Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
},
"metadata": {
"description": "Permanent coding companion for Claude Code (requires bun: https://bun.sh/install)",
"version": "0.3.0"
"version": "0.5.2"
},
"plugins": [
{
"name": "claude-buddy",
"source": "./",
"description": "Permanent coding companion for Claude Code \u2014 survives any update. MCP-based terminal pet with ASCII art, stats, reactions, and personality. Requires bun runtime (https://bun.sh/install).",
"version": "0.3.0",
"version": "0.5.2",
"author": {
"name": "1270011"
},
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "claude-buddy",
"version": "0.3.0",
"version": "0.5.2",
"description": "Permanent coding companion for Claude Code \u2014 survives any update. MCP-based terminal pet with ASCII art, stats, reactions, and personality.",
"author": {
"name": "1270011"
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"tui": "bun run cli/tui.tsx",
"test": "bun test",
"typecheck": "tsc --noEmit",
"gen:emoji-widths": "bun run scripts/gen-emoji-widths.ts"
"gen:emoji-widths": "bun run scripts/gen-emoji-widths.ts",
"sync-version": "bun run scripts/sync-version.ts",
"version": "bun run sync-version && git add .claude-plugin"
},
"files": [
"server/",
Expand Down
85 changes: 85 additions & 0 deletions scripts/sync-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* Sync version fields across the repo so package.json is the single source of truth.
*
* Run directly:
* bun run sync-version
*
* Wired into npm lifecycle via `"version"` script in package.json so that
* `bun pm version <bump>` (or `npm version <bump>) updates all three files
* together and git-adds them for the auto-generated version commit.
*
* --check: exit non-zero without modifying files if anything is out of sync
* (use this in CI).
*/

import { readFileSync, writeFileSync } from "fs";

const CHECK_ONLY = process.argv.includes("--check");

const pkg = JSON.parse(readFileSync("package.json", "utf8"));
const { version } = pkg;
if (typeof version !== "string" || !version) {
console.error("sync-version: package.json is missing a version field");
process.exit(2);
}

type Target = {
path: string;
read: () => unknown;
diffs: (doc: any) => { label: string; current: string }[];
apply: (doc: any) => void;
};

const targets: Target[] = [
{
path: ".claude-plugin/plugin.json",
read: () => JSON.parse(readFileSync(".claude-plugin/plugin.json", "utf8")),
diffs: (doc) => [{ label: "version", current: doc.version }],
apply: (doc) => {
doc.version = version;
},
},
{
path: ".claude-plugin/marketplace.json",
read: () =>
JSON.parse(readFileSync(".claude-plugin/marketplace.json", "utf8")),
diffs: (doc) => {
const out: { label: string; current: string }[] = [
{ label: "metadata.version", current: doc.metadata?.version },
];
for (let i = 0; i < (doc.plugins?.length ?? 0); i++) {
out.push({
label: `plugins[${i}].version`,
current: doc.plugins[i].version,
});
}
return out;
},
apply: (doc) => {
if (doc.metadata) doc.metadata.version = version;
for (const p of doc.plugins ?? []) p.version = version;
},
},
];

let drifted = false;
for (const t of targets) {
const doc = t.read();
const diffs = t.diffs(doc).filter((d) => d.current !== version);
if (diffs.length === 0) continue;
drifted = true;
for (const d of diffs) {
const prefix = CHECK_ONLY ? "DRIFT" : "sync";
console.log(`${prefix}: ${t.path} :: ${d.label} ${d.current} -> ${version}`);
}
if (!CHECK_ONLY) {
t.apply(doc);
writeFileSync(t.path, JSON.stringify(doc, null, 4) + "\n");
}
}

if (CHECK_ONLY && drifted) {
console.error("sync-version: version fields are out of sync with package.json");
process.exit(1);
}
if (!drifted) console.log(`sync-version: all version fields already at ${version}`);
3 changes: 2 additions & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { join, resolve, dirname } from "path";
import pkg from "../package.json" with { type: "json" };

import {
generateBones,
Expand Down Expand Up @@ -122,7 +123,7 @@ function getInstructions(): string {
const server = new McpServer(
{
name: "claude-buddy",
version: "0.3.0",
version: pkg.version,
},
{
instructions: getInstructions(),
Expand Down