Skip to content

Commit 71bfdcb

Browse files
CopilotNitload-NSI
andauthored
feat: add stgsharp.vss.dev bootstrap repository scaffold
Co-authored-by: Nitload-NSI <105042599+Nitload-NSI@users.noreply.github.com> Agent-Logs-Url: https://github.com/Nitload-NSI/StgSharp/sessions/df8577c4-3892-4f56-9ed5-47acbd4fc7b6
1 parent 3c0ab7a commit 71bfdcb

17 files changed

Lines changed: 574 additions & 0 deletions

stgsharp.vss.dev/.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[*]
2+
end_of_line = lf
3+
charset = utf-8
4+
insert_final_newline = true
5+
trim_trailing_whitespace = true
6+
7+
[*.{bat,cmd,ps1}]
8+
end_of_line = crlf
9+
10+
[*.cs]
11+
# CS1591: 缺少对公共可见类型或成员的 XML 注释
12+
dotnet_diagnostic.CS1591.severity = suggestion

stgsharp.vss.dev/.filenesting.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"help":"https://go.microsoft.com/fwlink/?linkid=866610"
3+
}

stgsharp.vss.dev/.gitattributes

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ══════════════════════════════════════════════
2+
# stgsharp.vss.dev line ending policy
3+
#
4+
# 仓库内统一 LF(Linux 编译兼容)
5+
# Windows 上 checkout 时 Git 自动转 CRLF
6+
# VS2022 / Rider / VSCode 都认这个文件
7+
# ══════════════════════════════════════════════
8+
9+
# ── 默认:所有文本文件入库 LF ──
10+
* text=auto eol=lf
11+
12+
# ── 源码 ──
13+
*.cs text eol=lf
14+
*.c text eol=lf
15+
*.cpp text eol=lf
16+
*.h text eol=lf
17+
*.hpp text eol=lf
18+
19+
# ── .NET 项目文件 ──
20+
*.csproj text eol=lf
21+
*.sln text eol=lf
22+
*.props text eol=lf
23+
*.targets text eol=lf
24+
25+
# ── 配置 / 文档 ──
26+
*.json text eol=lf
27+
*.xml text eol=lf
28+
*.config text eol=lf
29+
*.yml text eol=lf
30+
*.yaml text eol=lf
31+
*.md text eol=lf
32+
*.txt text eol=lf
33+
34+
# ── 构建脚本 ──
35+
*.sh text eol=lf
36+
*.bash text eol=lf
37+
*.cmake text eol=lf
38+
CMakeLists.txt text eol=lf
39+
40+
# ── Windows 脚本(这几个必须 CRLF 否则 cmd 会出问题)──
41+
*.bat text eol=crlf
42+
*.cmd text eol=crlf
43+
*.ps1 text eol=crlf
44+
45+
# ── 二进制:不动 ──
46+
*.png binary
47+
*.jpg binary
48+
*.jpeg binary
49+
*.gif binary
50+
*.ico binary
51+
*.dll binary
52+
*.exe binary
53+
*.pdb binary
54+
*.so binary
55+
*.dylib binary
56+
*.lib binary
57+
*.obj binary
58+
*.a binary
59+
*.zip binary
60+
*.7z binary
61+
*.gz binary

