@dommaker/harness 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/bootstrap/bootstrap.d.ts +15 -0
- package/dist/bootstrap/bootstrap.js +18 -1
- package/dist/bootstrap/index.d.ts +2 -2
- package/dist/bootstrap/index.js +3 -2
- package/dist/cli/commands/acceptance.d.ts +8 -0
- package/dist/cli/commands/acceptance.js +45 -24
- package/dist/cli/commands/check.d.ts +2 -0
- package/dist/cli/commands/check.js +36 -5
- package/dist/cli/commands/command.js +1 -1
- package/dist/cli/commands/definitions.js +4 -1
- package/dist/cli/commands/release.d.ts +11 -3
- package/dist/cli/commands/release.js +159 -52
- package/dist/cli/commands/report.d.ts +2 -0
- package/dist/cli/commands/report.js +54 -6
- package/dist/cli/commands/security.d.ts +3 -3
- package/dist/cli/commands/security.js +3 -2
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +3 -40
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +5 -159
- package/dist/cli/commands/sync-docs/compact.js +2 -2
- package/dist/cli/commands/sync-docs/context-syncer.d.ts +4 -36
- package/dist/cli/commands/sync-docs/context-syncer.js +4 -221
- package/dist/cli/commands/sync-docs/index.d.ts +8 -8
- package/dist/cli/commands/sync-docs/index.js +8 -8
- package/dist/cli/commands/sync-docs/main-flow.d.ts +5 -4
- package/dist/cli/commands/sync-docs/main-flow.js +6 -5
- package/dist/cli/commands/sync-docs/sync-output.d.ts +1 -1
- package/dist/cli/commands/sync-docs/sync-output.js +4 -0
- package/dist/cli/commands/sync-docs/sync-writes.d.ts +1 -1
- package/dist/cli/commands/validate.d.ts +2 -0
- package/dist/cli/commands/validate.js +40 -1
- package/dist/core/command-execution-policy.d.ts +59 -0
- package/dist/core/command-execution-policy.js +167 -0
- package/dist/core/config-files.d.ts +8 -0
- package/dist/core/config-files.js +62 -0
- package/dist/core/constraints/capabilities-parser.d.ts +2 -1
- package/dist/core/constraints/capabilities-parser.js +2 -1
- package/dist/core/constraints/checker.d.ts +18 -6
- package/dist/core/constraints/checker.js +21 -11
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +14 -15
- package/dist/core/constraints/checkers/no-test-simplification.js +8 -6
- package/dist/core/constraints/checkers/templated/exec.d.ts +4 -0
- package/dist/core/constraints/checkers/templated/exec.js +11 -48
- package/dist/core/constraints/checkers/templated/file-exists.js +7 -4
- package/dist/core/constraints/checkers/templated/regex-scan.js +11 -15
- package/dist/core/constraints/checkers/types.d.ts +13 -2
- package/dist/core/constraints/checkers/types.js +5 -2
- package/dist/core/constraints/construction-sites.d.ts +1 -1
- package/dist/core/constraints/construction-sites.js +1 -1
- package/dist/core/constraints/definitions.d.ts +2 -2
- package/dist/core/constraints/definitions.js +2 -2
- package/dist/core/constraints/injection-writer.d.ts +1 -1
- package/dist/core/constraints/injection-writer.js +1 -1
- package/dist/core/constraints/project-snapshot.d.ts +43 -0
- package/dist/core/constraints/project-snapshot.js +103 -0
- package/dist/core/constraints/run-env.d.ts +35 -0
- package/dist/core/constraints/run-env.js +36 -0
- package/dist/{cli/commands/sync-docs → core/docs-sync}/agents-syncer.d.ts +2 -0
- package/dist/{cli/commands/sync-docs → core/docs-sync}/agents-syncer.js +5 -3
- package/dist/core/docs-sync/capabilities-table.d.ts +46 -0
- package/dist/core/docs-sync/capabilities-table.js +200 -0
- package/dist/core/docs-sync/context-collector.d.ts +40 -0
- package/dist/core/docs-sync/context-collector.js +227 -0
- package/dist/{cli/commands/sync-docs → core/docs-sync}/project-reader.d.ts +5 -1
- package/dist/{cli/commands/sync-docs → core/docs-sync}/project-reader.js +10 -6
- package/dist/{cli/commands/sync-docs → core/docs-sync}/sync-state.d.ts +15 -9
- package/dist/{cli/commands/sync-docs → core/docs-sync}/sync-state.js +26 -29
- package/dist/core/effective-constraints.d.ts +1 -1
- package/dist/core/effective-constraints.js +1 -1
- package/dist/core/validators/check-handlers/command.js +22 -0
- package/dist/core/validators/check-handlers/output.js +26 -3
- package/dist/core/validators/checkpoint.d.ts +4 -0
- package/dist/core/validators/checkpoint.js +10 -2
- package/dist/gates/acceptance.d.ts +8 -4
- package/dist/gates/acceptance.js +76 -14
- package/dist/gates/command.d.ts +3 -4
- package/dist/gates/command.js +2 -3
- package/dist/gates/contract.d.ts +3 -4
- package/dist/gates/contract.js +0 -1
- package/dist/gates/definitions.d.ts +2 -4
- package/dist/gates/definitions.js +2 -8
- package/dist/gates/performance.d.ts +10 -4
- package/dist/gates/performance.js +49 -5
- package/dist/gates/review.d.ts +3 -4
- package/dist/gates/review.js +0 -1
- package/dist/gates/security.d.ts +3 -4
- package/dist/gates/security.js +26 -19
- package/dist/gates/types.d.ts +46 -19
- package/dist/index.d.ts +5 -4
- package/dist/index.js +9 -6
- package/dist/knowledge/index.d.ts +1 -1
- package/dist/knowledge/index.js +1 -2
- package/dist/knowledge/ingest.d.ts +32 -17
- package/dist/knowledge/ingest.js +188 -90
- package/dist/knowledge/lifecycle.d.ts +15 -0
- package/dist/knowledge/lifecycle.js +62 -0
- package/dist/knowledge/query.d.ts +11 -1
- package/dist/knowledge/query.js +61 -9
- package/dist/knowledge/store.d.ts +56 -3
- package/dist/knowledge/store.js +108 -30
- package/dist/monitoring/index.d.ts +2 -1
- package/dist/monitoring/index.js +3 -1
- package/dist/monitoring/traces.d.ts +12 -0
- package/dist/monitoring/traces.js +26 -4
- package/dist/types/checkpoint.d.ts +28 -1
- package/dist/types/command-execution-policy.d.ts +73 -0
- package/dist/types/command-execution-policy.js +16 -0
- package/dist/types/constraint.d.ts +0 -12
- package/dist/utils/exec.d.ts +7 -1
- package/dist/utils/exec.js +7 -1
- package/package.json +1 -1
- package/dist/core/constraints/check-cache.d.ts +0 -43
- package/dist/core/constraints/check-cache.js +0 -77
- package/dist/core/constraints/checkers/templated/glob.d.ts +0 -8
- package/dist/core/constraints/checkers/templated/glob.js +0 -14
- /package/dist/{cli/commands/sync-docs → core/docs-sync}/preserve-block.d.ts +0 -0
- /package/dist/{cli/commands/sync-docs → core/docs-sync}/preserve-block.js +0 -0
package/dist/utils/exec.js
CHANGED
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
* 通用工具模块
|
|
4
4
|
*
|
|
5
5
|
* 提供命令执行的公共函数,减少各子系统重复代码。
|
|
6
|
+
* 两个出口分工:`execAsync` = shell 字符串(仅消费方自己控制完整命令串时用);
|
|
7
|
+
* `execFileAsync` = argv 数组(外部路径/参数不经 shell 插值,P0.3 起的外部输入一律走这里)。
|
|
6
8
|
* 约束域谓词不在本模块(harness#137:`normalizeTriggers`/`matchesTrigger` 已迁
|
|
7
9
|
* `core/constraints/triggers.ts`;`isCommandAvailable`/`delay` 双仓零生产消费者,已删;
|
|
8
10
|
* `runCommand` 零生产调用点且不在包公共面,按 ADR-0022 同判据随 harness#162 删除)。
|
|
9
11
|
*/
|
|
10
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.execAsync = void 0;
|
|
13
|
+
exports.execFileAsync = exports.execAsync = void 0;
|
|
12
14
|
const child_process_1 = require("child_process");
|
|
13
15
|
const util_1 = require("util");
|
|
14
16
|
/**
|
|
15
17
|
* Promisified exec
|
|
16
18
|
*/
|
|
17
19
|
exports.execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
20
|
+
/**
|
|
21
|
+
* Promisified execFile(argv 形状,不经 shell)
|
|
22
|
+
*/
|
|
23
|
+
exports.execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CheckCache — 约束检查缓存(S7)
|
|
3
|
-
*
|
|
4
|
-
* 缓存 git diff 和 src/ 递归扫描结果,减少重复 I/O。
|
|
5
|
-
* 同一请求内多次 checkConstraints 调用共享缓存。
|
|
6
|
-
*
|
|
7
|
-
* 用法:
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const cache = new CheckCache({ ttlMs: 5000 });
|
|
10
|
-
* const diff = await cache.get('git_diff', projectPath, () => createGitEvidence(projectPath).stagedDiff());
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* CheckCache 构造配置
|
|
15
|
-
*/
|
|
16
|
-
export interface CheckCacheConfig {
|
|
17
|
-
/** 缓存 TTL(毫秒),默认 5000 */
|
|
18
|
-
ttlMs: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 约束检查缓存:TTL 缓存
|
|
22
|
-
*/
|
|
23
|
-
export declare class CheckCache {
|
|
24
|
-
private store;
|
|
25
|
-
private ttlMs;
|
|
26
|
-
constructor(config?: CheckCacheConfig);
|
|
27
|
-
/**
|
|
28
|
-
* 获取缓存值(miss 时执行 fn 并缓存结果)
|
|
29
|
-
*
|
|
30
|
-
* @param namespace 命名空间(如 'git_diff', 'src_scan')
|
|
31
|
-
* @param key 缓存键(如 projectPath)
|
|
32
|
-
* @param fn miss 时的计算函数
|
|
33
|
-
*/
|
|
34
|
-
get<T>(namespace: string, key: string, fn: () => Promise<T>): Promise<T>;
|
|
35
|
-
/**
|
|
36
|
-
* 同步版本(用于 readdirSync 等同步操作)
|
|
37
|
-
*/
|
|
38
|
-
getSync<T>(namespace: string, key: string, fn: () => T): T;
|
|
39
|
-
/**
|
|
40
|
-
* 使指定命名空间缓存失效
|
|
41
|
-
*/
|
|
42
|
-
invalidate(namespace?: string): void;
|
|
43
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CheckCache — 约束检查缓存(S7)
|
|
4
|
-
*
|
|
5
|
-
* 缓存 git diff 和 src/ 递归扫描结果,减少重复 I/O。
|
|
6
|
-
* 同一请求内多次 checkConstraints 调用共享缓存。
|
|
7
|
-
*
|
|
8
|
-
* 用法:
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const cache = new CheckCache({ ttlMs: 5000 });
|
|
11
|
-
* const diff = await cache.get('git_diff', projectPath, () => createGitEvidence(projectPath).stagedDiff());
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CheckCache = void 0;
|
|
16
|
-
/**
|
|
17
|
-
* 约束检查缓存:TTL 缓存
|
|
18
|
-
*/
|
|
19
|
-
class CheckCache {
|
|
20
|
-
store = new Map();
|
|
21
|
-
ttlMs;
|
|
22
|
-
constructor(config) {
|
|
23
|
-
this.ttlMs = config?.ttlMs ?? 5000;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 获取缓存值(miss 时执行 fn 并缓存结果)
|
|
27
|
-
*
|
|
28
|
-
* @param namespace 命名空间(如 'git_diff', 'src_scan')
|
|
29
|
-
* @param key 缓存键(如 projectPath)
|
|
30
|
-
* @param fn miss 时的计算函数
|
|
31
|
-
*/
|
|
32
|
-
async get(namespace, key, fn) {
|
|
33
|
-
const cacheKey = `${namespace}:${key}`;
|
|
34
|
-
const entry = this.store.get(cacheKey);
|
|
35
|
-
if (entry && Date.now() < entry.expiresAt) {
|
|
36
|
-
return entry.value;
|
|
37
|
-
}
|
|
38
|
-
const value = await fn();
|
|
39
|
-
this.store.set(cacheKey, {
|
|
40
|
-
value,
|
|
41
|
-
expiresAt: Date.now() + this.ttlMs,
|
|
42
|
-
});
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 同步版本(用于 readdirSync 等同步操作)
|
|
47
|
-
*/
|
|
48
|
-
getSync(namespace, key, fn) {
|
|
49
|
-
const cacheKey = `${namespace}:${key}`;
|
|
50
|
-
const entry = this.store.get(cacheKey);
|
|
51
|
-
if (entry && Date.now() < entry.expiresAt) {
|
|
52
|
-
return entry.value;
|
|
53
|
-
}
|
|
54
|
-
const value = fn();
|
|
55
|
-
this.store.set(cacheKey, {
|
|
56
|
-
value,
|
|
57
|
-
expiresAt: Date.now() + this.ttlMs,
|
|
58
|
-
});
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 使指定命名空间缓存失效
|
|
63
|
-
*/
|
|
64
|
-
invalidate(namespace) {
|
|
65
|
-
if (namespace) {
|
|
66
|
-
for (const key of this.store.keys()) {
|
|
67
|
-
if (key.startsWith(`${namespace}:`)) {
|
|
68
|
-
this.store.delete(key);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.store.clear();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.CheckCache = CheckCache;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 模板侧轻量 glob 匹配(支持 `**`、`*`、`?`,纯字符串判定,不碰文件系统)
|
|
3
|
-
*
|
|
4
|
-
* glob→正则正本在 `utils/glob-match.ts`(与 completion-checkers 同一匹配语义,
|
|
5
|
-
* utils 下游白名单内,分层守卫(harness#88)不违)。
|
|
6
|
-
*/
|
|
7
|
-
/** 单 glob 匹配(相对路径正斜杠口径) */
|
|
8
|
-
export declare function matchGlob(file: string, glob: string): boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 模板侧轻量 glob 匹配(支持 `**`、`*`、`?`,纯字符串判定,不碰文件系统)
|
|
4
|
-
*
|
|
5
|
-
* glob→正则正本在 `utils/glob-match.ts`(与 completion-checkers 同一匹配语义,
|
|
6
|
-
* utils 下游白名单内,分层守卫(harness#88)不违)。
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.matchGlob = matchGlob;
|
|
10
|
-
const glob_match_1 = require("../../../../utils/glob-match");
|
|
11
|
-
/** 单 glob 匹配(相对路径正斜杠口径) */
|
|
12
|
-
function matchGlob(file, glob) {
|
|
13
|
-
return (0, glob_match_1.globToRegExp)(glob).test(file);
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|