@sechroom/cli 2026.6.21 → 2026.6.23
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/dist/index.js +32 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1574,7 +1574,7 @@ Examples:
|
|
|
1574
1574
|
// src/commands/hook.ts
|
|
1575
1575
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
1576
1576
|
import { homedir as homedir3 } from "os";
|
|
1577
|
-
import { dirname as dirname4, join as join4 } from "path";
|
|
1577
|
+
import { delimiter, dirname as dirname4, join as join4 } from "path";
|
|
1578
1578
|
|
|
1579
1579
|
// src/sem.ts
|
|
1580
1580
|
import { basename as basename2, dirname as dirname2, join as join2 } from "path";
|
|
@@ -1652,6 +1652,15 @@ function ignoresSem(content) {
|
|
|
1652
1652
|
return t === STATE_DIR_NAME2 || t === STATE_DIR_IGNORE || t === `/${STATE_DIR_NAME2}` || t === `/${STATE_DIR_IGNORE}` || t === `**/${STATE_DIR_NAME2}` || t === `**/${STATE_DIR_IGNORE}`;
|
|
1653
1653
|
});
|
|
1654
1654
|
}
|
|
1655
|
+
function inGitRepo(startDir) {
|
|
1656
|
+
let dir = startDir;
|
|
1657
|
+
for (; ; ) {
|
|
1658
|
+
if (existsSync2(join2(dir, ".git"))) return true;
|
|
1659
|
+
const parent = dirname2(dir);
|
|
1660
|
+
if (parent === dir) return false;
|
|
1661
|
+
dir = parent;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1655
1664
|
function resolveGitignoreTarget(startDir) {
|
|
1656
1665
|
let dir = startDir;
|
|
1657
1666
|
for (; ; ) {
|
|
@@ -1667,6 +1676,7 @@ function resolveGitignoreTarget(startDir) {
|
|
|
1667
1676
|
function ensureSemIgnored(semPath) {
|
|
1668
1677
|
try {
|
|
1669
1678
|
const checkoutDir = dirname2(dirname2(semPath));
|
|
1679
|
+
if (!inGitRepo(checkoutDir)) return;
|
|
1670
1680
|
const target = resolveGitignoreTarget(checkoutDir);
|
|
1671
1681
|
if (target.exists) {
|
|
1672
1682
|
const content = readFileSync2(target.path, "utf8");
|
|
@@ -2049,6 +2059,25 @@ function detectHookSurfaces(cwd) {
|
|
|
2049
2059
|
if (detected.includes("codex")) surfaces.push("codex");
|
|
2050
2060
|
return surfaces;
|
|
2051
2061
|
}
|
|
2062
|
+
function isSechroomOnPath() {
|
|
2063
|
+
const pathEnv = process.env.PATH ?? "";
|
|
2064
|
+
if (!pathEnv) return false;
|
|
2065
|
+
const names = process.platform === "win32" ? ["sechroom.cmd", "sechroom.exe", "sechroom.bat", "sechroom"] : ["sechroom"];
|
|
2066
|
+
for (const dir of pathEnv.split(delimiter)) {
|
|
2067
|
+
if (!dir) continue;
|
|
2068
|
+
for (const name of names) {
|
|
2069
|
+
if (existsSync4(join4(dir, name))) return true;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
return false;
|
|
2073
|
+
}
|
|
2074
|
+
function warnIfSechroomNotOnPath(write = (s) => void process.stderr.write(s)) {
|
|
2075
|
+
if (isSechroomOnPath()) return false;
|
|
2076
|
+
write(
|
|
2077
|
+
"\n\u26A0 `sechroom` isn't on your PATH. The hooks run a bare `sechroom hook \u2026` command\n when your agent fires them, so a non-global install (npx / local) will fail at\n that point. Install globally so the command resolves:\n npm i -g @sechroom/cli\n"
|
|
2078
|
+
);
|
|
2079
|
+
return true;
|
|
2080
|
+
}
|
|
2052
2081
|
function registerHook(program2) {
|
|
2053
2082
|
const hook = program2.command("hook").description("Agent-lifecycle hook adapter (Claude Code / Codex) \u2014 bridges hooks to continuity");
|
|
2054
2083
|
hook.addHelpText(
|
|
@@ -2160,6 +2189,7 @@ Fail-soft: no lane / no auth / no-or-partial intent file / API error -> exit 0,
|
|
|
2160
2189
|
} else {
|
|
2161
2190
|
process.stdout.write("\nRestart (or reload) your agent for the hooks to take effect.\n");
|
|
2162
2191
|
}
|
|
2192
|
+
warnIfSechroomNotOnPath();
|
|
2163
2193
|
return process.exit(0);
|
|
2164
2194
|
});
|
|
2165
2195
|
}
|
|
@@ -2619,6 +2649,7 @@ auto-resumes where you left off and checkpoints working state before compacting.
|
|
|
2619
2649
|
process.stderr.write(`${style.dim("Restart (or reload) your agent for the hooks to take effect.")}
|
|
2620
2650
|
`);
|
|
2621
2651
|
}
|
|
2652
|
+
warnIfSechroomNotOnPath();
|
|
2622
2653
|
} catch (err2) {
|
|
2623
2654
|
process.stderr.write(`${style.dim(`(skipped hook install: ${err2.message})`)}
|
|
2624
2655
|
`);
|
package/package.json
CHANGED