@intentset/cli 0.1.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 (116) hide show
  1. package/dist/commands/architecture.d.ts +6 -0
  2. package/dist/commands/architecture.d.ts.map +1 -0
  3. package/dist/commands/architecture.js +65 -0
  4. package/dist/commands/architecture.js.map +1 -0
  5. package/dist/commands/context.d.ts +4 -0
  6. package/dist/commands/context.d.ts.map +1 -0
  7. package/dist/commands/context.js +124 -0
  8. package/dist/commands/context.js.map +1 -0
  9. package/dist/commands/evidence.d.ts +29 -0
  10. package/dist/commands/evidence.d.ts.map +1 -0
  11. package/dist/commands/evidence.js +157 -0
  12. package/dist/commands/evidence.js.map +1 -0
  13. package/dist/commands/graph.d.ts +18 -0
  14. package/dist/commands/graph.d.ts.map +1 -0
  15. package/dist/commands/graph.js +77 -0
  16. package/dist/commands/graph.js.map +1 -0
  17. package/dist/commands/impact.d.ts +20 -0
  18. package/dist/commands/impact.d.ts.map +1 -0
  19. package/dist/commands/impact.js +92 -0
  20. package/dist/commands/impact.js.map +1 -0
  21. package/dist/commands/init.d.ts +18 -0
  22. package/dist/commands/init.d.ts.map +1 -0
  23. package/dist/commands/init.js +122 -0
  24. package/dist/commands/init.js.map +1 -0
  25. package/dist/commands/mcp.d.ts +24 -0
  26. package/dist/commands/mcp.d.ts.map +1 -0
  27. package/dist/commands/mcp.js +122 -0
  28. package/dist/commands/mcp.js.map +1 -0
  29. package/dist/commands/publish.d.ts +19 -0
  30. package/dist/commands/publish.d.ts.map +1 -0
  31. package/dist/commands/publish.js +98 -0
  32. package/dist/commands/publish.js.map +1 -0
  33. package/dist/commands/review.d.ts +29 -0
  34. package/dist/commands/review.d.ts.map +1 -0
  35. package/dist/commands/review.js +147 -0
  36. package/dist/commands/review.js.map +1 -0
  37. package/dist/commands/serve.d.ts +14 -0
  38. package/dist/commands/serve.d.ts.map +1 -0
  39. package/dist/commands/serve.js +246 -0
  40. package/dist/commands/serve.js.map +1 -0
  41. package/dist/commands/shared.d.ts +19 -0
  42. package/dist/commands/shared.d.ts.map +1 -0
  43. package/dist/commands/shared.js +43 -0
  44. package/dist/commands/shared.js.map +1 -0
  45. package/dist/commands/validate.d.ts +11 -0
  46. package/dist/commands/validate.d.ts.map +1 -0
  47. package/dist/commands/validate.js +38 -0
  48. package/dist/commands/validate.js.map +1 -0
  49. package/dist/git.d.ts +25 -0
  50. package/dist/git.d.ts.map +1 -0
  51. package/dist/git.js +63 -0
  52. package/dist/git.js.map +1 -0
  53. package/dist/glob.d.ts +16 -0
  54. package/dist/glob.d.ts.map +1 -0
  55. package/dist/glob.js +60 -0
  56. package/dist/glob.js.map +1 -0
  57. package/dist/index.d.ts +9 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +8 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/intentset.d.ts +3 -0
  62. package/dist/intentset.d.ts.map +1 -0
  63. package/dist/intentset.js +15 -0
  64. package/dist/intentset.js.map +1 -0
  65. package/dist/main.d.ts +5 -0
  66. package/dist/main.d.ts.map +1 -0
  67. package/dist/main.js +406 -0
  68. package/dist/main.js.map +1 -0
  69. package/dist/output.d.ts +38 -0
  70. package/dist/output.d.ts.map +1 -0
  71. package/dist/output.js +53 -0
  72. package/dist/output.js.map +1 -0
  73. package/dist/outputs.d.ts +17 -0
  74. package/dist/outputs.d.ts.map +1 -0
  75. package/dist/outputs.js +70 -0
  76. package/dist/outputs.js.map +1 -0
  77. package/dist/reports.d.ts +16 -0
  78. package/dist/reports.d.ts.map +1 -0
  79. package/dist/reports.js +89 -0
  80. package/dist/reports.js.map +1 -0
  81. package/dist/repository.d.ts +56 -0
  82. package/dist/repository.d.ts.map +1 -0
  83. package/dist/repository.js +191 -0
  84. package/dist/repository.js.map +1 -0
  85. package/dist/session.d.ts +61 -0
  86. package/dist/session.d.ts.map +1 -0
  87. package/dist/session.js +202 -0
  88. package/dist/session.js.map +1 -0
  89. package/dist/tree.d.ts +15 -0
  90. package/dist/tree.d.ts.map +1 -0
  91. package/dist/tree.js +56 -0
  92. package/dist/tree.js.map +1 -0
  93. package/package.json +46 -0
  94. package/src/commands/architecture.ts +77 -0
  95. package/src/commands/context.ts +142 -0
  96. package/src/commands/evidence.ts +180 -0
  97. package/src/commands/graph.ts +89 -0
  98. package/src/commands/impact.ts +97 -0
  99. package/src/commands/init.ts +138 -0
  100. package/src/commands/mcp.ts +143 -0
  101. package/src/commands/publish.ts +119 -0
  102. package/src/commands/review.ts +155 -0
  103. package/src/commands/serve.ts +261 -0
  104. package/src/commands/shared.ts +46 -0
  105. package/src/commands/validate.ts +39 -0
  106. package/src/git.ts +81 -0
  107. package/src/glob.ts +58 -0
  108. package/src/index.ts +8 -0
  109. package/src/intentset.ts +15 -0
  110. package/src/main.ts +408 -0
  111. package/src/output.ts +78 -0
  112. package/src/outputs.ts +65 -0
  113. package/src/reports.ts +103 -0
  114. package/src/repository.ts +220 -0
  115. package/src/session.ts +276 -0
  116. package/src/tree.ts +64 -0
