@orkestrel/scaffold 0.0.11 → 0.0.12

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.
@@ -614,8 +614,9 @@ function orkestrelTokenIssue(normalized, catalog) {
614
614
  /** Parse a strict command-line argument vector. */
615
615
  function parseArguments(argv) {
616
616
  if (argv.some((argument) => !isTerminalText(argument))) throw new ScaffoldError("INVALID", "Command arguments must not contain control characters");
617
+ const args = argv[0] === "--" ? argv.slice(1) : [...argv];
617
618
  return parseArgs({
618
- args: argv[0] === "--" ? argv.slice(1) : [...argv],
619
+ args,
619
620
  allowPositionals: true,
620
621
  options: {
621
622
  src: { type: "string" },
@@ -975,9 +976,11 @@ var CLI = class {
975
976
  */
976
977
  #names(host) {
977
978
  const names = attempt(() => {
978
- const full = locateHostSource(readHostManifest(host), ".claude/agents/orkestrel.md", host);
979
+ const manifest = readHostManifest(host);
980
+ const full = locateHostSource(manifest, ".claude/agents/orkestrel.md", host);
979
981
  if (full === void 0 || !existsSync(full)) return void 0;
980
- return catalogNames(readFileText(host, relative(host, full).replaceAll("\\", "/"), "TARGET", "host"));
982
+ const relative$1 = relative(host, full).replaceAll("\\", "/");
983
+ return catalogNames(readFileText(host, relative$1, "TARGET", "host"));
981
984
  });
982
985
  return names.success ? names.value : void 0;
983
986
  }
@@ -1330,7 +1333,10 @@ var CLI = class {
1330
1333
  try {
1331
1334
  const spec = deriveBlueprint(directory);
1332
1335
  const scaffolding = compiler.compile(spec);
1333
- if (!scaffolding.plan) throw new ScaffoldError("INVALID", scaffolding.questions.map((question) => question.text).join("; "));
1336
+ if (!scaffolding.plan) {
1337
+ const message = scaffolding.questions.map((question) => question.text).join("; ");
1338
+ throw new ScaffoldError("INVALID", message);
1339
+ }
1334
1340
  scoped = {
1335
1341
  ...scaffolding.plan,
1336
1342
  blueprint: {
@@ -1344,8 +1350,9 @@ var CLI = class {
1344
1350
  compiler.destroy();
1345
1351
  }
1346
1352
  const plan = hydratePlan(scoped, host);
1353
+ const paths = plan.artifacts.map((artifact) => artifact.path);
1347
1354
  const rawAudit = {
1348
- ...diffPlan(plan, readTarget(directory, plan.artifacts.map((artifact) => artifact.path))),
1355
+ ...diffPlan(plan, readTarget(directory, paths)),
1349
1356
  questions
1350
1357
  };
1351
1358
  const audit = this.#scan(rawAudit, directory, host, plan.blueprint.service);
@@ -1501,7 +1508,8 @@ var CLI = class {
1501
1508
  const endParts = current.split(CATALOG_END_MARKER);
1502
1509
  if (startIndex === -1 || endIndex === -1 || endIndex < startIndex || startParts.length !== 2 || endParts.length !== 2) this.#error(new ScaffoldError("TARGET", `Expected exactly one ordered "${CATALOG_START_MARKER}" / "${CATALOG_END_MARKER}" pair in ${agentPath}`, { path: agentPath }), json);
1503
1510
  const updated = `${current.slice(0, startIndex + CATALOG_START_MARKER.length)}\n\n${block}\n${current.slice(endIndex)}`;
1504
- const oldRows = catalogNames(current.slice(startIndex + CATALOG_START_MARKER.length, endIndex)).length;
1511
+ const oldBlock = current.slice(startIndex + CATALOG_START_MARKER.length, endIndex);
1512
+ const oldRows = catalogNames(oldBlock).length;
1505
1513
  const shrink = entries.length < oldRows ? oldRows - entries.length : void 0;
1506
1514
  if (updated === current) {
1507
1515
  if (json) this.#write(catalogResultOf(entries, false));
@@ -1539,7 +1547,8 @@ var CLI = class {
1539
1547
  }]);
1540
1548
  const staged = attempt(() => {
1541
1549
  validateWriteDirectories(transaction);
1542
- mkdirSync(dirname(resolvePhysicalPath(transaction.stage, CATALOG_AGENT_PATH, "WRITE", "staging")), { recursive: true });
1550
+ const destination = resolvePhysicalPath(transaction.stage, CATALOG_AGENT_PATH, "WRITE", "staging");
1551
+ mkdirSync(dirname(destination), { recursive: true });
1543
1552
  validateWriteDirectories(transaction);
1544
1553
  const contained = resolvePhysicalPath(transaction.stage, CATALOG_AGENT_PATH, "WRITE", "staging");
1545
1554
  writeFileSync(contained, updated, {