workflow-agent-cli 1.1.3 ā 1.1.5
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/README.md +440 -0
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
# workflow-agent-cli
|
|
2
|
+
|
|
3
|
+
> A self-evolving workflow management system for AI-friendly development
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/workflow-agent-cli)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
|
|
10
|
+
**Workflow Agent** is a portable, framework-agnostic CLI tool that brings structure and consistency to your development workflow. It enforces branch naming conventions, validates commit messages, and includes a self-improvement system that learns from community feedback.
|
|
11
|
+
|
|
12
|
+
**šÆ Perfect for:**
|
|
13
|
+
- AI agent development with strict workflow requirements
|
|
14
|
+
- Teams maintaining multiple repositories
|
|
15
|
+
- Open source projects enforcing contribution guidelines
|
|
16
|
+
- Any project needing consistent branch/commit patterns
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## ⨠Features
|
|
21
|
+
|
|
22
|
+
- šÆ **Scope-based workflow** - Organize work with preset or custom scopes
|
|
23
|
+
- ā
**Branch validation** - `<type>/<scope>/<description>` format enforcement
|
|
24
|
+
- š **Commit validation** - Conventional commits: `type(scope): description`
|
|
25
|
+
- š **Smart suggestions** - Did-you-mean corrections for typos
|
|
26
|
+
- šØ **Framework detection** - Auto-detects Next.js, Vite, Remix, Astro, SvelteKit
|
|
27
|
+
- š¦ **5 preset libraries** - SaaS (17), Library (10), API (13), E-commerce (12), CMS (13)
|
|
28
|
+
- šØ **Custom scope builder** - Create domain-specific scope packages with `scope:create`
|
|
29
|
+
- š **Scope migration** - Convert inline scopes to reusable packages with `scope:migrate`
|
|
30
|
+
- š **Interactive CLI** - Beautiful prompts with @clack/prompts
|
|
31
|
+
- š¤ **Non-interactive mode** - CI/CD friendly with `--preset --name --yes`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## š Installation
|
|
36
|
+
|
|
37
|
+
### Global Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# npm
|
|
41
|
+
npm install -g workflow-agent-cli
|
|
42
|
+
|
|
43
|
+
# pnpm
|
|
44
|
+
pnpm add -g workflow-agent-cli
|
|
45
|
+
|
|
46
|
+
# yarn
|
|
47
|
+
yarn global add workflow-agent-cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Local Installation (Per-Project)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# npm
|
|
54
|
+
npm install -D workflow-agent-cli
|
|
55
|
+
|
|
56
|
+
# pnpm
|
|
57
|
+
pnpm add -D workflow-agent-cli
|
|
58
|
+
|
|
59
|
+
# yarn
|
|
60
|
+
yarn add -D workflow-agent-cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Setup Scripts (Recommended):**
|
|
64
|
+
|
|
65
|
+
pnpm blocks postinstall scripts by default, so run the setup command after installation:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# If using pnpm or npm locally:
|
|
69
|
+
pnpm workflow-agent setup
|
|
70
|
+
# or
|
|
71
|
+
npx workflow-agent setup
|
|
72
|
+
|
|
73
|
+
# If installed globally:
|
|
74
|
+
workflow-agent setup
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This adds these scripts to your `package.json`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"scripts": {
|
|
82
|
+
"workflow:init": "workflow-agent init",
|
|
83
|
+
"workflow:validate": "workflow-agent validate",
|
|
84
|
+
"workflow:suggest": "workflow-agent suggest",
|
|
85
|
+
"workflow:doctor": "workflow-agent doctor"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## š Quick Start
|
|
93
|
+
|
|
94
|
+
### 1. Initialize Your Project
|
|
95
|
+
|
|
96
|
+
#### Interactive Mode
|
|
97
|
+
```bash
|
|
98
|
+
# If installed globally:
|
|
99
|
+
workflow-agent init
|
|
100
|
+
|
|
101
|
+
# If installed locally:
|
|
102
|
+
pnpm workflow-agent init
|
|
103
|
+
# or
|
|
104
|
+
npx workflow-agent init
|
|
105
|
+
# or (after running setup):
|
|
106
|
+
pnpm run workflow:init
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Prompts you to:
|
|
110
|
+
1. Enter project name
|
|
111
|
+
2. Choose a preset (SaaS, Library, API, E-commerce, CMS, Custom)
|
|
112
|
+
3. Generate guidelines (optional)
|
|
113
|
+
|
|
114
|
+
#### Non-Interactive Mode
|
|
115
|
+
```bash
|
|
116
|
+
# Perfect for CI/CD or automation
|
|
117
|
+
|
|
118
|
+
# Global:
|
|
119
|
+
workflow-agent init --preset library --name my-project --yes
|
|
120
|
+
|
|
121
|
+
# Local:
|
|
122
|
+
pnpm workflow-agent init --preset library --name my-project --yes
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 2. Validate Your Work
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Validate branch names
|
|
129
|
+
workflow-agent validate branch
|
|
130
|
+
workflow-agent validate branch "feature/auth/add-login"
|
|
131
|
+
|
|
132
|
+
# Validate commit messages
|
|
133
|
+
workflow-agent validate commit "feat(auth): add OAuth support"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Expected formats:**
|
|
137
|
+
- **Branch:** `<type>/<scope>/<description>`
|
|
138
|
+
- Types: `feature`, `bugfix`, `hotfix`, `chore`, `refactor`, `docs`, `test`
|
|
139
|
+
- Example: `feature/auth/implement-2fa`
|
|
140
|
+
|
|
141
|
+
- **Commit:** `<type>(<scope>): <description>`
|
|
142
|
+
- Types: `feat`, `fix`, `refactor`, `chore`, `docs`, `test`, `perf`, `style`, `ci`, `build`
|
|
143
|
+
- Example: `feat(auth): implement 2FA with TOTP`
|
|
144
|
+
|
|
145
|
+
### 3. Create Custom Scopes
|
|
146
|
+
|
|
147
|
+
Build reusable scope packages for your domain:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
workflow-agent scope:create
|
|
151
|
+
|
|
152
|
+
# Follow the interactive prompts to:
|
|
153
|
+
# 1. Name your scope package (e.g., "medical", "finance", "gaming")
|
|
154
|
+
# 2. Define scopes (e.g., "patient", "appointment", "billing")
|
|
155
|
+
# 3. Add descriptions for each scope
|
|
156
|
+
# 4. Choose package location
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 4. Migrate Inline Scopes
|
|
160
|
+
|
|
161
|
+
Convert inline scopes to reusable packages:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
workflow-agent scope:migrate
|
|
165
|
+
|
|
166
|
+
# Extracts scopes from workflow.config.json
|
|
167
|
+
# Creates a new scope package
|
|
168
|
+
# Updates config to reference the package
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## š ļø Commands
|
|
174
|
+
|
|
175
|
+
| Command | Description |
|
|
176
|
+
|---------|-------------|
|
|
177
|
+
| `workflow-agent init` | Initialize project with interactive prompts |
|
|
178
|
+
| `workflow-agent validate branch [name]` | Validate branch name format |
|
|
179
|
+
| `workflow-agent validate commit [message]` | Validate commit message format |
|
|
180
|
+
| `workflow-agent config get [key]` | View configuration values |
|
|
181
|
+
| `workflow-agent config set <key> <value>` | Update configuration |
|
|
182
|
+
| `workflow-agent suggest <idea>` | Submit improvement suggestion |
|
|
183
|
+
| `workflow-agent doctor` | Run health checks and get optimization tips |
|
|
184
|
+
| `workflow-agent scope:create` | Create a custom scope package |
|
|
185
|
+
| `workflow-agent scope:migrate` | Migrate inline scopes to package |
|
|
186
|
+
|
|
187
|
+
### Command Options
|
|
188
|
+
|
|
189
|
+
#### `init`
|
|
190
|
+
- `--preset <name>` - Skip preset selection (saas, library, api, ecommerce, cms, custom)
|
|
191
|
+
- `--name <name>` - Set project name without prompt
|
|
192
|
+
- `--yes` - Accept all defaults (non-interactive)
|
|
193
|
+
|
|
194
|
+
#### `validate`
|
|
195
|
+
- `--fix` - Apply automatic fixes (coming soon)
|
|
196
|
+
- `--json` - Output in JSON format
|
|
197
|
+
|
|
198
|
+
#### `suggest`
|
|
199
|
+
- `--category <type>` - Suggestion category (feature, bug, improvement, documentation)
|
|
200
|
+
- `--author <name>` - Your name or username
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## š¦ Preset Scope Libraries
|
|
205
|
+
|
|
206
|
+
### SaaS (17 scopes)
|
|
207
|
+
`auth`, `billing`, `analytics`, `notifications`, `teams`, `admin`, `api`, `integration`, `subscription`, `dashboard`, `onboarding`, `settings`, `payments`, `reports`, `support`, `webhooks`, `search`
|
|
208
|
+
|
|
209
|
+
### Library (10 scopes)
|
|
210
|
+
`core`, `utils`, `types`, `config`, `cli`, `api`, `docs`, `examples`, `test`, `build`
|
|
211
|
+
|
|
212
|
+
### API (13 scopes)
|
|
213
|
+
`routes`, `middleware`, `controllers`, `models`, `services`, `auth`, `validation`, `errors`, `logging`, `cache`, `queue`, `websocket`, `graphql`
|
|
214
|
+
|
|
215
|
+
### E-commerce (12 scopes)
|
|
216
|
+
`products`, `cart`, `checkout`, `orders`, `payments`, `shipping`, `inventory`, `customers`, `reviews`, `discounts`, `recommendations`, `analytics`
|
|
217
|
+
|
|
218
|
+
### CMS (13 scopes)
|
|
219
|
+
`content`, `media`, `pages`, `posts`, `categories`, `tags`, `users`, `comments`, `seo`, `templates`, `widgets`, `api`, `admin`
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## šØ Custom Scopes
|
|
224
|
+
|
|
225
|
+
Create domain-specific scope packages:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
workflow-agent scope:create
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Example: Medical Scope Package**
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// packages/scopes-medical/src/index.ts
|
|
235
|
+
export default {
|
|
236
|
+
scopes: [
|
|
237
|
+
{ name: 'patient', description: 'Patient records and profiles' },
|
|
238
|
+
{ name: 'appointment', description: 'Scheduling and appointments' },
|
|
239
|
+
{ name: 'billing', description: 'Medical billing and insurance' },
|
|
240
|
+
{ name: 'prescription', description: 'Prescriptions and medications' },
|
|
241
|
+
{ name: 'lab', description: 'Laboratory tests and results' }
|
|
242
|
+
]
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Use in workflow.config.json:**
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"name": "medical-app",
|
|
251
|
+
"scopesSource": "packages/scopes-medical"
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
For detailed instructions, see the [Custom Scopes Documentation](https://github.com/hawkinsideOut/workflow-agent/blob/main/docs/content/custom-scopes.mdx).
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## š Troubleshooting
|
|
260
|
+
|
|
261
|
+
### Installation Issues
|
|
262
|
+
|
|
263
|
+
#### pnpm Installation with Postinstall
|
|
264
|
+
|
|
265
|
+
If you're using pnpm, postinstall scripts are blocked by default. Run setup manually:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
pnpm add -D workflow-agent-cli
|
|
269
|
+
pnpm workflow-agent setup
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Permission Errors (Global Install)
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Linux/macOS
|
|
276
|
+
sudo npm install -g workflow-agent-cli
|
|
277
|
+
|
|
278
|
+
# Or use nvm to avoid sudo
|
|
279
|
+
nvm use system
|
|
280
|
+
npm install -g workflow-agent-cli
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Publishing Issues (For Contributors)
|
|
284
|
+
|
|
285
|
+
#### npm Token Errors
|
|
286
|
+
|
|
287
|
+
**Error: "Access token expired or revoked" or "404 Not Found"**
|
|
288
|
+
|
|
289
|
+
This typically means your npm token doesn't have the correct permissions. To fix:
|
|
290
|
+
|
|
291
|
+
1. **Create a Granular Access Token on npm:**
|
|
292
|
+
- Go to https://www.npmjs.com/ ā Profile ā Access Tokens
|
|
293
|
+
- Click "Generate New Token" ā Select "Granular Access Token"
|
|
294
|
+
- Configure:
|
|
295
|
+
- **Packages and scopes**: Select **"All packages"** + **"Read and write"**
|
|
296
|
+
- **Organizations**: Leave **unchecked/empty** (unless publishing under an org)
|
|
297
|
+
- **Token type**: Should support automation/bypass 2FA
|
|
298
|
+
- Copy the token immediately
|
|
299
|
+
|
|
300
|
+
2. **Test the token locally:**
|
|
301
|
+
```bash
|
|
302
|
+
echo '//registry.npmjs.org/:_authToken=YOUR_TOKEN' > ~/.npmrc
|
|
303
|
+
npm whoami # Should show your npm username
|
|
304
|
+
cd packages/core
|
|
305
|
+
npm publish --access public --dry-run # Should succeed
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
3. **Update GitHub Secret:**
|
|
309
|
+
- Go to your repo ā Settings ā Secrets and variables ā Actions
|
|
310
|
+
- Update `NPM_TOKEN` with the exact token that works locally
|
|
311
|
+
|
|
312
|
+
**Error: "This operation requires a one-time password (EOTP)"**
|
|
313
|
+
|
|
314
|
+
Your npm account has 2FA enabled. Options:
|
|
315
|
+
|
|
316
|
+
1. **Use an Automation token** that bypasses 2FA (recommended)
|
|
317
|
+
2. **Disable 2FA for publishing** (keeps it for login):
|
|
318
|
+
- Go to npm ā Account Settings ā Two-Factor Authentication
|
|
319
|
+
- Change from "Authorization and Publishing" to "Authorization only"
|
|
320
|
+
|
|
321
|
+
#### Package Name Conflicts
|
|
322
|
+
|
|
323
|
+
**Error: "must not have multiple workspaces with the same name"**
|
|
324
|
+
|
|
325
|
+
If you have workspace packages with duplicate names:
|
|
326
|
+
|
|
327
|
+
1. **Check all package.json files** in `packages/*/package.json`
|
|
328
|
+
2. **Rename conflicting packages:**
|
|
329
|
+
```bash
|
|
330
|
+
# Example: rename vscode-extension to avoid conflict
|
|
331
|
+
# packages/vscode-extension/package.json
|
|
332
|
+
{ "name": "workflow-agent-vscode" }
|
|
333
|
+
```
|
|
334
|
+
3. **Update imports** in dependent packages
|
|
335
|
+
4. **Run `pnpm install`** to update lockfile
|
|
336
|
+
|
|
337
|
+
#### Lockfile Out of Sync
|
|
338
|
+
|
|
339
|
+
**Error: "Cannot install with frozen-lockfile because pnpm-lock.yaml is not up to date"**
|
|
340
|
+
|
|
341
|
+
After changing package dependencies:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
pnpm install # Update lockfile
|
|
345
|
+
git add pnpm-lock.yaml
|
|
346
|
+
git commit -m "chore: update lockfile"
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Build Issues
|
|
350
|
+
|
|
351
|
+
#### TypeScript Compilation Errors
|
|
352
|
+
|
|
353
|
+
**Error: "Cannot find module 'workflow-agent-cli/config'"**
|
|
354
|
+
|
|
355
|
+
This means the core package wasn't built before dependent packages:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Build core package first
|
|
359
|
+
pnpm --filter workflow-agent-cli run build
|
|
360
|
+
|
|
361
|
+
# Then build everything
|
|
362
|
+
pnpm build
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Fix permanently** by updating the root `package.json`:
|
|
366
|
+
|
|
367
|
+
```json
|
|
368
|
+
{
|
|
369
|
+
"scripts": {
|
|
370
|
+
"build": "pnpm --filter workflow-agent-cli run build && pnpm -r run build"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Template Issues
|
|
376
|
+
|
|
377
|
+
**Error: Guidelines directory not created**
|
|
378
|
+
|
|
379
|
+
If templates aren't bundled with the npm package:
|
|
380
|
+
|
|
381
|
+
1. **Ensure templates are in the package:**
|
|
382
|
+
```json
|
|
383
|
+
// packages/core/package.json
|
|
384
|
+
{
|
|
385
|
+
"files": ["dist", "templates"]
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
2. **Copy templates to package directory:**
|
|
390
|
+
```bash
|
|
391
|
+
cp -r templates packages/core/
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
3. **Update template paths** in code to use relative paths from the package
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## š¤ Contributing
|
|
399
|
+
|
|
400
|
+
Contributions are welcome! Please see our [Contributing Guide](https://github.com/hawkinsideOut/workflow-agent/blob/main/CONTRIBUTING.md).
|
|
401
|
+
|
|
402
|
+
### Development Setup
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Clone the repository
|
|
406
|
+
git clone https://github.com/hawkinsideOut/workflow-agent.git
|
|
407
|
+
cd workflow-agent
|
|
408
|
+
|
|
409
|
+
# Install dependencies
|
|
410
|
+
pnpm install
|
|
411
|
+
|
|
412
|
+
# Build all packages
|
|
413
|
+
pnpm build
|
|
414
|
+
|
|
415
|
+
# Run the CLI locally
|
|
416
|
+
node packages/core/dist/cli/index.js --help
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## š License
|
|
422
|
+
|
|
423
|
+
MIT Ā© Workflow Agent Team
|
|
424
|
+
|
|
425
|
+
See [LICENSE](https://github.com/hawkinsideOut/workflow-agent/blob/main/LICENSE) for details.
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## š Links
|
|
430
|
+
|
|
431
|
+
- [GitHub Repository](https://github.com/hawkinsideOut/workflow-agent)
|
|
432
|
+
- [npm Package](https://www.npmjs.com/package/workflow-agent-cli)
|
|
433
|
+
- [Documentation](https://github.com/hawkinsideOut/workflow-agent/tree/main/docs)
|
|
434
|
+
- [Custom Scopes Guide](https://github.com/hawkinsideOut/workflow-agent/blob/main/docs/content/custom-scopes.mdx)
|
|
435
|
+
- [Issue Tracker](https://github.com/hawkinsideOut/workflow-agent/issues)
|
|
436
|
+
- [Changelog](https://github.com/hawkinsideOut/workflow-agent/blob/main/CHANGELOG.md)
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
**Made with ā¤ļø for developers who value consistency and automation**
|
package/dist/cli/index.js
CHANGED
|
@@ -320,7 +320,7 @@ async function initCommand(options) {
|
|
|
320
320
|
const spinner4 = p.spinner();
|
|
321
321
|
spinner4.start("Generating guidelines...");
|
|
322
322
|
try {
|
|
323
|
-
const templatesDir = join(__dirname, "
|
|
323
|
+
const templatesDir = join(__dirname, "../../templates");
|
|
324
324
|
await validateTemplateDirectory(templatesDir);
|
|
325
325
|
const context = await buildTemplateContext(config, cwd);
|
|
326
326
|
const guidelinesDir = join(cwd, "guidelines");
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/init.ts","../../src/templates/renderer.ts","../../src/adapters/index.ts","../../src/cli/commands/validate.ts","../../src/cli/commands/config.ts","../../src/cli/commands/suggest.ts","../../src/cli/commands/doctor.ts","../../src/cli/commands/setup.ts","../../src/cli/commands/scope-create.ts","../../src/cli/commands/scope-migrate.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { initCommand } from './commands/init.js';\nimport { validateCommand } from './commands/validate.js';\nimport { configCommand } from './commands/config.js';\nimport { suggestCommand } from './commands/suggest.js';\nimport { doctorCommand } from './commands/doctor.js';\nimport { setupCommand } from './commands/setup.js';\nimport { scopeCreateCommand } from './commands/scope-create.js';\nimport { scopeMigrateCommand } from './commands/scope-migrate.js';\n\nconst program = new Command();\n\nprogram\n .name('workflow')\n .description('A self-evolving workflow management system for AI agent development')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize workflow in current project')\n .option('--migrate', 'Auto-detect existing patterns and migrate')\n .option('--workspace', 'Initialize for multiple repositories')\n .option('--preset <preset>', 'Preset to use (saas, library, api, ecommerce, cms, custom)')\n .option('--name <name>', 'Project name')\n .option('-y, --yes', 'Skip confirmation prompts')\n .action(initCommand);\n\nprogram\n .command('validate <type>')\n .description('Validate branch name, commit message, or PR title')\n .argument('<type>', 'What to validate: branch, commit, or pr')\n .argument('[value]', 'Value to validate (defaults to current branch/HEAD commit)')\n .option('--suggest-on-error', 'Offer improvement suggestions on validation errors')\n .action(validateCommand);\n\nprogram\n .command('config <action>')\n .description('Manage workflow configuration')\n .argument('<action>', 'Action: get, set, add, remove')\n .argument('[key]', 'Config key')\n .argument('[value]', 'Config value')\n .action(configCommand);\n\nprogram\n .command('suggest')\n .description('Submit an improvement suggestion')\n .argument('<feedback>', 'Your improvement suggestion')\n .option('--author <author>', 'Your name or username')\n .option('--category <category>', 'Category: feature, bug, documentation, performance, other')\n .action(suggestCommand);\n\nprogram\n .command('setup')\n .description('Add workflow scripts to package.json')\n .action(setupCommand);\n\nprogram\n .command('doctor')\n .description('Run health check and get optimization suggestions')\n .action(doctorCommand);\n\nprogram\n .command('scope:create')\n .description('Create a custom scope package')\n .option('--name <name>', 'Package name (e.g., \"fintech\", \"gaming\")')\n .option('--scopes <scopes>', 'Comma-separated scopes (format: name:description:emoji:category)')\n .option('--preset-name <preset>', 'Preset display name')\n .option('--output-dir <dir>', 'Output directory')\n .option('--no-test', 'Skip test file generation')\n .action(scopeCreateCommand);\n\nprogram\n .command('scope:migrate')\n .description('Migrate inline scopes to a custom package')\n .option('--name <name>', 'Package name for the preset')\n .option('--output-dir <dir>', 'Output directory')\n .option('--keep-config', 'Keep inline scopes in config after migration')\n .action(scopeMigrateCommand);\n\nprogram.parse();\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir } from 'fs/promises';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { hasConfig } from '../../config/index.js';\nimport { buildTemplateContext, renderTemplateDirectory, validateTemplateDirectory } from '../../templates/renderer.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport async function initCommand(options: { migrate?: boolean; workspace?: boolean; preset?: string; name?: string; yes?: boolean }) {\n console.log(chalk.bold.cyan('\\nš Workflow Agent Initialization\\n'));\n\n const cwd = process.cwd();\n const isNonInteractive = !!(options.preset && options.name);\n\n // Check if already initialized\n if (hasConfig(cwd) && !options.yes && !isNonInteractive) {\n const shouldContinue = await p.confirm({\n message: 'Workflow Agent is already configured. Continue and overwrite?',\n initialValue: false,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n }\n\n // Get project name\n const projectName = isNonInteractive ? options.name : await p.text({\n message: 'What is your project name?',\n placeholder: 'my-awesome-project',\n defaultValue: process.cwd().split('/').pop() || 'my-project',\n });\n\n if (!isNonInteractive && p.isCancel(projectName)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n // Select preset\n const preset = isNonInteractive ? options.preset : await p.select({\n message: 'Choose a scope preset for your project:',\n options: [\n { value: 'saas', label: 'š¦ SaaS Application - 17 scopes (auth, tasks, boards, sprints, etc.)' },\n { value: 'library', label: 'š Library/Package - 10 scopes (types, build, docs, examples, etc.)' },\n { value: 'api', label: 'š API/Backend - 13 scopes (auth, endpoints, models, services, etc.)' },\n { value: 'ecommerce', label: 'š E-commerce - 12 scopes (cart, products, payments, orders, etc.)' },\n { value: 'cms', label: 'š CMS - 13 scopes (content, pages, media, editor, etc.)' },\n { value: 'custom', label: '⨠Custom (define your own scopes manually)' },\n ],\n });\n\n if (!isNonInteractive && p.isCancel(preset)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n // Load preset scopes\n let scopes: Array<{ name: string; description: string; emoji?: string }> = [];\n \n if (preset !== 'custom') {\n // Import preset dynamically\n try {\n const presetModule = await import(`@workflow/scopes-${preset}`);\n scopes = presetModule.scopes || presetModule.default.scopes;\n \n const spinner = p.spinner();\n spinner.start(`Loading ${presetModule.default?.name || preset} preset`);\n await new Promise(resolve => setTimeout(resolve, 500));\n spinner.stop(`ā Loaded ${scopes.length} scopes from preset`);\n } catch (error) {\n console.log(chalk.yellow(`\\nā ļø Could not load preset package. Using basic scopes.`));\n scopes = [\n { name: 'feat', description: 'New features', emoji: 'āØ' },\n { name: 'fix', description: 'Bug fixes', emoji: 'š' },\n { name: 'docs', description: 'Documentation', emoji: 'š' },\n ];\n }\n } else {\n scopes = [\n { name: 'feat', description: 'New features', emoji: 'āØ' },\n { name: 'fix', description: 'Bug fixes', emoji: 'š' },\n { name: 'docs', description: 'Documentation', emoji: 'š' },\n ];\n console.log(chalk.dim('\\nš” Tip: Edit workflow.config.json to add your custom scopes'));\n }\n\n // Generate config\n const config = {\n projectName: projectName as string,\n scopes: scopes,\n enforcement: 'strict' as const,\n language: 'en',\n };\n\n // Write config file\n const configPath = join(cwd, 'workflow.config.json');\n await writeFile(configPath, JSON.stringify(config, null, 2));\n\n // Create .workflow directory\n const workflowDir = join(cwd, '.workflow');\n if (!existsSync(workflowDir)) {\n await mkdir(workflowDir, { recursive: true });\n }\n\n // Render guidelines from templates\n const shouldGenerateGuidelines = await p.confirm({\n message: 'Generate workflow guidelines from templates?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldGenerateGuidelines)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n if (shouldGenerateGuidelines) {\n const spinner = p.spinner();\n spinner.start('Generating guidelines...');\n\n try {\n // Find templates directory\n // When built: dist/cli/commands/init.js -> templates is at package root\n const templatesDir = join(__dirname, '../../../templates');\n \n // Validate templates exist\n await validateTemplateDirectory(templatesDir);\n\n // Build context for template rendering\n const context = await buildTemplateContext(config, cwd);\n\n // Create guidelines directory\n const guidelinesDir = join(cwd, 'guidelines');\n await mkdir(guidelinesDir, { recursive: true });\n\n // Render all templates\n const renderedFiles = await renderTemplateDirectory(templatesDir, guidelinesDir, context);\n\n spinner.stop(`ā Generated ${renderedFiles.length} guideline documents`);\n } catch (error) {\n spinner.stop('ā ļø Could not generate guidelines');\n console.log(chalk.yellow(`\\nReason: ${error instanceof Error ? error.message : String(error)}`));\n console.log(chalk.dim('You can manually copy guidelines later if needed.'));\n }\n }\n\n p.outro(chalk.green('ā Workflow Agent initialized successfully!'));\n console.log(chalk.dim('\\nNext steps:'));\n console.log(chalk.dim(' 1. Review your configuration in workflow.config.json'));\n if (shouldGenerateGuidelines) {\n console.log(chalk.dim(' 2. Review generated guidelines in guidelines/ directory'));\n console.log(chalk.dim(' 3. Run: workflow validate branch'));\n console.log(chalk.dim(' 4. Run: workflow doctor (for optimization suggestions)\\n'));\n } else {\n console.log(chalk.dim(' 2. Run: workflow validate branch'));\n console.log(chalk.dim(' 3. Run: workflow doctor (for optimization suggestions)\\n'));\n }\n}\n","import fs from 'fs/promises';\nimport path from 'path';\nimport { WorkflowConfig } from '../config/schema.js';\nimport { detectAdapter, getAdapter } from '../adapters/index.js';\n\nexport interface TemplateContext {\n projectName: string;\n framework: string;\n scopes: string;\n scopeList: string;\n pathStructure: string;\n enforcement: string;\n year: string;\n // Additional context for scope package scaffolding\n scopeName?: string;\n presetName?: string;\n scopeDefinitions?: string;\n packageDirectory?: string;\n isMonorepo?: string;\n testImports?: string;\n packageVersion?: string;\n [key: string]: string | undefined;\n}\n\n/**\n * Renders a template string with provided context using simple {{variable}} syntax\n */\nexport function renderTemplate(template: string, context: TemplateContext): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key) => {\n return context[key] ?? match;\n });\n}\n\n/**\n * Builds template context from workflow config and detected framework\n */\nexport async function buildTemplateContext(\n config: WorkflowConfig,\n projectPath: string = process.cwd()\n): Promise<TemplateContext> {\n // Detect framework\n const detectedFramework = await detectAdapter();\n const adapter = getAdapter(detectedFramework);\n\n // Build scope list as markdown\n const scopeList = config.scopes\n .map(s => `- **${s.name}** - ${s.description}`)\n .join('\\n');\n\n // Build scope names list (comma-separated)\n const scopes = config.scopes.map(s => s.name).join(', ');\n\n // Build path structure from adapter\n const pathStructure = adapter ? `\n### Path Structure\n\n\\`\\`\\`\n${adapter.paths.components}/ ā UI components\n${adapter.paths.lib}/ ā Utility functions and services\n${adapter.paths.hooks}/ ā Custom React hooks\n${adapter.paths.types}/ ā TypeScript type definitions\n\\`\\`\\`\n`.trim() : 'N/A';\n\n // Get project name from package.json or directory name\n const projectName = await getProjectName(projectPath);\n\n return {\n projectName,\n framework: adapter?.name || 'unknown',\n scopes,\n scopeList,\n pathStructure,\n enforcement: config.enforcement,\n year: new Date().getFullYear().toString(),\n };\n}\n\n/**\n * Renders a template file and writes output\n */\nexport async function renderTemplateFile(\n templatePath: string,\n outputPath: string,\n context: TemplateContext\n): Promise<void> {\n const template = await fs.readFile(templatePath, 'utf-8');\n const rendered = renderTemplate(template, context);\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, rendered, 'utf-8');\n}\n\n/**\n * Renders all template files from source directory to output directory\n * Supports .md, .ts, .json file extensions\n */\nexport async function renderTemplateDirectory(\n templateDir: string,\n outputDir: string,\n context: TemplateContext\n): Promise<string[]> {\n const files = await fs.readdir(templateDir);\n const rendered: string[] = [];\n\n for (const file of files) {\n // Support .md, .ts, .json files\n if (!file.match(/\\.(md|ts|json)$/)) continue;\n\n const templatePath = path.join(templateDir, file);\n const outputPath = path.join(outputDir, file);\n\n await renderTemplateFile(templatePath, outputPath, context);\n rendered.push(file);\n }\n\n return rendered;\n}\n\n/**\n * Gets project name from package.json or directory name\n */\nasync function getProjectName(projectPath: string): Promise<string> {\n try {\n const pkgPath = path.join(projectPath, 'package.json');\n const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));\n return pkg.name || path.basename(projectPath);\n } catch {\n return path.basename(projectPath);\n }\n}\n\n/**\n * Validates that template directory exists and contains markdown files\n */\nexport async function validateTemplateDirectory(templateDir: string): Promise<void> {\n try {\n const stat = await fs.stat(templateDir);\n if (!stat.isDirectory()) {\n throw new Error(`Template path is not a directory: ${templateDir}`);\n }\n\n const files = await fs.readdir(templateDir);\n const templateFiles = files.filter(f => f.match(/\\.(md|ts|json)$/));\n\n if (templateFiles.length === 0) {\n throw new Error(`No template files found in template directory: ${templateDir}`);\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`Template directory not found: ${templateDir}`);\n }\n throw error;\n }\n}\n\n/**\n * Renders a scope package from templates\n * @param outputDir Directory to create package in\n * @param context Template context with scope-specific variables\n */\nexport async function renderScopePackage(\n outputDir: string,\n context: Required<Pick<TemplateContext, 'scopeName' | 'presetName' | 'scopeDefinitions' | 'packageVersion'>> & TemplateContext\n): Promise<void> {\n // Ensure output directory exists\n await fs.mkdir(path.join(outputDir, 'src'), { recursive: true });\n\n // Write package.json\n const packageJson = {\n name: `@workflow/scopes-${context.scopeName}`,\n version: context.packageVersion,\n description: `Scope preset for ${context.presetName}`,\n keywords: ['workflow', 'scopes', context.scopeName, 'preset'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: context.packageDirectory || `packages/scopes-${context.scopeName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await fs.writeFile(\n path.join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Write tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await fs.writeFile(\n path.join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Write tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await fs.writeFile(path.join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Write src/index.ts\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${context.scopeDefinitions};\n\nexport const preset = {\n name: '${context.presetName}',\n description: 'Scope configuration for ${context.presetName}',\n scopes,\n version: '${context.packageVersion}',\n};\n\nexport default preset;\n`;\n\n await fs.writeFile(path.join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n}\n","export interface Adapter {\n name: string;\n description: string;\n detect: () => Promise<boolean>;\n paths: {\n actions?: string;\n components?: string;\n lib?: string;\n hooks?: string;\n types?: string;\n tests?: string;\n config?: string;\n };\n}\n\nexport const adapters: Record<string, Adapter> = {\n 'nextjs-app-router': {\n name: 'Next.js App Router',\n description: 'Next.js 13+ with app directory',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('app') && fs.existsSync('next.config.ts') || fs.existsSync('next.config.js');\n },\n paths: {\n actions: 'app/actions',\n components: 'components',\n lib: 'lib',\n hooks: 'hooks',\n types: 'types',\n tests: '__tests__',\n config: 'app',\n },\n },\n \n 'nextjs-pages': {\n name: 'Next.js Pages Router',\n description: 'Next.js with pages directory',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('pages') && (fs.existsSync('next.config.ts') || fs.existsSync('next.config.js'));\n },\n paths: {\n components: 'components',\n lib: 'lib',\n hooks: 'hooks',\n types: 'types',\n tests: '__tests__',\n config: 'pages',\n },\n },\n \n 'vite-react': {\n name: 'Vite + React',\n description: 'Vite-powered React application',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('vite.config.ts') || fs.existsSync('vite.config.js');\n },\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n hooks: 'src/hooks',\n types: 'src/types',\n tests: 'src/__tests__',\n config: 'src',\n },\n },\n \n 'remix': {\n name: 'Remix',\n description: 'Remix full-stack framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('app/routes') && (fs.existsSync('remix.config.js') || fs.existsSync('package.json'));\n },\n paths: {\n components: 'app/components',\n lib: 'app/lib',\n types: 'app/types',\n tests: 'app/__tests__',\n config: 'app/root.tsx',\n },\n },\n \n 'astro': {\n name: 'Astro',\n description: 'Astro static site framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('astro.config.mjs') || fs.existsSync('astro.config.ts');\n },\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n types: 'src/types',\n tests: 'src/__tests__',\n config: 'src/pages',\n },\n },\n \n 'sveltekit': {\n name: 'SvelteKit',\n description: 'SvelteKit full-stack framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('svelte.config.js') || fs.existsSync('src/routes');\n },\n paths: {\n components: 'src/lib/components',\n lib: 'src/lib',\n types: 'src/lib/types',\n tests: 'src/lib/__tests__',\n config: 'src/routes',\n },\n },\n \n 'generic': {\n name: 'Generic Project',\n description: 'Standard project structure',\n detect: async () => true, // Always matches as fallback\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n types: 'src/types',\n tests: 'tests',\n config: 'src',\n },\n },\n};\n\nexport async function detectAdapter(): Promise<string> {\n for (const [key, adapter] of Object.entries(adapters)) {\n if (key === 'generic') continue; // Skip generic, it's the fallback\n \n try {\n if (await adapter.detect()) {\n return key;\n }\n } catch {\n // Continue to next adapter\n }\n }\n \n return 'generic';\n}\n\nexport function getAdapter(name: string): Adapter | null {\n return adapters[name] || null;\n}\n","import chalk from 'chalk';\nimport { execa } from 'execa';\nimport { loadConfig } from '../../config/index.js';\nimport { validateBranchName, validateCommitMessage, validatePRTitle } from '../../validators/index.js';\n\nexport async function validateCommand(\n type: string,\n value?: string,\n _options: { suggestOnError?: boolean } = {}\n) {\n const config = await loadConfig();\n\n if (!config) {\n console.error(chalk.red('ā No workflow configuration found. Run: workflow init'));\n process.exit(1);\n }\n\n let targetValue = value;\n\n try {\n let result;\n switch (type) {\n case 'branch': {\n if (!targetValue) {\n const { stdout } = await execa('git', ['branch', '--show-current']);\n targetValue = stdout.trim();\n }\n result = await validateBranchName(targetValue, config);\n break;\n }\n\n case 'commit': {\n if (!targetValue) {\n const { stdout } = await execa('git', ['log', '-1', '--pretty=%s']);\n targetValue = stdout.trim();\n }\n result = await validateCommitMessage(targetValue, config);\n break;\n }\n\n case 'pr':\n case 'pr-title': {\n if (!targetValue) {\n console.error(chalk.red('ā PR title must be provided as argument'));\n process.exit(1);\n }\n result = await validatePRTitle(targetValue, config);\n break;\n }\n\n default:\n console.error(chalk.red(`ā Unknown validation type: ${type}`));\n console.error(chalk.dim('Valid types: branch, commit, pr'));\n process.exit(1);\n }\n\n if (result.valid) {\n console.log(chalk.green(`ā ${type} is valid: ${targetValue}`));\n process.exit(0);\n } else {\n console.error(chalk.red(`ā Invalid ${type}: ${targetValue}`));\n console.error(chalk.yellow(` ${result.error}`));\n if (result.suggestion) {\n console.error(chalk.cyan(` š” ${result.suggestion}`));\n }\n \n const enforcementLevel = config.enforcement;\n if (enforcementLevel === 'strict') {\n process.exit(1);\n } else {\n console.log(chalk.yellow(`\\nā ļø Advisory mode: validation failed but not blocking`));\n process.exit(0);\n }\n }\n } catch (error) {\n console.error(chalk.red(`ā Validation error: ${error}`));\n process.exit(1);\n }\n}\n","import chalk from 'chalk';\n\nexport async function configCommand(action: string, key?: string, value?: string) {\n console.log(chalk.yellow('Config command not yet implemented'));\n console.log({ action, key, value });\n}\n","import chalk from 'chalk';\nimport * as p from '@clack/prompts';\nimport { createTracker } from '@hawkinside_out/workflow-improvement-tracker';\n\nexport async function suggestCommand(feedback: string, options: { author?: string; category?: string } = {}) {\n console.log(chalk.cyan('š” Submitting improvement suggestion...\\n'));\n\n const tracker = createTracker();\n\n // Optionally get category if not provided\n let category = options.category;\n if (!category) {\n const categoryChoice = await p.select({\n message: 'What type of improvement is this?',\n options: [\n { value: 'feature', label: '⨠Feature Request' },\n { value: 'bug', label: 'š Bug Report' },\n { value: 'documentation', label: 'š Documentation' },\n { value: 'performance', label: 'ā” Performance' },\n { value: 'other', label: 'š” Other' },\n ],\n });\n\n if (p.isCancel(categoryChoice)) {\n p.cancel('Suggestion cancelled');\n process.exit(0);\n }\n\n category = categoryChoice as string;\n }\n\n // Submit suggestion\n const result = await tracker.submit(feedback, options.author, category);\n\n if (!result.success) {\n console.log(chalk.red('ā Suggestion rejected'));\n console.log(chalk.dim(` Reason: ${result.error}`));\n process.exit(1);\n }\n\n console.log(chalk.green('ā Suggestion submitted successfully!'));\n console.log(chalk.dim(` ID: ${result.suggestion?.id}`));\n console.log(chalk.dim(` Status: ${result.suggestion?.status}`));\n console.log(chalk.dim(` Category: ${result.suggestion?.category}`));\n console.log(chalk.dim('\\nYour suggestion will be:'));\n console.log(chalk.dim(' 1. Reviewed by the community'));\n console.log(chalk.dim(' 2. Prioritized based on impact'));\n console.log(chalk.dim(' 3. Incorporated into future releases if approved\\n'));\n}\n","import chalk from 'chalk';\nimport { loadConfig } from '../../config/index.js';\n\nexport async function doctorCommand() {\n console.log(chalk.bold.cyan('\\nš„ Workflow Agent Health Check\\n'));\n\n const config = await loadConfig();\n\n if (!config) {\n console.error(chalk.red('ā No workflow configuration found'));\n console.log(chalk.yellow(' Run: workflow init'));\n process.exit(1);\n }\n\n console.log(chalk.green('ā Configuration loaded successfully'));\n console.log(chalk.dim(` Project: ${config.projectName}`));\n console.log(chalk.dim(` Scopes: ${config.scopes.length} configured`));\n console.log(chalk.dim(` Enforcement: ${config.enforcement}`));\n console.log(chalk.dim(` Language: ${config.language}`));\n\n console.log(chalk.cyan('\\nš” Suggestions:\\n'));\n console.log(chalk.dim(' ⢠Health check analysis coming soon'));\n console.log(chalk.dim(' ⢠Git history analysis coming soon'));\n console.log(chalk.dim(' ⢠Optimization recommendations coming soon'));\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { readFileSync, writeFileSync, existsSync } from 'fs';\nimport { join } from 'path';\n\nconst WORKFLOW_SCRIPTS = {\n 'workflow:init': 'workflow-agent init',\n 'workflow:validate': 'workflow-agent validate',\n 'workflow:suggest': 'workflow-agent suggest',\n 'workflow:doctor': 'workflow-agent doctor',\n};\n\nexport async function setupCommand(): Promise<void> {\n p.intro(chalk.bgBlue(' workflow-agent setup '));\n\n const cwd = process.cwd();\n const packageJsonPath = join(cwd, 'package.json');\n\n if (!existsSync(packageJsonPath)) {\n p.cancel('No package.json found in current directory');\n process.exit(1);\n }\n\n // Read package.json\n const packageJsonContent = readFileSync(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(packageJsonContent);\n\n // Initialize scripts if needed\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n // Check which scripts already exist\n const existingScripts: string[] = [];\n const scriptsToAdd: Record<string, string> = {};\n\n for (const [scriptName, scriptCommand] of Object.entries(WORKFLOW_SCRIPTS)) {\n if (packageJson.scripts[scriptName]) {\n existingScripts.push(scriptName);\n } else {\n scriptsToAdd[scriptName] = scriptCommand;\n }\n }\n\n if (Object.keys(scriptsToAdd).length === 0) {\n p.outro(chalk.green('ā All workflow scripts are already configured!'));\n return;\n }\n\n // Show what will be added\n console.log(chalk.dim('\\nScripts to add:'));\n for (const [scriptName, scriptCommand] of Object.entries(scriptsToAdd)) {\n console.log(chalk.dim(` ${scriptName}: ${scriptCommand}`));\n }\n\n if (existingScripts.length > 0) {\n console.log(chalk.yellow('\\nExisting scripts (will be skipped):'));\n existingScripts.forEach((name) => {\n console.log(chalk.yellow(` ${name}`));\n });\n }\n\n const shouldAdd = await p.confirm({\n message: 'Add these scripts to package.json?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldAdd) || !shouldAdd) {\n p.cancel('Setup cancelled');\n process.exit(0);\n }\n\n // Add scripts\n for (const [scriptName, scriptCommand] of Object.entries(scriptsToAdd)) {\n packageJson.scripts[scriptName] = scriptCommand;\n }\n\n // Write back to package.json\n writeFileSync(\n packageJsonPath,\n JSON.stringify(packageJson, null, 2) + '\\n',\n 'utf-8'\n );\n\n p.outro(chalk.green(`ā Added ${Object.keys(scriptsToAdd).length} workflow scripts to package.json!`));\n console.log(chalk.dim('\\nRun them with:'));\n console.log(chalk.dim(' pnpm run workflow:init'));\n console.log(chalk.dim(' npm run workflow:init\\n'));\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { validateScopeDefinitions, type Scope } from '../../config/schema.js';\n\ninterface ScopeCreateOptions {\n name?: string;\n scopes?: string;\n presetName?: string;\n outputDir?: string;\n noTest?: boolean;\n}\n\nexport async function scopeCreateCommand(options: ScopeCreateOptions) {\n console.log(chalk.bold.cyan('\\nšØ Create Custom Scope Package\\n'));\n\n const cwd = process.cwd();\n const isNonInteractive = !!(options.name && options.scopes && options.presetName);\n\n // Check for monorepo\n const isMonorepo = existsSync(join(cwd, 'pnpm-workspace.yaml'));\n if (isMonorepo) {\n console.log(chalk.dim('ā Detected monorepo workspace\\n'));\n }\n\n // Get package name\n const packageNameInput = isNonInteractive ? options.name : await p.text({\n message: 'What is the package name? (e.g., \"fintech\", \"gaming\", \"healthcare\")',\n placeholder: 'my-custom-scope',\n validate: (value) => {\n if (!value || value.length === 0) return 'Package name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Package name must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Package name must be 32 characters or less';\n return undefined;\n },\n });\n\n if (!isNonInteractive && p.isCancel(packageNameInput)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n const packageName = packageNameInput as string;\n\n // Get preset display name\n const presetNameInput = isNonInteractive ? options.presetName : await p.text({\n message: 'What is the preset display name? (e.g., \"FinTech Application\", \"Gaming Platform\")',\n placeholder: 'My Custom Preset',\n validate: (value) => {\n if (!value || value.length === 0) return 'Preset name is required';\n return undefined;\n },\n });\n\n if (!isNonInteractive && p.isCancel(presetNameInput)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n const presetName = presetNameInput as string;\n\n // Collect scopes\n const scopes: Scope[] = [];\n \n if (isNonInteractive && options.scopes) {\n // Parse scopes from command line (format: \"name:description:emoji:category,...\")\n const scopeParts = options.scopes.split(',');\n for (const part of scopeParts) {\n const [name, description, emoji, category] = part.split(':');\n scopes.push({\n name: name.trim(),\n description: description?.trim() || 'Scope description',\n emoji: emoji?.trim(),\n category: category?.trim() as any,\n });\n }\n } else {\n console.log(chalk.dim('\\nAdd scopes to your preset (aim for 8-15 scopes):\\n'));\n \n let addMore = true;\n while (addMore) {\n const scopeName = await p.text({\n message: `Scope #${scopes.length + 1} - Name:`,\n placeholder: 'auth',\n validate: (value) => {\n if (!value || value.length === 0) return 'Scope name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Must be 32 characters or less';\n if (scopes.some(s => s.name === value)) return 'Scope name already exists';\n return undefined;\n },\n });\n\n if (p.isCancel(scopeName)) {\n break;\n }\n\n const scopeDescription = await p.text({\n message: 'Description:',\n placeholder: 'Authentication and authorization',\n validate: (value) => {\n if (!value || value.length < 10) return 'Description must be at least 10 characters';\n return undefined;\n },\n });\n\n if (p.isCancel(scopeDescription)) {\n break;\n }\n\n const scopeEmoji = await p.text({\n message: 'Emoji (optional):',\n placeholder: 'š',\n });\n\n if (p.isCancel(scopeEmoji)) {\n break;\n }\n\n const scopeCategory = await p.select({\n message: 'Category (optional):',\n options: [\n { value: 'auth', label: 'Authentication & Authorization' },\n { value: 'features', label: 'Features & Functionality' },\n { value: 'infrastructure', label: 'Infrastructure & DevOps' },\n { value: 'documentation', label: 'Documentation' },\n { value: 'testing', label: 'Testing & QA' },\n { value: 'performance', label: 'Performance & Optimization' },\n { value: 'other', label: 'Other' },\n { value: '', label: 'None' },\n ],\n });\n\n if (p.isCancel(scopeCategory)) {\n break;\n }\n\n scopes.push({\n name: scopeName as string,\n description: scopeDescription as string,\n emoji: scopeEmoji ? (scopeEmoji as string) : undefined,\n category: scopeCategory ? (scopeCategory as any) : undefined,\n });\n\n console.log(chalk.green(`\\nā Added scope: ${scopeName}\\n`));\n\n if (scopes.length >= 3) {\n addMore = await p.confirm({\n message: `You have ${scopes.length} scopes. Add another?`,\n initialValue: scopes.length < 10,\n }) as boolean;\n\n if (p.isCancel(addMore)) {\n break;\n }\n\n if (!addMore) break;\n }\n }\n }\n\n if (scopes.length === 0) {\n p.cancel('No scopes defined. Operation cancelled.');\n process.exit(1);\n }\n\n // Validate scopes\n const validation = validateScopeDefinitions(scopes);\n if (!validation.valid) {\n console.log(chalk.red('\\nā Scope validation failed:\\n'));\n validation.errors.forEach(error => console.log(chalk.red(` ⢠${error}`)));\n p.cancel('Operation cancelled');\n process.exit(1);\n }\n\n console.log(chalk.green(`\\nā ${scopes.length} scopes validated successfully\\n`));\n\n // Determine output directory\n let outputDir: string;\n if (options.outputDir) {\n outputDir = options.outputDir;\n } else if (isMonorepo) {\n outputDir = join(cwd, 'packages', `scopes-${packageName}`);\n } else {\n const customDir = await p.text({\n message: 'Output directory:',\n placeholder: `./scopes-${packageName}`,\n defaultValue: `./scopes-${packageName}`,\n });\n\n if (p.isCancel(customDir)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n outputDir = join(cwd, customDir as string);\n }\n\n // Check if directory exists\n if (existsSync(outputDir)) {\n const shouldOverwrite = await p.confirm({\n message: `Directory ${outputDir} already exists. Overwrite?`,\n initialValue: false,\n });\n\n if (p.isCancel(shouldOverwrite) || !shouldOverwrite) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n }\n\n // Create package files\n const spinner = p.spinner();\n spinner.start('Creating package structure...');\n\n try {\n // Create directories\n await mkdir(join(outputDir, 'src'), { recursive: true });\n\n // Create package.json\n const packageJson = {\n name: `@workflow/scopes-${packageName}`,\n version: '1.0.0',\n description: `Scope preset for ${presetName}`,\n keywords: ['workflow', 'scopes', packageName, 'preset'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: `packages/scopes-${packageName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await writeFile(\n join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Create tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await writeFile(\n join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Create tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Create src/index.ts\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${JSON.stringify(scopes, null, 2)};\n\nexport const preset = {\n name: '${presetName}',\n description: 'Scope configuration for ${presetName}',\n scopes,\n version: '1.0.0',\n};\n\nexport default preset;\n`;\n\n await writeFile(join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n\n // Create test file if not disabled\n if (!options.noTest) {\n const testFile = `import { describe, it, expect } from 'vitest';\nimport { scopes, preset } from './index.js';\nimport { ScopeSchema } from '@hawkinside_out/workflow-agent/config';\n\ndescribe('${presetName} Scope Preset', () => {\n it('should export valid scopes array', () => {\n expect(scopes).toBeDefined();\n expect(Array.isArray(scopes)).toBe(true);\n expect(scopes.length).toBeGreaterThan(0);\n });\n\n it('should have valid preset object', () => {\n expect(preset).toBeDefined();\n expect(preset.name).toBe('${presetName}');\n expect(preset.scopes).toBe(scopes);\n expect(preset.version).toBeDefined();\n });\n\n it('should have no duplicate scope names', () => {\n const names = scopes.map(s => s.name);\n const uniqueNames = new Set(names);\n expect(uniqueNames.size).toBe(names.length);\n });\n\n it('should have all scopes match schema', () => {\n scopes.forEach(scope => {\n const result = ScopeSchema.safeParse(scope);\n expect(result.success).toBe(true);\n });\n });\n\n it('should have descriptions for all scopes', () => {\n scopes.forEach(scope => {\n expect(scope.description).toBeDefined();\n expect(scope.description.length).toBeGreaterThan(0);\n });\n });\n});\n`;\n\n await writeFile(join(outputDir, 'src', 'index.test.ts'), testFile, 'utf-8');\n }\n\n spinner.stop('ā Package structure created');\n\n // Update pnpm-workspace.yaml if monorepo\n if (isMonorepo) {\n const workspaceFile = join(cwd, 'pnpm-workspace.yaml');\n const workspaceContent = await readFile(workspaceFile, 'utf-8');\n \n const packagePath = `packages/scopes-${packageName}`;\n if (!workspaceContent.includes(packagePath) && !workspaceContent.includes('packages/*')) {\n console.log(chalk.yellow('\\nā ļø Add the following to pnpm-workspace.yaml:'));\n console.log(chalk.dim(` - '${packagePath}'`));\n } else {\n console.log(chalk.green('\\nā Package will be included in workspace'));\n }\n }\n\n // Success summary\n console.log(chalk.green.bold('\\n⨠Custom scope package created successfully!\\n'));\n console.log(chalk.bold('Package details:'));\n console.log(chalk.dim(` Location: ${outputDir}`));\n console.log(chalk.dim(` Package: @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` Scopes: ${scopes.length} defined\\n`));\n\n console.log(chalk.bold('Next steps:\\n'));\n console.log(chalk.dim(` 1. cd ${outputDir}`));\n console.log(chalk.dim(` 2. pnpm install`));\n console.log(chalk.dim(` 3. pnpm build`));\n if (!options.noTest) {\n console.log(chalk.dim(` 4. pnpm test`));\n }\n console.log(chalk.dim(` ${!options.noTest ? '5' : '4'}. Update repository URL in package.json`));\n \n const shouldPublish = isNonInteractive ? false : await p.confirm({\n message: '\\nWould you like instructions for publishing to npm?',\n initialValue: false,\n });\n\n if (shouldPublish && !p.isCancel(shouldPublish)) {\n console.log(chalk.bold('\\nš¦ Publishing instructions:\\n'));\n console.log(chalk.dim(' 1. npm login (or configure .npmrc with your registry)'));\n console.log(chalk.dim(' 2. Update version in package.json as needed'));\n console.log(chalk.dim(' 3. pnpm publish --access public'));\n console.log(chalk.dim(' 4. Use in other projects: pnpm add @workflow/scopes-' + packageName + '\\n'));\n }\n\n } catch (error) {\n spinner.stop('ā Failed to create package');\n console.error(chalk.red('\\nError:'), error);\n process.exit(1);\n }\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { loadConfig, hasConfig } from '../../config/index.js';\nimport { validateScopeDefinitions, type WorkflowConfig } from '../../config/schema.js';\n\ninterface ScopeMigrateOptions {\n name?: string;\n outputDir?: string;\n keepConfig?: boolean;\n}\n\nexport async function scopeMigrateCommand(options: ScopeMigrateOptions) {\n console.log(chalk.bold.cyan('\\nš Migrate Scopes to Custom Package\\n'));\n\n const cwd = process.cwd();\n\n // Check for existing config\n if (!hasConfig(cwd)) {\n p.cancel('No workflow.config.json found in current directory');\n process.exit(1);\n }\n\n // Load current config\n let config: WorkflowConfig | null = null;\n try {\n config = await loadConfig(cwd);\n } catch (error) {\n console.error(chalk.red('Failed to load config:'), error);\n process.exit(1);\n }\n\n if (!config) {\n p.cancel('Failed to load configuration');\n process.exit(1);\n }\n\n if (!config.scopes || config.scopes.length === 0) {\n p.cancel('No scopes found in workflow.config.json');\n process.exit(1);\n }\n\n console.log(chalk.dim(`Found ${config.scopes.length} scopes in workflow.config.json\\n`));\n\n // Display current scopes\n console.log(chalk.bold('Current scopes:'));\n config.scopes.forEach((scope, i) => {\n console.log(chalk.dim(` ${i + 1}. ${scope.emoji || 'ā¢'} ${scope.name} - ${scope.description}`));\n });\n console.log();\n\n const shouldContinue = await p.confirm({\n message: 'Migrate these scopes to a custom package?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n // Check for monorepo\n const isMonorepo = existsSync(join(cwd, 'pnpm-workspace.yaml'));\n if (isMonorepo) {\n console.log(chalk.dim('\\nā Detected monorepo workspace\\n'));\n }\n\n // Get package name\n const packageNameInput = options.name || await p.text({\n message: 'Package name for the scope preset:',\n placeholder: config.projectName.toLowerCase().replace(/[^a-z0-9-]/g, '-'),\n validate: (value) => {\n if (!value || value.length === 0) return 'Package name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Package name must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Package name must be 32 characters or less';\n return undefined;\n },\n });\n\n if (p.isCancel(packageNameInput)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n const packageName = packageNameInput as string;\n\n // Get preset display name\n const presetNameInput = await p.text({\n message: 'Preset display name:',\n placeholder: config.projectName,\n defaultValue: config.projectName,\n });\n\n if (p.isCancel(presetNameInput)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n const presetName = presetNameInput as string;\n\n // Validate scopes\n const validation = validateScopeDefinitions(config.scopes);\n if (!validation.valid) {\n console.log(chalk.yellow('\\nā ļø Scope validation warnings:\\n'));\n validation.errors.forEach(error => console.log(chalk.yellow(` ⢠${error}`)));\n \n const shouldFix = await p.confirm({\n message: 'Some scopes have validation issues. Continue anyway?',\n initialValue: false,\n });\n\n if (p.isCancel(shouldFix) || !shouldFix) {\n p.cancel('Migration cancelled. Please fix validation errors first.');\n process.exit(1);\n }\n }\n\n // Determine output directory\n let outputDir: string;\n if (options.outputDir) {\n outputDir = options.outputDir;\n } else if (isMonorepo) {\n outputDir = join(cwd, 'packages', `scopes-${packageName}`);\n } else {\n const customDir = await p.text({\n message: 'Output directory:',\n placeholder: `./scopes-${packageName}`,\n defaultValue: `./scopes-${packageName}`,\n });\n\n if (p.isCancel(customDir)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n outputDir = join(cwd, customDir as string);\n }\n\n // Check if directory exists\n if (existsSync(outputDir)) {\n const shouldOverwrite = await p.confirm({\n message: `Directory ${outputDir} already exists. Overwrite?`,\n initialValue: false,\n });\n\n if (p.isCancel(shouldOverwrite) || !shouldOverwrite) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n }\n\n // Create package files\n const spinner = p.spinner();\n spinner.start('Migrating scopes to package...');\n\n try {\n // Create directories\n await mkdir(join(outputDir, 'src'), { recursive: true });\n\n // Create package.json\n const packageJson = {\n name: `@workflow/scopes-${packageName}`,\n version: '1.0.0',\n description: `Migrated scope preset for ${presetName}`,\n keywords: ['workflow', 'scopes', packageName, 'preset', 'migrated'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: `packages/scopes-${packageName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await writeFile(\n join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Create tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await writeFile(\n join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Create tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Create src/index.ts with migrated scopes\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${JSON.stringify(config.scopes, null, 2)};\n\nexport const preset = {\n name: '${presetName}',\n description: 'Migrated scope configuration for ${presetName}',\n scopes,\n version: '1.0.0',\n};\n\nexport default preset;\n`;\n\n await writeFile(join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n\n // Create test file\n const testFile = `import { describe, it, expect } from 'vitest';\nimport { scopes, preset } from './index.js';\nimport { ScopeSchema } from '@hawkinside_out/workflow-agent/config';\n\ndescribe('${presetName} Scope Preset (Migrated)', () => {\n it('should export valid scopes array', () => {\n expect(scopes).toBeDefined();\n expect(Array.isArray(scopes)).toBe(true);\n expect(scopes.length).toBe(${config.scopes.length});\n });\n\n it('should have valid preset object', () => {\n expect(preset).toBeDefined();\n expect(preset.name).toBe('${presetName}');\n expect(preset.scopes).toBe(scopes);\n expect(preset.version).toBeDefined();\n });\n\n it('should have no duplicate scope names', () => {\n const names = scopes.map(s => s.name);\n const uniqueNames = new Set(names);\n expect(uniqueNames.size).toBe(names.length);\n });\n\n it('should have all scopes match schema', () => {\n scopes.forEach(scope => {\n const result = ScopeSchema.safeParse(scope);\n if (!result.success) {\n console.error(\\`Scope \"\\${scope.name}\" failed validation:\\`, result.error);\n }\n expect(result.success).toBe(true);\n });\n });\n\n it('should have descriptions for all scopes', () => {\n scopes.forEach(scope => {\n expect(scope.description).toBeDefined();\n expect(scope.description.length).toBeGreaterThan(0);\n });\n });\n});\n`;\n\n await writeFile(join(outputDir, 'src', 'index.test.ts'), testFile, 'utf-8');\n\n spinner.stop('ā Package created from migrated scopes');\n\n // Update pnpm-workspace.yaml if monorepo\n if (isMonorepo) {\n const workspaceFile = join(cwd, 'pnpm-workspace.yaml');\n const workspaceContent = await readFile(workspaceFile, 'utf-8');\n \n const packagePath = `packages/scopes-${packageName}`;\n if (!workspaceContent.includes(packagePath) && !workspaceContent.includes('packages/*')) {\n console.log(chalk.yellow('\\nā ļø Add the following to pnpm-workspace.yaml:'));\n console.log(chalk.dim(` - '${packagePath}'`));\n } else {\n console.log(chalk.green('\\nā Package will be included in workspace'));\n }\n }\n\n // Ask about updating config\n const keepConfig = options.keepConfig ?? await p.confirm({\n message: 'Remove migrated scopes from workflow.config.json?',\n initialValue: false,\n });\n\n if (!p.isCancel(keepConfig) && !keepConfig) {\n const configPath = join(cwd, 'workflow.config.json');\n const updatedConfig = {\n ...config,\n scopes: [], // Clear inline scopes\n preset: `scopes-${packageName}`, // Reference the new package\n };\n\n await writeFile(configPath, JSON.stringify(updatedConfig, null, 2), 'utf-8');\n console.log(chalk.green('ā Updated workflow.config.json'));\n console.log(chalk.dim(' ⢠Cleared inline scopes'));\n console.log(chalk.dim(` ⢠Added preset reference: scopes-${packageName}\\n`));\n }\n\n // Success summary\n console.log(chalk.green.bold('\\n⨠Migration completed successfully!\\n'));\n console.log(chalk.bold('Package details:'));\n console.log(chalk.dim(` Location: ${outputDir}`));\n console.log(chalk.dim(` Package: @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` Scopes: ${config.scopes.length} migrated\\n`));\n\n console.log(chalk.bold('Next steps:\\n'));\n console.log(chalk.dim(` 1. cd ${outputDir}`));\n console.log(chalk.dim(` 2. pnpm install`));\n console.log(chalk.dim(` 3. pnpm build`));\n console.log(chalk.dim(` 4. pnpm test`));\n console.log(chalk.dim(` 5. Update repository URL in package.json\\n`));\n\n if (!keepConfig) {\n console.log(chalk.bold('To use the migrated scopes:\\n'));\n console.log(chalk.dim(` 1. Install the package: pnpm add -w @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` 2. The preset is already referenced in workflow.config.json\\n`));\n }\n\n console.log(chalk.dim('š” Tip: You can now reuse this scope package across multiple projects!\\n'));\n\n } catch (error) {\n spinner.stop('ā Migration failed');\n console.error(chalk.red('\\nError:'), error);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,eAAe;;;ACFxB,YAAY,OAAO;AACnB,OAAO,WAAW;AAClB,SAAS,kBAAkB;AAC3B,SAAS,WAAW,aAAa;AACjC,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;;;ACL9B,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACcV,IAAM,WAAoC;AAAA,EAC/C,qBAAqB;AAAA,IACnB,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ,YAAY;AAClB,YAAMA,MAAK,MAAM,OAAO,IAAI;AAC5B,aAAOA,IAAG,WAAW,KAAK,KAAKA,IAAG,WAAW,gBAAgB,KAAKA,IAAG,WAAW,gBAAgB;AAAA,IAClG;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ,YAAY;AAClB,YAAMA,MAAK,MAAM,OAAO,IAAI;AAC5B,aAAOA,IAAG,WAAW,OAAO,MAAMA,IAAG,WAAW,gBAAgB,KAAKA,IAAG,WAAW,gBAAgB;AAAA,IACrG;AAAA,IACA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,iBAAiB,EACzB,YAAY,mDAAmD,EAC/D,SAAS,UAAU,yCAAyC,EAC5D,SAAS,WAAW,4DAA4D,EAChF,OAAO,sBAAsB,oDAAoD,EACjF,OAAO,eAAe;AAEzB,QACG,QAAQ,iBAAiB,EACzB,YAAY,+BAA+B,EAC3C,SAAS,YAAY,+BAA+B,EACpD,SAAS,SAAS,YAAY,EAC9B,SAAS,WAAW,cAAc,EAClC,OAAO,aAAa;AAEvB,QACG,QAAQ,SAAS,EACjB,YAAY,kCAAkC,EAC9C,SAAS,cAAc,6BAA6B,EACpD,OAAO,qBAAqB,uBAAuB,EACnD,OAAO,yBAAyB,2DAA2D,EAC3F,OAAO,cAAc;AAExB,QACG,QAAQ,OAAO,EACf,YAAY,sCAAsC,EAClD,OAAO,YAAY;AAEtB,QACG,QAAQ,QAAQ,EAChB,YAAY,mDAAmD,EAC/D,OAAO,aAAa;AAEvB,QACG,QAAQ,cAAc,EACtB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,0CAA0C,EAClE,OAAO,qBAAqB,kEAAkE,EAC9F,OAAO,0BAA0B,qBAAqB,EACtD,OAAO,sBAAsB,kBAAkB,EAC/C,OAAO,aAAa,2BAA2B,EAC/C,OAAO,kBAAkB;AAE5B,QACG,QAAQ,eAAe,EACvB,YAAY,2CAA2C,EACvD,OAAO,iBAAiB,6BAA6B,EACrD,OAAO,sBAAsB,kBAAkB,EAC/C,OAAO,iBAAiB,8CAA8C,EACtE,OAAO,mBAAmB;AAE7B,QAAQ,MAAM;","names":["fs","spinner","chalk","chalk","chalk","chalk","p","chalk","chalk","p","chalk","existsSync","join","p","chalk","existsSync","writeFile","mkdir","join","chalk","existsSync","join","spinner","mkdir","writeFile","p","chalk","existsSync","writeFile","mkdir","readFile","join","chalk","existsSync","join","spinner","mkdir","writeFile","readFile"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/init.ts","../../src/templates/renderer.ts","../../src/adapters/index.ts","../../src/cli/commands/validate.ts","../../src/cli/commands/config.ts","../../src/cli/commands/suggest.ts","../../src/cli/commands/doctor.ts","../../src/cli/commands/setup.ts","../../src/cli/commands/scope-create.ts","../../src/cli/commands/scope-migrate.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { initCommand } from './commands/init.js';\nimport { validateCommand } from './commands/validate.js';\nimport { configCommand } from './commands/config.js';\nimport { suggestCommand } from './commands/suggest.js';\nimport { doctorCommand } from './commands/doctor.js';\nimport { setupCommand } from './commands/setup.js';\nimport { scopeCreateCommand } from './commands/scope-create.js';\nimport { scopeMigrateCommand } from './commands/scope-migrate.js';\n\nconst program = new Command();\n\nprogram\n .name('workflow')\n .description('A self-evolving workflow management system for AI agent development')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize workflow in current project')\n .option('--migrate', 'Auto-detect existing patterns and migrate')\n .option('--workspace', 'Initialize for multiple repositories')\n .option('--preset <preset>', 'Preset to use (saas, library, api, ecommerce, cms, custom)')\n .option('--name <name>', 'Project name')\n .option('-y, --yes', 'Skip confirmation prompts')\n .action(initCommand);\n\nprogram\n .command('validate <type>')\n .description('Validate branch name, commit message, or PR title')\n .argument('<type>', 'What to validate: branch, commit, or pr')\n .argument('[value]', 'Value to validate (defaults to current branch/HEAD commit)')\n .option('--suggest-on-error', 'Offer improvement suggestions on validation errors')\n .action(validateCommand);\n\nprogram\n .command('config <action>')\n .description('Manage workflow configuration')\n .argument('<action>', 'Action: get, set, add, remove')\n .argument('[key]', 'Config key')\n .argument('[value]', 'Config value')\n .action(configCommand);\n\nprogram\n .command('suggest')\n .description('Submit an improvement suggestion')\n .argument('<feedback>', 'Your improvement suggestion')\n .option('--author <author>', 'Your name or username')\n .option('--category <category>', 'Category: feature, bug, documentation, performance, other')\n .action(suggestCommand);\n\nprogram\n .command('setup')\n .description('Add workflow scripts to package.json')\n .action(setupCommand);\n\nprogram\n .command('doctor')\n .description('Run health check and get optimization suggestions')\n .action(doctorCommand);\n\nprogram\n .command('scope:create')\n .description('Create a custom scope package')\n .option('--name <name>', 'Package name (e.g., \"fintech\", \"gaming\")')\n .option('--scopes <scopes>', 'Comma-separated scopes (format: name:description:emoji:category)')\n .option('--preset-name <preset>', 'Preset display name')\n .option('--output-dir <dir>', 'Output directory')\n .option('--no-test', 'Skip test file generation')\n .action(scopeCreateCommand);\n\nprogram\n .command('scope:migrate')\n .description('Migrate inline scopes to a custom package')\n .option('--name <name>', 'Package name for the preset')\n .option('--output-dir <dir>', 'Output directory')\n .option('--keep-config', 'Keep inline scopes in config after migration')\n .action(scopeMigrateCommand);\n\nprogram.parse();\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir } from 'fs/promises';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { hasConfig } from '../../config/index.js';\nimport { buildTemplateContext, renderTemplateDirectory, validateTemplateDirectory } from '../../templates/renderer.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport async function initCommand(options: { migrate?: boolean; workspace?: boolean; preset?: string; name?: string; yes?: boolean }) {\n console.log(chalk.bold.cyan('\\nš Workflow Agent Initialization\\n'));\n\n const cwd = process.cwd();\n const isNonInteractive = !!(options.preset && options.name);\n\n // Check if already initialized\n if (hasConfig(cwd) && !options.yes && !isNonInteractive) {\n const shouldContinue = await p.confirm({\n message: 'Workflow Agent is already configured. Continue and overwrite?',\n initialValue: false,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n }\n\n // Get project name\n const projectName = isNonInteractive ? options.name : await p.text({\n message: 'What is your project name?',\n placeholder: 'my-awesome-project',\n defaultValue: process.cwd().split('/').pop() || 'my-project',\n });\n\n if (!isNonInteractive && p.isCancel(projectName)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n // Select preset\n const preset = isNonInteractive ? options.preset : await p.select({\n message: 'Choose a scope preset for your project:',\n options: [\n { value: 'saas', label: 'š¦ SaaS Application - 17 scopes (auth, tasks, boards, sprints, etc.)' },\n { value: 'library', label: 'š Library/Package - 10 scopes (types, build, docs, examples, etc.)' },\n { value: 'api', label: 'š API/Backend - 13 scopes (auth, endpoints, models, services, etc.)' },\n { value: 'ecommerce', label: 'š E-commerce - 12 scopes (cart, products, payments, orders, etc.)' },\n { value: 'cms', label: 'š CMS - 13 scopes (content, pages, media, editor, etc.)' },\n { value: 'custom', label: '⨠Custom (define your own scopes manually)' },\n ],\n });\n\n if (!isNonInteractive && p.isCancel(preset)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n // Load preset scopes\n let scopes: Array<{ name: string; description: string; emoji?: string }> = [];\n \n if (preset !== 'custom') {\n // Import preset dynamically\n try {\n const presetModule = await import(`@workflow/scopes-${preset}`);\n scopes = presetModule.scopes || presetModule.default.scopes;\n \n const spinner = p.spinner();\n spinner.start(`Loading ${presetModule.default?.name || preset} preset`);\n await new Promise(resolve => setTimeout(resolve, 500));\n spinner.stop(`ā Loaded ${scopes.length} scopes from preset`);\n } catch (error) {\n console.log(chalk.yellow(`\\nā ļø Could not load preset package. Using basic scopes.`));\n scopes = [\n { name: 'feat', description: 'New features', emoji: 'āØ' },\n { name: 'fix', description: 'Bug fixes', emoji: 'š' },\n { name: 'docs', description: 'Documentation', emoji: 'š' },\n ];\n }\n } else {\n scopes = [\n { name: 'feat', description: 'New features', emoji: 'āØ' },\n { name: 'fix', description: 'Bug fixes', emoji: 'š' },\n { name: 'docs', description: 'Documentation', emoji: 'š' },\n ];\n console.log(chalk.dim('\\nš” Tip: Edit workflow.config.json to add your custom scopes'));\n }\n\n // Generate config\n const config = {\n projectName: projectName as string,\n scopes: scopes,\n enforcement: 'strict' as const,\n language: 'en',\n };\n\n // Write config file\n const configPath = join(cwd, 'workflow.config.json');\n await writeFile(configPath, JSON.stringify(config, null, 2));\n\n // Create .workflow directory\n const workflowDir = join(cwd, '.workflow');\n if (!existsSync(workflowDir)) {\n await mkdir(workflowDir, { recursive: true });\n }\n\n // Render guidelines from templates\n const shouldGenerateGuidelines = await p.confirm({\n message: 'Generate workflow guidelines from templates?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldGenerateGuidelines)) {\n p.cancel('Initialization cancelled');\n process.exit(0);\n }\n\n if (shouldGenerateGuidelines) {\n const spinner = p.spinner();\n spinner.start('Generating guidelines...');\n\n try {\n // Find templates directory\n // When built and installed: dist/cli/index.js -> ../../templates\n // The templates are at the package root level\n const templatesDir = join(__dirname, '../../templates');\n \n // Validate templates exist\n await validateTemplateDirectory(templatesDir);\n\n // Build context for template rendering\n const context = await buildTemplateContext(config, cwd);\n\n // Create guidelines directory\n const guidelinesDir = join(cwd, 'guidelines');\n await mkdir(guidelinesDir, { recursive: true });\n\n // Render all templates\n const renderedFiles = await renderTemplateDirectory(templatesDir, guidelinesDir, context);\n\n spinner.stop(`ā Generated ${renderedFiles.length} guideline documents`);\n } catch (error) {\n spinner.stop('ā ļø Could not generate guidelines');\n console.log(chalk.yellow(`\\nReason: ${error instanceof Error ? error.message : String(error)}`));\n console.log(chalk.dim('You can manually copy guidelines later if needed.'));\n }\n }\n\n p.outro(chalk.green('ā Workflow Agent initialized successfully!'));\n console.log(chalk.dim('\\nNext steps:'));\n console.log(chalk.dim(' 1. Review your configuration in workflow.config.json'));\n if (shouldGenerateGuidelines) {\n console.log(chalk.dim(' 2. Review generated guidelines in guidelines/ directory'));\n console.log(chalk.dim(' 3. Run: workflow validate branch'));\n console.log(chalk.dim(' 4. Run: workflow doctor (for optimization suggestions)\\n'));\n } else {\n console.log(chalk.dim(' 2. Run: workflow validate branch'));\n console.log(chalk.dim(' 3. Run: workflow doctor (for optimization suggestions)\\n'));\n }\n}\n","import fs from 'fs/promises';\nimport path from 'path';\nimport { WorkflowConfig } from '../config/schema.js';\nimport { detectAdapter, getAdapter } from '../adapters/index.js';\n\nexport interface TemplateContext {\n projectName: string;\n framework: string;\n scopes: string;\n scopeList: string;\n pathStructure: string;\n enforcement: string;\n year: string;\n // Additional context for scope package scaffolding\n scopeName?: string;\n presetName?: string;\n scopeDefinitions?: string;\n packageDirectory?: string;\n isMonorepo?: string;\n testImports?: string;\n packageVersion?: string;\n [key: string]: string | undefined;\n}\n\n/**\n * Renders a template string with provided context using simple {{variable}} syntax\n */\nexport function renderTemplate(template: string, context: TemplateContext): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key) => {\n return context[key] ?? match;\n });\n}\n\n/**\n * Builds template context from workflow config and detected framework\n */\nexport async function buildTemplateContext(\n config: WorkflowConfig,\n projectPath: string = process.cwd()\n): Promise<TemplateContext> {\n // Detect framework\n const detectedFramework = await detectAdapter();\n const adapter = getAdapter(detectedFramework);\n\n // Build scope list as markdown\n const scopeList = config.scopes\n .map(s => `- **${s.name}** - ${s.description}`)\n .join('\\n');\n\n // Build scope names list (comma-separated)\n const scopes = config.scopes.map(s => s.name).join(', ');\n\n // Build path structure from adapter\n const pathStructure = adapter ? `\n### Path Structure\n\n\\`\\`\\`\n${adapter.paths.components}/ ā UI components\n${adapter.paths.lib}/ ā Utility functions and services\n${adapter.paths.hooks}/ ā Custom React hooks\n${adapter.paths.types}/ ā TypeScript type definitions\n\\`\\`\\`\n`.trim() : 'N/A';\n\n // Get project name from package.json or directory name\n const projectName = await getProjectName(projectPath);\n\n return {\n projectName,\n framework: adapter?.name || 'unknown',\n scopes,\n scopeList,\n pathStructure,\n enforcement: config.enforcement,\n year: new Date().getFullYear().toString(),\n };\n}\n\n/**\n * Renders a template file and writes output\n */\nexport async function renderTemplateFile(\n templatePath: string,\n outputPath: string,\n context: TemplateContext\n): Promise<void> {\n const template = await fs.readFile(templatePath, 'utf-8');\n const rendered = renderTemplate(template, context);\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, rendered, 'utf-8');\n}\n\n/**\n * Renders all template files from source directory to output directory\n * Supports .md, .ts, .json file extensions\n */\nexport async function renderTemplateDirectory(\n templateDir: string,\n outputDir: string,\n context: TemplateContext\n): Promise<string[]> {\n const files = await fs.readdir(templateDir);\n const rendered: string[] = [];\n\n for (const file of files) {\n // Support .md, .ts, .json files\n if (!file.match(/\\.(md|ts|json)$/)) continue;\n\n const templatePath = path.join(templateDir, file);\n const outputPath = path.join(outputDir, file);\n\n await renderTemplateFile(templatePath, outputPath, context);\n rendered.push(file);\n }\n\n return rendered;\n}\n\n/**\n * Gets project name from package.json or directory name\n */\nasync function getProjectName(projectPath: string): Promise<string> {\n try {\n const pkgPath = path.join(projectPath, 'package.json');\n const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));\n return pkg.name || path.basename(projectPath);\n } catch {\n return path.basename(projectPath);\n }\n}\n\n/**\n * Validates that template directory exists and contains markdown files\n */\nexport async function validateTemplateDirectory(templateDir: string): Promise<void> {\n try {\n const stat = await fs.stat(templateDir);\n if (!stat.isDirectory()) {\n throw new Error(`Template path is not a directory: ${templateDir}`);\n }\n\n const files = await fs.readdir(templateDir);\n const templateFiles = files.filter(f => f.match(/\\.(md|ts|json)$/));\n\n if (templateFiles.length === 0) {\n throw new Error(`No template files found in template directory: ${templateDir}`);\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`Template directory not found: ${templateDir}`);\n }\n throw error;\n }\n}\n\n/**\n * Renders a scope package from templates\n * @param outputDir Directory to create package in\n * @param context Template context with scope-specific variables\n */\nexport async function renderScopePackage(\n outputDir: string,\n context: Required<Pick<TemplateContext, 'scopeName' | 'presetName' | 'scopeDefinitions' | 'packageVersion'>> & TemplateContext\n): Promise<void> {\n // Ensure output directory exists\n await fs.mkdir(path.join(outputDir, 'src'), { recursive: true });\n\n // Write package.json\n const packageJson = {\n name: `@workflow/scopes-${context.scopeName}`,\n version: context.packageVersion,\n description: `Scope preset for ${context.presetName}`,\n keywords: ['workflow', 'scopes', context.scopeName, 'preset'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: context.packageDirectory || `packages/scopes-${context.scopeName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await fs.writeFile(\n path.join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Write tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await fs.writeFile(\n path.join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Write tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await fs.writeFile(path.join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Write src/index.ts\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${context.scopeDefinitions};\n\nexport const preset = {\n name: '${context.presetName}',\n description: 'Scope configuration for ${context.presetName}',\n scopes,\n version: '${context.packageVersion}',\n};\n\nexport default preset;\n`;\n\n await fs.writeFile(path.join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n}\n","export interface Adapter {\n name: string;\n description: string;\n detect: () => Promise<boolean>;\n paths: {\n actions?: string;\n components?: string;\n lib?: string;\n hooks?: string;\n types?: string;\n tests?: string;\n config?: string;\n };\n}\n\nexport const adapters: Record<string, Adapter> = {\n 'nextjs-app-router': {\n name: 'Next.js App Router',\n description: 'Next.js 13+ with app directory',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('app') && fs.existsSync('next.config.ts') || fs.existsSync('next.config.js');\n },\n paths: {\n actions: 'app/actions',\n components: 'components',\n lib: 'lib',\n hooks: 'hooks',\n types: 'types',\n tests: '__tests__',\n config: 'app',\n },\n },\n \n 'nextjs-pages': {\n name: 'Next.js Pages Router',\n description: 'Next.js with pages directory',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('pages') && (fs.existsSync('next.config.ts') || fs.existsSync('next.config.js'));\n },\n paths: {\n components: 'components',\n lib: 'lib',\n hooks: 'hooks',\n types: 'types',\n tests: '__tests__',\n config: 'pages',\n },\n },\n \n 'vite-react': {\n name: 'Vite + React',\n description: 'Vite-powered React application',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('vite.config.ts') || fs.existsSync('vite.config.js');\n },\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n hooks: 'src/hooks',\n types: 'src/types',\n tests: 'src/__tests__',\n config: 'src',\n },\n },\n \n 'remix': {\n name: 'Remix',\n description: 'Remix full-stack framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('app/routes') && (fs.existsSync('remix.config.js') || fs.existsSync('package.json'));\n },\n paths: {\n components: 'app/components',\n lib: 'app/lib',\n types: 'app/types',\n tests: 'app/__tests__',\n config: 'app/root.tsx',\n },\n },\n \n 'astro': {\n name: 'Astro',\n description: 'Astro static site framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('astro.config.mjs') || fs.existsSync('astro.config.ts');\n },\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n types: 'src/types',\n tests: 'src/__tests__',\n config: 'src/pages',\n },\n },\n \n 'sveltekit': {\n name: 'SvelteKit',\n description: 'SvelteKit full-stack framework',\n detect: async () => {\n const fs = await import('fs');\n return fs.existsSync('svelte.config.js') || fs.existsSync('src/routes');\n },\n paths: {\n components: 'src/lib/components',\n lib: 'src/lib',\n types: 'src/lib/types',\n tests: 'src/lib/__tests__',\n config: 'src/routes',\n },\n },\n \n 'generic': {\n name: 'Generic Project',\n description: 'Standard project structure',\n detect: async () => true, // Always matches as fallback\n paths: {\n components: 'src/components',\n lib: 'src/lib',\n types: 'src/types',\n tests: 'tests',\n config: 'src',\n },\n },\n};\n\nexport async function detectAdapter(): Promise<string> {\n for (const [key, adapter] of Object.entries(adapters)) {\n if (key === 'generic') continue; // Skip generic, it's the fallback\n \n try {\n if (await adapter.detect()) {\n return key;\n }\n } catch {\n // Continue to next adapter\n }\n }\n \n return 'generic';\n}\n\nexport function getAdapter(name: string): Adapter | null {\n return adapters[name] || null;\n}\n","import chalk from 'chalk';\nimport { execa } from 'execa';\nimport { loadConfig } from '../../config/index.js';\nimport { validateBranchName, validateCommitMessage, validatePRTitle } from '../../validators/index.js';\n\nexport async function validateCommand(\n type: string,\n value?: string,\n _options: { suggestOnError?: boolean } = {}\n) {\n const config = await loadConfig();\n\n if (!config) {\n console.error(chalk.red('ā No workflow configuration found. Run: workflow init'));\n process.exit(1);\n }\n\n let targetValue = value;\n\n try {\n let result;\n switch (type) {\n case 'branch': {\n if (!targetValue) {\n const { stdout } = await execa('git', ['branch', '--show-current']);\n targetValue = stdout.trim();\n }\n result = await validateBranchName(targetValue, config);\n break;\n }\n\n case 'commit': {\n if (!targetValue) {\n const { stdout } = await execa('git', ['log', '-1', '--pretty=%s']);\n targetValue = stdout.trim();\n }\n result = await validateCommitMessage(targetValue, config);\n break;\n }\n\n case 'pr':\n case 'pr-title': {\n if (!targetValue) {\n console.error(chalk.red('ā PR title must be provided as argument'));\n process.exit(1);\n }\n result = await validatePRTitle(targetValue, config);\n break;\n }\n\n default:\n console.error(chalk.red(`ā Unknown validation type: ${type}`));\n console.error(chalk.dim('Valid types: branch, commit, pr'));\n process.exit(1);\n }\n\n if (result.valid) {\n console.log(chalk.green(`ā ${type} is valid: ${targetValue}`));\n process.exit(0);\n } else {\n console.error(chalk.red(`ā Invalid ${type}: ${targetValue}`));\n console.error(chalk.yellow(` ${result.error}`));\n if (result.suggestion) {\n console.error(chalk.cyan(` š” ${result.suggestion}`));\n }\n \n const enforcementLevel = config.enforcement;\n if (enforcementLevel === 'strict') {\n process.exit(1);\n } else {\n console.log(chalk.yellow(`\\nā ļø Advisory mode: validation failed but not blocking`));\n process.exit(0);\n }\n }\n } catch (error) {\n console.error(chalk.red(`ā Validation error: ${error}`));\n process.exit(1);\n }\n}\n","import chalk from 'chalk';\n\nexport async function configCommand(action: string, key?: string, value?: string) {\n console.log(chalk.yellow('Config command not yet implemented'));\n console.log({ action, key, value });\n}\n","import chalk from 'chalk';\nimport * as p from '@clack/prompts';\nimport { createTracker } from '@hawkinside_out/workflow-improvement-tracker';\n\nexport async function suggestCommand(feedback: string, options: { author?: string; category?: string } = {}) {\n console.log(chalk.cyan('š” Submitting improvement suggestion...\\n'));\n\n const tracker = createTracker();\n\n // Optionally get category if not provided\n let category = options.category;\n if (!category) {\n const categoryChoice = await p.select({\n message: 'What type of improvement is this?',\n options: [\n { value: 'feature', label: '⨠Feature Request' },\n { value: 'bug', label: 'š Bug Report' },\n { value: 'documentation', label: 'š Documentation' },\n { value: 'performance', label: 'ā” Performance' },\n { value: 'other', label: 'š” Other' },\n ],\n });\n\n if (p.isCancel(categoryChoice)) {\n p.cancel('Suggestion cancelled');\n process.exit(0);\n }\n\n category = categoryChoice as string;\n }\n\n // Submit suggestion\n const result = await tracker.submit(feedback, options.author, category);\n\n if (!result.success) {\n console.log(chalk.red('ā Suggestion rejected'));\n console.log(chalk.dim(` Reason: ${result.error}`));\n process.exit(1);\n }\n\n console.log(chalk.green('ā Suggestion submitted successfully!'));\n console.log(chalk.dim(` ID: ${result.suggestion?.id}`));\n console.log(chalk.dim(` Status: ${result.suggestion?.status}`));\n console.log(chalk.dim(` Category: ${result.suggestion?.category}`));\n console.log(chalk.dim('\\nYour suggestion will be:'));\n console.log(chalk.dim(' 1. Reviewed by the community'));\n console.log(chalk.dim(' 2. Prioritized based on impact'));\n console.log(chalk.dim(' 3. Incorporated into future releases if approved\\n'));\n}\n","import chalk from 'chalk';\nimport { loadConfig } from '../../config/index.js';\n\nexport async function doctorCommand() {\n console.log(chalk.bold.cyan('\\nš„ Workflow Agent Health Check\\n'));\n\n const config = await loadConfig();\n\n if (!config) {\n console.error(chalk.red('ā No workflow configuration found'));\n console.log(chalk.yellow(' Run: workflow init'));\n process.exit(1);\n }\n\n console.log(chalk.green('ā Configuration loaded successfully'));\n console.log(chalk.dim(` Project: ${config.projectName}`));\n console.log(chalk.dim(` Scopes: ${config.scopes.length} configured`));\n console.log(chalk.dim(` Enforcement: ${config.enforcement}`));\n console.log(chalk.dim(` Language: ${config.language}`));\n\n console.log(chalk.cyan('\\nš” Suggestions:\\n'));\n console.log(chalk.dim(' ⢠Health check analysis coming soon'));\n console.log(chalk.dim(' ⢠Git history analysis coming soon'));\n console.log(chalk.dim(' ⢠Optimization recommendations coming soon'));\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { readFileSync, writeFileSync, existsSync } from 'fs';\nimport { join } from 'path';\n\nconst WORKFLOW_SCRIPTS = {\n 'workflow:init': 'workflow-agent init',\n 'workflow:validate': 'workflow-agent validate',\n 'workflow:suggest': 'workflow-agent suggest',\n 'workflow:doctor': 'workflow-agent doctor',\n};\n\nexport async function setupCommand(): Promise<void> {\n p.intro(chalk.bgBlue(' workflow-agent setup '));\n\n const cwd = process.cwd();\n const packageJsonPath = join(cwd, 'package.json');\n\n if (!existsSync(packageJsonPath)) {\n p.cancel('No package.json found in current directory');\n process.exit(1);\n }\n\n // Read package.json\n const packageJsonContent = readFileSync(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(packageJsonContent);\n\n // Initialize scripts if needed\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n // Check which scripts already exist\n const existingScripts: string[] = [];\n const scriptsToAdd: Record<string, string> = {};\n\n for (const [scriptName, scriptCommand] of Object.entries(WORKFLOW_SCRIPTS)) {\n if (packageJson.scripts[scriptName]) {\n existingScripts.push(scriptName);\n } else {\n scriptsToAdd[scriptName] = scriptCommand;\n }\n }\n\n if (Object.keys(scriptsToAdd).length === 0) {\n p.outro(chalk.green('ā All workflow scripts are already configured!'));\n return;\n }\n\n // Show what will be added\n console.log(chalk.dim('\\nScripts to add:'));\n for (const [scriptName, scriptCommand] of Object.entries(scriptsToAdd)) {\n console.log(chalk.dim(` ${scriptName}: ${scriptCommand}`));\n }\n\n if (existingScripts.length > 0) {\n console.log(chalk.yellow('\\nExisting scripts (will be skipped):'));\n existingScripts.forEach((name) => {\n console.log(chalk.yellow(` ${name}`));\n });\n }\n\n const shouldAdd = await p.confirm({\n message: 'Add these scripts to package.json?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldAdd) || !shouldAdd) {\n p.cancel('Setup cancelled');\n process.exit(0);\n }\n\n // Add scripts\n for (const [scriptName, scriptCommand] of Object.entries(scriptsToAdd)) {\n packageJson.scripts[scriptName] = scriptCommand;\n }\n\n // Write back to package.json\n writeFileSync(\n packageJsonPath,\n JSON.stringify(packageJson, null, 2) + '\\n',\n 'utf-8'\n );\n\n p.outro(chalk.green(`ā Added ${Object.keys(scriptsToAdd).length} workflow scripts to package.json!`));\n console.log(chalk.dim('\\nRun them with:'));\n console.log(chalk.dim(' pnpm run workflow:init'));\n console.log(chalk.dim(' npm run workflow:init\\n'));\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { validateScopeDefinitions, type Scope } from '../../config/schema.js';\n\ninterface ScopeCreateOptions {\n name?: string;\n scopes?: string;\n presetName?: string;\n outputDir?: string;\n noTest?: boolean;\n}\n\nexport async function scopeCreateCommand(options: ScopeCreateOptions) {\n console.log(chalk.bold.cyan('\\nšØ Create Custom Scope Package\\n'));\n\n const cwd = process.cwd();\n const isNonInteractive = !!(options.name && options.scopes && options.presetName);\n\n // Check for monorepo\n const isMonorepo = existsSync(join(cwd, 'pnpm-workspace.yaml'));\n if (isMonorepo) {\n console.log(chalk.dim('ā Detected monorepo workspace\\n'));\n }\n\n // Get package name\n const packageNameInput = isNonInteractive ? options.name : await p.text({\n message: 'What is the package name? (e.g., \"fintech\", \"gaming\", \"healthcare\")',\n placeholder: 'my-custom-scope',\n validate: (value) => {\n if (!value || value.length === 0) return 'Package name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Package name must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Package name must be 32 characters or less';\n return undefined;\n },\n });\n\n if (!isNonInteractive && p.isCancel(packageNameInput)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n const packageName = packageNameInput as string;\n\n // Get preset display name\n const presetNameInput = isNonInteractive ? options.presetName : await p.text({\n message: 'What is the preset display name? (e.g., \"FinTech Application\", \"Gaming Platform\")',\n placeholder: 'My Custom Preset',\n validate: (value) => {\n if (!value || value.length === 0) return 'Preset name is required';\n return undefined;\n },\n });\n\n if (!isNonInteractive && p.isCancel(presetNameInput)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n const presetName = presetNameInput as string;\n\n // Collect scopes\n const scopes: Scope[] = [];\n \n if (isNonInteractive && options.scopes) {\n // Parse scopes from command line (format: \"name:description:emoji:category,...\")\n const scopeParts = options.scopes.split(',');\n for (const part of scopeParts) {\n const [name, description, emoji, category] = part.split(':');\n scopes.push({\n name: name.trim(),\n description: description?.trim() || 'Scope description',\n emoji: emoji?.trim(),\n category: category?.trim() as any,\n });\n }\n } else {\n console.log(chalk.dim('\\nAdd scopes to your preset (aim for 8-15 scopes):\\n'));\n \n let addMore = true;\n while (addMore) {\n const scopeName = await p.text({\n message: `Scope #${scopes.length + 1} - Name:`,\n placeholder: 'auth',\n validate: (value) => {\n if (!value || value.length === 0) return 'Scope name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Must be 32 characters or less';\n if (scopes.some(s => s.name === value)) return 'Scope name already exists';\n return undefined;\n },\n });\n\n if (p.isCancel(scopeName)) {\n break;\n }\n\n const scopeDescription = await p.text({\n message: 'Description:',\n placeholder: 'Authentication and authorization',\n validate: (value) => {\n if (!value || value.length < 10) return 'Description must be at least 10 characters';\n return undefined;\n },\n });\n\n if (p.isCancel(scopeDescription)) {\n break;\n }\n\n const scopeEmoji = await p.text({\n message: 'Emoji (optional):',\n placeholder: 'š',\n });\n\n if (p.isCancel(scopeEmoji)) {\n break;\n }\n\n const scopeCategory = await p.select({\n message: 'Category (optional):',\n options: [\n { value: 'auth', label: 'Authentication & Authorization' },\n { value: 'features', label: 'Features & Functionality' },\n { value: 'infrastructure', label: 'Infrastructure & DevOps' },\n { value: 'documentation', label: 'Documentation' },\n { value: 'testing', label: 'Testing & QA' },\n { value: 'performance', label: 'Performance & Optimization' },\n { value: 'other', label: 'Other' },\n { value: '', label: 'None' },\n ],\n });\n\n if (p.isCancel(scopeCategory)) {\n break;\n }\n\n scopes.push({\n name: scopeName as string,\n description: scopeDescription as string,\n emoji: scopeEmoji ? (scopeEmoji as string) : undefined,\n category: scopeCategory ? (scopeCategory as any) : undefined,\n });\n\n console.log(chalk.green(`\\nā Added scope: ${scopeName}\\n`));\n\n if (scopes.length >= 3) {\n addMore = await p.confirm({\n message: `You have ${scopes.length} scopes. Add another?`,\n initialValue: scopes.length < 10,\n }) as boolean;\n\n if (p.isCancel(addMore)) {\n break;\n }\n\n if (!addMore) break;\n }\n }\n }\n\n if (scopes.length === 0) {\n p.cancel('No scopes defined. Operation cancelled.');\n process.exit(1);\n }\n\n // Validate scopes\n const validation = validateScopeDefinitions(scopes);\n if (!validation.valid) {\n console.log(chalk.red('\\nā Scope validation failed:\\n'));\n validation.errors.forEach(error => console.log(chalk.red(` ⢠${error}`)));\n p.cancel('Operation cancelled');\n process.exit(1);\n }\n\n console.log(chalk.green(`\\nā ${scopes.length} scopes validated successfully\\n`));\n\n // Determine output directory\n let outputDir: string;\n if (options.outputDir) {\n outputDir = options.outputDir;\n } else if (isMonorepo) {\n outputDir = join(cwd, 'packages', `scopes-${packageName}`);\n } else {\n const customDir = await p.text({\n message: 'Output directory:',\n placeholder: `./scopes-${packageName}`,\n defaultValue: `./scopes-${packageName}`,\n });\n\n if (p.isCancel(customDir)) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n\n outputDir = join(cwd, customDir as string);\n }\n\n // Check if directory exists\n if (existsSync(outputDir)) {\n const shouldOverwrite = await p.confirm({\n message: `Directory ${outputDir} already exists. Overwrite?`,\n initialValue: false,\n });\n\n if (p.isCancel(shouldOverwrite) || !shouldOverwrite) {\n p.cancel('Operation cancelled');\n process.exit(0);\n }\n }\n\n // Create package files\n const spinner = p.spinner();\n spinner.start('Creating package structure...');\n\n try {\n // Create directories\n await mkdir(join(outputDir, 'src'), { recursive: true });\n\n // Create package.json\n const packageJson = {\n name: `@workflow/scopes-${packageName}`,\n version: '1.0.0',\n description: `Scope preset for ${presetName}`,\n keywords: ['workflow', 'scopes', packageName, 'preset'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: `packages/scopes-${packageName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await writeFile(\n join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Create tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await writeFile(\n join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Create tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Create src/index.ts\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${JSON.stringify(scopes, null, 2)};\n\nexport const preset = {\n name: '${presetName}',\n description: 'Scope configuration for ${presetName}',\n scopes,\n version: '1.0.0',\n};\n\nexport default preset;\n`;\n\n await writeFile(join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n\n // Create test file if not disabled\n if (!options.noTest) {\n const testFile = `import { describe, it, expect } from 'vitest';\nimport { scopes, preset } from './index.js';\nimport { ScopeSchema } from '@hawkinside_out/workflow-agent/config';\n\ndescribe('${presetName} Scope Preset', () => {\n it('should export valid scopes array', () => {\n expect(scopes).toBeDefined();\n expect(Array.isArray(scopes)).toBe(true);\n expect(scopes.length).toBeGreaterThan(0);\n });\n\n it('should have valid preset object', () => {\n expect(preset).toBeDefined();\n expect(preset.name).toBe('${presetName}');\n expect(preset.scopes).toBe(scopes);\n expect(preset.version).toBeDefined();\n });\n\n it('should have no duplicate scope names', () => {\n const names = scopes.map(s => s.name);\n const uniqueNames = new Set(names);\n expect(uniqueNames.size).toBe(names.length);\n });\n\n it('should have all scopes match schema', () => {\n scopes.forEach(scope => {\n const result = ScopeSchema.safeParse(scope);\n expect(result.success).toBe(true);\n });\n });\n\n it('should have descriptions for all scopes', () => {\n scopes.forEach(scope => {\n expect(scope.description).toBeDefined();\n expect(scope.description.length).toBeGreaterThan(0);\n });\n });\n});\n`;\n\n await writeFile(join(outputDir, 'src', 'index.test.ts'), testFile, 'utf-8');\n }\n\n spinner.stop('ā Package structure created');\n\n // Update pnpm-workspace.yaml if monorepo\n if (isMonorepo) {\n const workspaceFile = join(cwd, 'pnpm-workspace.yaml');\n const workspaceContent = await readFile(workspaceFile, 'utf-8');\n \n const packagePath = `packages/scopes-${packageName}`;\n if (!workspaceContent.includes(packagePath) && !workspaceContent.includes('packages/*')) {\n console.log(chalk.yellow('\\nā ļø Add the following to pnpm-workspace.yaml:'));\n console.log(chalk.dim(` - '${packagePath}'`));\n } else {\n console.log(chalk.green('\\nā Package will be included in workspace'));\n }\n }\n\n // Success summary\n console.log(chalk.green.bold('\\n⨠Custom scope package created successfully!\\n'));\n console.log(chalk.bold('Package details:'));\n console.log(chalk.dim(` Location: ${outputDir}`));\n console.log(chalk.dim(` Package: @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` Scopes: ${scopes.length} defined\\n`));\n\n console.log(chalk.bold('Next steps:\\n'));\n console.log(chalk.dim(` 1. cd ${outputDir}`));\n console.log(chalk.dim(` 2. pnpm install`));\n console.log(chalk.dim(` 3. pnpm build`));\n if (!options.noTest) {\n console.log(chalk.dim(` 4. pnpm test`));\n }\n console.log(chalk.dim(` ${!options.noTest ? '5' : '4'}. Update repository URL in package.json`));\n \n const shouldPublish = isNonInteractive ? false : await p.confirm({\n message: '\\nWould you like instructions for publishing to npm?',\n initialValue: false,\n });\n\n if (shouldPublish && !p.isCancel(shouldPublish)) {\n console.log(chalk.bold('\\nš¦ Publishing instructions:\\n'));\n console.log(chalk.dim(' 1. npm login (or configure .npmrc with your registry)'));\n console.log(chalk.dim(' 2. Update version in package.json as needed'));\n console.log(chalk.dim(' 3. pnpm publish --access public'));\n console.log(chalk.dim(' 4. Use in other projects: pnpm add @workflow/scopes-' + packageName + '\\n'));\n }\n\n } catch (error) {\n spinner.stop('ā Failed to create package');\n console.error(chalk.red('\\nError:'), error);\n process.exit(1);\n }\n}\n","import * as p from '@clack/prompts';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { writeFile, mkdir, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { loadConfig, hasConfig } from '../../config/index.js';\nimport { validateScopeDefinitions, type WorkflowConfig } from '../../config/schema.js';\n\ninterface ScopeMigrateOptions {\n name?: string;\n outputDir?: string;\n keepConfig?: boolean;\n}\n\nexport async function scopeMigrateCommand(options: ScopeMigrateOptions) {\n console.log(chalk.bold.cyan('\\nš Migrate Scopes to Custom Package\\n'));\n\n const cwd = process.cwd();\n\n // Check for existing config\n if (!hasConfig(cwd)) {\n p.cancel('No workflow.config.json found in current directory');\n process.exit(1);\n }\n\n // Load current config\n let config: WorkflowConfig | null = null;\n try {\n config = await loadConfig(cwd);\n } catch (error) {\n console.error(chalk.red('Failed to load config:'), error);\n process.exit(1);\n }\n\n if (!config) {\n p.cancel('Failed to load configuration');\n process.exit(1);\n }\n\n if (!config.scopes || config.scopes.length === 0) {\n p.cancel('No scopes found in workflow.config.json');\n process.exit(1);\n }\n\n console.log(chalk.dim(`Found ${config.scopes.length} scopes in workflow.config.json\\n`));\n\n // Display current scopes\n console.log(chalk.bold('Current scopes:'));\n config.scopes.forEach((scope, i) => {\n console.log(chalk.dim(` ${i + 1}. ${scope.emoji || 'ā¢'} ${scope.name} - ${scope.description}`));\n });\n console.log();\n\n const shouldContinue = await p.confirm({\n message: 'Migrate these scopes to a custom package?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n // Check for monorepo\n const isMonorepo = existsSync(join(cwd, 'pnpm-workspace.yaml'));\n if (isMonorepo) {\n console.log(chalk.dim('\\nā Detected monorepo workspace\\n'));\n }\n\n // Get package name\n const packageNameInput = options.name || await p.text({\n message: 'Package name for the scope preset:',\n placeholder: config.projectName.toLowerCase().replace(/[^a-z0-9-]/g, '-'),\n validate: (value) => {\n if (!value || value.length === 0) return 'Package name is required';\n if (!/^[a-z0-9-]+$/.test(value)) return 'Package name must be lowercase alphanumeric with hyphens';\n if (value.length > 32) return 'Package name must be 32 characters or less';\n return undefined;\n },\n });\n\n if (p.isCancel(packageNameInput)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n const packageName = packageNameInput as string;\n\n // Get preset display name\n const presetNameInput = await p.text({\n message: 'Preset display name:',\n placeholder: config.projectName,\n defaultValue: config.projectName,\n });\n\n if (p.isCancel(presetNameInput)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n const presetName = presetNameInput as string;\n\n // Validate scopes\n const validation = validateScopeDefinitions(config.scopes);\n if (!validation.valid) {\n console.log(chalk.yellow('\\nā ļø Scope validation warnings:\\n'));\n validation.errors.forEach(error => console.log(chalk.yellow(` ⢠${error}`)));\n \n const shouldFix = await p.confirm({\n message: 'Some scopes have validation issues. Continue anyway?',\n initialValue: false,\n });\n\n if (p.isCancel(shouldFix) || !shouldFix) {\n p.cancel('Migration cancelled. Please fix validation errors first.');\n process.exit(1);\n }\n }\n\n // Determine output directory\n let outputDir: string;\n if (options.outputDir) {\n outputDir = options.outputDir;\n } else if (isMonorepo) {\n outputDir = join(cwd, 'packages', `scopes-${packageName}`);\n } else {\n const customDir = await p.text({\n message: 'Output directory:',\n placeholder: `./scopes-${packageName}`,\n defaultValue: `./scopes-${packageName}`,\n });\n\n if (p.isCancel(customDir)) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n\n outputDir = join(cwd, customDir as string);\n }\n\n // Check if directory exists\n if (existsSync(outputDir)) {\n const shouldOverwrite = await p.confirm({\n message: `Directory ${outputDir} already exists. Overwrite?`,\n initialValue: false,\n });\n\n if (p.isCancel(shouldOverwrite) || !shouldOverwrite) {\n p.cancel('Migration cancelled');\n process.exit(0);\n }\n }\n\n // Create package files\n const spinner = p.spinner();\n spinner.start('Migrating scopes to package...');\n\n try {\n // Create directories\n await mkdir(join(outputDir, 'src'), { recursive: true });\n\n // Create package.json\n const packageJson = {\n name: `@workflow/scopes-${packageName}`,\n version: '1.0.0',\n description: `Migrated scope preset for ${presetName}`,\n keywords: ['workflow', 'scopes', packageName, 'preset', 'migrated'],\n repository: {\n type: 'git',\n url: 'git+https://github.com/your-org/your-repo.git',\n directory: `packages/scopes-${packageName}`,\n },\n license: 'MIT',\n author: 'Your Name',\n type: 'module',\n exports: {\n '.': {\n types: './dist/index.d.ts',\n import: './dist/index.js',\n },\n },\n files: ['dist'],\n scripts: {\n build: 'tsup',\n dev: 'tsup --watch',\n typecheck: 'tsc --noEmit',\n test: 'vitest run',\n },\n peerDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n },\n devDependencies: {\n '@hawkinside_out/workflow-agent': '^1.0.0',\n tsup: '^8.0.1',\n typescript: '^5.3.3',\n vitest: '^1.0.0',\n },\n publishConfig: {\n access: 'public',\n },\n };\n\n await writeFile(\n join(outputDir, 'package.json'),\n JSON.stringify(packageJson, null, 2),\n 'utf-8'\n );\n\n // Create tsconfig.json\n const tsconfig = {\n extends: '../../tsconfig.json',\n compilerOptions: {\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n };\n\n await writeFile(\n join(outputDir, 'tsconfig.json'),\n JSON.stringify(tsconfig, null, 2),\n 'utf-8'\n );\n\n // Create tsup.config.ts\n const tsupConfig = `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(join(outputDir, 'tsup.config.ts'), tsupConfig, 'utf-8');\n\n // Create src/index.ts with migrated scopes\n const indexTs = `import type { Scope } from '@hawkinside_out/workflow-agent/config';\n\nexport const scopes: Scope[] = ${JSON.stringify(config.scopes, null, 2)};\n\nexport const preset = {\n name: '${presetName}',\n description: 'Migrated scope configuration for ${presetName}',\n scopes,\n version: '1.0.0',\n};\n\nexport default preset;\n`;\n\n await writeFile(join(outputDir, 'src', 'index.ts'), indexTs, 'utf-8');\n\n // Create test file\n const testFile = `import { describe, it, expect } from 'vitest';\nimport { scopes, preset } from './index.js';\nimport { ScopeSchema } from '@hawkinside_out/workflow-agent/config';\n\ndescribe('${presetName} Scope Preset (Migrated)', () => {\n it('should export valid scopes array', () => {\n expect(scopes).toBeDefined();\n expect(Array.isArray(scopes)).toBe(true);\n expect(scopes.length).toBe(${config.scopes.length});\n });\n\n it('should have valid preset object', () => {\n expect(preset).toBeDefined();\n expect(preset.name).toBe('${presetName}');\n expect(preset.scopes).toBe(scopes);\n expect(preset.version).toBeDefined();\n });\n\n it('should have no duplicate scope names', () => {\n const names = scopes.map(s => s.name);\n const uniqueNames = new Set(names);\n expect(uniqueNames.size).toBe(names.length);\n });\n\n it('should have all scopes match schema', () => {\n scopes.forEach(scope => {\n const result = ScopeSchema.safeParse(scope);\n if (!result.success) {\n console.error(\\`Scope \"\\${scope.name}\" failed validation:\\`, result.error);\n }\n expect(result.success).toBe(true);\n });\n });\n\n it('should have descriptions for all scopes', () => {\n scopes.forEach(scope => {\n expect(scope.description).toBeDefined();\n expect(scope.description.length).toBeGreaterThan(0);\n });\n });\n});\n`;\n\n await writeFile(join(outputDir, 'src', 'index.test.ts'), testFile, 'utf-8');\n\n spinner.stop('ā Package created from migrated scopes');\n\n // Update pnpm-workspace.yaml if monorepo\n if (isMonorepo) {\n const workspaceFile = join(cwd, 'pnpm-workspace.yaml');\n const workspaceContent = await readFile(workspaceFile, 'utf-8');\n \n const packagePath = `packages/scopes-${packageName}`;\n if (!workspaceContent.includes(packagePath) && !workspaceContent.includes('packages/*')) {\n console.log(chalk.yellow('\\nā ļø Add the following to pnpm-workspace.yaml:'));\n console.log(chalk.dim(` - '${packagePath}'`));\n } else {\n console.log(chalk.green('\\nā Package will be included in workspace'));\n }\n }\n\n // Ask about updating config\n const keepConfig = options.keepConfig ?? await p.confirm({\n message: 'Remove migrated scopes from workflow.config.json?',\n initialValue: false,\n });\n\n if (!p.isCancel(keepConfig) && !keepConfig) {\n const configPath = join(cwd, 'workflow.config.json');\n const updatedConfig = {\n ...config,\n scopes: [], // Clear inline scopes\n preset: `scopes-${packageName}`, // Reference the new package\n };\n\n await writeFile(configPath, JSON.stringify(updatedConfig, null, 2), 'utf-8');\n console.log(chalk.green('ā Updated workflow.config.json'));\n console.log(chalk.dim(' ⢠Cleared inline scopes'));\n console.log(chalk.dim(` ⢠Added preset reference: scopes-${packageName}\\n`));\n }\n\n // Success summary\n console.log(chalk.green.bold('\\n⨠Migration completed successfully!\\n'));\n console.log(chalk.bold('Package details:'));\n console.log(chalk.dim(` Location: ${outputDir}`));\n console.log(chalk.dim(` Package: @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` Scopes: ${config.scopes.length} migrated\\n`));\n\n console.log(chalk.bold('Next steps:\\n'));\n console.log(chalk.dim(` 1. cd ${outputDir}`));\n console.log(chalk.dim(` 2. pnpm install`));\n console.log(chalk.dim(` 3. pnpm build`));\n console.log(chalk.dim(` 4. pnpm test`));\n console.log(chalk.dim(` 5. Update repository URL in package.json\\n`));\n\n if (!keepConfig) {\n console.log(chalk.bold('To use the migrated scopes:\\n'));\n console.log(chalk.dim(` 1. Install the package: pnpm add -w @workflow/scopes-${packageName}`));\n console.log(chalk.dim(` 2. The preset is already referenced in workflow.config.json\\n`));\n }\n\n console.log(chalk.dim('š” Tip: You can now reuse this scope package across multiple projects!\\n'));\n\n } catch (error) {\n spinner.stop('ā Migration failed');\n console.error(chalk.red('\\nError:'), error);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,eAAe;;;ACFxB,YAAY,OAAO;AACnB,OAAO,WAAW;AAClB,SAAS,kBAAkB;AAC3B,SAAS,WAAW,aAAa;AACjC,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;;;ACL9B,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACcV,IAAM,WAAoC;AAAA,EAC/C,qBAAqB;AAAA,IACnB,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ,YAAY;AAClB,YAAMA,MAAK,MAA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a,2BAA2B,EAC/C,OAAO,kBAAkB;AAE5B,QACG,QAAQ,eAAe,EACvB,YAAY,2CAA2C,EACvD,OAAO,iBAAiB,6BAA6B,EACrD,OAAO,sBAAsB,kBAAkB,EAC/C,OAAO,iBAAiB,8CAA8C,EACtE,OAAO,mBAAmB;AAE7B,QAAQ,MAAM;","names":["fs","spinner","chalk","chalk","chalk","chalk","p","chalk","chalk","p","chalk","existsSync","join","p","chalk","existsSync","writeFile","mkdir","join","chalk","existsSync","join","spinner","mkdir","writeFile","p","chalk","existsSync","writeFile","mkdir","readFile","join","chalk","existsSync","join","spinner","mkdir","writeFile","readFile"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workflow-agent-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "A self-evolving workflow management system for AI agent development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"workflow",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
|
-
"templates"
|
|
41
|
+
"templates",
|
|
42
|
+
"README.md"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsup",
|