@sanqianx/project-knowledge 4.7.0 → 4.8.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/.agents/plugins/marketplace.json +17 -17
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +817 -799
- package/README.md +48 -36
- package/_modules/knowledge-engine/README.md +88 -0
- package/_modules/knowledge-engine/package.json +38 -0
- package/_modules/knowledge-engine/src/analysis-contract.js +25 -0
- package/_modules/knowledge-engine/src/analysis-worker.js +54 -0
- package/_modules/knowledge-engine/src/bin.js +52 -0
- package/_modules/knowledge-engine/src/bridge-client.js +24 -0
- package/_modules/knowledge-engine/src/coordinator.js +255 -0
- package/_modules/knowledge-engine/src/headless-analyzer.js +75 -0
- package/_modules/knowledge-engine/src/memories.js +85 -0
- package/_modules/knowledge-engine/src/migration.js +88 -0
- package/_modules/knowledge-engine/src/retrieval.js +116 -0
- package/_modules/knowledge-engine/src/runtime/README.md +7 -0
- package/_modules/knowledge-engine/src/runtime/atomic-file.js +204 -0
- package/_modules/knowledge-engine/src/runtime/automation-config.js +140 -0
- package/_modules/knowledge-engine/src/runtime/commit-conversation-binder.js +249 -0
- package/_modules/knowledge-engine/src/runtime/commit-processing-ledger.js +26 -0
- package/_modules/knowledge-engine/src/runtime/commit-prompt.js +202 -0
- package/_modules/knowledge-engine/src/runtime/commit-reconciler.js +432 -0
- package/_modules/knowledge-engine/src/runtime/content-hash.js +4 -0
- package/_modules/knowledge-engine/src/runtime/contracts.js +279 -0
- package/_modules/knowledge-engine/src/runtime/conversation-exclusions.js +204 -0
- package/_modules/knowledge-engine/src/runtime/conversation-store.js +387 -0
- package/_modules/knowledge-engine/src/runtime/evidence-bundle.js +228 -0
- package/_modules/knowledge-engine/src/runtime/git-runner.js +62 -0
- package/_modules/knowledge-engine/src/runtime/knowledge-promotion.js +444 -0
- package/_modules/knowledge-engine/src/runtime/knowledge-retrieval-service.js +402 -0
- package/_modules/knowledge-engine/src/runtime/layout.js +44 -0
- package/_modules/knowledge-engine/src/runtime/markdown-knowledge-indexer.js +230 -0
- package/_modules/knowledge-engine/src/runtime/scanner.js +298 -0
- package/_modules/knowledge-engine/src/server.js +155 -0
- package/_modules/knowledge-engine/src/store.js +239 -0
- package/_modules/knowledge-engine/ui/app.css +172 -0
- package/_modules/knowledge-engine/ui/app.js +297 -0
- package/_modules/knowledge-engine/ui/index.html +95 -0
- package/_site/README.md +30 -30
- package/_site/_test/ai-profile-resolver-test.js +137 -137
- package/_site/_test/automation-queue-test.js +14 -14
- package/_site/_test/automation-ui-test.js +40 -40
- package/_site/_test/background-task-registry-test.js +43 -43
- package/_site/_test/baseline-schema-test.js +91 -91
- package/_site/_test/chat-claudecodeui-match-test.js +92 -92
- package/_site/_test/claude-executable-discovery-test.js +62 -62
- package/_site/_test/claude-workbench-test.js +170 -170
- package/_site/_test/codex-conversation-projection-test.js +2 -1
- package/_site/_test/commit-conversation-binding-test.js +95 -95
- package/_site/_test/commit-evidence-test.js +110 -110
- package/_site/_test/conversation-api-test.js +109 -109
- package/_site/_test/conversation-store-test.js +136 -136
- package/_site/_test/data-dir-migration-test.js +57 -57
- package/_site/_test/desktop-browser-compat-test.js +28 -28
- package/_site/_test/desktop-hook-runtime-regression-test.js +204 -204
- package/_site/_test/explicit-commit-processor-test.js +37 -37
- package/_site/_test/fixtures/make-git-repos.js +12 -1
- package/_site/_test/folder-picker-output-test.js +19 -19
- package/_site/_test/full-integration-e2e-test.js +165 -165
- package/_site/_test/git-validation-test.js +2 -2
- package/_site/_test/hook-runtime-endpoint-test.js +88 -88
- package/_site/_test/hook-status-repair-api-test.js +152 -152
- package/_site/_test/hook-trigger-test.js +85 -85
- package/_site/_test/import-preflight-api-test.js +234 -233
- package/_site/_test/index-writer-concurrency-test.js +135 -135
- package/_site/_test/integration-adapters-test.js +171 -171
- package/_site/_test/integration-surface-coverage-test.js +164 -164
- package/_site/_test/knowledge-language-control-test.js +170 -170
- package/_site/_test/knowledge-promotion-recovery-test.js +260 -260
- package/_site/_test/knowledge-query-test.js +54 -54
- package/_site/_test/knowledge-retrieval-service-test.js +77 -77
- package/_site/_test/knowledge-storage-startup-test.js +52 -52
- package/_site/_test/knowledge-store-logs-supervision-test.js +89 -89
- package/_site/_test/legacy-forward-compat-test.js +257 -257
- package/_site/_test/legacy-project-upgrade-e2e-test.js +363 -363
- package/_site/_test/logging-api-test.js +89 -89
- package/_site/_test/logging-sse-no-gap-test.js +88 -88
- package/_site/_test/logging-ui-test.js +106 -104
- package/_site/_test/markdown-delta-overlay-test.js +85 -85
- package/_site/_test/markdown-maintenance-api-test.js +75 -75
- package/_site/_test/mcp-server-test.js +149 -149
- package/_site/_test/module-artifact-integrity-test.js +27 -0
- package/_site/_test/module-boundary-test.js +30 -0
- package/_site/_test/module-bridge-eventbridge-test.js +7 -0
- package/_site/_test/module-model-configuration-test.js +43 -0
- package/_site/_test/module-process-lifecycle-test.js +24 -0
- package/_site/_test/module-stream-proxy-test.js +34 -0
- package/_site/_test/non-release-ci-test.js +34 -34
- package/_site/_test/offline-boundary-isolation-test.js +32 -32
- package/_site/_test/p0-data-migration-characterization-test.js +37 -37
- package/_site/_test/p0-e2e-gate-test.js +347 -347
- package/_site/_test/packaged-ui-smoke-test.js +11 -9
- package/_site/_test/path-consistency-test.js +151 -151
- package/_site/_test/pending-sweep-test.js +9 -9
- package/_site/_test/post-commit-automation-test.js +87 -87
- package/_site/_test/product-diagnostics-ui-test.js +75 -0
- package/_site/_test/product-import-ui-test.js +92 -0
- package/_site/_test/project-delete-recovery-test.js +64 -64
- package/_site/_test/project-goal-editor-test.js +144 -144
- package/_site/_test/project-layout-v2-migration-test.js +127 -127
- package/_site/_test/project-lifecycle-transaction-test.js +106 -106
- package/_site/_test/prompt-settings-test.js +115 -115
- package/_site/_test/protected-architecture-gate-test.js +122 -122
- package/_site/_test/refactor-characterization-test.js +36 -36
- package/_site/_test/release-version-sync-test.js +1 -1
- package/_site/_test/requirement-recorder-test.js +173 -173
- package/_site/_test/run-all-tests.js +159 -156
- package/_site/_test/server-runtime-migration-safety-test.js +27 -27
- package/_site/_test/shared-contracts-test.js +58 -58
- package/_site/_test/startup-analysis-disabled-test.js +10 -10
- package/_site/_test/storage-foundation-test.js +78 -78
- package/_site/_test/structured-logger-test.js +101 -101
- package/_site/_test/tracking-start-test.js +108 -108
- package/_site/_test/v4122-upgrade-data-contract-test.js +56 -56
- package/_site/_test/workbench-permission-test.js +117 -117
- package/_site/_test/workspace-ui-contract-test.js +28 -43
- package/_site/lib/ai-profile-resolver.js +78 -78
- package/_site/lib/ai-workspace.js +101 -101
- package/_site/lib/automation-config.js +140 -140
- package/_site/lib/bridge-adapter.js +1 -0
- package/_site/lib/bridge-consumer-service.js +402 -402
- package/_site/lib/claude-cli-runner.js +1510 -1510
- package/_site/lib/commit-conversation-binder.js +234 -234
- package/_site/lib/commit-processing-ledger.js +27 -27
- package/_site/lib/commit-prompt.js +202 -202
- package/_site/lib/commit-reconciler.js +406 -406
- package/_site/lib/contracts.js +284 -279
- package/_site/lib/conversation-query-service.js +144 -144
- package/_site/lib/conversation-store.js +385 -385
- package/_site/lib/data-dir.js +74 -74
- package/_site/lib/data-state-classifier.js +40 -40
- package/_site/lib/engine-cutover.js +97 -0
- package/_site/lib/evidence-bundle.js +228 -228
- package/_site/lib/folder-picker-output.js +21 -21
- package/_site/lib/git-runner.js +62 -62
- package/_site/lib/github-team-store.js +1172 -1172
- package/_site/lib/hook-manager.js +203 -202
- package/_site/lib/index-service.js +173 -173
- package/_site/lib/integration-installer.js +907 -907
- package/_site/lib/kb-framework.js +176 -176
- package/_site/lib/kb-validator.js +124 -124
- package/_site/lib/knowledge-promotion.js +435 -435
- package/_site/lib/knowledge-retrieval-service.js +401 -401
- package/_site/lib/knowledge-tool-runtime.js +359 -359
- package/_site/lib/legacy-data-manifest.js +26 -26
- package/_site/lib/llm-client.js +161 -161
- package/_site/lib/markdown-knowledge-indexer.js +230 -230
- package/_site/lib/migration-service.js +442 -442
- package/_site/lib/module-bridge.js +198 -33
- package/_site/lib/post-commit-automation.js +87 -87
- package/_site/lib/project-lifecycle-service.js +519 -497
- package/_site/lib/project-store.js +268 -262
- package/_site/lib/requirement-recorder.js +278 -278
- package/_site/lib/runtime-endpoint.js +155 -155
- package/_site/lib/scanner.js +298 -298
- package/_site/lib/server-app.js +1590 -1520
- package/_site/lib/settings-store.js +133 -113
- package/_site/lib/storage-layout.js +162 -162
- package/_site/lib/structured-logger.js +574 -574
- package/_site/scripts/folder-picker.ps1 +156 -156
- package/_site/scripts/hook-trigger.js +157 -156
- package/_site/scripts/install-module-candidates.js +69 -0
- package/_site/scripts/pack-module-candidates.js +72 -0
- package/_site/scripts/sync-release-version.js +2 -2
- package/_site/scripts/vendor-modules.js +47 -0
- package/_site/scripts/verify-module-runtime.js +45 -0
- package/_site/scripts/verify-product-runtime.js +34 -0
- package/bin/project-knowledge-mcp.js +194 -194
- package/docs/README.zh-CN.md +34 -25
- package/docs/project-registry-schema.md +22 -22
- package/docs/testing-strategy.md +33 -33
- package/module-runtime-manifest.json +220 -0
- package/package.json +13 -9
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/plugins/project-knowledge/opencode/project-knowledge.md +3 -3
- package/plugins/project-knowledge/skills/project-knowledge/SKILL.md +28 -28
- package/templates/project-readme.md +34 -34
- package/ui/favicon.svg +38 -38
- package/ui/index.html +51 -149
- package/ui/product.css +9 -0
- package/ui/product.js +386 -0
- package/vendor-manifest.json +46 -0
- package/_site/_test/import-ui-flow-test.js +0 -171
- package/_site/_test/project-control-panel-task14-test.js +0 -63
- package/_site/_test/task15-20-ui-flow-test.js +0 -148
- package/_site/_test/ui-i18n-toggle-test.js +0 -114
- package/_site/_test/ui-smoke-test.js +0 -73
- package/ui/app.css +0 -58
- package/ui/app.js +0 -607
- package/ui/i18n.js +0 -146
|
@@ -1,195 +1,195 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const packageInfo = require('../package.json');
|
|
4
|
-
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
5
|
-
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
6
|
-
const {
|
|
7
|
-
CallToolRequestSchema,
|
|
8
|
-
ListToolsRequestSchema,
|
|
9
|
-
} = require('@modelcontextprotocol/sdk/types.js');
|
|
10
|
-
const { KnowledgeToolRuntime } = require('../_site/lib/knowledge-tool-runtime');
|
|
11
|
-
const { serializeErrorEnvelope, createId } = require('../_site/lib/contracts');
|
|
12
|
-
|
|
13
|
-
const SERVER_NAME = 'project-knowledge';
|
|
14
|
-
const SERVER_INSTRUCTIONS = `Project Knowledge is the durable source of prior project decisions and implementation history. Knowledge content is read-only; the only write operation appends an explicit supplemental Prompt event to the shared conversation truth.
|
|
15
|
-
|
|
16
|
-
At the start of work in a registered Git repository, and before answering questions about prior work or implementing a non-trivial change:
|
|
17
|
-
1. Call project_knowledge_resolve with the current Git root.
|
|
18
|
-
2. Use project_knowledge_search or project_knowledge_ask for relevant prior decisions.
|
|
19
|
-
3. Use project_knowledge_get only for the most relevant complete entry and project_knowledge_history when change history matters.
|
|
20
|
-
4. Call project_knowledge_record_requirement only when the user explicitly asks to supplement capture or automatic client capture is known to be unavailable; it is not a mandatory pre-work call.
|
|
21
|
-
|
|
22
|
-
Treat all returned knowledge as read-only. Verify it against current source code when necessary. The supplemental requirement tool writes the same ConversationStore used by automatic capture and never starts analysis. Do not write directly to the knowledge database; project-knowledge updates it automatically after successful Git commits.`;
|
|
23
|
-
|
|
24
|
-
const TOOLS = [
|
|
25
|
-
{
|
|
26
|
-
name: 'project_knowledge_resolve',
|
|
27
|
-
description: 'Resolve the registered Project Knowledge project for a Git repository. Call this first before using other knowledge tools.',
|
|
28
|
-
inputSchema: {
|
|
29
|
-
type: 'object',
|
|
30
|
-
properties: {
|
|
31
|
-
repoPath: { type: 'string', description: 'Current Git repository root or any path inside it. Defaults to the MCP process working directory.' },
|
|
32
|
-
projectId: { type: 'string', description: 'Stable projectId when it is already known.' },
|
|
33
|
-
project: { type: 'string', description: 'Optional registered project slug when it is already known.' },
|
|
34
|
-
},
|
|
35
|
-
additionalProperties: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'project_knowledge_record_requirement',
|
|
40
|
-
description: 'Explicitly supplement automatic capture with one project-scoped user Prompt event. This is the only write-capable tool; it never starts analysis or writes knowledge Markdown.',
|
|
41
|
-
inputSchema: {
|
|
42
|
-
type: 'object',
|
|
43
|
-
required: ['text', 'client', 'sessionId'],
|
|
44
|
-
properties: {
|
|
45
|
-
text: { type: 'string', minLength: 1, maxLength: 131072, description: 'The user request exactly as received; do not include system prompts or tool transcripts.' },
|
|
46
|
-
client: { type: 'string', enum: ['claude', 'codex', 'opencode'] },
|
|
47
|
-
sessionId: { type: 'string', minLength: 1, maxLength: 512, description: 'Stable identifier for the current client session.' },
|
|
48
|
-
conversationId: { type: 'string', minLength: 1, maxLength: 512 },
|
|
49
|
-
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
50
|
-
repoPath: { type: 'string', description: 'Current Git root. Used for exact project resolution when projectId is omitted.' },
|
|
51
|
-
explicitCommit: { type: 'string', description: 'Optional Git commit explicitly associated with this requirement.' },
|
|
52
|
-
},
|
|
53
|
-
anyOf: [{ required: ['projectId'] }, { required: ['repoPath'] }],
|
|
54
|
-
additionalProperties: false,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'project_knowledge_search',
|
|
59
|
-
description: 'Search durable project knowledge using the current project and its explicitly related-project scope. This tool is read-only.',
|
|
60
|
-
inputSchema: {
|
|
61
|
-
type: 'object',
|
|
62
|
-
required: ['query'],
|
|
63
|
-
properties: {
|
|
64
|
-
query: { type: 'string', minLength: 1 },
|
|
65
|
-
repoPath: { type: 'string', description: 'Current Git repository root or a path inside it.' },
|
|
66
|
-
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
67
|
-
project: { type: 'string', description: 'Optional registered project slug.' },
|
|
68
|
-
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
69
|
-
},
|
|
70
|
-
additionalProperties: false,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'project_knowledge_ask',
|
|
75
|
-
description: 'Return a compact answer with citations from durable project knowledge. This tool is read-only.',
|
|
76
|
-
inputSchema: {
|
|
77
|
-
type: 'object',
|
|
78
|
-
required: ['query'],
|
|
79
|
-
properties: {
|
|
80
|
-
query: { type: 'string', minLength: 1 },
|
|
81
|
-
repoPath: { type: 'string' },
|
|
82
|
-
projectId: { type: 'string' },
|
|
83
|
-
project: { type: 'string' },
|
|
84
|
-
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
85
|
-
},
|
|
86
|
-
additionalProperties: false,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'project_knowledge_get',
|
|
91
|
-
description: 'Read one complete knowledge entry selected from search results. This tool is read-only and scope checked.',
|
|
92
|
-
inputSchema: {
|
|
93
|
-
type: 'object',
|
|
94
|
-
required: ['entry'],
|
|
95
|
-
properties: {
|
|
96
|
-
entry: { type: 'string', minLength: 1, description: 'Entry identifier returned by search.' },
|
|
97
|
-
space: { type: 'string', description: 'Optional scoped knowledge space identifier.' },
|
|
98
|
-
repoPath: { type: 'string' },
|
|
99
|
-
projectId: { type: 'string' },
|
|
100
|
-
project: { type: 'string' },
|
|
101
|
-
},
|
|
102
|
-
additionalProperties: false,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'project_knowledge_history',
|
|
107
|
-
description: 'Read recent durable change history for the current project and its allowed scope. This tool is read-only.',
|
|
108
|
-
inputSchema: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties: {
|
|
111
|
-
repoPath: { type: 'string' },
|
|
112
|
-
projectId: { type: 'string' },
|
|
113
|
-
project: { type: 'string' },
|
|
114
|
-
limit: { type: 'integer', minimum: 1, maximum: 100, default: 20 },
|
|
115
|
-
},
|
|
116
|
-
additionalProperties: false,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
function toolContent(result) {
|
|
122
|
-
return {
|
|
123
|
-
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
124
|
-
structuredContent: result,
|
|
125
|
-
isError: false,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function callTool(runtime, name, args) {
|
|
130
|
-
if (name === 'project_knowledge_resolve') return runtime.resolveProject(args);
|
|
131
|
-
if (name === 'project_knowledge_record_requirement') return runtime.recordRequirement(args);
|
|
132
|
-
if (name === 'project_knowledge_search') return runtime.search(args);
|
|
133
|
-
if (name === 'project_knowledge_ask') return runtime.ask(args);
|
|
134
|
-
if (name === 'project_knowledge_get') return runtime.get(args);
|
|
135
|
-
if (name === 'project_knowledge_history') return runtime.history(args);
|
|
136
|
-
throw new Error(`unknown tool: ${name}`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function createServer(options = {}) {
|
|
140
|
-
const runtime = options.runtime || new KnowledgeToolRuntime();
|
|
141
|
-
const server = new Server(
|
|
142
|
-
{ name: SERVER_NAME, version: packageInfo.version },
|
|
143
|
-
{
|
|
144
|
-
capabilities: { tools: { listChanged: false } },
|
|
145
|
-
instructions: SERVER_INSTRUCTIONS,
|
|
146
|
-
},
|
|
147
|
-
);
|
|
148
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
149
|
-
server.setRequestHandler(CallToolRequestSchema, async request => {
|
|
150
|
-
const name = String(request.params?.name || '');
|
|
151
|
-
const args = request.params?.arguments && typeof request.params.arguments === 'object'
|
|
152
|
-
? request.params.arguments
|
|
153
|
-
: {};
|
|
154
|
-
try {
|
|
155
|
-
return toolContent(await callTool(runtime, name, args));
|
|
156
|
-
} catch (error) {
|
|
157
|
-
const operationId = createId('op');
|
|
158
|
-
return {
|
|
159
|
-
content: [{ type: 'text', text: JSON.stringify(serializeErrorEnvelope(error, operationId)) }],
|
|
160
|
-
isError: true,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return { server, runtime };
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async function main() {
|
|
168
|
-
const { server, runtime } = createServer();
|
|
169
|
-
const transport = new StdioServerTransport();
|
|
170
|
-
let closing = false;
|
|
171
|
-
const close = async () => {
|
|
172
|
-
if (closing) return;
|
|
173
|
-
closing = true;
|
|
174
|
-
await runtime.close();
|
|
175
|
-
await server.close();
|
|
176
|
-
};
|
|
177
|
-
process.once('SIGINT', () => close().finally(() => process.exit(0)));
|
|
178
|
-
process.once('SIGTERM', () => close().finally(() => process.exit(0)));
|
|
179
|
-
await server.connect(transport);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (require.main === module) {
|
|
183
|
-
main().catch(error => {
|
|
184
|
-
process.stderr.write(`[project-knowledge-mcp] ${JSON.stringify(serializeErrorEnvelope(error, createId('op')))}\n`);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
module.exports = {
|
|
190
|
-
callTool,
|
|
191
|
-
createServer,
|
|
192
|
-
SERVER_INSTRUCTIONS,
|
|
193
|
-
SERVER_NAME,
|
|
194
|
-
TOOLS,
|
|
195
|
-
};
|
|
2
|
+
|
|
3
|
+
const packageInfo = require('../package.json');
|
|
4
|
+
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
5
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
6
|
+
const {
|
|
7
|
+
CallToolRequestSchema,
|
|
8
|
+
ListToolsRequestSchema,
|
|
9
|
+
} = require('@modelcontextprotocol/sdk/types.js');
|
|
10
|
+
const { KnowledgeToolRuntime } = require('../_site/lib/knowledge-tool-runtime');
|
|
11
|
+
const { serializeErrorEnvelope, createId } = require('../_site/lib/contracts');
|
|
12
|
+
|
|
13
|
+
const SERVER_NAME = 'project-knowledge';
|
|
14
|
+
const SERVER_INSTRUCTIONS = `Project Knowledge is the durable source of prior project decisions and implementation history. Knowledge content is read-only; the only write operation appends an explicit supplemental Prompt event to the shared conversation truth.
|
|
15
|
+
|
|
16
|
+
At the start of work in a registered Git repository, and before answering questions about prior work or implementing a non-trivial change:
|
|
17
|
+
1. Call project_knowledge_resolve with the current Git root.
|
|
18
|
+
2. Use project_knowledge_search or project_knowledge_ask for relevant prior decisions.
|
|
19
|
+
3. Use project_knowledge_get only for the most relevant complete entry and project_knowledge_history when change history matters.
|
|
20
|
+
4. Call project_knowledge_record_requirement only when the user explicitly asks to supplement capture or automatic client capture is known to be unavailable; it is not a mandatory pre-work call.
|
|
21
|
+
|
|
22
|
+
Treat all returned knowledge as read-only. Verify it against current source code when necessary. The supplemental requirement tool writes the same ConversationStore used by automatic capture and never starts analysis. Do not write directly to the knowledge database; project-knowledge updates it automatically after successful Git commits.`;
|
|
23
|
+
|
|
24
|
+
const TOOLS = [
|
|
25
|
+
{
|
|
26
|
+
name: 'project_knowledge_resolve',
|
|
27
|
+
description: 'Resolve the registered Project Knowledge project for a Git repository. Call this first before using other knowledge tools.',
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
properties: {
|
|
31
|
+
repoPath: { type: 'string', description: 'Current Git repository root or any path inside it. Defaults to the MCP process working directory.' },
|
|
32
|
+
projectId: { type: 'string', description: 'Stable projectId when it is already known.' },
|
|
33
|
+
project: { type: 'string', description: 'Optional registered project slug when it is already known.' },
|
|
34
|
+
},
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'project_knowledge_record_requirement',
|
|
40
|
+
description: 'Explicitly supplement automatic capture with one project-scoped user Prompt event. This is the only write-capable tool; it never starts analysis or writes knowledge Markdown.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['text', 'client', 'sessionId'],
|
|
44
|
+
properties: {
|
|
45
|
+
text: { type: 'string', minLength: 1, maxLength: 131072, description: 'The user request exactly as received; do not include system prompts or tool transcripts.' },
|
|
46
|
+
client: { type: 'string', enum: ['claude', 'codex', 'opencode'] },
|
|
47
|
+
sessionId: { type: 'string', minLength: 1, maxLength: 512, description: 'Stable identifier for the current client session.' },
|
|
48
|
+
conversationId: { type: 'string', minLength: 1, maxLength: 512 },
|
|
49
|
+
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
50
|
+
repoPath: { type: 'string', description: 'Current Git root. Used for exact project resolution when projectId is omitted.' },
|
|
51
|
+
explicitCommit: { type: 'string', description: 'Optional Git commit explicitly associated with this requirement.' },
|
|
52
|
+
},
|
|
53
|
+
anyOf: [{ required: ['projectId'] }, { required: ['repoPath'] }],
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'project_knowledge_search',
|
|
59
|
+
description: 'Search durable project knowledge using the current project and its explicitly related-project scope. This tool is read-only.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
required: ['query'],
|
|
63
|
+
properties: {
|
|
64
|
+
query: { type: 'string', minLength: 1 },
|
|
65
|
+
repoPath: { type: 'string', description: 'Current Git repository root or a path inside it.' },
|
|
66
|
+
projectId: { type: 'string', description: 'Stable projectId returned by project_knowledge_resolve.' },
|
|
67
|
+
project: { type: 'string', description: 'Optional registered project slug.' },
|
|
68
|
+
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
69
|
+
},
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'project_knowledge_ask',
|
|
75
|
+
description: 'Return a compact answer with citations from durable project knowledge. This tool is read-only.',
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
required: ['query'],
|
|
79
|
+
properties: {
|
|
80
|
+
query: { type: 'string', minLength: 1 },
|
|
81
|
+
repoPath: { type: 'string' },
|
|
82
|
+
projectId: { type: 'string' },
|
|
83
|
+
project: { type: 'string' },
|
|
84
|
+
limit: { type: 'integer', minimum: 1, maximum: 30, default: 8 },
|
|
85
|
+
},
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'project_knowledge_get',
|
|
91
|
+
description: 'Read one complete knowledge entry selected from search results. This tool is read-only and scope checked.',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
required: ['entry'],
|
|
95
|
+
properties: {
|
|
96
|
+
entry: { type: 'string', minLength: 1, description: 'Entry identifier returned by search.' },
|
|
97
|
+
space: { type: 'string', description: 'Optional scoped knowledge space identifier.' },
|
|
98
|
+
repoPath: { type: 'string' },
|
|
99
|
+
projectId: { type: 'string' },
|
|
100
|
+
project: { type: 'string' },
|
|
101
|
+
},
|
|
102
|
+
additionalProperties: false,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'project_knowledge_history',
|
|
107
|
+
description: 'Read recent durable change history for the current project and its allowed scope. This tool is read-only.',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
repoPath: { type: 'string' },
|
|
112
|
+
projectId: { type: 'string' },
|
|
113
|
+
project: { type: 'string' },
|
|
114
|
+
limit: { type: 'integer', minimum: 1, maximum: 100, default: 20 },
|
|
115
|
+
},
|
|
116
|
+
additionalProperties: false,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
function toolContent(result) {
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
124
|
+
structuredContent: result,
|
|
125
|
+
isError: false,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function callTool(runtime, name, args) {
|
|
130
|
+
if (name === 'project_knowledge_resolve') return runtime.resolveProject(args);
|
|
131
|
+
if (name === 'project_knowledge_record_requirement') return runtime.recordRequirement(args);
|
|
132
|
+
if (name === 'project_knowledge_search') return runtime.search(args);
|
|
133
|
+
if (name === 'project_knowledge_ask') return runtime.ask(args);
|
|
134
|
+
if (name === 'project_knowledge_get') return runtime.get(args);
|
|
135
|
+
if (name === 'project_knowledge_history') return runtime.history(args);
|
|
136
|
+
throw new Error(`unknown tool: ${name}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function createServer(options = {}) {
|
|
140
|
+
const runtime = options.runtime || new KnowledgeToolRuntime();
|
|
141
|
+
const server = new Server(
|
|
142
|
+
{ name: SERVER_NAME, version: packageInfo.version },
|
|
143
|
+
{
|
|
144
|
+
capabilities: { tools: { listChanged: false } },
|
|
145
|
+
instructions: SERVER_INSTRUCTIONS,
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
149
|
+
server.setRequestHandler(CallToolRequestSchema, async request => {
|
|
150
|
+
const name = String(request.params?.name || '');
|
|
151
|
+
const args = request.params?.arguments && typeof request.params.arguments === 'object'
|
|
152
|
+
? request.params.arguments
|
|
153
|
+
: {};
|
|
154
|
+
try {
|
|
155
|
+
return toolContent(await callTool(runtime, name, args));
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const operationId = createId('op');
|
|
158
|
+
return {
|
|
159
|
+
content: [{ type: 'text', text: JSON.stringify(serializeErrorEnvelope(error, operationId)) }],
|
|
160
|
+
isError: true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return { server, runtime };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function main() {
|
|
168
|
+
const { server, runtime } = createServer();
|
|
169
|
+
const transport = new StdioServerTransport();
|
|
170
|
+
let closing = false;
|
|
171
|
+
const close = async () => {
|
|
172
|
+
if (closing) return;
|
|
173
|
+
closing = true;
|
|
174
|
+
await runtime.close();
|
|
175
|
+
await server.close();
|
|
176
|
+
};
|
|
177
|
+
process.once('SIGINT', () => close().finally(() => process.exit(0)));
|
|
178
|
+
process.once('SIGTERM', () => close().finally(() => process.exit(0)));
|
|
179
|
+
await server.connect(transport);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (require.main === module) {
|
|
183
|
+
main().catch(error => {
|
|
184
|
+
process.stderr.write(`[project-knowledge-mcp] ${JSON.stringify(serializeErrorEnvelope(error, createId('op')))}\n`);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
module.exports = {
|
|
190
|
+
callTool,
|
|
191
|
+
createServer,
|
|
192
|
+
SERVER_INSTRUCTIONS,
|
|
193
|
+
SERVER_NAME,
|
|
194
|
+
TOOLS,
|
|
195
|
+
};
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# project-knowledge
|
|
2
2
|
|
|
3
|
-
本地、由 Git Commit
|
|
4
|
-
|
|
3
|
+
本地、由 Git Commit 驱动的智脑知识服务。Markdown 是知识事实源;vector-hub
|
|
4
|
+
提供可重建的派生索引。外壳只负责导航、归属、接线与状态投影。
|
|
5
5
|
|
|
6
6
|
## 安装与运行
|
|
7
7
|
|
|
8
8
|
新机器完整安装只需三条命令:
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install -g project-knowledge
|
|
11
|
+
npm install -g @sanqianx/project-knowledge@latest
|
|
12
12
|
project-knowledge-integrations install
|
|
13
13
|
project-knowledge
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
1. `npm install -g project-knowledge`
|
|
17
|
-
|
|
16
|
+
1. `npm install -g @sanqianx/project-knowledge@latest` 安装外壳、固定版本的
|
|
17
|
+
工作台、vector-hub、event-bridge,以及包内 knowledge-engine。
|
|
18
18
|
2. `project-knowledge-integrations install` 是一次性的 Integration Setup,
|
|
19
19
|
对检测到的每个客户端(Claude Code / Codex / OpenCode)同时安装两类
|
|
20
20
|
相互独立、分别上报状态的能力:
|
|
@@ -44,26 +44,24 @@ project-knowledge status
|
|
|
44
44
|
project-knowledge stop
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
需要 Node.js
|
|
48
|
-
|
|
47
|
+
需要 Node.js 22+ 与 `PATH` 中的 Git。4.8.0 仅交付 npm 网页版本,不提供新版
|
|
48
|
+
Windows 安装包或桌面自动更新。
|
|
49
49
|
|
|
50
50
|
## 唯一分析流程
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
知识引擎是唯一分析执行者:
|
|
53
53
|
|
|
54
54
|
```text
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
程序 startup --------+ trigger: git-hook | startup
|
|
55
|
+
Git Hook → event-bridge journal → 引擎持久化认领 → 隔离 Agent 分析
|
|
56
|
+
→ staging 校验 → 知识晋升 → vector-hub 索引 → 检索
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
导入只建立 Git tracking baseline、创建项目元数据并安装/验证 Hook;不运行 AI、
|
|
61
60
|
不扫描全仓推测需求、不生成 TODO 知识。空仓库导入后的第一个 Commit会被处理。
|
|
62
61
|
|
|
63
|
-
Hook
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
同一个 in-flight reconciliation。
|
|
62
|
+
Hook 向 bridge journal 写入提交证据,通知只负责唤醒。通知丢失仍由 journal
|
|
63
|
+
消费及启动对账恢复;Hook 故障不阻塞提交。同项目严格串行、失败即停;不同项目
|
|
64
|
+
最多两个并发分析,重复事件不会重做已完成提交。关闭浏览器不停止后台维护。
|
|
67
65
|
|
|
68
66
|
## 知识与索引安全
|
|
69
67
|
|
|
@@ -76,8 +74,8 @@ Promotion 使用 backup、hash 与 durable journal。只有 Markdown promotion
|
|
|
76
74
|
成功后才推进 lastAnalyzedCommit 并把 index 标为 dirty。索引失败不会回滚真实
|
|
77
75
|
Markdown,也不会重跑 AI;启动和维护流程会重试 dirty index。
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
vector-hub 是唯一派生索引服务,外壳不再执行第二套索引写入。索引失败独立显示
|
|
78
|
+
“知识已更新,索引待修复”,修复索引不重跑模型、不撤销有效知识。
|
|
81
79
|
|
|
82
80
|
应用不会创建、修改、刷新或删除 `CLAUDE.md`。
|
|
83
81
|
|
|
@@ -96,8 +94,8 @@ project-knowledge-kb get --project <projectId> --entry modules/auth.md --json
|
|
|
96
94
|
project-knowledge-kb history --project <projectId> --json
|
|
97
95
|
```
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
只读查询不会创建或修改配置。索引不可用时回退到真实 Markdown。项目、所属领域、
|
|
98
|
+
整个智脑是包含范围;未确认记忆不能作为长期偏好注入任务。
|
|
101
99
|
|
|
102
100
|
## 存储合同
|
|
103
101
|
|
|
@@ -113,7 +111,7 @@ knowledgePath,修改 global root 不会移动已有项目。
|
|
|
113
111
|
│ ├── config.json # 固定 repoPath/knowledgePath
|
|
114
112
|
│ ├── state.json # tracking/claim/index/Hook 状态
|
|
115
113
|
│ └── requirements.jsonl # 按需创建
|
|
116
|
-
├──
|
|
114
|
+
├── knowledge-engine/ # 持久化 claim、run、journal 游标
|
|
117
115
|
├── cache/
|
|
118
116
|
├── runtime/
|
|
119
117
|
├── logs/{app,projects,hooks}/
|
|
@@ -138,15 +136,24 @@ settings、per-project config/state、最小 registry 与旧 index。验证路
|
|
|
138
136
|
Commit pointer、日志和索引后才激活,completion marker 最后写。任何阶段中断都
|
|
139
137
|
保留旧 reader、用户知识、历史日志、配置与 backup,允许安全重试。
|
|
140
138
|
|
|
141
|
-
##
|
|
139
|
+
## 产品 UI
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
一级导航为智脑首页、开始工作、知识检索、长期记忆、领域与项目、活动记录。
|
|
142
|
+
开始工作嵌入真实工作台,保留消息流、中止、权限和会话恢复,不重复实现聊天。
|
|
143
|
+
在“领域与项目”点击“导入项目”,确认代码目录、知识目录及领域;部分接线失败
|
|
144
|
+
保留项目,只重试失败模块。系统状态集中展示四模块健康、模型配置与诊断。
|
|
145
|
+
|
|
146
|
+
加入智脑不会搬动已有项目知识。领域共享知识及已确认记忆与项目知识并存。
|
|
147
|
+
凭据由 Workbench 统一管理;维护默认模型独立于聊天临时切换,运行凭据不进
|
|
148
|
+
引擎状态、日志或浏览器消息。
|
|
149
|
+
|
|
150
|
+
活动记录保留结构化日志能力:
|
|
144
151
|
|
|
145
152
|
- trace/debug/info/warn/error/fatal 六级;
|
|
146
153
|
- 本地日期、项目、component、event、operation、Commit、全文过滤;
|
|
147
154
|
- newest-first cursor 分页、暂停/自动刷新、按当前条件导出;
|
|
148
155
|
- operation flow、结构化 error/stack、logger degraded 状态;
|
|
149
|
-
- Hook
|
|
156
|
+
- Hook/索引/项目状态、统一的浅深主题。
|
|
150
157
|
|
|
151
158
|
日志使用 `log/v2` JSONL,按天和 50 MiB segment 轮转;默认保留 365 天,`0`
|
|
152
159
|
表示不按时间删除,并受总容量策略约束。写入、查询、error 与 export 全部递归脱敏。
|
|
@@ -167,8 +174,10 @@ npm test --prefix desktop
|
|
|
167
174
|
npm pack --dry-run --json
|
|
168
175
|
```
|
|
169
176
|
|
|
170
|
-
|
|
171
|
-
|
|
177
|
+
自动回归覆盖真实 Git Hook、空格/中文路径、提交证据、promotion/index、查询、
|
|
178
|
+
恢复与日志。产品浏览器验收只检查 1920×1080 桌面视口,模型和 embedding 为
|
|
179
|
+
可控替身;真实模型与真实索引抽测分别报告。完整故障组合和用户已有数据的最终
|
|
180
|
+
切换另行验收,不用可点击页面代替真实链路通过。
|
|
172
181
|
|
|
173
182
|
## 许可证
|
|
174
183
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# Project Registry Schema
|
|
2
|
-
|
|
3
|
-
Status: current
|
|
4
|
-
Date: 2026-06-21
|
|
5
|
-
|
|
6
|
-
`projects.json` stores local project configuration. The current KB layout marker is:
|
|
7
|
-
|
|
8
|
-
```json
|
|
9
|
-
{
|
|
10
|
-
"kbSchemaVersion": "minimal"
|
|
11
|
-
}
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Relevant Fields
|
|
15
|
-
|
|
16
|
-
| Field | Default | Notes |
|
|
17
|
-
|---|---|---|
|
|
18
|
-
| `slug` | required | Registry key and project identifier |
|
|
19
|
-
| `displayName` | slug | UI label |
|
|
20
|
-
| `gitPath` | required | Source repository path |
|
|
21
|
-
| `kbPath` | generated from knowledge-store root | Final minimal KB location |
|
|
22
|
-
| `kbSchemaVersion` | `"minimal"` | Current KB framework marker |
|
|
1
|
+
# Project Registry Schema
|
|
2
|
+
|
|
3
|
+
Status: current
|
|
4
|
+
Date: 2026-06-21
|
|
5
|
+
|
|
6
|
+
`projects.json` stores local project configuration. The current KB layout marker is:
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"kbSchemaVersion": "minimal"
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Relevant Fields
|
|
15
|
+
|
|
16
|
+
| Field | Default | Notes |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `slug` | required | Registry key and project identifier |
|
|
19
|
+
| `displayName` | slug | UI label |
|
|
20
|
+
| `gitPath` | required | Source repository path |
|
|
21
|
+
| `kbPath` | generated from knowledge-store root | Final minimal KB location |
|
|
22
|
+
| `kbSchemaVersion` | `"minimal"` | Current KB framework marker |
|
|
23
23
|
| `goalStatus` | `"not-created"` | Review state of `GOAL.md` |
|
|
24
24
|
| `trackingStartCommit` | current `HEAD` on first import | Baseline commit for incremental KB tracking; commits before it are not analyzed |
|
|
25
25
|
| `trackingStartedAt` | current timestamp on first import | Time the tracking baseline was established |
|
package/docs/testing-strategy.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# Testing Strategy
|
|
2
|
-
|
|
3
|
-
Status: current
|
|
4
|
-
Date: 2026-07-23
|
|
5
|
-
|
|
6
|
-
## Framework Tests
|
|
7
|
-
|
|
8
|
-
- New initialization creates the minimal KB structure.
|
|
9
|
-
- Generated `00-index.md` files remain protected from AI writes.
|
|
10
|
-
- Validation rejects legacy framework artifacts and KB-local AI workspaces.
|
|
11
|
-
|
|
12
|
-
## Commit Automation Tests
|
|
13
|
-
|
|
14
|
-
- One source Git commit renders one exact prompt.
|
|
15
|
-
- A project processes commits oldest-to-newest through a FIFO queue.
|
|
16
|
-
- Repeated Hook and startup reconciliation cannot create duplicate tasks.
|
|
17
|
-
- A completed commit is never automatically dispatched again.
|
|
18
|
-
- `queued` and `running` records recover after a restart.
|
|
19
|
-
- Failed tasks remain retryable and do not become silently completed.
|
|
20
|
-
- Different projects may run independently.
|
|
21
|
-
|
|
22
|
-
## Write-boundary Tests
|
|
23
|
-
|
|
24
|
-
- Automation can write only inside the selected project's KB.
|
|
25
|
-
- The source repository and other project KBs remain read-only.
|
|
26
|
-
- Bash is restricted to the read-only allowlist.
|
|
27
|
-
- There is no draft apply/reject or human-review API.
|
|
28
|
-
|
|
29
|
-
## Consumer Tests
|
|
30
|
-
|
|
31
|
-
- `buildPrContextPack` reads the final KB layout directly.
|
|
32
|
-
- The pack includes goal, architecture, indexes, and trusted Markdown files.
|
|
33
|
-
- The pack never includes AI workspace state.
|
|
1
|
+
# Testing Strategy
|
|
2
|
+
|
|
3
|
+
Status: current
|
|
4
|
+
Date: 2026-07-23
|
|
5
|
+
|
|
6
|
+
## Framework Tests
|
|
7
|
+
|
|
8
|
+
- New initialization creates the minimal KB structure.
|
|
9
|
+
- Generated `00-index.md` files remain protected from AI writes.
|
|
10
|
+
- Validation rejects legacy framework artifacts and KB-local AI workspaces.
|
|
11
|
+
|
|
12
|
+
## Commit Automation Tests
|
|
13
|
+
|
|
14
|
+
- One source Git commit renders one exact prompt.
|
|
15
|
+
- A project processes commits oldest-to-newest through a FIFO queue.
|
|
16
|
+
- Repeated Hook and startup reconciliation cannot create duplicate tasks.
|
|
17
|
+
- A completed commit is never automatically dispatched again.
|
|
18
|
+
- `queued` and `running` records recover after a restart.
|
|
19
|
+
- Failed tasks remain retryable and do not become silently completed.
|
|
20
|
+
- Different projects may run independently.
|
|
21
|
+
|
|
22
|
+
## Write-boundary Tests
|
|
23
|
+
|
|
24
|
+
- Automation can write only inside the selected project's KB.
|
|
25
|
+
- The source repository and other project KBs remain read-only.
|
|
26
|
+
- Bash is restricted to the read-only allowlist.
|
|
27
|
+
- There is no draft apply/reject or human-review API.
|
|
28
|
+
|
|
29
|
+
## Consumer Tests
|
|
30
|
+
|
|
31
|
+
- `buildPrContextPack` reads the final KB layout directly.
|
|
32
|
+
- The pack includes goal, architecture, indexes, and trusted Markdown files.
|
|
33
|
+
- The pack never includes AI workspace state.
|