@intentius/chant 0.84.0 → 0.86.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/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/mcp/resource-handlers.d.ts +2 -1
- package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
- package/dist/cli/mcp/server.d.ts +1 -0
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/tools/composites.d.ts +44 -0
- package/dist/cli/mcp/tools/composites.d.ts.map +1 -0
- package/dist/cli/mcp/tools/search.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +13 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +4 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/composite.d.ts +6 -0
- package/dist/composite.d.ts.map +1 -1
- package/dist/lexicon.d.ts +44 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +13 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/contract-repo.d.ts +7 -0
- package/dist/workspace/__fixtures__/contract-repo.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/sessions.d.ts +23 -0
- package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -0
- package/dist/workspace/checks/records.d.ts +1 -0
- package/dist/workspace/checks/records.d.ts.map +1 -1
- package/dist/workspace/checks.d.ts +4 -0
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/composites.d.ts +152 -0
- package/dist/workspace/composites.d.ts.map +1 -0
- package/dist/workspace/conformance/index.d.ts +211 -0
- package/dist/workspace/conformance/index.d.ts.map +1 -0
- package/dist/workspace/conformance/vitest.d.ts +11 -0
- package/dist/workspace/conformance/vitest.d.ts.map +1 -0
- package/dist/workspace/declaration.d.ts +28 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.schema.json +40 -0
- package/dist/workspace/declared-kinds.d.ts +43 -0
- package/dist/workspace/declared-kinds.d.ts.map +1 -0
- package/dist/workspace/graph-cli.d.ts +24 -2
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/intent-cli.d.ts +6 -1
- package/dist/workspace/intent-cli.d.ts.map +1 -1
- package/dist/workspace/intent-joins.d.ts +74 -9
- package/dist/workspace/intent-joins.d.ts.map +1 -1
- package/dist/workspace/intent.d.ts +90 -6
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/ls.d.ts +31 -1
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/member-commands.d.ts +7 -2
- package/dist/workspace/member-commands.d.ts.map +1 -1
- package/dist/workspace/reason-codes.d.ts +52 -2
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/record-sessions.d.ts +51 -0
- package/dist/workspace/record-sessions.d.ts.map +1 -0
- package/dist/workspace/record-source.d.ts +2 -0
- package/dist/workspace/record-source.d.ts.map +1 -1
- package/dist/workspace/records-cli.d.ts +65 -4
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-since.d.ts +90 -0
- package/dist/workspace/records-since.d.ts.map +1 -0
- package/dist/workspace/records-write.d.ts +164 -0
- package/dist/workspace/records-write.d.ts.map +1 -0
- package/dist/workspace/records.d.ts +202 -15
- package/dist/workspace/records.d.ts.map +1 -1
- package/dist/workspace/runtimes.d.ts +60 -0
- package/dist/workspace/runtimes.d.ts.map +1 -0
- package/dist/workspace/status-gates.d.ts +90 -0
- package/dist/workspace/status-gates.d.ts.map +1 -0
- package/dist/workspace/status.d.ts +17 -0
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/work.d.ts +56 -0
- package/dist/workspace/work.d.ts.map +1 -0
- package/package.json +19 -1
- package/src/cli/handlers/graph.ts +4 -0
- package/src/cli/main.test.ts +9 -0
- package/src/cli/main.ts +56 -3
- package/src/cli/mcp/resource-handlers.ts +17 -0
- package/src/cli/mcp/server.test.ts +140 -4
- package/src/cli/mcp/server.ts +5 -1
- package/src/cli/mcp/tools/composites.ts +98 -0
- package/src/cli/mcp/tools/search.ts +47 -5
- package/src/cli/registry.ts +13 -1
- package/src/components/cli-support.test.ts +16 -0
- package/src/components/cli-support.ts +8 -2
- package/src/composite.ts +9 -0
- package/src/lexicon.ts +47 -0
- package/src/lifecycle/gate-ledger.ts +14 -0
- package/src/workspace/__fixtures__/contract-repo.ts +17 -0
- package/src/workspace/__fixtures__/sessions.ts +66 -0
- package/src/workspace/checks/records.ts +19 -0
- package/src/workspace/checks.test.ts +2 -0
- package/src/workspace/checks.ts +7 -1
- package/src/workspace/composites.schema.json +533 -0
- package/src/workspace/composites.test.ts +334 -0
- package/src/workspace/composites.ts +316 -0
- package/src/workspace/conformance/__fixture__/app/package.json +7 -0
- package/src/workspace/conformance/__fixture__/app/src/server.mjs +29 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +32 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.schema.json +364 -0
- package/src/workspace/conformance/__fixture__/decisions/fix-001-how-the-app-is-deployed.md +40 -0
- package/src/workspace/conformance/__fixture__/delivery/chant.config.ts +7 -0
- package/src/workspace/conformance/__fixture__/delivery/lexicon/index.ts +26 -0
- package/src/workspace/conformance/__fixture__/delivery/package.json +7 -0
- package/src/workspace/conformance/__fixture__/delivery/src/app.component.ts +14 -0
- package/src/workspace/conformance/__fixture__/delivery/src/app.ts +4 -0
- package/src/workspace/conformance/conformance.test.ts +149 -0
- package/src/workspace/conformance/index.mjs +31 -0
- package/src/workspace/conformance/index.ts +453 -0
- package/src/workspace/conformance/vitest.ts +62 -0
- package/src/workspace/declaration.schema.json +40 -0
- package/src/workspace/declaration.ts +62 -0
- package/src/workspace/declared-kinds.test.ts +321 -0
- package/src/workspace/declared-kinds.ts +76 -0
- package/src/workspace/graph-cli.ts +40 -4
- package/src/workspace/intent-cli.ts +54 -7
- package/src/workspace/intent-joins.test.ts +60 -0
- package/src/workspace/intent-joins.ts +117 -20
- package/src/workspace/intent.schema.json +357 -19
- package/src/workspace/intent.test.ts +235 -20
- package/src/workspace/intent.ts +396 -51
- package/src/workspace/ls.schema.json +34 -0
- package/src/workspace/ls.ts +69 -4
- package/src/workspace/member-commands.ts +11 -5
- package/src/workspace/read-contract.test.ts +52 -3
- package/src/workspace/reason-codes.test.ts +48 -4
- package/src/workspace/reason-codes.ts +67 -2
- package/src/workspace/record-assets.test.ts +3 -1
- package/src/workspace/record-sessions.ts +105 -0
- package/src/workspace/record-source.ts +14 -5
- package/src/workspace/records-amend.schema.json +167 -0
- package/src/workspace/records-cli.ts +246 -19
- package/src/workspace/records-contract.test.ts +77 -2
- package/src/workspace/records-formats.test.ts +640 -0
- package/src/workspace/records-new.schema.json +158 -0
- package/src/workspace/records-quorum.test.ts +196 -0
- package/src/workspace/records-review.schema.json +202 -0
- package/src/workspace/records-sessions.test.ts +108 -0
- package/src/workspace/records-since.schema.json +193 -0
- package/src/workspace/records-since.test.ts +174 -0
- package/src/workspace/records-since.ts +259 -0
- package/src/workspace/records-write-contract.test.ts +125 -0
- package/src/workspace/records-write.test.ts +373 -0
- package/src/workspace/records-write.ts +736 -0
- package/src/workspace/records.schema.json +187 -9
- package/src/workspace/records.test.ts +93 -0
- package/src/workspace/records.ts +683 -49
- package/src/workspace/runtimes.ts +107 -0
- package/src/workspace/status-contract.test.ts +163 -0
- package/src/workspace/status-gates.ts +215 -0
- package/src/workspace/status.schema.json +69 -3
- package/src/workspace/status.ts +35 -2
- package/src/workspace/work.test.ts +388 -0
- package/src/workspace/work.ts +163 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant workspace graph --composites` (#2662): each composite instance the
|
|
3
|
+
* workspace's members declare, joined to the components that can deploy it.
|
|
4
|
+
*
|
|
5
|
+
* The composed graph already knows which composite instances each member
|
|
6
|
+
* declares (a node's `compositeInstance` and `compositeParent`), and a
|
|
7
|
+
* member's `chant graph --components --format ir` knows its components and
|
|
8
|
+
* the composite kinds each names in its contract's `composites`. This module
|
|
9
|
+
* joins the two and prints the rows. chant supplies the data and never the
|
|
10
|
+
* choice (ws-052): the document says how each component matched, and a
|
|
11
|
+
* reader decides what to offer.
|
|
12
|
+
*
|
|
13
|
+
* A component matches an instance in one of two ways:
|
|
14
|
+
*
|
|
15
|
+
* - `composites`: the component's contract lists one of the instance's
|
|
16
|
+
* composite kinds, compared exactly.
|
|
17
|
+
* - `name`: the component declares no `composites`, and its `name` joins the
|
|
18
|
+
* instance's kind or the instance's own name with the core `joinKey()`
|
|
19
|
+
* (`LoomBackend` and `loom-backend` join, labelled `folded`). This is the
|
|
20
|
+
* naming convention the component contract documents for a component that
|
|
21
|
+
* says nothing (#1492).
|
|
22
|
+
*
|
|
23
|
+
* Every match says how it crosses members (`via`): `member` when the
|
|
24
|
+
* component and the instance are in the same member, `link` when the
|
|
25
|
+
* component's member reads the instance's member through a resolved member
|
|
26
|
+
* link (#2539), and `unlinked` otherwise. An instance with no component is
|
|
27
|
+
* listed with an empty `components`, so the gap is visible.
|
|
28
|
+
*
|
|
29
|
+
* Each member runs under its own toolchain, as for `workspace graph`, and at
|
|
30
|
+
* the same revision with `--at`. Nothing is written and no listener starts.
|
|
31
|
+
*
|
|
32
|
+
* Each component also lists the runtimes it can deploy on (#2674,
|
|
33
|
+
* `runtimes.ts`): `local`, and each lexicon its member configures that hosts
|
|
34
|
+
* `chant run --components`, with the command line for each.
|
|
35
|
+
*/
|
|
36
|
+
import type { CommandContext } from "../cli/registry.js";
|
|
37
|
+
import { type JoinLabel } from "../join-key.js";
|
|
38
|
+
import type { MemberReason, WorkspaceGraph } from "./compose-graph.js";
|
|
39
|
+
import { type GraphQuery } from "./graph-cli.js";
|
|
40
|
+
import { type ErrorLocation, type WorkspaceErrorCode } from "./declaration.js";
|
|
41
|
+
import { type ComponentRuntime, type PluginLoader, type RuntimeReason } from "./runtimes.js";
|
|
42
|
+
/** `$id` of the JSON Schema for the document, shipped beside this file. */
|
|
43
|
+
export declare const COMPOSITES_OUTPUT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/composites/v1/composites.schema.json";
|
|
44
|
+
/** The read-contract version the document follows. */
|
|
45
|
+
export declare const COMPOSITES_CONTRACT_VERSION = 1;
|
|
46
|
+
/** Why the composites couldn't be read at all: the graph's codes. */
|
|
47
|
+
export declare const COMPOSITES_ERROR_CODES: readonly ["declaration-missing", "declaration-ambiguous", "declaration-unparseable", "declaration-invalid", "placement-invalid", "reader-too-old", "root-chant-required", "not-a-git-repository", "revision-unknown"];
|
|
48
|
+
/** Why the list is empty, or why no instance has a component. Closed: part of the read contract. */
|
|
49
|
+
export declare const COMPOSITES_REASON_CODES: readonly ["composites-no-chant-member", "composites-none-declared", "composites-no-component"];
|
|
50
|
+
export type CompositesReasonCode = (typeof COMPOSITES_REASON_CODES)[number];
|
|
51
|
+
/** Why a member's runtimes are only `local`, or leave out a lexicon its config lists (#2674). Closed. */
|
|
52
|
+
export declare const COMPOSITES_RUNTIME_REASON_CODES: readonly ["runtimes-config-unreadable", "runtimes-lexicon-unreadable"];
|
|
53
|
+
export interface CompositesMember {
|
|
54
|
+
name: string;
|
|
55
|
+
dir: string;
|
|
56
|
+
kind: string;
|
|
57
|
+
/** `read` when both its graph and its component graph were read. */
|
|
58
|
+
status: "read" | "skipped" | "failed";
|
|
59
|
+
reason: MemberReason | null;
|
|
60
|
+
chant: string | null;
|
|
61
|
+
/** Why its components' runtimes leave something out: its config, or a lexicon, couldn't be read. Empty for a member not of kind chant. */
|
|
62
|
+
runtimeReasons: RuntimeReason[];
|
|
63
|
+
}
|
|
64
|
+
export interface ComponentEntry {
|
|
65
|
+
/** `<member>/<name>`. */
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
member: string;
|
|
69
|
+
/** Declared or inferred; null when the member's chant does not print it. */
|
|
70
|
+
archetype: string | null;
|
|
71
|
+
/** The contract's `composites`, or null when it declares none. */
|
|
72
|
+
composites: string[] | null;
|
|
73
|
+
/** The component's file from the workspace root, when the member's chant names it. */
|
|
74
|
+
file: string | null;
|
|
75
|
+
/** The runtimes it can deploy on: `local` first, then each hosting lexicon its member configures. */
|
|
76
|
+
runtimes: ComponentRuntime[];
|
|
77
|
+
}
|
|
78
|
+
export interface ComponentMatch {
|
|
79
|
+
/** The {@link ComponentEntry} id. */
|
|
80
|
+
component: string;
|
|
81
|
+
by: "composites" | "name";
|
|
82
|
+
/** What was matched: one of the instance's kinds, or the instance's own name. */
|
|
83
|
+
against: "kind" | "instance";
|
|
84
|
+
value: string;
|
|
85
|
+
label: JoinLabel;
|
|
86
|
+
via: "member" | "link" | "unlinked";
|
|
87
|
+
}
|
|
88
|
+
export interface CompositeInstanceRow {
|
|
89
|
+
/** `<member>/<instance>`, the composed graph's `compositeInstance`. */
|
|
90
|
+
id: string;
|
|
91
|
+
member: string;
|
|
92
|
+
/** The instance's name in its member: the export name. */
|
|
93
|
+
instance: string;
|
|
94
|
+
/** The composite kinds its nodes came from; more than one when composites nest. */
|
|
95
|
+
kinds: string[];
|
|
96
|
+
lexicons: string[];
|
|
97
|
+
/** The composed ids of its nodes. */
|
|
98
|
+
nodes: string[];
|
|
99
|
+
components: ComponentMatch[];
|
|
100
|
+
}
|
|
101
|
+
interface Head {
|
|
102
|
+
$schema: string;
|
|
103
|
+
contract: number;
|
|
104
|
+
chant: string;
|
|
105
|
+
}
|
|
106
|
+
export type CompositesDocument = (Head & {
|
|
107
|
+
at: string | null;
|
|
108
|
+
workspace: {
|
|
109
|
+
name: string;
|
|
110
|
+
root: string;
|
|
111
|
+
};
|
|
112
|
+
members: CompositesMember[];
|
|
113
|
+
composites: CompositeInstanceRow[];
|
|
114
|
+
components: ComponentEntry[];
|
|
115
|
+
reasons: {
|
|
116
|
+
code: CompositesReasonCode;
|
|
117
|
+
message: string;
|
|
118
|
+
}[];
|
|
119
|
+
summary: {
|
|
120
|
+
composites: number;
|
|
121
|
+
withComponent: number;
|
|
122
|
+
withoutComponent: number;
|
|
123
|
+
components: number;
|
|
124
|
+
};
|
|
125
|
+
}) | (Head & {
|
|
126
|
+
error: {
|
|
127
|
+
code: WorkspaceErrorCode;
|
|
128
|
+
message: string;
|
|
129
|
+
location: ErrorLocation | null;
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
export interface CompositesResult {
|
|
133
|
+
doc: CompositesDocument;
|
|
134
|
+
failed: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** The composite instances in a composed graph, without their components. */
|
|
137
|
+
export declare function compositeInstances(graph: Pick<WorkspaceGraph, "nodes">): CompositeInstanceRow[];
|
|
138
|
+
/**
|
|
139
|
+
* Join instances to components. `links` are the composed graph's member link
|
|
140
|
+
* rows: a component crosses to another member's instance `via: "link"` when
|
|
141
|
+
* its member is the consumer of a resolved link whose producer is the
|
|
142
|
+
* instance's member.
|
|
143
|
+
*/
|
|
144
|
+
export declare function joinComponents(instances: CompositeInstanceRow[], components: ComponentEntry[], links: WorkspaceGraph["links"]): CompositeInstanceRow[];
|
|
145
|
+
/** Read the workspace's composites and components, and build the document. Never throws a `WorkspaceReadError`. */
|
|
146
|
+
export declare function workspaceComposites(query: Omit<GraphQuery, "kind" | "components" | "inTree"> & {
|
|
147
|
+
loadPlugin?: PluginLoader;
|
|
148
|
+
}): Promise<CompositesResult>;
|
|
149
|
+
/** `chant workspace graph --composites`: print the document as JSON, always, like the composed graph. */
|
|
150
|
+
export declare function runWorkspaceComposites(ctx: CommandContext, cwd: string): Promise<number>;
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=composites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composites.d.ts","sourceRoot":"","sources":["../../src/workspace/composites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAa,KAAK,SAAS,EAA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behold, reads only through the
|
|
5
|
+
* read contract (#2524 D15, ws-017) and writes nothing. This module holds a
|
|
6
|
+
* reader to that, for each read-contract command it lists:
|
|
7
|
+
*
|
|
8
|
+
* 1. The reader's `read(command, args)` returns a document that validates
|
|
9
|
+
* against that command's output schema, with the contract version this
|
|
10
|
+
* chant writes.
|
|
11
|
+
* 2. Each read makes exactly one chant call, and that call is the contract
|
|
12
|
+
* command with the suite's arguments and the command's JSON flag, and
|
|
13
|
+
* nothing else.
|
|
14
|
+
* 3. What the reader returns is the document chant printed, unchanged.
|
|
15
|
+
* 4. The workspace's files are byte for byte the same after every read.
|
|
16
|
+
*
|
|
17
|
+
* How "touched nothing else" is checked: the reader is built by calling
|
|
18
|
+
* `reader(chant)`, where `chant` is a recording transport. The reader is
|
|
19
|
+
* never given the workspace's path, so the transport is its only way to the
|
|
20
|
+
* workspace, and every call through it is recorded and compared with the
|
|
21
|
+
* contract command (points 2 and 3). Every file under the workspace is
|
|
22
|
+
* hashed before the first read and after the last one (point 4), which
|
|
23
|
+
* catches a write by any route, the transport included.
|
|
24
|
+
*
|
|
25
|
+
* This module ships in `@intentius/chant` as the subpath
|
|
26
|
+
* `@intentius/chant/workspace/conformance` and imports no test runner.
|
|
27
|
+
* {@link runWorkspaceReaderConformance} returns the problems for `node:test`
|
|
28
|
+
* or any runner, {@link checkReaderRead} checks one read, and
|
|
29
|
+
* `@intentius/chant/workspace/conformance/vitest` wraps the same checks in
|
|
30
|
+
* `describe` and `it`.
|
|
31
|
+
*
|
|
32
|
+
* The workspace: inside the chant repository it is `reference-workspace/`.
|
|
33
|
+
* Anywhere else the suite generates one in a temporary directory from the
|
|
34
|
+
* `__fixture__/` this package ships beside this module (a decision kind and record, an
|
|
35
|
+
* app, and a chant member with one composite and one component), declared
|
|
36
|
+
* by `chant workspace init --yes`, so {@link REFERENCE_READS} resolve in
|
|
37
|
+
* both. `workspaceDir` names another workspace with the same files.
|
|
38
|
+
*/
|
|
39
|
+
/** The read-contract commands, as a reader names them. */
|
|
40
|
+
export declare const READ_CONTRACT_COMMANDS: readonly ["ls", "graph", "check", "status", "records", "graph --intent", "graph --composites"];
|
|
41
|
+
export type ReadContractCommand = (typeof READ_CONTRACT_COMMANDS)[number];
|
|
42
|
+
/**
|
|
43
|
+
* Each command's output schema, beside this module's parent in `src/workspace/`.
|
|
44
|
+
* The write commands' schemas (`records-new`, `records-amend`,
|
|
45
|
+
* `records-review`, #2675) are not here: a reader never runs them.
|
|
46
|
+
*/
|
|
47
|
+
export declare const READ_CONTRACT_SCHEMAS: Record<ReadContractCommand, string>;
|
|
48
|
+
/** The flags that ask each command for its JSON document. A reader adds one of these and nothing else. */
|
|
49
|
+
export declare const READ_CONTRACT_JSON_FLAGS: Record<ReadContractCommand, readonly (readonly string[])[]>;
|
|
50
|
+
/** The arguments the suite passes each read, on the reference workspace or the generated one. */
|
|
51
|
+
export declare const REFERENCE_READS: Record<ReadContractCommand, string[]>;
|
|
52
|
+
/** One chant run: the arguments after `chant`, and what it printed. */
|
|
53
|
+
export interface ChantRun {
|
|
54
|
+
argv: string[];
|
|
55
|
+
status: number | null;
|
|
56
|
+
stdout: string;
|
|
57
|
+
stderr: string;
|
|
58
|
+
}
|
|
59
|
+
/** How a reader runs chant. It runs in the workspace; the reader never sees the path. */
|
|
60
|
+
export interface ChantTransport {
|
|
61
|
+
run(argv: string[]): Promise<ChantRun>;
|
|
62
|
+
}
|
|
63
|
+
export interface WorkspaceReader {
|
|
64
|
+
/** Run one read-contract command with `args`, and return the parsed JSON document. */
|
|
65
|
+
read(command: ReadContractCommand, args: string[]): Promise<unknown> | unknown;
|
|
66
|
+
}
|
|
67
|
+
/** Build the reader over the transport the suite gives it. */
|
|
68
|
+
export type WorkspaceReaderFactory = (chant: ChantTransport) => WorkspaceReader;
|
|
69
|
+
export interface WorkspaceReaderConformanceOptions {
|
|
70
|
+
/**
|
|
71
|
+
* The commands the reader reads. Only these are exercised; any other is
|
|
72
|
+
* not applicable and is reported as skipped. Defaults to every command in
|
|
73
|
+
* {@link READ_CONTRACT_COMMANDS}.
|
|
74
|
+
*/
|
|
75
|
+
commands?: readonly ReadContractCommand[];
|
|
76
|
+
/**
|
|
77
|
+
* The workspace to read. Defaults to the chant repository's
|
|
78
|
+
* reference-workspace inside that repository, and to a workspace generated
|
|
79
|
+
* from this package's conformance fixture anywhere else.
|
|
80
|
+
*/
|
|
81
|
+
workspaceDir?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The chant to run, as a command and its leading arguments. Defaults to the
|
|
84
|
+
* checkout's CLI through tsx inside the chant repository, and anywhere else
|
|
85
|
+
* to the first `node_modules/.bin/chant` above the current directory, then
|
|
86
|
+
* this package's own `bin/chant`, then `chant` on PATH.
|
|
87
|
+
*/
|
|
88
|
+
chantCommand?: string[];
|
|
89
|
+
/** How long one chant run may take, in milliseconds. Default 120000. */
|
|
90
|
+
timeoutMs?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface WorkspaceReaderConformanceConfig extends WorkspaceReaderConformanceOptions {
|
|
93
|
+
/** Short label, used in the suite name. */
|
|
94
|
+
name: string;
|
|
95
|
+
reader: WorkspaceReaderFactory;
|
|
96
|
+
}
|
|
97
|
+
/** What one read found. */
|
|
98
|
+
export interface ReaderReadResult {
|
|
99
|
+
command: ReadContractCommand;
|
|
100
|
+
args: string[];
|
|
101
|
+
problems: string[];
|
|
102
|
+
}
|
|
103
|
+
/** What {@link runWorkspaceReaderConformance} found. The reader conforms when `problems` is empty. */
|
|
104
|
+
export interface WorkspaceReaderConformanceReport {
|
|
105
|
+
/** Every problem, each starting with the command it concerns, or `workspace:` for a changed file. */
|
|
106
|
+
problems: string[];
|
|
107
|
+
/** The commands read, in contract order. */
|
|
108
|
+
checked: ReadContractCommand[];
|
|
109
|
+
/** The commands not in `commands`, so not applicable to this reader. */
|
|
110
|
+
skipped: ReadContractCommand[];
|
|
111
|
+
results: ReaderReadResult[];
|
|
112
|
+
/** The workspace that was read. A generated one is removed before the report is returned. */
|
|
113
|
+
workspaceDir: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The fixture the generated workspace is copied from, shipped under `src/`.
|
|
117
|
+
* Its `__fixture__` name keeps `chant workspace init` on the chant repository
|
|
118
|
+
* from proposing its projects as members.
|
|
119
|
+
*/
|
|
120
|
+
export declare const CONFORMANCE_FIXTURE_DIR: string;
|
|
121
|
+
/** The chant the suite runs when `chantCommand` is not given. */
|
|
122
|
+
export declare function defaultChantCommand(cwd?: string): string[];
|
|
123
|
+
/** The reference workspace in the chant repository, or undefined in an installed copy. */
|
|
124
|
+
export declare function referenceWorkspaceDir(): string | undefined;
|
|
125
|
+
type Validate = ((d: unknown) => boolean) & {
|
|
126
|
+
errors?: unknown;
|
|
127
|
+
};
|
|
128
|
+
/** A command's output schema and a draft 2020-12 validator for it, from this package's own ajv 8. */
|
|
129
|
+
export declare function readContractSchema(command: ReadContractCommand): {
|
|
130
|
+
schema: {
|
|
131
|
+
$id: string;
|
|
132
|
+
};
|
|
133
|
+
validate: Validate;
|
|
134
|
+
};
|
|
135
|
+
/** A digest of every file under `dir`, skipping node_modules. */
|
|
136
|
+
export declare function treeDigest(dir: string): Record<string, string>;
|
|
137
|
+
/** The files that differ between two {@link treeDigest}s: added, removed or changed. */
|
|
138
|
+
export declare function treeChanges(before: Record<string, string>, after: Record<string, string>): string[];
|
|
139
|
+
/**
|
|
140
|
+
* What is wrong with the chant calls one read made: anything but exactly one
|
|
141
|
+
* call, of `workspace <command>` with `args` in order and the command's JSON
|
|
142
|
+
* flag, and nothing else. Empty when the calls conform.
|
|
143
|
+
*/
|
|
144
|
+
export declare function readerCallProblems(command: ReadContractCommand, args: string[], calls: string[][]): string[];
|
|
145
|
+
/**
|
|
146
|
+
* Everything wrong with one read: the chant calls it made (`calls`, and
|
|
147
|
+
* `printed`, what each printed), and the document the reader returned
|
|
148
|
+
* (`doc`). Checks points 1 to 3 of the suite; empty when the read conforms.
|
|
149
|
+
*/
|
|
150
|
+
export declare function checkReaderRead(command: ReadContractCommand, args: string[], calls: string[][], printed: ChantRun[], doc: unknown): string[];
|
|
151
|
+
/** The commands to exercise and the ones skipped, from `commands`. Throws on a name that is not a contract command. */
|
|
152
|
+
export declare function selectCommands(commands?: readonly ReadContractCommand[]): {
|
|
153
|
+
checked: ReadContractCommand[];
|
|
154
|
+
skipped: ReadContractCommand[];
|
|
155
|
+
};
|
|
156
|
+
/** A workspace generated for a conformance run, and how to remove it. */
|
|
157
|
+
export interface ConformanceWorkspace {
|
|
158
|
+
dir: string;
|
|
159
|
+
dispose(): void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate the conformance workspace in a temporary directory: copy
|
|
163
|
+
* `__fixture__/`, link this package in as `node_modules/@intentius/chant`
|
|
164
|
+
* so the chant member resolves it, declare the workspace with
|
|
165
|
+
* `chant workspace init --yes --name conformance` and commit it all to a new
|
|
166
|
+
* git repository on `main`.
|
|
167
|
+
*/
|
|
168
|
+
export declare function createConformanceWorkspace(options?: {
|
|
169
|
+
chantCommand?: string[];
|
|
170
|
+
timeoutMs?: number;
|
|
171
|
+
}): ConformanceWorkspace;
|
|
172
|
+
/** The workspace and chant a run uses, from its options. `dispose` removes a generated workspace. */
|
|
173
|
+
export declare function conformanceTarget(options?: WorkspaceReaderConformanceOptions): {
|
|
174
|
+
workspaceDir: string;
|
|
175
|
+
chantCommand: string[];
|
|
176
|
+
dispose(): void;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* A transport that runs chant in the workspace `target()` names and records
|
|
180
|
+
* every call and what it printed. `reset()` clears the record before a read.
|
|
181
|
+
*/
|
|
182
|
+
export declare function recordingTransport(target: () => {
|
|
183
|
+
workspaceDir: string;
|
|
184
|
+
chantCommand: string[];
|
|
185
|
+
}, timeoutMs?: number): {
|
|
186
|
+
transport: ChantTransport;
|
|
187
|
+
calls: string[][];
|
|
188
|
+
printed: ChantRun[];
|
|
189
|
+
reset(): void;
|
|
190
|
+
};
|
|
191
|
+
/** Make one read through a recording transport and check it. A reader that throws is a problem, not an error. */
|
|
192
|
+
export declare function readAndCheck(reader: WorkspaceReader, recorder: ReturnType<typeof recordingTransport>, command: ReadContractCommand): Promise<ReaderReadResult>;
|
|
193
|
+
/**
|
|
194
|
+
* Hold a reader to the read contract, with no test runner: read each listed
|
|
195
|
+
* command once through a recording transport, check the four points, and
|
|
196
|
+
* return what is wrong. The reader conforms when `problems` is empty.
|
|
197
|
+
*
|
|
198
|
+
* ```js
|
|
199
|
+
* import { test } from "node:test";
|
|
200
|
+
* import assert from "node:assert/strict";
|
|
201
|
+
* import { runWorkspaceReaderConformance } from "@intentius/chant/workspace/conformance";
|
|
202
|
+
*
|
|
203
|
+
* test("my reader reads only through the contract", { timeout: 600_000 }, async () => {
|
|
204
|
+
* const report = await runWorkspaceReaderConformance(myReader, { commands: ["ls", "status"] });
|
|
205
|
+
* assert.deepEqual(report.problems, []);
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function runWorkspaceReaderConformance(reader: WorkspaceReaderFactory, options?: WorkspaceReaderConformanceOptions): Promise<WorkspaceReaderConformanceReport>;
|
|
210
|
+
export {};
|
|
211
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/conformance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAYH,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,gGAAiG,CAAC;AACrI,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAQrE,CAAC;AAEF,0GAA0G;AAC1G,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,mBAAmB,EAAE,SA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AA6B,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,GAAE,iCAAsC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAgB9K"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace reader conformance suite for vitest (#2657, #2679):
|
|
3
|
+
* {@link describeWorkspaceReaderConformance} wraps the runner-neutral checks
|
|
4
|
+
* of `./index` in `describe` and `it`, one test per listed command and one
|
|
5
|
+
* for the workspace's files. This is the only module of the suite that
|
|
6
|
+
* imports vitest; `@intentius/chant/workspace/conformance` imports no runner.
|
|
7
|
+
*/
|
|
8
|
+
import { type WorkspaceReaderConformanceConfig } from "./index.js";
|
|
9
|
+
export declare function describeWorkspaceReaderConformance(config: WorkspaceReaderConformanceConfig): void;
|
|
10
|
+
export * from "./index.js";
|
|
11
|
+
//# sourceMappingURL=vitest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../src/workspace/conformance/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EASL,KAAK,gCAAgC,EACtC,MAAM,SAAS,CAAC;AAEjB,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,gCAAgC,GAAG,IAAI,CAsCjG;AAED,cAAc,SAAS,CAAC"}
|
|
@@ -80,6 +80,22 @@ export interface LinkDeclaration {
|
|
|
80
80
|
/** The link's JSON Pointer in the file, for messages. */
|
|
81
81
|
pointer: string;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A record kind the declaration names (#2680): the workspace's own, in the
|
|
85
|
+
* top-level `records`, or a member's, in that member's `records`.
|
|
86
|
+
*/
|
|
87
|
+
export interface RecordKindDeclaration {
|
|
88
|
+
/** The kind file as the entry writes it: relative to the member's directory, or to the workspace root for the workspace's own. */
|
|
89
|
+
kind: string;
|
|
90
|
+
/** The kind file from the workspace root, with / separators. */
|
|
91
|
+
path: string;
|
|
92
|
+
/** The name the entry gives the kind, or null when readers use the kind file's own `recordKind.name`. */
|
|
93
|
+
name: string | null;
|
|
94
|
+
/** The member that declares it, or null for the workspace's own. */
|
|
95
|
+
member: string | null;
|
|
96
|
+
/** The entry's JSON Pointer in the file, for messages. */
|
|
97
|
+
pointer: string;
|
|
98
|
+
}
|
|
83
99
|
export interface Member {
|
|
84
100
|
type: "member";
|
|
85
101
|
name: string;
|
|
@@ -93,6 +109,8 @@ export interface Member {
|
|
|
93
109
|
outputs: string[] | null;
|
|
94
110
|
/** The links this member states as a consumer, in file order (#2539). */
|
|
95
111
|
links: LinkDeclaration[];
|
|
112
|
+
/** The record kinds this member declares, in file order (#2680). */
|
|
113
|
+
records: RecordKindDeclaration[];
|
|
96
114
|
upstream: string | null;
|
|
97
115
|
because: string | null;
|
|
98
116
|
suppress: Suppression[];
|
|
@@ -127,6 +145,10 @@ export interface Declaration {
|
|
|
127
145
|
pins: Pin[];
|
|
128
146
|
/** Severities set for declaration checks, keyed by `WSP` id (#2535). */
|
|
129
147
|
checks: Record<string, CheckSeverity>;
|
|
148
|
+
/** How many verdicts besides the decider's a record needs, or null when the declaration names none (#2671). */
|
|
149
|
+
quorum: number | null;
|
|
150
|
+
/** The workspace's own record kinds, from the top-level `records`, in file order (#2680). A member's are on the member. */
|
|
151
|
+
records: RecordKindDeclaration[];
|
|
130
152
|
/** The file, relative to the workspace root's tree (`chant.workspace.json` or `.jsonc`). */
|
|
131
153
|
file: string;
|
|
132
154
|
}
|
|
@@ -165,6 +187,12 @@ export declare function pinnedChant(obj: Record<string, unknown>): {
|
|
|
165
187
|
* trailing commas.
|
|
166
188
|
*/
|
|
167
189
|
export declare function parseDeclaration(text: string, file: string, reader?: string, options?: ReadOptions): Declaration;
|
|
190
|
+
/**
|
|
191
|
+
* Every record kind the declaration names (#2680), in the order readers use
|
|
192
|
+
* them: the workspace's own first, then each member's, members in file order
|
|
193
|
+
* and each list in its own order.
|
|
194
|
+
*/
|
|
195
|
+
export declare function declaredRecordKinds(declaration: Declaration): RecordKindDeclaration[];
|
|
168
196
|
/** Whether `path` is `dir` or sits under it. Both are tree-relative; `"."` is the root. */
|
|
169
197
|
export declare function isInside(path: string, dir: string): boolean;
|
|
170
198
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../src/workspace/declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,EAAE,aAAa,EAAqB,MAAM,SAAS,CAAC;AAC3D,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEtD,eAAO,MAAM,qBAAqB,QAAa,CAAC;AAChD,eAAO,MAAM,iBAAiB,4DAA6D,CAAC;AAC5F,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,gFAAgF;AAChF,eAAO,MAAM,cAAc,qCAAsC,CAAC;AAClE,eAAO,MAAM,YAAY,QAA8B,CAAC;AAIxD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,uNAmBQ,CAAC;AAC3C,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAEzC,QAAQ,CAAC,IAAI,EAAE,kBAAkB;IAEjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa;gBAFxB,IAAI,EAAE,kBAAkB,EACjC,OAAO,EAAE,MAAM,EACN,QAAQ,CAAC,EAAE,aAAa,YAAA;IAMnC,yDAAyD;IACzD,QAAQ,IAAI,MAAM;CAInB;AAID,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,O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3F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAG3D;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,SAAK,EAAE,OAAO,GAAE,WAAgB,GAAG,WAAW,CAarG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKzF;AAID,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,qEAAqE;IACrE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,uEAAuE;IACvE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE,CA8B5F;AAID;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EAAE,EACvB,IAAI,EAAE,MAAM,GACX;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAWlE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAWlH"}
|
|
@@ -44,6 +44,18 @@
|
|
|
44
44
|
"$ref": "#/$defs/pin"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
"quorum": {
|
|
48
|
+
"type": "integer",
|
|
49
|
+
"minimum": 0,
|
|
50
|
+
"description": "How many agree verdicts besides the decider's a record needs, for every record kind with a reviews list (#2671). chant workspace records reports each record's quorum against it. Two when absent. Added in schema 1 by chant 0.86.0, so a declaration that sets it sets minReader to 0.86.0 or newer. A per-kind quorum comes later (#2650 C14)."
|
|
51
|
+
},
|
|
52
|
+
"records": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"description": "The workspace's own record kinds, each a kind file relative to the workspace root (#2680): the kinds whose records belong to no one member, such as a decisions directory at the root. A member names its own in its records. chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.",
|
|
55
|
+
"items": {
|
|
56
|
+
"$ref": "#/$defs/recordKind"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
47
59
|
"checks": {
|
|
48
60
|
"type": "object",
|
|
49
61
|
"description": "Severity for the declaration checks that allow it, keyed by WSP id (#2535, ws-028): error, warning, info or off. chant workspace check refuses an id it does not know, and one whose severity is fixed.",
|
|
@@ -250,6 +262,13 @@
|
|
|
250
262
|
"$ref": "#/$defs/link"
|
|
251
263
|
}
|
|
252
264
|
},
|
|
265
|
+
"records": {
|
|
266
|
+
"type": "array",
|
|
267
|
+
"description": "The record kinds this member holds, each a kind file relative to the member's directory (#2680). chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.",
|
|
268
|
+
"items": {
|
|
269
|
+
"$ref": "#/$defs/recordKind"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
253
272
|
"upstream": {
|
|
254
273
|
"type": "string",
|
|
255
274
|
"minLength": 1,
|
|
@@ -335,6 +354,27 @@
|
|
|
335
354
|
"description": "A file or directory path with / separators: no leading /, no . or .. segments and no trailing /.",
|
|
336
355
|
"pattern": "^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$"
|
|
337
356
|
},
|
|
357
|
+
"recordKind": {
|
|
358
|
+
"type": "object",
|
|
359
|
+
"description": "A record kind the workspace declares (#2680): a kind file that exports recordKind. chant workspace check fails (WSP115) when the file is missing or does not load as a record kind.",
|
|
360
|
+
"required": [
|
|
361
|
+
"kind"
|
|
362
|
+
],
|
|
363
|
+
"properties": {
|
|
364
|
+
"kind": {
|
|
365
|
+
"$ref": "#/$defs/path",
|
|
366
|
+
"description": "The kind file, relative to the member's directory, or to the workspace root for the workspace's own records. A path is listed once across the declaration."
|
|
367
|
+
},
|
|
368
|
+
"name": {
|
|
369
|
+
"$ref": "#/$defs/kindName",
|
|
370
|
+
"description": "The name readers show for the kind. Without it, the kind file's own recordKind.name. Unique across the declaration."
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
"patternProperties": {
|
|
374
|
+
"^x-": true
|
|
375
|
+
},
|
|
376
|
+
"additionalProperties": false
|
|
377
|
+
},
|
|
338
378
|
"generatedFile": {
|
|
339
379
|
"type": "object",
|
|
340
380
|
"description": "One generated file of a member (#2524 D14, #2541).",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The record kinds a declaration names, loaded (#2680).
|
|
3
|
+
*
|
|
4
|
+
* `chant.workspace.json` may name the workspace's record kinds, in the
|
|
5
|
+
* top-level `records` and in each member's `records`, so a reader never has to
|
|
6
|
+
* guess which kind files exist. `chant workspace ls` lists them, `check` fails
|
|
7
|
+
* on one that doesn't load (WSP115), and `records` and `graph --intent` read
|
|
8
|
+
* every one of them when `--kind` is not given.
|
|
9
|
+
*
|
|
10
|
+
* A kind file is looked for in the tree read, which is the revision under
|
|
11
|
+
* `--at`, and loaded from the working tree, as `records --kind` loads one.
|
|
12
|
+
* Loading imports the file, so it runs only where a command already runs a
|
|
13
|
+
* kind file.
|
|
14
|
+
*/
|
|
15
|
+
import { type Declaration, type RecordKindDeclaration } from "./declaration.js";
|
|
16
|
+
import type { WorkspaceTree } from "./tree.js";
|
|
17
|
+
/** Why a declared kind can't be loaded: the codes `loadRecordKind` fails with. Closed, like every list of codes. */
|
|
18
|
+
export declare const DECLARED_KIND_REASON_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch"];
|
|
19
|
+
export type DeclaredKindReasonCode = (typeof DECLARED_KIND_REASON_CODES)[number];
|
|
20
|
+
export interface DeclaredKind {
|
|
21
|
+
declared: RecordKindDeclaration;
|
|
22
|
+
/** The kind file on disk, absolute. */
|
|
23
|
+
file: string;
|
|
24
|
+
/** The kind file's `recordKind.name`, or null when it wasn't loaded. */
|
|
25
|
+
kind: string | null;
|
|
26
|
+
/** Why it can't be loaded, or null. */
|
|
27
|
+
reason: {
|
|
28
|
+
code: DeclaredKindReasonCode;
|
|
29
|
+
message: string;
|
|
30
|
+
} | null;
|
|
31
|
+
}
|
|
32
|
+
/** The kind file of `declared` on disk, under the workspace root `rootOnDisk`. */
|
|
33
|
+
export declare function declaredKindFile(declared: RecordKindDeclaration, rootOnDisk: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Every kind the declaration names, in {@link declaredRecordKinds} order, each
|
|
36
|
+
* with its name or the reason it can't be loaded. A kind file missing from
|
|
37
|
+
* `tree` is `kind-unreadable` without a load. With `load: false`, nothing is
|
|
38
|
+
* imported and only that is checked.
|
|
39
|
+
*/
|
|
40
|
+
export declare function loadDeclaredKinds(declaration: Declaration, tree: WorkspaceTree, rootOnDisk: string, options?: {
|
|
41
|
+
load?: boolean;
|
|
42
|
+
}): Promise<DeclaredKind[]>;
|
|
43
|
+
//# sourceMappingURL=declared-kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-kinds.d.ts","sourceRoot":"","sources":["../../src/workspace/declared-kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAuB,KAAK,WAAW,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,oHAAoH;AACpH,eAAO,MAAM,0BAA0B,yFAA0H,CAAC;AAClK,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,uCAAuC;IACvC,MAAM,EAAE;QAAE,IAAI,EAAE,sBAAsB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAClE;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5F;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,OAAO,CAAC,YAAY,EAAE,CAAC,CAyBzB"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* With `--intent <path[:start-end]>` it prints the intent graph over one
|
|
9
9
|
* region instead (#2651, `intent.ts`), a document of its own in the read
|
|
10
|
-
* contract.
|
|
10
|
+
* contract. With `--composites` it prints each composite instance with the
|
|
11
|
+
* components that can deploy it (#2662, `composites.ts`), another.
|
|
11
12
|
*
|
|
12
13
|
* The document is part of the read contract, described by `graph.schema.json`
|
|
13
14
|
* beside this file. It is printed for a failure too, with the error's reason
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
import type { CommandContext, ParsedArgs } from "../cli/registry.js";
|
|
26
27
|
import { type WorkspaceGraph } from "./compose-graph.js";
|
|
27
28
|
import { type ErrorLocation, type WorkspaceErrorCode } from "./declaration.js";
|
|
28
|
-
import { type MemberPlan, type Toolchain } from "./member-commands.js";
|
|
29
|
+
import { type MemberPlan, type Toolchain, type UnitResult } from "./member-commands.js";
|
|
29
30
|
import { type LocatedWorkspace } from "./which-chant.js";
|
|
30
31
|
/** The version of the `graph` document this chant writes. */
|
|
31
32
|
export declare const GRAPH_CONTRACT_VERSION = 1;
|
|
@@ -65,12 +66,33 @@ export interface GraphQuery {
|
|
|
65
66
|
* rows of `links`.
|
|
66
67
|
*/
|
|
67
68
|
kind?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Also run each member's `chant graph --components --format ir` (#2662),
|
|
71
|
+
* under the same toolchain and at the same revision, and return the answers
|
|
72
|
+
* in {@link GraphResult.components}. The document is unchanged.
|
|
73
|
+
*/
|
|
74
|
+
components?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Called once the members have run, with the directory they were read from
|
|
77
|
+
* (the exported tree for `--at`, before it is removed) and the declared
|
|
78
|
+
* members the read covers. `--composites` reads each member's runtimes
|
|
79
|
+
* here (#2674).
|
|
80
|
+
*/
|
|
81
|
+
inTree?: (root: string, members: readonly {
|
|
82
|
+
name: string;
|
|
83
|
+
dir: string;
|
|
84
|
+
kind: string;
|
|
85
|
+
}[]) => Promise<void>;
|
|
68
86
|
}
|
|
69
87
|
export interface GraphResult {
|
|
70
88
|
doc: GraphDocument;
|
|
71
89
|
/** A member failed or couldn't be read, or the declaration couldn't be read. */
|
|
72
90
|
failed: boolean;
|
|
91
|
+
/** With {@link GraphQuery.components}: each member's component graph run, in plan order. */
|
|
92
|
+
components?: UnitResult[];
|
|
73
93
|
}
|
|
94
|
+
/** The command line a member runs for its component graph (#2662). */
|
|
95
|
+
export declare function componentGraphArgv(args: Partial<ParsedArgs>): string[];
|
|
74
96
|
/**
|
|
75
97
|
* Export the workspace root's tree at `at` into a temporary directory and link
|
|
76
98
|
* the working tree's `node_modules` into it, so members' configs resolve the
|