Skip to content

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

add: release workflows & /pack-test skill

jessepinkman99008d21ac84166e
diff --git a/.claude/skills/pack-test/SKILL.md b/.claude/skills/pack-test/SKILL.md
index 9d5daaa..fd3402d 100644
--- a/.claude/skills/pack-test/SKILL.md
+++ b/.claude/skills/pack-test/SKILL.md
@@ -18,15 +18,15 @@ Run each command in order. Stop and report if any step fails.
npm pack
```
-Produces `obsidian-agent-wiki-0.1.0.tgz` in the repo root. Verify the tarball appears before continuing.
+Produces `obsidian-agent-wiki-<version>.tgz` in the repo root, where `<version>` comes from `package.json`. Verify the tarball appears before continuing.
**Step 2 — Scaffold via npx**
```bash
-cd /tmp && npx /Users/srinivaskota/work/obsidian-agent-wiki/obsidian-agent-wiki-0.1.0.tgz test-vault
+npx -y obsidian-agent-wiki-$(node -p "require('./package.json').version").tgz test-vault
```
-Use `npx`, not `bunx` — bunx cannot resolve local tarball paths (it prepends `@` and treats them as scoped package names). Pass `test-vault` as the target dir argument to skip the interactive prompt.
+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 prompt. The vault is created in the repo root and cleaned up in Step 4.
**Step 3 — Verify checklist**
@@ -34,22 +34,22 @@ Run each of the following and confirm the expected output:
```bash
# Root structure
-ls -la /tmp/test-vault/
+ls -la test-vault/
# .gitignore must exist (not .gitignore.template — npm strips .gitignore from packages)
-cat /tmp/test-vault/.gitignore
+cat test-vault/.gitignore
# Wiki stubs
-ls /tmp/test-vault/wiki/
+ls test-vault/wiki/
# Sources dirs
-ls /tmp/test-vault/sources/
+ls test-vault/sources/
# Claude Code skills (expect: setup, ingest, query, lint, qmd-cli)
-ls /tmp/test-vault/.claude/skills/
+ls test-vault/.claude/skills/
# qmd scripts
-ls /tmp/test-vault/scripts/qmd/
+ls test-vault/scripts/qmd/
```
Report results against this checklist:
@@ -67,13 +67,13 @@ Report results against this checklist:
**Step 4 — Clean up**
```bash
-rm -rf /tmp/test-vault
-rm /Users/srinivaskota/work/obsidian-agent-wiki/obsidian-agent-wiki-0.1.0.tgz
+rm -rf test-vault
+rm obsidian-agent-wiki-$(node -p "require('./package.json').version").tgz
```
## What failure means
-- **`.gitignore.template` present instead of `.gitignore`** — npm stripped `.gitignore` from the tarball but the rename in `bin/create.ts` didn't fire; check the `try/catch` rename block
+- **`.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 bun` on line 1 of `bin/create.ts`
+- **`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`
- **Note:** `bunx` cannot run local tarballs — use `npx` for this test. After publishing, `bunx obsidian-agent-wiki` from the registry works fine.
diff --git a/.claude/skills/release/SKILL.md b/.claude/skills/release/SKILL.md
new file mode 100644
index 0000000..600b231
--- /dev/null
+++ b/.claude/skills/release/SKILL.md
@@ -0,0 +1,172 @@
+---
+name: release
+description: "Prepare and open a release PR for the obsidian-agent-wiki npm package. Analyzes changes vs main, suggests a semver version bump, updates package.json, commits, pushes, and opens a PR. Trigger phrases: /release, prepare a release, bump the version, publish a new version, open a release PR."
+argument-hint: "Optional: patch | minor | major | exact version (e.g. 0.2.0). Leave blank for auto-suggestion."
+---
+
+# /release
+
+Prepares and opens a release PR for the `obsidian-agent-wiki` npm package. Does **not** publish to npm directly — publishing happens automatically via GitHub Actions after the PR is merged.
+
+## When to use
+
+- When you're ready to ship a new version of the package to npm
+- After landing a batch of features or fixes on a feature branch
+- The current branch must have commits relative to `main`
+
+## Argument
+
+Pass a version bump type to skip the confirmation prompt:
+
+| Argument | Effect |
+|----------|--------|
+| (none) | Analyze changes and suggest a bump; ask user to confirm |
+| `patch` | Bump patch version (e.g. 0.1.0 → 0.1.1) |
+| `minor` | Bump minor version (e.g. 0.1.0 → 0.2.0) |
+| `major` | Bump major version (e.g. 0.1.0 → 1.0.0) |
+| `0.3.0` | Use this exact version |
+
+## Steps
+
+Run each step in order. Stop and report if any step fails.
+
+### Step 1 — Capture current state
+
+Run these commands to understand what's changed:
+
+```bash
+# Current branch
+git branch --show-current
+
+# Commits on this branch not yet in main
+git log main..HEAD --oneline
+
+# File-level diff summary vs main
+git diff main...HEAD --stat
+
+# Current version
+cat package.json | grep '"version"'
+```
+
+Record: the branch name, current version, list of commits, and all files changed.
+
+### Step 2 — Summarize changes
+
+Categorize all changes from Step 1 into this format:
+
+```
+## Changes in this release
+
+**New features:**
+- (e.g. new skill added, new CLI flag, new template file)
+
+**Bug fixes:**
+- (e.g. correctness fix in bin/create.ts, template fix)
+
+**Refactors / cleanup:**
+- (e.g. code reorganization, no behavior change)
+
+**Docs:**
+- (e.g. README updates, CLAUDE.md edits)
+```
+
+Show this changelog to the user. Skip empty categories.
+
+### Step 3 — Determine version bump
+
+Read the current version from `package.json`. Apply semver logic to suggest the next version:
+
+| Signal | Bump |
+|--------|------|
+| Changes to CLI interface, template structure that would break existing vaults, or commits containing "breaking" | **major** |
+| New skills added, new CLI flags, new template sections, or new behavior | **minor** |
+| Bug fixes, docs, refactors only | **patch** |
+
+State clearly:
+- Current version: `X.Y.Z`
+- Suggested next version: `A.B.C` (reason)
+
+**If the user passed an argument** (`/release patch`, `/release 0.2.0`, etc.), use that directly and skip asking.
+
+**If no argument**, ask the user to confirm the suggested version before continuing. Do not proceed to Step 4 until confirmed.
+
+### Step 4 — Update package.json
+
+Use the Edit tool to update the `"version"` field in `package.json` to the new version. Do not reformat the file.
+
+Verify:
+```bash
+cat package.json | grep '"version"'
+```
+
+### Step 5 — Update pack-test skill
+
+The `pack-test` skill hardcodes the tarball filename (e.g., `obsidian-agent-wiki-0.1.0.tgz`). Update every occurrence of the old version string in `.claude/skills/pack-test/SKILL.md` to the new version using the Edit tool with `replace_all: true`.
+
+Verify:
+```bash
+grep "obsidian-agent-wiki-" .claude/skills/pack-test/SKILL.md
+```
+
+### Step 6 — Commit the version bump
+
+```bash
+git add package.json .claude/skills/pack-test/SKILL.md
+git commit -m "chore: bump version to X.Y.Z"
+```
+
+Replace `X.Y.Z` with the confirmed new version.
+
+### Step 7 — Push and open PR
+
+Push the current branch:
+
+```bash
+git push origin HEAD
+```
+
+Create a PR targeting `main`. Use the changelog from Step 2 in the body:
+
+```bash
+gh pr create \
+ --title "release: vX.Y.Z" \
+ --body "$(cat <<'EOF'
+## Release vX.Y.Z
+
+### Changes
+
+[changelog from Step 2]
+
+### What happens after merge
+
+1. GitHub Action creates tag `vX.Y.Z` and a GitHub Release with auto-generated notes
+2. GitHub Action publishes `[email protected]` to npm automatically
+
+### Checklist
+
+- [ ] Changelog accurately reflects all changes
+- [ ] `package.json` version is correct
+- [ ] Pack-test skill tarball filename updated
+EOF
+)" \
+ --base main
+```
+
+### Step 8 — Report to user
+
+After the PR is created, tell the user:
+
+> **PR opened:** [url]
+>
+> **Pipeline after merge:**
+> 1. `create-release.yml` creates tag `vX.Y.Z` and a GitHub Release
+> 2. `publish-npm.yml` publishes `[email protected]` to npm
+>
+> **To verify after merge:** https://www.npmjs.com/package/obsidian-agent-wiki
+
+## What can go wrong
+
+- **`gh` not authenticated** — run `gh auth login` first
+- **Nothing to release** — `git log main..HEAD` is empty; make sure you're on the right branch
+- **Merge conflicts with main** — rebase on main before running `/release`
+- **Pack-test version mismatch** — Step 5 handles this; the grep verify confirms it
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
new file mode 100644
index 0000000..489ae90
--- /dev/null
+++ b/.github/workflows/create-release.yml
@@ -0,0 +1,48 @@
+name: Create Release
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ name: Create GitHub Release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Read version from package.json
+ id: version
+ run: |
+ VERSION=$(jq -r '.version' package.json)
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
+
+ - name: Check if release already exists
+ id: check
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ if gh release view "${{ steps.version.outputs.tag }}" --json tagName > /dev/null 2>&1; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "exists=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Create tag and release
+ if: steps.check.outputs.exists == 'false'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ gh release create "${{ steps.version.outputs.tag }}" \
+ --title "v${{ steps.version.outputs.version }}" \
+ --generate-notes \
+ --latest
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
new file mode 100644
index 0000000..a01b172
--- /dev/null
+++ b/.github/workflows/publish-npm.yml
@@ -0,0 +1,31 @@
+name: Publish to npm
+
+on:
+ release:
+ types:
+ - published
+
+permissions:
+ contents: read
+
+jobs:
+ publish:
+ name: Publish obsidian-agent-wiki to npm
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout release tag
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.ref }}
+
+ - name: Set up Node.js with npm registry auth
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ registry-url: 'https://registry.npmjs.org'
+
+ - name: Publish to npm
+ run: npm publish --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.gitignore b/.gitignore
index e4a5ab2..700b02a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,6 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# IntelliJ based IDEs
.idea
+
+#
+test-vault
diff --git a/bin/create.ts b/bin/create.js
similarity index 67%
rename from bin/create.ts
rename to bin/create.js
index 934f2ff..0c24017 100644
--- a/bin/create.ts
+++ b/bin/create.js
@@ -1,25 +1,30 @@
-#!/usr/bin/env bun
+#!/usr/bin/env node
import { cp, rename, access } from "fs/promises"
-import { join } from "path"
+import { join, dirname } from "path"
+import { fileURLToPath } from "url"
+import { spawnSync } from "child_process"
+import { createInterface } from "readline/promises"
-const TEMPLATE = join(import.meta.dir, "../template")
+const __dirname = dirname(fileURLToPath(import.meta.url))
+const TEMPLATE = join(__dirname, "../template")
-async function run(cmd: string[], cwd?: string): Promise<boolean> {
- const proc = Bun.spawn(cmd, { cwd, stdout: "inherit", stderr: "inherit" })
- return (await proc.exited) === 0
+function run(cmd, cwd) {
+ const result = spawnSync(cmd[0], cmd.slice(1), { cwd, stdio: "inherit" })
+ return result.status === 0
}
-async function commandExists(cmd: string): Promise<boolean> {
- const proc = Bun.spawn(["which", cmd], { stdout: "pipe", stderr: "pipe" })
- return (await proc.exited) === 0
+function commandExists(cmd) {
+ const result = spawnSync("which", [cmd], { stdio: "pipe" })
+ return result.status === 0
}
async function main() {
- // Accept dir name as CLI arg or prompt interactively
let targetName = process.argv[2]
if (!targetName) {
- const answer = prompt("Where to create your wiki? (my-wiki) ›") ?? ""
+ const rl = createInterface({ input: process.stdin, output: process.stdout })
+ const answer = await rl.question("Where to create your wiki? (my-wiki) › ")
+ rl.close()
targetName = answer.trim() || "my-wiki"
}
@@ -51,9 +56,9 @@ async function main() {
console.log(`✓ Created ${targetName}/`)
// 2. Install mise if not present
- if (!(await commandExists("mise"))) {
+ if (!commandExists("mise")) {
console.log("\nInstalling mise...")
- const ok = await run(["npm", "install", "-g", "@jdxcode/mise"])
+ const ok = run(["npm", "install", "-g", "@jdxcode/mise"])
if (ok) {
console.log("✓ Installed mise")
} else {
@@ -63,7 +68,7 @@ async function main() {
// 3. Run mise install inside the new vault to install bun
console.log("\nInstalling bun via mise...")
- const miseOk = await run(["mise", "install"], targetDir)
+ const miseOk = run(["mise", "install"], targetDir)
if (miseOk) {
console.log("✓ Installed bun")
} else {
@@ -72,10 +77,10 @@ async function main() {
// 4. Git init
console.log("\nInitializing git repo...")
- const gitOk = await run(["git", "init"], targetDir)
+ const gitOk = run(["git", "init"], targetDir)
if (gitOk) {
- await run(["git", "add", "."], targetDir)
- await run(["git", "commit", "-m", "initial commit"], targetDir)
+ run(["git", "add", "."], targetDir)
+ run(["git", "commit", "-m", "initial commit"], targetDir)
console.log("✓ Git repo initialized")
} else {
console.error(" git init failed — run it manually inside your vault")
diff --git a/package.json b/package.json
index f8d8b9e..0181b70 100644
--- a/package.json
+++ b/package.json
@@ -2,12 +2,16 @@
"name": "obsidian-agent-wiki",
"version": "0.1.0",
"description": "Scaffold an LLM-maintained Obsidian knowledge wiki",
+ "type": "module",
"bin": {
- "obsidian-agent-wiki": "./bin/create.ts"
+ "obsidian-agent-wiki": "./bin/create.js"
},
"files": [
"bin/",
"template/"
],
+ "engines": {
+ "node": ">=18.0.0"
+ },
"license": "MIT"
}