@intentset/cli 0.10.0 → 0.13.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 (53) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/agents.js +43 -2
  3. package/dist/agents.js.map +1 -1
  4. package/dist/commands/context.d.ts.map +1 -1
  5. package/dist/commands/context.js +20 -4
  6. package/dist/commands/context.js.map +1 -1
  7. package/dist/commands/graph.js +1 -1
  8. package/dist/commands/init.d.ts.map +1 -1
  9. package/dist/commands/init.js +10 -8
  10. package/dist/commands/init.js.map +1 -1
  11. package/dist/commands/list.d.ts +49 -0
  12. package/dist/commands/list.d.ts.map +1 -0
  13. package/dist/commands/list.js +295 -0
  14. package/dist/commands/list.js.map +1 -0
  15. package/dist/commands/review.js +1 -1
  16. package/dist/commands/review.js.map +1 -1
  17. package/dist/commands/shared.d.ts +8 -0
  18. package/dist/commands/shared.d.ts.map +1 -1
  19. package/dist/commands/shared.js +15 -5
  20. package/dist/commands/shared.js.map +1 -1
  21. package/dist/glob.d.ts +4 -13
  22. package/dist/glob.d.ts.map +1 -1
  23. package/dist/glob.js +4 -57
  24. package/dist/glob.js.map +1 -1
  25. package/dist/main.d.ts +1 -1
  26. package/dist/main.d.ts.map +1 -1
  27. package/dist/main.js +78 -5
  28. package/dist/main.js.map +1 -1
  29. package/dist/session.d.ts +1 -2
  30. package/dist/session.d.ts.map +1 -1
  31. package/dist/session.js +6 -4
  32. package/dist/session.js.map +1 -1
  33. package/dist/subject.d.ts +2 -0
  34. package/dist/subject.d.ts.map +1 -1
  35. package/dist/subject.js +11 -1
  36. package/dist/subject.js.map +1 -1
  37. package/package.json +9 -9
  38. package/src/agents.ts +43 -2
  39. package/src/commands/context.ts +24 -3
  40. package/src/commands/graph.ts +1 -1
  41. package/src/commands/init.ts +10 -8
  42. package/src/commands/list.ts +346 -0
  43. package/src/commands/review.ts +1 -1
  44. package/src/commands/shared.ts +20 -0
  45. package/src/glob.ts +4 -56
  46. package/src/main.ts +85 -6
  47. package/src/session.ts +5 -4
  48. package/src/subject.ts +13 -1
  49. package/dist/slices.d.ts +0 -24
  50. package/dist/slices.d.ts.map +0 -1
  51. package/dist/slices.js +0 -48
  52. package/dist/slices.js.map +0 -1
  53. package/src/slices.ts +0 -54
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAGL,iBAAiB,EAEjB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,cAAc,EAId,SAAS,EACT,SAAS,EACT,MAAM,EAEN,eAAe,EAEf,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAEL,aAAa,EAKb,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,aAAa,CAAC;AACvE,OAAO,EAAoB,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,sGAAsG;AACtG,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAiDlD,MAAM,EAAE,GAAG,CAAC,KAAY,EAAE,KAAY,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE1F,q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,CACJ,MAAM,CAAC,QAAQ,KAAK,IAAI;YACtB,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI;gBAC1B,CAAC,CAAC,uBAAuB;gBACzB,CAAC,CAAC,6CAA6C,EACnD,GAAG,IAAI,CAAC,MAAM,cAAc,EAAE,kBAAkB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAC/E,mIAAmI,CACpI,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC"}
package/dist/subject.d.ts CHANGED
@@ -2,6 +2,8 @@ import type { EvidenceBinding, Graph } from "@intentset/core";
2
2
  import { type BindingDecision, type Subject, type SubjectSource } from "@intentset/verification";
3
3
  import type { Repository } from "./repository.ts";
4
4
  import type { Tree } from "./tree.ts";
5
+ /** Where run records are read from when no --evidence is given. Local output: not to be committed. */
6
+ export declare const EVIDENCE_DIR = ".intentset/evidence";
5
7
  /** The binding in force: the option, else the configuration, else the default (Core §8). */
6
8
  export declare function bindingFor(repo: Repository, graph: Graph, given: EvidenceBinding | undefined): BindingDecision;
