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.
Files changed (75) hide show
  1. package/AGENTS.md +31 -77
  2. package/README.md +31 -58
  3. package/cli/docs/command-guards.md +231 -197
  4. package/cli/docs/flags.md +25 -55
  5. package/cli/docs/install.md +2 -3
  6. package/cli/docs/omp-models.md +9 -0
  7. package/cli/docs/overview.md +4 -12
  8. package/cli/docs/platforms.md +2 -2
  9. package/cli/docs/sync-layers.md +10 -57
  10. package/cli/docs/toolchain.md +9 -78
  11. package/cli/src/argv.ts +0 -8
  12. package/cli/src/argvValidate.ts +2 -46
  13. package/cli/src/commands/docs.ts +2 -14
  14. package/cli/src/commands/harnesses.ts +6 -9
  15. package/cli/src/commands/sync.ts +5 -99
  16. package/cli/src/commands/toolchain.ts +4 -12
  17. package/cli/src/engine-native/DESIGN.md +67 -88
  18. package/cli/src/engine-native/deps.ts +6 -86
  19. package/cli/src/engine-native/engineCtx.ts +7 -76
  20. package/cli/src/engine-native/exec.ts +1 -18
  21. package/cli/src/engine-native/harnesses.ts +6 -6
  22. package/cli/src/engine-native/index.ts +4 -6
  23. package/cli/src/engine-native/jq.ts +4 -37
  24. package/cli/src/engine-native/modes.ts +3 -132
  25. package/cli/src/engine-native/os/darwin.ts +0 -4
  26. package/cli/src/engine-native/os/index.ts +1 -2
  27. package/cli/src/engine-native/os/linux.ts +0 -3
  28. package/cli/src/engine-native/os/posix.ts +2 -46
  29. package/cli/src/engine-native/os/types.ts +1 -32
  30. package/cli/src/engine-native/os/windows.ts +0 -49
  31. package/cli/src/engine-native/parseArgs.ts +11 -124
  32. package/cli/src/engine-native/parseHelp.ts +5 -40
  33. package/cli/src/engine-native/scratch.ts +1 -1
  34. package/cli/src/engine-native/services.ts +1 -2
  35. package/cli/src/engine-native/sharedTypes.d.ts +0 -40
  36. package/cli/src/engine-native/skillsSync.ts +1 -1
  37. package/cli/src/engine-native/syncConcurrency.ts +3 -15
  38. package/cli/src/engine-native/syncDispatch.ts +10 -57
  39. package/cli/src/engine-native/toolchain.ts +5 -40
  40. package/cli/src/engine.ts +0 -75
  41. package/cli/src/generated/sotPayload.ts +12 -39
  42. package/cli/src/main.ts +7 -19
  43. package/cli/src/manifests.ts +1 -93
  44. package/cli/src/payload.ts +2 -8
  45. package/cli/tsconfig.json +1 -3
  46. package/package.json +3 -5
  47. package/cli/docs/models.md +0 -58
  48. package/cli/docs/modifiers.md +0 -52
  49. package/cli/docs/plugins.md +0 -70
  50. package/cli/src/commands/model.ts +0 -68
  51. package/cli/src/commands/models.ts +0 -75
  52. package/cli/src/commands/plugins.ts +0 -35
  53. package/cli/src/commands/status.ts +0 -206
  54. package/cli/src/efforts.ts +0 -89
  55. package/cli/src/engine-native/claudeLsp.ts +0 -301
  56. package/cli/src/engine-native/claudeOptionalPlugins.ts +0 -126
  57. package/cli/src/engine-native/claudePluginPasses.ts +0 -426
  58. package/cli/src/engine-native/claudeRemovals.ts +0 -383
  59. package/cli/src/engine-native/claudeRetired.ts +0 -165
  60. package/cli/src/engine-native/claudeRuntime.ts +0 -157
  61. package/cli/src/engine-native/claudeSettings.ts +0 -201
  62. package/cli/src/engine-native/claudeSettingsModifiers.ts +0 -115
  63. package/cli/src/engine-native/claudeSync.ts +0 -312
  64. package/cli/src/engine-native/codexConfig.ts +0 -214
  65. package/cli/src/engine-native/codexHooks.ts +0 -91
  66. package/cli/src/engine-native/codexPaths.ts +0 -14
  67. package/cli/src/engine-native/codexPlugins.ts +0 -315
  68. package/cli/src/engine-native/codexStatus.ts +0 -25
  69. package/cli/src/engine-native/codexSync.ts +0 -314
  70. package/cli/src/engine-native/codexToml.ts +0 -303
  71. package/cli/src/engine-native/liveModels.ts +0 -264
  72. package/cli/src/engine-native/models.ts +0 -101
  73. package/cli/src/engine-native/parseModifiers.ts +0 -225
  74. package/cli/src/engine-native/settings.ts +0 -42
  75. package/cli/src/engine-native/tomlLines.ts +0 -92
