docks-kit 0.24.0 → 0.26.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.
- package/AGENTS.md +21 -136
- package/README.md +54 -9
- package/cli/dist/docks-kit.js +24688 -0
- package/cli/docs/command-guards.md +1 -1
- package/cli/docs/install.md +30 -9
- package/cli/docs/omp-context.md +1 -1
- package/cli/docs/omp-models.md +5 -4
- package/cli/docs/sync-layers.md +46 -75
- package/cli/docs/toolchain.md +4 -5
- package/cli/src/agentDocs/agentFirstCheck.ts +786 -0
- package/cli/src/agentDocs/bridgeCheck.ts +226 -0
- package/cli/src/agentDocs/commands.ts +63 -0
- package/cli/src/agentDocs/prTemplate.ts +211 -0
- package/cli/src/agentDocs/services.ts +202 -0
- package/cli/src/agentDocs/shared.ts +730 -0
- package/cli/src/agentDocs/verifySkill.ts +136 -0
- package/cli/src/argv.ts +25 -1
- package/cli/src/commands/agentDocs.ts +29 -0
- package/cli/src/commands/plan.ts +29 -0
- package/cli/src/commands/skill.ts +29 -0
- package/cli/src/commands/update.ts +90 -31
- package/cli/src/engine-native/DESIGN.md +5 -6
- package/cli/src/engine-native/engineCtx.ts +0 -3
- package/cli/src/engine-native/failures.ts +2 -2
- package/cli/src/engine-native/ompChild.ts +1 -1
- package/cli/src/engine-native/ompKitPlugin.ts +7 -16
- package/cli/src/engine-native/ompPlugins.ts +205 -221
- package/cli/src/engine-native/ompSync.ts +5 -14
- package/cli/src/generated/sotPayload.ts +308 -12
- package/cli/src/main.ts +12 -3
- package/cli/src/plan/bytes.ts +110 -0
- package/cli/src/plan/checkout.ts +341 -0
- package/cli/src/plan/commands.ts +1192 -0
- package/cli/src/plan/github.ts +816 -0
- package/cli/src/plan/records.ts +623 -0
- package/cli/src/plan/repository.ts +53 -0
- package/cli/src/plan/reviews.ts +292 -0
- package/cli/src/plan/services.ts +256 -0
- package/cli/src/plan/types.ts +164 -0
- package/cli/src/skills/commands.ts +142 -0
- package/cli/src/skills/config.json +30 -0
- package/cli/src/skills/files.ts +74 -0
- package/cli/src/skills/frontmatter.ts +148 -0
- package/cli/src/skills/guard.ts +366 -0
- package/cli/src/skills/kitGate.ts +406 -0
- package/cli/src/skills/rubric.ts +143 -0
- package/cli/tsconfig.json +1 -0
- package/package.json +7 -4
- package/cli/src/engine-native/ompMarketplace.ts +0 -140
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EngineNative omp plugin pass:
|
|
3
|
-
* pinned pi-intercom npm plugin, and the link of the kit plugin
|
|
4
|
-
* `ompKitPlugin.ts syncKitPlugin` writes. Split from ompSync.ts; the
|
|
2
|
+
* EngineNative omp plugin pass: the retirement of the docks marketplace
|
|
3
|
+
* plugins, the pinned pi-intercom npm plugin, and the link of the kit plugin
|
|
4
|
+
* that `ompKitPlugin.ts syncKitPlugin` writes. Split from ompSync.ts; the
|
|
5
5
|
* orchestration still lives there.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* gives a warning, not a sync failure. The kit plugin extension
|
|
13
|
-
* `pluginUpgrades.ts` reads that log.
|
|
7
|
+
* The kit plugin now ships the content of the retired `docks@docks` and
|
|
8
|
+
* `plan-lifecycle@docks` marketplace plugins. Each real sync uninstalls their
|
|
9
|
+
* user-scope installs, warns about their project-scope installs, and then
|
|
10
|
+
* removes the `docks` marketplace. A second sync after a successful
|
|
11
|
+
* retirement runs no omp mutation for it.
|
|
14
12
|
*/
|
|
15
|
-
import {
|
|
16
|
-
import { chmodSync, mkdirSync, readdirSync, realpathSync, unlinkSync } from "node:fs";
|
|
13
|
+
import { existsSync, readFileSync, realpathSync, rmSync } from "node:fs";
|
|
17
14
|
|
|
18
|
-
import { removeStaleTemporaries, replaceFile } from "./atomicWrite";
|
|
19
15
|
import { p, processFailureSummary } from "./exec";
|
|
20
16
|
import { recordFailure } from "./failures";
|
|
21
17
|
import type { Ctx } from "./index";
|
|
@@ -26,14 +22,12 @@ import type { OmpPaths } from "./ompPaths";
|
|
|
26
22
|
import { kitCacheDir } from "./scratch";
|
|
27
23
|
import { field } from "./toolchain";
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** The
|
|
32
|
-
const
|
|
33
|
-
/**
|
|
34
|
-
const
|
|
35
|
-
/** The version of an upgrade event when the inventory read did not give it. */
|
|
36
|
-
const UNKNOWN_VERSION = "unknown";
|
|
25
|
+
/** The marketplace plugins whose content the kit plugin now ships. */
|
|
26
|
+
const RETIRED_PLUGIN_IDS = ["docks@docks", "plan-lifecycle@docks"] as const;
|
|
27
|
+
/** The marketplace of the retired plugins. */
|
|
28
|
+
const RETIRED_MARKETPLACE = "docks";
|
|
29
|
+
/** The label of the marketplace in progress, failure, and summary texts. */
|
|
30
|
+
const RETIRED_MARKETPLACE_LABEL = `${RETIRED_MARKETPLACE} marketplace`;
|
|
37
31
|
|
|
38
32
|
// -------------------------------------------------------------- plugins ----
|
|
39
33
|
|
|
@@ -43,51 +37,38 @@ interface InstalledNpmPlugin {
|
|
|
43
37
|
readonly path: string | undefined;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
readonly marketplace: Map<string, string | undefined>;
|
|
49
|
-
readonly npm: Map<string, InstalledNpmPlugin>;
|
|
50
|
-
}
|
|
40
|
+
/** The install scopes of omp marketplace plugins. */
|
|
41
|
+
type MarketplaceScope = "user" | "project";
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
interface InstalledMarketplacePlugin {
|
|
44
|
+
/** The composite id `<plugin>@<marketplace>`. */
|
|
54
45
|
readonly id: string;
|
|
55
|
-
|
|
56
|
-
* Whether the inventory listed the plugin before the operation, or
|
|
57
|
-
* undefined when that inventory could not be read.
|
|
58
|
-
*/
|
|
59
|
-
readonly present: boolean | undefined;
|
|
60
|
-
readonly before: string | undefined;
|
|
46
|
+
readonly scope: MarketplaceScope;
|
|
61
47
|
}
|
|
62
48
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/** The time in milliseconds just after the omp command returned. */
|
|
68
|
-
readonly finishedAt: number;
|
|
69
|
-
})
|
|
70
|
-
| (VersionedOperation & { readonly kind: "npm" })
|
|
71
|
-
| { readonly kind: "link"; readonly id: string };
|
|
72
|
-
|
|
73
|
-
/** One marketplace plugin upgrade that changed the installed version or can have changed it. */
|
|
74
|
-
interface PluginUpgrade {
|
|
75
|
-
readonly id: string;
|
|
76
|
-
readonly before: string;
|
|
77
|
-
readonly after: string;
|
|
78
|
-
readonly finishedAt: number;
|
|
49
|
+
interface InstalledPlugins {
|
|
50
|
+
/** One row for each scope that holds a marketplace plugin. */
|
|
51
|
+
readonly marketplace: ReadonlyArray<InstalledMarketplacePlugin>;
|
|
52
|
+
readonly npm: Map<string, InstalledNpmPlugin>;
|
|
79
53
|
}
|
|
80
54
|
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
55
|
+
/** One successful plugin operation, named in the sync summary line. */
|
|
56
|
+
type PluginOperation =
|
|
57
|
+
| {
|
|
58
|
+
readonly kind: "npm";
|
|
59
|
+
readonly id: string;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the inventory listed the plugin before the operation, or
|
|
62
|
+
* undefined when that inventory could not be read.
|
|
63
|
+
*/
|
|
64
|
+
readonly present: boolean | undefined;
|
|
65
|
+
readonly before: string | undefined;
|
|
66
|
+
}
|
|
67
|
+
| { readonly kind: "link"; readonly id: string }
|
|
68
|
+
| { readonly kind: "uninstall"; readonly id: string }
|
|
69
|
+
| { readonly kind: "marketplaceRemove" };
|
|
89
70
|
|
|
90
|
-
async function
|
|
71
|
+
async function installedPluginsFromCli(paths: OmpPaths): Promise<InstalledPlugins | undefined> {
|
|
91
72
|
const result = await spawnOmp(paths, ["plugin", "list", "--json"], ["ignore", "pipe", "ignore"]);
|
|
92
73
|
if (result.error !== undefined || result.exitCode !== 0) return undefined;
|
|
93
74
|
|
|
@@ -102,15 +83,15 @@ async function installedPluginIdsFromCli(paths: OmpPaths): Promise<InstalledPlug
|
|
|
102
83
|
}
|
|
103
84
|
|
|
104
85
|
// `omp plugin list --json` reports marketplace rows as
|
|
105
|
-
// `{ id: "<plugin>@<marketplace>", scope, entries: [...] }
|
|
106
|
-
// is
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
// `user` row counts as installed for this pipeline.
|
|
110
|
-
const marketplace = new Map<string, string | undefined>();
|
|
86
|
+
// `{ id: "<plugin>@<marketplace>", scope, entries: [...] }`. The composite
|
|
87
|
+
// id is the token that `omp plugin uninstall` takes. omp emits one row for
|
|
88
|
+
// each scope that holds the plugin.
|
|
89
|
+
const marketplace: Array<InstalledMarketplacePlugin> = [];
|
|
111
90
|
for (const row of value["marketplace"]) {
|
|
112
|
-
if (!isObject(row) || typeof row["id"] !== "string"
|
|
113
|
-
|
|
91
|
+
if (!isObject(row) || typeof row["id"] !== "string") continue;
|
|
92
|
+
const scope = row["scope"];
|
|
93
|
+
if (scope !== "user" && scope !== "project") continue;
|
|
94
|
+
marketplace.push({ id: row["id"], scope });
|
|
114
95
|
}
|
|
115
96
|
|
|
116
97
|
const npm = new Map<string, InstalledNpmPlugin>();
|
|
@@ -124,23 +105,29 @@ async function installedPluginIdsFromCli(paths: OmpPaths): Promise<InstalledPlug
|
|
|
124
105
|
}
|
|
125
106
|
|
|
126
107
|
/**
|
|
127
|
-
* Names one operation
|
|
108
|
+
* Names one operation. For an npm operation, `after` is the inventory read
|
|
128
109
|
* after all operations; when it does not give a version, only the id remains.
|
|
129
110
|
*/
|
|
130
111
|
function describeOperation(
|
|
131
112
|
operation: PluginOperation,
|
|
132
113
|
after: InstalledPlugins | undefined,
|
|
133
114
|
): string {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
115
|
+
switch (operation.kind) {
|
|
116
|
+
case "link":
|
|
117
|
+
return `${operation.id} linked`;
|
|
118
|
+
case "uninstall":
|
|
119
|
+
return `${operation.id} uninstalled`;
|
|
120
|
+
case "marketplaceRemove":
|
|
121
|
+
return `${RETIRED_MARKETPLACE_LABEL} removed`;
|
|
122
|
+
case "npm": {
|
|
123
|
+
const version = after?.npm.get(operation.id)?.version;
|
|
124
|
+
if (version === undefined) return operation.id;
|
|
125
|
+
if (operation.present === false) return `${operation.id} ${version} (new)`;
|
|
126
|
+
if (operation.before === undefined) return `${operation.id} ${version}`;
|
|
127
|
+
if (operation.before === version) return `${operation.id} ${version} (current)`;
|
|
128
|
+
return `${operation.id} ${operation.before} -> ${version}`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
144
131
|
}
|
|
145
132
|
|
|
146
133
|
async function runPluginCommand(
|
|
@@ -170,103 +157,134 @@ function realPath(path: string): string | undefined {
|
|
|
170
157
|
}
|
|
171
158
|
}
|
|
172
159
|
|
|
160
|
+
// ----------------------------------------------------------- retirement ----
|
|
161
|
+
|
|
173
162
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* each upgrade of a present plugin counts as a change to `unknown`.
|
|
163
|
+
* What a registry file says about the `docks` marketplace. `unreadable` names a
|
|
164
|
+
* file that exists but cannot be read or parsed: it can still hold the entry.
|
|
177
165
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
const version = after.marketplace.get(id);
|
|
192
|
-
if (before === undefined || version === undefined || version === before) continue;
|
|
193
|
-
upgrades.push({ id, before, after: version, finishedAt });
|
|
166
|
+
type RegistryState =
|
|
167
|
+
| { readonly kind: "listed" | "absent" }
|
|
168
|
+
| { readonly kind: "unreadable"; readonly file: string };
|
|
169
|
+
|
|
170
|
+
function registryState(registryFile: string): RegistryState | { readonly kind: "missing" } {
|
|
171
|
+
let registryText: string;
|
|
172
|
+
try {
|
|
173
|
+
registryText = readFileSync(registryFile, "utf8");
|
|
174
|
+
} catch (error) {
|
|
175
|
+
// Only a missing path is no registry; a denied or failed read can hide the entry.
|
|
176
|
+
const code = typeof error === "object" && error !== null && "code" in error ? error.code : "";
|
|
177
|
+
if (code === "ENOENT" || code === "ENOTDIR") return { kind: "missing" };
|
|
178
|
+
return { kind: "unreadable", file: registryFile };
|
|
194
179
|
}
|
|
195
|
-
|
|
180
|
+
const registry = parseJson(registryText);
|
|
181
|
+
if (registry === undefined) return { kind: "unreadable", file: registryFile };
|
|
182
|
+
if (isObject(registry) && Object.hasOwn(registry, RETIRED_MARKETPLACE)) return { kind: "listed" };
|
|
183
|
+
|
|
184
|
+
const entries = Array.isArray(registry)
|
|
185
|
+
? registry
|
|
186
|
+
: isObject(registry) && Array.isArray(registry["marketplaces"])
|
|
187
|
+
? registry["marketplaces"]
|
|
188
|
+
: [];
|
|
189
|
+
return entries.some((entry) => isObject(entry) && entry["name"] === RETIRED_MARKETPLACE)
|
|
190
|
+
? { kind: "listed" }
|
|
191
|
+
: { kind: "absent" };
|
|
196
192
|
}
|
|
197
193
|
|
|
198
194
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
195
|
+
* Whether omp knows the `docks` marketplace. omp reads the active registry
|
|
196
|
+
* `<data root>/marketplaces.json`. Upstream `getMarketplacesRegistryPath`
|
|
197
|
+
* copies a legacy `<config root>/marketplaces.json` forward only when it
|
|
198
|
+
* resolves an XDG data root that has no active registry yet. So a legacy
|
|
199
|
+
* entry counts only when no active registry exists; beside an active
|
|
200
|
+
* registry it is stale.
|
|
201
201
|
*/
|
|
202
|
-
function
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
unlinkSync(p(dir, event.name));
|
|
215
|
-
} catch (error) {
|
|
216
|
-
// A concurrent sync removed the same file first.
|
|
217
|
-
const code = typeof error === "object" && error !== null && "code" in error ? error.code : "";
|
|
218
|
-
if (code !== "ENOENT") throw error;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
202
|
+
function docksRegistryState(paths: OmpPaths): RegistryState {
|
|
203
|
+
const active = registryState(p(paths.dataRoot, "marketplaces.json"));
|
|
204
|
+
if (active.kind !== "missing") return active;
|
|
205
|
+
if (paths.dataRoot === paths.configRoot) return { kind: "absent" };
|
|
206
|
+
const legacy = registryState(p(paths.configRoot, "marketplaces.json"));
|
|
207
|
+
return legacy.kind === "missing" ? { kind: "absent" } : legacy;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** The warning for a registry that can hold the `docks` entry but cannot be read. */
|
|
211
|
+
function unreadableRegistryWarning(file: string): string {
|
|
212
|
+
return `omp marketplace registry ${file} cannot be read or parsed — the docks marketplace is not removed; repair the file, then run docks-kit sync again`;
|
|
221
213
|
}
|
|
222
214
|
|
|
223
215
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* Returns a warning when a step fails. It does not throw, because the
|
|
227
|
-
* upgrades are already done and the sync must still give its upgrade advice.
|
|
216
|
+
* Removes the folder of the retired plugin upgrade log, which only the
|
|
217
|
+
* marketplace plugin upgrades wrote. The kit owns the folder.
|
|
228
218
|
*/
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
219
|
+
function removeUpgradeLog(ctx: Ctx): void {
|
|
220
|
+
const dir = p(kitCacheDir(ctx.home), "omp-plugin-upgrades");
|
|
221
|
+
if (!existsSync(dir)) return;
|
|
232
222
|
try {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
for (const upgrade of upgrades) {
|
|
236
|
-
const event = {
|
|
237
|
-
version: 1,
|
|
238
|
-
id: upgrade.id,
|
|
239
|
-
before: upgrade.before,
|
|
240
|
-
after: upgrade.after,
|
|
241
|
-
finishedAt: new Date(upgrade.finishedAt).toISOString(),
|
|
242
|
-
};
|
|
243
|
-
const name = `${upgrade.finishedAt}-${randomBytes(8).toString("hex")}.json`;
|
|
244
|
-
// replaceFile writes a temporary name in the same folder and renames it into place.
|
|
245
|
-
replaceFile(p(dir, name), `${JSON.stringify(event)}\n`, { mode: 0o600 });
|
|
246
|
-
}
|
|
223
|
+
rmSync(dir, { recursive: true, force: true });
|
|
224
|
+
ctx.services.logger.verbose(`removed the retired omp plugin upgrade log ${dir}`);
|
|
247
225
|
} catch (error) {
|
|
248
226
|
const detail = error instanceof Error ? error.message : String(error);
|
|
249
|
-
|
|
227
|
+
ctx.services.logger.warn(`retired omp plugin upgrade log not removed: ${detail}`);
|
|
250
228
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Uninstalls each user-scope install of a retired plugin and warns about each
|
|
233
|
+
* project-scope install, which belongs to that project. Then removes the
|
|
234
|
+
* `docks` marketplace when no uninstall failed and omp knows the marketplace.
|
|
235
|
+
* Returns the successful operations.
|
|
236
|
+
*/
|
|
237
|
+
async function retireMarketplacePlugins(
|
|
238
|
+
ctx: Ctx,
|
|
239
|
+
paths: OmpPaths,
|
|
240
|
+
installed: InstalledPlugins,
|
|
241
|
+
): Promise<Array<PluginOperation>> {
|
|
242
|
+
const { warn } = ctx.services.logger;
|
|
243
|
+
const operations: Array<PluginOperation> = [];
|
|
244
|
+
let uninstallFailed = false;
|
|
245
|
+
|
|
246
|
+
for (const pluginId of RETIRED_PLUGIN_IDS) {
|
|
247
|
+
const rows = installed.marketplace.filter((row) => row.id === pluginId);
|
|
248
|
+
if (rows.some((row) => row.scope === "project")) {
|
|
249
|
+
warn(
|
|
250
|
+
`omp plugin ${pluginId} is installed at project scope and docks-kit no longer ships it; run from that project: omp plugin uninstall --scope project ${pluginId}`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
if (!rows.some((row) => row.scope === "user")) continue;
|
|
254
|
+
|
|
255
|
+
const args = ["plugin", "uninstall", "--scope", "user", pluginId];
|
|
256
|
+
if (await runPluginCommand(ctx, paths, pluginId, args)) {
|
|
257
|
+
operations.push({ kind: "uninstall", id: pluginId });
|
|
258
|
+
} else {
|
|
259
|
+
uninstallFailed = true;
|
|
260
|
+
}
|
|
257
261
|
}
|
|
258
|
-
|
|
262
|
+
|
|
263
|
+
// A failed uninstall keeps the marketplace, so the manual command still resolves the id.
|
|
264
|
+
if (uninstallFailed) return operations;
|
|
265
|
+
const registry = docksRegistryState(paths);
|
|
266
|
+
if (registry.kind === "unreadable") {
|
|
267
|
+
warn(unreadableRegistryWarning(registry.file));
|
|
268
|
+
} else if (registry.kind === "listed") {
|
|
269
|
+
const args = ["plugin", "marketplace", "remove", RETIRED_MARKETPLACE];
|
|
270
|
+
if (await runPluginCommand(ctx, paths, RETIRED_MARKETPLACE_LABEL, args)) {
|
|
271
|
+
operations.push({ kind: "marketplaceRemove" });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return operations;
|
|
259
275
|
}
|
|
260
276
|
|
|
261
277
|
/** Run the plugin pass. `paths` are the omp paths that the sync locked. */
|
|
262
278
|
export async function syncPlugins(ctx: Ctx, paths: OmpPaths): Promise<number> {
|
|
263
279
|
const { change, clearProgress, echo, progress, verbose, warn } = ctx.services.logger;
|
|
264
280
|
|
|
281
|
+
if (!ctx.dryRun) removeUpgradeLog(ctx);
|
|
282
|
+
|
|
265
283
|
if (ctx.services.deps.probe("omp").state === "missing") {
|
|
266
284
|
ctx.services.deps.warnMissing(
|
|
267
285
|
"omp",
|
|
268
286
|
ctx.services.logger,
|
|
269
|
-
"deployed omp config only —
|
|
287
|
+
"deployed omp config only — plugin pass skipped; re-run sync after installing",
|
|
270
288
|
);
|
|
271
289
|
return 0;
|
|
272
290
|
}
|
|
@@ -274,15 +292,23 @@ export async function syncPlugins(ctx: Ctx, paths: OmpPaths): Promise<number> {
|
|
|
274
292
|
ctx.services.deps.warnMissing(
|
|
275
293
|
"git",
|
|
276
294
|
ctx.services.logger,
|
|
277
|
-
"
|
|
295
|
+
"omp plugin pass skipped; re-run sync after installing",
|
|
278
296
|
);
|
|
279
297
|
return 0;
|
|
280
298
|
}
|
|
281
299
|
|
|
300
|
+
const piIntercomPin = field("pi-intercom", "verified");
|
|
301
|
+
|
|
282
302
|
if (ctx.dryRun) {
|
|
283
|
-
|
|
284
|
-
for (const pluginId of
|
|
285
|
-
echo(`[dry-run] omp plugin
|
|
303
|
+
// A dry run reads no inventory, so it previews the uninstall of each retired id.
|
|
304
|
+
for (const pluginId of RETIRED_PLUGIN_IDS) {
|
|
305
|
+
echo(`[dry-run] omp plugin uninstall --scope user ${pluginId}`);
|
|
306
|
+
}
|
|
307
|
+
const registry = docksRegistryState(paths);
|
|
308
|
+
if (registry.kind === "unreadable") {
|
|
309
|
+
warn(unreadableRegistryWarning(registry.file));
|
|
310
|
+
} else if (registry.kind === "listed") {
|
|
311
|
+
echo(`[dry-run] omp plugin marketplace remove ${RETIRED_MARKETPLACE}`);
|
|
286
312
|
}
|
|
287
313
|
if (piIntercomPin === "") {
|
|
288
314
|
warn(
|
|
@@ -295,47 +321,24 @@ export async function syncPlugins(ctx: Ctx, paths: OmpPaths): Promise<number> {
|
|
|
295
321
|
return 0;
|
|
296
322
|
}
|
|
297
323
|
|
|
298
|
-
const piIntercomPin = field("pi-intercom", "verified");
|
|
299
|
-
|
|
300
324
|
progress("Checking installed omp plugins...");
|
|
301
|
-
const installed = await
|
|
325
|
+
const installed = await installedPluginsFromCli(paths);
|
|
302
326
|
clearProgress();
|
|
327
|
+
|
|
328
|
+
const operations: Array<PluginOperation> = [];
|
|
303
329
|
if (installed === undefined) {
|
|
304
|
-
warn(
|
|
330
|
+
warn(
|
|
331
|
+
"omp plugin inventory unavailable — retirement of the docks marketplace plugins skipped until the next sync; pi-intercom and the kit plugin take the full refresh path",
|
|
332
|
+
);
|
|
333
|
+
} else {
|
|
334
|
+
operations.push(...(await retireMarketplacePlugins(ctx, paths, installed)));
|
|
305
335
|
}
|
|
306
336
|
|
|
307
337
|
let pluginsInstalled =
|
|
308
338
|
installed === undefined
|
|
309
339
|
? 0
|
|
310
|
-
:
|
|
311
|
-
(piIntercomPin !== "" && installed.npm.has("pi-intercom") ? 1 : 0) +
|
|
340
|
+
: (piIntercomPin !== "" && installed.npm.has("pi-intercom") ? 1 : 0) +
|
|
312
341
|
(installed.npm.has(KIT_PLUGIN_NAME) ? 1 : 0);
|
|
313
|
-
const operations: Array<PluginOperation> = [];
|
|
314
|
-
|
|
315
|
-
for (const pluginId of MARKETPLACE_PLUGIN_IDS) {
|
|
316
|
-
const present = installed?.marketplace.has(pluginId) === true;
|
|
317
|
-
if (present && ctx.skipPluginRefresh === true) {
|
|
318
|
-
verbose(`omp plugin ${pluginId} already installed; refresh-only update skipped`);
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const args = present
|
|
323
|
-
? ["plugin", "upgrade", "--scope", "user", pluginId]
|
|
324
|
-
: ["plugin", "install", "--scope", "user", pluginId];
|
|
325
|
-
const succeeded = await runPluginCommand(ctx, paths, pluginId, args);
|
|
326
|
-
// The operation boundary: an omp process that started later loaded the new folder.
|
|
327
|
-
const finishedAt = Date.now();
|
|
328
|
-
if (succeeded) {
|
|
329
|
-
operations.push({
|
|
330
|
-
kind: "marketplace",
|
|
331
|
-
id: pluginId,
|
|
332
|
-
present: installed === undefined ? undefined : present,
|
|
333
|
-
before: installed?.marketplace.get(pluginId),
|
|
334
|
-
finishedAt,
|
|
335
|
-
});
|
|
336
|
-
if (!present) pluginsInstalled++;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
342
|
|
|
340
343
|
if (piIntercomPin === "") {
|
|
341
344
|
warn("pi-intercom install skipped because SoT/toolchain.json has no verified pi-intercom pin");
|
|
@@ -374,44 +377,25 @@ export async function syncPlugins(ctx: Ctx, paths: OmpPaths): Promise<number> {
|
|
|
374
377
|
if (installed?.npm.has(KIT_PLUGIN_NAME) !== true) pluginsInstalled++;
|
|
375
378
|
}
|
|
376
379
|
|
|
377
|
-
if (operations.length
|
|
378
|
-
|
|
380
|
+
if (operations.length === 0) {
|
|
381
|
+
verbose("omp plugins already in sync");
|
|
382
|
+
return pluginsInstalled;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Only an npm operation names a version, so only then a second inventory
|
|
386
|
+
// read gives the versions that the operations left.
|
|
387
|
+
let after: InstalledPlugins | undefined;
|
|
388
|
+
if (operations.some((operation) => operation.kind === "npm")) {
|
|
379
389
|
progress("Reading omp plugin versions...");
|
|
380
|
-
|
|
390
|
+
after = await installedPluginsFromCli(paths);
|
|
381
391
|
clearProgress();
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
// version, an npm install, or a link) still needs a restart.
|
|
390
|
-
const upgradedIds = new Set(upgrades.map((upgrade) => upgrade.id));
|
|
391
|
-
if (
|
|
392
|
-
operations.some(
|
|
393
|
-
(operation) => operation.kind !== "marketplace" || !upgradedIds.has(operation.id),
|
|
394
|
-
)
|
|
395
|
-
) {
|
|
396
|
-
ctx.nextStepTriggers.ompRestart = true;
|
|
397
|
-
}
|
|
398
|
-
if (after === undefined && upgrades.length > 0) {
|
|
399
|
-
warn(
|
|
400
|
-
"omp plugin versions could not be read after the upgrade — each upgraded plugin counts as changed",
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
for (const upgrade of upgrades) {
|
|
404
|
-
warn(
|
|
405
|
-
`omp plugin ${upgrade.id} ${upgrade.before} -> ${upgrade.after}: running omp sessions lose its plugin agents until they run /reload-plugins and read its skills again through skill:// (restart omp instead when the plugin ships hooks, extension modules, or non-MCP tools).`,
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
if (upgrades.length > 0) {
|
|
409
|
-
ctx.nextStepTriggers.ompPluginUpgraded = true;
|
|
410
|
-
const logFailure = recordUpgrades(ctx.home, upgrades);
|
|
411
|
-
if (logFailure !== undefined) warn(logFailure);
|
|
412
|
-
}
|
|
413
|
-
} else {
|
|
414
|
-
verbose("omp plugins already in sync");
|
|
392
|
+
}
|
|
393
|
+
const items = operations.map((operation) => describeOperation(operation, after));
|
|
394
|
+
change(`omp plugins synced: ${items.join(", ")}`);
|
|
395
|
+
// An install, a link, or an uninstall changes the plugins that omp loads.
|
|
396
|
+
// A marketplace removal alone changes no loaded plugin.
|
|
397
|
+
if (operations.some((operation) => operation.kind !== "marketplaceRemove")) {
|
|
398
|
+
ctx.nextStepTriggers.ompRestart = true;
|
|
415
399
|
}
|
|
416
400
|
return pluginsInstalled;
|
|
417
401
|
}
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* subcommand runs under ctx.dryRun.
|
|
9
9
|
*
|
|
10
10
|
* Split: file deploy lives in `ompFileDeploy.ts`, the kit plugin files in
|
|
11
|
-
* `ompKitPlugin.ts`, the
|
|
12
|
-
*
|
|
13
|
-
* This module keeps the orchestration plus the summary
|
|
11
|
+
* `ompKitPlugin.ts`, the plugin pass (with the retirement of the docks
|
|
12
|
+
* marketplace plugins) in `ompPlugins.ts`, and the retired-key prune in
|
|
13
|
+
* `ompRemovals.ts`. This module keeps the orchestration plus the summary
|
|
14
|
+
* surface.
|
|
14
15
|
*/
|
|
15
16
|
import { isAbsolute, resolve } from "node:path";
|
|
16
17
|
|
|
@@ -22,7 +23,6 @@ import { ompPaths, type OmpPaths } from "./ompPaths";
|
|
|
22
23
|
import { mergeOmpConfig, mergeOmpModels } from "./ompYaml";
|
|
23
24
|
import { ensureDirectory, syncMergedYaml, syncWholeFile } from "./ompFileDeploy";
|
|
24
25
|
import { syncKitPlugin } from "./ompKitPlugin";
|
|
25
|
-
import { syncMarketplace } from "./ompMarketplace";
|
|
26
26
|
import { syncPlugins } from "./ompPlugins";
|
|
27
27
|
import { syncOmpModelRemovals, syncOmpRemovals } from "./ompRemovals";
|
|
28
28
|
|
|
@@ -107,7 +107,6 @@ export async function ompSync(ctx: Ctx, folders: OmpWriteFolders): Promise<OmpSt
|
|
|
107
107
|
// The plugin pass links this directory, so the files must exist first.
|
|
108
108
|
syncKitPlugin(ctx);
|
|
109
109
|
|
|
110
|
-
await syncMarketplace(ctx, paths);
|
|
111
110
|
const pluginsInstalled = await syncPlugins(ctx, paths);
|
|
112
111
|
|
|
113
112
|
// omp adopts `$XDG_DATA_HOME/omp` once it exists. When another sync created
|
|
@@ -137,17 +136,9 @@ export function ompSummary(ctx: Ctx, state: OmpState): void {
|
|
|
137
136
|
if (!ctx.dryRun) echo(`omp plugins: ${state.pluginsInstalled} installed`);
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
/**
|
|
141
|
-
* The omp next steps. The upgrade rule and the restart advice are independent,
|
|
142
|
-
* because a sync can upgrade a plugin and also change a file that needs a restart.
|
|
143
|
-
*/
|
|
139
|
+
/** The omp next steps. */
|
|
144
140
|
export function ompNextSteps(ctx: Ctx): Array<string> {
|
|
145
141
|
const steps: Array<string> = [];
|
|
146
|
-
if (ctx.nextStepTriggers.ompPluginUpgraded) {
|
|
147
|
-
steps.push(
|
|
148
|
-
"Run /reload-plugins in each running omp session, then read each plugin skill again through skill://. Restart omp instead when an upgraded plugin ships hooks, extension modules, or non-MCP tools.",
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
142
|
if (ctx.verbose || ctx.nextStepTriggers.ompRestart) {
|
|
152
143
|
steps.push("Restart omp to load any refreshed plugins, skills, or tools.");
|
|
153
144
|
}
|