Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
pull_request:
paths:
- 'apps/cli/**'
- 'apps/frontend/openapi.json'
- '.github/workflows/cli-test.yml'
push:
branches: [main]
paths:
- 'apps/cli/**'
- 'apps/frontend/openapi.json'
- '.github/workflows/cli-test.yml'

concurrency:
Expand Down Expand Up @@ -57,10 +59,37 @@ jobs:
run: pnpm install --frozen-lockfile
working-directory: apps/cli

- name: Generate CLI OpenAPI types
run: pnpm openapi:generate
working-directory: apps/cli

- name: Type-check CLI application
run: pnpm build
working-directory: apps/cli

- name: Type-check contract tests
run: pnpm typecheck:test
working-directory: apps/cli

- name: Check generated CLI OpenAPI type drift
run: |
set -euo pipefail
if git diff --quiet -- src/api/openapi.d.ts; then
echo "CLI OpenAPI types are in sync."
exit 0
fi

echo "::error::apps/cli/src/api/openapi.d.ts is out of sync with apps/frontend/openapi.json."
echo ""
echo "After changing the API surface, regenerate and commit the CLI types:"
echo " cd apps/cli && pnpm openapi:generate"
echo " git add apps/cli/src/api/openapi.d.ts"
echo ""
echo "Diff:"
git diff -- src/api/openapi.d.ts | head -200 || true
exit 1
working-directory: apps/cli

- name: Run tests
run: pnpm test
working-directory: apps/cli
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ cargo test --workspace --lib
- `DATABASE_URL` / `REDIS_URL` が環境か `.env` に設定済みならそれを優先する(CI と同じ経路。CI はこの経路のためワークフロー変更不要)
- SMTP・シークレット系の env はハーネスが CI と同じテスト用の値で補完する。GitHub App 系も設定不要(`load_github_test_env()` が自前注入)。SMTP は実サーバー不要
- API 表面を変えたら: `cd apps/frontend && pnpm openapi && node_modules/.bin/vp fmt`
- CLI 型も再生成: `cd apps/cli && pnpm openapi:generate`
- 整形は **`vp fmt`**(prettier は入っていない)。`api.d.ts` は gitignore 済み
- API を変えていない PR では `openapi.json` の差分ゼロが検証項目になる

Expand Down
2 changes: 2 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"build": "tsc",
"dev": "ts-node src/index.ts",
"openapi:generate": "openapi-typescript ../frontend/openapi.json -o ./src/api/openapi.d.ts",
"test": "pnpm run build && vitest run",
"typecheck:test": "tsc -p tsconfig.test.json"
},
Expand All @@ -22,6 +23,7 @@
"devDependencies": {
"@types/js-yaml": "4.0.9",
"@types/node": "24.13.3",
"openapi-typescript": "7.13.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",
"vitest": "4.1.10"
Expand Down
Loading