@aerovato/operator-helper 1.0.1 → 1.0.2
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/README.md +3 -2
- package/dist/index.js +107 -125
- package/dist/index.js.map +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,13 +32,14 @@ Users interact with Operator through the OpenCode commands `/operator:user-init`
|
|
|
32
32
|
|
|
33
33
|
Run each Operator command in a new conversation so the agent can focus on that operation with a clean working context. Initialization preserves existing content. Project setup configures `.operator/` in the global Git ignore but does not automatically untrack files already committed.
|
|
34
34
|
|
|
35
|
-
The direct user-facing Helper
|
|
35
|
+
The direct user-facing Helper operation is adapter installation:
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
operator-helper install opencode
|
|
39
|
-
operator-helper upgrade
|
|
40
39
|
```
|
|
41
40
|
|
|
41
|
+
Operator Helper automatically checks for and installs updates when commands run. If it cannot determine whether Bun or npm owns the global installation, it asks for a manual update using the original installation method.
|
|
42
|
+
|
|
42
43
|
## Documentation
|
|
43
44
|
|
|
44
45
|
- [Overview and setup](https://github.com/aerovato/operator-memory#readme)
|
package/dist/index.js
CHANGED
|
@@ -8671,6 +8671,7 @@ var require_table = __commonJS((exports, module) => {
|
|
|
8671
8671
|
});
|
|
8672
8672
|
|
|
8673
8673
|
// src/index.ts
|
|
8674
|
+
import { spawnSync } from "node:child_process";
|
|
8674
8675
|
import { homedir } from "node:os";
|
|
8675
8676
|
// ../../node_modules/.bun/@effect+platform-node@4.0.0-beta.107+a2edc8a872f58f99/node_modules/@effect/platform-node/dist/NodeChildProcessSpawner.js
|
|
8676
8677
|
var exports_NodeChildProcessSpawner = {};
|
|
@@ -22899,7 +22900,7 @@ var withTime = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, label)
|
|
|
22899
22900
|
// package.json
|
|
22900
22901
|
var package_default = {
|
|
22901
22902
|
name: "@aerovato/operator-helper",
|
|
22902
|
-
version: "1.0.
|
|
22903
|
+
version: "1.0.2",
|
|
22903
22904
|
description: "Installation and setup CLI for Operator Memory",
|
|
22904
22905
|
license: "BSD-3-Clause",
|
|
22905
22906
|
author: "Aerovato Research",
|
|
@@ -24509,6 +24510,80 @@ ${renderTable([["User Instructions", `${USER_PATH} (${Buffer.byteLength(content)
|
|
|
24509
24510
|
};
|
|
24510
24511
|
});
|
|
24511
24512
|
|
|
24513
|
+
// src/cli.ts
|
|
24514
|
+
var HELP = `Operator Helper
|
|
24515
|
+
|
|
24516
|
+
USER COMMANDS
|
|
24517
|
+
|
|
24518
|
+
${renderTable([
|
|
24519
|
+
["help", "Show help for operator-helper"],
|
|
24520
|
+
["version", "Show the installed version"],
|
|
24521
|
+
["operator-helper install opencode", "Install or update the OpenCode plugin"]
|
|
24522
|
+
])}
|
|
24523
|
+
|
|
24524
|
+
AGENT COMMANDS
|
|
24525
|
+
|
|
24526
|
+
${renderTable([
|
|
24527
|
+
["operator-helper user status", "Show User Instructions status"],
|
|
24528
|
+
["operator-helper user init", "Initialize User Instructions without overwriting content"],
|
|
24529
|
+
["operator-helper user guide", "Print the agent guide for completing User Setup"],
|
|
24530
|
+
[
|
|
24531
|
+
"operator-helper project status",
|
|
24532
|
+
"Show Project Private, Shared, Git ignore, and tracking status"
|
|
24533
|
+
],
|
|
24534
|
+
["operator-helper project init", "Initialize project partitions and global Git ignore"],
|
|
24535
|
+
["operator-helper project guide", "Print the agent guide for completing Project Setup"],
|
|
24536
|
+
["operator-helper index status", "Show Private and Shared main Project Index status"],
|
|
24537
|
+
["operator-helper index guide", "Print the agent guide for building or refreshing indexes"],
|
|
24538
|
+
["operator-helper index lint", "Check Project Index structure and frontmatter"],
|
|
24539
|
+
["operator-helper memory check", "Check that all Operator memory can be loaded"]
|
|
24540
|
+
])}`;
|
|
24541
|
+
function runCli(arguments_, context3) {
|
|
24542
|
+
return exports_Effect.gen(function* () {
|
|
24543
|
+
if (arguments_.length === 1 && arguments_[0] === "help") {
|
|
24544
|
+
return { exitCode: 0, output: HELP };
|
|
24545
|
+
}
|
|
24546
|
+
if (arguments_.length === 1 && arguments_[0] === "version") {
|
|
24547
|
+
return { exitCode: 0, output: context3.version };
|
|
24548
|
+
}
|
|
24549
|
+
if (arguments_.length !== 2) {
|
|
24550
|
+
return { exitCode: 2, output: HELP };
|
|
24551
|
+
}
|
|
24552
|
+
const command = `${arguments_[0]} ${arguments_[1]}`;
|
|
24553
|
+
switch (command) {
|
|
24554
|
+
case "user status":
|
|
24555
|
+
return yield* userStatus(context3);
|
|
24556
|
+
case "user init":
|
|
24557
|
+
return yield* userInit(context3);
|
|
24558
|
+
case "user guide":
|
|
24559
|
+
return yield* userGuide();
|
|
24560
|
+
case "project status":
|
|
24561
|
+
return yield* projectStatus(context3);
|
|
24562
|
+
case "project init":
|
|
24563
|
+
return yield* projectInit(context3);
|
|
24564
|
+
case "project guide":
|
|
24565
|
+
return yield* projectGuide();
|
|
24566
|
+
case "index status":
|
|
24567
|
+
return yield* indexStatus(context3);
|
|
24568
|
+
case "index guide":
|
|
24569
|
+
return yield* indexGuide();
|
|
24570
|
+
case "index lint":
|
|
24571
|
+
return yield* indexLint(context3);
|
|
24572
|
+
case "memory check":
|
|
24573
|
+
return yield* memoryCheck(context3);
|
|
24574
|
+
case "install opencode":
|
|
24575
|
+
return yield* installOpenCode(context3);
|
|
24576
|
+
default:
|
|
24577
|
+
return {
|
|
24578
|
+
exitCode: 2,
|
|
24579
|
+
output: `Unknown command: ${command}
|
|
24580
|
+
|
|
24581
|
+
${HELP}`
|
|
24582
|
+
};
|
|
24583
|
+
}
|
|
24584
|
+
}).pipe(exports_Effect.catch((error2) => exports_Effect.succeed(fileFailure(error2))));
|
|
24585
|
+
}
|
|
24586
|
+
|
|
24512
24587
|
// src/npm-registry.ts
|
|
24513
24588
|
class NpmRegistryError extends exports_Data.TaggedError("NpmRegistryError") {
|
|
24514
24589
|
}
|
|
@@ -24544,59 +24619,27 @@ var NpmRegistry;
|
|
|
24544
24619
|
}));
|
|
24545
24620
|
})(NpmRegistry ||= {});
|
|
24546
24621
|
|
|
24547
|
-
// src/
|
|
24622
|
+
// src/update.ts
|
|
24548
24623
|
var HELPER_PACKAGE = "@aerovato/operator-helper";
|
|
24549
|
-
var
|
|
24624
|
+
var UPDATE_TIMEOUT = "60 seconds";
|
|
24625
|
+
var autoUpdate = exports_Effect.fn("autoUpdate")(function* (currentVersion, context3) {
|
|
24550
24626
|
const registry = yield* NpmRegistry.Service;
|
|
24551
24627
|
const latest = yield* registry.latestVersion(HELPER_PACKAGE).pipe(exports_Effect.option);
|
|
24552
24628
|
if (exports_Option.isNone(latest) || !isNewerVersion(currentVersion, latest.value)) {
|
|
24553
|
-
return
|
|
24629
|
+
return { status: "current" };
|
|
24554
24630
|
}
|
|
24555
|
-
return `Operator Helper ${latest.value} is available. Run operator-helper upgrade.`;
|
|
24556
|
-
});
|
|
24557
|
-
var upgrade = exports_Effect.fn("upgrade")(function* (context3) {
|
|
24558
24631
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
24559
24632
|
const channel = yield* detectInstallationChannel(spawner, context3.cwd);
|
|
24560
24633
|
if (channel === "unknown") {
|
|
24561
|
-
return {
|
|
24562
|
-
exitCode: 1,
|
|
24563
|
-
output: `✗ ${[
|
|
24564
|
-
"Could not determine how Operator Helper was installed.",
|
|
24565
|
-
"Upgrade manually using your original installation method.",
|
|
24566
|
-
"",
|
|
24567
|
-
"bun add --global --minimum-release-age 0 @aerovato/operator-helper@latest",
|
|
24568
|
-
"NPM_CONFIG_MIN_RELEASE_AGE=0 npm install --global @aerovato/operator-helper@latest"
|
|
24569
|
-
].join(`
|
|
24570
|
-
`)}`
|
|
24571
|
-
};
|
|
24634
|
+
return { status: "unknown", latest: latest.value };
|
|
24572
24635
|
}
|
|
24573
|
-
const command = channel === "bun" ? exports_ChildProcess.make("bun", ["add", "--global", "--minimum-release-age", "0", `${HELPER_PACKAGE}
|
|
24636
|
+
const command = channel === "bun" ? exports_ChildProcess.make("bun", ["add", "--global", "--minimum-release-age", "0", `${HELPER_PACKAGE}@${latest.value}`], { cwd: context3.cwd }) : exports_ChildProcess.make("npm", ["install", "--global", `${HELPER_PACKAGE}@${latest.value}`], {
|
|
24574
24637
|
cwd: context3.cwd,
|
|
24575
24638
|
env: { NPM_CONFIG_MIN_RELEASE_AGE: "0" },
|
|
24576
24639
|
extendEnv: true
|
|
24577
24640
|
});
|
|
24578
|
-
const execution = yield* run2(spawner, command).pipe(exports_Effect.
|
|
24579
|
-
|
|
24580
|
-
const message = execution.failure instanceof exports_PlatformError.PlatformError ? execution.failure.reason.description ?? execution.failure.message : getErrorMessage(execution.failure);
|
|
24581
|
-
return {
|
|
24582
|
-
exitCode: 1,
|
|
24583
|
-
output: `✗ ${[
|
|
24584
|
-
`Could not upgrade with ${channel}: ${message}`,
|
|
24585
|
-
"",
|
|
24586
|
-
"Upgrade manually using your original installation method.",
|
|
24587
|
-
"",
|
|
24588
|
-
"bun add --global --minimum-release-age 0 @aerovato/operator-helper@latest",
|
|
24589
|
-
"NPM_CONFIG_MIN_RELEASE_AGE=0 npm install --global @aerovato/operator-helper@latest"
|
|
24590
|
-
].join(`
|
|
24591
|
-
`)}`
|
|
24592
|
-
};
|
|
24593
|
-
}
|
|
24594
|
-
const output = [execution.success.stdout.trim(), execution.success.stderr.trim()].filter(Boolean).join(`
|
|
24595
|
-
`);
|
|
24596
|
-
return execution.success.exitCode === 0 ? { exitCode: 0, output } : {
|
|
24597
|
-
exitCode: execution.success.exitCode,
|
|
24598
|
-
output: output || "Operator Helper upgrade failed"
|
|
24599
|
-
};
|
|
24641
|
+
const execution = yield* run2(spawner, command).pipe(exports_Effect.timeout(UPDATE_TIMEOUT), exports_Effect.option);
|
|
24642
|
+
return exports_Option.isSome(execution) && execution.value.exitCode === 0 ? { status: "updated" } : { status: "failed" };
|
|
24600
24643
|
});
|
|
24601
24644
|
function detectInstallationChannel(spawner, cwd) {
|
|
24602
24645
|
return exports_Effect.gen(function* () {
|
|
@@ -24646,85 +24689,8 @@ function parseVersion(value) {
|
|
|
24646
24689
|
return [Number(match7[1]), Number(match7[2]), Number(match7[3])];
|
|
24647
24690
|
}
|
|
24648
24691
|
|
|
24649
|
-
// src/cli.ts
|
|
24650
|
-
var HELP = `Operator Helper
|
|
24651
|
-
|
|
24652
|
-
USER COMMANDS
|
|
24653
|
-
|
|
24654
|
-
${renderTable([
|
|
24655
|
-
["help", "Show help for operator-helper"],
|
|
24656
|
-
["version", "Show the installed version"],
|
|
24657
|
-
["operator-helper install opencode", "Install or update the OpenCode plugin"],
|
|
24658
|
-
["operator-helper upgrade", "Upgrade Operator Helper"]
|
|
24659
|
-
])}
|
|
24660
|
-
|
|
24661
|
-
AGENT COMMANDS
|
|
24662
|
-
|
|
24663
|
-
${renderTable([
|
|
24664
|
-
["operator-helper user status", "Show User Instructions status"],
|
|
24665
|
-
["operator-helper user init", "Initialize User Instructions without overwriting content"],
|
|
24666
|
-
["operator-helper user guide", "Print the agent guide for completing User Setup"],
|
|
24667
|
-
[
|
|
24668
|
-
"operator-helper project status",
|
|
24669
|
-
"Show Project Private, Shared, Git ignore, and tracking status"
|
|
24670
|
-
],
|
|
24671
|
-
["operator-helper project init", "Initialize project partitions and global Git ignore"],
|
|
24672
|
-
["operator-helper project guide", "Print the agent guide for completing Project Setup"],
|
|
24673
|
-
["operator-helper index status", "Show Private and Shared main Project Index status"],
|
|
24674
|
-
["operator-helper index guide", "Print the agent guide for building or refreshing indexes"],
|
|
24675
|
-
["operator-helper index lint", "Check Project Index structure and frontmatter"],
|
|
24676
|
-
["operator-helper memory check", "Check that all Operator memory can be loaded"]
|
|
24677
|
-
])}`;
|
|
24678
|
-
function runCli(arguments_, context3) {
|
|
24679
|
-
return exports_Effect.gen(function* () {
|
|
24680
|
-
if (arguments_.length === 1 && arguments_[0] === "help") {
|
|
24681
|
-
return { exitCode: 0, output: HELP };
|
|
24682
|
-
}
|
|
24683
|
-
if (arguments_.length === 1 && arguments_[0] === "version") {
|
|
24684
|
-
return { exitCode: 0, output: context3.version };
|
|
24685
|
-
}
|
|
24686
|
-
if (arguments_.length === 1 && arguments_[0] === "upgrade") {
|
|
24687
|
-
return yield* upgrade(context3);
|
|
24688
|
-
}
|
|
24689
|
-
if (arguments_.length !== 2) {
|
|
24690
|
-
return { exitCode: 2, output: HELP };
|
|
24691
|
-
}
|
|
24692
|
-
const command = `${arguments_[0]} ${arguments_[1]}`;
|
|
24693
|
-
switch (command) {
|
|
24694
|
-
case "user status":
|
|
24695
|
-
return yield* userStatus(context3);
|
|
24696
|
-
case "user init":
|
|
24697
|
-
return yield* userInit(context3);
|
|
24698
|
-
case "user guide":
|
|
24699
|
-
return yield* userGuide();
|
|
24700
|
-
case "project status":
|
|
24701
|
-
return yield* projectStatus(context3);
|
|
24702
|
-
case "project init":
|
|
24703
|
-
return yield* projectInit(context3);
|
|
24704
|
-
case "project guide":
|
|
24705
|
-
return yield* projectGuide();
|
|
24706
|
-
case "index status":
|
|
24707
|
-
return yield* indexStatus(context3);
|
|
24708
|
-
case "index guide":
|
|
24709
|
-
return yield* indexGuide();
|
|
24710
|
-
case "index lint":
|
|
24711
|
-
return yield* indexLint(context3);
|
|
24712
|
-
case "memory check":
|
|
24713
|
-
return yield* memoryCheck(context3);
|
|
24714
|
-
case "install opencode":
|
|
24715
|
-
return yield* installOpenCode(context3);
|
|
24716
|
-
default:
|
|
24717
|
-
return {
|
|
24718
|
-
exitCode: 2,
|
|
24719
|
-
output: `Unknown command: ${command}
|
|
24720
|
-
|
|
24721
|
-
${HELP}`
|
|
24722
|
-
};
|
|
24723
|
-
}
|
|
24724
|
-
}).pipe(exports_Effect.catch((error2) => exports_Effect.succeed(fileFailure(error2))));
|
|
24725
|
-
}
|
|
24726
|
-
|
|
24727
24692
|
// src/index.ts
|
|
24693
|
+
var SKIP_UPDATE_ENVIRONMENT_VARIABLE = "OPERATOR_HELPER_SKIP_UPDATE";
|
|
24728
24694
|
var ChildProcessLayer = exports_NodeChildProcessSpawner.layer.pipe(exports_Layer.provide(exports_NodeFileSystem.layer), exports_Layer.provide(exports_NodePath.layer));
|
|
24729
24695
|
var LiveLayers = exports_Layer.mergeAll(exports_NodeFileSystem.layer, exports_NodePath.layer, ChildProcessLayer, NpmRegistry.layer, GitRunner.layer.pipe(exports_Layer.provide(ChildProcessLayer), exports_Layer.provide(exports_NodeFileSystem.layer), exports_Layer.provide(exports_NodePath.layer)));
|
|
24730
24696
|
var main = exports_Effect.gen(function* () {
|
|
@@ -24732,21 +24698,37 @@ var main = exports_Effect.gen(function* () {
|
|
|
24732
24698
|
arguments: process.argv.slice(2),
|
|
24733
24699
|
cwd: process.cwd(),
|
|
24734
24700
|
home: homedir(),
|
|
24735
|
-
xdgConfigHome: process.env.XDG_CONFIG_HOME ?? null
|
|
24701
|
+
xdgConfigHome: process.env.XDG_CONFIG_HOME ?? null,
|
|
24702
|
+
version: package_default.version
|
|
24736
24703
|
};
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24704
|
+
if (process.env[SKIP_UPDATE_ENVIRONMENT_VARIABLE] !== "1") {
|
|
24705
|
+
const update2 = yield* autoUpdate(package_default.version, environment);
|
|
24706
|
+
if (update2.status === "updated") {
|
|
24707
|
+
const entrypoint = process.argv[1];
|
|
24708
|
+
if (entrypoint !== undefined) {
|
|
24709
|
+
const rerun = spawnSync(process.execPath, [entrypoint, ...environment.arguments], {
|
|
24710
|
+
cwd: environment.cwd,
|
|
24711
|
+
env: { ...process.env, [SKIP_UPDATE_ENVIRONMENT_VARIABLE]: "1" },
|
|
24712
|
+
stdio: "inherit"
|
|
24713
|
+
});
|
|
24714
|
+
if (rerun.error === undefined && rerun.status !== null) {
|
|
24715
|
+
process.exitCode = rerun.status;
|
|
24716
|
+
return;
|
|
24717
|
+
}
|
|
24718
|
+
}
|
|
24719
|
+
} else if (update2.status === "unknown") {
|
|
24720
|
+
yield* exports_Console.warn(`Operator Helper ${update2.latest} is available, but automatic update could not determine whether Bun or npm owns this installation. Ask the user to update operator-helper manually using the original installation method.`);
|
|
24721
|
+
}
|
|
24740
24722
|
}
|
|
24741
24723
|
const result4 = yield* runCli(environment.arguments, {
|
|
24742
24724
|
cwd: environment.cwd,
|
|
24743
24725
|
home: environment.home,
|
|
24744
24726
|
xdgConfigHome: environment.xdgConfigHome,
|
|
24745
|
-
version:
|
|
24727
|
+
version: environment.version
|
|
24746
24728
|
});
|
|
24747
24729
|
yield* exports_Console.log(result4.output);
|
|
24748
24730
|
process.exitCode = result4.exitCode;
|
|
24749
24731
|
}).pipe(exports_Effect.provide(LiveLayers));
|
|
24750
24732
|
exports_NodeRuntime.runMain(main);
|
|
24751
24733
|
|
|
24752
|
-
//# debugId=
|
|
24734
|
+
//# debugId=D773290F0860260964756E2164756E21
|