Skip to content

Commit 1fbc43e

Browse files
Add CI workflow, ESLint, Prettier, and pre-commit hooks
* feat: add minimal TUI mode with code review fixes - Add src/ui/tui.ts: ~150 LOC TUI using raw ANSI codes - Add src/tui.ts: entry point with dotenv loading - Export TUI from src/ui/index.ts - Add npm scripts: tui (bun) and tui:node (tsx) Code review fixes: - Remove unused HIDE_CURSOR constant - Fix memory leak: remove close listener after resolve - Fix spinner interval not cleared on close - Use unknown instead of any for error type - Pop failed user message from conversation on error Run with: npm run tui Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: cross-platform path handling and provider validation in TUI - Use path.basename() instead of split('/').pop() for Windows compatibility - Add provider validation to fail fast for non-Anthropic configs - Add API key validation with clear error messages Fixes issues from code review on PR #6. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: add CI workflow, ESLint, Prettier, and pre-commit hooks - Enhanced GitHub Actions CI with lint, typecheck, test, and build jobs - Added ESLint configuration with TypeScript support - Added Prettier configuration for consistent code formatting - Added Husky pre-commit hooks with lint-staged - Formatted all source files with Prettier - Added npm scripts: lint, lint:fix, format, format:check, check New scripts: - npm run lint - Run ESLint - npm run lint:fix - Auto-fix ESLint issues - npm run format - Format with Prettier - npm run format:check - Check formatting - npm run check - Run all checks (typecheck + lint + format) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 25ea445 commit 1fbc43e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2945
-598
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,66 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, typescript ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main, typescript ]
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
812

913
jobs:
10-
test:
11-
name: Test on Node.js ${{ matrix.node-version }}
14+
lint:
15+
name: Lint & Format
1216
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20.x'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run ESLint
30+
run: npm run lint
31+
32+
- name: Check Prettier formatting
33+
run: npm run format:check
34+
35+
typecheck:
36+
name: Type Check
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '20.x'
45+
cache: 'npm'
46+
47+
- name: Install dependencies
48+
run: npm ci
1349

50+
- name: Run TypeScript type check
51+
run: npm run typecheck
52+
53+
test:
54+
name: Test (Node ${{ matrix.node-version }})
55+
runs-on: ubuntu-latest
1456
strategy:
57+
fail-fast: false
1558
matrix:
16-
node-version: [18.x, 20.x, 21.x]
59+
node-version: ['20.x', '22.x']
1760

1861
steps:
1962
- uses: actions/checkout@v4
2063

21-
- name: Use Node.js ${{ matrix.node-version }}
64+
- name: Setup Node.js ${{ matrix.node-version }}
2265
uses: actions/setup-node@v4
2366
with:
2467
node-version: ${{ matrix.node-version }}
@@ -27,23 +70,17 @@ jobs:
2770
- name: Install dependencies
2871
run: npm ci
2972

30-
- name: Run type check
31-
run: npm run typecheck
32-
3373
- name: Run tests
3474
run: npm test
3575

36-
- name: Build
37-
run: npm run build
38-
39-
lint:
40-
name: Lint
76+
build:
77+
name: Build
4178
runs-on: ubuntu-latest
42-
79+
needs: [lint, typecheck, test]
4380
steps:
4481
- uses: actions/checkout@v4
4582

46-
- name: Use Node.js
83+
- name: Setup Node.js
4784
uses: actions/setup-node@v4
4885
with:
4986
node-version: '20.x'
@@ -52,5 +89,10 @@ jobs:
5289
- name: Install dependencies
5390
run: npm ci
5491

55-
- name: Run type check
56-
run: npm run typecheck
92+
- name: Build
93+
run: npm run build
94+
95+
- name: Verify build output
96+
run: |
97+
test -f dist/app.js
98+
echo "Build successful!"

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"src/**/*.ts": ["eslint --fix", "prettier --write"],
3+
"test/**/*.ts": ["eslint --fix", "prettier --write"],
4+
"*.{json,yml,yaml}": ["prettier --write"]
5+
}

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist/
2+
node_modules/
3+
implementations/
4+
*.md
5+
package-lock.json

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100,
7+
"bracketSpacing": true,
8+
"arrowParens": "always",
9+
"endOfLine": "lf"
10+
}

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
ignores: [
9+
'dist/**',
10+
'node_modules/**',
11+
'implementations/**',
12+
'*.js',
13+
'*.mjs',
14+
],
15+
},
16+
{
17+
files: ['src/**/*.ts', 'test/**/*.ts'],
18+
languageOptions: {
19+
ecmaVersion: 2022,
20+
sourceType: 'module',
21+
},
22+
rules: {
23+
// TypeScript specific
24+
'@typescript-eslint/no-unused-vars': ['warn', {
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
}],
28+
'@typescript-eslint/no-explicit-any': 'warn',
29+
'@typescript-eslint/explicit-function-return-type': 'off',
30+
'@typescript-eslint/no-non-null-assertion': 'off',
31+
'@typescript-eslint/no-require-imports': 'warn',
32+
'@typescript-eslint/no-unused-expressions': 'warn',
33+
34+
// General
35+
'no-console': 'off',
36+
'prefer-const': 'warn',
37+
'no-var': 'error',
38+
'eqeqeq': ['error', 'always'],
39+
'no-useless-escape': 'warn',
40+
'no-control-regex': 'off',
41+
},
42+
}
43+
);

0 commit comments

Comments
 (0)