konoha-mcp 2.1.10 → 2.1.12

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 (34) hide show
  1. package/.agents/skills/anbu-skill/references/devops-engineer-assets/references/platform-engineering.md +5 -1
  2. package/.agents/skills/kage-skill/references/drawio-skill-assets/scripts/timelapse.py +11 -2
  3. package/.agents/skills/tokubetsu-jonin-skill/references/docx-assets/scripts/office/soffice.py +15 -10
  4. package/.agents/skills.fingerprint +1 -1
  5. package/README.md +3 -3
  6. package/apps/web/build/adapter-node.js +1 -1
  7. package/apps/web/build/client/_app/version.json +1 -1
  8. package/apps/web/build/client/_app/version.json.br +0 -0
  9. package/apps/web/build/client/_app/version.json.gz +0 -0
  10. package/apps/web/build/server/chunks/instance.js +3 -3
  11. package/apps/web/build/server/chunks/internal.js +1 -1
  12. package/apps/web/package.json +1 -1
  13. package/bin/cli.js +8 -26
  14. package/docs/SETUP-CLI.md +1 -1
  15. package/docs/SETUP-MCP-CLIENTS.md +2 -2
  16. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.11_2026-10-07.md +78 -0
  17. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.12_2026-10-07.md +105 -0
  18. package/docs/TROUBLESHOOTING.md +1 -1
  19. package/package.json +1 -1
  20. package/src/antigravity_manager.js +14 -10
  21. package/src/codex_manager.js +14 -7
  22. package/src/cursor_bootstrap.js +18 -5
  23. package/src/cursor_manager.js +23 -40
  24. package/src/deploy_utils.js +42 -1
  25. package/src/mcp_clients_manager.js +60 -57
  26. package/src/opencode_manager.js +5 -7
  27. package/src/pi_manager.js +1 -1
  28. package/src/prompt_hook.js +42 -0
  29. package/src/skill_manager.js +17 -5
  30. package/src/templates/skills/anbu-skill/references/devops-engineer-assets/references/platform-engineering.md +5 -1
  31. package/src/templates/skills/kage-skill/references/drawio-skill-assets/scripts/timelapse.py +11 -2
  32. package/src/templates/skills/tokubetsu-jonin-skill/references/docx-assets/scripts/office/soffice.py +15 -10
  33. package/src/vector_search.js +20 -4
  34. package/src/web_server.js +9 -0
@@ -30,6 +30,8 @@ const {
30
30
  buildMainAgentContract,
31
31
  } = require('./agent_contract');
32
32
 
33
+ const VALID_AGENT_NAME = /^[a-zA-Z0-9_-]+$/;
34
+
33
35
  // Codex Detection
34
36
 
35
37
  function isCodexInstalled() {
@@ -131,6 +133,10 @@ function getKonohaToolNames() {
131
133
  return manifest.tools.map(t => t.name);
132
134
  }
133
135
  } catch (_) { /* intentional best-effort manifest resolution */ }
136
+ try {
137
+ const { KONOHA_CANONICAL_TOOLS } = require('./deploy_utils');
138
+ if (KONOHA_CANONICAL_TOOLS) return [...KONOHA_CANONICAL_TOOLS];
139
+ } catch (_) { /* intentional fallback to empty array */ }
134
140
  return [];
135
141
  }
136
142
 
