@canonical/pragma-cli 0.36.0 → 0.37.0

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.
Files changed (107) hide show
  1. package/dist/package.json +22 -19
  2. package/dist/pragma.conf.js +35 -5
  3. package/dist/pragma.conf.js.map +1 -1
  4. package/dist/src/capabilities/capabilities/hints.js +1 -1
  5. package/dist/src/capabilities/capabilities/hints.js.map +1 -1
  6. package/dist/src/capabilities/create/create.verb.js +2 -1
  7. package/dist/src/capabilities/create/create.verb.js.map +1 -1
  8. package/dist/src/capabilities/create/createSurface.generated.js +23 -1
  9. package/dist/src/capabilities/create/createSurface.generated.js.map +1 -1
  10. package/dist/src/capabilities/doctor/checks/checkNodeVersion.js +11 -6
  11. package/dist/src/capabilities/doctor/checks/checkNodeVersion.js.map +1 -1
  12. package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js +38 -0
  13. package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js.map +1 -0
  14. package/dist/src/capabilities/setup/operations/setupCompletions.js +6 -2
  15. package/dist/src/capabilities/setup/operations/setupCompletions.js.map +1 -1
  16. package/dist/src/capabilities/setup/operations/setupConfig.js +4 -2
  17. package/dist/src/capabilities/setup/operations/setupConfig.js.map +1 -1
  18. package/dist/src/capabilities/setup/operations/setupGenerator.js +64 -13
  19. package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -1
  20. package/dist/src/capabilities/setup/operations/setupLsp.js +59 -13
  21. package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -1
  22. package/dist/src/capabilities/setup/operations/setupMcp.js +4 -1
  23. package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -1
  24. package/dist/src/capabilities/setup/operations/setupSkills.js +4 -2
  25. package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -1
  26. package/dist/src/capabilities/setup/setup.verb.js +79 -30
  27. package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
  28. package/dist/src/capabilities/setup/targets.js +12 -6
  29. package/dist/src/capabilities/setup/targets.js.map +1 -1
  30. package/dist/src/capabilities/shared/index.js +1 -1
  31. package/dist/src/capabilities/shared/index.js.map +1 -1
  32. package/dist/src/constants.js +7 -1
  33. package/dist/src/constants.js.map +1 -1
  34. package/dist/src/kernel/packs/sparql/buildLookupQuery.js +11 -7
  35. package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
  36. package/dist/src/kernel/project/cli/dispatch.js +23 -1
  37. package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
  38. package/dist/src/kernel/project/cli/rootHelp.js +8 -5
  39. package/dist/src/kernel/project/cli/rootHelp.js.map +1 -1
  40. package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js +2 -3
  41. package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js.map +1 -1
  42. package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js +1 -1
  43. package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js.map +1 -1
  44. package/dist/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.js +4 -0
  45. package/dist/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.js.map +1 -0
  46. package/dist/src/kernel/runtime/graphpack/embedded.js +13 -6
  47. package/dist/src/kernel/runtime/graphpack/embedded.js.map +1 -1
  48. package/dist/src/kernel/runtime/graphpack/read.js +14 -9
  49. package/dist/src/kernel/runtime/graphpack/read.js.map +1 -1
  50. package/dist/src/kernel/runtime/loadSession.js +3 -1
  51. package/dist/src/kernel/runtime/loadSession.js.map +1 -1
  52. package/dist/src/kernel/runtime/probe.js +1 -1
  53. package/dist/src/kernel/runtime/probe.js.map +1 -1
  54. package/dist/src/kernel/runtime/refs/parseRef.js +17 -1
  55. package/dist/src/kernel/runtime/refs/parseRef.js.map +1 -1
  56. package/dist/src/kernel/runtime/refs/resolve.js +9 -3
  57. package/dist/src/kernel/runtime/refs/resolve.js.map +1 -1
  58. package/package.json +22 -19
  59. package/pragma.conf.ts +36 -5
  60. package/src/capabilities/capabilities/hints.ts +1 -1
  61. package/src/capabilities/config/collectConfigShow.test.ts +1 -0
  62. package/src/capabilities/create/byteEquality.test.ts +28 -1
  63. package/src/capabilities/create/create.test.ts +1 -0
  64. package/src/capabilities/create/create.verb.ts +2 -1
  65. package/src/capabilities/create/createGrammar.test.ts +4 -1
  66. package/src/capabilities/create/createSurface.generated.ts +23 -1
  67. package/src/capabilities/create/crossCli.subprocess.test.ts +10 -3
  68. package/src/capabilities/doctor/checks/checkNodeVersion.test.ts +49 -0
  69. package/src/capabilities/doctor/checks/checkNodeVersion.ts +11 -7
  70. package/src/capabilities/doctor/checks/isSupportedNodeVersion.test.ts +111 -0
  71. package/src/capabilities/doctor/checks/isSupportedNodeVersion.ts +34 -0
  72. package/src/capabilities/doctor/checks/mcpCommand.test.ts +7 -1
  73. package/src/capabilities/lazy.test.ts +26 -2
  74. package/src/capabilities/listLookup.shipped.exec.test.ts +340 -0
  75. package/src/capabilities/resources/resources.test.ts +38 -2
  76. package/src/capabilities/setup/operations/setupCompletions.ts +9 -2
  77. package/src/capabilities/setup/operations/setupConfig.ts +7 -2
  78. package/src/capabilities/setup/operations/setupGenerator.ts +83 -14
  79. package/src/capabilities/setup/operations/setupLsp.ts +95 -22
  80. package/src/capabilities/setup/operations/setupMcp.ts +7 -1
  81. package/src/capabilities/setup/operations/setupSkills.ts +7 -2
  82. package/src/capabilities/setup/setup.test.ts +247 -2
  83. package/src/capabilities/setup/setup.verb.ts +83 -35
  84. package/src/capabilities/setup/targets.ts +18 -8
  85. package/src/capabilities/shared/index.ts +1 -0
  86. package/src/capabilities/surface.test.ts +12 -4
  87. package/src/constants.ts +8 -0
  88. package/src/kernel/config/defaults.test.ts +17 -2
  89. package/src/kernel/config/readConfig.test.ts +1 -1
  90. package/src/kernel/packs/sparql/buildLookupQuery.ts +11 -7
  91. package/src/kernel/project/cli/dispatch.ts +23 -1
  92. package/src/kernel/project/cli/rootHelp.ts +8 -5
  93. package/src/kernel/render/prefixes.test.ts +2 -0
  94. package/src/kernel/runtime/graphpack/embedded/pack.generated.ts +2 -3
  95. package/src/kernel/runtime/graphpack/embedded/pack.index.generated.ts +1 -1
  96. package/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.ts +3 -0
  97. package/src/kernel/runtime/graphpack/embedded.ts +14 -6
  98. package/src/kernel/runtime/graphpack/graphpack.test.ts +31 -5
  99. package/src/kernel/runtime/graphpack/read.ts +14 -12
  100. package/src/kernel/runtime/loadSession.ts +3 -1
  101. package/src/kernel/runtime/probe.ts +1 -1
  102. package/src/kernel/runtime/refs/parseRef.test.ts +49 -1
  103. package/src/kernel/runtime/refs/parseRef.ts +25 -1
  104. package/src/kernel/runtime/refs/resolve.ts +9 -3
  105. package/src/kernel/runtime/types.ts +17 -0
  106. package/src/testing/helpers/runCli.test.ts +44 -0
  107. package/src/testing/helpers/runCli.ts +27 -3
