docks-kit 0.23.0 → 0.25.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 (59) hide show
  1. package/AGENTS.md +22 -138
  2. package/README.md +38 -23
  3. package/cli/docs/command-guards.md +5 -3
  4. package/cli/docs/flags.md +11 -29
  5. package/cli/docs/install.md +5 -4
  6. package/cli/docs/omp-context.md +79 -7
  7. package/cli/docs/omp-models.md +22 -15
  8. package/cli/docs/overview.md +5 -8
  9. package/cli/docs/sync-layers.md +55 -83
  10. package/cli/docs/toolchain.md +7 -8
  11. package/cli/src/argv.ts +0 -4
  12. package/cli/src/argvValidate.ts +2 -9
  13. package/cli/src/commands/docs.ts +2 -2
  14. package/cli/src/commands/omp.ts +1 -1
  15. package/cli/src/commands/scratch.ts +1 -1
  16. package/cli/src/commands/sync.ts +3 -24
  17. package/cli/src/commands/tidy.ts +1 -1
  18. package/cli/src/commands/update.ts +3 -3
  19. package/cli/src/engine-native/DESIGN.md +24 -35
  20. package/cli/src/engine-native/deps.ts +2 -7
  21. package/cli/src/engine-native/engineCtx.ts +3 -31
  22. package/cli/src/engine-native/failures.ts +2 -2
  23. package/cli/src/engine-native/index.ts +2 -2
  24. package/cli/src/engine-native/kitDb.ts +21 -37
  25. package/cli/src/engine-native/ompChild.ts +1 -1
  26. package/cli/src/engine-native/ompFastMode.ts +1 -1
  27. package/cli/src/engine-native/ompKitPlugin.ts +7 -16
  28. package/cli/src/engine-native/ompOverlay.ts +1 -1
  29. package/cli/src/engine-native/ompPlugins.ts +205 -221
  30. package/cli/src/engine-native/ompRemovals.ts +24 -3
  31. package/cli/src/engine-native/ompSession.ts +67 -0
  32. package/cli/src/engine-native/ompSync.ts +6 -15
  33. package/cli/src/engine-native/os/posix.ts +0 -1
  34. package/cli/src/engine-native/os/types.ts +0 -4
  35. package/cli/src/engine-native/os/windows.ts +0 -1
  36. package/cli/src/engine-native/parseArgs.ts +1 -61
  37. package/cli/src/engine-native/parseHelp.ts +1 -6
  38. package/cli/src/engine-native/scratch.ts +1 -1
  39. package/cli/src/engine-native/sharedTypes.d.ts +1 -1
  40. package/cli/src/engine-native/syncConcurrency.ts +3 -3
  41. package/cli/src/engine-native/syncDispatch.ts +26 -92
  42. package/cli/src/engine-native/toolchain.ts +1 -5
  43. package/cli/src/generated/sotPayload.ts +339 -17
  44. package/cli/src/main.ts +3 -7
  45. package/cli/tsconfig.json +1 -0
  46. package/package.json +2 -2
  47. package/cli/src/checklistPrompt.ts +0 -464
  48. package/cli/src/commands/harnesses.ts +0 -77
  49. package/cli/src/commands/skills.ts +0 -40
  50. package/cli/src/engine-native/harnesses.ts +0 -138
  51. package/cli/src/engine-native/ompMarketplace.ts +0 -140
  52. package/cli/src/engine-native/skillsInstall.ts +0 -135
  53. package/cli/src/engine-native/skillsLinks.ts +0 -216
  54. package/cli/src/engine-native/skillsManifest.ts +0 -36
  55. package/cli/src/engine-native/skillsPrune.ts +0 -117
  56. package/cli/src/engine-native/skillsRecords.ts +0 -138
  57. package/cli/src/engine-native/skillsSync.ts +0 -57
  58. package/cli/src/manifests.ts +0 -53
  59. package/cli/src/terminalCells.ts +0 -191
@@ -3,7 +3,7 @@
3
3
  EngineNative is the only supported sync engine. It lives in
4
4
  `cli/src/engine-native/`. The `sync` and `toolchain` commands invoke it
