@antomanc/aginit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +245 -0
- package/THIRD_PARTY_NOTICES.md +36 -0
- package/bin/aginit.js +8 -0
- package/dist/adapters/agents-md.d.ts +8 -0
- package/dist/adapters/agents-md.d.ts.map +1 -0
- package/dist/adapters/agents-md.js +121 -0
- package/dist/adapters/agents-md.js.map +1 -0
- package/dist/adapters/browser.d.ts +5 -0
- package/dist/adapters/browser.d.ts.map +1 -0
- package/dist/adapters/browser.js +42 -0
- package/dist/adapters/browser.js.map +1 -0
- package/dist/adapters/git.d.ts +5 -0
- package/dist/adapters/git.d.ts.map +1 -0
- package/dist/adapters/git.js +90 -0
- package/dist/adapters/git.js.map +1 -0
- package/dist/adapters/graft.d.ts +14 -0
- package/dist/adapters/graft.d.ts.map +1 -0
- package/dist/adapters/graft.js +56 -0
- package/dist/adapters/graft.js.map +1 -0
- package/dist/adapters/package-manager.d.ts +20 -0
- package/dist/adapters/package-manager.d.ts.map +1 -0
- package/dist/adapters/package-manager.js +89 -0
- package/dist/adapters/package-manager.js.map +1 -0
- package/dist/adapters/skills.d.ts +29 -0
- package/dist/adapters/skills.d.ts.map +1 -0
- package/dist/adapters/skills.js +80 -0
- package/dist/adapters/skills.js.map +1 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +212 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +32 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +162 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/new.d.ts +15 -0
- package/dist/cli/new.d.ts.map +1 -0
- package/dist/cli/new.js +161 -0
- package/dist/cli/new.js.map +1 -0
- package/dist/cli/wizard.d.ts +31 -0
- package/dist/cli/wizard.d.ts.map +1 -0
- package/dist/cli/wizard.js +260 -0
- package/dist/cli/wizard.js.map +1 -0
- package/dist/config/defaults.d.ts +8 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +122 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/schema.d.ts +40 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +4 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validation.d.ts +11 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +99 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/presets/adr.d.ts +5 -0
- package/dist/presets/adr.d.ts.map +1 -0
- package/dist/presets/adr.js +33 -0
- package/dist/presets/adr.js.map +1 -0
- package/dist/presets/cli.d.ts +3 -0
- package/dist/presets/cli.d.ts.map +1 -0
- package/dist/presets/cli.js +126 -0
- package/dist/presets/cli.js.map +1 -0
- package/dist/presets/generic.d.ts +3 -0
- package/dist/presets/generic.d.ts.map +1 -0
- package/dist/presets/generic.js +29 -0
- package/dist/presets/generic.js.map +1 -0
- package/dist/presets/registry.d.ts +6 -0
- package/dist/presets/registry.d.ts.map +1 -0
- package/dist/presets/registry.js +20 -0
- package/dist/presets/registry.js.map +1 -0
- package/dist/presets/testing.d.ts +6 -0
- package/dist/presets/testing.d.ts.map +1 -0
- package/dist/presets/testing.js +46 -0
- package/dist/presets/testing.js.map +1 -0
- package/dist/presets/types.d.ts +14 -0
- package/dist/presets/types.d.ts.map +1 -0
- package/dist/presets/types.js +2 -0
- package/dist/presets/types.js.map +1 -0
- package/dist/presets/web.d.ts +3 -0
- package/dist/presets/web.d.ts.map +1 -0
- package/dist/presets/web.js +84 -0
- package/dist/presets/web.js.map +1 -0
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +60 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +20 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/shell.d.ts +17 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +87 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +71 -0
- package/src/adapters/agents-md.ts +143 -0
- package/src/adapters/browser.ts +49 -0
- package/src/adapters/git.ts +100 -0
- package/src/adapters/graft.ts +80 -0
- package/src/adapters/package-manager.ts +116 -0
- package/src/adapters/skills.ts +117 -0
- package/src/cli/doctor.ts +244 -0
- package/src/cli/init.ts +34 -0
- package/src/cli/main.ts +191 -0
- package/src/cli/new.ts +200 -0
- package/src/cli/wizard.ts +300 -0
- package/src/config/defaults.ts +137 -0
- package/src/config/schema.ts +44 -0
- package/src/config/validation.ts +96 -0
- package/src/index.ts +15 -0
- package/src/presets/adr.ts +37 -0
- package/src/presets/cli.ts +136 -0
- package/src/presets/generic.ts +32 -0
- package/src/presets/registry.ts +24 -0
- package/src/presets/testing.ts +56 -0
- package/src/presets/types.ts +15 -0
- package/src/presets/web.ts +99 -0
- package/src/utils/fs.ts +79 -0
- package/src/utils/logger.ts +20 -0
- package/src/utils/shell.ts +116 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antonio Mancuso
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Aginit
|
|
2
|
+
|
|
3
|
+
> **Public Beta (v0.1.0)** — Minimal, modular AI-first project bootstrapper for T3 Code, Antigravity, and Codex.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/antomanc/aginit/actions)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@antomanc/aginit)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Philosophy
|
|
12
|
+
|
|
13
|
+
> **“We orchestrate the tools. We don’t replace them.”**
|
|
14
|
+
|
|
15
|
+
Aginit initializes software projects ready for AI-assisted development in seconds. Instead of reinventing custom agent frameworks or vendoring brittle skills, Aginit ties together best-in-class upstream capabilities into a coherent, idempotent developer workflow.
|
|
16
|
+
|
|
17
|
+
- **Zero vendoring**: Skills and codebase graphs are fetched and configured directly from upstream maintainers via standard package ecosystems (`skills.sh`, `graft`).
|
|
18
|
+
- **Dual-agent parity**: Antigravity and Codex share the exact same `.agents/skills` and `AGENTS.md` conventions without conflicting configurations.
|
|
19
|
+
- **Conservative & idempotent**: Never overwrites existing code destructively; respects your choice of framework, toolchain, and package manager.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What Aginit Configures
|
|
24
|
+
|
|
25
|
+
Every project bootstrapped with Aginit receives:
|
|
26
|
+
|
|
27
|
+
1. **Upstream Skills Engine (`skills.sh`)**:
|
|
28
|
+
- Universal engineering trio: `tdd`, `code-review`, `diagnosing-bugs` (by Matt Pocock).
|
|
29
|
+
- *Optional* spec workflow: `to-spec`, `to-tickets`, `implement-spec` (`--spec-workflow`).
|
|
30
|
+
- Frontend craft & UI polish: `impeccable` (by Peter Bak-Hansen) for web presets.
|
|
31
|
+
- Interactive visual inspection: `agent-browser` (by Vercel Labs) for web presets.
|
|
32
|
+
2. **Codebase Understanding (`graft`)**:
|
|
33
|
+
- Deterministic structural code graph and fast token-efficient semantic map (`graft map`, `graft ask`).
|
|
34
|
+
3. **Agent Invariants (`AGENTS.md`)**:
|
|
35
|
+
- A short, non-invasive intake contract and invariant guide that agents parse immediately upon opening the repository in T3 Code.
|
|
36
|
+
4. **Deterministic Testing Harness**:
|
|
37
|
+
- Vitest for instant unit testing.
|
|
38
|
+
- Playwright for browser testing when a web framework is selected. Its starter test is explicitly skipped until you supply an application URL and real assertions.
|
|
39
|
+
5. **Declarative State (`aginit.config.json`)**:
|
|
40
|
+
- Versioned project manifest (`schemaVersion: "1.0.0"`) tracking active agents, skills, preset, and package manager.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quickstart
|
|
45
|
+
|
|
46
|
+
### Prerequisites
|
|
47
|
+
|
|
48
|
+
- Node.js **22.12 or newer** (use a supported Node LTS release).
|
|
49
|
+
- Git and npm/npx in `PATH`; install your selected package manager before using it.
|
|
50
|
+
- Internet access for official framework scaffolders and upstream skills.
|
|
51
|
+
- Optional Graft CLI: `npm install -g @nanonets/graft`. Use `--no-graft` to omit it.
|
|
52
|
+
|
|
53
|
+
### Interactive Wizard (Recommended)
|
|
54
|
+
|
|
55
|
+
Simply run `aginit` or `npx @antomanc/aginit` with no arguments in your terminal to launch the interactive prompt:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Run directly without installation
|
|
59
|
+
npx @antomanc/aginit
|
|
60
|
+
|
|
61
|
+
# Or with pnpm dlx
|
|
62
|
+
pnpm dlx @antomanc/aginit
|
|
63
|
+
|
|
64
|
+
# Or install globally
|
|
65
|
+
npm install -g @antomanc/aginit
|
|
66
|
+
aginit
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The wizard prompts only for meaningful choices:
|
|
70
|
+
1. Action: *Create brand new project* vs *Initialize in current directory*
|
|
71
|
+
2. Project name (when creating a new project)
|
|
72
|
+
3. Preset (`web` | `cli` | `generic`)
|
|
73
|
+
4. Framework (for `web`: `none` | `vite` | `next` | `existing`)
|
|
74
|
+
5. Workflow (`minimal` | `spec`)
|
|
75
|
+
6. Package Manager (`pnpm (Recommended)` | `npm` | `yarn` | `bun`) — *auto-detected and preserved when initializing existing projects*
|
|
76
|
+
|
|
77
|
+
### Non-Interactive / Scriptable CLI
|
|
78
|
+
|
|
79
|
+
All commands accept explicit flags for automated environments and CI:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Create a new web project directly with pnpm
|
|
83
|
+
aginit new my-web-app --preset web --framework vite --package-manager pnpm
|
|
84
|
+
|
|
85
|
+
# Or with npm, yarn, or bun
|
|
86
|
+
aginit new my-app --preset web --package-manager bun
|
|
87
|
+
|
|
88
|
+
# Or via npx
|
|
89
|
+
npx @antomanc/aginit new my-web-app --preset web
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then open the project in **T3 Code**, and tell Antigravity:
|
|
93
|
+
> *"bootstrap this project"*
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Package Managers
|
|
98
|
+
|
|
99
|
+
Aginit provides centralized package manager orchestration:
|
|
100
|
+
- **Supported Managers**: `pnpm` (recommended/default), `npm`, `yarn` (Classic or modern), `bun`.
|
|
101
|
+
- **New Projects**: Prompted as the final wizard step, or configured via `--package-manager <pm>`. Stored in `aginit.config.json`.
|
|
102
|
+
- **Existing Projects**: Automatically detects existing lockfiles (`pnpm-lock.yaml`, `bun.lockb`, `yarn.lock`, `package-lock.json`) and preserves your manager without prompting.
|
|
103
|
+
- **Official Scaffolding**: Passes the selected package manager to upstream toolchains (e.g. `--use-pnpm`, `--use-npm`, `--use-yarn`, `--use-bun` for Next.js, and package manager specific create commands for Vite).
|
|
104
|
+
- **Clean Toolchains**: `pnpm-workspace.yaml` and pnpm-specific lifecycle configs are only generated when `pnpm` is the active manager.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Presets & Frameworks
|
|
109
|
+
|
|
110
|
+
### 1. `web` Preset
|
|
111
|
+
|
|
112
|
+
Framework-agnostic by default:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Agnostic baseline: clean TypeScript + Vitest, zero bundler lock-in
|
|
116
|
+
aginit new my-app --preset web --framework none
|
|
117
|
+
|
|
118
|
+
# Official Vite scaffolding
|
|
119
|
+
aginit new my-vite-app --preset web --framework vite
|
|
120
|
+
|
|
121
|
+
# Official Next.js scaffolding
|
|
122
|
+
aginit new my-next-app --preset web --framework next
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
*Note: With `--framework none`, Aginit does not generate dummy or failing E2E configs until an actual web target is introduced.*
|
|
126
|
+
|
|
127
|
+
### 2. `cli` Preset
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
aginit new my-cli --preset cli
|
|
131
|
+
```
|
|
132
|
+
Configures an executable Node.js/TypeScript CLI with Commander, Picocolors, and Vitest.
|
|
133
|
+
|
|
134
|
+
### 3. `generic` Preset
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
aginit new my-repo --preset generic
|
|
138
|
+
```
|
|
139
|
+
Minimal AI readiness for any codebase: Git, `.agents/skills`, Graft context graph, and `AGENTS.md`.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Adding Aginit to an Existing Project
|
|
144
|
+
|
|
145
|
+
Run `aginit init` inside an existing repository:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
cd my-existing-project
|
|
149
|
+
aginit init --preset web
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Aginit preserves application source, custom scripts, dependency versions, and existing test configurations. The web and CLI presets add missing test tooling to `package.json`; custom test runners get a separate `test:unit` script. The generic preset leaves an existing project manifest untouched.
|
|
153
|
+
|
|
154
|
+
Repeat `aginit init` preserves the saved preset, framework, agents, workflow, skill sources, and extension fields. Explicit options override the requested setting. Invalid JSON or configuration is reported before initialization changes files. `--no-skills` skips installation without erasing an existing configuration's sources.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Diagnostics (`aginit doctor`)
|
|
159
|
+
|
|
160
|
+
Run the health check at any time to inspect system tooling and repository agent readiness (it may download the upstream Skills CLI through npx):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
aginit doctor
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Checks:
|
|
167
|
+
- Node.js runtime and active project package manager (`pnpm`, `npm`, `yarn`, or `bun`)
|
|
168
|
+
- Git repository state
|
|
169
|
+
- Global Graft CLI availability
|
|
170
|
+
- Codex CLI availability (secondary reviewer)
|
|
171
|
+
- Skills CLI engine functionality
|
|
172
|
+
- `aginit.config.json` schema validation and package manager setting
|
|
173
|
+
- `AGENTS.md` context and intake section
|
|
174
|
+
- Installed `.agents/skills/` health
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Updating Upstream Capabilities (`aginit update`)
|
|
179
|
+
|
|
180
|
+
Keep your project's skills and codebase graph up to date:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
aginit update
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This runs the upstream project-scoped `skills update` and refreshes the Graft graph index. Disabled integrations are skipped; failed updates return a nonzero exit status.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Safety & Dry Run
|
|
191
|
+
|
|
192
|
+
Preview changes without touching the disk:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
aginit new test-project --preset web --dry-run
|
|
196
|
+
aginit init --dry-run
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Existing application files are preserved. Manifest additions and explicit configuration changes are intentional; rerunning the same initialization is idempotent. Framework scaffold failures stop the command instead of generating a substitute app.
|
|
200
|
+
|
|
201
|
+
Missing Graft or failed skill installation produces an actionable warning and a nonzero exit status. The scaffold is retained so you can resolve the prerequisite and rerun `aginit init`.
|
|
202
|
+
|
|
203
|
+
`--dry-run` prints planned operations without creating files or downloading framework tools. Upstream-generated files cannot be enumerated until the real scaffolder runs.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Development & Release Verification
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pnpm install --frozen-lockfile
|
|
211
|
+
pnpm check # typecheck, tests, build, dependency audit
|
|
212
|
+
pnpm smoke # install the tarball and verify generated consumer projects
|
|
213
|
+
pnpm smoke --frameworks # additionally scaffold, test, build, and serve Vite and Next.js
|
|
214
|
+
pnpm smoke --package-managers # verify native pnpm, Yarn, and Bun consumer commands
|
|
215
|
+
npm pack --dry-run
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The framework smoke test downloads upstream tools and dependencies. The generated generic project has a working Vitest starter harness; application-specific assertions remain yours to write. `npm publish` runs the checks and base consumer smoke test before publication.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Upstream Licenses Notice
|
|
223
|
+
|
|
224
|
+
Aginit integrates and configures independent open-source software and skills:
|
|
225
|
+
- **Graft**: Copyright © NanoNets / Graft contributors
|
|
226
|
+
- **skills.sh**: Copyright © Vercel Inc. and contributors
|
|
227
|
+
- **Matt Pocock Skills**: Copyright © Matt Pocock
|
|
228
|
+
- **Impeccable**: Copyright © Peter Bak-Hansen
|
|
229
|
+
- **agent-browser**: Copyright © Vercel Labs
|
|
230
|
+
- **Playwright**: Copyright © Microsoft Corporation
|
|
231
|
+
|
|
232
|
+
Each upstream tool is governed by its own independent license. Aginit does not vendor, alter, or relicense upstream software. For details, see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Contributing & Security
|
|
237
|
+
|
|
238
|
+
- **Contributing**: Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on development and submitting pull requests.
|
|
239
|
+
- **Security**: See [SECURITY.md](SECURITY.md) for our vulnerability reporting policy.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
[MIT](LICENSE) © 2026 Antonio Mancuso
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Third-Party Notices & Upstream Capabilities
|
|
2
|
+
|
|
3
|
+
Aginit is an orchestrator and bootstrapper that configures and integrates independent open-source tools and skills. Aginit does not vendor, fork, claim ownership of, or relicense upstream software.
|
|
4
|
+
|
|
5
|
+
Each integrated upstream tool is governed by its respective authors and licenses:
|
|
6
|
+
|
|
7
|
+
- **Graft**
|
|
8
|
+
- Project: Codebase understanding & context graph CLI
|
|
9
|
+
- Author: NanoNets / Graft contributors
|
|
10
|
+
- Repository: https://github.com/NanoNets/context-graph-engine
|
|
11
|
+
|
|
12
|
+
- **Skills CLI / skills.sh**
|
|
13
|
+
- Project: Decentralized agent skill package installer
|
|
14
|
+
- Author: Vercel Inc. and contributors
|
|
15
|
+
- Website: https://skills.sh
|
|
16
|
+
|
|
17
|
+
- **Matt Pocock Skills**
|
|
18
|
+
- Project: Workflow skills (`tdd`, `code-review`, `diagnosing-bugs`, `to-spec`, `to-tickets`, `implement-spec`)
|
|
19
|
+
- Author: Matt Pocock
|
|
20
|
+
- Repository: https://github.com/mattpocock/skills
|
|
21
|
+
|
|
22
|
+
- **Impeccable**
|
|
23
|
+
- Project: Frontend craft & design system review skill
|
|
24
|
+
- Author: Peter Bak-Hansen
|
|
25
|
+
- Repository: https://github.com/pbakaus/impeccable
|
|
26
|
+
|
|
27
|
+
- **agent-browser**
|
|
28
|
+
- Project: Fast headless/CDP browser automation CLI for AI agents
|
|
29
|
+
- Author: Vercel Labs
|
|
30
|
+
- Repository: https://github.com/vercel-labs/agent-browser
|
|
31
|
+
|
|
32
|
+
- **Playwright**
|
|
33
|
+
- Project: End-to-end testing framework
|
|
34
|
+
- Author: Microsoft Corporation
|
|
35
|
+
- License: Apache-2.0
|
|
36
|
+
- Website: https://playwright.dev
|
package/bin/aginit.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AginitConfig } from '../config/schema.js';
|
|
2
|
+
export declare function generateAgentsMarkdown(config: AginitConfig, scripts?: Record<string, string>): string;
|
|
3
|
+
export declare function setupAgentsMarkdown(targetDir: string, config: AginitConfig, options?: {
|
|
4
|
+
overwrite?: boolean;
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
silent?: boolean;
|
|
7
|
+
}): boolean;
|
|
8
|
+
//# sourceMappingURL=agents-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.d.ts","sourceRoot":"","sources":["../../src/adapters/agents-md.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKnD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,MAAM,CA+FR;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACxE,OAAO,CA+BT"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileExists, readTextFile, safeWriteFile } from '../utils/fs.js';
|
|
3
|
+
import { readPackageManifest } from '../config/validation.js';
|
|
4
|
+
import { logger } from '../utils/logger.js';
|
|
5
|
+
import { getPackageManagerAdapter } from './package-manager.js';
|
|
6
|
+
export function generateAgentsMarkdown(config, scripts) {
|
|
7
|
+
const commands = scripts ??
|
|
8
|
+
(config.preset === 'generic'
|
|
9
|
+
? { test: 'vitest run' }
|
|
10
|
+
: { build: '', typecheck: '', test: '', dev: '', 'test:e2e': '' });
|
|
11
|
+
const hasCommand = (name) => Object.hasOwn(commands, name);
|
|
12
|
+
const isWeb = config.preset === 'web';
|
|
13
|
+
const hasBrowser = isWeb && config.browser.playwright;
|
|
14
|
+
const hasVisualAgent = isWeb && config.browser.visualAgent;
|
|
15
|
+
const pm = config.packageManager || 'pnpm';
|
|
16
|
+
const pmAdapter = getPackageManagerAdapter(pm);
|
|
17
|
+
let devCommand = '';
|
|
18
|
+
if (hasCommand('dev') && isWeb && config.framework && config.framework !== 'none') {
|
|
19
|
+
devCommand = `- Dev Server: \`${pmAdapter.runCmd('dev')}\``;
|
|
20
|
+
}
|
|
21
|
+
let testE2E = '';
|
|
22
|
+
if (hasBrowser && hasCommand('test:e2e')) {
|
|
23
|
+
testE2E = `- Test (E2E / Browser): \`${pmAdapter.runCmd('test:e2e')}\``;
|
|
24
|
+
}
|
|
25
|
+
const selectedSkills = config.skills.sources.flatMap((source) => source.skills);
|
|
26
|
+
const engineering = selectedSkills.filter((skill) => ['tdd', 'code-review', 'diagnosing-bugs'].includes(skill));
|
|
27
|
+
let uiCapability = '';
|
|
28
|
+
if (isWeb && selectedSkills.includes('impeccable')) {
|
|
29
|
+
uiCapability =
|
|
30
|
+
'- **UI & Design**: Use `impeccable` skill for frontend polish, design critique, and token craft.';
|
|
31
|
+
}
|
|
32
|
+
let browserCapability = '';
|
|
33
|
+
if (hasVisualAgent && selectedSkills.includes('agent-browser')) {
|
|
34
|
+
browserCapability =
|
|
35
|
+
'- **Browser Verification**: Use `agent-browser` skill for interactive inspection and visual QA.';
|
|
36
|
+
}
|
|
37
|
+
let graftCapability = '';
|
|
38
|
+
if (config.codebase.graft) {
|
|
39
|
+
graftCapability =
|
|
40
|
+
'- **Codebase Graph**: Use `graft ask "<query>" --source` or `graft map` for orientation before raw grep.';
|
|
41
|
+
}
|
|
42
|
+
let specWorkflow = '';
|
|
43
|
+
if (config.skills.workflow === 'spec' && selectedSkills.includes('to-spec')) {
|
|
44
|
+
specWorkflow = '- **Spec & Tickets Workflow**: `to-spec`, `to-tickets`, `implement-spec`';
|
|
45
|
+
}
|
|
46
|
+
const sections = [
|
|
47
|
+
`# ${config.name}`,
|
|
48
|
+
'',
|
|
49
|
+
`AI-first ${config.preset} project configured with \`aginit\`.`,
|
|
50
|
+
'',
|
|
51
|
+
'## Core Invariants',
|
|
52
|
+
'- Keep changes small, focused, and test-verified.',
|
|
53
|
+
'- Prefer native language & platform capabilities over heavy external frameworks.',
|
|
54
|
+
'- Never commit broken builds, failed typechecks, or unverified changes.',
|
|
55
|
+
'',
|
|
56
|
+
'## Essential Commands',
|
|
57
|
+
`- Package Manager: \`${pm}\``,
|
|
58
|
+
devCommand,
|
|
59
|
+
hasCommand('build') ? `- Build: \`${pmAdapter.runCmd('build')}\`` : '',
|
|
60
|
+
hasCommand('typecheck') ? `- Typecheck: \`${pmAdapter.runCmd('typecheck')}\`` : '',
|
|
61
|
+
hasCommand('test') ? `- Test: \`${pmAdapter.runCmd('test')}\`` : '',
|
|
62
|
+
hasCommand('test:unit') ? `- Unit Test: \`${pmAdapter.runCmd('test:unit')}\`` : '',
|
|
63
|
+
testE2E,
|
|
64
|
+
'',
|
|
65
|
+
'## AI Capabilities & Skills',
|
|
66
|
+
selectedSkills.length
|
|
67
|
+
? 'Configured skills install into `.agents/skills/` (shared by Antigravity and Codex):'
|
|
68
|
+
: 'Skills installation is disabled in this configuration.',
|
|
69
|
+
engineering.length
|
|
70
|
+
? `- **Engineering**: ${engineering.map((skill) => '\`' + skill + '\`').join(', ')}`
|
|
71
|
+
: '',
|
|
72
|
+
specWorkflow,
|
|
73
|
+
uiCapability,
|
|
74
|
+
browserCapability,
|
|
75
|
+
graftCapability,
|
|
76
|
+
'',
|
|
77
|
+
'## Bootstrap & First Session',
|
|
78
|
+
'When the user asks to "bootstrap this project" or kicks off a new initiative:',
|
|
79
|
+
'1. Understand product intent and ask 2-3 essential questions to resolve ambiguity.',
|
|
80
|
+
'2. Draft or refine canonical context in `PRODUCT.md` and `DESIGN.md` (or `docs/adr/`).',
|
|
81
|
+
'3. Plan in small verifiable increments and implement test-first using installed skills.',
|
|
82
|
+
''
|
|
83
|
+
];
|
|
84
|
+
return (sections
|
|
85
|
+
.filter((s) => s !== '')
|
|
86
|
+
.join('\n')
|
|
87
|
+
.trim() + '\n');
|
|
88
|
+
}
|
|
89
|
+
export function setupAgentsMarkdown(targetDir, config, options = {}) {
|
|
90
|
+
const { overwrite = false, dryRun = false, silent = false } = options;
|
|
91
|
+
const filePath = path.join(targetDir, 'AGENTS.md');
|
|
92
|
+
if (fileExists(filePath) && !overwrite) {
|
|
93
|
+
// File exists; check if it has the bootstrap guidance. If not, append it conservatively.
|
|
94
|
+
const existing = readTextFile(filePath) || '';
|
|
95
|
+
if (!existing.includes('## Bootstrap & First Session')) {
|
|
96
|
+
const addition = [
|
|
97
|
+
'',
|
|
98
|
+
'## Bootstrap & First Session',
|
|
99
|
+
'When the user asks to "bootstrap this project" or kicks off a new initiative:',
|
|
100
|
+
'1. Understand product intent and ask 2-3 essential questions to resolve ambiguity.',
|
|
101
|
+
'2. Draft or refine canonical context in `PRODUCT.md` and `DESIGN.md` (or `docs/adr/`).',
|
|
102
|
+
'3. Plan in small verifiable increments and implement test-first using installed skills.',
|
|
103
|
+
''
|
|
104
|
+
].join('\n');
|
|
105
|
+
safeWriteFile(filePath, existing.trimEnd() + '\n' + addition, {
|
|
106
|
+
overwrite: true,
|
|
107
|
+
dryRun,
|
|
108
|
+
silent
|
|
109
|
+
});
|
|
110
|
+
if (!silent)
|
|
111
|
+
logger.dim('Appended Bootstrap section to existing AGENTS.md');
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
if (!silent)
|
|
115
|
+
logger.dim('AGENTS.md already exists, preserving content.');
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
const content = generateAgentsMarkdown(config, readPackageManifest(targetDir)?.scripts);
|
|
119
|
+
return safeWriteFile(filePath, content, { overwrite: true, dryRun, silent });
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=agents-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src/adapters/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,UAAU,sBAAsB,CACpC,MAAoB,EACpB,OAAgC;IAEhC,MAAM,QAAQ,GACZ,OAAO;QACP,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS;YAC1B,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE;YACxB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAA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BACf,EAAE;gBACF,8BAA8B;gBAC9B,+EAA+E;gBAC/E,oFAAoF;gBACpF,wFAAwF;gBACxF,yFAAyF;gBACzF,EAAE;aACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACb,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,QAAQ,EAAE;gBAC5D,SAAS,EAAE,IAAI;gBACf,MAAM;gBACN,MAAM;aACP,CAAC,CAAC;YACH,IAAI,CAAC,MAAM;gBAAE,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IACxF,OAAO,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AAiCA,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,IAAI,CAYN"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { safeWriteFile } from '../utils/fs.js';
|
|
3
|
+
const PLAYWRIGHT_CONFIG = `import { defineConfig, devices } from '@playwright/test';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
testDir: './e2e',
|
|
7
|
+
fullyParallel: true,
|
|
8
|
+
forbidOnly: !!process.env.CI,
|
|
9
|
+
retries: process.env.CI ? 2 : 0,
|
|
10
|
+
workers: process.env.CI ? 1 : undefined,
|
|
11
|
+
reporter: 'html',
|
|
12
|
+
use: {
|
|
13
|
+
trace: 'on-first-retry',
|
|
14
|
+
screenshot: 'only-on-failure'
|
|
15
|
+
},
|
|
16
|
+
projects: [
|
|
17
|
+
{
|
|
18
|
+
name: 'chromium',
|
|
19
|
+
use: { ...devices['Desktop Chrome'] }
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
`;
|
|
24
|
+
const SMOKE_TEST = `import { test, expect } from '@playwright/test';
|
|
25
|
+
|
|
26
|
+
test.skip('TODO: verify the application in a browser', async ({ page }) => {
|
|
27
|
+
// Replace with local dev server or preview URL during development
|
|
28
|
+
// Example: await page.goto('/'); await expect(page).toHaveTitle(/Your app/);
|
|
29
|
+
});
|
|
30
|
+
`;
|
|
31
|
+
export function setupBrowserTesting(targetDir, options = {}) {
|
|
32
|
+
const { dryRun = false, silent = false } = options;
|
|
33
|
+
safeWriteFile(path.join(targetDir, 'playwright.config.ts'), PLAYWRIGHT_CONFIG, {
|
|
34
|
+
dryRun,
|
|
35
|
+
silent
|
|
36
|
+
});
|
|
37
|
+
safeWriteFile(path.join(targetDir, 'e2e', 'smoke.spec.ts'), SMOKE_TEST, {
|
|
38
|
+
dryRun,
|
|
39
|
+
silent
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBzB,CAAC;AAEF,MAAM,UAAU,GAAG;;;;;;CAMlB,CAAC;AAEF,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,UAAkD,EAAE;IAEpD,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAEnD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,EAAE,iBAAiB,EAAE;QAC7E,MAAM;QACN,MAAM;KACP,CAAC,CAAC;IAEH,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,eAAe,CAAC,EAAE,UAAU,EAAE;QACtE,MAAM;QACN,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/adapters/git.ts"],"names":[],"mappings":"AAqCA,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,OAAO,CAAC,CA2DlB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileExists, readTextFile, safeWriteFile } from '../utils/fs.js';
|
|
3
|
+
import { runExecutable } from '../utils/shell.js';
|
|
4
|
+
import { logger } from '../utils/logger.js';
|
|
5
|
+
const DEFAULT_GITIGNORE = `# Dependencies
|
|
6
|
+
node_modules/
|
|
7
|
+
.pnpm-store/
|
|
8
|
+
|
|
9
|
+
# Build artifacts
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
.next/
|
|
13
|
+
out/
|
|
14
|
+
|
|
15
|
+
# Environment
|
|
16
|
+
.env
|
|
17
|
+
.env.*
|
|
18
|
+
!.env.example
|
|
19
|
+
!.env.*.example
|
|
20
|
+
*.local
|
|
21
|
+
|
|
22
|
+
# Logs & temp
|
|
23
|
+
*.log
|
|
24
|
+
.DS_Store
|
|
25
|
+
*.tsbuildinfo
|
|
26
|
+
|
|
27
|
+
# Testing & Coverage
|
|
28
|
+
coverage/
|
|
29
|
+
test-results/
|
|
30
|
+
playwright-report/
|
|
31
|
+
blob-report/
|
|
32
|
+
|
|
33
|
+
# Codebase intelligence cache (graft builds locally, git-ignored)
|
|
34
|
+
/graft/
|
|
35
|
+
`;
|
|
36
|
+
export async function setupGit(targetDir, options = {}) {
|
|
37
|
+
const { dryRun = false, silent = false } = options;
|
|
38
|
+
const gitDir = path.join(targetDir, '.git');
|
|
39
|
+
const gitignorePath = path.join(targetDir, '.gitignore');
|
|
40
|
+
let gitOk = true;
|
|
41
|
+
// Check if directory is already a git repo or inside an existing git work tree (e.g. monorepo package)
|
|
42
|
+
let isRepo = fileExists(gitDir);
|
|
43
|
+
if (!isRepo && !dryRun) {
|
|
44
|
+
const check = await runExecutable('git', ['rev-parse', '--is-inside-work-tree'], {
|
|
45
|
+
cwd: targetDir,
|
|
46
|
+
silent: true
|
|
47
|
+
});
|
|
48
|
+
if (check.ok && check.stdout === 'true') {
|
|
49
|
+
isRepo = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!isRepo) {
|
|
53
|
+
if (!silent)
|
|
54
|
+
logger.dim('Initializing git repository...');
|
|
55
|
+
const res = await runExecutable('git', ['init'], { cwd: targetDir, dryRun, silent: true });
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
logger.warn(`Failed to initialize git repository: ${res.stderr}`);
|
|
58
|
+
gitOk = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Ensure .gitignore exists or append essential rules regardless of git init status
|
|
62
|
+
if (!fileExists(gitignorePath)) {
|
|
63
|
+
safeWriteFile(gitignorePath, DEFAULT_GITIGNORE, { dryRun, silent });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const existing = readTextFile(gitignorePath) || '';
|
|
67
|
+
const toAppend = [];
|
|
68
|
+
const essentialRules = [
|
|
69
|
+
'node_modules/',
|
|
70
|
+
'/graft/',
|
|
71
|
+
'.DS_Store',
|
|
72
|
+
'dist/',
|
|
73
|
+
'.env',
|
|
74
|
+
'.env.*',
|
|
75
|
+
'!.env.example',
|
|
76
|
+
'!.env.*.example'
|
|
77
|
+
];
|
|
78
|
+
for (const rule of essentialRules) {
|
|
79
|
+
if (!existing.split(/\r?\n/).includes(rule)) {
|
|
80
|
+
toAppend.push(rule);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (toAppend.length > 0) {
|
|
84
|
+
const updated = existing.trimEnd() + '\n\n# AI & Project rules\n' + toAppend.join('\n') + '\n';
|
|
85
|
+
safeWriteFile(gitignorePath, updated, { overwrite: true, dryRun, silent });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return gitOk;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/adapters/git.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BzB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,SAAiB,EACjB,UAAkD,EAAE;IAEpD,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,a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E,CAAC;QAE9B,MAAM,cAAc,GAAG;YACrB,eAAe;YACf,SAAS;YACT,WAAW;YACX,OAAO;YACP,MAAM;YACN,QAAQ;YACR,eAAe;YACf,iBAAiB;SAClB,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;YAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,OAAO,GACX,QAAQ,CAAC,OAAO,EAAE,GAAG,4BAA4B,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACjF,aAAa,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function isGraftInstalled(): Promise<boolean>;
|
|
2
|
+
export declare function initGraft(targetDir: string, options?: {
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
silent?: boolean;
|
|
5
|
+
}): Promise<boolean>;
|
|
6
|
+
export declare function buildGraft(targetDir: string, options?: {
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
silent?: boolean;
|
|
9
|
+
}): Promise<boolean>;
|
|
10
|
+
export declare function uninstallGraft(targetDir: string, options?: {
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
silent?: boolean;
|
|
13
|
+
}): Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=graft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graft.d.ts","sourceRoot":"","sources":["../../src/adapters/graft.ts"],"names":[],"mappings":"AAKA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEzD;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,OAAO,CAAC,CAgClB;AAED,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
|