Skip to content

Commit a564100

Browse files
SOIVclaude
andcommitted
chore: ESLint 설정 추가 및 AGENTS.md 업데이트
- ESLint 설정 구성 (@typescript-eslint/recommended, react-hooks/recommended) - no-explicit-any error, consistent-type-imports warn, no-console warn 규칙 적용 - stories 파일 ESLint 오버라이드 추가 (Storybook render 함수 패턴 허용) - 각 패키지에 lint 스크립트 추가 - foundation.ts 인덱스 시그니처 → Record 타입으로 수정 - main.tsx FormEvent를 type import로 수정 - HomeView 빈 onClick 핸들러를 Marketplace 이동으로 수정 - AGENTS.md: P0/P0.5 구현 완료 상태 반영, pnpm lint 커맨드 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6caaa94 commit a564100

11 files changed

Lines changed: 878 additions & 209 deletions

File tree

.eslintrc.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ module.exports = {
55
node: true,
66
browser: true,
77
},
8-
extends: [],
9-
ignorePatterns: ["dist", "node_modules"],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
ecmaVersion: 2022,
11+
sourceType: 'module',
12+
ecmaFeatures: { jsx: true },
13+
},
14+
plugins: ['@typescript-eslint', 'react-hooks'],
15+
extends: [
16+
'eslint:recommended',
17+
'plugin:@typescript-eslint/recommended',
18+
'plugin:@typescript-eslint/stylistic',
19+
'plugin:react-hooks/recommended',
20+
],
21+
rules: {
22+
'@typescript-eslint/no-explicit-any': 'error',
23+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
24+
'@typescript-eslint/consistent-type-imports': 'warn',
25+
'no-console': ['warn', { allow: ['warn', 'error'] }],
26+
},
27+
ignorePatterns: ['dist', 'node_modules', '*.js', '*.cjs'],
28+
overrides: [
29+
{
30+
files: ['**/*.stories.tsx'],
31+
rules: {
32+
'react-hooks/rules-of-hooks': 'off',
33+
'@typescript-eslint/no-empty-function': 'off',
34+
},
35+
},
36+
],
1037
};

AGENTS.md

Lines changed: 53 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -1,201 +1,55 @@
11
# AGENTS.md - Fieldstack Agent Guide
22

