docks-kit 0.22.25 → 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 (77) hide show
  1. package/AGENTS.md +35 -81
  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-context.md +5 -5
  7. package/cli/docs/omp-models.md +249 -48
  8. package/cli/docs/overview.md +4 -12
  9. package/cli/docs/platforms.md +2 -2
  10. package/cli/docs/sync-layers.md +10 -57
  11. package/cli/docs/toolchain.md +9 -78
  12. package/cli/src/argv.ts +0 -8
  13. package/cli/src/argvValidate.ts +2 -46
  14. package/cli/src/commands/docs.ts +2 -14
  15. package/cli/src/commands/harnesses.ts +6 -9
  16. package/cli/src/commands/sync.ts +5 -99
  17. package/cli/src/commands/toolchain.ts +4 -12
  18. package/cli/src/engine-native/DESIGN.md +67 -88
  19. package/cli/src/engine-native/deps.ts +6 -86
  20. package/cli/src/engine-native/engineCtx.ts +7 -76
  21. package/cli/src/engine-native/exec.ts +1 -18
  22. package/cli/src/engine-native/harnesses.ts +6 -6
  23. package/cli/src/engine-native/index.ts +4 -6
  24. package/cli/src/engine-native/jq.ts +4 -37
  25. package/cli/src/engine-native/modes.ts +3 -132
  26. package/cli/src/engine-native/ompRemovals.ts +14 -0
  27. package/cli/src/engine-native/os/darwin.ts +0 -4
  28. package/cli/src/engine-native/os/index.ts +1 -2
  29. package/cli/src/engine-native/os/linux.ts +0 -3
  30. package/cli/src/engine-native/os/posix.ts +2 -46
  31. package/cli/src/engine-native/os/types.ts +1 -32
  32. package/cli/src/engine-native/os/windows.ts +0 -49
  33. package/cli/src/engine-native/parseArgs.ts +11 -124
  34. package/cli/src/engine-native/parseHelp.ts +5 -40
  35. package/cli/src/engine-native/scratch.ts +1 -1
  36. package/cli/src/engine-native/services.ts +1 -2
  37. package/cli/src/engine-native/sharedTypes.d.ts +0 -40
  38. package/cli/src/engine-native/skillsSync.ts +1 -1
  39. package/cli/src/engine-native/syncConcurrency.ts +3 -15
  40. package/cli/src/engine-native/syncDispatch.ts +10 -57
  41. package/cli/src/engine-native/toolchain.ts +5 -40
  42. package/cli/src/engine.ts +0 -75
  43. package/cli/src/generated/sotPayload.ts +14 -41
  44. package/cli/src/main.ts +7 -19
  45. package/cli/src/manifests.ts +1 -93
  46. package/cli/src/payload.ts +2 -8
  47. package/cli/tsconfig.json +1 -3
  48. package/package.json +3 -5
  49. package/cli/docs/models.md +0 -58
  50. package/cli/docs/modifiers.md +0 -52
  51. package/cli/docs/plugins.md +0 -70
  52. package/cli/src/commands/model.ts +0 -68
  53. package/cli/src/commands/models.ts +0 -75
  54. package/cli/src/commands/plugins.ts +0 -35
  55. package/cli/src/commands/status.ts +0 -206
  56. package/cli/src/efforts.ts +0 -89
  57. package/cli/src/engine-native/claudeLsp.ts +0 -301
  58. package/cli/src/engine-native/claudeOptionalPlugins.ts +0 -126
  59. package/cli/src/engine-native/claudePluginPasses.ts +0 -426
  60. package/cli/src/engine-native/claudeRemovals.ts +0 -383
  61. package/cli/src/engine-native/claudeRetired.ts +0 -165
  62. package/cli/src/engine-native/claudeRuntime.ts +0 -157
  63. package/cli/src/engine-native/claudeSettings.ts +0 -201
  64. package/cli/src/engine-native/claudeSettingsModifiers.ts +0 -115
  65. package/cli/src/engine-native/claudeSync.ts +0 -312
  66. package/cli/src/engine-native/codexConfig.ts +0 -214
  67. package/cli/src/engine-native/codexHooks.ts +0 -91
  68. package/cli/src/engine-native/codexPaths.ts +0 -14
  69. package/cli/src/engine-native/codexPlugins.ts +0 -315
  70. package/cli/src/engine-native/codexStatus.ts +0 -25
  71. package/cli/src/engine-native/codexSync.ts +0 -314
  72. package/cli/src/engine-native/codexToml.ts +0 -303
  73. package/cli/src/engine-native/liveModels.ts +0 -264
  74. package/cli/src/engine-native/models.ts +0 -101
  75. package/cli/src/engine-native/parseModifiers.ts +0 -225
  76. package/cli/src/engine-native/settings.ts +0 -42
  77. package/cli/src/engine-native/tomlLines.ts +0 -92
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EngineNative — the supported sync/model/toolchain engine.
2
+ * EngineNative — the supported sync/toolchain engine.
3
3
  *
