@singbox-iac/cli 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-en.md +67 -1
- package/README.md +66 -1
- package/dist/cli/commands/apply.js +5 -1
- package/dist/cli/commands/apply.js.map +1 -1
- package/dist/cli/commands/author.d.ts +3 -0
- package/dist/cli/commands/author.js +35 -3
- package/dist/cli/commands/author.js.map +1 -1
- package/dist/cli/commands/build.js +11 -0
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/check.js +5 -1
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doctor.js +12 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/proxifier.js +60 -5
- package/dist/cli/commands/proxifier.js.map +1 -1
- package/dist/cli/commands/reload.js +5 -1
- package/dist/cli/commands/reload.js.map +1 -1
- package/dist/cli/commands/restart.d.ts +2 -0
- package/dist/cli/commands/restart.js +57 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/rollback.js +6 -2
- package/dist/cli/commands/rollback.js.map +1 -1
- package/dist/cli/commands/run.js +5 -1
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/schedule.js +10 -2
- package/dist/cli/commands/schedule.js.map +1 -1
- package/dist/cli/commands/setup.js +90 -12
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.js +51 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +65 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +2 -0
- package/dist/cli/commands/stop.js +29 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/update.js +8 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/use.js +7 -0
- package/dist/cli/commands/use.js.map +1 -1
- package/dist/cli/commands/verify.js +15 -3
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/index.js +17 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/schema.d.ts +125 -0
- package/dist/config/schema.js +49 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/domain/runtime-mode.d.ts +10 -0
- package/dist/domain/runtime-mode.js +2 -0
- package/dist/domain/runtime-mode.js.map +1 -0
- package/dist/modules/authoring/index.d.ts +2 -0
- package/dist/modules/authoring/index.js +19 -5
- package/dist/modules/authoring/index.js.map +1 -1
- package/dist/modules/compiler/index.js +32 -14
- package/dist/modules/compiler/index.js.map +1 -1
- package/dist/modules/desktop-runtime/index.d.ts +48 -0
- package/dist/modules/desktop-runtime/index.js +183 -0
- package/dist/modules/desktop-runtime/index.js.map +1 -0
- package/dist/modules/doctor/index.d.ts +5 -0
- package/dist/modules/doctor/index.js +37 -8
- package/dist/modules/doctor/index.js.map +1 -1
- package/dist/modules/manager/index.d.ts +1 -1
- package/dist/modules/manager/index.js +6 -28
- package/dist/modules/manager/index.js.map +1 -1
- package/dist/modules/natural-language/index.d.ts +5 -0
- package/dist/modules/natural-language/index.js +52 -9
- package/dist/modules/natural-language/index.js.map +1 -1
- package/dist/modules/preview/index.d.ts +4 -0
- package/dist/modules/preview/index.js +3 -0
- package/dist/modules/preview/index.js.map +1 -1
- package/dist/modules/proxifier/index.d.ts +15 -4
- package/dist/modules/proxifier/index.js +146 -40
- package/dist/modules/proxifier/index.js.map +1 -1
- package/dist/modules/runtime-dependencies/index.d.ts +22 -0
- package/dist/modules/runtime-dependencies/index.js +114 -0
- package/dist/modules/runtime-dependencies/index.js.map +1 -0
- package/dist/modules/runtime-mode/index.d.ts +23 -0
- package/dist/modules/runtime-mode/index.js +86 -0
- package/dist/modules/runtime-mode/index.js.map +1 -0
- package/dist/modules/schedule/index.d.ts +1 -0
- package/dist/modules/schedule/index.js +1 -1
- package/dist/modules/schedule/index.js.map +1 -1
- package/dist/modules/status/index.d.ts +57 -0
- package/dist/modules/status/index.js +295 -0
- package/dist/modules/status/index.js.map +1 -0
- package/dist/modules/update/index.js +5 -3
- package/dist/modules/update/index.js.map +1 -1
- package/dist/modules/verification/index.d.ts +1 -1
- package/dist/modules/verification/index.js +6 -12
- package/dist/modules/verification/index.js.map +1 -1
- package/docs/natural-language-authoring.md +36 -0
- package/docs/proxifier-onboarding.md +14 -0
- package/docs/runtime-on-macos.md +36 -0
- package/examples/builder.config.yaml +9 -0
- package/package.json +2 -1
|
@@ -178,12 +178,48 @@ and writes a new staging config.
|
|
|
178
178
|
|
|
179
179
|
With `--preview`, the command does not write anything. Instead it prints:
|
|
180
180
|
|
|
181
|
+
- Intent IR diff
|
|
181
182
|
- rules diff
|
|
182
183
|
- builder config diff
|
|
183
184
|
- staging config diff
|
|
184
185
|
|
|
185
186
|
This is the safest way to inspect what a prompt or local AI CLI would change before touching your local files.
|
|
186
187
|
|
|
188
|
+
## Audit-Friendly Flags
|
|
189
|
+
|
|
190
|
+
Use these flags when you want stronger control over one-sentence authoring:
|
|
191
|
+
|
|
192
|
+
- `--strict`
|
|
193
|
+
Reject vague language instead of guessing. This is recommended for production changes.
|
|
194
|
+
- `--diff`
|
|
195
|
+
Print the `IntentIR` diff, rules diff, builder config diff, and staging config diff without writing files.
|
|
196
|
+
- `--emit-intent-ir`
|
|
197
|
+
Print the generated `IntentIR` JSON and exit without touching local files.
|
|
198
|
+
|
|
199
|
+
Examples:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
./node_modules/.bin/tsx src/cli/index.ts use \
|
|
203
|
+
'GitHub 这类开发类都走香港,Gemini 走新加坡' \
|
|
204
|
+
--strict --diff
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
./node_modules/.bin/tsx src/cli/index.ts author \
|
|
209
|
+
--config ./builder.config.local.yaml \
|
|
210
|
+
--prompt 'OpenRouter 走香港' \
|
|
211
|
+
--emit-intent-ir
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
In strict mode, the command rejects prompts like:
|
|
215
|
+
|
|
216
|
+
- `快一点`
|
|
217
|
+
- `大部分`
|
|
218
|
+
- `差不多`
|
|
219
|
+
- `AI 都走好一点的节点`
|
|
220
|
+
|
|
221
|
+
Those phrases are too vague to compile into a stable routing policy.
|
|
222
|
+
|
|
187
223
|
## Exec Provider
|
|
188
224
|
|
|
189
225
|
The `exec` provider is the escape hatch for developer machines that already have local AI tooling.
|
|
@@ -18,6 +18,8 @@ Typical files:
|
|
|
18
18
|
- `bundles/antigravity.txt`
|
|
19
19
|
- `bundles/cursor.txt`
|
|
20
20
|
- `bundles/developer-ai-cli.txt`
|
|
21
|
+
- `bundle-specs/antigravity.yaml`
|
|
22
|
+
- `bundle-specs/cursor.yaml`
|
|
21
23
|
- `all-processes.txt`
|
|
22
24
|
|
|
23
25
|
## Fast Path
|
|
@@ -44,6 +46,18 @@ To see the supported bundle presets:
|
|
|
44
46
|
singbox-iac proxifier bundles
|
|
45
47
|
```
|
|
46
48
|
|
|
49
|
+
To inspect one declarative bundle:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
singbox-iac proxifier bundles show antigravity
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To render one bundle spec as YAML:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
singbox-iac proxifier bundles render antigravity
|
|
59
|
+
```
|
|
60
|
+
|
|
47
61
|
## Endpoint
|
|
48
62
|
|
|
49
63
|
By default the process-aware listener is:
|
package/docs/runtime-on-macos.md
CHANGED
|
@@ -7,6 +7,7 @@ The target runtime is a headless macOS deployment:
|
|
|
7
7
|
- `sing-box` installed separately
|
|
8
8
|
- this CLI generates and validates config
|
|
9
9
|
- `launchd` handles periodic updates
|
|
10
|
+
- a dedicated runtime LaunchAgent can keep `sing-box` running in desktop mode
|
|
10
11
|
|
|
11
12
|
## Planned Flow
|
|
12
13
|
|
|
@@ -22,6 +23,9 @@ The target runtime is a headless macOS deployment:
|
|
|
22
23
|
singbox-iac go '<url>' '<一句话策略>'
|
|
23
24
|
singbox-iac use '<新的需求描述>'
|
|
24
25
|
singbox-iac update
|
|
26
|
+
singbox-iac start
|
|
27
|
+
singbox-iac stop
|
|
28
|
+
singbox-iac status
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
Advanced commands remain available for debugging or fine-grained control:
|
|
@@ -33,13 +37,45 @@ singbox-iac author
|
|
|
33
37
|
singbox-iac build
|
|
34
38
|
singbox-iac verify
|
|
35
39
|
singbox-iac schedule install
|
|
40
|
+
singbox-iac restart
|
|
36
41
|
```
|
|
37
42
|
|
|
43
|
+
## Desktop Runtime Profiles
|
|
44
|
+
|
|
45
|
+
The builder config now persists an internal desktop runtime profile:
|
|
46
|
+
|
|
47
|
+
- `system-proxy`
|
|
48
|
+
- `in-mixed` is still used
|
|
49
|
+
- `set_system_proxy: true` is emitted so `sing-box` can set and clean the macOS system proxy
|
|
50
|
+
- `tun`
|
|
51
|
+
- a `tun` inbound is emitted
|
|
52
|
+
- `auto_route` is enabled
|
|
53
|
+
- this is closer to the "global capture" experience of GUI clients
|
|
54
|
+
|
|
55
|
+
During onboarding, prompts that mention `TUN`, `全局代理`, or `全局模式` are inferred as `tun`; otherwise the default is `system-proxy`.
|
|
56
|
+
|
|
57
|
+
## Runtime Control
|
|
58
|
+
|
|
59
|
+
Use the dedicated runtime commands for GUI-like everyday control:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
singbox-iac start
|
|
63
|
+
singbox-iac stop
|
|
64
|
+
singbox-iac restart
|
|
65
|
+
singbox-iac status
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `start` writes or refreshes a dedicated runtime LaunchAgent and boots it
|
|
69
|
+
- `stop` unloads and removes that runtime LaunchAgent
|
|
70
|
+
- `restart` replaces the runtime LaunchAgent
|
|
71
|
+
- `status` reports `sing-box` binary resolution, live config presence, desktop runtime state, system proxy/TUN hints, scheduler state, and recent transactions
|
|
72
|
+
|
|
38
73
|
## Launchd Notes
|
|
39
74
|
|
|
40
75
|
- In source-tree development, `schedule install` emits a LaunchAgent that runs `node_modules/.bin/tsx src/cli/index.ts update --config <path>`.
|
|
41
76
|
- In built distributions, the same logic emits a LaunchAgent that runs the compiled CLI entrypoint with `node`.
|
|
42
77
|
- Use `--no-load` during testing to validate the generated plist without calling `launchctl bootstrap`.
|
|
78
|
+
- Desktop runtime uses a separate LaunchAgent label from the update scheduler.
|
|
43
79
|
|
|
44
80
|
## Why `launchd`
|
|
45
81
|
|
|
@@ -17,6 +17,15 @@ runtime:
|
|
|
17
17
|
kind: "signal"
|
|
18
18
|
processName: "sing-box"
|
|
19
19
|
signal: "HUP"
|
|
20
|
+
desktop:
|
|
21
|
+
profile: "system-proxy"
|
|
22
|
+
launchAgentLabel: "org.singbox-iac.runtime"
|
|
23
|
+
tun:
|
|
24
|
+
autoRoute: true
|
|
25
|
+
strictRoute: false
|
|
26
|
+
addresses:
|
|
27
|
+
- "172.19.0.1/30"
|
|
28
|
+
- "fdfe:dcba:9876::1/126"
|
|
20
29
|
|
|
21
30
|
listeners:
|
|
22
31
|
mixed:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singbox-iac/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Policy-first subscription compiler for sing-box on macOS.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"prepack": "npm run build",
|
|
47
47
|
"release:check": "node ./scripts/release-check.mjs",
|
|
48
48
|
"release:dry-run": "node ./scripts/release-dry-run.mjs",
|
|
49
|
+
"fixtures:regenerate": "tsx tests/regression/generate-fixtures.ts",
|
|
49
50
|
"test": "vitest run",
|
|
50
51
|
"test:watch": "vitest",
|
|
51
52
|
"lint": "biome check .",
|