@cleocode/caamp 2026.9.17 → 2026.9.19

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/cli.js CHANGED
@@ -47,11 +47,12 @@ import {
47
47
  setHuman,
48
48
  setQuiet,
49
49
  setVerbose,
50
+ syncGlobalInstructions,
50
51
  toSarif,
51
52
  tokenizeCriteriaValue,
52
53
  updateInstructionsSingleOperation,
53
54
  validateSkill
54
- } from "./chunk-52ZWZXEN.js";
55
+ } from "./chunk-IBHW6GEI.js";
55
56
  import {
56
57
  buildSkillsMap,
57
58
  checkAllInjections,
@@ -64,7 +65,7 @@ import {
64
65
  groupByInstructFile,
65
66
  injectAll,
66
67
  providerSupports
67
- } from "./chunk-G3CEXEW2.js";
68
+ } from "./chunk-CHPNPLOK.js";
68
69
  import {
69
70
  CANONICAL_HOOK_EVENTS,
70
71
  buildHookMatrix,
@@ -1258,6 +1259,8 @@ function registerInstructionsCheck(parent) {
1258
1259
  providers = getAllProviders();
1259
1260
  } else if (opts.agent.length > 0) {
1260
1261
  providers = opts.agent.map((a) => getProvider(a)).filter((p) => p !== void 0);
1262
+ } else if (opts.global) {
1263
+ providers = getInstalledProviders();
1261
1264
  } else {
1262
1265
  providers = resolveDefaultTargetProviders();
1263
1266
  }
@@ -1416,12 +1419,24 @@ function registerInstructionsInject(parent) {
1416
1419
  }
1417
1420
  }
1418
1421
  }
