@lifeaitools/rdc-skills 0.9.9 → 0.9.10
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/hooks/check-cwd.js +11 -5
- package/package.json +1 -1
package/hooks/check-cwd.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Hard blocks session if CWD is not
|
|
2
|
+
// Hard blocks session if CWD is not the regen-root project directory.
|
|
3
3
|
// Exits with code 1 to fail the hook + outputs a blocking systemMessage.
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const hookLog = require('./hook-logger');
|
|
7
|
+
const cwd = process.cwd().replace(/\\/g, '/');
|
|
8
|
+
|
|
9
|
+
let expected = 'regen-root';
|
|
10
|
+
try {
|
|
11
|
+
expected = execSync('git rev-parse --show-toplevel', { encoding: 'utf8', stdio: 'pipe' })
|
|
12
|
+
.trim().replace(/\\/g, '/');
|
|
13
|
+
} catch (_) {}
|
|
8
14
|
|
|
9
15
|
if (!cwd.endsWith('regen-root')) {
|
|
10
16
|
hookLog('check-cwd', 'SessionStart', 'block', { cwd, expected });
|
|
@@ -15,7 +21,7 @@ if (!cwd.endsWith('regen-root')) {
|
|
|
15
21
|
`Required: "${expected}"\n\n` +
|
|
16
22
|
`DO NOT proceed with any task. DO NOT read files, run commands, or help with anything.\n\n` +
|
|
17
23
|
`Tell the user:\n` +
|
|
18
|
-
`"Session is blocked. Claude Code must be launched from
|
|
24
|
+
`"Session is blocked. Claude Code must be launched from ${expected}.\n` +
|
|
19
25
|
` Close this session and relaunch from the correct directory."\n\n` +
|
|
20
26
|
`Then stop.`
|
|
21
27
|
}));
|
package/package.json
CHANGED