4
4
  * Golden suites drive it through main.ts's harness-private `native-raw`
5
5
  * channel, which bypasses effect/cli so tests see the internal argv
@@ -11,13 +11,13 @@
11
11
  * existing import paths keep working.
12
12
  */
13
13
  import { makeCtx, type Ctx } from "./engineCtx";
14
- import { modeModel, modeToolchain } from "./modes";
14
+ import { modeToolchain } from "./modes";
15
15
  import { ExitError } from "./parseArgs";
16
16
  import { makeEngineServices, type EngineServices, type Logger } from "./services";
17
17
  import { engineSync } from "./syncDispatch";
18
18
 
19
- export type { Ctx, ModifierFlag } from "./engineCtx";
20
- export { runBounded, syncConcurrencyForManifest } from "./syncConcurrency";
19
+ export type { Ctx } from "./engineCtx";
20
+ export { runBounded } from "./syncConcurrency";
21
21
  export type { SyncConcurrency, SyncTask } from "./syncConcurrency";
22
22
 
23
23
  /**
@@ -52,8 +52,6 @@ export async function runEngineNative(
52
52
  try {
53
53
  ctx = makeCtx(runServices, { envGlobals: options.envGlobals === true });
54
54
  switch (argv[0]) {
55
- case "model":
56
- return await modeModel(ctx, argv.slice(1));
57
55
  case "toolchain":
58
56
  return await modeToolchain(ctx, argv.slice(1));
59
57
  case "sync":
@@ -1,17 +1,9 @@
1
1
  /**
2
- * jq-semantics primitives for EngineNative.
3
- *
4
- * Some deployed JSON contracts were defined by jq behavior, so EngineNative
5
- * reproduces three jq behaviors exactly:
6
- * - `*` (recursive object merge): right side wins; objects merge
7
- * recursively; arrays and scalars are REPLACED, never concatenated;
8
- * merged key order = left object's order, then right-only keys appended.
9
- * - `unique`: sorts (jq's total order — for our string arrays, Unicode
10
- * codepoint order) and deduplicates.
11
- * - output formatting: 2-space indent, UTF-8 raw, trailing newline.
2
+ * JSON primitives for EngineNative: the `Json` value type, object narrowing,
3
+ * jq-compatible codepoint ordering, and a parse that yields `undefined`
4
+ * instead of throwing.
12
5
  */
13
6
 
14
- import { existsSync, readFileSync } from "node:fs";
15
7
  import type { JsonObject } from "./sharedTypes";
16
8
 
17
9
  export type Json = null | boolean | number | string | Array<Json> | { [key: string]: Json };
@@ -20,22 +12,7 @@ export function isObject(v: Json): v is JsonObject {
20
12
  return typeof v === "object" && v !== null && !Array.isArray(v);
21
13
  }
22
14
 
