@sanqianx/project-knowledge 5.1.2 → 5.1.3
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +2 -2
- package/_site/_test/capture-hook-dedup-test.js +1 -1
- package/_site/_test/fresh-product-data-test.js +1 -1
- package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +1 -1
- package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +1 -1
- package/_site/_test/helpers/parallel-memory-injection-shell.js +1 -1
- package/_site/_test/helpers/parallel-retrieval-followup-r2-shell.js +1 -1
- package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +1 -1
- package/_site/_test/helpers/parallel-workbench-fixture.js +1 -1
- package/_site/_test/helpers/parallel-workbench-integration-5025-fixture.js +1 -1
- package/_site/_test/helpers/qa-r44-env.js +2 -2
- package/_site/_test/integration-runtime-binding-a2-test.js +2 -2
- package/_site/_test/integration-runtime-binding-test.js +3 -3
- package/_site/_test/launcher-readiness-test.js +1 -1
- package/_site/lib/data-dir.js +1 -1
- package/bin/project-knowledge.js +1 -1
- package/module-runtime-manifest.json +5 -5
- package/package.json +1 -1
- 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 +2 -2
- package/plugins/project-knowledge/scripts/context-hook.cjs +1 -1
- package/plugins/project-knowledge/scripts/mcp-launcher.cjs +1 -1
package/README.md
CHANGED
|
@@ -200,7 +200,7 @@ new empty knowledge directories. Old files remain untouched but are not read.
|
|
|
200
200
|
See [fresh v5 setup](docs/fresh-v5-start.md). Queued tasks can be cancelled by
|
|
201
201
|
unbinding; only an active knowledge/index writer blocks removal.
|
|
202
202
|
|
|
203
|
-
Default internal data directory: `~/.project-knowledge
|
|
203
|
+
Default internal data directory: `~/.project-knowledge/`
|
|
204
204
|
|
|
205
205
|
Override it with `KB_DATA_DIR`:
|
|
206
206
|
|
|
@@ -224,7 +224,7 @@ Settings, registration metadata, caches, runtime state, logs, and recovery
|
|
|
224
224
|
assets remain in the internal data directory; vector payloads do not:
|
|
225
225
|
|
|
226
226
|
```text
|
|
227
|
-
~/.project-knowledge
|
|
227
|
+
~/.project-knowledge/
|
|
228
228
|
├── settings.json
|
|
229
229
|
├── projects.json # minimal project ID/order index
|
|
230
230
|
├── projects/<projectId>/
|
|
@@ -13,7 +13,7 @@ const ROOT = path.resolve(__dirname, '../..');
|
|
|
13
13
|
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), 'pk-capture-dedup-'));
|
|
14
14
|
const HOME = path.join(TEMP, '用户 空格');
|
|
15
15
|
const OLD = path.join(HOME, '.ai-coding-event-bridge');
|
|
16
|
-
const CURRENT = path.join(HOME, '.project-knowledge
|
|
16
|
+
const CURRENT = path.join(HOME, '.project-knowledge/events');
|
|
17
17
|
const options = { homeDir: HOME, bridgeHomeDir: CURRENT };
|
|
18
18
|
const shim = home => path.join(home, 'bin/bridge-hook.cjs');
|
|
19
19
|
const cmd = home => ({ type: 'command', command: `node "${shim(home)}"` });
|
|
@@ -8,7 +8,7 @@ const { connectEngine } = require('../lib/engine-connection');
|
|
|
8
8
|
|
|
9
9
|
(async () => {
|
|
10
10
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'kb-fresh-product-'));
|
|
11
|
-
assert.equal(resolveDataDirPath({ dataDir: '', homeDir: root }), path.join(root, '.project-knowledge
|
|
11
|
+
assert.equal(resolveDataDirPath({ dataDir: '', homeDir: root }), path.join(root, '.project-knowledge'));
|
|
12
12
|
const old = path.join(root, 'old'); fs.mkdirSync(old);
|
|
13
13
|
const bytes = JSON.stringify({ projects: ['old-project'], activeClaim: 'old-claim' });
|
|
14
14
|
fs.writeFileSync(path.join(old, 'projects.json'), bytes);
|
|
@@ -42,7 +42,7 @@ const MODULE_API_PREFIX = '/api/claude-workbench/v1';
|
|
|
42
42
|
// fixture data dir. The live desktop core 5.0.24 installation is never
|
|
43
43
|
// written to, restarted or replaced.
|
|
44
44
|
const REAL_PROFILE_STORES = [
|
|
45
|
-
path.join(os.homedir(), '.project-knowledge
|
|
45
|
+
path.join(os.homedir(), '.project-knowledge', 'workbench'),
|
|
46
46
|
path.join(os.homedir(), '.agent-terminal'),
|
|
47
47
|
];
|
|
48
48
|
|
|
@@ -102,7 +102,7 @@ const REAL_USERPROFILE = process.env.USERPROFILE || REAL_HOME;
|
|
|
102
102
|
// a time, and the secret that is read there never leaves the server process
|
|
103
103
|
// memory: it is handed over through a pipe, never written to a file.
|
|
104
104
|
const REAL_PROFILE_STORES = [
|
|
105
|
-
path.join(REAL_HOME, '.project-knowledge
|
|
105
|
+
path.join(REAL_HOME, '.project-knowledge', 'workbench'),
|
|
106
106
|
path.join(REAL_HOME, '.agent-terminal'),
|
|
107
107
|
];
|
|
108
108
|
|
|
@@ -273,7 +273,7 @@ function hostEnv(layout, extra = {}) {
|
|
|
273
273
|
function realWorkbenchProfileDir() {
|
|
274
274
|
const override = String(process.env.PK_WB_REAL_PROFILE_DIR || '').trim();
|
|
275
275
|
if (override) return path.resolve(override);
|
|
276
|
-
return path.join(REAL_HOME, '.project-knowledge
|
|
276
|
+
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// Byte-level snapshot of a flat directory. The SHA-256 digests stay in the
|
|
@@ -280,7 +280,7 @@ function hostEnv(layout, extra = {}) {
|
|
|
280
280
|
function realWorkbenchProfileDir() {
|
|
281
281
|
const override = String(process.env.PK_WB_REAL_PROFILE_DIR || '').trim();
|
|
282
282
|
if (override) return path.resolve(override);
|
|
283
|
-
return path.join(REAL_HOME, '.project-knowledge
|
|
283
|
+
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// Byte-level snapshot of a flat directory. The SHA-256 digests stay in the
|
|
@@ -250,7 +250,7 @@ function hostEnv(layout, extra = {}) {
|
|
|
250
250
|
// captured at module load. R5 uses this string exclusively to prove that no
|
|
251
251
|
// isolated env value points there; this helper never touches the filesystem.
|
|
252
252
|
function realWorkbenchProfileDir() {
|
|
253
|
-
return path.join(REAL_HOME, '.project-knowledge
|
|
253
|
+
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
// The module that is hosted: the copy the installed product ships, unless
|
|
@@ -214,7 +214,7 @@ function hostEnv(layout, extra = {}) {
|
|
|
214
214
|
function realWorkbenchProfileDir() {
|
|
215
215
|
const override = String(process.env.PK_WB_REAL_PROFILE_DIR || '').trim();
|
|
216
216
|
if (override) return path.resolve(override);
|
|
217
|
-
return path.join(REAL_HOME, '.project-knowledge
|
|
217
|
+
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// Byte-level snapshot of a flat directory. The SHA256 digests stay in the
|
|
@@ -309,7 +309,7 @@ function hostEnv(layout, extra = {}) {
|
|
|
309
309
|
// no isolated env value points there; this helper never touches the
|
|
310
310
|
// filesystem.
|
|
311
311
|
function realWorkbenchProfileDir() {
|
|
312
|
-
return path.join(REAL_HOME, '.project-knowledge
|
|
312
|
+
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
// The module that is hosted: the copy the installed product ships, unless
|
|
@@ -105,7 +105,7 @@ function isInside(candidate, parent) {
|
|
|
105
105
|
// hardens its own environment, and os.homedir() reads the REDIRECTED
|
|
106
106
|
// USERPROFILE once the isolation is applied. The value is therefore captured
|
|
107
107
|
// at load time and refreshed by the capture, never re-derived later.
|
|
108
|
-
let REAL_PROFILE_DIR = path.join(os.homedir(), '.project-knowledge
|
|
108
|
+
let REAL_PROFILE_DIR = path.join(os.homedir(), '.project-knowledge', 'workbench');
|
|
109
109
|
function realProfileDir() { return REAL_PROFILE_DIR; }
|
|
110
110
|
|
|
111
111
|
// The lane's own temp root, outside the repository and outside the real
|
|
@@ -190,7 +190,7 @@ function captureRealEnvironment() {
|
|
|
190
190
|
const chrome = findChromeDetailed();
|
|
191
191
|
const claude = findClaudeExecutable();
|
|
192
192
|
const present = (name) => Object.keys(process.env).some(key => key.toUpperCase() === name && String(process.env[key] || '').trim() !== '');
|
|
193
|
-
REAL_PROFILE_DIR = path.join(realHome, '.project-knowledge
|
|
193
|
+
REAL_PROFILE_DIR = path.join(realHome, '.project-knowledge', 'workbench');
|
|
194
194
|
return {
|
|
195
195
|
realHome,
|
|
196
196
|
realUserProfile,
|
|
@@ -508,8 +508,8 @@ async function testProbeEnvUsesManagerDataDir() {
|
|
|
508
508
|
// not leak into the probe: the manager's own home-based binding wins.
|
|
509
509
|
const goodData = stubServerPackage('ok-env');
|
|
510
510
|
const goodHome = dir('env-good-home');
|
|
511
|
-
fs.mkdirSync(path.join(goodHome, '.project-knowledge
|
|
512
|
-
fs.copyFileSync(bindingPathOf(goodData), path.join(goodHome, '.project-knowledge
|
|
511
|
+
fs.mkdirSync(path.join(goodHome, '.project-knowledge'), { recursive: true });
|
|
512
|
+
fs.copyFileSync(bindingPathOf(goodData), path.join(goodHome, '.project-knowledge', 'integration-runtime.json'));
|
|
513
513
|
const evilPkg = dir('env-evil-pkg');
|
|
514
514
|
fakePackage(evilPkg, { version: '5.0.15' });
|
|
515
515
|
const evilData = dir('env-evil-data');
|
|
@@ -230,7 +230,7 @@ async function testBootstrapResolvesForBothNativeForms() {
|
|
|
230
230
|
|
|
231
231
|
async function testInstallerBindingLifecycle() {
|
|
232
232
|
const home = path.join(TEMP, 'installer-home');
|
|
233
|
-
const dataDir = path.join(home, '.project-knowledge
|
|
233
|
+
const dataDir = path.join(home, '.project-knowledge');
|
|
234
234
|
const bindingPath = path.join(dataDir, 'integration-runtime.json');
|
|
235
235
|
const manager = new IntegrationManager({
|
|
236
236
|
rootDir: ROOT,
|
|
@@ -274,7 +274,7 @@ async function testInstallerBindingLifecycle() {
|
|
|
274
274
|
|
|
275
275
|
async function testInstallAllCaptureOnlySkipsBinding() {
|
|
276
276
|
const home = path.join(TEMP, 'install-all-home');
|
|
277
|
-
const dataDir = path.join(home, '.project-knowledge
|
|
277
|
+
const dataDir = path.join(home, '.project-knowledge');
|
|
278
278
|
const bridgeStub = {
|
|
279
279
|
createBridge: () => ({
|
|
280
280
|
registerConsumer: async () => ({}),
|
|
@@ -303,7 +303,7 @@ async function testInstallAllCaptureOnlySkipsBinding() {
|
|
|
303
303
|
|
|
304
304
|
async function testMcpStartupProbe() {
|
|
305
305
|
const home = path.join(TEMP, 'probe-home');
|
|
306
|
-
const dataDir = path.join(home, '.project-knowledge
|
|
306
|
+
const dataDir = path.join(home, '.project-knowledge');
|
|
307
307
|
const packageInfo = readJson(path.join(ROOT, 'package.json'));
|
|
308
308
|
writeBinding(dataDir, { schema: RUNTIME_SCHEMA, packageName: packageInfo.name, packageRoot: ROOT, version: packageInfo.version, updatedAt: new Date().toISOString() });
|
|
309
309
|
const manager = new IntegrationManager({
|
|
@@ -10,7 +10,7 @@ const endpoint = require('../lib/runtime-endpoint');
|
|
|
10
10
|
const packageRoot = process.env.KB_LAUNCHER_TEST_PACKAGE || path.resolve(__dirname, '../..');
|
|
11
11
|
const bin = path.join(packageRoot, 'bin/project-knowledge.js');
|
|
12
12
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'kb-launcher-readiness-'));
|
|
13
|
-
const data = path.join(root, '.project-knowledge
|
|
13
|
+
const data = path.join(root, '.project-knowledge');
|
|
14
14
|
const record = path.join(data, 'runtime/claude-sessions/project-a/session.json');
|
|
15
15
|
const recordBytes = JSON.stringify({ schema: 'claude-workbench-session/v1', sessionId: 'old-test', projectSlug: 'project-a', state: 'running', metadata: { automation: true } });
|
|
16
16
|
fs.mkdirSync(path.dirname(record), { recursive: true });
|
package/_site/lib/data-dir.js
CHANGED
|
@@ -5,7 +5,7 @@ const os = require('os');
|
|
|
5
5
|
let resolved = null;
|
|
6
6
|
function resolveDataDirPath(options = {}) {
|
|
7
7
|
const configured = options.dataDir === undefined ? process.env.KB_DATA_DIR : options.dataDir;
|
|
8
|
-
return path.resolve(configured || path.join(options.homeDir || os.homedir(), '.project-knowledge
|
|
8
|
+
return path.resolve(configured || path.join(options.homeDir || os.homedir(), '.project-knowledge'));
|
|
9
9
|
}
|
|
10
10
|
function ensureDataDir(dataDir = resolveDataDirPath()) { fs.mkdirSync(dataDir, { recursive: true }); return path.resolve(dataDir); }
|
|
11
11
|
function getDataDir() { if (!resolved) resolved = resolveDataDirPath(); return resolved; }
|
package/bin/project-knowledge.js
CHANGED
|
@@ -25,7 +25,7 @@ Usage:
|
|
|
25
25
|
|
|
26
26
|
Options:
|
|
27
27
|
-p, --port <port> Port (default: 5757, startup auto-fallback +19)
|
|
28
|
-
--data <dir> Select data directory (default: ~/.project-knowledge
|
|
28
|
+
--data <dir> Select data directory (default: ~/.project-knowledge)
|
|
29
29
|
--host <host> Bind host (default: 127.0.0.1)
|
|
30
30
|
--no-open Do not open browser
|
|
31
31
|
--fg Run in foreground
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"ui/favicon.svg": "c48be946b224112ebb0238b44263f7a61bda31e531afa895c2e9801c0ff24f32",
|
|
10
10
|
"plugins/project-knowledge/hooks/claude.json": "d61510327e3e1facbb4c645228e9f50cad05a88b33d80c4c22e5ba9f8b9f5359",
|
|
11
11
|
"plugins/project-knowledge/hooks/codex.json": "216e03c07295606ef6ebb2c4f669ad0d790b5e7c4f3f34600488033db75e4239",
|
|
12
|
-
"plugins/project-knowledge/scripts/context-hook.cjs": "
|
|
13
|
-
"plugins/project-knowledge/scripts/mcp-launcher.cjs": "
|
|
14
|
-
"plugins/project-knowledge/.claude-plugin/plugin.json": "
|
|
15
|
-
"plugins/project-knowledge/.codex-plugin/plugin.json": "
|
|
16
|
-
"plugins/project-knowledge/.mcp.json": "
|
|
12
|
+
"plugins/project-knowledge/scripts/context-hook.cjs": "12f9120a4503193042eff109da3688e909ef8a0f8409bf38c7f47f6e36941d86",
|
|
13
|
+
"plugins/project-knowledge/scripts/mcp-launcher.cjs": "c9235eaf722ad011ce42d7a8416a77bef8e2a65e174f27b3d183f4b8f811f293",
|
|
14
|
+
"plugins/project-knowledge/.claude-plugin/plugin.json": "f05c4000bfe5edea956e8ee472d698aecdc34bbfe79010b1b09ad1a2784a5caa",
|
|
15
|
+
"plugins/project-knowledge/.codex-plugin/plugin.json": "8e38a3bbe337087238a681a41f88c4753616f298de0e339f37660dbb42aa69f2",
|
|
16
|
+
"plugins/project-knowledge/.mcp.json": "89bce93cc7544443d060a25e318399cb013f2d694fdcc43c31110f4411be67ff",
|
|
17
17
|
"ui/version-info.js": "01a82217b031de54b80d6c7974da9c70888c4c90a046bd4248a808f7989ddce7",
|
|
18
18
|
"ui/version-info.css": "209fad8e42b661f72d2aba3280e1ca47768b5cefb776fe5459538d34fbad120f"
|
|
19
19
|
},
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
|
|
3
3
|
"name": "project-knowledge",
|
|
4
4
|
"hooks": "./hooks/claude.json",
|
|
5
|
-
"version": "5.1.
|
|
5
|
+
"version": "5.1.3",
|
|
6
6
|
"description": "Read durable project decisions and implementation history from Project Knowledge.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "SanQianX",
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
"command": "node",
|
|
6
6
|
"args": [
|
|
7
7
|
"-e",
|
|
8
|
-
"const fs=require('fs'),path=require('path'),os=require('os');const PKG='@sanqianx/project-knowledge',SC='project-knowledge/integration-runtime/v1';let f='';const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root){f=path.join(root,'scripts','mcp-launcher.cjs');if(!fs.existsSync(f))f=''}if(!f){const dd=process.env.KB_DATA_DIR||path.join(os.homedir(),'.project-knowledge
|
|
8
|
+
"const fs=require('fs'),path=require('path'),os=require('os');const PKG='@sanqianx/project-knowledge',SC='project-knowledge/integration-runtime/v1';let f='';const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root){f=path.join(root,'scripts','mcp-launcher.cjs');if(!fs.existsSync(f))f=''}if(!f){const dd=process.env.KB_DATA_DIR||path.join(os.homedir(),'.project-knowledge');try{const bp=path.join(dd,'integration-runtime.json');const st=fs.statSync(bp);if(st.isFile()&&st.size<=32768){const b=JSON.parse(fs.readFileSync(bp,'utf8'));if(b&&b.schema===SC&&b.packageName===PKG&&typeof b.packageRoot==='string'&&path.isAbsolute(b.packageRoot)){const c=path.join(b.packageRoot,'plugins','project-knowledge','scripts','mcp-launcher.cjs');const rr=fs.realpathSync(b.packageRoot),cr=fs.realpathSync(c);const rel=path.relative(rr,cr);if(rel&&rel!=='..'&&!rel.startsWith('..'+path.sep)&&!path.isAbsolute(rel)&&fs.statSync(cr).isFile())f=cr}}}catch(e){}}if(!f){console.error('[project-knowledge-mcp] 未能通过受信任插件根或已验证的安装绑定定位启动器,已停止;不访问网络,也不加载工作目录源码。');process.exit(127)}require(f);"
|
|
9
9
|
],
|
|
10
10
|
"env": {
|
|
11
|
-
"KB_PLUGIN_VERSION": "5.1.
|
|
11
|
+
"KB_PLUGIN_VERSION": "5.1.3"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -29,7 +29,7 @@ function log(dataDir, event, input) {
|
|
|
29
29
|
async function run(payload, { env = process.env, argv = process.argv.slice(2), fetchImpl = fetch, timeoutMs = 10000 } = {}) {
|
|
30
30
|
if (env.KB_KNOWLEDGE_CONTEXT === '0' || !payload || payload.hook_event_name !== 'UserPromptSubmit') return {};
|
|
31
31
|
const client = clientFrom(argv), requestId = `context-${crypto.randomUUID()}`, started = Date.now();
|
|
32
|
-
const dataDir = path.resolve(env.KB_DATA_DIR || path.join(os.homedir(), '.project-knowledge
|
|
32
|
+
const dataDir = path.resolve(env.KB_DATA_DIR || path.join(os.homedir(), '.project-knowledge'));
|
|
33
33
|
if (typeof payload.cwd !== 'string' || !path.isAbsolute(payload.cwd) || typeof payload.prompt !== 'string' || !payload.prompt.trim() || payload.prompt.length > 131072) return {};
|
|
34
34
|
const controller = new AbortController(), timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
35
35
|
let result;
|
|
@@ -32,7 +32,7 @@ function fail(code) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function bindingPath() {
|
|
35
|
-
return path.join(process.env.KB_DATA_DIR || path.join(os.homedir(), '.project-knowledge
|
|
35
|
+
return path.join(process.env.KB_DATA_DIR || path.join(os.homedir(), '.project-knowledge'), 'integration-runtime.json');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function loadBinding() {
|