docks-kit 0.22.28 → 0.23.0
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/AGENTS.md +31 -77
- package/README.md +31 -58
- package/cli/docs/command-guards.md +231 -197
- package/cli/docs/flags.md +25 -55
- package/cli/docs/install.md +2 -3
- package/cli/docs/omp-models.md +9 -0
- package/cli/docs/overview.md +4 -12
- package/cli/docs/platforms.md +2 -2
- package/cli/docs/sync-layers.md +10 -57
- package/cli/docs/toolchain.md +9 -78
- package/cli/src/argv.ts +0 -8
- package/cli/src/argvValidate.ts +2 -46
- package/cli/src/commands/docs.ts +2 -14
- package/cli/src/commands/harnesses.ts +6 -9
- package/cli/src/commands/sync.ts +5 -99
- package/cli/src/commands/toolchain.ts +4 -12
- package/cli/src/engine-native/DESIGN.md +67 -88
- package/cli/src/engine-native/deps.ts +6 -86
- package/cli/src/engine-native/engineCtx.ts +7 -76
- package/cli/src/engine-native/exec.ts +1 -18
- package/cli/src/engine-native/harnesses.ts +6 -6
- package/cli/src/engine-native/index.ts +4 -6
- package/cli/src/engine-native/jq.ts +4 -37
- package/cli/src/engine-native/modes.ts +3 -132
- package/cli/src/engine-native/os/darwin.ts +0 -4
- package/cli/src/engine-native/os/index.ts +1 -2
- package/cli/src/engine-native/os/linux.ts +0 -3
- package/cli/src/engine-native/os/posix.ts +2 -46
- package/cli/src/engine-native/os/types.ts +1 -32
- package/cli/src/engine-native/os/windows.ts +0 -49
- package/cli/src/engine-native/parseArgs.ts +11 -124
- package/cli/src/engine-native/parseHelp.ts +5 -40
- package/cli/src/engine-native/scratch.ts +1 -1
- package/cli/src/engine-native/services.ts +1 -2
- package/cli/src/engine-native/sharedTypes.d.ts +0 -40
- package/cli/src/engine-native/skillsSync.ts +1 -1
- package/cli/src/engine-native/syncConcurrency.ts +3 -15
- package/cli/src/engine-native/syncDispatch.ts +10 -57
- package/cli/src/engine-native/toolchain.ts +5 -40
- package/cli/src/engine.ts +0 -75
- package/cli/src/generated/sotPayload.ts +12 -39
- package/cli/src/main.ts +7 -19
- package/cli/src/manifests.ts +1 -93
- package/cli/src/payload.ts +2 -8
- package/cli/tsconfig.json +1 -3
- package/package.json +3 -5
- package/cli/docs/models.md +0 -58
- package/cli/docs/modifiers.md +0 -52
- package/cli/docs/plugins.md +0 -70
- package/cli/src/commands/model.ts +0 -68
- package/cli/src/commands/models.ts +0 -75
- package/cli/src/commands/plugins.ts +0 -35
- package/cli/src/commands/status.ts +0 -206
- package/cli/src/efforts.ts +0 -89
- package/cli/src/engine-native/claudeLsp.ts +0 -301
- package/cli/src/engine-native/claudeOptionalPlugins.ts +0 -126
- package/cli/src/engine-native/claudePluginPasses.ts +0 -426
- package/cli/src/engine-native/claudeRemovals.ts +0 -383
- package/cli/src/engine-native/claudeRetired.ts +0 -165
- package/cli/src/engine-native/claudeRuntime.ts +0 -157
- package/cli/src/engine-native/claudeSettings.ts +0 -201
- package/cli/src/engine-native/claudeSettingsModifiers.ts +0 -115
- package/cli/src/engine-native/claudeSync.ts +0 -312
- package/cli/src/engine-native/codexConfig.ts +0 -214
- package/cli/src/engine-native/codexHooks.ts +0 -91
- package/cli/src/engine-native/codexPaths.ts +0 -14
- package/cli/src/engine-native/codexPlugins.ts +0 -315
- package/cli/src/engine-native/codexStatus.ts +0 -25
- package/cli/src/engine-native/codexSync.ts +0 -314
- package/cli/src/engine-native/codexToml.ts +0 -303
- package/cli/src/engine-native/liveModels.ts +0 -264
- package/cli/src/engine-native/models.ts +0 -101
- package/cli/src/engine-native/parseModifiers.ts +0 -225
- package/cli/src/engine-native/settings.ts +0 -42
- package/cli/src/engine-native/tomlLines.ts +0 -92
|
@@ -2,15 +2,6 @@ import { win32 } from "node:path";
|
|
|
2
2
|
import { p } from "../exec";
|
|
3
3
|
import type { HostOs } from "./types";
|
|
4
4
|
|
|
5
|
-
function powershellLiteral(value: string): string {
|
|
6
|
-
return `'${value.replace(/['\u2018\u2019\u201A\u201B]/g, "$&$&")}'`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function encodedPowerShellCommand(script: string): string {
|
|
10
|
-
const encoded = Buffer.from(script, "utf16le").toString("base64");
|
|
11
|
-
return `powershell.exe -NoProfile -NonInteractive -EncodedCommand ${encoded}`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
/**
|
|
15
6
|
* Windows shim encoding handles three hazards: Windows argv parsing, cmd
|
|
16
7
|
* metacharacter parsing, and percent/newline values that cmd cannot escape.
|
|
@@ -101,7 +92,6 @@ function commandShimInvocation(executablePath: string, args: ReadonlyArray<strin
|
|
|
101
92
|
export const windows: HostOs = {
|
|
102
93
|
id: "windows",
|
|
103
94
|
toolchainOs: "windows",
|
|
104
|
-
supportsBubblewrap: false,
|
|
105
95
|
directoryLinkKinds: ["symlink", "junction"],
|
|
106
96
|
executableSuffixes: [".exe", ".cmd", ".bat", ""],
|
|
107
97
|
invoke: (executablePath, args) =>
|
|
@@ -132,39 +122,6 @@ export const windows: HostOs = {
|
|
|
132
122
|
},
|
|
133
123
|
};
|
|
134
124
|
},
|
|
135
|
-
environmentSetting: (name, value) => ({
|
|
136
|
-
kind: "command",
|
|
137
|
-
probe: {
|
|
138
|
-
command: "reg",
|
|
139
|
-
args: ["query", "HKCU\\Environment", "/v", name],
|
|
140
|
-
},
|
|
141
|
-
apply: {
|
|
142
|
-
command: "setx",
|
|
143
|
-
args: [name, value],
|
|
144
|
-
},
|
|
145
|
-
location: "user environment",
|
|
146
|
-
manualHint: "set it manually in System Properties > Environment Variables",
|
|
147
|
-
}),
|
|
148
|
-
statusLineCommand: (bun, script) => {
|
|
149
|
-
const bunLiteral = powershellLiteral(bun);
|
|
150
|
-
const scriptLiteral = powershellLiteral(script);
|
|
151
|
-
// Module auto-loading reports "Preparing modules for first use" as a
|
|
152
|
-
// progress record, which a redirected host serializes to stderr as CLIXML.
|
|
153
|
-
// Claude runs this command every turn, and the records recur across runs, so
|
|
154
|
-
// silencing progress inside the stored command keeps its streams clean.
|
|
155
|
-
return encodedPowerShellCommand(
|
|
156
|
-
`$ProgressPreference = 'SilentlyContinue'; if ((Test-Path -LiteralPath ${bunLiteral} -PathType Leaf) -and (Test-Path -LiteralPath ${scriptLiteral} -PathType Leaf)) { & ${bunLiteral} ${scriptLiteral} }`,
|
|
157
|
-
);
|
|
158
|
-
},
|
|
159
|
-
failureHookCommand: (command) => {
|
|
160
|
-
const prefix = "echo '";
|
|
161
|
-
if (!command.startsWith(prefix) || !command.endsWith("'")) return command;
|
|
162
|
-
const quotedPayload = command.slice(prefix.length, -1);
|
|
163
|
-
const posixApostrophe = `'"'"'`;
|
|
164
|
-
if (quotedPayload.replaceAll(posixApostrophe, "").includes("'")) return command;
|
|
165
|
-
const payload = quotedPayload.replaceAll(posixApostrophe, "'");
|
|
166
|
-
return encodedPowerShellCommand(`Write-Output ${powershellLiteral(payload)}`);
|
|
167
|
-
},
|
|
168
125
|
installHint: (tool) => {
|
|
169
126
|
switch (tool) {
|
|
170
127
|
case "git":
|
|
@@ -173,12 +130,6 @@ export const windows: HostOs = {
|
|
|
173
130
|
return "winget install --id jqlang.jq -e";
|
|
174
131
|
case "curl":
|
|
175
132
|
return "winget install --id cURL.cURL -e";
|
|
176
|
-
case "ffplay":
|
|
177
|
-
return "winget install --id Gyan.FFmpeg -e";
|
|
178
|
-
case "claude":
|
|
179
|
-
return "$tmp = Join-Path $env:TEMP 'claude-install.ps1'; curl.exe -fsSL https://claude.ai/install.ps1 -o $tmp; if ($LASTEXITCODE -eq 0) { powershell.exe -NoProfile -ExecutionPolicy Bypass -File $tmp }";
|
|
180
|
-
case "codex":
|
|
181
|
-
return "$tmp = Join-Path $env:TEMP 'codex-install.ps1'; curl.exe -fsSL https://chatgpt.com/codex/install.ps1 -o $tmp; if ($LASTEXITCODE -eq 0) { $env:CODEX_NON_INTERACTIVE = '1'; powershell.exe -NoProfile -ExecutionPolicy Bypass -File $tmp }";
|
|
182
133
|
}
|
|
183
134
|
},
|
|
184
135
|
};
|
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* EngineNative flag layer: target selection and the argv dispatch loop.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `from "./parseArgs"` imports keep working).
|
|
3
|
+
* Help text and the early-exit error live in parseHelp.ts (re-exported here
|
|
4
|
+
* so existing `from "./parseArgs"` imports keep working).
|
|
6
5
|
*/
|
|
7
6
|
import type { Ctx } from "./index";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { printModels } from "./models";
|
|
11
|
-
import { curatedCatalog } from "./liveModels";
|
|
12
|
-
import { ExitError, printCatalog, printUsage } from "./parseHelp";
|
|
13
|
-
import {
|
|
14
|
-
KNOWN_CLAUDE_OPTIN_PLUGINS,
|
|
15
|
-
addClaudePlugin,
|
|
16
|
-
isScalarModifierFlag,
|
|
17
|
-
markModifier,
|
|
18
|
-
parseCompactWindow,
|
|
19
|
-
setModifier,
|
|
20
|
-
} from "./parseModifiers";
|
|
7
|
+
import { DEFAULT_SELECTION, readHarnessSelection, type Harness } from "./harnesses";
|
|
8
|
+
import { ExitError, printUsage } from "./parseHelp";
|
|
21
9
|
|
|
22
10
|
export { ExitError } from "./parseHelp";
|
|
23
|
-
export {
|
|
24
|
-
KNOWN_CLAUDE_OPTIN_PLUGINS,
|
|
25
|
-
parseClaudePlugin,
|
|
26
|
-
parseCompactWindow,
|
|
27
|
-
validateModifierFlags,
|
|
28
|
-
} from "./parseModifiers";
|
|
29
11
|
|
|
30
|
-
type TargetFlag = "
|
|
12
|
+
type TargetFlag = "syncAgents" | "syncOmp";
|
|
31
13
|
|
|
32
14
|
const TARGET_FLAGS = {
|
|
33
|
-
claude: "syncClaude",
|
|
34
|
-
codex: "syncCodex",
|
|
35
15
|
agents: "syncAgents",
|
|
36
16
|
omp: "syncOmp",
|
|
37
17
|
} satisfies Record<Harness, TargetFlag>;
|
|
@@ -42,18 +22,9 @@ const TARGET_FLAGS = {
|
|
|
42
22
|
* text, so the two paths cannot drift.
|
|
43
23
|
*/
|
|
44
24
|
export const LEGACY_FLAG_HINTS = {
|
|
45
|
-
"--claude": "--claude was renamed: pass the target as a word, e.g. 'sync claude'",
|
|
46
|
-
"--codex": "--codex was renamed: pass the target as a word, e.g. 'sync codex'",
|
|
47
25
|
"--agents": "--agents was renamed: pass the target as a word, e.g. 'sync agents'",
|
|
48
26
|
"--omp": "--omp was renamed: pass the target as a word, e.g. 'sync omp'",
|
|
49
|
-
"--
|
|
50
|
-
"--remove-plugins":
|
|
51
|
-
"--remove-plugins was renamed to --prune (it also removes marketplaces + kit-managed skills)",
|
|
52
|
-
"--680k": "--680k was renamed to --claude-compact-window=680k",
|
|
53
|
-
"--permissive": "--permissive was renamed to --claude-permissive",
|
|
54
|
-
"--supabase": "--supabase was renamed to --claude-plugin=supabase",
|
|
55
|
-
"--n8n": "--n8n was renamed to --claude-plugin=n8n",
|
|
56
|
-
"--skip-rtk": "--skip-rtk was renamed to --skip-bubblewrap",
|
|
27
|
+
"--remove-plugins": "--remove-plugins was renamed to --prune",
|
|
57
28
|
} as const satisfies Record<string, string>;
|
|
58
29
|
|
|
59
30
|
type LegacyFlag = keyof typeof LEGACY_FLAG_HINTS;
|
|
@@ -68,8 +39,6 @@ function selectTarget(ctx: Ctx, target: Harness): void {
|
|
|
68
39
|
}
|
|
69
40
|
|
|
70
41
|
function applySelection(ctx: Ctx, selection: ReadonlyArray<Harness>): void {
|
|
71
|
-
ctx.syncClaude = selection.includes("claude");
|
|
72
|
-
ctx.syncCodex = selection.includes("codex");
|
|
73
42
|
ctx.syncAgents = selection.includes("agents");
|
|
74
43
|
ctx.syncOmp = selection.includes("omp");
|
|
75
44
|
}
|
|
@@ -78,25 +47,17 @@ function applyDefaultSelection(ctx: Ctx): void {
|
|
|
78
47
|
if (ctx.targetFilterSet) return;
|
|
79
48
|
|
|
80
49
|
const storedSelection = readHarnessSelection(ctx.home);
|
|
81
|
-
applySelection(ctx, storedSelection ??
|
|
50
|
+
applySelection(ctx, storedSelection ?? DEFAULT_SELECTION);
|
|
82
51
|
if (storedSelection !== undefined || !ctx.interactive) return;
|
|
83
52
|
|
|
84
|
-
ctx.services.logger.echo(
|
|
53
|
+
ctx.services.logger.echo(`No harness selection stored; syncing ${DEFAULT_SELECTION.join(", ")}`);
|
|
85
54
|
ctx.services.logger.echo("Choose harnesses with: docks-kit harnesses");
|
|
86
55
|
}
|
|
87
56
|
|
|
88
57
|
export function parseArgs(ctx: Ctx, args: ReadonlyArray<string>): void {
|
|
89
58
|
const { err } = ctx.services.logger;
|
|
90
|
-
for (
|
|
91
|
-
const arg = args[index] ?? "";
|
|
92
|
-
if (isScalarModifierFlag(arg) && args[index + 1] === "") {
|
|
93
|
-
setModifier(ctx, arg, "");
|
|
94
|
-
index += 1;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
59
|
+
for (const arg of args) {
|
|
97
60
|
switch (arg) {
|
|
98
|
-
case "claude":
|
|
99
|
-
case "codex":
|
|
100
61
|
case "agents":
|
|
101
62
|
case "omp":
|
|
102
63
|
selectTarget(ctx, arg);
|
|
@@ -104,101 +65,27 @@ export function parseArgs(ctx: Ctx, args: ReadonlyArray<string>): void {
|
|
|
104
65
|
case "--dry-run":
|
|
105
66
|
ctx.dryRun = true;
|
|
106
67
|
continue;
|
|
107
|
-
case "--skip-bubblewrap":
|
|
108
|
-
ctx.skipBubblewrap = true;
|
|
109
|
-
continue;
|
|
110
68
|
case "--skip-plugin-refresh":
|
|
111
69
|
ctx.skipPluginRefresh = true;
|
|
112
70
|
continue;
|
|
113
|
-
case "--reconcile":
|
|
114
|
-
ctx.reconcile = true;
|
|
115
|
-
continue;
|
|
116
71
|
case "--prune":
|
|
117
72
|
ctx.prune = true;
|
|
118
73
|
continue;
|
|
119
74
|
case "--verbose":
|
|
120
75
|
ctx.verbose = true;
|
|
121
76
|
continue;
|
|
122
|
-
case "--claude-model":
|
|
123
|
-
printModels(ctx, curatedCatalog("claude"));
|
|
124
|
-
err("--claude-model requires a value: --claude-model=<model>");
|
|
125
|
-
throw new ExitError(2);
|
|
126
|
-
case "--codex-model":
|
|
127
|
-
printModels(ctx, curatedCatalog("codex"));
|
|
128
|
-
err("--codex-model requires a value: --codex-model=<model>");
|
|
129
|
-
throw new ExitError(2);
|
|
130
|
-
case "--claude-effort":
|
|
131
|
-
printCatalog(ctx, effortCatalog("claude"));
|
|
132
|
-
err(`--claude-effort requires a value: ${effortFlagGrammar("claude")}`);
|
|
133
|
-
throw new ExitError(2);
|
|
134
|
-
case "--codex-effort":
|
|
135
|
-
printCatalog(ctx, effortCatalog("codex"));
|
|
136
|
-
err(`--codex-effort requires a value: ${effortFlagGrammar("codex")}`);
|
|
137
|
-
throw new ExitError(2);
|
|
138
|
-
case "--claude-advisor":
|
|
139
|
-
printCatalog(ctx, advisorCatalog());
|
|
140
|
-
err(`--claude-advisor requires a value: ${advisorFlagGrammar()}`);
|
|
141
|
-
throw new ExitError(2);
|
|
142
|
-
case "--claude-compact-window":
|
|
143
|
-
err(
|
|
144
|
-
"--claude-compact-window requires a value: --claude-compact-window=<tokens> (e.g. 680k)",
|
|
145
|
-
);
|
|
146
|
-
throw new ExitError(2);
|
|
147
|
-
case "--claude-permissive":
|
|
148
|
-
ctx.claudePermissive = true;
|
|
149
|
-
markModifier(ctx, "--claude-permissive");
|
|
150
|
-
continue;
|
|
151
|
-
case "--claude-plugin":
|
|
152
|
-
err(
|
|
153
|
-
`--claude-plugin requires a value: --claude-plugin=<${KNOWN_CLAUDE_OPTIN_PLUGINS.join("|")}>`,
|
|
154
|
-
);
|
|
155
|
-
throw new ExitError(2);
|
|
156
|
-
case "--claude":
|
|
157
|
-
case "--codex":
|
|
158
77
|
case "--agents":
|
|
159
78
|
case "--omp":
|
|
160
|
-
case "--force":
|
|
161
79
|
case "--remove-plugins":
|
|
162
|
-
case "--680k":
|
|
163
|
-
case "--permissive":
|
|
164
|
-
case "--supabase":
|
|
165
|
-
case "--n8n":
|
|
166
|
-
case "--skip-rtk":
|
|
167
80
|
err(LEGACY_FLAG_HINTS[arg]);
|
|
168
81
|
throw new ExitError(2);
|
|
169
82
|
case "-h":
|
|
170
83
|
case "--help":
|
|
171
|
-
printUsage(ctx
|
|
84
|
+
printUsage(ctx);
|
|
172
85
|
throw new ExitError(0);
|
|
173
86
|
default:
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
if (arg.startsWith("--claude-model=")) {
|
|
177
|
-
setModifier(ctx, "--claude-model", arg.slice("--claude-model=".length));
|
|
178
|
-
} else if (arg.startsWith("--codex-model=")) {
|
|
179
|
-
setModifier(ctx, "--codex-model", arg.slice("--codex-model=".length));
|
|
180
|
-
} else if (arg.startsWith("--claude-effort=")) {
|
|
181
|
-
setModifier(ctx, "--claude-effort", arg.slice("--claude-effort=".length));
|
|
182
|
-
} else if (arg.startsWith("--codex-effort=")) {
|
|
183
|
-
setModifier(ctx, "--codex-effort", arg.slice("--codex-effort=".length));
|
|
184
|
-
} else if (arg.startsWith("--claude-advisor=")) {
|
|
185
|
-
setModifier(ctx, "--claude-advisor", arg.slice("--claude-advisor=".length));
|
|
186
|
-
} else if (arg.startsWith("--claude-compact-window=")) {
|
|
187
|
-
const parsed = parseCompactWindow(arg.slice("--claude-compact-window=".length));
|
|
188
|
-
if (parsed === undefined) {
|
|
189
|
-
err("--claude-compact-window expects a token count (e.g. 680000 or 680k)");
|
|
87
|
+
err(`Unknown arg: ${arg}`);
|
|
190
88
|
throw new ExitError(2);
|
|
191
|
-
}
|
|
192
|
-
ctx.claudeCompactWindow = parsed;
|
|
193
|
-
markModifier(ctx, "--claude-compact-window");
|
|
194
|
-
} else if (arg.startsWith("--claude-plugin=")) {
|
|
195
|
-
addClaudePlugin(ctx, arg.slice("--claude-plugin=".length));
|
|
196
|
-
} else if (arg.startsWith("--claude-permissive=")) {
|
|
197
|
-
err("--claude-permissive does not take a value");
|
|
198
|
-
throw new ExitError(2);
|
|
199
|
-
} else {
|
|
200
|
-
err(`Unknown arg: ${arg}`);
|
|
201
|
-
throw new ExitError(2);
|
|
202
89
|
}
|
|
203
90
|
}
|
|
204
91
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Help text and the early-exit signal for the EngineNative flag layer.
|
|
3
|
-
* Kept dependency-free (besides injected ctx) so
|
|
4
|
-
*
|
|
3
|
+
* Kept dependency-free (besides injected ctx) so the dispatch loop and its
|
|
4
|
+
* callers can share it without import cycles.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { Ctx } from "./index";
|
|
8
|
-
import { advisorFlagGrammar, effortFlagGrammar } from "../efforts";
|
|
9
8
|
|
|
10
9
|
export class ExitError extends Error {
|
|
11
10
|
constructor(readonly code: number) {
|
|
@@ -13,54 +12,20 @@ export class ExitError extends Error {
|
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export function
|
|
17
|
-
for (const line of catalog.split("\n")) ctx.services.logger.echo(line);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function printUsage(ctx: Ctx, knownPlugins: ReadonlyArray<string>): void {
|
|
15
|
+
export function printUsage(ctx: Ctx): void {
|
|
21
16
|
const { echo } = ctx.services.logger;
|
|
22
17
|
const argv0 = "docks-kit sync";
|
|
23
|
-
echo(`Usage: ${argv0} [
|
|
18
|
+
echo(`Usage: ${argv0} [agents] [omp] [flags]`);
|
|
24
19
|
echo("");
|
|
25
20
|
echo("Targets (positional; default: this machine's harness selection)");
|
|
26
|
-
echo(" claude sync the Claude Code SoT");
|
|
27
|
-
echo(" codex sync the Codex SoT");
|
|
28
21
|
echo(" agents sync universal agent skills");
|
|
29
22
|
echo(" omp sync the Oh My Pi SoT");
|
|
30
23
|
echo("");
|
|
31
24
|
echo("Global flags");
|
|
32
25
|
echo(" --dry-run preview without applying");
|
|
33
|
-
echo(
|
|
34
|
-
" --reconcile reconcile kit-owned settings with SoT (SoT keys win; user-only keys preserved; permissions arrays replaced)",
|
|
35
|
-
);
|
|
36
|
-
echo(
|
|
37
|
-
" --prune uninstall kit-managed installs not in SoT (plugins, marketplaces, skills in SoT/.agents/skills.txt)",
|
|
38
|
-
);
|
|
39
|
-
echo(" --skip-bubblewrap skip optional bubblewrap bootstrap (Codex Linux sandbox)");
|
|
26
|
+
echo(" --prune remove kit-managed universal skills not in SoT/.agents/skills.txt");
|
|
40
27
|
echo(" --skip-plugin-refresh install missing plugins but skip refresh-only updates");
|
|
41
28
|
echo(
|
|
42
29
|
" --verbose also print no-op confirmations (already in sync, up to date, left as-is)",
|
|
43
30
|
);
|
|
44
|
-
echo("");
|
|
45
|
-
echo(
|
|
46
|
-
"Deploy-time modifiers (deployed config only; SoT untouched; a later flag-less sync reverts)",
|
|
47
|
-
);
|
|
48
|
-
echo(
|
|
49
|
-
" --claude-model=<m> set deployed ~/.claude/settings.json model (aliases: best|opus|fable|sonnet|haiku, full claude-* IDs, or 'default' to unset)",
|
|
50
|
-
);
|
|
51
|
-
echo(` ${effortFlagGrammar("claude").padEnd(39)} set deployed effortLevel`);
|
|
52
|
-
echo(` ${advisorFlagGrammar().padEnd(39)} set deployed advisor state`);
|
|
53
|
-
echo(
|
|
54
|
-
" --claude-compact-window=<n> set deployed autocompact window in tokens (e.g. 680000 or 680k) for disposable sessions",
|
|
55
|
-
);
|
|
56
|
-
echo(
|
|
57
|
-
" --claude-permissive empty permissions.ask/deny in deployed settings (sandboxes/containers; unattended commits + pushes)",
|
|
58
|
-
);
|
|
59
|
-
echo(" --codex-model=<m> set deployed ~/.codex/config.toml model (e.g. gpt-5.5)");
|
|
60
|
-
echo(` ${effortFlagGrammar("codex").padEnd(39)} set deployed model_reasoning_effort`);
|
|
61
|
-
echo("");
|
|
62
|
-
echo("Sticky opt-ins (installed + enabled until --prune)");
|
|
63
|
-
echo(
|
|
64
|
-
` --claude-plugin=<name> opt an optional plugin into this machine (known: ${knownPlugins.join(", ")}; repeatable)`,
|
|
65
|
-
);
|
|
66
31
|
}
|
|
@@ -35,7 +35,7 @@ export function syncLockPath(home: string): string {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* The `kitLock.ts` lock inside
|
|
38
|
+
* The `kitLock.ts` lock inside an agents or omp folder that a sync
|
|
39
39
|
* writes. Syncs of different homes that share the folder all take it.
|
|
40
40
|
*/
|
|
41
41
|
export function folderSyncLockPath(folder: string): string {
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Shared service factory — the single construction point for the engine's
|
|
3
3
|
* injectable capabilities (Output Policy in DESIGN.md). The Effect rim wraps
|
|
4
4
|
* these in Layers (cli/src/services.ts); the harness-private native-raw entry
|
|
5
|
-
*
|
|
6
|
-
* path shares one implementation.
|
|
5
|
+
* calls it directly, so every execution path shares one implementation.
|
|
7
6
|
*/
|
|
8
7
|
import {
|
|
9
8
|
DEPENDENCIES,
|
|
@@ -4,40 +4,10 @@
|
|
|
4
4
|
* structurally identical anonymous types. Types only — no runtime code.
|
|
5
5
|
*/
|
|
6
6
|
import type { Json } from "./jq";
|
|
7
|
-
import type { ModifierFlag } from "./engineCtx";
|
|
8
7
|
|
|
9
8
|
/** Manifest-record object: the `{ [key]: Json }` shape redeclared across manifest readers. */
|
|
10
9
|
export type JsonObject = { [key: string]: Json };
|
|
11
10
|
|
|
12
|
-
export type CatalogTool = "claude" | "codex" | "omp";
|
|
13
|
-
export type CatalogSource = "anthropic-api" | "codex-cache" | "omp-cli" | "curated";
|
|
14
|
-
|
|
15
|
-
export interface ResolvedCatalog {
|
|
16
|
-
readonly tool: CatalogTool;
|
|
17
|
-
readonly source: CatalogSource;
|
|
18
|
-
readonly verified: string;
|
|
19
|
-
readonly fetchedAt?: string;
|
|
20
|
-
readonly fallbackReason?: string;
|
|
21
|
-
readonly models: ReadonlyArray<{
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly kind: "alias" | "id";
|
|
24
|
-
readonly note?: string;
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Shared core of per-tool settings-edit descriptors (Claude JSON modifiers,
|
|
30
|
-
* Codex TOML passes). Each tool narrows `key` to its own vocabulary and keeps
|
|
31
|
-
* tool-only fields (such as Claude's dry-run preview) on its local extension.
|
|
32
|
-
*/
|
|
33
|
-
export interface SettingEdit<TKey extends string> {
|
|
34
|
-
readonly tag: string;
|
|
35
|
-
readonly key: TKey;
|
|
36
|
-
readonly value: string | undefined;
|
|
37
|
-
readonly changed: string;
|
|
38
|
-
readonly unchanged: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
11
|
/**
|
|
42
12
|
* omp session model (moved from harnesses.ts, which re-exports it so existing
|
|
43
13
|
* import paths keep working).
|
|
@@ -49,15 +19,5 @@ export interface OmpSessionModel {
|
|
|
49
19
|
readonly thinking?: string;
|
|
50
20
|
}
|
|
51
21
|
|
|
52
|
-
/**
|
|
53
|
-
* Scalar modifier flags: the ModifierFlag subset taking a value through
|
|
54
|
-
* setModifier. Derived by exclusion so a new ModifierFlag forces an explicit
|
|
55
|
-
* scalar/non-scalar decision here.
|
|
56
|
-
*/
|
|
57
|
-
export type ScalarModifierFlag = Exclude<
|
|
58
|
-
ModifierFlag,
|
|
59
|
-
"--claude-compact-window" | "--claude-permissive" | "--claude-plugin"
|
|
60
|
-
>;
|
|
61
|
-
|
|
62
22
|
/** Injected HTTP client: the subset of fetch the network lookups call. */
|
|
63
23
|
export type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
|
|
@@ -52,6 +52,6 @@ export function skillsSummary(ctx: Ctx, state: SkillsState): void {
|
|
|
52
52
|
|
|
53
53
|
export function skillsNextSteps(ctx: Ctx): Array<string> {
|
|
54
54
|
return ctx.verbose || ctx.nextStepTriggers.skillsRestart
|
|
55
|
-
? ["Restart Claude Code
|
|
55
|
+
? ["Restart Claude Code to discover newly installed universal skills."]
|
|
56
56
|
: [];
|
|
57
57
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EngineNative sync scheduling: bounded-concurrency runner
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* EngineNative sync scheduling: the bounded-concurrency runner. Split from
|
|
3
|
+
* index.ts, which re-exports the public surface so existing import paths keep
|
|
4
|
+
* working.
|
|
5
5
|
*/
|
|
6
|
-
import { normalizeManifest } from "./skillsManifest";
|
|
7
6
|
|
|
8
7
|
export type SyncConcurrency = 1 | 2 | 3;
|
|
9
8
|
export type SyncTask<T> = () => Promise<T>;
|
|
@@ -42,14 +41,3 @@ export async function runBounded<T>(
|
|
|
42
41
|
}
|
|
43
42
|
return results;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
export function syncConcurrencyForManifest(
|
|
47
|
-
configured: SyncConcurrency,
|
|
48
|
-
manifest: string,
|
|
49
|
-
claudeSelected: boolean,
|
|
50
|
-
skillsSelected: boolean,
|
|
51
|
-
): SyncConcurrency {
|
|
52
|
-
if (!claudeSelected || !skillsSelected || normalizeManifest(manifest).length === 0)
|
|
53
|
-
return configured;
|
|
54
|
-
return 1;
|
|
55
|
-
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* EngineNative pipeline dispatch: select the requested harness pipelines,
|
|
3
3
|
* run them under the concurrency cap, then print the summary and advice.
|
|
4
|
-
* Split from index.ts; the `sync`/`
|
|
5
|
-
*
|
|
4
|
+
* Split from index.ts; the `sync`/`toolchain` entry routing still lives
|
|
5
|
+
* there.
|
|
6
6
|
*/
|
|
7
7
|
import { existsSync, mkdirSync, realpathSync } from "node:fs";
|
|
8
8
|
import { basename, dirname, join, resolve } from "node:path";
|
|
9
9
|
|
|
10
|
-
import { payloadText } from "../payload";
|
|
11
|
-
import { claudeNextSteps, claudeSummary, claudeSync, type ClaudeRuntimeState } from "./claudeSync";
|
|
12
|
-
import { preflightClaudeSettings } from "./claudeSettings";
|
|
13
|
-
import { codexHome } from "./codexPaths";
|
|
14
|
-
import { codexNextSteps, codexSummary, codexSync } from "./codexSync";
|
|
15
10
|
import type { Ctx } from "./index";
|
|
16
11
|
import { compareCodepoints } from "./jq";
|
|
17
12
|
import { acquireKitLock, releaseKitLock, type KitLock } from "./kitLock";
|
|
@@ -24,16 +19,11 @@ import {
|
|
|
24
19
|
type OmpWriteFolders,
|
|
25
20
|
} from "./ompSync";
|
|
26
21
|
import { skillsNextSteps, skillsSummary, skillsSync, type SkillsState } from "./skillsSync";
|
|
27
|
-
import { ExitError, parseArgs
|
|
22
|
+
import { ExitError, parseArgs } from "./parseArgs";
|
|
28
23
|
import { folderSyncLockPath, syncLockPath } from "./scratch";
|
|
29
|
-
import {
|
|
30
|
-
runBounded,
|
|
31
|
-
syncConcurrencyForManifest,
|
|
32
|
-
type SyncConcurrency,
|
|
33
|
-
type SyncTask,
|
|
34
|
-
} from "./syncConcurrency";
|
|
24
|
+
import { runBounded, type SyncConcurrency, type SyncTask } from "./syncConcurrency";
|
|
35
25
|
|
|
36
|
-
/** The default time that a sync
|
|
26
|
+
/** The default time that a sync waits for another sync to release the sync lock. */
|
|
37
27
|
export const SYNC_LOCK_WAIT_MS = 120_000;
|
|
38
28
|
const SYNC_LOCK_WAIT_ERROR = "DOCKS_KIT_SYNC_LOCK_WAIT_MS must be a non-negative safe integer";
|
|
39
29
|
|
|
@@ -107,7 +97,7 @@ async function withKitLocks(
|
|
|
107
97
|
* `UNLOCKED_TOKENS`, or `ctx.dryRun` is true. `makeCtx` sets `ctx.dryRun`
|
|
108
98
|
* from the `DRY_RUN` env global only on the channel that reads env globals.
|
|
109
99
|
*/
|
|
110
|
-
|
|
100
|
+
async function withSyncLock(
|
|
111
101
|
ctx: Ctx,
|
|
112
102
|
args: ReadonlyArray<string>,
|
|
113
103
|
body: () => Promise<number>,
|
|
@@ -143,12 +133,12 @@ export function folderLockPaths(folders: ReadonlyArray<string>): Array<string> {
|
|
|
143
133
|
|
|
144
134
|
/**
|
|
145
135
|
* Run `body` under the folder lock of each folder in `folders`. Take it after
|
|
146
|
-
* the sync lock. Syncs of different homes can share
|
|
136
|
+
* the sync lock. Syncs of different homes can share an agents or omp
|
|
147
137
|
* folder, and their home locks differ. A missing folder is created under the
|
|
148
138
|
* locks of its ancestors in the set. A dry run takes no folder lock and
|
|
149
139
|
* creates nothing.
|
|
150
140
|
*/
|
|
151
|
-
|
|
141
|
+
async function withFolderLocks(
|
|
152
142
|
ctx: Ctx,
|
|
153
143
|
folders: ReadonlyArray<string>,
|
|
154
144
|
body: () => Promise<number>,
|
|
@@ -186,7 +176,6 @@ export async function engineSync(ctx: Ctx, args: ReadonlyArray<string>): Promise
|
|
|
186
176
|
async function runSync(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
|
|
187
177
|
const { err } = ctx.services.logger;
|
|
188
178
|
parseArgs(ctx, args);
|
|
189
|
-
await validateModifierFlags(ctx);
|
|
190
179
|
const configuredConcurrency = process.env["DOCKS_KIT_SYNC_CONCURRENCY"];
|
|
191
180
|
if (configuredConcurrency === undefined || configuredConcurrency === "") {
|
|
192
181
|
ctx.syncConcurrency = 3;
|
|
@@ -208,7 +197,6 @@ async function runSync(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
|
|
|
208
197
|
// data root that appears after the locks cannot move them.
|
|
209
198
|
const omp = ctx.syncOmp ? ompWriteFolders(ctx) : undefined;
|
|
210
199
|
const folders = [
|
|
211
|
-
...(ctx.syncCodex ? [codexHome(ctx.home)] : []),
|
|
212
200
|
...(ctx.syncAgents ? [resolve(ctx.agentsDir)] : []),
|
|
213
201
|
...(omp === undefined ? [] : [omp.paths.agentDir, omp.intercomDir, omp.paths.dataRoot]),
|
|
214
202
|
];
|
|
@@ -218,12 +206,8 @@ async function runSync(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
|
|
|
218
206
|
/** Run the selected pipelines. `omp` holds the omp folders when omp is selected. */
|
|
219
207
|
async function runPipelines(ctx: Ctx, omp: OmpWriteFolders | undefined): Promise<number> {
|
|
220
208
|
const { acquireTerminal, echo } = ctx.services.logger;
|
|
221
|
-
// An abort-class check runs before any pipeline starts, so the abort stops the whole sync.
|
|
222
|
-
preflightClaudeSettings(ctx);
|
|
223
209
|
|
|
224
210
|
type PipelineResult =
|
|
225
|
-
| { readonly kind: "claude"; readonly runtime: ClaudeRuntimeState }
|
|
226
|
-
| { readonly kind: "codex" }
|
|
227
211
|
| { readonly kind: "skills"; readonly state: SkillsState }
|
|
228
212
|
| { readonly kind: "omp"; readonly state: OmpState };
|
|
229
213
|
interface SelectedPipeline {
|
|
@@ -232,21 +216,6 @@ async function runPipelines(ctx: Ctx, omp: OmpWriteFolders | undefined): Promise
|
|
|
232
216
|
}
|
|
233
217
|
|
|
234
218
|
const selected: Array<SelectedPipeline> = [];
|
|
235
|
-
if (ctx.syncClaude) {
|
|
236
|
-
selected.push({
|
|
237
|
-
name: "Claude",
|
|
238
|
-
run: async () => ({ kind: "claude", runtime: await claudeSync(ctx) }),
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
if (ctx.syncCodex) {
|
|
242
|
-
selected.push({
|
|
243
|
-
name: "Codex",
|
|
244
|
-
run: async () => {
|
|
245
|
-
await codexSync(ctx);
|
|
246
|
-
return { kind: "codex" };
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
219
|
if (ctx.syncAgents) {
|
|
251
220
|
selected.push({
|
|
252
221
|
name: "skills",
|
|
@@ -260,14 +229,6 @@ async function runPipelines(ctx: Ctx, omp: OmpWriteFolders | undefined): Promise
|
|
|
260
229
|
});
|
|
261
230
|
}
|
|
262
231
|
|
|
263
|
-
// A populated skills manifest deploys with `-a claude-code codex`, and symlink healing also writes into Claude's tree.
|
|
264
|
-
ctx.syncConcurrency = syncConcurrencyForManifest(
|
|
265
|
-
ctx.syncConcurrency,
|
|
266
|
-
payloadText("SoT/.agents/skills.txt"),
|
|
267
|
-
ctx.syncClaude,
|
|
268
|
-
ctx.syncAgents,
|
|
269
|
-
);
|
|
270
|
-
|
|
271
232
|
const remaining = new Set(selected.map(({ name }) => name));
|
|
272
233
|
const lease = acquireTerminal(`Syncing ${[...remaining].join(", ")}...`);
|
|
273
234
|
ctx.terminalLease = lease;
|
|
@@ -293,28 +254,20 @@ async function runPipelines(ctx: Ctx, omp: OmpWriteFolders | undefined): Promise
|
|
|
293
254
|
throw error;
|
|
294
255
|
}
|
|
295
256
|
|
|
296
|
-
const claudeRan = ctx.syncClaude;
|
|
297
|
-
const codexRan = ctx.syncCodex;
|
|
298
|
-
let claudeRuntime: ClaudeRuntimeState | undefined;
|
|
299
257
|
let skillsState: SkillsState | undefined;
|
|
300
258
|
let ompState: OmpState | undefined;
|
|
301
259
|
for (const result of results) {
|
|
302
|
-
if (result.kind === "
|
|
303
|
-
else
|
|
304
|
-
else if (result.kind === "omp") ompState = result.state;
|
|
260
|
+
if (result.kind === "skills") skillsState = result.state;
|
|
261
|
+
else ompState = result.state;
|
|
305
262
|
}
|
|
306
263
|
|
|
307
264
|
echo("");
|
|
308
265
|
echo("--- Sync complete ---");
|
|
309
266
|
echo(`Repo: ${ctx.repoDir}`);
|
|
310
|
-
if (claudeRuntime !== undefined) claudeSummary(ctx, claudeRuntime);
|
|
311
|
-
if (codexRan) codexSummary(ctx);
|
|
312
267
|
if (skillsState !== undefined) skillsSummary(ctx, skillsState);
|
|
313
268
|
if (ompState !== undefined) ompSummary(ctx, ompState);
|
|
314
269
|
|
|
315
270
|
const advice = [
|
|
316
|
-
...(claudeRan ? claudeNextSteps(ctx) : []),
|
|
317
|
-
...(codexRan ? codexNextSteps(ctx) : []),
|
|
318
271
|
...(skillsState !== undefined ? skillsNextSteps(ctx) : []),
|
|
319
272
|
...(ompState !== undefined ? ompNextSteps(ctx) : []),
|
|
320
273
|
];
|