@driftsys/markspec 0.8.0 → 0.9.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.
Files changed (43) hide show
  1. package/esm/config/mod.d.ts.map +1 -1
  2. package/esm/config/mod.js +25 -0
  3. package/esm/discovery/gitignore.d.ts +40 -0
  4. package/esm/discovery/gitignore.d.ts.map +1 -0
  5. package/esm/discovery/gitignore.js +145 -0
  6. package/esm/discovery/mod.d.ts +54 -0
  7. package/esm/discovery/mod.d.ts.map +1 -0
  8. package/esm/discovery/mod.js +122 -0
  9. package/esm/mod.d.ts +3 -1
  10. package/esm/mod.d.ts.map +1 -1
  11. package/esm/mod.js +3 -1
  12. package/esm/model/mod.d.ts +6 -0
  13. package/esm/model/mod.d.ts.map +1 -1
  14. package/esm/model/mod.js +1 -0
  15. package/esm/parser/markdown.d.ts.map +1 -1
  16. package/esm/parser/markdown.js +28 -15
  17. package/esm/self_upgrade/target.d.ts +3 -3
  18. package/esm/self_upgrade/target.d.ts.map +1 -1
  19. package/esm/self_upgrade/target.js +4 -2
  20. package/esm/validator/listing.d.ts.map +1 -1
  21. package/esm/validator/listing.js +4 -1
  22. package/package.json +1 -1
  23. package/script/config/mod.d.ts.map +1 -1
  24. package/script/config/mod.js +25 -0
  25. package/script/discovery/gitignore.d.ts +40 -0
  26. package/script/discovery/gitignore.d.ts.map +1 -0
  27. package/script/discovery/gitignore.js +149 -0
  28. package/script/discovery/mod.d.ts +54 -0
  29. package/script/discovery/mod.d.ts.map +1 -0
  30. package/script/discovery/mod.js +128 -0
  31. package/script/mod.d.ts +3 -1
  32. package/script/mod.d.ts.map +1 -1
  33. package/script/mod.js +10 -2
  34. package/script/model/mod.d.ts +6 -0
  35. package/script/model/mod.d.ts.map +1 -1
  36. package/script/model/mod.js +1 -0
  37. package/script/parser/markdown.d.ts.map +1 -1
  38. package/script/parser/markdown.js +27 -14
  39. package/script/self_upgrade/target.d.ts +3 -3
  40. package/script/self_upgrade/target.d.ts.map +1 -1
  41. package/script/self_upgrade/target.js +4 -2
  42. package/script/validator/listing.d.ts.map +1 -1
  43. package/script/validator/listing.js +4 -1
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Map (os, arch) → the GitHub release target string used in tarball
5
5
  * names. Targets match those produced by the Release workflow:
6
- * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
- * aarch64-apple-darwin, x86_64-pc-windows-msvc.
6
+ * x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu,
7
+ * x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
8
  *
9
9
  * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
10
  * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
@@ -17,7 +17,7 @@ export interface Platform {
17
17
  readonly os: Os;
18
18
  readonly arch: Arch;
19
19
  }
20
- export type Target = "x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" | "aarch64-apple-darwin" | "x86_64-pc-windows-msvc";
20
+ export type Target = "x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu" | "x86_64-apple-darwin" | "aarch64-apple-darwin" | "x86_64-pc-windows-msvc";
21
21
  /** Return the release target for a platform, or undefined if not shipped. */
22
22
  export declare function detectTarget(platform: Platform): Target | undefined;
23
23
  /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
