@a5c-ai/babysitter-sdk 0.0.18 → 0.0.28

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.
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAonDA,wBAAgB,mBAAmB;eAEf,MAAM,EAAE,GAA2B,OAAO,CAAC,MAAM,CAAC;kBA4CpD,MAAM;EAIvB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AA+rDA,wBAAgB,mBAAmB;eAEf,MAAM,EAAE,GAA2B,OAAO,CAAC,MAAM,CAAC;kBA4CpD,MAAM;EAIvB"}
package/dist/cli/main.js CHANGED
@@ -35,7 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.createBabysitterCli = createBabysitterCli;
38
+ const node_child_process_1 = require("node:child_process");
38
39
  const node_fs_1 = require("node:fs");
40
+ const node_module_1 = require("node:module");
39
41
  const path = __importStar(require("node:path"));
40
42
  const os = __importStar(require("node:os"));
41
43
  const nodeTaskRunner_1 = require("./nodeTaskRunner");
@@ -56,10 +58,10 @@ const USAGE = `Usage:
56
58
  babysitter run:continue <runDir> [--runs-dir <dir>] [--json] [--dry-run] [--auto-node-tasks] [--auto-node-max <n>] [--auto-node-label <text>]
57
59
  babysitter task:list <runDir> [--runs-dir <dir>] [--pending] [--kind <kind>] [--json]
58
60
  babysitter task:show <runDir> <effectId> [--runs-dir <dir>] [--json]
59
- babysitter skill:install [--type <claude|codex|cursor>] [--scope <local|global>] [--skills-dir <dir>] [--force] [--json] [--dry-run]
61
+ babysitter skill:install [--type <claude|codex|cursor>] [--scope <local|global>] [--force] [--json] [--dry-run]
60
62
 
61
63
  Global flags:
62
- --runs-dir <dir> Override the runs directory (defaults to current working directory).
64
+ --runs-dir <dir> Override the runs directory (defaults to .a5c/runs).
63
65
  --json Emit JSON output when supported by the command.
64
66
  --dry-run Describe planned mutations without changing on-disk state.
65
67
  --verbose Log resolved paths and options to stderr for debugging.
@@ -67,11 +69,12 @@ Global flags:
67
69
  const LARGE_RESULT_PREVIEW_LIMIT = 1024 * 1024; // 1 MiB
68
70
  const DEFAULT_SKILL_TARGET = "codex";
69
71
  const DEFAULT_SKILL_SCOPE = "local";
72
+ const breakpointsRequire = (0, node_module_1.createRequire)(__filename);
70
73
  function parseArgs(argv) {
71
74
  const [initialCommand, ...rest] = argv;
72
75
  const parsed = {
73
76
  command: initialCommand,
74
- runsDir: ".",
77
+ runsDir: ".a5c/runs",
75
78
  skillsDir: undefined,
76
79
  skillType: DEFAULT_SKILL_TARGET,
77
80
  skillScope: DEFAULT_SKILL_SCOPE,
@@ -380,6 +383,62 @@ async function pathExists(filePath) {
380
383
  function toPosixPath(value) {
381
384
  return value.replace(/\\/g, "/");
382
385
  }
386
+ function resolveBreakpointsBin() {
387
+ const pkgPath = breakpointsRequire.resolve("@a5c-ai/babysitter-breakpoints/package.json");
388
+ const pkgDir = path.dirname(pkgPath);
389
+ const pkgJson = breakpointsRequire(pkgPath);
390
+ let binRelative;
391
+ if (typeof pkgJson.bin === "string") {
392
+ binRelative = pkgJson.bin;
393
+ }
394
+ else if (pkgJson.bin && typeof pkgJson.bin === "object") {
395
+ binRelative = pkgJson.bin.breakpoints ?? pkgJson.bin["babysitter-breakpoints"] ?? Object.values(pkgJson.bin)[0];
396
+ }
397
+ if (!binRelative) {
398
+ throw new Error("missing bin entry in @a5c-ai/babysitter-breakpoints package.json");
399
+ }
400
+ return path.resolve(pkgDir, binRelative);
401
+ }
402
+ async function installBreakpointsSkill(parsed, skillsDir) {
403
+ if (parsed.dryRun) {
404
+ return { status: "planned", message: "dry-run: skipped breakpoints install" };
405
+ }
406
+ let binPath;
407
+ try {
408
+ binPath = resolveBreakpointsBin();
409
+ }
410
+ catch (error) {
411
+ const message = error instanceof Error ? error.message : String(error);
412
+ return { status: "error", message };
413
+ }
414
+ const args = [binPath, "install-skill", "--target", parsed.skillType, "--scope", parsed.skillScope];
415
+ if (parsed.skillsDir) {
416
+ args.push("--skills-dir", skillsDir);
417
+ }
418
+ if (parsed.json) {
419
+ args.push("--json");
420
+ }
421
+ const child = (0, node_child_process_1.spawn)(process.execPath, args, {
422
+ stdio: parsed.json ? ["ignore", "pipe", "pipe"] : "inherit",
423
+ });
424
+ const stdoutChunks = [];
425
+ const stderrChunks = [];
426
+ if (parsed.json) {
427
+ child.stdout?.on("data", (chunk) => stdoutChunks.push(Buffer.from(chunk)));
428
+ child.stderr?.on("data", (chunk) => stderrChunks.push(Buffer.from(chunk)));
429
+ }
430
+ const exitCode = await new Promise((resolve) => {
431
+ child.on("close", (code) => resolve(code ?? 1));
432
+ child.on("error", () => resolve(1));
433
+ });
434
+ const stdout = parsed.json ? Buffer.concat(stdoutChunks).toString().trim() : undefined;
435
+ const stderr = parsed.json ? Buffer.concat(stderrChunks).toString().trim() : undefined;
436
+ if (exitCode === 0) {
437
+ return { status: "installed", exitCode, stdout: stdout || undefined, stderr: stderr || undefined };
438
+ }
439
+ const message = stderr || stdout || `breakpoints install-skill exited with code ${exitCode}`;
440
+ return { status: "error", exitCode, message, stdout: stdout || undefined, stderr: stderr || undefined };
441
+ }
383
442
  async function installBundledSkillDir(skillName, options) {
384
443
  const sourceDir = path.join(resolveBundledSkillsRoot(), skillName);
385
444
  const destinationDir = path.join(options.skillsDir, skillName);
@@ -1210,9 +1269,11 @@ async function handleSkillInstall(parsed) {
1210
1269
  else
1211
1270
  counts.error += 1;
1212
1271
  }
1272
+ const breakpointsSummary = await installBreakpointsSkill(parsed, skillsDir);
1273
+ const breakpointsFailed = breakpointsSummary.status === "error";
1213
1274
  if (parsed.json) {
1214
- console.log(JSON.stringify({ skillsDir, type: parsed.skillType, scope: parsed.skillScope, results }));
1215
- return counts.error > 0 ? 1 : 0;
1275
+ console.log(JSON.stringify({ skillsDir, type: parsed.skillType, scope: parsed.skillScope, results, breakpoints: breakpointsSummary }));
1276
+ return counts.error > 0 || breakpointsFailed ? 1 : 0;
1216
1277
  }
1217
1278
  const parts = [`[skill:install] dir=${skillsDir}`];
1218
1279
  if (!parsed.skillsDir) {
@@ -1223,6 +1284,7 @@ async function handleSkillInstall(parsed) {
1223
1284
  parts.push("dryRun=true");
1224
1285
  if (parsed.force)
1225
1286
  parts.push("force=true");
1287
+ parts.push(`breakpoints=${breakpointsSummary.status}`);
1226
1288
  if (counts.installed)
1227
1289
  parts.push(`installed=${counts.installed}`);
1228
1290
  if (counts.skipped)
@@ -1232,6 +1294,9 @@ async function handleSkillInstall(parsed) {
1232
1294
  if (counts.error)
1233
1295
  parts.push(`errors=${counts.error}`);
1234
1296
  console.log(parts.join(" "));
1297
+ if (breakpointsSummary.status === "error") {
1298
+ console.error(`[skill:install] breakpoints install failed: ${breakpointsSummary.message ?? "unknown error"}`);
1299
+ }
1235
1300
  for (const result of results) {
1236
1301
  const relativeDest = toPosixPath(path.relative(skillsDir, result.destinationDir));
1237
1302
  const relativeSource = toPosixPath(path.relative(skillsDir, result.sourceDir));
@@ -1240,7 +1305,7 @@ async function handleSkillInstall(parsed) {
1240
1305
  const messageSuffix = result.message ? ` message=${result.message}` : "";
1241
1306
  console.log(`- ${result.name} status=${result.status} dest=${destLabel} src=${sourceLabel}${messageSuffix}`);
1242
1307
  }
1243
- return counts.error > 0 ? 1 : 0;
1308
+ return counts.error > 0 || breakpointsFailed ? 1 : 0;
1244
1309
  }
1245
1310
  function toTaskListEntry(record, runDir) {
1246
1311
  return {
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@a5c-ai/babysitter-sdk",
3
- "version": "0.0.18",
3
+ "version": "0.0.28",
4
4
  "description": "Storage and run-registry primitives for event-sourced babysitter workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "bin": {
10
- "babysitter": "dist/cli/main.js"
10
+ "babysitter": "dist/cli/main.js",
11
+ "babysitter-sdk": "dist/cli/main.js"
11
12
  },
12
13
  "files": [
13
14
  "dist",
@@ -22,10 +23,13 @@
22
23
  "smoke:cli": "node scripts/smoke-cli.js --runs-dir packages/sdk/test-fixtures/cli/runs/smoke"
23
24
  },
24
25
  "dependencies": {
26
+ "@a5c-ai/babysitter-breakpoints": "^0.1.3",
25
27
  "fs-extra": "^11.2.0",
26
28
  "ulid": "^2.3.0"
27
29
  },
28
30
  "devDependencies": {
31
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
32
+ "@typescript-eslint/parser": "^7.18.0",
29
33
  "@types/fs-extra": "^11.0.4",
30
34
  "@types/node": "^20.11.30",
31
35
  "eslint": "^8.57.0",