@pcircle/memesh 2.9.4 → 2.10.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.
@@ -1,22 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Post-install script for MeMesh (v2.8.5+)
3
+ * Post-install script for MeMesh Plugin
4
4
  *
5
- * Complete plugin installation with backward compatibility
5
+ * Following official Claude Code Plugin spec:
6
+ * - MCP servers: handled by plugin system via .mcp.json
7
+ * - Hooks: handled by plugin system via hooks/hooks.json
8
+ * - Skills: auto-discovered by plugin system from skills/
6
9
  *
7
- * Installation flow:
10
+ * This script only does:
8
11
  * 1. Detect install mode (global/local)
9
12
  * 2. Register marketplace
10
13
  * 3. Create symlink
11
14
  * 4. Enable plugin
12
- * 5. Configure MCP
13
- * 6. Fix legacy installations
15
+ * 5. Fix legacy installations
14
16
  */
15
17
 
16
18
  import { fileURLToPath } from 'url';
17
19
  import { dirname, join } from 'path';
18
20
  import { homedir } from 'os';
19
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, statSync } from 'fs';
20
21
  import chalk from 'chalk';
21
22
  import boxen from 'boxen';
22
23
 
@@ -24,92 +25,16 @@ import boxen from 'boxen';
24
25
  const __filename = fileURLToPath(import.meta.url);
25
26
  const __dirname = dirname(__filename);
26
27
 
27
- // Import functions from postinstall-lib.js (compiled from postinstall-lib.ts)
28
+ // Import functions from postinstall-lib.js
28
29
  import {
29
30
  detectInstallMode,
30
31
  getPluginInstallPath,
31
32
  ensureMarketplaceRegistered,
32
33
  ensureSymlinkExists,
33
34
  ensurePluginEnabled,
34
- ensureMCPConfigured,
35
35
  detectAndFixLegacyInstall
36
36
  } from './postinstall-lib.js';
37
37
 
38
- // ============================================================================
39
- // Bundled Skills Installation
40
- // ============================================================================
41
-
42
- /**
43
- * Install bundled skills to ~/.claude/skills/sa:<name>/
44
- * Skills are shipped in scripts/skills/<name>/SKILL.md
45
- * Only installs if skill doesn't exist or bundled version is newer.
46
- *
47
- * @param {string} claudeDir - Path to ~/.claude
48
- * @returns {{ installed: string[], skipped: string[], errors: string[] }}
49
- */
50
- function installBundledSkills(claudeDir) {
51
- const result = { installed: [], skipped: [], errors: [] };
52
- const bundledDir = join(__dirname, 'skills');
53
- const skillsDir = join(claudeDir, 'skills');
54
-
55
- if (!existsSync(bundledDir)) {
56
- return result;
57
- }
58
-
59
- // Ensure skills directory exists
60
- mkdirSync(skillsDir, { recursive: true });
61
-
62
- // Read all bundled skills
63
- let entries;
64
- try {
65
- entries = readdirSync(bundledDir, { withFileTypes: true });
66
- } catch {
67
- return result;
68
- }
69
-
70
- for (const entry of entries) {
71
- if (!entry.isDirectory()) continue;
72
-
73
- const skillName = entry.name;
74
- const prefixedName = `sa:${skillName}`;
75
- const sourceFile = join(bundledDir, skillName, 'SKILL.md');
76
- const targetDir = join(skillsDir, prefixedName);
77
- const targetFile = join(targetDir, 'SKILL.md');
78
-
79
- try {
80
- // Read source first — if it doesn't exist, skip (no TOCTOU with existsSync)
81
- let content;
82
- let sourceStat;
83
- try {
84
- content = readFileSync(sourceFile, 'utf-8');
85
- sourceStat = statSync(sourceFile);
86
- } catch {
87
- continue; // source doesn't exist, skip
88
- }
89
-
90
- // Skip if target exists and is newer than source
91
- try {
92
- const targetStat = statSync(targetFile);
93
- if (targetStat.mtimeMs >= sourceStat.mtimeMs) {
94
- result.skipped.push(skillName);
95
- continue;
96
- }
97
- } catch {
98
- // target doesn't exist yet, proceed to install
99
- }
100
-
101
- // Install: create dir + write SKILL.md
102
- mkdirSync(targetDir, { recursive: true });
103
- writeFileSync(targetFile, content, 'utf-8');
104
- result.installed.push(skillName);
105
- } catch (error) {
106
- result.errors.push(`${skillName}: ${error.message}`);
107
- }
108
- }
109
-
110
- return result;
111
- }
112
-
113
38
  // ============================================================================