1419
- if (genericProviders.length > 0) {
1420
- const genericResults = await injectAll(genericProviders, process.cwd(), scope, content);
1421
- for (const [file, action] of genericResults) {
1422
- results.set(file, action);
1422
+ const failed = [];
1423
+ for (const provider of genericProviders) {
1424
+ try {
1425
+ for (const [file, action] of await injectAll(
1426
+ [provider],
1427
+ process.cwd(),
1428
+ scope,
1429
+ content
1430
+ )) {
1431
+ results.set(file, action);
1432
+ }
1433
+ } catch (err) {
1434
+ const error = err instanceof Error ? err.message : String(err);
1435
+ failed.push({ provider: provider.id, error });
1436
+ if (format === "human") console.log(pc4.red(` x ${provider.id}: ${error}`));
1423
1437
  }
1424
1438
  }
1439
+ if (failed.length > 0) process.exitCode = 1;
1425
1440
  const injected = [];
1426
1441
  for (const [file] of results) {
1427
1442
  injected.push(file);
@@ -1430,7 +1445,8 @@ function registerInstructionsInject(parent) {
1430
1445
  outputSuccess(operation, mvi, {
1431
1446
  injected,
1432
1447
  providers: providers.map((p) => p.id),
1433
- count: results.size
1448
+ count: results.size,
1449
+ ...failed.length > 0 ? { failed } : {}
1434
1450
  });
1435
1451
  } else {
1436
1452
  for (const [file, action] of results) {
@@ -1446,6 +1462,44 @@ ${results.size} file(s) processed.`));
1446
1462
 
1447
1463
  // src/commands/instructions/update.ts
1448
1464
  import pc5 from "picocolors";
1465
+ async function updateGlobal(format) {
1466
+ const operation = "instructions.update";
1467
+ const mvi = "standard";
1468
+ const result = await syncGlobalInstructions();
1469
+ const updated = result.files.filter((file) => file.action !== "intact" && file.action !== "failed").map((file) => file.path);
1470
+ const failed = [
1471
+ ...result.files.filter((file) => file.action === "failed").map((file) => ({ provider: file.providers.join(","), error: file.error ?? "unknown" })),
1472
+ ...result.findings.map((finding) => ({
1473
+ provider: "hub",
1474
+ error: `${finding.kind}: ${finding.path} (${finding.reason})`
1475
+ }))
1476
+ ];
1477
+ if (failed.length > 0) process.exitCode = 1;
1478
+ if (format === "json") {
1479
+ outputSuccess(operation, mvi, {
1480
+ status: result.status,
1481
+ updated,
1482
+ failed,
1483
+ files: result.files,
1484
+ skippedProviders: result.skippedProviders,
1485
+ count: { updated: updated.length, failed: failed.length }
1486
+ });
1487
+ return;
1488
+ }
1489
+ if (result.status === "no-providers") {
1490
+ console.log(pc5.yellow("No provider installations detected."));
1491
+ return;
1492
+ }
1493
+ for (const file of result.files) {
1494
+ const icon = file.action === "failed" ? pc5.red("x") : pc5.green("\u2713");
1495
+ console.log(` ${icon} ${file.path} (${file.action}${file.error ? `: ${file.error}` : ""})`);
1496
+ }
1497
+ for (const finding of result.findings) {
1498
+ console.log(` ${pc5.red("x")} ${finding.kind}: ${finding.path} \u2014 ${finding.reason}`);
1499
+ }
1500
+ console.log(pc5.bold(`
1501
+ ${updated.length} file(s) updated.`));
1502
+ }
1449
1503
  function registerInstructionsUpdate(parent) {
1450
1504
  parent.command("update").description("Update all instruction file injections").option("-g, --global", "Update global instruction files").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON (default)").option("--human", "Output in human-readable format").action(async (opts) => {
1451
1505
  const operation = "instructions.update";
@@ -1468,8 +1522,12 @@ function registerInstructionsUpdate(parent) {
1468
1522
  );
1469
1523
  process.exit(1);
1470
1524
  }
1525
+ if (opts.global) {
1526
+ await updateGlobal(format);
1527
+ return;
1528
+ }
1471
1529
  const providers = resolveDefaultTargetProviders();
1472
- const scope = opts.global ? "global" : "project";
1530
+ const scope = "project";
1473
1531
  const content = generateInjectionContent();
1474
1532
  const harnessProviders = [];
1475
1533
  const genericProviders = [];
@@ -1503,9 +1561,21 @@ function registerInstructionsUpdate(parent) {
1503
1561
  }
1504
1562
  const providerIds = new Set(needsUpdate.map((c) => c.provider));
1505
1563
  const toUpdate = genericProviders.filter((p) => providerIds.has(p.id));
1506
- const results = await injectAll(toUpdate, process.cwd(), scope, content);
1507
- const harnessScope = scope === "global" ? { kind: "global" } : { kind: "project", projectDir: process.cwd() };
1508
- const harnessFailures = [];
1564
+ const failures = [];
1565
+ const results = /* @__PURE__ */ new Map();
1566
+ for (const provider of toUpdate) {
1567
+ try {
1568
+ for (const [file, action] of await injectAll([provider], process.cwd(), scope, content)) {
1569
+ results.set(file, action);
1570
+ }
1571
+ } catch (err) {
1572
+ failures.push({
1573
+ provider: provider.id,
1574
+ error: err instanceof Error ? err.message : String(err)
1575
+ });
1576
+ }
1577
+ }
1578
+ const harnessScope = { kind: "project", projectDir: process.cwd() };
1509
1579
  for (const provider of harnessProviders) {
1510
1580
  const harness = getHarnessFor(provider);
1511
1581
  if (harness === null) continue;
@@ -1513,22 +1583,19 @@ function registerInstructionsUpdate(parent) {
1513
1583
  await harness.injectInstructions(content, harnessScope);
1514
1584
  results.set(`${provider.id}:AGENTS.md`, "updated");
1515
1585
  } catch (err) {
1516
- harnessFailures.push({
1586
+ failures.push({
1517
1587
  provider: provider.id,
1518
1588
  error: err instanceof Error ? err.message : String(err)
1519
1589
  });
1520
1590
  }
1521
1591
  }
1522
- const updated = [];
1523
- for (const [file] of results) {
1524
- updated.push(file);
1525
- }
1592
+ const updated = [...results.keys()];
1526
1593
  if (format === "human") {
1527
1594
  console.log();
1528
1595
  for (const [file, action] of results) {
1529
1596
  console.log(` ${pc5.green("\u2713")} ${file} (${action})`);
1530
1597
  }
1531
- for (const failure of harnessFailures) {
1598
+ for (const failure of failures) {
1532
1599
  console.log(` ${pc5.red("x")} ${failure.provider}: ${failure.error}`);
1533
1600
  }
1534
1601
  console.log(pc5.bold(`
@@ -1537,8 +1604,8 @@ ${results.size} file(s) updated.`));
1537
1604
  if (format === "json") {
1538
1605
  outputSuccess(operation, mvi, {
1539
1606
  updated,
1540
- failed: harnessFailures,
1541
- count: { updated: updated.length, failed: harnessFailures.length }
1607
+ failed: failures,
1608
+ count: { updated: updated.length, failed: failures.length }
1542
1609
  });
1543
1610
  }
1544
1611
  });