23
- /** jq `$left * $right`. */
24
- export function deepMerge(left: Json, right: Json): Json {
25
- if (!isObject(left) || !isObject(right)) return right;
26
- const out: JsonObject = { ...left };
27
- for (const [k, v] of Object.entries(right)) {
28
- const lv = out[k];
29
- out[k] = lv !== undefined && isObject(lv) && isObject(v) ? deepMerge(lv, v) : v;
30
- }
31
- return out;
32
- }
33
-
34
- /** jq `unique` over an array of strings: codepoint sort + dedup. */
35
- export function uniqueStrings(arr: Array<string>): Array<string> {
36
- return [...new Set(arr)].sort(compareCodepoints);
37
- }
38
-
15
+ /** jq's string order: compare by Unicode codepoint, not UTF-16 code unit. */
39
16
  export function compareCodepoints(a: string, b: string): number {
40
17
  const ia = a[Symbol.iterator]();
41
18
  const ib = b[Symbol.iterator]();
@@ -51,11 +28,6 @@ export function compareCodepoints(a: string, b: string): number {
51
28
  }
52
29
  }
53
30
 
54
- /** jq's default pretty-printer for the documents this kit writes. */
55
- export function jqStringify(v: Json): string {
56
- return `${JSON.stringify(v, null, 2)}\n`;
57
- }
58
-
59
31
  /** jq `empty` validation: parse or null. */
