@substrat-run/cli 0.45.0 → 0.46.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/bump.d.ts +120 -0
- package/dist/bump.d.ts.map +1 -0
- package/dist/bump.js +780 -0
- package/dist/bump.js.map +1 -0
- package/dist/changeset.d.ts +129 -0
- package/dist/changeset.d.ts.map +1 -0
- package/dist/changeset.js +336 -0
- package/dist/changeset.js.map +1 -0
- package/dist/cli.js +77 -1
- package/dist/cli.js.map +1 -1
- package/dist/concept.d.ts +19 -0
- package/dist/concept.d.ts.map +1 -0
- package/dist/concept.js +25 -0
- package/dist/concept.js.map +1 -0
- package/package.json +4 -4
package/dist/bump.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The semver bump a vertical's change calls for, computed from its artifacts of record (#2364).
|
|
3
|
+
*
|
|
4
|
+
* Choosing a bump is a judgement an agent makes with confidence and gets wrong, and a breaking
|
|
5
|
+
* change marked `patch` looks exactly like a green release. A vertical already checks in every
|
|
6
|
+
* fact the judgement needs — `model.json` (`lint:model`), `openapi.json` (`lint:api`) and
|
|
7
|
+
* `PERMISSIONS.md` (`lint:permissions`), each held to the source by a `--check` re-emit — so the
|
|
8
|
+
* bump is read off the diff of those three files instead of asked for.
|
|
9
|
+
*
|
|
10
|
+
* The rules, one level per change, the bump being the highest. An INPUT is what a caller sends
|
|
11
|
+
* (parameters, request bodies); an OUTPUT is what a caller reads (responses, stored rows in
|
|
12
|
+
* `model.json`, event payloads).
|
|
13
|
+
*
|
|
14
|
+
* - **major**: something removed or narrowed. An operation, field, entity, state, transition,
|
|
15
|
+
* response, media type, enum value, parent edge, derived handler or export; an input that
|
|
16
|
+
* became required, tighter (`minLength` up, `maxLength` down, …), closed to unnamed
|
|
17
|
+
* properties or `readOnly`; an output that may now be omitted, looser, or `writeOnly`; a
|
|
18
|
+
* type, key, table, initial state or `operationId` changed; trash terms changed.
|
|
19
|
+
* - **minor**: something added. An operation, field, entity, state, transition, enum value,
|
|
20
|
+
* response or stamp; an input that became optional or looser; an output that became required
|
|
21
|
+
* or tighter; a `default` added, changed or dropped (a caller who omits the value gets other
|
|
22
|
+
* behaviour); `readOnly`/`writeOnly` dropped, or set in the direction that does not use the
|
|
23
|
+
* field; `erasable` gained or lost (lost is flagged). Every permission change is at least
|
|
24
|
+
* minor and FLAGGED for the human checkpoint (CLAUDE.md, "Two human checkpoints") — a
|
|
25
|
+
* narrowing and a widening alike, since a key gaining a role is the risk surface it exists for.
|
|
26
|
+
* - **patch**: only what describes: the schema keywords `description`, `title`, `examples`,
|
|
27
|
+
* `example`, `$comment`, `deprecated` and any `x-*`; an operation's `summary`, `description`,
|
|
28
|
+
* `tags`, `externalDocs` and `deprecated`; `info`; a permission key's description.
|
|
29
|
+
*
|
|
30
|
+
* **What it cannot read is major.** A keyword, section or key this module does not know is
|
|
31
|
+
* judged as a breaking change, never skipped. The CI check refuses a changeset that declares
|
|
32
|
+
* LESS than this, so an unknown shape that read as "no change" would let a real break ship as a
|
|
33
|
+
* patch. A false major costs a reviewed override line in the changeset; a false patch costs a
|
|
34
|
+
* broken consumer. Teach this file the new shape instead.
|
|
35
|
+
*
|
|
36
|
+
* Two known limits, both stated rather than fixed:
|
|
37
|
+
*
|
|
38
|
+
* - **Alternatives reordered rank major.** `anyOf`/`oneOf`/`allOf` branches are compared by
|
|
39
|
+
* position (the emitter writes them in declaration order), so a reorder with no other change
|
|
40
|
+
* reads as every branch changing. The safe direction: a reviewed override covers it.
|
|
41
|
+
* - **A component renamed with identical content ranks none.** `$ref`s are resolved before
|
|
42
|
+
* comparing, so `#/components/schemas/A` → `B` is invisible, although a client generated from
|
|
43
|
+
* `openapi.json` names its types after components. Nothing a caller sends or reads changed,
|
|
44
|
+
* and this repo's browser client is generated from `spec/model.ts`, not from component names.
|
|
45
|
+
*
|
|
46
|
+
* Pure: two texts in, a classification out. The filesystem and git half is `changeset.ts`. It
|
|
47
|
+
* reads the artifacts, never the TypeScript, which is what keeps it valid across a change of
|
|
48
|
+
* authoring notation (`tools/model-diff.mts`). The same classifier is what `substrat changeset`
|
|
49
|
+
* writes, what `--check` holds a hand-written changeset to, and what a status line can show.
|
|
50
|
+
*/
|
|
51
|
+
export type Level = 'patch' | 'minor' | 'major';
|
|
52
|
+
export type Bump = 'none' | Level;
|
|
53
|
+
export type Artifact = 'model' | 'openapi' | 'permissions';
|
|
54
|
+
export interface Change {
|
|
55
|
+
readonly level: Level;
|
|
56
|
+
readonly artifact: Artifact;
|
|
57
|
+
/** Where in the artifact, as a reader would name it (`POST /api/lists`, `entities.item.fields.text`). */
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly detail: string;
|
|
60
|
+
/** A permission change the human checkpoint must read, whatever the bump. */
|
|
61
|
+
readonly flagged?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface Classification {
|
|
64
|
+
readonly bump: Bump;
|
|
65
|
+
readonly changes: readonly Change[];
|
|
66
|
+
}
|
|
67
|
+
export declare const rank: (b: Bump) => number;
|
|
68
|
+
export declare const maxBump: (a: Bump, b: Bump) => Bump;
|
|
69
|
+
export declare const isBump: (s: string) => s is Bump;
|
|
70
|
+
/**
|
|
71
|
+
* Every local `$ref` (`#/…`) replaced by its target, recursively, against `root`. Compared
|
|
72
|
+
* unresolved, a break inside a shared component reads as an unchanged `{"$ref": …}` on both
|
|
73
|
+
* sides. A reference that loops back is left as the reference.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveRefs(node: unknown, root?: unknown, seen?: readonly string[]): unknown;
|
|
76
|
+
/**
|
|
77
|
+
* Which way a schema's values travel. An `input` is what a caller SENDS: requiring more of it
|
|
78
|
+
* breaks the caller, accepting more does not. An `output` is what a caller READS (a response, a
|
|
79
|
+
* stored row, an event payload): promising less of it breaks the reader, promising more does not.
|
|
80
|
+
*/
|
|
81
|
+
export type Direction = 'input' | 'output';
|
|
82
|
+
export declare function classifyModel(baseText: string | null, headText: string | null): Classification;
|
|
83
|
+
export declare function classifyOpenApi(baseText: string | null, headText: string | null): Classification;
|
|
84
|
+
/**
|
|
85
|
+
* The parts of `PERMISSIONS.md` that carry a fact: one map per section, from a row's first
|
|
86
|
+
* cell (a key, a role, an entity type, a scheduled operation) to the row.
|
|
87
|
+
*/
|
|
88
|
+
export interface PermissionSnapshot {
|
|
89
|
+
/** Permission key → its description and declaring module. */
|
|
90
|
+
readonly registry: Record<string, string[]>;
|
|
91
|
+
/** Role → the keys it holds. */
|
|
92
|
+
readonly roles: Record<string, string[]>;
|
|
93
|
+
/** Entity type → keys granted per entity, then its remaining cells as written. */
|
|
94
|
+
readonly grantShapes: Record<string, {
|
|
95
|
+
keys: string[];
|
|
96
|
+
terms: string[];
|
|
97
|
+
}>;
|
|
98
|
+
/** Scheduled operation → the keys its system principal holds, then the remaining cells. */
|
|
99
|
+
readonly schedules: Record<string, {
|
|
100
|
+
keys: string[];
|
|
101
|
+
terms: string[];
|
|
102
|
+
}>;
|
|
103
|
+
/** Sections this parser does not read, by heading, with their text: judged whole. */
|
|
104
|
+
readonly unread: Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parse a `PERMISSIONS.md` that `tools/permission-diff.mts` emitted. Sections are found by
|
|
108
|
+
* their heading's words, not their number: the numbering shifts with which sections a vertical
|
|
109
|
+
* has (§4 is grant shapes in one file and "not covered" in another).
|
|
110
|
+
*/
|
|
111
|
+
export declare function parsePermissions(text: string): PermissionSnapshot;
|
|
112
|
+
export declare function classifyPermissions(baseText: string | null, headText: string | null): Classification;
|
|
113
|
+
/** One vertical's three artifacts as text, `null` where the file does not exist. */
|
|
114
|
+
export interface Artifacts {
|
|
115
|
+
readonly model: string | null;
|
|
116
|
+
readonly openapi: string | null;
|
|
117
|
+
readonly permissions: string | null;
|
|
118
|
+
}
|
|
119
|
+
export declare function classify(base: Artifacts, head: Artifacts): Classification;
|
|
120
|
+
//# sourceMappingURL=bump.d.ts.map
|
|
@@ -0,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