vigiles 39.1.0 → 40.0.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/adapter.d.ts +3 -2
- package/dist/adapters/claude-code/dialect.js +9 -0
- package/dist/adapters/claude-code/output-style.js +15 -0
- package/dist/adapters/claude-code/skill-listing.d.ts +48 -0
- package/dist/adapters/claude-code/skill-listing.js +54 -0
- package/dist/adapters/codex/dialect.js +4 -0
- package/dist/adapters/codex/layout.js +5 -0
- package/dist/adapters/codex/mock-model.d.ts +7 -0
- package/dist/adapters/codex/mock-model.js +1 -0
- package/dist/adapters/codex/skill-listing.d.ts +42 -0
- package/dist/adapters/codex/skill-listing.js +40 -0
- package/dist/audit-html.js +7 -2
- package/dist/audit-report.d.ts +51 -0
- package/dist/audit-report.js +54 -8
- package/dist/audit-report.template.html +38 -33
- package/dist/cli-flag-check.d.ts +1 -1
- package/dist/cli-flag-check.js +1 -1
- package/dist/cli-main.d.ts +9 -3
- package/dist/cli-main.js +33 -18
- package/dist/{instruction-weight-ratchet.d.ts → context-creep-ratchet.d.ts} +34 -12
- package/dist/context-creep-ratchet.js +270 -0
- package/dist/core/adopt.js +32 -8
- package/dist/core/always-loaded.d.ts +128 -0
- package/dist/core/always-loaded.js +134 -0
- package/dist/core/compile.d.ts +1 -1
- package/dist/core/compile.js +48 -15
- package/dist/core/dialect.d.ts +10 -1
- package/dist/core/dialect.js +2 -0
- package/dist/core/harness-unit.d.ts +20 -0
- package/dist/core/harness-unit.js +24 -0
- package/dist/core/instruction-baseline.d.ts +179 -11
- package/dist/core/instruction-baseline.js +349 -47
- package/dist/core/instruction-weight.d.ts +2 -11
- package/dist/core/instruction-weight.js +6 -16
- package/dist/core/layout.d.ts +40 -0
- package/dist/core/layout.js +25 -1
- package/dist/core/output-style.d.ts +20 -0
- package/dist/core/skill-listing.d.ts +49 -0
- package/dist/core/skill-listing.js +23 -0
- package/dist/core/spec.d.ts +17 -0
- package/dist/core/types.d.ts +2 -2
- package/dist/deprecated-key-files.d.ts +1 -1
- package/dist/deprecated-key-files.js +1 -1
- package/dist/doc-commands.d.ts +2 -2
- package/dist/fs-walk.d.ts +31 -0
- package/dist/fs-walk.js +49 -0
- package/dist/local-files.js +2 -1
- package/dist/plugin-loader.js +40 -19
- package/dist/rules/index.d.ts +4 -4
- package/dist/rules/index.js +7 -7
- package/dist/scan-files.js +24 -3
- package/dist/scan.d.ts +30 -1
- package/dist/scan.js +69 -3
- package/dist/skill-harness.d.ts +3 -1
- package/dist/skill-harness.js +5 -2
- package/dist/surface-discovery-fs.d.ts +15 -0
- package/dist/surface-discovery-fs.js +55 -0
- package/dist/vigilesrc.schema.json +2 -2
- package/hooks/session-start.sh +3 -1
- package/package.json +1 -1
- package/dist/instruction-weight-ratchet.js +0 -181
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The context-creep RATCHET: the always-loaded weight may not grow past
|
|
3
3
|
* what the repository itself last recorded.
|
|
4
4
|
*
|
|
5
5
|
* WHY A RATCHET AND NOT THE BUDGET. `./instruction-weight.ts` explains why the
|
|
@@ -32,17 +32,76 @@
|
|
|
32
32
|
* baseline is allowed and is the point: growth is not forbidden, it is made
|
|
33
33
|
* visible as a reviewed diff of a committed file.
|
|
34
34
|
*
|
|
35
|
+
* VERSION 2 — THE ALWAYS-LOADED CONTEXT. The output style the committed settings select
|
|
36
|
+
* and the skill listing load at session start exactly as the instructions do
|
|
37
|
+
* (`./always-loaded.ts`), so a section moved from `CLAUDE.md` into either is
|
|
38
|
+
* the same relocation the sum above exists to see. A version-2 entry carries
|
|
39
|
+
* them as `parts`, each with its own `measure`, and the verdict is decided on
|
|
40
|
+
* the SUM of the instructions and every recorded part. Per part, so a change
|
|
41
|
+
* to how one part is measured asks to re-record that part by name.
|
|
42
|
+
*
|
|
43
|
+
* ⚠️ THE TRADE-OFF OF A STRICT FILE, stated rather than hidden. Version 1 was
|
|
44
|
+
* read with `.strict()` and `z.literal(1)`, so there is no extension of it an
|
|
45
|
+
* OLDER vigiles accepts: it reads a version-2 file as "cannot be read", which
|
|
46
|
+
* is a finding at the rule's severity — red CI wherever lint still runs the old
|
|
47
|
+
* release, the moment one teammate re-records. Loud, never silent, but red. The
|
|
48
|
+
* alternative, a sibling file old readers ignore, would split one gated sum
|
|
49
|
+
* across two files, so that a move from one to the other read as a shrink in
|
|
50
|
+
* each. What keeps the cost small:
|
|
51
|
+
*
|
|
52
|
+
* - a repo still on version 1 is read as before — the instructions gate as
|
|
53
|
+
* they did, and each new part that is not zero is a NOTE, never a finding,
|
|
54
|
+
* so upgrading vigiles never turns CI red;
|
|
55
|
+
* - `--update-baseline` writes version 2 only when some part is not zero, so
|
|
56
|
+
* a repo with no output style and no listed skill keeps a version-1 file
|
|
57
|
+
* every release reads — and, once a file is version 2, keeps it there even
|
|
58
|
+
* when every part drops to zero, so re-adding a part is growth, not a note;
|
|
59
|
+
* - the note and the rule doc say to upgrade vigiles wherever lint runs
|
|
60
|
+
* BEFORE re-recording.
|
|
61
|
+
*
|
|
35
62
|
* Pure: parsing, comparison and formatting only. Reading and writing the file
|
|
36
|
-
* is the caller's (`src/
|
|
63
|
+
* is the caller's (`src/context-creep-ratchet.ts`).
|
|
37
64
|
*/
|
|
38
65
|
import { z } from "zod";
|
|
39
66
|
import type { InstructionWeight } from "./instruction-weight.js";
|
|
67
|
+
import type { AlwaysLoadedContext, LoadedPart, LoadedPartName } from "./always-loaded.js";
|
|
40
68
|
/** Where the baseline lives, relative to the directory `.vigilesrc.json` is read from. */
|
|
41
|
-
export declare const INSTRUCTION_BASELINE_FILE = ".vigiles/
|
|
69
|
+
export declare const INSTRUCTION_BASELINE_FILE = ".vigiles/context-creep.json";
|
|
70
|
+
/**
|
|
71
|
+
* The name this baseline had before the rule became `context-creep`. Still
|
|
72
|
+
* READ when the new file is absent (a repo upgrading keeps its ratchet), never
|
|
73
|
+
* written; {@link legacyBaselineNote} tells the author how to move it.
|
|
74
|
+
*/
|
|
75
|
+
export declare const LEGACY_INSTRUCTION_BASELINE_FILE = ".vigiles/instruction-weight.json";
|
|
76
|
+
/** Which of the two baseline files exist: neither/only the new one, the old one alone, or both. */
|
|
77
|
+
export type LegacyBaseline = "none" | "only" | "both";
|
|
78
|
+
/** The command that renames the old baseline — quoted verbatim by the note. */
|
|
79
|
+
export declare const RENAME_BASELINE_COMMAND = "git mv .vigiles/instruction-weight.json .vigiles/context-creep.json";
|
|
80
|
+
/** The command that drops a stale old baseline once the new one exists. */
|
|
81
|
+
export declare const REMOVE_LEGACY_BASELINE_COMMAND = "git rm .vigiles/instruction-weight.json";
|
|
82
|
+
/**
|
|
83
|
+
* The one-sentence NOTE (never a finding) for a repo that still has the old
|
|
84
|
+
* file, or `undefined` when it has not. The exact command is in the text: the
|
|
85
|
+
* session-start hook injects `lint --summary` into the agent, and the agent
|
|
86
|
+
* runs the command.
|
|
87
|
+
*/
|
|
88
|
+
export declare function legacyBaselineNote(legacy: LegacyBaseline): string | undefined;
|
|
42
89
|
/** The command that writes the baseline — named once, quoted by every message. */
|
|
43
90
|
export declare const UPDATE_BASELINE_COMMAND = "vigiles lint --update-baseline";
|
|
44
|
-
/**
|
|
45
|
-
|
|
91
|
+
/**
|
|
92
|
+
* The newest on-disk shape this release reads and writes. Bumped only on an
|
|
93
|
+
* incompatible change. Version 1 is still read, and still WRITTEN when no
|
|
94
|
+
* always-loaded part has anything in it — see the header for why.
|
|
95
|
+
*/
|
|
96
|
+
export declare const INSTRUCTION_BASELINE_VERSION = 2;
|
|
97
|
+
/**
|
|
98
|
+
* Which measurement produced a recorded PART — the same job as
|
|
99
|
+
* {@link INSTRUCTION_WEIGHT_MEASURE}, per part, so a change to how the skill
|
|
100
|
+
* listing is rendered re-records the listing and names it.
|
|
101
|
+
*/
|
|
102
|
+
export declare const LOADED_PART_MEASURE = 1;
|
|
103
|
+
/** The parts a version-2 entry may carry, in the order they are printed. */
|
|
104
|
+
export declare const LOADED_PART_NAMES: readonly LoadedPartName[];
|
|
46
105
|
/**
|
|
47
106
|
* Which MEASUREMENT produced a recorded number — bumped whenever a release
|
|
48
107
|
* changes what counts (chain membership in any adapter, how a file is sized),
|
|
@@ -55,6 +114,11 @@ export declare const INSTRUCTION_BASELINE_VERSION = 1;
|
|
|
55
114
|
* describes the file, not the number in it.
|
|
56
115
|
*/
|
|
57
116
|
export declare const INSTRUCTION_WEIGHT_MEASURE = 1;
|
|
117
|
+
declare const partSchema: z.ZodObject<{
|
|
118
|
+
measure: z.ZodNumber;
|
|
119
|
+
total: z.ZodNumber;
|
|
120
|
+
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
121
|
+
}, z.core.$strict>;
|
|
58
122
|
declare const entrySchema: z.ZodObject<{
|
|
59
123
|
unit: z.ZodEnum<{
|
|
60
124
|
chars: "chars";
|
|
@@ -63,9 +127,21 @@ declare const entrySchema: z.ZodObject<{
|
|
|
63
127
|
measure: z.ZodNumber;
|
|
64
128
|
total: z.ZodNumber;
|
|
65
129
|
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
130
|
+
parts: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
"output-style": z.ZodOptional<z.ZodObject<{
|
|
132
|
+
measure: z.ZodNumber;
|
|
133
|
+
total: z.ZodNumber;
|
|
134
|
+
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
"skill-listing": z.ZodOptional<z.ZodObject<{
|
|
137
|
+
measure: z.ZodNumber;
|
|
138
|
+
total: z.ZodNumber;
|
|
139
|
+
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
66
142
|
}, z.core.$strict>;
|
|
67
143
|
declare const baselineSchema: z.ZodObject<{
|
|
68
|
-
version: z.ZodLiteral<1>;
|
|
144
|
+
version: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
69
145
|
bundles: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
70
146
|
unit: z.ZodEnum<{
|
|
71
147
|
chars: "chars";
|
|
@@ -74,10 +150,24 @@ declare const baselineSchema: z.ZodObject<{
|
|
|
74
150
|
measure: z.ZodNumber;
|
|
75
151
|
total: z.ZodNumber;
|
|
76
152
|
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
153
|
+
parts: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
"output-style": z.ZodOptional<z.ZodObject<{
|
|
155
|
+
measure: z.ZodNumber;
|
|
156
|
+
total: z.ZodNumber;
|
|
157
|
+
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
"skill-listing": z.ZodOptional<z.ZodObject<{
|
|
160
|
+
measure: z.ZodNumber;
|
|
161
|
+
total: z.ZodNumber;
|
|
162
|
+
files: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
163
|
+
}, z.core.$strict>>;
|
|
164
|
+
}, z.core.$strict>>;
|
|
77
165
|
}, z.core.$strict>>;
|
|
78
166
|
}, z.core.$strict>;
|
|
79
167
|
/** One bundle's recorded weight. */
|
|
80
|
-
export type BaselineEntry = z.infer<typeof entrySchema
|
|
168
|
+
export type BaselineEntry = Readonly<z.infer<typeof entrySchema>>;
|
|
169
|
+
/** One recorded always-loaded part. */
|
|
170
|
+
export type BaselinePart = Readonly<z.infer<typeof partSchema>>;
|
|
81
171
|
/** The whole committed file. */
|
|
82
172
|
export type InstructionBaseline = z.infer<typeof baselineSchema>;
|
|
83
173
|
/** The file's contents, parsed once at the boundary. */
|
|
@@ -89,8 +179,11 @@ export type ParsedBaseline = {
|
|
|
89
179
|
readonly message: string;
|
|
90
180
|
};
|
|
91
181
|
export declare function parseInstructionBaseline(text: string): ParsedBaseline;
|
|
92
|
-
/**
|
|
93
|
-
|
|
182
|
+
/**
|
|
183
|
+
* What a measured weight would be recorded as: the SCORED files only, plus
|
|
184
|
+
* every always-loaded part that is not zero when one is handed in.
|
|
185
|
+
*/
|
|
186
|
+
export declare function entryFor(weight: InstructionWeight, loaded?: AlwaysLoadedContext): BaselineEntry;
|
|
94
187
|
/** One file whose recorded size differs. `null` = absent on that side. */
|
|
95
188
|
export interface FileChange {
|
|
96
189
|
readonly path: string;
|
|
@@ -114,6 +207,8 @@ export type RatchetVerdict = {
|
|
|
114
207
|
readonly kind: "measure-changed";
|
|
115
208
|
readonly recorded: number;
|
|
116
209
|
readonly current: number;
|
|
210
|
+
/** Set when it is one always-loaded PART whose measurement changed. */
|
|
211
|
+
readonly part?: LoadedPartName;
|
|
117
212
|
} | {
|
|
118
213
|
readonly kind: "held";
|
|
119
214
|
readonly total: number;
|
|
@@ -127,6 +222,66 @@ export type RatchetVerdict = {
|
|
|
127
222
|
readonly changes: readonly FileChange[];
|
|
128
223
|
};
|
|
129
224
|
export declare function compareToBaseline(weight: InstructionWeight, recorded: BaselineEntry | undefined): RatchetVerdict;
|
|
225
|
+
/** One part's recorded and current size, for the line that says where weight moved. */
|
|
226
|
+
export interface PartMove {
|
|
227
|
+
readonly part: "instructions" | LoadedPartName;
|
|
228
|
+
readonly from: number;
|
|
229
|
+
readonly to: number;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The ratchet's verdict for one bundle with its always-loaded context:
|
|
233
|
+
*
|
|
234
|
+
* - `instructions-only` — decided on the instructions as before. A version-1
|
|
235
|
+
* file, or a repo with no part to add and no file yet. Each part that is
|
|
236
|
+
* not zero is listed so the caller can print it as a NOTE.
|
|
237
|
+
* - `always-loaded` — decided on the SUM of the instructions and the parts: a
|
|
238
|
+
* version-2 file, or no file yet and something to add (recording then
|
|
239
|
+
* writes version 2). `byPart` says where weight moved, also on `held`,
|
|
240
|
+
* because a held sum can hide a listing that doubled while the
|
|
241
|
+
* instructions halved.
|
|
242
|
+
*/
|
|
243
|
+
export type BaselineVerdict = {
|
|
244
|
+
readonly kind: "instructions-only";
|
|
245
|
+
readonly verdict: RatchetVerdict;
|
|
246
|
+
readonly unrecordedParts: readonly {
|
|
247
|
+
readonly part: LoadedPartName;
|
|
248
|
+
readonly total: number;
|
|
249
|
+
}[];
|
|
250
|
+
} | {
|
|
251
|
+
readonly kind: "always-loaded";
|
|
252
|
+
readonly verdict: RatchetVerdict;
|
|
253
|
+
readonly byPart: readonly PartMove[];
|
|
254
|
+
/** Recorded parts this run cannot measure, carried rather than compared. */
|
|
255
|
+
readonly unmeasured: readonly UnmeasuredPart[];
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* A part the baseline records and this run cannot measure: the adapter no
|
|
259
|
+
* longer models it (`not-modelled`), the harness has no such part
|
|
260
|
+
* (`not-supported`), or the selected style names no repository file
|
|
261
|
+
* (`unresolved`). None of these is ZERO (`./always-loaded.ts` keeps them apart
|
|
262
|
+
* for that reason), so the recorded size is carried into the comparison and
|
|
263
|
+
* into a re-record instead of being read as a cut. Reading it as 0 would print
|
|
264
|
+
* "shrank … lock the cut in", and following that advice would delete the part
|
|
265
|
+
* — and, with no part left, turn the file back into version 1, silently
|
|
266
|
+
* returning the gate to the instructions alone.
|
|
267
|
+
*/
|
|
268
|
+
export interface UnmeasuredPart {
|
|
269
|
+
readonly part: LoadedPartName;
|
|
270
|
+
readonly kind: Exclude<LoadedPart["kind"], "counted" | "none">;
|
|
271
|
+
readonly recorded: number;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* `current` with every recorded part this run cannot measure carried over from
|
|
275
|
+
* `recorded`, and the list of those parts. `counted` and `none` are measured —
|
|
276
|
+
* `none` is a real zero — so they are never carried.
|
|
277
|
+
*/
|
|
278
|
+
export declare function carryUnmeasured(current: BaselineEntry, loaded: AlwaysLoadedContext, recorded: BaselineEntry | undefined): {
|
|
279
|
+
readonly entry: BaselineEntry;
|
|
280
|
+
readonly unmeasured: readonly UnmeasuredPart[];
|
|
281
|
+
};
|
|
282
|
+
/** Which version of the file the verdict is read against; `absent` = no file. */
|
|
283
|
+
export type BaselineFileVersion = 1 | typeof INSTRUCTION_BASELINE_VERSION | "absent";
|
|
284
|
+
export declare function compareAlwaysLoadedToBaseline(weight: InstructionWeight, loaded: AlwaysLoadedContext, recorded: BaselineEntry | undefined, file: BaselineFileVersion): BaselineVerdict;
|
|
130
285
|
/** One file's size, for naming where the weight is. */
|
|
131
286
|
export interface FileWeight {
|
|
132
287
|
readonly path: string;
|
|
@@ -154,12 +309,25 @@ export declare function recordEntries(previous: InstructionBaseline | undefined,
|
|
|
154
309
|
/** Stable text: sorted keys, two-space indent, trailing newline, no timestamp. */
|
|
155
310
|
export declare function serializeBaseline(baseline: InstructionBaseline): string;
|
|
156
311
|
/** The one-paragraph message a verdict prints as, prefixed by its bundle. */
|
|
157
|
-
export declare function formatVerdict(verdict: RatchetVerdict, at: string): string;
|
|
312
|
+
export declare function formatVerdict(verdict: RatchetVerdict, at: string, subject?: string): string;
|
|
313
|
+
/** The message for one bundle's {@link BaselineVerdict}, prefixed by its bundle. */
|
|
314
|
+
export declare function formatBaselineVerdict(verdict: BaselineVerdict, at: string): string;
|
|
315
|
+
/** Why a recorded part was carried: the run could not measure it, not a cut. */
|
|
316
|
+
export declare function describeUnmeasured(u: UnmeasuredPart): string;
|
|
317
|
+
/**
|
|
318
|
+
* The NOTE a version-1 file gets for each part that is not zero: always
|
|
319
|
+
* loaded, not yet in the baseline, and what recording it does — including the
|
|
320
|
+
* one cost of recording, an older vigiles reading the new file as unreadable.
|
|
321
|
+
*/
|
|
322
|
+
export declare function formatUnrecordedParts(parts: readonly {
|
|
323
|
+
readonly part: LoadedPartName;
|
|
324
|
+
readonly total: number;
|
|
325
|
+
}[], unit: BaselineEntry["unit"], at: string): string;
|
|
158
326
|
/** The message for a total over the ceiling, prefixed by its bundle. */
|
|
159
327
|
export declare function formatCeiling(verdict: CeilingVerdict, at: string): string;
|
|
160
328
|
/** Why `--update-baseline` wrote nothing: the ceiling it would have been recorded above. */
|
|
161
329
|
export declare function formatRefusal(verdict: CeilingVerdict, at: string): string;
|
|
162
330
|
/** The compile-time one-liner: weight now, against the baseline when there is one. */
|
|
163
|
-
export declare function formatWeightLine(verdict: RatchetVerdict): string;
|
|
331
|
+
export declare function formatWeightLine(verdict: RatchetVerdict, label?: string): string;
|
|
164
332
|
export {};
|
|
165
333
|
//# sourceMappingURL=instruction-baseline.d.ts.map
|