Skip to content

Fastest way to scaffold your LLM powered personal knowledge base - Obsidian, Claude Code, qmd, Github

fix: surface non-ENOENT errors in patchVault instead of swallowing

jessepinkman99002417d8b7c8be
diff --git a/CLAUDE.md b/CLAUDE.md
index 04379c0..b864378 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -240,7 +240,7 @@ Whenever you **add, remove, or rename a skill** under `template/.claude/skills/`
1. **`README.md`** (root) — the "Claude Code skills included" section and the "Installing and updating skills" block. Bump the skill count ("N wiki skills") in the install commands.
2. **`template/README.md`** — the "Your Claude Code skills" section and the "Installing and updating skills" block. Bump the skill count.
-3. **`bin/create.js`** — the `installGlobalSkills()` array (lines ~65) if the skill should be installed globally (`~/.claude/skills/`). `brain-ingest`, `brain-search`, `brain-refresh` are global today; `brain-rebuild`, `lint`, `setup`, `qmd-cli` are vault-local.
+3. **`bin/create.js`** — the skill-name array inside `installGlobalSkills()` if the skill should be installed globally (`~/.claude/skills/`). `brain-ingest`, `brain-search`, `brain-refresh` are global today; `brain-rebuild`, `lint`, `setup`, `qmd-cli` are vault-local.
4. **`.github/workflows/pack-test.yml`** — add a `check` line for the new vault-local skill directory, and if the skill is global, add a `check` line for `$HOME/.claude/skills/<name>/SKILL.md` plus a `grep_check` for `INDEX_PATH=/`.
5. **`.claude/skills/pack-test/SKILL.md`** — update the expected-skills comment, the `ls` and `grep` commands in Step 3, the checklist table (including the "N subdirs" count), and the cleanup / overwrite-warning note in Step 4.
diff --git a/bin/create.js b/bin/create.js
index 43094b9..c4f8018 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -41,14 +41,18 @@ async function patchVault(targetDir, qmdPath, brainName) {
for (const skill of readdirSync(skillsDir)) {
filesToPatch.push(join(skillsDir, skill, "SKILL.md"))
}
- } catch { /* no skills dir */ }
+ } catch (err) {
+ if (err.code !== "ENOENT") throw err
+ }
await Promise.all(filesToPatch.map(async file => {
try {
let content = await readFile(file, "utf8")
content = content.replaceAll("__QMD_PATH__", qmdPath)
await writeFile(file, content, "utf8")
- } catch { /* file may not exist */ }
+ } catch (err) {
+ if (err.code !== "ENOENT") throw err
+ }
}))
const readmePath = join(targetDir, "README.md")
@@ -56,7 +60,9 @@ async function patchVault(targetDir, qmdPath, brainName) {
let readme = await readFile(readmePath, "utf8")
readme = readme.replaceAll("__BRAIN_NAME__", brainName)
await writeFile(readmePath, readme, "utf8")
- } catch { /* README may not exist */ }
+ } catch (err) {
+ if (err.code !== "ENOENT") throw err
+ }
}
async function installGlobalSkills(qmdPath) {
diff --git a/template/.claude/skills/brain-rebuild/SKILL.md b/template/.claude/skills/brain-rebuild/SKILL.md
index ae5bf4c..19a48bb 100644
--- a/template/.claude/skills/brain-rebuild/SKILL.md
+++ b/template/.claude/skills/brain-rebuild/SKILL.md
@@ -58,7 +58,7 @@ Edit `scripts/qmd/setup.ts` to reflect the new schema:
- Update the `ensureCollection` calls (add, remove, or rename)
- Update `setGlobalContext` and the `addContext` calls
-- Keep the `__QMD_PATH__` / `DB` line untouched — it was already substituted at install time
+- Leave the `DB` constant alone — its value was substituted at scaffold time and must not change
- Keep the script idempotent
### Step 6 — Update related references