60
32
  export function parseJson(text: string): Json | undefined {
61
33
  try {
@@ -64,8 +36,3 @@ export function parseJson(text: string): Json | undefined {
64
36
  return undefined;
65
37
  }
66
38
  }
67
-
68
- /** Parse a JSON file with `parseJson` semantics; a missing file is `undefined`. */
69
- export function readJsonFile(file: string): Json | undefined {
70
- return existsSync(file) ? parseJson(readFileSync(file, "utf8")) : undefined;
71
- }
@@ -1,140 +1,12 @@
1
1
  /**
2
- * Direct modes for `model` and `toolchain`. Same public argv vocabulary,
3
- * golden-tested messages, same exit codes.
2
+ * Direct mode for `toolchain`. Same public argv vocabulary, golden-tested
3
+ * messages, same exit codes.
4
4
  */
5
- import { p } from "./exec";
6
- import { existsSync, readFileSync } from "node:fs";
7
- import { payloadText } from "../payload";
8
-
9
- import { codexHome } from "./codexPaths";
10
- import { syncClaudeModel } from "./claudeSettingsModifiers";
11
- import { syncCodexModel } from "./codexToml";
12
5
  import type { Ctx } from "./index";
13
- import { isObject, parseJson, type Json } from "./jq";
14
- import { printModels, validateClaudeModel, validateCodexModel } from "./models";
15
- import { defaultLiveInputs, resolveCatalog } from "./liveModels";
16
6
  import { bunBootstrap } from "./bun";
17
- import { withFolderLocks, withSyncLock } from "./syncDispatch";
18
- import { upgradeLspServers } from "./claudeLsp";
19
7
  import { belowFloor, field, installedVersion, outdatedReport, present, report } from "./toolchain";
20
- import { topLevelTomlString } from "../manifests";
21
-
22
- export async function modeModel(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
23
- const { err } = ctx.services.logger;
24
- let tool: "claude" | "codex" | "" = "";
25
- let value = "";
26
- for (const arg of args) {
27
- if (arg === "--dry-run") ctx.dryRun = true;
28
- else if (arg === "--verbose") {
29
- ctx.verbose = true;
30
- } else if (arg === "claude" || arg === "codex") tool = arg;
31
- else if (arg.startsWith("-")) {
32
- err(`Unknown flag for model: ${arg}`);
33
- return 2;
34
- } else value = arg;
35
- }
36
- if (tool === "") {
37
- err("Usage: model <claude|codex> [value] [--dry-run]");
38
- return 2;
39
- }
40
- if (value === "") return await showModel(ctx, tool);
41
- // A write does the same read-modify-write of settings.json and config.toml as a sync.
42
- return await withSyncLock(ctx, args, async () => {
43
- // `model codex` writes config.toml in the Codex folder, which syncs of
44
- // other homes can share. It creates no folder, so a missing one needs no lock.
45
- const codexDir = codexHome(ctx.home);
46
- const folders = tool === "codex" && existsSync(codexDir) ? [codexDir] : [];
47
- return await withFolderLocks(ctx, folders, () => writeModel(ctx, tool, value));
48
- });
49
- }
50
-
51
- /** Print the deployed model, the SoT model, and the model catalog of `tool`. */
52
- async function showModel(ctx: Ctx, tool: "claude" | "codex"): Promise<number> {
53
- const { echo, err, warn } = ctx.services.logger;
54
- const catalog = await resolveCatalog(tool, defaultLiveInputs(ctx.home));
55
- if (tool === "claude") {
56
- const deployed = p(ctx.home, ".claude", "settings.json");
57
- const result = readConfig(deployed);
58
- if (result.kind === "missing") {
59
- warn("~/.claude/settings.json missing");
60
- return 0;
61
- }
62
- if (result.kind === "read-error") {
63
- err(`Failed to read ~/.claude/settings.json: ${String(result.error)}`);
64
- return 1;
65
- }
66
- echo(`deployed: ${jsonModelText(result.data)}`);
67
- echo(`SoT: ${jsonModelText(payloadText("SoT/.claude/settings.json"))}`);
68
- } else {
69
- const deployed = p(codexHome(ctx.home), "config.toml");
70
- const result = readConfig(deployed);
71
- if (result.kind === "missing") {
72
- warn(`${deployed} missing`);
73
- return 0;
74
- }
75
- if (result.kind === "read-error") {
76
- err(`Failed to read ${deployed}: ${String(result.error)}`);
77
- return 1;
78
- }
79
- echo(`deployed: ${topLevelTomlString(result.data, "model") ?? ""}`);
80
- echo(`SoT: ${topLevelTomlString(payloadText("SoT/.codex/config.toml"), "model") ?? ""}`);
81
- }
82
- printModels(ctx, catalog);
83
- return 0;
84
- }
85
-
86
- /** Validate `value` against the model catalog of `tool`, then write it. */
87
- async function writeModel(ctx: Ctx, tool: "claude" | "codex", value: string): Promise<number> {
88
- const { err } = ctx.services.logger;
89
- const catalog = await resolveCatalog(tool, defaultLiveInputs(ctx.home));
90
- if (tool === "claude") {
91
- if (!validateClaudeModel(ctx, value, catalog)) {
92
- printModels(ctx, catalog);
93
- err(`Invalid Claude model '${value}'`);
94
- return 2;
95
- }
96
- syncClaudeModel(ctx, value);
97
- } else {
98
- if (!validateCodexModel(ctx, value, catalog)) {
99
- printModels(ctx, catalog);
100
- err(`Invalid Codex model '${value}'`);
101
- return 2;
102
- }
103
- syncCodexModel(ctx, value);
104
- }
105
- return 0;
106
- }
107
-
108
- type ConfigReadResult =
109
- | { readonly kind: "missing" }
110
- | { readonly kind: "read-error"; readonly error: unknown }
111
- | { readonly kind: "data"; readonly data: string };
112
-
113
- function readConfig(file: string): ConfigReadResult {
114
- try {
115
- return { kind: "data", data: readFileSync(file, "utf8") };
116
- } catch (error) {
117
- const code =
118
- typeof error === "object" &&
119
- error !== null &&
120
- "code" in error &&
121
- typeof error.code === "string"
122
- ? error.code
123
- : undefined;
124
- return code === "ENOENT" ? { kind: "missing" } : { kind: "read-error", error };
125
- }
126
- }
127
-
128
- function jsonModelText(text: string): string {
129
- const doc = parseJson(text);
130
- if (doc === undefined) return "";
131
- const v: Json | undefined = isObject(doc) ? doc["model"] : undefined;
132
- if (v === undefined || v === null || v === false) return "default (unset)";
133
- return typeof v === "string" ? v : JSON.stringify(v);
134
- }
135
8
 
136
- const TOOLCHAIN_USAGE =
137
- "Usage: toolchain [check|ensure <tool> [--dry-run]|outdated [--refresh]|upgrade [--dry-run]]";
9
+ const TOOLCHAIN_USAGE = "Usage: toolchain [check|ensure <tool> [--dry-run]|outdated [--refresh]]";
138
10
 
139
11
  export async function modeToolchain(ctx: Ctx, args: ReadonlyArray<string>): Promise<number> {
140
12
  const { echo, err, verbose, warn } = ctx.services.logger;
@@ -158,7 +30,6 @@ export async function modeToolchain(ctx: Ctx, args: ReadonlyArray<string>): Prom
158
30
  await outdatedReport(ctx, { refresh: args.includes("--refresh") });
159
31
  return 0;
160
32
  }
161
- if (op === "upgrade") return await upgradeLspServers(ctx);
162
33
  if (op !== "ensure") {
163
34
  err(TOOLCHAIN_USAGE);
164
35
  return 2;
@@ -104,6 +104,10 @@ const OMP_RETIRED_KEYS: ReadonlyArray<string> = ["providers.webSearchOrder"];
104
104
  * served the id as an empty stub. The catalog now publishes the same limits,
105
105
  * prices, and ladder. The block's `defaultLevel: high` applied only to a bare
106
106
  * selector, and every kit selector names its level.
107
+ *
108
+ * `gpt-6-astra` carried the kit's worked ladder override while the `astra`
109
+ * role ran GPT-6 Astra. The role moved to GPT-6.2 Astra, and the override
110
+ * moved with it to the `gpt-6.2-astra` key, so no role uses this block.
107
111
  */
108
112
  const OMP_RETIRED_MODEL_BLOCKS: ReadonlyArray<readonly [string, unknown]> = [
109
113
  [
@@ -122,6 +126,16 @@ const OMP_RETIRED_MODEL_BLOCKS: ReadonlyArray<readonly [string, unknown]> = [
122
126
  },
123
127
  },
124
128
  ],
129
+ [
130
+ "providers.openai-codex.modelOverrides.gpt-6-astra",
131
+ {
132
+ thinking: {
133
+ mode: "effort",
134
+ efforts: ["low", "medium", "high", "xhigh", "max"],
135
+ defaultLevel: "xhigh",
136
+ },
137
+ },
138
+ ],
125
139
  ];
126
140
 
127
141
  /** Each two-letter short-option cluster with a first letter from `first` and a second from `second`. */
@@ -4,13 +4,9 @@ import type { HostOs } from "./types";
4
4
  export const darwin: HostOs = posixHost({
5
5
  id: "darwin",
6
6
  toolchainOs: "darwin",
7
- supportsBubblewrap: false,
8
- // macOS terminals start bash as a login shell. It reads the first existing file of these and never reads .bashrc.
9
- bashTargets: [".bash_profile", ".bash_login", ".profile"],
10
7
  packageManagerHints: {
11
8
  git: "brew install git",
12
9
  jq: "brew install jq",
13
10
  curl: "brew install curl",
14
- ffplay: "brew install ffmpeg",
15
11
  },
16
12
  });
@@ -22,12 +22,11 @@ export function platformName(pf: NodeJS.Platform = rawPlatform()): PlatformName
22
22
  }
