|
1 | | -# AGENTS.md |
| 1 | +# Agent Configuration |
2 | 2 |
|
3 | | -This file provides guidance to AI coding agents working with code in this repository. |
| 3 | +> `CLAUDE.md` points to this file so Claude Code picks it up automatically. Other agents (Cursor, Windsurf, etc.) read `AGENTS.md` natively. |
| 4 | +
|
| 5 | +--- |
4 | 6 |
|
5 | 7 | ## What This Is |
6 | 8 |
|
7 | | -A CLI installer tool for dAppBooster projects, built with React + Ink (terminal UI framework). It walks users through an interactive setup flow: project naming, repo cloning, installation mode selection, optional packages, and post-install steps. |
| 9 | +A CLI installer tool for dAppBooster projects. It supports two modes: |
| 10 | + |
| 11 | +- **Interactive** (default): React + Ink TUI that walks users through project naming, repo cloning, installation mode selection, optional packages, and post-install steps. |
| 12 | +- **Non-interactive**: Flag-driven mode (`--ni` or auto-detected when not a TTY) for AI agents and CI. Outputs JSON to stdout. Run `--info` for feature discovery, then `--name` + `--mode` [+ `--features`] to install. |
| 13 | + |
| 14 | +## Stack & Conventions |
| 15 | + |
| 16 | +| Category | Technology | Notes | |
| 17 | +|----------|-----------|-------| |
| 18 | +| Language | TypeScript (strict mode) | Extends `@sindresorhus/tsconfig` | |
| 19 | +| Framework | React + Ink | Terminal UI framework | |
| 20 | +| Arg parsing | meow | CLI flag parsing for non-interactive mode | |
| 21 | +| Package manager | pnpm | Never npm or yarn | |
| 22 | +| Linting/formatting | Biome | Run `pnpm lint` before committing | |
| 23 | +| Testing | Vitest + @vitest/coverage-v8 | | |
| 24 | +| Node | v20+ | See `.nvmrc` | |
| 25 | +| Naming | camelCase vars/functions, PascalCase components/types | | |
8 | 26 |
|
9 | | -## Commands |
| 27 | +## Code Style |
10 | 28 |
|
11 | | -- `pnpm build` — compile TypeScript (`tsc`) |
12 | | -- `pnpm dev` — watch mode compilation |
13 | | -- `pnpm test` — run tests (`vitest run`) |
14 | | -- `pnpm lint` — run Biome linter (`biome check`) |
15 | | -- `pnpm lint:fix` — auto-fix lint issues (`biome check --write`) |
| 29 | +- **Semicolons:** no |
| 30 | +- **Quotes:** single |
| 31 | +- **Print width:** 100 |
| 32 | +- **Trailing commas:** none (Biome default) |
| 33 | +- **Indent:** spaces, width 2 |
| 34 | +- **Imports:** explicit `.js` extensions (ESM, `"type": "module"`) |
| 35 | + |
| 36 | +## Working Rules |
| 37 | + |
| 38 | +- Use **pnpm** only (never npm or yarn) |
| 39 | +- Treat `dist/` as build output — never edit directly |
| 40 | +- User input (`projectName`) must never be interpolated into shell command strings — use `execFile` (args array) instead |
| 41 | +- `source/constants/config.ts` is the single source of truth for feature metadata — all consumers read from it |
| 42 | +- Components are presentation-only — business logic lives in `source/operations/` |
16 | 43 |
|
17 | 44 | ## Architecture |
18 | 45 |
|
19 | | -Entry: `source/cli.tsx` → renders the Ink React app. |
| 46 | +Entry: `source/cli.tsx` — parses args with `meow`, routes between interactive and non-interactive paths. |
20 | 47 |
|
21 | | -`source/app.tsx` is the main component — a step-based state machine (`currentStep` integer) that renders each installer step in sequence. Steps advance via a `finishStep` callback. |
| 48 | +- **Interactive path**: `source/app.tsx` — step-based state machine that renders each installer step in sequence via React + Ink |
| 49 | +- **Non-interactive path**: `source/nonInteractive.ts` — validates flags, runs operations sequentially, outputs JSON |
22 | 50 |
|
23 | | -### Key directories |
| 51 | +Key directories: |
24 | 52 |
|
25 | | -- `source/components/steps/` — each installer step as a React component (ProjectName, CloneRepo, InstallationMode, OptionalPackages, Install, FileCleanup, PostInstall) |
| 53 | +- `source/operations/` — business logic as plain async functions, shared by both paths |
| 54 | +- `source/components/steps/` — TUI step components, presentation-only |
26 | 55 | - `source/components/` — reusable UI components (Ask, Divider, MainTitle, Multiselect) |
27 | | -- `source/constants/config.ts` — feature package mappings and repo URL |
28 | | -- `source/types/types.ts` — shared TypeScript types |
29 | | -- `source/utils/utils.ts` — helper functions (validation, step visibility) |
30 | | - |
31 | | -## Code Conventions |
32 | | - |
33 | | -- **ESM**: `"type": "module"` — imports use explicit `.js` extensions |
34 | | -- **Formatting**: Biome — single quotes, no semicolons, 2-space indent, 100-char line width |
35 | | -- **Components**: Functional components with TypeScript (`FC<Props>`) |
36 | | -- **State**: Local `useState` only, props/callbacks for parent-child communication |
37 | | -- **Skip pattern**: Steps accept a `skip` prop to conditionally bypass themselves |
38 | | -- **Node**: Requires v20+ (see `.nvmrc`) |
| 56 | +- `source/__tests__/` — vitest test suite |
| 57 | + |
| 58 | +## Testing |
| 59 | + |
| 60 | +- **Framework:** Vitest + V8 coverage |
| 61 | +- **Run tests:** `pnpm test` / `pnpm test:coverage` |
| 62 | +- **Structure:** `source/__tests__/` mirrors `source/` layout. Operations tests live in `source/__tests__/operations/` |
| 63 | +- **What to test:** Non-interactive agentic flow (validation, JSON output), operations (correct shell commands), config, utils |
| 64 | +- **What not to test:** React/Ink components, `exec.ts` internals (mocked in all consumers) |
| 65 | +- **Mocking pattern:** Operations tests mock `exec`/`execFile` from `source/operations/exec.js`. Non-interactive tests mock the entire operations layer |
| 66 | +- **Coverage:** Focus on the agentic interface. Test files and `source/components/` are excluded from coverage |
| 67 | + |
| 68 | +## Guardrails |
| 69 | + |
| 70 | +- Do not commit secrets, API keys, or credentials |
| 71 | +- Do not modify CI/CD pipelines without team review |
| 72 | +- Do not skip tests or linting to make a build pass |
| 73 | +- When in doubt, ask — don't assume |
| 74 | + |
| 75 | +## Change Strategy |
| 76 | + |
| 77 | +- Prefer small, focused diffs over broad refactors |
| 78 | +- Preserve existing UX unless the task explicitly changes it |
| 79 | +- Avoid introducing new patterns when a project pattern already exists |
| 80 | +- Update docs only when behavior or workflow changes |
| 81 | + |
| 82 | +## Validation Checklist |
| 83 | + |
| 84 | +- `pnpm build` |
| 85 | +- `pnpm lint` |
| 86 | +- `pnpm test` |
39 | 87 |
|
40 | 88 | ## Release |
41 | 89 |
|
|
0 commit comments