stgsharp.vss.dev/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/build
2+
/.idea
3+
/.vs
4+
/.vscode
5+
*/obj
6+
*/bin
7+
*/build
8+
*/Debug
9+
*/Release
10+
/TestResults
11+
*/x64
12+
*/.vs
13+
obj
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<Project>
2+
3+
<!-- ════════════════════════════════════════════════════════ -->
4+
<!-- 全局属性:所有 C# 项目共享 -->
5+
<!-- ════════════════════════════════════════════════════════ -->
6+
<PropertyGroup>
7+
<TargetFramework>net8.0</TargetFramework>
8+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
9+
<LangVersion>Preview</LangVersion>
10+
<Nullable>enable</Nullable>
11+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
12+
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
13+
<EnableNETAnalyzers>True</EnableNETAnalyzers>
14+
<AnalysisLevel>preview-all</AnalysisLevel>
15+
<Platforms>x64;ARM64</Platforms>
16+
<Configurations>Debug;Release</Configurations>
17+
<!-- CA1716: Start/Stop is intentional VSS lifecycle API (C#-only project) -->
18+
<NoWarn>1701;1702;0649;1591;0169;CA1716</NoWarn>
19+
20+
<!-- 包信息 -->
21+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
22+
<PackageProjectUrl>https://github.com/Nitload-NSI/stgsharp.vss.dev</PackageProjectUrl>
23+
<RepositoryUrl>https://github.com/Nitload-NSI/stgsharp.vss.dev.git</RepositoryUrl>
24+
</PropertyGroup>
25+
26+
<!-- ════════════════════════════════════════════════════════ -->
27+
<!-- Configuration × Platform 属性 -->
28+
<!-- 在这里统一定义,各项目 csproj 不再重复 -->
29+
<!-- ════════════════════════════════════════════════════════ -->
30+
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
31+
<Optimize>False</Optimize>
32+
<DebugType>portable</DebugType>
33+
<Deterministic>False</Deterministic>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
37+
<Optimize>True</Optimize>
38+
<DebugType>none</DebugType>
39+
<Deterministic>False</Deterministic>
40+
</PropertyGroup>
41+
42+
<!-- ════════════════════════════════════════════════════════ -->
43+
<!-- 路径约定 -->
44+
<!-- ════════════════════════════════════════════════════════ -->
45+
<PropertyGroup>
46+
<!-- 解决方案根目录(自动向上查找本文件来确定) -->
47+
<SolutionRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Directory.Build.props'))\</SolutionRoot>
48+
</PropertyGroup>
49+
50+
<!-- ════════════════════════════════════════════════════════ -->
51+
<!-- OS / Arch 检测(编译机器,用于条件编译) -->
52+
<!-- ════════════════════════════════════════════════════════ -->
53+
<PropertyGroup>
54+
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
55+
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
56+
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
57+
</PropertyGroup>
58+
59+
<!-- ════════════════════════════════════════════════════════ -->
60+
<!-- OS 条件编译符号 -->
61+
<!-- ════════════════════════════════════════════════════════ -->
62+
<PropertyGroup Condition="'$(IsWindows)'=='true'">
63+
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
64+
</PropertyGroup>
65+
<PropertyGroup Condition="'$(IsOSX)'=='true'">
66+
<DefineConstants>$(DefineConstants);OSX</DefineConstants>
67+
</PropertyGroup>
68+
<PropertyGroup Condition="'$(IsLinux)'=='true'">
69+
<DefineConstants>$(DefineConstants);LINUX</DefineConstants>
70+
</PropertyGroup>
71+
72+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project>
2+
3+
<!-- ════════════════════════════════════════════════════════ -->
4+
<!-- 编译后:把输出拷贝到 build/<configuration>/ 目录 -->
5+
<!-- ════════════════════════════════════════════════════════ -->
6+
<Target Name="CopyOutputToBuildDir"
7+
AfterTargets="Build"
8+
Condition="'$(DisablePostBuildCopy)'!='true'">
9+
10+
<PropertyGroup>
11+
<_BuildOutDir>$(SolutionRoot)build\$(Configuration)\</_BuildOutDir>
12+
</PropertyGroup>
13+
14+
<MakeDir Directories="$(_BuildOutDir)" />
15+
16+
<ItemGroup>
17+
<_OutputFiles Include="$(OutputPath)**\*.*"
18+
Exclude="$(OutputPath)**\*.user" />
19+
</ItemGroup>
20+
21+
<Copy SourceFiles="@(_OutputFiles)"
22+
DestinationFolder="$(_BuildOutDir)%(RecursiveDir)"
23+
SkipUnchangedFiles="true" />
24+
25+
<Message Importance="high"
26+
Text="[VssDev] $(MSBuildProjectName) → $(_BuildOutDir)" />
27+
</Target>
28+
29+
</Project>

stgsharp.vss.dev/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Nitload-NSI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

stgsharp.vss.dev/README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# stgsharp.vss.dev
2+
3+
VSS architecture development repository — upstream development bed for
4+
[`StgSharp.UserInterface`](https://github.com/Nitload-NSI/StgSharp).
5+
6+
## What is this repository?
7+
8+
`stgsharp.vss.dev` is a focused, standalone development repository for the
9+
**VSS (View–State–Service)** architecture pattern.
10+
11+
Its role in the StgSharp ecosystem mirrors the relationship between Fedora and RHEL:
12+
new VSS type primitives, interface contracts and architecture experiments are developed
13+
and stabilised here first, then upstreamed into the main `StgSharp` repository once proven
14+
in production.
15+
16+
```
17+
stgsharp.vss.dev ──────────────────→ Nitload-NSI/StgSharp
18+
(upstream dev bed) back-flow (main release repo)
19+
```
20+
21+
## Repository layout
22+
23+
```
24+
stgsharp.vss.dev/
25+
├── VssDev.Core/ # VSS type scaffold (Intent, StateSnapshot, adapters …)
26+
├── Directory.Build.props # shared MSBuild properties (net8.0, LangVersion preview …)
27+
├── Directory.Build.targets # shared post-build copy target
28+
├── .editorconfig # editor conventions (UTF-8, LF, CS1591 suggestion)
29+
├── .gitattributes # line-ending policy (LF repo-wide, CRLF for .bat/.cmd/.ps1)
30+
├── .gitignore # standard .NET ignore list
31+
├── LICENSE # MIT
32+
└── stgsharp.vss.dev.sln # Visual Studio solution
33+
```
34+
35+
## Upstream / downstream boundaries
36+
37+
| What belongs here | What belongs in StgSharp |
38+
|---|---|
39+
| VSS interface contracts (`IInputAdapter`, `IOutputAdapter`, `IVssState`) | Stable, versioned releases of those contracts |
40+
| `Intent` / `StateSnapshot` base types and related utilities | Published NuGet packages (future) |
41+
| Architecture experiments and proof-of-concept implementations | Graphics / mathematics / native interop |
42+
| Production VSS state machines and service adapters (company project layer) ||
43+
44+
**Rule**: generic improvements flow *up* to StgSharp. Business-specific code stays here.
45+
46+
## VSS Architecture overview
47+
48+
VSS separates an application into three layers with strictly one-way knowledge:
49+
50+
```
51+
V (View / I/O adapters)
52+
↓ Intent ↑ StateSnapshot
53+
S (State machine — sole owner of application state)
54+
↓ Command ↑ Event
55+
S (Service layer — devices, I/O, long-running work)
56+
```
57+
58+
See [`StgSharp.UserInterface/VSS_Arch.md`](https://github.com/Nitload-NSI/StgSharp/blob/main/StgSharp.UserInterface/VSS_Arch.md)
59+
for the full design rationale.
60+
61+
## Requirements
62+
63+
- .NET 8.0 SDK or later
64+
- Windows 10/11 or Linux
65+
- x64 or ARM64 architecture
66+
67+
## Getting started
68+
69+
### Clone and build
70+
71+
```bash
72+
git clone https://github.com/Nitload-NSI/stgsharp.vss.dev.git vssdev
73+
cd vssdev
74+
dotnet build
75+
```
76+
77+
### Connect a local repository named `vssdev` to the remote
78+
79+
If you have already initialised a local repository:
80+
81+
```bash
82+
# inside your local vssdev directory
83+
git remote add origin https://github.com/Nitload-NSI/stgsharp.vss.dev.git
84+
git fetch origin
85+
git checkout -b main --track origin/main
86+
# push your first commit
87+
git push -u origin main
88+
```
89+
90+
Or start fresh:
91+
92+
```bash
93+
mkdir vssdev && cd vssdev
94+
git init -b main
95+
git remote add origin https://github.com/Nitload-NSI/stgsharp.vss.dev.git
96+
# copy bootstrap files, then:
97+
git add .
98+
git commit -m "chore: initial repository bootstrap"
99+
git push -u origin main
100+
```
101+
102+
## License
103+
104+
MIT — see [LICENSE](LICENSE).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Threading;
4+
global using System.Threading.Tasks;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace VssDev.Core;
2+
3+
/// <summary>
4+
/// Adapts a specific input source (mouse, keyboard, hardware button panel, serial device, etc.)
5+
/// into a stream of <see cref="Intent"/> values delivered to the state machine.
6+
/// </summary>
7+
/// <remarks>
8+
/// <para>
9+
/// An input adapter is the boundary between the physical world and VSS application logic.
10+
/// Its only job is to translate raw signals into <see cref="Intent"/> objects and forward them
11+
/// via the <c>dispatch</c> delegate — no semantic interpretation should happen here.
12+
/// </para>
13+
/// <para>
14+
/// Implementations may run on any thread; <c>dispatch</c> is guaranteed to be thread-safe
15+
/// because the state machine's internal <c>Channel&lt;Intent&gt;</c> is written atomically.
16+
/// </para>
17+
/// </remarks>
18+
public interface IInputAdapter
19+
{
20+
/// <summary>
21+
/// Starts the adapter and registers the dispatch entry point.
22+
/// </summary>
23+
/// <param name="dispatch">
24+
/// Delegate provided by <see cref="IVssState"/> used to enqueue each arriving
25+
/// <see cref="Intent"/>. Must not be <see langword="null"/>.
26+
/// </param>
27+
void Start(Action<Intent> dispatch);
28+
29+
/// <summary>Stops input collection and releases all resources held by the adapter.</summary>
30+
void Stop();
31+
}

0 commit comments

Comments
 (0)