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
5 changes: 2 additions & 3 deletions .ai-run/guides/development/development-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,8 @@ codemie doctor
| Dev watch | `npm run dev` | Watch mode (tsc --watch) |
| Lint | `npm run lint` | ESLint check (zero warnings) |
| Lint fix | `npm run lint:fix` | Auto-fix issues |
| Test | `npm test` | ONLY if user requests |
| Test unit | `npm run test:unit` | Unit tests only |
| Test integration | `npm run test:integration` | Integration tests only |
| Test | `npm test` | Full local suite (unit + cli + agent), ONLY if user requests |
| Test one project | `npx vitest run --project unit\|cli\|agent` | Scoped run while iterating |
| CI | `npm run ci` | Full CI pipeline |
| Link global | `npm link` | Link for local testing |

Expand Down
8 changes: 4 additions & 4 deletions .ai-run/guides/quality-gates.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ Run order is fastest-to-slowest. Each gate is a real `npm run` script in `packag

### Unit tests

**Run**: `npm run test:unit` (`vitest run src`)
**Run**: `npx vitest run --project unit` (part of `npm test`)
**Pass**: all tests under `src/**/__tests__/` and `src/**/*.test.ts` pass.
**Fail**: Vitest prints failing specs with stack traces.
**Auto-fix**: none.
**Skip if**: never, unless the change is `.ai-run/guides/` or doc-only.

### Cross-platform CI (Windows)

CI runs a separate `test-windows` job (`.github/workflows/ci.yml`) using the same `npm run test:unit`/`test:integration` commands on `windows-latest`. GitHub's Windows runners default `core.autocrlf=true`, so any text file is checked out with CRLF unless `.gitattributes` forces LF. The repo's `.gitattributes` (`* text=auto eol=lf`) exists specifically to prevent this — without it, a `.mjs`/`.js` file starting with a shebang line (`#!/usr/bin/env node`) breaks Vite/Vitest's module transform with `SyntaxError: Invalid or unexpected token` when checked out with CRLF. See `src/agents/plugins/claude/plugin/statusline.mjs:1`.
CI runs a separate `test-windows` job (`.github/workflows/ci.yml`) using the same `npm run ci` test commands (`vitest run --project unit` / `--project cli`) on `windows-latest`. GitHub's Windows runners default `core.autocrlf=true`, so any text file is checked out with CRLF unless `.gitattributes` forces LF. The repo's `.gitattributes` (`* text=auto eol=lf`) exists specifically to prevent this — without it, a `.mjs`/`.js` file starting with a shebang line (`#!/usr/bin/env node`) breaks Vite/Vitest's module transform with `SyntaxError: Invalid or unexpected token` when checked out with CRLF. See `src/agents/plugins/claude/plugin/statusline.mjs:1`.

**Local repro**: convert a file to CRLF (`perl -pi -e 's/\n/\r\n/ unless /\r\n$/' <file>`) and re-run `npx vitest run <its-test>` — this reproduces Windows-only CI failures without needing a Windows machine.

### Integration tests

**Run**: `npm run test:integration` (`vitest run tests/integration`)
**Run**: `npx vitest run --project cli` (part of `npm test`; `tests/integration/**` minus `agent-*.test.ts`)
**Pass**: all specs under `tests/integration/` pass.
**Fail**: Vitest output identifies the failing scenario; check `tests/integration/session/fixtures/` for snapshot drift.
**Auto-fix**: none.
Expand Down Expand Up @@ -80,7 +80,7 @@ CI runs a separate `test-windows` job (`.github/workflows/ci.yml`) using the sam

### Full CI

**Run**: `npm run ci` (`license-check && lint && build && test:unit && test:integration`)
**Run**: `npm run ci` (`license-check && lint && build && vitest run --project unit && vitest run --project cli`)
**Pass**: every above-listed gate passes in order.
**Fail**: stops at the first failing gate.
**Skip if**: never before merge.
Expand Down
2 changes: 1 addition & 1 deletion .ai-run/guides/testing/testing-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Reference: `tests/integration/*.test.ts`

## Test Commands

See `.ai-run/guides/quality-gates.md` for full command definitions (`npm test`, `test:unit`, `test:integration`, `test:coverage`, `test:watch`).
See `.ai-run/guides/quality-gates.md` for full command definitions (`npm test` runs the full local suite; `npx vitest run --project unit|cli|agent` for a scoped run; `test:coverage`, `test:watch`).

