From 5d0ac66f6560f97eadcbea29a036584d7dd60aa5 Mon Sep 17 00:00:00 2001 From: Grimmer Kang Date: Mon, 6 Jul 2026 14:02:47 +0800 Subject: [PATCH 01/10] feat(multi-account): codev account CLI + Vitest + CI (Batch 2a) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a `codev account` CLI that manages ~/.config/codev/accounts.json and regenerates accounts.sh from ONE shared generator, replacing Batch 1's hand-editing. Run in dev via `yarn account `. - src/cli/account-manager.ts: shared registry read/write + accounts.sh generator (the 2b Settings UI will reuse the same generator) - src/cli/codev-account.ts: CLI — list/add/default/remove/regenerate/ show/install/uninstall - src/cli/account-manager.test.ts: Vitest suite for the generator (default -> no env, extra -> CLAUDE_CONFIG_DIR, dispatcher * -> defaultAccount, whoami mapping, bash -n validity) - Replace the placeholder CI with a real test workflow (yarn test) - Bump 1.0.77 + CHANGELOG + design-doc §6.A/§7 Verified: generated accounts.sh is functionally equivalent to the hand-written one (diff) and passes `zsh -n`; 9/9 tests green. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017kCK4t5JSVynVZxGcrTGGp --- .github/workflows/test_ci.yaml | 27 +- CHANGELOG.md | 7 + docs/multi-account-support-design.md | 24 +- package.json | 6 +- src/cli/account-manager.test.ts | 100 ++++++ src/cli/account-manager.ts | 350 ++++++++++++++++++++ src/cli/codev-account.ts | 157 +++++++++ vitest.config.ts | 11 + yarn.lock | 478 ++++++++++++++++++++++++++- 9 files changed, 1140 insertions(+), 20 deletions(-) create mode 100644 src/cli/account-manager.test.ts create mode 100644 src/cli/account-manager.ts create mode 100644 src/cli/codev-account.ts create mode 100644 vitest.config.ts diff --git a/.github/workflows/test_ci.yaml b/.github/workflows/test_ci.yaml index d83fce1..316905f 100644 --- a/.github/workflows/test_ci.yaml +++ b/.github/workflows/test_ci.yaml @@ -1,19 +1,22 @@ -name: hello-world +name: test on: - workflow_dispatch: pull_request: - branches: - - master - - staging - - main - paths: - - README.md - + branches: [main] + push: + branches: [main] + workflow_dispatch: jobs: - my-job: + test: runs-on: ubuntu-latest steps: - - name: my-step - run: echo "Hello World!" \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Run tests + run: yarn test diff --git a/CHANGELOG.md b/CHANGELOG.md index 85a231b..e8bf219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 1.0.77 + +- Feat: multi-account Batch 2a — `codev account` CLI to manage the registry + - `codev account list | add