5
5
  through `cli/src/engine.ts` and pass normalized argv to that seam. Other
6
- commands, such as `omp`, `harnesses`, `update`, `skills`, `scratch`, and
6
+ commands, such as `omp`, `update`, `scratch`, and
7
7
  `tidy`, import engine-native modules directly. The former
8
8
  shell engine was removed after the `bash-engine-final` tag.
9
9
  `DOCKS_KIT_ENGINE=bash` is now an explicit removed-engine diagnostic and exits
@@ -12,11 +12,12 @@ shell engine was removed after the `bash-engine-final` tag.
12
12
  ## Selection Contract
13
13
 
14
14
  - The public `sync` and `toolchain` commands route through `engine(args)`
15
- after `effect/cli` (the CLI module inside `effect` 4) parses pickers, target
16
- words, and flag spellings.
15
+ after `effect/cli` (the CLI module inside `effect` 4) parses pickers and flag
16
+ spellings. `sync` takes no positional argument, so `effect/cli` refuses a
17
+ word such as `omp` with `Unexpected positional argument` and exit 1.
17
18
  - Other public commands call engine-native modules directly, for example
18
19
  `tidy.ts` `planTidy` and `applyTidy`, `scratch.ts` `createScratchDir`, and
19
- `harnesses.ts` `readHarnessSelection`.
20
+ `ompSession.ts` `readOmpSessionModel`.
20
21
  - `DOCKS_KIT_ENGINE=native-raw` is harness-private: it bypasses `effect/cli`
21
22
  and hands argv directly to EngineNative so tests can exercise the internal
22
23
  engine vocabulary.
@@ -38,16 +39,11 @@ shell engine was removed after the `bash-engine-final` tag.
38
39
  the whole files, merges `config.yml` and runs the retired-key removals on
39
40
  the merged result, merges `models.yml` and runs its removals, writes the
40
41
  intercom configuration, materializes the kit plugin, and only then runs the
41
- marketplace and plugin passes, because the plugin pass links the kit plugin
42
- directory.
43
- - **Pipeline concurrency is bounded.** The selected skills and omp pipelines
44
- run through one input-ordered pool (`syncConcurrency.ts` `runBounded`). The
45
- production default cap is 3, so both pipelines run at once. After the first
46
- rejection, started pipelines drain and queued pipelines never start.
47
- `DOCKS_KIT_SYNC_CONCURRENCY=1` restores serial execution for golden tests
48
- and debugging. Each individual pipeline remains serial, and summaries keep
49
- the skills, omp order.
50
- - **External CLIs stay external.** `omp`, `npx`, `npm`, `bun`, and `curl` are
42
+ plugin pass, because the plugin pass links the kit plugin directory.
43
+ - **One pipeline.** Sync runs only the omp pipeline, which is serial.
44
+ `syncConcurrency.ts` `runBounded` stays for the parallel probes of `tidy`
45
+ and the tidy report.
46
+ - **External CLIs stay external.** `omp`, `npm`, `bun`, and `curl` are
51
47
  spawned with argv arrays, not shell command strings except where an external
52
48
  installer contract requires a script interpreter.
53
49
  - **Backups precede mutation.** Deployed settings/config files write `.bak`
@@ -117,15 +113,14 @@ bootstrap needs an installer download.
117
113
  the deliverable (the report table for `toolchain check`), so nothing prints
118
114
  after it. The schema below applies to `sync` only.
119
115
 
120
- The `--- Sync complete ---` block (stdout, `echo`) prints after the selected
121
- pipelines settle, also on dry-run. When a pipeline rejects, `syncDispatch.ts`
116
+ The `--- Sync complete ---` block (stdout, `echo`) prints after the omp
117
+ pipeline settles, also on dry-run. When the pipeline rejects, `syncDispatch.ts`
122
118
  `engineSync` skips the block and prints only the `--- Failures ---` ledger.
