fluffy-context 0.3.0 → 0.3.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/README.md +2 -2
- package/dist/src/integrations/claude-code.js +36 -13
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Context Runtime
|
|
2
2
|
|
|
3
|
-
`fluffy-context` 是面向 AI 编程会话的本地 Context Runtime CLI。0.3.
|
|
3
|
+
`fluffy-context` 是面向 AI 编程会话的本地 Context Runtime CLI。0.3.1 提供可重复、安全调用的任务定位入口、MCP 工具,以及 Claude Code 的阶段性工作流引导,让 Agent 不必自行拼接恢复、共识发现与短期记录。
|
|
4
4
|
|
|
5
5
|
它更接近“Context 的 Git”,而不是代码备份工具:Git 仍然负责代码和真实文件变更;Context Runtime 负责 AI 工作状态、已验证共识与交接信息的本地保存和恢复。
|
|
6
6
|
|
|
@@ -187,6 +187,6 @@ npm pack --dry-run --json
|
|
|
187
187
|
|
|
188
188
|
## 当前范围
|
|
189
189
|
|
|
190
|
-
0.3.
|
|
190
|
+
0.3.1 聚焦单项目、本地优先的可靠闭环和 Agent 采用路径:有界 Orient、显式 checkpoint、确定性 Knowledge/Deadend discovery、MCP `context_orient` 与可选的 Claude Code Hook 集成。
|
|
191
191
|
|
|
192
192
|
远程同步、多人协作、复杂语义检索、自动模型总结、自动 checkpoint、Context merge,以及更多状态变更型 MCP 工具不属于当前版本范围。
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { access } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { resolveProjectRoot } from '../project/project-resolver.js';
|
|
4
5
|
import { atomicWriteJson } from '../storage/atomic-write.js';
|
|
5
6
|
import { isRecord, readJson } from '../storage/json-store.js';
|
|
6
7
|
import { manifestPath } from '../storage/layout.js';
|
|
8
|
+
const cliPath = fileURLToPath(new URL('../cli/main.js', import.meta.url));
|
|
9
|
+
const cliCommand = `"${process.execPath}" "${cliPath}"`;
|
|
7
10
|
const HOOK_COMMANDS = {
|
|
11
|
+
sessionStart: `${cliCommand} hook claude-code session-start`,
|
|
12
|
+
userPrompt: `${cliCommand} hook claude-code user-prompt`,
|
|
13
|
+
};
|
|
14
|
+
const LEGACY_HOOK_COMMANDS = {
|
|
8
15
|
sessionStart: 'ctx hook claude-code session-start',
|
|
9
16
|
userPrompt: 'ctx hook claude-code user-prompt',
|
|
10
17
|
};
|
|
11
|
-
const MCP_SERVER = { command:
|
|
18
|
+
const MCP_SERVER = { command: process.execPath, args: [cliPath, 'agent', 'serve'] };
|
|
19
|
+
const LEGACY_MCP_SERVER = { command: 'ctx', args: ['agent', 'serve'] };
|
|
12
20
|
function object(value) {
|
|
13
21
|
return isRecord(value) ? { ...value } : {};
|
|
14
22
|
}
|
|
@@ -19,11 +27,23 @@ function hookInstalled(value, command) {
|
|
|
19
27
|
&& Array.isArray(group.hooks)
|
|
20
28
|
&& group.hooks.some((hook) => isRecord(hook) && hook.type === 'command' && hook.command === command));
|
|
21
29
|
}
|
|
22
|
-
function addHook(value, command) {
|
|
30
|
+
function addHook(value, command, legacyCommand) {
|
|
23
31
|
const groups = Array.isArray(value) ? value.filter(isRecord).map((group) => ({ ...group })) : [];
|
|
24
32
|
if (hookInstalled(groups, command))
|
|
25
33
|
return groups;
|
|
26
|
-
|
|
34
|
+
let replaced = false;
|
|
35
|
+
const updated = groups.map((group) => ({
|
|
36
|
+
...group,
|
|
37
|
+
hooks: Array.isArray(group.hooks)
|
|
38
|
+
? group.hooks.map((hook) => {
|
|
39
|
+
if (!isRecord(hook) || hook.type !== 'command' || hook.command !== legacyCommand)
|
|
40
|
+
return hook;
|
|
41
|
+
replaced = true;
|
|
42
|
+
return { ...hook, command };
|
|
43
|
+
})
|
|
44
|
+
: group.hooks,
|
|
45
|
+
}));
|
|
46
|
+
return replaced ? updated : [...updated, { hooks: [{ type: 'command', command }] }];
|
|
27
47
|
}
|
|
28
48
|
async function exists(filePath) {
|
|
29
49
|
try {
|
|
@@ -50,18 +70,21 @@ function validateConfig(settings, mcp) {
|
|
|
50
70
|
if (mcp.mcpServers !== undefined && !isRecord(mcp.mcpServers))
|
|
51
71
|
throw new Error('Claude Code MCP servers must be an object');
|
|
52
72
|
}
|
|
73
|
+
function mcpInstalled(value, server = MCP_SERVER) {
|
|
74
|
+
return isRecord(value)
|
|
75
|
+
&& value.command === server.command
|
|
76
|
+
&& Array.isArray(value.args)
|
|
77
|
+
&& value.args.length === server.args.length
|
|
78
|
+
&& value.args.every((item, index) => item === server.args[index]);
|
|
79
|
+
}
|
|
53
80
|
function status(projectRoot, settingsPath, mcpPath, settings, mcp, settingsExists, mcpExists, initialized) {
|
|
54
81
|
const hooks = object(settings.hooks);
|
|
55
82
|
const sessionStartInstalled = hookInstalled(hooks.SessionStart, HOOK_COMMANDS.sessionStart);
|
|
56
83
|
const userPromptInstalled = hookInstalled(hooks.UserPromptSubmit, HOOK_COMMANDS.userPrompt);
|
|
57
84
|
const mcpServers = object(mcp.mcpServers);
|
|
58
85
|
const configuredMcp = mcpServers['fluffy-context'];
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
&& Array.isArray(configuredMcp.args)
|
|
62
|
-
&& configuredMcp.args.length === MCP_SERVER.args.length
|
|
63
|
-
&& configuredMcp.args.every((value, index) => value === MCP_SERVER.args[index]);
|
|
64
|
-
const mcpConflict = configuredMcp !== undefined && !mcpInstalled;
|
|
86
|
+
const installed = mcpInstalled(configuredMcp);
|
|
87
|
+
const mcpConflict = configuredMcp !== undefined && !installed && !mcpInstalled(configuredMcp, LEGACY_MCP_SERVER);
|
|
65
88
|
return {
|
|
66
89
|
projectRoot,
|
|
67
90
|
initialized,
|
|
@@ -71,9 +94,9 @@ function status(projectRoot, settingsPath, mcpPath, settings, mcp, settingsExist
|
|
|
71
94
|
mcpExists,
|
|
72
95
|
sessionStartInstalled,
|
|
73
96
|
userPromptInstalled,
|
|
74
|
-
mcpInstalled,
|
|
97
|
+
mcpInstalled: installed,
|
|
75
98
|
mcpConflict,
|
|
76
|
-
installationNeeded: !sessionStartInstalled || !userPromptInstalled || !
|
|
99
|
+
installationNeeded: !sessionStartInstalled || !userPromptInstalled || !installed,
|
|
77
100
|
};
|
|
78
101
|
}
|
|
79
102
|
async function inspect(projectRoot) {
|
|
@@ -105,8 +128,8 @@ export async function installClaudeIntegration(startPath, apply) {
|
|
|
105
128
|
...inspected.settings,
|
|
106
129
|
hooks: {
|
|
107
130
|
...settingsHooks,
|
|
108
|
-
SessionStart: addHook(settingsHooks.SessionStart, HOOK_COMMANDS.sessionStart),
|
|
109
|
-
UserPromptSubmit: addHook(settingsHooks.UserPromptSubmit, HOOK_COMMANDS.userPrompt),
|
|
131
|
+
SessionStart: addHook(settingsHooks.SessionStart, HOOK_COMMANDS.sessionStart, LEGACY_HOOK_COMMANDS.sessionStart),
|
|
132
|
+
UserPromptSubmit: addHook(settingsHooks.UserPromptSubmit, HOOK_COMMANDS.userPrompt, LEGACY_HOOK_COMMANDS.userPrompt),
|
|
110
133
|
},
|
|
111
134
|
};
|
|
112
135
|
const mcpServers = object(inspected.mcp.mcpServers);
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.3.
|
|
1
|
+
export declare const VERSION = "0.3.1";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.3.
|
|
1
|
+
export const VERSION = '0.3.1';
|