@topolo/cli 0.13.0 → 0.13.1
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/agent-packs/README.md +154 -0
- package/agent-packs/src/topolo_agent_pack/claude.py +265 -0
- package/agent-packs/src/topolo_agent_pack/cli.py +29 -2
- package/agent-packs/src/topolo_agent_pack/execution.py +154 -0
- package/agent-packs/src/topolo_agent_pack/live.py +49 -8
- package/agent-packs/src/topolo_agent_pack/policy.py +92 -0
- package/dist/claude-pack-backend-IDQQX3DG.js +555 -0
- package/dist/index.js +51 -17
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,8 +5,22 @@ import { spawnSync } from "child_process";
|
|
|
5
5
|
import { existsSync } from "fs";
|
|
6
6
|
import { dirname, resolve } from "path";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
|
+
import { homedir } from "os";
|
|
8
9
|
function registerAgentPacksCommand(program2) {
|
|
9
10
|
const packs = program2.command("agent-packs").description("Install and operate Topolo Agent Packs in supported local hosts").option("--store <path>", "Portable pack library (default ~/AgentPacks)");
|
|
11
|
+
packs.command("configure").description("Qualify and configure an adopted Claude roster through its live native backend").argument("<pack>").option("--harness <name>", "Host adapter", "claude").requiredOption("--policy <path>", "Reviewed execution policy JSON").requiredOption("--endpoint <url>", "Explicit loopback main-process inspector endpoint, enabled separately with authorization").requiredOption("--pid <pid>", "Expected Claude main-process PID").option("--apply", "Apply native groups, pins, models, effort and permission modes; otherwise preflight only").action(async (pack, options) => {
|
|
12
|
+
if (options.harness !== "claude") throw new Error("Native configure is currently qualified only for Claude Desktop.");
|
|
13
|
+
const { configureClaudePack } = await import("./claude-pack-backend-IDQQX3DG.js");
|
|
14
|
+
const result = await configureClaudePack({
|
|
15
|
+
store: packs.opts().store ?? resolve(homedir(), "AgentPacks"),
|
|
16
|
+
pack,
|
|
17
|
+
policy: options.policy,
|
|
18
|
+
endpoint: options.endpoint,
|
|
19
|
+
pid: Number(options.pid),
|
|
20
|
+
apply: options.apply === true
|
|
21
|
+
});
|
|
22
|
+
console.log(JSON.stringify(result, null, 2));
|
|
23
|
+
});
|
|
10
24
|
const commands = [
|
|
11
25
|
"add",
|
|
12
26
|
"replace",
|
|
@@ -19,6 +33,7 @@ function registerAgentPacksCommand(program2) {
|
|
|
19
33
|
"list",
|
|
20
34
|
"recover",
|
|
21
35
|
"doctor",
|
|
36
|
+
"policy",
|
|
22
37
|
"remote-recover",
|
|
23
38
|
"connect",
|
|
24
39
|
"remote-context",
|
|
@@ -27,8 +42,26 @@ function registerAgentPacksCommand(program2) {
|
|
|
27
42
|
"artifact-get"
|
|
28
43
|
];
|
|
29
44
|
for (const name of commands) {
|
|
30
|
-
packs.command(name).description(name === "add" ? "Add an installed or bundled pack, group, or agent" : `Run the pack ${name} operation`)
|
|
31
|
-
|
|
45
|
+
const command = packs.command(name).description(name === "add" ? "Add an installed or bundled pack, group, or agent" : `Run the pack ${name} operation`);
|
|
46
|
+
if (name === "switch" || name === "recover") command.option("--policy <path>", "Reviewed policy for an adopted Claude roster").option("--endpoint <url>", "Explicit authorized Claude main-process inspector endpoint").option("--pid <pid>", "Expected Claude main-process PID").option("--apply", "Apply a native switch; recovery is always read-only");
|
|
47
|
+
command.option("--harness <name>", "Local host adapter (codex, claude Desktop Code sessions)", "codex").option("--adapter-help", "Show every option supported by the selected adapter").argument("[arguments...]").allowUnknownOption().allowExcessArguments().addHelpText("after", name === "add" ? "\nExamples:\n topolo agent-packs add founder\n topolo agent-packs add founder --group specialists\n topolo agent-packs add founder --agent strategy\n" : "\nRun topolo agent-packs <command> --adapter-help for all adapter options. Cloud commands require explicit --environment and --context-key.\n").action(async (args, options) => {
|
|
48
|
+
if (!["codex", "claude"].includes(options.harness)) throw new Error(`The ${options.harness} pack adapter is not available. Supported adapters: codex, claude.`);
|
|
49
|
+
if (options.policy || options.endpoint || options.pid || options.apply) {
|
|
50
|
+
if (options.harness !== "claude" || !options.policy || !options.endpoint || !options.pid || args.length !== 1)
|
|
51
|
+
throw new Error("Native switch/recovery requires one Claude pack, --policy, --endpoint and --pid.");
|
|
52
|
+
const { configureClaudePack } = await import("./claude-pack-backend-IDQQX3DG.js");
|
|
53
|
+
const result2 = await configureClaudePack({
|
|
54
|
+
store: packs.opts().store ?? resolve(homedir(), "AgentPacks"),
|
|
55
|
+
pack: args[0],
|
|
56
|
+
policy: options.policy,
|
|
57
|
+
endpoint: options.endpoint,
|
|
58
|
+
pid: Number(options.pid),
|
|
59
|
+
mode: name,
|
|
60
|
+
apply: options.apply === true
|
|
61
|
+
});
|
|
62
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
32
65
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
33
66
|
const adapter = [resolve(here, "../agent-packs/topolo-agent-pack"), resolve(here, "../../agent-packs/topolo-agent-pack")].find(existsSync);
|
|
34
67
|
if (!adapter) throw new Error("This CLI installation is missing its bundled Topolo Agent Pack adapter. Reinstall @topolo/cli.");
|
|
@@ -37,6 +70,7 @@ function registerAgentPacksCommand(program2) {
|
|
|
37
70
|
const result = spawnSync("python3", [
|
|
38
71
|
adapter,
|
|
39
72
|
...store ? ["--store", store] : [],
|
|
73
|
+
...options.harness === "claude" ? ["--harness", "claude"] : [],
|
|
40
74
|
name,
|
|
41
75
|
...forwarded,
|
|
42
76
|
...name === "add" && !options.adapterHelp ? ["--catalog"] : []
|
|
@@ -3667,7 +3701,7 @@ import { join as join2 } from "path";
|
|
|
3667
3701
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
3668
3702
|
import { mkdir, readFile, readdir, rename, rm, writeFile, chmod } from "fs/promises";
|
|
3669
3703
|
import { existsSync as existsSync3 } from "fs";
|
|
3670
|
-
import { homedir, platform as hostPlatform } from "os";
|
|
3704
|
+
import { homedir as homedir3, platform as hostPlatform } from "os";
|
|
3671
3705
|
import { dirname as dirname3, join } from "path";
|
|
3672
3706
|
var TopoloSdkError2 = class extends Error {
|
|
3673
3707
|
code;
|
|
@@ -4097,7 +4131,7 @@ var MACOS_KEYCHAIN_WRITE_SCRIPT = [
|
|
|
4097
4131
|
function installationStorePath() {
|
|
4098
4132
|
const override = process.env.TOPOLO_INSTALLATIONS_PATH?.trim();
|
|
4099
4133
|
if (override) return override;
|
|
4100
|
-
const base = process.env.XDG_CONFIG_HOME || (hostPlatform() === "win32" ? join(
|
|
4134
|
+
const base = process.env.XDG_CONFIG_HOME || (hostPlatform() === "win32" ? join(homedir3(), "AppData", "Roaming") : join(homedir3(), ".config"));
|
|
4101
4135
|
return join(base, "topolo", "installations");
|
|
4102
4136
|
}
|
|
4103
4137
|
function installationPath(environment, id) {
|
|
@@ -6126,7 +6160,7 @@ function formatCheckResult(result) {
|
|
|
6126
6160
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
6127
6161
|
import { existsSync as existsSync6 } from "fs";
|
|
6128
6162
|
import { readFile as readFile6, rm as rm3 } from "fs/promises";
|
|
6129
|
-
import { homedir as
|
|
6163
|
+
import { homedir as homedir5 } from "os";
|
|
6130
6164
|
import { dirname as dirname6, join as join7, resolve as resolve2 } from "path";
|
|
6131
6165
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6132
6166
|
import { createRequire } from "module";
|
|
@@ -6135,7 +6169,7 @@ import { createRequire } from "module";
|
|
|
6135
6169
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
6136
6170
|
import { existsSync as existsSync4 } from "fs";
|
|
6137
6171
|
import { readFile as readFile4 } from "fs/promises";
|
|
6138
|
-
import { homedir as
|
|
6172
|
+
import { homedir as homedir4 } from "os";
|
|
6139
6173
|
import { isAbsolute, join as join6 } from "path";
|
|
6140
6174
|
var SUPPORTED_AGENT_IDS = [
|
|
6141
6175
|
"claude",
|
|
@@ -6191,7 +6225,7 @@ function stableNodeCommand() {
|
|
|
6191
6225
|
});
|
|
6192
6226
|
return selectStableNodeCommand(probe.status === 0 ? probe.stdout : void 0);
|
|
6193
6227
|
}
|
|
6194
|
-
function agentSkillPath(agent, homeDir =
|
|
6228
|
+
function agentSkillPath(agent, homeDir = homedir4(), projectDir) {
|
|
6195
6229
|
switch (agent) {
|
|
6196
6230
|
case "claude":
|
|
6197
6231
|
return projectDir ? join6(projectDir, ".claude", "skills", "topolo", "SKILL.md") : join6(homeDir, ".claude", "skills", "topolo", "SKILL.md");
|
|
@@ -6216,7 +6250,7 @@ function agentSkillPath(agent, homeDir = homedir3(), projectDir) {
|
|
|
6216
6250
|
return void 0;
|
|
6217
6251
|
}
|
|
6218
6252
|
}
|
|
6219
|
-
function agentConfigPaths(agent, homeDir =
|
|
6253
|
+
function agentConfigPaths(agent, homeDir = homedir4(), projectDir) {
|
|
6220
6254
|
switch (agent) {
|
|
6221
6255
|
case "claude":
|
|
6222
6256
|
return [{ path: join6(homeDir, ".claude.json"), format: "json", rootKey: "mcpServers" }];
|
|
@@ -6308,7 +6342,7 @@ function agentCliNames(agent) {
|
|
|
6308
6342
|
return ["qchat", "q"];
|
|
6309
6343
|
}
|
|
6310
6344
|
}
|
|
6311
|
-
function agentConfigExists(agent, homeDir =
|
|
6345
|
+
function agentConfigExists(agent, homeDir = homedir4(), projectDir) {
|
|
6312
6346
|
return agentConfigPaths(agent, homeDir, projectDir).some((config) => existsSync4(config.path));
|
|
6313
6347
|
}
|
|
6314
6348
|
function claudeDesktopConfigPath(homeDir) {
|
|
@@ -6321,7 +6355,7 @@ function vscodeUserConfigPath(homeDir) {
|
|
|
6321
6355
|
if (process.platform === "win32") return join6(process.env.APPDATA ?? join6(homeDir, "AppData", "Roaming"), "Code", "User", "mcp.json");
|
|
6322
6356
|
return join6(process.env.XDG_CONFIG_HOME ?? join6(homeDir, ".config"), "Code", "User", "mcp.json");
|
|
6323
6357
|
}
|
|
6324
|
-
async function readAgentRegistrations(agent, homeDir =
|
|
6358
|
+
async function readAgentRegistrations(agent, homeDir = homedir4(), projectDir) {
|
|
6325
6359
|
const registrations = [];
|
|
6326
6360
|
for (const config of agentConfigPaths(agent, homeDir, projectDir)) {
|
|
6327
6361
|
if (!existsSync4(config.path)) continue;
|
|
@@ -6859,8 +6893,8 @@ function resolveTargets(opts) {
|
|
|
6859
6893
|
}))];
|
|
6860
6894
|
}
|
|
6861
6895
|
if (opts.all) return [...SUPPORTED_AGENT_IDS];
|
|
6862
|
-
const homeDir = opts.homeDir ??
|
|
6863
|
-
const detectBinaries = homeDir ===
|
|
6896
|
+
const homeDir = opts.homeDir ?? homedir5();
|
|
6897
|
+
const detectBinaries = homeDir === homedir5();
|
|
6864
6898
|
const detected = SUPPORTED_AGENT_IDS.filter((agent) => agentConfigExists(agent, homeDir, opts.project) || detectBinaries && agentBinaryExists(agent));
|
|
6865
6899
|
return [.../* @__PURE__ */ new Set(["claude", "codex", ...detected])];
|
|
6866
6900
|
}
|
|
@@ -6921,7 +6955,7 @@ async function installAgentSurfaces(opts) {
|
|
|
6921
6955
|
}
|
|
6922
6956
|
const mcp = resolveMcpCommand();
|
|
6923
6957
|
const registration = resolveMcpRegistration(opts);
|
|
6924
|
-
const homeDir = opts.homeDir ??
|
|
6958
|
+
const homeDir = opts.homeDir ?? homedir5();
|
|
6925
6959
|
const results = [];
|
|
6926
6960
|
for (const agent of resolveTargets({ ...opts, homeDir, project: opts.project })) {
|
|
6927
6961
|
results.push(await installForAgent(agent, sourceDir, mcp, {
|
|
@@ -6956,7 +6990,7 @@ function assertAgentSetupSucceeded(results) {
|
|
|
6956
6990
|
}
|
|
6957
6991
|
}
|
|
6958
6992
|
async function agentSurfaceStatus(options = {}) {
|
|
6959
|
-
const homeDir = options.homeDir ??
|
|
6993
|
+
const homeDir = options.homeDir ?? homedir5();
|
|
6960
6994
|
const sourceSkill = await readFile6(join7(skillsSourceDir(), "topolo", "SKILL.md"), "utf8");
|
|
6961
6995
|
const agents = resolveTargets({
|
|
6962
6996
|
agent: options.agent,
|
|
@@ -6980,7 +7014,7 @@ async function agentSurfaceStatus(options = {}) {
|
|
|
6980
7014
|
}));
|
|
6981
7015
|
}
|
|
6982
7016
|
async function uninstallAgentSurfaces(options) {
|
|
6983
|
-
const homeDir = options.homeDir ??
|
|
7017
|
+
const homeDir = options.homeDir ?? homedir5();
|
|
6984
7018
|
const name = options.name?.trim() || "topolo";
|
|
6985
7019
|
resolveMcpRegistration({ name, ...name === "topolo" ? {} : { context: "uninstall-validation" } });
|
|
6986
7020
|
const removed = [];
|
|
@@ -7021,7 +7055,7 @@ function formatStatus(rows) {
|
|
|
7021
7055
|
|
|
7022
7056
|
// src/commands/doctor.ts
|
|
7023
7057
|
import { access } from "fs/promises";
|
|
7024
|
-
import { homedir as
|
|
7058
|
+
import { homedir as homedir6 } from "os";
|
|
7025
7059
|
import { resolve as resolve3 } from "path";
|
|
7026
7060
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
7027
7061
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
@@ -7084,7 +7118,7 @@ async function verifyMcpProtocol(command, args, env = definedEnvironment(process
|
|
|
7084
7118
|
}
|
|
7085
7119
|
async function resolveInstalledDoctorTarget(options) {
|
|
7086
7120
|
const name = options.name?.trim() || "topolo";
|
|
7087
|
-
const homeDir = options.agentHome ? resolve3(options.agentHome) :
|
|
7121
|
+
const homeDir = options.agentHome ? resolve3(options.agentHome) : homedir6();
|
|
7088
7122
|
const expected = resolveMcpCommand();
|
|
7089
7123
|
const requestedAgents = resolveTargets({
|
|
7090
7124
|
...options,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.13.
|
|
5
|
-
"topoloPublishedVersion": "0.13.
|
|
4
|
+
"version": "0.13.1",
|
|
5
|
+
"topoloPublishedVersion": "0.13.1",
|
|
6
6
|
"description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test:watch": "vitest",
|
|
28
28
|
"coverage": "pnpm run coverage:node && pnpm run coverage:adapter",
|
|
29
29
|
"coverage:node": "vitest run --coverage",
|
|
30
|
-
"coverage:adapter": "python3 -m venv node_modules/.cache/agent-pack-test && node_modules/.cache/agent-pack-test/bin/python -m pip install --disable-pip-version-check --quiet --timeout 15 --retries 0 -r agent-packs/requirements-test.txt && PYTHONPATH=agent-packs/src COVERAGE_FILE=node_modules/.cache/agent-pack-test/.coverage node_modules/.cache/agent-pack-test/bin/python -m coverage run --branch --source=topolo_agent_pack.topolo -m unittest discover -s agent-packs/tests && COVERAGE_FILE=node_modules/.cache/agent-pack-test/.coverage node_modules/.cache/agent-pack-test/bin/python -m coverage report --fail-under=100"
|
|
30
|
+
"coverage:adapter": "python3 -m venv node_modules/.cache/agent-pack-test && node_modules/.cache/agent-pack-test/bin/python -m pip install --disable-pip-version-check --quiet --timeout 15 --retries 0 -r agent-packs/requirements-test.txt && PYTHONPATH=agent-packs/src COVERAGE_FILE=node_modules/.cache/agent-pack-test/.coverage node_modules/.cache/agent-pack-test/bin/python -m coverage run --branch --source=topolo_agent_pack.topolo,topolo_agent_pack.claude,topolo_agent_pack.policy -m unittest discover -s agent-packs/tests && COVERAGE_FILE=node_modules/.cache/agent-pack-test/.coverage node_modules/.cache/agent-pack-test/bin/python -m coverage report --fail-under=100"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.0.0",
|