123
- The block starts with a `Repo:` line and adds the inventory lines of each
124
- selected target: `Skills:` and `omp:`/`omp plugins:`. Dry-run leaves out the
125
- `omp plugins:` line. Next-step advice lines print only when their trigger
126
- changed this run (an omp plugin upgraded → `/reload-plugins` line; omp files
127
- changed → restart line; skills changed → discovery line) or under
128
- `--verbose`.
119
+ The block starts with a `Repo:` line and adds the `omp:` and `omp plugins:`
120
+ inventory lines. Dry-run leaves out the `omp plugins:` line. Next-step advice
121
+ lines print only when their trigger changed this run (an omp plugin operation,
122
+ such as the uninstall of a retired marketplace plugin, or a changed omp file →
123
+ restart line) or under `--verbose`.
129
124
 
130
125
  ### Platform seam
131
126
 
@@ -134,7 +129,7 @@ holds the engine's host-detection `process.platform` read and keeps platform
134
129
  normalization injectable for tests. These direct reads remain:
135
130
 
136
131
  - the POSIX-only `chmod` guard in `kitDb.ts`;
137
- - the default `platform` argument of `harnesses.ts` `engineHome`;
132
+ - the default `platform` argument of `ompSession.ts` `engineHome`;
138
133
  - `exec.ts` `WINDOWS_PROCESS`;
139
134
  - `tidy.ts` `listProcesses`;
140
135
  - `tidyReport.ts` `memorySection`, `processSection`, `trashSection`,
@@ -161,8 +156,8 @@ on the host directly.
161
156
  `--verbose` / `-v` on the public `sync` and `toolchain` commands selects
162
157
  verbose output. On the harness-private raw channel,
163
158
  `DOCKS_KIT_VERBOSE=1` also selects it. Only the raw channel honors the
164
- unprefixed `Ctx` env globals (`engineCtx.ts makeCtx` reads `DRY_RUN`,
165
- `DOCKS_KIT_VERBOSE`, `PRUNE`, and `AGENTS_DIR`). `main.ts` passes `{ envGlobals: true }` to
159
+ unprefixed `Ctx` env globals (`engineCtx.ts makeCtx` reads `DRY_RUN` and
160
+ `DOCKS_KIT_VERBOSE`). `main.ts` passes `{ envGlobals: true }` to
166
161
  `runEngineNative` only on that channel. The public `engine()` seam ignores
167
162
  these variables.
168
163
  The default service factory returns a raw Logger. `runEngineNative` wraps the
@@ -175,15 +170,14 @@ active logger binding.
175
170
 
176
171
  | Module | Owns |
177
172
  | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
178
- | `parseArgs.ts` | engine usage, target selection, argv dispatch loop, legacy rename hints; re-exports the `parseHelp.ts` help text and early-exit error |
173
+ | `parseArgs.ts` | engine usage and the argv dispatch loop; re-exports the `parseHelp.ts` help text and early-exit error |
179
174
  | `index.ts` | entry routing (`toolchain`/`sync`) and the run-scoped verbosity gate |
180
175
  | `engineCtx.ts` | `Ctx` shape and `makeCtx`; the unprefixed env globals apply only on the native-raw channel |
181
- | `syncDispatch.ts` | pipeline selection, pool dispatch, run summary, next-step blocks, and the `--- Failures ---` ledger |
182
- | `syncConcurrency.ts` | input-ordered bounded pool (`runBounded`) |
176
+ | `syncDispatch.ts` | sync and folder locks, the omp pipeline call, run summary, next-step blocks, and the `--- Failures ---` ledger |
177
+ | `syncConcurrency.ts` | input-ordered bounded pool (`runBounded`) for the tidy probes |
183
178
  | `../payload.ts` | generated text payload reads and presentation-only source labels |
184
179
  | `bun.ts` | per-run memoized Bun resolution/bootstrap shared by the omp pipeline and direct toolchain ensure |
185
- | `skillsSync.ts` | universal-skill pipeline orchestration; `skillsManifest.ts` parses the manifest, `skillsInstall.ts` owns the install pass, `skillsLinks.ts` the ordered symlink/junction/copy fallback and `~/.claude/skills` entry healing, and `skillsPrune.ts` the prune and managed-skill snapshot |
186
- | `ompSync.ts` | omp pipeline orchestration and summary; `ompFileDeploy.ts`, `ompMarketplace.ts`, `ompPlugins.ts`, and `ompRemovals.ts` own the file, marketplace, plugin, and retired-key passes; `ompPaths.ts` resolves roots; `ompYaml.ts` merges YAML |
180
+ | `ompSync.ts` | omp pipeline orchestration and summary; `ompFileDeploy.ts`, `ompPlugins.ts`, and `ompRemovals.ts` own the file, plugin (with the marketplace-plugin retirement), and retired-key passes; `ompPaths.ts` resolves roots; `ompYaml.ts` merges YAML |
187
181
  | `toolchain.ts` | tool presence/version probes, verified-version floor reporting, report table |