23
23
  }
24
24
 
25
- // An unrecognized host keeps Linux hint text, filters no toolchain row, and never claims bubblewrap — exactly today's behavior.
25
+ // An unrecognized host keeps Linux hint text and filters no toolchain row — exactly today's behavior.
26
26
  const unknown: HostOs = {
27
27
  ...linux,
28
28
  id: "unknown",
29
29
  toolchainOs: "",
30
- supportsBubblewrap: false,
31
30
  };
32
31
 
33
32
  const HOSTS: Readonly<Record<PlatformName, HostOs>> = {
@@ -4,12 +4,9 @@ import type { HostOs } from "./types";
4
4
  export const linux: HostOs = posixHost({
5
5
  id: "linux",
6
6
  toolchainOs: "linux",
7
- supportsBubblewrap: true,
8
- bashTargets: [".bashrc"],
9
7
  packageManagerHints: {
10
8
  git: "sudo apt install -y git (or your distro's package manager)",
11
9
  jq: "sudo apt install -y jq",
12
10
  curl: "sudo apt install -y curl",
13
- ffplay: "sudo apt install -y ffmpeg",
14
11
  },
15
12
  });
@@ -2,26 +2,13 @@
2
2
  // through this module. A slash join keeps the same host-stable path p() would produce.
3
3
  import type { HintedTool, HostOs } from "./types";
4
4
 
5
- function posixLiteral(value: string): string {
6
- return `'${value.replaceAll("'", `'"'"'`)}'`;
7
- }
8
-
9
5
  /** Package-manager hints for the tools a POSIX host installs through its own package manager. */
10
- export type PackageManagerHints = Readonly<Record<Exclude<HintedTool, "claude" | "codex">, string>>;
11
-
12
- const UPSTREAM_INSTALLER_HINTS: Readonly<Record<"claude" | "codex", string>> = {
13
- claude: 'tmp=$(mktemp) && curl -fsSL https://claude.ai/install.sh -o "$tmp" && bash "$tmp"',
14
- codex:
15
- 'tmp=$(mktemp) && curl -fsSL https://chatgpt.com/codex/install.sh -o "$tmp" && CODEX_NON_INTERACTIVE=1 sh "$tmp"',
16
- };
6
+ export type PackageManagerHints = Readonly<Record<HintedTool, string>>;
17
7
 
18
8
  interface PosixHostInputs {
19
9
  readonly id: HostOs["id"];
20
10
  readonly toolchainOs: HostOs["toolchainOs"];
21
- readonly supportsBubblewrap: boolean;
22
11
  readonly packageManagerHints: PackageManagerHints;
23
- /** Home-relative bash startup files in read order; the first existing one gets the write, else the first entry. */
24
- readonly bashTargets: readonly [string, ...string[]];
25
12
  }
26
13
 
27
14
  /** Members shared by every POSIX host; linux and darwin differ only in the inputs. */
@@ -29,7 +16,6 @@ export function posixHost(inputs: PosixHostInputs): HostOs {
29
16
  return {
30
17
  id: inputs.id,
31
18
  toolchainOs: inputs.toolchainOs,
32
- supportsBubblewrap: inputs.supportsBubblewrap,
33
19
  directoryLinkKinds: ["symlink"],
34
20
  executableSuffixes: [""],
35
21
  invoke: (executablePath, args) => ({ command: executablePath, args }),
@@ -48,36 +34,6 @@ export function posixHost(inputs: PosixHostInputs): HostOs {
48
34
  },
49
35
  };
50
36
  },
51
- environmentSetting: (name, value) => ({
52
- kind: "profile",
53
- // Bash reads .bash_login only as a login file. Only a host that writes to it
54
- // scans it, so a dormant copy cannot block the write to the loaded file.
55
- candidates: [
56
- ".zshrc",
57
- ".bashrc",
58
- ".bash_profile",
59
- ...(inputs.bashTargets.includes(".bash_login") ? [".bash_login"] : []),
60
- ".profile",
61
- ".zshenv",
62
- ],
63
- target: (shell, exists) => {
64
- const shellPath = shell ?? "bash";
65
- const shellName = shellPath.slice(shellPath.lastIndexOf("/") + 1);
66
- if (shellName === "zsh") return ".zshrc";
67
- if (shellName !== "bash") return ".profile";
68
- return inputs.bashTargets.find(exists) ?? inputs.bashTargets[0];
69
- },
70
- line: `export ${name}=${value}`,
71
- }),
72
- statusLineCommand: (bun, script) => {
73
- const bunLiteral = posixLiteral(bun);
74
- const scriptLiteral = posixLiteral(script);
75
- return `test -x ${bunLiteral} && test -f ${scriptLiteral} && exec ${bunLiteral} ${scriptLiteral} || true`;
76
- },
77
- failureHookCommand: (command) => command,
78
- installHint: (tool) =>
79
- tool === "claude" || tool === "codex"
80
- ? UPSTREAM_INSTALLER_HINTS[tool]
81
- : inputs.packageManagerHints[tool],
37
+ installHint: (tool) => inputs.packageManagerHints[tool],
82
38
  };
