@any-nav/core 0.1.0 → 0.2.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/CHANGELOG.md +15 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +12 -3
- package/dist/config.js.map +1 -1
- package/dist/facade.d.ts +1 -1
- package/dist/facade.js +5 -4
- package/dist/facade.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/query.d.ts +4 -12
- package/dist/query.js +21 -50
- package/dist/query.js.map +1 -1
- package/dist/search-engine.d.ts +15 -1
- package/dist/search-engine.js +62 -13
- package/dist/search-engine.js.map +1 -1
- package/dist/types.d.ts +15 -14
- package/package.json +8 -3
- package/dist/bindings.d.ts +0 -10
- package/dist/bindings.js +0 -51
- package/dist/bindings.js.map +0 -1
- package/dist/description.d.ts +0 -31
- package/dist/description.js +0 -273
- package/dist/description.js.map +0 -1
- package/dist/gitignore.d.ts +0 -9
- package/dist/gitignore.js +0 -110
- package/dist/gitignore.js.map +0 -1
- package/dist/path-hints.d.ts +0 -14
- package/dist/path-hints.js +0 -60
- package/dist/path-hints.js.map +0 -1
- package/dist/scan.d.ts +0 -46
- package/dist/scan.js +0 -301
- package/dist/scan.js.map +0 -1
package/dist/search-engine.js
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Search engine seam + fast-bm25 adapter
|
|
3
|
-
* architecture §12 #4)
|
|
4
|
-
* (src/bm25/engine.ts + fast-bm25-engine.ts +
|
|
5
|
-
* discipline of src/tools/tool_search.ts);
|
|
6
|
-
* semantics unchanged.
|
|
2
|
+
* Search face: engine seam + fast-bm25 adapter + index assembly. The engine
|
|
3
|
+
* seam (TODO bm25-engine-port, ruling architecture §12 #4) was ported from
|
|
4
|
+
* sparse-retrieve's bm25 layer (src/bm25/engine.ts + fast-bm25-engine.ts +
|
|
5
|
+
* the search-text assembly discipline of src/tools/tool_search.ts);
|
|
6
|
+
* interface adapted to NavItem, semantics unchanged.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* Load isolation (2026-10-23): fast-bm25 is loaded synchronously on first
|
|
9
|
+
* engine construction, never at module load — importing @any-nav/core (or
|
|
10
|
+
* any of its list/read faces) costs zero engine load; only the first search
|
|
11
|
+
* pays it. The sync hop rides require() over the package's CJS build
|
|
12
|
+
* (dual-format ship), so the sync signatures stay sync.
|
|
13
|
+
*
|
|
14
|
+
* v1 recall matches English metadata only (init ruling 2026-10-02): the
|
|
15
|
+
* package tokenizer splits on whitespace and punctuation, so unsegmented
|
|
16
|
+
* CJK runs do not match shorter queries — Chinese metadata missing
|
|
17
|
+
* English-query hits is stance, not a gap.
|
|
14
18
|
*/
|
|
15
|
-
import {
|
|
19
|
+
import { createRequire } from 'node:module';
|
|
20
|
+
// Lazy sync loader: module-load-time cost of fast-bm25 is deferred to the
|
|
21
|
+
// first FastBm25Engine construction (the first search), keeping every
|
|
22
|
+
// non-search entry — CLI list / list --json / dsh nav — off the engine.
|
|
23
|
+
const requireCjs = createRequire(import.meta.url);
|
|
24
|
+
let bm25Ctor;
|
|
25
|
+
const loadBm25 = () => (bm25Ctor ??= requireCjs('fast-bm25').BM25);
|
|
26
|
+
// Seam-level decisions (TODO bm25-engine-port): fast-bm25 requires an
|
|
27
|
+
// explicit topK, so an unset limit defaults to 20; k1/b are passed
|
|
28
|
+
// explicitly — package defaults stay out of our ranking contract — keeping
|
|
29
|
+
// the in-service values the self-implemented engine used. Exported so
|
|
30
|
+
// adapter-facing descriptions of `limit` stay in sync with the behavior.
|
|
31
|
+
export const DEFAULT_SEARCH_LIMIT = 20;
|
|
32
|
+
const BM25_K1 = 1.5;
|
|
33
|
+
const BM25_B = 0.75;
|
|
16
34
|
/**
|
|
17
35
|
* fast-bm25 adapter over one pool of search texts; document id = array
|
|
18
36
|
* index. An empty corpus degenerates to an always-empty engine — the
|
|
@@ -24,7 +42,7 @@ export class FastBm25Engine {
|
|
|
24
42
|
this.bm25 =
|
|
25
43
|
searchTexts.length === 0
|
|
26
44
|
? null
|
|
27
|
-
: new
|
|
45
|
+
: new (loadBm25())(searchTexts.map((content) => ({ content })), { stemming: true, ...options });
|
|
28
46
|
}
|
|
29
47
|
search(query, limit) {
|
|
30
48
|
return this.bm25 ? this.bm25.search(query, limit) : [];
|
|
@@ -51,4 +69,35 @@ export function navSearchText(item) {
|
|
|
51
69
|
push(item.locator.path);
|
|
52
70
|
return parts.join(' ');
|
|
53
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* One search pool over the scanned sources' file items (buildSearchIndex:
|
|
74
|
+
* engine assembly + hit mapping, moved here from query.ts 2026-10-23 so the
|
|
75
|
+
* non-search faces never load fast-bm25). The index is a snapshot; freshness
|
|
76
|
+
* is the caller's rebuild policy.
|
|
77
|
+
*/
|
|
78
|
+
export function buildSearchIndex(sources) {
|
|
79
|
+
const entries = [];
|
|
80
|
+
const visit = (nodes) => {
|
|
81
|
+
for (const node of nodes ?? []) {
|
|
82
|
+
if (node.kind === 'file' && node.item)
|
|
83
|
+
entries.push({ item: node.item });
|
|
84
|
+
else
|
|
85
|
+
visit(node.children);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
for (const source of sources)
|
|
89
|
+
visit(source.tree.children);
|
|
90
|
+
// One pool over all sources (nav retirement: the config root is the
|
|
91
|
+
// single source; per-source scoping lost its selector).
|
|
92
|
+
const engine = new FastBm25Engine(entries.map((entry) => navSearchText(entry.item)), { k1: BM25_K1, b: BM25_B });
|
|
93
|
+
return {
|
|
94
|
+
search({ text, limit }) {
|
|
95
|
+
const top = Math.max(0, limit ?? DEFAULT_SEARCH_LIMIT);
|
|
96
|
+
return engine.search(text, top).map(({ index, score }) => {
|
|
97
|
+
const item = entries[index].item;
|
|
98
|
+
return { item, score, snippet: item.description.slice(0, 100) };
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
54
103
|
//# sourceMappingURL=search-engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-engine.js","sourceRoot":"","sources":["../src/search-engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"search-engine.js","sourceRoot":"","sources":["../src/search-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,0EAA0E;AAC1E,sEAAsE;AACtE,wEAAwE;AACxE,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,IAAI,QAAiC,CAAC;AACtC,MAAM,QAAQ,GAAG,GAAgB,EAAE,CAAC,CAAC,QAAQ,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAEhF,sEAAsE;AACtE,mEAAmE;AACnE,2EAA2E;AAC3E,sEAAsE;AACtE,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,MAAM,GAAG,IAAI,CAAC;AA2BpB;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACR,IAAI,CAAc;IAEnC,YAAY,WAAqB,EAAE,OAAO,GAAoB,EAAE;QAC9D,IAAI,CAAC,IAAI;YACP,WAAW,CAAC,MAAM,KAAK,CAAC;gBACtB,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CACd,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAC3C,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAC/B,CAAC;I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CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;;gBACpE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1D,oEAAoE;IACpE,wDAAwD;IACxD,MAAM,MAAM,GAAG,IAAI,cAAc,CAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EACjD,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAC3B,CAAC;IAEF,OAAO;QACL,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;YACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,oBAAoB,CAAC,CAAC;YACvD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;gBACvD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;gBACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;YAClE,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,9 +15,10 @@ export type { DiagnosticAudience, NavItem, NavLocator, NavLocatorKind, NavNode,
|
|
|
15
15
|
* the SDK (routes ported + core additions): scan-root-not-found /
|
|
16
16
|
* scan-root-is-file / scan-root-unsupported / unreadable-directory /
|
|
17
17
|
* unreadable-file / file-limit-reached / count-truncated-at-limit (per-row
|
|
18
|
-
* floor-count disclosure
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* floor-count disclosure) / no-description (core placeholder) /
|
|
19
|
+
* description-carrier-unreadable (folder description carrier — package.json /
|
|
20
|
+
* manifest.yml) / route-rows-truncated
|
|
21
|
+
* (view-level breadth guard) / expand-path-missing
|
|
21
22
|
* (local list) / section-trimmed-to-budget (write-face guard: marker
|
|
22
23
|
* branches collapsed first, then lines trimmed — budget-guard unit; carries
|
|
23
24
|
* face: 'write', so it surfaces only where the write artifact is produced).
|
|
@@ -28,7 +29,7 @@ export type { DiagnosticAudience, NavItem, NavLocator, NavLocatorKind, NavNode,
|
|
|
28
29
|
* count-truncated-at-limit / route-rows-truncated / fragment-over-budget /
|
|
29
30
|
* scan-root-* / candidate-feed-*): travels in consumer payloads as the
|
|
30
31
|
* single signal. 'maintainer' — corpus quality or config someone must fix
|
|
31
|
-
* (no-description / unreadable-* /
|
|
32
|
+
* (no-description / unreadable-* / description-carrier-unreadable /
|
|
32
33
|
* expand-path-missing): maintainer side-channel only (CLI stderr); agent
|
|
33
34
|
* faces stay silent. New codes must pick an audience — the envelope
|
|
34
35
|
* burden account (specs/surface.md adapter obligations).
|
|
@@ -49,7 +50,7 @@ export interface FragmentNode {
|
|
|
49
50
|
description?: string;
|
|
50
51
|
/** Folder only: recursive .md count under it (what expansion would list). */
|
|
51
52
|
below?: number;
|
|
52
|
-
/** Folder only: present when the maxFiles budget cut the descent — `below` is a floor (renders ≥N
|
|
53
|
+
/** Folder only: present when the maxFiles budget cut the descent — `below` is a floor (renders ≥N). */
|
|
53
54
|
countIncomplete?: true;
|
|
54
55
|
/** Folder only: curated children — present iff the folder is a local member. */
|
|
55
56
|
children?: FragmentNode[];
|
|
@@ -102,7 +103,7 @@ export interface SearchHit {
|
|
|
102
103
|
snippet?: string;
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
|
-
* Candidate-feed row
|
|
106
|
+
* Candidate-feed row: one nav node as a word-picker candidate,
|
|
106
107
|
* paths re-rooted onto the query's baseDir. Pure data by contract — the
|
|
107
108
|
* feed crosses plugin seams as a structural mirror, never shared type
|
|
108
109
|
* instances (no classes, functions, Date, Map).
|
|
@@ -114,7 +115,7 @@ export interface NavCandidate {
|
|
|
114
115
|
/** Present when a real description exists; placeholders are omitted. */
|
|
115
116
|
description?: string;
|
|
116
117
|
}
|
|
117
|
-
/** Candidate feed
|
|
118
|
+
/** Candidate feed: the whole curated tree, flattened for matchers. */
|
|
118
119
|
export interface NavCandidateFeed {
|
|
119
120
|
/** Provenance header: source config path + resolved absolute root, config order. */
|
|
120
121
|
sources: {
|
|
@@ -145,18 +146,18 @@ export interface NavSource {
|
|
|
145
146
|
root: string;
|
|
146
147
|
tree: NavNode;
|
|
147
148
|
itemCount: number;
|
|
148
|
-
/** Non-fatal scan warnings (structured
|
|
149
|
+
/** Non-fatal scan warnings (structured). */
|
|
149
150
|
diagnostics: ScanDiagnostic[];
|
|
150
151
|
/**
|
|
151
|
-
* Dir paths whose descent the maxFiles budget cut short (scan-walk
|
|
152
|
-
*
|
|
152
|
+
* Dir paths whose descent the maxFiles budget cut short (scan-walk
|
|
153
|
+
* fact): folder rows under these paths render floor (≥) counts —
|
|
153
154
|
* a lens fact on the source envelope, never on the scan-domain NavNode
|
|
154
155
|
* (decision 2). Absent when no cut happened.
|
|
155
156
|
*/
|
|
156
157
|
countIncompletePaths?: readonly string[];
|
|
157
158
|
}
|
|
158
159
|
/**
|
|
159
|
-
* Routing-view node (
|
|
160
|
+
* Routing-view node (the view projection superset — truncated
|
|
160
161
|
* markers live here, never on the scan-domain NavNode). A node is
|
|
161
162
|
* structural-only when it carries children but no markdown/kind/description:
|
|
162
163
|
* the path leading to real entries; flat output skips it (the index face's
|
|
@@ -176,15 +177,15 @@ export interface RouteViewNode {
|
|
|
176
177
|
* consumers may rely on it as negative evidence: expansion lists exactly
|
|
177
178
|
* N entries, and content the policy excludes never counts.
|
|
178
179
|
*
|
|
179
|
-
* The commitment holds for completed walks only: present
|
|
180
|
-
* count-truncated-at-limit) when the scan.maxFiles budget cut this
|
|
180
|
+
* The commitment holds for completed walks only: present
|
|
181
|
+
* (count-truncated-at-limit) when the scan.maxFiles budget cut this
|
|
181
182
|
* folder's descent — the count is then a floor (rows render ≥N, at least
|
|
182
183
|
* N, possibly more).
|
|
183
184
|
*/
|
|
184
185
|
omittedMarkdownCount?: number;
|
|
185
186
|
/**
|
|
186
187
|
* Present iff this truncated folder sits on the maxFiles cut chain: its
|
|
187
|
-
* omittedMarkdownCount is a floor, not the total (
|
|
188
|
+
* omittedMarkdownCount is a floor, not the total (fact-safe cut).
|
|
188
189
|
* Rides the JSON face verbatim (additive, presence-only).
|
|
189
190
|
*/
|
|
190
191
|
countIncomplete?: true;
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@any-nav/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Any-Nav SDK: read-only core that scans Markdown folders into navigation, decides exposure within a context budget, renders injection fragments, and answers list/search/read. Adapters own all writes, processes, and protocols.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/CatheadOwl/any-nav.git"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"main": "./dist/index.js",
|
|
8
12
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +15,8 @@
|
|
|
11
15
|
"CHANGELOG.md"
|
|
12
16
|
],
|
|
13
17
|
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
18
|
+
"access": "public",
|
|
19
|
+
"provenance": false
|
|
15
20
|
},
|
|
16
21
|
"keywords": [
|
|
17
22
|
"agent",
|
|
@@ -20,7 +25,7 @@
|
|
|
20
25
|
"context"
|
|
21
26
|
],
|
|
22
27
|
"dependencies": {
|
|
23
|
-
"@any-nav/scan": "0.
|
|
28
|
+
"@any-nav/scan": "0.2.0",
|
|
24
29
|
"fast-bm25": "^0.0.6",
|
|
25
30
|
"smol-toml": "^1.9.0"
|
|
26
31
|
},
|
package/dist/bindings.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bindings: passive-push declarations (mode ④).
|
|
3
|
-
*
|
|
4
|
-
* Interface only — the harness extracts paths from prompts and tool
|
|
5
|
-
* calls and calls resolve(); core never triggers. Glob support is a
|
|
6
|
-
* small in-house matcher (** across separators, * and ? within one).
|
|
7
|
-
*/
|
|
8
|
-
import type { NavSource, PushResolution } from './types.ts';
|
|
9
|
-
export declare function globToRegExp(pattern: string): RegExp;
|
|
10
|
-
export declare function resolvePush(sources: NavSource[], path: string): PushResolution;
|
package/dist/bindings.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export function globToRegExp(pattern) {
|
|
2
|
-
const segments = pattern.replace(/\\/g, '/').split('/');
|
|
3
|
-
let source = '';
|
|
4
|
-
for (let i = 0; i < segments.length; i++) {
|
|
5
|
-
const segment = segments[i];
|
|
6
|
-
const isLast = i === segments.length - 1;
|
|
7
|
-
if (segment === '**') {
|
|
8
|
-
// Trailing ** matches any tail; mid-pattern ** matches whole directories.
|
|
9
|
-
source += isLast ? '.*' : '(?:.*/)?';
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
source += segment
|
|
13
|
-
.split('')
|
|
14
|
-
.map((ch) => (ch === '*' ? '[^/]*' : ch === '?' ? '[^/]' : escapeRegExp(ch)))
|
|
15
|
-
.join('');
|
|
16
|
-
if (!isLast)
|
|
17
|
-
source += '/';
|
|
18
|
-
}
|
|
19
|
-
return new RegExp(`^${source}$`);
|
|
20
|
-
}
|
|
21
|
-
export function resolvePush(sources, path) {
|
|
22
|
-
const normalized = path.replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, '');
|
|
23
|
-
const items = [];
|
|
24
|
-
for (const source of sources) {
|
|
25
|
-
for (const binding of source.config.bind ?? []) {
|
|
26
|
-
if (!globToRegExp(binding.match).test(normalized))
|
|
27
|
-
continue;
|
|
28
|
-
for (const itemPath of binding.items) {
|
|
29
|
-
const item = findItem(source.tree, itemPath.replace(/\\/g, '/').replace(/^\.\//, ''));
|
|
30
|
-
if (item !== null)
|
|
31
|
-
items.push(item);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return { matched: items.length > 0, items };
|
|
36
|
-
}
|
|
37
|
-
function findItem(tree, relPath) {
|
|
38
|
-
const segments = relPath.split('/').filter((s) => s !== '');
|
|
39
|
-
let node = tree;
|
|
40
|
-
for (const segment of segments) {
|
|
41
|
-
const next = node.children?.find((c) => c.name === segment || (c.kind === 'file' && `${c.name}.md` === segment.toLowerCase()));
|
|
42
|
-
if (!next)
|
|
43
|
-
return null;
|
|
44
|
-
node = next;
|
|
45
|
-
}
|
|
46
|
-
return node.kind === 'file' ? node.item ?? null : null;
|
|
47
|
-
}
|
|
48
|
-
function escapeRegExp(ch) {
|
|
49
|
-
return /[.*+?^${}()|[\]\\]/.test(ch) ? `\\${ch}` : ch;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=bindings.js.map
|
package/dist/bindings.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,M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AAC;AACxD,CAAC"}
|
package/dist/description.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-line description extraction, ported verbatim from the routes module
|
|
3
|
-
* (dsh-plugin-dev/extras/modules/routes/src/description.ts, ADR-0010:
|
|
4
|
-
* absorption is porting — every boundary handling here is tuition already
|
|
5
|
-
* paid on production corpora; do not "simplify" it).
|
|
6
|
-
*
|
|
7
|
-
* Priority: ① frontmatter `description:`, ② an explicit `description:` line
|
|
8
|
-
* in the document head, ③ the first substantive body line as a fallback.
|
|
9
|
-
* Returns null when none match.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Extracts a one-line route description from Markdown, in priority order:
|
|
13
|
-
* ① frontmatter `description:`, ② an explicit `description:` line in the document
|
|
14
|
-
* head, ③ the first substantive body line as a fallback. Returns `null` when none match.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extractDescription(content: string): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Directory sidecar read (2026-10-07): `_category_.yml/.yaml/.json` carry a
|
|
19
|
-
* folder's description so release-face READMEs stay untouched. YAML reuses
|
|
20
|
-
* the frontmatter ① key reader — the sidecar is frontmatter without the
|
|
21
|
-
* document (an indented `link.description:` therefore reads too, covering
|
|
22
|
-
* Docusaurus-shaped files for free); JSON parses properly and accepts the
|
|
23
|
-
* top-level `description` or the Docusaurus `link.description` shape.
|
|
24
|
-
* `{ description: null }` means the file carries no description key.
|
|
25
|
-
*/
|
|
26
|
-
export type SidecarRead = {
|
|
27
|
-
description: string | null;
|
|
28
|
-
} | {
|
|
29
|
-
error: string;
|
|
30
|
-
};
|
|
31
|
-
export declare function extractSidecarDescription(fileName: string, content: string): SidecarRead;
|
package/dist/description.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-line description extraction, ported verbatim from the routes module
|
|
3
|
-
* (dsh-plugin-dev/extras/modules/routes/src/description.ts, ADR-0010:
|
|
4
|
-
* absorption is porting — every boundary handling here is tuition already
|
|
5
|
-
* paid on production corpora; do not "simplify" it).
|
|
6
|
-
*
|
|
7
|
-
* Priority: ① frontmatter `description:`, ② an explicit `description:` line
|
|
8
|
-
* in the document head, ③ the first substantive body line as a fallback.
|
|
9
|
-
* Returns null when none match.
|
|
10
|
-
*/
|
|
11
|
-
/** Body-line description lookup only trusts the document head, so a `description:` inside a code block or deep in the prose cannot hijack the route. */
|
|
12
|
-
const BODY_HEAD_LINE_LIMIT = 15;
|
|
13
|
-
/** Minimum code-point length for a body line to count as a substantive first sentence (fallback ③). Word count is avoided because CJK text has no space tokenization. */
|
|
14
|
-
const MIN_SUBSTANTIVE_LENGTH = 20;
|
|
15
|
-
/** Approximate cap (code points) for a fallback description; longer lines are cut at the last sentence boundary inside the cap. */
|
|
16
|
-
const MAX_DESCRIPTION_CHARS = 120;
|
|
17
|
-
const SENTENCE_ENDERS = ['.', '。', '!', '!', '?', '?', ';', ';'];
|
|
18
|
-
/** Link or image, tolerating one level of nesting so a badge (`[](href)`) counts as a single token. */
|
|
19
|
-
const LINK_OR_IMAGE = /!?\[(?:[^[\]]|\[[^\]]*\])*\]\([^)]*\)/gu;
|
|
20
|
-
/**
|
|
21
|
-
* Extracts a one-line route description from Markdown, in priority order:
|
|
22
|
-
* ① frontmatter `description:`, ② an explicit `description:` line in the document
|
|
23
|
-
* head, ③ the first substantive body line as a fallback. Returns `null` when none match.
|
|
24
|
-
*/
|
|
25
|
-
export function extractDescription(content) {
|
|
26
|
-
const frontmatter = parseYamlLikeFrontmatter(content);
|
|
27
|
-
const frontmatterDescription = frontmatter
|
|
28
|
-
? readDescriptionKey(frontmatter.split(/\r?\n/u))
|
|
29
|
-
: null;
|
|
30
|
-
if (frontmatterDescription)
|
|
31
|
-
return frontmatterDescription;
|
|
32
|
-
const body = frontmatter ? contentAfterFrontmatter(content) : content;
|
|
33
|
-
const openBodyLines = stripHtmlComments(stripCodeFences(body.split(/\r?\n/u))).slice(0, BODY_HEAD_LINE_LIMIT);
|
|
34
|
-
const bodyDescription = readDescriptionKey(openBodyLines);
|
|
35
|
-
if (bodyDescription)
|
|
36
|
-
return bodyDescription;
|
|
37
|
-
return firstSubstantiveLine(openBodyLines);
|
|
38
|
-
}
|
|
39
|
-
/** Fallback ③: the first body line that is prose (not Markdown structure) and long enough, cleaned of inline Markdown and capped. */
|
|
40
|
-
function firstSubstantiveLine(lines) {
|
|
41
|
-
for (let index = 0; index < lines.length; index++) {
|
|
42
|
-
const line = lines[index];
|
|
43
|
-
if (isStructuralLine(line) || isSetextTitle(lines, index))
|
|
44
|
-
continue;
|
|
45
|
-
const cleaned = cleanInlineMarkdown(line);
|
|
46
|
-
if (codePointLength(cleaned) < MIN_SUBSTANTIVE_LENGTH)
|
|
47
|
-
continue;
|
|
48
|
-
return truncateDescription(cleaned);
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
/** A setext heading's title line sits directly above its `===`/`---` underline; skip the title, not just the underline. */
|
|
53
|
-
function isSetextTitle(lines, index) {
|
|
54
|
-
if (index + 1 >= lines.length)
|
|
55
|
-
return false;
|
|
56
|
-
const trimmed = lines[index + 1].trim();
|
|
57
|
-
return trimmed.length > 0 && /^(={3,}|-{3,})\s*$/u.test(trimmed);
|
|
58
|
-
}
|
|
59
|
-
/** Structural Markdown lines never carry a description; they are skipped before the length test. */
|
|
60
|
-
function isStructuralLine(line) {
|
|
61
|
-
const text = line.trim();
|
|
62
|
-
if (text.length === 0)
|
|
63
|
-
return true;
|
|
64
|
-
if (/^#{1,6}(\s|$)/u.test(text))
|
|
65
|
-
return true; // ATX heading
|
|
66
|
-
if (/^(={3,}|-{3,}|\*{3,}|_{3,})$/u.test(text))
|
|
67
|
-
return true; // setext underline / horizontal rule
|
|
68
|
-
if (/^>/u.test(text))
|
|
69
|
-
return true;
|
|
70
|
-
if (/^[-+*](\s|$)/u.test(text))
|
|
71
|
-
return true; // unordered list
|
|
72
|
-
if (/^\d{1,3}\.\s/u.test(text))
|
|
73
|
-
return true; // ordered list
|
|
74
|
-
// table row / language-switch ("English | [中文]"); inline code spans are
|
|
75
|
-
// masked first — marked-up code is never table structure (ADR-0010 U8)
|
|
76
|
-
const outsideCodeSpans = text.replace(/`[^`]*`/gu, '');
|
|
77
|
-
if (outsideCodeSpans.startsWith('|') || /\s\|\s/u.test(outsideCodeSpans))
|
|
78
|
-
return true;
|
|
79
|
-
if (/^</u.test(text))
|
|
80
|
-
return true;
|
|
81
|
-
if (isLinkOnlyLine(text))
|
|
82
|
-
return true; // badge row / nav chrome
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
/** A line whose visible text is only links/images (badges, nav) carries no prose description. */
|
|
86
|
-
function isLinkOnlyLine(text) {
|
|
87
|
-
return text.length > 0 && text.replace(LINK_OR_IMAGE, '').trim().length === 0;
|
|
88
|
-
}
|
|
89
|
-
/** Light inline-Markdown cleanup so a fallback line reads as plain prose. */
|
|
90
|
-
function cleanInlineMarkdown(line) {
|
|
91
|
-
return line
|
|
92
|
-
.trim()
|
|
93
|
-
.replace(/!\[([^\]]*)\]\([^)]*\)/gu, '$1')
|
|
94
|
-
.replace(/\[([^\]]*)\]\([^)]*\)/gu, '$1')
|
|
95
|
-
.replace(/`([^`]*)`/gu, '$1')
|
|
96
|
-
.replace(/\*\*([^*]+)\*\*/gu, '$1')
|
|
97
|
-
.replace(/__([^_]+)__/gu, '$1')
|
|
98
|
-
.replace(/\s+/g, ' ')
|
|
99
|
-
.replace(/[::]\s*$/u, '')
|
|
100
|
-
.trim();
|
|
101
|
-
}
|
|
102
|
-
/** Cut long fallback text at the last sentence boundary inside the cap; hard-cut (with a trailing `...`) when no boundary is deep enough. */
|
|
103
|
-
function truncateDescription(text) {
|
|
104
|
-
if (codePointLength(text) <= MAX_DESCRIPTION_CHARS)
|
|
105
|
-
return text;
|
|
106
|
-
const head = [...text].slice(0, MAX_DESCRIPTION_CHARS).join('');
|
|
107
|
-
const boundary = lastSentenceBoundary(head);
|
|
108
|
-
if (boundary >= 0) {
|
|
109
|
-
const cut = head.slice(0, boundary + 1).trimEnd();
|
|
110
|
-
if (codePointLength(cut) >= MIN_SUBSTANTIVE_LENGTH)
|
|
111
|
-
return cut;
|
|
112
|
-
}
|
|
113
|
-
return head.trimEnd() + '...';
|
|
114
|
-
}
|
|
115
|
-
/** Last sentence ender inside `text`, skipping abbreviation dots (`ctx.`, `e.g.`). */
|
|
116
|
-
function lastSentenceBoundary(text) {
|
|
117
|
-
for (let index = text.length - 1; index >= 0; index--) {
|
|
118
|
-
const char = text[index];
|
|
119
|
-
if (char === '.') {
|
|
120
|
-
if (isAbbreviationDot(text, index))
|
|
121
|
-
continue;
|
|
122
|
-
return index;
|
|
123
|
-
}
|
|
124
|
-
if (SENTENCE_ENDERS.includes(char))
|
|
125
|
-
return index;
|
|
126
|
-
}
|
|
127
|
-
return -1;
|
|
128
|
-
}
|
|
129
|
-
function isAbbreviationDot(text, index) {
|
|
130
|
-
let letters = 0;
|
|
131
|
-
for (let prev = index - 1; prev >= 0 && prev >= index - 3; prev--) {
|
|
132
|
-
if (/[a-z]/u.test(text[prev]))
|
|
133
|
-
letters++;
|
|
134
|
-
else
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
if (letters === 0)
|
|
138
|
-
return false;
|
|
139
|
-
const next = index + 1 < text.length ? text[index + 1] : '';
|
|
140
|
-
return /[a-z,;):]/u.test(next);
|
|
141
|
-
}
|
|
142
|
-
function codePointLength(text) {
|
|
143
|
-
return [...text].length;
|
|
144
|
-
}
|
|
145
|
-
/** Drops fenced code blocks (```…``` and ~~~…~~~) so tool/program examples cannot leak `description:` matches. */
|
|
146
|
-
function stripCodeFences(lines) {
|
|
147
|
-
const openLines = [];
|
|
148
|
-
let insideFence = false;
|
|
149
|
-
for (const line of lines) {
|
|
150
|
-
if (isFenceLine(line)) {
|
|
151
|
-
insideFence = !insideFence;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (!insideFence)
|
|
155
|
-
openLines.push(line);
|
|
156
|
-
}
|
|
157
|
-
return openLines;
|
|
158
|
-
}
|
|
159
|
-
function isFenceLine(line) {
|
|
160
|
-
return /^\s*(`{3,}|~{3,})/u.test(line);
|
|
161
|
-
}
|
|
162
|
-
/** Drops HTML comments (`<!--`…`-->`, possibly multi-line) so generated/boilerplate comment text cannot become the description. */
|
|
163
|
-
function stripHtmlComments(lines) {
|
|
164
|
-
const openLines = [];
|
|
165
|
-
let insideComment = false;
|
|
166
|
-
for (const line of lines) {
|
|
167
|
-
let rest = line;
|
|
168
|
-
let openPart = '';
|
|
169
|
-
while (rest.length > 0) {
|
|
170
|
-
if (!insideComment) {
|
|
171
|
-
const start = rest.indexOf('<!--');
|
|
172
|
-
if (start === -1) {
|
|
173
|
-
openPart += rest;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
openPart += rest.slice(0, start);
|
|
177
|
-
rest = rest.slice(start + 4);
|
|
178
|
-
insideComment = true;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
const end = rest.indexOf('-->');
|
|
182
|
-
if (end === -1) {
|
|
183
|
-
rest = '';
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
rest = rest.slice(end + 3);
|
|
187
|
-
insideComment = false;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
openLines.push(openPart);
|
|
191
|
-
}
|
|
192
|
-
return openLines;
|
|
193
|
-
}
|
|
194
|
-
export function extractSidecarDescription(fileName, content) {
|
|
195
|
-
if (fileName.toLowerCase().endsWith('.json')) {
|
|
196
|
-
let parsed;
|
|
197
|
-
try {
|
|
198
|
-
parsed = JSON.parse(content);
|
|
199
|
-
}
|
|
200
|
-
catch (err) {
|
|
201
|
-
return { error: `invalid JSON: ${err.message}` };
|
|
202
|
-
}
|
|
203
|
-
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
204
|
-
return { error: 'sidecar JSON must be an object' };
|
|
205
|
-
}
|
|
206
|
-
const obj = parsed;
|
|
207
|
-
const fromKey = (value) => typeof value === 'string' && value.trim() !== '' ? value.trim() : null;
|
|
208
|
-
const top = fromKey(obj.description);
|
|
209
|
-
if (top !== null)
|
|
210
|
-
return { description: top };
|
|
211
|
-
const link = typeof obj.link === 'object' && obj.link !== null && !Array.isArray(obj.link)
|
|
212
|
-
? obj.link
|
|
213
|
-
: undefined;
|
|
214
|
-
const nested = link === undefined ? null : fromKey(link.description);
|
|
215
|
-
return { description: nested };
|
|
216
|
-
}
|
|
217
|
-
return { description: readDescriptionKey(content.split(/\r?\n/u)) };
|
|
218
|
-
}
|
|
219
|
-
function parseYamlLikeFrontmatter(content) {
|
|
220
|
-
const lines = content.split(/\r?\n/u);
|
|
221
|
-
if (lines[0]?.trim() !== '---')
|
|
222
|
-
return null;
|
|
223
|
-
const endIndex = lines.findIndex((line, index) => index > 0 && line.trim() === '---');
|
|
224
|
-
if (endIndex === -1)
|
|
225
|
-
return null;
|
|
226
|
-
return lines.slice(1, endIndex).join('\n');
|
|
227
|
-
}
|
|
228
|
-
function contentAfterFrontmatter(content) {
|
|
229
|
-
const lines = content.split(/\r?\n/u);
|
|
230
|
-
const endIndex = lines.findIndex((line, index) => index > 0 && line.trim() === '---');
|
|
231
|
-
return endIndex === -1 ? content : lines.slice(endIndex + 1).join('\n');
|
|
232
|
-
}
|
|
233
|
-
function readDescriptionKey(lines) {
|
|
234
|
-
for (let index = 0; index < lines.length; index++) {
|
|
235
|
-
const line = lines[index];
|
|
236
|
-
const match = line.match(/^\s*(description|decription)\s*:\s*(.*)$/iu);
|
|
237
|
-
if (!match)
|
|
238
|
-
continue;
|
|
239
|
-
const inline = stripYamlString(match[2].trim());
|
|
240
|
-
if (inline)
|
|
241
|
-
return inline;
|
|
242
|
-
const block = readIndentedBlock(lines, index + 1);
|
|
243
|
-
if (block)
|
|
244
|
-
return block;
|
|
245
|
-
}
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
function readIndentedBlock(lines, start) {
|
|
249
|
-
const collected = [];
|
|
250
|
-
for (let index = start; index < lines.length; index++) {
|
|
251
|
-
const line = lines[index];
|
|
252
|
-
if (line.trim().length === 0) {
|
|
253
|
-
if (collected.length > 0)
|
|
254
|
-
break;
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
if (!/^\s+/.test(line))
|
|
258
|
-
break;
|
|
259
|
-
collected.push(line.trim());
|
|
260
|
-
}
|
|
261
|
-
return collected.length > 0 ? collected.join(' ') : null;
|
|
262
|
-
}
|
|
263
|
-
function stripYamlString(value) {
|
|
264
|
-
const stripped = value
|
|
265
|
-
.replace(/^\|[+-]?$/u, '')
|
|
266
|
-
.replace(/^>[+-]?$/u, '')
|
|
267
|
-
.trim();
|
|
268
|
-
if (!stripped)
|
|
269
|
-
return null;
|
|
270
|
-
const quoted = stripped.match(/^(['"])(.*)\1$/u);
|
|
271
|
-
return (quoted ? quoted[2] : stripped).trim() || null;
|
|
272
|
-
}
|
|
273
|
-
//# sourceMappingURL=description.js.map
|
package/dist/description.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"description.js","sourceRoot":"","sources":["../src/description.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,wJAAwJ;AACxJ,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,yKAAyK;AACzK,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,mIAAmI;AACnI,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,eAAe,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpF,kHAAkH;AAClH,MAAM,aAAa,GAAG,yCAAyC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACt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AAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM;QAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,QAAQ,GAAG,KAAK;SACnB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,IAAI,EAAE,CAAC;IACV,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;AACxD,CAAC"}
|
package/dist/gitignore.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface GitignoreRule {
|
|
2
|
-
baseDir: string;
|
|
3
|
-
pattern: string;
|
|
4
|
-
negated: boolean;
|
|
5
|
-
directoryOnly: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function readInheritedGitignoreRules(root: string, scanRoot: string): Promise<GitignoreRule[]>;
|
|
8
|
-
export declare function readGitignoreRules(dir: string): Promise<GitignoreRule[]>;
|
|
9
|
-
export declare function isGitignored(filePath: string, isDirectory: boolean, rules: readonly GitignoreRule[]): boolean;
|