Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

chore: add unified version bump script and update publish workflow

Gener6aaa6e9f6079
diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml
index 88a7b1109..838e90de2 100644
--- a/.github/workflows/publish-cli.yml
+++ b/.github/workflows/publish-cli.yml
@@ -2,10 +2,11 @@ name: Publish CLI
on:
push:
- tags: ["cli/v*"]
+ branches: [main]
+ paths: [src/cli/package.json]
concurrency:
- group: publish-cli-${{ github.ref }}
+ group: publish-cli
cancel-in-progress: false
jobs:
@@ -17,58 +18,58 @@ jobs:
id-token: write
contents: write
steps:
- - name: Validate tag
+ - uses: actions/checkout@v6
+
+ - name: Detect version
+ id: version
run: |
- if [[ ! "${GITHUB_REF_NAME}" =~ ^cli/v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
- echo "::error::Tag ${GITHUB_REF_NAME} does not match cli/vX.Y.Z[-prerelease]"
- exit 1
- fi
- echo "VERSION=${GITHUB_REF_NAME#cli/v}" >> "$GITHUB_ENV"
+ VERSION=$(node -p "require('./src/cli/package.json').version")
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ echo "tag=cli/v$VERSION" >> "$GITHUB_OUTPUT"
- - uses: actions/checkout@v6
+ - name: Check if version already published
+ id: check
+ run: |
+ if npm view "@alook/cli@${{ steps.version.outputs.version }}" version >/dev/null 2>&1; then
+ echo "skip=true" >> "$GITHUB_OUTPUT"
+ echo "::notice::@alook/cli@${{ steps.version.outputs.version }} already on npm — skipping"
+ else
+ echo "skip=false" >> "$GITHUB_OUTPUT"
+ fi
- uses: pnpm/action-setup@v6
+ if: steps.check.outputs.skip == 'false'
- uses: oven-sh/setup-bun@v2
+ if: steps.check.outputs.skip == 'false'
- uses: actions/setup-node@v6
+ if: steps.check.outputs.skip == 'false'
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Upgrade npm for Trusted Publishers
- # Install into a separate prefix so the running npm doesn't overwrite
- # its own node_modules mid-install (npm/cli#7657).
+ if: steps.check.outputs.skip == 'false'
run: |
npm install -g --prefix="$RUNNER_TEMP/npm-new" npm@latest
echo "$RUNNER_TEMP/npm-new/bin" >> "$GITHUB_PATH"
- run: pnpm install --frozen-lockfile
-
- - name: Set CLI package version
- working-directory: src/cli
- run: npm version "$VERSION" --no-git-tag-version --allow-same-version
+ if: steps.check.outputs.skip == 'false'
- name: Build CLI bundle
+ if: steps.check.outputs.skip == 'false'
run: pnpm -C src/cli run build
- - name: Check if version already published
- id: check_published
- run: |
- if npm view "@alook/cli@$VERSION" version >/dev/null 2>&1; then
- echo "already_published=true" >> "$GITHUB_OUTPUT"
- echo "::notice::@alook/cli@$VERSION already on npm — skipping publish"
- else
- echo "already_published=false" >> "$GITHUB_OUTPUT"
- fi
-
- name: Publish to npm (OIDC)
- if: steps.check_published.outputs.already_published == 'false'
+ if: steps.check.outputs.skip == 'false'
working-directory: src/cli
run: npm publish --access public
- name: Create GitHub release
+ if: steps.check.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: gh release create "$GITHUB_REF_NAME" --generate-notes --title "CLI v$VERSION"
+ run: gh release create "${{ steps.version.outputs.tag }}" --generate-notes --title "CLI v${{ steps.version.outputs.version }}"
diff --git a/AGENTS.md b/AGENTS.md
index de294c860..ec4d1bcbb 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -14,6 +14,17 @@ Alook's main purpose is to make the cli agent always on, and give it a email add
- service must be STATELESS! All the state must be in DB or local, never put important states in memory.
- scope the queries before, not check the ownership after. don't query data then check if the data belongs to a workspace, use workspace id ahead to query the data.
+## Release — Unified Version Bump
+All workspace packages share one version. Use `pnpm bump` to release:
+```bash
+pnpm bump 0.0.11 # explicit version (v prefix optional)
+pnpm bump patch # auto-increment patch/minor/major
+```
+This updates every `src/*/package.json`, commits `release: vX.Y.Z`, but does NOT push.
+After reviewing the commit, `git push origin main` to trigger CI:
+- **@alook/cli** → auto-published to npm via `publish-cli.yml` (watches `src/cli/package.json`)
+- **CF Workers** → each module redeploys when its own `package.json` changes
+
## Plan-driven Development
- You must make a markdown plan at `plans/` before you implement any my request, otherwise I will reject your implementation.
- The `plans/` directory is gitignored — plans are kept locally and do not need to be committed or included in PRs.
diff --git a/package.json b/package.json
index 1d8b862eb..62a0339bc 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,8 @@
"deploy:web": "cd src/web && npx opennextjs-cloudflare build && npx opennextjs-cloudflare deploy",
"deploy:ws-do": "cd src/ws-do && npx wrangler deploy",
"deploy:email": "cd src/email-worker && npx wrangler deploy",
- "db:migrate:remote": "pnpm --filter @alook/web exec wrangler d1 migrations apply alook-app --remote"
+ "db:migrate:remote": "pnpm --filter @alook/web exec wrangler d1 migrations apply alook-app --remote",
+ "bump": "node scripts/bump-version.mjs"
},
"devDependencies": {
"turbo": "^2.9.6",
diff --git a/scripts/bump-version.mjs b/scripts/bump-version.mjs
new file mode 100644
index 000000000..8018c3722
--- /dev/null
+++ b/scripts/bump-version.mjs
@@ -0,0 +1,68 @@
+#!/usr/bin/env node
+import { readFileSync, writeFileSync } from "node:fs";
+import { join } from "node:path";
+import { execSync } from "node:child_process";
+
+const ROOT = new URL("..", import.meta.url).pathname.replace(/\/$/, "");
+const WORKSPACE_DIRS = ["src/shared", "src/cli", "src/web", "src/email-worker", "src/ws-do"];
+
+function readPkg(dir) {
+ const p = join(ROOT, dir, "package.json");
+ return { path: p, pkg: JSON.parse(readFileSync(p, "utf8")) };
+}
+
+function writePkg(path, pkg) {
+ writeFileSync(path, JSON.stringify(pkg, null, 2) + "\n");
+}
+
+function bumpSemver(current, type) {
+ const [major, minor, patch] = current.split(".").map(Number);
+ if (type === "major") return `${major + 1}.0.0`;
+ if (type === "minor") return `${major}.${minor + 1}.0`;
+ return `${major}.${minor}.${patch + 1}`;
+}
+
+const arg = process.argv[2];
+if (!arg) {
+ console.error("Usage: pnpm bump <version|patch|minor|major>");
+ console.error(" pnpm bump 0.0.11");
+ console.error(" pnpm bump v0.0.11");
+ console.error(" pnpm bump patch");
+ process.exit(1);
+}
+
+const BUMP_TYPES = ["patch", "minor", "major"];
+let version;
+
+if (BUMP_TYPES.includes(arg)) {
+ const { pkg } = readPkg(WORKSPACE_DIRS[0]);
+ version = bumpSemver(pkg.version, arg);
+} else {
+ version = arg.replace(/^v/, "");
+ if (!/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/.test(version)) {
+ console.error(`Invalid version: ${arg}`);
+ process.exit(1);
+ }
+}
+
+console.log(`\n📦 Bumping all packages to v${version}\n`);
+
+const files = [];
+
+for (const dir of WORKSPACE_DIRS) {
+ const { path, pkg } = readPkg(dir);
+ const old = pkg.version;
+ pkg.version = version;
+ writePkg(path, pkg);
+ files.push(path);
+ console.log(` ${pkg.name}: ${old} → ${version}`);
+}
+
+const gitFiles = files.map((f) => f.replace(ROOT + "/", ""));
+execSync(`git add ${gitFiles.join(" ")}`, { cwd: ROOT, stdio: "inherit" });
+execSync(`git commit -m "release: v${version}"`, { cwd: ROOT, stdio: "inherit" });
+
+console.log(`\n✅ Committed: release: v${version}`);
+console.log(`\n👉 Next steps:`);
+console.log(` git push origin main`);
+console.log(` # CI will auto-publish @alook/cli and trigger CF deployments\n`);