@metaobjectsdev/cli 1.0.0-rc.5 → 1.0.0-rc.6
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 +38 -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 +2 -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/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 +162 -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/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/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 +44 -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 +2 -5
- package/src/lib/args.ts +60 -39
- package/src/lib/base-url-advisory.ts +173 -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/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
|
@@ -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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I,CAAC,GAAG,CAAC,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,sDAAsD,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO;YACL,KAAK,EAAE,YAAY,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,E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OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAE/D,IAAI,GAAG,CAAC;IACR,IAAI,CAAC;QACH,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,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,CA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IACvD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEjC,sFAAsF;IACtF,gEAAgE;IAChE,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** True for a thrown value carrying the loader's ADR-0009 envelope. */
|
|
2
|
+
function isLoaderError(err) {
|
|
3
|
+
return (typeof err === "object" && err !== null
|
|
4
|
+
&& typeof err.code === "string"
|
|
5
|
+
&& typeof err.source === "object");
|
|
6
|
+
}
|
|
7
|
+
export function describeLoadError(err) {
|
|
8
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
9
|
+
if (!isLoaderError(err))
|
|
10
|
+
return { text: message };
|
|
11
|
+
const source = err.source;
|
|
12
|
+
const files = source.files?.filter((f) => f.length > 0);
|
|
13
|
+
const jsonPath = source.jsonPath;
|
|
14
|
+
const suggestions = err.suggestions?.filter((s) => s.length > 0);
|
|
15
|
+
// `code` first: it is the one part a machine keys on, and a human scanning a terminal
|
|
16
|
+
// finds it fastest at the front of the line. Then WHERE, which is the question the
|
|
17
|
+
// message itself can never answer.
|
|
18
|
+
const where = [
|
|
19
|
+
files !== undefined && files.length > 0 ? files.join(", ") : undefined,
|
|
20
|
+
jsonPath !== undefined && jsonPath.length > 0 ? `at ${jsonPath}` : undefined,
|
|
21
|
+
].filter((p) => p !== undefined).join(" ");
|
|
22
|
+
const head = `${err.code}: ${message}`;
|
|
23
|
+
return {
|
|
24
|
+
text: where.length > 0 ? `${head}\n in ${where}` : head,
|
|
25
|
+
code: err.code,
|
|
26
|
+
...(files !== undefined && files.length > 0 ? { files } : {}),
|
|
27
|
+
...(jsonPath !== undefined && jsonPath.length > 0 ? { jsonPath } : {}),
|
|
28
|
+
...(suggestions !== undefined && suggestions.length > 0 ? { suggestions } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Print a load failure the one way every command prints it: the described line, then the
|
|
33
|
+
* loader's own `suggestions[]` indented beneath it, verbatim.
|
|
34
|
+
*
|
|
35
|
+
* This lived as a byte-identical private copy in `docs.ts`, `gen.ts` and `migrate.ts`. It
|
|
36
|
+
* belongs beside `describeLoadError` for the same reason that function exists: the rendering
|
|
37
|
+
* of a load failure is ONE decision, and three copies of it are three places for the next
|
|
38
|
+
* improvement to reach two of. `verify.ts`'s variant is deliberately NOT this — it chooses
|
|
39
|
+
* between the loader's suggestions and its own strict-attr hint (ADR-0023), which is a
|
|
40
|
+
* different decision, not a different spelling of this one.
|
|
41
|
+
*
|
|
42
|
+
* `log` is a parameter rather than an import so a test can capture what was printed without
|
|
43
|
+
* reaching into module state.
|
|
44
|
+
*/
|
|
45
|
+
export function reportLoadError(log, prefix, err) {
|
|
46
|
+
const report = describeLoadError(err);
|
|
47
|
+
log.error(`${prefix}: ${report.text}`);
|
|
48
|
+
for (const s of report.suggestions ?? [])
|
|
49
|
+
log.error(` ${s}`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=load-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-error.js","sourceRoot":"","sources":["../../../src/lib/load-error.ts"],"names":[],"mappings":"AA8BA,uEAAuE;AACvE,SAAS,a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,iBAAiB,QAAqD,CAAC;AAEpF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"manifest-ignored-check.d.ts","sourceRoot":"","sources":["../../../src/lib/manifest-ignored-check.ts"],"names":[],"mappings":"AAsBA;6BAC6B;AAC7B,eAAO,MAAM,iBAAiB,QAAqD,CAAC;AAEpF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAiCvD"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { existsSync } from "node:fs";
|
|
18
18
|
import { join } from "node:path";
|
|
19
19
|
import { log } from "./log.js";
|
|
20
|
-
import { isGitIgnored } from "./git-ignore.js";
|
|
20
|
+
import { gitIgnoreSource, isGitIgnored } from "./git-ignore.js";
|
|
21
21
|
/** Project-relative path of the manifest — the one artifact of `.gen-state/` that is
|
|
22
22
|
* meant to be committed. */
|
|
23
23
|
export const HASH_MANIFEST_REL = join(".metaobjects", ".gen-state", ".hashes.json");
|
|
@@ -37,12 +37,25 @@ export function warnIfManifestIgnored(cwd) {
|
|
|
37
37
|
// per-user ignore file answers it just as truly as a committed .gitignore does.
|
|
38
38
|
if (isGitIgnored(cwd, HASH_MANIFEST_REL, { honourGlobalExcludes: true }) !== true)
|
|
39
39
|
return;
|
|
40
|
+
// WHERE the rule actually lives, asked of git rather than assumed. This used to name
|
|
41
|
+
// `.metaobjects/.gitignore` and the literal pattern `.gen-state/`, which is only one of
|
|
42
|
+
// the places the exclusion can sit: an adopter estate had it in the ROOT `.gitignore` as
|
|
43
|
+
// `.metaobjects/.gen-state/`, so following this advisory to the letter edited a file that
|
|
44
|
+
// did not hold the rule, changed nothing, and printed this same line again — the loop
|
|
45
|
+
// shape. `git check-ignore -v` knows the answer, so nothing is guessed. When git cannot
|
|
46
|
+
// say, the wording degrades to the generic form rather than asserting a location.
|
|
47
|
+
const src = gitIgnoreSource(cwd, HASH_MANIFEST_REL, { honourGlobalExcludes: true });
|
|
48
|
+
const where = src !== undefined
|
|
49
|
+
? `The rule is '${src.pattern}' at ${src.file}:${src.line} — replace it there with ` +
|
|
50
|
+
`a '/*' form plus a '!' negation for the manifest ` +
|
|
51
|
+
`(e.g. '${src.pattern.replace(/\/$/, "")}/*' and '!${src.pattern.replace(/\/$/, "")}/.hashes.json')`
|
|
52
|
+
: `Find the rule with 'git check-ignore -v ${HASH_MANIFEST_REL}' and replace it with ` +
|
|
53
|
+
`a '/*' form plus a '!' negation for the manifest`;
|
|
40
54
|
log.warn(`${HASH_MANIFEST_REL} is git-ignored, so it never reaches another machine — ` +
|
|
41
55
|
`on a fresh clone or CI runner 'meta gen' cannot tell your hand edits from its ` +
|
|
42
|
-
`own stale output, and will refuse to overwrite rather than guess.
|
|
43
|
-
|
|
44
|
-
`
|
|
45
|
-
`
|
|
46
|
-
`commit the manifest. If you deliberately do not commit generated output, ignore this.`);
|
|
56
|
+
`own stale output, and will refuse to overwrite rather than guess. ${where} ` +
|
|
57
|
+
`(the glob matters — git will not descend into an excluded directory, so a negation ` +
|
|
58
|
+
`INSIDE an excluded directory can never apply), then commit the manifest. ` +
|
|
59
|
+
`If you deliberately do not commit generated output, ignore this.`);
|
|
47
60
|
}
|
|
48
61
|
//# sourceMappingURL=manifest-ignored-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-ignored-check.js","sourceRoot":"","sources":["../../../src/lib/manifest-ignored-check.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,oFAAoF;AACpF,oFAAoF;AACpF,qFAAqF;AACrF,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,sFAAsF;AACtF,qFAAqF;AACrF,qFAAqF;AACrF,kFAAkF;AAClF,EAAE;AACF,kFAAkF;AAClF,qFAAqF;AACrF,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest-ignored-check.js","sourceRoot":"","sources":["../../../src/lib/manifest-ignored-check.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,oFAAoF;AACpF,oFAAoF;AACpF,qFAAqF;AACrF,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,sFAAsF;AACtF,qFAAqF;AACrF,qFAAqF;AACrF,kFAAkF;AAClF,EAAE;AACF,kFAAkF;AAClF,qFAAqF;AACrF,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhE;6BAC6B;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,kEAAkE;IAClE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;QAAE,OAAO;IAEtD,mFAAmF;IACnF,mFAAmF;IACnF,gFAAgF;IAChF,IAAI,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI;QAAE,OAAO;IAE1F,qFAAqF;IACrF,wFAAwF;IACxF,yFAAyF;IACzF,0FAA0F;IAC1F,sFAAsF;IACtF,wFAAwF;IACxF,kFAAkF;IAClF,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;IACpF,MAAM,KAAK,GACT,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,gBAAgB,GAAG,CAAC,OAAO,QAAQ,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,2BAA2B;YAClF,mDAAmD;YACnD,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB;QACtG,CAAC,CAAC,2CAA2C,iBAAiB,wBAAwB;YACpF,kDAAkD,CAAC;IAEzD,GAAG,CAAC,IAAI,CACN,GAAG,iBAAiB,yDAAyD;QAC3E,gFAAgF;QAChF,qEAAqE,KAAK,GAAG;QAC7E,qFAAqF;QACrF,2EAA2E;QAC3E,kEAAkE,CACrE,CAAC;AACJ,CAAC"}
|
package/dist/src/lib/output.d.ts
CHANGED
|
@@ -12,7 +12,11 @@ export interface FormatOptions {
|
|
|
12
12
|
* rather than a preference: the summary line was right and the per-file status
|
|
13
13
|
* was not.
|
|
14
14
|
*/
|
|
15
|
-
export type GenFileStatus = "new" | "overwrite" | "merged" | "conflict" | "unchanged" | "refused"
|
|
15
|
+
export type GenFileStatus = "new" | "overwrite" | "merged" | "conflict" | "unchanged" | "refused"
|
|
16
|
+
/** `--baseline=adopt`: the file's existing content became the merge base and
|
|
17
|
+
* nothing was written. Never folded into "unchanged" — the run's product is the
|
|
18
|
+
* manifest, and a summary that showed these as unchanged would hide it. */
|
|
19
|
+
| "adopted" | "removed";
|
|
16
20
|
export interface GenFileEntry {
|
|
17
21
|
path: string;
|
|
18
22
|
status: GenFileStatus;
|
|
@@ -36,6 +40,14 @@ export interface GenResultShape {
|
|
|
36
40
|
* structured payload carries every finding.
|
|
37
41
|
*/
|
|
38
42
|
antiPatterns?: AdvisorySection<AdvisoryFindingRow>;
|
|
43
|
+
/**
|
|
44
|
+
* How many generators the config wired. Required, because the alternative is a
|
|
45
|
+
* message that GUESSES: with no generators wired, a run over a project with five
|
|
46
|
+
* entities emitted nothing and reported "no entities to generate … author entities
|
|
47
|
+
* in this project's metadata sources", sending the reader to edit a file that was
|
|
48
|
+
* already correct. The output's own first line (`gen: []`) already knew.
|
|
49
|
+
*/
|
|
50
|
+
generatorCount: number;
|
|
39
51
|
}
|
|
40
52
|
export declare function formatGenResult(result: GenResultShape, opts: FormatOptions): string;
|
|
41
53
|
export interface BlockedEntry {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/lib/output.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAE9F,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;CAChB;AAMD;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,WAAW,GACX,QAAQ,GACR,UAAU,GACV,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/lib/output.ts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
11
11
|
conflict: "✗",
|
|
12
12
|
unchanged: "=",
|
|
13
13
|
refused: "⚠",
|
|
14
|
+
adopted: "⊕",
|
|
14
15
|
removed: "−",
|
|
15
16
|
};
|
|
16
17
|
const GEN_WORDS = {
|
|
@@ -20,6 +21,7 @@ const GEN_WORDS = {
|
|
|
20
21
|
conflict: "CONFLICT",
|
|
21
22
|
unchanged: "UNCHANGED",
|
|
22
23
|
refused: "REFUSED",
|
|
24
|
+
adopted: "ADOPTED",
|
|
23
25
|
removed: "REMOVED",
|
|
24
26
|
};
|
|
25
27
|
export function formatGenResult(result, opts) {
|
|
@@ -45,7 +47,7 @@ export function formatGenResult(result, opts) {
|
|
|
45
47
|
const counts = result.files.reduce((acc, f) => {
|
|
46
48
|
acc[f.status] = (acc[f.status] ?? 0) + 1;
|
|
47
49
|
return acc;
|
|
48
|
-
}, { new: 0, overwrite: 0, merged: 0, conflict: 0, unchanged: 0, refused: 0, removed: 0 });
|
|
50
|
+
}, { new: 0, overwrite: 0, merged: 0, conflict: 0, unchanged: 0, refused: 0, adopted: 0, removed: 0 });
|
|
49
51
|
const parts = [];
|
|
50
52
|
// "written" stays the sum of new + overwrite: that number was always correct and
|
|
51
53
|
// adopters read it. Splitting the SUMMARY as well would change a line nothing was
|
|
@@ -61,6 +63,11 @@ export function formatGenResult(result, opts) {
|
|
|
61
63
|
parts.push(`${counts.unchanged} unchanged`);
|
|
62
64
|
if (counts.refused > 0)
|
|
63
65
|
parts.push(`${counts.refused} refused`);
|
|
66
|
+
// `--baseline=adopt`: recorded as the merge base, nothing written. Counted separately
|
|
67
|
+
// from `unchanged` because the run's product is the manifest, and an adopter who cannot
|
|
68
|
+
// see how many files it now covers has no way to review what they are about to commit.
|
|
69
|
+
if (counts.adopted > 0)
|
|
70
|
+
parts.push(`${counts.adopted} adopted`);
|
|
64
71
|
if (counts.removed > 0)
|
|
65
72
|
parts.push(`${counts.removed} removed`);
|
|
66
73
|
lines.push("", ` ${parts.join(", ")}`, "");
|
|
@@ -110,7 +117,7 @@ export function formatMigrateResult(result, _opts) {
|
|
|
110
117
|
// gen TOON/JSON formatters (axi)
|
|
111
118
|
// ---------------------------------------------------------------------------
|
|
112
119
|
export function genResultToData(result) {
|
|
113
|
-
const counts = result.files.reduce((a, f) => ((a[f.status] = (a[f.status] ?? 0) + 1), a), { new: 0, overwrite: 0, merged: 0, conflict: 0, unchanged: 0, refused: 0, removed: 0 });
|
|
120
|
+
const counts = result.files.reduce((a, f) => ((a[f.status] = (a[f.status] ?? 0) + 1), a), { new: 0, overwrite: 0, merged: 0, conflict: 0, unchanged: 0, refused: 0, adopted: 0, removed: 0 });
|
|
114
121
|
const parts = [];
|
|
115
122
|
// Same split as the text formatter: `written` is new + overwrite, and the
|
|
116
123
|
// per-file rows carry which one each was.
|
|
@@ -125,14 +132,25 @@ export function genResultToData(result) {
|
|
|
125
132
|
parts.push(`${counts.unchanged} unchanged`);
|
|
126
133
|
if (counts.refused)
|
|
127
134
|
parts.push(`${counts.refused} refused`);
|
|
135
|
+
if (counts.adopted)
|
|
136
|
+
parts.push(`${counts.adopted} adopted`);
|
|
128
137
|
if (counts.removed)
|
|
129
138
|
parts.push(`${counts.removed} removed`);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
// Two ways to emit nothing, and they send the reader to different files. Name the
|
|
140
|
+
// one that is actually true: a config wiring no generators cannot produce output
|
|
141
|
+
// however good the metadata is, and telling its author to go write entities is a
|
|
142
|
+
// false statement about a project that already has them.
|
|
143
|
+
const noGenerators = result.generatorCount === 0;
|
|
144
|
+
const summary = result.files.length !== 0
|
|
145
|
+
? parts.join(", ")
|
|
146
|
+
: noGenerators
|
|
147
|
+
? "no generators are wired in metaobjects.config.ts, so nothing was generated"
|
|
148
|
+
: `no entities to generate in ${result.outDir}`;
|
|
149
|
+
const help = result.files.length !== 0
|
|
150
|
+
? ["typecheck the generated code with `npx tsc`", "create your database tables with `meta migrate --from-db --db <url> --dialect <sqlite|postgres> --slug init --apply`"]
|
|
151
|
+
: noGenerators
|
|
152
|
+
? ["add generators to the `generators: []` array in metaobjects.config.ts — `meta eject --list` names every generator you can own, and `meta init` scaffolds the usual set"]
|
|
153
|
+
: ["author entities in this project's metadata sources then re-run `meta gen`"];
|
|
136
154
|
// An absent section is STATED, never omitted: a reader must be able to tell
|
|
137
155
|
// "the scan found nothing" from "the scan never ran".
|
|
138
156
|
const antiPatterns = result.antiPatterns
|