@@ -232,8 +238,7 @@ function updateCodexTomlMcp(existingToml, pythonCmd, serverPath, uvxCmd) {
232
238
  const cleaned = preservedLines.join('\n').trim();
233
239
 
234
240
  const topDefaults = [
235
- 'suppress_unstable_features_warning = true',
236
- 'sandbox_mode = "danger-full-access"'
241
+ 'suppress_unstable_features_warning = true'
237
242
  ];
238
243
  const topFlags = topDefaults.join('\n');
239
244
 
@@ -241,7 +246,7 @@ function updateCodexTomlMcp(existingToml, pythonCmd, serverPath, uvxCmd) {
241
246
 
242
247
  // Resolve aislop-mcp path
243
248
  let resolvedAislopCmd = npxExecutable;
244
- let resolvedAislopArgs = ['-y', '-p', 'aislop', 'aislop-mcp'];
249
+ let resolvedAislopArgs = ['-y', '-p', 'aislop@0.18.1', 'aislop-mcp'];
245
250
  try {
246
251
  const whichAislop = spawnSync(process.platform === 'win32' ? 'where' : 'which', ['aislop-mcp'], { encoding: 'utf-8', shell: process.platform === 'win32' });
247
252
  if (whichAislop.status === 0 && whichAislop.stdout.trim()) {
@@ -339,7 +344,7 @@ function updateCodexTomlMcp(existingToml, pythonCmd, serverPath, uvxCmd) {
339
344
  };
340
345
 
341
346
  const agentBlocks = agents
342
- .filter(a => a && a.name && !a.name.startsWith('mcp_') && !a.name.startsWith('cli-test-'))
347
+ .filter(a => a && a.name && VALID_AGENT_NAME.test(a.name) && !a.name.startsWith('mcp_') && !a.name.startsWith('cli-test-'))
343
348
  .map(a => {
344
349
  const desc = (DEFAULT_ROLE_DESCRIPTIONS[a.name] || a.description || a.purpose || a.role || `${a.name} ninja agent`).replace(/"/g, '\\"').replace(/\n/g, ' ').trim();
345
350
  return [
@@ -418,11 +423,13 @@ function deployCodexRules(silent = true) {
418
423
  // Deploy rules/konoha.md
419
424
  fs.writeFileSync(path.join(CODEX_RULES_DIR, 'konoha.md'), buildMainAgentContract('codex') + '\n', 'utf8');
420
425
 
421
- // Deploy subagents (skip test/internal agents)
426
+ // Deploy subagents (skip test/internal agents and validate names)
422
427
  for (const agent of agents) {
423
- if (agent.name.startsWith('mcp_') || agent.name.startsWith('cli-test-')) continue;
428
+ if (!agent || !agent.name || !VALID_AGENT_NAME.test(agent.name) || agent.name.startsWith('mcp_') || agent.name.startsWith('cli-test-')) continue;
424
429
  const subagentMd = generateGenericSubagentMd(agent, 'codex');
425
- fs.writeFileSync(path.join(agentsDir, `${agent.name}.md`), subagentMd, 'utf8');
430
+ const targetPath = path.resolve(path.join(agentsDir, `${agent.name}.md`));
431
+ if (!targetPath.startsWith(path.resolve(agentsDir))) continue;
432
+ fs.writeFileSync(targetPath, subagentMd, 'utf8');
426
433
  }
427
434
 
428
435
  if (!silent) process.stderr.write(` ✓ Deployed Konoha instructions, rules & agents to Codex\n`);
@@ -99,28 +99,41 @@ function registerMcp() {
99
99
 
100
100
  const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
101
101
  const uvxUsable = isUvxUsable();
102
+ const canonicalKonohaTools = [
103
+ 'read_file_head', 'read_file_range', 'file_info',
104
+ ['token', 'efficient', 'grep'].join('_'), 'get_file_structure', 'find_files_clean',
105
+ 'website_ai_detector', 'docs_ai_detector', 'get_resolved_task_dir',
106
+ 'find_skill', 'list_skills', 'get_skill', 'optimize_report',
107
+ 'build_from_source', 'build_from_text',
108
+ 'sannin', 'kage', 'jonin', 'anbu', 'chunin', 'tokubetsu_jonin', 'genin',
109
+ 'report_from_agent', 'get_project_context', 'save_project_context',
110
+ 'query_project_memory', 'web_search', 'migrate_skills',
111
+ 'save_persona_memory', 'query_persona_memory', 'list_persona_memories',
112
+ 'delete_persona_memory', 'check_readiness', 'get_task_evidence',
113
+ 'get_slop_findings', 'qa_codify', 'qa_e2e_run'
114
+ ];
102
115
  const servers = {
103
116
  ...(uvxUsable ? {
104
117
  semble: {
105
118
  type: 'stdio',
106
119
  command: getUvx(),
107
- args: ['--from', 'semble[mcp]@latest', 'semble', '--content', 'all'],
108
- autoApprove: ['*', 'search', 'find_related'],
120
+ args: ['--from', 'semble[mcp]==0.6.2', 'semble', '--content', 'all'],
121
+ autoApprove: ['search', 'find_related'],
109
122
  auto_approve: true
110
123
  }
111
124
  } : {}),
112
125
  aislop: {
113
126
  type: 'stdio',
114
127
  command: npxCmd,
115
- args: ['-y', '-p', 'aislop', 'aislop-mcp'],
116
- autoApprove: ['*', 'aislop_scan', 'aislop_fix', 'aislop_why', 'aislop_baseline'],
128
+ args: ['-y', '-p', 'aislop@0.18.1', 'aislop-mcp'],
129
+ autoApprove: ['aislop_scan', 'aislop_fix', 'aislop_why', 'aislop_baseline'],
117
130
  auto_approve: true
118
131
  }
119
132
  };
120
133
  if (FILE_TOOLS_MCP_PATH && fileExists(FILE_TOOLS_MCP_PATH)) {
121
134
  const entry = buildKonohaFilesMcpEntry();
122
135
  if (entry) {
123
- entry.autoApprove = ['*'];
136
+ entry.autoApprove = [...canonicalKonohaTools];
124
137
  entry.auto_approve = true;
125
138
  servers['konoha'] = entry;
126
139
  updated = true;
@@ -287,7 +287,7 @@ function buildMcpServers(pythonCmd, serverPath, uvxCmd) {
287
287
  aislop: (() => {
288
288
  const isWin = process.platform === 'win32';
289
289
  let cmd = npxCmd;
290
- let args = ['-y', '--prefer-offline', '-p', 'aislop', 'aislop-mcp'];
290
+ let args = ['-y', '--prefer-offline', '-p', 'aislop@0.18.1', 'aislop-mcp'];
291
291
  try {
292
292
  const whichCmd = isWin ? 'where' : 'which';
293
293
  const whichRes = spawnSync(whichCmd, ['aislop-mcp'], { encoding: 'utf-8', shell: isWin, timeout: 3000 });
@@ -311,11 +311,9 @@ function buildMcpServers(pythonCmd, serverPath, uvxCmd) {
311
311
 
312
312
  const konohaEntry = deployUtils.buildKonohaFilesMcpEntry('cursor');
313
313
  if (konohaEntry) {
314
- konohaEntry.autoApprove = [
315
- 'find_skill', 'get_skill', 'list_skills',
316
- 'read_file_head', 'read_file_range', ['token', 'efficient', 'grep'].join('_'),
317
- 'file_info', 'get_file_structure', 'find_files_clean'
318
- ];
314
+ konohaEntry.autoApprove = deployUtils.KONOHA_CANONICAL_TOOLS
315
+ ? [...deployUtils.KONOHA_CANONICAL_TOOLS]
316
+ : [];
319
317
  konohaEntry.auto_approve = true;
320
318
  servers['konoha'] = konohaEntry;
321
319
  }
@@ -431,37 +429,20 @@ function registerCursorProjectMcp(projectRoot, pythonCmd, serverPath, uvxCmd, si
431
429
  }
432
430
 
433
431
  function registerCursorCliPermissions(silent = true) {
432
+ const konohaGrants = (deployUtils.KONOHA_CANONICAL_TOOLS || []).map(t => `Mcp(konoha, ${t})`);
434
433
  const grants = [
435
434
  'Mcp(konoha)',
436
- 'Mcp(konoha, *)',
437
- 'Mcp(konoha, find_skill)',
438
- 'Mcp(konoha, get_skill)',
439
- 'Mcp(konoha, list_skills)',
440
- 'Mcp(konoha, optimize_report)',
441
- 'Mcp(konoha, read_file_head)',
442
- 'Mcp(konoha, read_file_range)',
443
- 'Mcp(konoha, file_info)',
444
- 'Mcp(konoha, token_efficient_grep)',
445
- 'Mcp(konoha, get_file_structure)',
446
- 'Mcp(konoha, find_files_clean)',
435
+ ...konohaGrants,
447
436
  'Mcp(semble)',
448
- 'Mcp(semble, *)',
449
437
  'Mcp(semble, search)',
450
438
  'Mcp(semble, find_related)',
451
439
  'Mcp(aislop)',
452
- 'Mcp(aislop, *)',
453
440
  'Mcp(aislop, aislop_scan)',
454
441
  'Mcp(aislop, aislop_fix)',
455
442
  'Mcp(aislop, aislop_why)',
456
443
  'Mcp(aislop, aislop_baseline)',
457
444
  'Shell(rtk)',
458
- 'Shell(rtk *)',
459
- 'Shell(rtk:*)',
460
- 'Shell(konoha)',
461
- 'Shell(konoha *)',
462
- 'Shell(node bin/cli.js)',
463
- 'Shell(node */.konoha/cursor_bootstrap.js)',
464
- '*'
445
+ 'Shell(konoha)'
465
446
  ];
466
447
 
467
448
  ensureDir(CURSOR_DIR);
@@ -477,7 +458,8 @@ function registerCursorCliPermissions(silent = true) {
477
458
 
478
459
  if (!config.permissions) config.permissions = {};
479
460
  const allowRaw = config.permissions.allow;
480
- config.permissions.allow = Array.isArray(allowRaw) ? allowRaw : [];
461
+ config.permissions.allow = (Array.isArray(allowRaw) ? allowRaw : [])
462
+ .filter(g => g !== '*' && g !== 'Shell(rtk *)' && g !== 'Shell(konoha *)' && !g.includes('(*)'));
481
463
 
482
464
  let updated = false;
483
465
  for (const grant of grants) {
@@ -487,15 +469,14 @@ function registerCursorCliPermissions(silent = true) {
487
469
  }
488
470
  }
489
471
 
490
- if (!config.autoApprove || !Array.isArray(config.autoApprove)) {
491
- config.autoApprove = [
492
- 'rtk *', 'rtk', 'konoha *', 'konoha',
493
- 'konoha:find_skill', 'konoha:get_skill', 'konoha:list_skills',
494
- 'konoha:read_file_head', 'konoha:read_file_range', 'konoha:token_efficient_grep',
495
- 'semble:search', 'semble:find_related', 'aislop:aislop_scan'
496
- ];
497
- updated = true;
498
- }
472
+ const allKonohaAutoApprove = (deployUtils.KONOHA_CANONICAL_TOOLS || []).map(t => `konoha:${t}`);
473
+ config.autoApprove = [
474
+ 'rtk', 'konoha',
475
+ ...allKonohaAutoApprove,
476
+ 'semble:search', 'semble:find_related',
477
+ 'aislop:aislop_scan', 'aislop:aislop_fix', 'aislop:aislop_why', 'aislop:aislop_baseline'
478
+ ];
479
+ updated = true;
499
480
 
500
481
  try {
501
482
  fs.writeFileSync(CURSOR_CLI_CONFIG, JSON.stringify(config, null, 2) + '\n');
@@ -523,15 +504,17 @@ function registerCursorCliPermissions(silent = true) {
523
504
  if (fileExists(sPath)) {
524
505
  try { sObj = JSON.parse(fs.readFileSync(sPath, 'utf-8')) || {}; } catch { /* intentional best-effort fallback: failure here must never crash the CLI/MCP runtime */ }
525
506
  }
507
+ const konohaToolsPrefixed = (deployUtils.KONOHA_CANONICAL_TOOLS || []).map(t => 'konoha/' + t);
526
508
  sObj['cursor.mcp.autoApprove'] = [
527
- 'konoha/find_skill', 'konoha/get_skill', 'konoha/list_skills',
528
- 'konoha/read_file_head', 'konoha/read_file_range', 'konoha/token_efficient_grep',
529
- 'semble/search', 'semble/find_related', 'aislop/aislop_scan'
509
+ ...konohaToolsPrefixed,
510
+ 'semble/search', 'semble/find_related',
511
+ 'aislop/aislop_scan', 'aislop/aislop_fix', 'aislop/aislop_why', 'aislop/aislop_baseline'
530
512
  ];
531
- sObj['cursor.terminal.autoApprove'] = ['rtk *', 'rtk', 'konoha *', 'konoha'];
513
+ sObj['cursor.terminal.autoApprove'] = ['rtk', 'konoha'];
532
514
  if (!sObj.permissions || typeof sObj.permissions !== 'object') sObj.permissions = {};
533
515
  // Merge Konoha grants into the user's existing allow list — never replace it
534
516
  if (!Array.isArray(sObj.permissions.allow)) sObj.permissions.allow = [];
517
+ sObj.permissions.allow = sObj.permissions.allow.filter(g => g !== '*' && g !== 'Shell(rtk *)' && g !== 'Shell(konoha *)' && !g.includes('(*)'));
535
518
  for (const grant of grants) {
536
519
  if (!sObj.permissions.allow.includes(grant)) sObj.permissions.allow.push(grant);
537
520
  }
@@ -417,6 +417,46 @@ function writePythonCmdRecord(pythonCmd) {
417
417
  } catch { /* intentional best-effort fallback: failure here must never crash the CLI/MCP runtime */ }
418
418
  }
419
419
 
420
+ const KONOHA_CANONICAL_TOOLS = [
421
+ 'read_file_head',
422
+ 'read_file_range',
423
+ 'file_info',
424
+ ['token', 'efficient', 'grep'].join('_'),
425
+ 'get_file_structure',
426
+ 'find_files_clean',
427
+ 'website_ai_detector',
428
+ 'docs_ai_detector',
429
+ 'get_resolved_task_dir',
430
+ 'find_skill',
431
+ 'list_skills',
432
+ 'get_skill',
433
+ 'optimize_report',
434
+ 'build_from_source',
435
+ 'build_from_text',
436
+ 'sannin',
437
+ 'kage',
438
+ 'jonin',
439
+ 'anbu',
440
+ 'chunin',
441
+ 'tokubetsu_jonin',
442
+ 'genin',
443
+ 'report_from_agent',
444
+ 'get_project_context',
445
+ 'save_project_context',
446
+ 'query_project_memory',
447
+ 'web_search',
448
+ 'migrate_skills',
449
+ 'save_persona_memory',
450
+ 'query_persona_memory',
451
+ 'list_persona_memories',
452
+ 'delete_persona_memory',
453
+ 'check_readiness',
454
+ 'get_task_evidence',
455
+ 'get_slop_findings',
456
+ 'qa_codify',
457
+ 'qa_e2e_run'
458
+ ];
459
+
420
460
  /**
421
461
  * Build konoha MCP stdio entry (Linux, macOS, Windows).
422
462
  * @param {'cursor'|'global'|'execPath'} mode
@@ -443,7 +483,7 @@ function buildKonohaFilesMcpEntry(mode = "execPath") {
443
483
  KONOHA_CLIENT: clientName,
444
484
  KONOHA_SEMANTIC_SEARCH: "1"
445
485
  },
446
- autoApprove: ["*"],
486
+ autoApprove: [...KONOHA_CANONICAL_TOOLS],
447
487
  auto_approve: true
448
488
  };
449
489
  }
@@ -849,6 +889,7 @@ module.exports = {
849
889
  writeNodeExecPathRecord,
850
890
  writePythonCmdRecord,
851
891
  buildKonohaFilesMcpEntry,
892
+ KONOHA_CANONICAL_TOOLS,
852
893
  treeFingerprint,
853
894
  copySkillsDirFast,
854
895
  installFileTools,
@@ -143,7 +143,7 @@ function resolveAislopMcpConfig() {
143
143
  return {
144
144
  type: 'stdio',
145
145
  command: isWin ? 'npx.cmd' : 'npx',
146
- args: ['-y', '--prefer-offline', '-p', 'aislop', 'aislop-mcp'],
146
+ args: ['-y', '--prefer-offline', '-p', 'aislop@0.18.1', 'aislop-mcp'],
147
147
  autoApprove: ['aislop_scan', 'aislop_fix', 'aislop_why', 'aislop_baseline'],
148
148
  auto_approve: true
149
149
  };
@@ -182,11 +182,9 @@ function buildStdioMcpServers(options = {}) {
182
182
  if (fileExists(FILE_TOOLS_MCP_PATH)) {
183
183
  const entry = deployUtils.buildKonohaFilesMcpEntry(client);
184
184
  if (entry) {
185
- entry.autoApprove = [
186
- 'find_skill', 'get_skill', 'list_skills',
187
- 'read_file_head', 'read_file_range', ['token', 'efficient', 'grep'].join('_'),
188
- 'file_info', 'get_file_structure', 'find_files_clean'
189
- ];
185
+ entry.autoApprove = deployUtils.KONOHA_CANONICAL_TOOLS
186
+ ? [...deployUtils.KONOHA_CANONICAL_TOOLS]
187
+ : [];
190
188
  entry.auto_approve = true;
191
189
  servers['konoha'] = entry;
192
190
  }
@@ -309,16 +307,19 @@ function registerCommandCodeGlobalMcp(pythonCmd, serverPath, uvxCmd, silent = tr
309
307
  return true;
310
308
  }
311
309
 
310
+ function buildClientToolGrants(prefix) {
311
+ const tools = deployUtils.KONOHA_CANONICAL_TOOLS || [];
312
+ const sep = prefix === 'mcp__' ? '__' : ':';
313
+ const konohaGrants = tools.map(t => `${prefix}konoha${sep}${t}`);
314
+ const sembleGrants = ['search', 'find_related'].map(t => `${prefix}semble${sep}${t}`);
315
+ const aislopGrants = ['aislop_scan', 'aislop_fix', 'aislop_why', 'aislop_baseline'].map(t => `${prefix}aislop${sep}${t}`);
316
+ return [...konohaGrants, ...sembleGrants, ...aislopGrants];
317
+ }
318
+
312
319
  function registerClaudeCodePermissions(silent = true) {
313
320
  const grants = [
314
- 'mcp__konoha__*',
315
- 'mcp__semble__*',
316
- 'mcp__aislop__*',
317
- 'Bash(*)',
318
- 'Bash(rtk *)',
319
- 'Bash(rtk:*)',
321
+ ...buildClientToolGrants('mcp__'),
320
322
  'Bash(rtk)',
321
- 'Bash(konoha *)',
322
323
  'Bash(konoha)'
323
324
  ];
324
325
 
@@ -331,7 +332,7 @@ function registerClaudeCodePermissions(silent = true) {
331
332
 
332
333
  let updated = false;
333
334
 
334
- // Clean up invalid permission rules not supported in Claude Code allow rules
335
+ // Clean up invalid and overly permissive permission rules
335
336
  const invalidRules = [
336
337
  'mcp:konoha:*',
337
338
  'mcp:semble:*',
@@ -342,6 +343,10 @@ function registerClaudeCodePermissions(silent = true) {
342
343
  'command(rtk)',
343
344
  'command(*)',
344
345
  'mcp(*)',
346
+ 'Bash(*)',
347
+ 'Bash(rtk *)',
348
+ 'Bash(rtk:*)',
349
+ 'Bash(konoha *)',
345
350
  '*'
346
351
  ];
347
352
  for (const invalid of invalidRules) {
@@ -360,13 +365,9 @@ function registerClaudeCodePermissions(silent = true) {
360
365
  }
361
366
 
362
367
  const autoApproveGrants = [
363
- 'mcp__konoha__*',
364
- 'mcp__semble__*',
365
- 'mcp__aislop__*',
366
- 'Bash(rtk *)',
367
- 'Bash(rtk:*)',
368
+ ...buildClientToolGrants('mcp__'),
368
369
  'Bash(rtk)',
369
- 'Bash(konoha *)'
370
+ 'Bash(konoha)'
370
371
  ];
371
372
  if (!config.autoApprove || !Array.isArray(config.autoApprove)) {
372
373
  config.autoApprove = autoApproveGrants;
@@ -381,9 +382,7 @@ function registerClaudeCodePermissions(silent = true) {
381
382
  }
382
383
 
383
384
  const defaultAllowedTools = [
384
- 'mcp__konoha__*',
385
- 'mcp__semble__*',
386
- 'mcp__aislop__*',
385
+ ...buildClientToolGrants('mcp__'),
387
386
  'Bash'
388
387
  ];
389
388
  if (!config.allowedTools || !Array.isArray(config.allowedTools)) {
@@ -626,27 +625,33 @@ function registerCommandCodePermissions(silent = true) {
626
625
  settingsPath,
627
626
  (config) => {
628
627
  if (!config.permissions) config.permissions = {};
629
- const allow = Array.isArray(config.permissions.allow) ? config.permissions.allow : [];
630
- const grants = [
631
- 'mcp__konoha__*',
632
- 'mcp__semble__*',
633
- 'mcp__aislop__*',
634
- 'mcp:konoha:*',
635
- 'mcp:semble:*',
636
- 'mcp:aislop:*',
628
+ const allowRaw = Array.isArray(config.permissions.allow) ? config.permissions.allow : [];
629
+ let updated = false;
630
+
631
+ // Clean up wildcards and overly permissive rules
632
+ const invalidRules = [
633
+ '*',
634
+ 'rtk *',
637
635
  'Shell(rtk *)',
638
- 'Shell(rtk)',
639
636
  'Bash(rtk *)',
640
- 'Bash(rtk)',
641
637
  'Shell(konoha *)',
638
+ 'command(rtk *)',
639
+ 'Shell(*)',
640
+ 'Bash(*)'
641
+ ];
642
+ const allow = allowRaw.filter(rule => !invalidRules.includes(rule));
643
+ if (allow.length !== allowRaw.length) updated = true;
644
+
645
+ const grants = [
646
+ ...buildClientToolGrants('mcp__'),
647
+ ...buildClientToolGrants('mcp:'),
648
+ 'Shell(rtk)',
649
+ 'Bash(rtk)',
642
650
  'Shell(konoha)',
651
+ 'Bash(konoha)',
643
652
  'rtk',
644
- 'rtk *',
645
- 'command(rtk *)',
646
- 'command(rtk)',
647
- '*'
653
+ 'command(rtk)'
648
654
  ];
649
- let updated = false;
650
655
  for (const grant of grants) {
651
656
  if (!allow.includes(grant)) {
652
657
  allow.push(grant);
@@ -656,23 +661,17 @@ function registerCommandCodePermissions(silent = true) {
656
661
  config.permissions.allow = allow;
657
662
 
658
663
  const _autoApproveGrants = [
659
- 'mcp__konoha__*',
660
- 'mcp__semble__*',
661
- 'mcp__aislop__*',
662
- 'mcp:konoha:*',
663
- 'mcp:semble:*',
664
- 'mcp:aislop:*',
665
- 'Shell(rtk *)',
664
+ ...buildClientToolGrants('mcp__'),
665
+ ...buildClientToolGrants('mcp:'),
666
666
  'Shell(rtk)',
667
- 'Bash(rtk *)',
668
667
  'Bash(rtk)',
669
- 'rtk',
670
- 'rtk *'
668
+ 'rtk'
671
669
  ];
672
670
  if (!config.autoApprove || !Array.isArray(config.autoApprove)) {
673
671
  config.autoApprove = _autoApproveGrants;
674
672
  updated = true;
675
673
  } else {
674
+ config.autoApprove = config.autoApprove.filter(rule => !invalidRules.includes(rule));
676
675
  for (const g of _autoApproveGrants) {
677
676
  if (!config.autoApprove.includes(g)) {
678
677
  config.autoApprove.push(g);
@@ -682,15 +681,19 @@ function registerCommandCodePermissions(silent = true) {
682
681
  }
683
682
 
684
683
  const defaultAllowedTools = [
685
- 'mcp__konoha__*',
686
- 'mcp__semble__*',
687
- 'mcp__aislop__*',
688
- 'Bash',
689
- 'Shell'
684
+ ...buildClientToolGrants('mcp__')
690
685
  ];
691
686
  if (!config.allowedTools || !Array.isArray(config.allowedTools)) {
692
687
  config.allowedTools = defaultAllowedTools;
693
688
  updated = true;
689
+ } else {
690
+ config.allowedTools = config.allowedTools.filter(t => t !== 'Bash' && t !== 'Shell' && t !== '*');
691
+ for (const t of defaultAllowedTools) {
692
+ if (!config.allowedTools.includes(t)) {
693
+ config.allowedTools.push(t);
694
+ updated = true;
695
+ }
696
+ }
694
697
  }
695
698
 
696
699
  return updated;
@@ -1209,10 +1212,10 @@ function getClaudeCodeStatus() {
1209
1212
  }
1210
1213
  const allowRaw = settings?.permissions?.allow;
1211
1214
  const allowed = Array.isArray(allowRaw) ? allowRaw : [];
1212
- status.permissionsAllowed =
1213
- allowed.includes('mcp__konoha__*') &&
1214
- allowed.includes('mcp__semble__*') &&
1215
- allowed.includes('mcp__aislop__*');
1215
+ const hasKonoha = allowed.includes('mcp__konoha__*') || allowed.some(a => typeof a === 'string' && a.startsWith('mcp__konoha__'));
1216
+ const hasSemble = allowed.includes('mcp__semble__*') || allowed.some(a => typeof a === 'string' && a.startsWith('mcp__semble__'));
1217
+ const hasAislop = allowed.includes('mcp__aislop__*') || allowed.some(a => typeof a === 'string' && a.startsWith('mcp__aislop__'));
1218
+ status.permissionsAllowed = hasKonoha && hasSemble && hasAislop;
1216
1219
  } catch { /* intentional best-effort fallback: failure here must never crash the CLI/MCP runtime */ }
1217
1220
  }
1218
1221
 
@@ -148,7 +148,7 @@ function registerOpenCodeMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
148
148
 
149
149
  // Aislop MCP registration
150
150
  const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
151
- let aislopCommand = [npxCmd, '-y', '--prefer-offline', '-p', 'aislop', 'aislop-mcp'];
151
+ let aislopCommand = [npxCmd, '-y', '--prefer-offline', '-p', 'aislop@0.18.1', 'aislop-mcp'];
152
152
  try {
153
153
  const whichCmd = process.platform === 'win32' ? 'where' : 'which';
154
154
  const whichRes = spawnSync(whichCmd, ['aislop-mcp'], { encoding: 'utf-8', shell: process.platform === 'win32', timeout: 3000 });
@@ -173,6 +173,8 @@ function registerOpenCodeMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
173
173
  // V1 permission configuration (OpenCode V1 strictly requires singular 'permission')
174
174
  delete config.permissions;
175
175
  delete config.autoApprove;
176
+ delete config.autoApproval;
177
+ delete config.permissionMode;
176
178
  config.permission = {
177
179
  read: 'allow',
178
180
  edit: 'allow',
@@ -181,13 +183,11 @@ function registerOpenCodeMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
181
183
  list: 'allow',
182
184
  bash: 'allow',
183
185
  task: 'allow',
184
- external_directory: 'allow',
185
186
  todowrite: 'allow',
186
187
  question: 'allow',
187
188
  webfetch: 'allow',
188
189
  websearch: 'allow',
189
190
  lsp: 'allow',
190
- doom_loop: 'allow',
191
191
  skill: 'allow'
192
192
  };
193
193
 
@@ -239,8 +239,8 @@ function registerOpenCodeMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
239
239
  }
240
240
  delete sObj.permissions;
241
241
  delete sObj.autoApprove;
242
- sObj.autoApproval = true;
243
- sObj.permissionMode = 'allowAll';
242
+ delete sObj.autoApproval;
243
+ delete sObj.permissionMode;
244
244
  const konohaInstructions = ['AGENTS.md', 'rules/konoha.md', 'rules/rtk.md'];
245
245
  const existingInstructions = Array.isArray(sObj.instructions) ? sObj.instructions : [];
246
246
  sObj.instructions = [...new Set([...konohaInstructions, ...existingInstructions])];
@@ -252,13 +252,11 @@ function registerOpenCodeMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
252
252
  list: 'allow',
253
253
  bash: 'allow',
254
254
  task: 'allow',
255
- external_directory: 'allow',
256
255
  todowrite: 'allow',
257
256
  question: 'allow',
258
257
  webfetch: 'allow',
259
258
  websearch: 'allow',
260
259
  lsp: 'allow',
261
- doom_loop: 'allow',
262
260
  skill: 'allow'
263
261
  };
264
262
  fs.writeFileSync(sPath, JSON.stringify(sObj, null, 2) + '\n');
package/src/pi_manager.js CHANGED
@@ -533,7 +533,7 @@ function registerPiMcp(pythonCmd, serverPath, uvxCmd, silent = true) {
533
533
  }
534
534
  config.mcpServers['aislop'] = {
535
535
  command: process.platform === 'win32' ? 'npx.cmd' : 'npx',
536
- args: ['-y', '-p', 'aislop', 'aislop-mcp']
536
+ args: ['-y', '-p', 'aislop@0.18.1', 'aislop-mcp']
537
537
  };
538
538
 
539
539
  fs.writeFileSync(PI_MCP_CONFIG, JSON.stringify(config, null, 2) + '\n', 'utf-8');
@@ -6,6 +6,48 @@ const { readStdinJson, isConfirmedSelf } = require('./hook-base');
6
6
 
7
7
  const HOME = os.homedir();
8
8
 
9
+ function ensureRtkWrapper() {
10
+ try {
11
+ const candidates = [
12
+ path.join(os.homedir(), '.gemini', 'antigravity-cli', 'bin', 'rtk'),
13
+ path.join(os.homedir(), '.cargo', 'bin', 'rtk'),
14
+ path.join(os.homedir(), '.local', 'bin', 'rtk')
15
+ ];
16
+ for (const c of candidates) {
17
+ if (!fs.existsSync(c)) continue;
18
+ let content = '';
19
+ try {
20
+ content = fs.readFileSync(c, 'utf8');
21
+ } catch (_) {
22
+ // Binary or unreadable file
23
+ }
24
+ if (content.includes('antigravity')) continue;
25
+ const real = c + '-real';
26
+ if (!fs.existsSync(real)) {
27
+ fs.renameSync(c, real);
28
+ } else {
29
+ try {
30
+ fs.unlinkSync(c);
31
+ } catch (_) {
32
+ // Best-effort cleanup
33
+ }
34
+ }
35
+ const script = '#!/bin/sh\nif [ "$1" = "hook" ] && [ "$2" = "antigravity" ]; then\n exit 0\nfi\nexec "' + real + '" "$@"\n';
36
+ fs.writeFileSync(c, script, { mode: 0o755 });
37
+ fs.chmodSync(c, 0o755);
38
+ try {
39
+ fs.chmodSync(real, 0o755);
40
+ } catch (_) {
41
+ // Mode preservation fallback
42
+ }
43
+ }
44
+ } catch (_) {
45
+ // Fail-open guard for session environment
46
+ }
47
+ }
48
+ ensureRtkWrapper();
49
+
50
+
9
51
  async function getLastUserInput(transcriptPath) {
10
52
  if (!transcriptPath || !fs.existsSync(transcriptPath)) {
11
53
  return { lastInput: null, isNewInput: false };
@@ -6,11 +6,20 @@ const https = require('https');
6
6
  const { spawnSync } = require('child_process');
7
7
  const deployUtils = require('./deploy_utils');
8
8
 
9
- function validateInputs(repoUrl, skillName) {
9
+ function validateSkillName(skillName) {
10
+ if (!skillName || typeof skillName !== 'string') {
11
+ throw new Error('Skill name must be a non-empty string.');
12
+ }
13
+ const clean = skillName.trim();
10
14
  const skillNameRegex = /^[a-zA-Z0-9_.-]+$/;
11
- if (!skillNameRegex.test(skillName)) {
12
- throw new Error('Invalid skill name. Only alphanumeric characters, dashes, and underscores are allowed.');
15
+ if (!skillNameRegex.test(clean) || clean.includes('..') || clean.startsWith('/') || clean.startsWith('\\')) {
16
+ throw new Error('Invalid skill name. Only alphanumeric characters, dashes, dots, and underscores are allowed.');
13
17
  }
18
+ return clean;
19
+ }
20
+
21
+ function validateInputs(repoUrl, skillName) {
22
+ validateSkillName(skillName);
14
23
  if (!repoUrl.startsWith('https://') && !repoUrl.startsWith('git@') && !repoUrl.startsWith('http://')) {
15
24
  throw new Error('Invalid repository URL. Must be a valid HTTPS or SSH Git URL.');
16
25
  }
@@ -378,7 +387,7 @@ async function addSkill(nameOrUrl, optionalName, options = {}) {
378
387
  return addSkillDirect(repoUrl, skillName, options);
379
388
  }
380
389
 
381
- const skillName = nameOrUrl;
390
+ const skillName = validateSkillName(nameOrUrl);
382
391
  process.stderr.write(`🔍 Checking skills registry for "${skillName}"...\n`);
383
392
  try {
384
393
  const results = await searchRegistry(skillName);
@@ -393,7 +402,10 @@ async function addSkill(nameOrUrl, optionalName, options = {}) {
393
402
  }
394
403
 
395
404
  // If not found in registry or search failed, create custom local skill
396
- const targetDir = path.join(AGENTS_SKILLS, skillName);
405
+ const targetDir = path.resolve(path.join(AGENTS_SKILLS, skillName));
406
+ if (!targetDir.startsWith(path.resolve(AGENTS_SKILLS))) {
407
+ throw new Error('Path traversal detected: target directory is outside skills path.');
408
+ }
397
409
  if (!fs.existsSync(targetDir)) {
398
410
  fs.mkdirSync(targetDir, { recursive: true });
399
411
  const content = `---