188
182
  | `modes.ts` | direct `toolchain` mode |
189
183
  | `jq.ts` | the `Json` value type, object narrowing, jq-compatible codepoint ordering, and a parse that yields `undefined` instead of throwing |
@@ -199,11 +193,6 @@ active logger binding.
199
193
  x64.
200
194
  - Unsupported hosts fail before launcher fallback, dependency probes, downloads,
201
195
  settings writes, or sync work.
202
- - Directory linking is capability-driven. The host module supplies only the
203
- order while the runtime decides the outcome: symlink, then a Windows junction
204
- with an absolute target, then a recursive copy. Copies carry a kit marker so
205
- later sync can heal them back to a real link and prune can reclaim them
206
- without touching user-owned directories.
207
196
 
208
197
  ## Tests
209
198
 
@@ -10,12 +10,12 @@
10
10
  import { isAbsolute } from "node:path";
11
11
 
12
12
  import { capture, captureWithin, commandExists, p, which, type CaptureOutcome } from "./exec";
13
- import { engineHome } from "./harnesses";
13
+ import { engineHome } from "./ompSession";
14
14
  import { hostOs, platformName, rawPlatform } from "./os";
15
15
  import type { Invocation } from "./os/types";
16
16
  import { field } from "./toolchain";
17
17
 
18
- export type ToolId = "git" | "jq" | "curl" | "node" | "npm" | "npx" | "omp" | "bun";
18
+ export type ToolId = "git" | "jq" | "curl" | "npm" | "omp" | "bun";
19
19
 
20
20
  export type ProbeResult =
21
21
  | { readonly state: "present"; readonly path?: string }
