wize-dev-kit 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -1
- package/README.md +64 -0
- package/package.json +1 -1
- package/src/app-overlay/playbooks/apple-hig.md +112 -0
- package/src/app-overlay/playbooks/detox-maestro.md +179 -0
- package/src/app-overlay/playbooks/device-matrix.md +121 -0
- package/src/app-overlay/playbooks/material-design-3.md +135 -0
- package/src/app-overlay/playbooks/mobile-perf-budgets.md +145 -0
- package/src/app-overlay/playbooks/permissions-ux.md +147 -0
- package/src/app-overlay/playbooks/touch-targets-and-gestures.md +127 -0
- package/src/app-overlay/stack-catalog.md +178 -0
- package/src/method-skills/1-analysis/wize-document-project/workflow.md +147 -20
- package/src/method-skills/1-analysis/wize-prfaq/workflow.md +150 -11
- package/src/method-skills/1-analysis/wize-product-brief/workflow.md +90 -19
- package/src/method-skills/1-analysis/wize-research/workflow.md +101 -9
- package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +80 -16
- package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +132 -23
- package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +132 -28
- package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +91 -15
- package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +106 -12
- package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +101 -11
- package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +197 -29
- package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +127 -12
- package/src/method-skills/3-solutioning/wize-design-system/workflow.md +182 -22
- package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +142 -16
- package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +127 -21
- package/src/method-skills/4-implementation/wize-code-review/workflow.md +105 -10
- package/src/method-skills/4-implementation/wize-create-story/workflow.md +131 -10
- package/src/method-skills/4-implementation/wize-dev-story/workflow.md +115 -17
- package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +109 -18
- package/src/method-skills/4-implementation/wize-retrospective/workflow.md +112 -10
- package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +85 -10
- package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +96 -11
- package/src/tea-skills/wize-tea-design/workflow.md +104 -13
- package/src/tea-skills/wize-tea-gate/workflow.md +108 -25
- package/src/tea-skills/wize-tea-nfr/workflow.md +104 -14
- package/src/tea-skills/wize-tea-review/workflow.md +107 -13
- package/src/tea-skills/wize-tea-risk/workflow.md +99 -10
- package/src/tea-skills/wize-tea-trace/workflow.md +83 -12
- package/src/web-overlay/playbooks/playwright-vitest.md +211 -0
- package/src/web-overlay/playbooks/responsive-breakpoints.md +104 -0
- package/src/web-overlay/playbooks/semantic-html.md +114 -0
- package/src/web-overlay/playbooks/wcag-aa.md +97 -0
- package/src/web-overlay/playbooks/web-perf-budgets.md +140 -0
- package/src/web-overlay/stack-catalog.md +208 -0
- package/tools/installer/commands/agent.js +197 -0
- package/tools/installer/commands/sync.js +45 -0
- package/tools/installer/commands/update.js +172 -0
- package/tools/installer/wize-cli.js +24 -8
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
catalog: web-stack
|
|
3
|
+
owner: wize-agent-architect # Tony (with Fury on strategy)
|
|
4
|
+
applies_when: web-overlay active
|
|
5
|
+
status: ready
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Web Stack Catalog — Tony's Reference
|
|
9
|
+
|
|
10
|
+
Tony reads this during the architecture interview. The catalog is opinionated but lists trade-offs honestly; the final pick depends on the PRD audience, Fury's NFR budget, and team comfort.
|
|
11
|
+
|
|
12
|
+
## 1. Decision dimensions
|
|
13
|
+
|
|
14
|
+
Pick by **dimension order**, not "which framework I like":
|
|
15
|
+
|
|
16
|
+
1. **Audience reach** — public marketing + SEO, or authenticated app?
|
|
17
|
+
2. **Latency budget** — sub-1s LCP on 3G, or richer-but-slower OK?
|
|
18
|
+
3. **Team familiarity** — favor the boring choice the team has shipped before.
|
|
19
|
+
4. **Backend coupling** — separate API, fullstack monolith, or BaaS?
|
|
20
|
+
5. **Deploy target** — edge platform, container, or self-managed?
|
|
21
|
+
|
|
22
|
+
## 2. Front-end frameworks
|
|
23
|
+
|
|
24
|
+
### Next.js (React)
|
|
25
|
+
|
|
26
|
+
| | |
|
|
27
|
+
|---|---|
|
|
28
|
+
| **Pick when** | SEO-critical pages + product app in one codebase. Strong ecosystem. |
|
|
29
|
+
| **Strengths** | App Router (RSC), edge runtime, ISR, large hiring pool. |
|
|
30
|
+
| **Costs** | RSC mental model still maturing; vendor lock-in toward Vercel optional but present. |
|
|
31
|
+
| **Bundle baseline** | React runtime ~45 KB gz + framework code. |
|
|
32
|
+
| **Best for** | Public products needing SEO + auth product behind same domain. |
|
|
33
|
+
|
|
34
|
+
### Nuxt 3 (Vue)
|
|
35
|
+
|
|
36
|
+
| | |
|
|
37
|
+
|---|---|
|
|
38
|
+
| **Pick when** | Vue-shop wanting Next-tier DX. |
|
|
39
|
+
| **Strengths** | Composition API ergonomics, auto-imports, modules ecosystem. |
|
|
40
|
+
| **Costs** | Smaller third-party SDK coverage than React. |
|
|
41
|
+
| **Bundle baseline** | Vue runtime ~30 KB gz. |
|
|
42
|
+
| **Best for** | Marketing + dashboard hybrid where Vue is the team's stack. |
|
|
43
|
+
|
|
44
|
+
### SvelteKit
|
|
45
|
+
|
|
46
|
+
| | |
|
|
47
|
+
|---|---|
|
|
48
|
+
| **Pick when** | Smallest runtime + fastest TTI. |
|
|
49
|
+
| **Strengths** | Compile-to-no-runtime, intuitive reactivity, edge-first. |
|
|
50
|
+
| **Costs** | Smaller hiring pool, fewer enterprise integrations. |
|
|
51
|
+
| **Bundle baseline** | ~0 KB framework runtime; only your code. |
|
|
52
|
+
| **Best for** | Latency-sensitive products, content-heavy + interactive. |
|
|
53
|
+
|
|
54
|
+
### Astro
|
|
55
|
+
|
|
56
|
+
| | |
|
|
57
|
+
|---|---|
|
|
58
|
+
| **Pick when** | Content-first (docs, marketing, blog) with islands of interactivity. |
|
|
59
|
+
| **Strengths** | Zero-JS by default; mix frameworks per island. |
|
|
60
|
+
| **Costs** | Not a SPA; not the right tool for heavy state apps. |
|
|
61
|
+
| **Bundle baseline** | ~0 KB unless you opt into an island. |
|
|
62
|
+
| **Best for** | Marketing sites, docs portals, mostly-static products. |
|
|
63
|
+
|
|
64
|
+
### Remix
|
|
65
|
+
|
|
66
|
+
| | |
|
|
67
|
+
|---|---|
|
|
68
|
+
| **Pick when** | Forms + nested routes + progressive enhancement matter. |
|
|
69
|
+
| **Strengths** | Web fundamentals first; great for "works without JS" requirements. |
|
|
70
|
+
| **Costs** | Smaller community than Next; some patterns ported back to Next. |
|
|
71
|
+
| **Bundle baseline** | React runtime + Remix glue. |
|
|
72
|
+
| **Best for** | Form-heavy apps (admin, e-commerce flows). |
|
|
73
|
+
|
|
74
|
+
### SPAs without SSR (CRA-style, Vite + React/Vue/Svelte)
|
|
75
|
+
|
|
76
|
+
| | |
|
|
77
|
+
|---|---|
|
|
78
|
+
| **Pick when** | Authenticated app behind login; SEO not required. |
|
|
79
|
+
| **Strengths** | Simplest mental model; fast iteration. |
|
|
80
|
+
| **Costs** | Slow LCP for first-time visitors; no SEO. |
|
|
81
|
+
| **Best for** | Internal tools, dashboards, B2B authenticated apps. |
|
|
82
|
+
|
|
83
|
+
### Laravel + Vue (Inertia)
|
|
84
|
+
|
|
85
|
+
| | |
|
|
86
|
+
|---|---|
|
|
87
|
+
| **Pick when** | PHP back-end exists + team is PHP-fluent. |
|
|
88
|
+
| **Strengths** | Server-rendered routing + SPA UX; great DX in monolith mode. |
|
|
89
|
+
| **Costs** | PHP hosting realities; smaller real-time ecosystem. |
|
|
90
|
+
| **Best for** | Brownfield Laravel apps modernizing the front-end. |
|
|
91
|
+
|
|
92
|
+
## 3. Back-end / data layer
|
|
93
|
+
|
|
94
|
+
### Supabase
|
|
95
|
+
|
|
96
|
+
| | |
|
|
97
|
+
|---|---|
|
|
98
|
+
| **Pick when** | Need Postgres + auth + storage + realtime with low setup. |
|
|
99
|
+
| **Strengths** | Full Postgres power, RLS, edge functions, GoTrue auth. |
|
|
100
|
+
| **Costs** | Lock-in to Supabase service surface (mitigated by being Postgres underneath). |
|
|
101
|
+
|
|
102
|
+
### PlanetScale / Neon (managed Postgres)
|
|
103
|
+
|
|
104
|
+
| | |
|
|
105
|
+
|---|---|
|
|
106
|
+
| **Pick when** | Need managed serverless Postgres without the rest of Supabase. |
|
|
107
|
+
| **Strengths** | Branching DBs, generous free tiers, edge-friendly. |
|
|
108
|
+
| **Costs** | You ship your own auth, storage, realtime. |
|
|
109
|
+
|
|
110
|
+
### Drizzle ORM
|
|
111
|
+
|
|
112
|
+
| | |
|
|
113
|
+
|---|---|
|
|
114
|
+
| **Pick when** | TypeScript-first ORM, edge-runtime compatibility matters. |
|
|
115
|
+
| **Strengths** | Tiny runtime, SQL-y; great for serverless. |
|
|
116
|
+
| **Costs** | Smaller ecosystem than Prisma. |
|
|
117
|
+
|
|
118
|
+
### Prisma
|
|
119
|
+
|
|
120
|
+
| | |
|
|
121
|
+
|---|---|
|
|
122
|
+
| **Pick when** | Larger team; tooling and migrations are paramount. |
|
|
123
|
+
| **Strengths** | Excellent migrations, generated client, mature ecosystem. |
|
|
124
|
+
| **Costs** | Heavier runtime; edge story improved but not as native as Drizzle. |
|
|
125
|
+
|
|
126
|
+
### tRPC
|
|
127
|
+
|
|
128
|
+
| | |
|
|
129
|
+
|---|---|
|
|
130
|
+
| **Pick when** | Single TS monorepo, server + client share types. |
|
|
131
|
+
| **Strengths** | Type-safe end-to-end; minimal overhead. |
|
|
132
|
+
| **Costs** | Not language-agnostic; OpenAPI shim needed for external consumers. |
|
|
133
|
+
|
|
134
|
+
### GraphQL (Apollo / urql / Relay)
|
|
135
|
+
|
|
136
|
+
| | |
|
|
137
|
+
|---|---|
|
|
138
|
+
| **Pick when** | Many client consumers, federated data sources. |
|
|
139
|
+
| **Strengths** | Per-client shape, schema-first design. |
|
|
140
|
+
| **Costs** | Server complexity; caching nuance; not always worth it for one client. |
|
|
141
|
+
|
|
142
|
+
## 4. Authentication
|
|
143
|
+
|
|
144
|
+
| Choice | Pick when |
|
|
145
|
+
|---|---|
|
|
146
|
+
| Supabase Auth (GoTrue) | Using Supabase already. |
|
|
147
|
+
| Clerk / Auth0 | Need polished UI + SSO out of the box; team avoids auth complexity. |
|
|
148
|
+
| WorkOS | Enterprise SSO + SCIM from day one. |
|
|
149
|
+
| Lucia | Self-hosted, TS, full control, smaller team. |
|
|
150
|
+
| Roll-your-own | Almost never. |
|
|
151
|
+
|
|
152
|
+
## 5. Hosting / deploy
|
|
153
|
+
|
|
154
|
+
| Choice | Pick when |
|
|
155
|
+
|---|---|
|
|
156
|
+
| **Vercel** | Next.js / Nuxt / SvelteKit, edge functions, generous DX. |
|
|
157
|
+
| **Cloudflare Pages + Workers** | Latency, global edge, low cost. |
|
|
158
|
+
| **Fly.io** | Need a real container with TCP, sticky regions. |
|
|
159
|
+
| **Coolify** (self-hosted PaaS) | Want Vercel-ish DX on own infra. |
|
|
160
|
+
| **Render / Railway** | Container apps + databases under one billing. |
|
|
161
|
+
| **Self-hosted Docker** | Heavy compliance constraints. |
|
|
162
|
+
|
|
163
|
+
## 6. Styling
|
|
164
|
+
|
|
165
|
+
| Choice | Pick when |
|
|
166
|
+
|---|---|
|
|
167
|
+
| **Tailwind CSS** | Token-first design system, utility-class team comfort. |
|
|
168
|
+
| **CSS Modules** | Component-scoped, no runtime, easy SSR. |
|
|
169
|
+
| **Vanilla Extract** | Type-safe styling at build time. |
|
|
170
|
+
| **shadcn-ui / Radix Primitives** | Need accessible primitives without ceding design. |
|
|
171
|
+
| **Linaria / Compiled** | CSS-in-JS without runtime cost. |
|
|
172
|
+
|
|
173
|
+
Mantis owns tokens (`.wize/solutioning/design-system/tokens.json`); Tony picks the system that maps those tokens cleanly.
|
|
174
|
+
|
|
175
|
+
## 7. State management
|
|
176
|
+
|
|
177
|
+
| Choice | Pick when |
|
|
178
|
+
|---|---|
|
|
179
|
+
| **React Server Components / Suspense** | Most data is server-derived. |
|
|
180
|
+
| **TanStack Query** | Heavy client-side data + caching. |
|
|
181
|
+
| **Zustand** | Small global state; no boilerplate. |
|
|
182
|
+
| **Jotai** | Atoms feel right for the domain. |
|
|
183
|
+
| **Pinia** (Vue) | Default Vue store. |
|
|
184
|
+
| **Redux Toolkit** | Time-travel, complex async pipelines, large team. |
|
|
185
|
+
|
|
186
|
+
## 8. Forms
|
|
187
|
+
|
|
188
|
+
| Choice | Pick when |
|
|
189
|
+
|---|---|
|
|
190
|
+
| **React Hook Form + Zod** | Type-safe schemas, low re-render count. |
|
|
191
|
+
| **Conform** | Server-progressive enhancement (Remix). |
|
|
192
|
+
| **TanStack Form** | TanStack ecosystem, schema-agnostic. |
|
|
193
|
+
|
|
194
|
+
## 9. Anti-patterns Tony flags fast
|
|
195
|
+
|
|
196
|
+
- Mixing **SSR + heavy client state** without a clear seam.
|
|
197
|
+
- Loading `lodash` for one function.
|
|
198
|
+
- Using **Redux for an app with 3 stores** of 5 keys each.
|
|
199
|
+
- Picking a tech because it's on a HackerNews front page.
|
|
200
|
+
- Defaulting to GraphQL for a one-client app.
|
|
201
|
+
|
|
202
|
+
## 10. Recording the choice
|
|
203
|
+
|
|
204
|
+
Tony writes the chosen stack into:
|
|
205
|
+
|
|
206
|
+
- `.wize/planning/tech-vision.md` (Fury): family + non-negotiables.
|
|
207
|
+
- `.wize/solutioning/architecture.md` (Tony): concrete picks + reasons.
|
|
208
|
+
- `.wize/solutioning/adrs/ADR-001-stack.md`: the trade-off log for future readers.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// `wize-dev-kit agent <subcommand>` — manage built-in and custom agents.
|
|
2
|
+
//
|
|
3
|
+
// list - show every agent the active install resolves (built-in + custom)
|
|
4
|
+
// create - scaffold a brand-new custom agent in .wize/custom/agents/{code}/
|
|
5
|
+
// edit <code> - override an existing built-in via .wize/custom/agents/{code}/customize.toml
|
|
6
|
+
//
|
|
7
|
+
// All write operations validate the result against schemas/agent.schema.json
|
|
8
|
+
// (lite parser — no dependency on Ajv yet) and do a smoke dry-run before
|
|
9
|
+
// persisting, matching the contract `wize-create-agent` describes.
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const fs = require('node:fs');
|
|
14
|
+
const path = require('node:path');
|
|
15
|
+
const prompts = require('prompts');
|
|
16
|
+
const { collectAssets } = require('../render-shared.js');
|
|
17
|
+
|
|
18
|
+
const VALID_CODE = /^wize-(agent|orchestrator)(?:-[a-z0-9-]+)?$/;
|
|
19
|
+
const VALID_MODULES = ['orchestrator', 'method', 'tea', 'builder', 'core', 'web-overlay', 'app-overlay', 'custom'];
|
|
20
|
+
|
|
21
|
+
function ensureDir(p) { fs.mkdirSync(p, { recursive: true }); }
|
|
22
|
+
|
|
23
|
+
function listAgents(kitRoot, projectRoot) {
|
|
24
|
+
const builtIn = collectAssets(kitRoot, { profiles: ['core', 'web-overlay', 'app-overlay'] })
|
|
25
|
+
.filter(a => a.kind === 'agent')
|
|
26
|
+
.map(a => ({ code: a.code, name: a.name, title: a.title, source: 'built-in' }));
|
|
27
|
+
const customDir = path.join(projectRoot, '.wize/custom/agents');
|
|
28
|
+
const custom = [];
|
|
29
|
+
if (fs.existsSync(customDir)) {
|
|
30
|
+
for (const entry of fs.readdirSync(customDir, { withFileTypes: true })) {
|
|
31
|
+
if (!entry.isDirectory()) continue;
|
|
32
|
+
const yamlPath = path.join(customDir, entry.name, 'agent.yaml');
|
|
33
|
+
const customizePath = path.join(customDir, entry.name, 'customize.toml');
|
|
34
|
+
if (fs.existsSync(yamlPath)) {
|
|
35
|
+
const yaml = fs.readFileSync(yamlPath, 'utf-8');
|
|
36
|
+
const name = (yaml.match(/^name:\s*(.+)$/m) || [])[1] || entry.name;
|
|
37
|
+
const title = (yaml.match(/^title:\s*(.+)$/m) || [])[1] || '';
|
|
38
|
+
custom.push({ code: entry.name, name: name.trim(), title: title.trim(), source: 'custom' });
|
|
39
|
+
} else if (fs.existsSync(customizePath)) {
|
|
40
|
+
custom.push({ code: entry.name, name: '(override)', title: '', source: 'override' });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { builtIn, custom };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function cmdAgentList({ kitRoot, projectRoot, log = console.log } = {}) {
|
|
48
|
+
const { builtIn, custom } = listAgents(kitRoot, projectRoot);
|
|
49
|
+
log('Built-in agents:');
|
|
50
|
+
for (const a of builtIn) log(` ${a.code.padEnd(36)} ${a.name}${a.title ? ' — ' + a.title : ''}`);
|
|
51
|
+
if (custom.length) {
|
|
52
|
+
log('\nCustom / override agents (from .wize/custom/agents/):');
|
|
53
|
+
for (const a of custom) log(` ${a.code.padEnd(36)} ${a.name}${a.title ? ' — ' + a.title : ''} [${a.source}]`);
|
|
54
|
+
} else {
|
|
55
|
+
log('\nCustom / override agents: (none yet — use `wize-dev-kit agent create`)');
|
|
56
|
+
}
|
|
57
|
+
return { builtIn, custom };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function validateAgent(spec, kitRoot) {
|
|
61
|
+
const errs = [];
|
|
62
|
+
if (!spec.code) errs.push('code is required');
|
|
63
|
+
else if (!VALID_CODE.test(spec.code)) errs.push(`code "${spec.code}" must match wize-(agent|orchestrator)[-name]`);
|
|
64
|
+
if (!spec.name) errs.push('name is required');
|
|
65
|
+
if (!spec.title) errs.push('title is required');
|
|
66
|
+
if (!VALID_MODULES.includes(spec.module)) errs.push(`module must be one of: ${VALID_MODULES.join(', ')}`);
|
|
67
|
+
if (!spec.description || spec.description.length < 10) errs.push('description must be ≥ 10 characters');
|
|
68
|
+
// Collide check against built-ins when not overriding.
|
|
69
|
+
const builtinCodes = collectAssets(kitRoot, { profiles: ['core', 'web-overlay', 'app-overlay'] })
|
|
70
|
+
.filter(a => a.kind === 'agent').map(a => a.code);
|
|
71
|
+
if (builtinCodes.includes(spec.code) && !spec.allowOverride) {
|
|
72
|
+
errs.push(`code "${spec.code}" already exists as a built-in. Use \`wize-dev-kit agent edit ${spec.code}\` to override.`);
|
|
73
|
+
}
|
|
74
|
+
return errs;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function renderAgentYaml(spec) {
|
|
78
|
+
return [
|
|
79
|
+
`code: ${spec.code}`,
|
|
80
|
+
`name: ${spec.name}`,
|
|
81
|
+
`title: ${spec.title}`,
|
|
82
|
+
`icon: "${spec.icon || '🔧'}"`,
|
|
83
|
+
`team: ${spec.team || 'software-development'}`,
|
|
84
|
+
`module: ${spec.module}`,
|
|
85
|
+
'',
|
|
86
|
+
'description: |',
|
|
87
|
+
...spec.description.split('\n').map(l => ' ' + l),
|
|
88
|
+
''
|
|
89
|
+
].join('\n');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function renderPersonaMd(spec) {
|
|
93
|
+
const body = (spec.persona || `I am **${spec.name}**. ${spec.description}`).trim();
|
|
94
|
+
return [
|
|
95
|
+
`# ${spec.name} — ${spec.title}`,
|
|
96
|
+
'',
|
|
97
|
+
body,
|
|
98
|
+
''
|
|
99
|
+
].join('\n');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Smoke dry-run: write to temp dir, re-read, assert frontmatter parses.
|
|
103
|
+
function dryRunPersist(spec) {
|
|
104
|
+
const tmp = path.join(require('node:os').tmpdir(), `wize-agent-${spec.code}-${Date.now()}`);
|
|
105
|
+
ensureDir(tmp);
|
|
106
|
+
try {
|
|
107
|
+
fs.writeFileSync(path.join(tmp, 'agent.yaml'), renderAgentYaml(spec), 'utf-8');
|
|
108
|
+
fs.writeFileSync(path.join(tmp, 'persona.md'), renderPersonaMd(spec), 'utf-8');
|
|
109
|
+
const reread = fs.readFileSync(path.join(tmp, 'agent.yaml'), 'utf-8');
|
|
110
|
+
if (!/^code:\s+/m.test(reread)) throw new Error('emitted agent.yaml has no "code:" line');
|
|
111
|
+
if (!/^name:\s+/m.test(reread)) throw new Error('emitted agent.yaml has no "name:" line');
|
|
112
|
+
return { ok: true };
|
|
113
|
+
} finally {
|
|
114
|
+
try { fs.rmSync(tmp, { recursive: true, force: true }); } catch (_) {}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function cmdAgentCreate({ kitRoot, projectRoot, opts = {} } = {}) {
|
|
119
|
+
const interactive = process.stdout.isTTY && process.stdin.isTTY && !opts.fromSpec;
|
|
120
|
+
let spec = opts.fromSpec || {};
|
|
121
|
+
|
|
122
|
+
if (interactive) {
|
|
123
|
+
const a = await prompts([
|
|
124
|
+
{ type: 'text', name: 'code', message: 'Agent code (e.g. wize-agent-runbooks)',
|
|
125
|
+
validate: v => VALID_CODE.test(v) || 'must match wize-(agent|orchestrator)[-name]' },
|
|
126
|
+
{ type: 'text', name: 'name', message: 'Display name (e.g. Riri Williams)', validate: v => !!v.trim() || 'required' },
|
|
127
|
+
{ type: 'text', name: 'title', message: 'Role / title (e.g. Reliability Engineer)', validate: v => !!v.trim() || 'required' },
|
|
128
|
+
{ type: 'text', name: 'icon', message: 'Icon emoji (optional)', initial: '🔧' },
|
|
129
|
+
{ type: 'text', name: 'team', message: 'Team', initial: 'software-development' },
|
|
130
|
+
{ type: 'select', name: 'module', message: 'Module', choices: VALID_MODULES.map(v => ({ title: v, value: v })), initial: VALID_MODULES.indexOf('custom') },
|
|
131
|
+
{ type: 'text', name: 'description', message: 'One-paragraph description (≥ 10 chars)', validate: v => v.length >= 10 || 'must be ≥ 10 characters' },
|
|
132
|
+
{ type: 'text', name: 'persona', message: 'Persona body (optional — defaults to description)', initial: '' }
|
|
133
|
+
], { onCancel: () => process.exit(130) });
|
|
134
|
+
spec = { ...spec, ...a };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const errs = validateAgent(spec, kitRoot);
|
|
138
|
+
if (errs.length) {
|
|
139
|
+
console.error('✖ Validation failed:');
|
|
140
|
+
for (const e of errs) console.error(' - ' + e);
|
|
141
|
+
process.exit(2);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const dry = dryRunPersist(spec);
|
|
145
|
+
if (!dry.ok) {
|
|
146
|
+
console.error('✖ Dry-run failed; aborting.');
|
|
147
|
+
process.exit(3);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const target = path.join(projectRoot, '.wize/custom/agents', spec.code);
|
|
151
|
+
ensureDir(target);
|
|
152
|
+
fs.writeFileSync(path.join(target, 'agent.yaml'), renderAgentYaml(spec), 'utf-8');
|
|
153
|
+
fs.writeFileSync(path.join(target, 'persona.md'), renderPersonaMd(spec), 'utf-8');
|
|
154
|
+
|
|
155
|
+
console.log(`✓ Created ${path.relative(projectRoot, target)}/`);
|
|
156
|
+
console.log(' Run `wize-dev-kit sync` to refresh IDE adapter outputs with the new agent.');
|
|
157
|
+
return { code: spec.code, path: target };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function cmdAgentEdit({ kitRoot, projectRoot, code, opts = {} } = {}) {
|
|
161
|
+
if (!code) {
|
|
162
|
+
console.error('Usage: wize-dev-kit agent edit <code>');
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
const builtinCodes = collectAssets(kitRoot, { profiles: ['core', 'web-overlay', 'app-overlay'] })
|
|
166
|
+
.filter(a => a.kind === 'agent').map(a => a.code);
|
|
167
|
+
if (!builtinCodes.includes(code)) {
|
|
168
|
+
console.error(`✖ "${code}" is not a built-in agent. Use \`wize-dev-kit agent create\` for new agents.`);
|
|
169
|
+
process.exit(2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const target = path.join(projectRoot, '.wize/custom/agents', code);
|
|
173
|
+
ensureDir(target);
|
|
174
|
+
const customize = path.join(target, 'customize.toml');
|
|
175
|
+
if (fs.existsSync(customize) && !opts.force) {
|
|
176
|
+
console.log(`= ${path.relative(projectRoot, customize)} already exists. Edit it directly.`);
|
|
177
|
+
return { code, path: customize };
|
|
178
|
+
}
|
|
179
|
+
fs.writeFileSync(customize, `# Wize Dev Kit — overrides for the built-in agent "${code}".
|
|
180
|
+
# This file is loaded on top of the built-in agent's persona.md / agent.yaml
|
|
181
|
+
# at IDE adapter render time. Only the fields you set here are overridden.
|
|
182
|
+
|
|
183
|
+
[persona]
|
|
184
|
+
# motto = "your custom motto"
|
|
185
|
+
# voice = "succinct and irreverent"
|
|
186
|
+
# style = "show with code, not prose"
|
|
187
|
+
|
|
188
|
+
[behavior]
|
|
189
|
+
# defer_to = [] # e.g. ["wize-agent-pm"] to lower priority on certain decisions
|
|
190
|
+
# tools_deny = [] # tool codes the override removes from the agent
|
|
191
|
+
`, 'utf-8');
|
|
192
|
+
console.log(`✓ Created ${path.relative(projectRoot, customize)}`);
|
|
193
|
+
console.log(' Edit the file, then run `wize-dev-kit sync` to apply.');
|
|
194
|
+
return { code, path: customize };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = { cmdAgentList, cmdAgentCreate, cmdAgentEdit, listAgents, validateAgent };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// `wize-dev-kit sync` — regenerate adapter outputs for the IDE targets the
|
|
2
|
+
// project opted into. Useful after editing .wize/config/project.toml,
|
|
3
|
+
// running `agent create`, or pulling kit changes that don't bump version.
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const fs = require('node:fs');
|
|
8
|
+
const path = require('node:path');
|
|
9
|
+
const { loadProjectConfig } = require('./update.js');
|
|
10
|
+
|
|
11
|
+
function cmdSync({ kitRoot, projectRoot, opts = {} } = {}) {
|
|
12
|
+
const log = opts.log || console.log;
|
|
13
|
+
const cfg = loadProjectConfig(projectRoot);
|
|
14
|
+
if (!cfg.project) {
|
|
15
|
+
log('No .wize/config/project.toml found here. Run `wize-dev-kit install` first.');
|
|
16
|
+
return { changed: false };
|
|
17
|
+
}
|
|
18
|
+
const ideTargets = (cfg.install && cfg.install.ide_targets) || ['claude-code', 'generic'];
|
|
19
|
+
const profiles = (cfg.install && cfg.install.profiles) || ['core'];
|
|
20
|
+
log(`Syncing ${ideTargets.length} adapter(s) for profile(s) ${profiles.join(' + ')}:`);
|
|
21
|
+
|
|
22
|
+
const results = [];
|
|
23
|
+
for (const code of ideTargets) {
|
|
24
|
+
const renderPath = path.join(kitRoot, 'adapters', code, 'render.js');
|
|
25
|
+
if (!fs.existsSync(renderPath)) {
|
|
26
|
+
log(` - ${code}: skipped (adapter missing in installed kit)`);
|
|
27
|
+
results.push({ code, skipped: true });
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
delete require.cache[require.resolve(renderPath)];
|
|
31
|
+
try {
|
|
32
|
+
const out = require(renderPath).render(kitRoot, projectRoot, { profiles });
|
|
33
|
+
const n = out && Array.isArray(out.written) ? out.written.length : 0;
|
|
34
|
+
log(` ✓ ${code}: ${n} file(s) emitted`);
|
|
35
|
+
results.push({ code, written: n });
|
|
36
|
+
} catch (err) {
|
|
37
|
+
log(` ✖ ${code}: ${err.message}`);
|
|
38
|
+
results.push({ code, error: err.message });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
log('\nDone. Restart your IDE if it caches skills at startup.');
|
|
42
|
+
return { changed: true, adapters: results };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = { cmdSync };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// `wize-dev-kit update` — refresh an installed kit to the version currently
|
|
2
|
+
// resolved by `node_modules/wize-dev-kit`. Preserves .wize/config/user.toml,
|
|
3
|
+
// re-runs the active IDE adapters, and re-applies the .gitignore block when
|
|
4
|
+
// it was opted-in originally.
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
|
+
const { applyGitignore } = require('../setup-helpers.js');
|
|
11
|
+
|
|
12
|
+
// Minimal TOML reader for the subset we write — handles `[section]` headers,
|
|
13
|
+
// `key = "value"` scalars, and `key = ["a", "b"]` string arrays.
|
|
14
|
+
function readToml(file) {
|
|
15
|
+
if (!fs.existsSync(file)) return {};
|
|
16
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
17
|
+
const out = {};
|
|
18
|
+
let section = null;
|
|
19
|
+
for (const raw of content.split('\n')) {
|
|
20
|
+
const line = raw.replace(/#.*$/, '').trim();
|
|
21
|
+
if (!line) continue;
|
|
22
|
+
const head = line.match(/^\[([^\]]+)\]$/);
|
|
23
|
+
if (head) { section = head[1]; out[section] = out[section] || {}; continue; }
|
|
24
|
+
const kv = line.match(/^([a-zA-Z_][\w-]*)\s*=\s*(.+)$/);
|
|
25
|
+
if (!kv) continue;
|
|
26
|
+
const [, key, valRaw] = kv;
|
|
27
|
+
const v = parseTomlValue(valRaw.trim());
|
|
28
|
+
if (section) out[section][key] = v;
|
|
29
|
+
else out[key] = v;
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseTomlValue(raw) {
|
|
35
|
+
if (raw.startsWith('"') && raw.endsWith('"')) return raw.slice(1, -1);
|
|
36
|
+
if (raw.startsWith("'") && raw.endsWith("'")) return raw.slice(1, -1);
|
|
37
|
+
if (raw.startsWith('[') && raw.endsWith(']')) {
|
|
38
|
+
return raw.slice(1, -1).split(',').map(s => s.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
|
|
39
|
+
}
|
|
40
|
+
if (raw === 'true') return true;
|
|
41
|
+
if (raw === 'false') return false;
|
|
42
|
+
if (!isNaN(Number(raw))) return Number(raw);
|
|
43
|
+
return raw;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function loadProjectConfig(projectRoot) {
|
|
47
|
+
return readToml(path.join(projectRoot, '.wize/config/project.toml'));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function loadInstalledKitVersion(kitRoot) {
|
|
51
|
+
try { return require(path.join(kitRoot, 'package.json')).version; }
|
|
52
|
+
catch { return null; }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Returns a list of CHANGELOG entries (markdown blocks) for versions strictly
|
|
56
|
+
// between `from` and `to`. Best-effort — if CHANGELOG layout is unusual,
|
|
57
|
+
// returns an empty list and falls back to a generic note.
|
|
58
|
+
function changelogBetween(kitRoot, fromVersion, toVersion) {
|
|
59
|
+
const file = path.join(kitRoot, 'CHANGELOG.md');
|
|
60
|
+
if (!fs.existsSync(file)) return [];
|
|
61
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
62
|
+
const versionRe = /^## \[(\d+\.\d+\.\d+)\][^\n]*\n/gm;
|
|
63
|
+
const matches = [];
|
|
64
|
+
let m;
|
|
65
|
+
while ((m = versionRe.exec(content)) !== null) {
|
|
66
|
+
matches.push({ v: m[1], start: m.index, headerEnd: versionRe.lastIndex });
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < matches.length; i++) {
|
|
69
|
+
matches[i].end = i + 1 < matches.length ? matches[i + 1].start : content.length;
|
|
70
|
+
}
|
|
71
|
+
return matches
|
|
72
|
+
.filter(x => compare(x.v, fromVersion) > 0 && compare(x.v, toVersion) <= 0)
|
|
73
|
+
.map(x => content.slice(x.start, x.end).trim());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function compare(a, b) {
|
|
77
|
+
const pa = a.split('.').map(Number);
|
|
78
|
+
const pb = b.split('.').map(Number);
|
|
79
|
+
for (let i = 0; i < 3; i++) {
|
|
80
|
+
if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) - (pb[i] || 0);
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Re-runs every adapter that the project opted into at install time, using
|
|
86
|
+
// the current versions of the kit's renderers.
|
|
87
|
+
function rerunAdapters({ kitRoot, projectRoot, ideTargets, profiles, log }) {
|
|
88
|
+
const results = [];
|
|
89
|
+
for (const code of ideTargets) {
|
|
90
|
+
const renderPath = path.join(kitRoot, 'adapters', code, 'render.js');
|
|
91
|
+
if (!fs.existsSync(renderPath)) {
|
|
92
|
+
results.push({ code, skipped: true, reason: 'adapter missing in this kit version' });
|
|
93
|
+
log(` - ${code}: skipped (adapter no longer exists)`);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
delete require.cache[require.resolve(renderPath)]; // make `update` idempotent in the same process
|
|
97
|
+
try {
|
|
98
|
+
const mod = require(renderPath);
|
|
99
|
+
const out = mod.render(kitRoot, projectRoot, { profiles });
|
|
100
|
+
const n = out && Array.isArray(out.written) ? out.written.length : 0;
|
|
101
|
+
results.push({ code, written: n });
|
|
102
|
+
log(` ✓ ${code}: ${n} file(s) refreshed`);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
results.push({ code, error: err.message });
|
|
105
|
+
log(` ✖ ${code}: ${err.message}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return results;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function writeUpdatedProjectToml(projectRoot, currentToml, newKitVersion) {
|
|
112
|
+
// Surgical rewrite — only updates `kit_version = ...` under `[project]`.
|
|
113
|
+
// Leaves everything else as the user/team configured it.
|
|
114
|
+
const file = path.join(projectRoot, '.wize/config/project.toml');
|
|
115
|
+
if (!fs.existsSync(file)) return false;
|
|
116
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
117
|
+
const updated = content.replace(/^kit_version\s*=\s*".*"$/m, `kit_version = "${newKitVersion}"`);
|
|
118
|
+
if (updated === content) return false;
|
|
119
|
+
fs.writeFileSync(file, updated, 'utf-8');
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function cmdUpdate({ kitRoot, projectRoot, opts = {} } = {}) {
|
|
124
|
+
const log = opts.log || console.log;
|
|
125
|
+
const cfg = loadProjectConfig(projectRoot);
|
|
126
|
+
if (!cfg.project) {
|
|
127
|
+
log('No .wize/config/project.toml found here.');
|
|
128
|
+
log('Run `wize-dev-kit install` first.');
|
|
129
|
+
return { changed: false };
|
|
130
|
+
}
|
|
131
|
+
const fromVersion = cfg.project.kit_version || '0.0.0';
|
|
132
|
+
const toVersion = loadInstalledKitVersion(kitRoot) || 'unknown';
|
|
133
|
+
if (toVersion === 'unknown') {
|
|
134
|
+
log('Could not read kit version from node_modules. Aborting.');
|
|
135
|
+
return { changed: false };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
log(`Wize Dev Kit update: ${fromVersion} → ${toVersion}`);
|
|
139
|
+
if (fromVersion === toVersion) {
|
|
140
|
+
log('Already on the same version. Re-rendering adapters anyway (idempotent).');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const ideTargets = (cfg.install && cfg.install.ide_targets) || ['claude-code', 'generic'];
|
|
144
|
+
const profiles = (cfg.install && cfg.install.profiles) || ['core'];
|
|
145
|
+
|
|
146
|
+
log('\nRe-rendering active IDE adapters:');
|
|
147
|
+
const adapterResults = rerunAdapters({ kitRoot, projectRoot, ideTargets, profiles, log });
|
|
148
|
+
|
|
149
|
+
if (opts.refreshGitignore !== false) {
|
|
150
|
+
const r = applyGitignore(projectRoot);
|
|
151
|
+
if (r.changed) log(`\n✓ .gitignore ${r.mode}`);
|
|
152
|
+
else log('\n= .gitignore already up to date');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
writeUpdatedProjectToml(projectRoot, cfg, toVersion);
|
|
156
|
+
log(`\n✓ project.toml kit_version → ${toVersion}`);
|
|
157
|
+
|
|
158
|
+
const entries = changelogBetween(kitRoot, fromVersion, toVersion);
|
|
159
|
+
if (entries.length) {
|
|
160
|
+
log(`\nWhat changed (excerpt from CHANGELOG):`);
|
|
161
|
+
for (const e of entries) {
|
|
162
|
+
log(e.split('\n').slice(0, 4).map(l => ' ' + l).join('\n'));
|
|
163
|
+
log(' …');
|
|
164
|
+
}
|
|
165
|
+
log(`\nFull details: ${path.join(kitRoot, 'CHANGELOG.md')}`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
log('\nDone. Restart your IDE so the refreshed slash commands are picked up.');
|
|
169
|
+
return { changed: true, from: fromVersion, to: toVersion, adapters: adapterResults };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = { cmdUpdate, loadProjectConfig, loadInstalledKitVersion, changelogBetween };
|