@agentbridge1/cli 0.0.1 → 0.0.3
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/build-info.json +4 -4
- package/dist/commands/connect.js +3 -3
- package/dist/commands/doctor.js +12 -7
- package/dist/commands/recover.js +60 -16
- package/dist/config.js +3 -2
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"builtAt": "2026-06-
|
|
3
|
-
"gitHead": "
|
|
4
|
-
"sourceLatestMtime": "2026-06-
|
|
5
|
-
"sourceLatestFile": "
|
|
2
|
+
"builtAt": "2026-06-02T01:31:45.533Z",
|
|
3
|
+
"gitHead": "184f85c",
|
|
4
|
+
"sourceLatestMtime": "2026-06-02T01:19:37.980Z",
|
|
5
|
+
"sourceLatestFile": "src/commands/recover.ts"
|
|
6
6
|
}
|
package/dist/commands/connect.js
CHANGED
|
@@ -7,7 +7,7 @@ const http_1 = require("../http");
|
|
|
7
7
|
function resolveBaseUrl(override) {
|
|
8
8
|
return (override ??
|
|
9
9
|
process.env.AGENTBRIDGE_BASE_URL ??
|
|
10
|
-
|
|
10
|
+
config_1.DEFAULT_API_BASE_URL);
|
|
11
11
|
}
|
|
12
12
|
async function verifyCredentials(projectId, apiKey, apiBaseUrl) {
|
|
13
13
|
const url = `${apiBaseUrl}/v1/dev/projects/${projectId}/health`;
|
|
@@ -29,7 +29,7 @@ async function verifyCredentials(projectId, apiKey, apiBaseUrl) {
|
|
|
29
29
|
throw new errors_1.SafeCliError(`API key rejected (HTTP ${res.status}).\n\nGet a valid key at https://agentbridge.dev/dashboard and set AGENTBRIDGE_API_KEY.`);
|
|
30
30
|
}
|
|
31
31
|
if (res.status === 404) {
|
|
32
|
-
throw new errors_1.SafeCliError(`Project
|
|
32
|
+
throw new errors_1.SafeCliError(`Project not found on ${apiBaseUrl}. Check project ID or backend URL.`);
|
|
33
33
|
}
|
|
34
34
|
if (!res.ok) {
|
|
35
35
|
const text = await res.text();
|
|
@@ -98,7 +98,7 @@ async function runConnect(options = {}) {
|
|
|
98
98
|
].join("\n"));
|
|
99
99
|
process.exit(1);
|
|
100
100
|
}
|
|
101
|
-
process.stdout.write(`Connecting to project ${projectId} … `);
|
|
101
|
+
process.stdout.write(`Connecting to project ${projectId} at ${apiBaseUrl} … `);
|
|
102
102
|
let projectName;
|
|
103
103
|
let agentCount;
|
|
104
104
|
try {
|
package/dist/commands/doctor.js
CHANGED
|
@@ -86,6 +86,12 @@ function extractHttpReason(error) {
|
|
|
86
86
|
}
|
|
87
87
|
return `http_${error.status}`;
|
|
88
88
|
}
|
|
89
|
+
function recoveryRequiredByPacket(packet) {
|
|
90
|
+
if (!packet || packet.project_mode !== "recovery")
|
|
91
|
+
return false;
|
|
92
|
+
const status = packet.recovery_status ?? null;
|
|
93
|
+
return status === "baseline_required" || status === "pending" || status === null;
|
|
94
|
+
}
|
|
89
95
|
async function checkProjectAccess(ctx) {
|
|
90
96
|
if (!ctx.configComplete) {
|
|
91
97
|
return {
|
|
@@ -97,8 +103,8 @@ async function checkProjectAccess(ctx) {
|
|
|
97
103
|
const apiKey = ctx.apiKey;
|
|
98
104
|
const apiBaseUrl = ctx.apiBaseUrl;
|
|
99
105
|
try {
|
|
100
|
-
await (0, http_1.getJson)({ projectId, apiKey, apiBaseUrl, apiKeySource: "config" }, `/v1/dev/projects/${encodeURIComponent(projectId)}/packet`);
|
|
101
|
-
return { status: "ok" };
|
|
106
|
+
const packet = await (0, http_1.getJson)({ projectId, apiKey, apiBaseUrl, apiKeySource: "config" }, `/v1/dev/projects/${encodeURIComponent(projectId)}/packet`);
|
|
107
|
+
return { status: "ok", packet };
|
|
102
108
|
}
|
|
103
109
|
catch (error) {
|
|
104
110
|
if (error instanceof http_1.CliHttpError) {
|
|
@@ -176,7 +182,7 @@ async function runDoctor(cliRootOverride) {
|
|
|
176
182
|
const resolvedApiKey = process.env.AGENTBRIDGE_API_KEY ?? cfg.apiKey;
|
|
177
183
|
const resolvedBaseUrl = process.env.AGENTBRIDGE_BASE_URL ??
|
|
178
184
|
cfg.apiBaseUrl ??
|
|
179
|
-
|
|
185
|
+
config_1.DEFAULT_API_BASE_URL;
|
|
180
186
|
const resolvedAgentId = process.env.AGENTBRIDGE_AGENT_ID ?? cfg.activeAgentId;
|
|
181
187
|
const projectIdPresent = Boolean(resolvedProjectId);
|
|
182
188
|
const apiKeyPresent = Boolean(resolvedApiKey);
|
|
@@ -251,10 +257,9 @@ async function runDoctor(cliRootOverride) {
|
|
|
251
257
|
productStatus = "active_work_found";
|
|
252
258
|
}
|
|
253
259
|
else {
|
|
254
|
-
productStatus =
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
: "needs_recover";
|
|
260
|
+
productStatus = recoveryRequiredByPacket(projectAccess.packet)
|
|
261
|
+
? "needs_recover"
|
|
262
|
+
: "ready";
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
lines.push("");
|
package/dist/commands/recover.js
CHANGED
|
@@ -21,10 +21,18 @@ function resolveNetworkContext() {
|
|
|
21
21
|
}
|
|
22
22
|
function renderRecoverOutput(packet) {
|
|
23
23
|
const lines = [];
|
|
24
|
+
const domainCount = packet.domains_summary.length;
|
|
25
|
+
const ruleCount = packet.global_rules?.length ?? 0;
|
|
26
|
+
const hasCharterContext = Boolean(packet.charter_summary?.purpose);
|
|
24
27
|
lines.push("Project recovered.");
|
|
25
28
|
lines.push("");
|
|
26
29
|
lines.push(`Project: ${packet.project_name ?? packet.project_id}`);
|
|
27
|
-
|
|
30
|
+
lines.push("");
|
|
31
|
+
lines.push("Recovered artifacts:");
|
|
32
|
+
lines.push(`- Domains: ${domainCount}`);
|
|
33
|
+
lines.push(`- Project rules: ${ruleCount}`);
|
|
34
|
+
lines.push(`- Charter context: ${hasCharterContext ? "yes" : "no"}`);
|
|
35
|
+
if (domainCount > 0) {
|
|
28
36
|
lines.push("");
|
|
29
37
|
lines.push("Domains found:");
|
|
30
38
|
for (const domain of packet.domains_summary) {
|
|
@@ -50,6 +58,26 @@ function renderRecoverOutput(packet) {
|
|
|
50
58
|
lines.push("");
|
|
51
59
|
return lines.join("\n");
|
|
52
60
|
}
|
|
61
|
+
function recoveryStatusLabel(packet) {
|
|
62
|
+
return packet.recovery_status ?? "unknown";
|
|
63
|
+
}
|
|
64
|
+
function baselineRequired(packet) {
|
|
65
|
+
const status = packet.recovery_status ?? null;
|
|
66
|
+
if (packet.project_mode !== "recovery")
|
|
67
|
+
return false;
|
|
68
|
+
return status === "baseline_required" || status === "pending" || status === null;
|
|
69
|
+
}
|
|
70
|
+
function renderRecoveryStatusBlock(input) {
|
|
71
|
+
const lines = [];
|
|
72
|
+
lines.push(`Project: ${input.projectId}`);
|
|
73
|
+
lines.push(`Recovery status before: ${recoveryStatusLabel(input.before)}`);
|
|
74
|
+
lines.push(`Action: ${input.action}`);
|
|
75
|
+
lines.push(`Recovery status after: ${recoveryStatusLabel(input.after)}`);
|
|
76
|
+
lines.push("Next:");
|
|
77
|
+
lines.push(` ${input.next}`);
|
|
78
|
+
lines.push("");
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
53
81
|
async function runRecover(options = {}) {
|
|
54
82
|
process.exitCode = 0;
|
|
55
83
|
process.stdout.write([
|
|
@@ -91,26 +119,42 @@ async function runRecover(options = {}) {
|
|
|
91
119
|
process.exitCode = 1;
|
|
92
120
|
return;
|
|
93
121
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
process.stdout.write("Project context already exists.\n\n");
|
|
103
|
-
process.stdout.write(renderRecoverOutput(packet));
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (!alreadyRecovered) {
|
|
107
|
-
process.stdout.write("No baseline found. Building recovery baseline now...\n");
|
|
122
|
+
const beforePacket = packet;
|
|
123
|
+
const needsRecovery = baselineRequired(beforePacket);
|
|
124
|
+
let actionTaken = "baseline already exists; no rebuild needed";
|
|
125
|
+
if (needsRecovery || options.force) {
|
|
126
|
+
actionTaken = needsRecovery
|
|
127
|
+
? "build recovery baseline from repository evidence"
|
|
128
|
+
: "force-refresh recovery baseline from repository evidence";
|
|
129
|
+
process.stdout.write("Building recovery baseline now...\n");
|
|
108
130
|
await (0, init_1.runBootstrapRecovery)(ctx);
|
|
109
131
|
packet = await (0, server_sync_1.fetchProjectPacket)(ctx);
|
|
110
132
|
}
|
|
111
|
-
|
|
133
|
+
const afterPacket = packet;
|
|
134
|
+
if (baselineRequired(afterPacket)) {
|
|
135
|
+
process.stderr.write([
|
|
136
|
+
"Recovery could not complete: baseline still required.",
|
|
137
|
+
"",
|
|
138
|
+
renderRecoveryStatusBlock({
|
|
139
|
+
projectId: ctx.projectId,
|
|
140
|
+
before: beforePacket,
|
|
141
|
+
after: afterPacket,
|
|
142
|
+
action: actionTaken,
|
|
143
|
+
next: "agentbridge doctor",
|
|
144
|
+
}),
|
|
145
|
+
].join("\n"));
|
|
146
|
+
process.exitCode = 1;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
112
149
|
const repoRoot = (0, node_process_1.cwd)();
|
|
113
150
|
(0, gates_1.ensureGitignoreSessionEntry)(repoRoot);
|
|
114
151
|
(0, gates_1.ensureGatesFile)(repoRoot);
|
|
152
|
+
process.stdout.write(renderRecoveryStatusBlock({
|
|
153
|
+
projectId: ctx.projectId,
|
|
154
|
+
before: beforePacket,
|
|
155
|
+
after: afterPacket,
|
|
156
|
+
action: actionTaken,
|
|
157
|
+
next: "agentbridge start",
|
|
158
|
+
}));
|
|
115
159
|
process.stdout.write(renderRecoverOutput(packet));
|
|
116
160
|
}
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONFIG_PATH = exports.CONFIG_DIR = void 0;
|
|
3
|
+
exports.DEFAULT_API_BASE_URL = exports.CONFIG_PATH = exports.CONFIG_DIR = void 0;
|
|
4
4
|
exports.readConfig = readConfig;
|
|
5
5
|
exports.writeConfig = writeConfig;
|
|
6
6
|
exports.updateConfig = updateConfig;
|
|
@@ -9,6 +9,7 @@ const node_fs_1 = require("node:fs");
|
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
exports.CONFIG_DIR = ".agentbridge";
|
|
11
11
|
exports.CONFIG_PATH = (0, node_path_1.resolve)(process.cwd(), exports.CONFIG_DIR, "config.json");
|
|
12
|
+
exports.DEFAULT_API_BASE_URL = "https://agentauth-api-production.up.railway.app";
|
|
12
13
|
function ensureConfigDir() {
|
|
13
14
|
(0, node_fs_1.mkdirSync)((0, node_path_1.resolve)(process.cwd(), exports.CONFIG_DIR), { recursive: true });
|
|
14
15
|
}
|
|
@@ -33,7 +34,7 @@ function contextFromConfig() {
|
|
|
33
34
|
const cfg = readConfig();
|
|
34
35
|
const apiBaseUrl = process.env.AGENTBRIDGE_BASE_URL ??
|
|
35
36
|
cfg.apiBaseUrl ??
|
|
36
|
-
|
|
37
|
+
exports.DEFAULT_API_BASE_URL;
|
|
37
38
|
const apiKey = process.env.AGENTBRIDGE_API_KEY ?? cfg.apiKey;
|
|
38
39
|
const projectId = process.env.AGENTBRIDGE_PROJECT_ID ?? cfg.projectId;
|
|
39
40
|
if (!apiBaseUrl || !apiKey || !projectId) {
|
package/dist/index.js
CHANGED
|
@@ -221,7 +221,7 @@ function resolveInitContext(overrides) {
|
|
|
221
221
|
const apiBaseUrl = overrides.apiBaseUrl ??
|
|
222
222
|
process.env.AGENTBRIDGE_BASE_URL ??
|
|
223
223
|
cfg.apiBaseUrl ??
|
|
224
|
-
|
|
224
|
+
config_1.DEFAULT_API_BASE_URL;
|
|
225
225
|
if (!projectId) {
|
|
226
226
|
throw (0, errors_1.catalogCliError)("CONFIG_INCOMPLETE");
|
|
227
227
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentbridge1/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "CLI for AgentBridge — structured AI agent work sessions with domain authority and approval gates",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"url": "git+https://github.com/agentbridge/agentbridge.git"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"chalk": "^5.6.2",
|
|
42
43
|
"chokidar": "^4.0.3"
|
|
43
44
|
}
|
|
44
45
|
}
|