@metaobjectsdev/cli 1.0.0-rc.5 → 1.0.0-rc.7
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/src/commands/docs.d.ts.map +1 -1
- package/dist/src/commands/docs.js +41 -9
- package/dist/src/commands/docs.js.map +1 -1
- package/dist/src/commands/gen.d.ts +5 -0
- package/dist/src/commands/gen.d.ts.map +1 -1
- package/dist/src/commands/gen.js +12 -1
- package/dist/src/commands/gen.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +27 -3
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/migrate.d.ts +5 -0
- package/dist/src/commands/migrate.d.ts.map +1 -1
- package/dist/src/commands/migrate.js +10 -4
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/prompt-snapshot.d.ts.map +1 -1
- package/dist/src/commands/prompt-snapshot.js +2 -1
- package/dist/src/commands/prompt-snapshot.js.map +1 -1
- package/dist/src/commands/types.d.ts.map +1 -1
- package/dist/src/commands/types.js +12 -3
- package/dist/src/commands/types.js.map +1 -1
- package/dist/src/commands/upgrade.d.ts.map +1 -1
- package/dist/src/commands/upgrade.js +62 -4
- package/dist/src/commands/upgrade.js.map +1 -1
- package/dist/src/commands/verify.d.ts.map +1 -1
- package/dist/src/commands/verify.js +69 -21
- package/dist/src/commands/verify.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +37 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/advisory.d.ts +6 -0
- package/dist/src/lib/advisory.d.ts.map +1 -1
- package/dist/src/lib/advisory.js +13 -0
- package/dist/src/lib/advisory.js.map +1 -1
- package/dist/src/lib/anti-patterns.d.ts.map +1 -1
- package/dist/src/lib/anti-patterns.js +8 -4
- package/dist/src/lib/anti-patterns.js.map +1 -1
- package/dist/src/lib/args.d.ts +23 -12
- package/dist/src/lib/args.d.ts.map +1 -1
- package/dist/src/lib/args.js +33 -22
- package/dist/src/lib/args.js.map +1 -1
- package/dist/src/lib/authored-source.d.ts +22 -0
- package/dist/src/lib/authored-source.d.ts.map +1 -0
- package/dist/src/lib/authored-source.js +46 -0
- package/dist/src/lib/authored-source.js.map +1 -0
- package/dist/src/lib/base-url-advisory.d.ts +37 -0
- package/dist/src/lib/base-url-advisory.d.ts.map +1 -0
- package/dist/src/lib/base-url-advisory.js +168 -0
- package/dist/src/lib/base-url-advisory.js.map +1 -0
- package/dist/src/lib/codegen-drift.d.ts +8 -0
- package/dist/src/lib/codegen-drift.d.ts.map +1 -1
- package/dist/src/lib/codegen-drift.js +43 -10
- package/dist/src/lib/codegen-drift.js.map +1 -1
- package/dist/src/lib/detect-stack.d.ts +17 -0
- package/dist/src/lib/detect-stack.d.ts.map +1 -1
- package/dist/src/lib/detect-stack.js +64 -2
- package/dist/src/lib/detect-stack.js.map +1 -1
- package/dist/src/lib/docs-drift.d.ts.map +1 -1
- package/dist/src/lib/docs-drift.js +16 -7
- package/dist/src/lib/docs-drift.js.map +1 -1
- package/dist/src/lib/git-ignore.d.ts +19 -0
- package/dist/src/lib/git-ignore.d.ts.map +1 -1
- package/dist/src/lib/git-ignore.js +46 -3
- package/dist/src/lib/git-ignore.js.map +1 -1
- package/dist/src/lib/ignored-scaffold-check.d.ts +12 -0
- package/dist/src/lib/ignored-scaffold-check.d.ts.map +1 -0
- package/dist/src/lib/ignored-scaffold-check.js +75 -0
- package/dist/src/lib/ignored-scaffold-check.js.map +1 -0
- package/dist/src/lib/load-error.d.ts +46 -0
- package/dist/src/lib/load-error.d.ts.map +1 -0
- package/dist/src/lib/load-error.js +51 -0
- package/dist/src/lib/load-error.js.map +1 -0
- package/dist/src/lib/load-metaobjects-config.d.ts +13 -0
- package/dist/src/lib/load-metaobjects-config.d.ts.map +1 -1
- package/dist/src/lib/load-metaobjects-config.js +54 -5
- package/dist/src/lib/load-metaobjects-config.js.map +1 -1
- package/dist/src/lib/manifest-ignored-check.d.ts.map +1 -1
- package/dist/src/lib/manifest-ignored-check.js +19 -6
- package/dist/src/lib/manifest-ignored-check.js.map +1 -1
- package/dist/src/lib/output.d.ts +13 -1
- package/dist/src/lib/output.d.ts.map +1 -1
- package/dist/src/lib/output.js +26 -8
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/rel-posix.d.ts +5 -0
- package/dist/src/lib/rel-posix.d.ts.map +1 -0
- package/dist/src/lib/rel-posix.js +23 -0
- package/dist/src/lib/rel-posix.js.map +1 -0
- package/dist/src/lib/replay-remedy.d.ts +2 -0
- package/dist/src/lib/replay-remedy.d.ts.map +1 -0
- package/dist/src/lib/replay-remedy.js +69 -0
- package/dist/src/lib/replay-remedy.js.map +1 -0
- package/dist/src/lib/wrangler.d.ts +17 -2
- package/dist/src/lib/wrangler.d.ts.map +1 -1
- package/dist/src/lib/wrangler.js +51 -2
- package/dist/src/lib/wrangler.js.map +1 -1
- package/package.json +10 -10
- package/src/commands/docs.ts +51 -12
- package/src/commands/gen.ts +14 -1
- package/src/commands/init.ts +27 -3
- package/src/commands/migrate.ts +12 -4
- package/src/commands/prompt-snapshot.ts +2 -1
- package/src/commands/types.ts +12 -3
- package/src/commands/upgrade.ts +69 -4
- package/src/commands/verify.ts +74 -23
- package/src/index.ts +37 -18
- package/src/lib/advisory.ts +15 -0
- package/src/lib/anti-patterns.ts +7 -5
- package/src/lib/args.ts +60 -39
- package/src/lib/authored-source.ts +45 -0
- package/src/lib/base-url-advisory.ts +178 -0
- package/src/lib/codegen-drift.ts +52 -9
- package/src/lib/detect-stack.ts +73 -2
- package/src/lib/docs-drift.ts +17 -7
- package/src/lib/git-ignore.ts +47 -3
- package/src/lib/ignored-scaffold-check.ts +78 -0
- package/src/lib/load-error.ts +89 -0
- package/src/lib/load-metaobjects-config.ts +53 -5
- package/src/lib/manifest-ignored-check.ts +21 -6
- package/src/lib/output.ts +36 -8
- package/src/lib/rel-posix.ts +25 -0
- package/src/lib/replay-remedy.ts +78 -0
- package/src/lib/wrangler.ts +52 -4
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { mkdtempSync, rmSync, existsSync, readFileSync, readdirSync, statSync, cpSync, } from "node:fs";
|
|
31
31
|
import { tmpdir } from "node:os";
|
|
32
32
|
import { join, relative, resolve, isAbsolute } from "node:path";
|
|
33
|
-
import { runGen, contentHash, readGeneratedHash, listGeneratedPaths, } from "@metaobjectsdev/codegen-ts";
|
|
33
|
+
import { runGen, contentHash, readGeneratedHash, listGeneratedPaths, NAMES_FILE_SUFFIX, } from "@metaobjectsdev/codegen-ts";
|
|
34
34
|
/** Collect the committed outDirs declared by the config (default + per-target),
|
|
35
35
|
* resolved against `projectRoot` — a relative outDir (the common, portable,
|
|
36
36
|
* `meta init`-scaffolded shape) must resolve against the project the CLI's
|
|
@@ -91,6 +91,7 @@ export async function computeCodegenDrift(config, metadata, projectRoot, scope)
|
|
|
91
91
|
clean: false,
|
|
92
92
|
driftedFiles: [],
|
|
93
93
|
lines: [],
|
|
94
|
+
handEditedNames: [],
|
|
94
95
|
error: "verify --codegen: no outDir configured — cannot locate the committed " +
|
|
95
96
|
"generated output to diff against. Set 'outDir' (and/or per-target " +
|
|
96
97
|
"outDir) in metaobjects.config.ts.",
|
|
@@ -153,6 +154,7 @@ export async function computeCodegenDrift(config, metadata, projectRoot, scope)
|
|
|
153
154
|
// Diff each committed outDir against its temp mirror.
|
|
154
155
|
const driftedFiles = new Set();
|
|
155
156
|
const lines = [];
|
|
157
|
+
const handEditedNames = new Set();
|
|
156
158
|
// Whether we have any record of what we wrote here. With records, the orphan
|
|
157
159
|
// branch below can scope itself to our own output; with none, it cannot tell
|
|
158
160
|
// our stale output from a stranger's file, so the old verdict stands.
|
|
@@ -190,20 +192,51 @@ export async function computeCodegenDrift(config, metadata, projectRoot, scope)
|
|
|
190
192
|
else {
|
|
191
193
|
const a = readFileSync(join(committed, rel), "utf8");
|
|
192
194
|
const b = readFileSync(join(fresh, rel), "utf8");
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
if (a !== b) {
|
|
196
|
+
// A `<Entity>Names` artifact is the ONE generated file where a hand edit is
|
|
197
|
+
// itself the defect, so the exemption below does not reach it. RULED: if you
|
|
198
|
+
// want a constant of your own, put it in a file of your own.
|
|
199
|
+
//
|
|
200
|
+
// The exemption exists because `meta gen` MERGES a hand edit and reports
|
|
201
|
+
// "merged", so convicting it printed a remedy that could not work — gen
|
|
202
|
+
// merges again and the next verify fails identically. A names artifact is not
|
|
203
|
+
// that shape. It is a module of physical database names, every value a string:
|
|
204
|
+
// no compiler can see a wrong one, no test reads it, and the whole point of
|
|
205
|
+
// the artifact is that a name is spelled ONCE per run and referenced. So an
|
|
206
|
+
// edited one silently renames a column for every consumer of it, while the
|
|
207
|
+
// gate reports "generated output is in sync with the metadata" — the exact
|
|
208
|
+
// failure the artifact was added to prevent, committed inside the artifact.
|
|
209
|
+
//
|
|
210
|
+
// Keyed on the suffix the emitter and the reference template both spell from
|
|
211
|
+
// one constant. An adopter who owns the generator and RENAMES the artifact
|
|
212
|
+
// opts out of this — stated rather than hidden; the gate cannot recognise a
|
|
213
|
+
// file shape it was never told about.
|
|
214
|
+
if (rel.endsWith(NAMES_FILE_SUFFIX)) {
|
|
215
|
+
driftedFiles.add(relKey);
|
|
216
|
+
handEditedNames.add(relKey);
|
|
217
|
+
lines.push(`~ ${relKey} (hand-edited; a names artifact must match a fresh regen exactly — ` +
|
|
218
|
+
`put constants of your own in a file of your own)`);
|
|
219
|
+
}
|
|
220
|
+
else if (readGeneratedHash(projectGenStateDir, relKey) !== contentHash(b)) {
|
|
221
|
+
// Not `a !== b` alone: that convicts the hand edit `meta gen` preserved.
|
|
222
|
+
// The question this gate can honestly answer is "is the GENERATED
|
|
223
|
+
// contribution current?", and the recorded hash answers exactly it.
|
|
224
|
+
// FAILS CLOSED, matching `isPristineGenerated`: with no recorded hash
|
|
225
|
+
// nothing is proven, so the old byte verdict stands.
|
|
226
|
+
driftedFiles.add(relKey);
|
|
227
|
+
lines.push(`~ ${relKey} (committed content differs from a fresh regen)`);
|
|
228
|
+
}
|
|
201
229
|
}
|
|
202
230
|
}
|
|
203
231
|
}
|
|
204
232
|
}
|
|
205
233
|
const sorted = [...driftedFiles].sort();
|
|
206
|
-
return {
|
|
234
|
+
return {
|
|
235
|
+
clean: sorted.length === 0,
|
|
236
|
+
driftedFiles: sorted,
|
|
237
|
+
lines,
|
|
238
|
+
handEditedNames: [...handEditedNames].sort(),
|
|
239
|
+
};
|
|
207
240
|
}
|
|
208
241
|
finally {
|
|
209
242
|
rmSync(tempRoot, { recursive: true, force: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-drift.js","sourceRoot":"","sources":["../../../src/lib/codegen-drift.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,mFAAmF;AACnF,uCAAuC;AACvC,EAAE;AACF,6EAA6E;AAC7E,kFAAkF;AAClF,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,iFAAiF;AACjF,kFAAkF;AAClF,qCAAqC;AACrC,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,iFAAiF;AACjF,yEAAyE;AACzE,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,mEAAmE;AAEnE,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EACL,MAA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YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;4BACzB,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,iDAAiD,CAAC,CAAC;wBAC3E,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,YAAY,EAAE,MAAM;YACpB,KAAK;YACL,eAAe,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,IAAI,EAAE;SAC7C,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { type Stack } from "@metaobjectsdev/sdk/agent-context";
|
|
2
|
+
/**
|
|
3
|
+
* Refuse an unknown `--server` / `--client` value instead of dropping it.
|
|
4
|
+
*
|
|
5
|
+
* `--server node` — the CLI's own help example — used to exit 0 with no warning and record
|
|
6
|
+
* `"servers": []`. Worse than the missing four reference fragments: a non-empty override
|
|
7
|
+
* array suppresses BOTH the prior manifest's stack and detection, so the emitted context then
|
|
8
|
+
* declared "Stack: no server, no client" and told the agent that this project has no
|
|
9
|
+
* `metaobjects.config.ts` — about a project with a Fastify server, a React client, and the
|
|
10
|
+
* very config file the same CLI had just read. One silently-dropped flag value made three
|
|
11
|
+
* statements false in the artifact whose whole job is to orient an agent correctly.
|
|
12
|
+
*
|
|
13
|
+
* Either accept the value or say so; never neither.
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertKnownStackValues(overrides: {
|
|
16
|
+
servers: string[];
|
|
17
|
+
clients: string[];
|
|
18
|
+
}): void;
|
|
2
19
|
/** Resolve the stack: explicit --server/--client overrides take precedence; otherwise detect.
|
|
3
20
|
* Concern tokens (e.g. requirements) are always OBSERVED from project state, independent of
|
|
4
21
|
* any --server/--client override — a concern is not a stack axis. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-stack.d.ts","sourceRoot":"","sources":["../../../src/lib/detect-stack.ts"],"names":[],"mappings":"AAIA,OAAO,EAEkC,KAAK,KAAK,EAElD,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"detect-stack.d.ts","sourceRoot":"","sources":["../../../src/lib/detect-stack.ts"],"names":[],"mappings":"AAIA,OAAO,EAEkC,KAAK,KAAK,EAElD,MAAM,mCAAmC,CAAC;AA0E3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAoBhG;AAED;;qEAEqE;AACrE,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAcnH"}
|
|
@@ -41,14 +41,76 @@ async function probe(cwd) {
|
|
|
41
41
|
hasRequirementNodes: () => requirementNodes,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Spellings accepted for a stack value that is not the canonical one.
|
|
46
|
+
*
|
|
47
|
+
* `node` is here because the CLI's OWN `--help` gives it as an example of `--server`, and it
|
|
48
|
+
* is the more natural word for a Fastify backend run by the Node CLI. It used to be filtered
|
|
49
|
+
* out silently — see `assertKnownStackValues` for what that silence cost.
|
|
50
|
+
*/
|
|
51
|
+
const SERVER_ALIASES = {
|
|
52
|
+
node: "typescript",
|
|
53
|
+
nodejs: "typescript",
|
|
54
|
+
ts: "typescript",
|
|
55
|
+
"c#": "csharp",
|
|
56
|
+
dotnet: "csharp",
|
|
57
|
+
py: "python",
|
|
58
|
+
};
|
|
59
|
+
const CLIENT_ALIASES = {
|
|
60
|
+
reactjs: "react",
|
|
61
|
+
"react-query": "tanstack",
|
|
62
|
+
};
|
|
63
|
+
/** Canonicalize one value, or `undefined` when it names nothing we know. */
|
|
64
|
+
function canonical(raw, valid, aliases) {
|
|
65
|
+
const v = raw.trim().toLowerCase();
|
|
66
|
+
if (valid.includes(v))
|
|
67
|
+
return v;
|
|
68
|
+
return aliases[v];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Refuse an unknown `--server` / `--client` value instead of dropping it.
|
|
72
|
+
*
|
|
73
|
+
* `--server node` — the CLI's own help example — used to exit 0 with no warning and record
|
|
74
|
+
* `"servers": []`. Worse than the missing four reference fragments: a non-empty override
|
|
75
|
+
* array suppresses BOTH the prior manifest's stack and detection, so the emitted context then
|
|
76
|
+
* declared "Stack: no server, no client" and told the agent that this project has no
|
|
77
|
+
* `metaobjects.config.ts` — about a project with a Fastify server, a React client, and the
|
|
78
|
+
* very config file the same CLI had just read. One silently-dropped flag value made three
|
|
79
|
+
* statements false in the artifact whose whole job is to orient an agent correctly.
|
|
80
|
+
*
|
|
81
|
+
* Either accept the value or say so; never neither.
|
|
82
|
+
*/
|
|
83
|
+
export function assertKnownStackValues(overrides) {
|
|
84
|
+
const bad = [];
|
|
85
|
+
for (const s of overrides.servers) {
|
|
86
|
+
if (canonical(s, SERVER_LANGS, SERVER_ALIASES) === undefined) {
|
|
87
|
+
bad.push(`--server ${s} (known: ${SERVER_LANGS.join(", ")})`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const c of overrides.clients) {
|
|
91
|
+
if (canonical(c, CLIENT_FRAMEWORKS, CLIENT_ALIASES) === undefined) {
|
|
92
|
+
bad.push(`--client ${c} (known: ${CLIENT_FRAMEWORKS.join(", ")})`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (bad.length > 0) {
|
|
96
|
+
throw new Error(`unknown stack value(s): ${bad.join("; ")}. A value that names nothing is refused rather ` +
|
|
97
|
+
"than dropped: an empty stack suppresses both the prior manifest and detection, and the " +
|
|
98
|
+
"generated agent context then states the project has no server, no client and no " +
|
|
99
|
+
"metaobjects.config.ts.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
44
102
|
/** Resolve the stack: explicit --server/--client overrides take precedence; otherwise detect.
|
|
45
103
|
* Concern tokens (e.g. requirements) are always OBSERVED from project state, independent of
|
|
46
104
|
* any --server/--client override — a concern is not a stack axis. */
|
|
47
105
|
export async function resolveStack(cwd, overrides) {
|
|
48
106
|
const validServers = SERVER_LANGS;
|
|
49
107
|
const validClients = CLIENT_FRAMEWORKS;
|
|
50
|
-
const oServers = overrides.servers
|
|
51
|
-
|
|
108
|
+
const oServers = overrides.servers
|
|
109
|
+
.map((s) => canonical(s, validServers, SERVER_ALIASES))
|
|
110
|
+
.filter((s) => s !== undefined);
|
|
111
|
+
const oClients = overrides.clients
|
|
112
|
+
.map((c) => canonical(c, validClients, CLIENT_ALIASES))
|
|
113
|
+
.filter((c) => c !== undefined);
|
|
52
114
|
const p = await probe(cwd);
|
|
53
115
|
const concerns = detectConcerns(p);
|
|
54
116
|
if (oServers.length > 0 || oClients.length > 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-stack.js","sourceRoot":"","sources":["../../../src/lib/detect-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EACL,WAAW,EAAE,cAAc,EAAE,SAAS,EAEtC,YAAY,EAAE,iBAAiB,GAChC,MAAM,mCAA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AQ,GAAG,SAAS,CAAC,OAAO;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAkB,CAAC,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;SACvE,MAAM,CAAC,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACxD,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/F,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-drift.d.ts","sourceRoot":"","sources":["../../../src/lib/docs-drift.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs-drift.d.ts","sourceRoot":"","sources":["../../../src/lib/docs-drift.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,KAAK,EAAE,OAAO,CAAC;IACf;yDACqD;IACrD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yCAAyC;IACzC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;2DAGuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB;;;sBAGkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB;;+EAE2E;IAC3E,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4DD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CA2J3F"}
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
// `.gen-state/.hashes.json` to tell a preserved hand edit from stale output; here
|
|
20
20
|
// there is no such offer to honour.
|
|
21
21
|
//
|
|
22
|
-
// 2. IT REPORTS A FILE AS EXTRA ONLY WHERE IT OWNS THE DIRECTORY. `docs.outDir`
|
|
23
|
-
//
|
|
24
|
-
// documentation — this repository's own `docs/` holds a hundred such files.
|
|
22
|
+
// 2. IT REPORTS A FILE AS EXTRA ONLY WHERE IT OWNS THE DIRECTORY. `docs.outDir` is a
|
|
23
|
+
// directory an adopter chooses, and it may well be one full of hand-written
|
|
24
|
+
// documentation — this repository's own `docs/` holds a hundred such files. (The
|
|
25
|
+
// default moved to `./docs/generated` for exactly that reason: defaulting into the
|
|
26
|
+
// most-owned directory name in the ecosystem contradicted this paragraph.) Its
|
|
25
27
|
// `api/` subtree is not ours either: on a multi-port project those pages are written
|
|
26
28
|
// by the OTHER port's docs command (`mvn metaobjects:docs`, `metaobjects docs`,
|
|
27
29
|
// `dotnet meta docs`), which this gate never runs, so a fresh run here legitimately
|
|
@@ -46,9 +48,10 @@
|
|
|
46
48
|
// entity that was DELETED stays committed and this gate stays green.
|
|
47
49
|
import { mkdtempSync, rmSync, existsSync, readFileSync, readdirSync, lstatSync } from "node:fs";
|
|
48
50
|
import { tmpdir } from "node:os";
|
|
49
|
-
import { join, relative, resolve, isAbsolute
|
|
51
|
+
import { join, relative, resolve, isAbsolute } from "node:path";
|
|
50
52
|
import { docsCommand } from "../commands/docs.js";
|
|
51
53
|
import { gitIgnored } from "./git-ignore.js";
|
|
54
|
+
import { toPosix } from "./rel-posix.js";
|
|
52
55
|
/**
|
|
53
56
|
* Recursively list files under `dir`, relative to it.
|
|
54
57
|
*
|
|
@@ -96,7 +99,7 @@ const GENERATED_MARKER = "@generated";
|
|
|
96
99
|
* hand-written note inside `agent/` out of it.
|
|
97
100
|
*/
|
|
98
101
|
function isOurs(docsDir, rel) {
|
|
99
|
-
const normalized = rel
|
|
102
|
+
const normalized = toPosix(rel);
|
|
100
103
|
if (!OWNED_PREFIXES.some((p) => normalized.startsWith(p)))
|
|
101
104
|
return false;
|
|
102
105
|
try {
|
|
@@ -194,10 +197,16 @@ export async function computeDocsDrift(args) {
|
|
|
194
197
|
});
|
|
195
198
|
const ignored = "ignored" in ignoreLookup ? ignoreLookup.ignored : new Set();
|
|
196
199
|
const ignoreReason = "unavailable" in ignoreLookup ? ignoreLookup.unavailable : undefined;
|
|
197
|
-
const isIgnored = (rel) => ignored.has(rel
|
|
200
|
+
const isIgnored = (rel) => ignored.has(toPosix(rel));
|
|
198
201
|
const toCheck = fresh.filter((rel) => !isIgnored(rel));
|
|
199
202
|
const orphans = ownedOrphans.filter((rel) => !isIgnored(rel));
|
|
200
|
-
|
|
203
|
+
// BOTH halves. `ignoreCandidates` above tests fresh pages AND owned orphans, so an
|
|
204
|
+
// ignored orphan is dropped from the check exactly like an ignored fresh page — but
|
|
205
|
+
// counting only the fresh half reported a number SMALLER than the work actually
|
|
206
|
+
// skipped. That is the `verify --templates` denominator mistake in miniature (a line
|
|
207
|
+
// describing work the command did not do), which is the very thing the orphan loop
|
|
208
|
+
// below is written to avoid; the two must be consistent about the same set.
|
|
209
|
+
const ignoredCount = fresh.length - toCheck.length + (ownedOrphans.length - orphans.length);
|
|
201
210
|
// A gate asked to check pages that could check NONE must not answer "no drift".
|
|
202
211
|
if (toCheck.length === 0 && orphans.length === 0) {
|
|
203
212
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-drift.js","sourceRoot":"","sources":["../../../src/lib/docs-drift.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,mFAAmF;AACnF,wFAAwF;AACxF,2FAA2F;AAC3F,uFAAuF;AACvF,mEAAmE;AACnE,EAAE;AACF,0FAA0F;AAC1F,4FAA4F;AAC5F,wEAAwE;AACxE,EAAE;AACF,2FAA2F;AAC3F,YAAY;AACZ,EAAE;AACF,4FAA4F;AAC5F,wFAAwF;AACxF,+EAA+E;AAC/E,uFAAuF;AACvF,yCAAyC;AACzC,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"docs-drift.js","sourceRoot":"","sources":["../../../src/lib/docs-drift.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,mFAAmF;AACnF,wFAAwF;AACxF,2FAA2F;AAC3F,uFAAuF;AACvF,mEAAmE;AACnE,EAAE;AACF,0FAA0F;AAC1F,4FAA4F;AAC5F,wEAAwE;AACxE,EAAE;AACF,2FAA2F;AAC3F,YAAY;AACZ,EAAE;AACF,4FAA4F;AAC5F,wFAAwF;AACxF,+EAA+E;AAC/E,uFAAuF;AACvF,yCAAyC;AACzC,EAAE;AACF,uFAAuF;AACvF,iFAAiF;AACjF,sFAAsF;AACtF,wFAAwF;AACxF,oFAAoF;AACpF,0FAA0F;AAC1F,qFAAqF;AACrF,yFAAyF;AACzF,wFAAwF;AACxF,0FAA0F;AAC1F,kFAAkF;AAClF,gEAAgE;AAChE,EAAE;AACF,0FAA0F;AAC1F,yFAAyF;AACzF,wFAAwF;AACxF,2FAA2F;AAC3F,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,uFAAuF;AACvF,uFAAuF;AACvF,qCAAqC;AACrC,EAAE;AACF,uFAAuF;AACvF,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChG,OAAO,E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AY,CAAC,MAAM,KAAK,CAAC;YAChC,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE;YACjC,KAAK;YACL,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;YACxC,OAAO,EAAE,YAAY;YACrB,YAAY;SACb,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -37,4 +37,23 @@ export declare function gitIgnored(dir: string, rels: readonly string[], opts: G
|
|
|
37
37
|
* `honourGlobalExcludes` is the caller's decision — see the option's doc.
|
|
38
38
|
*/
|
|
39
39
|
export declare function isGitIgnored(dir: string, rel: string, opts: GitIgnoreOptions): boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* WHICH rule ignores `rel` — the `.gitignore` file, its line, and the pattern.
|
|
42
|
+
*
|
|
43
|
+
* Advisories that tell an adopter to fix an ignore rule have to name the rule that is
|
|
44
|
+
* actually in force, not a conventional location. The exclusion can live in ANY
|
|
45
|
+
* `.gitignore` up the tree, in `.git/info/exclude`, or in a per-user excludes file, and an
|
|
46
|
+
* advisory that assumes one of them sends the reader to edit a file that does not hold the
|
|
47
|
+
* rule — after which the same advisory prints again, unchanged. `git check-ignore -v`
|
|
48
|
+
* answers it exactly, so nothing has to be assumed.
|
|
49
|
+
*
|
|
50
|
+
* `undefined` when git cannot say or nothing matches. The verdict itself still comes from
|
|
51
|
+
* `isGitIgnored`; this is only for the message, so a failure here degrades the wording
|
|
52
|
+
* rather than the check.
|
|
53
|
+
*/
|
|
54
|
+
export declare function gitIgnoreSource(dir: string, rel: string, opts: GitIgnoreOptions): {
|
|
55
|
+
file: string;
|
|
56
|
+
line: string;
|
|
57
|
+
pattern: string;
|
|
58
|
+
} | undefined;
|
|
40
59
|
//# sourceMappingURL=git-ignore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-ignore.d.ts","sourceRoot":"","sources":["../../../src/lib/git-ignore.ts"],"names":[],"mappings":"AAoBA,oEAAoE;AACpE,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,GACzC;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;CACxC;AAKD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,gBAAgB,GACrB,eAAe,CAwCjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,gBAAgB,GACrB,OAAO,GAAG,SAAS,CAIrB"}
|
|
1
|
+
{"version":3,"file":"git-ignore.d.ts","sourceRoot":"","sources":["../../../src/lib/git-ignore.ts"],"names":[],"mappings":"AAoBA,oEAAoE;AACpE,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,GACzC;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;CACxC;AAKD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,gBAAgB,GACrB,eAAe,CAwCjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,gBAAgB,GACrB,OAAO,GAAG,SAAS,CAIrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,gBAAgB,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAwB7D"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// the set a fresh run WOULD emit, so the verdict is identical on a developer box
|
|
16
16
|
// where those files are present and on a CI runner where they are not.
|
|
17
17
|
import { spawnSync } from "node:child_process";
|
|
18
|
-
import {
|
|
18
|
+
import { toPosix } from "./rel-posix.js";
|
|
19
19
|
/** A path that cannot exist, used to neutralise a per-user excludes file. */
|
|
20
20
|
const NO_SUCH_EXCLUDES_FILE = "/dev/null/metaobjects-no-global-excludes";
|
|
21
21
|
/**
|
|
@@ -37,7 +37,7 @@ export function gitIgnored(dir, rels, opts) {
|
|
|
37
37
|
args.push("-C", dir, "check-ignore", "--stdin", "-z");
|
|
38
38
|
// Forward slashes: git speaks them on every platform, and `listFiles` hands us
|
|
39
39
|
// platform separators.
|
|
40
|
-
const input = rels.map(
|
|
40
|
+
const input = rels.map(toPosix).join("\0");
|
|
41
41
|
let res;
|
|
42
42
|
try {
|
|
43
43
|
res = spawnSync(gitBin, args, { encoding: "utf-8", input });
|
|
@@ -72,6 +72,49 @@ export function isGitIgnored(dir, rel, opts) {
|
|
|
72
72
|
const res = gitIgnored(dir, [rel], opts);
|
|
73
73
|
if ("unavailable" in res)
|
|
74
74
|
return undefined;
|
|
75
|
-
return res.ignored.has(rel
|
|
75
|
+
return res.ignored.has(toPosix(rel));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* WHICH rule ignores `rel` — the `.gitignore` file, its line, and the pattern.
|
|
79
|
+
*
|
|
80
|
+
* Advisories that tell an adopter to fix an ignore rule have to name the rule that is
|
|
81
|
+
* actually in force, not a conventional location. The exclusion can live in ANY
|
|
82
|
+
* `.gitignore` up the tree, in `.git/info/exclude`, or in a per-user excludes file, and an
|
|
83
|
+
* advisory that assumes one of them sends the reader to edit a file that does not hold the
|
|
84
|
+
* rule — after which the same advisory prints again, unchanged. `git check-ignore -v`
|
|
85
|
+
* answers it exactly, so nothing has to be assumed.
|
|
86
|
+
*
|
|
87
|
+
* `undefined` when git cannot say or nothing matches. The verdict itself still comes from
|
|
88
|
+
* `isGitIgnored`; this is only for the message, so a failure here degrades the wording
|
|
89
|
+
* rather than the check.
|
|
90
|
+
*/
|
|
91
|
+
export function gitIgnoreSource(dir, rel, opts) {
|
|
92
|
+
const gitBin = process.env.META_GEN_GIT ?? "git";
|
|
93
|
+
const args = [];
|
|
94
|
+
if (!opts.honourGlobalExcludes) {
|
|
95
|
+
args.push("-c", `core.excludesFile=${NO_SUCH_EXCLUDES_FILE}`);
|
|
96
|
+
}
|
|
97
|
+
args.push("-C", dir, "check-ignore", "-v", "--", toPosix(rel));
|
|
98
|
+
let res;
|
|
99
|
+
try {
|
|
100
|
+
res = spawnSync(gitBin, args, { encoding: "utf-8" });
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
if (res.error !== undefined || res.status !== 0)
|
|
106
|
+
return undefined;
|
|
107
|
+
// `<source>:<line>:<pattern>\t<path>` — the source may itself contain a colon on
|
|
108
|
+
// Windows, so split from the RIGHT of the first tab-delimited field.
|
|
109
|
+
const first = (res.stdout ?? "").split("\n")[0];
|
|
110
|
+
if (first === undefined || first === "")
|
|
111
|
+
return undefined;
|
|
112
|
+
const lhs = first.split("\t")[0];
|
|
113
|
+
if (lhs === undefined)
|
|
114
|
+
return undefined;
|
|
115
|
+
const m = /^(.*):(\d+):(.*)$/.exec(lhs);
|
|
116
|
+
if (m === null)
|
|
117
|
+
return undefined;
|
|
118
|
+
return { file: m[1], line: m[2], pattern: m[3] };
|
|
76
119
|
}
|
|
77
120
|
//# sourceMappingURL=git-ignore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-ignore.js","sourceRoot":"","sources":["../../../src/lib/git-ignore.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,6CAA6C;AAC7C,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,qEAAqE;AACrE,EAAE;AACF,sFAAsF;AACtF,mFAAmF;AACnF,iFAAiF;AACjF,uEAAuE;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"git-ignore.js","sourceRoot":"","sources":["../../../src/lib/git-ignore.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,iFAAiF;AACjF,mFAAmF;AACnF,mFAAmF;AACnF,6CAA6C;AAC7C,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,qEAAqE;AACrE,EAAE;AACF,sFAAsF;AACtF,mFAAmF;AACnF,iFAAiF;AACjF,uEAAuE;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA0BzC,6EAA6E;AAC7E,MAAM,qBAAqB,GAAG,0CAA0C,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,GAAW,EACX,IAAuB,EACvB,IAAsB;IAEtB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,KAAK,CAAC;IACjD,MAAM,I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AAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClE,iFAAiF;IACjF,qEAAqE;IACrE,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1D,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warn when some of the scaffolded paths are git-ignored, naming how many and where.
|
|
3
|
+
*
|
|
4
|
+
* Silent when: nothing is ignored, the project is not a git repository, or git cannot be
|
|
5
|
+
* consulted — "cannot say" must never be reported as "there is a problem".
|
|
6
|
+
*
|
|
7
|
+
* `honourGlobalExcludes: false` for the same reason the docs-drift gate uses it: this is a
|
|
8
|
+
* property of the REPOSITORY, and a personal `~/.gitignore` is not something a teammate
|
|
9
|
+
* shares. A warning that fires for one developer and not another is worse than none.
|
|
10
|
+
*/
|
|
11
|
+
export declare function reportIgnoredScaffold(cwd: string, created: readonly string[]): void;
|
|
12
|
+
//# sourceMappingURL=ignored-scaffold-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignored-scaffold-check.d.ts","sourceRoot":"","sources":["../../../src/lib/ignored-scaffold-check.ts"],"names":[],"mappings":"AA0CA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAyBnF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Advisory: did the scaffold land in a directory this repository ignores?
|
|
2
|
+
//
|
|
3
|
+
// `meta init` reports "(11 files)". Eight of them go under `.claude/skills/`, and many
|
|
4
|
+
// projects git-ignore `.claude/` — commonly under a comment about credentials, which is a
|
|
5
|
+
// defensible convention, not a mistake. Ignored, those files exist only on the machine that
|
|
6
|
+
// ran the command: never committed, absent from CI and from a fresh clone, invisible to a
|
|
7
|
+
// teammate — while `.metaobjects/.agent-context.json`, which IS committed, records every one
|
|
8
|
+
// of them. The count says eleven; the repository gets three.
|
|
9
|
+
//
|
|
10
|
+
// The failure is INVISIBLE, which is why it is worth a check rather than a doc: nothing
|
|
11
|
+
// errors, nothing looks wrong, and the whole downstream agent-context design is simply void
|
|
12
|
+
// for that repo.
|
|
13
|
+
//
|
|
14
|
+
// Deliberately ADVISORY. Ignoring `.claude/` may be exactly what the project wants — it is a
|
|
15
|
+
// per-repo policy call, and a scaffolder has no standing to fail a build over it.
|
|
16
|
+
import { isAbsolute, relative } from "node:path";
|
|
17
|
+
import { log } from "./log.js";
|
|
18
|
+
import { gitIgnored } from "./git-ignore.js";
|
|
19
|
+
import { toPosix } from "./rel-posix.js";
|
|
20
|
+
/**
|
|
21
|
+
* `meta init` records what it created as paths RELATIVE TO THE PROJECT, and one of them
|
|
22
|
+
* carries a display decoration ("CLAUDE.md (created with MetaObjects @import)") because the
|
|
23
|
+
* same array is printed back to the user. Normalize both into a plain project-relative,
|
|
24
|
+
* POSIX-separated path, and drop anything outside the project.
|
|
25
|
+
*
|
|
26
|
+
* The relative case is why this exists at all: `relative(cwd, p)` resolves BOTH arguments
|
|
27
|
+
* against the ambient `process.cwd()`, so handing it an already-relative path under `--cwd`
|
|
28
|
+
* produced a "../"-prefixed result for every entry, the filter dropped them all, and the
|
|
29
|
+
* advisory returned before consulting git. It fired only when the process happened to be
|
|
30
|
+
* running in the project directory — silent on the path the check exists for.
|
|
31
|
+
*/
|
|
32
|
+
function toProjectRelative(cwd, p) {
|
|
33
|
+
// Strip a trailing display decoration; handed to git verbatim it is not a path, so a
|
|
34
|
+
// repository ignoring that file was never told about it.
|
|
35
|
+
const bare = p.replace(/\s+\(.*\)$/, "");
|
|
36
|
+
const rel = toPosix(isAbsolute(bare) ? relative(cwd, bare) : bare);
|
|
37
|
+
if (rel.length === 0 || rel === ".." || rel.startsWith("../"))
|
|
38
|
+
return undefined;
|
|
39
|
+
return rel;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Warn when some of the scaffolded paths are git-ignored, naming how many and where.
|
|
43
|
+
*
|
|
44
|
+
* Silent when: nothing is ignored, the project is not a git repository, or git cannot be
|
|
45
|
+
* consulted — "cannot say" must never be reported as "there is a problem".
|
|
46
|
+
*
|
|
47
|
+
* `honourGlobalExcludes: false` for the same reason the docs-drift gate uses it: this is a
|
|
48
|
+
* property of the REPOSITORY, and a personal `~/.gitignore` is not something a teammate
|
|
49
|
+
* shares. A warning that fires for one developer and not another is worse than none.
|
|
50
|
+
*/
|
|
51
|
+
export function reportIgnoredScaffold(cwd, created) {
|
|
52
|
+
const rels = created
|
|
53
|
+
.map((p) => toProjectRelative(cwd, p))
|
|
54
|
+
.filter((p) => p !== undefined);
|
|
55
|
+
if (rels.length === 0)
|
|
56
|
+
return;
|
|
57
|
+
const res = gitIgnored(cwd, rels, { honourGlobalExcludes: false });
|
|
58
|
+
if ("unavailable" in res)
|
|
59
|
+
return; // not a git repo, or git could not answer
|
|
60
|
+
const ignored = rels.filter((p) => res.ignored.has(p));
|
|
61
|
+
if (ignored.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
// Report the DIRECTORIES rather than every path: an adopter fixes this by editing one
|
|
64
|
+
// `.gitignore` line, and a wall of forty filenames buries that.
|
|
65
|
+
const dirs = [...new Set(ignored.map((p) => {
|
|
66
|
+
const i = p.indexOf("/");
|
|
67
|
+
return i < 0 ? p : p.slice(0, i) + "/";
|
|
68
|
+
}))].sort();
|
|
69
|
+
log.warn(`${ignored.length} of ${rels.length} scaffolded file(s) are git-ignored (${dirs.join(", ")}), ` +
|
|
70
|
+
"so they exist only on this machine — not committed, absent from CI and from a fresh " +
|
|
71
|
+
"clone, invisible to a teammate — while .metaobjects/.agent-context.json is committed " +
|
|
72
|
+
"and records them. If the agent context is meant to be shared, un-ignore those paths; " +
|
|
73
|
+
"if it is deliberately local, nothing to do.");
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ignored-scaffold-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignored-scaffold-check.js","sourceRoot":"","sources":["../../../src/lib/ignored-scaffold-check.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,uFAAuF;AACvF,0FAA0F;AAC1F,4FAA4F;AAC5F,0FAA0F;AAC1F,6FAA6F;AAC7F,6DAA6D;AAC7D,EAAE;AACF,wFAAwF;AACxF,4FAA4F;AAC5F,iBAAiB;AACjB,EAAE;AACF,6FAA6F;AAC7F,kFAAkF;AAElF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;GAWG;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CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACzC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;QACzC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEZ,GAAG,CAAC,IAAI,CACN,GAAG,OAAO,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM,wCAAwC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QAC7F,sFAAsF;QACtF,uFAAuF;QACvF,uFAAuF;QACvF,6CAA6C,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One rendering of a metadata LOAD failure, for every command that can hit one.
|
|
3
|
+
*
|
|
4
|
+
* The loader builds a full ADR-0009 envelope — a stable `code`, the `files` the node came
|
|
5
|
+
* from, the `jsonPath` inside the document, and often `suggestions[]` naming the next step.
|
|
6
|
+
* Five commands then printed `` `failed to load metadata: ${err.message}` `` and threw all
|
|
7
|
+
* of it away. So `ERR_ABSTRACT_SUBTYPE_AUTHORED` reached an adopter as a paragraph with no
|
|
8
|
+
* file, no line, no node name and no code — and `--format json` carried the same bare
|
|
9
|
+
* string, so a CI job could not key on the code ADR-0009 promises and the docs name. Five
|
|
10
|
+
* metadata files made that a `grep`; two hundred would not.
|
|
11
|
+
*
|
|
12
|
+
* This does not invent provenance. It reports exactly what the error carries and stays
|
|
13
|
+
* silent about what it does not, so a caller can never read more precision into the line
|
|
14
|
+
* than the loader actually had.
|
|
15
|
+
*/
|
|
16
|
+
export interface LoadErrorReport {
|
|
17
|
+
/** The message plus whatever provenance the envelope carried, for a human. */
|
|
18
|
+
readonly text: string;
|
|
19
|
+
/** ADR-0009 stable code, when the loader attached one. */
|
|
20
|
+
readonly code?: string;
|
|
21
|
+
/** The file(s) the failing node was read from. */
|
|
22
|
+
readonly files?: readonly string[];
|
|
23
|
+
/** JSON path of the failing node within its document. */
|
|
24
|
+
readonly jsonPath?: string;
|
|
25
|
+
/** The loader's own next steps. Printed verbatim; never paraphrased. */
|
|
26
|
+
readonly suggestions?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function describeLoadError(err: unknown): LoadErrorReport;
|
|
29
|
+
/**
|
|
30
|
+
* Print a load failure the one way every command prints it: the described line, then the
|
|
31
|
+
* loader's own `suggestions[]` indented beneath it, verbatim.
|
|
32
|
+
*
|
|
33
|
+
* This lived as a byte-identical private copy in `docs.ts`, `gen.ts` and `migrate.ts`. It
|
|
34
|
+
* belongs beside `describeLoadError` for the same reason that function exists: the rendering
|
|
35
|
+
* of a load failure is ONE decision, and three copies of it are three places for the next
|
|
36
|
+
* improvement to reach two of. `verify.ts`'s variant is deliberately NOT this — it chooses
|
|
37
|
+
* between the loader's suggestions and its own strict-attr hint (ADR-0023), which is a
|
|
38
|
+
* different decision, not a different spelling of this one.
|
|
39
|
+
*
|
|
40
|
+
* `log` is a parameter rather than an import so a test can capture what was printed without
|
|
41
|
+
* reaching into module state.
|
|
42
|
+
*/
|
|
43
|
+
export declare function reportLoadError(log: {
|
|
44
|
+
error: (msg: string) => void;
|
|
45
|
+
}, prefix: string, err: unknown): void;
|
|
46
|
+
//# sourceMappingURL=load-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-error.d.ts","sourceRoot":"","sources":["../../../src/lib/load-error.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAWD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAyB/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EACrC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,OAAO,GACX,IAAI,CAIN"}
|