docks-kit 0.17.1 → 0.17.3
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 +41 -33
- package/cli/docs/omp-context.md +104 -0
- package/cli/docs/omp-models.md +106 -56
- package/cli/src/argv.ts +38 -469
- package/cli/src/argvSurface.ts +371 -0
- package/cli/src/argvValidate.ts +122 -0
- package/cli/src/commands/docs.ts +62 -42
- package/cli/src/commands/harnesses.ts +38 -45
- package/cli/src/commands/model.ts +48 -53
- package/cli/src/commands/models.ts +24 -26
- package/cli/src/commands/omp.ts +132 -112
- package/cli/src/commands/plugins.ts +20 -20
- package/cli/src/commands/skills.ts +22 -20
- package/cli/src/commands/status.ts +87 -80
- package/cli/src/commands/sync.ts +113 -87
- package/cli/src/commands/toolchain.ts +21 -21
- package/cli/src/commands/update.ts +139 -117
- package/cli/src/efforts.ts +35 -34
- package/cli/src/engine-native/DESIGN.md +30 -30
- package/cli/src/engine-native/bun.ts +77 -55
- package/cli/src/engine-native/claudeLsp.ts +154 -0
- package/cli/src/engine-native/claudeOptionalPlugins.ts +113 -0
- package/cli/src/engine-native/claudePluginPasses.ts +348 -0
- package/cli/src/engine-native/claudeRemovals.ts +195 -0
- package/cli/src/engine-native/claudeRetired.ts +4 -4
- package/cli/src/engine-native/claudeRuntime.ts +94 -68
- package/cli/src/engine-native/claudeSettings.ts +174 -0
- package/cli/src/engine-native/claudeSettingsModifiers.ts +50 -54
- package/cli/src/engine-native/claudeSync.ts +176 -456
- package/cli/src/engine-native/codexConfig.ts +158 -0
- package/cli/src/engine-native/codexHooks.ts +91 -0
- package/cli/src/engine-native/codexPlugins.ts +290 -0
- package/cli/src/engine-native/codexStatus.ts +24 -0
- package/cli/src/engine-native/codexSync.ts +110 -568
- package/cli/src/engine-native/codexToml.ts +140 -138
- package/cli/src/engine-native/deps.ts +144 -107
- package/cli/src/engine-native/engineCtx.ts +126 -0
- package/cli/src/engine-native/exec.ts +98 -87
- package/cli/src/engine-native/failures.ts +3 -3
- package/cli/src/engine-native/harnesses.ts +62 -72
- package/cli/src/engine-native/index.ts +34 -315
- package/cli/src/engine-native/jq.ts +25 -24
- package/cli/src/engine-native/logger.ts +98 -100
- package/cli/src/engine-native/models.ts +50 -45
- package/cli/src/engine-native/modes.ts +83 -80
- package/cli/src/engine-native/ompFileDeploy.ts +111 -0
- package/cli/src/engine-native/ompMarketplace.ts +136 -0
- package/cli/src/engine-native/ompOverlay.ts +67 -64
- package/cli/src/engine-native/ompPaths.ts +49 -38
- package/cli/src/engine-native/ompPlugins.ts +170 -0
- package/cli/src/engine-native/ompRemovals.ts +159 -0
- package/cli/src/engine-native/ompSync.ts +69 -409
- package/cli/src/engine-native/ompYaml.ts +43 -41
- package/cli/src/engine-native/os/darwin.ts +5 -5
- package/cli/src/engine-native/os/index.ts +15 -15
- package/cli/src/engine-native/os/linux.ts +5 -5
- package/cli/src/engine-native/os/posix.ts +28 -24
- package/cli/src/engine-native/os/targets.ts +17 -17
- package/cli/src/engine-native/os/types.ts +31 -31
- package/cli/src/engine-native/os/windows.ts +61 -61
- package/cli/src/engine-native/parseArgs.ts +122 -372
- package/cli/src/engine-native/parseHelp.ts +66 -0
- package/cli/src/engine-native/parseModifiers.ts +222 -0
- package/cli/src/engine-native/services.ts +34 -34
- package/cli/src/engine-native/settings.ts +15 -15
- package/cli/src/engine-native/sharedTypes.d.ts +46 -0
- package/cli/src/engine-native/skillsInstall.ts +105 -0
- package/cli/src/engine-native/skillsLinks.ts +203 -0
- package/cli/src/engine-native/skillsManifest.ts +16 -0
- package/cli/src/engine-native/skillsPrune.ts +108 -0
- package/cli/src/engine-native/skillsSync.ts +28 -362
- package/cli/src/engine-native/syncConcurrency.ts +55 -0
- package/cli/src/engine-native/syncDispatch.ts +141 -0
- package/cli/src/engine-native/toolchain.ts +65 -62
- package/cli/src/engine.ts +65 -57
- package/cli/src/generated/sotPayload.ts +7 -7
- package/cli/src/kitHome.ts +44 -40
- package/cli/src/main.ts +63 -56
- package/cli/src/manifests.ts +53 -54
- package/cli/src/md.d.ts +2 -2
- package/cli/src/payload.ts +9 -9
- package/cli/src/services.ts +21 -13
- package/cli/tsconfig.json +4 -1
- package/docks-kit +13 -2
- package/docks-kit.ps1 +21 -6
- package/package.json +10 -2
- package/cli/src/engine-native/claudePlugins.ts +0 -510
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { win32 } from "node:path"
|
|
2
|
-
import { p } from "../exec"
|
|
3
|
-
import type { HostOs } from "./types"
|
|
1
|
+
import { win32 } from "node:path";
|
|
2
|
+
import { p } from "../exec";
|
|
3
|
+
import type { HostOs } from "./types";
|
|
4
4
|
|
|
5
5
|
function powershellLiteral(value: string): string {
|
|
6
|
-
return `'${value.replaceAll("'", "''")}'
|
|
6
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function encodedPowerShellCommand(script: string): string {
|
|
10
|
-
const encoded = Buffer.from(script, "utf16le").toString("base64")
|
|
11
|
-
return `powershell.exe -NoProfile -NonInteractive -EncodedCommand ${encoded}
|
|
10
|
+
const encoded = Buffer.from(script, "utf16le").toString("base64");
|
|
11
|
+
return `powershell.exe -NoProfile -NonInteractive -EncodedCommand ${encoded}`;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -21,22 +21,22 @@ function encodedPowerShellCommand(script: string): string {
|
|
|
21
21
|
* https://flatt.tech/research/posts/batbadbut-you-cant-securely-execute-commands-on-windows/
|
|
22
22
|
* https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
|
|
23
23
|
*/
|
|
24
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g
|
|
24
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
25
25
|
|
|
26
26
|
function escapeCommand(arg: string): string {
|
|
27
|
-
return arg.replace(metaCharsRegExp, "^$1")
|
|
27
|
+
return arg.replace(metaCharsRegExp, "^$1");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function escapeArgument(arg: string, doubleEscapeMetaChars: boolean): string {
|
|
31
|
-
arg = `${arg}
|
|
32
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g,
|
|
33
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1")
|
|
34
|
-
arg = `"${arg}"
|
|
35
|
-
arg = arg.replace(metaCharsRegExp, "^$1")
|
|
31
|
+
arg = `${arg}`;
|
|
32
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
33
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
34
|
+
arg = `"${arg}"`;
|
|
35
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
36
36
|
if (doubleEscapeMetaChars) {
|
|
37
|
-
arg = arg.replace(metaCharsRegExp, "^$1")
|
|
37
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
38
38
|
}
|
|
39
|
-
return arg
|
|
39
|
+
return arg;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function assertCommandLineValue(value: string, kind: "executable path" | "argument"): void {
|
|
@@ -46,16 +46,16 @@ function assertCommandLineValue(value: string, kind: "executable path" | "argume
|
|
|
46
46
|
? "carriage return (CR)"
|
|
47
47
|
: value.includes("\n")
|
|
48
48
|
? "line feed (LF)"
|
|
49
|
-
: undefined
|
|
50
|
-
if (unsupported === undefined) return
|
|
49
|
+
: undefined;
|
|
50
|
+
if (unsupported === undefined) return;
|
|
51
51
|
|
|
52
52
|
const executablePercentHint =
|
|
53
53
|
kind === "executable path" && unsupported === "percent sign (%)"
|
|
54
54
|
? " The tool must be reached through its .exe or moved out of a directory whose name contains a percent sign."
|
|
55
|
-
: ""
|
|
55
|
+
: "";
|
|
56
56
|
throw new Error(
|
|
57
|
-
`${kind} ${JSON.stringify(value)} contains a ${unsupported}, which cannot be escaped on a cmd command line; the caller must pass the value another way.${executablePercentHint}
|
|
58
|
-
)
|
|
57
|
+
`${kind} ${JSON.stringify(value)} contains a ${unsupported}, which cannot be escaped on a cmd command line; the caller must pass the value another way.${executablePercentHint}`,
|
|
58
|
+
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -65,28 +65,28 @@ function assertCommandLineValue(value: string, kind: "executable path" | "argume
|
|
|
65
65
|
* when it is an absolute path; otherwise it is rebuilt under SystemRoot.
|
|
66
66
|
*/
|
|
67
67
|
function commandInterpreter(environment: NodeJS.ProcessEnv = process.env): string {
|
|
68
|
-
const comSpec = environment["ComSpec"] ?? ""
|
|
69
|
-
if (win32.isAbsolute(comSpec)) return comSpec
|
|
70
|
-
const systemRoot = environment["SystemRoot"] ?? ""
|
|
71
|
-
const root = win32.isAbsolute(systemRoot) ? systemRoot : "C:\\Windows"
|
|
72
|
-
return win32.join(root, "System32", "cmd.exe")
|
|
68
|
+
const comSpec = environment["ComSpec"] ?? "";
|
|
69
|
+
if (win32.isAbsolute(comSpec)) return comSpec;
|
|
70
|
+
const systemRoot = environment["SystemRoot"] ?? "";
|
|
71
|
+
const root = win32.isAbsolute(systemRoot) ? systemRoot : "C:\\Windows";
|
|
72
|
+
return win32.join(root, "System32", "cmd.exe");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function commandShimInvocation(executablePath: string, args: ReadonlyArray<string>) {
|
|
76
|
-
assertCommandLineValue(executablePath, "executable path")
|
|
77
|
-
for (const arg of args) assertCommandLineValue(arg, "argument")
|
|
76
|
+
assertCommandLineValue(executablePath, "executable path");
|
|
77
|
+
for (const arg of args) assertCommandLineValue(arg, "argument");
|
|
78
78
|
|
|
79
|
-
const normalizedPath = win32.normalize(executablePath)
|
|
80
|
-
const doubleEscapeMetaChars = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i.test(normalizedPath)
|
|
79
|
+
const normalizedPath = win32.normalize(executablePath);
|
|
80
|
+
const doubleEscapeMetaChars = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i.test(normalizedPath);
|
|
81
81
|
const commandLine = [
|
|
82
82
|
escapeCommand(normalizedPath),
|
|
83
|
-
...args.map((arg) => escapeArgument(arg, doubleEscapeMetaChars))
|
|
84
|
-
].join(" ")
|
|
83
|
+
...args.map((arg) => escapeArgument(arg, doubleEscapeMetaChars)),
|
|
84
|
+
].join(" ");
|
|
85
85
|
return {
|
|
86
86
|
command: commandInterpreter(),
|
|
87
87
|
args: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
88
|
-
windowsVerbatimArguments: true
|
|
89
|
-
} as const
|
|
88
|
+
windowsVerbatimArguments: true,
|
|
89
|
+
} as const;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// Authored now, but unreachable until the supported-host admission gate opens.
|
|
@@ -102,12 +102,12 @@ export const windows: HostOs = {
|
|
|
102
102
|
: { command: executablePath, args },
|
|
103
103
|
bunExecutableName: "bun.exe",
|
|
104
104
|
bunInstaller: (pin, directory) => {
|
|
105
|
-
const scriptPath = p(directory, "install.ps1")
|
|
105
|
+
const scriptPath = p(directory, "install.ps1");
|
|
106
106
|
return {
|
|
107
107
|
scriptPath,
|
|
108
108
|
download: {
|
|
109
109
|
command: "curl",
|
|
110
|
-
args: ["-fsSL", "https://bun.sh/install.ps1", "-o", scriptPath]
|
|
110
|
+
args: ["-fsSL", "https://bun.sh/install.ps1", "-o", scriptPath],
|
|
111
111
|
},
|
|
112
112
|
run: {
|
|
113
113
|
command: "powershell.exe",
|
|
@@ -119,58 +119,58 @@ export const windows: HostOs = {
|
|
|
119
119
|
"-File",
|
|
120
120
|
scriptPath,
|
|
121
121
|
"-Version",
|
|
122
|
-
pin
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
}
|
|
122
|
+
pin,
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
126
|
},
|
|
127
127
|
environmentSetting: (name, value) => ({
|
|
128
128
|
kind: "command",
|
|
129
129
|
probe: {
|
|
130
130
|
command: "reg",
|
|
131
|
-
args: ["query", "HKCU\\Environment", "/v", name]
|
|
131
|
+
args: ["query", "HKCU\\Environment", "/v", name],
|
|
132
132
|
},
|
|
133
133
|
apply: {
|
|
134
134
|
command: "setx",
|
|
135
|
-
args: [name, value]
|
|
135
|
+
args: [name, value],
|
|
136
136
|
},
|
|
137
137
|
location: "user environment",
|
|
138
|
-
manualHint: "set it manually in System Properties > Environment Variables"
|
|
138
|
+
manualHint: "set it manually in System Properties > Environment Variables",
|
|
139
139
|
}),
|
|
140
140
|
statusLineCommand: (bun, script) => {
|
|
141
|
-
const bunLiteral = powershellLiteral(bun)
|
|
142
|
-
const scriptLiteral = powershellLiteral(script)
|
|
141
|
+
const bunLiteral = powershellLiteral(bun);
|
|
142
|
+
const scriptLiteral = powershellLiteral(script);
|
|
143
143
|
// Module auto-loading reports "Preparing modules for first use" as a
|
|
144
144
|
// progress record, which a redirected host serializes to stderr as CLIXML.
|
|
145
145
|
// Claude runs this command every turn, and the records recur across runs, so
|
|
146
146
|
// silencing progress inside the stored command keeps its streams clean.
|
|
147
147
|
return encodedPowerShellCommand(
|
|
148
|
-
`$ProgressPreference = 'SilentlyContinue'; if ((Test-Path -LiteralPath ${bunLiteral} -PathType Leaf) -and (Test-Path -LiteralPath ${scriptLiteral} -PathType Leaf)) { & ${bunLiteral} ${scriptLiteral} }
|
|
149
|
-
)
|
|
148
|
+
`$ProgressPreference = 'SilentlyContinue'; if ((Test-Path -LiteralPath ${bunLiteral} -PathType Leaf) -and (Test-Path -LiteralPath ${scriptLiteral} -PathType Leaf)) { & ${bunLiteral} ${scriptLiteral} }`,
|
|
149
|
+
);
|
|
150
150
|
},
|
|
151
151
|
failureHookCommand: (command) => {
|
|
152
|
-
const prefix = "echo '"
|
|
153
|
-
if (!command.startsWith(prefix) || !command.endsWith("'")) return command
|
|
154
|
-
const quotedPayload = command.slice(prefix.length, -1)
|
|
155
|
-
const posixApostrophe = `'"'"'
|
|
156
|
-
if (quotedPayload.replaceAll(posixApostrophe, "").includes("'")) return command
|
|
157
|
-
const payload = quotedPayload.replaceAll(posixApostrophe, "'")
|
|
158
|
-
return encodedPowerShellCommand(`Write-Output ${powershellLiteral(payload)}`)
|
|
152
|
+
const prefix = "echo '";
|
|
153
|
+
if (!command.startsWith(prefix) || !command.endsWith("'")) return command;
|
|
154
|
+
const quotedPayload = command.slice(prefix.length, -1);
|
|
155
|
+
const posixApostrophe = `'"'"'`;
|
|
156
|
+
if (quotedPayload.replaceAll(posixApostrophe, "").includes("'")) return command;
|
|
157
|
+
const payload = quotedPayload.replaceAll(posixApostrophe, "'");
|
|
158
|
+
return encodedPowerShellCommand(`Write-Output ${powershellLiteral(payload)}`);
|
|
159
159
|
},
|
|
160
160
|
installHint: (tool) => {
|
|
161
161
|
switch (tool) {
|
|
162
162
|
case "git":
|
|
163
|
-
return "winget install --id Git.Git -e"
|
|
163
|
+
return "winget install --id Git.Git -e";
|
|
164
164
|
case "jq":
|
|
165
|
-
return "winget install --id jqlang.jq -e"
|
|
165
|
+
return "winget install --id jqlang.jq -e";
|
|
166
166
|
case "curl":
|
|
167
|
-
return "winget install --id cURL.cURL -e"
|
|
167
|
+
return "winget install --id cURL.cURL -e";
|
|
168
168
|
case "ffplay":
|
|
169
|
-
return "winget install --id Gyan.FFmpeg -e"
|
|
169
|
+
return "winget install --id Gyan.FFmpeg -e";
|
|
170
170
|
case "claude":
|
|
171
|
-
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 }"
|
|
171
|
+
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 }";
|
|
172
172
|
case "codex":
|
|
173
|
-
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 }"
|
|
173
|
+
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 }";
|
|
174
174
|
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
175
|
+
},
|
|
176
|
+
};
|