metame-cli 1.1.2 → 1.2.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/README.md +24 -10
- package/README/344/270/255/346/226/207/347/211/210.md +12 -9
- package/index.js +71 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,17 +26,10 @@ It is not just a launcher; it is a **Meta Avatar** .
|
|
|
26
26
|
|
|
27
27
|
## 🛠 Prerequisites
|
|
28
28
|
|
|
29
|
-
MetaMe is a wrapper around
|
|
29
|
+
MetaMe is a wrapper around **Claude Code**. You must have Node.js and the official Claude Code tool installed first.
|
|
30
30
|
|
|
31
|
-
1. **Node.js
|
|
32
|
-
2. **Claude Code
|
|
33
|
-
**Bash**
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
npm install -g @anthropic-ai/claude-code
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
1. **Auth** : Ensure you have logged in via `claude login`.
|
|
31
|
+
1. **Node.js**: Version 14 or higher.
|
|
32
|
+
2. **Claude Code**: Ensure `claude` is available in your PATH and you are logged in.
|
|
40
33
|
|
|
41
34
|
## 📦 Installation
|
|
42
35
|
|
|
@@ -84,6 +77,27 @@ When you run MetaMe for the first time, it will detect that your profile is empt
|
|
|
84
77
|
3. Claude will start and immediately say: *"Ready, [Your Name]..."*
|
|
85
78
|
4. Start coding. MetaMe manages the context in the background.
|
|
86
79
|
|
|
80
|
+
### Global Initialization (Reset/Interview)
|
|
81
|
+
|
|
82
|
+
If you want to restart the **Genesis Interview** to update your psychological profile:
|
|
83
|
+
|
|
84
|
+
**Bash**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
metame interview
|
|
88
|
+
```
|
|
89
|
+
(Command to be implemented in v1.3 - currently you can manually edit `~/.claude_profile.yaml` or use `set-trait`)
|
|
90
|
+
|
|
91
|
+
### Surgical Update (Manual Override)
|
|
92
|
+
|
|
93
|
+
If you need to update a specific trait without editing the file manually:
|
|
94
|
+
|
|
95
|
+
**Bash**
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
metame set-trait status.focus "Learning Rust"
|
|
99
|
+
```
|
|
100
|
+
|
|
87
101
|
### Hot Reload (Refresh)
|
|
88
102
|
|
|
89
103
|
If you update your profile or need to fix a broken context **without restarting your session**:
|
|
@@ -28,15 +28,8 @@
|
|
|
28
28
|
|
|
29
29
|
MetaMe 是 **Claude Code** 的外壳。你必须先安装 Node.js 和官方的 Claude Code 工具。
|
|
30
30
|
|
|
31
|
-
1. **Node.js
|
|
32
|
-
2. **Claude Code
|
|
33
|
-
**Bash**
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
npm install -g @anthropic-ai/claude-code
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
1. **认证** : 确保你已经运行过 `claude login` 并登录成功。
|
|
31
|
+
1. **Node.js**: 版本 14 或更高。
|
|
32
|
+
2. **Claude Code**: 确保 `claude` 命令可用且已登录。
|
|
40
33
|
|
|
41
34
|
## 📦 安装 (Installation)
|
|
42
35
|
|
|
@@ -84,6 +77,16 @@ MetaMe
|
|
|
84
77
|
3. Claude 启动并立即说:*“Ready, [你的名字]...”*
|
|
85
78
|
4. 开始写代码。MetaMe 会在后台自动管理上下文。
|
|
86
79
|
|
|
80
|
+
### 精准手术 (Surgical Update)
|
|
81
|
+
|
|
82
|
+
如果你需要更新某个具体的特征,而不想手动编辑文件:
|
|
83
|
+
|
|
84
|
+
**Bash**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
metame set-trait status.focus "Learning Rust"
|
|
88
|
+
```
|
|
89
|
+
|
|
87
90
|
### 热重载 (Hot Reload)
|
|
88
91
|
|
|
89
92
|
如果你更新了个人档案,或者需要修复断开的上下文连接,而**不想重启会话**:
|
package/index.js
CHANGED
|
@@ -48,8 +48,10 @@ const CORE_PROTOCOL = `
|
|
|
48
48
|
|
|
49
49
|
**3. EVOLUTION MECHANISM (Manual Sync):**
|
|
50
50
|
* **PHILOSOPHY:** You respect the User's flow. You do NOT interrupt.
|
|
51
|
-
* **
|
|
52
|
-
|
|
51
|
+
* **TOOLS:**
|
|
52
|
+
1. **Log Insight:** \`!metame evolve "Insight"\` (For additive knowledge).
|
|
53
|
+
2. **Surgical Update:** \`!metame set-trait key value\` (For overwriting specific fields, e.g., \`!metame set-trait status.focus "API Design"\`).
|
|
54
|
+
* **RULE:** Only use these tools when the User **EXPLICITLY** instructs you.
|
|
53
55
|
* **REMINDER:** If the User expresses a strong persistent preference, you may gently ask *at the end of the task*: "Should I save this preference to your MetaMe profile?"
|
|
54
56
|
---
|
|
55
57
|
`;
|
|
@@ -182,25 +184,80 @@ if (isEvolve) {
|
|
|
182
184
|
process.exit(0);
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
// Check for "set-trait" command (Surgical Update)
|
|
188
|
+
const isSetTrait = process.argv.includes('set-trait');
|
|
189
|
+
|
|
190
|
+
if (isSetTrait) {
|
|
191
|
+
const yaml = require('js-yaml');
|
|
192
|
+
|
|
193
|
+
// Syntax: metame set-trait <key> <value>
|
|
194
|
+
// Example: metame set-trait identity.role "Engineering Manager"
|
|
195
|
+
|
|
196
|
+
const setIndex = process.argv.indexOf('set-trait');
|
|
197
|
+
const key = process.argv[setIndex + 1];
|
|
198
|
+
// Join the rest as the value (allows spaces)
|
|
199
|
+
const value = process.argv.slice(setIndex + 2).join(' ').trim();
|
|
200
|
+
|
|
201
|
+
if (!key || !value) {
|
|
202
|
+
console.error("❌ Error: Missing key or value.");
|
|
203
|
+
console.error(" Usage: metame set-trait identity.role \"New Role\"");
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
if (fs.existsSync(BRAIN_FILE)) {
|
|
209
|
+
const rawContent = fs.readFileSync(BRAIN_FILE, 'utf8');
|
|
210
|
+
const doc = yaml.load(rawContent) || {};
|
|
211
|
+
|
|
212
|
+
// Helper to set nested property
|
|
213
|
+
const setNested = (obj, path, val) => {
|
|
214
|
+
const keys = path.split('.');
|
|
215
|
+
let current = obj;
|
|
216
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
217
|
+
if (!current[keys[i]]) current[keys[i]] = {};
|
|
218
|
+
current = current[keys[i]];
|
|
219
|
+
}
|
|
220
|
+
current[keys[keys.length - 1]] = val;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Set the value
|
|
224
|
+
setNested(doc, key, value);
|
|
225
|
+
|
|
226
|
+
fs.writeFileSync(BRAIN_FILE, yaml.dump(doc), 'utf8');
|
|
227
|
+
|
|
228
|
+
console.log(`🧠 MetaMe Brain Surgically Updated.`);
|
|
229
|
+
console.log(` Set \`${key}\` = "${value}"`);
|
|
230
|
+
console.log(" (Run 'metame refresh' to apply this to the current session)");
|
|
231
|
+
} else {
|
|
232
|
+
console.error("❌ Error: No profile found.");
|
|
233
|
+
}
|
|
234
|
+
} catch (e) {
|
|
235
|
+
console.error("❌ Error updating profile:", e.message);
|
|
236
|
+
}
|
|
237
|
+
process.exit(0);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// ---------------------------------------------------------
|
|
185
241
|
// ---------------------------------------------------------
|
|
186
|
-
// 6. SAFETY GUARD:
|
|
242
|
+
// 6. SAFETY GUARD: RECURSION PREVENTION (v2)
|
|
187
243
|
// ---------------------------------------------------------
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
console.
|
|
193
|
-
console.
|
|
194
|
-
|
|
195
|
-
console.warn(" - If this is a new session, you can ignore this warning.\n");
|
|
196
|
-
// process.exit(1); // DISABLED: Too many false positives in VSCode terminals
|
|
244
|
+
// We rely on our own scoped variable to detect nesting,
|
|
245
|
+
// ignoring the leaky CLAUDE_CODE_SSE_PORT from IDEs.
|
|
246
|
+
if (process.env.METAME_ACTIVE_SESSION === 'true') {
|
|
247
|
+
console.error("\n🚫 ACTION BLOCKED: Nested Session Detected");
|
|
248
|
+
console.error(" You are actively running inside a MetaMe session.");
|
|
249
|
+
console.error(" To reload configuration, use: \x1b[36m!metame refresh\x1b[0m\n");
|
|
250
|
+
process.exit(1);
|
|
197
251
|
}
|
|
198
252
|
|
|
199
253
|
// ---------------------------------------------------------
|
|
200
254
|
// 7. LAUNCH CLAUDE
|
|
201
255
|
// ---------------------------------------------------------
|
|
202
|
-
// Spawn the official claude tool
|
|
203
|
-
const child = spawn('claude', process.argv.slice(2), {
|
|
256
|
+
// Spawn the official claude tool with our marker
|
|
257
|
+
const child = spawn('claude', process.argv.slice(2), {
|
|
258
|
+
stdio: 'inherit',
|
|
259
|
+
env: { ...process.env, METAME_ACTIVE_SESSION: 'true' }
|
|
260
|
+
});
|
|
204
261
|
|
|
205
262
|
child.on('error', (err) => {
|
|
206
263
|
console.error("\n❌ Error: Could not launch 'claude'.");
|