@sanqianx/project-knowledge 5.0.19 → 5.0.20-rc.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/.agents/plugins/marketplace.json +3 -3
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -201
- package/NOTICE +5 -5
- package/README.md +349 -349
- package/_modules/knowledge-engine/README.md +4 -0
- package/_modules/knowledge-engine/src/analysis-failures.js +39 -0
- package/_modules/knowledge-engine/src/analysis-worker.js +6 -2
- package/_modules/knowledge-engine/src/coordinator.js +7 -0
- package/_modules/knowledge-engine/src/headless-analyzer.js +2 -1
- package/_modules/knowledge-engine/src/server.js +1 -1
- package/_site/_test/agent-capture-mcp-ui-test.js +67 -67
- package/_site/_test/ai-profile-test.js +75 -75
- package/_site/_test/ai-vendor-presets-test.js +91 -91
- package/_site/_test/automatic-context-test.js +70 -70
- package/_site/_test/bin-cli-test.js +230 -230
- package/_site/_test/bridge-adapter-test.js +95 -95
- package/_site/_test/bridge-consumer-service-test.js +310 -310
- package/_site/_test/candidate-bin-content-test.js +35 -35
- package/_site/_test/candidate-product-assets-test.js +13 -13
- package/_site/_test/candidate-release-contract-test.js +14 -14
- package/_site/_test/capture-hook-dedup-test.js +158 -158
- package/_site/_test/claude-executable-discovery-test.js +28 -28
- package/_site/_test/claude-session-lifecycle-sweep-test.js +252 -252
- package/_site/_test/cli-instance-management-test.js +62 -62
- package/_site/_test/client-capture-restart-e2e-test.js +189 -189
- package/_site/_test/codex-conversation-projection-test.js +60 -60
- package/_site/_test/codex-marketplace-scoped-path-test.js +186 -186
- package/_site/_test/codex-notify-capture-e2e-test.js +101 -101
- package/_site/_test/codex-notify-fanout-test.js +134 -134
- package/_site/_test/codex-notify-upgrade-test.js +253 -253
- package/_site/_test/commit-boundary-freeze-test.js +147 -147
- package/_site/_test/commit-conversation-binding-test.js +4 -4
- package/_site/_test/configuration-generation-test.js +22 -22
- package/_site/_test/context-pack-test.js +200 -200
- package/_site/_test/conversation-api-test.js +10 -10
- package/_site/_test/conversation-origin-test.js +15 -15
- package/_site/_test/cross-repo-isolation-e2e-test.js +187 -187
- package/_site/_test/embedding-config-test.js +32 -32
- package/_site/_test/fixtures/fake-browser-exit.js +10 -10
- package/_site/_test/fixtures/fake-browser-hang.js +10 -10
- package/_site/_test/fixtures/integration-busy-worker.cjs +6 -6
- package/_site/_test/fixtures/make-git-repos.js +92 -92
- package/_site/_test/fixtures/retrieval-gold-queries.json +32 -32
- package/_site/_test/fresh-hook-reimport-test.js +53 -53
- package/_site/_test/fresh-product-data-test.js +56 -56
- package/_site/_test/git-path-compatibility-test.js +80 -80
- package/_site/_test/git-validation-test.js +81 -81
- package/_site/_test/hook-worktree-test.js +42 -42
- package/_site/_test/index-builder-test.js +41 -41
- package/_site/_test/index-error-display-contract-test.js +10 -10
- package/_site/_test/integration-adapters-test.js +67 -67
- package/_site/_test/integration-capture-setup-test.js +118 -118
- package/_site/_test/integration-runtime-binding-a2-test.js +566 -566
- package/_site/_test/integration-runtime-binding-a3-test.js +227 -227
- package/_site/_test/integration-runtime-binding-test.js +473 -473
- package/_site/_test/integration-status-scan-test.js +29 -29
- package/_site/_test/kb-framework-test.js +57 -57
- package/_site/_test/kbpath-follow-test.js +63 -63
- package/_site/_test/knowledge-db-test.js +144 -144
- package/_site/_test/knowledge-engine-client-test.js +109 -109
- package/_site/_test/knowledge-maintenance-test.js +40 -40
- package/_site/_test/knowledge-panel-ui-contract-test.js +112 -0
- package/_site/_test/knowledge-scopes-test.js +37 -37
- package/_site/_test/knowledge-storage-location-test.js +28 -28
- package/_site/_test/launcher-readiness-test.js +80 -80
- package/_site/_test/legacy-claude-session-alias-test.js +106 -106
- package/_site/_test/legacy-routes-removed-test.js +47 -47
- package/_site/_test/legacy-workbench-exclusion-test.js +92 -92
- package/_site/_test/live-gateway-test.js +48 -48
- package/_site/_test/local-marketplace-test.js +16 -16
- package/_site/_test/log-redaction-test.js +58 -58
- package/_site/_test/markdown-maintenance-test.js +11 -11
- package/_site/_test/model-context-windows-test.js +89 -89
- package/_site/_test/module-agent-start-proxy-test.js +65 -65
- package/_site/_test/module-artifact-integrity-test.js +27 -27
- package/_site/_test/module-boundary-test.js +30 -30
- package/_site/_test/module-bridge-eventbridge-test.js +202 -202
- package/_site/_test/module-dynamic-port-test.js +118 -118
- package/_site/_test/module-index-proxy-test.js +33 -33
- package/_site/_test/module-model-configuration-test.js +44 -44
- package/_site/_test/module-process-lifecycle-test.js +35 -35
- package/_site/_test/module-stream-proxy-test.js +34 -34
- package/_site/_test/module-terminal-restart-test.js +63 -63
- package/_site/_test/module-wiring-unbind-race-test.js +59 -59
- package/_site/_test/native-context-integrations-test.js +86 -86
- package/_site/_test/orphaned-claim-recovery-test.js +80 -80
- package/_site/_test/package-boundary-test.js +43 -42
- package/_site/_test/package-startup-test.js +56 -56
- package/_site/_test/packaged-ui-smoke-test.js +88 -88
- package/_site/_test/pr-consumer-contract-test.js +55 -55
- package/_site/_test/product-brand-contract-test.js +25 -25
- package/_site/_test/product-diagnostics-ui-test.js +93 -93
- package/_site/_test/product-import-ui-test.js +104 -104
- package/_site/_test/product-progress-status-test.js +12 -1
- package/_site/_test/project-remove-running-guard-test.js +79 -79
- package/_site/_test/project-store-test.js +90 -90
- package/_site/_test/registry-events-test.js +38 -38
- package/_site/_test/release-version-sync-test.js +115 -115
- package/_site/_test/requirement-binding-test.js +113 -113
- package/_site/_test/runtime-endpoint-test.js +64 -64
- package/_site/_test/scanner-test.js +83 -83
- package/_site/_test/server-security-test.js +96 -96
- package/_site/_test/sessions-stream-test.js +93 -93
- package/_site/_test/shared-scope-root-binding-test.js +67 -67
- package/_site/_test/simple-import-test.js +98 -98
- package/_site/_test/startup-analysis-disabled-test.js +6 -6
- package/_site/_test/team-knowledge-store-sparse-checkout-test.js +196 -196
- package/_site/_test/team-knowledge-store-test.js +132 -132
- package/_site/_test/test-server-cleanup-test.js +35 -35
- package/_site/_test/test-server-module-isolation-test.js +37 -37
- package/_site/_test/tracking-start-test.js +35 -35
- package/_site/_test/workbench-context-receipts-test.js +22 -22
- package/_site/_test/workspace-ui-contract-test.js +31 -31
- package/_site/_test/zcode-capture-integration-test.js +108 -108
- package/_site/lib/ai-vendor-presets.js +83 -83
- package/_site/lib/ai-workspace.js +3 -3
- package/_site/lib/atomic-file.js +204 -204
- package/_site/lib/bridge-adapter.js +260 -260
- package/_site/lib/capture-hook-config.js +108 -108
- package/_site/lib/claude-cli-runner.js +89 -89
- package/_site/lib/cli-instances.js +43 -43
- package/_site/lib/codex-context-status.js +17 -17
- package/_site/lib/codex-notify-config.js +193 -193
- package/_site/lib/commit-conversation-binder.js +12 -12
- package/_site/lib/commit-reconciler.js +38 -38
- package/_site/lib/context-pack-builder.js +299 -299
- package/_site/lib/conversation-exclusions.js +204 -204
- package/_site/lib/conversation-query-service.js +17 -17
- package/_site/lib/data-dir.js +13 -13
- package/_site/lib/embedding-service.js +85 -85
- package/_site/lib/engine-connection.js +93 -93
- package/_site/lib/engine-knowledge-client.js +72 -72
- package/_site/lib/folder-picker-output.js +3 -3
- package/_site/lib/git-path.js +14 -14
- package/_site/lib/github-team-store.js +3 -3
- package/_site/lib/index-builder.js +157 -157
- package/_site/lib/integration-status-scan.js +99 -99
- package/_site/lib/integration-status-worker.js +14 -14
- package/_site/lib/kb-framework.js +15 -15
- package/_site/lib/knowledge-db.js +363 -363
- package/_site/lib/knowledge-schema.js +121 -121
- package/_site/lib/live-gateway.js +78 -78
- package/_site/lib/llm-client.js +12 -12
- package/_site/lib/model-context-windows.js +82 -82
- package/_site/lib/module-bridge.js +874 -874
- package/_site/lib/module-port-resolver.js +57 -57
- package/_site/lib/post-commit-automation.js +54 -54
- package/_site/lib/product-data.js +35 -35
- package/_site/lib/project-lifecycle-service.js +14 -14
- package/_site/lib/project-registry-store.js +129 -129
- package/_site/lib/prompt-registry.js +148 -148
- package/_site/lib/registry-events.js +16 -16
- package/_site/lib/requirement-adapters.js +10 -10
- package/_site/lib/requirement-binder.js +112 -112
- package/_site/lib/runtime-control.js +89 -89
- package/_site/lib/runtime-endpoint.js +5 -5
- package/_site/lib/zcode-context-integration.js +60 -60
- package/_site/scripts/codex-notify-fanout.cjs +95 -95
- package/_site/scripts/install-module-candidates.js +69 -69
- package/_site/scripts/pack-module-candidates.js +89 -89
- package/_site/scripts/sync-product-content.js +28 -28
- package/_site/scripts/sync-release-version.js +164 -164
- package/_site/scripts/vendor-modules.js +49 -49
- package/_site/scripts/verify-module-runtime.js +50 -50
- package/_site/scripts/verify-product-runtime.js +36 -36
- package/_site/scripts/verify-retrieval-gold.js +83 -83
- package/_site/server.js +15 -15
- package/_site/start.bat +26 -26
- package/_site/stop.bat +11 -11
- package/bin/project-knowledge-integrations.js +254 -254
- package/bin/project-knowledge-kb.js +67 -67
- package/bin/project-knowledge-mcp.js +8 -8
- package/bin/project-knowledge.js +170 -170
- package/claude-prompts.json +21 -21
- package/docs/README.zh-CN.md +205 -205
- package/docs/assets/architecture.svg +181 -181
- package/docs/assets/logo.svg +49 -49
- package/docs/fresh-v5-start.md +42 -42
- package/docs/leader-glm-workbench-playbook.md +122 -122
- package/docs/project-registry-schema.md +11 -11
- package/docs/release-5.0.16-acceptance.md +176 -176
- package/docs/release-5.0.17-acceptance.md +117 -117
- package/docs/release-5.0.19-acceptance.md +39 -25
- package/docs/team-knowledge-mode-a-plan.md +73 -73
- package/module-runtime-manifest.json +53 -33
- package/package.json +3 -2
- 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/change.md +30 -30
- package/templates/project-readme.md +18 -18
- package/ui/index.html +1 -1
- package/ui/knowledge-panel.html +118 -0
- package/ui/product.css +8 -0
- package/ui/product.js +146 -4
- package/vendor-manifest.json +55 -54
|
@@ -139,85 +139,85 @@ async function main() {
|
|
|
139
139
|
});
|
|
140
140
|
const codexResult = await codexManager.operate('update', ['codex']);
|
|
141
141
|
assert(codexResult[0].ok, 'Codex update should complete');
|
|
142
|
-
assert(codexCalls.some(call => call.args.join(' ') === 'plugin marketplace upgrade project-knowledge'), 'Codex should refresh its marketplace');
|
|
143
|
-
assert(codexCalls.some(call => call.args.join(' ') === 'plugin remove project-knowledge@project-knowledge'), 'Codex should remove the cached plugin during update');
|
|
144
|
-
assert(codexCalls.some(call => call.args.join(' ') === 'plugin add project-knowledge@project-knowledge'), 'Codex should install the refreshed plugin');
|
|
145
|
-
|
|
146
|
-
const chainedCodexConfig = path.join(TEMP, 'codex-config.toml');
|
|
147
|
-
const oldNotifier = Buffer.from(JSON.stringify(['node', 'C:/existing-notify.js'])).toString('base64');
|
|
148
|
-
fs.writeFileSync(chainedCodexConfig, `notify = ["node", "C:/tools/devtask-radar/connectors/codex/notify-hook.js", "--previous-notify", "${oldNotifier}"]\n`, 'utf8');
|
|
149
|
-
const chainedManager = new IntegrationManager({
|
|
150
|
-
rootDir: ROOT,
|
|
151
|
-
homeDir: path.join(TEMP, 'codex-home'),
|
|
152
|
-
bridgeHomeDir: path.join(TEMP, 'bridge-home'),
|
|
153
|
-
codexConfigFile: chainedCodexConfig,
|
|
154
|
-
});
|
|
155
|
-
const chained = await chainedManager.installCaptureCodex();
|
|
156
|
-
assert(chained.installed && !chained.conflict, 'a compatible DevTask Radar notifier should chain Bridge instead of blocking capture');
|
|
157
|
-
const chainedConfig = JSON.parse(fs.readFileSync(chainedCodexConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
158
|
-
const nextIndex = chainedConfig.indexOf('--next-base64');
|
|
142
|
+
assert(codexCalls.some(call => call.args.join(' ') === 'plugin marketplace upgrade project-knowledge'), 'Codex should refresh its marketplace');
|
|
143
|
+
assert(codexCalls.some(call => call.args.join(' ') === 'plugin remove project-knowledge@project-knowledge'), 'Codex should remove the cached plugin during update');
|
|
144
|
+
assert(codexCalls.some(call => call.args.join(' ') === 'plugin add project-knowledge@project-knowledge'), 'Codex should install the refreshed plugin');
|
|
145
|
+
|
|
146
|
+
const chainedCodexConfig = path.join(TEMP, 'codex-config.toml');
|
|
147
|
+
const oldNotifier = Buffer.from(JSON.stringify(['node', 'C:/existing-notify.js'])).toString('base64');
|
|
148
|
+
fs.writeFileSync(chainedCodexConfig, `notify = ["node", "C:/tools/devtask-radar/connectors/codex/notify-hook.js", "--previous-notify", "${oldNotifier}"]\n`, 'utf8');
|
|
149
|
+
const chainedManager = new IntegrationManager({
|
|
150
|
+
rootDir: ROOT,
|
|
151
|
+
homeDir: path.join(TEMP, 'codex-home'),
|
|
152
|
+
bridgeHomeDir: path.join(TEMP, 'bridge-home'),
|
|
153
|
+
codexConfigFile: chainedCodexConfig,
|
|
154
|
+
});
|
|
155
|
+
const chained = await chainedManager.installCaptureCodex();
|
|
156
|
+
assert(chained.installed && !chained.conflict, 'a compatible DevTask Radar notifier should chain Bridge instead of blocking capture');
|
|
157
|
+
const chainedConfig = JSON.parse(fs.readFileSync(chainedCodexConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
158
|
+
const nextIndex = chainedConfig.indexOf('--next-base64');
|
|
159
159
|
assert(nextIndex >= 0, 'managed fan-out must preserve the compatible notifier as its independent branch');
|
|
160
|
-
const nextNotify = JSON.parse(Buffer.from(chainedConfig[nextIndex + 1], 'base64').toString('utf8'));
|
|
160
|
+
const nextNotify = JSON.parse(Buffer.from(chainedConfig[nextIndex + 1], 'base64').toString('utf8'));
|
|
161
161
|
assert(nextNotify[1] === 'C:/tools/devtask-radar/connectors/codex/notify-hook.js', 'Radar remains the existing independent notifier');
|
|
162
162
|
const bridgeIndex = chainedConfig.indexOf('--bridge-base64');
|
|
163
163
|
const bridgeNotify = JSON.parse(Buffer.from(chainedConfig[bridgeIndex + 1], 'base64').toString('utf8'));
|
|
164
164
|
assert(bridgeNotify[1] === path.join(TEMP, 'bridge-home', 'bin', 'bridge-hook.cjs'), 'capture must receive the payload through the current Bridge shim');
|
|
165
|
-
const chainedStatus = await chainedManager.statusCaptureCodex();
|
|
166
|
-
assert(chainedStatus.installed && !chainedStatus.conflict, 'status should recognize the compatible chained notifier');
|
|
167
|
-
|
|
168
|
-
const nestedCodexConfig = path.join(TEMP, 'nested-codex-config.toml');
|
|
169
|
-
const nestedDevTask = ['node', 'C:/tools/devtask-radar/connectors/codex/notify-hook.js', '--next-base64', oldNotifier];
|
|
165
|
+
const chainedStatus = await chainedManager.statusCaptureCodex();
|
|
166
|
+
assert(chainedStatus.installed && !chainedStatus.conflict, 'status should recognize the compatible chained notifier');
|
|
167
|
+
|
|
168
|
+
const nestedCodexConfig = path.join(TEMP, 'nested-codex-config.toml');
|
|
169
|
+
const nestedDevTask = ['node', 'C:/tools/devtask-radar/connectors/codex/notify-hook.js', '--next-base64', oldNotifier];
|
|
170
170
|
const desktopExecutable = path.join(TEMP, 'OpenAI', 'Codex', 'runtimes', 'cua_node', 'test-runtime', 'bin', 'node_modules', '@oai', 'sky', 'bin', 'windows', 'codex-computer-use.exe');
|
|
171
171
|
fs.mkdirSync(path.dirname(desktopExecutable), { recursive: true });
|
|
172
172
|
fs.writeFileSync(desktopExecutable, '');
|
|
173
173
|
fs.writeFileSync(nestedCodexConfig, `notify = ${JSON.stringify([desktopExecutable, 'turn-ended', '--previous-notify', JSON.stringify(nestedDevTask)])}\n`, 'utf8');
|
|
174
|
-
const nestedManager = new IntegrationManager({
|
|
175
|
-
rootDir: ROOT,
|
|
176
|
-
homeDir: path.join(TEMP, 'nested-codex-home'),
|
|
177
|
-
bridgeHomeDir: path.join(TEMP, 'nested-bridge-home'),
|
|
178
|
-
codexConfigFile: nestedCodexConfig,
|
|
179
|
-
});
|
|
180
|
-
const nested = await nestedManager.installCaptureCodex();
|
|
181
|
-
assert(nested.installed && !nested.conflict, 'a nested DevTask Radar notifier should be preserved through the fan-out wrapper');
|
|
182
|
-
const nestedConfig = JSON.parse(fs.readFileSync(nestedCodexConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
174
|
+
const nestedManager = new IntegrationManager({
|
|
175
|
+
rootDir: ROOT,
|
|
176
|
+
homeDir: path.join(TEMP, 'nested-codex-home'),
|
|
177
|
+
bridgeHomeDir: path.join(TEMP, 'nested-bridge-home'),
|
|
178
|
+
codexConfigFile: nestedCodexConfig,
|
|
179
|
+
});
|
|
180
|
+
const nested = await nestedManager.installCaptureCodex();
|
|
181
|
+
assert(nested.installed && !nested.conflict, 'a nested DevTask Radar notifier should be preserved through the fan-out wrapper');
|
|
182
|
+
const nestedConfig = JSON.parse(fs.readFileSync(nestedCodexConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
183
183
|
assert(nestedConfig[0] === desktopExecutable, 'the active Codex desktop wrapper keeps its position');
|
|
184
184
|
assert(nestedConfig.join(' ').includes('codex-notify-fanout.cjs'), 'nested notifier chain should use the Project Knowledge fan-out wrapper');
|
|
185
|
-
const nestedStatus = await nestedManager.statusCaptureCodex();
|
|
186
|
-
assert(nestedStatus.installed && !nestedStatus.conflict, 'status should recognize the managed nested fan-out wrapper');
|
|
187
|
-
|
|
188
|
-
// Codex Desktop computer-use wraps the existing notifier as a JSON array in
|
|
189
|
-
// --previous-notify. The managed fan-out is still installed and must not be
|
|
190
|
-
// misreported as a third-party conflict or wrapped a second time.
|
|
191
|
-
const desktopWrappedConfig = path.join(TEMP, 'desktop-wrapped-codex-config.toml');
|
|
185
|
+
const nestedStatus = await nestedManager.statusCaptureCodex();
|
|
186
|
+
assert(nestedStatus.installed && !nestedStatus.conflict, 'status should recognize the managed nested fan-out wrapper');
|
|
187
|
+
|
|
188
|
+
// Codex Desktop computer-use wraps the existing notifier as a JSON array in
|
|
189
|
+
// --previous-notify. The managed fan-out is still installed and must not be
|
|
190
|
+
// misreported as a third-party conflict or wrapped a second time.
|
|
191
|
+
const desktopWrappedConfig = path.join(TEMP, 'desktop-wrapped-codex-config.toml');
|
|
192
192
|
const desktopWrappedArgs = [desktopExecutable, 'turn-ended', '--previous-notify', JSON.stringify(nestedConfig)];
|
|
193
|
-
fs.writeFileSync(desktopWrappedConfig, `notify = ${JSON.stringify(desktopWrappedArgs)}\n`, 'utf8');
|
|
194
|
-
const desktopWrappedManager = new IntegrationManager({
|
|
195
|
-
rootDir: ROOT,
|
|
196
|
-
homeDir: path.join(TEMP, 'desktop-wrapped-codex-home'),
|
|
197
|
-
bridgeHomeDir: path.join(TEMP, 'nested-bridge-home'),
|
|
198
|
-
codexConfigFile: desktopWrappedConfig,
|
|
199
|
-
});
|
|
200
|
-
const desktopWrappedStatus = await desktopWrappedManager.statusCaptureCodex();
|
|
201
|
-
assert(desktopWrappedStatus.installed && !desktopWrappedStatus.conflict,
|
|
202
|
-
'Codex Desktop outer wrapper should preserve managed capture health');
|
|
203
|
-
const beforeDesktopInstall = fs.readFileSync(desktopWrappedConfig, 'utf8');
|
|
204
|
-
const desktopWrappedInstall = await desktopWrappedManager.installCaptureCodex();
|
|
205
|
-
assert(desktopWrappedInstall.installed && !desktopWrappedInstall.conflict,
|
|
206
|
-
'one-click repair should recognize the nested managed fan-out');
|
|
207
|
-
assert(fs.readFileSync(desktopWrappedConfig, 'utf8') === beforeDesktopInstall,
|
|
208
|
-
'healthy Codex Desktop wrapper must remain byte-for-byte unchanged');
|
|
209
|
-
|
|
210
|
-
const bridgeOnlyConfig = path.join(TEMP, 'bridge-only-codex-config.toml');
|
|
211
|
-
const bridgeOnlyManager = new IntegrationManager({
|
|
212
|
-
rootDir: ROOT,
|
|
213
|
-
homeDir: path.join(TEMP, 'bridge-only-codex-home'),
|
|
214
|
-
bridgeHomeDir: path.join(TEMP, 'bridge-only-bridge-home'),
|
|
215
|
-
codexConfigFile: bridgeOnlyConfig,
|
|
216
|
-
});
|
|
217
|
-
const bridgeOnly = await bridgeOnlyManager.installCaptureCodex();
|
|
218
|
-
assert(bridgeOnly.installed && !bridgeOnly.conflict, 'a fresh Codex install should use the payload-preserving fan-out wrapper');
|
|
219
|
-
const bridgeOnlyArgs = JSON.parse(fs.readFileSync(bridgeOnlyConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
220
|
-
assert(bridgeOnlyArgs.join(' ').includes('codex-notify-fanout.cjs'), 'fresh Codex install should use the Project Knowledge fan-out wrapper');
|
|
193
|
+
fs.writeFileSync(desktopWrappedConfig, `notify = ${JSON.stringify(desktopWrappedArgs)}\n`, 'utf8');
|
|
194
|
+
const desktopWrappedManager = new IntegrationManager({
|
|
195
|
+
rootDir: ROOT,
|
|
196
|
+
homeDir: path.join(TEMP, 'desktop-wrapped-codex-home'),
|
|
197
|
+
bridgeHomeDir: path.join(TEMP, 'nested-bridge-home'),
|
|
198
|
+
codexConfigFile: desktopWrappedConfig,
|
|
199
|
+
});
|
|
200
|
+
const desktopWrappedStatus = await desktopWrappedManager.statusCaptureCodex();
|
|
201
|
+
assert(desktopWrappedStatus.installed && !desktopWrappedStatus.conflict,
|
|
202
|
+
'Codex Desktop outer wrapper should preserve managed capture health');
|
|
203
|
+
const beforeDesktopInstall = fs.readFileSync(desktopWrappedConfig, 'utf8');
|
|
204
|
+
const desktopWrappedInstall = await desktopWrappedManager.installCaptureCodex();
|
|
205
|
+
assert(desktopWrappedInstall.installed && !desktopWrappedInstall.conflict,
|
|
206
|
+
'one-click repair should recognize the nested managed fan-out');
|
|
207
|
+
assert(fs.readFileSync(desktopWrappedConfig, 'utf8') === beforeDesktopInstall,
|
|
208
|
+
'healthy Codex Desktop wrapper must remain byte-for-byte unchanged');
|
|
209
|
+
|
|
210
|
+
const bridgeOnlyConfig = path.join(TEMP, 'bridge-only-codex-config.toml');
|
|
211
|
+
const bridgeOnlyManager = new IntegrationManager({
|
|
212
|
+
rootDir: ROOT,
|
|
213
|
+
homeDir: path.join(TEMP, 'bridge-only-codex-home'),
|
|
214
|
+
bridgeHomeDir: path.join(TEMP, 'bridge-only-bridge-home'),
|
|
215
|
+
codexConfigFile: bridgeOnlyConfig,
|
|
216
|
+
});
|
|
217
|
+
const bridgeOnly = await bridgeOnlyManager.installCaptureCodex();
|
|
218
|
+
assert(bridgeOnly.installed && !bridgeOnly.conflict, 'a fresh Codex install should use the payload-preserving fan-out wrapper');
|
|
219
|
+
const bridgeOnlyArgs = JSON.parse(fs.readFileSync(bridgeOnlyConfig, 'utf8').replace(/^\s*notify\s*=\s*/, '').trim());
|
|
220
|
+
assert(bridgeOnlyArgs.join(' ').includes('codex-notify-fanout.cjs'), 'fresh Codex install should use the Project Knowledge fan-out wrapper');
|
|
221
221
|
|
|
222
222
|
const integrationLogs = [];
|
|
223
223
|
const failingManager = new IntegrationManager({
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
// Run: node _site/_test/integration-capture-setup-test.js
|
|
2
|
-
//
|
|
3
|
-
// T18 gates (INSTALL-001/002/003): one Project-Knowledge setup installs
|
|
4
|
-
// Knowledge Integration + Development Capture without opening any client UI;
|
|
5
|
-
// per-client status reports the two capabilities separately; third-party
|
|
6
|
-
// config is preserved; Codex notify conflicts are reported, not overwritten;
|
|
7
|
-
// connector uninstall keeps the host Bridge consumer until a global disable.
|
|
8
|
-
|
|
9
|
-
const assert = require('assert');
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const os = require('os');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
const { IntegrationManager } = require('../lib/integration-installer');
|
|
14
|
-
const { createBridge } = require('@sanqianx/ai-coding-event-bridge-console/src/bridge');
|
|
15
|
-
|
|
16
|
-
const ROOT = path.resolve(__dirname, '..', '..');
|
|
17
|
-
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), `pk-integration-capture-${process.pid}-`));
|
|
18
|
-
const homeDir = path.join(TEMP, 'home');
|
|
19
|
-
const bridgeHome = path.join(TEMP, 'bridge-home');
|
|
20
|
-
const claudeSettings = path.join(TEMP, 'claude-settings.json');
|
|
21
|
-
const codexConfig = path.join(TEMP, 'codex-config.toml');
|
|
22
|
-
const openCodePlugins = path.join(TEMP, 'opencode-plugins');
|
|
23
|
-
|
|
24
|
-
function makeManager() {
|
|
25
|
-
return new IntegrationManager({
|
|
26
|
-
rootDir: ROOT,
|
|
27
|
-
homeDir,
|
|
28
|
-
env: {},
|
|
29
|
-
commandResolver: name => name,
|
|
30
|
-
runner: (command, args) => {
|
|
31
|
-
const version = require('../../package.json').version;
|
|
32
|
-
const cache = path.join(homeDir, '.claude/plugins/cache/project-knowledge/project-knowledge', version);
|
|
33
|
-
if (command === 'claude' && args.slice(0, 2).join(' ') === 'plugin install') { fs.mkdirSync(cache, { recursive: true }); fs.cpSync(path.join(ROOT, 'plugins/project-knowledge'), cache, { recursive: true }); }
|
|
34
|
-
if (command === 'claude' && args.join(' ') === 'plugin list --json') return { status: 0, stdout: JSON.stringify(fs.existsSync(cache) ? [{ id: 'project-knowledge@project-knowledge', version, enabled: true }] : []), stderr: '' };
|
|
35
|
-
const codexCache = path.join(homeDir, 'codex-plugin-cache');
|
|
36
|
-
if (command === 'codex' && args.slice(0, 2).join(' ') === 'plugin add') { fs.mkdirSync(codexCache, { recursive: true }); fs.cpSync(path.join(ROOT, 'plugins/project-knowledge'), codexCache, { recursive: true }); }
|
|
37
|
-
if (command === 'codex' && args.join(' ') === 'plugin list --json') return { status: 0, stdout: JSON.stringify({ installed: fs.existsSync(codexCache) ? [{ pluginId: 'project-knowledge@project-knowledge', version, enabled: true, source: { path: codexCache } }] : [] }), stderr: '' };
|
|
38
|
-
return { status: 0, stdout: '', stderr: '' };
|
|
39
|
-
},
|
|
40
|
-
bridgeHomeDir: bridgeHome,
|
|
41
|
-
codexHookProbe: async () => ({ data: [] }),
|
|
42
|
-
claudeSettingsFile: claudeSettings,
|
|
43
|
-
codexConfigFile: codexConfig,
|
|
44
|
-
openCodePluginsDir: openCodePlugins,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function main() {
|
|
49
|
-
const manager = makeManager();
|
|
50
|
-
|
|
51
|
-
// Third-party entries pre-exist; they must survive every operation.
|
|
52
|
-
fs.mkdirSync(path.dirname(claudeSettings), { recursive: true });
|
|
53
|
-
fs.writeFileSync(claudeSettings, JSON.stringify({
|
|
54
|
-
model: 'sonnet',
|
|
55
|
-
hooks: { Stop: [{ matcher: '*', hooks: [{ type: 'command', command: 'node /somewhere/notify-user.js' }] }] },
|
|
56
|
-
}));
|
|
57
|
-
fs.mkdirSync(path.dirname(codexConfig), { recursive: true });
|
|
58
|
-
fs.writeFileSync(codexConfig, 'model = "gpt-5"\nnotify = ["python", "C:/tools/my-notify.py"]\n');
|
|
59
|
-
fs.mkdirSync(openCodePlugins, { recursive: true });
|
|
60
|
-
fs.writeFileSync(path.join(openCodePlugins, 'my-own-plugin.js'), '// third party\n');
|
|
61
|
-
|
|
62
|
-
// GATE INSTALL-001: one setup action, both capabilities, no client UI.
|
|
63
|
-
const installed = await manager.installAll({ clients: ['claude', 'codex', 'opencode'] });
|
|
64
|
-
assert.strictEqual(installed.bridge.ok, true, 'host Bridge consumer registered once');
|
|
65
|
-
assert.strictEqual(installed.bridge.consumerName, 'project-knowledge');
|
|
66
|
-
for (const entry of installed.clients) {
|
|
67
|
-
assert.strictEqual(entry.knowledgeIntegration.ok, true, `${entry.client} knowledge integration installs`);
|
|
68
|
-
const expectedCapture = entry.client === 'codex' ? 'conflict' : 'installed';
|
|
69
|
-
assert.strictEqual(entry.developmentCapture.state, expectedCapture, `${entry.client} development capture state`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Claude managed hooks written programmatically into the user config.
|
|
73
|
-
const settings = JSON.parse(fs.readFileSync(claudeSettings, 'utf8'));
|
|
74
|
-
const managedClaude = settings.hooks.UserPromptSubmit.some(group => group.hooks.some(hook => String(hook.command).includes('bridge-hook.cjs')));
|
|
75
|
-
assert.strictEqual(managedClaude, true, 'managed Bridge hooks written to Claude user config without any interactive Claude step');
|
|
76
|
-
assert.strictEqual(settings.hooks.Stop.some(group => group.hooks.some(hook => hook.command === 'node /somewhere/notify-user.js')), true, 'Claude third-party hook preserved');
|
|
77
|
-
|
|
78
|
-
// GATE INSTALL-002: Codex third-party notify conflict reported, not overwritten.
|
|
79
|
-
const codexEntry = installed.clients.find(entry => entry.client === 'codex');
|
|
80
|
-
assert.strictEqual(codexEntry.developmentCapture.state, 'conflict', 'Codex reports the third-party notify conflict');
|
|
81
|
-
assert.strictEqual(codexEntry.knowledgeIntegration.ok, true, 'Knowledge Integration stays independent of the Codex capture conflict');
|
|
82
|
-
assert(fs.readFileSync(codexConfig, 'utf8').includes('my-notify.py'), 'third-party notifier never overwritten');
|
|
83
|
-
|
|
84
|
-
// OpenCode managed plugin installed alongside third-party files.
|
|
85
|
-
assert(fs.existsSync(path.join(openCodePlugins, 'ai-coding-event-bridge.js')), 'managed OpenCode plugin written');
|
|
86
|
-
assert(fs.existsSync(path.join(openCodePlugins, 'my-own-plugin.js')), 'third-party plugin preserved');
|
|
87
|
-
|
|
88
|
-
// Status reports the two capabilities separately.
|
|
89
|
-
const status = await manager.statusAll({ clients: ['claude', 'codex', 'opencode'] });
|
|
90
|
-
assert.strictEqual(status.bridge.consumerRegistered, true);
|
|
91
|
-
assert.strictEqual(status.bridge.bridgeHealthy, true);
|
|
92
|
-
const claudeStatus = status.clients.find(entry => entry.client === 'claude');
|
|
93
|
-
assert.strictEqual(claudeStatus.developmentCapture.installed, true);
|
|
94
|
-
const codexStatus = status.clients.find(entry => entry.client === 'codex');
|
|
95
|
-
assert.strictEqual(codexStatus.developmentCapture.conflict, true, 'conflict surfaces in status');
|
|
96
|
-
assert.ok(Number.isInteger(status.bridge.health.lastSequence), 'bridge health fields available for the UI');
|
|
97
|
-
|
|
98
|
-
// GATE INSTALL-003: removing one connector keeps the host consumer.
|
|
99
|
-
await manager.uninstallCaptureClaude({});
|
|
100
|
-
const facade = createBridge({ homeDir: bridgeHome });
|
|
101
|
-
assert.strictEqual(Boolean(await facade.getConsumer('project-knowledge')), true, 'consumer survives a single connector uninstall');
|
|
102
|
-
const settingsAfterClaude = JSON.parse(fs.readFileSync(claudeSettings, 'utf8'));
|
|
103
|
-
assert.strictEqual(settingsAfterClaude.hooks.UserPromptSubmit, undefined, 'managed Claude hook removed');
|
|
104
|
-
assert.strictEqual(settingsAfterClaude.hooks.Stop[0].hooks[0].command, 'node /somewhere/notify-user.js', 'third-party hook still intact');
|
|
105
|
-
|
|
106
|
-
// Another registered consumer stays untouched by a global disable.
|
|
107
|
-
await facade.registerConsumer('devtask-radar');
|
|
108
|
-
const disabled = await manager.disableAllCapture({ clients: ['claude', 'codex', 'opencode'] });
|
|
109
|
-
assert.strictEqual(disabled.consumer.ok, true, 'global disable unregisters the project-knowledge consumer');
|
|
110
|
-
const consumers = await facade.listConsumers();
|
|
111
|
-
assert.deepStrictEqual(consumers.map(consumer => consumer.name), ['devtask-radar'], 'other consumers remain');
|
|
112
|
-
assert(!fs.existsSync(path.join(openCodePlugins, 'ai-coding-event-bridge.js')), 'managed plugin removed');
|
|
113
|
-
assert(fs.existsSync(path.join(openCodePlugins, 'my-own-plugin.js')), 'third-party plugin survives global disable');
|
|
114
|
-
|
|
115
|
-
console.log('integration-capture-setup-test PASS');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
module.exports = main();
|
|
1
|
+
// Run: node _site/_test/integration-capture-setup-test.js
|
|
2
|
+
//
|
|
3
|
+
// T18 gates (INSTALL-001/002/003): one Project-Knowledge setup installs
|
|
4
|
+
// Knowledge Integration + Development Capture without opening any client UI;
|
|
5
|
+
// per-client status reports the two capabilities separately; third-party
|
|
6
|
+
// config is preserved; Codex notify conflicts are reported, not overwritten;
|
|
7
|
+
// connector uninstall keeps the host Bridge consumer until a global disable.
|
|
8
|
+
|
|
9
|
+
const assert = require('assert');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { IntegrationManager } = require('../lib/integration-installer');
|
|
14
|
+
const { createBridge } = require('@sanqianx/ai-coding-event-bridge-console/src/bridge');
|
|
15
|
+
|
|
16
|
+
const ROOT = path.resolve(__dirname, '..', '..');
|
|
17
|
+
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), `pk-integration-capture-${process.pid}-`));
|
|
18
|
+
const homeDir = path.join(TEMP, 'home');
|
|
19
|
+
const bridgeHome = path.join(TEMP, 'bridge-home');
|
|
20
|
+
const claudeSettings = path.join(TEMP, 'claude-settings.json');
|
|
21
|
+
const codexConfig = path.join(TEMP, 'codex-config.toml');
|
|
22
|
+
const openCodePlugins = path.join(TEMP, 'opencode-plugins');
|
|
23
|
+
|
|
24
|
+
function makeManager() {
|
|
25
|
+
return new IntegrationManager({
|
|
26
|
+
rootDir: ROOT,
|
|
27
|
+
homeDir,
|
|
28
|
+
env: {},
|
|
29
|
+
commandResolver: name => name,
|
|
30
|
+
runner: (command, args) => {
|
|
31
|
+
const version = require('../../package.json').version;
|
|
32
|
+
const cache = path.join(homeDir, '.claude/plugins/cache/project-knowledge/project-knowledge', version);
|
|
33
|
+
if (command === 'claude' && args.slice(0, 2).join(' ') === 'plugin install') { fs.mkdirSync(cache, { recursive: true }); fs.cpSync(path.join(ROOT, 'plugins/project-knowledge'), cache, { recursive: true }); }
|
|
34
|
+
if (command === 'claude' && args.join(' ') === 'plugin list --json') return { status: 0, stdout: JSON.stringify(fs.existsSync(cache) ? [{ id: 'project-knowledge@project-knowledge', version, enabled: true }] : []), stderr: '' };
|
|
35
|
+
const codexCache = path.join(homeDir, 'codex-plugin-cache');
|
|
36
|
+
if (command === 'codex' && args.slice(0, 2).join(' ') === 'plugin add') { fs.mkdirSync(codexCache, { recursive: true }); fs.cpSync(path.join(ROOT, 'plugins/project-knowledge'), codexCache, { recursive: true }); }
|
|
37
|
+
if (command === 'codex' && args.join(' ') === 'plugin list --json') return { status: 0, stdout: JSON.stringify({ installed: fs.existsSync(codexCache) ? [{ pluginId: 'project-knowledge@project-knowledge', version, enabled: true, source: { path: codexCache } }] : [] }), stderr: '' };
|
|
38
|
+
return { status: 0, stdout: '', stderr: '' };
|
|
39
|
+
},
|
|
40
|
+
bridgeHomeDir: bridgeHome,
|
|
41
|
+
codexHookProbe: async () => ({ data: [] }),
|
|
42
|
+
claudeSettingsFile: claudeSettings,
|
|
43
|
+
codexConfigFile: codexConfig,
|
|
44
|
+
openCodePluginsDir: openCodePlugins,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function main() {
|
|
49
|
+
const manager = makeManager();
|
|
50
|
+
|
|
51
|
+
// Third-party entries pre-exist; they must survive every operation.
|
|
52
|
+
fs.mkdirSync(path.dirname(claudeSettings), { recursive: true });
|
|
53
|
+
fs.writeFileSync(claudeSettings, JSON.stringify({
|
|
54
|
+
model: 'sonnet',
|
|
55
|
+
hooks: { Stop: [{ matcher: '*', hooks: [{ type: 'command', command: 'node /somewhere/notify-user.js' }] }] },
|
|
56
|
+
}));
|
|
57
|
+
fs.mkdirSync(path.dirname(codexConfig), { recursive: true });
|
|
58
|
+
fs.writeFileSync(codexConfig, 'model = "gpt-5"\nnotify = ["python", "C:/tools/my-notify.py"]\n');
|
|
59
|
+
fs.mkdirSync(openCodePlugins, { recursive: true });
|
|
60
|
+
fs.writeFileSync(path.join(openCodePlugins, 'my-own-plugin.js'), '// third party\n');
|
|
61
|
+
|
|
62
|
+
// GATE INSTALL-001: one setup action, both capabilities, no client UI.
|
|
63
|
+
const installed = await manager.installAll({ clients: ['claude', 'codex', 'opencode'] });
|
|
64
|
+
assert.strictEqual(installed.bridge.ok, true, 'host Bridge consumer registered once');
|
|
65
|
+
assert.strictEqual(installed.bridge.consumerName, 'project-knowledge');
|
|
66
|
+
for (const entry of installed.clients) {
|
|
67
|
+
assert.strictEqual(entry.knowledgeIntegration.ok, true, `${entry.client} knowledge integration installs`);
|
|
68
|
+
const expectedCapture = entry.client === 'codex' ? 'conflict' : 'installed';
|
|
69
|
+
assert.strictEqual(entry.developmentCapture.state, expectedCapture, `${entry.client} development capture state`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Claude managed hooks written programmatically into the user config.
|
|
73
|
+
const settings = JSON.parse(fs.readFileSync(claudeSettings, 'utf8'));
|
|
74
|
+
const managedClaude = settings.hooks.UserPromptSubmit.some(group => group.hooks.some(hook => String(hook.command).includes('bridge-hook.cjs')));
|
|
75
|
+
assert.strictEqual(managedClaude, true, 'managed Bridge hooks written to Claude user config without any interactive Claude step');
|
|
76
|
+
assert.strictEqual(settings.hooks.Stop.some(group => group.hooks.some(hook => hook.command === 'node /somewhere/notify-user.js')), true, 'Claude third-party hook preserved');
|
|
77
|
+
|
|
78
|
+
// GATE INSTALL-002: Codex third-party notify conflict reported, not overwritten.
|
|
79
|
+
const codexEntry = installed.clients.find(entry => entry.client === 'codex');
|
|
80
|
+
assert.strictEqual(codexEntry.developmentCapture.state, 'conflict', 'Codex reports the third-party notify conflict');
|
|
81
|
+
assert.strictEqual(codexEntry.knowledgeIntegration.ok, true, 'Knowledge Integration stays independent of the Codex capture conflict');
|
|
82
|
+
assert(fs.readFileSync(codexConfig, 'utf8').includes('my-notify.py'), 'third-party notifier never overwritten');
|
|
83
|
+
|
|
84
|
+
// OpenCode managed plugin installed alongside third-party files.
|
|
85
|
+
assert(fs.existsSync(path.join(openCodePlugins, 'ai-coding-event-bridge.js')), 'managed OpenCode plugin written');
|
|
86
|
+
assert(fs.existsSync(path.join(openCodePlugins, 'my-own-plugin.js')), 'third-party plugin preserved');
|
|
87
|
+
|
|
88
|
+
// Status reports the two capabilities separately.
|
|
89
|
+
const status = await manager.statusAll({ clients: ['claude', 'codex', 'opencode'] });
|
|
90
|
+
assert.strictEqual(status.bridge.consumerRegistered, true);
|
|
91
|
+
assert.strictEqual(status.bridge.bridgeHealthy, true);
|
|
92
|
+
const claudeStatus = status.clients.find(entry => entry.client === 'claude');
|
|
93
|
+
assert.strictEqual(claudeStatus.developmentCapture.installed, true);
|
|
94
|
+
const codexStatus = status.clients.find(entry => entry.client === 'codex');
|
|
95
|
+
assert.strictEqual(codexStatus.developmentCapture.conflict, true, 'conflict surfaces in status');
|
|
96
|
+
assert.ok(Number.isInteger(status.bridge.health.lastSequence), 'bridge health fields available for the UI');
|
|
97
|
+
|
|
98
|
+
// GATE INSTALL-003: removing one connector keeps the host consumer.
|
|
99
|
+
await manager.uninstallCaptureClaude({});
|
|
100
|
+
const facade = createBridge({ homeDir: bridgeHome });
|
|
101
|
+
assert.strictEqual(Boolean(await facade.getConsumer('project-knowledge')), true, 'consumer survives a single connector uninstall');
|
|
102
|
+
const settingsAfterClaude = JSON.parse(fs.readFileSync(claudeSettings, 'utf8'));
|
|
103
|
+
assert.strictEqual(settingsAfterClaude.hooks.UserPromptSubmit, undefined, 'managed Claude hook removed');
|
|
104
|
+
assert.strictEqual(settingsAfterClaude.hooks.Stop[0].hooks[0].command, 'node /somewhere/notify-user.js', 'third-party hook still intact');
|
|
105
|
+
|
|
106
|
+
// Another registered consumer stays untouched by a global disable.
|
|
107
|
+
await facade.registerConsumer('devtask-radar');
|
|
108
|
+
const disabled = await manager.disableAllCapture({ clients: ['claude', 'codex', 'opencode'] });
|
|
109
|
+
assert.strictEqual(disabled.consumer.ok, true, 'global disable unregisters the project-knowledge consumer');
|
|
110
|
+
const consumers = await facade.listConsumers();
|
|
111
|
+
assert.deepStrictEqual(consumers.map(consumer => consumer.name), ['devtask-radar'], 'other consumers remain');
|
|
112
|
+
assert(!fs.existsSync(path.join(openCodePlugins, 'ai-coding-event-bridge.js')), 'managed plugin removed');
|
|
113
|
+
assert(fs.existsSync(path.join(openCodePlugins, 'my-own-plugin.js')), 'third-party plugin survives global disable');
|
|
114
|
+
|
|
115
|
+
console.log('integration-capture-setup-test PASS');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = main();
|