Skip to content

Commit 675349b

Browse files
committed
chore: update AGENTS.md for non-interactive mode and operations layer
Reflect the current architecture: dual-mode entry point, operations layer, non-interactive path, info output, test suite, and updated config.ts role as single source of truth.
1 parent fb2b88a commit 675349b

2 files changed

Lines changed: 76 additions & 25 deletions

File tree

AGENTS.md

Lines changed: 73 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,89 @@
1-
# AGENTS.md
1+
# Agent Configuration
22

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+
---
46

57
## What This Is
68

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 | |
826

9-
## Commands
27+
## Code Style
1028

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/`
1643

1744
## Architecture
1845

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.
2047

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
2250

23-
### Key directories
51+
Key directories:
2452

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
2655
- `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`
3987

4088
## Release
4189

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CLAUDE.md
2+
3+
See [AGENTS.md](./AGENTS.md) for all project guidance.

0 commit comments

Comments
 (0)