@@ -38,8 +38,8 @@ export function isNewer(a: string, b: string): boolean {
38
38
 
39
39
  /**
40
40
  * A readable installed version strictly older than the manifest floor. The
41
- * doctor row and the LSP install gate must agree on that judgement, so both
42
- * ask here rather than re-deriving it.
41
+ * doctor row and `toolchain ensure` must agree on that judgement, so both ask
42
+ * here rather than re-deriving it.
43
43
  */
44
44
  export function belowFloor(installed: string, floor: string): boolean {
45
45
  return installed !== "" && floor !== "" && isNewer(floor, installed);
@@ -57,10 +57,6 @@ function firstLineField(out: string, index: number): string {
57
57
  export async function installedVersion(ctx: Ctx, tool: ToolId): Promise<string> {
58
58
  const version = () => ctx.services.deps.version(tool);
59
59
  switch (tool) {
60
- case "claude":
61
- return firstLineField(await version(), 0);
62
- case "codex":
63
- return firstLineField(await version(), -1);
64
60
  case "git":
65
61
  return firstLineField(await version(), 2);
66
62
  case "node":
@@ -68,22 +64,11 @@ export async function installedVersion(ctx: Ctx, tool: ToolId): Promise<string>
68
64
  case "jq":
69
65
  return (await version()).replace(/^jq-/, "");
70
66
  case "curl":
71
- case "tsc":
72
- // `rust-analyzer --version` prints "rust-analyzer <version>", where the
73
- // version tail also carries a commit and a date in parentheses.
74
- case "rust-analyzer":
75
67
  return firstLineField(await version(), 1);
76
68
  case "bun":
77
69
  case "omp":
78
70
  case "npm":
79
71
  return await version();
80
- case "bwrap":
81
- return firstLineField(await version(), 1);
82
- case "ffplay":
83
- return firstLineField(await version(), 2).replace(/-.*$/, "");
84
- case "intelephense":
85
- case "typescript-language-server":
86
- return (await version()).trim();
87
72
  default:
88
73
  return "";
89
74
  }
@@ -152,9 +137,8 @@ function upstreamSpec(tool: string): JsonObject | undefined {
152
137
  }
153
138
 
154
139
  function upstreamLabel(spec: JsonObject): string {
155
- const { npm, github, line } = spec;
156
- if (typeof npm === "string")
157
- return typeof line === "string" ? `npm ${npm} (${line}.x)` : `npm ${npm}`;
140
+ const { npm, github } = spec;
141
+ if (typeof npm === "string") return `npm ${npm}`;
158
142
  return typeof github === "string" ? `github ${github}` : "-";
159
143
  }
160
144
 
@@ -176,26 +160,7 @@ async function lookupUpstream(
176
160
  fetchImpl: FetchLike,
177
161
  env: NodeJS.ProcessEnv,
178
162
  ): Promise<UpstreamResult> {
179
- const { npm, line, github, tagPrefix } = spec;
180
- if (typeof npm === "string" && typeof line === "string") {
181
- // The registry rejects ranges, so read the packument and pick the newest release on the line.
182
- const result = await fetchJson(fetchImpl, `https://registry.npmjs.org/${npm}`, {
183
- Accept: "application/vnd.npm.install-v1+json",
184
- });
185
- if (!result.ok) return result;
186
- const versions = result.body["versions"];
187
- if (versions === undefined || !isObject(versions))
188
- return { ok: false, reason: "invalid response" };
189
- if (!/^\d+$/.test(line)) return { ok: false, reason: `invalid line ${line}` };
190
- const pattern = new RegExp(`^${line}\\.\\d+\\.\\d+$`);
191
- let newest = "";
192
- for (const version of Object.keys(versions)) {
193
- if (pattern.test(version) && (newest === "" || isNewer(version, newest))) newest = version;
194
- }
195
- return newest === ""
196
- ? { ok: false, reason: `no ${line}.x release` }
197
- : { ok: true, version: newest };
198
- }
163
+ const { npm, github, tagPrefix } = spec;
199
164
  if (typeof npm === "string") {
200
165
  const result = await fetchJson(fetchImpl, `https://registry.npmjs.org/${npm}/latest`, {
201
166
  Accept: "application/json",
package/cli/src/engine.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  import { CliError } from "effect/cli";
2
2
  import { Console, Effect } from "effect";
3
- import { spawnSync } from "node:child_process";
4
3
  import { runEngineNative } from "./engine-native";
5
- import { ENV_GLOBAL_KEYS } from "./engine-native/engineCtx";
6
- import { ExitError } from "./engine-native/parseArgs";
7
- import { makeEngineServices } from "./engine-native/services";
8
4
  import { targetForHost } from "./engine-native/os/targets";
9
- import { kitHome } from "./kitHome";
10
5
  import { DependencyManagerService, LoggerService, PlatformService } from "./services";
11
6
 
12
7
  /**
@@ -32,17 +27,6 @@ const requireSupportedHost = () => {
32
27
  // executable can be compiled, so absence means false.
33
28
  export const compiled: boolean = typeof Bun !== "undefined" && Bun.isStandaloneExecutable === true;
34
29
 
35
- export class EngineCaptureError extends ExitError {
36
- constructor(
37
- readonly diagnostic: string,
38
- code: number,
39
- ) {
40
- super(code);
41
- this.name = "EngineCaptureError";
42
- this.message = diagnostic;
43
- }
44
- }
45
-
46
30
  const failureMessage = (error: unknown): string => {
47
31
  if (error instanceof Error && error.message !== "") return error.message;
48
32
  return typeof error === "string" && error !== "" ? error : "unknown error";
@@ -70,65 +54,6 @@ export const engine = (args: ReadonlyArray<string>) =>
70
54
  }
71
55
  });
72
56
 
73
- // The capture child must not inherit the env globals or a caller's channel
74
- // selection in any spelling.
75
- const CAPTURE_DROPPED_KEYS: ReadonlyArray<string> = [...ENV_GLOBAL_KEYS, "DOCKS_KIT_ENGINE"];
76
-
77
- /**
78
- * Build the capture child environment. Windows environment names are
79
- * case-insensitive, so a key such as `claude_compact_window` also matches
80
- * there. POSIX names stay case-sensitive.
81
- */
82
- const captureChildEnv = (): NodeJS.ProcessEnv => {
83
- const foldCase = process.platform === "win32";
84
- const env: NodeJS.ProcessEnv = {};
85
- for (const [name, value] of Object.entries(process.env)) {
86
- if (value === undefined) continue;
87
- if (CAPTURE_DROPPED_KEYS.includes(foldCase ? name.toUpperCase() : name)) continue;
88
- env[name] = value;
89
- }
90
- env["DOCKS_KIT_ENGINE"] = "native-capture";
91
- return env;
92
- };
93
-
94
- /** Run the engine capturing stdout (engine logs/warns go to stderr and pass through). */
95
- export const engineCapture = (args: ReadonlyArray<string>) =>
96
- Effect.gen(function* () {
97
- yield* requireSupportedHost();
98
- if (bashEngineRequested()) {
99
- return yield* bail(bashRemovedMessage, 2);
100
- }
101
- // The child runs the native-capture channel, which ignores env globals even
102
- // when Bun reloads them from a project `.env`. The child environment also
103
- // omits them, so a captured public command behaves like an in-process one.
104
- const childEnv = captureChildEnv();
105
- const res = yield* Effect.sync(() =>
106
- // Child process (capture channel): runEngineNative writes straight to
107
- // process.stdout, so in-process capture is not possible.
108
- spawnSync(
109
- process.execPath,
110
- compiled ? [...args] : [`${kitHome()}/cli/src/main.ts`, ...args],
111
- {
112
- env: childEnv,
113
- encoding: "utf8",
114
- stdio: ["ignore", "pipe", "inherit"],
115
- },
116
- ),
117
- );
118
- if (res.error !== undefined || res.status !== 0) {
119
- const reasons = new Array<string>();
120
- if (typeof res.status === "number") reasons.push(`exit ${res.status}`);
121
- if (res.signal !== null) reasons.push(`signal ${res.signal}`);
122
- if (res.error !== undefined) reasons.push(`spawn error: ${res.error.message}`);
123
- if (reasons.length === 0) reasons.push("no child status");
124
- const diagnostic = `engine capture failed for '${args.join(" ") || "default"}': ${reasons.join("; ")}`;
125
- makeEngineServices().logger.err(diagnostic);
126
- const code = typeof res.status === "number" && res.status !== 0 ? res.status : 1;
127
- return yield* Effect.fail(new EngineCaptureError(diagnostic, code));
128
- }
129
- return res.stdout ?? "";
130
- });
131
-
132
57
  /** Print a message to stderr and exit — for CLI-side validation failures. */
133
58
  export const bail = (message: string, code = 2) =>
134
59
  Console.error(message).pipe(Effect.andThen(Effect.sync(() => process.exit(code))));