@hanzlaa/rcode 3.6.6 → 3.6.7

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.
@@ -231,7 +231,29 @@ function main(packageRoot, targetSkillsDir, version, options = {}) {
231
231
  generated++;
232
232
  }
233
233
 
234
- return { generated, skipped };
234
+ // Cleanup stale stubs: generated stubs whose command was removed from
235
+ // SIDEBAR_COMMANDS still block the corresponding ~/.claude/commands/ file
236
+ // in Claude Code 2.x (skill with user-invocable:false overrides the command).
237
+ // Delete any generated stub for a command no longer in the curated set.
238
+ let cleaned = 0;
239
+ try {
240
+ for (const entry of fs.readdirSync(targetSkillsDir)) {
241
+ if (!entry.startsWith('rihal-')) continue;
242
+ const cmdName = entry.replace(/^rihal-/, '');
243
+ if (SIDEBAR_COMMANDS.has(cmdName)) continue; // still wanted — leave it
244
+ if (realSkills.has(entry)) continue; // real skill — never touch
245
+ const skillFile = path.join(targetSkillsDir, entry, 'SKILL.md');
246
+ if (!fs.existsSync(skillFile)) continue;
247
+ const text = fs.readFileSync(skillFile, 'utf8');
248
+ // Only remove stubs that were auto-generated from a command file.
249
+ if (!/^generated:\s*true/m.test(text)) continue;
250
+ if (!/^source:\s*rihal\/commands\//m.test(text)) continue;
251
+ fs.rmSync(path.join(targetSkillsDir, entry), { recursive: true, force: true });
252
+ cleaned++;
253
+ }
254
+ } catch { /* non-fatal */ }
255
+
256
+ return { generated, skipped, cleaned };
235
257
  }
236
258
 
237
259
  if (require.main === module) {
@@ -240,8 +262,8 @@ if (require.main === module) {
240
262
  console.error('Usage: generate-command-skills.cjs <package-root> <target-skills-dir> [version]');
241
263
  process.exit(2);
242
264
  }
243
- const { generated, skipped } = main(packageRoot, targetSkillsDir, version);
244
- console.log(`✓ ${generated} sidebar skill stub${generated === 1 ? '' : 's'} generated, ${skipped} skipped (already real skills or out of curated set)`);
265
+ const { generated, skipped, cleaned } = main(packageRoot, targetSkillsDir, version);
266
+ console.log(`✓ ${generated} sidebar skill stub${generated === 1 ? '' : 's'} generated, ${skipped} skipped, ${cleaned} stale stubs cleaned`);
245
267
  }
246
268
 
247
269
  module.exports = { main, SIDEBAR_COMMANDS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzlaa/rcode",
3
- "version": "3.6.6",
3
+ "version": "3.6.7",
4
4
  "description": "rcode — the AI team that never forgets. Persistent memory, specialist agents, and slash commands for AI IDEs. Works in Claude Code, Cursor, Gemini, VS Code, and Antigravity.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
@@ -205,7 +205,7 @@ function spawnOrchestrator() {
205
205
  try {
206
206
  _orchProc = spawn(process.execPath, [ORCH_BIN], {
207
207
  cwd: path.join(__dirname, '..'),
208
- env: { ...process.env, ORCH_TOKEN },
208
+ env: { ...process.env, ORCH_TOKEN, RIHAL_DIR, PROJECT_ROOT },
209
209
  stdio: 'pipe',
210
210
  });
211
211
  _orchProc.stdout.on('data', chunk => {
@@ -40,8 +40,14 @@ try { pty = require('@lydell/node-pty'); } catch { /* handled in handleRun */ }
40
40
  let WebSocketServer = null;
41
41
  try { ({ WebSocketServer } = require('ws')); } catch { /* handled at boot */ }
42
42
 
43
- const PORT = parseInt(process.env.ORCH_PORT || '7718', 10);
44
- const PROJECT_ROOT = path.resolve(__dirname, '..');
43
+ const PORT = parseInt(process.env.ORCH_PORT || '7718', 10);
44
+ // Use the project root passed by the dashboard (RIHAL_DIR → parent, or explicit
45
+ // PROJECT_ROOT env var). Fall back to cwd so standalone orchestrator runs work.
46
+ // NEVER use __dirname-relative path — that resolves to the npm package dir when
47
+ // rcode is installed globally, not the user's actual project.
48
+ const PROJECT_ROOT = process.env.PROJECT_ROOT
49
+ || (process.env.RIHAL_DIR ? path.dirname(process.env.RIHAL_DIR) : null)
50
+ || process.cwd();
45
51
  const CLAUDE_BIN = process.env.CLAUDE_BIN || 'claude';
46
52
 
47
53
  // Per-session auth token — see authed(). The dashboard passes ORCH_TOKEN in