@@ -1 +1 @@
1
- {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,MAAM,GACd,0BAA0B,GAC1B,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAKtB"}
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,MAAM,GACd,0BAA0B,GAC1B,2BAA2B,GAC3B,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAQnE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAKtB"}
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Map (os, arch) → the GitHub release target string used in tarball
5
5
  * names. Targets match those produced by the Release workflow:
6
- * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
- * aarch64-apple-darwin, x86_64-pc-windows-msvc.
6
+ * x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu,
7
+ * x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
8
  *
9
9
  * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
10
  * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
@@ -16,6 +16,8 @@ export function detectTarget(platform) {
16
16
  const { os, arch } = platform;
17
17
  if (os === "linux" && arch === "x86_64")
18
18
  return "x86_64-unknown-linux-gnu";
19
+ if (os === "linux" && arch === "aarch64")
20
+ return "aarch64-unknown-linux-gnu";
19
21
  if (os === "darwin" && arch === "x86_64")
20
22
  return "x86_64-apple-darwin";
21
23
  if (os === "darwin" && arch === "aarch64")
@@ -1 +1 @@
1
- {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAYpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA4SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
1
+ {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAYpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA8SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
@@ -42,7 +42,10 @@ const UNIT_FAMILY = new Set([
42
42
  // ---------------------------------------------------------------------------
43
43
  /** Listing kind implied by a file's basename, or null if not a listing file. */
44
44
  function filenameKind(file) {
45
- const base = basename(file).toLowerCase().replace(/\.[^.]+$/, "");
45
+ const name = basename(file).toLowerCase();
46
+ if (!name.endsWith(".md"))
47
+ return null;
48
+ const base = name.replace(/\.md$/, "");
46
49
  if (base === "references")
47
50
  return "references";
48
51
  if (base === "glossary")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftsys/markspec",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Markdown flavor and toolchain for traceable industrial documentation",
5
5
  "keywords": [
6
6
  "markdown",
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/config/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,E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OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAMrE;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7B;AAsBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,aAAa,CA+Nf;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiBxD;AAMD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAUvC"}
@@ -232,6 +232,30 @@ function parseProjectConfig(yaml, filePath) {
232
232
  }
233
233
  }
234
234
  }
235
+ // exclude: optional string[] of gitignore-syntax patterns
236
+ let exclude = mod_js_1.DEFAULT_PROJECT_CONFIG.exclude;
237
+ if (obj.exclude !== undefined && obj.exclude !== null) {
238
+ if (!Array.isArray(obj.exclude)) {
239
+ errors.push({
240
+ field: "exclude",
241
+ message: `expected array, got ${typeof obj.exclude}`,
242
+ line: findLineNumber(yaml, "exclude"),
243
+ });
244
+ }
245
+ else {
246
+ const bad = obj.exclude.findIndex((v) => typeof v !== "string" || v === "");
247
+ if (bad !== -1) {
248
+ errors.push({
249
+ field: `exclude[${bad}]`,
250
+ message: "each exclude pattern must be a non-empty string",
251
+ line: findLineNumber(yaml, "exclude"),
252
+ });
253
+ }
254
+ else {
255
+ exclude = obj.exclude;
256
+ }
257
+ }
258
+ }
235
259
  if (errors.length > 0) {
236
260
  throw new mod_js_1.ConfigError(filePath, errors);
237
261
  }
@@ -242,6 +266,7 @@ function parseProjectConfig(yaml, filePath) {
242
266
  parents,
243
267
  parentFallback,
244
268
  captionConventions,
269
+ exclude,
245
270
  };
246
271
  }
247
272
  // ---------------------------------------------------------------------------
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module core/discovery/gitignore
3
+ *
4
+ * Pure-TypeScript `.gitignore` pattern matcher. Implements the standard
5
+ * semantics the discovery walker needs: `#` comments, `!` negation,
6
+ * trailing-`/` directory-only patterns, leading-`/` and contains-`/`
7
+ * anchoring, `*` / `?` / `[...]` globs, and `**` cross-directory globs.
8
+ * Last matching rule wins.
9
+ *
10
+ * Per git semantics, a file inside an ignored directory cannot be
11
+ * re-included by a negation — the walker enforces this by pruning
12
+ * ignored directories without descending.
13
+ *
14
+ * No I/O, no platform APIs — Node-compatible by construction.
15
+ */
16
+ /** One compiled gitignore rule. */
17
+ export interface GitignoreRule {
18
+ /** Matches a root-relative POSIX path (no leading slash). */
19
+ readonly regex: RegExp;
20
+ /** `!pattern` — a match un-ignores the path. */
21
+ readonly negated: boolean;
22
+ /** `pattern/` — matches directories only. */
23
+ readonly dirOnly: boolean;
24
+ }
25
+ /**
26
+ * Parse `.gitignore` content into compiled rules.
27
+ *
28
+ * @param content - Raw file content (LF or CRLF).
29
+ * @param baseDir - Root-relative POSIX dir the `.gitignore` lives in
30
+ * (`""` for the root one). Patterns only match paths under it.
31
+ */
32
+ export declare function parseGitignore(content: string, baseDir: string): GitignoreRule[];
33
+ /**
34
+ * Test a root-relative POSIX path against compiled rules.
35
+ * Last matching rule wins; no match → not ignored.
36
+ *
37
+ * @param isDir - Directory-only rules (`build/`) match only when true.
38
+ */
39
+ export declare function isIgnored(relPath: string, isDir: boolean, rules: readonly GitignoreRule[]): boolean;
40
+ //# sourceMappingURL=gitignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/discovery/gitignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mCAAmC;AACnC,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AA0DD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,aAAa,EAAE,CAyCjB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,OAAO,CAOT"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/discovery/gitignore
4
+ *
5
+ * Pure-TypeScript `.gitignore` pattern matcher. Implements the standard
6
+ * semantics the discovery walker needs: `#` comments, `!` negation,
7
+ * trailing-`/` directory-only patterns, leading-`/` and contains-`/`
8
+ * anchoring, `*` / `?` / `[...]` globs, and `**` cross-directory globs.
9
+ * Last matching rule wins.
10
+ *
11
+ * Per git semantics, a file inside an ignored directory cannot be
12
+ * re-included by a negation — the walker enforces this by pruning
13
+ * ignored directories without descending.
14
+ *
15
+ * No I/O, no platform APIs — Node-compatible by construction.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.parseGitignore = parseGitignore;
19
+ exports.isIgnored = isIgnored;
20
+ const REGEX_SPECIALS = /[.+^${}()|\\]/;
21
+ function escapeRegexChar(c) {
22
+ return REGEX_SPECIALS.test(c) ? `\\${c}` : c;
23
+ }
24
+ /** Translate one gitignore glob (already stripped of `!`, `/` affixes)
25
+ * into a regex source string. */
26
+ function globToRegexSource(pattern) {
27
+ let re = "";
28
+ let i = 0;
29
+ while (i < pattern.length) {
30
+ const c = pattern[i];
31
+ if (c === "*") {
32
+ // Consume the whole run of consecutive `*` so we never emit adjacent
33
+ // unbounded quantifiers (which backtrack catastrophically against a
34
+ // non-matching input). Git likewise treats consecutive `*` that are
35
+ // not a slash-delimited `**` as regular asterisks.
36
+ let stars = 0;
37
+ while (pattern[i] === "*") {
38
+ stars++;
39
+ i++;
40
+ }
41
+ if (stars >= 2 && pattern[i] === "/") {
42
+ re += "(?:[^/]+/)*"; // `**/` — zero or more whole segments
43
+ i++; // consume the `/`
44
+ }
45
+ else if (stars >= 2) {
46
+ re += ".*"; // leading/trailing/bare `**` — crosses directories
47
+ }
48
+ else {
49
+ re += "[^/]*"; // single `*` — within one path segment
50
+ }
51
+ }
52
+ else if (c === "?") {
53
+ re += "[^/]";
54
+ i++;
55
+ }
56
+ else if (c === "[") {
57
+ const end = pattern.indexOf("]", i + 1);
58
+ if (end < 0) {
59
+ re += "\\[";
60
+ i++;
61
+ }
62
+ else {
63
+ let cls = pattern.slice(i + 1, end);
64
+ if (cls.startsWith("!"))
65
+ cls = `^${cls.slice(1)}`;
66
+ re += `[${cls}]`;
67
+ i = end + 1;
68
+ }
69
+ }
70
+ else if (c === "\\" && i + 1 < pattern.length) {
71
+ re += escapeRegexChar(pattern[i + 1]);
72
+ i += 2;
73
+ }
74
+ else {
75
+ re += escapeRegexChar(c);
76
+ i++;
77
+ }
78
+ }
79
+ return re;
80
+ }
81
+ /**
82
+ * Parse `.gitignore` content into compiled rules.
83
+ *
84
+ * @param content - Raw file content (LF or CRLF).
85
+ * @param baseDir - Root-relative POSIX dir the `.gitignore` lives in
86
+ * (`""` for the root one). Patterns only match paths under it.
87
+ */
88
+ function parseGitignore(content, baseDir) {
89
+ const rules = [];
90
+ for (const rawLine of content.split("\n")) {
91
+ // Strip CR and unescaped trailing spaces (git semantics).
92
+ const line = rawLine.replace(/\r$/, "").replace(/(?<!\\) +$/, "");
93
+ if (line === "" || line.startsWith("#"))
94
+ continue;
95
+ let pattern = line;
96
+ let negated = false;
97
+ if (pattern.startsWith("!")) {
98
+ negated = true;
99
+ pattern = pattern.slice(1);
100
+ }
101
+ let dirOnly = false;
102
+ if (pattern.endsWith("/")) {
103
+ dirOnly = true;
104
+ pattern = pattern.slice(0, -1);
105
+ }
106
+ // A separator anywhere in the pattern anchors it to baseDir;
107
+ // otherwise it matches at any depth below baseDir.
108
+ const anchored = pattern.includes("/");
109
+ if (pattern.startsWith("/"))
110
+ pattern = pattern.slice(1);
111
+ if (pattern === "")
112
+ continue;
113
+ // baseDir is a literal directory prefix, so every regex metacharacter
114
+ // in it must be escaped — including `* ? [ ]`, which the pattern-body
115
+ // helpers (escapeRegexChar / globToRegexSource) deliberately leave
116
+ // unescaped so they can act as globs. A dir literally named `pkg[v2]`
117
+ // would otherwise inject a stray character class.
118
+ const prefix = baseDir === ""
119
+ ? ""
120
+ : `${baseDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/`;
121
+ const depth = anchored ? "" : "(?:.*/)?";
122
+ let regex;
123
+ try {
124
+ regex = new RegExp(`^${prefix}${depth}${globToRegexSource(pattern)}$`);
125
+ }
126
+ catch {
127
+ continue; // skip a line that compiles to an invalid regex (e.g. a
128
+ // malformed character class) rather than crashing discovery
129
+ }
130
+ rules.push({ regex, negated, dirOnly });
131
+ }
132
+ return rules;
133
+ }
134
+ /**
135
+ * Test a root-relative POSIX path against compiled rules.
136
+ * Last matching rule wins; no match → not ignored.
137
+ *
138
+ * @param isDir - Directory-only rules (`build/`) match only when true.
139
+ */
140
+ function isIgnored(relPath, isDir, rules) {
141
+ let ignored = false;
142
+ for (const rule of rules) {
143
+ if (rule.dirOnly && !isDir)
144
+ continue;
145
+ if (rule.regex.test(relPath))
146
+ ignored = !rule.negated;
147
+ }
148
+ return ignored;
149
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @module core/discovery
3
+ *
4
+ * Gitignore-aware project file discovery — the single walker every
5
+ * MarkSpec surface uses (CLI verbs, LSP indexing, lockfile entry
6
+ * collection). Yields absolute paths of MarkSpec-relevant files under a
7
+ * root, honoring (in precedence order):
8
+ *
9
+ * 1. built-in skips — hidden directories (name starts with `.`)
10
+ * 2. `.gitignore` files (root + nested, standard semantics)
11
+ * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored)
12
+ *
13
+ * I/O is injected via {@linkcode DiscoveryIO} so the module stays
14
+ * Node-compatible; entry points supply the Deno implementation.
15
+ */
16
+ export { type GitignoreRule, isIgnored, parseGitignore } from "./gitignore.js";
17
+ /**
18
+ * Source-file extensions the parser can extract doc-comment entries
19
+ * from (tree-sitter grammars available). Single SSOT — `lsp/context.ts`
20
+ * imports this set.
21
+ */
22
+ export declare const SOURCE_EXTENSIONS: ReadonlySet<string>;
23
+ /** Markdown only — the `fmt` scope (the formatter never rewrites source). */
24
+ export declare const MARKDOWN_EXTENSIONS: ReadonlySet<string>;
25
+ /** Everything MarkSpec-relevant: markdown + source families. */
26
+ export declare const RELEVANT_EXTENSIONS: ReadonlySet<string>;
27
+ /** One directory entry from {@linkcode DiscoveryIO.readDir}.
28
+ * Structurally compatible with `Deno.DirEntry`. */
29
+ export interface DiscoveryDirEntry {
30
+ readonly name: string;
31
+ readonly isDirectory: boolean;
32
+ readonly isFile: boolean;
33
+ }
34
+ /** Injected filesystem surface for the walker. */
35
+ export interface DiscoveryIO {
36
+ readDir(path: string): AsyncIterable<DiscoveryDirEntry>;
37
+ /** Resolves `undefined` when the file does not exist or is unreadable. */
38
+ readFile(path: string): Promise<string | undefined>;
39
+ }
40
+ /** Options for {@linkcode discoverFiles}. */
41
+ export interface DiscoverOptions {
42
+ /** Extension filter; defaults to {@linkcode RELEVANT_EXTENSIONS}. */
43
+ readonly extensions?: ReadonlySet<string>;
44
+ /** Extra gitignore-syntax patterns, anchored at `root` (e.g. from
45
+ * project.yaml `exclude:`). Applied after `.gitignore` rules. */
46
+ readonly exclude?: readonly string[];
47
+ }
48
+ /**
49
+ * Walk `root` recursively, yielding absolute paths of relevant files.
50
+ * Entries are yielded in sorted order per directory — deterministic
51
+ * output across filesystems. Unreadable directories are skipped.
52
+ */
53
+ export declare function discoverFiles(root: string, io: DiscoveryIO, options?: DiscoverOptions): AsyncGenerator<string>;
54
+ //# sourceMappingURL=mod.d.ts.map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
+ * @module core/discovery
4
+ *
5
+ * Gitignore-aware project file discovery — the single walker every
6
+ * MarkSpec surface uses (CLI verbs, LSP indexing, lockfile entry
7
+ * collection). Yields absolute paths of MarkSpec-relevant files under a
8
+ * root, honoring (in precedence order):
9
+ *
10
+ * 1. built-in skips — hidden directories (name starts with `.`)
11
+ * 2. `.gitignore` files (root + nested, standard semantics)
12
+ * 3. caller-supplied `exclude` patterns (gitignore syntax, root-anchored)
13
+ *
14
+ * I/O is injected via {@linkcode DiscoveryIO} so the module stays
15
+ * Node-compatible; entry points supply the Deno implementation.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.RELEVANT_EXTENSIONS = exports.MARKDOWN_EXTENSIONS = exports.SOURCE_EXTENSIONS = exports.parseGitignore = exports.isIgnored = void 0;
19
+ exports.discoverFiles = discoverFiles;
20
+ const path_1 = require("@std/path");
21
+ const gitignore_js_1 = require("./gitignore.js");
22
+ var gitignore_js_2 = require("./gitignore.js");
23
+ Object.defineProperty(exports, "isIgnored", { enumerable: true, get: function () { return gitignore_js_2.isIgnored; } });
24
+ Object.defineProperty(exports, "parseGitignore", { enumerable: true, get: function () { return gitignore_js_2.parseGitignore; } });
25
+ /**
26
+ * Source-file extensions the parser can extract doc-comment entries
27
+ * from (tree-sitter grammars available). Single SSOT — `lsp/context.ts`
28
+ * imports this set.
29
+ */
30
+ exports.SOURCE_EXTENSIONS = new Set([
31
+ ".rs",
32
+ ".kt",
33
+ ".kts",
34
+ ".java",
35
+ ".c",
36
+ ".h",
37
+ ".cpp",
38
+ ".cc",
39
+ ".cxx",
40
+ ".hpp",
41
+ ".hxx",
42
+ ".ts",
43
+ ".tsx",
44
+ ".jsx",
45
+ ".js",
46
+ ".mjs",
47
+ ".cjs",
48
+ ".cs",
49
+ ]);
50
+ /** Markdown only — the `fmt` scope (the formatter never rewrites source). */
51
+ exports.MARKDOWN_EXTENSIONS = new Set([".md"]);
52
+ /** Everything MarkSpec-relevant: markdown + source families. */
53
+ exports.RELEVANT_EXTENSIONS = new Set([
54
+ ...exports.MARKDOWN_EXTENSIONS,
55
+ ...exports.SOURCE_EXTENSIONS,
56
+ ]);
57
+ /**
58
+ * Directory names pruned by default, in addition to the hidden-dir skip.
59
+ * These are the common build-output / dependency directories the
60
+ * pre-`core/discovery` walkers (LSP `walkDirectory`, lockfile
61
+ * `collectEntries`) hardcoded; keeping them restores that guarantee
62
+ * independent of a consumer's `.gitignore` — otherwise a project that does
63
+ * not list them recurses into build artifacts (duplicate-ID noise, slow LSP
64
+ * indexing, spurious `MSL-L212` edge-hash entries).
65
+ *
66
+ * Unlike the hidden-dir skip these are overridable: they are applied as the
67
+ * LOWEST-precedence rule layer (before `.gitignore` and `exclude:`), so a
68
+ * negated `!target/` entry in either re-includes them under gitignore
69
+ * last-match-wins.
70
+ */
71
+ const BUILTIN_SKIP_DIRS = [
72
+ "node_modules",
73
+ "target",
74
+ "dist",
75
+ "build",
76
+ ];
77
+ /** Compiled once: the built-in skip as unanchored, directory-only gitignore
78
+ * rules (each matches a directory of that name at any depth). */
79
+ const BUILTIN_SKIP_RULES = (0, gitignore_js_1.parseGitignore)(BUILTIN_SKIP_DIRS.map((d) => `${d}/`).join("\n"), "");
80
+ /**
81
+ * Walk `root` recursively, yielding absolute paths of relevant files.
82
+ * Entries are yielded in sorted order per directory — deterministic
83
+ * output across filesystems. Unreadable directories are skipped.
84
+ */
85
+ async function* discoverFiles(root, io, options = {}) {
86
+ const extensions = options.extensions ?? exports.RELEVANT_EXTENSIONS;
87
+ const excludeRules = (0, gitignore_js_1.parseGitignore)((options.exclude ?? []).join("\n"), "");
88
+ // Built-in build-output skips are the lowest-precedence layer: `.gitignore`
89
+ // (appended per-directory in `walk`) and `exclude:` both come after, so a
90
+ // `!target/` negation in either overrides them.
91
+ yield* walk(root, "", [...BUILTIN_SKIP_RULES, ...excludeRules], io, extensions);
92
+ }
93
+ async function* walk(absDir, relDir, rules, io, extensions) {
94
+ // Nested .gitignore rules append after inherited ones — deeper rules
95
+ // win under last-match-wins.
96
+ const raw = await io.readFile((0, path_1.join)(absDir, ".gitignore"));
97
+ const active = raw !== undefined && raw.length > 0
98
+ ? [...rules, ...(0, gitignore_js_1.parseGitignore)(raw, relDir)]
99
+ : rules;
100
+ const entries = [];
101
+ try {
102
+ for await (const e of io.readDir(absDir))
103
+ entries.push(e);
104
+ }
105
+ catch {
106
+ return; // unreadable directory — a project walk must not abort
107
+ }
108
+ entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
109
+ for (const entry of entries) {
110
+ const rel = relDir === "" ? entry.name : `${relDir}/${entry.name}`;
111
+ if (entry.isDirectory) {
112
+ if (entry.name.startsWith("."))
113
+ continue; // built-in: hidden dirs
114
+ // Git semantics: paths under an ignored directory cannot be
115
+ // re-included, so pruning here is correct (and fast).
116
+ if ((0, gitignore_js_1.isIgnored)(rel, true, active))
117
+ continue;
118
+ yield* walk((0, path_1.join)(absDir, entry.name), rel, active, io, extensions);
119
+ }
120
+ else if (entry.isFile) {
121
+ if (!extensions.has((0, path_1.extname)(entry.name).toLowerCase()))
122
+ continue;
123
+ if ((0, gitignore_js_1.isIgnored)(rel, false, active))
124
+ continue;
125
+ yield (0, path_1.join)(absDir, entry.name);
126
+ }
127
+ }
128
+ }
package/script/mod.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * from core/mod.ts, never from internal paths.
9
9
  */
10
10
  import "./_dnt.polyfills.js";
11
- export declare const VERSION = "0.8.0";
11
+ export declare const VERSION = "0.9.0";
12
12
  export declare const CORE_SCHEMA_VERSION = 1;
13
13
  export { ConfigError, CORE_DISCIPLINE_REGISTRY, CORE_KINDS, CORE_RELATIONS, DEFAULT_PROJECT_CONFIG, descendantsOf, KNOWN_LINK_KINDS, LOCK_EXTRA_INVERSE_KEYS, makeDisplayId, makeUlid, MIXED_DISCIPLINE, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
14
14
  export type { Attribute, BodyToken, BodyTokenKind, Caption, CaptionConventions, CaptionPosition, ConfigFieldError, Diagnostic, Directive, Discipline, DisciplineRegistry, DisplayId, EarsTrigger, EffectiveProfile, EffectiveTypeDef, EntityRefConvention, Entry, EntryShape, EntrySource, ExtractorRule, InlineRef, KindDecl, LabelConcern, LabelConcernKind, LabelValue, Link, LinkKind, LoadedProfile, ModalCase, PaletteHue, ProfileChain, ProfileConvention, ProjectConfig, ProvenancedMap, ProvenancedMapEntry, ProvenancedValue, RelationDef, Severity, SourceLocation, Ulid, } from "./model/mod.js";
@@ -53,4 +53,6 @@ export type { RefIndex } from "./refs/mod.js";
53
53
  export { aggregateStatusByState, encodeLogLine, inferLockedAttributes, parseLogLine, parseMapping, validateMappings, } from "./sync/mod.js";
54
54
  export type { AttributeMapping, BoundEntryStatus, ConflictPolicy, Direction as SyncDirection, Mapping, ParseMappingResult, RemoteState, SyncLogEntry, } from "./sync/mod.js";
55
55
  export { type Arch as SelfUpgradeArch, assertTrustedReleaseUrl, classifyInstallPath, type ClassifyResult as SelfUpgradeClassifyResult, compareVersions, type Comparison, DEFAULT_RELEASES_API, DEFAULT_RELEASES_DOWNLOAD_BASE, detectTarget, type InstallSource, type Os as SelfUpgradeOs, parseSha256Line, type Platform as SelfUpgradePlatform, platformFromBuild, type ReleaseAssets, releaseAssets, type ReleaseEndpoints, type ResolveEndpointsInput, resolveReleaseEndpoints, type Target as SelfUpgradeTarget, } from "./self_upgrade/mod.js";
56
+ export { discoverFiles, isIgnored, MARKDOWN_EXTENSIONS, parseGitignore, RELEVANT_EXTENSIONS, SOURCE_EXTENSIONS, } from "./discovery/mod.js";
57
+ export type { DiscoverOptions, DiscoveryDirEntry, DiscoveryIO, GitignoreRule, } from "./discovery/mod.js";
56
58
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,qBAAqB,CAAC;AAG7B,eAAO,MAAM,O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,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,SAAS,IAAI,aAAa,EAC1B,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,IAAI,IAAI,eAAe,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,cAAc,IAAI,yBAAyB,EAChD,eAAe,EACf,KAAK,UAAU,EACf,oBAAoB,EACpB,8BAA8B,EAC9B,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,EAAE,IAAI,aAAa,EACxB,eAAe,EACf,KAAK,QAAQ,IAAI,mBAAmB,EACpC,iBAAiB,EACjB,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,KAAK,MAAM,IAAI,iBAAiB,GACjC,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,qBAAqB,CAAC;AAG7B,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAGrC,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,EAC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ACjB,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,uBAAuB,EACvB,KAAK,MAAM,IAAI,iBAAiB,GACjC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,GACd,MAAM,oBAAoB,CAAC"}
package/script/mod.js CHANGED
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.buildProfileIntrospection = exports.targetsForRelation = exports.filterEntriesByTraceTargets = exports.entryMatchesTargets = exports.validateDisplayIdPattern = exports.parseDisplayIdPattern = exports.padDisplayIdNumber = exports.highestDisplayIdNumber = exports.formatDisplayId = exports.resolveDisciplineMode = exports.inferDisciplineMode = exports.buildEffectiveDisciplineRegistry = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.resolveEntryColor = exports.parseManifest = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.readMarkspecYaml = exports.parseMarkspecYaml = exports.MARKSPEC_YAML_FILENAME = exports.discoverMarkspecRoot = exports.addProfileSpecifier = exports.parseProjectConfig = exports.loadConfig = exports.discoverProjectRoot = exports.render = exports.normalizeBodyAst = exports.astEquivalent = exports.REFHUB_URL = exports.PALETTE_HUES = exports.MIXED_DISCIPLINE = exports.makeUlid = exports.makeDisplayId = exports.LOCK_EXTRA_INVERSE_KEYS = exports.KNOWN_LINK_KINDS = exports.descendantsOf = exports.DEFAULT_PROJECT_CONFIG = exports.CORE_RELATIONS = exports.CORE_KINDS = exports.CORE_DISCIPLINE_REGISTRY = exports.ConfigError = exports.CORE_SCHEMA_VERSION = exports.VERSION = void 0;
37
37
  exports.serializeLockfile = exports.resolveUpstreams = exports.resolveRegistries = exports.resolveReferences = exports.resolveProfileChain = exports.resolveBoundEntries = exports.parseLockfile = exports.LOCKFILE_SCHEMA_VERSION = exports.isBelowFloor = exports.hashCanonicalEdges = exports.extractEdgeQuads = exports.extractEdgeLedger = exports.checkDrift = exports.canonicalEdgeJson = exports.typl = exports.runLint = exports.isProseScope = exports.computeScoreRollup = exports.ANTI_PATTERN_NOTE = exports.report = exports.indexToJson = exports.buildEntriesNdjson = exports.buildEdgesNdjson = exports.buildManifest = exports.serializeCompileResult = exports.generateInverses = exports.compile = exports.validateValue = exports.validateTraceabilityForEntry = exports.validateListingDocuments = exports.validateAttributesForEntry = exports.validate = exports.suppressDeclaredAttrR010 = exports.runPipeline = exports.normalizeListValues = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.format = exports.parseSource = exports.parseFile = exports.parse = exports.loadGrammar = exports.isSupportedExtension = exports.detectInlineRefs = exports.detectDirectives = exports.detectCaptions = void 0;
38
- exports.resolveReleaseEndpoints = exports.releaseAssets = exports.platformFromBuild = exports.parseSha256Line = exports.detectTarget = exports.DEFAULT_RELEASES_DOWNLOAD_BASE = exports.DEFAULT_RELEASES_API = exports.compareVersions = exports.classifyInstallPath = exports.assertTrustedReleaseUrl = exports.validateMappings = exports.parseMapping = exports.parseLogLine = exports.inferLockedAttributes = exports.encodeLogLine = exports.aggregateStatusByState = exports.TRACE_ATTRIBUTE_KEYS = exports.canonicalizeRefs = exports.buildRefIndex = exports.sha256String = exports.sha256Bytes = void 0;
38
+ exports.SOURCE_EXTENSIONS = exports.RELEVANT_EXTENSIONS = exports.parseGitignore = exports.MARKDOWN_EXTENSIONS = exports.isIgnored = exports.discoverFiles = exports.resolveReleaseEndpoints = exports.releaseAssets = exports.platformFromBuild = exports.parseSha256Line = exports.detectTarget = exports.DEFAULT_RELEASES_DOWNLOAD_BASE = exports.DEFAULT_RELEASES_API = exports.compareVersions = exports.classifyInstallPath = exports.assertTrustedReleaseUrl = exports.validateMappings = exports.parseMapping = exports.parseLogLine = exports.inferLockedAttributes = exports.encodeLogLine = exports.aggregateStatusByState = exports.TRACE_ATTRIBUTE_KEYS = exports.canonicalizeRefs = exports.buildRefIndex = exports.sha256String = exports.sha256Bytes = void 0;
39
39
  /**
40
40
  * @module core
41
41
  *
@@ -46,7 +46,7 @@ exports.resolveReleaseEndpoints = exports.releaseAssets = exports.platformFromBu
46
46
  * from core/mod.ts, never from internal paths.
47
47
  */
48
48
  require("./_dnt.polyfills.js");
49
- exports.VERSION = "0.8.0";
49
+ exports.VERSION = "0.9.0";
50
50
  exports.CORE_SCHEMA_VERSION = 1;
51
51
  // Model types
52
52
  var mod_js_1 = require("./model/mod.js");
@@ -207,3 +207,11 @@ Object.defineProperty(exports, "parseSha256Line", { enumerable: true, get: funct
207
207
  Object.defineProperty(exports, "platformFromBuild", { enumerable: true, get: function () { return mod_js_18.platformFromBuild; } });
208
208
  Object.defineProperty(exports, "releaseAssets", { enumerable: true, get: function () { return mod_js_18.releaseAssets; } });
209
209
  Object.defineProperty(exports, "resolveReleaseEndpoints", { enumerable: true, get: function () { return mod_js_18.resolveReleaseEndpoints; } });
210
+ // ── Gitignore-aware project file discovery ───────────────────────────────
211
+ var mod_js_19 = require("./discovery/mod.js");
212
+ Object.defineProperty(exports, "discoverFiles", { enumerable: true, get: function () { return mod_js_19.discoverFiles; } });
213
+ Object.defineProperty(exports, "isIgnored", { enumerable: true, get: function () { return mod_js_19.isIgnored; } });
214
+ Object.defineProperty(exports, "MARKDOWN_EXTENSIONS", { enumerable: true, get: function () { return mod_js_19.MARKDOWN_EXTENSIONS; } });
215
+ Object.defineProperty(exports, "parseGitignore", { enumerable: true, get: function () { return mod_js_19.parseGitignore; } });
216
+ Object.defineProperty(exports, "RELEVANT_EXTENSIONS", { enumerable: true, get: function () { return mod_js_19.RELEVANT_EXTENSIONS; } });
217
+ Object.defineProperty(exports, "SOURCE_EXTENSIONS", { enumerable: true, get: function () { return mod_js_19.SOURCE_EXTENSIONS; } });
@@ -457,6 +457,12 @@ export interface ProjectConfig {
457
457
  * or absent map means all keywords are unconstrained.
458
458
  */
459
459
  readonly captionConventions: CaptionConventions;
460
+ /**
461
+ * Gitignore-syntax patterns excluded from project file discovery,
462
+ * anchored at the project root (e.g. `["skills/", "*.gen.md"]`).
463
+ * Applied after `.gitignore` rules by `core/discovery`.
464
+ */
465
+ readonly exclude: readonly string[];
460
466
  }
461
467
  /** Default configuration used when no `project.yaml` is found. */
462
468
  export declare const DEFAULT_PROJECT_CONFIG: ProjectConfig;