Skip to content

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

fix: failing ci

jessepinkman990048911d7c265c
diff --git a/.claude/skills/pack-test/SKILL.md b/.claude/skills/pack-test/SKILL.md
index 9d50f70..9f4fea8 100644
--- a/.claude/skills/pack-test/SKILL.md
+++ b/.claude/skills/pack-test/SKILL.md
@@ -23,10 +23,10 @@ Produces `claude-second-brain-<version>.tgz` in the repo root, where `<version>`
**Step 2 — Scaffold via npx**
```bash
-printf '\n\n' | npx -y claude-second-brain-$(node -p "require('./package.json').version").tgz test-vault
+npx -y claude-second-brain-$(node -p "require('./package.json').version").tgz test-vault
```
-Use `npx` with the `file:` prefix — without it, npx tries to execute the tarball as a shell script and fails with "Permission denied". Pass `test-vault` as the target dir argument to skip the interactive folder name prompt. Pipe `printf '\n\n'` to accept defaults for both the qmd path prompt and the GitHub repo prompt (`y/N` → defaults to `N`, skipping GitHub setup). The vault is created in the repo root and cleaned up in Step 4.
+Use `npx` to run from the local tarball — `bunx` doesn't support local tarball paths. Pass `test-vault` as the target dir argument to skip the interactive folder name prompt. When stdin is not a TTY (non-interactive), the CLI automatically uses defaults for the qmd path (`~/.cache/qmd/index.sqlite`) and skips the GitHub repo prompt. No `printf` pipe needed. The vault is created in the repo root and cleaned up in Step 4.
**Step 3 — Verify checklist**
@@ -98,7 +98,7 @@ gh repo delete test-vault --yes
- **`.gitignore.template` present instead of `.gitignore`** — npm stripped `.gitignore` from the tarball but the rename in `bin/create.js` didn't fire; check the `try/catch` rename block
- **Missing skill dirs** — template copy failed or `.claude/` hidden dir wasn't included; check `npm pack --dry-run` output
- **`npx` fails to run the bin** — shebang or `bin` field in `package.json` is wrong; check `#!/usr/bin/env node` on line 1 of `bin/create.js`
-- **`qmd.sqlite` still in CLAUDE.md or skill files** — `patchVault()` didn't run or the replaceAll target string didn't match; check for typos in the patch targets in `bin/create.js`
+- **`qmd.sqlite` still in CLAUDE.md or skill files** — `patchVault()` didn't run (CLI exited early, often due to a non-TTY prompt hanging) or the replaceAll target string didn't match; check the `isInteractive` guard in `bin/create.js` and the patch target strings
- **Global skills not installed** — `installGlobalSkills()` failed; check that `~/.claude/skills/` is writable and template skill dirs are named `brain-ingest`/`brain-search`
- **`join(VAULT, ...)` still in setup.ts** — the DB line patch didn't match; verify the exact string `const DB = join(VAULT, "qmd.sqlite")` exists in the template
- **Note:** `bunx` cannot run local tarballs — use `npx` for this test. After publishing, `bunx claude-second-brain` from the registry works fine.
diff --git a/bin/create.js b/bin/create.js
index 8ead30d..a06990d 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -78,6 +78,8 @@ async function installGlobalSkills(qmdPath) {
}
async function main() {
+ const isInteractive = Boolean(process.stdin.isTTY)
+
p.intro(`${pc.bgCyan(pc.black(" claude-second-brain "))} v${version}`)
// 1. Folder name
@@ -97,29 +99,39 @@ async function main() {
process.env.XDG_CACHE_HOME || join(homedir(), ".cache"),
"qmd", "index.sqlite"
)
- const qmdPath = await p.text({
- message: "Where to store the qmd index?",
- placeholder: defaultQmdPath,
- defaultValue: defaultQmdPath,
- })
- if (p.isCancel(qmdPath)) { p.cancel("Setup cancelled."); process.exit(0) }
+ let qmdPath
+ if (isInteractive) {
+ const answer = await p.text({
+ message: "Where to store the qmd index?",
+ placeholder: defaultQmdPath,
+ defaultValue: defaultQmdPath,
+ })
+ if (p.isCancel(answer)) { p.cancel("Setup cancelled."); process.exit(0) }
+ qmdPath = answer
+ } else {
+ qmdPath = defaultQmdPath
+ }
// 3. GitHub repo
- const createGhRepo = await p.confirm({
- message: "Create a private GitHub repo?",
- initialValue: false,
- })
- if (p.isCancel(createGhRepo)) { p.cancel("Setup cancelled."); process.exit(0) }
-
+ let createGhRepo = false
let ghRepoName = null
- if (createGhRepo) {
- const answer = await p.text({
- message: "GitHub repo name?",
- placeholder: targetName,
- defaultValue: targetName,
+ if (isInteractive) {
+ const confirm = await p.confirm({
+ message: "Create a private GitHub repo?",
+ initialValue: false,
})
- if (p.isCancel(answer)) { p.cancel("Setup cancelled."); process.exit(0) }
- ghRepoName = answer
+ if (p.isCancel(confirm)) { p.cancel("Setup cancelled."); process.exit(0) }
+ createGhRepo = confirm
+
+ if (createGhRepo) {
+ const answer = await p.text({
+ message: "GitHub repo name?",
+ placeholder: targetName,
+ defaultValue: targetName,
+ })
+ if (p.isCancel(answer)) { p.cancel("Setup cancelled."); process.exit(0) }
+ ghRepoName = answer
+ }
}
const targetDir = join(process.cwd(), targetName)