@@ -411,7 +411,29 @@ export async function executeVerb(
411
411
  }
412
412
  }
413
413
  if (mutation.undo) {
414
- const { undoCount } = await runUndo(task, { onLog: logSink(flags) });
414
+ // The truth seam. `runUndo`'s collection phase drove the verb's task
415
+ // with every effect mocked, so anything the task body reported was a
416
+ // narration of the mocked walk, not of the reversals — which have only
417
+ // JUST run, each isolated, each with its own outcome. Those outcomes
418
+ // are the one honest record of what the undo did: a verb that reports
419
+ // per-target results sets `undoReport` (like `exec`/`planData`) and
420
+ // projects them onto its own rows; a throw from it renders as the
421
+ // run's error, exactly like a failed real run. Verbs without a
422
+ // projector of their own still may not exit 0 over a failed reversal,
423
+ // so the outcomes are re-checked here as the backstop.
424
+ const { undoCount, outcomes } = await runUndo(task, {
425
+ onLog: logSink(flags),
426
+ });
427
+ await mutationRuntime.undoReport?.(outcomes);
428
+ const failed = outcomes.filter((o) => o.status === "failed");
429
+ if (failed.length > 0) {
430
+ throw new PragmaError({
431
+ code: "UNSUPPORTED",
432
+ message: `${failed.length} of ${outcomes.length} undo step(s) did not complete: ${failed
433
+ .map((o) => o.error.message)
434
+ .join("; ")}`,
435
+ });
436
+ }
415
437
  return renderUndo(flags, undoCount);
416
438
  }
417
439
  // Real execution: spread the verb's runner options into the node
@@ -83,6 +83,14 @@ function buildKernelGroups(programName: string): readonly HelpGroup[] {
83
83
  },
84
84
  { noun: "info", summary: "Show version, config, and update status" },
85
85
  { noun: "version", summary: "Print the CLI version" },
86
+ // A colophon is the note at the back of a book: the typeface, the
87
+ // press, the paper. Nothing depends on it, which is the point — so
88
+ // this line does not argue for it. Every other summary in this column
89
+ // promises work done; this one just invites you to look. It sits with
90
+ // the other commands that describe the distribution rather than act on
91
+ // it; "For AI agents" is for surfaces an agent drives, and credits are
92
+ // for a person reading.
93
+ { noun: "colophon", summary: "Read the credits" },
86
94
  {
87
95
  noun: "upgrade",
88
96
  summary: `Upgrade the ${programName} CLI to the latest version`,
@@ -96,11 +104,6 @@ function buildKernelGroups(programName: string): readonly HelpGroup[] {
96
104
  noun: "capabilities",
97
105
  summary: "Discover conventions, tools, and the discovery sequence",
98
106
  },
99
- // A colophon is the note at the back of a book: the typeface, the
100
- // press, the paper. Nothing depends on it, which is the point — so
101
- // this line does not argue for it. Every other summary in this column
102
- // promises work done; this one just invites you to look.
103
- { noun: "colophon", summary: "Read the credits" },
104
107
  { noun: "skill", summary: "Browse agent skills from the active packs" },
105
108
  { noun: "prompt", summary: "Browse reusable prompt templates" },
106
109
  // Curated for PLACEMENT, not for existence: `mcp serve` is an
@@ -13,6 +13,8 @@ describe("DEFAULT_PREFIX_MAP", () => {
13
13
  skos: "http://www.w3.org/2004/02/skos/core#",
14
14
  ds: "https://ds.canonical.com/",
15
15
  cs: "http://pragma.canonical.com/codestandards#",
16
+ dt: "https://dt.canonical.com/",
17
+ "w3c-tokens": "https://dt.canonical.com/w3c-tokens/",
16
18
  });
17
19
  });
18
20