|
2 | 2 |
|
3 | 3 | ## The Problem |
4 | 4 |
|
5 | | -[Vite+](https://viteplus.dev) has done a great job consolidating build, test, lint, and format into one tool. But in day-to-day enterprise development, there are still things you end up wiring yourself: |
| 5 | +[Vite+](https://viteplus.dev) has done a great job consolidating build-related work into one tool. But in enterprise development, there are still things you end up wiring yourself: |
6 | 6 |
|
7 | 7 | - **Release workflow** — version bumping, npm publishing, changelog generation |
8 | 8 | - **Git hooks** — commit message linting, lockfile change detection |
9 | 9 | - **API codegen** — generating type-safe API modules from OpenAPI/Swagger schemas |
10 | 10 | - **Utility functions** — common helpers for strings, arrays, objects, etc. |
11 | 11 |
|
12 | | -Each of these typically requires its own tool, its own config file, and its own learning curve. Over time, project root directories fill up with config fragments, and keeping everything compatible becomes a chore. |
| 12 | +## AI Agent Friendly |
| 13 | + |
| 14 | +An increasingly practical concern — AI coding assistants work better when the toolchain is cohesive: |
| 15 | + |
| 16 | +- **Single dependency** — one library to learn, not a dozen tools with different APIs. |
| 17 | +- **Unified Skills** — Rattail provides [Agent Skills](https://github.com/varletjs/rattail/tree/main/skills) so AI assistants can understand the whole toolchain at once. |
| 18 | +- **Built-in presets** — the toolchain's lint, format, and other presets let AI assistants directly understand the project's code conventions, so generated code naturally follows team standards. |
| 19 | +- **Consistent patterns** — same config-driven approach for every CLI command, same import convention for every utility. Predictable structure leads to more reliable generated code. |
| 20 | +- **Less fragmented context** — all relevant knowledge in one place, rather than spread across separate documentation sites. |
| 21 | + |
| 22 | +## Design Principles |
| 23 | + |
| 24 | +- **Complement Vite+** — Rattail covers what Vite+ intentionally leaves out of scope, not what it already does. |
| 25 | +- **Config-driven** — CLI commands read from `vite.config.ts`. No scattered config files. |
| 26 | +- **Incrementally adoptable** — `rattail/vite-plus` for presets, `rattail/cli` for the CLI, `rattail` for utilities. Use what you need, skip what you don't. |
| 27 | +- **Sensible defaults** — works out of the box, with escape hatches when you need them. |
13 | 28 |
|
14 | 29 | ## What Rattail Does |
15 | 30 |
|
16 | | -Rattail tries to consolidate these pieces into `vite.config.ts`, alongside Vite+: |
| 31 | +Rattail brings these loose ends together in three ways: |
| 32 | + |
| 33 | +- **Unified configuration** — lint, format, `staged`, and workflow-related options (release, hooks, API codegen, etc.) live in `vite.config.ts` next to Vite+, so you keep fewer one-off config files in the project root. |
| 34 | +- **CLI for chores** — the `rt` CLI reads the same config to run publishing, changelogs, git hooks, OpenAPI codegen, and other peripheral tasks. |
| 35 | +- **Utilities for daily work** — the main `rattail` package exposes a large, tree-shakable set of helpers for strings, collections, requests, and other everyday coding needs. |
17 | 36 |
|
18 | 37 | ```ts |
19 | | -import { defineConfig, lint, fmt, staged, hook, clean } from 'rattail/vite-plus' |
| 38 | +// vite.config.ts |
| 39 | +import { |
| 40 | + defineConfig, |
| 41 | + lint, |
| 42 | + fmt, |
| 43 | + staged, |
| 44 | + hook, |
| 45 | + clean, |
| 46 | +} from 'rattail/vite-plus' |
20 | 47 |
|
21 | 48 | export default defineConfig({ |
22 | 49 | lint: lint(), |
| 50 | + |
23 | 51 | fmt: fmt(), |
| 52 | + |
24 | 53 | staged: staged(), |
| 54 | + |
25 | 55 | rattail: { |
| 56 | + // rt clean |
26 | 57 | clean: clean(), |
| 58 | + |
| 59 | + // rt hook |
27 | 60 | hook: hook(), |
| 61 | + |
| 62 | + // rt api |
| 63 | + api: { |
| 64 | + input: './openapi.json', |
| 65 | + output: './src/apis', |
| 66 | + }, |
| 67 | + |
| 68 | + // rt release |
28 | 69 | release: {}, |
| 70 | + |
| 71 | + // rt changelog |
29 | 72 | changelog: {}, |
30 | 73 | }, |
31 | 74 | }) |
32 | 75 | ``` |
33 | | - |
34 | | -One file for Vite+ config and the surrounding workflow. Fewer config files in your project root. |
35 | | - |
36 | | -## AI Agent Friendly |
37 | | - |
38 | | -An increasingly practical concern — AI coding assistants work better when the toolchain is cohesive: |
39 | | - |
40 | | -- **Single dependency** — one library to learn, not a dozen tools with different APIs. |
41 | | -- **Unified Skills** — Rattail provides [Agent Skills](https://github.com/varletjs/rattail/tree/main/skills) so AI assistants can understand the whole toolchain at once. |
42 | | -- **Consistent patterns** — same config-driven approach for every CLI command, same import convention for every utility. Predictable structure leads to more reliable generated code. |
43 | | -- **Less fragmented context** — all relevant knowledge in one place, rather than spread across separate documentation sites. |
44 | | - |
45 | | -## Design Principles |
46 | | - |
47 | | -- **Complement Vite+** — Rattail covers what Vite+ intentionally leaves out of scope, not what it already does. |
48 | | -- **Config-driven** — CLI commands read from `vite.config.ts`. No scattered config files. |
49 | | -- **Incrementally adoptable** — `rattail/vite-plus` for presets, `rattail/cli` for the CLI, `rattail` for utilities. Use what you need, skip what you don't. |
50 | | -- **Sensible defaults** — works out of the box, with escape hatches when you need them. |
|
0 commit comments