114
39
  // Main Installation Flow
115
40
  // ============================================================================
@@ -123,7 +48,6 @@ async function main() {
123
48
  marketplace: false,
124
49
  symlink: false,
125
50
  pluginEnabled: false,
126
- mcpConfigured: false,
127
51
  legacyFixed: null,
128
52
  errors: []
129
53
  };
@@ -172,25 +96,7 @@ async function main() {
172
96
  console.log(chalk.yellow(` ⚠️ Plugin enablement failed (non-fatal)`));
173
97
  }
174
98
 
175
- // Step 5: MCP Configuration
176
- // IMPORTANT: Skip MCP config for local dev to prevent path pollution
177
- // (see v2.9.0 Issue 2: Local Development Path Pollution)
178
- if (mode === 'local') {
179
- console.log(chalk.yellow(' ⚠️ Skipping MCP configuration (local development mode)'));
180
- console.log(chalk.gray(' This prevents writing local dev paths to ~/.claude/mcp_settings.json'));
181
- results.mcpConfigured = false;
182
- } else {
183
- try {
184
- await ensureMCPConfigured(installPath, mode, claudeDir);
185
- results.mcpConfigured = true;
186
- console.log(chalk.green(' ✅ MCP configured'));
187
- } catch (error) {
188
- results.errors.push(`MCP: ${error.message}`);
189
- console.log(chalk.yellow(` ⚠️ MCP configuration failed (non-fatal)`));
190
- }
191
- }
192
-
193
- // Step 6: Legacy Installation Fix
99
+ // Step 5: Legacy Installation Fix
194
100
  try {
195
101
  const legacyStatus = await detectAndFixLegacyInstall(installPath, claudeDir);
196
102
  results.legacyFixed = legacyStatus;
@@ -204,25 +110,6 @@ async function main() {
204
110
  console.log(chalk.dim(' ℹ️ Legacy check skipped'));
205
111
  }
206
112
 
207
- // Step 7: Install Bundled Skills
208
- try {
209
- const skillResult = installBundledSkills(claudeDir);
210
- results.skillsInstalled = skillResult.installed;
211
- results.skillsSkipped = skillResult.skipped;
212
-
213
- if (skillResult.installed.length > 0) {
214
- console.log(chalk.green(` ✅ Skills installed: ${skillResult.installed.join(', ')}`));
215
- } else if (skillResult.skipped.length > 0) {
216
- console.log(chalk.dim(` ℹ️ Skills up to date (${skillResult.skipped.length} already installed)`));
217
- }
218
-
219
- if (skillResult.errors.length > 0) {
220
- results.errors.push(`Skills: ${skillResult.errors.join('; ')}`);
221
- }
222
- } catch (error) {
223
- console.log(chalk.dim(' ℹ️ Skills installation skipped'));
224
- }
225
-
226
113
  } catch (error) {
227
114
  console.error(chalk.red('\n❌ Installation failed:'), error.message);
228
115
  console.error(chalk.yellow('\n💡 You can configure manually (see instructions below)\n'));
@@ -232,8 +119,7 @@ async function main() {
232
119
  // Display Installation Summary
233
120
  // ============================================================================
234
121
 
235
- const allSuccess = results.marketplace && results.symlink &&
236
- results.pluginEnabled && results.mcpConfigured;
122
+ const allSuccess = results.marketplace && results.symlink && results.pluginEnabled;
237
123
 
238
124
  const statusIcon = allSuccess ? '✅' : (results.errors.length > 0 ? '⚠️' : '✅');
239
125
  const statusText = allSuccess
@@ -247,13 +133,13 @@ ${chalk.bold('Installation Summary:')}
247
133
  ${results.marketplace ? '✅' : '⚠️'} Marketplace: ${results.marketplace ? 'Registered' : 'Failed'}
248
134
  ${results.symlink ? '✅' : '⚠️'} Symlink: ${results.symlink ? 'Created' : 'Failed'}
249
135
  ${results.pluginEnabled ? '✅' : '⚠️'} Plugin: ${results.pluginEnabled ? 'Enabled' : 'Failed'}
250
- ${results.mcpConfigured ? '✅' : '⚠️'} MCP: ${results.mcpConfigured ? 'Configured' : 'Failed'}
251
136
 
252
- ${chalk.bold('What You Got:')}
253
- ${chalk.cyan('•')} 8 MCP tools (persistent memory, semantic search, task routing, cloud sync)
137
+ ${chalk.bold('Plugin Components (auto-managed by Claude Code):')}
138
+ ${chalk.cyan('•')} MCP Server: 8 tools (persistent memory, semantic search, task routing)
139
+ ${chalk.cyan('•')} Hooks: 6 auto-hooks (session recall, commit tracking, smart routing)
140
+ ${chalk.cyan('•')} Skills: Comprehensive code review
254
141
  ${chalk.cyan('•')} Vector semantic search with ONNX embeddings (runs 100% locally)
255
- ${chalk.cyan('•')} Auto-memory with smart knowledge graph
256
- ${chalk.cyan('•')} Local-first architecture (all data stored locally)
142
+ ${chalk.cyan('•')} Auto-relation inference in knowledge graph
257
143
 
258
144
  ${chalk.bold('Next Steps:')}
259
145
  ${chalk.yellow('1.')} ${chalk.bold('Restart Claude Code')}
@@ -284,9 +170,9 @@ ${chalk.dim('Need help? Open an issue: https://github.com/PCIRCLE-AI/claude-code
284
170
  );
285
171
 
286
172
  // Exit with appropriate code
287
- // Critical failures (MCP config, plugin registration) → exit 1
288
- // Non-critical failures (skills, symlink already exists) → exit 0
289
- const hasCriticalFailure = !results.mcpConfigured && results.mode !== 'local';
173
+ // Critical failures (plugin registration) → exit 1
174
+ // Non-critical failures (symlink already exists) → exit 0
175
+ const hasCriticalFailure = !results.marketplace && !results.symlink;
290
176
  const hasPluginFailure = !results.pluginEnabled;
291
177
  if (hasCriticalFailure || hasPluginFailure) {
292
178
  process.exit(1);
package/mcp.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "memesh": {
3
- "command": "node",
4
- "args": ["${CLAUDE_PLUGIN_ROOT}/dist/mcp/server-bootstrap.js"],
5
- "env": {
6
- "NODE_ENV": "production",
7
- "MEMESH_DISABLE_DAEMON": "1"
8
- }
9
- }
10
- }
@@ -1,46 +0,0 @@
1
- ## Required Plan Sections
2
-
3
- Your plan MUST include all of the following sections. Incomplete plans will be rejected.
4
-
5
- ### 1. System Design Description (SDD)
6
- - Component architecture and responsibilities
7
- - Data flow between components
8
- - Interface contracts (input/output types)
9
- - Dependencies and integration points
10
-
11
- ### 2. Behavior-Driven Design (BDD)
12
- For EACH feature, write Gherkin scenarios:
13
-
14
- ```gherkin
15
- Scenario: [descriptive name]
16
- Given [precondition]
17
- When [action]
18
- Then [expected outcome]
19
- ```
20
-
21
- Cover: happy path, error path, edge cases.
22
-
23
- ### 3. Edge Case Handling
24
-
25
- | Edge Case | How Handled | Test Coverage |
26
- |-----------|------------|---------------|
27
- | [case] | [strategy] | [yes/no] |
28
-
29
- Include at minimum: empty input, null/undefined, boundary values, concurrent access, timeout, large data.
30
-
31
- ### 4. Dry-Run Test Plan
32
- Before dispatching heavy tasks, verify:
33
- - [ ] Core function compiles (`tsc --noEmit` or `node --check`)
34
- - [ ] Unit test for critical path passes
35
- - [ ] Integration point verified with real call
36
- - [ ] No regressions in existing tests
37
-
38
- ### 5. Risk Assessment
39
-
40
- | Risk | Probability | Impact | Mitigation |
41
- |------|------------|--------|------------|
42
- | [risk] | High/Med/Low | High/Med/Low | [strategy] |
43
-
44
- ---
45
-
46
- **IMPORTANT**: After completing this plan, present it to the user and wait for explicit approval before proceeding to implementation. Do NOT auto-execute.