feat(extensions): add Roast Room, bring Codex to parity, fix audit findings
Roast Room is installed as a managed Git clone under ~/.my-ai-configuration/roast-room, shared by Claude and Codex. A personal launcher skill runs it from any folder, starts its live room when needed, and only runs when invoked by name (/roast-room, $roast-room). Codex now gets what was Claude-only before: the Caveman skill with a SessionStart hook that keeps it on, PreCompact and session-pointer hooks, execpolicy deny rules mirroring Claude's permissions.deny, and Impeccable's custom agents registered in ~/.codex/agents. The command-safety hook checks both shell dialects for Codex on Windows, where PowerShell text arrives as Bash, in both the PowerShell and Bash packages. Audit fixes: - command-safety blocks git checkout -- / restore / push --force / stash clear and find -delete, and treats heredoc bodies as text - removing a clone clears read-only Git files, git errors no longer abort the extension sync, and a lock left by a dead process is replaced - with-credential passes child flags such as -k or -d through unchanged and resolves commands from PATH - uninstall strips only owned hooks from settings.json and config.toml and keeps the selection while another client is installed; update keeps CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY; Bash merges write the same bytes as PowerShell - qmd no longer trusts a stale daemon.json after a lost start race and prunes collections of deleted repositories - Bash scripts avoid GNU-only find -printf Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
63a36d90e0
commit
b35e2254b3
48 files changed
+1059
-98
No files matched your search
@@ -82,6 +82,25 @@ export function keepModelsLoaded(store) {
|
||||
|
||||
const REPO_COLLECTION = /^repo-[0-9a-f]{12}$/;
|
||||
|
||||
// Deleted worktrees and temp clones leave recorded repo collections behind; drop those whose path is gone.
|
||||
export async function pruneCollections({ store, collectionsFile, remove, exists = existsSync, log = console.error }) {
|
||||
const recorded = readJson(collectionsFile, []);
|
||||
if (!Array.isArray(recorded) || recorded.length === 0) return;
|
||||
const paths = new Map((await store.listCollections()).map((c) => [c.name, c.pwd]));
|
||||
const kept = recorded.filter((name) => {
|
||||
const path = paths.get(name);
|
||||
if (!REPO_COLLECTION.test(name) || !path || exists(path)) return true;
|
||||
try {
|
||||
remove(name);
|
||||
return false;
|
||||
} catch (error) {
|
||||
log(`qmd-daemon: could not remove stale collection ${name}: ${error.message}`);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (kept.length !== recorded.length) writePrivateJson(collectionsFile, kept);
|
||||
}
|
||||
|
||||
function tokenMatches(given, expected) {
|
||||
const a = Buffer.from(String(given ?? ''));
|
||||
const b = Buffer.from(expected);
|
||||
@@ -224,6 +243,8 @@ async function main() {
|
||||
const { loadConfig } = await importQmd(join('dist', 'collections.js'));
|
||||
const { syncConfigToDb } = await importQmd(join('dist', 'store.js'));
|
||||
const collectionsFile = join(dir, 'collections.json');
|
||||
await pruneCollections({ store, collectionsFile, remove: (name) => runQmdCli(['collection', 'remove', name], { windowsHide: true, stdio: 'ignore' }) })
|
||||
.catch((error) => console.error(`qmd-daemon: could not prune stale collections: ${error.message}`));
|
||||
const token = randomBytes(32).toString('hex');
|
||||
let stopping = false;
|
||||
const stop = async () => {
|
||||
|
||||
@@ -41,7 +41,18 @@ export async function callDaemon(path, body, { file = daemonFile(), fetchImpl =
|
||||
return response.json();
|
||||
}
|
||||
|
||||
export async function startDaemon({ spawnChild = spawn, file = daemonFile() } = {}) {
|
||||
async function healthy(info, fetchImpl) {
|
||||
try {
|
||||
const response = await fetchImpl(`http://127.0.0.1:${info.port}/health`, { headers: { 'x-qmd-token': info.token }, signal: AbortSignal.timeout(2000) });
|
||||
return response.ok && (await response.json()).service === 'ai-config-qmd';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function startDaemon({ spawnChild = spawn, file = daemonFile(), fetchImpl = fetch } = {}) {
|
||||
// After a crash daemon.json keeps the dead daemon's port and token, so a lost race must not trust that token unchecked.
|
||||
const staleToken = readJson(file, null)?.token;
|
||||
const device = readJson(setupStatePath(), {}).device || 'cpu';
|
||||
const child = spawnChild(process.execPath, [join(here, 'qmd-daemon.mjs')], { detached: true, stdio: 'ignore', windowsHide: true, env: deviceEnv(device) });
|
||||
let failure = null;
|
||||
@@ -57,7 +68,9 @@ export async function startDaemon({ spawnChild = spawn, file = daemonFile() } =
|
||||
await new Promise((done) => setTimeout(done, 500));
|
||||
if (failure) throw failure;
|
||||
const info = readJson(file, null);
|
||||
if (info?.port && info?.token && (lostRace || info.pid === child.pid)) return;
|
||||
if (!info?.port || !info?.token) continue;
|
||||
if (info.pid === child.pid) return;
|
||||
if (lostRace && (info.token !== staleToken || await healthy(info, fetchImpl))) return;
|
||||
}
|
||||
throw new Error('daemon did not start within 120 s');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user