3-
> Project Status: Planning/Documentation phase (implementation planned 2026-2027)
4-
> This repo currently contains specifications and design docs. No source code yet.
5-
6-
---
7-
8-
## Repository Orientation
9-
10-
- Primary docs: `docs/v2_FINANCIAL-LEDGER/` (mostly Korean).
11-
- Public overview: `README.md`.
12-
- Treat commands and conventions as planned until implementation lands.
13-
14-
---
15-
16-
## Build / Lint / Test Commands
17-
18-
**Current State**: No build system implemented yet. Commands below are planned.
19-
20-
**Planned Dev/Build/Test/Lint (from docs)**:
21-
22-
```bash
23-
# Development (when implemented)
24-
pnpm dev # Run dev workflow (see 98-build-process.md)
25-
pnpm dev:web # Vite dev server (port 5173)
26-
pnpm dev:api # Express backend (port 3000)
27-
28-
# Production build
29-
pnpm build # Build all packages (integrated mode)
30-
pnpm build:web # Frontend only
31-
pnpm build:api # Backend only
32-
pnpm start # Start production server
33-
34-
# Testing (planned: Vitest + React Testing Library)
35-
pnpm test # Run all tests
36-
pnpm test:unit # Unit tests only
37-
pnpm test:e2e # E2E tests (Playwright)
38-
pnpm test:watch # Watch mode
39-
40-
# Linting (planned: ESLint + Prettier)
41-
pnpm lint # Lint all code
42-
pnpm lint:fix # Auto-fix issues
43-
pnpm format # Format with Prettier
44-
45-
# Type checking
46-
pnpm typecheck # TypeScript type checking
47-
```
48-
49-
**Single Test Runs**:
50-
- No single-test command is documented yet.
51-
- Once scripts exist, prefer project-defined commands in `package.json`.
52-
53-
---
54-
55-
## Build Process Details (Docs)
56-
57-
Reference: `docs/v2_FINANCIAL-LEDGER/deployment/98-build-process.md`
58-
59-
**Root scripts (planned)**:
60-
61-
```json
62-
{
63-
"scripts": {
64-
"dev": "pnpm --parallel dev",
65-
"dev:api": "pnpm --filter api dev",
66-
"dev:web": "pnpm --filter web dev",
67-
"build": "pnpm build:web && pnpm build:api && pnpm postbuild",
68-
"build:web": "pnpm --filter web build",
69-
"build:api": "pnpm --filter api build",
70-
"postbuild": "node scripts/copy-frontend.js",
71-
"start": "cd apps/api && node dist/index.js",
72-
"test": "pnpm --recursive test",
73-
"lint": "pnpm --recursive lint"
74-
}
75-
}
76-
```
77-
78-
**Build verification (planned)**:
79-
80-
```bash
81-
ls -la apps/web/dist
82-
ls -la apps/api/dist
83-
ls -la apps/api/public
84-
du -sh apps/web/dist
85-
du -sh apps/api/dist
86-
du -sh apps/api/public
87-
cd apps/api
88-
node dist/index.js
89-
```
90-
91-
---
92-
93-
## Code Style & Conventions (Planned)
94-
95-
### TypeScript Strictness
96-
97-
- Use strict TS settings (planned in `tsconfig.json`).
98-
- Never use `any`, `@ts-ignore`, or `@ts-expect-error`.
99-
100-
### Type Definitions
101-
102-
- Prefer `interface` for object shapes.
103-
- Use `type` for unions, intersections, utilities.
104-
- Define module types in `types/index.ts`.
105-
106-
### Imports
107-
108-
Order (planned ESLint rule):
109-
1. External libraries (`react`, `express`)
110-
2. Internal packages (`@fieldstack/core`, `@fieldstack/controls`)
111-
3. Relative imports (`./`, `../`)
112-
113-
Use `import type` for types.
114-
115-
### Naming Conventions
116-
117-
| Item | Convention | Example |
118-
| --- | --- | --- |
119-
| Components | PascalCase | `MyComponent.tsx` |
120-
| Hooks | `use` + camelCase | `useLedger.ts` |
121-
| Services | camelCase | `ledgerService.ts` |
122-
| Types/Interfaces | PascalCase | `LedgerItem` |
123-
| Constants | UPPER_SNAKE_CASE | `MAX_FILE_SIZE` |
124-
| Files | kebab-case or PascalCase | `ledger-list.tsx` |
125-
| API routes | kebab-case | `/api/ledger-items` |
126-
127-
### Error Handling
128-
129-
- Backend: explicit try/catch with meaningful status + message.
130-
- Frontend: user-friendly error messages; rethrow when caller needs it.
131-
- Never leave empty catch blocks.
132-
- Never log sensitive data (tokens, passwords).
133-
134-
### Validation
135-
136-
- Zod is preferred for input validation.
137-
- Yup is listed as an alternative, but use Zod unless module docs require otherwise.
138-
139-
---
140-
141-
## UI/UX Guidelines (Planned)
142-
143-
- UI is fully separated from core/module business logic.
144-
- Prefer `@fieldstack/controls` components for consistency.
145-
- Tailwind CSS is the planned styling approach.
146-
- Users can override UI with `apps/web/src/custom-ui/`.
147-
148-
Design tokens (from `docs/v2_FINANCIAL-LEDGER/ui/design-system.md`):
149-
- Primary color: blue scale (500 = `#3B82F6`).
150-
- Semantic colors: success `#10B981`, warning `#F59E0B`, danger `#EF4444`.
151-
- Fonts: Inter (text), JetBrains Mono (code).
152-
- Breakpoints: `sm <= 640`, `md >= 768`, `lg >= 1024`.
153-
154-
---
155-
156-
## Module Rules (Planned)
157-
158-
- Modules are self-contained (no cross-module imports).
159-
- Keep `frontend/`, `backend/`, `types/` within each module.
160-
- Use Event Bus for inter-module communication.
161-
- Core only forwards file uploads; modules validate/parse/process.
162-
- Privacy-first: no telemetry, no SaaS, no data collection.
163-
164-
---
165-
166-
## Testing Guidelines (Planned)
167-
168-
- Backend: Vitest
169-
- Frontend: React Testing Library
170-
- E2E: Playwright (optional)
171-
- Write tests for critical paths
172-
173-
---
174-
175-
## Tooling & Infra (Planned)
176-
177-
- Package manager: pnpm (workspace)
178-
- Node.js: >= 20
179-
- TypeScript: >= 5
180-
- React: >= 18
181-
- Backend: Express (or Fastify)
182-
183-
---
184-
185-
## Cursor / Copilot Rules
186-
187-
- No `.cursor/rules/`, `.cursorrules`, or `.github/copilot-instructions.md` found.
188-
189-
---
190-
191-
## Key References
192-
193-
- `docs/v2_FINANCIAL-LEDGER/technical/tech-stack.md`
194-
- `docs/v2_FINANCIAL-LEDGER/deployment/98-build-process.md`
195-
- `docs/v2_FINANCIAL-LEDGER/ui/design-system.md`
196-
- `docs/v2_FINANCIAL-LEDGER/ui/core-components.md`
197-
- `README.md`
198-
199-
---
200-
201-
Last Updated: 2026-02-03
3+
This file provides high-signal, repo-specific guidance for AI agents working in the Fieldstack repository. Read this before taking action to avoid architectural mistakes.
4+
5+
## Project Status & Environment
6+
- **Current Phase**: Phase 1.5 in progress. Core UI Shell is running but mostly mocked. Backend API endpoints are largely unimplemented.
7+
- **Workspace**: `pnpm` workspace with `node-linker=hoisted`.
8+
- **References**: Check `CLAUDE.md` and `docs/v2_FINANCIAL-LEDGER/` for phase-specific checklists and design tokens.
9+
10+
## Developer Commands
11+
12+
### Development Servers
13+
- `pnpm dev` — Runs web + api in parallel (includes setup wizard).
14+
- `pnpm dev:bypass`**(Crucial)** Runs web + api but skips the installation wizard via `INSTALL_MODE=bypass`. Use this to test core UI directly.
15+
- `pnpm dev:web` / `pnpm dev:api` — Run frontend or backend individually.
16+
- `pnpm storybook` — Runs Storybook for `@fieldstack/controls` on **port 6007**.
17+
18+
### Testing & Verification
19+
- `pnpm test` — Runs all tests recursively using Vitest.
20+
- `pnpm --filter <package> test` — Run tests for a specific workspace package (e.g., `api`, `core`).
21+
- `pnpm exec vitest run <path/to/test.ts>` — Run a single test file.
22+
- `pnpm lint` — Run ESLint across all workspace packages.
23+
- `pnpm typecheck` — Run TypeScript compiler checks.
24+
- `pnpm build` — Builds web, builds api, then copies web build to `apps/api/public` via `scripts/copy-frontend.js`.
25+
26+
## Architecture Quirks
27+
28+
### Frontend (`apps/web`)
29+
- **Hash Routing**: Uses Hash-based routing (`#login`, `#home`, `#admin`) managed by a custom state machine in `apps/web/src/main.tsx` (`effectiveRoute`).
30+
- **Auth State**: Authentication and session state are persisted in `sessionStorage` using the `fs_` prefix (e.g., `fs_auth`, `fs_admin`).
31+
- **Dev Mocks**: When testing auth UI locally, use `otp1234` for the OTP flow and `temp1234` for the force-password-change flow.
32+
33+
### Backend (`apps/api`)
34+
- **Dynamic Module Loading**: Backend modules are dynamically scanned and loaded via `apps/api/src/loader/index.ts`.
35+
- **Module Requirements**: A backend module will only be loaded if it has a valid `module.json` manifest with `"enabled": true`.
36+
37+
### Shared & UI Packages
38+
- **`packages/controls`**: All P0/P0.5 components are fully implemented (`ready: true`). Styled with `fs-` prefixed CSS classes and design tokens. Use `@fieldstack/controls` in `apps/web` — do not write inline component styles in views.
39+
- **Inter-module Communication**: Direct module-to-module imports are strictly forbidden. All cross-module communication must use the Event Bus.
40+
41+
## Strict Code Rules
42+
43+
- **TypeScript Strictness**: **NEVER** use `any`, `@ts-ignore`, or `@ts-expect-error`. If types are wrong, fix the types.
44+
- **Imports**:
45+
1. External libraries (`react`, `express`)
46+
2. Internal workspace packages (`@fieldstack/core`, `@fieldstack/controls`)
47+
3. Relative imports (`./`, `../`)
48+
- Always use `import type` when importing types/interfaces.
49+
- **Naming Conventions**:
50+
- Components / Types / Interfaces: `PascalCase`
51+
- Hooks: `useCamelCase`
52+
- Constants: `UPPER_SNAKE_CASE`
53+
- Files / API Routes: `kebab-case`
54+
- **Validation**: Use Zod for schema and input validation.
55+
- **Error Handling**: Never leave empty `catch` blocks. Frontend should present user-friendly errors; backend should throw explicit HTTP statuses. Never log sensitive tokens.