@@ -144,15 +144,10 @@ export const DEPENDENCIES: Record<ToolId, DependencySpec> = {
144
144
  git: spec("git", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("git")),
145
145
  jq: spec("jq", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("jq")),
146
146
  curl: spec("curl", (pf = rawPlatform()) => hostOs(platformName(pf)).installHint("curl")),
147
- node: spec("node", () => "install Node.js via https://nodejs.org (or your package manager)"),
148
147
  npm: spec(
149
148
  "npm",
150
149
  () => "ships with Node.js — install via https://nodejs.org (or your package manager)",
151
150
  ),
152
- npx: spec(
153
- "npx",
154
- () => "ships with Node.js — install via https://nodejs.org (or your package manager)",
155
- ),
156
151
  omp: spec(
157
152
  "omp",
158
153
  () =>
@@ -3,37 +3,25 @@
3
3
  * the environment. Split from index.ts, which re-exports the public surface
4
4
  * so existing import paths keep working.
5
5
  */
6
- import { p } from "./exec";
7
- import { engineHome } from "./harnesses";
6
+ import { engineHome } from "./ompSession";
8
7
  import type { TerminalLease } from "./logger";
9
8
  import type { BunRuntimeState } from "./bun";
10
9
  import { kitHome } from "../kitHome";
11
10
  import type { EngineServices } from "./services";
12
- import type { SyncConcurrency } from "./syncConcurrency";
13
11
 
14
12
  export interface Ctx {
15
13
  readonly repoDir: string;
16
14
  readonly home: string;
17
- readonly agentsDir: string;
18
- readonly interactive: boolean;
19
15
  dryRun: boolean;
20
16
  verbose: boolean;
21
17
  skipPluginRefresh?: boolean;
22
- prune: boolean;
23
18
  /** Injected capability seam (logger/deps/platform) — see services.ts. */
24
19
  readonly services: EngineServices;
25
- syncConcurrency: SyncConcurrency;
26
20
  terminalLease?: TerminalLease;
27
21
  bunRuntime?: Promise<BunRuntimeState>;
28
- targetFilterSet: boolean;
29
- syncAgents: boolean;
30
- syncOmp: boolean;
31
22
  /** Per-run next-step triggers (Output Policy): advice prints only when its trigger changed or --verbose. */
32
23
  readonly nextStepTriggers: {
33
- skillsRestart: boolean;
34
24
  ompRestart: boolean;
35
- /** A marketplace plugin upgrade changed a version, so running omp sessions lost its folder. */
36
- ompPluginUpgraded: boolean;
37
25
  };
38
26
  /** Harness-CLI operations that failed this run; a non-empty list fails the sync. */
39
27
  readonly failures: Array<string>;
@@ -42,7 +30,7 @@ export interface Ctx {
42
30
  export interface CtxOptions {
43
31
  /**
44
32
  * True only on the harness-private native-raw channel: seed `Ctx` from the
45
- * unprefixed env globals DRY_RUN, DOCKS_KIT_VERBOSE, PRUNE, and AGENTS_DIR
33
+ * unprefixed env globals DRY_RUN and DOCKS_KIT_VERBOSE
46
34
  * (the historical ${VAR:-default} contract). The public CLI takes the same
47
35
  * behavior from flags.
48
36
  */
@@ -50,7 +38,7 @@ export interface CtxOptions {
50
38
  }
51
39
 
52
40
  /**
53
- * Build the run context. HOME and DOCKS_KIT_INTERACTIVE apply on every path;
41
+ * Build the run context. HOME applies on every path;
54
42
  * the env globals apply only when `options.envGlobals` is true.
55
43
  */
56
44
  export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
@@ -60,28 +48,12 @@ export function makeCtx(services: EngineServices, options: CtxOptions): Ctx {
60
48
  return {
61
49
  repoDir: kitHome(),
62
50
  home,
63
- agentsDir:
64
- globals["AGENTS_DIR"] !== undefined && globals["AGENTS_DIR"] !== ""
65
- ? globals["AGENTS_DIR"]
66
- : p(home, ".agents"),
67
- interactive:
68
- env["DOCKS_KIT_INTERACTIVE"] === "1" ||
69
- (env["DOCKS_KIT_INTERACTIVE"] !== "0" &&
70
- process.stdout.isTTY === true &&
71
- process.stdin.isTTY === true),
72
51
  dryRun: globals["DRY_RUN"] === "1",
73
52
  verbose: globals["DOCKS_KIT_VERBOSE"] === "1",
74
53
  skipPluginRefresh: false,
75
- prune: globals["PRUNE"] === "1",
76
- syncConcurrency: 3,
77
54
  services,
78
- targetFilterSet: false,
79
- syncAgents: false,
80
- syncOmp: false,
81
55
  nextStepTriggers: {
82
- skillsRestart: false,
83
56
  ompRestart: false,
84
- ompPluginUpgraded: false,
85
57
  },
86
58
  failures: [],
87
59
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Failure ledger for harness-CLI operations. A kit-managed marketplace or
3
- * plugin command that exits non-zero is recorded here so engineSync can list
2
+ * Failure ledger for harness-CLI operations. A kit-managed plugin or
3
+ * marketplace command that exits non-zero is recorded here so engineSync can list
4
4
  * it and exit non-zero instead of reporting a clean sync.
5
5
  */
6
6
  import type { Ctx } from "./index";
@@ -5,8 +5,8 @@
5
5
  * channel, which bypasses effect/cli so tests see the internal argv
6
6
  * vocabulary directly.
7
7
  *
8
- * Split: run context lives in `engineCtx.ts`, scheduling in
9
- * `syncConcurrency.ts`, and pipeline dispatch in `syncDispatch.ts`. This
8
+ * Split: run context lives in `engineCtx.ts`, the bounded runner in
9
+ * `syncConcurrency.ts`, and sync dispatch in `syncDispatch.ts`. This
10
10
  * module keeps the entry routing and re-exports the public surface so
11
11
  * existing import paths keep working.
12
12
  */
@@ -11,13 +11,14 @@ import { p } from "./exec";
11
11
 
12
12
  /**
13
13
  * Append-only. Never edit or reorder a shipped entry. A release that changes the
14
- * schema appends one SQL string. State tables (harness_selection, omp_session)
15
- * get data-preserving migrations; cache_entry may be dropped and recreated
14
+ * schema appends one SQL string. The state table omp_session gets
15
+ * data-preserving migrations; cache_entry may be dropped and recreated
16
16
  * because every row can be refetched.
17
17
  */
18
18
  const MIGRATIONS: ReadonlyArray<string> = [
19
- // omp_session.advisor_thinking has had no use since 0.22.22. It stays only
20
- // to keep schema 1, which older kits still open; nothing reads or writes it.
19
+ // omp_session.advisor_thinking has had no use since 0.22.22, and
20
+ // harness_selection has had no use since 0.24.0. They stay only to keep
21
+ // schema 1, which older kits still open; nothing reads or writes them.
21
22
  `CREATE TABLE harness_selection (
22
23
  harness TEXT PRIMARY KEY CHECK (harness IN ('claude','codex','agents','omp'))
23
24
  ) STRICT, WITHOUT ROWID;
@@ -88,9 +89,9 @@ function migrate(db: DatabaseSync): boolean {
88
89
  });
89
90
  }
90
91
 
91
- interface LegacyState {
92
- readonly harnesses: ReadonlyArray<string>;
93
- readonly session?: { selector: string; thinking: string | null };
92
+ interface LegacySession {
93
+ readonly selector: string;
94
+ readonly thinking: string | null;
94
95
  }
95
96
 
96
97
  export function isNonBlankString(value: unknown): value is string {
@@ -103,9 +104,9 @@ export function nonBlankOrNull(value: unknown): string | null {
103
104
  }
104
105
 
105
106
  // Same validation the JSON store applied: root object, version 1, non-blank
106
- // selector and levels. Unknown or duplicate harness names are dropped by the
107
- // table's CHECK and PRIMARY KEY through INSERT OR IGNORE.
108
- function parseLegacyState(file: string): LegacyState | undefined {
107
+ // selector and levels. The legacy harness selection is not imported: sync
108
+ // has one harness and reads no selection.
109
+ function parseLegacySession(file: string): LegacySession | undefined {
109
110
  let parsed: unknown;
110
111
  try {
111
112
  parsed = JSON.parse(readFileSync(file, "utf8")) as unknown;
@@ -115,43 +116,26 @@ function parseLegacyState(file: string): LegacyState | undefined {
115
116
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return undefined;
116
117
  if (!("version" in parsed) || parsed.version !== 1) return undefined;
117
118
 
118
- const rawHarnesses = "harnesses" in parsed ? parsed.harnesses : undefined;
119
- const harnesses = Array.isArray(rawHarnesses)
120
- ? rawHarnesses.filter((value): value is string => typeof value === "string")
121
- : [];
122
119
  const entry = "ompSession" in parsed ? parsed.ompSession : undefined;
123
- if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return { harnesses };
120
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return undefined;
124
121
  const selector = nonBlankOrNull("selector" in entry ? entry.selector : undefined);
125
- if (selector === null) return { harnesses };
122
+ if (selector === null) return undefined;
126
123
  return {
127
- harnesses,
128
- session: {
129
- selector,
130
- thinking: nonBlankOrNull("thinking" in entry ? entry.thinking : undefined),
131
- },
124
+ selector,
125
+ thinking: nonBlankOrNull("thinking" in entry ? entry.thinking : undefined),
132
126
  };
133
127
  }
134
128
 
135
129
  function importLegacyState(db: DatabaseSync, legacy: string): void {
136
130
  inTransaction(db, () => {
137
- const rows = db
138
- .prepare(
139
- "SELECT (SELECT count(*) FROM harness_selection) + (SELECT count(*) FROM omp_session) AS n",
140
- )
141
- .get()?.["n"];
131
+ const rows = db.prepare("SELECT count(*) AS n FROM omp_session").get()?.["n"];
142
132
  if (rows !== 0) return;
143
- const state = parseLegacyState(legacy);
144
- if (state === undefined) return;
145
- const insertHarness = db.prepare(
146
- "INSERT OR IGNORE INTO harness_selection (harness) VALUES (?)",
133
+ const session = parseLegacySession(legacy);
134
+ if (session === undefined) return;
135
+ db.prepare("INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)").run(
136
+ session.selector,
137
+ session.thinking,
147
138
  );
148
- for (const harness of state.harnesses) insertHarness.run(harness);
149
- if (state.session !== undefined) {
150
- db.prepare("INSERT INTO omp_session (id, selector, thinking) VALUES (1, ?, ?)").run(
151
- state.session.selector,
152
- state.session.thinking,
153
- );
154
- }
155
139
  });
156
140
  // An invalid file is renamed too, so no later run parses it again.
157
141
  try {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The `omp` child processes of a sync. Every `omp` command that the
3
- * marketplace and plugin passes run starts through `spawnOmp`, so each child
3
+ * plugin pass runs starts through `spawnOmp`, so each child
4
4
  * writes into the data root that the sync locked.
5
5
  */
6
6
  import { spawnProcess, type AsyncProcessOptions, type AsyncProcessResult } from "./exec";
@@ -47,7 +47,7 @@ export function toggleOpenAiFast(configText: string): FastToggle {
47
47
  /** Throw the error of the toggle when the deployed config.yml is missing. */
48
48
  export function requireDeployedConfig(configPath: string): void {
49
49
  if (!existsSync(configPath)) {
50
- throw new Error(`${configPath} does not exist; run 'docks-kit sync omp' first`);
50
+ throw new Error(`${configPath} does not exist; run 'docks-kit sync' first`);
51
51
  }
52
52
  }
53
53
 
@@ -6,19 +6,11 @@
6
6
  * the payload no longer lists. Split from ompSync.ts; the orchestration still
7
7
  * lives there.
8
8
  */
9
- import {
10
- chmodSync,
11
- existsSync,
12
- lstatSync,
13
- readFileSync,
14
- readdirSync,
15
- rmdirSync,
16
- unlinkSync,
17
- writeFileSync,
18
- } from "node:fs";
9
+ import { existsSync, lstatSync, readFileSync, readdirSync, rmdirSync, unlinkSync } from "node:fs";
19
10
 
20
11
  import { GENERATED_PACKAGE_VERSION } from "../generated/sotPayload";
21
- import { payloadBytes, payloadDisplayPath, payloadPaths } from "../payload";
12
+ import { payloadBytes, payloadPaths } from "../payload";
13
+ import { replaceFile } from "./atomicWrite";
22
14
  import { p } from "./exec";
23
15
  import type { Ctx } from "./index";
24
16
  import { isObject, parseJson } from "./jq";
@@ -69,9 +61,8 @@ export function syncKitPlugin(ctx: Ctx): void {
69
61
  }));
70
62
 
71
63
  if (ctx.dryRun) {
72
- for (const { source, target } of files) {
73
- echo(`[dry-run] cp ${payloadDisplayPath(source)} -> ${target}`);
74
- }
64
+ // One line for the folder: a line per file would grow with each plugin file.
65
+ echo(`[dry-run] sync embedded:${SOURCE_PREFIX} -> ${pluginDir}`);
75
66
  return;
76
67
  }
77
68
 
@@ -87,8 +78,8 @@ export function syncKitPlugin(ctx: Ctx): void {
87
78
  }
88
79
  ensureDirectory(target.slice(0, target.lastIndexOf("/")));
89
80
  if (existsSync(target) && readFileSync(target).equals(content)) continue;
90
- writeFileSync(target, content, { mode: 0o600 });
91
- chmodSync(target, 0o600);
81
+ // A rename, so a session that reads the file during a sync sees the old or the new file.
82
+ replaceFile(target, content, { mode: 0o600 });
92
83
  changed = true;
93
84
  }
94
85
  if (existsSync(pluginDir)) {
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import { createHash } from "node:crypto";
14
14
  import { delimiter } from "node:path";
15
- import type { OmpSessionModel } from "./harnesses";
15
+ import type { OmpSessionModel } from "./ompSession";
16
16
 
17
17
  export interface CatalogModel {
18
18
  readonly selector: string;