package/dist/git.js ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The git reads `review` needs: a base to compare with and the files changed
3
+ * since it. Every call is a read and passes --no-optional-locks, so not even
4
+ * git's own index refresh is written (invariant 7). Paths come back relative
5
+ * to the repository root the CLI is working in, which may be a subdirectory
6
+ * of the git work tree.
7
+ */
8
+ import { execFileSync } from "node:child_process";
9
+ import { compareStrings } from "@intentset/core";
10
+ function git(root, args) {
11
+ try {
12
+ return execFileSync("git", ["--no-optional-locks", ...args], {
13
+ cwd: root,
14
+ encoding: "utf8",
15
+ stdio: ["ignore", "pipe", "pipe"],
16
+ maxBuffer: 256 * 1024 * 1024,
17
+ });
18
+ }
19
+ catch {
20
+ return null;
21
+ }
22
+ }
23
+ function paths(out) {
24
+ return out === null ? [] : out.split("\0").filter((path) => path !== "");
25
+ }
26
+ /** The commit a ref names, or null. */
27
+ export function resolveCommit(root, ref) {
28
+ const out = git(root, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
29
+ return out === null || out.trim() === "" ? null : out.trim();
30
+ }
31
+ /**
32
+ * The base: `given` when there is one (null when it names no commit), else
33
+ * the merge-base with main when that is not HEAD itself, else HEAD~1.
34
+ */
35
+ export function chooseBase(root, given) {
36
+ if (given !== undefined) {
37
+ const commit = resolveCommit(root, given);
38
+ return commit === null ? null : { ref: given, commit };
39
+ }
40
+ const head = resolveCommit(root, "HEAD");
41
+ if (head === null)
42
+ return { unavailable: "the repository has no commit at HEAD" };
43
+ const mergeBase = git(root, ["merge-base", "HEAD", "main"])?.trim();
44
+ if (mergeBase !== undefined && mergeBase !== "" && mergeBase !== head) {
45
+ return { ref: "merge-base with main", commit: mergeBase };
46
+ }
47
+ const parent = resolveCommit(root, "HEAD~1");
48
+ if (parent !== null)
49
+ return { ref: "HEAD~1", commit: parent };
50
+ return { unavailable: "HEAD has no parent and no merge-base with main differs from it" };
51
+ }
52
+ export function changedFiles(root, base) {
53
+ const committed = base === null ? [] : paths(git(root, ["diff", "--relative", "--name-only", "-z", `${base.commit}...HEAD`]));
54
+ const uncommitted = [
55
+ ...paths(git(root, ["diff", "--relative", "--name-only", "-z", "HEAD"])),
56
+ ...paths(git(root, ["ls-files", "-z", "--others", "--exclude-standard"])),
57
+ ];
58
+ return {
59
+ committed: [...new Set(committed)].sort(compareStrings),
60
+ uncommitted: [...new Set(uncommitted)].sort(compareStrings),
61
+ };
62
+ }
63
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,SAAS,GAAG,CAAC,IAAY,EAAE,IAAc;IACvC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAA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AAI,CAAC,cAAc,CAAC;QACvD,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;KAC5D,CAAC;AACJ,CAAC"}
package/dist/glob.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The pattern language of `.intentset/config.yaml` scope and ignore lists,
3
+ * which is VSA §3's: repository-relative POSIX paths made of literal segments,
4
+ * `*` within one segment, and `**` across zero or more segments. Nothing else
5
+ * is special: no `?`, no classes, no braces, no negation, so there is no
6
+ * precedence to explain. A pattern and a path match segment by segment, and
7
+ * `*` never crosses a `/`.
8
+ *
9
+ * The architecture package has its own copy for claims. Duplicating thirty
10
+ * lines keeps the CLI's core commands independent of it.
11
+ */
12
+ /** VSA §3: true when the repository-relative POSIX `path` matches `pattern`. */
13
+ export declare function matchGlob(pattern: string, path: string): boolean;
14
+ /** True when any of `patterns` matches `path`. */
15
+ export declare function matchAny(patterns: readonly string[], path: string): boolean;
16
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBhE;AAED,kDAAkD;AAClD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3E"}
package/dist/glob.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The pattern language of `.intentset/config.yaml` scope and ignore lists,
3
+ * which is VSA §3's: repository-relative POSIX paths made of literal segments,
4
+ * `*` within one segment, and `**` across zero or more segments. Nothing else
5
+ * is special: no `?`, no classes, no braces, no negation, so there is no
6
+ * precedence to explain. A pattern and a path match segment by segment, and
7
+ * `*` never crosses a `/`.
8
+ *
9
+ * The architecture package has its own copy for claims. Duplicating thirty
10
+ * lines keeps the CLI's core commands independent of it.
11
+ */
12
+ /** VSA §3: true when the repository-relative POSIX `path` matches `pattern`. */
13
+ export function matchGlob(pattern, path) {
14
+ const p = normalize(pattern).split("/");
15
+ const s = path.split("/");
16
+ // Memo of (pattern index, path index) pairs already known not to match, so
17
+ // several `**` in one pattern stay polynomial rather than exponential.
18
+ const failed = new Set();
19
+ const width = s.length + 1;
20
+ const match = (i, j) => {
21
+ if (failed.has(i * width + j))
22
+ return false;
23
+ let ok;
24
+ if (i === p.length)
25
+ ok = j === s.length;
26
+ else if (p[i] === "**")
27
+ ok = match(i + 1, j) || (j < s.length && match(i, j + 1));
28
+ else
29
+ ok = j < s.length && matchSegment(p[i], s[j]) && match(i + 1, j + 1);
30
+ if (!ok)
31
+ failed.add(i * width + j);
32
+ return ok;
33
+ };
34
+ return match(0, 0);
35
+ }
36
+ /** True when any of `patterns` matches `path`. */
37
+ export function matchAny(patterns, path) {
38
+ return patterns.some((pattern) => matchGlob(pattern, path));
39
+ }
40
+ /** A leading `./` names the same path; repeated `/` separate nothing. */
41
+ function normalize(pattern) {
42
+ return pattern.replace(/^(?:\.\/)+/, "").replace(/\/{2,}/g, "/");
43
+ }
44
+ const SEGMENTS = new Map();
45
+ /** One segment: literal text, with each `*` standing for any run of characters other than `/`. */
46
+ function matchSegment(pattern, name) {
47
+ if (!pattern.includes("*"))
48
+ return pattern === name;
49
+ let regex = SEGMENTS.get(pattern);
50
+ if (regex === undefined) {
51
+ const body = pattern
52
+ .split("*")
53
+ .map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&"))
54
+ .join("[^/]*");
55
+ regex = new RegExp(`^${body}$`);
56
+ SEGMENTS.set(pattern, regex);
57
+ }
58
+ return regex.test(name);
59
+ }
60
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"m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O,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,QAAQ,CAAC,QAA2B,EAAE,IAAY;IAChE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,yEAAyE;AACzE,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE3C,kGAAkG;AAClG,SAAS,YAAY,CAAC,OAAe,EAAE,IAAY;IACjD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,KAAK,IAAI,CAAC;IACpD,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,OAAO;aACjB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;aACzD,IAAI,CAAC,OAAO,CAAC,CAAC;QACjB,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @intentset/cli as a library: `main` for running the command in-process,
3
+ * and the repository loader and pattern matcher it is built on.
4
+ */
5
+ export { main, USAGE } from "./main.ts";
6
+ export type { Io } from "./output.ts";
7
+ export { matchAny, matchGlob } from "./glob.ts";
8
+ export { CONFIG_PATH, enumerate, findRoot, loadRepository, readCommit, type Repository } from "./repository.ts";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @intentset/cli as a library: `main` for running the command in-process,
3
+ * and the repository loader and pattern matcher it is built on.
4
+ */
5
+ export { main, USAGE } from "./main.js";
6
+ export { matchAny, matchGlob } from "./glob.js";
7
+ export { CONFIG_PATH, enumerate, findRoot, loadRepository, readCommit } from "./repository.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=intentset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intentset.d.ts","sourceRoot":"","sources":["../src/intentset.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "./main.js";
3
+ // The first SIGINT or SIGTERM asks a long-running command (serve, mcp) to stop
4
+ // cleanly; the listener is removed as it fires, so a second one terminates.
5
+ const controller = new AbortController();
6
+ for (const signal of ["SIGINT", "SIGTERM"])
7
+ process.once(signal, () => controller.abort());
8
+ const code = await main(process.argv.slice(2), {
9
+ stdout: (s) => process.stdout.write(s),
10
+ stderr: (s) => process.stderr.write(s),
11
+ cwd: process.cwd(),
12
+ signal: controller.signal,
13
+ });
14
+ process.exitCode = code;
15
+ //# sourceMappingURL=intentset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intentset.js","sourceRoot":"","sources":["../src/intentset.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,+EAA+E;AAC/E,4EAA4E;AAC5E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAU;IAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;AAEpG,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC7C,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,MAAM,EAAE,UAAU,CAAC,MAAM;CAC1B,CAAC,CAAC;AACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { Io } from "./output.ts";
2
+ export type { Io } from "./output.ts";
3
+ export declare const USAGE = "usage: intentset <command> [options]\n\ncommands\n init [--repository <name>] [--example]\n create .intentset/config.yaml and an empty .intentset/registries.yaml;\n --example adds the scheduling example under product/scheduling/.\n Never overwrites a file.\n validate every check the level asks for; exit 1 when any diagnostic is an error\n graph [--format json] [--include-bodies] [--release <product>:<label>] [--out <file>]\n [--generated-at <time>]\n print the intentset/export/0.1 envelope, or write it to --out\n architecture check [--mode migration|strict] [--baseline <file>] [--write-baseline <file>]\n ownership, claims, imports, layers and regions (default level L2)\n evidence import --from vitest|node-tap <report> --out <file> --product <ID> --release <label>\n [--environment <text>] [--started-at <time>] [--finished-at <time>] [--uri-base <uri>]\n [--tool-version <v>]\n turn a test report into run records bound to this commit and graph\n impact <ID> what depends on an artifact: direct, candidates, review context, ancestors\n context <ID> [--include-restricted]\n the bounded engineering context of an artifact, with paths and bodies\n review [--base <ref>] the local review report: checks, coverage, and the impact of what changed\n publish --visibility <v> --audience <a> --product <ID> --release <r> --role <r> --edition <e>\n [--flag <f>]... [--authorized-internal] [--authorized-restricted] --out <dir> [--html]\n [--published-at <time>]\n reviewed knowledge for one audience and release, as Markset with provenance\n serve [--port <n>] [--host <address>] [--out <dir>]\n the Atlas, the internal review pages, on http://127.0.0.1:3000/ (rebuilt\n when a file changes), or written to --out; runs at L2, or L3 with run records\n mcp --mode engineering [--include-restricted]\n mcp --mode customer --visibility <public|customer> --audience <a> --product <ID> --release <r>\n --role <r> --edition <e> [--flag <f>]...\n the read-only MCP server on stdio: the engineering graph, or one\n publication made in memory as publish makes it, and nothing else\n\noptions\n --root <dir> repository root (default: the nearest directory at or above this one\n holding .intentset/config.yaml)\n --json machine-readable output, keys in canonical order\n --carrier <markset|plain> how documents are read (default markset)\n --level <L1..L4> conformance level; each includes those below it (default L1):\n L2 adds architecture, L3 evidence, L4 publication readiness\n --evidence <file> L3 and above: run records to read, repeatable (default: every *.json in\n .intentset/evidence/, which holds local output and is not committed)\n --product <ID> --release <label>\n L3 and above: the exact scope evidence is assessed for (default: every scope)\n --mode <migration|strict> --baseline <file>\n L2 and above: whether a baseline of known violations applies, and which\n (for mcp, --mode names the server's mode instead)\n -h, --help show this help\n\nexit codes: 0 no errors, 1 validation errors, 2 invocation or tool failure";
4
+ export declare function main(argv: string[], io: Io): Promise<number>;
5
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAItC,YAAY,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,eAAO,MAAM,KAAK,8lHAkDyD,CAAC;AA4E5E,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA0MlE"}
package/dist/main.js ADDED
@@ -0,0 +1,406 @@
1
+ /**
2
+ * The `intentset` command: argument parsing, dispatch and exit codes, with
3
+ * every command's work in commands/. `main` returns the exit code rather than
4
+ * exiting, so tests run it in-process with captured io.
5
+ *
6
+ * Exit codes (Core §11, ADR 0004): 0 no errors, 1 validation errors, 2
7
+ * invocation or tool failure. validate, graph, architecture check, impact,
8
+ * context, review, serve and mcp never write; graph --out, architecture
9
+ * check --write-baseline, evidence import --out, publish --out and serve
10
+ * --out write only what they name; init only creates.
11
+ */
12
+ import { parseArgs } from "node:util";
13
+ import { LEVELS } from "@intentset/core";
14
+ import { architectureCommand } from "./commands/architecture.js";
15
+ import { contextCommand } from "./commands/context.js";
16
+ import { evidenceImportCommand, evidenceUsageProblem } from "./commands/evidence.js";
17
+ import { graphCommand, graphUsageProblem, parseRelease } from "./commands/graph.js";
18
+ import { impactCommand } from "./commands/impact.js";
19
+ import { initCommand } from "./commands/init.js";
20
+ import { mcpCommand, mcpUsageProblem } from "./commands/mcp.js";
21
+ import { publishCommand, publishUsageProblem } from "./commands/publish.js";
22
+ import { reviewCommand } from "./commands/review.js";
23
+ import { serveCommand } from "./commands/serve.js";
24
+ import { validateCommand } from "./commands/validate.js";
25
+ import { CARRIERS, findRoot } from "./repository.js";
26
+ import { EVIDENCE_DIR, evidenceFiles, openSession } from "./session.js";
27
+ export const USAGE = `usage: intentset <command> [options]
28
+
29
+ commands
30
+ init [--repository <name>] [--example]
31
+ create .intentset/config.yaml and an empty .intentset/registries.yaml;
32
+ --example adds the scheduling example under product/scheduling/.
33
+ Never overwrites a file.
34
+ validate every check the level asks for; exit 1 when any diagnostic is an error
35
+ graph [--format json] [--include-bodies] [--release <product>:<label>] [--out <file>]
36
+ [--generated-at <time>]
37
+ print the intentset/export/0.1 envelope, or write it to --out
38
+ architecture check [--mode migration|strict] [--baseline <file>] [--write-baseline <file>]
39
+ ownership, claims, imports, layers and regions (default level L2)
40
+ evidence import --from vitest|node-tap <report> --out <file> --product <ID> --release <label>
41
+ [--environment <text>] [--started-at <time>] [--finished-at <time>] [--uri-base <uri>]
42
+ [--tool-version <v>]
43
+ turn a test report into run records bound to this commit and graph
44
+ impact <ID> what depends on an artifact: direct, candidates, review context, ancestors
45
+ context <ID> [--include-restricted]
46
+ the bounded engineering context of an artifact, with paths and bodies
47
+ review [--base <ref>] the local review report: checks, coverage, and the impact of what changed
48
+ publish --visibility <v> --audience <a> --product <ID> --release <r> --role <r> --edition <e>
49
+ [--flag <f>]... [--authorized-internal] [--authorized-restricted] --out <dir> [--html]
50
+ [--published-at <time>]
51
+ reviewed knowledge for one audience and release, as Markset with provenance
52
+ serve [--port <n>] [--host <address>] [--out <dir>]
53
+ the Atlas, the internal review pages, on http://127.0.0.1:3000/ (rebuilt
54
+ when a file changes), or written to --out; runs at L2, or L3 with run records
55
+ mcp --mode engineering [--include-restricted]
56
+ mcp --mode customer --visibility <public|customer> --audience <a> --product <ID> --release <r>
57
+ --role <r> --edition <e> [--flag <f>]...
58
+ the read-only MCP server on stdio: the engineering graph, or one
59
+ publication made in memory as publish makes it, and nothing else
60
+
61
+ options
62
+ --root <dir> repository root (default: the nearest directory at or above this one
63
+ holding .intentset/config.yaml)
64
+ --json machine-readable output, keys in canonical order
65
+ --carrier <markset|plain> how documents are read (default markset)
66
+ --level <L1..L4> conformance level; each includes those below it (default L1):
67
+ L2 adds architecture, L3 evidence, L4 publication readiness
68
+ --evidence <file> L3 and above: run records to read, repeatable (default: every *.json in
69
+ ${EVIDENCE_DIR}/, which holds local output and is not committed)
70
+ --product <ID> --release <label>
71
+ L3 and above: the exact scope evidence is assessed for (default: every scope)
72
+ --mode <migration|strict> --baseline <file>
73
+ L2 and above: whether a baseline of known violations applies, and which
74
+ (for mcp, --mode names the server's mode instead)
75
+ -h, --help show this help
76
+
77
+ exit codes: 0 no errors, 1 validation errors, 2 invocation or tool failure`;
78
+ const COMMANDS = [
79
+ "init",
80
+ "validate",
81
+ "graph",
82
+ "architecture",
83
+ "evidence",
84
+ "impact",
85
+ "context",
86
+ "review",
87
+ "publish",
88
+ "serve",
89
+ "mcp",
90
+ ];
91
+ const GLOBAL = ["root", "json", "carrier", "level", "help"];
92
+ const LEVEL_OPTIONS = ["evidence", "product", "release", "mode", "baseline"];
93
+ const COMMAND_OPTIONS = {
94
+ init: ["repository", "example"],
95
+ validate: LEVEL_OPTIONS,
96
+ graph: ["format", "include-bodies", "release", "out", "generated-at", "evidence", "mode", "baseline"],
97
+ architecture: ["mode", "baseline", "write-baseline"],
98
+ evidence: [
99
+ "from",
100
+ "out",
101
+ "product",
102
+ "release",
103
+ "environment",
104
+ "started-at",
105
+ "finished-at",
106
+ "uri-base",
107
+ "tool-version",
108
+ ],
109
+ impact: LEVEL_OPTIONS,
110
+ context: ["include-restricted", ...LEVEL_OPTIONS],
111
+ review: ["base", ...LEVEL_OPTIONS],
112
+ serve: ["port", "host", "out", ...LEVEL_OPTIONS],
113
+ mcp: [
114
+ "mode",
115
+ "include-restricted",
116
+ "visibility",
117
+ "audience",
118
+ "product",
119
+ "release",
120
+ "role",
121
+ "edition",
122
+ "flag",
123
+ "authorized-internal",
124
+ "authorized-restricted",
125
+ "published-at",
126
+ ],
127
+ publish: [
128
+ "visibility",
129
+ "audience",
130
+ "product",
131
+ "release",
132
+ "role",
133
+ "edition",
134
+ "flag",
135
+ "authorized-internal",
136
+ "authorized-restricted",
137
+ "out",
138
+ "html",
139
+ "published-at",
140
+ ],
141
+ };
142
+ /** Positional arguments after the command: a fixed subcommand, then how many more. */
143
+ const POSITIONALS = {
144
+ architecture: { sub: "check", count: 0 },
145
+ evidence: { sub: "import", count: 1, what: "a report file" },
146
+ impact: { count: 1, what: "an artifact ID" },
147
+ context: { count: 1, what: "an artifact ID" },
148
+ };
149
+ export async function main(argv, io) {
150
+ let parsed;
151
+ try {
152
+ parsed = parse(argv);
153
+ }
154
+ catch (error) {
155
+ io.stderr(`intentset: ${error.message}\n\n${USAGE}\n`);
156
+ return 2;
157
+ }
158
+ const { values, positionals, tokens } = parsed;
159
+ const [command, ...rest] = positionals;
160
+ if (values.help || command === undefined) {
161
+ io.stdout(`${USAGE}\n`);
162
+ return values.help ? 0 : 2;
163
+ }
164
+ // The command is checked before its arguments, so a typo reads as a typo and not as a missing ID.
165
+ if (!COMMANDS.includes(command)) {
166
+ io.stderr(`intentset: unknown command "${command}"\n\n${USAGE}\n`);
167
+ return 2;
168
+ }
169
+ const usage = (message) => {
170
+ io.stderr(`intentset ${command}: ${message}\n`);
171
+ return 2;
172
+ };
173
+ const allowed = [...GLOBAL, ...(COMMAND_OPTIONS[command] ?? [])];
174
+ for (const token of tokens) {
175
+ if (token.kind === "option" && !allowed.includes(token.name)) {
176
+ return usage(`--${token.name} is not an option of ${command}`);
177
+ }
178
+ }
179
+ const shape = POSITIONALS[command] ?? { count: 0 };
180
+ let args = rest;
181
+ if (shape.sub !== undefined) {
182
+ if (args[0] !== shape.sub)
183
+ return usage(`the only subcommand is "${command} ${shape.sub}"`);
184
+ args = args.slice(1);
185
+ }
186
+ if (args.length < shape.count)
187
+ return usage(`${shape.what} is required`);
188
+ if (args.length > shape.count) {
189
+ const hint = shape.count === 0 ? " (use --root <dir> to name the repository)" : "";
190
+ return usage(`unexpected argument "${args[shape.count]}"${hint}`);
191
+ }
192
+ const carrier = values.carrier ?? "markset";
193
+ if (!Object.hasOwn(CARRIERS, carrier)) {
194
+ return usage(`--carrier ${carrier}: the carriers are ${Object.keys(CARRIERS).join(" and ")}`);
195
+ }
196
+ const levelGiven = values.level;
197
+ if (levelGiven !== undefined && !LEVELS.includes(levelGiven)) {
198
+ return usage(`--level ${levelGiven}: the levels are ${LEVELS.join(", ")}`);
199
+ }
200
+ if (levelGiven === "L5") {
201
+ return usage("L5 is a claim about continuous CI, not something one run can check (Core §11).");
202
+ }
203
+ if (command !== "mcp" && values.mode !== undefined && values.mode !== "migration" && values.mode !== "strict") {
204
+ return usage(`--mode ${values.mode}: the modes are migration and strict`);
205
+ }
206
+ if (command === "init") {
207
+ return initCommand({ root: values.root, repository: values.repository, example: values.example }, io);
208
+ }
209
+ // Evidence scope: --product with --release, or graph's --release <product>:<label>.
210
+ let scope = null;
211
+ if (command !== "evidence" && command !== "publish" && command !== "mcp") {
212
+ if (command === "graph") {
213
+ const release = values.release === undefined ? null : parseRelease(values.release);
214
+ scope = release === null ? null : { product: release.product, release: release.label };
215
+ }
216
+ else if ((values.product === undefined) !== (values.release === undefined)) {
217
+ return usage("--product and --release name one scope together; give both or neither");
218
+ }
219
+ else if (values.product !== undefined && values.release !== undefined) {
220
+ scope = { product: values.product, release: values.release };
221
+ }
222
+ }
223
+ const sessionOptions = (level) => ({
224
+ root: values.root,
225
+ carrier: carrier,
226
+ level,
227
+ mode: command === "mcp" ? undefined : values.mode,
228
+ baseline: values.baseline,
229
+ evidence: values.evidence,
230
+ scope,
231
+ });
232
+ switch (command) {
233
+ case "validate": {
234
+ const session = openSession(command, sessionOptions(levelGiven ?? "L1"), io);
235
+ return typeof session === "number" ? session : validateCommand(session, values.json, io);
236
+ }
237
+ case "graph": {
238
+ const options = {
239
+ format: values.format,
240
+ includeBodies: values["include-bodies"],
241
+ release: values.release,
242
+ out: values.out,
243
+ generatedAt: values["generated-at"],
244
+ };
245
+ const problem = graphUsageProblem(options);
246
+ if (problem !== null)
247
+ return usage(problem);
248
+ const session = openSession(command, sessionOptions(levelGiven ?? "L1"), io);
249
+ return typeof session === "number" ? session : graphCommand(session, options, io);
250
+ }
251
+ case "architecture": {
252
+ if (levelGiven === "L1")
253
+ return usage("the architecture check runs at L2 and above, where ownership joins");
254
+ const session = openSession("architecture check", sessionOptions(levelGiven ?? "L2"), io);
255
+ if (typeof session === "number")
256
+ return session;
257
+ return architectureCommand(session, { writeBaseline: values["write-baseline"] }, values.json, io);
258
+ }
259
+ case "evidence": {
260
+ const options = {
261
+ from: values.from,
262
+ report: args[0],
263
+ out: values.out,
264
+ product: values.product,
265
+ release: values.release,
266
+ environment: values.environment,
267
+ startedAt: values["started-at"],
268
+ finishedAt: values["finished-at"],
269
+ uriBase: values["uri-base"],
270
+ toolVersion: values["tool-version"],
271
+ };
272
+ const problem = evidenceUsageProblem(options);
273
+ if (problem !== null)
274
+ return usage(problem);
275
+ const session = openSession("evidence import", sessionOptions(levelGiven ?? "L1"), io);
276
+ return typeof session === "number" ? session : evidenceImportCommand(session, options, io);
277
+ }
278
+ case "impact": {
279
+ const session = openSession(command, sessionOptions(levelGiven ?? "L1"), io);
280
+ return typeof session === "number" ? session : impactCommand(session, args[0], values.json, io);
281
+ }
282
+ case "context": {
283
+ const session = openSession(command, sessionOptions(levelGiven ?? "L1"), io);
284
+ if (typeof session === "number")
285
+ return session;
286
+ return contextCommand(session, args[0], values["include-restricted"], values.json, io);
287
+ }
288
+ case "review": {
289
+ let level = levelGiven;
290
+ let reason = "as asked";
291
+ if (level === undefined) {
292
+ const root = findRoot(io.cwd, values.root);
293
+ const records = root === null ? [] : evidenceFiles(root, io.cwd, values.evidence);
294
+ level = records.length > 0 ? "L4" : "L2";
295
+ reason =
296
+ records.length > 0
297
+ ? "the highest the inputs allow: run records were given or found"
298
+ : `the highest the inputs allow: no run records were given or found in ${EVIDENCE_DIR}/, so L3 and L4 were not checked`;
299
+ }
300
+ const session = openSession(command, sessionOptions(level), io);
301
+ if (typeof session === "number")
302
+ return session;
303
+ return reviewCommand(session, { base: values.base, levelReason: reason }, values.json, io);
304
+ }
305
+ case "serve": {
306
+ const port = values.port === undefined ? 3000 : Number(values.port);
307
+ if (!Number.isInteger(port) || port < 0 || port > 65535 || values.port === "") {
308
+ return usage(`--port ${values.port}: give a port number from 0 to 65535`);
309
+ }
310
+ let level = levelGiven;
311
+ if (level === undefined) {
312
+ const root = findRoot(io.cwd, values.root);
313
+ level = root !== null && evidenceFiles(root, io.cwd, values.evidence).length > 0 ? "L3" : "L2";
314
+ }
315
+ return serveCommand({ port, host: values.host ?? "127.0.0.1", out: values.out }, sessionOptions(level), io);
316
+ }
317
+ case "mcp": {
318
+ const options = {
319
+ mode: values.mode,
320
+ includeRestricted: values["include-restricted"],
321
+ visibility: values.visibility,
322
+ audience: values.audience,
323
+ product: values.product,
324
+ release: values.release,
325
+ role: values.role,
326
+ edition: values.edition,
327
+ flags: values.flag ?? [],
328
+ authorizedInternal: values["authorized-internal"],
329
+ authorizedRestricted: values["authorized-restricted"],
330
+ publishedAt: values["published-at"],
331
+ };
332
+ const problem = mcpUsageProblem(options);
333
+ if (problem !== null)
334
+ return usage(problem);
335
+ return mcpCommand(options, sessionOptions(levelGiven ?? "L1"), io);
336
+ }
337
+ default: {
338
+ const options = {
339
+ visibility: values.visibility,
340
+ audience: values.audience,
341
+ product: values.product,
342
+ release: values.release,
343
+ role: values.role,
344
+ edition: values.edition,
345
+ flags: values.flag ?? [],
346
+ authorizedInternal: values["authorized-internal"],
347
+ authorizedRestricted: values["authorized-restricted"],
348
+ out: values.out,
349
+ html: values.html,
350
+ publishedAt: values["published-at"],
351
+ };
352
+ const problem = publishUsageProblem(options);
353
+ if (problem !== null)
354
+ return usage(problem);
355
+ const session = openSession(command, sessionOptions(levelGiven ?? "L1"), io);
356
+ return typeof session === "number" ? session : publishCommand(session, options, io);
357
+ }
358
+ }
359
+ }
360
+ function parse(argv) {
361
+ return parseArgs({
362
+ args: argv,
363
+ allowPositionals: true,
364
+ strict: true,
365
+ tokens: true,
366
+ options: {
367
+ root: { type: "string" },
368
+ json: { type: "boolean", default: false },
369
+ carrier: { type: "string" },
370
+ level: { type: "string" },
371
+ help: { type: "boolean", short: "h", default: false },
372
+ repository: { type: "string" },
373
+ example: { type: "boolean", default: false },
374
+ format: { type: "string" },
375
+ "include-bodies": { type: "boolean", default: false },
376
+ release: { type: "string" },
377
+ out: { type: "string" },
378
+ "generated-at": { type: "string" },
379
+ "include-restricted": { type: "boolean", default: false },
380
+ evidence: { type: "string", multiple: true },
381
+ product: { type: "string" },
382
+ mode: { type: "string" },
383
+ baseline: { type: "string" },
384
+ "write-baseline": { type: "string" },
385
+ from: { type: "string" },
386
+ environment: { type: "string" },
387
+ "started-at": { type: "string" },
388
+ "finished-at": { type: "string" },
389
+ "uri-base": { type: "string" },
390
+ "tool-version": { type: "string" },
391
+ base: { type: "string" },
392
+ visibility: { type: "string" },
393
+ audience: { type: "string" },
394
+ role: { type: "string" },
395
+ edition: { type: "string" },
396
+ flag: { type: "string", multiple: true },
397
+ "authorized-internal": { type: "boolean", default: false },
398
+ "authorized-restricted": { type: "boolean", default: false },
399
+ html: { type: "boolean", default: false },
400
+ "published-at": { type: "string" },
401
+ port: { type: "string" },
402
+ host: { type: "string" },
403
+ },
404
+ });
405
+ }
406
+ //# sourceMappingURL=main.js.map