@driftsys/markspec 0.11.0 → 0.12.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/README.md +9 -0
- package/esm/ast/normalize.d.ts +4 -5
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +6 -37
- package/esm/collect/mod.d.ts +29 -9
- package/esm/collect/mod.d.ts.map +1 -1
- package/esm/collect/mod.js +36 -10
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +2 -6
- package/esm/config/markspec.d.ts +4 -2
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/discovery/mod.d.ts +24 -8
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +57 -21
- package/esm/discovery/projects.d.ts +109 -0
- package/esm/discovery/projects.d.ts.map +1 -0
- package/esm/discovery/projects.js +232 -0
- package/esm/formatter/entry_body.d.ts +86 -0
- package/esm/formatter/entry_body.d.ts.map +1 -0
- package/esm/formatter/entry_body.js +287 -0
- package/esm/formatter/mod.d.ts +13 -9
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +126 -50
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +5 -4
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +4 -4
- package/esm/lock/check.d.ts.map +1 -1
- package/esm/lock/check.js +2 -1
- package/esm/lock/edge_drift.d.ts +2 -0
- package/esm/lock/edge_drift.d.ts.map +1 -1
- package/esm/lock/edge_drift.js +4 -0
- package/esm/lock/mod.d.ts +1 -1
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +1 -1
- package/esm/mod.d.ts +10 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +8 -6
- package/esm/model/mod.d.ts +21 -0
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +10 -0
- package/esm/parser/code_regions.d.ts +29 -0
- package/esm/parser/code_regions.d.ts.map +1 -0
- package/esm/parser/code_regions.js +38 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +103 -40
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +7 -1
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +8 -19
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +2 -2
- package/esm/util/fence.d.ts +20 -29
- package/esm/util/fence.d.ts.map +1 -1
- package/esm/util/fence.js +42 -50
- package/esm/util/modals.d.ts +6 -0
- package/esm/util/modals.d.ts.map +1 -1
- package/esm/util/modals.js +37 -0
- package/esm/validator/body_blocks.d.ts +2 -1
- package/esm/validator/body_blocks.d.ts.map +1 -1
- package/esm/validator/body_blocks.js +80 -2
- package/esm/validator/corpus.d.ts +6 -0
- package/esm/validator/corpus.d.ts.map +1 -1
- package/esm/validator/corpus.js +16 -4
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +1 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +11 -8
- package/package.json +1 -1
- package/script/ast/normalize.d.ts +4 -5
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +5 -36
- package/script/collect/mod.d.ts +29 -9
- package/script/collect/mod.d.ts.map +1 -1
- package/script/collect/mod.js +38 -10
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +1 -5
- package/script/config/markspec.d.ts +4 -2
- package/script/config/markspec.d.ts.map +1 -1
- package/script/discovery/mod.d.ts +24 -8
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +56 -20
- package/script/discovery/projects.d.ts +109 -0
- package/script/discovery/projects.d.ts.map +1 -0
- package/script/discovery/projects.js +240 -0
- package/script/formatter/entry_body.d.ts +86 -0
- package/script/formatter/entry_body.d.ts.map +1 -0
- package/script/formatter/entry_body.js +292 -0
- package/script/formatter/mod.d.ts +13 -9
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +124 -48
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +15 -14
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +3 -3
- package/script/lock/check.d.ts.map +1 -1
- package/script/lock/check.js +2 -1
- package/script/lock/edge_drift.d.ts +2 -0
- package/script/lock/edge_drift.d.ts.map +1 -1
- package/script/lock/edge_drift.js +5 -0
- package/script/lock/mod.d.ts +1 -1
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +2 -1
- package/script/mod.d.ts +10 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +20 -5
- package/script/model/mod.d.ts +21 -0
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +11 -0
- package/script/parser/code_regions.d.ts +29 -0
- package/script/parser/code_regions.d.ts.map +1 -0
- package/script/parser/code_regions.js +41 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +102 -39
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +7 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +7 -18
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +1 -1
- package/script/util/fence.d.ts +20 -29
- package/script/util/fence.d.ts.map +1 -1
- package/script/util/fence.js +47 -54
- package/script/util/modals.d.ts +6 -0
- package/script/util/modals.d.ts.map +1 -1
- package/script/util/modals.js +38 -0
- package/script/validator/body_blocks.d.ts +2 -1
- package/script/validator/body_blocks.d.ts.map +1 -1
- package/script/validator/body_blocks.js +80 -2
- package/script/validator/corpus.d.ts +6 -0
- package/script/validator/corpus.d.ts.map +1 -1
- package/script/validator/corpus.js +16 -3
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +2 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +11 -8
package/script/collect/mod.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module core/collect
|
|
3
3
|
*
|
|
4
|
-
* Project-entry collection: discover
|
|
5
|
-
*
|
|
4
|
+
* Project-entry collection: discover the MarkSpec-relevant files of one
|
|
5
|
+
* project (a root, minus the projects nested below it) and parse them into
|
|
6
|
+
* a flat `Entry[]`. The single source of truth for
|
|
6
7
|
* "the set of entries whose trace edges the lockfile pins" — shared by
|
|
7
8
|
* `markspec lock` (the pinner) and its checkers (`compile`, `fmt`, `doctor`)
|
|
8
9
|
* so they cannot disagree on which files count. Previously each of those
|
|
@@ -12,23 +13,42 @@
|
|
|
12
13
|
*/
|
|
13
14
|
import type { Entry } from "../model/mod.js";
|
|
14
15
|
import { type DiscoveryIO } from "../discovery/mod.js";
|
|
16
|
+
/** A discovered project file could not be read. */
|
|
17
|
+
export declare class UnreadableProjectFileError extends Error {
|
|
18
|
+
readonly file: string;
|
|
19
|
+
constructor(file: string);
|
|
20
|
+
}
|
|
15
21
|
/** Options for {@linkcode collectProjectEntries}. */
|
|
16
22
|
export interface CollectOptions {
|
|
17
|
-
/** Gitignore-syntax patterns (e.g.
|
|
18
|
-
* `root`. Applied after
|
|
23
|
+
/** Gitignore-syntax patterns (e.g. `.markspec.yaml` `exclude:`), anchored at
|
|
24
|
+
* `root`. Applied after built-in build-output skips and all `.gitignore`
|
|
25
|
+
* rules at every directory level. Hidden directories are always skipped.
|
|
26
|
+
* Defaults to none. */
|
|
19
27
|
readonly exclude?: readonly string[];
|
|
28
|
+
/** An enclosing project root whose `.gitignore` files, from it down to
|
|
29
|
+
* `root`, also apply (`discoverFiles` option of the same name). Pass the
|
|
30
|
+
* outermost project root above a nested project, so the nested project
|
|
31
|
+
* pins the files a bare `check` from any folder walks. */
|
|
32
|
+
readonly inheritGitignoreFrom?: string;
|
|
33
|
+
/** Roots of the projects nested below `root`. Their files belong to those
|
|
34
|
+
* projects and are skipped: each `markspec.lock` pins only the entries
|
|
35
|
+
* of its own project. Defaults to none. */
|
|
36
|
+
readonly nestedRoots?: readonly string[];
|
|
20
37
|
}
|
|
21
38
|
/**
|
|
22
39
|
* Walk `root` via {@linkcode discoverFiles} — relying on its default
|
|
23
40
|
* extension set (`RELEVANT_EXTENSIONS`), the parity point every caller
|
|
24
|
-
* depends on — and parse each discovered file
|
|
25
|
-
* entry list.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
41
|
+
* depends on — and parse each discovered file of the project at `root`,
|
|
42
|
+
* returning the flattened entry list. Files below `opts.nestedRoots` are
|
|
43
|
+
* skipped, and `opts.inheritGitignoreFrom` adds the `.gitignore` files of
|
|
44
|
+
* an enclosing project. An unreadable discovered file aborts collection.
|
|
45
|
+
* Parse diagnostics are not surfaced here: this collector exists to give
|
|
46
|
+
* the lockfile pinner and its checkers one definition of the file set;
|
|
47
|
+
* callers that need diagnostics re-parse.
|
|
29
48
|
*
|
|
30
49
|
* @param io Injected filesystem surface (keeps `core/` Node-compatible; CLI
|
|
31
50
|
* entry points pass a Deno-backed implementation).
|
|
51
|
+
* @throws {UnreadableProjectFileError} If a discovered project file cannot be read.
|
|
32
52
|
*/
|
|
33
53
|
export declare function collectProjectEntries(root: string, io: DiscoveryIO, opts?: CollectOptions): Promise<Entry[]>;
|
|
34
54
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/collect/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/collect/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAItE,mDAAmD;AACnD,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAIlC;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B;;;2BAGuB;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;8DAG0D;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;+CAE2C;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,KAAK,EAAE,CAAC,CAkBlB"}
|
package/script/collect/mod.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @module core/collect
|
|
4
4
|
*
|
|
5
|
-
* Project-entry collection: discover
|
|
6
|
-
*
|
|
5
|
+
* Project-entry collection: discover the MarkSpec-relevant files of one
|
|
6
|
+
* project (a root, minus the projects nested below it) and parse them into
|
|
7
|
+
* a flat `Entry[]`. The single source of truth for
|
|
7
8
|
* "the set of entries whose trace edges the lockfile pins" — shared by
|
|
8
9
|
* `markspec lock` (the pinner) and its checkers (`compile`, `fmt`, `doctor`)
|
|
9
10
|
* so they cannot disagree on which files count. Previously each of those
|
|
@@ -12,27 +13,54 @@
|
|
|
12
13
|
* by hand or the lockfile edge-hash comparison would drift spuriously.
|
|
13
14
|
*/
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.UnreadableProjectFileError = void 0;
|
|
15
17
|
exports.collectProjectEntries = collectProjectEntries;
|
|
18
|
+
const path_1 = require("@std/path");
|
|
16
19
|
const mod_js_1 = require("../discovery/mod.js");
|
|
20
|
+
const projects_js_1 = require("../discovery/projects.js");
|
|
17
21
|
const mod_js_2 = require("../parser/mod.js");
|
|
22
|
+
/** A discovered project file could not be read. */
|
|
23
|
+
class UnreadableProjectFileError extends Error {
|
|
24
|
+
constructor(file) {
|
|
25
|
+
super(`Cannot read discovered project file: ${file}`);
|
|
26
|
+
Object.defineProperty(this, "file", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: file
|
|
31
|
+
});
|
|
32
|
+
this.name = "UnreadableProjectFileError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.UnreadableProjectFileError = UnreadableProjectFileError;
|
|
18
36
|
/**
|
|
19
37
|
* Walk `root` via {@linkcode discoverFiles} — relying on its default
|
|
20
38
|
* extension set (`RELEVANT_EXTENSIONS`), the parity point every caller
|
|
21
|
-
* depends on — and parse each discovered file
|
|
22
|
-
* entry list.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
39
|
+
* depends on — and parse each discovered file of the project at `root`,
|
|
40
|
+
* returning the flattened entry list. Files below `opts.nestedRoots` are
|
|
41
|
+
* skipped, and `opts.inheritGitignoreFrom` adds the `.gitignore` files of
|
|
42
|
+
* an enclosing project. An unreadable discovered file aborts collection.
|
|
43
|
+
* Parse diagnostics are not surfaced here: this collector exists to give
|
|
44
|
+
* the lockfile pinner and its checkers one definition of the file set;
|
|
45
|
+
* callers that need diagnostics re-parse.
|
|
26
46
|
*
|
|
27
47
|
* @param io Injected filesystem surface (keeps `core/` Node-compatible; CLI
|
|
28
48
|
* entry points pass a Deno-backed implementation).
|
|
49
|
+
* @throws {UnreadableProjectFileError} If a discovered project file cannot be read.
|
|
29
50
|
*/
|
|
30
51
|
async function collectProjectEntries(root, io, opts = {}) {
|
|
31
52
|
const out = [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
const roots = [root, ...opts.nestedRoots ?? []];
|
|
54
|
+
for await (const file of (0, mod_js_1.discoverFiles)(root, io, {
|
|
55
|
+
exclude: opts.exclude,
|
|
56
|
+
inheritGitignoreFrom: opts.inheritGitignoreFrom,
|
|
57
|
+
})) {
|
|
58
|
+
if ((0, projects_js_1.nearestRoot)((0, path_1.dirname)(file), roots) !== root)
|
|
35
59
|
continue;
|
|
60
|
+
const content = await io.readFile(file);
|
|
61
|
+
if (content === undefined) {
|
|
62
|
+
throw new UnreadableProjectFileError(file);
|
|
63
|
+
}
|
|
36
64
|
const result = await (0, mod_js_2.parseFile)(content, { file });
|
|
37
65
|
out.push(...result.entries);
|
|
38
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOtE,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,IAAI,EAAE,MAA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OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAoMxB;AA+ED,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
package/script/compiler/mod.js
CHANGED
|
@@ -264,11 +264,7 @@ async function compile(paths, options) {
|
|
|
264
264
|
// bugs they cannot fix. No-op (and zero allocation beyond the spread
|
|
265
265
|
// above) when no corpus was injected.
|
|
266
266
|
if (options.corpusEntries && options.corpusEntries.length > 0) {
|
|
267
|
-
|
|
268
|
-
diagnostics = [
|
|
269
|
-
...(0, mod_js_3.attributeCorpusDiagnostics)(diagnostics, allEntries, collisions.collidedTokens),
|
|
270
|
-
...collisions.diagnostics,
|
|
271
|
-
];
|
|
267
|
+
diagnostics = (0, mod_js_3.applyCorpusPostPass)(diagnostics, allEntries);
|
|
272
268
|
}
|
|
273
269
|
return {
|
|
274
270
|
entries,
|
|
@@ -47,8 +47,10 @@ export interface MarkspecYaml {
|
|
|
47
47
|
/**
|
|
48
48
|
* Gitignore-syntax patterns excluded from project file discovery,
|
|
49
49
|
* anchored at the project root (e.g. `["skills/", "*.gen.md"]`).
|
|
50
|
-
* Applied after `.gitignore` rules
|
|
51
|
-
*
|
|
50
|
+
* Applied after built-in build-output skips and all `.gitignore` rules at
|
|
51
|
+
* every directory level by `core/discovery`. Negations can re-include
|
|
52
|
+
* non-hidden directories, provided their parents are not ignored. Hidden
|
|
53
|
+
* directories are always skipped. Defaults to `[]` when the key is absent.
|
|
52
54
|
*/
|
|
53
55
|
readonly exclude: readonly string[];
|
|
54
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markspec.d.ts","sourceRoot":"","sources":["../../src/config/markspec.ts"],"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AM,EACnB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAC,CAkBrE"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module core/discovery
|
|
3
3
|
*
|
|
4
|
-
* Gitignore-aware project file discovery
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* root, honoring (in
|
|
4
|
+
* Gitignore-aware project file discovery shared by CLI scope resolution,
|
|
5
|
+
* LSP indexing, lockfile entry collection and nested-project discovery.
|
|
6
|
+
* Yields absolute paths of MarkSpec-relevant files under a
|
|
7
|
+
* root, unconditionally skipping hidden directories and honoring (in
|
|
8
|
+
* precedence order):
|
|
8
9
|
*
|
|
9
|
-
* 1. built-in skips —
|
|
10
|
-
* 2. `.gitignore` files (root + nested, standard semantics)
|
|
11
|
-
*
|
|
10
|
+
* 1. built-in skips — common build-output directories
|
|
11
|
+
* 2. `.gitignore` files (root + nested, standard semantics), plus, when
|
|
12
|
+
* the caller names an enclosing folder, the `.gitignore` files of the
|
|
13
|
+
* folders from that folder down to the root's parent
|
|
14
|
+
* 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
|
|
15
|
+
* applied last at every directory level, including for negations
|
|
12
16
|
*
|
|
13
17
|
* I/O is injected via {@linkcode DiscoveryIO} so the module stays
|
|
14
18
|
* Node-compatible; entry points supply the Deno implementation.
|
|
@@ -42,8 +46,20 @@ export interface DiscoverOptions {
|
|
|
42
46
|
/** Extension filter; defaults to {@linkcode RELEVANT_EXTENSIONS}. */
|
|
43
47
|
readonly extensions?: ReadonlySet<string>;
|
|
44
48
|
/** Extra gitignore-syntax patterns, anchored at `root` (e.g. from
|
|
45
|
-
*
|
|
49
|
+
* `.markspec.yaml` `exclude:`). Applied after built-in build-output skips and
|
|
50
|
+
* `.gitignore` rules at every directory level. Negations can re-include
|
|
51
|
+
* non-hidden directories; an ignored parent must also be re-included. */
|
|
46
52
|
readonly exclude?: readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* An enclosing folder of `root`, such as the root of the project that a
|
|
55
|
+
* nested project lies in. The `.gitignore` files of the folders from it
|
|
56
|
+
* down to the parent of `root` also apply, each anchored to its own
|
|
57
|
+
* folder, so the walk of a nested project skips the files that those
|
|
58
|
+
* `.gitignore` files ignore. Only `.gitignore` files are inherited, not
|
|
59
|
+
* the enclosing folder's `exclude` patterns. No `.gitignore` above this
|
|
60
|
+
* folder is read. Ignored when it is not a strict ancestor of `root`.
|
|
61
|
+
*/
|
|
62
|
+
readonly inheritGitignoreFrom?: string;
|
|
47
63
|
}
|
|
48
64
|
/**
|
|
49
65
|
* Walk `root` recursively, yielding absolute paths of relevant files.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/discovery/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAmBhD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAEzE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH;mDACmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C;;;6EAGyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AA8BD;;;;GAIG;AACH,wBAAuB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,WAAW,EACf,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAsBxB"}
|
package/script/discovery/mod.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @module core/discovery
|
|
4
4
|
*
|
|
5
|
-
* Gitignore-aware project file discovery
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* root, honoring (in
|
|
5
|
+
* Gitignore-aware project file discovery shared by CLI scope resolution,
|
|
6
|
+
* LSP indexing, lockfile entry collection and nested-project discovery.
|
|
7
|
+
* Yields absolute paths of MarkSpec-relevant files under a
|
|
8
|
+
* root, unconditionally skipping hidden directories and honoring (in
|
|
9
|
+
* precedence order):
|
|
9
10
|
*
|
|
10
|
-
* 1. built-in skips —
|
|
11
|
-
* 2. `.gitignore` files (root + nested, standard semantics)
|
|
12
|
-
*
|
|
11
|
+
* 1. built-in skips — common build-output directories
|
|
12
|
+
* 2. `.gitignore` files (root + nested, standard semantics), plus, when
|
|
13
|
+
* the caller names an enclosing folder, the `.gitignore` files of the
|
|
14
|
+
* folders from that folder down to the root's parent
|
|
15
|
+
* 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored),
|
|
16
|
+
* applied last at every directory level, including for negations
|
|
13
17
|
*
|
|
14
18
|
* I/O is injected via {@linkcode DiscoveryIO} so the module stays
|
|
15
19
|
* Node-compatible; entry points supply the Deno implementation.
|
|
@@ -64,9 +68,9 @@ exports.RELEVANT_EXTENSIONS = new Set([
|
|
|
64
68
|
* indexing, spurious `MSL-L212` edge-hash entries).
|
|
65
69
|
*
|
|
66
70
|
* Unlike the hidden-dir skip these are overridable: they are applied as the
|
|
67
|
-
*
|
|
68
|
-
* negated `!target/` entry in either re-includes
|
|
69
|
-
* last-match-wins.
|
|
71
|
+
* lowest-precedence rule layer (before `.gitignore` and `exclude:`), so a
|
|
72
|
+
* negated `!target/` entry in either re-includes that directory under
|
|
73
|
+
* gitignore last-match-wins.
|
|
70
74
|
*/
|
|
71
75
|
const BUILTIN_SKIP_DIRS = [
|
|
72
76
|
"node_modules",
|
|
@@ -84,19 +88,51 @@ const BUILTIN_SKIP_RULES = (0, gitignore_js_1.parseGitignore)(BUILTIN_SKIP_DIRS.
|
|
|
84
88
|
*/
|
|
85
89
|
async function* discoverFiles(root, io, options = {}) {
|
|
86
90
|
const extensions = options.extensions ?? exports.RELEVANT_EXTENSIONS;
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
|
|
91
|
+
const inherited = options.inheritGitignoreFrom === undefined
|
|
92
|
+
? { rules: [], prefix: "" }
|
|
93
|
+
: await inheritedGitignoreRules(options.inheritGitignoreFrom, root, io);
|
|
94
|
+
// With inherited rules, every rule is matched against paths relative to
|
|
95
|
+
// the enclosing folder, so `prefix` is the path from it down to `root`.
|
|
96
|
+
const prefix = inherited.prefix;
|
|
97
|
+
const excludeRules = (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), prefix);
|
|
98
|
+
// Carry excludes separately: they must stay after every `.gitignore`,
|
|
99
|
+
// including ones loaded deeper in the walk.
|
|
100
|
+
yield* walk(root, prefix, [...BUILTIN_SKIP_RULES, ...inherited.rules], excludeRules, io, extensions);
|
|
92
101
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Collect the `.gitignore` rules of the folders from `from` down to the
|
|
104
|
+
* parent of `root`, outermost first, each anchored to its own folder.
|
|
105
|
+
* Returns them with the POSIX path from `from` down to `root`. Returns no
|
|
106
|
+
* rules and an empty path when `from` is not a strict ancestor of `root`.
|
|
107
|
+
*/
|
|
108
|
+
async function inheritedGitignoreRules(from, root, io) {
|
|
109
|
+
const rel = (0, path_1.relative)((0, path_1.resolve)(from), (0, path_1.resolve)(root));
|
|
110
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${path_1.SEPARATOR}`)) {
|
|
111
|
+
return { rules: [], prefix: "" };
|
|
112
|
+
}
|
|
113
|
+
const segments = rel.split(path_1.SEPARATOR);
|
|
114
|
+
const rules = [];
|
|
115
|
+
for (let i = 0; i < segments.length; i++) {
|
|
116
|
+
const raw = await io.readFile((0, path_1.join)(from, ...segments.slice(0, i), ".gitignore"));
|
|
117
|
+
if (raw === undefined || raw.length === 0)
|
|
118
|
+
continue;
|
|
119
|
+
rules.push(...(0, gitignore_js_1.parseGitignore)(raw, segments.slice(0, i).join("/")));
|
|
120
|
+
}
|
|
121
|
+
return { rules, prefix: segments.join("/") };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Walk `absDir`. `relDir` is the POSIX path of `absDir` relative to the
|
|
125
|
+
* folder the rules are anchored at (the enclosing folder when rules are
|
|
126
|
+
* inherited, else the walk root); `""` for that folder itself.
|
|
127
|
+
*/
|
|
128
|
+
async function* walk(absDir, relDir, rules, excludeRules, io, extensions) {
|
|
129
|
+
// Deeper `.gitignore` rules win over inherited ones. Excludes stay last
|
|
130
|
+
// for this directory's decisions, but are not inherited as gitignore rules.
|
|
96
131
|
const raw = await io.readFile((0, path_1.join)(absDir, ".gitignore"));
|
|
97
|
-
const
|
|
132
|
+
const gitignoreRules = raw !== undefined && raw.length > 0
|
|
98
133
|
? [...rules, ...(0, gitignore_js_1.parseGitignore)(raw, relDir)]
|
|
99
134
|
: rules;
|
|
135
|
+
const active = [...gitignoreRules, ...excludeRules];
|
|
100
136
|
const entries = [];
|
|
101
137
|
try {
|
|
102
138
|
for await (const e of io.readDir(absDir))
|
|
@@ -115,7 +151,7 @@ async function* walk(absDir, relDir, rules, io, extensions) {
|
|
|
115
151
|
// re-included, so pruning here is correct (and fast).
|
|
116
152
|
if ((0, gitignore_js_1.isIgnored)(rel, true, active))
|
|
117
153
|
continue;
|
|
118
|
-
yield* walk((0, path_1.join)(absDir, entry.name), rel,
|
|
154
|
+
yield* walk((0, path_1.join)(absDir, entry.name), rel, gitignoreRules, excludeRules, io, extensions);
|
|
119
155
|
}
|
|
120
156
|
else if (entry.isFile) {
|
|
121
157
|
if (!extensions.has((0, path_1.extname)(entry.name).toLowerCase()))
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/discovery/projects
|
|
3
|
+
*
|
|
4
|
+
* Project-root discovery shared by the CLI, the LSP and the MCP server.
|
|
5
|
+
*
|
|
6
|
+
* A "project root" is a directory that holds a `project.yaml` or a
|
|
7
|
+
* `.markspec.yaml`. {@linkcode discoverProjectRoots} finds the primary
|
|
8
|
+
* root by walking up from a start folder, then every nested root below
|
|
9
|
+
* it with the gitignore-aware file walk.
|
|
10
|
+
*/
|
|
11
|
+
import { type DiscoveryIO } from "./mod.js";
|
|
12
|
+
/** `true` when `path` is `root` itself or lies below it. */
|
|
13
|
+
export declare function isWithin(root: string, path: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Return the deepest root in `roots` that is `dir` itself or an ancestor
|
|
16
|
+
* of `dir`, or `undefined` when none is.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nearestRoot(dir: string, roots: Iterable<string>): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Walk up from `startDir` to the nearest `project.yaml`, else the nearest
|
|
21
|
+
* `.markspec.yaml`. Returns `undefined` when neither exists.
|
|
22
|
+
*
|
|
23
|
+
* The LSP server and the MCP server use this order to find the root
|
|
24
|
+
* above their workspace. The CLI (`check`, `fmt`, `lint`) uses
|
|
25
|
+
* {@linkcode createProjectRootResolver}, which starts from this nearest
|
|
26
|
+
* config root but skips a config that an enclosing project hides (#845).
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveConfigRoot(startDir: string, readFile: (path: string) => Promise<string | undefined>): Promise<string | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Directories strictly below `root` that a document walk-up would
|
|
31
|
+
* resolve to, found with the gitignore-aware project walk (honouring
|
|
32
|
+
* `exclude`). Each discovered `project.yaml` or `.markspec.yaml` is
|
|
33
|
+
* resolved with {@linkcode resolveConfigRoot} from its own directory, so a
|
|
34
|
+
* `.markspec.yaml` below a `project.yaml` is not a root of its own — the
|
|
35
|
+
* same answer the CLI gives for a file there. A found root is dropped when
|
|
36
|
+
* the `.markspec.yaml` `exclude:` list of another found root above it
|
|
37
|
+
* covers it: each project's exclude list applies to its own subtree, with
|
|
38
|
+
* patterns relative to that project. The result is sorted.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findNestedProjectRoots(root: string, io: DiscoveryIO, exclude?: readonly string[]): Promise<string[]>;
|
|
41
|
+
/** Options for {@linkcode discoverProjectRoots}. */
|
|
42
|
+
export interface ProjectDiscoveryOptions {
|
|
43
|
+
/** The user's home folder. When the primary root equals this folder, no
|
|
44
|
+
* downward scan runs from it. */
|
|
45
|
+
readonly homeDir?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Find every MarkSpec project reachable from `startDir`.
|
|
49
|
+
*
|
|
50
|
+
* `primaryRoot` is the nearest config root found by walking up from
|
|
51
|
+
* `startDir` (see {@linkcode resolveConfigRoot}), or `startDir` itself
|
|
52
|
+
* when there is none. `roots` holds the primary root (only when it has a
|
|
53
|
+
* config) plus every nested root below it, sorted. The nested scan honours
|
|
54
|
+
* the primary project's `.markspec.yaml` `exclude:` list, and each nested
|
|
55
|
+
* project's own list for the folders below it.
|
|
56
|
+
*
|
|
57
|
+
* When the primary root is a filesystem root or `options.homeDir`, no
|
|
58
|
+
* downward scan runs, even when that folder holds a config: `roots` then
|
|
59
|
+
* holds only the primary root when it has a config, and is empty
|
|
60
|
+
* otherwise.
|
|
61
|
+
*/
|
|
62
|
+
export declare function discoverProjectRoots(startDir: string, io: DiscoveryIO, options?: ProjectDiscoveryOptions): Promise<{
|
|
63
|
+
primaryRoot: string;
|
|
64
|
+
roots: string[];
|
|
65
|
+
}>;
|
|
66
|
+
/** Answers which project root owns a folder; see
|
|
67
|
+
* {@linkcode createProjectRootResolver}. */
|
|
68
|
+
export interface ProjectRootResolver {
|
|
69
|
+
/**
|
|
70
|
+
* The project root that owns files in `dir`, or `undefined` when no
|
|
71
|
+
* `project.yaml` or `.markspec.yaml` is at or above `dir`.
|
|
72
|
+
*/
|
|
73
|
+
ownerOf(dir: string): Promise<string | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* The nested project roots below `root`
|
|
76
|
+
* ({@linkcode findNestedProjectRoots} with the `.markspec.yaml`
|
|
77
|
+
* `exclude:` list of `root`). Cached per root.
|
|
78
|
+
*/
|
|
79
|
+
nestedRoots(root: string): Promise<string[]>;
|
|
80
|
+
/**
|
|
81
|
+
* The outermost project root at or above `dir`: the root from which the
|
|
82
|
+
* LSP would index `dir` when its workspace is the outermost project. A
|
|
83
|
+
* nested project's walk inherits the `.gitignore` files from this root
|
|
84
|
+
* down (`discoverFiles` option `inheritGitignoreFrom`). `undefined` when
|
|
85
|
+
* no `project.yaml` or `.markspec.yaml` is at or above `dir`.
|
|
86
|
+
*/
|
|
87
|
+
outermostOf(dir: string): Promise<string | undefined>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a resolver that gives, for any folder, the project root the LSP
|
|
91
|
+
* would give a document in that folder when the editor workspace is the
|
|
92
|
+
* outermost project root above it (#845).
|
|
93
|
+
*
|
|
94
|
+
* The nearest config root {@linkcode resolveConfigRoot} finds is not
|
|
95
|
+
* always the owner: when an enclosing project hides that config (an
|
|
96
|
+
* `exclude:` entry, a `.gitignore` entry, a hidden folder), the LSP and
|
|
97
|
+
* the MCP server never treat it as a root, and its files belong to the
|
|
98
|
+
* enclosing project. So the resolver walks up from the nearest config
|
|
99
|
+
* root to the outermost enclosing one, finds the nested roots below that
|
|
100
|
+
* outermost root the way the LSP does, and returns the deepest of them
|
|
101
|
+
* that contains `dir`.
|
|
102
|
+
*
|
|
103
|
+
* The walk up stops before a filesystem root and before
|
|
104
|
+
* `options.homeDir`: {@linkcode discoverProjectRoots} never scans down
|
|
105
|
+
* from those folders, so a stray config there must not claim every
|
|
106
|
+
* project below it. Results are cached per folder.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createProjectRootResolver(io: DiscoveryIO, options?: ProjectDiscoveryOptions): ProjectRootResolver;
|
|
109
|
+
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/discovery/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAS3D,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtB,MAAM,GAAG,SAAS,CAOpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CA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