@intentset/cli 0.4.0 → 0.5.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 +38 -8
- package/dist/agents.js.map +1 -1
- package/dist/commands/init.js +11 -3
- 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/package.json +10 -10
- package/src/agents.ts +43 -8
- package/src/commands/init.ts +12 -3
- package/src/commands/publish.ts +5 -3
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,CAgJ5F"}
|
package/dist/agents.js
CHANGED
|
@@ -17,7 +17,25 @@ 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
|
|
@@ -28,15 +46,15 @@ which code delivers it and how it is checked. You keep them true as part of ever
|
|
|
28
46
|
code, so that people can review what the product does without reading every line of what changed.
|
|
29
47
|
|
|
30
48
|
Written by \`intentset init\` (${TOOL.name} ${TOOL.version}). To refresh it, delete it and run
|
|
31
|
-
|
|
49
|
+
\`${run} init --agents\`.
|
|
32
50
|
|
|
33
51
|
## Before you change code
|
|
34
52
|
|
|
35
53
|
Load what the code you are about to change promises:
|
|
36
54
|
|
|
37
55
|
\`\`\`sh
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
${run} context <a file you will edit>
|
|
57
|
+
${run} context <an ID, such as BEH-...>
|
|
40
58
|
\`\`\`
|
|
41
59
|
|
|
42
60
|
The result is the owning slice, its behaviors, rules, scenarios, contracts, decisions and checks, with their paths.
|
|
@@ -83,14 +101,14 @@ commit answers it. Use it only when no behavior changed: a reviewer reads it as
|
|
|
83
101
|
## Before you finish
|
|
84
102
|
|
|
85
103
|
\`\`\`sh
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
104
|
+
${run} validate
|
|
105
|
+
${run} architecture check # when .intentset/architecture.yaml exists
|
|
106
|
+
${run} review --base main
|
|
89
107
|
\`\`\`
|
|
90
108
|
|
|
91
109
|
Fix every error. Resolve each slice \`review\` lists under "Code changed, records unchanged", by updating its records
|
|
92
110
|
or with the trailer. The architecture check needs TypeScript 7; on an earlier TypeScript, run the toolchain as
|
|
93
|
-
|
|
111
|
+
\`${isolated}\`.
|
|
94
112
|
|
|
95
113
|
## Record format
|
|
96
114
|
|
|
@@ -134,6 +152,18 @@ What must be true first.
|
|
|
134
152
|
Success: what happens. Failure: what is rejected, and what is left unchanged.
|
|
135
153
|
\`\`\`
|
|
136
154
|
|
|
155
|
+
A knowledge record explains behaviors, rules or capabilities to one audience, in that audience's words rather than
|
|
156
|
+
the behavior's. It may carry \`tips\`: one plain sentence per explained ID, at most 160 characters, which the
|
|
157
|
+
product shows beside the control that delivers that behavior once the knowledge is reviewed and published.
|
|
158
|
+
|
|
159
|
+
\`\`\`yaml
|
|
160
|
+
links:
|
|
161
|
+
explains: [BEH-AREA-NAME, RULE-AREA-LIMIT]
|
|
162
|
+
tips:
|
|
163
|
+
BEH-AREA-NAME: What this control does, in one sentence.
|
|
164
|
+
RULE-AREA-LIMIT: The limit, and what happens at it.
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
137
167
|
Each type requires these level-two sections:
|
|
138
168
|
|
|
139
169
|
| 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,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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AC,MAAM,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAClG,CAAC;IACF,OAAO;;;gEAGuD,KAAK;;;;iCAIpC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO;IACtD,GAAG;;;;;;;EAOL,GAAG;EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BH,iBAAiB;;;;;;;;;;;;;;;;;;;;EAoBjB,GAAG;EACH,GAAG;EACH,GAAG;;;;;IAKD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DV,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;CAGpB,CAAC;AACF,CAAC"}
|
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";
|
|
@@ -95,7 +95,7 @@ export async function initCommand(options, io) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
files.set(REGISTRIES_PATH, registries);
|
|
98
|
-
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE]));
|
|
98
|
+
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE], managerAt(root)));
|
|
99
99
|
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
100
100
|
const config = readConfig(files.get(CONFIG_PATH), CONFIG_PATH);
|
|
101
101
|
const registry = readRegistries(registries, REGISTRIES_PATH);
|
|
@@ -119,11 +119,19 @@ function writeGuideOnly(root, io) {
|
|
|
119
119
|
if (diagnostics.length === 0 && config.scope.length > 0)
|
|
120
120
|
scope = config.scope;
|
|
121
121
|
}
|
|
122
|
-
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope)]]), io))
|
|
122
|
+
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope, managerAt(root))]]), io))
|
|
123
123
|
return 2;
|
|
124
124
|
pointers(io);
|
|
125
125
|
return 0;
|
|
126
126
|
}
|
|
127
|
+
/** The package manager the repository at root uses, so the guide's commands are ones it can run. */
|
|
128
|
+
function managerAt(root) {
|
|
129
|
+
const packageJson = join(root, "package.json");
|
|
130
|
+
return detectPackageManager({
|
|
131
|
+
has: (path) => existsSync(join(root, path)),
|
|
132
|
+
packageJson: existsSync(packageJson) ? readFileSync(packageJson, "utf8") : null,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
127
135
|
/** Create every file or none: refuse if any exists, then write each with exclusive create. */
|
|
128
136
|
function create(root, files, io) {
|
|
129
137
|
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,C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ACf,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,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,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,IAAI,CAAC,IAAI,CAAC,GAAG,EACnK,aAAa,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,cAAc,QAAQ,CAAC,iBAAiB,GAAG,CAAC,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentset/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.5.0",
|
|
35
|
+
"@intentset/markset-adapter": "^0.5.0",
|
|
36
|
+
"@intentset/architecture": "^0.5.0",
|
|
37
|
+
"@intentset/verification": "^0.5.0",
|
|
38
|
+
"@intentset/publisher": "^0.5.0",
|
|
39
|
+
"@intentset/atlas": "^0.5.0",
|
|
40
|
+
"@intentset/mcp": "^0.5.0",
|
|
41
|
+
"@intentset/conformance-suite": "^0.5.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.32.0"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|
package/src/agents.ts
CHANGED
|
@@ -20,7 +20,30 @@ 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(", ")} |`,
|
|
@@ -33,15 +56,15 @@ which code delivers it and how it is checked. You keep them true as part of ever
|
|
|
33
56
|
code, so that people can review what the product does without reading every line of what changed.
|
|
34
57
|
|
|
35
58
|
Written by \`intentset init\` (${TOOL.name} ${TOOL.version}). To refresh it, delete it and run
|
|
36
|
-
|
|
59
|
+
\`${run} init --agents\`.
|
|
37
60
|
|
|
38
61
|
## Before you change code
|
|
39
62
|
|
|
40
63
|
Load what the code you are about to change promises:
|
|
41
64
|
|
|
42
65
|
\`\`\`sh
|
|
43
|
-
|
|
44
|
-
|
|
66
|
+
${run} context <a file you will edit>
|
|
67
|
+
${run} context <an ID, such as BEH-...>
|
|
45
68
|
\`\`\`
|
|
46
69
|
|
|
47
70
|
The result is the owning slice, its behaviors, rules, scenarios, contracts, decisions and checks, with their paths.
|
|
@@ -88,14 +111,14 @@ commit answers it. Use it only when no behavior changed: a reviewer reads it as
|
|
|
88
111
|
## Before you finish
|
|
89
112
|
|
|
90
113
|
\`\`\`sh
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
${run} validate
|
|
115
|
+
${run} architecture check # when .intentset/architecture.yaml exists
|
|
116
|
+
${run} review --base main
|
|
94
117
|
\`\`\`
|
|
95
118
|
|
|
96
119
|
Fix every error. Resolve each slice \`review\` lists under "Code changed, records unchanged", by updating its records
|
|
97
120
|
or with the trailer. The architecture check needs TypeScript 7; on an earlier TypeScript, run the toolchain as
|
|
98
|
-
|
|
121
|
+
\`${isolated}\`.
|
|
99
122
|
|
|
100
123
|
## Record format
|
|
101
124
|
|
|
@@ -139,6 +162,18 @@ What must be true first.
|
|
|
139
162
|
Success: what happens. Failure: what is rejected, and what is left unchanged.
|
|
140
163
|
\`\`\`
|
|
141
164
|
|
|
165
|
+
A knowledge record explains behaviors, rules or capabilities to one audience, in that audience's words rather than
|
|
166
|
+
the behavior's. It may carry \`tips\`: one plain sentence per explained ID, at most 160 characters, which the
|
|
167
|
+
product shows beside the control that delivers that behavior once the knowledge is reviewed and published.
|
|
168
|
+
|
|
169
|
+
\`\`\`yaml
|
|
170
|
+
links:
|
|
171
|
+
explains: [BEH-AREA-NAME, RULE-AREA-LIMIT]
|
|
172
|
+
tips:
|
|
173
|
+
BEH-AREA-NAME: What this control does, in one sentence.
|
|
174
|
+
RULE-AREA-LIMIT: The limit, and what happens at it.
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
142
177
|
Each type requires these level-two sections:
|
|
143
178
|
|
|
144
179
|
| Type | Required sections |
|
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
|
|
|
@@ -111,7 +111,7 @@ export async function initCommand(options: InitOptions, io: Io): Promise<number>
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
files.set(REGISTRIES_PATH, registries);
|
|
114
|
-
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE]));
|
|
114
|
+
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE], managerAt(root)));
|
|
115
115
|
|
|
116
116
|
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
117
117
|
const config = readConfig(files.get(CONFIG_PATH) as string, CONFIG_PATH);
|
|
@@ -136,11 +136,20 @@ function writeGuideOnly(root: string, io: Io): number {
|
|
|
136
136
|
const { config, diagnostics } = readConfig(readFileSync(configFile, "utf8"), CONFIG_PATH);
|
|
137
137
|
if (diagnostics.length === 0 && config.scope.length > 0) scope = config.scope;
|
|
138
138
|
}
|
|
139
|
-
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope)]]), io)) return 2;
|
|
139
|
+
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope, managerAt(root))]]), io)) return 2;
|
|
140
140
|
pointers(io);
|
|
141
141
|
return 0;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/** The package manager the repository at root uses, so the guide's commands are ones it can run. */
|
|
145
|
+
function managerAt(root: string) {
|
|
146
|
+
const packageJson = join(root, "package.json");
|
|
147
|
+
return detectPackageManager({
|
|
148
|
+
has: (path) => existsSync(join(root, path)),
|
|
149
|
+
packageJson: existsSync(packageJson) ? readFileSync(packageJson, "utf8") : null,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
/** Create every file or none: refuse if any exists, then write each with exclusive create. */
|
|
145
154
|
function create(root: string, files: Map<string, string>, io: Io): boolean {
|
|
146
155
|
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
|
}
|