@dommaker/harness 0.14.0 → 0.16.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 +11 -0
- package/dist/cli/commands/knowledge.js +6 -6
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +43 -6
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/core/constraints/checker.js +1 -1
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +30 -24
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +1 -1
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/doctor.d.ts +1 -1
- package/dist/knowledge/doctor.d.ts.map +1 -1
- package/dist/knowledge/import.d.ts +1 -1
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/index.d.ts +2 -1
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +2 -2
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +1 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/lifecycle-hooks.d.ts +1 -1
- package/dist/knowledge/lifecycle-hooks.d.ts.map +1 -1
- package/dist/knowledge/lifecycle.d.ts +1 -1
- package/dist/knowledge/lifecycle.d.ts.map +1 -1
- package/dist/knowledge/lint.d.ts +1 -1
- package/dist/knowledge/lint.d.ts.map +1 -1
- package/dist/knowledge/lint.js +1 -1
- package/dist/knowledge/lint.js.map +1 -1
- package/dist/knowledge/query.d.ts +1 -1
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/reference-tracker.d.ts +1 -1
- package/dist/knowledge/reference-tracker.d.ts.map +1 -1
- package/dist/knowledge/store.d.ts +29 -2
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +10 -5
- package/dist/knowledge/store.js.map +1 -1
- package/dist/knowledge/types.d.ts +14 -0
- package/dist/knowledge/types.d.ts.map +1 -1
- package/dist/monitoring/knowledge-evolver.d.ts +1 -1
- package/dist/monitoring/knowledge-evolver.d.ts.map +1 -1
- package/dist/types/constraint.d.ts +1 -1
- package/dist/types/constraint.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/checker.test.ts +4 -4
- package/src/cli/commands/__tests__/knowledge.test.ts +1 -1
- package/src/cli/commands/knowledge.ts +1 -1
- package/src/cli/commands/release.ts +44 -6
- package/src/context/__tests__/knowledge-injector.test.ts +1 -1
- package/src/core/constraints/checker.ts +1 -1
- package/src/core/constraints/definitions.ts +31 -25
- package/src/knowledge/__tests__/audit.test.ts +1 -1
- package/src/knowledge/__tests__/doctor.test.ts +1 -1
- package/src/knowledge/__tests__/import.test.ts +1 -1
- package/src/knowledge/__tests__/ingest.test.ts +1 -1
- package/src/knowledge/__tests__/lifecycle-hooks.test.ts +1 -1
- package/src/knowledge/__tests__/lifecycle.test.ts +1 -1
- package/src/knowledge/__tests__/lint.test.ts +1 -1
- package/src/knowledge/__tests__/query.test.ts +1 -1
- package/src/knowledge/__tests__/reference-tracker.test.ts +1 -1
- package/src/knowledge/__tests__/store.test.ts +1 -1
- package/src/knowledge/audit.ts +3 -2
- package/src/knowledge/doctor.ts +1 -1
- package/src/knowledge/import.ts +1 -1
- package/src/knowledge/index.ts +2 -1
- package/src/knowledge/ingest.ts +1 -1
- package/src/knowledge/lifecycle-hooks.ts +1 -1
- package/src/knowledge/lifecycle.ts +1 -1
- package/src/knowledge/lint.ts +2 -2
- package/src/knowledge/query.ts +1 -1
- package/src/knowledge/reference-tracker.ts +1 -1
- package/src/knowledge/store.ts +27 -4
- package/src/knowledge/types.ts +17 -0
- package/src/monitoring/knowledge-evolver.ts +1 -1
- package/src/types/constraint.ts +1 -1
- package/dist/cli/commands/diagnose.d.ts +0 -16
- package/dist/cli/commands/diagnose.d.ts.map +0 -1
- package/dist/cli/commands/diagnose.js +0 -195
- package/dist/cli/commands/diagnose.js.map +0 -1
- package/dist/cli/commands/propose.d.ts +0 -18
- package/dist/cli/commands/propose.d.ts.map +0 -1
- package/dist/cli/commands/propose.js +0 -331
- package/dist/cli/commands/propose.js.map +0 -1
- package/dist/cli/commands/traces.d.ts +0 -15
- package/dist/cli/commands/traces.d.ts.map +0 -1
- package/dist/cli/commands/traces.js +0 -167
- package/dist/cli/commands/traces.js.map +0 -1
- package/dist/constraints/definitions.d.ts +0 -39
- package/dist/constraints/definitions.d.ts.map +0 -1
- package/dist/constraints/definitions.js +0 -71
- package/dist/constraints/definitions.js.map +0 -1
- package/dist/constraints/quality.d.ts +0 -11
- package/dist/constraints/quality.d.ts.map +0 -1
- package/dist/constraints/quality.js +0 -257
- package/dist/constraints/quality.js.map +0 -1
- package/dist/constraints/safety.d.ts +0 -13
- package/dist/constraints/safety.d.ts.map +0 -1
- package/dist/constraints/safety.js +0 -103
- package/dist/constraints/safety.js.map +0 -1
- package/dist/extensions/long-running/constraints.d.ts +0 -38
- package/dist/extensions/long-running/constraints.d.ts.map +0 -1
- package/dist/extensions/long-running/constraints.js +0 -153
- package/dist/extensions/long-running/constraints.js.map +0 -1
- package/dist/extensions/long-running/index.d.ts +0 -30
- package/dist/extensions/long-running/index.d.ts.map +0 -1
- package/dist/extensions/long-running/index.js +0 -50
- package/dist/extensions/long-running/index.js.map +0 -1
- package/dist/extensions/long-running/types.d.ts +0 -154
- package/dist/extensions/long-running/types.d.ts.map +0 -1
- package/dist/extensions/long-running/types.js +0 -9
- package/dist/extensions/long-running/types.js.map +0 -1
- package/dist/presets/long-running.d.ts +0 -33
- package/dist/presets/long-running.d.ts.map +0 -1
- package/dist/presets/long-running.js +0 -52
- package/dist/presets/long-running.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint.d.ts","sourceRoot":"","sources":["../../src/types/constraint.ts"],"names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B,EAAE,CAAC;IAE/B,kBAAkB;IAClB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAEzB,mBAAmB;IACnB,MAAM,EAAE,OAAO,CAAC;IAEhB,WAAW;IACX,YAAY,EAAE,MAAM,CAAC;IAErB,WAAW;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/package.json
CHANGED
|
@@ -1113,19 +1113,19 @@ describe('ConstraintChecker', () => {
|
|
|
1113
1113
|
expect(result.satisfied).toBe(false);
|
|
1114
1114
|
});
|
|
1115
1115
|
|
|
1116
|
-
it('
|
|
1116
|
+
it('prefer_worktree should pass with worktree', async () => {
|
|
1117
1117
|
const context: ConstraintContext = { operation: 'code_implementation', hasWorktree: true };
|
|
1118
1118
|
const result = await checker.check(
|
|
1119
|
-
{ id: '
|
|
1119
|
+
{ id: 'prefer_worktree', level: 'guideline', rule: 'WORKTREE', message: 'test', trigger: 'code_implementation', enforcement: 'test' },
|
|
1120
1120
|
context
|
|
1121
1121
|
);
|
|
1122
1122
|
expect(result.satisfied).toBe(true);
|
|
1123
1123
|
});
|
|
1124
1124
|
|
|
1125
|
-
it('
|
|
1125
|
+
it('prefer_worktree should fail without worktree', async () => {
|
|
1126
1126
|
const context: ConstraintContext = { operation: 'code_implementation', hasWorktree: false };
|
|
1127
1127
|
const result = await checker.check(
|
|
1128
|
-
{ id: '
|
|
1128
|
+
{ id: 'prefer_worktree', level: 'guideline', rule: 'WORKTREE', message: 'test', trigger: 'code_implementation', enforcement: 'test' },
|
|
1129
1129
|
context
|
|
1130
1130
|
);
|
|
1131
1131
|
expect(result.satisfied).toBe(false);
|
|
@@ -68,7 +68,7 @@ describe('getKnowledgeDir', () => {
|
|
|
68
68
|
|
|
69
69
|
beforeEach(() => {
|
|
70
70
|
delete process.env.KNOWLEDGE_BASE_DIR;
|
|
71
|
-
storeCtorSpy = jest.spyOn(storeModule, '
|
|
71
|
+
storeCtorSpy = jest.spyOn(storeModule, 'FileKnowledgeStore').mockImplementation(() => ({
|
|
72
72
|
list: jest.fn().mockReturnValue([]),
|
|
73
73
|
}));
|
|
74
74
|
});
|
|
@@ -8,7 +8,7 @@ import chalk from 'chalk';
|
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as os from 'os';
|
|
10
10
|
import * as path from 'path';
|
|
11
|
-
import { KnowledgeStore } from '../../knowledge/store';
|
|
11
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../../knowledge/store';
|
|
12
12
|
import { KnowledgeQuery } from '../../knowledge/query';
|
|
13
13
|
import { KnowledgeLifecycle } from '../../knowledge/lifecycle';
|
|
14
14
|
import { ColdStartImporter } from '../../knowledge/import';
|
|
@@ -44,7 +44,26 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
44
44
|
console.log(chalk.cyan(`📦 ${pkgName}@${oldVersion}`));
|
|
45
45
|
console.log(chalk.cyan(` bump: ${bumpType}${dryRun ? ' (dry-run)' : ''}`));
|
|
46
46
|
|
|
47
|
-
// ── 2. Check
|
|
47
|
+
// ── 2. Check branch (must be on master/main) ──
|
|
48
|
+
const branchResult = await run('git rev-parse --abbrev-ref HEAD', pkgPath);
|
|
49
|
+
const currentBranch = branchResult.stdout.trim();
|
|
50
|
+
if (currentBranch !== 'master' && currentBranch !== 'main') {
|
|
51
|
+
console.error(chalk.red(`❌ Must be on master or main branch to release. Currently on: ${currentBranch}`));
|
|
52
|
+
console.error(chalk.gray(' Run: git checkout master && git merge ' + currentBranch));
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
console.log(chalk.green(`✅ git: on ${currentBranch}`));
|
|
56
|
+
|
|
57
|
+
// ── 2b. Check remote sync ──
|
|
58
|
+
await run('git fetch origin', pkgPath, 15_000);
|
|
59
|
+
const behind = await run(`git rev-list --count HEAD..origin/${currentBranch}`, pkgPath);
|
|
60
|
+
if (behind.stdout.trim() !== '0') {
|
|
61
|
+
console.error(chalk.red(`❌ Local ${currentBranch} is ${behind.stdout.trim()} commits behind origin/${currentBranch}. Pull first.`));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
console.log(chalk.green('✅ git: synced with remote'));
|
|
65
|
+
|
|
66
|
+
// ── 2c. Check clean working tree ──
|
|
48
67
|
const stat = await run('git status --porcelain -uno', pkgPath);
|
|
49
68
|
if (stat.stdout.length > 0) {
|
|
50
69
|
console.error(chalk.red('❌ Uncommitted changes. Commit or stash before releasing.'));
|
|
@@ -98,6 +117,18 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
98
117
|
// ── 5. Bump version (npm version creates git commit + tag atomically,
|
|
99
118
|
// including package-lock.json — no desync possible) ──
|
|
100
119
|
console.log(chalk.cyan('🔢 Bumping version...'));
|
|
120
|
+
const [major, minor, patch] = oldVersion.split('.').map(Number);
|
|
121
|
+
let expectedNew: string;
|
|
122
|
+
if (bumpType === 'major') expectedNew = `${major + 1}.0.0`;
|
|
123
|
+
else if (bumpType === 'minor') expectedNew = `${major}.${minor + 1}.0`;
|
|
124
|
+
else expectedNew = `${major}.${minor}.${patch + 1}`;
|
|
125
|
+
const expectedTag = `v${expectedNew}`;
|
|
126
|
+
const tagExists = await run(`git tag -l "${expectedTag}"`, pkgPath);
|
|
127
|
+
if (tagExists.stdout.trim() === expectedTag) {
|
|
128
|
+
console.error(chalk.red(`❌ Tag ${expectedTag} already exists. Version may have been released already.`));
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
101
132
|
const bump = await run(`npm version ${bumpType} -m "release: %s"`, pkgPath);
|
|
102
133
|
if (bump.stderr && !bump.stdout) {
|
|
103
134
|
console.error(chalk.red('❌ npm version failed:'), bump.stderr);
|
|
@@ -107,10 +138,9 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
107
138
|
const tag = `v${newVersion}`;
|
|
108
139
|
console.log(chalk.green(`✅ version: ${oldVersion} → ${newVersion} (committed + tagged)`));
|
|
109
140
|
|
|
110
|
-
// ──
|
|
141
|
+
// ── 6. Push ──
|
|
111
142
|
console.log(chalk.cyan('⬆️ Pushing...'));
|
|
112
|
-
const
|
|
113
|
-
const push = await run(`git push origin ${branch.stdout}`, pkgPath, 30_000);
|
|
143
|
+
const push = await run(`git push origin ${currentBranch}`, pkgPath, 30_000);
|
|
114
144
|
if (push.stderr && push.stderr.includes('error')) {
|
|
115
145
|
console.error(chalk.red('❌ git push failed:'), push.stderr.slice(0, 500));
|
|
116
146
|
process.exit(1);
|
|
@@ -118,7 +148,15 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
118
148
|
await run(`git push origin ${tag}`, pkgPath, 30_000);
|
|
119
149
|
console.log(chalk.green('✅ git: pushed'));
|
|
120
150
|
|
|
121
|
-
// ── 8.
|
|
151
|
+
// ── 8. Check private flag ──
|
|
152
|
+
if (pkgJson.private) {
|
|
153
|
+
console.error(chalk.red('❌ package.json has "private": true. Remove it before publishing.'));
|
|
154
|
+
console.error(chalk.gray(' The release tool will NOT auto-remove private flag.'));
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
console.log(chalk.green('✅ package: not private'));
|
|
158
|
+
|
|
159
|
+
// ── 7. npm publish ──
|
|
122
160
|
// Switch to npmjs.org for publishing (npmmirror is read-only mirror)
|
|
123
161
|
const origRegistry = await run('npm config get registry', pkgPath);
|
|
124
162
|
await run('npm config set registry https://registry.npmjs.org/', pkgPath);
|
|
@@ -136,7 +174,7 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
136
174
|
process.exit(1);
|
|
137
175
|
}
|
|
138
176
|
|
|
139
|
-
// ──
|
|
177
|
+
// ── 8. GitHub Release ──
|
|
140
178
|
console.log(chalk.cyan('🐙 Creating GitHub Release...'));
|
|
141
179
|
const gh = await run(`gh release create ${tag} --generate-notes`, pkgPath, 30_000);
|
|
142
180
|
if (gh.stderr && gh.stderr.includes('already exists')) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { KnowledgeInjector } from '../knowledge-injector';
|
|
6
6
|
import { KnowledgeQuery } from '../../knowledge/query';
|
|
7
|
-
import { KnowledgeStore } from '../../knowledge/store';
|
|
7
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../../knowledge/store';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import * as os from 'os';
|
|
@@ -238,31 +238,6 @@ https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agent
|
|
|
238
238
|
promptInjection: '开始编写代码前,必须确认:需求来源明确(Spec/Issue/Roadmap/用户指令)、验收标准(AC)已定义、边界情况已明确。不要凭假设或猜测开始实现。',
|
|
239
239
|
},
|
|
240
240
|
|
|
241
|
-
/**
|
|
242
|
-
* 必须在 worktree 中开发
|
|
243
|
-
* 原因:隔离工作区,安全回滚,并行开发
|
|
244
|
-
* 来源:Superpowers must_use_worktree
|
|
245
|
-
*/
|
|
246
|
-
must_use_worktree: {
|
|
247
|
-
id: 'must_use_worktree',
|
|
248
|
-
rule: 'CODE CHANGES MUST BE ISOLATED IN A WORKTREE',
|
|
249
|
-
message: '代码开发必须在隔离的 worktree 中进行',
|
|
250
|
-
level: 'iron_law',
|
|
251
|
-
trigger: ['code_implementation'],
|
|
252
|
-
enforcement: 'check-worktree',
|
|
253
|
-
description: `所有代码修改必须在隔离的 worktree 中进行,不要在原始仓库目录直接编辑。
|
|
254
|
-
|
|
255
|
-
【原因】
|
|
256
|
-
- 隔离风险:worktree 中的改动不会影响主工作区
|
|
257
|
-
- 安全回滚:删除 worktree 即可放弃改动
|
|
258
|
-
- 并行开发:多个任务可同时在不同 worktree 中进行
|
|
259
|
-
|
|
260
|
-
【禁止】
|
|
261
|
-
- 在原始仓库目录直接编辑文件
|
|
262
|
-
- 跳过 worktree 创建直接执行 Agent`,
|
|
263
|
-
promptInjection: '所有代码修改必须在隔离的 worktree 中进行。不要在原始仓库目录直接编辑文件。worktree 提供了安全回滚和并行开发能力。如果你发现不在 worktree 中,立即停止并要求创建 worktree。',
|
|
264
|
-
},
|
|
265
|
-
|
|
266
241
|
/**
|
|
267
242
|
* 禁止模糊完成声明
|
|
268
243
|
* 原因:质量底线,必须有可量化证据
|
|
@@ -371,6 +346,37 @@ https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agent
|
|
|
371
346
|
// ========================================
|
|
372
347
|
|
|
373
348
|
export const GUIDELINES: Record<string, Constraint> = {
|
|
349
|
+
/**
|
|
350
|
+
* 高风险改动优先使用 worktree
|
|
351
|
+
* 原因:隔离工作区,安全回滚,并行开发
|
|
352
|
+
* 来源:Superpowers prefer_worktree
|
|
353
|
+
*/
|
|
354
|
+
prefer_worktree: {
|
|
355
|
+
id: 'prefer_worktree',
|
|
356
|
+
rule: 'USE WORKTREE FOR HIGH-RISK CHANGES',
|
|
357
|
+
message: '高风险改动应在 worktree 中进行',
|
|
358
|
+
level: 'guideline',
|
|
359
|
+
trigger: ['code_implementation'],
|
|
360
|
+
enforcement: 'check-worktree',
|
|
361
|
+
description: `高风险改动应在隔离的 worktree 中进行。
|
|
362
|
+
|
|
363
|
+
【何时需要 worktree】
|
|
364
|
+
- 新功能开发(新增模块/API)
|
|
365
|
+
- 跨模块改动(>3 文件)
|
|
366
|
+
- 基础设施变更(CI/CD、依赖)
|
|
367
|
+
|
|
368
|
+
【何时不需要】
|
|
369
|
+
- 配置文件修改
|
|
370
|
+
- 单文件 bug fix
|
|
371
|
+
- 外科手术式修复(typo、missing import)
|
|
372
|
+
|
|
373
|
+
【原因】
|
|
374
|
+
- 隔离风险:worktree 中的改动不会影响主工作区
|
|
375
|
+
- 安全回滚:删除 worktree 即可放弃改动
|
|
376
|
+
- 并行开发:多个任务可同时在不同 worktree 中进行`,
|
|
377
|
+
promptInjection: '高风险改动(新功能、跨模块、基础设施)应在 worktree 中进行。配置修改、单文件 fix 可直接编辑。',
|
|
378
|
+
},
|
|
379
|
+
|
|
374
380
|
/**
|
|
375
381
|
* 禁止无调查修复 bug
|
|
376
382
|
* 例外:简单 typo、配置错误
|
|
@@ -14,7 +14,7 @@ import * as fs from 'fs';
|
|
|
14
14
|
import * as path from 'path';
|
|
15
15
|
import * as os from 'os';
|
|
16
16
|
import { KnowledgeAudit } from '../audit';
|
|
17
|
-
import { KnowledgeStore } from '../store';
|
|
17
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
18
18
|
import type { KnowledgeEntry } from '../types';
|
|
19
19
|
|
|
20
20
|
function makeTmpDir(): string {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
-
import { KnowledgeStore } from '../store';
|
|
7
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
8
8
|
import { KnowledgeLinter, type LintReport } from '../lint';
|
|
9
9
|
import { ReferenceTracker } from '../reference-tracker';
|
|
10
10
|
import { KnowledgeHealthScorer } from '../doctor';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { KnowledgeIngest } from '../ingest';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { KnowledgeLifecycleHooks } from '../lifecycle-hooks';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { KnowledgeQuery } from '../query';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { KnowledgeLifecycle } from '../lifecycle';
|
|
8
8
|
import type { KnowledgeEntry } from '../types';
|
|
9
9
|
import * as fs from 'fs';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { KnowledgeLinter } from '../lint';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { ReferenceTracker } from '../reference-tracker';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { KnowledgeQuery } from '../query';
|
|
8
8
|
import type { KnowledgeEntry, QueryBudget } from '../types';
|
|
9
9
|
import * as fs from 'fs';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import { ReferenceTracker } from '../reference-tracker';
|
|
8
8
|
import type { KnowledgeEntry } from '../types';
|
|
9
9
|
import * as fs from 'fs';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
6
|
-
import { KnowledgeStore } from '../store';
|
|
6
|
+
import { FileKnowledgeStore as KnowledgeStore } from '../store';
|
|
7
7
|
import type { KnowledgeEntry } from '../types';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import * as path from 'path';
|
package/src/knowledge/audit.ts
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
import * as fs from 'fs';
|
|
13
13
|
import * as path from 'path';
|
|
14
|
-
import {
|
|
14
|
+
import { FileKnowledgeStore } from './store';
|
|
15
|
+
import type { KnowledgeStore } from './store';
|
|
15
16
|
import type { KnowledgeEntry, MaturityLevel } from './types';
|
|
16
17
|
|
|
17
18
|
// ── Types ─────────────────────────────────────────────────
|
|
@@ -300,7 +301,7 @@ export class KnowledgeAudit {
|
|
|
300
301
|
private promotionBlockDays: number;
|
|
301
302
|
|
|
302
303
|
constructor(options?: AuditOptions) {
|
|
303
|
-
this.store = new
|
|
304
|
+
this.store = new FileKnowledgeStore({ baseDir: options?.baseDir });
|
|
304
305
|
this.shortContentThreshold = options?.shortContentThreshold ?? DEFAULT_SHORT_CONTENT_THRESHOLD;
|
|
305
306
|
this.staleDays = options?.staleDays ?? DEFAULT_STALE_DAYS;
|
|
306
307
|
this.promotionBlockDays = options?.promotionBlockDays ?? DEFAULT_PROMOTION_BLOCK_DAYS;
|
package/src/knowledge/doctor.ts
CHANGED
package/src/knowledge/import.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import * as fs from 'fs';
|
|
15
15
|
import * as path from 'path';
|
|
16
16
|
import type { KnowledgeEntry, KnowledgeType, MaturityLevel, StorageLayer } from './types';
|
|
17
|
-
import { KnowledgeStore } from './store';
|
|
17
|
+
import type { KnowledgeStore } from './store';
|
|
18
18
|
|
|
19
19
|
// ── 导入源 ───────────────────────────────────────────────
|
|
20
20
|
|
package/src/knowledge/index.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export * from './types';
|
|
8
|
-
export { KnowledgeStore } from './store';
|
|
8
|
+
export type { KnowledgeStore } from './store';
|
|
9
|
+
export { FileKnowledgeStore } from './store';
|
|
9
10
|
export { KnowledgeQuery } from './query';
|
|
10
11
|
export { KnowledgeLifecycle } from './lifecycle';
|
|
11
12
|
export type { ConsumptionEvent } from './lifecycle';
|
package/src/knowledge/ingest.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { KnowledgeEntry, KnowledgeType } from './types';
|
|
10
|
-
import { KnowledgeStore } from './store';
|
|
10
|
+
import type { KnowledgeStore } from './store';
|
|
11
11
|
import { KnowledgeQuery } from './query';
|
|
12
12
|
import type { ContextSource } from '../context/types';
|
|
13
13
|
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
DecayConfig,
|
|
13
13
|
} from './types';
|
|
14
14
|
import { DEFAULT_DECAY_CONFIG } from './types';
|
|
15
|
-
import { KnowledgeStore } from './store';
|
|
15
|
+
import type { KnowledgeStore } from './store';
|
|
16
16
|
|
|
17
17
|
const MAX_REFERENCED_BY = 20;
|
|
18
18
|
const MIN_CONTENT_FOR_PROVEN = 100;
|
package/src/knowledge/lint.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - 成熟度衰减
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { KnowledgeStore } from './store';
|
|
13
|
+
import type { KnowledgeStore } from './store';
|
|
14
14
|
import { ReferenceTracker } from './reference-tracker';
|
|
15
15
|
import type { KnowledgeEntry, LintIssue, LintIssueType, MaturityLevel } from './types';
|
|
16
16
|
|
|
@@ -79,7 +79,7 @@ export class KnowledgeLinter {
|
|
|
79
79
|
*/
|
|
80
80
|
checkIndexConsistency(entries: KnowledgeEntry[]): LintIssue[] {
|
|
81
81
|
const issues: LintIssue[] = [];
|
|
82
|
-
const index = this.store
|
|
82
|
+
const index = this.store.readIndex();
|
|
83
83
|
|
|
84
84
|
// 检查索引中的条目是否都有对应文件
|
|
85
85
|
for (const indexEntry of index) {
|
package/src/knowledge/query.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
QueryFilter,
|
|
17
17
|
IndexEntry,
|
|
18
18
|
} from './types';
|
|
19
|
-
import { KnowledgeStore } from './store';
|
|
19
|
+
import type { KnowledgeStore } from './store';
|
|
20
20
|
import { KnowledgeLifecycle } from './lifecycle';
|
|
21
21
|
|
|
22
22
|
// ── Constants ──────────────────────────────────────────────
|
package/src/knowledge/store.ts
CHANGED
|
@@ -22,7 +22,30 @@ const DEFAULT_CONFIG: StoreConfig = {
|
|
|
22
22
|
baseDir: DEFAULT_DIR,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* KnowledgeStore interface — abstract contract for knowledge storage.
|
|
27
|
+
*/
|
|
28
|
+
export interface KnowledgeStore {
|
|
29
|
+
getBaseDir(): string;
|
|
30
|
+
get(id: string): KnowledgeEntry | undefined;
|
|
31
|
+
list(filter?: QueryFilter): KnowledgeEntry[];
|
|
32
|
+
save(entry: KnowledgeEntry): void;
|
|
33
|
+
delete(id: string): boolean;
|
|
34
|
+
update(id: string, partial: Partial<KnowledgeEntry>): KnowledgeEntry | undefined;
|
|
35
|
+
rebuildIndex(): void;
|
|
36
|
+
readIndex(): IndexEntry[];
|
|
37
|
+
readEntriesFromDisk(): KnowledgeEntry[];
|
|
38
|
+
snapshot(): string;
|
|
39
|
+
getSnapshot(date: string): IndexEntry[] | undefined;
|
|
40
|
+
getSurvivalRate(daysAgo: number): { rate: number; survived: number; total: number; snapshotDate: string } | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* FileKnowledgeStore — file-based implementation of KnowledgeStore.
|
|
45
|
+
* Each entry is a markdown file with YAML frontmatter.
|
|
46
|
+
* An index.json provides fast listing without reading all files.
|
|
47
|
+
*/
|
|
48
|
+
export class FileKnowledgeStore implements KnowledgeStore {
|
|
26
49
|
private baseDir: string;
|
|
27
50
|
|
|
28
51
|
constructor(config?: Partial<StoreConfig>) {
|
|
@@ -269,7 +292,7 @@ export class KnowledgeStore {
|
|
|
269
292
|
* 保存当日 index.json 快照
|
|
270
293
|
*/
|
|
271
294
|
snapshot(): string {
|
|
272
|
-
const snapDir = path.join(this.baseDir,
|
|
295
|
+
const snapDir = path.join(this.baseDir, FileKnowledgeStore.SNAPSHOTS_DIR);
|
|
273
296
|
if (!fs.existsSync(snapDir)) {
|
|
274
297
|
fs.mkdirSync(snapDir, { recursive: true });
|
|
275
298
|
}
|
|
@@ -286,7 +309,7 @@ export class KnowledgeStore {
|
|
|
286
309
|
* 读取指定日期的快照
|
|
287
310
|
*/
|
|
288
311
|
getSnapshot(date: string): IndexEntry[] | undefined {
|
|
289
|
-
const snapPath = path.join(this.baseDir,
|
|
312
|
+
const snapPath = path.join(this.baseDir, FileKnowledgeStore.SNAPSHOTS_DIR, `index-${date}.json`);
|
|
290
313
|
if (!fs.existsSync(snapPath)) return undefined;
|
|
291
314
|
try {
|
|
292
315
|
return JSON.parse(fs.readFileSync(snapPath, 'utf-8')) as IndexEntry[];
|
|
@@ -323,7 +346,7 @@ export class KnowledgeStore {
|
|
|
323
346
|
|
|
324
347
|
// ── Index I/O ────────────────────────────────────────────
|
|
325
348
|
|
|
326
|
-
|
|
349
|
+
readIndex(): IndexEntry[] {
|
|
327
350
|
const indexPath = path.join(this.baseDir, INDEX_FILE);
|
|
328
351
|
if (!fs.existsSync(indexPath)) return [];
|
|
329
352
|
try {
|
package/src/knowledge/types.ts
CHANGED
|
@@ -146,6 +146,23 @@ export const DEFAULT_DECAY_CONFIG: DecayConfig = {
|
|
|
146
146
|
autoPromoteSources: [],
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
+
// ── Decision ────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
export interface DecisionRecord {
|
|
152
|
+
topic: string;
|
|
153
|
+
category: 'architecture' | 'tooling' | 'process' | 'design';
|
|
154
|
+
context: string;
|
|
155
|
+
decision: string;
|
|
156
|
+
alternatives: string[];
|
|
157
|
+
rationale: string;
|
|
158
|
+
consequences: string;
|
|
159
|
+
participants: string[];
|
|
160
|
+
sourceType: string;
|
|
161
|
+
sourceId?: string;
|
|
162
|
+
revisable: boolean;
|
|
163
|
+
revisitCondition?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
149
166
|
// ── Reference ───────────────────────────────────────────────
|
|
150
167
|
|
|
151
168
|
export interface ReferenceRecord {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import type { KnowledgeEntry, MaturityLevel } from '../knowledge/types';
|
|
11
11
|
import type { KnowledgeDiagnosis } from './knowledge-doctor';
|
|
12
|
-
import { KnowledgeStore } from '../knowledge/store';
|
|
12
|
+
import type { KnowledgeStore } from '../knowledge/store';
|
|
13
13
|
|
|
14
14
|
// ── 进化提案 ─────────────────────────────────────────────
|
|
15
15
|
|
package/src/types/constraint.ts
CHANGED
|
@@ -220,7 +220,7 @@ export interface ConstraintContext {
|
|
|
220
220
|
/** 是否有需求文档(用于 no_implementation_without_requirement) */
|
|
221
221
|
hasRequirement?: boolean;
|
|
222
222
|
|
|
223
|
-
/** 是否在 worktree 中执行(用于
|
|
223
|
+
/** 是否在 worktree 中执行(用于 prefer_worktree) */
|
|
224
224
|
hasWorktree?: boolean;
|
|
225
225
|
|
|
226
226
|
/** worktree 路径(用于 worktree 相关检查) */
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Diagnose CLI 命令
|
|
3
|
-
*
|
|
4
|
-
* 运行诊断分析异常
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* diagnose 命令
|
|
8
|
-
*/
|
|
9
|
-
export declare function diagnoseCommand(subcommand: string, options: {
|
|
10
|
-
hours?: number;
|
|
11
|
-
constraintId?: string;
|
|
12
|
-
anomalyId?: string;
|
|
13
|
-
format?: 'json' | 'text';
|
|
14
|
-
save?: boolean;
|
|
15
|
-
}): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=diagnose.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diagnose.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/diagnose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IACP,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GACA,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
|