7
9
  /** The architecture's resolution over the tree, reading file contents from disk. */
@@ -1 +1 @@
1
- {"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../src/subject.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,GAAG,SAAS,G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EAAE,aAAa,CAAC;IACtB,kEAAkE;IAClE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,GAAG,IAAI,CAAC;CACnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,CAW/E"}
package/dist/subject.js CHANGED
@@ -10,6 +10,16 @@ import { join } from "node:path";
10
10
  import { subjectSource } from "@intentset/architecture";
11
11
  import { hasSliceClaims, resolveBinding, subjectsFor, } from "@intentset/verification";
12
12
  import { changedSince } from "./git.js";
13
+ /** Where run records are read from when no --evidence is given. Local output: not to be committed. */
14
+ export const EVIDENCE_DIR = ".intentset/evidence";
15
+ /**
16
+ * The run records under EVIDENCE_DIR are the toolchain's own output, never part of a subject, so a change to them
17
+ * says nothing about evidence and is left out of what `changedSince` answers: EVID005 would otherwise list the file
18
+ * `evidence import --out` has just written, until it is ignored or committed.
19
+ */
20
+ function outsideEvidence(paths) {
21
+ return paths === null ? null : paths.filter((path) => path !== EVIDENCE_DIR && !path.startsWith(`${EVIDENCE_DIR}/`));
22
+ }
13
23
  /** The binding in force: the option, else the configuration, else the default (Core §8). */
