@pleri/olam-cli 0.1.182 → 0.1.185
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/agent-stream/agent-sdk-to-chunks.js +44 -30
- package/dist/ask/checkout.d.ts +19 -0
- package/dist/ask/checkout.d.ts.map +1 -0
- package/dist/ask/checkout.js +40 -0
- package/dist/ask/checkout.js.map +1 -0
- package/dist/ask/knowledge-pack-builder.d.ts +72 -0
- package/dist/ask/knowledge-pack-builder.d.ts.map +1 -0
- package/dist/ask/knowledge-pack-builder.js +91 -0
- package/dist/ask/knowledge-pack-builder.js.map +1 -0
- package/dist/ask/knowledge-pack.generated.d.ts +8 -0
- package/dist/ask/knowledge-pack.generated.d.ts.map +1 -0
- package/dist/ask/knowledge-pack.generated.js +1947 -0
- package/dist/ask/knowledge-pack.generated.js.map +1 -0
- package/dist/ask/one-shot.d.ts +21 -0
- package/dist/ask/one-shot.d.ts.map +1 -0
- package/dist/ask/one-shot.js +50 -0
- package/dist/ask/one-shot.js.map +1 -0
- package/dist/ask/repl.d.ts +30 -0
- package/dist/ask/repl.d.ts.map +1 -0
- package/dist/ask/repl.js +109 -0
- package/dist/ask/repl.js.map +1 -0
- package/dist/ask/sdk-client.d.ts +87 -0
- package/dist/ask/sdk-client.d.ts.map +1 -0
- package/dist/ask/sdk-client.js +118 -0
- package/dist/ask/sdk-client.js.map +1 -0
- package/dist/ask/system-prompt.d.ts +30 -0
- package/dist/ask/system-prompt.d.ts.map +1 -0
- package/dist/ask/system-prompt.js +31 -0
- package/dist/ask/system-prompt.js.map +1 -0
- package/dist/commands/ask.d.ts +27 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +63 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/auth-list-json.d.ts +53 -0
- package/dist/commands/auth-list-json.d.ts.map +1 -0
- package/dist/commands/auth-list-json.js +47 -0
- package/dist/commands/auth-list-json.js.map +1 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +13 -0
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/doctor.js +11 -11
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/keys-list-json.d.ts +55 -0
- package/dist/commands/keys-list-json.d.ts.map +1 -0
- package/dist/commands/keys-list-json.js +54 -0
- package/dist/commands/keys-list-json.js.map +1 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +6 -0
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/lanes-list-json.d.ts +69 -0
- package/dist/commands/lanes-list-json.d.ts.map +1 -0
- package/dist/commands/lanes-list-json.js +42 -0
- package/dist/commands/lanes-list-json.js.map +1 -0
- package/dist/commands/lanes.d.ts.map +1 -1
- package/dist/commands/lanes.js +18 -7
- package/dist/commands/lanes.js.map +1 -1
- package/dist/commands/plans-list-json.d.ts +77 -0
- package/dist/commands/plans-list-json.d.ts.map +1 -0
- package/dist/commands/plans-list-json.js +61 -0
- package/dist/commands/plans-list-json.js.map +1 -0
- package/dist/commands/plans.d.ts.map +1 -1
- package/dist/commands/plans.js +10 -0
- package/dist/commands/plans.js.map +1 -1
- package/dist/commands/repos-list-json.d.ts +58 -0
- package/dist/commands/repos-list-json.d.ts.map +1 -0
- package/dist/commands/repos-list-json.js +45 -0
- package/dist/commands/repos-list-json.js.map +1 -0
- package/dist/commands/repos.d.ts +1 -1
- package/dist/commands/repos.d.ts.map +1 -1
- package/dist/commands/repos.js +12 -2
- package/dist/commands/repos.js.map +1 -1
- package/dist/commands/services.d.ts +47 -1
- package/dist/commands/services.d.ts.map +1 -1
- package/dist/commands/services.js +59 -33
- package/dist/commands/services.js.map +1 -1
- package/dist/commands/skills.d.ts +27 -0
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +17 -2
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/workspace-list-json.d.ts +73 -0
- package/dist/commands/workspace-list-json.d.ts.map +1 -0
- package/dist/commands/workspace-list-json.js +59 -0
- package/dist/commands/workspace-list-json.js.map +1 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +7 -1
- package/dist/commands/workspace.js.map +1 -1
- package/dist/image-digests.json +8 -8
- package/dist/index.js +3170 -580
- package/dist/index.js.map +1 -1
- package/dist/lib/k8s-bootstrap.d.ts.map +1 -1
- package/dist/lib/k8s-bootstrap.js +13 -1
- package/dist/lib/k8s-bootstrap.js.map +1 -1
- package/dist/lib/k8s-secret-render.d.ts +2 -0
- package/dist/lib/k8s-secret-render.d.ts.map +1 -1
- package/dist/lib/k8s-secret-render.js +27 -0
- package/dist/lib/k8s-secret-render.js.map +1 -1
- package/dist/lib/peripheral-registry.d.ts +1 -1
- package/dist/lib/peripheral-registry.d.ts.map +1 -1
- package/dist/lib/peripheral-registry.js +13 -0
- package/dist/lib/peripheral-registry.js.map +1 -1
- package/dist/lib/upgrade-kubernetes.d.ts +6 -0
- package/dist/lib/upgrade-kubernetes.d.ts.map +1 -1
- package/dist/lib/upgrade-kubernetes.js +7 -1
- package/dist/lib/upgrade-kubernetes.js.map +1 -1
- package/dist/mcp-server.js +1167 -37
- package/hermes-bundle/version.json +1 -1
- package/host-cp/k8s/manifests/30-configmap.yaml +11 -6
- package/host-cp/k8s/manifests/50-deployment.yaml +15 -1
- package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/templates/chunks-postgres-secret-template.yaml +24 -0
- package/host-cp/k8s/templates/plan-chat-service-secret-template.yaml +35 -0
- package/host-cp/src/plan-chat-service.mjs +99 -74
- package/host-cp/src/server.mjs +141 -5
- package/package.json +4 -2
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam lanes list <world> --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a network round-trip (mirrors the pattern
|
|
6
|
+
* used by `repos-list-json.ts`, `auth-list-json.ts`, `services.ts`).
|
|
7
|
+
*
|
|
8
|
+
* WHY this exists: agent/script drivers (Rico, flywheel chain skills,
|
|
9
|
+
* CI pipelines) need to enumerate running lanes in a world before
|
|
10
|
+
* dispatching work or routing a follow-up task to the right lane.
|
|
11
|
+
* The human renderer uses printInfo/printHeader which emit ANSI codes
|
|
12
|
+
* and may reflow — scraping it is brittle. This serialiser gives
|
|
13
|
+
* drivers a stable, colour-free array with the exact fields needed to
|
|
14
|
+
* pick a lane without re-querying host-cp.
|
|
15
|
+
*
|
|
16
|
+
* Secret redaction: lane records contain no secrets (names, tasks, and
|
|
17
|
+
* status strings are all operator-visible). No redaction needed.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Per-lane row in the `lanes list --json` payload.
|
|
21
|
+
* Field names are load-bearing — add new fields freely, never rename.
|
|
22
|
+
*/
|
|
23
|
+
export interface LaneListJsonEntry {
|
|
24
|
+
/** Lane name (lowercase + digits + hyphens). */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/** Task prompt the lane was created with. */
|
|
27
|
+
readonly task: string;
|
|
28
|
+
/**
|
|
29
|
+
* Lifecycle status string as reported by host-cp.
|
|
30
|
+
* Typically 'running' | 'idle' | 'stopped' but treated as opaque string
|
|
31
|
+
* here — drivers should compare against known values defensively.
|
|
32
|
+
*/
|
|
33
|
+
readonly status: string;
|
|
34
|
+
/** Underlying tmux session name (e.g. "claude-lane-main"). */
|
|
35
|
+
readonly tmuxSession: string;
|
|
36
|
+
/** ISO-8601 creation timestamp, as returned by host-cp. */
|
|
37
|
+
readonly createdAt: string;
|
|
38
|
+
/**
|
|
39
|
+
* True for the world's main lane (spawned by dispatch, not by
|
|
40
|
+
* `olam lanes create`). False or absent → user-created lane.
|
|
41
|
+
*/
|
|
42
|
+
readonly isMain: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Top-level shape emitted by `olam lanes list <world> --json`. */
|
|
45
|
+
export interface LanesListJson {
|
|
46
|
+
/** World id that was queried. */
|
|
47
|
+
readonly worldId: string;
|
|
48
|
+
/** Number of lanes returned. */
|
|
49
|
+
readonly count: number;
|
|
50
|
+
readonly lanes: readonly LaneListJsonEntry[];
|
|
51
|
+
}
|
|
52
|
+
/** Input shape as returned by host-cp GET /lanes. Field names match the API. */
|
|
53
|
+
export interface HostCpLaneInfo {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly task: string;
|
|
56
|
+
readonly status: string;
|
|
57
|
+
readonly tmuxSession: string;
|
|
58
|
+
readonly createdAt: string;
|
|
59
|
+
readonly isMain?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Serialise host-cp's lane list to the stable `--json` wire shape.
|
|
63
|
+
*
|
|
64
|
+
* @param worldId The world id that was queried (echoed back for driver convenience).
|
|
65
|
+
* @param lanes Lane array from host-cp (may be empty).
|
|
66
|
+
* @returns JSON string — no trailing newline (caller adds it).
|
|
67
|
+
*/
|
|
68
|
+
export declare function renderLanesListJson(worldId: string, lanes: readonly HostCpLaneInfo[]): string;
|
|
69
|
+
//# sourceMappingURL=lanes-list-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lanes-list-json.d.ts","sourceRoot":"","sources":["../../src/commands/lanes-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C;AAED,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,cAAc,EAAE,GAC/B,MAAM,CAiBR"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam lanes list <world> --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a network round-trip (mirrors the pattern
|
|
6
|
+
* used by `repos-list-json.ts`, `auth-list-json.ts`, `services.ts`).
|
|
7
|
+
*
|
|
8
|
+
* WHY this exists: agent/script drivers (Rico, flywheel chain skills,
|
|
9
|
+
* CI pipelines) need to enumerate running lanes in a world before
|
|
10
|
+
* dispatching work or routing a follow-up task to the right lane.
|
|
11
|
+
* The human renderer uses printInfo/printHeader which emit ANSI codes
|
|
12
|
+
* and may reflow — scraping it is brittle. This serialiser gives
|
|
13
|
+
* drivers a stable, colour-free array with the exact fields needed to
|
|
14
|
+
* pick a lane without re-querying host-cp.
|
|
15
|
+
*
|
|
16
|
+
* Secret redaction: lane records contain no secrets (names, tasks, and
|
|
17
|
+
* status strings are all operator-visible). No redaction needed.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Serialise host-cp's lane list to the stable `--json` wire shape.
|
|
21
|
+
*
|
|
22
|
+
* @param worldId The world id that was queried (echoed back for driver convenience).
|
|
23
|
+
* @param lanes Lane array from host-cp (may be empty).
|
|
24
|
+
* @returns JSON string — no trailing newline (caller adds it).
|
|
25
|
+
*/
|
|
26
|
+
export function renderLanesListJson(worldId, lanes) {
|
|
27
|
+
const rows = lanes.map((l) => ({
|
|
28
|
+
name: l.name,
|
|
29
|
+
task: l.task,
|
|
30
|
+
status: l.status,
|
|
31
|
+
tmuxSession: l.tmuxSession,
|
|
32
|
+
createdAt: l.createdAt,
|
|
33
|
+
isMain: l.isMain ?? false,
|
|
34
|
+
}));
|
|
35
|
+
const payload = {
|
|
36
|
+
worldId,
|
|
37
|
+
count: rows.length,
|
|
38
|
+
lanes: rows,
|
|
39
|
+
};
|
|
40
|
+
return JSON.stringify(payload);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=lanes-list-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lanes-list-json.js","sourceRoot":"","sources":["../../src/commands/lanes-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA+CH;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,KAAgC;IAEhC,MAAM,IAAI,GAAwB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,KAAK;KAC1B,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAkB;QAC7B,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanes.d.ts","sourceRoot":"","sources":["../../src/commands/lanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"lanes.d.ts","sourceRoot":"","sources":["../../src/commands/lanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgHzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsCpD"}
|
package/dist/commands/lanes.js
CHANGED
|
@@ -15,19 +15,29 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { callHostCpProxy } from './host-cp.js';
|
|
17
17
|
import { printError, printSuccess, printInfo, printHeader } from '../output.js';
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
import { renderLanesListJson } from './lanes-list-json.js';
|
|
19
|
+
async function handleList(world, opts) {
|
|
20
20
|
const result = await callHostCpProxy('GET', world, '/lanes');
|
|
21
21
|
if (!result.ok) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (opts.json) {
|
|
23
|
+
process.stdout.write(JSON.stringify({ worldId: world, count: 0, lanes: [], error: result.error }) + '\n');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
printError(`List failed: ${result.error}`);
|
|
27
|
+
if (result.status === 0) {
|
|
28
|
+
printInfo('Hint', 'Is host CP running? `olam host-cp status`');
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
process.exitCode = 1;
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
29
34
|
const data = result.data;
|
|
30
|
-
const lanes = data?.lanes ?? [];
|
|
35
|
+
const lanes = (data?.lanes ?? []);
|
|
36
|
+
if (opts.json) {
|
|
37
|
+
process.stdout.write(renderLanesListJson(world, lanes) + '\n');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
printHeader(`Lanes in world ${world}`);
|
|
31
41
|
if (lanes.length === 0) {
|
|
32
42
|
printInfo('Lanes', '(none — dispatch a task to spawn claude-main)');
|
|
33
43
|
return;
|
|
@@ -97,7 +107,8 @@ export function registerLanes(program) {
|
|
|
97
107
|
.command('list')
|
|
98
108
|
.description('Enumerate lanes in a world')
|
|
99
109
|
.argument('<world>', 'World id (e.g. ember-elk-8412)')
|
|
100
|
-
.
|
|
110
|
+
.option('--json', 'Emit machine-readable JSON instead of the text table', false)
|
|
111
|
+
.action((world, opts) => handleList(world, opts));
|
|
101
112
|
lanes
|
|
102
113
|
.command('create')
|
|
103
114
|
.description('Spawn a new claude-lane-<name> session with an initial task')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanes.js","sourceRoot":"","sources":["../../src/commands/lanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAWhF,KAAK,UAAU,UAAU,CAAC,KAAa
|
|
1
|
+
{"version":3,"file":"lanes.js","sourceRoot":"","sources":["../../src/commands/lanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,c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K;SACF,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,kDAAkD,CAAC;SAC/D,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;SAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;SAC/B,MAAM,CAAC,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvE,KAAK;SACF,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,4BAA4B,CAAC;SACzC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;SAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;SAC/B,QAAQ,CAAC,aAAa,EAAE,+CAA+C,CAAC;SACxE,MAAM,CAAC,CAAC,KAAa,EAAE,IAAY,EAAE,WAAqB,EAAE,EAAE,CAC7D,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACnD,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam plans list --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a live cloud endpoint (mirrors the pattern
|
|
6
|
+
* used by `repos-list-json.ts`, `auth-list-json.ts`, and
|
|
7
|
+
* `servicesStatusJson` in services.ts).
|
|
8
|
+
*
|
|
9
|
+
* WHY this exists: agent/script drivers (Rico, flywheel chain, CI pipelines)
|
|
10
|
+
* need to enumerate cloud plan state — plan IDs, statuses, modes — before
|
|
11
|
+
* deciding whether to spawn a new plan or pick up an existing one. The human
|
|
12
|
+
* table is colorized and column-width-sensitive, so scraping it is brittle.
|
|
13
|
+
* This serialiser gives drivers a stable, color-free array via
|
|
14
|
+
* `olam plans list --json | jq '.plans[] | select(.status=="active")'`.
|
|
15
|
+
*
|
|
16
|
+
* Secret redaction: the PlanSummary shape carries two URL fields
|
|
17
|
+
* (`host_cp_url`, `auth_recovery_callback_url`) that MAY embed auth
|
|
18
|
+
* tokens in the URL userinfo component. Both are redacted before emission
|
|
19
|
+
* using the canonical `:***@` substitution that matches
|
|
20
|
+
* `@olam/core/src/skill-sources/store.ts`'s `redactUrl`.
|
|
21
|
+
* The `bearer` (showcase password) used for HTTP auth never enters the
|
|
22
|
+
* PlanSummary shape itself and is therefore never serialised.
|
|
23
|
+
*/
|
|
24
|
+
import type { PlanSummary } from '../lib/plans-client.js';
|
|
25
|
+
/**
|
|
26
|
+
* Per-plan row in the `plans list --json` payload.
|
|
27
|
+
* Field names are load-bearing — add new fields freely, never rename.
|
|
28
|
+
*/
|
|
29
|
+
export interface PlanListJsonEntry {
|
|
30
|
+
/** Stable UUID identifying the plan. */
|
|
31
|
+
readonly plan_id: string;
|
|
32
|
+
/** Operator that owns the plan. */
|
|
33
|
+
readonly operator_id: string;
|
|
34
|
+
/** Lifecycle state of the plan. */
|
|
35
|
+
readonly status: PlanSummary['status'];
|
|
36
|
+
/** Execution mode (cloud / goal). */
|
|
37
|
+
readonly mode: PlanSummary['mode'];
|
|
38
|
+
/** Unix epoch ms when the plan was created. */
|
|
39
|
+
readonly created_at: number;
|
|
40
|
+
/** Unix epoch ms of the last activity, or null when never active. */
|
|
41
|
+
readonly last_active_at: number | null;
|
|
42
|
+
/** Unix epoch ms until which the plan is pinned, or null when not pinned. */
|
|
43
|
+
readonly pinned_until: number | null;
|
|
44
|
+
/**
|
|
45
|
+
* Host-CP URL for the plan, with credentials redacted.
|
|
46
|
+
* null when not set.
|
|
47
|
+
*/
|
|
48
|
+
readonly host_cp_url: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Auth recovery callback URL, with credentials redacted.
|
|
51
|
+
* null when not set.
|
|
52
|
+
*/
|
|
53
|
+
readonly auth_recovery_callback_url: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Whether a recovery callback URL is registered (boolean convenience flag).
|
|
56
|
+
* Consumers should prefer this over checking `auth_recovery_callback_url`
|
|
57
|
+
* when they only need to know "does a callback exist?".
|
|
58
|
+
*/
|
|
59
|
+
readonly has_recovery_callback: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Top-level shape emitted by `olam plans list --json`. */
|
|
62
|
+
export interface PlansListJson {
|
|
63
|
+
/** Number of plans returned. */
|
|
64
|
+
readonly count: number;
|
|
65
|
+
readonly plans: readonly PlanListJsonEntry[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Serialise a PlanSummary array to the stable `--json` wire shape.
|
|
69
|
+
* Returns a JSON string (no trailing newline — caller adds it).
|
|
70
|
+
*
|
|
71
|
+
* Redacts any URL credentials in `host_cp_url` and
|
|
72
|
+
* `auth_recovery_callback_url` using the canonical `redactUrl` helper
|
|
73
|
+
* (`:***@` substitution), matching the pattern used by `repos-list-json.ts`
|
|
74
|
+
* and `skills source list --json`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function renderPlansListJson(plans: readonly PlanSummary[]): string;
|
|
77
|
+
//# sourceMappingURL=plans-list-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans-list-json.d.ts","sourceRoot":"","sources":["../../src/commands/plans-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAY1D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;CACzC;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CAqBzE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam plans list --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a live cloud endpoint (mirrors the pattern
|
|
6
|
+
* used by `repos-list-json.ts`, `auth-list-json.ts`, and
|
|
7
|
+
* `servicesStatusJson` in services.ts).
|
|
8
|
+
*
|
|
9
|
+
* WHY this exists: agent/script drivers (Rico, flywheel chain, CI pipelines)
|
|
10
|
+
* need to enumerate cloud plan state — plan IDs, statuses, modes — before
|
|
11
|
+
* deciding whether to spawn a new plan or pick up an existing one. The human
|
|
12
|
+
* table is colorized and column-width-sensitive, so scraping it is brittle.
|
|
13
|
+
* This serialiser gives drivers a stable, color-free array via
|
|
14
|
+
* `olam plans list --json | jq '.plans[] | select(.status=="active")'`.
|
|
15
|
+
*
|
|
16
|
+
* Secret redaction: the PlanSummary shape carries two URL fields
|
|
17
|
+
* (`host_cp_url`, `auth_recovery_callback_url`) that MAY embed auth
|
|
18
|
+
* tokens in the URL userinfo component. Both are redacted before emission
|
|
19
|
+
* using the canonical `:***@` substitution that matches
|
|
20
|
+
* `@olam/core/src/skill-sources/store.ts`'s `redactUrl`.
|
|
21
|
+
* The `bearer` (showcase password) used for HTTP auth never enters the
|
|
22
|
+
* PlanSummary shape itself and is therefore never serialised.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Redact the password component of a URL's userinfo (`:password@` → `:***@`).
|
|
26
|
+
* Matches the same pattern used by `@olam/core/src/skill-sources/store.ts`'s
|
|
27
|
+
* `redactUrl`. Inlined here so the serialiser has no cross-package import that
|
|
28
|
+
* would require built packages to resolve in test environments.
|
|
29
|
+
*/
|
|
30
|
+
function redactUrlCredentials(url) {
|
|
31
|
+
return url.replace(/:[^@/\s]+@/g, ':***@');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serialise a PlanSummary array to the stable `--json` wire shape.
|
|
35
|
+
* Returns a JSON string (no trailing newline — caller adds it).
|
|
36
|
+
*
|
|
37
|
+
* Redacts any URL credentials in `host_cp_url` and
|
|
38
|
+
* `auth_recovery_callback_url` using the canonical `redactUrl` helper
|
|
39
|
+
* (`:***@` substitution), matching the pattern used by `repos-list-json.ts`
|
|
40
|
+
* and `skills source list --json`.
|
|
41
|
+
*/
|
|
42
|
+
export function renderPlansListJson(plans) {
|
|
43
|
+
const rows = plans.map((p) => ({
|
|
44
|
+
plan_id: p.plan_id,
|
|
45
|
+
operator_id: p.operator_id,
|
|
46
|
+
status: p.status,
|
|
47
|
+
mode: p.mode,
|
|
48
|
+
created_at: p.created_at,
|
|
49
|
+
last_active_at: p.last_active_at ?? null,
|
|
50
|
+
pinned_until: p.pinned_until ?? null,
|
|
51
|
+
host_cp_url: p.host_cp_url != null ? redactUrlCredentials(p.host_cp_url) : null,
|
|
52
|
+
auth_recovery_callback_url: p.auth_recovery_callback_url != null ? redactUrlCredentials(p.auth_recovery_callback_url) : null,
|
|
53
|
+
has_recovery_callback: p.has_recovery_callback,
|
|
54
|
+
}));
|
|
55
|
+
const payload = {
|
|
56
|
+
count: rows.length,
|
|
57
|
+
plans: rows,
|
|
58
|
+
};
|
|
59
|
+
return JSON.stringify(payload);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=plans-list-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans-list-json.js","sourceRoot":"","sources":["../../src/commands/plans-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AA8CD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAC/D,MAAM,IAAI,GAAwB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,cAAc,EAAE,CAAC,CAAC,cAAc,IAAI,IAAI;QACxC,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,IAAI;QACpC,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;QAC/E,0BAA0B,EACxB,CAAC,CAAC,0BAA0B,IAAI,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,IAAI;QAClG,qBAAqB,EAAE,CAAC,CAAC,qBAAqB;KAC/C,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAkB;QAC7B,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/commands/plans.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/commands/plans.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+LpD"}
|
package/dist/commands/plans.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// path. Multi-operator support follows the A11 vault-sync flow.
|
|
13
13
|
import { PlansClient, PlansClientError, resolveCloudConfig } from '../lib/plans-client.js';
|
|
14
14
|
import { printError, printSuccess, printHeader, printWarning } from '../output.js';
|
|
15
|
+
import { renderPlansListJson } from './plans-list-json.js';
|
|
15
16
|
function defaultOperatorId() {
|
|
16
17
|
return process.env.OLAM_OPERATOR_ID ?? 'default';
|
|
17
18
|
}
|
|
@@ -37,10 +38,19 @@ export function registerPlans(program) {
|
|
|
37
38
|
.command('list')
|
|
38
39
|
.description('List your cloud plans')
|
|
39
40
|
.option('--operator <id>', 'Operator id', defaultOperatorId())
|
|
41
|
+
.option('--json', 'Emit a machine-readable JSON object instead of the human table', false)
|
|
40
42
|
.action(async (opts) => {
|
|
41
43
|
const client = makeClient();
|
|
42
44
|
try {
|
|
43
45
|
const rows = await client.list(opts.operator);
|
|
46
|
+
// --json: stable, scriptable contract. Always an object with a `plans`
|
|
47
|
+
// array (empty when no plans exist). URL credentials are redacted before
|
|
48
|
+
// emission. Consumers gate on `count`; drivers iterate `plans[].plan_id`
|
|
49
|
+
// + `plans[].status` to pick up existing plans or decide to spawn new ones.
|
|
50
|
+
if (opts.json) {
|
|
51
|
+
process.stdout.write(renderPlansListJson(rows) + '\n');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
44
54
|
if (rows.length === 0) {
|
|
45
55
|
printHeader(`No cloud plans for operator '${opts.operator}'.`);
|
|
46
56
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/commands/plans.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,sEAAsE;AACtE,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,gEAAgE;AAGhE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAoB,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/commands/plans.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,sEAAsE;AACtE,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,gEAAgE;AAGhE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAoB,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,SAAS,iBAAiB;IACxB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,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,KAAK;SACF,OAAO,CAAC,uBAAuB,CAAC;SAChC,WAAW,CAAC,qEAAqE,CAAC;SAClF,cAAc,CAAC,cAAc,EAAE,8CAA8C,CAAC;SAC9E,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAuB,EAAE,EAAE;QACxD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5C,YAAY,CAAC,SAAS,MAAM,iCAAiC,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam repos list --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a filesystem round-trip (mirrors the pattern
|
|
6
|
+
* used by `auth-list-json.ts`, `renderPsJson` in ps.ts, and
|
|
7
|
+
* `servicesStatusJson` in services.ts).
|
|
8
|
+
*
|
|
9
|
+
* WHY this exists: agent/script drivers (CI pipelines, Rico, flywheel
|
|
10
|
+
* chain skills) need to discover registered repo paths before spawning
|
|
11
|
+
* worlds or dispatching work with `--repo`. The human table is colorized
|
|
12
|
+
* and reflows per terminal width, so scraping it is brittle and breaks
|
|
13
|
+
* when column widths change. This serialiser gives drivers a stable,
|
|
14
|
+
* color-free array: each entry carries the name, resolved path, and
|
|
15
|
+
* optional metadata needed to pick a repo without re-querying the registry.
|
|
16
|
+
*
|
|
17
|
+
* Secret redaction: the optional `url` field can carry HTTPS credentials
|
|
18
|
+
* in the URL userinfo component (e.g. `https://token:x-oauth-basic@github.com/...`).
|
|
19
|
+
* The serialiser redacts userinfo credentials with `***` before emitting,
|
|
20
|
+
* matching the same pattern used by `olam skills source list --json`.
|
|
21
|
+
* The `path` field is a local filesystem path and carries no secrets.
|
|
22
|
+
*/
|
|
23
|
+
import type { RepoEntry } from '@olam/core/src/global-config/schema.js';
|
|
24
|
+
/**
|
|
25
|
+
* Per-repo row in the `repos list --json` payload.
|
|
26
|
+
* Field names are load-bearing — add new fields freely, never rename.
|
|
27
|
+
*/
|
|
28
|
+
export interface RepoListJsonEntry {
|
|
29
|
+
/** Registered repo name (lowercase, digits, dash). */
|
|
30
|
+
readonly name: string;
|
|
31
|
+
/** Resolved absolute filesystem path (may still be tilde-prefixed when stored as such). */
|
|
32
|
+
readonly path: string;
|
|
33
|
+
/**
|
|
34
|
+
* Git remote URL, if registered, with credentials redacted.
|
|
35
|
+
* null when the entry has no url field.
|
|
36
|
+
*/
|
|
37
|
+
readonly url: string | null;
|
|
38
|
+
/** Optional human-readable description. */
|
|
39
|
+
readonly description: string | null;
|
|
40
|
+
/** Default branch name (e.g. "main"). null when not set. */
|
|
41
|
+
readonly defaultBranch: string | null;
|
|
42
|
+
/** Unix epoch ms when the entry was first registered. */
|
|
43
|
+
readonly addedAt: number;
|
|
44
|
+
/** Unix epoch ms of the last update. */
|
|
45
|
+
readonly updatedAt: number;
|
|
46
|
+
}
|
|
47
|
+
/** Top-level shape emitted by `olam repos list --json`. */
|
|
48
|
+
export interface ReposListJson {
|
|
49
|
+
/** Number of registered repos. */
|
|
50
|
+
readonly count: number;
|
|
51
|
+
readonly repos: readonly RepoListJsonEntry[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Serialise the global repo registry to the stable `--json` wire shape.
|
|
55
|
+
* Returns a JSON string (no trailing newline — caller adds it).
|
|
56
|
+
*/
|
|
57
|
+
export declare function renderReposListJson(entries: readonly RepoEntry[]): string;
|
|
58
|
+
//# sourceMappingURL=repos-list-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos-list-json.d.ts","sourceRoot":"","sources":["../../src/commands/repos-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAGxE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAkBzE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JSON serialiser for `olam repos list --json`.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the command action so the wire contract is
|
|
5
|
+
* unit-testable without a filesystem round-trip (mirrors the pattern
|
|
6
|
+
* used by `auth-list-json.ts`, `renderPsJson` in ps.ts, and
|
|
7
|
+
* `servicesStatusJson` in services.ts).
|
|
8
|
+
*
|
|
9
|
+
* WHY this exists: agent/script drivers (CI pipelines, Rico, flywheel
|
|
10
|
+
* chain skills) need to discover registered repo paths before spawning
|
|
11
|
+
* worlds or dispatching work with `--repo`. The human table is colorized
|
|
12
|
+
* and reflows per terminal width, so scraping it is brittle and breaks
|
|
13
|
+
* when column widths change. This serialiser gives drivers a stable,
|
|
14
|
+
* color-free array: each entry carries the name, resolved path, and
|
|
15
|
+
* optional metadata needed to pick a repo without re-querying the registry.
|
|
16
|
+
*
|
|
17
|
+
* Secret redaction: the optional `url` field can carry HTTPS credentials
|
|
18
|
+
* in the URL userinfo component (e.g. `https://token:x-oauth-basic@github.com/...`).
|
|
19
|
+
* The serialiser redacts userinfo credentials with `***` before emitting,
|
|
20
|
+
* matching the same pattern used by `olam skills source list --json`.
|
|
21
|
+
* The `path` field is a local filesystem path and carries no secrets.
|
|
22
|
+
*/
|
|
23
|
+
import { redactUrl } from '@olam/core/src/skill-sources/index.js';
|
|
24
|
+
/**
|
|
25
|
+
* Serialise the global repo registry to the stable `--json` wire shape.
|
|
26
|
+
* Returns a JSON string (no trailing newline — caller adds it).
|
|
27
|
+
*/
|
|
28
|
+
export function renderReposListJson(entries) {
|
|
29
|
+
const rows = entries.map((e) => ({
|
|
30
|
+
name: e.name,
|
|
31
|
+
path: e.path,
|
|
32
|
+
// Redact credentials from URL userinfo (e.g. `https://token:x@host` → `https://token:***@host`).
|
|
33
|
+
url: e.url != null ? redactUrl(e.url) : null,
|
|
34
|
+
description: e.description ?? null,
|
|
35
|
+
defaultBranch: e.defaultBranch ?? null,
|
|
36
|
+
addedAt: e.addedAt,
|
|
37
|
+
updatedAt: e.updatedAt,
|
|
38
|
+
}));
|
|
39
|
+
const payload = {
|
|
40
|
+
count: rows.length,
|
|
41
|
+
repos: rows,
|
|
42
|
+
};
|
|
43
|
+
return JSON.stringify(payload);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=repos-list-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos-list-json.js","sourceRoot":"","sources":["../../src/commands/repos-list-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAiClE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,IAAI,GAAwB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,iGAAiG;QACjG,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;QAC5C,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI;QAClC,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,IAAI;QACtC,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,SAAS,EAAE,CAAC,CAAC,SAAS;KACvB,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAkB;QAC7B,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/commands/repos.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* olam repos — manage the global repo registry (~/.olam/config.json).
|
|
3
3
|
*
|
|
4
|
-
* olam repos list
|
|
4
|
+
* olam repos list [--json]
|
|
5
5
|
* olam repos add --name <n> --path <p> [--description <d>] [--default-branch <b>]
|
|
6
6
|
* olam repos remove <name>
|
|
7
7
|
* olam repos update <name> [--path <p>] [--description <d>] [--default-branch <b>]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/commands/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/commands/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwFpD"}
|
package/dist/commands/repos.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* olam repos — manage the global repo registry (~/.olam/config.json).
|
|
3
3
|
*
|
|
4
|
-
* olam repos list
|
|
4
|
+
* olam repos list [--json]
|
|
5
5
|
* olam repos add --name <n> --path <p> [--description <d>] [--default-branch <b>]
|
|
6
6
|
* olam repos remove <name>
|
|
7
7
|
* olam repos update <name> [--path <p>] [--description <d>] [--default-branch <b>]
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import pc from 'picocolors';
|
|
10
10
|
import { listRepos, addRepo, removeRepo, updateRepo, } from '@olam/core/src/global-config/index.js';
|
|
11
11
|
import { printError, printSuccess, printHeader } from '../output.js';
|
|
12
|
+
import { renderReposListJson } from './repos-list-json.js';
|
|
12
13
|
function asMessage(err) {
|
|
13
14
|
return err instanceof Error ? err.message : String(err);
|
|
14
15
|
}
|
|
@@ -19,8 +20,17 @@ export function registerRepos(program) {
|
|
|
19
20
|
repos
|
|
20
21
|
.command('list')
|
|
21
22
|
.description('List all registered repos')
|
|
22
|
-
.
|
|
23
|
+
.option('--json', 'Emit a machine-readable JSON object instead of the human table', false)
|
|
24
|
+
.action((opts) => {
|
|
23
25
|
const all = listRepos();
|
|
26
|
+
// --json: stable, scriptable contract. Always an object with a `repos` array
|
|
27
|
+
// (empty when no repos registered). Consumers gate on `count`; drivers
|
|
28
|
+
// iterate `repos[].name` + `repos[].path` to pick a repo for `--repo` flags.
|
|
29
|
+
// url credentials are redacted before emission (`:***@` substitution).
|
|
30
|
+
if (opts.json) {
|
|
31
|
+
process.stdout.write(renderReposListJson(all) + '\n');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
24
34
|
if (all.length === 0) {
|
|
25
35
|
console.log(pc.dim('0 repo(s) registered. Add one with: olam repos add --name <n> --path <p>'));
|
|
26
36
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.js","sourceRoot":"","sources":["../../src/commands/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EACL,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"repos.js","sourceRoot":"","sources":["../../src/commands/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EACL,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC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