@intentset/cli 0.4.0 → 0.6.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.
- package/LICENSE +21 -0
- package/dist/agents.d.ts +8 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +65 -13
- package/dist/agents.js.map +1 -1
- package/dist/commands/graph.js +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +15 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +5 -3
- package/dist/commands/publish.js.map +1 -1
- package/dist/intentset.js +0 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/package.json +10 -10
- package/src/agents.ts +70 -13
- package/src/commands/graph.ts +1 -1
- package/src/commands/init.ts +16 -6
- package/src/commands/publish.ts +5 -3
- package/src/main.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Coral Reef Ventures, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/agents.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export declare const AGENT_GUIDE_PATH = ".intentset/agents.md";
|
|
2
2
|
/** The lines a repository adds so its agents read the guide, by the file that takes each. */
|
|
3
3
|
export declare const AGENT_POINTERS: Array<[string, string]>;
|
|
4
|
-
|
|
4
|
+
/** How the guide runs the CLI: through the package manager the repository uses. */
|
|
5
|
+
export type PackageManager = "npm" | "pnpm";
|
|
6
|
+
/** pnpm when the repository says so (its lockfile, workspace file or packageManager field), npm otherwise. */
|
|
7
|
+
export declare function detectPackageManager(files: {
|
|
8
|
+
has(path: string): boolean;
|
|
9
|
+
packageJson: string | null;
|
|
10
|
+
}): PackageManager;
|
|
11
|
+
export declare function agentGuide(scope: readonly string[], manager?: PackageManager): string;
|
|
5
12
|
//# sourceMappingURL=agents.d.ts.map
|
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlD,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlD,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,8GAA8G;AAC9G,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,cAAc,CASjB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,cAAsB,GAAG,MAAM,CAsK5F"}
|
package/dist/agents.js
CHANGED
|
@@ -17,26 +17,45 @@ export const AGENT_POINTERS = [
|
|
|
17
17
|
["CLAUDE.md", `@${AGENT_GUIDE_PATH}`],
|
|
18
18
|
["AGENTS.md", `Before changing code, read ${AGENT_GUIDE_PATH} and follow it.`],
|
|
19
19
|
];
|
|
20
|
-
|
|
20
|
+
/** pnpm when the repository says so (its lockfile, workspace file or packageManager field), npm otherwise. */
|
|
21
|
+
export function detectPackageManager(files) {
|
|
22
|
+
if (files.has("pnpm-lock.yaml") || files.has("pnpm-workspace.yaml"))
|
|
23
|
+
return "pnpm";
|
|
24
|
+
try {
|
|
25
|
+
const manager = JSON.parse(files.packageJson ?? "{}").packageManager;
|
|
26
|
+
if (typeof manager === "string" && manager.startsWith("pnpm@"))
|
|
27
|
+
return "pnpm";
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// An unreadable package.json says nothing about the package manager.
|
|
31
|
+
}
|
|
32
|
+
return "npm";
|
|
33
|
+
}
|
|
34
|
+
export function agentGuide(scope, manager = "npm") {
|
|
35
|
+
const run = manager === "pnpm" ? "pnpm exec intentset" : "npx intentset";
|
|
36
|
+
const isolated = manager === "pnpm"
|
|
37
|
+
? "pnpm dlx --package=@intentset/cli --package=typescript@7 intentset ..."
|
|
38
|
+
: "npx -p @intentset/cli -p typescript@7 intentset ...";
|
|
21
39
|
const where = scope.map((pattern) => `\`${pattern}\``).join(", ");
|
|
22
40
|
const sections = ARTIFACT_TYPES.map((type) => `| ${type} | ${REQUIRED_SECTIONS[type].map((section) => `## ${section}`).join(", ")} |`);
|
|
23
41
|
return `# Keeping the product model current
|
|
24
42
|
|
|
25
|
-
This repository keeps an Intentset product model: one Markdown file per product
|
|
26
|
-
contract, decision, verification and knowledge article, under ${where}. The records
|
|
27
|
-
|
|
43
|
+
This repository keeps an Intentset product model: one Markdown file per product intent, outcome, measure, capability,
|
|
44
|
+
behavior, rule, scenario, slice, contract, decision, verification and knowledge article, under ${where}. The records
|
|
45
|
+
say why the product is changing, what the change should produce and how that will be measured, what the product
|
|
46
|
+
promises, which code delivers it and how it is checked. You keep them true as part of every change, in the same commit as the
|
|
28
47
|
code, so that people can review what the product does without reading every line of what changed.
|
|
29
48
|
|
|
30
49
|
Written by \`intentset init\` (${TOOL.name} ${TOOL.version}). To refresh it, delete it and run
|
|
31
|
-
|
|
50
|
+
\`${run} init --agents\`.
|
|
32
51
|
|
|
33
52
|
## Before you change code
|
|
34
53
|
|
|
35
54
|
Load what the code you are about to change promises:
|
|
36
55
|
|
|
37
56
|
\`\`\`sh
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
${run} context <a file you will edit>
|
|
58
|
+
${run} context <an ID, such as BEH-...>
|
|
40
59
|
\`\`\`
|
|
41
60
|
|
|
42
61
|
The result is the owning slice, its behaviors, rules, scenarios, contracts, decisions and checks, with their paths.
|
|
@@ -75,22 +94,24 @@ commit answers it. Use it only when no behavior changed: a reviewer reads it as
|
|
|
75
94
|
is not approval.
|
|
76
95
|
- Change an ID or reuse a retired one. Moving or renaming a file keeps its ID; splitting a behavior retires the old
|
|
77
96
|
one with \`replacedBy\`.
|
|
78
|
-
- Name an owner, audience, release, role, edition or
|
|
79
|
-
instead.
|
|
97
|
+
- Name an owner, audience, release, role, edition, flag or evidence source that is not in
|
|
98
|
+
\`.intentset/registries.yaml\`. Ask instead.
|
|
99
|
+
- Treat a passing check as the outcome achieved. Verification says the behavior was built as described; a measure
|
|
100
|
+
says whether building it produced the outcome, and only evidence read in its window answers that.
|
|
80
101
|
- Commit run evidence (\`.intentset/evidence/\`) or an export. They describe one commit and are stale once it lands.
|
|
81
102
|
- Edit generated output: an export, the Atlas, published pages.
|
|
82
103
|
|
|
83
104
|
## Before you finish
|
|
84
105
|
|
|
85
106
|
\`\`\`sh
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
107
|
+
${run} validate
|
|
108
|
+
${run} architecture check # when .intentset/architecture.yaml exists
|
|
109
|
+
${run} review --base main
|
|
89
110
|
\`\`\`
|
|
90
111
|
|
|
91
112
|
Fix every error. Resolve each slice \`review\` lists under "Code changed, records unchanged", by updating its records
|
|
92
113
|
or with the trailer. The architecture check needs TypeScript 7; on an earlier TypeScript, run the toolchain as
|
|
93
|
-
|
|
114
|
+
\`${isolated}\`.
|
|
94
115
|
|
|
95
116
|
## Record format
|
|
96
117
|
|
|
@@ -134,6 +155,37 @@ What must be true first.
|
|
|
134
155
|
Success: what happens. Failure: what is rejected, and what is left unchanged.
|
|
135
156
|
\`\`\`
|
|
136
157
|
|
|
158
|
+
A knowledge record explains behaviors, rules or capabilities to one audience, in that audience's words rather than
|
|
159
|
+
the behavior's. It may carry \`tips\`: one plain sentence per explained ID, at most 160 characters, which the
|
|
160
|
+
product shows beside the control that delivers that behavior once the knowledge is reviewed and published.
|
|
161
|
+
|
|
162
|
+
\`\`\`yaml
|
|
163
|
+
links:
|
|
164
|
+
explains: [BEH-AREA-NAME, RULE-AREA-LIMIT]
|
|
165
|
+
tips:
|
|
166
|
+
BEH-AREA-NAME: What this control does, in one sentence.
|
|
167
|
+
RULE-AREA-LIMIT: The limit, and what happens at it.
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
Above the behaviors sit the reasons for them. An intent says why the product is changing (its Rationale names the
|
|
171
|
+
problem or opportunity), an outcome says what observable change is expected, and a measure under the outcome says
|
|
172
|
+
how that change will be read: a metric, the baseline before the change or the literal \`unknown\`, a target, the
|
|
173
|
+
window in which it is read and the source the evidence comes from, which must be in the registry. An outcome past
|
|
174
|
+
draft needs at least one measure. Write a measure when you add an outcome, before the capabilities under it.
|
|
175
|
+
|
|
176
|
+
\`\`\`yaml
|
|
177
|
+
id: MEAS-AREA-NAME
|
|
178
|
+
type: measure
|
|
179
|
+
parent: OUT-...
|
|
180
|
+
measure:
|
|
181
|
+
metric: median_time_to_intervention
|
|
182
|
+
baseline: 5 days
|
|
183
|
+
target: under 2 days
|
|
184
|
+
window: 90 days after <a release from the registry>
|
|
185
|
+
source: <an evidence source from the registry>
|
|
186
|
+
direction: decrease
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
137
189
|
Each type requires these level-two sections:
|
|
138
190
|
|
|
139
191
|
| Type | Required sections |
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEvD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD,CAAC,WAAW,EAAE,IAAI,gBAAgB,EAAE,CAAC;IACrC,CAAC,WAAW,EAAE,8BAA8B,gBAAgB,iBAAiB,CAAC;CAC/E,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,iB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AAI,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CACjC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAClG,CAAC;IACF,OAAO;;;iGAGwF,KAAK;;;;;iCAKrE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO;IACtD,GAAG;;;;;;;EAOL,GAAG;EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BH,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAsBjB,GAAG;EACH,GAAG;EACH,GAAG;;;;;IAKD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EV,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;CAGpB,CAAC;AACF,CAAC"}
|
package/dist/commands/graph.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intentset graph --format json` (spec/export.md, Core §12): the
|
|
3
|
-
* `intentset/export/0.
|
|
3
|
+
* `intentset/export/0.3` 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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGvC,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAarD;AAED,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGvC,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAarD;AAED,eAAO,MAAM,qBAAqB,QAatB,CAAC;AAEb;;;;GAIG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASzD;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA8C/E"}
|
package/dist/commands/init.js
CHANGED
|
@@ -14,7 +14,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
|
14
14
|
import { basename, dirname, join, resolve } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { compareStrings, DEFAULT_IGNORE, readConfig, readRegistries } from "@intentset/core";
|
|
17
|
-
import { AGENT_GUIDE_PATH, AGENT_POINTERS, agentGuide } from "../agents.js";
|
|
17
|
+
import { AGENT_GUIDE_PATH, AGENT_POINTERS, agentGuide, detectPackageManager } from "../agents.js";
|
|
18
18
|
import { CONFIG_PATH } from "../repository.js";
|
|
19
19
|
export const REGISTRIES_PATH = ".intentset/registries.yaml";
|
|
20
20
|
export const DEFAULT_INIT_SCOPE = "product/**/*.md";
|
|
@@ -38,15 +38,16 @@ export function configText(repository) {
|
|
|
38
38
|
].join("\n");
|
|
39
39
|
}
|
|
40
40
|
export const EMPTY_REGISTRIES_TEXT = [
|
|
41
|
-
"# Intentset registries (Core §4, §7; VSA §3): the owners, audiences, release dimensions",
|
|
42
|
-
"# and shared resources records may name. An empty registry reads as not
|
|
43
|
-
"# validate warns (CORE005) when a record names a value it could not check.",
|
|
41
|
+
"# Intentset registries (Core §4, §6, §7; VSA §3): the owners, audiences, release dimensions,",
|
|
42
|
+
"# evidence sources and shared resources records may name. An empty registry reads as not",
|
|
43
|
+
"# declared, and validate warns (CORE005) when a record names a value it could not check.",
|
|
44
44
|
"owners: []",
|
|
45
45
|
"audiences: []",
|
|
46
46
|
"releases: []",
|
|
47
47
|
"roles: []",
|
|
48
48
|
"editions: []",
|
|
49
49
|
"flags: []",
|
|
50
|
+
"evidenceSources: []",
|
|
50
51
|
"resources: []",
|
|
51
52
|
"",
|
|
52
53
|
].join("\n");
|
|
@@ -95,7 +96,7 @@ export async function initCommand(options, io) {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
files.set(REGISTRIES_PATH, registries);
|
|
98
|
-
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE]));
|
|
99
|
+
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE], managerAt(root)));
|
|
99
100
|
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
100
101
|
const config = readConfig(files.get(CONFIG_PATH), CONFIG_PATH);
|
|
101
102
|
const registry = readRegistries(registries, REGISTRIES_PATH);
|
|
@@ -119,11 +120,19 @@ function writeGuideOnly(root, io) {
|
|
|
119
120
|
if (diagnostics.length === 0 && config.scope.length > 0)
|
|
120
121
|
scope = config.scope;
|
|
121
122
|
}
|
|
122
|
-
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope)]]), io))
|
|
123
|
+
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope, managerAt(root))]]), io))
|
|
123
124
|
return 2;
|
|
124
125
|
pointers(io);
|
|
125
126
|
return 0;
|
|
126
127
|
}
|
|
128
|
+
/** The package manager the repository at root uses, so the guide's commands are ones it can run. */
|
|
129
|
+
function managerAt(root) {
|
|
130
|
+
const packageJson = join(root, "package.json");
|
|
131
|
+
return detectPackageManager({
|
|
132
|
+
has: (path) => existsSync(join(root, path)),
|
|
133
|
+
packageJson: existsSync(packageJson) ? readFileSync(packageJson, "utf8") : null,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
127
136
|
/** Create every file or none: refuse if any exists, then write each with exclusive create. */
|
|
128
137
|
function create(root, files, io) {
|
|
129
138
|
const ordered = [...files.keys()].sort(compareStrings);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":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,IAAI,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,MAAM,CAAC,oCAAoC,IAAI,KAAM,KAAe,CAAC,OAAO,IAAI,CAAC,CAAC;YACrF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,EAAE,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,+HAA+H;AAC/H,SAAS,QAAQ,CAAC,EAAM;IACtB,EAAE,CAAC,MAAM,CAAC,iCAAiC,gBAAgB,yCAAyC,CAAC,CAAC;IACtG,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,cAAc;QAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAeA,OAAO,EAA2B,KAAK,EAAE,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAM7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CA4E3F"}
|
package/dist/commands/publish.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intentset publish` (Core §9): the deny-by-default projection of reviewed
|
|
3
3
|
* knowledge for one audience, release and entitlement, as generated Markset
|
|
4
|
-
* with provenance, optional HTML, the index a customer tool may read,
|
|
5
|
-
*
|
|
4
|
+
* with provenance, optional HTML, the index a customer tool may read, the
|
|
5
|
+
* help file a product's runtime reads, and retrieval chunks that carry the
|
|
6
|
+
* same filters. Refuses outright when the
|
|
6
7
|
* graph does not validate. Review pins are read as written: a real pin is a
|
|
7
8
|
* literal hash, and the fixtures' `@current` is never bound here, so an
|
|
8
9
|
* unbound one reads as changed. Writes only into the --out directory, which
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
import { existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
12
13
|
import { join, resolve } from "node:path";
|
|
13
14
|
import { sortDiagnostics } from "@intentset/core";
|
|
14
|
-
import { publish, toChunks } from "@intentset/publisher";
|
|
15
|
+
import { HELP_FILE, publish, toChunks } from "@intentset/publisher";
|
|
15
16
|
import { count, formatDiagnostic } from "../output.js";
|
|
16
17
|
import { outputDirProblem, outputProblem } from "../outputs.js";
|
|
17
18
|
const ISO_8601 = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]+)?(?:Z|[+-][0-9]{2}:[0-9]{2})$/;
|
|
@@ -67,6 +68,7 @@ export function publishCommand(session, options, io) {
|
|
|
67
68
|
outputs.set(`${document.id}.html`, document.html);
|
|
68
69
|
}
|
|
69
70
|
outputs.set("index.json", `${JSON.stringify(published.index, null, 2)}\n`);
|
|
71
|
+
outputs.set(HELP_FILE, `${JSON.stringify(published.help, null, 2)}\n`);
|
|
70
72
|
const chunks = toChunks(published.documents);
|
|
71
73
|
outputs.set("chunks.jsonl", chunks.map((chunk) => `${JSON.stringify(chunk)}\n`).join(""));
|
|
72
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAmB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,SAAS,EAA2B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAkBhE,MAAM,QAAQ,GAAG,iGAAiG,CAAC;AAEnH,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAC5D,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,KAAK,EAAE;QAAE,OAAO,yBA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AC,CAAC,CAAC,UAAU,QAAQ,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC,SAAS,EAAE,EAChJ,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAa,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/intentset.js
CHANGED
|
File without changes
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Io } from "./output.ts";
|
|
2
2
|
export type { Io } from "./output.ts";
|
|
3
|
-
export declare const USAGE = "usage: intentset <command> [options]\n\ncommands\n init [--repository <name>] [--example] [--agents]\n create .intentset/config.yaml, an empty .intentset/registries.yaml and\n .intentset/agents.md, the guide that tells coding agents how to keep the\n model current; --example adds the scheduling example under\n product/scheduling/; --agents writes only the guide, for a repository\n already initialized. 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>] [--report evidence|knowledge|impact|ownership|all]...\n [--include-restricted]\n print the intentset/export/0.
|
|
3
|
+
export declare const USAGE = "usage: intentset <command> [options]\n\ncommands\n init [--repository <name>] [--example] [--agents]\n create .intentset/config.yaml, an empty .intentset/registries.yaml and\n .intentset/agents.md, the guide that tells coding agents how to keep the\n model current; --example adds the scheduling example under\n product/scheduling/; --agents writes only the guide, for a repository\n already initialized. 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>] [--report evidence|knowledge|impact|ownership|all]...\n [--include-restricted]\n print the intentset/export/0.3 envelope, or write it to --out;\n each --report adds a section (ownership needs L2, evidence L3; all\n is every one the level reads). Restricted artifacts are withheld\n and counted unless --include-restricted\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|path> [--include-restricted]\n the bounded engineering context of an artifact, with paths and bodies;\n given a file a slice claims, the context of that slice\n review [--base <ref>] [--fail-on-drift]\n the local review report: checks, coverage, the impact of what changed,\n and each slice whose code changed while its records did not;\n --fail-on-drift exits 1 for any such slice no commit acknowledged with\n an Intentset-Unchanged trailer\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 (or, with review --fail-on-drift, unacknowledged drift),\n 2 invocation or tool failure";
|
|
4
4
|
export declare function main(argv: string[], io: Io): Promise<number>;
|
|
5
5
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.js
CHANGED
|
@@ -37,7 +37,7 @@ commands
|
|
|
37
37
|
graph [--format json] [--include-bodies] [--release <product>:<label>] [--out <file>]
|
|
38
38
|
[--generated-at <time>] [--report evidence|knowledge|impact|ownership|all]...
|
|
39
39
|
[--include-restricted]
|
|
40
|
-
print the intentset/export/0.
|
|
40
|
+
print the intentset/export/0.3 envelope, or write it to --out;
|
|
41
41
|
each --report adds a section (ownership needs L2, evidence L3; all
|
|
42
42
|
is every one the level reads). Restricted artifacts are withheld
|
|
43
43
|
and counted unless --include-restricted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentset/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The intentset command: validate, graph, architecture check, evidence, impact, review, publish, serve, context, mcp.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"intentset": "./dist/intentset.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@intentset/core": "^0.
|
|
35
|
-
"@intentset/markset-adapter": "^0.
|
|
36
|
-
"@intentset/architecture": "^0.
|
|
37
|
-
"@intentset/verification": "^0.
|
|
38
|
-
"@intentset/publisher": "^0.
|
|
39
|
-
"@intentset/atlas": "^0.
|
|
40
|
-
"@intentset/mcp": "^0.
|
|
41
|
-
"@intentset/conformance-suite": "^0.
|
|
34
|
+
"@intentset/core": "^0.6.0",
|
|
35
|
+
"@intentset/markset-adapter": "^0.6.0",
|
|
36
|
+
"@intentset/architecture": "^0.6.0",
|
|
37
|
+
"@intentset/verification": "^0.6.0",
|
|
38
|
+
"@intentset/publisher": "^0.6.0",
|
|
39
|
+
"@intentset/atlas": "^0.6.0",
|
|
40
|
+
"@intentset/mcp": "^0.6.0",
|
|
41
|
+
"@intentset/conformance-suite": "^0.6.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.32.0"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|
package/src/agents.ts
CHANGED
|
@@ -20,28 +20,52 @@ export const AGENT_POINTERS: Array<[string, string]> = [
|
|
|
20
20
|
["AGENTS.md", `Before changing code, read ${AGENT_GUIDE_PATH} and follow it.`],
|
|
21
21
|
];
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/** How the guide runs the CLI: through the package manager the repository uses. */
|
|
24
|
+
export type PackageManager = "npm" | "pnpm";
|
|
25
|
+
|
|
26
|
+
/** pnpm when the repository says so (its lockfile, workspace file or packageManager field), npm otherwise. */
|
|
27
|
+
export function detectPackageManager(files: {
|
|
28
|
+
has(path: string): boolean;
|
|
29
|
+
packageJson: string | null;
|
|
30
|
+
}): PackageManager {
|
|
31
|
+
if (files.has("pnpm-lock.yaml") || files.has("pnpm-workspace.yaml")) return "pnpm";
|
|
32
|
+
try {
|
|
33
|
+
const manager = (JSON.parse(files.packageJson ?? "{}") as { packageManager?: unknown }).packageManager;
|
|
34
|
+
if (typeof manager === "string" && manager.startsWith("pnpm@")) return "pnpm";
|
|
35
|
+
} catch {
|
|
36
|
+
// An unreadable package.json says nothing about the package manager.
|
|
37
|
+
}
|
|
38
|
+
return "npm";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function agentGuide(scope: readonly string[], manager: PackageManager = "npm"): string {
|
|
42
|
+
const run = manager === "pnpm" ? "pnpm exec intentset" : "npx intentset";
|
|
43
|
+
const isolated =
|
|
44
|
+
manager === "pnpm"
|
|
45
|
+
? "pnpm dlx --package=@intentset/cli --package=typescript@7 intentset ..."
|
|
46
|
+
: "npx -p @intentset/cli -p typescript@7 intentset ...";
|
|
24
47
|
const where = scope.map((pattern) => `\`${pattern}\``).join(", ");
|
|
25
48
|
const sections = ARTIFACT_TYPES.map(
|
|
26
49
|
(type) => `| ${type} | ${REQUIRED_SECTIONS[type].map((section) => `## ${section}`).join(", ")} |`,
|
|
27
50
|
);
|
|
28
51
|
return `# Keeping the product model current
|
|
29
52
|
|
|
30
|
-
This repository keeps an Intentset product model: one Markdown file per product
|
|
31
|
-
contract, decision, verification and knowledge article, under ${where}. The records
|
|
32
|
-
|
|
53
|
+
This repository keeps an Intentset product model: one Markdown file per product intent, outcome, measure, capability,
|
|
54
|
+
behavior, rule, scenario, slice, contract, decision, verification and knowledge article, under ${where}. The records
|
|
55
|
+
say why the product is changing, what the change should produce and how that will be measured, what the product
|
|
56
|
+
promises, which code delivers it and how it is checked. You keep them true as part of every change, in the same commit as the
|
|
33
57
|
code, so that people can review what the product does without reading every line of what changed.
|
|
34
58
|
|
|
35
59
|
Written by \`intentset init\` (${TOOL.name} ${TOOL.version}). To refresh it, delete it and run
|
|
36
|
-
|
|
60
|
+
\`${run} init --agents\`.
|
|
37
61
|
|
|
38
62
|
## Before you change code
|
|
39
63
|
|
|
40
64
|
Load what the code you are about to change promises:
|
|
41
65
|
|
|
42
66
|
\`\`\`sh
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
${run} context <a file you will edit>
|
|
68
|
+
${run} context <an ID, such as BEH-...>
|
|
45
69
|
\`\`\`
|
|
46
70
|
|
|
47
71
|
The result is the owning slice, its behaviors, rules, scenarios, contracts, decisions and checks, with their paths.
|
|
@@ -80,22 +104,24 @@ commit answers it. Use it only when no behavior changed: a reviewer reads it as
|
|
|
80
104
|
is not approval.
|
|
81
105
|
- Change an ID or reuse a retired one. Moving or renaming a file keeps its ID; splitting a behavior retires the old
|
|
82
106
|
one with \`replacedBy\`.
|
|
83
|
-
- Name an owner, audience, release, role, edition or
|
|
84
|
-
instead.
|
|
107
|
+
- Name an owner, audience, release, role, edition, flag or evidence source that is not in
|
|
108
|
+
\`.intentset/registries.yaml\`. Ask instead.
|
|
109
|
+
- Treat a passing check as the outcome achieved. Verification says the behavior was built as described; a measure
|
|
110
|
+
says whether building it produced the outcome, and only evidence read in its window answers that.
|
|
85
111
|
- Commit run evidence (\`.intentset/evidence/\`) or an export. They describe one commit and are stale once it lands.
|
|
86
112
|
- Edit generated output: an export, the Atlas, published pages.
|
|
87
113
|
|
|
88
114
|
## Before you finish
|
|
89
115
|
|
|
90
116
|
\`\`\`sh
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
${run} validate
|
|
118
|
+
${run} architecture check # when .intentset/architecture.yaml exists
|
|
119
|
+
${run} review --base main
|
|
94
120
|
\`\`\`
|
|
95
121
|
|
|
96
122
|
Fix every error. Resolve each slice \`review\` lists under "Code changed, records unchanged", by updating its records
|
|
97
123
|
or with the trailer. The architecture check needs TypeScript 7; on an earlier TypeScript, run the toolchain as
|
|
98
|
-
|
|
124
|
+
\`${isolated}\`.
|
|
99
125
|
|
|
100
126
|
## Record format
|
|
101
127
|
|
|
@@ -139,6 +165,37 @@ What must be true first.
|
|
|
139
165
|
Success: what happens. Failure: what is rejected, and what is left unchanged.
|
|
140
166
|
\`\`\`
|
|
141
167
|
|
|
168
|
+
A knowledge record explains behaviors, rules or capabilities to one audience, in that audience's words rather than
|
|
169
|
+
the behavior's. It may carry \`tips\`: one plain sentence per explained ID, at most 160 characters, which the
|
|
170
|
+
product shows beside the control that delivers that behavior once the knowledge is reviewed and published.
|
|
171
|
+
|
|
172
|
+
\`\`\`yaml
|
|
173
|
+
links:
|
|
174
|
+
explains: [BEH-AREA-NAME, RULE-AREA-LIMIT]
|
|
175
|
+
tips:
|
|
176
|
+
BEH-AREA-NAME: What this control does, in one sentence.
|
|
177
|
+
RULE-AREA-LIMIT: The limit, and what happens at it.
|
|
178
|
+
\`\`\`
|
|
179
|
+
|
|
180
|
+
Above the behaviors sit the reasons for them. An intent says why the product is changing (its Rationale names the
|
|
181
|
+
problem or opportunity), an outcome says what observable change is expected, and a measure under the outcome says
|
|
182
|
+
how that change will be read: a metric, the baseline before the change or the literal \`unknown\`, a target, the
|
|
183
|
+
window in which it is read and the source the evidence comes from, which must be in the registry. An outcome past
|
|
184
|
+
draft needs at least one measure. Write a measure when you add an outcome, before the capabilities under it.
|
|
185
|
+
|
|
186
|
+
\`\`\`yaml
|
|
187
|
+
id: MEAS-AREA-NAME
|
|
188
|
+
type: measure
|
|
189
|
+
parent: OUT-...
|
|
190
|
+
measure:
|
|
191
|
+
metric: median_time_to_intervention
|
|
192
|
+
baseline: 5 days
|
|
193
|
+
target: under 2 days
|
|
194
|
+
window: 90 days after <a release from the registry>
|
|
195
|
+
source: <an evidence source from the registry>
|
|
196
|
+
direction: decrease
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
142
199
|
Each type requires these level-two sections:
|
|
143
200
|
|
|
144
201
|
| Type | Required sections |
|
package/src/commands/graph.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intentset graph --format json` (spec/export.md, Core §12): the
|
|
3
|
-
* `intentset/export/0.
|
|
3
|
+
* `intentset/export/0.3` 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
|
package/src/commands/init.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
|
14
14
|
import { basename, dirname, join, resolve } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { compareStrings, DEFAULT_IGNORE, readConfig, readRegistries } from "@intentset/core";
|
|
17
|
-
import { AGENT_GUIDE_PATH, AGENT_POINTERS, agentGuide } from "../agents.ts";
|
|
17
|
+
import { AGENT_GUIDE_PATH, AGENT_POINTERS, agentGuide, detectPackageManager } from "../agents.ts";
|
|
18
18
|
import type { Io } from "../output.ts";
|
|
19
19
|
import { CONFIG_PATH } from "../repository.ts";
|
|
20
20
|
|
|
@@ -51,15 +51,16 @@ export function configText(repository: string): string {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export const EMPTY_REGISTRIES_TEXT = [
|
|
54
|
-
"# Intentset registries (Core §4, §7; VSA §3): the owners, audiences, release dimensions",
|
|
55
|
-
"# and shared resources records may name. An empty registry reads as not
|
|
56
|
-
"# validate warns (CORE005) when a record names a value it could not check.",
|
|
54
|
+
"# Intentset registries (Core §4, §6, §7; VSA §3): the owners, audiences, release dimensions,",
|
|
55
|
+
"# evidence sources and shared resources records may name. An empty registry reads as not",
|
|
56
|
+
"# declared, and validate warns (CORE005) when a record names a value it could not check.",
|
|
57
57
|
"owners: []",
|
|
58
58
|
"audiences: []",
|
|
59
59
|
"releases: []",
|
|
60
60
|
"roles: []",
|
|
61
61
|
"editions: []",
|
|
62
62
|
"flags: []",
|
|
63
|
+
"evidenceSources: []",
|
|
63
64
|
"resources: []",
|
|
64
65
|
"",
|
|
65
66
|
].join("\n");
|
|
@@ -111,7 +112,7 @@ export async function initCommand(options: InitOptions, io: Io): Promise<number>
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
files.set(REGISTRIES_PATH, registries);
|
|
114
|
-
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE]));
|
|
115
|
+
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE], managerAt(root)));
|
|
115
116
|
|
|
116
117
|
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
117
118
|
const config = readConfig(files.get(CONFIG_PATH) as string, CONFIG_PATH);
|
|
@@ -136,11 +137,20 @@ function writeGuideOnly(root: string, io: Io): number {
|
|
|
136
137
|
const { config, diagnostics } = readConfig(readFileSync(configFile, "utf8"), CONFIG_PATH);
|
|
137
138
|
if (diagnostics.length === 0 && config.scope.length > 0) scope = config.scope;
|
|
138
139
|
}
|
|
139
|
-
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope)]]), io)) return 2;
|
|
140
|
+
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope, managerAt(root))]]), io)) return 2;
|
|
140
141
|
pointers(io);
|
|
141
142
|
return 0;
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
/** The package manager the repository at root uses, so the guide's commands are ones it can run. */
|
|
146
|
+
function managerAt(root: string) {
|
|
147
|
+
const packageJson = join(root, "package.json");
|
|
148
|
+
return detectPackageManager({
|
|
149
|
+
has: (path) => existsSync(join(root, path)),
|
|
150
|
+
packageJson: existsSync(packageJson) ? readFileSync(packageJson, "utf8") : null,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
144
154
|
/** Create every file or none: refuse if any exists, then write each with exclusive create. */
|
|
145
155
|
function create(root: string, files: Map<string, string>, io: Io): boolean {
|
|
146
156
|
const ordered = [...files.keys()].sort(compareStrings);
|
package/src/commands/publish.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intentset publish` (Core §9): the deny-by-default projection of reviewed
|
|
3
3
|
* knowledge for one audience, release and entitlement, as generated Markset
|
|
4
|
-
* with provenance, optional HTML, the index a customer tool may read,
|
|
5
|
-
*
|
|
4
|
+
* with provenance, optional HTML, the index a customer tool may read, the
|
|
5
|
+
* help file a product's runtime reads, and retrieval chunks that carry the
|
|
6
|
+
* same filters. Refuses outright when the
|
|
6
7
|
* graph does not validate. Review pins are read as written: a real pin is a
|
|
7
8
|
* literal hash, and the fixtures' `@current` is never bound here, so an
|
|
8
9
|
* unbound one reads as changed. Writes only into the --out directory, which
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
import { existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
12
13
|
import { join, resolve } from "node:path";
|
|
13
14
|
import { type Visibility, sortDiagnostics } from "@intentset/core";
|
|
14
|
-
import { type PublicationRequest, publish, toChunks } from "@intentset/publisher";
|
|
15
|
+
import { HELP_FILE, type PublicationRequest, publish, toChunks } from "@intentset/publisher";
|
|
15
16
|
import { count, formatDiagnostic, type Io } from "../output.ts";
|
|
16
17
|
import { outputDirProblem, outputProblem } from "../outputs.ts";
|
|
17
18
|
import type { Session } from "../session.ts";
|
|
@@ -86,6 +87,7 @@ export function publishCommand(session: Session, options: PublishCliOptions, io:
|
|
|
86
87
|
if (document.html !== undefined) outputs.set(`${document.id}.html`, document.html);
|
|
87
88
|
}
|
|
88
89
|
outputs.set("index.json", `${JSON.stringify(published.index, null, 2)}\n`);
|
|
90
|
+
outputs.set(HELP_FILE, `${JSON.stringify(published.help, null, 2)}\n`);
|
|
89
91
|
const chunks = toChunks(published.documents);
|
|
90
92
|
outputs.set("chunks.jsonl", chunks.map((chunk) => `${JSON.stringify(chunk)}\n`).join(""));
|
|
91
93
|
}
|
package/src/main.ts
CHANGED
|
@@ -43,7 +43,7 @@ commands
|
|
|
43
43
|
graph [--format json] [--include-bodies] [--release <product>:<label>] [--out <file>]
|
|
44
44
|
[--generated-at <time>] [--report evidence|knowledge|impact|ownership|all]...
|
|
45
45
|
[--include-restricted]
|
|
46
|
-
print the intentset/export/0.
|
|
46
|
+
print the intentset/export/0.3 envelope, or write it to --out;
|
|
47
47
|
each --report adds a section (ownership needs L2, evidence L3; all
|
|
48
48
|
is every one the level reads). Restricted artifacts are withheld
|
|
49
49
|
and counted unless --include-restricted
|