rvlib-shipkit 2.25.0 → 2.26.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 +13 -0
- package/package.json +2 -2
- package/src/agent-time/hooks.ts +329 -0
- package/src/agent-time/render.ts +14 -2
- package/src/agent-time/report.ts +56 -4
- package/src/agent-time/store.ts +59 -5
- package/src/checks/SK045-slow-hooks.check.ts +47 -0
- package/src/checks/SK046-hook-records.check.ts +76 -0
- package/src/cli/cmd_Backup.ts +3 -1
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Releases.ts +30 -0
- package/src/cli/cmd_Review.ts +23 -4
- package/src/cli/cmd_Time.ts +8 -2
- package/src/cli/registry.ts +2 -1
- package/src/commands/runner.ts +5 -1
- package/src/core/history-files.ts +9 -5
- package/src/core/signal-name.ts +6 -0
- package/src/core/trace-audit.ts +6 -1
- package/src/core/transient.ts +6 -0
- package/src/drill/run.ts +1 -1
- package/src/ledger/gate-checks.ts +23 -2
- package/src/ledger/git-key.ts +3 -3
- package/src/ledger/git-scan.ts +49 -7
- package/src/media-store/backup/daemon.ts +11 -0
- package/src/media-store/backup/sources.ts +1 -4
- package/src/reflect/transcript.ts +21 -3
- package/src/releases/model.ts +18 -0
- package/src/releases/store.ts +13 -1
- package/src/repo-config.ts +11 -1
- package/src/review/inbox-hook.ts +35 -0
- package/src/review/model.ts +12 -6
- package/src/suite/judge-suites.ts +77 -10
- package/src/suite/suite-cli.ts +72 -31
- package/src/wiki/run-wiki.ts +2 -1
- package/src/wiki/scan-md.ts +42 -2
package/src/wiki/scan-md.ts
CHANGED
|
@@ -32,6 +32,32 @@ export type MdScan = {
|
|
|
32
32
|
dangling: MdDanglingRef[]
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/** the anchor a heading answers to, as the forges write it: lower case, its marks dropped, each space a dash */
|
|
36
|
+
const slugOf = (heading: string): string =>
|
|
37
|
+
heading.trim().toLowerCase().replace(/\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/[^\p{L}\p{N}\p{M}_\- ]/gu, '').replace(/ /g, '-')
|
|
38
|
+
|
|
39
|
+
/** an anchor as a link writes it, read the way a heading's slug is */
|
|
40
|
+
export const anchorSlug = (anchor: string): string => {
|
|
41
|
+
try { return decodeURIComponent(anchor).toLowerCase() } catch { return anchor.toLowerCase() }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** every anchor a page's headings answer to; a heading that repeats takes `-1`, `-2` after its slug. Fenced code holds no heading */
|
|
45
|
+
export function headingSlugs(text: string): Set<string> {
|
|
46
|
+
const out = new Set<string>()
|
|
47
|
+
const seen = new Map<string, number>()
|
|
48
|
+
let fenced = false
|
|
49
|
+
for (const line of text.split('\n')) {
|
|
50
|
+
if (line.startsWith('```')) { fenced = !fenced; continue }
|
|
51
|
+
const m = fenced ? null : /^#{1,6}\s+(.*?)\s*#*\s*$/.exec(line)
|
|
52
|
+
if (m == null) continue
|
|
53
|
+
const s = slugOf(m[1]!)
|
|
54
|
+
const n = seen.get(s) ?? 0
|
|
55
|
+
seen.set(s, n + 1)
|
|
56
|
+
out.add(n === 0 ? s : `${s}-${n}`)
|
|
57
|
+
}
|
|
58
|
+
return out
|
|
59
|
+
}
|
|
60
|
+
|
|
35
61
|
export function scanMdGraph(cfg: ScanMdConfig): MdGraph {
|
|
36
62
|
return scanMd(cfg).graph
|
|
37
63
|
}
|
|
@@ -104,6 +130,12 @@ function scanMdNow(cfg: ScanMdConfig): MdScan {
|
|
|
104
130
|
if (!inRoot && inBoundary && existsSync(cand)) return { to: [], onDisk: true }
|
|
105
131
|
return null
|
|
106
132
|
}
|
|
133
|
+
const headings = new Map<string, Set<string>>()
|
|
134
|
+
const headingsOf = (page: string): Set<string> => {
|
|
135
|
+
let h = headings.get(page)
|
|
136
|
+
if (h == null) { h = headingSlugs(readFileSync(join(cfg.root, page), 'utf8')); headings.set(page, h) }
|
|
137
|
+
return h
|
|
138
|
+
}
|
|
107
139
|
const edgesOf = (rel: string): MdEdge[] => {
|
|
108
140
|
const raw = readFileSync(join(cfg.root, rel), 'utf8')
|
|
109
141
|
const body = raw.startsWith('---\n') ? raw.slice(4).replace(/^[\s\S]*?^---\s*$/m, '') : raw
|
|
@@ -122,8 +154,16 @@ function scanMdNow(cfg: ScanMdConfig): MdScan {
|
|
|
122
154
|
}
|
|
123
155
|
for (const m of prose.matchAll(/(?:^|[\s(])@((?:\.{1,2}\/)*[\w][\w./-]*\.md)/gm)) push(m[1]!, true, true, lineOf(m))
|
|
124
156
|
for (const m of prose.matchAll(/→\s*([\w][\w./-]*\.md)\b/g)) push(m[1]!, false, true, lineOf(m))
|
|
125
|
-
// an anchor or a title never changes the page a link reaches
|
|
126
|
-
|
|
157
|
+
// an anchor or a title never changes the page a link reaches; an anchor names a heading of that page, and one
|
|
158
|
+
// the page does not have is a ref of its own that dangles (a heading renamed under its links)
|
|
159
|
+
for (const m of prose.matchAll(/\]\(([^)\s:#]+\.md)?(?:#([^)\s]*))?(?:\s+"[^"]*")?\)/g)) {
|
|
160
|
+
if (m[1] == null && m[2] == null) continue
|
|
161
|
+
if (m[1] != null) push(m[1], false, true, lineOf(m))
|
|
162
|
+
if (m[2] == null || m[2] === '') continue
|
|
163
|
+
const to = m[1] == null ? rel : resolveRef(rel, m[1])?.to
|
|
164
|
+
const page = typeof to === 'string' ? to : to?.length === 1 ? to[0]! : null
|
|
165
|
+
if (page != null && !headingsOf(page).has(anchorSlug(m[2]))) dangling.push({ from: rel, token: `${m[1] ?? ''}#${m[2]}`, line: lineOf(m) })
|
|
166
|
+
}
|
|
127
167
|
for (const m of prose.matchAll(/\]\(([^)\s:]*\/)\)/g)) push(m[1]!, false, true, lineOf(m))
|
|
128
168
|
for (const s of spans) for (const m of s.matchAll(/[\w][\w./-]*\.md/g)) push(m[0], false, false)
|
|
129
169
|
for (const s of spans) for (const m of s.matchAll(/(?:^|\s)([\w.][\w./-]*\/)(?=$|[\s<*])/g)) push(m[1]!, false, false)
|