indelible-mcp 4.1.3 → 4.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +59 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indelible-mcp",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "description": "Blockchain-backed memory and code storage for Claude Code. Save AI conversations and source code permanently on BSV.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -55,10 +55,14 @@ function installHooks() {
55
55
  h.hooks?.some(hh => hh.command?.includes('indelible-mcp hook pre-compact')) ||
56
56
  h.command?.includes('indelible-mcp hook pre-compact')
57
57
  )
58
- const hasSessionStart = settings.hooks.SessionStart?.some(h =>
58
+ const hasPostCompact = settings.hooks.SessionStart?.some(h =>
59
59
  h.hooks?.some(hh => hh.command?.includes('indelible-mcp hook post-compact')) ||
60
60
  h.command?.includes('indelible-mcp hook post-compact')
61
61
  )
62
+ const hasSessionStart = settings.hooks.SessionStart?.some(h =>
63
+ h.hooks?.some(hh => hh.command?.includes('indelible-mcp hook session-start')) ||
64
+ h.command?.includes('indelible-mcp hook session-start')
65
+ )
62
66
 
63
67
  const installed = []
64
68
 
@@ -71,13 +75,22 @@ function installHooks() {
71
75
  installed.push('PreCompact')
72
76
  }
73
77
 
74
- if (!hasSessionStart) {
78
+ if (!hasPostCompact) {
75
79
  if (!settings.hooks.SessionStart) settings.hooks.SessionStart = []
76
80
  settings.hooks.SessionStart.push({
77
81
  matcher: 'compact',
78
82
  hooks: [{ type: 'command', command: 'indelible-mcp hook post-compact' }]
79
83
  })
80
- installed.push('SessionStart')
84
+ installed.push('SessionStart:compact')
85
+ }
86
+
87
+ if (!hasSessionStart) {
88
+ if (!settings.hooks.SessionStart) settings.hooks.SessionStart = []
89
+ settings.hooks.SessionStart.push({
90
+ matcher: '',
91
+ hooks: [{ type: 'command', command: 'indelible-mcp hook session-start' }]
92
+ })
93
+ installed.push('SessionStart:style')
81
94
  }
82
95
 
83
96
  writeFileSync(settingsPath, JSON.stringify(settings, null, 2))
@@ -256,7 +269,7 @@ Commands:
256
269
 
257
270
  function printHelp() {
258
271
  console.log(`
259
- Indelible MCP — Blockchain memory for Claude Code (v4.1.3)
272
+ Indelible MCP — Blockchain memory for Claude Code (v4.1.5)
260
273
 
261
274
  Setup:
262
275
  indelible-mcp setup --wif=KEY --pin=PIN Import and encrypt your private key
@@ -468,7 +481,7 @@ function readStdin() {
468
481
 
469
482
  const SERVER_INFO = {
470
483
  name: 'indelible',
471
- version: '4.1.3',
484
+ version: '4.1.5',
472
485
  description: 'Blockchain-backed memory and code storage for Claude Code'
473
486
  }
474
487
 
@@ -737,6 +750,14 @@ async function runMcpServer() {
737
750
  // ============ SETUP WIZARD ============
738
751
 
739
752
  async function runWizard() {
753
+ // Detect sudo on Mac/Linux — MCP registration goes to wrong user
754
+ if (process.platform !== 'win32' && process.getuid?.() === 0) {
755
+ console.log('\n Don\'t run the wizard with sudo. Run it as your normal user:')
756
+ console.log(' indelible-mcp\n')
757
+ console.log(' (sudo is only needed for npm install -g)\n')
758
+ process.exit(1)
759
+ }
760
+
740
761
  const rl = createInterface({ input: process.stdin, output: process.stdout })
741
762
  const ask = (q) => new Promise(resolve => rl.question(q, resolve))
742
763
 
@@ -763,13 +784,17 @@ async function runWizard() {
763
784
  allGood = false
764
785
  }
765
786
 
766
- // MCP registered
767
- const claudeSettings = join(homedir(), '.claude', 'settings.json')
787
+ // MCP registered — check both config locations
768
788
  let mcpOk = false
769
- try {
770
- const s = JSON.parse(readFileSync(claudeSettings, 'utf8'))
771
- mcpOk = !!s?.mcpServers?.indelible
772
- } catch {}
789
+ for (const cfgPath of [
790
+ join(homedir(), '.claude.json'),
791
+ join(homedir(), '.claude', 'settings.json')
792
+ ]) {
793
+ try {
794
+ const s = JSON.parse(readFileSync(cfgPath, 'utf8'))
795
+ if (s?.mcpServers?.indelible) { mcpOk = true; break }
796
+ } catch {}
797
+ }
773
798
  console.log(mcpOk ? ' ✓ MCP registered with Claude Code' : ' ✗ MCP not registered')
774
799
  if (!mcpOk) allGood = false
775
800
 
@@ -847,10 +872,10 @@ async function runWizard() {
847
872
  if (!mcpOk && claudeOk) {
848
873
  console.log(' Fixing: registering MCP with Claude Code...')
849
874
  try {
850
- execSync('claude mcp add indelible -- indelible-mcp', { stdio: 'pipe' })
875
+ execSync('claude mcp add --scope user indelible -- indelible-mcp', { stdio: 'pipe' })
851
876
  console.log(' ✓ MCP registered')
852
877
  } catch {
853
- console.log(' Run this yourself: claude mcp add indelible -- indelible-mcp')
878
+ console.log(' Run this yourself: claude mcp add --scope user indelible -- indelible-mcp')
854
879
  }
855
880
  }
856
881
  if (!hooksOk) {
@@ -924,11 +949,11 @@ async function runWizard() {
924
949
  // Register MCP with Claude Code
925
950
  console.log(' Registering Indelible with Claude Code...')
926
951
  try {
927
- execSync('claude mcp add indelible -- indelible-mcp', { stdio: 'pipe' })
952
+ execSync('claude mcp add --scope user indelible -- indelible-mcp', { stdio: 'pipe' })
928
953
  console.log(' ✓ MCP registered\n')
929
954
  } catch {
930
955
  console.log(' Could not register automatically.')
931
- console.log(' Run this yourself: claude mcp add indelible -- indelible-mcp\n')
956
+ console.log(' Run this yourself: claude mcp add --scope user indelible -- indelible-mcp\n')
932
957
  }
933
958
 
934
959
  config = await loadConfig()
@@ -1010,6 +1035,25 @@ if (args[0] === 'hook') {
1010
1035
  runPreCompactSave().catch(e => { process.stderr.write(`Indelible error: ${e.message}\n`); process.exit(0) })
1011
1036
  } else if (args[1] === 'post-compact') {
1012
1037
  runPostCompactRestore().catch(e => { process.stderr.write(`Indelible error: ${e.message}\n`); process.exit(0) })
1038
+ } else if (args[1] === 'session-start') {
1039
+ // Lightweight hook: load style only (runs on every new session)
1040
+ (async () => {
1041
+ const config = loadConfig()
1042
+ if (!config?.style_txid) { process.exit(0) }
1043
+ try {
1044
+ const style = await loadStyle(config.style_txid)
1045
+ if (style.success && style.rules) {
1046
+ process.stdout.write(`# AI Interaction Style: ${style.name}\n`)
1047
+ process.stdout.write(`Loaded from blockchain tx: ${config.style_txid}\n`)
1048
+ process.stdout.write(`Owner: ${style.owner} | Created: ${style.createdAt}\n\n`)
1049
+ process.stdout.write(style.rules + '\n')
1050
+ process.stderr.write(`Indelible: Style "${style.name}" loaded\n`)
1051
+ }
1052
+ } catch (err) {
1053
+ process.stderr.write(`Indelible: Style load failed: ${err.message}\n`)
1054
+ }
1055
+ process.exit(0)
1056
+ })()
1013
1057
  } else {
1014
1058
  console.error('Unknown hook:', args[1])
1015
1059
  process.exit(1)