@aerovato/operator-helper 1.3.1 → 1.4.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/dist/index.js +75 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17998,7 +17998,7 @@ var Uint8Array2 = /* @__PURE__ */ instanceOf(globalThis.Uint8Array, {
|
|
|
17998
17998
|
// package.json
|
|
17999
17999
|
var package_default = {
|
|
18000
18000
|
name: "@aerovato/operator-helper",
|
|
18001
|
-
version: "1.
|
|
18001
|
+
version: "1.4.0",
|
|
18002
18002
|
description: "Installation and setup CLI for Operator Memory",
|
|
18003
18003
|
license: "BSD-3-Clause",
|
|
18004
18004
|
author: "Aerovato Research",
|
|
@@ -18378,7 +18378,7 @@ var PROJECT_SETUP_TEMPLATE = `# Project Setup
|
|
|
18378
18378
|
|
|
18379
18379
|
You are helping the user configure the Operator Project Brain across the private \`.operator/\` partition and shared \`.operator-shared/\` partition.
|
|
18380
18380
|
|
|
18381
|
-
Project indexing is
|
|
18381
|
+
Project indexing is excluded from the setup phases; you offer it as the final step in Phase 7.
|
|
18382
18382
|
|
|
18383
18383
|
**Document syntax:** Index and catalog structure, entry syntax, and examples are defined in the fixed preamble (Project Index and Partition Catalog sections). **You must follow that preamble document syntax** when creating or filling indexes and catalogs. Do not invent layouts. \`operator-helper project init\` seeds Private core files with the canonical syntax; fill or rewrite from the preamble. Operator Instructions and Shared README seeds are in the Canonical Seeds section below.
|
|
18384
18384
|
|
|
@@ -18518,22 +18518,18 @@ Ask whether anything is incorrect, missing, too strict, too permissive, improper
|
|
|
18518
18518
|
|
|
18519
18519
|
Apply approved corrections and finish only after the user confirms the setup. Do not end the session in this phase.
|
|
18520
18520
|
|
|
18521
|
-
## Phase 7:
|
|
18521
|
+
## Phase 7: Offer Indexing
|
|
18522
18522
|
|
|
18523
|
-
|
|
18523
|
+
After the user has confirmed Project Setup: Notice that the index has not been populated yet, then offer to index.
|
|
18524
18524
|
|
|
18525
|
-
|
|
18525
|
+
Offer the user two choices:
|
|
18526
18526
|
|
|
18527
|
-
|
|
18527
|
+
1. Index now, in this conversation. You run \`operator-helper index status\` and \`operator-helper index guide\` yourself and follow the Project Index Setup guide immediately. Helper output is working context; do not reproduce it for the user.
|
|
18528
|
+
2. Start a new conversation and run \`/operator:index\` in their harness to build or refresh the Project Index.
|
|
18528
18529
|
|
|
18529
|
-
|
|
18530
|
+
Recommendation: for a small or medium codebase, including greenfield, recommend indexing now — it is fast and the setup context is still loaded. For a large codebase, recommend a new conversation so the indexing agent starts with clean context, while still offering to index here.
|
|
18530
18531
|
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
1. Project Setup is complete.
|
|
18534
|
-
2. They should start a new conversation and run \`/operator:index\` in their harness to build or refresh the Project Index.
|
|
18535
|
-
|
|
18536
|
-
Stop after delivering this handoff unless the user asks something else about setup.
|
|
18532
|
+
If the user declines, tell them \`/operator:index\` is available anytime later. Stop after this phase unless the user asks something else about setup.
|
|
18537
18533
|
|
|
18538
18534
|
## Canonical Seeds
|
|
18539
18535
|
|
|
@@ -19203,6 +19199,9 @@ var installCodex = fn2("installCodex")(function* (context) {
|
|
|
19203
19199
|
if (!marketplace.ok)
|
|
19204
19200
|
return marketplace.result;
|
|
19205
19201
|
const addMarketplace = yield* runProcess("codex", ["plugin", "marketplace", "add", marketplace.path, "--json"], context.cwd, { NPM_CONFIG_MIN_RELEASE_AGE: "0" });
|
|
19202
|
+
if (!addMarketplace.ok && isMissingBinary(addMarketplace.error)) {
|
|
19203
|
+
return yield* registerDesktopMarketplace(context, marketplace.path);
|
|
19204
|
+
}
|
|
19206
19205
|
const addFailure = commandFailure(addMarketplace, "Codex marketplace installation failed");
|
|
19207
19206
|
if (addFailure !== null)
|
|
19208
19207
|
return addFailure;
|
|
@@ -19262,6 +19261,68 @@ function writeMarketplace(home) {
|
|
|
19262
19261
|
}
|
|
19263
19262
|
});
|
|
19264
19263
|
}
|
|
19264
|
+
function isMissingBinary(error) {
|
|
19265
|
+
return error.startsWith("NotFound:");
|
|
19266
|
+
}
|
|
19267
|
+
function registerDesktopMarketplace(context, marketplacePath) {
|
|
19268
|
+
return promise2(async () => {
|
|
19269
|
+
const codexHome = process.env.CODEX_HOME || join3(context.home, ".codex");
|
|
19270
|
+
const config = join3(codexHome, "config.toml");
|
|
19271
|
+
try {
|
|
19272
|
+
const content = await readOptionalFile(config);
|
|
19273
|
+
await mkdir3(codexHome, { recursive: true });
|
|
19274
|
+
await writeFile4(config, upsertMarketplaceTable(content, marketplacePath));
|
|
19275
|
+
} catch (error) {
|
|
19276
|
+
return {
|
|
19277
|
+
exitCode: 1,
|
|
19278
|
+
output: `✗ Could not register the Codex marketplace: ${getErrorMessage(error)}`
|
|
19279
|
+
};
|
|
19280
|
+
}
|
|
19281
|
+
return {
|
|
19282
|
+
exitCode: 0,
|
|
19283
|
+
output: [
|
|
19284
|
+
"✓ Registered the Operator Codex marketplace",
|
|
19285
|
+
"Codex CLI unavailable: install aerovato@operator-memory from the Codex plugins browser, then start a new session and approve the Operator hooks."
|
|
19286
|
+
].join(`
|
|
19287
|
+
`)
|
|
19288
|
+
};
|
|
19289
|
+
});
|
|
19290
|
+
}
|
|
19291
|
+
function upsertMarketplaceTable(content, source) {
|
|
19292
|
+
const header = `[marketplaces.${MARKETPLACE_NAME}]`;
|
|
19293
|
+
const block = `${header}
|
|
19294
|
+
source_type = "local"
|
|
19295
|
+
source = ${JSON.stringify(source)}
|
|
19296
|
+
`;
|
|
19297
|
+
if (content === null)
|
|
19298
|
+
return block;
|
|
19299
|
+
const lines = content.split(`
|
|
19300
|
+
`);
|
|
19301
|
+
for (const line of lines) {
|
|
19302
|
+
const trimmed = line.trim();
|
|
19303
|
+
if (/^marketplaces\s*=/.test(trimmed) || /^marketplaces\./.test(trimmed)) {
|
|
19304
|
+
throw new Error("config.toml expresses marketplaces without tables; refusing to edit it");
|
|
19305
|
+
}
|
|
19306
|
+
}
|
|
19307
|
+
const headerPattern = new RegExp(`^\\[\\s*marketplaces\\.${MARKETPLACE_NAME}\\s*\\]$`);
|
|
19308
|
+
const headerIndex = lines.findIndex((line) => headerPattern.test(line.trim()));
|
|
19309
|
+
if (headerIndex === -1) {
|
|
19310
|
+
return content.endsWith(`
|
|
19311
|
+
`) || content.length === 0 ? `${content}${block}` : `${content}
|
|
19312
|
+
${block}`;
|
|
19313
|
+
}
|
|
19314
|
+
let end = lines.length;
|
|
19315
|
+
for (let index = headerIndex + 1;index < lines.length; index += 1) {
|
|
19316
|
+
const line = lines[index];
|
|
19317
|
+
if (line !== undefined && /^\s*\[\[?/.test(line)) {
|
|
19318
|
+
end = index;
|
|
19319
|
+
break;
|
|
19320
|
+
}
|
|
19321
|
+
}
|
|
19322
|
+
return [...lines.slice(0, headerIndex), ...block.split(`
|
|
19323
|
+
`), ...lines.slice(end)].join(`
|
|
19324
|
+
`);
|
|
19325
|
+
}
|
|
19265
19326
|
function isInstalledAndEnabled(output) {
|
|
19266
19327
|
try {
|
|
19267
19328
|
const value = JSON.parse(output);
|
|
@@ -20662,4 +20723,4 @@ var main = gen2(function* () {
|
|
|
20662
20723
|
}).pipe(provide4(LiveLayers));
|
|
20663
20724
|
runMain2(main);
|
|
20664
20725
|
|
|
20665
|
-
//# debugId=
|
|
20726
|
+
//# debugId=8D56B5D70FBDBE6E64756E2164756E21
|