Run a specific file:
```bash
Expand Down
6 changes: 3 additions & 3 deletions .claude/agents/qa-lead.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ npm run validate:secrets
The repository policy says tests are run only on explicit user request. If the user explicitly requested tests or coverage, run the requested scope:

```bash
npm test
npm run test:unit
npm run test:integration
npm test # full local suite: unit + cli + agent
npx vitest run --project unit # scoped: unit only
npx vitest run --project cli # scoped: CLI integration only
npm run test:coverage
```

Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/codemie-release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Confirm release version 0.0.36?
**After user confirms the version, run the full test suite before any commits.**

```bash
npm run test:all
npm test
```

This runs unit tests, CLI integration tests, and agent tests (`unit` + `cli` + `agent` projects).
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ jobs:
path: dist/

- name: Run unit tests
run: npm run test:unit
run: npx vitest run --project unit

- name: Run integration tests
run: npm run test:integration
run: npx vitest run --project cli

test-windows:
name: Test (Windows)
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
path: dist/

- name: Run unit tests
run: npm run test:unit
run: npx vitest run --project unit

- name: Run integration tests
run: npm run test:integration
run: npx vitest run --project cli
15 changes: 6 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,13 @@ To get the project running locally, follow these steps:

### Run All Tests
```bash
npm test # Run tests in watch mode
npm run test:run # Run tests once
npm run test:unit # Run unit tests only
npm run test:integration # Run integration tests only
npm run test:integration:agent # Run agent integration tests only
npm run test:all # Run unit + CLI + agent tests in sequence
npm test # Run unit + CLI + agent tests once, in sequence — the full local suite
npm run test:watch # Run tests in interactive watch mode
```

> **Note:** Agent integration tests (`test:integration:agent` and the agent stage of `test:all`) only execute if you have a working CodeMie SSO setup. If your active profile provider is not `ai-run-sso`, the agent tests are automatically skipped and a message is printed — no credentials error will occur.
`npm test` is the same test suite `npm run ci` runs (minus the `agent` project, which CI can't run without live SSO credentials) — it's what the release process uses too. To run just one project while iterating, use vitest directly, e.g. `npx vitest run --project unit` or `npx vitest run --project cli -- <file>`.

> **Note:** The agent stage of `npm test` only executes if you have a working CodeMie SSO setup. If your active profile provider is not `ai-run-sso`, the agent tests are automatically skipped and a message is printed — no credentials error will occur.

### Run Validation Checks

Expand Down Expand Up @@ -252,8 +250,7 @@ Before committing, ensure:
1. ✅ Commit message follows Conventional Commits format
2. ✅ Code passes ESLint with zero warnings: `npm run lint`
3. ✅ TypeScript compiles: `npm run build`
4. ✅ All tests pass: `npm run test:run`
5. ✅ Agent tests pass: `npm run test:integration:agent` or `npm run test:all` (only if CodeMie SSO is configured)
4. ✅ All tests pass: `npm test` (agent stage only if CodeMie SSO is configured)
6. ✅ No secrets exposed: `npm run validate:secrets` (optional, requires Docker)
7. ✅ Dependencies have approved licenses: `npm run license-check`

Expand Down
2 changes: 1 addition & 1 deletion docs/COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ reduced hidden-reasoning continuity. Prefer a current VS Code release (1.122 or
stateless flag and marker suppression are honored.

Check the daemon context with `codemie proxy status`. Automated VS Code BYOK configuration
and routing coverage runs as part of `npm run test:all`.
and routing coverage runs as part of `npm test`.

#### Troubleshooting VS Code BYOK

Expand Down
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@
"copy-plugin": "node scripts/copy-plugins.js",
"prepare:install-artifacts": "node scripts/prepare-install-artifacts.mjs",
"dev": "tsc --watch",
"test": "vitest",
"test:unit": "vitest run --project unit",
"test:integration": "vitest run --project cli",
"test:integration:cli": "vitest run --project cli",
"test:integration:vscode-models": "vitest run --project cli tests/integration/vscode-byok.test.ts tests/integration/vscode-models.live.test.ts",
"test:integration:agent": "vitest run --project agent",
"test:run": "vitest run --project unit --project cli",
"test:all": "vitest run --project unit && vitest run --project cli && vitest run --project agent",
"test": "vitest run --project unit && vitest run --project cli && vitest run --project agent",
"test:coverage": "vitest run --project unit --coverage",
"test:watch": "vitest --watch",
"test:ui": "vitest --ui",
Expand All @@ -55,7 +48,7 @@
"commitlint:last": "commitlint --from HEAD~1 --to HEAD --verbose",
"validate:secrets": "node scripts/validate-secrets.js",
"license-check": "node scripts/license-check.js",
"ci": "npm run license-check && npm run lint && npm run build && npm run test:unit && npm run test:integration",
"ci": "npm run license-check && npm run lint && npm run build && vitest run --project unit && vitest run --project cli",
"ci:full": "npm run commitlint:last && npm run ci",
"prepare": "husky",
"prepublishOnly": "npm run build",
Expand Down
6 changes: 3 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Designed to be resumable - can continue from failed steps
#
# Release flow: version bump → commit → agent tests gate → tag → push → GitHub release
# Agent tests gate: runs `npm run test:integration:agent` before tagging.
# Agent tests gate: runs `npx vitest run --project agent` before tagging.
# - Tests pass → continue automatically
# - Tests fail → release blocked (fix tests first)
# - Tests cannot run (missing SSO/JWT credentials) → manual confirmation required
Expand Down Expand Up @@ -207,7 +207,7 @@ echo ""
echo "🧪 Running agent tests..."
AGENT_TEST_JSON=$(mktemp /tmp/agent-test-XXXXX.json) || { echo "ERROR: mktemp failed, cannot capture agent test results"; exit 1; }
trap 'rm -f "$AGENT_TEST_JSON"' EXIT INT TERM
npm run test:integration:agent -- --reporter=verbose --reporter=json --outputFile="$AGENT_TEST_JSON"
npx vitest run --project agent --reporter=verbose --reporter=json --outputFile="$AGENT_TEST_JSON"
AGENT_EXIT_CODE=$?

AGENT_PASSED=0
Expand Down Expand Up @@ -237,7 +237,7 @@ else
echo " (check: cat ~/.codemie/codemie-cli.config.json)"
echo " • CI: set CI_IS_LOCAL_RUN=false and provide tests/.env.test.local"
echo ""
echo " To run manually: npm run test:integration:agent"
echo " To run manually: npx vitest run --project agent"
echo ""
read -p "❓ Have you manually run agent tests and confirmed they pass? (y/N): " -n 1 -r
echo
Expand Down
Loading
Loading