bamboo-agents 0.1.5-dev.44.fc84729 → 0.1.5-dev.46.a33345f
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/VERSION +1 -1
- package/dist/index.js +290 -74
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.5-dev.
|
|
1
|
+
0.1.5-dev.46.a33345f
|
package/dist/index.js
CHANGED
|
@@ -3037,7 +3037,7 @@ var VERSION;
|
|
|
3037
3037
|
var init_version = __esm({
|
|
3038
3038
|
"src/version.ts"() {
|
|
3039
3039
|
"use strict";
|
|
3040
|
-
VERSION = "0.1.5-dev.
|
|
3040
|
+
VERSION = "0.1.5-dev.46.a33345f";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12134,6 +12134,58 @@ var init_agents = __esm({
|
|
|
12134
12134
|
}
|
|
12135
12135
|
});
|
|
12136
12136
|
|
|
12137
|
+
// ../../src/lib/api-contracts/cli/save.ts
|
|
12138
|
+
var SaveEditSchema, SaveBatchRequestSchema, SaveFileResultSchema, SaveBatchResponseSchema;
|
|
12139
|
+
var init_save = __esm({
|
|
12140
|
+
"../../src/lib/api-contracts/cli/save.ts"() {
|
|
12141
|
+
init_zod();
|
|
12142
|
+
SaveEditSchema = external_exports.object({
|
|
12143
|
+
/** Canonical repo path, e.g. `brands/acme/knowledge/competitors.md`. */
|
|
12144
|
+
path: external_exports.string().min(1).max(512),
|
|
12145
|
+
/** UTF-8 file content. Required unless `delete` is true. */
|
|
12146
|
+
content: external_exports.string().optional(),
|
|
12147
|
+
/** Emit as a git-level deletion instead of a content write. */
|
|
12148
|
+
delete: external_exports.boolean().optional()
|
|
12149
|
+
}).refine((e) => e.delete === true || typeof e.content === "string", {
|
|
12150
|
+
message: "content is required unless delete is true"
|
|
12151
|
+
});
|
|
12152
|
+
SaveBatchRequestSchema = external_exports.object({
|
|
12153
|
+
/** The changed + deleted files the client found vs the last-synced state. */
|
|
12154
|
+
edits: external_exports.array(SaveEditSchema).min(1).max(200),
|
|
12155
|
+
/** Human-readable summary surfaced in the PR body / commit trailer. */
|
|
12156
|
+
intent: external_exports.string().max(500).optional()
|
|
12157
|
+
});
|
|
12158
|
+
SaveFileResultSchema = external_exports.object({
|
|
12159
|
+
path: external_exports.string(),
|
|
12160
|
+
/** `auto` = merged to main; `queued` = opened/appended a review PR. */
|
|
12161
|
+
routed: external_exports.enum(["auto", "queued"]),
|
|
12162
|
+
/** Present when a PR was opened (queued, or auto via the queue-PR path). */
|
|
12163
|
+
pr_url: external_exports.string().optional(),
|
|
12164
|
+
pr_number: external_exports.number().optional()
|
|
12165
|
+
});
|
|
12166
|
+
SaveBatchResponseSchema = external_exports.object({
|
|
12167
|
+
/**
|
|
12168
|
+
* Aggregate routing decision from `executeKnowledgeWrite` for the whole
|
|
12169
|
+
* batch (the core routes a batch as one unit). `auto` when every edit
|
|
12170
|
+
* auto-merged, `queued` otherwise.
|
|
12171
|
+
*/
|
|
12172
|
+
routed: external_exports.enum(["auto", "queued"]),
|
|
12173
|
+
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
12174
|
+
/** Per-file detail. One entry per accepted edit. */
|
|
12175
|
+
files: external_exports.array(SaveFileResultSchema),
|
|
12176
|
+
/** Count of files that landed live (auto-merged). */
|
|
12177
|
+
live_count: external_exports.number().int().nonnegative(),
|
|
12178
|
+
/** Count of files queued for review. */
|
|
12179
|
+
queued_count: external_exports.number().int().nonnegative(),
|
|
12180
|
+
/** Present when a PR was opened for the batch. */
|
|
12181
|
+
pr_url: external_exports.string().optional(),
|
|
12182
|
+
pr_number: external_exports.number().optional(),
|
|
12183
|
+
/** Present on a rejected/forbidden batch — short machine-friendly reason. */
|
|
12184
|
+
reason: external_exports.string().optional()
|
|
12185
|
+
});
|
|
12186
|
+
}
|
|
12187
|
+
});
|
|
12188
|
+
|
|
12137
12189
|
// ../../src/lib/api-contracts/cli/context-health.ts
|
|
12138
12190
|
var ScopeKindSchema, ScopeSchema, CriterionMetricsSchema, StatusSchema, CriterionContributionSchema, CriterionResultSchema, BucketScoresSchema, ResolvedScopeSchema, GapsSchema, ContextHealthResponseSchema;
|
|
12139
12191
|
var init_context_health = __esm({
|
|
@@ -12284,6 +12336,19 @@ async function saveKnowledge(bambooSession, body) {
|
|
|
12284
12336
|
const json = await res.json();
|
|
12285
12337
|
return KnowledgeSaveResponseSchema.parse(json);
|
|
12286
12338
|
}
|
|
12339
|
+
async function saveWorkspace(bambooSession, body) {
|
|
12340
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/save`, {
|
|
12341
|
+
method: "POST",
|
|
12342
|
+
headers: {
|
|
12343
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
12344
|
+
"Content-Type": "application/json"
|
|
12345
|
+
},
|
|
12346
|
+
body: JSON.stringify(body)
|
|
12347
|
+
});
|
|
12348
|
+
if (!res.ok) throw await parseError(res);
|
|
12349
|
+
const json = await res.json();
|
|
12350
|
+
return SaveBatchResponseSchema.parse(json);
|
|
12351
|
+
}
|
|
12287
12352
|
async function getHistory(bambooSession, opts = {}) {
|
|
12288
12353
|
const url = new URL(`${apiBase()}/api/v1/cli/history`);
|
|
12289
12354
|
if (opts.limit) url.searchParams.set("limit", String(opts.limit));
|
|
@@ -12515,6 +12580,7 @@ var init_api = __esm({
|
|
|
12515
12580
|
init_agents();
|
|
12516
12581
|
init_knowledge_slots();
|
|
12517
12582
|
init_knowledge_save();
|
|
12583
|
+
init_save();
|
|
12518
12584
|
init_history();
|
|
12519
12585
|
init_changes();
|
|
12520
12586
|
init_onboarding_status();
|
|
@@ -15137,22 +15203,83 @@ var init_doctor = __esm({
|
|
|
15137
15203
|
// src/commands/save.ts
|
|
15138
15204
|
var save_exports = {};
|
|
15139
15205
|
__export(save_exports, {
|
|
15206
|
+
isDeletion: () => isDeletion,
|
|
15207
|
+
isManagedPath: () => isManagedPath,
|
|
15208
|
+
parsePorcelain: () => parsePorcelain,
|
|
15209
|
+
planBatchFromPorcelain: () => planBatchFromPorcelain,
|
|
15140
15210
|
runSave: () => runSave
|
|
15141
15211
|
});
|
|
15142
15212
|
import { execFile as execFile9 } from "node:child_process";
|
|
15213
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
15214
|
+
import { join as join3 } from "node:path";
|
|
15143
15215
|
import { promisify as promisify9 } from "node:util";
|
|
15216
|
+
function parsePorcelain(out) {
|
|
15217
|
+
if (!out) return [];
|
|
15218
|
+
const fields = out.split("\0");
|
|
15219
|
+
const entries = [];
|
|
15220
|
+
for (let i = 0; i < fields.length; i++) {
|
|
15221
|
+
const field = fields[i];
|
|
15222
|
+
if (!field) continue;
|
|
15223
|
+
const status = field.slice(0, 2);
|
|
15224
|
+
const path2 = field.slice(3);
|
|
15225
|
+
if (!path2) continue;
|
|
15226
|
+
entries.push({ status, path: path2 });
|
|
15227
|
+
if (status[0] === "R" || status[0] === "C") {
|
|
15228
|
+
i++;
|
|
15229
|
+
}
|
|
15230
|
+
}
|
|
15231
|
+
return entries;
|
|
15232
|
+
}
|
|
15233
|
+
function isManagedPath(path2) {
|
|
15234
|
+
if (MANAGED_FILES.includes(path2)) return true;
|
|
15235
|
+
return MANAGED_PREFIXES.some((p) => path2.startsWith(p));
|
|
15236
|
+
}
|
|
15237
|
+
function isDeletion(entry) {
|
|
15238
|
+
return entry.status[0] === "D" || entry.status[1] === "D";
|
|
15239
|
+
}
|
|
15240
|
+
function planBatchFromPorcelain(entries) {
|
|
15241
|
+
const deletes = [];
|
|
15242
|
+
const writes = [];
|
|
15243
|
+
const skipped = [];
|
|
15244
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15245
|
+
for (const entry of entries) {
|
|
15246
|
+
if (seen.has(entry.path)) continue;
|
|
15247
|
+
seen.add(entry.path);
|
|
15248
|
+
if (!isManagedPath(entry.path)) {
|
|
15249
|
+
skipped.push(entry.path);
|
|
15250
|
+
continue;
|
|
15251
|
+
}
|
|
15252
|
+
if (isDeletion(entry)) {
|
|
15253
|
+
deletes.push(entry.path);
|
|
15254
|
+
} else {
|
|
15255
|
+
writes.push(entry.path);
|
|
15256
|
+
}
|
|
15257
|
+
}
|
|
15258
|
+
return { deletes, writes, skipped };
|
|
15259
|
+
}
|
|
15144
15260
|
async function gitC(repoPath, args) {
|
|
15145
|
-
const { stdout
|
|
15146
|
-
encoding: "utf8"
|
|
15261
|
+
const { stdout } = await execFileP4("git", ["-C", repoPath, ...args], {
|
|
15262
|
+
encoding: "utf8",
|
|
15263
|
+
// -z output + file content can exceed the default 1MB buffer.
|
|
15264
|
+
maxBuffer: 32 * 1024 * 1024
|
|
15147
15265
|
});
|
|
15148
|
-
return
|
|
15266
|
+
return stdout;
|
|
15149
15267
|
}
|
|
15150
|
-
async function
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15268
|
+
async function currentBranch(repoPath) {
|
|
15269
|
+
const out = await gitC(repoPath, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
15270
|
+
return out.trim() || "main";
|
|
15271
|
+
}
|
|
15272
|
+
async function requireSession() {
|
|
15273
|
+
const creds = await readCredentials();
|
|
15274
|
+
if (!creds) {
|
|
15275
|
+
console.error(
|
|
15276
|
+
"bamboo-agents save: not signed in. Run `bamboo-agents login` first."
|
|
15277
|
+
);
|
|
15278
|
+
process.exit(1);
|
|
15155
15279
|
}
|
|
15280
|
+
return creds.bamboo_session;
|
|
15281
|
+
}
|
|
15282
|
+
async function runSave(intent) {
|
|
15156
15283
|
let workspacePath;
|
|
15157
15284
|
try {
|
|
15158
15285
|
workspacePath = (await resolveWorkspace()).path;
|
|
@@ -15163,40 +15290,118 @@ async function runSave(message) {
|
|
|
15163
15290
|
}
|
|
15164
15291
|
throw err;
|
|
15165
15292
|
}
|
|
15293
|
+
const session = await requireSession();
|
|
15294
|
+
let entries;
|
|
15166
15295
|
try {
|
|
15167
|
-
await gitC(workspacePath, [
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15296
|
+
const porcelain = await gitC(workspacePath, [
|
|
15297
|
+
"status",
|
|
15298
|
+
"--porcelain=v1",
|
|
15299
|
+
"-z",
|
|
15300
|
+
"-uall"
|
|
15301
|
+
]);
|
|
15302
|
+
entries = parsePorcelain(porcelain);
|
|
15303
|
+
} catch {
|
|
15304
|
+
console.error(
|
|
15305
|
+
" Couldn't read your workspace changes.\n Next: run `bamboo-agents doctor` to check your workspace is healthy."
|
|
15306
|
+
);
|
|
15307
|
+
process.exit(1);
|
|
15308
|
+
}
|
|
15309
|
+
const { deletes, writes, skipped } = planBatchFromPorcelain(entries);
|
|
15310
|
+
if (deletes.length === 0 && writes.length === 0) {
|
|
15311
|
+
console.log("");
|
|
15312
|
+
if (skipped.length > 0) {
|
|
15313
|
+
console.log(
|
|
15314
|
+
" Nothing to save \u2014 the only changes are outside your context folders."
|
|
15315
|
+
);
|
|
15316
|
+
} else {
|
|
15176
15317
|
console.log(" Nothing to save \u2014 your workspace is already up to date.");
|
|
15177
|
-
console.log("");
|
|
15178
|
-
return;
|
|
15179
15318
|
}
|
|
15180
|
-
await gitC(workspacePath, ["commit", "-m", message.trim()]);
|
|
15181
|
-
await gitC(workspacePath, ["push"]);
|
|
15182
|
-
console.log("");
|
|
15183
|
-
console.log(` Saved: ${message.trim()}`);
|
|
15184
|
-
console.log(` (pushed from ${workspacePath})`);
|
|
15185
15319
|
console.log("");
|
|
15320
|
+
return;
|
|
15321
|
+
}
|
|
15322
|
+
const edits = [];
|
|
15323
|
+
try {
|
|
15324
|
+
for (const path2 of writes) {
|
|
15325
|
+
const content = await readFile4(join3(workspacePath, path2), "utf8");
|
|
15326
|
+
edits.push({ path: path2, content });
|
|
15327
|
+
}
|
|
15328
|
+
} catch {
|
|
15329
|
+
console.error(
|
|
15330
|
+
" Couldn't read one of your changed files.\n Next: make sure the file still exists, then run `bamboo-agents save` again."
|
|
15331
|
+
);
|
|
15332
|
+
process.exit(1);
|
|
15333
|
+
}
|
|
15334
|
+
for (const path2 of deletes) {
|
|
15335
|
+
edits.push({ path: path2, delete: true });
|
|
15336
|
+
}
|
|
15337
|
+
let result;
|
|
15338
|
+
try {
|
|
15339
|
+
result = await saveWorkspace(session, {
|
|
15340
|
+
edits,
|
|
15341
|
+
intent: intent?.trim() || void 0
|
|
15342
|
+
});
|
|
15186
15343
|
} catch (err) {
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15344
|
+
if (err instanceof ApiError && err.status === 403) {
|
|
15345
|
+
console.error("");
|
|
15346
|
+
console.error(
|
|
15347
|
+
" Couldn't save \u2014 you don't have permission to change some of these files.\n Next: ask an org admin to review, or edit only your own brand/agent files."
|
|
15348
|
+
);
|
|
15349
|
+
process.exit(1);
|
|
15350
|
+
}
|
|
15351
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
15352
|
+
console.error("");
|
|
15353
|
+
console.error(
|
|
15354
|
+
` Couldn't reach Bamboo to save your changes.
|
|
15355
|
+
Next: check your connection and run \`bamboo-agents save\` again. (${message})`
|
|
15356
|
+
);
|
|
15191
15357
|
process.exit(1);
|
|
15192
15358
|
}
|
|
15359
|
+
let branch = "main";
|
|
15360
|
+
try {
|
|
15361
|
+
branch = await currentBranch(workspacePath);
|
|
15362
|
+
await gitC(workspacePath, ["fetch", "origin", branch]);
|
|
15363
|
+
await gitC(workspacePath, ["reset", "--hard", `origin/${branch}`]);
|
|
15364
|
+
} catch {
|
|
15365
|
+
console.warn(
|
|
15366
|
+
" (Saved, but couldn't refresh your local copy just now \u2014 it'll catch up on your next command.)"
|
|
15367
|
+
);
|
|
15368
|
+
}
|
|
15369
|
+
const total = edits.length;
|
|
15370
|
+
const live = result.live_count;
|
|
15371
|
+
const queued = result.queued_count;
|
|
15372
|
+
console.log("");
|
|
15373
|
+
const parts = [];
|
|
15374
|
+
if (live > 0) parts.push(`${live} live`);
|
|
15375
|
+
if (queued > 0) parts.push(`${queued} queued for review`);
|
|
15376
|
+
const summary = parts.length > 0 ? ` \u2014 ${parts.join(", ")}` : "";
|
|
15377
|
+
console.log(` Saved ${total} file${total === 1 ? "" : "s"}${summary}.`);
|
|
15378
|
+
if (queued > 0 && result.pr_url) {
|
|
15379
|
+
console.log(` Review: ${result.pr_url}`);
|
|
15380
|
+
}
|
|
15381
|
+
if (skipped.length > 0) {
|
|
15382
|
+
console.log(
|
|
15383
|
+
` (Skipped ${skipped.length} file${skipped.length === 1 ? "" : "s"} outside your context folders.)`
|
|
15384
|
+
);
|
|
15385
|
+
}
|
|
15386
|
+
console.log("");
|
|
15193
15387
|
}
|
|
15194
|
-
var execFileP4;
|
|
15195
|
-
var
|
|
15388
|
+
var execFileP4, MANAGED_PREFIXES, MANAGED_FILES;
|
|
15389
|
+
var init_save2 = __esm({
|
|
15196
15390
|
"src/commands/save.ts"() {
|
|
15197
15391
|
"use strict";
|
|
15392
|
+
init_api();
|
|
15393
|
+
init_credentials();
|
|
15198
15394
|
init_workspace();
|
|
15199
15395
|
execFileP4 = promisify9(execFile9);
|
|
15396
|
+
MANAGED_PREFIXES = [
|
|
15397
|
+
"brands/",
|
|
15398
|
+
"agents/",
|
|
15399
|
+
"knowledge/",
|
|
15400
|
+
"skills/",
|
|
15401
|
+
"instructions/",
|
|
15402
|
+
"org/"
|
|
15403
|
+
];
|
|
15404
|
+
MANAGED_FILES = ["CLAUDE.md", "AGENTS.md"];
|
|
15200
15405
|
}
|
|
15201
15406
|
});
|
|
15202
15407
|
|
|
@@ -15259,8 +15464,8 @@ var init_sync = __esm({
|
|
|
15259
15464
|
});
|
|
15260
15465
|
|
|
15261
15466
|
// src/lib/skills-local.ts
|
|
15262
|
-
import { readdir as readdir3, readFile as
|
|
15263
|
-
import { join as
|
|
15467
|
+
import { readdir as readdir3, readFile as readFile5, stat as stat2 } from "node:fs/promises";
|
|
15468
|
+
import { join as join4 } from "node:path";
|
|
15264
15469
|
function parseSimpleFrontmatter(raw) {
|
|
15265
15470
|
const text = raw.replace(/\r\n/g, "\n");
|
|
15266
15471
|
const m = text.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
@@ -15375,7 +15580,7 @@ function parseSkillContent(raw, sourcePath) {
|
|
|
15375
15580
|
};
|
|
15376
15581
|
}
|
|
15377
15582
|
async function resolveSkillsDir(repoPath) {
|
|
15378
|
-
const dir =
|
|
15583
|
+
const dir = join4(repoPath, "skills");
|
|
15379
15584
|
try {
|
|
15380
15585
|
const s = await stat2(dir);
|
|
15381
15586
|
return s.isDirectory() ? dir : null;
|
|
@@ -15390,10 +15595,10 @@ async function listLocalSkills(repoPath) {
|
|
|
15390
15595
|
const skillDirs = entries.filter((e) => e.isDirectory());
|
|
15391
15596
|
const skills2 = [];
|
|
15392
15597
|
for (const entry of skillDirs) {
|
|
15393
|
-
const full =
|
|
15598
|
+
const full = join4(dir, entry.name, "SKILL.md");
|
|
15394
15599
|
let raw;
|
|
15395
15600
|
try {
|
|
15396
|
-
raw = await
|
|
15601
|
+
raw = await readFile5(full, "utf8");
|
|
15397
15602
|
} catch (err) {
|
|
15398
15603
|
const code = err.code;
|
|
15399
15604
|
if (code === "ENOENT") continue;
|
|
@@ -15411,10 +15616,10 @@ async function listLocalSkills(repoPath) {
|
|
|
15411
15616
|
async function getLocalSkill(repoPath, name) {
|
|
15412
15617
|
const dir = await resolveSkillsDir(repoPath);
|
|
15413
15618
|
if (!dir) return null;
|
|
15414
|
-
const full =
|
|
15619
|
+
const full = join4(dir, name, "SKILL.md");
|
|
15415
15620
|
let raw;
|
|
15416
15621
|
try {
|
|
15417
|
-
raw = await
|
|
15622
|
+
raw = await readFile5(full, "utf8");
|
|
15418
15623
|
} catch {
|
|
15419
15624
|
return null;
|
|
15420
15625
|
}
|
|
@@ -15485,7 +15690,7 @@ function printAgentNotFound(identifier, agents) {
|
|
|
15485
15690
|
}
|
|
15486
15691
|
process.exit(2);
|
|
15487
15692
|
}
|
|
15488
|
-
async function
|
|
15693
|
+
async function requireSession2() {
|
|
15489
15694
|
const creds = await readCredentials();
|
|
15490
15695
|
if (!creds) {
|
|
15491
15696
|
console.error(
|
|
@@ -15500,7 +15705,7 @@ async function runSkillsList(options = {}) {
|
|
|
15500
15705
|
}
|
|
15501
15706
|
async function runSkillsListImpl(options = {}) {
|
|
15502
15707
|
if (options.agent) {
|
|
15503
|
-
const bambooSession = await
|
|
15708
|
+
const bambooSession = await requireSession2();
|
|
15504
15709
|
const resolved = await resolveAgent(bambooSession, options.agent);
|
|
15505
15710
|
if (!resolved) {
|
|
15506
15711
|
const list = await listCliAgents(bambooSession);
|
|
@@ -15658,7 +15863,7 @@ async function runSubscribeOp(action, agentIdentifier, skillName) {
|
|
|
15658
15863
|
);
|
|
15659
15864
|
process.exit(2);
|
|
15660
15865
|
}
|
|
15661
|
-
const bambooSession = await
|
|
15866
|
+
const bambooSession = await requireSession2();
|
|
15662
15867
|
const resolved = await resolveAgent(bambooSession, agentIdentifier);
|
|
15663
15868
|
if (!resolved) {
|
|
15664
15869
|
const list = await listCliAgents(bambooSession);
|
|
@@ -15708,7 +15913,7 @@ async function runSkillsCreateImpl(skillName, options = {}) {
|
|
|
15708
15913
|
);
|
|
15709
15914
|
process.exit(2);
|
|
15710
15915
|
}
|
|
15711
|
-
const bambooSession = await
|
|
15916
|
+
const bambooSession = await requireSession2();
|
|
15712
15917
|
let result;
|
|
15713
15918
|
try {
|
|
15714
15919
|
result = await scaffoldSkill(bambooSession, {
|
|
@@ -15745,7 +15950,7 @@ async function runSkillsUpdateImpl(agentIdentifier, skillName) {
|
|
|
15745
15950
|
console.error('Example: bamboo-agents skills update "Paid Ads" walk-pr');
|
|
15746
15951
|
process.exit(2);
|
|
15747
15952
|
}
|
|
15748
|
-
const bambooSession = await
|
|
15953
|
+
const bambooSession = await requireSession2();
|
|
15749
15954
|
const resolved = await resolveAgent(bambooSession, agentIdentifier);
|
|
15750
15955
|
if (!resolved) {
|
|
15751
15956
|
const list = await listCliAgents(bambooSession);
|
|
@@ -15783,8 +15988,8 @@ __export(knowledge_exports, {
|
|
|
15783
15988
|
runKnowledgeSave: () => runKnowledgeSave,
|
|
15784
15989
|
runKnowledgeSlots: () => runKnowledgeSlots
|
|
15785
15990
|
});
|
|
15786
|
-
import { readFile as
|
|
15787
|
-
async function
|
|
15991
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
15992
|
+
async function requireSession3() {
|
|
15788
15993
|
const creds = await readCredentials();
|
|
15789
15994
|
if (!creds) {
|
|
15790
15995
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -15824,7 +16029,7 @@ function printHuman(data) {
|
|
|
15824
16029
|
console.log("");
|
|
15825
16030
|
}
|
|
15826
16031
|
async function runKnowledgeSlots(options) {
|
|
15827
|
-
const session = await
|
|
16032
|
+
const session = await requireSession3();
|
|
15828
16033
|
let data;
|
|
15829
16034
|
try {
|
|
15830
16035
|
data = await getKnowledgeSlots(session);
|
|
@@ -15840,7 +16045,7 @@ async function runKnowledgeSlots(options) {
|
|
|
15840
16045
|
}
|
|
15841
16046
|
async function resolveContent(options) {
|
|
15842
16047
|
if (options.contentFile) {
|
|
15843
|
-
return
|
|
16048
|
+
return readFile6(options.contentFile, "utf8");
|
|
15844
16049
|
}
|
|
15845
16050
|
if (typeof options.content === "string") {
|
|
15846
16051
|
return options.content;
|
|
@@ -15855,7 +16060,7 @@ async function resolveContent(options) {
|
|
|
15855
16060
|
return "";
|
|
15856
16061
|
}
|
|
15857
16062
|
async function runKnowledgeSave(options) {
|
|
15858
|
-
const session = await
|
|
16063
|
+
const session = await requireSession3();
|
|
15859
16064
|
if (!options.path) {
|
|
15860
16065
|
console.error("bamboo-agents: knowledge save requires --path.");
|
|
15861
16066
|
console.error("Tip: run `bamboo-agents knowledge slots` to find the right path.");
|
|
@@ -15918,7 +16123,7 @@ __export(history_exports2, {
|
|
|
15918
16123
|
runChanges: () => runChanges,
|
|
15919
16124
|
runHistory: () => runHistory
|
|
15920
16125
|
});
|
|
15921
|
-
async function
|
|
16126
|
+
async function requireSession4() {
|
|
15922
16127
|
const creds = await readCredentials();
|
|
15923
16128
|
if (!creds) {
|
|
15924
16129
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -15949,7 +16154,7 @@ function printHistory(data) {
|
|
|
15949
16154
|
console.log(` ${data.count} action${data.count === 1 ? "" : "s"}.`);
|
|
15950
16155
|
}
|
|
15951
16156
|
async function runHistory(options) {
|
|
15952
|
-
const session = await
|
|
16157
|
+
const session = await requireSession4();
|
|
15953
16158
|
let data;
|
|
15954
16159
|
try {
|
|
15955
16160
|
data = await getHistory(session, { limit: parseLimit(options.limit) });
|
|
@@ -15975,7 +16180,7 @@ function printChanges(data) {
|
|
|
15975
16180
|
console.log(` ${data.count} change${data.count === 1 ? "" : "s"}.`);
|
|
15976
16181
|
}
|
|
15977
16182
|
async function runChanges(options) {
|
|
15978
|
-
const session = await
|
|
16183
|
+
const session = await requireSession4();
|
|
15979
16184
|
let data;
|
|
15980
16185
|
try {
|
|
15981
16186
|
data = await getChanges(session, {
|
|
@@ -16007,7 +16212,7 @@ var context_exports = {};
|
|
|
16007
16212
|
__export(context_exports, {
|
|
16008
16213
|
runContextHealth: () => runContextHealth
|
|
16009
16214
|
});
|
|
16010
|
-
async function
|
|
16215
|
+
async function requireSession5() {
|
|
16011
16216
|
const creds = await readCredentials();
|
|
16012
16217
|
if (!creds) {
|
|
16013
16218
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -16042,7 +16247,7 @@ function printHealth(data) {
|
|
|
16042
16247
|
console.log("");
|
|
16043
16248
|
}
|
|
16044
16249
|
async function runContextHealth(options) {
|
|
16045
|
-
const session = await
|
|
16250
|
+
const session = await requireSession5();
|
|
16046
16251
|
let data;
|
|
16047
16252
|
try {
|
|
16048
16253
|
data = await getContextHealth(session, {
|
|
@@ -16072,7 +16277,7 @@ var onboarding_exports = {};
|
|
|
16072
16277
|
__export(onboarding_exports, {
|
|
16073
16278
|
runOnboardingStatus: () => runOnboardingStatus
|
|
16074
16279
|
});
|
|
16075
|
-
async function
|
|
16280
|
+
async function requireSession6() {
|
|
16076
16281
|
const creds = await readCredentials();
|
|
16077
16282
|
if (!creds) {
|
|
16078
16283
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -16091,7 +16296,7 @@ function printStatus(data) {
|
|
|
16091
16296
|
console.log("");
|
|
16092
16297
|
}
|
|
16093
16298
|
async function runOnboardingStatus(options) {
|
|
16094
|
-
const session = await
|
|
16299
|
+
const session = await requireSession6();
|
|
16095
16300
|
let data;
|
|
16096
16301
|
try {
|
|
16097
16302
|
data = await getOnboardingStatus(session, { brandId: options.brand });
|
|
@@ -16274,6 +16479,17 @@ async function buildCommandSchema(program3, cliVersion, commandName) {
|
|
|
16274
16479
|
const manifest = await buildManifest(program3, cliVersion);
|
|
16275
16480
|
return manifest.commands.find((c) => c.name === commandName) ?? null;
|
|
16276
16481
|
}
|
|
16482
|
+
function resolveIntrospection(rawArgs, operands) {
|
|
16483
|
+
if (operands.length > 0) return null;
|
|
16484
|
+
if (rawArgs.includes("--describe")) return { mode: "describe" };
|
|
16485
|
+
const schemaIdx = rawArgs.indexOf("--schema");
|
|
16486
|
+
if (schemaIdx !== -1) {
|
|
16487
|
+
const command = rawArgs[schemaIdx + 1];
|
|
16488
|
+
if (!command || command.startsWith("--")) return { mode: "schema-missing" };
|
|
16489
|
+
return { mode: "schema", command };
|
|
16490
|
+
}
|
|
16491
|
+
return null;
|
|
16492
|
+
}
|
|
16277
16493
|
|
|
16278
16494
|
// src/index.ts
|
|
16279
16495
|
var program2 = new Command();
|
|
@@ -16305,9 +16521,9 @@ program2.command("doctor").description("Verify your local setup is ready + heal
|
|
|
16305
16521
|
const { runDoctor: runDoctor2 } = await Promise.resolve().then(() => (init_doctor(), doctor_exports));
|
|
16306
16522
|
await runDoctor2({ quiet: options.quiet, autoHeal: options.autoHeal });
|
|
16307
16523
|
});
|
|
16308
|
-
program2.command("save
|
|
16309
|
-
const { runSave: runSave2 } = await Promise.resolve().then(() => (
|
|
16310
|
-
await runSave2(
|
|
16524
|
+
program2.command("save [intent]").description("Save your workspace changes (routed write \u2014 auto-merges or queues)").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (intent) => {
|
|
16525
|
+
const { runSave: runSave2 } = await Promise.resolve().then(() => (init_save2(), save_exports));
|
|
16526
|
+
await runSave2(intent);
|
|
16311
16527
|
});
|
|
16312
16528
|
program2.command("sync").description("Pull your workspace clone up to remote (cwd-agnostic)").action(async () => {
|
|
16313
16529
|
const { runSync: runSync2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
@@ -16373,29 +16589,29 @@ onboarding.command("status").description("Composite onboarding gate (activation
|
|
|
16373
16589
|
await runOnboardingStatus2(options);
|
|
16374
16590
|
});
|
|
16375
16591
|
(async () => {
|
|
16376
|
-
const { operands, unknown: unknownArgs } = program2.parseOptions(
|
|
16377
|
-
process.argv.slice(2)
|
|
16378
|
-
);
|
|
16379
16592
|
const rawArgs = process.argv.slice(2);
|
|
16380
|
-
const
|
|
16381
|
-
const
|
|
16382
|
-
if (
|
|
16593
|
+
const { operands } = program2.parseOptions(rawArgs);
|
|
16594
|
+
const introspection = resolveIntrospection(rawArgs, operands);
|
|
16595
|
+
if (introspection?.mode === "describe") {
|
|
16383
16596
|
const manifest = await buildManifest(program2, VERSION);
|
|
16384
16597
|
process.stdout.write(JSON.stringify(manifest, null, 2) + "\n");
|
|
16385
16598
|
process.exit(0);
|
|
16386
16599
|
}
|
|
16387
|
-
if (
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16395
|
-
|
|
16600
|
+
if (introspection?.mode === "schema-missing") {
|
|
16601
|
+
process.stderr.write(
|
|
16602
|
+
"bamboo-agents: --schema requires a command name, e.g. --schema history\n"
|
|
16603
|
+
);
|
|
16604
|
+
process.exit(1);
|
|
16605
|
+
}
|
|
16606
|
+
if (introspection?.mode === "schema") {
|
|
16607
|
+
const entry = await buildCommandSchema(
|
|
16608
|
+
program2,
|
|
16609
|
+
VERSION,
|
|
16610
|
+
introspection.command
|
|
16611
|
+
);
|
|
16396
16612
|
if (entry === null) {
|
|
16397
16613
|
process.stderr.write(
|
|
16398
|
-
`bamboo-agents: unknown command '${
|
|
16614
|
+
`bamboo-agents: unknown command '${introspection.command}'. Run --describe for the full list.
|
|
16399
16615
|
`
|
|
16400
16616
|
);
|
|
16401
16617
|
process.exit(1);
|