A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
fix: bump shard.yaml version on release (#73)
Brenno Ferrariadaa5971411d
diff --git a/.claude/scripts/tests/generate-changelog.test.ts b/.claude/scripts/tests/generate-changelog.test.tsindex 827193e..92c16aa 100644--- a/.claude/scripts/tests/generate-changelog.test.ts+++ b/.claude/scripts/tests/generate-changelog.test.ts@@ -14,6 +14,7 @@ import {toFingerprintKey,pickMarkers,findLatestOpenFingerprint,+ bumpShardYamlVersion,} from "../../../.github/scripts/generate-changelog.ts";describe("classifyCommit", () => {@@ -242,6 +243,65 @@ describe("pickMarkers", () => {});});+describe("bumpShardYamlVersion", () => {+ const FIXTURE = [+ "apiVersion: v1",+ "name: obsidian-mind",+ "namespace: breferrari",+ "version: 6.0.0-beta.1",+ 'description: "AI-augmented Obsidian vault"',+ "",+ ].join("\n");++ test("rewrites the top-level version line", () => {+ const out = bumpShardYamlVersion(FIXTURE, "v6.0");+ assert.match(out, /^version: 6\.0\.0$/m);+ assert.doesNotMatch(out, /6\.0\.0-beta\.1/);+ });++ test("normalizes the version (v6.1 → 6.1.0)", () => {+ const out = bumpShardYamlVersion(FIXTURE, "v6.1");+ assert.match(out, /^version: 6\.1\.0$/m);+ });++ test("preserves surrounding lines", () => {+ const out = bumpShardYamlVersion(FIXTURE, "v6.0");+ assert.match(out, /^apiVersion: v1$/m);+ assert.match(out, /^name: obsidian-mind$/m);+ assert.match(out, /^namespace: breferrari$/m);+ assert.match(out, /^description: /m);+ });++ test("idempotent when run twice with the same version", () => {+ const once = bumpShardYamlVersion(FIXTURE, "v6.0");+ const twice = bumpShardYamlVersion(once, "v6.0");+ assert.equal(once, twice);+ });++ test("throws when no version line is present", () => {+ const broken = "apiVersion: v1\nname: thing\n";+ assert.throws(() => bumpShardYamlVersion(broken, "v6.0"), /version:/);+ });++ test("only rewrites the top-level version, not nested ones", () => {+ // The regex anchors to a leftmost-column `version:`, so an indented+ // `version:` inside a list (e.g. shardmind migrations entries) must+ // be left alone. Use an actually-indented `version:` here, not a+ // look-alike key like `from_version:` — the latter wouldn't match+ // the regex regardless and so wouldn't exercise the anchor.+ const withNested = [+ "version: 6.0.0-beta.1",+ "migrations:",+ " - version: 5.0.0",+ " note: keep this nested version untouched",+ ].join("\n");+ const out = bumpShardYamlVersion(withNested, "v6.0");+ assert.match(out, /^version: 6\.0\.0$/m);+ assert.match(out, /^ - version: 5\.0\.0$/m);+ assert.match(out, /note: keep this nested version untouched/);+ });+});+describe("findLatestOpenFingerprint", () => {test("returns the highest version without a missing field", () => {const fp = {diff --git a/.github/scripts/generate-changelog.ts b/.github/scripts/generate-changelog.tsindex 2b7a59d..8fffd48 100644--- a/.github/scripts/generate-changelog.ts+++ b/.github/scripts/generate-changelog.ts@@ -394,6 +394,40 @@ function updateManifest(version: string, prevTag: string | null): void {);}+/**+ * Replace the top-level `version:` line in `.shardmind/shard.yaml` with the+ * normalized release version. The shard manifest is what `shardmind install`+ * shows in its wizard header — keeping it in lockstep with vault-manifest.json+ * means a release commit bumps both, identical to how CHANGELOG.md gets a+ * matching section. ENOENT-tolerant so non-shardmind clones (no .shardmind/)+ * stay releasable.+ */+export function bumpShardYamlVersion(content: string, version: string): string {+ const normalized = normalizeVersion(version);+ const pattern = /^version:[ \t]*.*$/m;+ if (!pattern.test(content)) {+ throw new Error(+ "shard.yaml is missing a top-level `version:` line — refusing to write.",+ );+ }+ return content.replace(pattern, `version: ${normalized}`);+}++function updateShardYaml(version: string): void {+ const path = ".shardmind/shard.yaml";+ let content: string;+ try {+ content = readFileSync(path, { encoding: "utf-8" });+ } catch (err) {+ if ((err as NodeJS.ErrnoException).code === "ENOENT") {+ process.stderr.write(`${path} not present — skipping shard version bump.\n`);+ return;+ }+ throw err;+ }+ writeFileSync(path, bumpShardYamlVersion(content, version), { encoding: "utf-8" });+}+function main(): void {const version = process.argv[2];if (!version) {@@ -422,6 +456,7 @@ function main(): void {prependToChangelog(section, version);updateManifest(version, prevTag);+ updateShardYaml(version);// Print section for GitHub Release bodyprocess.stdout.write(section);diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex eb7cafe..965f87c 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -92,12 +92,18 @@ jobs:sed -i 's/^ //' /tmp/release_body.mdcat /tmp/changelog_section.md >> /tmp/release_body.md- - name: Commit changelog and manifest+ - name: Commit changelog and manifestsrun: |git config user.name "github-actions[bot]"git config user.email "github-actions[bot]@users.noreply.github.com"git add CHANGELOG.md vault-manifest.json- git commit -m "release: update CHANGELOG and manifest for $VERSION"+ # Match the script's ENOENT tolerance: forks without `.shardmind/`+ # have nothing to stage, and `git add` on a missing path would+ # fail the workflow.+ if [ -f .shardmind/shard.yaml ]; then+ git add .shardmind/shard.yaml+ fi+ git commit -m "release: update CHANGELOG and manifests for $VERSION"git push origin main- name: Build vault zipdiff --git a/.shardmind/shard.yaml b/.shardmind/shard.yamlindex 245890c..6b7ec9f 100644--- a/.shardmind/shard.yaml+++ b/.shardmind/shard.yaml@@ -3,7 +3,7 @@apiVersion: v1name: obsidian-mindnamespace: breferrari-version: 6.0.0-beta.1+version: 6.0.0description: "AI-augmented Obsidian vault for multi-agent knowledge work"persona: "Engineers, researchers, freelancers — anyone using Claude Code, Codex, or Gemini CLI as a thinking partner"license: MIT