14
24
  export function bindingFor(repo, graph, given) {
15
25
  return resolveBinding(given ?? repo.config.evidence.binding, hasSliceClaims(graph));
@@ -38,7 +48,7 @@ export function subjectsOf(repo, graph, tree) {
38
48
  source,
39
49
  changedSince: (commit) => {
40
50
  if (!asked.has(commit))
41
- asked.set(commit, changedSince(repo.root, commit));
51
+ asked.set(commit, outsideEvidence(changedSince(repo.root, commit)));
42
52
  return asked.get(commit) ?? null;
43
53
  },
44
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"subject.js","sourceRoot":"","sources":["../src/subject.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC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
3
+ "version": "0.13.0",
4
4
  "description": "The intentset command: validate, graph, architecture check, evidence, impact, review, publish, serve, context, mcp, guide.",
5
5
  "keywords": [
6
6
  "intentset",
@@ -39,14 +39,14 @@
39
39
  "intentset": "./dist/intentset.js"
40
40
  },
41
41
  "dependencies": {
42
- "@intentset/core": "^0.10.0",
43
- "@intentset/markset-adapter": "^0.10.0",
44
- "@intentset/architecture": "^0.10.0",
45
- "@intentset/verification": "^0.10.0",
46
- "@intentset/publisher": "^0.10.0",
47
- "@intentset/atlas": "^0.10.0",
48
- "@intentset/mcp": "^0.10.0",
49
- "@intentset/conformance-suite": "^0.10.0"
42
+ "@intentset/core": "^0.13.0",
43
+ "@intentset/markset-adapter": "^0.13.0",
44
+ "@intentset/architecture": "^0.13.0",
45
+ "@intentset/verification": "^0.13.0",
46
+ "@intentset/publisher": "^0.13.0",
47
+ "@intentset/atlas": "^0.13.0",
48
+ "@intentset/mcp": "^0.13.0",
49
+ "@intentset/conformance-suite": "^0.13.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@modelcontextprotocol/sdk": "^1.32.0"
package/src/agents.ts CHANGED
@@ -85,6 +85,10 @@ Update the records in the same change as the code.
85
85
  slice is a draft, the paths it plans may not exist yet.
86
86
  - A changed check: a verification record names the test that checks a claim. Change the test and its record
87
87
  together, and add one for a behavior or rule that has none.
88
+ - Whether the work is built: a capability, behavior, rule, scenario, slice or contract says so in \`delivery\`.
89
+ Write \`delivery: built\` on a record you wrote from code that exists, \`delivery: planned\` on one that proposes
90
+ work, and change \`planned\` to \`built\` in the change that builds it. It states a fact about the code, not an
91
+ approval, so you may set it; a draft that says \`built\` is still a draft until a person approves it.
88
92
 
89
93
  Write each link once, on the record that points: a behavior is \`governedBy\` its rules, a scenario \`illustrates\`
90
94
  a behavior, a slice \`implements\` behaviors, a verification \`verifies\` what it checks. Never write the reverse.
@@ -134,8 +138,10 @@ level-one heading repeats its title. Plain Markdown is valid Markset. For the re
134
138
  callouts, tables and other constructs a record may use and the codes \`validate\` reports for them, read Markset's
135
139
  guide at ${MARKSET_GUIDE_URL}, or print it with \`${markset}\`.
136
140
 
137
- An existing record of the same type in this repository is the best template; a new behavior looks like this, one
138
- recognizable promise including how it fails:
141
+ An existing record of the same type in this repository is the best template; in a repository with none yet,
142
+ \`${run} init --example --root <an empty directory>\` writes one record of each type there to read. A capability sits
143
+ under an outcome, an outcome under an intent, and an intent under the product, so the first capability brings those
144
+ three with it. A new behavior looks like this, one recognizable promise including how it fails:
139
145
 
140
146
  \`\`\`markdown
141
147
  ---
@@ -147,6 +153,7 @@ intentset:
147
153
  type: behavior
148
154
  title: The promise in a few words, such as Schedule a student assessment
149
155
  status: draft
156
+ delivery: planned
150
157
  owner: <an owner from the registry>
151
158
  visibility: internal
152
159
  audiences: [engineering, product]
@@ -173,6 +180,40 @@ What must be true first.
173
180
  Success: what happens. Failure: what is rejected, and what is left unchanged.
174
181
  \`\`\`
175
182
 
183
+ A verification record binds a check to what it verifies. An automated one names the test file and a selector the
184
+ test's title holds as whole words (a \`describe\`'s name binds all of its tests), which is how \`evidence import\`
185
+ matches a run to it:
186
+
187
+ \`\`\`markdown
188
+ ---
189
+ markset: 0
190
+ intentset:
191
+ spec: '0.2'
192
+ profile: intentset/verification/0.2
193
+ id: TEST-AREA-NAME
194
+ type: verification
195
+ title: What the check proves, such as Unit test of scheduling an assessment
196
+ status: draft
197
+ owner: <an owner from the registry>
198
+ visibility: internal
199
+ audiences: [engineering]
200
+ links:
201
+ verifies: [BEH-AREA-NAME, RULE-AREA-LIMIT]
202
+ verification:
203
+ method: automated
204
+ locator: src/area/name.test.ts
205
+ selector: the test's title, or the describe's name
206
+ ---
207
+
208
+ # What the check proves, such as Unit test of scheduling an assessment
209
+
210
+ ## Procedure
211
+ The runner and the file, and the cases it covers, the failure cases included.
212
+
213
+ ## Expected result
214
+ What a pass shows.
215
+ \`\`\`
216
+
176
217
  A knowledge record explains behaviors, rules or capabilities to one audience, in that audience's words rather than
177
218
  the behavior's. It may carry \`tips\`: one plain sentence per explained ID, at most 160 characters, which the
178
219
  product shows beside the control that delivers that behavior once the knowledge is reviewed and published.
@@ -21,14 +21,31 @@ import {
21
21
  type ContextRole,
22
22
  compareStrings,
23
23
  contextFor,
24
+ type Diagnostic,
24
25
  type Graph,
26
+ ID_PATTERN,
25
27
  type LinkKind,
26
28
  } from "@intentset/core";
27
29
  import { count, formatDiagnostic, type Io, json, snapshotLine, TOOL } from "../output.ts";
28
30
  import type { Session } from "../session.ts";
29
- import { claimingSlices } from "../slices.ts";
31
+ import { claimingSlices } from "@intentset/core";
30
32
  import { unresolved, validationLine, validationSummary } from "./shared.ts";
31
33
 
34
+ /** A file no slice claims has no context to load; VSA009 is the claims rule the architecture check reports it under. */
35
+ function unclaimed(path: string, session: Session): Diagnostic {
36
+ const slices = [...session.result.graph.artifacts.values()].filter((a) => a.meta.type === "slice").length;
37
+ return {
38
+ code: "VSA009",
39
+ severity: "error",
40
+ origin: "architecture",
41
+ artifact: null,
42
+ path,
43
+ message: `No slice claims ${path}, so there is no context to load for it (${count(slices, "slice")} in this graph).`,
44
+ remediation:
45
+ "Give the ID of the record whose context to load, or add the file to the claims of the slice that owns it (VSA §2).",
46
+ };
47
+ }
48
+
32
49
  /**
33
50
  * The artifact a `context` argument names: itself when it is an ID, else the
34
51
  * one slice whose claims include it as a file path, relative to the working
@@ -81,9 +98,12 @@ export function contextCommand(
81
98
  }
82
99
  const via = "id" in target ? target.path : null;
83
100
  const id = "id" in target ? target.id : argument;
84
- const bundle = contextFor(graph, id, { includeRestricted });
101
+ const bundle = "slices" in target && !ID_PATTERN.test(argument) ? null : contextFor(graph, id, { includeRestricted });
85
102
  if (bundle === null) {
86
- const diagnostic = unresolved(id, session);
103
+ // An argument that is not an ID was a file path, and no slice claims it: say that, rather than reading the
104
+ // path as a malformed ID, since the agent gave the file it is about to edit and wants to know what owns it.
105
+ const diagnostic =
106
+ "slices" in target && !ID_PATTERN.test(argument) ? unclaimed(target.path, session) : unresolved(id, session);
87
107
  if (asJson) {
88
108
  io.stdout(
89
109
  json({
@@ -116,6 +136,7 @@ export function contextCommand(
116
136
  artifacts: bundle.artifacts.map((a) => ({
117
137
  ...a,
118
138
  sourceHash: full(a).sourceHash,
139
+ contentHash: full(a).contentHash,
119
140
  links: links(graph, full(a), visible),
120
141
  body: full(a).body,
121
142
  })),
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `intentset graph --format json` (spec/export.md, Core §12): the
3
- * `intentset/export/0.4` envelope over the validated repository, with the
3
+ * `intentset/export/0.5` envelope over the validated repository, with the
4
4
  * report sections `--report` asks for. Printed to stdout, or written to the
5
5
  * one file `--out` names, which may not be any file the repository reads.
6
6
  * A failing validation still exports, with `validation.status: "fail"`, and
@@ -54,14 +54,16 @@ export const EMPTY_REGISTRIES_TEXT = [
54
54
  "# Intentset registries (Core §4, §6, §7; VSA §3): the owners, audiences, release dimensions,",
55
55
  "# evidence sources and shared resources records may name. An empty registry reads as not",
56
56
  "# declared, and validate warns (CORE005) when a record names a value it could not check.",
57
- "owners: []",
58
- "audiences: []",
59
- "releases: []",
60
- "roles: []",
61
- "editions: []",
62
- "flags: []",
63
- "evidenceSources: []",
64
- "resources: []",
57
+ "# Every record names an owner and audiences from these lists, and a behavior names at least",
58
+ "# one release, one role and one edition, so fill each of those before the first record.",
59
+ "owners: [] # who owns records, a team or a person, such as team-shop",
60
+ "audiences: [] # who records are written for, such as engineering and product",
61
+ "releases: [] # labels of the releases behaviors are available in, such as v1",
62
+ "roles: [] # roles of the product's users, such as shopper; a product with none still names one",
63
+ "editions: [] # editions the product ships in, such as standard; likewise",
64
+ "flags: [] # feature flags a behavior may require; usually none",
65
+ "evidenceSources: [] # where a measure's reading comes from, such as product-analytics",
66
+ "resources: [] # resources slices share, such as a data layer, each with its owner and consumers",
65
67
  "",
66
68
  ].join("\n");
67
69
 
@@ -0,0 +1,346 @@
1
+ /**
2
+ * `intentset list` (spec/list.md, ADR 0016): the records that match a selector, from the repository's tree or from
3
+ * an export, as a table, as the `intentset/list/0.1` result, or as IDs. The options compile to the selector `select`
4
+ * in core reads, or `--where` gives it whole. Never writes. Exit 0 whenever it answered, a failed validation included
5
+ * (the result says so); 1 with --check when a record matched or is undetermined; 2 for an invocation error.
6
+ */
7
+ import { readFileSync } from "node:fs";
8
+ import { resolve } from "node:path";
9
+ import {
10
+ COUNT_FIELDS,
11
+ type CountField,
12
+ exportListMeta,
13
+ type ListOutput,
14
+ listOutput,
15
+ readExport,
16
+ readSelector,
17
+ type Selector,
18
+ type SelectorProblem,
19
+ select,
20
+ } from "@intentset/core";
21
+ import { count, type Io, json, snapshotLine } from "../output.ts";
22
+ import type { Session } from "../session.ts";
23
+ import { validationSummary } from "./shared.ts";
24
+
25
+ export const LIST_FORMATS = ["table", "json", "ids"] as const;
26
+ export type ListFormat = (typeof LIST_FORMATS)[number];
27
+
28
+ /** Each field option and the selector field it fills. */
29
+ const FIELD_OPTIONS: Record<string, string> = {
30
+ id: "ids",
31
+ type: "types",
32
+ status: "statuses",
33
+ delivery: "deliveries",
34
+ owner: "owners",
35
+ audience: "audiences",
36
+ visibility: "visibilities",
37
+ under: "under",
38
+ "has-extension": "hasExtension",
39
+ describing: "describing",
40
+ claims: "claims",
41
+ };
42
+
43
+ /** Each availability option and the dimension it fills. */
44
+ const AVAILABILITY_OPTIONS: Record<string, string> = {
45
+ product: "products",
46
+ release: "releases",
47
+ "not-release": "notReleases",
48
+ role: "roles",
49
+ edition: "editions",
50
+ flag: "flags",
51
+ };
52
+
53
+ /** Every option that adds to the selector, `--has` included. */
54
+ export const SELECTOR_OPTIONS = [...Object.keys(FIELD_OPTIONS), ...Object.keys(AVAILABILITY_OPTIONS), "has"];
55
+
56
+ export interface ListOptions {
57
+ /** The selector options as given, in order, each repetition kept. */
58
+ given: Array<{ name: string; value: string }>;
59
+ where?: string;
60
+ from?: string;
61
+ countBy?: string;
62
+ format?: string;
63
+ json: boolean;
64
+ check: boolean;
65
+ includeRestricted: boolean;
66
+ }
67
+
68
+ const HAS_SHAPE =
69
+ "write it as [some:|none:|all:]<out|in>:<kind>[=<status>,...], such as out:governedBy=draft or none:in:verifies";
70
+
71
+ /**
72
+ * The checks that need no repository, so a typo costs nothing: the format, the count field, and the selector,
73
+ * compiled from the options or read from --where. Returns the selector and format, or a message.
74
+ */
75
+ export function listUsageProblem(
76
+ options: ListOptions,
77
+ io: Io,
78
+ ): { problem: string } | { selector: Selector; format: ListFormat; countBy: CountField | null } {
79
+ const format = options.format ?? (options.json ? "json" : "table");
80
+ if (!(LIST_FORMATS as readonly string[]).includes(format)) {
81
+ return { problem: `--format ${format}: the formats are ${LIST_FORMATS.join(", ")}` };
82
+ }
83
+ if (options.json && format !== "json") {
84
+ return { problem: `--json is --format json; it does not combine with --format ${format}` };
85
+ }
86
+ if (options.countBy !== undefined && !(COUNT_FIELDS as readonly string[]).includes(options.countBy)) {
87
+ return { problem: `--count-by ${options.countBy}: the fields are ${COUNT_FIELDS.join(", ")}` };
88
+ }
89
+ if (options.from !== undefined && options.includeRestricted) {
90
+ return { problem: "--include-restricted reads the tree; an export withheld what it withheld when it was written" };
91
+ }
92
+
93
+ let value: unknown;
94
+ let where: ((problem: SelectorProblem) => string) | undefined;
95
+ if (options.where !== undefined) {
96
+ if (options.given.length > 0) {
97
+ const first = options.given[0].name;
98
+ return { problem: `--where gives the whole selector; it does not combine with --${first}` };
99
+ }
100
+ const file = options.where;
101
+ try {
102
+ value = JSON.parse(readFileSync(resolve(io.cwd, file), "utf8"));
103
+ } catch (error) {
104
+ return { problem: `--where ${file}: ${(error as Error).message}` };
105
+ }
106
+ where = (p) => `--where ${file}: ${p.pointer === "" ? "the selector" : p.pointer}: ${p.message}`;
107
+ } else {
108
+ const compiled = compile(options.given);
109
+ if ("problem" in compiled) return compiled;
110
+ value = compiled.selector;
111
+ where = (p) => `${optionFor(p.pointer)}: ${p.message}`;
112
+ }
113
+ const read = readSelector(value);
114
+ if (!read.ok) return { problem: read.problems.map(where).join("\n ") };
115
+ return {
116
+ selector: read.selector,
117
+ format: format as ListFormat,
118
+ countBy: (options.countBy ?? null) as CountField | null,
119
+ };
120
+ }
121
+
122
+ /** The options as a selector: a value may be a comma-separated list (one path for --claims), and repeats add values. */
123
+ function compile(given: ListOptions["given"]): { selector: Record<string, unknown> } | { problem: string } {
124
+ const selector: Record<string, unknown> = {};
125
+ const availability: Record<string, string[]> = {};
126
+ const links: unknown[] = [];
127
+ const add = (target: Record<string, unknown>, key: string, values: string[]) => {
128
+ target[key] = [...((target[key] as string[] | undefined) ?? []), ...values];
129
+ };
130
+ for (const { name, value } of given) {
131
+ const values = name === "claims" ? [value] : value.split(",").map((part) => part.trim());
132
+ if (name === "has") {
133
+ const link = parseHas(value);
134
+ if (link === null) return { problem: `--has ${value}: ${HAS_SHAPE}` };
135
+ links.push(link);
136
+ } else if (Object.hasOwn(AVAILABILITY_OPTIONS, name)) {
137
+ add(availability, AVAILABILITY_OPTIONS[name], values);
138
+ } else {
139
+ add(selector, FIELD_OPTIONS[name], values);
140
+ }
141
+ }
142
+ if (Object.keys(availability).length > 0) selector.availability = availability;
143
+ if (links.length > 0) selector.links = links;
144
+ return { selector };
145
+ }
146
+
147
+ /** `[quantifier:]direction:kind[=status,...]`; the parts are checked by readSelector, the shape here. */
148
+ function parseHas(value: string): Record<string, unknown> | null {
149
+ const equals = value.indexOf("=");
150
+ const head = equals === -1 ? value : value.slice(0, equals);
151
+ const parts = head.split(":");
152
+ if (parts.length < 2 || parts.length > 3 || parts.some((part) => part === "")) return null;
153
+ const [quantifier, direction, kind] = parts.length === 3 ? parts : ["some", ...parts];
154
+ const link: Record<string, unknown> = { direction, kind, quantifier };
155
+ if (equals !== -1)
156
+ link.match = {
157
+ statuses: value
158
+ .slice(equals + 1)
159
+ .split(",")
160
+ .map((part) => part.trim()),
161
+ };
162
+ return link;
163
+ }
164
+
165
+ /** The option a compiled selector's pointer came from, for a message in the command line's words. */
166
+ function optionFor(pointer: string): string {
167
+ const [, field, second] = pointer.split("/");
168
+ if (field === "links") return "--has";
169
+ if (field === "availability") {
170
+ return `--${Object.keys(AVAILABILITY_OPTIONS).find((name) => AVAILABILITY_OPTIONS[name] === second) ?? "availability"}`;
171
+ }
172
+ return `--${Object.keys(FIELD_OPTIONS).find((name) => FIELD_OPTIONS[name] === field) ?? field}`;
173
+ }
174
+
175
+ /** The list from the repository's tree, over the session's validation. */
176
+ export function listCommand(
177
+ session: Session,
178
+ checked: { selector: Selector; format: ListFormat; countBy: CountField | null },
179
+ options: ListOptions,
180
+ io: Io,
181
+ ): number {
182
+ const { repo, result, snapshot } = session;
183
+ const selection = select(result.graph, checked.selector, {
184
+ includeRestricted: options.includeRestricted,
185
+ registries: repo.registries,
186
+ });
187
+ const v = validationSummary(session, session.level);
188
+ const output = listOutput(
189
+ selection,
190
+ {
191
+ source: "tree",
192
+ snapshot: {
193
+ repository: repo.config.repository,
194
+ commit: snapshot.commit,
195
+ ...(snapshot.commitUnavailable === undefined ? {} : { commitUnavailable: snapshot.commitUnavailable }),
196
+ uncommitted: snapshot.uncommitted === true,
197
+ graphHash: snapshot.graphHash,
198
+ },
199
+ validation: { level: session.level, status: v.status, errors: v.errors, warnings: v.warnings },
200
+ },
201
+ checked.countBy,
202
+ );
203
+ return print(output, checked.format, options, io, "the repository's tree");
204
+ }
205
+
206
+ /** The list from an export, read as a consumer reads one (spec/export.md §5), with no repository I/O. */
207
+ export function listFromExportCommand(
208
+ checked: { selector: Selector; format: ListFormat; countBy: CountField | null },
209
+ options: ListOptions & { from: string },
210
+ io: Io,
211
+ ): number {
212
+ let bytes: Uint8Array;
213
+ try {
214
+ bytes = readFileSync(resolve(io.cwd, options.from));
215
+ } catch (error) {
216
+ io.stderr(`intentset list: --from ${options.from}: ${(error as Error).message}\n`);
217
+ return 2;
218
+ }
219
+ // The file is one the caller named, so its size is not a reason to refuse it.
220
+ const read = readExport(bytes, { maxBytes: Math.max(bytes.length, 1) });
221
+ if (!read.ok) {
222
+ const problems = read.problems.slice(0, 5).map((p) => ` ${p.pointer || "/"} ${p.message}`);
223
+ io.stderr(`intentset list: --from ${options.from} is not an export this reader accepts (${read.category}):\n`);
224
+ io.stderr(`${problems.join("\n")}\n`);
225
+ return 2;
226
+ }
227
+ const output = listOutput(
228
+ select(read.envelope, checked.selector),
229
+ { source: "export", ...exportListMeta(read.envelope) },
230
+ checked.countBy,
231
+ );
232
+ return print(output, checked.format, options, io, `the export ${options.from}`);
233
+ }
234
+
235
+ function print(output: ListOutput, format: ListFormat, options: ListOptions, io: Io, source: string): number {
236
+ if (format === "json") io.stdout(json(output));
237
+ else if (format === "ids") {
238
+ io.stdout(output.rows.map((row) => `${row.id}\n`).join(""));
239
+ for (const line of cautions(output)) io.stderr(`intentset list: ${line}\n`);
240
+ } else io.stdout(renderTable(output, source));
241
+ const flagged = output.counts.matched + output.counts.undetermined;
242
+ return options.check && flagged > 0 ? 1 : 0;
243
+ }
244
+
245
+ /** What a reader of bare IDs should know, said on stderr so it never lands in a captured list. */
246
+ function cautions(output: ListOutput): string[] {
247
+ const lines: string[] = [];
248
+ const { counts, validation } = output;
249
+ if (counts.undetermined > 0) {
250
+ lines.push(
251
+ `${count(counts.undetermined, "record")} undetermined, because the answer depends on a link to a withheld artifact: ${output.undetermined.join(", ")}`,
252
+ );
253
+ }
254
+ if (validation.status === "fail") {
255
+ lines.push(
256
+ `validation failed at ${validation.level} with ${count(validation.errors, "error")}, so the graph may be incomplete; run \`intentset validate\`.`,
257
+ );
258
+ }
259
+ return [...lines, ...output.notes];
260
+ }
261
+
262
+ function renderTable(output: ListOutput, source: string): string {
263
+ const { counts, validation, snapshot } = output;
264
+ const lines = [
265
+ snapshotLine({
266
+ commit: snapshot.commit,
267
+ ...(snapshot.commitUnavailable === undefined ? {} : { commitUnavailable: snapshot.commitUnavailable }),
268
+ uncommitted: snapshot.uncommitted,
269
+ graphHash: snapshot.graphHash,
270
+ }),
271
+ `Source: ${source}${snapshot.generatedAt === undefined ? "" : `, generated ${snapshot.generatedAt}`}`,
272
+ `Validation: ${validation.status} at ${validation.level}, ${count(validation.errors, "error")}, ${count(validation.warnings, "warning")}` +
273
+ (validation.status === "fail" ? ". The graph may be incomplete; run `intentset validate`." : ""),
274
+ `Selector: ${describeSelector(output.selector)}`,
275
+ `Considered ${counts.considered} (${counts.withheld} withheld), matched ${counts.matched}, undetermined ${counts.undetermined}`,
276
+ "",
277
+ ];
278
+ if (output.countBy !== null) {
279
+ const groups = output.countBy.groups.map((group) => [group.value ?? "(none)", String(group.count)]);
280
+ lines.push(...columns([[output.countBy.field, "count"], ...groups], [false, true]));
281
+ if (output.countBy.multiValued) {
282
+ lines.push(
283
+ "",
284
+ `A record counts once under each ${output.countBy.field} it names, so the counts can sum to more than ${counts.matched}.`,
285
+ );
286
+ }
287
+ } else if (output.rows.length === 0) {
288
+ lines.push("No record matches.");
289
+ } else {
290
+ const rows = output.rows.map((row) => [row.id, row.type, row.status, row.owner, row.title]);
291
+ lines.push(...columns([["ID", "type", "status", "owner", "title"], ...rows], []));
292
+ }
293
+ if (output.undetermined.length > 0) {
294
+ lines.push(
295
+ "",
296
+ `Undetermined, because the answer depends on a link to a withheld artifact (${output.undetermined.length}):`,
297
+ ...output.undetermined.map((id) => ` ${id}`),
298
+ );
299
+ }
300
+ if (output.notes.length > 0) lines.push("", ...output.notes.map((note) => `Note: ${note}`));
301
+ return `${lines.join("\n")}\n`;
302
+ }
303
+
304
+ /** Columns padded to their widest cell, the last left ragged; `right` aligns a column to the right. */
305
+ function columns(table: string[][], right: boolean[]): string[] {
306
+ const widths = table[0].map((_, i) => Math.max(...table.map((row) => row[i].length)));
307
+ return table.map((row) =>
308
+ row
309
+ .map((cell, i) => {
310
+ if (i === row.length - 1 && !right[i]) return cell;
311
+ return right[i] ? cell.padStart(widths[i]) : cell.padEnd(widths[i]);
312
+ })
313
+ .join(" "),
314
+ );
315
+ }
316
+
317
+ /** The normalized selector in a line: fields joined with "and", values with "or". */
318
+ export function describeSelector(selector: Selector): string {
319
+ const parts: string[] = [];
320
+ const values = (list: readonly string[]) => list.join(" or ");
321
+ for (const [field, label] of [
322
+ ["ids", "id"],
323
+ ["types", "type"],
324
+ ["statuses", "status"],
325
+ ["deliveries", "delivery"],
326
+ ["owners", "owner"],
327
+ ["audiences", "audience"],
328
+ ["visibilities", "visibility"],
329
+ ["under", "under"],
330
+ ["hasExtension", "extension"],
331
+ ] as const) {
332
+ const list = selector[field];
333
+ if (list !== undefined) parts.push(`${label} ${values(list)}`);
334
+ }
335
+ for (const [name, dimension] of Object.entries(AVAILABILITY_OPTIONS)) {
336
+ const list = selector.availability?.[dimension as keyof NonNullable<Selector["availability"]>];
337
+ if (list !== undefined) parts.push(`${name.replace("-", " ")} ${values(list)}`);
338
+ }
339
+ for (const link of selector.links ?? []) {
340
+ const match = link.match === undefined ? "" : ` matching ${describeSelector(link.match)}`;
341
+ parts.push(`${link.quantifier} ${link.direction} ${link.kind}${match}`);
342
+ }
343
+ if (selector.describing !== undefined) parts.push(`describing ${values(selector.describing)}`);
344
+ if (selector.claims !== undefined) parts.push(`claiming ${values(selector.claims)}`);
345
+ return parts.length === 0 ? "every record" : parts.join(", and ");
346
+ }
@@ -42,7 +42,7 @@ import {
42
42
  import { count, formatDiagnostic, type Io, json, snapshotLine, TOOL } from "../output.ts";
43
43
  import { levelJson, levelSections } from "../reports.ts";
44
44
  import type { Session } from "../session.ts";
45
- import { activeSlices, claimingSlices, describingRecords, isSliceCode } from "../slices.ts";
45
+ import { activeSlices, claimingSlices, describingRecords, isSliceCode } from "@intentset/core";
46
46
  import { pathText, REACHABILITY_NOTE } from "./impact.ts";
47
47
 
48
48
  export interface Attribution {