@longzai-intelligence-issues/ledger 0.0.1
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 +18 -0
- package/README.md +26 -0
- package/dist/index.d.ts +2123 -0
- package/dist/index.js +78 -0
- package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
- package/lzi-builder.config.ts +15 -0
- package/lzi-bun.config.ts +8 -0
- package/oxlint.config.ts +3 -0
- package/package.json +39 -0
- package/src/__tests__/close/verify-close.commands.test.ts +560 -0
- package/src/__tests__/docs-refs/docs-refs.commands.test.ts +213 -0
- package/src/__tests__/fs/mini-glob.utils.test.ts +71 -0
- package/src/__tests__/fs/walk-surface.utils.test.ts +170 -0
- package/src/__tests__/health/health.commands.test.ts +131 -0
- package/src/__tests__/lint/lint.core.test.ts +332 -0
- package/src/__tests__/numbering/numbering.commands.test.ts +194 -0
- package/src/__tests__/numbering/numbering.core.test.ts +318 -0
- package/src/__tests__/parser/guide-fixture.utils.test.ts +45 -0
- package/src/__tests__/parser/registry.parser.test.ts +316 -0
- package/src/__tests__/prompts/prompts.commands.test.ts +47 -0
- package/src/__tests__/template/issue-template.renderer.test.ts +133 -0
- package/src/close/evidence-reader.utils.ts +201 -0
- package/src/close/green-flip.commands.ts +199 -0
- package/src/close/verify-close.commands.ts +676 -0
- package/src/docs-refs/docs-refs.commands.ts +693 -0
- package/src/freeze/freeze.commands.ts +261 -0
- package/src/fs/mini-glob.utils.ts +216 -0
- package/src/fs/walk-surface.utils.ts +298 -0
- package/src/health/health.commands.ts +327 -0
- package/src/index.ts +46 -0
- package/src/lint/lint-baseline.commands.ts +147 -0
- package/src/lint/lint.core.ts +584 -0
- package/src/normalize/normalize-header.commands.ts +361 -0
- package/src/numbering/numbering.commands.ts +375 -0
- package/src/numbering/numbering.core.ts +685 -0
- package/src/parser/format.utils.ts +279 -0
- package/src/parser/guide-fixture.utils.ts +117 -0
- package/src/parser/registry.parser.ts +679 -0
- package/src/prompts/prompts.commands.ts +211 -0
- package/src/template/issue-template.renderer.ts +351 -0
- package/src/triage/triage.classify.ts +93 -0
- package/src/vault/vault.commands.ts +434 -0
- package/tsconfig/.cache/build.tsbuildinfo +1 -0
- package/tsconfig/.cache/node.tsbuildinfo +1 -0
- package/tsconfig/.cache/test.tsbuildinfo +1 -0
- package/tsconfig/app.json +13 -0
- package/tsconfig/build.json +15 -0
- package/tsconfig/node.json +12 -0
- package/tsconfig/test.json +15 -0
- package/tsconfig.json +23 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2123 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import { LintBaselineEntry, LziIssuesConfig } from "@longzai-intelligence-issues/config";
|
|
3
|
+
//#region src/close/evidence-reader.utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 绿证据锚点判读(证据收口缺省模式的判定核)
|
|
6
|
+
*
|
|
7
|
+
* 处置段定位(标题行起至下一 `## ` 或文末,跨内嵌围栏);段内围栏里行整体跳过
|
|
8
|
+
* (判据声明非执行结果),围栏外逐行按优先级归类锚点:certificate > exit-zero >
|
|
9
|
+
* all-green > adjudicated;零锚点拒收。挂起词拦截按状态行全文判定。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 锚点类别
|
|
13
|
+
*/
|
|
14
|
+
type EvidenceAnchorKind = 'certificate' | 'exit-zero' | 'all-green' | 'adjudicated';
|
|
15
|
+
/**
|
|
16
|
+
* 绿证据锚点
|
|
17
|
+
*/
|
|
18
|
+
type EvidenceAnchor = {
|
|
19
|
+
/**
|
|
20
|
+
* 锚点类别
|
|
21
|
+
*/
|
|
22
|
+
kind: EvidenceAnchorKind;
|
|
23
|
+
/**
|
|
24
|
+
* 锚点原文行
|
|
25
|
+
*/
|
|
26
|
+
line: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 证据判读结果
|
|
30
|
+
*/
|
|
31
|
+
type EvidenceReadResult = {
|
|
32
|
+
/**
|
|
33
|
+
* 锚点列表(按判读优先级序)
|
|
34
|
+
*/
|
|
35
|
+
anchors: EvidenceAnchor[];
|
|
36
|
+
/**
|
|
37
|
+
* 处置段文本(定位失败为空串)
|
|
38
|
+
*/
|
|
39
|
+
dispositionText: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 定位处置段文本(跨内嵌围栏)
|
|
43
|
+
*
|
|
44
|
+
* @param raw - 文档全文
|
|
45
|
+
* @returns 处置段文本(含标题行;缺席为空串)
|
|
46
|
+
*/
|
|
47
|
+
declare function locateDispositionText(raw: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* 判读处置段围栏外锚点
|
|
50
|
+
*
|
|
51
|
+
* @param dispositionText - 处置段文本
|
|
52
|
+
* @returns 锚点列表(优先级降序归类,首个命中类别只取一次)
|
|
53
|
+
*/
|
|
54
|
+
declare function readEvidenceAnchors(dispositionText: string): EvidenceAnchor[];
|
|
55
|
+
/**
|
|
56
|
+
* 证据判读组合入口
|
|
57
|
+
*
|
|
58
|
+
* @param raw - 文档全文
|
|
59
|
+
* @returns 判读结果
|
|
60
|
+
*/
|
|
61
|
+
declare function readEvidence(raw: string): EvidenceReadResult;
|
|
62
|
+
/**
|
|
63
|
+
* 挂起词拦截判定(状态行含任一挂起词即拒绝收口——诚实黄灯维持)
|
|
64
|
+
*
|
|
65
|
+
* @param statusLine - 状态行全文
|
|
66
|
+
* @param pendingWords - 挂起词表
|
|
67
|
+
* @returns 命中的挂起词;未命中为 null
|
|
68
|
+
*/
|
|
69
|
+
declare function findPendingWord(statusLine: string, pendingWords: readonly string[]): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* 挂起原因提取(冻结/收口报文引用;复用解析器括注口径)
|
|
72
|
+
*
|
|
73
|
+
* @param statusLine - 状态行全文
|
|
74
|
+
* @returns 挂起原因;无括注为 null
|
|
75
|
+
*/
|
|
76
|
+
declare function readPendingReason(statusLine: string): string | null;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/docs-refs/docs-refs.commands.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* docs 检查入参
|
|
81
|
+
*/
|
|
82
|
+
type DocsCheckInput = {
|
|
83
|
+
/**
|
|
84
|
+
* 仓库根绝对路径
|
|
85
|
+
*/
|
|
86
|
+
root: string;
|
|
87
|
+
/**
|
|
88
|
+
* 解析后配置
|
|
89
|
+
*/
|
|
90
|
+
config: LziIssuesConfig;
|
|
91
|
+
/**
|
|
92
|
+
* 跳过基线豁免(write-baseline 再生口径)
|
|
93
|
+
*/
|
|
94
|
+
ignoreBaseline?: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* docs 修带入参
|
|
98
|
+
*/
|
|
99
|
+
type DocsFixInput = {
|
|
100
|
+
/**
|
|
101
|
+
* 仓库根绝对路径
|
|
102
|
+
*/
|
|
103
|
+
root: string;
|
|
104
|
+
/**
|
|
105
|
+
* 解析后配置
|
|
106
|
+
*/
|
|
107
|
+
config: LziIssuesConfig;
|
|
108
|
+
/**
|
|
109
|
+
* 只呈现不落盘
|
|
110
|
+
*/
|
|
111
|
+
dryRun?: boolean;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* docs 修复结果
|
|
115
|
+
*/
|
|
116
|
+
type DocsFixResult = {
|
|
117
|
+
/**
|
|
118
|
+
* 已修复文件清单
|
|
119
|
+
*/
|
|
120
|
+
fixedFiles: string[];
|
|
121
|
+
/**
|
|
122
|
+
* 拒绝项清单(待人工面,存在即 exit 1 语义)
|
|
123
|
+
*/
|
|
124
|
+
refused: DocRefViolation[];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* docs 基线再生命令入参
|
|
128
|
+
*/
|
|
129
|
+
type DocsBaselineInput = {
|
|
130
|
+
/**
|
|
131
|
+
* 仓库根绝对路径
|
|
132
|
+
*/
|
|
133
|
+
root: string;
|
|
134
|
+
/**
|
|
135
|
+
* 解析后配置
|
|
136
|
+
*/
|
|
137
|
+
config: LziIssuesConfig;
|
|
138
|
+
/**
|
|
139
|
+
* 收编指针
|
|
140
|
+
*/
|
|
141
|
+
issuePointer: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* docs 基线再生结果
|
|
145
|
+
*/
|
|
146
|
+
type DocsBaselineResult = {
|
|
147
|
+
ok: true;
|
|
148
|
+
content: string;
|
|
149
|
+
entryCount: number;
|
|
150
|
+
} | {
|
|
151
|
+
ok: false;
|
|
152
|
+
error: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* docs 引用违例
|
|
156
|
+
*/
|
|
157
|
+
type DocRefViolation = {
|
|
158
|
+
/**
|
|
159
|
+
* 引用所在文件仓库相对 posix 路径
|
|
160
|
+
*/
|
|
161
|
+
file: string;
|
|
162
|
+
/**
|
|
163
|
+
* 行号(1 起)
|
|
164
|
+
*/
|
|
165
|
+
line: number;
|
|
166
|
+
/**
|
|
167
|
+
* 列号(1 起)
|
|
168
|
+
*/
|
|
169
|
+
column: number;
|
|
170
|
+
/**
|
|
171
|
+
* 规则名(doc-ref-unknown / doc-ref-ambiguous / baseline-stale)
|
|
172
|
+
*/
|
|
173
|
+
rule: string;
|
|
174
|
+
/**
|
|
175
|
+
* 违规消息
|
|
176
|
+
*/
|
|
177
|
+
message: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* docs 引用检查结果
|
|
181
|
+
*/
|
|
182
|
+
type DocRefCheckResult = {
|
|
183
|
+
/**
|
|
184
|
+
* 违例列表(active + baseline-stale)
|
|
185
|
+
*/
|
|
186
|
+
violations: DocRefViolation[];
|
|
187
|
+
/**
|
|
188
|
+
* 基线豁免计数
|
|
189
|
+
*/
|
|
190
|
+
suppressed: number;
|
|
191
|
+
/**
|
|
192
|
+
* 扫描文件数
|
|
193
|
+
*/
|
|
194
|
+
scannedFiles: number;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* docs 引用检查
|
|
198
|
+
*
|
|
199
|
+
* @param input - 命令入参
|
|
200
|
+
* @param input.root - 仓库根绝对路径
|
|
201
|
+
* @param input.config - 解析后配置
|
|
202
|
+
* @param input.ignoreBaseline - 跳过基线豁免(write-baseline 再生口径)
|
|
203
|
+
* @returns 检查结果
|
|
204
|
+
* @throws {@link Error} 配置未登记 docs 节
|
|
205
|
+
*/
|
|
206
|
+
declare function runDocsCheck(input: DocsCheckInput): DocRefCheckResult;
|
|
207
|
+
/**
|
|
208
|
+
* docs 引用机械修复(唯一前缀展开为完整 slug)
|
|
209
|
+
*
|
|
210
|
+
* @param input - 命令入参
|
|
211
|
+
* @param input.root - 仓库根绝对路径
|
|
212
|
+
* @param input.config - 解析后配置
|
|
213
|
+
* @param input.dryRun - 只呈现不落盘
|
|
214
|
+
* @returns 修复结果(fixed / refused 清单;存在 refused 即 exit 1 语义)
|
|
215
|
+
* @throws {@link Error} 配置未登记 docs 节
|
|
216
|
+
*/
|
|
217
|
+
declare function runDocsFix(input: DocsFixInput): DocsFixResult;
|
|
218
|
+
/**
|
|
219
|
+
* docs 基线再生命令核(拒绝扩基线)
|
|
220
|
+
*
|
|
221
|
+
* @param input - 命令入参
|
|
222
|
+
* @param input.root - 仓库根绝对路径
|
|
223
|
+
* @param input.config - 解析后配置
|
|
224
|
+
* @param input.issuePointer - 收编指针
|
|
225
|
+
* @returns 再生结果
|
|
226
|
+
* @throws {@link Error} 配置未登记 docs 节
|
|
227
|
+
*/
|
|
228
|
+
declare function runWriteDocsBaseline(input: DocsBaselineInput): DocsBaselineResult;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/prompts/prompts.commands.d.ts
|
|
231
|
+
/**
|
|
232
|
+
* 推荐提示词(内置两模板 + extraDir 自定义加载)
|
|
233
|
+
*
|
|
234
|
+
* apex 两工作流提示词的泛化迁移:watch 域特有内容替换为 config 驱动的 scope
|
|
235
|
+
* 判定与 lzi-issues 命令面。CLI `prompts list / show` 消费;不动 MCP。
|
|
236
|
+
*/
|
|
237
|
+
/**
|
|
238
|
+
* 提示词列举/展示选项
|
|
239
|
+
*/
|
|
240
|
+
type PromptsOptions = {
|
|
241
|
+
/**
|
|
242
|
+
* 是否包含内置模板(默认 true)
|
|
243
|
+
*/
|
|
244
|
+
builtin?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* 自定义模板目录绝对路径
|
|
247
|
+
*/
|
|
248
|
+
extraDir?: string;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* 提示词条目
|
|
252
|
+
*/
|
|
253
|
+
type PromptEntry = {
|
|
254
|
+
/**
|
|
255
|
+
* 提示词 id(kebab-case)
|
|
256
|
+
*/
|
|
257
|
+
id: string;
|
|
258
|
+
/**
|
|
259
|
+
* 一句话描述
|
|
260
|
+
*/
|
|
261
|
+
description: string;
|
|
262
|
+
/**
|
|
263
|
+
* 正文全文(markdown)
|
|
264
|
+
*/
|
|
265
|
+
content: string;
|
|
266
|
+
/**
|
|
267
|
+
* 来源(builtin / extra)
|
|
268
|
+
*/
|
|
269
|
+
source: 'builtin' | 'extra';
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* 列出全部提示词(内置 + extra;builtin 关闭时仅 extra)
|
|
273
|
+
*
|
|
274
|
+
* @param options - 列举选项
|
|
275
|
+
* @param options.builtin - 是否包含内置(默认 true)
|
|
276
|
+
* @param options.extraDir - 自定义模板目录
|
|
277
|
+
* @returns 提示词条目列表(id 去重,extra 覆盖同 id 内置)
|
|
278
|
+
*/
|
|
279
|
+
declare function listPrompts(options: PromptsOptions): PromptEntry[];
|
|
280
|
+
/**
|
|
281
|
+
* 展示单个提示词
|
|
282
|
+
*
|
|
283
|
+
* @param id - 提示词 id
|
|
284
|
+
* @param options - 列举选项(与 listPrompts 一致)
|
|
285
|
+
* @returns 提示词条目;未命中为 null
|
|
286
|
+
*/
|
|
287
|
+
declare function showPrompt(id: string, options: PromptsOptions): PromptEntry | null;
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/close/green-flip.commands.d.ts
|
|
290
|
+
/**
|
|
291
|
+
* 翻绿回填内核(green-flip)
|
|
292
|
+
*
|
|
293
|
+
* 状态行改写保留前缀粗体/冒号原形态(读/写口径统一);处置段回填证据锚点块
|
|
294
|
+
* (两种收口形态标题)。守卫分诊:replace 原样返回且正则仍命中(已绿且概要
|
|
295
|
+
* 逐字一致)→ 幂等零变更;正则零命中 → 抛错拒绝(防「处置段在场而状态行未
|
|
296
|
+
* 翻」假绿)。
|
|
297
|
+
*/
|
|
298
|
+
/**
|
|
299
|
+
* 翻绿入参
|
|
300
|
+
*/
|
|
301
|
+
type GreenFlipInput = {
|
|
302
|
+
/**
|
|
303
|
+
* 文档全文
|
|
304
|
+
*/
|
|
305
|
+
raw: string;
|
|
306
|
+
/**
|
|
307
|
+
* 收口概要(状态行括注与证据块首行)
|
|
308
|
+
*/
|
|
309
|
+
summary: string;
|
|
310
|
+
/**
|
|
311
|
+
* 证据锚点块全文(含标题行;空串表示只翻状态行)
|
|
312
|
+
*/
|
|
313
|
+
evidenceBlock: string;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* 翻绿结果
|
|
317
|
+
*/
|
|
318
|
+
type GreenFlipResult = {
|
|
319
|
+
/**
|
|
320
|
+
* 翻绿产物全文(幂等时与原文一致)
|
|
321
|
+
*/
|
|
322
|
+
content: string;
|
|
323
|
+
/**
|
|
324
|
+
* 幂等标记(原文已为目标形态)
|
|
325
|
+
*/
|
|
326
|
+
idempotent: boolean;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* 执行翻绿回填
|
|
330
|
+
*
|
|
331
|
+
* @param input - 翻绿入参
|
|
332
|
+
* @returns 翻绿结果
|
|
333
|
+
* @throws {@link Error} 状态行零命中(缺状态行的文档不得走翻绿路径)
|
|
334
|
+
*/
|
|
335
|
+
declare function applyGreenFlip(input: GreenFlipInput): GreenFlipResult;
|
|
336
|
+
/**
|
|
337
|
+
* 零执行证据收口证据块渲染
|
|
338
|
+
*
|
|
339
|
+
* @param anchorLines - 锚点原文行列表
|
|
340
|
+
* @param decisionRef - 收口依据(如「docs/decisions/0005」)
|
|
341
|
+
* @returns 证据锚点块全文
|
|
342
|
+
*/
|
|
343
|
+
declare function renderEvidenceCloseBlock(anchorLines: readonly string[], decisionRef: string): string;
|
|
344
|
+
/**
|
|
345
|
+
* 证书化真跑证据块渲染(逐判据证书指纹行)
|
|
346
|
+
*
|
|
347
|
+
* @param summary - 收口概要
|
|
348
|
+
* @param evidenceLines - 逐判据证据行(已含证书指纹与退出码)
|
|
349
|
+
* @param caseRef - 收口先例指针
|
|
350
|
+
* @returns 证据锚点块全文
|
|
351
|
+
*/
|
|
352
|
+
declare function renderRerunEvidenceBlock(summary: string, evidenceLines: readonly string[], caseRef: string): string;
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/vault/vault.commands.d.ts
|
|
355
|
+
/**
|
|
356
|
+
* 证书库(verify vault)
|
|
357
|
+
*
|
|
358
|
+
* 判据指纹 = sha256(git 可见树 + 命令身份)——git 仓取 `git ls-files` 可见面,
|
|
359
|
+
* 非 git 仓回退目录全树;证书按 <channel>/<指纹>.json 落 .lzi/issues/vault/
|
|
360
|
+
* certificates/,同指纹复用秒回;run.lock 防并行互踩(D3:FIFO 队列留增强)。
|
|
361
|
+
*/
|
|
362
|
+
/**
|
|
363
|
+
* 判据(verify-close --criterion 四段)
|
|
364
|
+
*/
|
|
365
|
+
type Criterion = {
|
|
366
|
+
/**
|
|
367
|
+
* 判据标签
|
|
368
|
+
*/
|
|
369
|
+
label: string;
|
|
370
|
+
/**
|
|
371
|
+
* 判据通道(证书库的通道维度)
|
|
372
|
+
*/
|
|
373
|
+
channel: string;
|
|
374
|
+
/**
|
|
375
|
+
* 判据工作目录(相对仓库根)
|
|
376
|
+
*/
|
|
377
|
+
cwd: string;
|
|
378
|
+
/**
|
|
379
|
+
* 判据命令(退出码即判据)
|
|
380
|
+
*/
|
|
381
|
+
command: string;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* 判据证书
|
|
385
|
+
*/
|
|
386
|
+
type CriterionCertificate = {
|
|
387
|
+
/**
|
|
388
|
+
* 内容寻址指纹(64 位 hex)
|
|
389
|
+
*/
|
|
390
|
+
fingerprint: string;
|
|
391
|
+
/**
|
|
392
|
+
* 通道
|
|
393
|
+
*/
|
|
394
|
+
channel: string;
|
|
395
|
+
/**
|
|
396
|
+
* 判据命令
|
|
397
|
+
*/
|
|
398
|
+
command: string;
|
|
399
|
+
/**
|
|
400
|
+
* 工作目录
|
|
401
|
+
*/
|
|
402
|
+
cwd: string;
|
|
403
|
+
/**
|
|
404
|
+
* 退出码
|
|
405
|
+
*/
|
|
406
|
+
exitCode: number;
|
|
407
|
+
/**
|
|
408
|
+
* 输出摘要(首尾各若干行)
|
|
409
|
+
*/
|
|
410
|
+
outputSummary: string[];
|
|
411
|
+
/**
|
|
412
|
+
* 执行时刻(ISO)
|
|
413
|
+
*/
|
|
414
|
+
executedAt: string;
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* 判据执行入参
|
|
418
|
+
*/
|
|
419
|
+
type RunCriterionInput = {
|
|
420
|
+
/**
|
|
421
|
+
* 仓库根绝对路径
|
|
422
|
+
*/
|
|
423
|
+
root: string;
|
|
424
|
+
/**
|
|
425
|
+
* 判据
|
|
426
|
+
*/
|
|
427
|
+
criterion: Criterion;
|
|
428
|
+
/**
|
|
429
|
+
* 预计算指纹(缺省现算)
|
|
430
|
+
*/
|
|
431
|
+
fingerprint?: string;
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* 判据执行结果
|
|
435
|
+
*/
|
|
436
|
+
type CriterionRunResult = {
|
|
437
|
+
/**
|
|
438
|
+
* 是否全绿(退出码 0)
|
|
439
|
+
*/
|
|
440
|
+
green: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* 真实执行 / 复用标记
|
|
443
|
+
*/
|
|
444
|
+
reused: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* 证书(执行失败时也落证书)
|
|
447
|
+
*/
|
|
448
|
+
certificate: CriterionCertificate;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* 计算判据指纹
|
|
452
|
+
*
|
|
453
|
+
* @param root - 仓库根绝对路径
|
|
454
|
+
* @param criterion - 判据
|
|
455
|
+
* @returns 64 位 hex 指纹
|
|
456
|
+
*/
|
|
457
|
+
declare function computeCriterionFingerprint(root: string, criterion: Criterion): string;
|
|
458
|
+
/**
|
|
459
|
+
* 证书路径
|
|
460
|
+
*
|
|
461
|
+
* @param root - 仓库根绝对路径
|
|
462
|
+
* @param channel - 通道
|
|
463
|
+
* @param fingerprint - 指纹
|
|
464
|
+
* @returns 证书文件绝对路径
|
|
465
|
+
*/
|
|
466
|
+
declare function certificatePath(root: string, channel: string, fingerprint: string): string;
|
|
467
|
+
/**
|
|
468
|
+
* 查找在册证书(只读)
|
|
469
|
+
*
|
|
470
|
+
* @param root - 仓库根绝对路径
|
|
471
|
+
* @param channel - 通道
|
|
472
|
+
* @param fingerprint - 指纹
|
|
473
|
+
* @returns 证书;缺席为 null
|
|
474
|
+
*/
|
|
475
|
+
declare function findCertificate(root: string, channel: string, fingerprint: string): CriterionCertificate | null;
|
|
476
|
+
/**
|
|
477
|
+
* 执行判据并落证书(同指纹在册直接复用秒回)
|
|
478
|
+
*
|
|
479
|
+
* @param input - 执行入参
|
|
480
|
+
* @param input.root - 仓库根绝对路径
|
|
481
|
+
* @param input.criterion - 判据
|
|
482
|
+
* @param input.fingerprint - 预计算指纹(缺省现算)
|
|
483
|
+
* @returns 执行结果
|
|
484
|
+
*/
|
|
485
|
+
declare function runCriterionViaVault(input: RunCriterionInput): CriterionRunResult;
|
|
486
|
+
/**
|
|
487
|
+
* 运行锁句柄
|
|
488
|
+
*/
|
|
489
|
+
type RunLockHandle = {
|
|
490
|
+
/**
|
|
491
|
+
* 释放锁(仅释放本进程写入的锁)
|
|
492
|
+
*/
|
|
493
|
+
unlock: () => void;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* 运行锁(防并行真跑互踩;进程退出自动释放)
|
|
497
|
+
*
|
|
498
|
+
* @param root - 仓库根绝对路径
|
|
499
|
+
* @returns 锁句柄(unlock 释放;持锁失败抛错)
|
|
500
|
+
* @throws {@link Error} 已有并行真跑持锁
|
|
501
|
+
*/
|
|
502
|
+
declare function acquireRunLock(root: string): RunLockHandle;
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/close/verify-close.commands.d.ts
|
|
505
|
+
/**
|
|
506
|
+
* 证据收口入参
|
|
507
|
+
*/
|
|
508
|
+
type EvidenceCloseInput = {
|
|
509
|
+
/**
|
|
510
|
+
* 仓库根绝对路径
|
|
511
|
+
*/
|
|
512
|
+
root: string;
|
|
513
|
+
/**
|
|
514
|
+
* 解析后配置
|
|
515
|
+
*/
|
|
516
|
+
config: LziIssuesConfig;
|
|
517
|
+
/**
|
|
518
|
+
* issue 文件仓库相对路径列表
|
|
519
|
+
*/
|
|
520
|
+
files: readonly string[];
|
|
521
|
+
/**
|
|
522
|
+
* 显式概要(批量禁用)
|
|
523
|
+
*/
|
|
524
|
+
summaryOverride?: string;
|
|
525
|
+
/**
|
|
526
|
+
* 只呈现不落盘
|
|
527
|
+
*/
|
|
528
|
+
dryRun?: boolean;
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* 单案收口结果
|
|
532
|
+
*/
|
|
533
|
+
type CloseCaseResult = {
|
|
534
|
+
/**
|
|
535
|
+
* issue 文件仓库相对路径
|
|
536
|
+
*/
|
|
537
|
+
file: string;
|
|
538
|
+
/**
|
|
539
|
+
* 是否翻绿成功
|
|
540
|
+
*/
|
|
541
|
+
ok: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* 结果说明(失败原因 / 概要)
|
|
544
|
+
*/
|
|
545
|
+
message: string;
|
|
546
|
+
/**
|
|
547
|
+
* 幂等标记(已绿且概要一致零变更)
|
|
548
|
+
*/
|
|
549
|
+
idempotent: boolean;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* 批次收口结果
|
|
553
|
+
*/
|
|
554
|
+
type CloseBatchResult = {
|
|
555
|
+
/**
|
|
556
|
+
* 逐案结果
|
|
557
|
+
*/
|
|
558
|
+
cases: CloseCaseResult[];
|
|
559
|
+
/**
|
|
560
|
+
* 成功案数
|
|
561
|
+
*/
|
|
562
|
+
succeeded: number;
|
|
563
|
+
/**
|
|
564
|
+
* 门禁拦截标记(exit 2 语义;真跑模式未过两级门禁时为真,零执行)
|
|
565
|
+
*/
|
|
566
|
+
gateBlocked: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* 门禁拦截说明
|
|
569
|
+
*/
|
|
570
|
+
gateMessage: string;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* 证据收口批(缺省模式,零执行)
|
|
574
|
+
*
|
|
575
|
+
* @param input - 命令入参
|
|
576
|
+
* @param input.root - 仓库根绝对路径
|
|
577
|
+
* @param input.config - 解析后配置
|
|
578
|
+
* @param input.files - issue 文件仓库相对路径列表
|
|
579
|
+
* @param input.summaryOverride - 显式概要(批量禁用)
|
|
580
|
+
* @param input.dryRun - 只呈现不落盘
|
|
581
|
+
* @returns 批次结果
|
|
582
|
+
*/
|
|
583
|
+
declare function evidenceCloseFlow(input: EvidenceCloseInput): CloseBatchResult;
|
|
584
|
+
/**
|
|
585
|
+
* 两级门禁判定结果
|
|
586
|
+
*/
|
|
587
|
+
type CloseGateResult = {
|
|
588
|
+
/**
|
|
589
|
+
* 是否拦截
|
|
590
|
+
*/
|
|
591
|
+
blocked: boolean;
|
|
592
|
+
/**
|
|
593
|
+
* 拦截级(full 禁用级 / heavy 确认级 / none 通过)
|
|
594
|
+
*/
|
|
595
|
+
kind: 'full' | 'heavy' | 'none';
|
|
596
|
+
/**
|
|
597
|
+
* 拦截说明
|
|
598
|
+
*/
|
|
599
|
+
message: string;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* 真跑两级门禁判定
|
|
603
|
+
*
|
|
604
|
+
* @param config - 解析后配置
|
|
605
|
+
* @param criteria - 判据列表
|
|
606
|
+
* @param allowFullCriterion - --allow-full-criterion 豁免
|
|
607
|
+
* @param confirmHeavy - --confirm-heavy 确认
|
|
608
|
+
* @returns 拦截结果(blocked=false 通过)
|
|
609
|
+
*/
|
|
610
|
+
declare function resolveCloseGates(config: LziIssuesConfig, criteria: readonly Criterion[], allowFullCriterion: boolean, confirmHeavy: boolean): CloseGateResult;
|
|
611
|
+
/**
|
|
612
|
+
* 证书化真跑入参
|
|
613
|
+
*/
|
|
614
|
+
type RerunCloseInput = {
|
|
615
|
+
/**
|
|
616
|
+
* 仓库根绝对路径
|
|
617
|
+
*/
|
|
618
|
+
root: string;
|
|
619
|
+
/**
|
|
620
|
+
* 解析后配置
|
|
621
|
+
*/
|
|
622
|
+
config: LziIssuesConfig;
|
|
623
|
+
/**
|
|
624
|
+
* issue 文件仓库相对路径列表
|
|
625
|
+
*/
|
|
626
|
+
files: readonly string[];
|
|
627
|
+
/**
|
|
628
|
+
* 显式判据(四段字符串列表,公共判据垫后)
|
|
629
|
+
*/
|
|
630
|
+
explicitCriteria?: readonly string[];
|
|
631
|
+
/**
|
|
632
|
+
* 从各案 criteria 块取判据
|
|
633
|
+
*/
|
|
634
|
+
criteriaFromIssue?: boolean;
|
|
635
|
+
/**
|
|
636
|
+
* 显式概要(批量禁用)
|
|
637
|
+
*/
|
|
638
|
+
summaryOverride?: string;
|
|
639
|
+
/**
|
|
640
|
+
* 只呈现不执行不落盘
|
|
641
|
+
*/
|
|
642
|
+
dryRun?: boolean;
|
|
643
|
+
/**
|
|
644
|
+
* 全量判据豁免(须留痕)
|
|
645
|
+
*/
|
|
646
|
+
allowFullCriterion?: boolean;
|
|
647
|
+
/**
|
|
648
|
+
* 重度命令确认(仅人类明令)
|
|
649
|
+
*/
|
|
650
|
+
confirmHeavy?: boolean;
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* 证书化真跑批(--rerun)
|
|
654
|
+
*
|
|
655
|
+
* @param input - 命令入参
|
|
656
|
+
* @param input.root - 仓库根绝对路径
|
|
657
|
+
* @param input.config - 解析后配置
|
|
658
|
+
* @param input.files - issue 文件仓库相对路径列表
|
|
659
|
+
* @param input.explicitCriteria - 显式判据(四段字符串列表,公共判据垫后)
|
|
660
|
+
* @param input.criteriaFromIssue - 从各案 criteria 块取判据
|
|
661
|
+
* @param input.summaryOverride - 显式概要(批量禁用)
|
|
662
|
+
* @param input.dryRun - 只呈现不执行不落盘(门禁拦截外的干跑)
|
|
663
|
+
* @param input.allowFullCriterion - 全量豁免
|
|
664
|
+
* @param input.confirmHeavy - 重度确认
|
|
665
|
+
* @returns 批次结果(gateBlocked=true 时零执行,exit 2 语义)
|
|
666
|
+
*/
|
|
667
|
+
declare function rerunCloseFlow(input: RerunCloseInput): CloseBatchResult;
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/fs/mini-glob.utils.d.ts
|
|
670
|
+
/**
|
|
671
|
+
* 自研 mini-glob 编译器(零第三方依赖)
|
|
672
|
+
*
|
|
673
|
+
* 语义(apex numbering-guard 同款):单星→段内任意;双星后随分隔→任意层级
|
|
674
|
+
* 目录;双星非后随分隔→任意字符;`?`→段内单字符;`{a,b}`→段内多选一(候选
|
|
675
|
+
* 项可含通配);字符类 `[` 与裸大括号显式抛错(不静默误配);整串锚定匹配。
|
|
676
|
+
*/
|
|
677
|
+
/**
|
|
678
|
+
* mini-glob 编译错误
|
|
679
|
+
*/
|
|
680
|
+
declare class MiniGlobError extends Error {
|
|
681
|
+
/**
|
|
682
|
+
* 构造编译错误
|
|
683
|
+
*
|
|
684
|
+
* @param pattern - 涉事 glob 模式
|
|
685
|
+
* @param reason - 违规原因
|
|
686
|
+
*/
|
|
687
|
+
constructor(pattern: string, reason: string);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* 编译 glob 模式为整串锚定正则
|
|
691
|
+
*
|
|
692
|
+
* @param pattern - glob 模式
|
|
693
|
+
* @returns 整串 `^…$` 正则
|
|
694
|
+
* @throws {@link MiniGlobError} 模式含不支持语法
|
|
695
|
+
*/
|
|
696
|
+
declare function compileMiniGlob(pattern: string): RegExp;
|
|
697
|
+
/**
|
|
698
|
+
* 判定候选路径是否命中 glob
|
|
699
|
+
*
|
|
700
|
+
* @param pattern - glob 模式
|
|
701
|
+
* @param candidate - 候选 posix 相对路径
|
|
702
|
+
* @returns 是否命中
|
|
703
|
+
* @throws {@link MiniGlobError} 模式含不支持语法
|
|
704
|
+
*/
|
|
705
|
+
declare function matchMiniGlob(pattern: string, candidate: string): boolean;
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/fs/walk-surface.utils.d.ts
|
|
708
|
+
/**
|
|
709
|
+
* 扫描面分层遍历基座
|
|
710
|
+
*
|
|
711
|
+
* include glob 反推最小目录前缀集(截断=保守超集,glob 可匹配路径必落某推导
|
|
712
|
+
* 前缀下);前缀遍历宽容(缺前缀静默跳过=未来目录合法),全仓遍历严格(缺根
|
|
713
|
+
* 抛错防扫描面缩水)。剪枝:.git 恒跳过 / 排除 glob 整树剪枝 / 符号链接跳过;
|
|
714
|
+
* 文件名级零内容读取、零子进程、零网络;输出 posix 相对路径升序。
|
|
715
|
+
*
|
|
716
|
+
* 前缀约定:无尾斜杠的 posix 相对目录路径,'' 表示全仓根。
|
|
717
|
+
*/
|
|
718
|
+
/**
|
|
719
|
+
* 遍历选项
|
|
720
|
+
*/
|
|
721
|
+
type WalkOptions = {
|
|
722
|
+
/**
|
|
723
|
+
* 排除 glob 列表(目录命中即整树剪枝,按原相对路径 / 尾斜杠 / 子树三口径测试)
|
|
724
|
+
*/
|
|
725
|
+
excludeGlobs?: readonly string[];
|
|
726
|
+
};
|
|
727
|
+
/**
|
|
728
|
+
* include glob 反推最小目录前缀集
|
|
729
|
+
*
|
|
730
|
+
* 末段恒为文件名模式不参与推导;字面段续推、通配段截断(截断=更短前缀=
|
|
731
|
+
* 覆盖超集)、`{a,b}` 分叉(候选项含通配即截断该分支);任一模式贡献空前缀
|
|
732
|
+
* 则全仓标记('')。候选去重后按包含关系裁剪(宽前缀吞并其下窄前缀)。
|
|
733
|
+
* 空模式集产出空前缀集(无扫描面)。
|
|
734
|
+
*
|
|
735
|
+
* @param includeGlobs - include glob 列表
|
|
736
|
+
* @returns 最小目录前缀集(无尾斜杠 posix 相对路径,'' 表示全仓)
|
|
737
|
+
*/
|
|
738
|
+
declare function deriveWalkPrefixes(includeGlobs: readonly string[]): string[];
|
|
739
|
+
/**
|
|
740
|
+
* 前缀定向遍历(宽容:前缀目录缺失静默跳过——scope 登记未来目录属合法现状)
|
|
741
|
+
*
|
|
742
|
+
* @param root - 遍历根绝对路径
|
|
743
|
+
* @param prefixes - deriveWalkPrefixes 产物('' 表示全仓)
|
|
744
|
+
* @param options - 遍历选项(排除 glob)
|
|
745
|
+
* @returns 命中文件相对路径列表(posix 升序)
|
|
746
|
+
*/
|
|
747
|
+
declare function walkFilesUnderPrefixes(root: string, prefixes: readonly string[], options?: WalkOptions): string[];
|
|
748
|
+
/**
|
|
749
|
+
* 全仓严格遍历(缺根抛错,audit 防缩水口径)
|
|
750
|
+
*
|
|
751
|
+
* @param root - 遍历根绝对路径
|
|
752
|
+
* @param options - 遍历选项(排除 glob)
|
|
753
|
+
* @returns 命中文件相对路径列表(posix 升序)
|
|
754
|
+
* @throws {@link Error} 根目录缺失
|
|
755
|
+
*/
|
|
756
|
+
declare function walkFilesUnderRoots(root: string, options?: WalkOptions): string[];
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/freeze/freeze.commands.d.ts
|
|
759
|
+
/**
|
|
760
|
+
* freeze / unfreeze(裁定语硬门)
|
|
761
|
+
*
|
|
762
|
+
* 冻结/解冻均属人类裁定事项:--reason/--note 必须含「用户裁定」,工具拒绝形式
|
|
763
|
+
* 冻结/解冻;状态行含 `|`(复合元信息行)拒绝整行破坏性替换;幂等(重复
|
|
764
|
+
* freeze 更新理由);解冻仅对已冻结案生效,恢复 🔴。
|
|
765
|
+
*/
|
|
766
|
+
/**
|
|
767
|
+
* 裁定语硬门关键词
|
|
768
|
+
*/
|
|
769
|
+
declare const ADJUDICATION_KEYWORD = "用户裁定";
|
|
770
|
+
/**
|
|
771
|
+
* freeze 命令入参
|
|
772
|
+
*/
|
|
773
|
+
type FreezeIssueInput = {
|
|
774
|
+
/**
|
|
775
|
+
* 仓库根绝对路径
|
|
776
|
+
*/
|
|
777
|
+
root: string;
|
|
778
|
+
/**
|
|
779
|
+
* issue 文件仓库相对路径
|
|
780
|
+
*/
|
|
781
|
+
file: string;
|
|
782
|
+
/**
|
|
783
|
+
* 裁定理由(须含「用户裁定」)
|
|
784
|
+
*/
|
|
785
|
+
reason: string;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* unfreeze 命令入参
|
|
789
|
+
*/
|
|
790
|
+
type UnfreezeIssueInput = {
|
|
791
|
+
/**
|
|
792
|
+
* 仓库根绝对路径
|
|
793
|
+
*/
|
|
794
|
+
root: string;
|
|
795
|
+
/**
|
|
796
|
+
* issue 文件仓库相对路径
|
|
797
|
+
*/
|
|
798
|
+
file: string;
|
|
799
|
+
/**
|
|
800
|
+
* 解冻注记(须含「用户裁定」)
|
|
801
|
+
*/
|
|
802
|
+
note: string;
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* freeze / unfreeze 结果
|
|
806
|
+
*/
|
|
807
|
+
type FreezeResult = {
|
|
808
|
+
/**
|
|
809
|
+
* 操作成功标记
|
|
810
|
+
*/
|
|
811
|
+
ok: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* 结果说明
|
|
814
|
+
*/
|
|
815
|
+
message: string;
|
|
816
|
+
/**
|
|
817
|
+
* 幂等标记
|
|
818
|
+
*/
|
|
819
|
+
idempotent: boolean;
|
|
820
|
+
};
|
|
821
|
+
/**
|
|
822
|
+
* 执行冻结(幂等:重复调用更新理由)
|
|
823
|
+
*
|
|
824
|
+
* @param input - 命令入参
|
|
825
|
+
* @param input.root - 仓库根绝对路径
|
|
826
|
+
* @param input.file - issue 文件仓库相对路径
|
|
827
|
+
* @param input.reason - 裁定理由(须含「用户裁定」)
|
|
828
|
+
* @returns 操作结果
|
|
829
|
+
*/
|
|
830
|
+
declare function freezeIssue(input: FreezeIssueInput): FreezeResult;
|
|
831
|
+
/**
|
|
832
|
+
* 执行解冻(仅对已冻结案生效)
|
|
833
|
+
*
|
|
834
|
+
* @param input - 命令入参
|
|
835
|
+
* @param input.root - 仓库根绝对路径
|
|
836
|
+
* @param input.file - issue 文件仓库相对路径
|
|
837
|
+
* @param input.note - 解冻注记(须含「用户裁定」)
|
|
838
|
+
* @returns 操作结果
|
|
839
|
+
*/
|
|
840
|
+
declare function unfreezeIssue(input: UnfreezeIssueInput): FreezeResult;
|
|
841
|
+
//#endregion
|
|
842
|
+
//#region src/health/health.commands.d.ts
|
|
843
|
+
/**
|
|
844
|
+
* 巡检报告
|
|
845
|
+
*/
|
|
846
|
+
type HealthReport = {
|
|
847
|
+
/**
|
|
848
|
+
* 状态分布(状态归类 → 计数)
|
|
849
|
+
*/
|
|
850
|
+
statusCounts: Record<string, number>;
|
|
851
|
+
/**
|
|
852
|
+
* 黄灯总数(含旧格式 legacy-yellow)
|
|
853
|
+
*/
|
|
854
|
+
yellowTotal: number;
|
|
855
|
+
/**
|
|
856
|
+
* 最老黄灯账龄(天,mtime 口径向下取整;无黄灯为 0)
|
|
857
|
+
*/
|
|
858
|
+
oldestYellowAgeDays: number;
|
|
859
|
+
/**
|
|
860
|
+
* A-B-C 分类分布
|
|
861
|
+
*/
|
|
862
|
+
categoryCounts: Record<string, number>;
|
|
863
|
+
};
|
|
864
|
+
/**
|
|
865
|
+
* 分诊台账条目
|
|
866
|
+
*/
|
|
867
|
+
type TriageItem = {
|
|
868
|
+
/**
|
|
869
|
+
* issue 编号
|
|
870
|
+
*/
|
|
871
|
+
id: string;
|
|
872
|
+
/**
|
|
873
|
+
* issue 文件仓库相对路径
|
|
874
|
+
*/
|
|
875
|
+
file: string;
|
|
876
|
+
/**
|
|
877
|
+
* 状态归类
|
|
878
|
+
*/
|
|
879
|
+
status: string;
|
|
880
|
+
/**
|
|
881
|
+
* 分类(A/B/C)
|
|
882
|
+
*/
|
|
883
|
+
category: 'A' | 'B' | 'C';
|
|
884
|
+
/**
|
|
885
|
+
* 分类依据(中文说明)
|
|
886
|
+
*/
|
|
887
|
+
reason: string;
|
|
888
|
+
/**
|
|
889
|
+
* 判据命令列表(空表示待补录)
|
|
890
|
+
*/
|
|
891
|
+
criteriaCommands: string[];
|
|
892
|
+
};
|
|
893
|
+
/**
|
|
894
|
+
* 分诊台账文件结构
|
|
895
|
+
*/
|
|
896
|
+
type TriageLedgerFile = {
|
|
897
|
+
/**
|
|
898
|
+
* 生成时刻(毫秒)
|
|
899
|
+
*/
|
|
900
|
+
generatedAtMs: number;
|
|
901
|
+
/**
|
|
902
|
+
* 参与扫描的注册表目录
|
|
903
|
+
*/
|
|
904
|
+
registryDirs: string[];
|
|
905
|
+
/**
|
|
906
|
+
* 台账条目(黄灯)
|
|
907
|
+
*/
|
|
908
|
+
items: TriageItem[];
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* 黄灯巡检命令入参
|
|
912
|
+
*/
|
|
913
|
+
type RunHealthInput = {
|
|
914
|
+
/**
|
|
915
|
+
* 仓库根绝对路径
|
|
916
|
+
*/
|
|
917
|
+
root: string;
|
|
918
|
+
/**
|
|
919
|
+
* 解析后配置
|
|
920
|
+
*/
|
|
921
|
+
config: LziIssuesConfig;
|
|
922
|
+
/**
|
|
923
|
+
* 限定注册表目录(缺省全部)
|
|
924
|
+
*/
|
|
925
|
+
dirRels?: readonly string[];
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* 黄灯巡检
|
|
929
|
+
*
|
|
930
|
+
* @param input - 命令入参
|
|
931
|
+
* @returns 巡检报告
|
|
932
|
+
*/
|
|
933
|
+
declare function runHealth(input: RunHealthInput): HealthReport;
|
|
934
|
+
/**
|
|
935
|
+
* 分诊命令入参
|
|
936
|
+
*/
|
|
937
|
+
type RunTriageInput = {
|
|
938
|
+
/**
|
|
939
|
+
* 仓库根绝对路径
|
|
940
|
+
*/
|
|
941
|
+
root: string;
|
|
942
|
+
/**
|
|
943
|
+
* 解析后配置
|
|
944
|
+
*/
|
|
945
|
+
config: LziIssuesConfig;
|
|
946
|
+
/**
|
|
947
|
+
* 台账输出目录覆盖(缺省 <root>/.lzi/issues/runs/ledger)
|
|
948
|
+
*/
|
|
949
|
+
outDir?: string;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* 分诊命令结果
|
|
953
|
+
*/
|
|
954
|
+
type RunTriageResult = {
|
|
955
|
+
/**
|
|
956
|
+
* 台账绝对路径
|
|
957
|
+
*/
|
|
958
|
+
ledgerPath: string;
|
|
959
|
+
/**
|
|
960
|
+
* 台账对象
|
|
961
|
+
*/
|
|
962
|
+
ledger: TriageLedgerFile;
|
|
963
|
+
};
|
|
964
|
+
/**
|
|
965
|
+
* 分诊台账落盘(append-only:triage-<时刻>.json 不覆盖历史)
|
|
966
|
+
*
|
|
967
|
+
* @param input - 命令入参
|
|
968
|
+
* @returns 台账绝对路径与台账对象
|
|
969
|
+
*/
|
|
970
|
+
declare function runTriage(input: RunTriageInput): RunTriageResult;
|
|
971
|
+
//#endregion
|
|
972
|
+
//#region src/parser/format.utils.d.ts
|
|
973
|
+
/**
|
|
974
|
+
* issue 注册表格式单一真源
|
|
975
|
+
*
|
|
976
|
+
* 全部格式口径(文件名、状态行、处置段、criteria 围栏块、引用形态)的常量与判定
|
|
977
|
+
* 函数集中于此模块。读侧(解析器 / lint / 收口)与写侧(模板渲染 / 翻绿回填 / 冻结
|
|
978
|
+
* 写入)共用同一真源,杜绝两套口径漂移——该纪律经 apex-energy-turbo
|
|
979
|
+
* issue-verify-ledger 长期验证有效后迁移(其 registry.parser.ts 同构实现)。
|
|
980
|
+
*/
|
|
981
|
+
/**
|
|
982
|
+
* 注册表文件收集口径
|
|
983
|
+
*
|
|
984
|
+
* 3-4 位零填充数字前缀 + `-` + slug + `.md`;README 等不匹配文件天然不收编。
|
|
985
|
+
*/
|
|
986
|
+
declare const REGISTRY_FILE_PATTERN: RegExp;
|
|
987
|
+
/**
|
|
988
|
+
* slug 合法字符集(单一真源):仅 ASCII kebab——小写字母、数字、连字符,
|
|
989
|
+
* 禁中文与任何非 ASCII 字符(与契约层 SlugVO 口径一致)。
|
|
990
|
+
*/
|
|
991
|
+
declare const ASCII_KEBAB_SLUG_PATTERN: RegExp;
|
|
992
|
+
/**
|
|
993
|
+
* 状态行前缀正则源(读写共用单一真源)
|
|
994
|
+
*
|
|
995
|
+
* 「状态」+ 可选 0-2 个粗体星号 + 可选空白 + 全/半角冒号。以源字符串形态导出,
|
|
996
|
+
* 写侧改写正则由本源动态构造,保证读/写口径永不分裂。
|
|
997
|
+
*/
|
|
998
|
+
declare const STATUS_LINE_PREFIX_SOURCE = "状态\\*{0,2}\\s*[::]";
|
|
999
|
+
/**
|
|
1000
|
+
* 状态行定位正则(读侧使用,由前缀源构造)
|
|
1001
|
+
*/
|
|
1002
|
+
declare const STATUS_LINE_LOCATE_PATTERN: RegExp;
|
|
1003
|
+
/**
|
|
1004
|
+
* 状态行定位扫描窗口(头部前 N 行)
|
|
1005
|
+
*/
|
|
1006
|
+
declare const STATUS_LINE_SCAN_LINES = 30;
|
|
1007
|
+
/**
|
|
1008
|
+
* 挂起原因括注提取模式:全/半角括号内至少 4 字符
|
|
1009
|
+
*/
|
|
1010
|
+
declare const PENDING_REASON_PATTERN: RegExp;
|
|
1011
|
+
/**
|
|
1012
|
+
* 处置段标题关键词
|
|
1013
|
+
*
|
|
1014
|
+
* `## ` 标题行包含本关键词即认定为处置段。
|
|
1015
|
+
*/
|
|
1016
|
+
declare const DISPOSITION_TITLE_KEYWORD = "处置结果";
|
|
1017
|
+
/**
|
|
1018
|
+
* 处置段占位判定模式(读写共用单一真源)
|
|
1019
|
+
*
|
|
1020
|
+
* 「处置中 / 待回填」后须紧跟右括号 / 标点 / 破折号 / 行尾才计占位——占位是终态
|
|
1021
|
+
* 标签,正文状语(如「处置中新核实的…」后为继续字符)不计。
|
|
1022
|
+
*/
|
|
1023
|
+
declare const DISPOSITION_PLACEHOLDER_PATTERN: RegExp;
|
|
1024
|
+
/**
|
|
1025
|
+
* 处置段占位判定窗口(处置段标题起 N 行)
|
|
1026
|
+
*/
|
|
1027
|
+
declare const DISPOSITION_PLACEHOLDER_WINDOW_LINES = 8;
|
|
1028
|
+
/**
|
|
1029
|
+
* 证据锚点块在位判定标记
|
|
1030
|
+
*
|
|
1031
|
+
* 两种收口形态的回填标题前缀:零执行证据收口 / 证书化真跑收口。
|
|
1032
|
+
*/
|
|
1033
|
+
declare const EVIDENCE_ANCHOR_MARKERS: readonly ['证据锚点(末次通过零执行收口', '判据执行证据('];
|
|
1034
|
+
/**
|
|
1035
|
+
* criteria 围栏块开栏行模式
|
|
1036
|
+
*/
|
|
1037
|
+
declare const CRITERIA_FENCE_OPEN_PATTERN: RegExp;
|
|
1038
|
+
/**
|
|
1039
|
+
* criteria 围栏块闭栏行模式
|
|
1040
|
+
*/
|
|
1041
|
+
declare const CRITERIA_FENCE_CLOSE_PATTERN: RegExp;
|
|
1042
|
+
/**
|
|
1043
|
+
* criteria 判据行 channel 段合法形态(字母数字起首,限字母数字与 . _ -)
|
|
1044
|
+
*/
|
|
1045
|
+
declare const CRITERIA_CHANNEL_PATTERN: RegExp;
|
|
1046
|
+
/**
|
|
1047
|
+
* 元信息行「沿革」键:前序 issue 引用载体
|
|
1048
|
+
*/
|
|
1049
|
+
declare const HISTORY_LINE_KEY = "沿革";
|
|
1050
|
+
/**
|
|
1051
|
+
* 元信息行「阻塞」键:阻塞关系引用载体(全部 🟢 后方可收口)
|
|
1052
|
+
*/
|
|
1053
|
+
declare const BLOCKING_LINE_KEY = "阻塞";
|
|
1054
|
+
/**
|
|
1055
|
+
* 元信息行键定位前缀源
|
|
1056
|
+
*
|
|
1057
|
+
* 粗体标签(`**沿革**:`)与裸键(`沿革:`)两形态通吃;冒号全/半角均可。
|
|
1058
|
+
*/
|
|
1059
|
+
declare const META_LINE_PREFIX_SOURCE_TEMPLATE = "\\*{0,2}%s\\*{0,2}\\s*[::]";
|
|
1060
|
+
/**
|
|
1061
|
+
* issue 状态归类
|
|
1062
|
+
*
|
|
1063
|
+
* 规范五态(red / yellow / green / frozen / canceled)+ 旧格式变体
|
|
1064
|
+
* (legacy-yellow / legacy-green,仅 --strict-legacy 计违规)+ 未知(unknown)。
|
|
1065
|
+
*/
|
|
1066
|
+
type IssueStatusKind = 'red' | 'yellow' | 'green' | 'frozen' | 'canceled' | 'legacy-yellow' | 'legacy-green' | 'unknown';
|
|
1067
|
+
/**
|
|
1068
|
+
* 规范状态标签(写侧单一真源)
|
|
1069
|
+
*/
|
|
1070
|
+
declare const CANONICAL_STATUS_LABELS: Readonly<Record<'red' | 'yellow' | 'green' | 'frozen' | 'canceled', string>>;
|
|
1071
|
+
/**
|
|
1072
|
+
* issue 引用 token 形态
|
|
1073
|
+
*
|
|
1074
|
+
* `number` 为 3-4 位编号;`slug` 为可空的不完整 slug 段(纯编号引用无 slug)。
|
|
1075
|
+
*/
|
|
1076
|
+
type IssueRefToken = {
|
|
1077
|
+
/**
|
|
1078
|
+
* 引用编号(3-4 位零填充)
|
|
1079
|
+
*/
|
|
1080
|
+
number: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* 引用 slug 段(纯编号引用时为 null)
|
|
1083
|
+
*/
|
|
1084
|
+
slug: string | null;
|
|
1085
|
+
};
|
|
1086
|
+
/**
|
|
1087
|
+
* issue 引用 token 提取模式
|
|
1088
|
+
*
|
|
1089
|
+
* 命中 markdown 链接 label 与纯文本两种形态:`[0035](./0035-xxx.md)` 与 `[0035]`,
|
|
1090
|
+
* 以及行内代码中的不完整 slug 前缀 `[0035-slug-pre]` 形态。链接目标(第三捕获组)
|
|
1091
|
+
* 作为 slug 兜底来源——label 只有编号时从目标文件名 `NNNN-slug.md` 反解 slug。
|
|
1092
|
+
*/
|
|
1093
|
+
declare const ISSUE_REF_TOKEN_PATTERN: RegExp;
|
|
1094
|
+
/**
|
|
1095
|
+
* 从任意文本行提取 issue 引用 token 列表
|
|
1096
|
+
*
|
|
1097
|
+
* slug 解析优先级:label 内 slug 段 > 链接目标文件名 slug;两者皆无时为 null
|
|
1098
|
+
* (纯编号引用)。
|
|
1099
|
+
*
|
|
1100
|
+
* @param text - 待提取文本(沿革/阻塞行内容、正文段落等)
|
|
1101
|
+
* @returns 按出现顺序去重后的引用 token 列表
|
|
1102
|
+
*/
|
|
1103
|
+
declare function extractIssueRefTokens(text: string): IssueRefToken[];
|
|
1104
|
+
/**
|
|
1105
|
+
* 构造元信息行键定位正则
|
|
1106
|
+
*
|
|
1107
|
+
* @param key - 元信息键(如「沿革」「阻塞」)
|
|
1108
|
+
* @returns 行首锚定的键定位正则
|
|
1109
|
+
*/
|
|
1110
|
+
declare function buildMetaLineLocatePattern(key: string): RegExp;
|
|
1111
|
+
/**
|
|
1112
|
+
* 状态行归类
|
|
1113
|
+
*
|
|
1114
|
+
* 归类优先级:已冻结 > 🔴 > ⚫ > 🟡 处理中 > 🟡(旧格式)> 🟢 已处置 > 🟢/✅(旧格式)>
|
|
1115
|
+
* 未知。未识别形态归 unknown(与「无状态行」同判,lint 由 status-line-missing 拦截)。
|
|
1116
|
+
*
|
|
1117
|
+
* @param line - 状态行全文
|
|
1118
|
+
* @returns 状态归类
|
|
1119
|
+
*/
|
|
1120
|
+
declare function classifyStatusLine(line: string): IssueStatusKind;
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/parser/registry.parser.d.ts
|
|
1123
|
+
/**
|
|
1124
|
+
* criteria 判据条目(一行一判据,四段竖线分隔)
|
|
1125
|
+
*/
|
|
1126
|
+
type ParsedCriterion = {
|
|
1127
|
+
/**
|
|
1128
|
+
* 判据标签(人类可读名)
|
|
1129
|
+
*/
|
|
1130
|
+
label: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* 判据通道(证书库的通道维度)
|
|
1133
|
+
*/
|
|
1134
|
+
channel: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* 判据工作目录(相对仓库根)
|
|
1137
|
+
*/
|
|
1138
|
+
cwd: string;
|
|
1139
|
+
/**
|
|
1140
|
+
* 判据命令(退出码即判据)
|
|
1141
|
+
*/
|
|
1142
|
+
command: string;
|
|
1143
|
+
};
|
|
1144
|
+
/**
|
|
1145
|
+
* criteria 围栏块解析产物
|
|
1146
|
+
*/
|
|
1147
|
+
type ParsedCriteriaBlock = {
|
|
1148
|
+
/**
|
|
1149
|
+
* 概要行(唯一非空;缺席为 null)
|
|
1150
|
+
*/
|
|
1151
|
+
summary: string | null;
|
|
1152
|
+
/**
|
|
1153
|
+
* 判据条目列表(至少一条)
|
|
1154
|
+
*/
|
|
1155
|
+
criteria: ParsedCriterion[];
|
|
1156
|
+
};
|
|
1157
|
+
/**
|
|
1158
|
+
* issue 文档解析产物(IssueDocRecord)
|
|
1159
|
+
*/
|
|
1160
|
+
type IssueDocRecord = {
|
|
1161
|
+
/**
|
|
1162
|
+
* 编号(文件名 3-4 位数字前缀)
|
|
1163
|
+
*/
|
|
1164
|
+
id: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* slug(文件名剥前缀与扩展名)
|
|
1167
|
+
*/
|
|
1168
|
+
slug: string;
|
|
1169
|
+
/**
|
|
1170
|
+
* 文件名(basename)
|
|
1171
|
+
*/
|
|
1172
|
+
file: string;
|
|
1173
|
+
/**
|
|
1174
|
+
* 标题(首个 `# ` 行内容;缺席为空串)
|
|
1175
|
+
*/
|
|
1176
|
+
title: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* 状态归类
|
|
1179
|
+
*/
|
|
1180
|
+
status: IssueStatusKind;
|
|
1181
|
+
/**
|
|
1182
|
+
* 状态行全文(未定位为空串)
|
|
1183
|
+
*/
|
|
1184
|
+
statusLine: string;
|
|
1185
|
+
/**
|
|
1186
|
+
* 状态行行号(1 起;未定位为 0)
|
|
1187
|
+
*/
|
|
1188
|
+
statusLineNumber: number;
|
|
1189
|
+
/**
|
|
1190
|
+
* 挂起原因(状态行首个 ≥4 字括注;缺席为 null)
|
|
1191
|
+
*/
|
|
1192
|
+
pendingReason: string | null;
|
|
1193
|
+
/**
|
|
1194
|
+
* 是否存在处置段标题
|
|
1195
|
+
*/
|
|
1196
|
+
hasDispositionSection: boolean;
|
|
1197
|
+
/**
|
|
1198
|
+
* 处置段是否命中占位模式(标题起 8 行窗口)
|
|
1199
|
+
*/
|
|
1200
|
+
dispositionIsPlaceholder: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* 证据锚点块是否在位
|
|
1203
|
+
*/
|
|
1204
|
+
hasEvidenceAnchorBlock: boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* criteria 围栏块解析产物(块在位且解析成功)
|
|
1207
|
+
*/
|
|
1208
|
+
criteria: ParsedCriteriaBlock | null;
|
|
1209
|
+
/**
|
|
1210
|
+
* criteria 围栏块解析错误消息(块缺席为 null;多块/畸形带行号)
|
|
1211
|
+
*/
|
|
1212
|
+
criteriaError: string | null;
|
|
1213
|
+
/**
|
|
1214
|
+
* 沿革引用 token 列表
|
|
1215
|
+
*/
|
|
1216
|
+
historyRefs: IssueRefToken[];
|
|
1217
|
+
/**
|
|
1218
|
+
* 阻塞引用 token 列表
|
|
1219
|
+
*/
|
|
1220
|
+
blockedByRefs: IssueRefToken[];
|
|
1221
|
+
/**
|
|
1222
|
+
* 文档全文
|
|
1223
|
+
*/
|
|
1224
|
+
rawContent: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* 文件 mtime(毫秒;账龄计算口径)
|
|
1227
|
+
*/
|
|
1228
|
+
modifiedAtMs: number;
|
|
1229
|
+
};
|
|
1230
|
+
/**
|
|
1231
|
+
* 注册表文件名解析产物
|
|
1232
|
+
*/
|
|
1233
|
+
type RegistryFileNameParts = {
|
|
1234
|
+
/**
|
|
1235
|
+
* 编号(3-4 位零填充)
|
|
1236
|
+
*/
|
|
1237
|
+
id: string;
|
|
1238
|
+
/**
|
|
1239
|
+
* slug 段
|
|
1240
|
+
*/
|
|
1241
|
+
slug: string;
|
|
1242
|
+
};
|
|
1243
|
+
/**
|
|
1244
|
+
* 解析文件名为编号与 slug
|
|
1245
|
+
*
|
|
1246
|
+
* @param file - 文件名(basename)
|
|
1247
|
+
* @returns 编号与 slug;不符合收集口径返回 null
|
|
1248
|
+
*/
|
|
1249
|
+
declare function parseRegistryFileName(file: string): RegistryFileNameParts | null;
|
|
1250
|
+
/**
|
|
1251
|
+
* 解析 criteria 围栏块(宁可拒收不可猜)
|
|
1252
|
+
*
|
|
1253
|
+
* 全文必须单块唯一;`summary:` 唯一非空;判据行四段逐段非空、channel 合法、
|
|
1254
|
+
* 段内禁多余竖线;块内至少一条判据。所有违规抛带行号错误。
|
|
1255
|
+
*
|
|
1256
|
+
* @param raw - 文档全文
|
|
1257
|
+
* @returns 围栏块解析产物
|
|
1258
|
+
* @throws {@link Error} 块缺席 / 多块 / 未闭合 / 行内违规(错误消息含行号)
|
|
1259
|
+
*/
|
|
1260
|
+
declare function parseCriteriaBlock(raw: string): ParsedCriteriaBlock;
|
|
1261
|
+
/**
|
|
1262
|
+
* 解析单份 issue 文档
|
|
1263
|
+
*
|
|
1264
|
+
* @param file - 文件名(basename,用于编号与 slug 提取)
|
|
1265
|
+
* @param raw - 文档全文
|
|
1266
|
+
* @param modifiedAtMs - 文件 mtime(毫秒)
|
|
1267
|
+
* @returns 解析产物(收集口径外的文件返回 null)
|
|
1268
|
+
*/
|
|
1269
|
+
declare function parseIssueDoc(file: string, raw: string, modifiedAtMs: number): IssueDocRecord | null;
|
|
1270
|
+
/**
|
|
1271
|
+
* 扫描注册表目录
|
|
1272
|
+
*
|
|
1273
|
+
* 只收集口径内文件(NNNN-slug.md),逐份解析,按编号升序;目录缺席返回空数组;
|
|
1274
|
+
* 单份读档失败降级为 unknown 最小形态(不中断批次,apex 同款语义)。
|
|
1275
|
+
*
|
|
1276
|
+
* @param registryDir - 注册表目录绝对或相对路径
|
|
1277
|
+
* @returns 解析产物列表(编号升序)
|
|
1278
|
+
*/
|
|
1279
|
+
declare function scanRegistryDir(registryDir: string): IssueDocRecord[];
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/lint/lint.core.d.ts
|
|
1282
|
+
/**
|
|
1283
|
+
* lint 违规
|
|
1284
|
+
*/
|
|
1285
|
+
type LintViolation = {
|
|
1286
|
+
/**
|
|
1287
|
+
* issue 文件仓库相对 posix 路径
|
|
1288
|
+
*/
|
|
1289
|
+
file: string;
|
|
1290
|
+
/**
|
|
1291
|
+
* 违规行号(0 = 全文级)
|
|
1292
|
+
*/
|
|
1293
|
+
line: number;
|
|
1294
|
+
/**
|
|
1295
|
+
* 规则名
|
|
1296
|
+
*/
|
|
1297
|
+
rule: string;
|
|
1298
|
+
/**
|
|
1299
|
+
* 人类可读违规消息
|
|
1300
|
+
*/
|
|
1301
|
+
message: string;
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* lint 结果
|
|
1305
|
+
*/
|
|
1306
|
+
type LintResult = {
|
|
1307
|
+
/**
|
|
1308
|
+
* 违规列表(active + baseline-stale,按 file/rule 排序)
|
|
1309
|
+
*/
|
|
1310
|
+
violations: LintViolation[];
|
|
1311
|
+
/**
|
|
1312
|
+
* 基线豁免计数(命中存量)
|
|
1313
|
+
*/
|
|
1314
|
+
suppressed: number;
|
|
1315
|
+
/**
|
|
1316
|
+
* 基线条目总数
|
|
1317
|
+
*/
|
|
1318
|
+
baselineCount: number;
|
|
1319
|
+
};
|
|
1320
|
+
/**
|
|
1321
|
+
* 规则判定上下文
|
|
1322
|
+
*/
|
|
1323
|
+
type LintRuleContext = {
|
|
1324
|
+
/**
|
|
1325
|
+
* 仓库根绝对路径
|
|
1326
|
+
*/
|
|
1327
|
+
root: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* 所属 scope key
|
|
1330
|
+
*/
|
|
1331
|
+
scopeKey: string;
|
|
1332
|
+
/**
|
|
1333
|
+
* 注册表目录(posix 相对)
|
|
1334
|
+
*/
|
|
1335
|
+
registryDir: string;
|
|
1336
|
+
/**
|
|
1337
|
+
* 该注册表全部文件名集合(blocking 引用存在性判定)
|
|
1338
|
+
*/
|
|
1339
|
+
registryBasenames: ReadonlySet<string>;
|
|
1340
|
+
/**
|
|
1341
|
+
* 解析后配置
|
|
1342
|
+
*/
|
|
1343
|
+
config: LziIssuesConfig;
|
|
1344
|
+
};
|
|
1345
|
+
/**
|
|
1346
|
+
* 单条规则(返回违规消息即违规;null 放行)
|
|
1347
|
+
*/
|
|
1348
|
+
type LintRule = {
|
|
1349
|
+
/**
|
|
1350
|
+
* 规则名(基线 (file, rule) 豁免键成分)
|
|
1351
|
+
*/
|
|
1352
|
+
name: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* 判定函数
|
|
1355
|
+
*
|
|
1356
|
+
* @param record - 解析产物
|
|
1357
|
+
* @param ctx - 判定上下文
|
|
1358
|
+
* @returns 违规消息;放行为 null
|
|
1359
|
+
*/
|
|
1360
|
+
evaluate: (record: IssueDocRecord, ctx: LintRuleContext) => string | null;
|
|
1361
|
+
};
|
|
1362
|
+
/**
|
|
1363
|
+
* 注册 lint 规则包(域规则扩展点;覆盖同名包)
|
|
1364
|
+
*
|
|
1365
|
+
* @param packId - 规则包 id(config lint.rulePacks 引用)
|
|
1366
|
+
* @param rules - 规则列表
|
|
1367
|
+
*/
|
|
1368
|
+
declare function registerLintRulePack(packId: string, rules: readonly LintRule[]): void;
|
|
1369
|
+
/**
|
|
1370
|
+
* 核心规则全集(13 条)
|
|
1371
|
+
*/
|
|
1372
|
+
declare const CORE_LINT_RULES: readonly LintRule[];
|
|
1373
|
+
/**
|
|
1374
|
+
* lint 命令入参
|
|
1375
|
+
*/
|
|
1376
|
+
type RunLintInput = {
|
|
1377
|
+
/**
|
|
1378
|
+
* 仓库根绝对路径
|
|
1379
|
+
*/
|
|
1380
|
+
root: string;
|
|
1381
|
+
/**
|
|
1382
|
+
* 解析后配置
|
|
1383
|
+
*/
|
|
1384
|
+
config: LziIssuesConfig;
|
|
1385
|
+
/**
|
|
1386
|
+
* 限定注册表目录(缺省全部 scope)
|
|
1387
|
+
*/
|
|
1388
|
+
dirRels?: readonly string[];
|
|
1389
|
+
/**
|
|
1390
|
+
* 是否跳过基线豁免(write-baseline 再生口径:全集违规)
|
|
1391
|
+
*/
|
|
1392
|
+
ignoreBaseline?: boolean;
|
|
1393
|
+
};
|
|
1394
|
+
/**
|
|
1395
|
+
* 运行 lint(核心规则 + 启用的规则包 + 棘轮基线三态)
|
|
1396
|
+
*
|
|
1397
|
+
* @param input - 命令入参
|
|
1398
|
+
* @returns lint 结果(violations 非空即违规)
|
|
1399
|
+
*/
|
|
1400
|
+
declare function runLint(input: RunLintInput): LintResult;
|
|
1401
|
+
/**
|
|
1402
|
+
* 全仓 sidecar 孤儿扫描辅助(orphan-sidecar 的目录级补充:边车存在而注册表无文件)
|
|
1403
|
+
*
|
|
1404
|
+
* @param root - 仓库根绝对路径
|
|
1405
|
+
* @param config - 解析后配置
|
|
1406
|
+
* @returns 孤儿边车违规列表
|
|
1407
|
+
*/
|
|
1408
|
+
declare function scanOrphanSidecars(root: string, config: LziIssuesConfig): LintViolation[];
|
|
1409
|
+
//#endregion
|
|
1410
|
+
//#region src/lint/lint-baseline.commands.d.ts
|
|
1411
|
+
/**
|
|
1412
|
+
* 基线再生结果
|
|
1413
|
+
*/
|
|
1414
|
+
type WriteLintBaselineResult = {
|
|
1415
|
+
/**
|
|
1416
|
+
* 再生成功标记
|
|
1417
|
+
*/
|
|
1418
|
+
ok: true;
|
|
1419
|
+
/**
|
|
1420
|
+
* 再生产物全文(整文件写回 lzi-issues.config.ts)
|
|
1421
|
+
*/
|
|
1422
|
+
content: string;
|
|
1423
|
+
/**
|
|
1424
|
+
* 再生条目数
|
|
1425
|
+
*/
|
|
1426
|
+
entryCount: number;
|
|
1427
|
+
} | {
|
|
1428
|
+
/**
|
|
1429
|
+
* 再生成功标记
|
|
1430
|
+
*/
|
|
1431
|
+
ok: false;
|
|
1432
|
+
/**
|
|
1433
|
+
* 拒绝原因
|
|
1434
|
+
*/
|
|
1435
|
+
error: string;
|
|
1436
|
+
};
|
|
1437
|
+
/**
|
|
1438
|
+
* 基线再生命令入参
|
|
1439
|
+
*/
|
|
1440
|
+
type WriteLintBaselineInput = {
|
|
1441
|
+
/**
|
|
1442
|
+
* 仓库根绝对路径
|
|
1443
|
+
*/
|
|
1444
|
+
root: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* 解析后配置
|
|
1447
|
+
*/
|
|
1448
|
+
config: LziIssuesConfig;
|
|
1449
|
+
/**
|
|
1450
|
+
* 收编指针(非空;作为新条目盖章)
|
|
1451
|
+
*/
|
|
1452
|
+
issuePointer: string;
|
|
1453
|
+
};
|
|
1454
|
+
/**
|
|
1455
|
+
* 基线再生命令核
|
|
1456
|
+
*
|
|
1457
|
+
* @param input - 命令入参
|
|
1458
|
+
* @returns 再生结果
|
|
1459
|
+
*/
|
|
1460
|
+
declare function runWriteLintBaseline(input: WriteLintBaselineInput): WriteLintBaselineResult;
|
|
1461
|
+
/**
|
|
1462
|
+
* 从 lint 违规导出基线条目(排序去重;测试与工具消费)
|
|
1463
|
+
*
|
|
1464
|
+
* @param violations - 违规列表
|
|
1465
|
+
* @param issuePointer - 收编指针
|
|
1466
|
+
* @returns 基线条目列表
|
|
1467
|
+
*/
|
|
1468
|
+
declare function deriveEntriesFromViolations(violations: readonly LintViolation[], issuePointer: string): LintBaselineEntry[];
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/normalize/normalize-header.commands.d.ts
|
|
1471
|
+
/**
|
|
1472
|
+
* normalize-header(方言头部迁移)
|
|
1473
|
+
*
|
|
1474
|
+
* 四种历史方言(单行管道引用行 / 粗体标签行 / `## 键: 值` 标题式 / `- ` 列表式)
|
|
1475
|
+
* 解析后重排为裁定格式:粗体标签逐行 `**键**: 值`;字段规范序(FIELD_RANK);
|
|
1476
|
+
* 「主题」问题陈述迁正文首个节标题后;residual 原样保留。零丢失守卫:每字段
|
|
1477
|
+
* 必须在产物文本在场否则 failed 不落盘;幂等(产物 === 原文 → unchanged)。
|
|
1478
|
+
*/
|
|
1479
|
+
/**
|
|
1480
|
+
* 单文件迁移入参
|
|
1481
|
+
*/
|
|
1482
|
+
type NormalizeHeaderFileInput = {
|
|
1483
|
+
/**
|
|
1484
|
+
* 仓库根绝对路径
|
|
1485
|
+
*/
|
|
1486
|
+
root: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* issue 文件仓库相对路径
|
|
1489
|
+
*/
|
|
1490
|
+
file: string;
|
|
1491
|
+
};
|
|
1492
|
+
/**
|
|
1493
|
+
* 单文件迁移结果
|
|
1494
|
+
*/
|
|
1495
|
+
type NormalizeHeaderResult = {
|
|
1496
|
+
/**
|
|
1497
|
+
* issue 文件仓库相对路径
|
|
1498
|
+
*/
|
|
1499
|
+
file: string;
|
|
1500
|
+
/**
|
|
1501
|
+
* 处置形态:rewritten / unchanged / skipped / failed
|
|
1502
|
+
*/
|
|
1503
|
+
outcome: 'rewritten' | 'unchanged' | 'skipped' | 'failed';
|
|
1504
|
+
/**
|
|
1505
|
+
* 结果说明(failed 含原因;skipped 说明灯位缺失等)
|
|
1506
|
+
*/
|
|
1507
|
+
message: string;
|
|
1508
|
+
};
|
|
1509
|
+
/**
|
|
1510
|
+
* 迁移形态
|
|
1511
|
+
*/
|
|
1512
|
+
type NormalizeOutcome = 'rewritten' | 'unchanged' | 'skipped';
|
|
1513
|
+
/**
|
|
1514
|
+
* 迁移产物
|
|
1515
|
+
*/
|
|
1516
|
+
type NormalizeResult = {
|
|
1517
|
+
/**
|
|
1518
|
+
* 产物全文
|
|
1519
|
+
*/
|
|
1520
|
+
content: string;
|
|
1521
|
+
/**
|
|
1522
|
+
* 迁移形态
|
|
1523
|
+
*/
|
|
1524
|
+
outcome: NormalizeOutcome;
|
|
1525
|
+
};
|
|
1526
|
+
/**
|
|
1527
|
+
* 迁移单份文档头部
|
|
1528
|
+
*
|
|
1529
|
+
* @param raw - 文档全文
|
|
1530
|
+
* @returns 迁移产物
|
|
1531
|
+
*/
|
|
1532
|
+
declare function normalizeHeader(raw: string): NormalizeResult;
|
|
1533
|
+
/**
|
|
1534
|
+
* 迁移并落盘单份文档(守卫失败不落盘)
|
|
1535
|
+
*
|
|
1536
|
+
* @param input - 命令入参
|
|
1537
|
+
* @param input.root - 仓库根绝对路径
|
|
1538
|
+
* @param input.file - issue 文件仓库相对路径
|
|
1539
|
+
* @returns 单文件迁移结果
|
|
1540
|
+
*/
|
|
1541
|
+
declare function normalizeHeaderFile(input: NormalizeHeaderFileInput): NormalizeHeaderResult;
|
|
1542
|
+
//#endregion
|
|
1543
|
+
//#region src/numbering/numbering.core.d.ts
|
|
1544
|
+
/**
|
|
1545
|
+
* 编号门禁核心(纯函数,零 fs)
|
|
1546
|
+
*
|
|
1547
|
+
* apex numbering-guard 语义迁移:四类键型提取、取号(max+1 顺延跳已占与保留、
|
|
1548
|
+
* 宽度随最大键)、五类违例扫描(目录=编号命名空间)、slug 数字策略、覆盖面
|
|
1549
|
+
* 审计。文件系统编排由 numbering.commands 承担,本模块可独立测试。
|
|
1550
|
+
*/
|
|
1551
|
+
/**
|
|
1552
|
+
* 编号键规则(判别联合;v1 issues 注册表固定 numericPrefix,其余键型供通用引擎使用)
|
|
1553
|
+
*/
|
|
1554
|
+
type NumberingKeyRule = {
|
|
1555
|
+
kind: 'numericPrefix';
|
|
1556
|
+
} | {
|
|
1557
|
+
kind: 'compositePrefix';
|
|
1558
|
+
groups: number;
|
|
1559
|
+
} | {
|
|
1560
|
+
kind: 'numericSuffix';
|
|
1561
|
+
} | {
|
|
1562
|
+
kind: 'customPattern';
|
|
1563
|
+
pattern: string;
|
|
1564
|
+
};
|
|
1565
|
+
/**
|
|
1566
|
+
* 编号违例种类
|
|
1567
|
+
*/
|
|
1568
|
+
type NumberingFindingKind = 'duplicate' | 'reservedOccupied' | 'widthInconsistent' | 'allowlistStale' | 'slugContainsDigit' | 'slugDigitAllowlistStale';
|
|
1569
|
+
/**
|
|
1570
|
+
* 编号违例
|
|
1571
|
+
*/
|
|
1572
|
+
type NumberingFinding = {
|
|
1573
|
+
/**
|
|
1574
|
+
* 违例种类
|
|
1575
|
+
*/
|
|
1576
|
+
kind: NumberingFindingKind;
|
|
1577
|
+
/**
|
|
1578
|
+
* 所属 scope(slugDigitAllowlistStale 为 'global')
|
|
1579
|
+
*/
|
|
1580
|
+
scopeKey: string;
|
|
1581
|
+
/**
|
|
1582
|
+
* 人类可读违例消息(含文件清单与处置指引)
|
|
1583
|
+
*/
|
|
1584
|
+
message: string;
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* 审计违例种类
|
|
1588
|
+
*/
|
|
1589
|
+
type NumberingAuditFindingKind = 'coverageGap' | 'pendingStale';
|
|
1590
|
+
/**
|
|
1591
|
+
* 审计违例
|
|
1592
|
+
*/
|
|
1593
|
+
type NumberingAuditFinding = {
|
|
1594
|
+
/**
|
|
1595
|
+
* 违例种类
|
|
1596
|
+
*/
|
|
1597
|
+
kind: NumberingAuditFindingKind;
|
|
1598
|
+
/**
|
|
1599
|
+
* 人类可读违例消息
|
|
1600
|
+
*/
|
|
1601
|
+
message: string;
|
|
1602
|
+
};
|
|
1603
|
+
/**
|
|
1604
|
+
* 编号豁免条目(引擎消费形态;files 为仓库相对 posix 路径,精确文件集)
|
|
1605
|
+
*/
|
|
1606
|
+
type NumberingAllowlistEntry = {
|
|
1607
|
+
/**
|
|
1608
|
+
* 所属 scope key
|
|
1609
|
+
*/
|
|
1610
|
+
scopeKey: string;
|
|
1611
|
+
/**
|
|
1612
|
+
* 豁免编号
|
|
1613
|
+
*/
|
|
1614
|
+
number: string;
|
|
1615
|
+
/**
|
|
1616
|
+
* 精确文件集(排序后与磁盘对照)
|
|
1617
|
+
*/
|
|
1618
|
+
files: string[];
|
|
1619
|
+
/**
|
|
1620
|
+
* 棘轮状态
|
|
1621
|
+
*/
|
|
1622
|
+
status: string;
|
|
1623
|
+
/**
|
|
1624
|
+
* 豁免理由
|
|
1625
|
+
*/
|
|
1626
|
+
reason: string;
|
|
1627
|
+
};
|
|
1628
|
+
/**
|
|
1629
|
+
* 提取文件名编号键
|
|
1630
|
+
*
|
|
1631
|
+
* 提不出键的文件(README 等)返回 null,天然不占号。
|
|
1632
|
+
*
|
|
1633
|
+
* @param basename - 文件名
|
|
1634
|
+
* @param rule - 键规则
|
|
1635
|
+
* @returns 编号键原文;无键为 null
|
|
1636
|
+
*/
|
|
1637
|
+
declare function extractFileKey(basename: string, rule: NumberingKeyRule): string | null;
|
|
1638
|
+
/**
|
|
1639
|
+
* 提取键的前导数值
|
|
1640
|
+
*
|
|
1641
|
+
* @param key - 编号键
|
|
1642
|
+
* @returns 前导数值;非数字键为 null
|
|
1643
|
+
*/
|
|
1644
|
+
declare function keyLeadingNumber(key: string): number | null;
|
|
1645
|
+
/**
|
|
1646
|
+
* 取号入参
|
|
1647
|
+
*/
|
|
1648
|
+
type NextNumberInput = {
|
|
1649
|
+
/**
|
|
1650
|
+
* 扫描面文件名列表(键提取口径占号)
|
|
1651
|
+
*/
|
|
1652
|
+
basenames: readonly string[];
|
|
1653
|
+
/**
|
|
1654
|
+
* 键规则
|
|
1655
|
+
*/
|
|
1656
|
+
rule: NumberingKeyRule;
|
|
1657
|
+
/**
|
|
1658
|
+
* 保留号列表(不回收复用)
|
|
1659
|
+
*/
|
|
1660
|
+
reserved: readonly string[];
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* 取号结果
|
|
1664
|
+
*/
|
|
1665
|
+
type NextNumberResult = {
|
|
1666
|
+
ok: true;
|
|
1667
|
+
number: string;
|
|
1668
|
+
skippedOccupied: number;
|
|
1669
|
+
skippedReserved: number;
|
|
1670
|
+
} | {
|
|
1671
|
+
ok: false;
|
|
1672
|
+
error: string;
|
|
1673
|
+
};
|
|
1674
|
+
/**
|
|
1675
|
+
* 取号:max+1 起顺延,跳过磁盘已占与保留号,取首个空闲
|
|
1676
|
+
*
|
|
1677
|
+
* 宽度 = 数值最大键的字符串长度(零填充跟随现行形态);空范围拒绝取号(无法
|
|
1678
|
+
* 推断位数,人工定号)。
|
|
1679
|
+
*
|
|
1680
|
+
* @param input - 取号入参
|
|
1681
|
+
* @returns 取号结果
|
|
1682
|
+
*/
|
|
1683
|
+
declare function computeNextNumber(input: NextNumberInput): NextNumberResult;
|
|
1684
|
+
/**
|
|
1685
|
+
* 提取文件名 slug 段(剥前缀键 + 单个分隔符 + 最后一个扩展名)
|
|
1686
|
+
*
|
|
1687
|
+
* 空.slug 放行(返回空串);非前缀数字形态返回 null(不属判定面)。
|
|
1688
|
+
*
|
|
1689
|
+
* @param basename - 文件名
|
|
1690
|
+
* @returns slug 段;非判定面为 null
|
|
1691
|
+
*/
|
|
1692
|
+
declare function extractSlugSegment(basename: string): string | null;
|
|
1693
|
+
/**
|
|
1694
|
+
* 违例扫描入参(单 scope)
|
|
1695
|
+
*/
|
|
1696
|
+
type ScopeScanInput = {
|
|
1697
|
+
/**
|
|
1698
|
+
* scope key
|
|
1699
|
+
*/
|
|
1700
|
+
scopeKey: string;
|
|
1701
|
+
/**
|
|
1702
|
+
* 扫描面文件名列表
|
|
1703
|
+
*/
|
|
1704
|
+
basenames: readonly string[];
|
|
1705
|
+
/**
|
|
1706
|
+
* 键规则
|
|
1707
|
+
*/
|
|
1708
|
+
rule: NumberingKeyRule;
|
|
1709
|
+
/**
|
|
1710
|
+
* 保留号(含理由,报文引用)
|
|
1711
|
+
*/
|
|
1712
|
+
reserved: ReadonlyArray<{
|
|
1713
|
+
number: string;
|
|
1714
|
+
reason: string;
|
|
1715
|
+
}>;
|
|
1716
|
+
/**
|
|
1717
|
+
* 该 scope 的豁免条目(files 为仓库相对 posix 路径)
|
|
1718
|
+
*/
|
|
1719
|
+
allowlist: readonly NumberingAllowlistEntry[];
|
|
1720
|
+
/**
|
|
1721
|
+
* slug 数字策略('forbid' 启用判定)
|
|
1722
|
+
*/
|
|
1723
|
+
slugDigitPolicy?: 'forbid';
|
|
1724
|
+
/**
|
|
1725
|
+
* slug 数字白名单 glob(仓库相对路径命中豁免)
|
|
1726
|
+
*/
|
|
1727
|
+
slugDigitAllowlist: readonly string[];
|
|
1728
|
+
/**
|
|
1729
|
+
* 文件仓库相对路径构造器(slug 白名单匹配口径)
|
|
1730
|
+
*/
|
|
1731
|
+
toRepoRelative: (basename: string) => string;
|
|
1732
|
+
/**
|
|
1733
|
+
* 全量档标记(true 时追加 slug 白名单失效对账)
|
|
1734
|
+
*/
|
|
1735
|
+
fullMode: boolean;
|
|
1736
|
+
};
|
|
1737
|
+
/**
|
|
1738
|
+
* 单 scope 违例扫描(目录=编号命名空间)
|
|
1739
|
+
*
|
|
1740
|
+
* 判定顺序:先撞号组(豁免须排序文件集双向相等精确覆盖)后保留号;全部组判
|
|
1741
|
+
* 完后逐豁免条目对账(棘轮只许缩短)。
|
|
1742
|
+
*
|
|
1743
|
+
* @param input - 扫描入参
|
|
1744
|
+
* @returns 违例列表
|
|
1745
|
+
*/
|
|
1746
|
+
declare function scanScopeForFindings(input: ScopeScanInput): NumberingFinding[];
|
|
1747
|
+
/**
|
|
1748
|
+
* 覆盖面审计入参
|
|
1749
|
+
*/
|
|
1750
|
+
type AuditCoverageInput = {
|
|
1751
|
+
/**
|
|
1752
|
+
* 全仓扫描面文件列表(posix 相对路径,已过全局排除)
|
|
1753
|
+
*/
|
|
1754
|
+
files: readonly string[];
|
|
1755
|
+
/**
|
|
1756
|
+
* 形似编号筛选模式(作用于 basename)
|
|
1757
|
+
*/
|
|
1758
|
+
numberishPattern: string;
|
|
1759
|
+
/**
|
|
1760
|
+
* 已登记注册表目录列表(文件落于其下即被 scope 收编)
|
|
1761
|
+
*/
|
|
1762
|
+
registryDirs: readonly string[];
|
|
1763
|
+
/**
|
|
1764
|
+
* pending 探针列表(glob + 理由;命中即视为已规划覆盖)
|
|
1765
|
+
*/
|
|
1766
|
+
pending: ReadonlyArray<{
|
|
1767
|
+
glob: string;
|
|
1768
|
+
reason: string;
|
|
1769
|
+
}>;
|
|
1770
|
+
};
|
|
1771
|
+
/**
|
|
1772
|
+
* 覆盖面审计:形似编号文件必须被 scope / 排除 / pending 三者之一覆盖
|
|
1773
|
+
*
|
|
1774
|
+
* 未覆盖按目录聚合为 coverageGap;pending 未命中计 pendingStale。
|
|
1775
|
+
*
|
|
1776
|
+
* @param input - 审计入参
|
|
1777
|
+
* @returns 审计违例列表
|
|
1778
|
+
*/
|
|
1779
|
+
declare function auditCoverage(input: AuditCoverageInput): NumberingAuditFinding[];
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/numbering/numbering.commands.d.ts
|
|
1782
|
+
/**
|
|
1783
|
+
* issues 注册表键规则(数字前缀;v1 注册表固定形态)
|
|
1784
|
+
*/
|
|
1785
|
+
declare const ISSUES_KEY_RULE: NumberingKeyRule;
|
|
1786
|
+
/**
|
|
1787
|
+
* 取号命令结果
|
|
1788
|
+
*/
|
|
1789
|
+
type NumberingNextResult = {
|
|
1790
|
+
/**
|
|
1791
|
+
* 取号成功标记
|
|
1792
|
+
*/
|
|
1793
|
+
ok: true;
|
|
1794
|
+
/**
|
|
1795
|
+
* 下一可用编号(零填充)
|
|
1796
|
+
*/
|
|
1797
|
+
number: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* 取号目标描述(scope key 或目录)
|
|
1800
|
+
*/
|
|
1801
|
+
target: string;
|
|
1802
|
+
/**
|
|
1803
|
+
* 跳过的已占用号数
|
|
1804
|
+
*/
|
|
1805
|
+
skippedOccupied: number;
|
|
1806
|
+
/**
|
|
1807
|
+
* 跳过的保留号数
|
|
1808
|
+
*/
|
|
1809
|
+
skippedReserved: number;
|
|
1810
|
+
} | {
|
|
1811
|
+
/**
|
|
1812
|
+
* 取号成功标记
|
|
1813
|
+
*/
|
|
1814
|
+
ok: false;
|
|
1815
|
+
/**
|
|
1816
|
+
* 失败原因
|
|
1817
|
+
*/
|
|
1818
|
+
error: string;
|
|
1819
|
+
};
|
|
1820
|
+
/**
|
|
1821
|
+
* 检查命令结果
|
|
1822
|
+
*/
|
|
1823
|
+
type NumberingCheckResult = {
|
|
1824
|
+
/**
|
|
1825
|
+
* 违例列表(空 = 通过)
|
|
1826
|
+
*/
|
|
1827
|
+
findings: NumberingFinding[];
|
|
1828
|
+
/**
|
|
1829
|
+
* 参与判定的 scope 数
|
|
1830
|
+
*/
|
|
1831
|
+
scopeCount: number;
|
|
1832
|
+
/**
|
|
1833
|
+
* 扫描面文件数
|
|
1834
|
+
*/
|
|
1835
|
+
scannedFiles: number;
|
|
1836
|
+
};
|
|
1837
|
+
/**
|
|
1838
|
+
* 审计命令结果
|
|
1839
|
+
*/
|
|
1840
|
+
type NumberingAuditResult = {
|
|
1841
|
+
/**
|
|
1842
|
+
* 违例列表(空 = 通过)
|
|
1843
|
+
*/
|
|
1844
|
+
findings: NumberingAuditFinding[];
|
|
1845
|
+
/**
|
|
1846
|
+
* 全仓扫描面文件数
|
|
1847
|
+
*/
|
|
1848
|
+
scannedFiles: number;
|
|
1849
|
+
};
|
|
1850
|
+
/**
|
|
1851
|
+
* 取号命令入参
|
|
1852
|
+
*/
|
|
1853
|
+
type NumberingNextCommandInput = {
|
|
1854
|
+
/**
|
|
1855
|
+
* 仓库根绝对路径
|
|
1856
|
+
*/
|
|
1857
|
+
root: string;
|
|
1858
|
+
/**
|
|
1859
|
+
* 解析后配置
|
|
1860
|
+
*/
|
|
1861
|
+
config: LziIssuesConfig;
|
|
1862
|
+
/**
|
|
1863
|
+
* 目标 scope key(与 dirRel 互斥)
|
|
1864
|
+
*/
|
|
1865
|
+
scopeKey?: string;
|
|
1866
|
+
/**
|
|
1867
|
+
* 目标注册表目录(posix 相对,与 scopeKey 互斥)
|
|
1868
|
+
*/
|
|
1869
|
+
dirRel?: string;
|
|
1870
|
+
};
|
|
1871
|
+
/**
|
|
1872
|
+
* 取号命令核(只读不写;编号写入时刻确定——落盘前重跑取最新值)
|
|
1873
|
+
*
|
|
1874
|
+
* @param input - 命令入参
|
|
1875
|
+
* @returns 取号结果
|
|
1876
|
+
*/
|
|
1877
|
+
declare function runNumberingNext(input: NumberingNextCommandInput): NumberingNextResult;
|
|
1878
|
+
/**
|
|
1879
|
+
* 检查命令入参
|
|
1880
|
+
*/
|
|
1881
|
+
type NumberingCheckCommandInput = {
|
|
1882
|
+
/**
|
|
1883
|
+
* 仓库根绝对路径
|
|
1884
|
+
*/
|
|
1885
|
+
root: string;
|
|
1886
|
+
/**
|
|
1887
|
+
* 解析后配置
|
|
1888
|
+
*/
|
|
1889
|
+
config: LziIssuesConfig;
|
|
1890
|
+
/**
|
|
1891
|
+
* 目录增量档目标(缺省全量档)
|
|
1892
|
+
*/
|
|
1893
|
+
dirRel?: string;
|
|
1894
|
+
};
|
|
1895
|
+
/**
|
|
1896
|
+
* 检查命令核(全量档 / 目录增量档)
|
|
1897
|
+
*
|
|
1898
|
+
* 目录增量档:只判覆盖 scope,豁免按目录过滤(防其他目录条目误判 stale),
|
|
1899
|
+
* 不跑 slug 白名单失效对账(扫描面不完整防假阳性)。
|
|
1900
|
+
*
|
|
1901
|
+
* @param input - 命令入参
|
|
1902
|
+
* @returns 检查结果
|
|
1903
|
+
*/
|
|
1904
|
+
declare function runNumberingCheck(input: NumberingCheckCommandInput): NumberingCheckResult;
|
|
1905
|
+
/**
|
|
1906
|
+
* 审计命令入参
|
|
1907
|
+
*/
|
|
1908
|
+
type NumberingAuditCommandInput = {
|
|
1909
|
+
/**
|
|
1910
|
+
* 仓库根绝对路径
|
|
1911
|
+
*/
|
|
1912
|
+
root: string;
|
|
1913
|
+
/**
|
|
1914
|
+
* 解析后配置
|
|
1915
|
+
*/
|
|
1916
|
+
config: LziIssuesConfig;
|
|
1917
|
+
};
|
|
1918
|
+
/**
|
|
1919
|
+
* 审计命令核(全仓严格遍历防逃逸;审计根缺失抛错防扫描面缩水)
|
|
1920
|
+
*
|
|
1921
|
+
* @param input - 命令入参
|
|
1922
|
+
* @returns 审计结果
|
|
1923
|
+
* @throws {@link Error} 审计根缺失
|
|
1924
|
+
*/
|
|
1925
|
+
declare function runNumberingAudit(input: NumberingAuditCommandInput): NumberingAuditResult;
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region src/parser/guide-fixture.utils.d.ts
|
|
1928
|
+
/**
|
|
1929
|
+
* 格式指南夹具工具(零漂移守卫的切片面)
|
|
1930
|
+
*
|
|
1931
|
+
* 格式真源指南(docs/guides/issue-file-format.md)内的活样板以 HTML 注释标记
|
|
1932
|
+
* 圈定边界;本模块负责定位指南文件、切片活样板,供测试与渲染器比对——
|
|
1933
|
+
* 「写指南即写测试,改解析器必改指南」(apex guide-fixture 同款机制)。
|
|
1934
|
+
*/
|
|
1935
|
+
/**
|
|
1936
|
+
* 活样板起点标记
|
|
1937
|
+
*/
|
|
1938
|
+
declare const GUIDE_FIXTURE_START_MARK = "<!-- issue-file-format-fixture:start -->";
|
|
1939
|
+
/**
|
|
1940
|
+
* 活样板终点标记
|
|
1941
|
+
*/
|
|
1942
|
+
declare const GUIDE_FIXTURE_END_MARK = "<!-- issue-file-format-fixture:end -->";
|
|
1943
|
+
/**
|
|
1944
|
+
* 格式指南相对项目根路径
|
|
1945
|
+
*/
|
|
1946
|
+
declare const ISSUE_FILE_FORMAT_GUIDE_RELATIVE = "docs/guides/issue-file-format.md";
|
|
1947
|
+
/**
|
|
1948
|
+
* 定位格式指南绝对路径
|
|
1949
|
+
*
|
|
1950
|
+
* 从本模块运行位置逐级向上查找 `docs/guides/issue-file-format.md`(源码运行与
|
|
1951
|
+
* dist 构建产物两种位置均可命中;上限 10 层防失控上溯)。
|
|
1952
|
+
*
|
|
1953
|
+
* @returns 指南绝对路径
|
|
1954
|
+
* @throws {@link Error} 超出查找上限仍未命中
|
|
1955
|
+
*/
|
|
1956
|
+
declare function locateIssueFileFormatGuide(): string;
|
|
1957
|
+
/**
|
|
1958
|
+
* 读取格式指南全文
|
|
1959
|
+
*
|
|
1960
|
+
* @returns 指南全文
|
|
1961
|
+
*/
|
|
1962
|
+
declare function loadIssueFileFormatGuide(): string;
|
|
1963
|
+
/**
|
|
1964
|
+
* 切片指南活样板
|
|
1965
|
+
*
|
|
1966
|
+
* @param guide - 指南全文
|
|
1967
|
+
* @returns 起终点标记之间的活样板文本(去首尾空白行)
|
|
1968
|
+
* @throws {@link Error} 标记缺席或次序颠倒(显式抛错,不静默返回空)
|
|
1969
|
+
*/
|
|
1970
|
+
declare function sliceGuideFixtureSample(guide: string): string;
|
|
1971
|
+
//#endregion
|
|
1972
|
+
//#region src/template/issue-template.renderer.d.ts
|
|
1973
|
+
/**
|
|
1974
|
+
* issue 标准模板渲染器(唯一真源)
|
|
1975
|
+
*
|
|
1976
|
+
* 标准格式三路共用本渲染器:template 命令(skeleton 骨架展示)、create 建档
|
|
1977
|
+
* (instance 实际值骨架)、init 注册表 README 存根。正文四段占位文本以常量形态
|
|
1978
|
+
* 由两种模式共享,结构漂移在构造上不可能发生;指南活样板与骨架的逐字一致由
|
|
1979
|
+
* guide-fixture 测试守卫(零漂移五环之一)。
|
|
1980
|
+
*/
|
|
1981
|
+
/**
|
|
1982
|
+
* issue 优先级(模板口径)
|
|
1983
|
+
*/
|
|
1984
|
+
type IssueTemplatePriority = 'P1' | 'P2' | 'P3';
|
|
1985
|
+
/**
|
|
1986
|
+
* 模板引用形态(沿革 / 阻塞行的引用条目)
|
|
1987
|
+
*/
|
|
1988
|
+
type IssueTemplateRef = {
|
|
1989
|
+
/**
|
|
1990
|
+
* 引用编号(3-4 位零填充)
|
|
1991
|
+
*/
|
|
1992
|
+
number: string;
|
|
1993
|
+
/**
|
|
1994
|
+
* 引用完整 slug(缺席时渲染为纯编号引用)
|
|
1995
|
+
*/
|
|
1996
|
+
slug?: string;
|
|
1997
|
+
};
|
|
1998
|
+
/**
|
|
1999
|
+
* instance 模式渲染入参
|
|
2000
|
+
*/
|
|
2001
|
+
type IssueTemplateValues = {
|
|
2002
|
+
/**
|
|
2003
|
+
* 编号(4 位零填充,编号门禁取号分配)
|
|
2004
|
+
*/
|
|
2005
|
+
number: string;
|
|
2006
|
+
/**
|
|
2007
|
+
* slug(kebab-case,默认禁数字)
|
|
2008
|
+
*/
|
|
2009
|
+
slug: string;
|
|
2010
|
+
/**
|
|
2011
|
+
* 一句话标题(问题是什么,禁笼统词)
|
|
2012
|
+
*/
|
|
2013
|
+
title: string;
|
|
2014
|
+
/**
|
|
2015
|
+
* 优先级
|
|
2016
|
+
*/
|
|
2017
|
+
priority: IssueTemplatePriority;
|
|
2018
|
+
/**
|
|
2019
|
+
* 所属域(config 登记的 scope title)
|
|
2020
|
+
*/
|
|
2021
|
+
scopeTitle: string;
|
|
2022
|
+
/**
|
|
2023
|
+
* 立案日期(YYYY-MM-DD)
|
|
2024
|
+
*/
|
|
2025
|
+
date: string;
|
|
2026
|
+
/**
|
|
2027
|
+
* 来源(问题原文出处 + 日期)
|
|
2028
|
+
*/
|
|
2029
|
+
source: string;
|
|
2030
|
+
/**
|
|
2031
|
+
* 沿革引用(缺席时省略沿革行)
|
|
2032
|
+
*/
|
|
2033
|
+
historyRefs?: IssueTemplateRef[];
|
|
2034
|
+
/**
|
|
2035
|
+
* 阻塞引用(缺席时省略阻塞行;全部 🟢 后方可收口)
|
|
2036
|
+
*/
|
|
2037
|
+
blockedByRefs?: IssueTemplateRef[];
|
|
2038
|
+
};
|
|
2039
|
+
/**
|
|
2040
|
+
* 渲染标准模板骨架(skeleton 模式)
|
|
2041
|
+
*
|
|
2042
|
+
* 占位符形态,供 template 命令展示与指南活样板消费。
|
|
2043
|
+
*
|
|
2044
|
+
* @returns 骨架全文(以单个换行结尾)
|
|
2045
|
+
*/
|
|
2046
|
+
declare function renderIssueTemplateSkeleton(): string;
|
|
2047
|
+
/**
|
|
2048
|
+
* 渲染标准模板实例(instance 模式)
|
|
2049
|
+
*
|
|
2050
|
+
* 头部元信息代入实际值;沿革 / 阻塞行按入参省略或渲染;正文四段保留占位指导
|
|
2051
|
+
* 文本(建档即骨架,内容随治理进展回填——apex 同款语义)。
|
|
2052
|
+
*
|
|
2053
|
+
* @param values - 实际值入参
|
|
2054
|
+
* @returns 可直接落盘的 issue 文档全文(以单个换行结尾)
|
|
2055
|
+
*/
|
|
2056
|
+
declare function renderIssueTemplate(values: IssueTemplateValues): string;
|
|
2057
|
+
/**
|
|
2058
|
+
* 渲染 criteria 判据块示例(template --with-criteria 附带)
|
|
2059
|
+
*
|
|
2060
|
+
* 示例本身为解析器合法形态(照抄即通过机检),字段说明以 `#` 注释行承载。
|
|
2061
|
+
*
|
|
2062
|
+
* @returns 判据块示例全文
|
|
2063
|
+
*/
|
|
2064
|
+
declare function renderCriteriaBlockExample(): string;
|
|
2065
|
+
/**
|
|
2066
|
+
* 渲染注册表 README 格式存根(init 命令落盘)
|
|
2067
|
+
*
|
|
2068
|
+
* 一页式格式速览:建档入口、状态行五态、正文四段;完整规范指向格式真源指南。
|
|
2069
|
+
*
|
|
2070
|
+
* @param scopeTitle - scope 人类可读名
|
|
2071
|
+
* @param guideRelPath - 格式指南相对本注册表目录的路径(如 `../../docs/guides/issue-file-format.md`)
|
|
2072
|
+
* @returns README 存根全文
|
|
2073
|
+
*/
|
|
2074
|
+
declare function renderRegistryReadmeStub(scopeTitle: string, guideRelPath: string): string;
|
|
2075
|
+
/**
|
|
2076
|
+
* 模板字段说明条目(template --format json 载荷)
|
|
2077
|
+
*/
|
|
2078
|
+
type TemplateFieldDoc = {
|
|
2079
|
+
/**
|
|
2080
|
+
* 字段名(渲染入参名或元信息键)
|
|
2081
|
+
*/
|
|
2082
|
+
name: string;
|
|
2083
|
+
/**
|
|
2084
|
+
* 是否必填
|
|
2085
|
+
*/
|
|
2086
|
+
required: boolean;
|
|
2087
|
+
/**
|
|
2088
|
+
* 字段说明
|
|
2089
|
+
*/
|
|
2090
|
+
description: string;
|
|
2091
|
+
};
|
|
2092
|
+
/**
|
|
2093
|
+
* 标准模板字段说明全集(供 agent / 使用者程序化消费)
|
|
2094
|
+
*/
|
|
2095
|
+
declare const TEMPLATE_FIELDS: readonly TemplateFieldDoc[];
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region src/triage/triage.classify.d.ts
|
|
2098
|
+
/**
|
|
2099
|
+
* 分诊类别
|
|
2100
|
+
*/
|
|
2101
|
+
type TriageCategory = 'A' | 'B' | 'C';
|
|
2102
|
+
/**
|
|
2103
|
+
* 分诊结果
|
|
2104
|
+
*/
|
|
2105
|
+
type TriageClassification = {
|
|
2106
|
+
/**
|
|
2107
|
+
* 类别
|
|
2108
|
+
*/
|
|
2109
|
+
category: TriageCategory;
|
|
2110
|
+
/**
|
|
2111
|
+
* 分类依据(中文说明)
|
|
2112
|
+
*/
|
|
2113
|
+
reason: string;
|
|
2114
|
+
};
|
|
2115
|
+
/**
|
|
2116
|
+
* 黄灯分诊分类
|
|
2117
|
+
*
|
|
2118
|
+
* @param record - 解析产物
|
|
2119
|
+
* @returns 分诊结果
|
|
2120
|
+
*/
|
|
2121
|
+
declare function classifyIssue(record: IssueDocRecord): TriageClassification;
|
|
2122
|
+
//#endregion
|
|
2123
|
+
export { ADJUDICATION_KEYWORD, ASCII_KEBAB_SLUG_PATTERN, AuditCoverageInput, BLOCKING_LINE_KEY, CANONICAL_STATUS_LABELS, CORE_LINT_RULES, CRITERIA_CHANNEL_PATTERN, CRITERIA_FENCE_CLOSE_PATTERN, CRITERIA_FENCE_OPEN_PATTERN, CloseBatchResult, CloseCaseResult, CloseGateResult, Criterion, CriterionCertificate, CriterionRunResult, DISPOSITION_PLACEHOLDER_PATTERN, DISPOSITION_PLACEHOLDER_WINDOW_LINES, DISPOSITION_TITLE_KEYWORD, DocRefCheckResult, DocRefViolation, DocsBaselineInput, DocsBaselineResult, DocsCheckInput, DocsFixInput, DocsFixResult, EVIDENCE_ANCHOR_MARKERS, EvidenceAnchor, EvidenceAnchorKind, EvidenceCloseInput, EvidenceReadResult, FreezeIssueInput, FreezeResult, GUIDE_FIXTURE_END_MARK, GUIDE_FIXTURE_START_MARK, GreenFlipInput, GreenFlipResult, HISTORY_LINE_KEY, HealthReport, ISSUES_KEY_RULE, ISSUE_FILE_FORMAT_GUIDE_RELATIVE, ISSUE_REF_TOKEN_PATTERN, IssueDocRecord, IssueRefToken, IssueStatusKind, IssueTemplatePriority, IssueTemplateRef, IssueTemplateValues, LintResult, LintRule, LintRuleContext, LintViolation, META_LINE_PREFIX_SOURCE_TEMPLATE, MiniGlobError, NextNumberInput, NextNumberResult, NormalizeHeaderFileInput, NormalizeHeaderResult, NormalizeOutcome, NormalizeResult, NumberingAllowlistEntry, NumberingAuditCommandInput, NumberingAuditFinding, NumberingAuditFindingKind, NumberingAuditResult, NumberingCheckCommandInput, NumberingCheckResult, NumberingFinding, NumberingFindingKind, NumberingKeyRule, NumberingNextCommandInput, NumberingNextResult, PENDING_REASON_PATTERN, ParsedCriteriaBlock, ParsedCriterion, PromptEntry, PromptsOptions, REGISTRY_FILE_PATTERN, RegistryFileNameParts, RerunCloseInput, RunCriterionInput, RunHealthInput, RunLintInput, RunLockHandle, RunTriageInput, RunTriageResult, STATUS_LINE_LOCATE_PATTERN, STATUS_LINE_PREFIX_SOURCE, STATUS_LINE_SCAN_LINES, ScopeScanInput, TEMPLATE_FIELDS, TemplateFieldDoc, TriageCategory, TriageClassification, TriageItem, TriageLedgerFile, UnfreezeIssueInput, WalkOptions, WriteLintBaselineInput, WriteLintBaselineResult, acquireRunLock, applyGreenFlip, auditCoverage, buildMetaLineLocatePattern, certificatePath, classifyIssue, classifyStatusLine, compileMiniGlob, computeCriterionFingerprint, computeNextNumber, deriveEntriesFromViolations, deriveWalkPrefixes, evidenceCloseFlow, extractFileKey, extractIssueRefTokens, extractSlugSegment, findCertificate, findPendingWord, freezeIssue, keyLeadingNumber, listPrompts, loadIssueFileFormatGuide, locateDispositionText, locateIssueFileFormatGuide, matchMiniGlob, normalizeHeader, normalizeHeaderFile, parseCriteriaBlock, parseIssueDoc, parseRegistryFileName, readEvidence, readEvidenceAnchors, readPendingReason, registerLintRulePack, renderCriteriaBlockExample, renderEvidenceCloseBlock, renderIssueTemplate, renderIssueTemplateSkeleton, renderRegistryReadmeStub, renderRerunEvidenceBlock, rerunCloseFlow, resolveCloseGates, runCriterionViaVault, runDocsCheck, runDocsFix, runHealth, runLint, runNumberingAudit, runNumberingCheck, runNumberingNext, runTriage, runWriteDocsBaseline, runWriteLintBaseline, scanOrphanSidecars, scanRegistryDir, scanScopeForFindings, showPrompt, sliceGuideFixtureSample, unfreezeIssue, walkFilesUnderPrefixes, walkFilesUnderRoots };
|