@intentset/cli 0.3.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 +12 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +176 -0
- package/dist/agents.js.map +1 -0
- package/dist/commands/context.d.ts +14 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +34 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +52 -10
- 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/commands/review.d.ts +20 -0
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +52 -8
- package/dist/commands/review.js.map +1 -1
- package/dist/git.d.ts +8 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +15 -0
- package/dist/git.js.map +1 -1
- package/dist/intentset.js +0 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +25 -13
- package/dist/main.js.map +1 -1
- package/dist/slices.d.ts +24 -0
- package/dist/slices.d.ts.map +1 -0
- package/dist/slices.js +48 -0
- package/dist/slices.js.map +1 -0
- package/package.json +10 -10
- package/src/agents.ts +185 -0
- package/src/commands/context.ts +39 -1
- package/src/commands/init.ts +54 -10
- package/src/commands/publish.ts +5 -3
- package/src/commands/review.ts +66 -9
- package/src/git.ts +15 -0
- package/src/main.ts +33 -13
- package/src/slices.ts +54 -0
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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const AGENT_GUIDE_PATH = ".intentset/agents.md";
|
|
2
|
+
/** The lines a repository adds so its agents read the guide, by the file that takes each. */
|
|
3
|
+
export declare const AGENT_POINTERS: Array<[string, string]>;
|
|
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;
|
|
12
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +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,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
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent guide `intentset init` writes to `.intentset/agents.md`: what a
|
|
3
|
+
* coding agent does, before and after it changes code, to keep the model
|
|
4
|
+
* current (Core §10: load the owning slice first, update affected semantics
|
|
5
|
+
* and checks in the same review, never self-approve). A repository points its
|
|
6
|
+
* agents at it from AGENTS.md or CLAUDE.md.
|
|
7
|
+
*
|
|
8
|
+
* Generated rather than copied, so the commands, the required sections and
|
|
9
|
+
* the trailer can never disagree with the toolchain that wrote it.
|
|
10
|
+
*/
|
|
11
|
+
import { ARTIFACT_TYPES, REQUIRED_SECTIONS } from "@intentset/core";
|
|
12
|
+
import { UNCHANGED_TRAILER } from "./git.js";
|
|
13
|
+
import { TOOL } from "./output.js";
|
|
14
|
+
export const AGENT_GUIDE_PATH = ".intentset/agents.md";
|
|
15
|
+
/** The lines a repository adds so its agents read the guide, by the file that takes each. */
|
|
16
|
+
export const AGENT_POINTERS = [
|
|
17
|
+
["CLAUDE.md", `@${AGENT_GUIDE_PATH}`],
|
|
18
|
+
["AGENTS.md", `Before changing code, read ${AGENT_GUIDE_PATH} and follow it.`],
|
|
19
|
+
];
|
|
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 ...";
|
|
39
|
+
const where = scope.map((pattern) => `\`${pattern}\``).join(", ");
|
|
40
|
+
const sections = ARTIFACT_TYPES.map((type) => `| ${type} | ${REQUIRED_SECTIONS[type].map((section) => `## ${section}`).join(", ")} |`);
|
|
41
|
+
return `# Keeping the product model current
|
|
42
|
+
|
|
43
|
+
This repository keeps an Intentset product model: one Markdown file per product behavior, rule, scenario, slice,
|
|
44
|
+
contract, decision, verification and knowledge article, under ${where}. The records say what the product promises,
|
|
45
|
+
which code delivers it and how it is checked. You keep them true as part of every change, in the same commit as the
|
|
46
|
+
code, so that people can review what the product does without reading every line of what changed.
|
|
47
|
+
|
|
48
|
+
Written by \`intentset init\` (${TOOL.name} ${TOOL.version}). To refresh it, delete it and run
|
|
49
|
+
\`${run} init --agents\`.
|
|
50
|
+
|
|
51
|
+
## Before you change code
|
|
52
|
+
|
|
53
|
+
Load what the code you are about to change promises:
|
|
54
|
+
|
|
55
|
+
\`\`\`sh
|
|
56
|
+
${run} context <a file you will edit>
|
|
57
|
+
${run} context <an ID, such as BEH-...>
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
The result is the owning slice, its behaviors, rules, scenarios, contracts, decisions and checks, with their paths.
|
|
61
|
+
Keep the change inside that slice, and reach other slices only through the contracts it consumes.
|
|
62
|
+
|
|
63
|
+
## When behavior changes
|
|
64
|
+
|
|
65
|
+
Update the records in the same change as the code.
|
|
66
|
+
|
|
67
|
+
- A changed promise: edit the behavior's Behavior, Preconditions and Outcomes, and the rules and scenarios it
|
|
68
|
+
touches.
|
|
69
|
+
- A new promise: add a behavior record with \`status: draft\`, and add its ID to \`implements\` on the slice that
|
|
70
|
+
delivers it. New rules, scenarios and verifications start as drafts too.
|
|
71
|
+
- New code that no slice claims: add a slice record with \`status: draft\`, its claims and its entrypoints. While a
|
|
72
|
+
slice is a draft, the paths it plans may not exist yet.
|
|
73
|
+
- A changed check: a verification record names the test that checks a claim. Change the test and its record
|
|
74
|
+
together, and add one for a behavior or rule that has none.
|
|
75
|
+
|
|
76
|
+
Write each link once, on the record that points: a behavior is \`governedBy\` its rules, a scenario \`illustrates\`
|
|
77
|
+
a behavior, a slice \`implements\` behaviors, a verification \`verifies\` what it checks. Never write the reverse.
|
|
78
|
+
|
|
79
|
+
## When behavior does not change
|
|
80
|
+
|
|
81
|
+
A refactor changes code and no behavior. Say so in the commit message with a trailer naming each slice:
|
|
82
|
+
|
|
83
|
+
\`\`\`text
|
|
84
|
+
${UNCHANGED_TRAILER}: SLICE-...
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
\`intentset review\` lists every slice whose code changed while its records did not, and this trailer is how a
|
|
88
|
+
commit answers it. Use it only when no behavior changed: a reviewer reads it as your claim.
|
|
89
|
+
|
|
90
|
+
## Never
|
|
91
|
+
|
|
92
|
+
- Set a status to approved, implemented or released, or publish knowledge. People approve, and validation passing
|
|
93
|
+
is not approval.
|
|
94
|
+
- Change an ID or reuse a retired one. Moving or renaming a file keeps its ID; splitting a behavior retires the old
|
|
95
|
+
one with \`replacedBy\`.
|
|
96
|
+
- Name an owner, audience, release, role, edition or flag that is not in \`.intentset/registries.yaml\`. Ask
|
|
97
|
+
instead.
|
|
98
|
+
- Commit run evidence (\`.intentset/evidence/\`) or an export. They describe one commit and are stale once it lands.
|
|
99
|
+
- Edit generated output: an export, the Atlas, published pages.
|
|
100
|
+
|
|
101
|
+
## Before you finish
|
|
102
|
+
|
|
103
|
+
\`\`\`sh
|
|
104
|
+
${run} validate
|
|
105
|
+
${run} architecture check # when .intentset/architecture.yaml exists
|
|
106
|
+
${run} review --base main
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
Fix every error. Resolve each slice \`review\` lists under "Code changed, records unchanged", by updating its records
|
|
110
|
+
or with the trailer. The architecture check needs TypeScript 7; on an earlier TypeScript, run the toolchain as
|
|
111
|
+
\`${isolated}\`.
|
|
112
|
+
|
|
113
|
+
## Record format
|
|
114
|
+
|
|
115
|
+
A record is Markdown with YAML frontmatter under \`intentset:\`, and its level-one heading repeats its title. An
|
|
116
|
+
existing record of the same type in this repository is the best template; a new behavior looks like this, one
|
|
117
|
+
recognizable promise including how it fails:
|
|
118
|
+
|
|
119
|
+
\`\`\`markdown
|
|
120
|
+
---
|
|
121
|
+
markset: 0
|
|
122
|
+
intentset:
|
|
123
|
+
spec: '0.1'
|
|
124
|
+
profile: intentset/behavior/0.1
|
|
125
|
+
id: BEH-AREA-NAME
|
|
126
|
+
type: behavior
|
|
127
|
+
title: The promise in a few words, such as Schedule an assessment
|
|
128
|
+
status: draft
|
|
129
|
+
owner: <an owner from the registry>
|
|
130
|
+
visibility: internal
|
|
131
|
+
audiences: [engineering, product]
|
|
132
|
+
parent: CAP-...
|
|
133
|
+
links:
|
|
134
|
+
governedBy: [RULE-...]
|
|
135
|
+
availability:
|
|
136
|
+
products: [PRD-...]
|
|
137
|
+
releases: [<a release from the registry>]
|
|
138
|
+
roles: [<a role>]
|
|
139
|
+
editions: [<an edition>]
|
|
140
|
+
flags: []
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# The promise in a few words, such as Schedule an assessment
|
|
144
|
+
|
|
145
|
+
## Behavior
|
|
146
|
+
Who acts, and what the system does.
|
|
147
|
+
|
|
148
|
+
## Preconditions
|
|
149
|
+
What must be true first.
|
|
150
|
+
|
|
151
|
+
## Outcomes
|
|
152
|
+
Success: what happens. Failure: what is rejected, and what is left unchanged.
|
|
153
|
+
\`\`\`
|
|
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
|
+
|
|
167
|
+
Each type requires these level-two sections:
|
|
168
|
+
|
|
169
|
+
| Type | Required sections |
|
|
170
|
+
|---|---|
|
|
171
|
+
${sections.join("\n")}
|
|
172
|
+
|
|
173
|
+
The specifications are at https://intentset.org/specifications/.
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +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;AAC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,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;;;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"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { type Io } from "../output.ts";
|
|
2
2
|
import type { Session } from "../session.ts";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The artifact a `context` argument names: itself when it is an ID, else the
|
|
5
|
+
* one slice whose claims include it as a file path, relative to the working
|
|
6
|
+
* directory. Several claiming slices are an overlap VSA reports; the caller
|
|
7
|
+
* is asked to choose.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveTarget(session: Session, argument: string, cwd: string): {
|
|
10
|
+
id: string;
|
|
11
|
+
path: string | null;
|
|
12
|
+
} | {
|
|
13
|
+
path: string;
|
|
14
|
+
slices: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function contextCommand(session: Session, argument: string, includeRestricted: boolean, asJson: boolean, io: Io): number;
|
|
4
17
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AA0BA,OAAO,EAA2B,KAAK,EAAE,EAA4B,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAQ1E;AAgBD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,OAAO,EAC1B,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,EAAE,GACL,MAAM,CAuFR"}
|
package/dist/commands/context.js
CHANGED
|
@@ -9,10 +9,33 @@
|
|
|
9
9
|
*
|
|
10
10
|
* `restricted` artifacts are withheld unless asked for, and the report says
|
|
11
11
|
* how many, so a short context never reads as a complete one. Never writes.
|
|
12
|
+
*
|
|
13
|
+
* Given a file rather than an ID, it reads the context of the slice whose
|
|
14
|
+
* claims include the file, since an agent about to edit code knows the file
|
|
15
|
+
* and not the ID of what it promises.
|
|
12
16
|
*/
|
|
17
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
13
18
|
import { compareStrings, contextFor, } from "@intentset/core";
|
|
14
19
|
import { count, formatDiagnostic, json, snapshotLine, TOOL } from "../output.js";
|
|
20
|
+
import { claimingSlices } from "../slices.js";
|
|
15
21
|
import { unresolved, validationLine, validationSummary } from "./shared.js";
|
|
22
|
+
/**
|
|
23
|
+
* The artifact a `context` argument names: itself when it is an ID, else the
|
|
24
|
+
* one slice whose claims include it as a file path, relative to the working
|
|
25
|
+
* directory. Several claiming slices are an overlap VSA reports; the caller
|
|
26
|
+
* is asked to choose.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveTarget(session, argument, cwd) {
|
|
29
|
+
const graph = session.result.graph;
|
|
30
|
+
if (graph.artifacts.has(argument))
|
|
31
|
+
return { id: argument, path: null };
|
|
32
|
+
const absolute = isAbsolute(argument) ? argument : resolve(cwd, argument);
|
|
33
|
+
const path = relative(session.repo.root, absolute).split(sep).join("/");
|
|
34
|
+
const slices = claimingSlices(graph, path).map((slice) => slice.meta.id);
|
|
35
|
+
if (slices.length === 1)
|
|
36
|
+
return { id: slices[0], path };
|
|
37
|
+
return { path, slices };
|
|
38
|
+
}
|
|
16
39
|
const HEADINGS = {
|
|
17
40
|
start: "Start",
|
|
18
41
|
owner: "Owning slice",
|
|
@@ -26,8 +49,16 @@ const HEADINGS = {
|
|
|
26
49
|
ancestor: "Navigation ancestors",
|
|
27
50
|
neighbour: "Neighbours",
|
|
28
51
|
};
|
|
29
|
-
export function contextCommand(session,
|
|
52
|
+
export function contextCommand(session, argument, includeRestricted, asJson, io) {
|
|
30
53
|
const { graph } = session.result;
|
|
54
|
+
const target = resolveTarget(session, argument, io.cwd);
|
|
55
|
+
if ("slices" in target && target.slices.length > 1) {
|
|
56
|
+
io.stderr(`intentset context: ${target.path} is claimed by ${target.slices.join(" and ")}, an overlap VSA reports; ` +
|
|
57
|
+
"name one of them.\n");
|
|
58
|
+
return 2;
|
|
59
|
+
}
|
|
60
|
+
const via = "id" in target ? target.path : null;
|
|
61
|
+
const id = "id" in target ? target.id : argument;
|
|
31
62
|
const bundle = contextFor(graph, id, { includeRestricted });
|
|
32
63
|
if (bundle === null) {
|
|
33
64
|
const diagnostic = unresolved(id, session);
|
|
@@ -53,6 +84,7 @@ export function contextCommand(session, id, includeRestricted, asJson, io) {
|
|
|
53
84
|
snapshot: session.snapshot,
|
|
54
85
|
validation: validationSummary(session, session.level),
|
|
55
86
|
start: id,
|
|
87
|
+
...(via === null ? {} : { resolvedFrom: via }),
|
|
56
88
|
included: bundle.artifacts.length,
|
|
57
89
|
withheld: bundle.withheld,
|
|
58
90
|
restrictedIncluded: includeRestricted,
|
|
@@ -71,6 +103,7 @@ export function contextCommand(session, id, includeRestricted, asJson, io) {
|
|
|
71
103
|
`# Context for ${id}`,
|
|
72
104
|
"",
|
|
73
105
|
`Bounded engineering context (Core §10) for ${start.meta.type} ${id}, "${start.meta.title}".`,
|
|
106
|
+
...(via === null ? [] : ["", `${via} is claimed by ${id}, so this is that slice's context.`]),
|
|
74
107
|
"",
|
|
75
108
|
`- ${snapshotLine(session.snapshot)}`,
|
|
76
109
|
`- ${validationLine(session, session.level)}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAIL,cAAc,EACd,UAAU,GAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAW,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAgB,EAChB,QAAgB,EAChB,GAAW;IAEX,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IACnC,IAAI,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,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AC,CAAC;QAC5B,IAAI,IAAI,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAC9C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qHAAqH;AACrH,SAAS,MAAM,CAAC,IAAY;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,KAAK,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface InitOptions {
|
|
|
5
5
|
root?: string;
|
|
6
6
|
repository?: string;
|
|
7
7
|
example: boolean;
|
|
8
|
+
/** Write only the agent guide. */
|
|
9
|
+
agentsOnly?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare function configText(repository: string): string;
|
|
10
12
|
export declare const EMPTY_REGISTRIES_TEXT: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
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,QAYtB,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
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intentset init`: the one command that writes, and it only creates. It
|
|
3
|
-
* writes `.intentset/config.yaml
|
|
4
|
-
* `.intentset/registries.yaml
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* writes `.intentset/config.yaml`, an empty-but-valid
|
|
4
|
+
* `.intentset/registries.yaml` and `.intentset/agents.md`, the guide coding
|
|
5
|
+
* agents follow to keep the model current, and with `--example` the
|
|
6
|
+
* scheduling example's records under `product/scheduling/` and its
|
|
7
|
+
* registries in place of the empty ones. `--agents` writes the guide alone,
|
|
8
|
+
* for a repository initialized before there was one, with the scope its
|
|
9
|
+
* config already names. Every target is checked before anything is written,
|
|
10
|
+
* and each file is opened with exclusive create, so an existing file is never
|
|
8
11
|
* overwritten, not even by a race.
|
|
9
12
|
*/
|
|
10
13
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
14
|
import { basename, dirname, join, resolve } from "node:path";
|
|
12
15
|
import { fileURLToPath } from "node:url";
|
|
13
16
|
import { compareStrings, DEFAULT_IGNORE, readConfig, readRegistries } from "@intentset/core";
|
|
17
|
+
import { AGENT_GUIDE_PATH, AGENT_POINTERS, agentGuide, detectPackageManager } from "../agents.js";
|
|
14
18
|
import { CONFIG_PATH } from "../repository.js";
|
|
15
19
|
export const REGISTRIES_PATH = ".intentset/registries.yaml";
|
|
16
20
|
export const DEFAULT_INIT_SCOPE = "product/**/*.md";
|
|
@@ -70,6 +74,8 @@ export async function initCommand(options, io) {
|
|
|
70
74
|
io.stderr("intentset init: --repository must be a non-empty name on one line, such as org/name.\n");
|
|
71
75
|
return 2;
|
|
72
76
|
}
|
|
77
|
+
if (options.agentsOnly === true)
|
|
78
|
+
return writeGuideOnly(root, io);
|
|
73
79
|
// Everything to write, decided before anything is written.
|
|
74
80
|
const files = new Map([[CONFIG_PATH, configText(repository)]]);
|
|
75
81
|
let registries = EMPTY_REGISTRIES_TEXT;
|
|
@@ -89,6 +95,7 @@ export async function initCommand(options, io) {
|
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
files.set(REGISTRIES_PATH, registries);
|
|
98
|
+
files.set(AGENT_GUIDE_PATH, agentGuide([DEFAULT_INIT_SCOPE], managerAt(root)));
|
|
92
99
|
// What init writes must read back clean, or it has handed the user a broken repository.
|
|
93
100
|
const config = readConfig(files.get(CONFIG_PATH), CONFIG_PATH);
|
|
94
101
|
const registry = readRegistries(registries, REGISTRIES_PATH);
|
|
@@ -96,12 +103,43 @@ export async function initCommand(options, io) {
|
|
|
96
103
|
io.stderr("intentset init: the files it would write do not read back clean; nothing was written.\n");
|
|
97
104
|
return 2;
|
|
98
105
|
}
|
|
106
|
+
if (!create(root, files, io))
|
|
107
|
+
return 2;
|
|
108
|
+
const scope = options.example ? `${files.size - 3} example records in scope` : "an empty scope";
|
|
109
|
+
io.stdout(`Initialized ${quote(repository)} with ${scope}. Next: intentset validate\n`);
|
|
110
|
+
pointers(io);
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
/** `init --agents`: the guide alone, for the scope the repository's config names, or the default with no config. */
|
|
114
|
+
function writeGuideOnly(root, io) {
|
|
115
|
+
let scope = [DEFAULT_INIT_SCOPE];
|
|
116
|
+
const configFile = join(root, CONFIG_PATH);
|
|
117
|
+
if (existsSync(configFile)) {
|
|
118
|
+
const { config, diagnostics } = readConfig(readFileSync(configFile, "utf8"), CONFIG_PATH);
|
|
119
|
+
if (diagnostics.length === 0 && config.scope.length > 0)
|
|
120
|
+
scope = config.scope;
|
|
121
|
+
}
|
|
122
|
+
if (!create(root, new Map([[AGENT_GUIDE_PATH, agentGuide(scope, managerAt(root))]]), io))
|
|
123
|
+
return 2;
|
|
124
|
+
pointers(io);
|
|
125
|
+
return 0;
|
|
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
|
+
}
|
|
135
|
+
/** Create every file or none: refuse if any exists, then write each with exclusive create. */
|
|
136
|
+
function create(root, files, io) {
|
|
99
137
|
const ordered = [...files.keys()].sort(compareStrings);
|
|
100
138
|
const existing = ordered.filter((path) => existsSync(join(root, path)));
|
|
101
139
|
if (existing.length > 0) {
|
|
102
140
|
io.stderr(`intentset init: refusing to overwrite ${existing.join(", ")}; init only creates files.\n` +
|
|
103
141
|
"Remove them first if a fresh start is what you want.\n");
|
|
104
|
-
return
|
|
142
|
+
return false;
|
|
105
143
|
}
|
|
106
144
|
for (const path of ordered) {
|
|
107
145
|
const target = join(root, path);
|
|
@@ -111,12 +149,16 @@ export async function initCommand(options, io) {
|
|
|
111
149
|
}
|
|
112
150
|
catch (error) {
|
|
113
151
|
io.stderr(`intentset init: could not create ${path}: ${error.message}\n`);
|
|
114
|
-
return
|
|
152
|
+
return false;
|
|
115
153
|
}
|
|
116
154
|
io.stdout(`created ${path}\n`);
|
|
117
155
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
/** How to point a repository's agents at the guide. init never edits a file it did not create, so it says rather than does. */
|
|
159
|
+
function pointers(io) {
|
|
160
|
+
io.stdout(`\nPoint your coding agents at ${AGENT_GUIDE_PATH} with one line in the file they read:\n`);
|
|
161
|
+
for (const [file, line] of AGENT_POINTERS)
|
|
162
|
+
io.stdout(` ${file}: ${line}\n`);
|
|
121
163
|
}
|
|
122
164
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA
|
|
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,O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C;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,yBAAyB,CAAC;IACtF,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7E,OAAO,kBAAkB,OAAO,CAAC,WAAW,sDAAsD,CAAC;IACrG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,OAA0B,EAAE,EAAM;IACjF,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE;QAC/B,EAAE,CAAC,MAAM,CAAC,sBAAsB,O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AC,CAAC;IACnC,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* touches, a changed record to its own artifact and a changed source file
|
|
8
8
|
* through the claiming slice to that slice's behaviors, each start's direct
|
|
9
9
|
* dependents shown apart from its candidates. Markdown by default. Read-only.
|
|
10
|
+
*
|
|
11
|
+
* It also lists every slice whose code changed while none of the records that
|
|
12
|
+
* describe it did (Core §10: an agent updates affected semantics in the same
|
|
13
|
+
* review). A refactor changes code and no behavior, so the list is a prompt,
|
|
14
|
+
* not an error: a commit says so with an Intentset-Unchanged trailer, and
|
|
15
|
+
* `--fail-on-drift` fails only on slices no commit has spoken for.
|
|
10
16
|
*/
|
|
11
17
|
import { type Graph } from "@intentset/core";
|
|
12
18
|
import { type Io } from "../output.ts";
|
|
@@ -22,8 +28,22 @@ export declare function attribute(graph: Graph, changed: readonly string[]): {
|
|
|
22
28
|
starts: Attribution[];
|
|
23
29
|
unattributed: string[];
|
|
24
30
|
};
|
|
31
|
+
export interface Drift {
|
|
32
|
+
slice: string;
|
|
33
|
+
title: string;
|
|
34
|
+
/** The slice's changed code: files its source, backend or contract claims match. */
|
|
35
|
+
code: string[];
|
|
36
|
+
/** The records that describe the slice, none of which changed. */
|
|
37
|
+
records: string[];
|
|
38
|
+
/** True when a commit after the base names the slice in an Intentset-Unchanged trailer. */
|
|
39
|
+
acknowledged: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const DRIFT_NOTE: string;
|
|
42
|
+
/** Each slice whose code is among the changed files while none of its describing records is, sorted by slice ID. */
|
|
43
|
+
export declare function drift(graph: Graph, changed: readonly string[], acknowledged: ReadonlySet<string>): Drift[];
|
|
25
44
|
export declare function reviewCommand(session: Session, options: {
|
|
26
45
|
base?: string;
|
|
27
46
|
levelReason: string;
|
|
47
|
+
failOnDrift?: boolean;
|
|
28
48
|
}, asJson: boolean, io: Io): number;
|
|
29
49
|
//# sourceMappingURL=review.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,KAAK,EAA0B,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAA2B,KAAK,EAAE,EAA4B,MAAM,cAAc,CAAC;AAE1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,kJAAkJ;AAClJ,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCrH;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kEAAkE;IAClE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2FAA2F;IAC3F,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,UAAU,QAGqF,CAAC;AAE7G,oHAAoH;AACpH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,CAkB1G;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EA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