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.
Files changed (87) hide show
  1. package/AGENTS.md +41 -33
  2. package/cli/docs/omp-context.md +104 -0
  3. package/cli/docs/omp-models.md +106 -56
  4. package/cli/src/argv.ts +38 -469
  5. package/cli/src/argvSurface.ts +371 -0
  6. package/cli/src/argvValidate.ts +122 -0
  7. package/cli/src/commands/docs.ts +62 -42
  8. package/cli/src/commands/harnesses.ts +38 -45
  9. package/cli/src/commands/model.ts +48 -53
  10. package/cli/src/commands/models.ts +24 -26
  11. package/cli/src/commands/omp.ts +132 -112
  12. package/cli/src/commands/plugins.ts +20 -20
  13. package/cli/src/commands/skills.ts +22 -20
  14. package/cli/src/commands/status.ts +87 -80
  15. package/cli/src/commands/sync.ts +113 -87
  16. package/cli/src/commands/toolchain.ts +21 -21
  17. package/cli/src/commands/update.ts +139 -117
  18. package/cli/src/efforts.ts +35 -34
  19. package/cli/src/engine-native/DESIGN.md +30 -30
  20. package/cli/src/engine-native/bun.ts +77 -55
  21. package/cli/src/engine-native/claudeLsp.ts +154 -0
  22. package/cli/src/engine-native/claudeOptionalPlugins.ts +113 -0
  23. package/cli/src/engine-native/claudePluginPasses.ts +348 -0
  24. package/cli/src/engine-native/claudeRemovals.ts +195 -0
  25. package/cli/src/engine-native/claudeRetired.ts +4 -4
  26. package/cli/src/engine-native/claudeRuntime.ts +94 -68
  27. package/cli/src/engine-native/claudeSettings.ts +174 -0
  28. package/cli/src/engine-native/claudeSettingsModifiers.ts +50 -54
  29. package/cli/src/engine-native/claudeSync.ts +176 -456
  30. package/cli/src/engine-native/codexConfig.ts +158 -0
  31. package/cli/src/engine-native/codexHooks.ts +91 -0
  32. package/cli/src/engine-native/codexPlugins.ts +290 -0
  33. package/cli/src/engine-native/codexStatus.ts +24 -0
  34. package/cli/src/engine-native/codexSync.ts +110 -568
  35. package/cli/src/engine-native/codexToml.ts +140 -138
  36. package/cli/src/engine-native/deps.ts +144 -107
  37. package/cli/src/engine-native/engineCtx.ts +126 -0
  38. package/cli/src/engine-native/exec.ts +98 -87
  39. package/cli/src/engine-native/failures.ts +3 -3
  40. package/cli/src/engine-native/harnesses.ts +62 -72
  41. package/cli/src/engine-native/index.ts +34 -315
  42. package/cli/src/engine-native/jq.ts +25 -24
  43. package/cli/src/engine-native/logger.ts +98 -100
  44. package/cli/src/engine-native/models.ts +50 -45
  45. package/cli/src/engine-native/modes.ts +83 -80
  46. package/cli/src/engine-native/ompFileDeploy.ts +111 -0
  47. package/cli/src/engine-native/ompMarketplace.ts +136 -0
  48. package/cli/src/engine-native/ompOverlay.ts +67 -64
  49. package/cli/src/engine-native/ompPaths.ts +49 -38
  50. package/cli/src/engine-native/ompPlugins.ts +170 -0
  51. package/cli/src/engine-native/ompRemovals.ts +159 -0
  52. package/cli/src/engine-native/ompSync.ts +69 -409
  53. package/cli/src/engine-native/ompYaml.ts +43 -41
  54. package/cli/src/engine-native/os/darwin.ts +5 -5
  55. package/cli/src/engine-native/os/index.ts +15 -15
  56. package/cli/src/engine-native/os/linux.ts +5 -5
  57. package/cli/src/engine-native/os/posix.ts +28 -24
  58. package/cli/src/engine-native/os/targets.ts +17 -17
  59. package/cli/src/engine-native/os/types.ts +31 -31
  60. package/cli/src/engine-native/os/windows.ts +61 -61
  61. package/cli/src/engine-native/parseArgs.ts +122 -372
  62. package/cli/src/engine-native/parseHelp.ts +66 -0
  63. package/cli/src/engine-native/parseModifiers.ts +222 -0
  64. package/cli/src/engine-native/services.ts +34 -34
  65. package/cli/src/engine-native/settings.ts +15 -15
  66. package/cli/src/engine-native/sharedTypes.d.ts +46 -0
  67. package/cli/src/engine-native/skillsInstall.ts +105 -0
  68. package/cli/src/engine-native/skillsLinks.ts +203 -0
  69. package/cli/src/engine-native/skillsManifest.ts +16 -0
  70. package/cli/src/engine-native/skillsPrune.ts +108 -0
  71. package/cli/src/engine-native/skillsSync.ts +28 -362
  72. package/cli/src/engine-native/syncConcurrency.ts +55 -0
  73. package/cli/src/engine-native/syncDispatch.ts +141 -0
  74. package/cli/src/engine-native/toolchain.ts +65 -62
  75. package/cli/src/engine.ts +65 -57
  76. package/cli/src/generated/sotPayload.ts +7 -7
  77. package/cli/src/kitHome.ts +44 -40
  78. package/cli/src/main.ts +63 -56
  79. package/cli/src/manifests.ts +53 -54
  80. package/cli/src/md.d.ts +2 -2
  81. package/cli/src/payload.ts +9 -9
  82. package/cli/src/services.ts +21 -13
  83. package/cli/tsconfig.json +4 -1
  84. package/docks-kit +13 -2
  85. package/docks-kit.ps1 +21 -6
  86. package/package.json +10 -2
  87. 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, "$1$1\\\"")
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
+ };