apps/api/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"build": "tsc",
1010
"start": "node dist/index.js",
1111
"test": "vitest run",
12-
"typecheck": "tsc --noEmit"
12+
"typecheck": "tsc --noEmit",
13+
"lint": "eslint src --ext .ts"
1314
},
1415
"devDependencies": {
1516
"tsx": "^4.21.0",

apps/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "tsc && vite build",
99
"preview": "vite preview",
1010
"test": "vitest run --passWithNoTests",
11-
"typecheck": "tsc --noEmit"
11+
"typecheck": "tsc --noEmit",
12+
"lint": "eslint src --ext .ts,.tsx"
1213
},
1314
"devDependencies": {
1415
"@types/react": "^19.2.14",

apps/web/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FormEvent, useEffect, useMemo, useState } from "react";
1+
import { type FormEvent, useEffect, useMemo, useState } from "react";
22
import { createRoot } from "react-dom/client";
33

44
import "./styles/global.css";

apps/web/src/views/HomeView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function HomeView({ onOpenSettings }: HomeViewProps) {
125125
icon="⬡"
126126
title="No modules installed yet"
127127
description="첫 모듈을 설치하면 메인 허브에 즉시 표시됩니다."
128-
action={{ label: "Browse Marketplace", onClick: () => {} }}
128+
action={{ label: "Browse Marketplace", onClick: () => { window.location.hash = '#marketplace'; } }}
129129
/>
130130
)}
131131
</section>

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
"version": "0.0.0",
55
"devDependencies": {
66
"@types/node": "^22.18.2",
7+
"@typescript-eslint/eslint-plugin": "^8.35.1",
8+
"@typescript-eslint/parser": "^8.35.1",
79
"@vitest/coverage-v8": "^2.1.9",
10+
"eslint": "^8.57.1",
11+
"eslint-plugin-react-hooks": "^5.2.0",
812
"typescript": "^5.9.2",
913
"vitest": "^2.1.9"
1014
},

packages/controls/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"build": "tsc",
1717
"test": "vitest run --passWithNoTests",
1818
"typecheck": "tsc --noEmit",
19+
"lint": "eslint src --ext .ts,.tsx",
1920
"storybook": "storybook dev -p 6006",
2021
"storybook:build": "storybook build"
2122
},

packages/controls/src/foundation.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
export interface ThemeColorScale {
2-
[key: string]: string;
3-
}
1+
export type ThemeColorScale = Record<string, string>;
42

53
export interface UiThemeTokens {
64
primary: ThemeColorScale;

packages/core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"scripts": {
1515
"build": "tsc",
1616
"test": "vitest run",
17-
"typecheck": "tsc --noEmit"
17+
"typecheck": "tsc --noEmit",
18+
"lint": "eslint src --ext .ts"
1819
},
1920
"devDependencies": {
2021
"vitest": "^2.1.9"

0 commit comments

Comments
 (0)