|
| 1 | +--- |
| 2 | +title: setup commands |
| 3 | +id: intent-setup |
| 4 | +--- |
| 5 | + |
| 6 | +Intent exposes setup as three separate commands. |
| 7 | + |
| 8 | +```bash |
| 9 | +npx @tanstack/intent@latest add-library-bin |
| 10 | +npx @tanstack/intent@latest edit-package-json |
| 11 | +npx @tanstack/intent@latest setup-github-actions |
| 12 | +``` |
| 13 | + |
| 14 | +## Commands |
| 15 | + |
| 16 | +- `add-library-bin`: create a package-local `intent` shim in `bin/` |
| 17 | +- `edit-package-json`: add or normalize `package.json` entries needed to publish skills |
| 18 | +- `setup-github-actions`: copy workflow templates to `.github/workflows` |
| 19 | + |
| 20 | +## What each command changes |
| 21 | + |
| 22 | +- `add-library-bin` |
| 23 | + - Creates `bin/intent.js` when `package.json.type` is `module`, otherwise `bin/intent.mjs` |
| 24 | + - If either shim already exists, command skips creation |
| 25 | + - Shim imports `@tanstack/intent/intent-library` |
| 26 | +- `edit-package-json` |
| 27 | + - Requires a valid `package.json` in current directory |
| 28 | + - Ensures `bin.intent` points to `./bin/intent.<ext>` |
| 29 | + - Ensures `files` includes required publish entries |
| 30 | + - Preserves existing indentation and existing `bin` entries |
| 31 | + - Converts string shorthand `bin` to object when needed |
| 32 | +- `setup-github-actions` |
| 33 | + - Copies templates from `@tanstack/intent/meta/templates/workflows` to `.github/workflows` |
| 34 | + - Applies variable substitution for `PACKAGE_NAME`, `REPO`, `DOCS_PATH`, `SRC_PATH` |
| 35 | + - Skips files that already exist at destination |
| 36 | + |
| 37 | +## Required `files` entries |
| 38 | + |
| 39 | +`edit-package-json` enforces different `files` sets based on package location: |
| 40 | + |
| 41 | +- Monorepo package: `skills`, `bin` |
| 42 | +- Non-monorepo package: `skills`, `bin`, `!skills/_artifacts` |
| 43 | + |
| 44 | +## Common errors |
| 45 | + |
| 46 | +- Missing or invalid `package.json` when running `edit-package-json` |
| 47 | +- Missing template source when running `setup-github-actions` |
| 48 | + |
| 49 | +## Notes |
| 50 | + |
| 51 | +- `add-library-bin` and `setup-github-actions` skip existing files |
| 52 | + |
| 53 | +## Related |
| 54 | + |
| 55 | +- [intent validate](./intent-validate) |
| 56 | +- [intent scaffold](./intent-scaffold) |
0 commit comments