83
39
  }
@@ -8,7 +8,7 @@ export type PlatformName = "linux" | "darwin" | "windows" | "unknown";
8
8
  /** Directory-link mechanisms, tried in order before the copy fallback. */
9
9
  export type DirectoryLinkKind = "symlink" | "junction";
10
10
  /** Tools whose install command differs per host OS. */
11
- export type HintedTool = "git" | "jq" | "curl" | "ffplay" | "claude" | "codex";
11
+ export type HintedTool = "git" | "jq" | "curl";
12
12
 
13
13
  /** A command plus argv, already shaped for how this host must invoke it. */
14
14
  export interface Invocation {
@@ -18,29 +18,6 @@ export interface Invocation {
18
18
  readonly windowsVerbatimArguments?: boolean;
19
19
  }
20
20
 
21
- /** How this host persists a user-level environment variable. */
22
- export type EnvironmentSetting =
23
- | {
24
- readonly kind: "profile";
25
- /** Home-relative files scanned for an existing setting. */
26
- readonly candidates: ReadonlyArray<string>;
27
- /** Home-relative file that receives the write for this shell; `exists` tests a home-relative file. */
28
- readonly target: (shell: string | undefined, exists: (file: string) => boolean) => string;
29
- /** Line appended to the target file. */
30
- readonly line: string;
31
- }
32
- | {
33
- readonly kind: "command";
34
- /** Exits zero when the variable is already persisted. */
35
- readonly probe: Invocation;
36
- /** Persists the variable. */
37
- readonly apply: Invocation;
38
- /** Where the value lands, named for the log line. */
39
- readonly location: string;
40
- /** Manual recovery when `apply` fails. */
41
- readonly manualHint: string;
42
- };
43
-
44
21
  /** The two steps that fetch and run a pinned Bun installer. */
45
22
  export interface BunInstaller {
46
23
  readonly scriptPath: string;
@@ -52,8 +29,6 @@ export interface HostOs {
52
29
  readonly id: PlatformName;
53
30
  /** `SoT/toolchain.json` `os` field this host matches; "" matches every row. */
54
31
  readonly toolchainOs: string;
55
- /** Bubblewrap is the Linux-only Codex sandbox runtime. */
56
- readonly supportsBubblewrap: boolean;
57
32
  /** Directory-link mechanisms tried in order before `skillsLinks.ts linkOrCopy` copies. */
58
33
  readonly directoryLinkKinds: ReadonlyArray<DirectoryLinkKind>;
59
34
  /** One-line install command for a tool whose package differs per OS. */
@@ -66,10 +41,4 @@ export interface HostOs {
66
41
  readonly bunExecutableName: string;
67
42
  /** Download-then-run installer for a pinned Bun version placed in `directory`. */
68
43
  readonly bunInstaller: (pin: string, directory: string) => BunInstaller;
69
- /** How this host persists a user-level environment variable. */
70
- readonly environmentSetting: (name: string, value: string) => EnvironmentSetting;
71
- /** Claude `statusLine.command` for a resolved bun executable and script. */
72
- readonly statusLineCommand: (bun: string, script: string) => string;
73
- /** Reshape the SoT `PostToolUseFailure` command for this host's shell. */
74
- readonly failureHookCommand: (command: string) => string;
75
44
  }
@@ -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
  };