@stackwright-pro/launch-stackwright-pro 0.4.0-alpha.5 → 0.4.0-alpha.50
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 +13 -6
- package/dist/index.js +133 -15
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
- package/templates/pro/prebuild.js +54 -78
- package/templates/pro/scripts/pro-content-plugin.js +47 -0
package/README.md
CHANGED
|
@@ -120,17 +120,24 @@ for architecture details, auth deep-dives, and deployment guides.
|
|
|
120
120
|
|
|
121
121
|
## Starting the Otter Raft
|
|
122
122
|
|
|
123
|
-
The otter raft
|
|
123
|
+
The otter raft runs in two modes:
|
|
124
|
+
|
|
125
|
+
### Interactive Mode (Default)
|
|
124
126
|
|
|
125
127
|
```bash
|
|
126
|
-
|
|
128
|
+
python -m stackwright_pro.raft.cli_adapter foreman --spawn
|
|
127
129
|
```
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
This spawns code-puppy with the foreman system prompt. The foreman:
|
|
132
|
+
|
|
133
|
+
- Asks questions about your project via TUI
|
|
134
|
+
- Coordinates specialist otters (brand, theme, api, auth, page)
|
|
135
|
+
- Uses certificate pinning to ensure only approved otters are invoked
|
|
136
|
+
|
|
137
|
+
### Phases Mode (Debugging)
|
|
130
138
|
|
|
131
139
|
```bash
|
|
132
|
-
|
|
133
|
-
python -m stackwright_pro.raft.cli foreman
|
|
140
|
+
python -m stackwright_pro.raft.cli_adapter foreman --phases
|
|
134
141
|
```
|
|
135
142
|
|
|
136
|
-
|
|
143
|
+
Executes phases sequentially via the Python state machine. Useful for debugging.
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "@stackwright-pro/launch-stackwright-pro",
|
|
34
|
-
version: "0.4.0-alpha.
|
|
34
|
+
version: "0.4.0-alpha.50",
|
|
35
35
|
description: "Launch a new Stackwright Pro project with OpenAPI integration, auth, and the otter raft",
|
|
36
36
|
license: "MIT",
|
|
37
37
|
publishConfig: {
|
|
@@ -57,14 +57,20 @@ var require_package = __commonJS({
|
|
|
57
57
|
"launch-stackwright-pro": "dist/index.js"
|
|
58
58
|
},
|
|
59
59
|
scripts: {
|
|
60
|
-
build: "tsup",
|
|
60
|
+
build: "node ../../scripts/sync-versions.mjs && tsup",
|
|
61
|
+
"sync-versions": "node ../../scripts/sync-versions.mjs",
|
|
61
62
|
dev: "tsup --watch",
|
|
62
63
|
test: "vitest run",
|
|
63
64
|
"test:coverage": "vitest run --coverage"
|
|
64
65
|
},
|
|
65
66
|
dependencies: {
|
|
66
|
-
"@stackwright-pro/
|
|
67
|
-
"@stackwright/
|
|
67
|
+
"@stackwright-pro/auth": "workspace:*",
|
|
68
|
+
"@stackwright-pro/auth-nextjs": "workspace:*",
|
|
69
|
+
"@stackwright-pro/mcp": "workspace:*",
|
|
70
|
+
"@stackwright-pro/openapi": "workspace:*",
|
|
71
|
+
"@stackwright-pro/otters": "workspace:*",
|
|
72
|
+
"@stackwright-pro/scaffold-hooks": "latest",
|
|
73
|
+
"@stackwright/cli": "^0.7.1-alpha.0",
|
|
68
74
|
"@stackwright/scaffold-core": "^0.1.0",
|
|
69
75
|
chalk: "^5.6.2",
|
|
70
76
|
commander: "^14.0.3",
|
|
@@ -94,6 +100,30 @@ var import_child_process = require("child_process");
|
|
|
94
100
|
var import_cli = require("@stackwright/cli");
|
|
95
101
|
var import_scaffold_core = require("@stackwright/scaffold-core");
|
|
96
102
|
var import_scaffold_hooks = require("@stackwright-pro/scaffold-hooks");
|
|
103
|
+
|
|
104
|
+
// src/generated/workspace-versions.ts
|
|
105
|
+
var PRO_VERSIONS = {
|
|
106
|
+
"@stackwright-pro/auth": "0.2.0-alpha.3",
|
|
107
|
+
"@stackwright-pro/auth-nextjs": "0.2.0-alpha.3",
|
|
108
|
+
"@stackwright-pro/display-components": "0.2.0-alpha.5",
|
|
109
|
+
"@stackwright-pro/mcp": "0.2.0-alpha.29",
|
|
110
|
+
"@stackwright-pro/openapi": "0.3.0-alpha.10",
|
|
111
|
+
"@stackwright-pro/otters": "1.0.0-alpha.29",
|
|
112
|
+
"@stackwright-pro/pulse": "0.3.0-alpha.7",
|
|
113
|
+
"@stackwright-pro/workflow": "0.1.0-alpha.7",
|
|
114
|
+
"@stackwright-pro/workflow-components": "0.1.0-alpha.9"
|
|
115
|
+
};
|
|
116
|
+
var OSS_VERSIONS = {
|
|
117
|
+
"@stackwright/build-scripts": "^0.7.0",
|
|
118
|
+
"@stackwright/core": "^0.8.2",
|
|
119
|
+
"@stackwright/icons": "^0.3.0",
|
|
120
|
+
"@stackwright/mcp": "^0.2.0",
|
|
121
|
+
"@stackwright/nextjs": "^0.3.1",
|
|
122
|
+
"@stackwright/otters": "^0.2.0",
|
|
123
|
+
"@stackwright/ui-shadcn": "^0.1.0"
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/index.ts
|
|
97
127
|
(0, import_scaffold_hooks.registerProScaffoldHooks)();
|
|
98
128
|
var { version } = require_package();
|
|
99
129
|
async function copyProTemplate(templateName, destPath) {
|
|
@@ -103,7 +133,7 @@ async function copyProTemplate(templateName, destPath) {
|
|
|
103
133
|
async function addAuthToStackwrightYml(targetDir) {
|
|
104
134
|
const ymlPath = import_path.default.join(targetDir, "stackwright.yml");
|
|
105
135
|
const content = await import_fs_extra.default.readFile(ymlPath, "utf-8");
|
|
106
|
-
const config = import_js_yaml.default.load(content);
|
|
136
|
+
const config = import_js_yaml.default.load(content, { schema: import_js_yaml.default.CORE_SCHEMA });
|
|
107
137
|
config.auth = {
|
|
108
138
|
type: "pki",
|
|
109
139
|
profile: "dod_cac",
|
|
@@ -118,10 +148,52 @@ async function addAuthToStackwrightYml(targetDir) {
|
|
|
118
148
|
};
|
|
119
149
|
await import_fs_extra.default.writeFile(ymlPath, import_js_yaml.default.dump(config, { lineWidth: 120 }));
|
|
120
150
|
}
|
|
151
|
+
async function addProDepsToPackageJson(targetDir) {
|
|
152
|
+
const pkgPath = import_path.default.join(targetDir, "package.json");
|
|
153
|
+
const content = await import_fs_extra.default.readFile(pkgPath, "utf-8");
|
|
154
|
+
const pkg = JSON.parse(content);
|
|
155
|
+
const dependencies = pkg.dependencies || {};
|
|
156
|
+
const devDependencies = pkg.devDependencies || {};
|
|
157
|
+
const scripts = pkg.scripts || {};
|
|
158
|
+
for (const [pkgName, pinnedVersion] of Object.entries(OSS_VERSIONS)) {
|
|
159
|
+
if (dependencies[pkgName] === "workspace:*") {
|
|
160
|
+
dependencies[pkgName] = pinnedVersion;
|
|
161
|
+
}
|
|
162
|
+
if (devDependencies[pkgName] === "workspace:*") {
|
|
163
|
+
devDependencies[pkgName] = pinnedVersion;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
Object.assign(dependencies, {
|
|
167
|
+
"@stackwright-pro/display-components": PRO_VERSIONS["@stackwright-pro/display-components"],
|
|
168
|
+
"@stackwright-pro/mcp": PRO_VERSIONS["@stackwright-pro/mcp"],
|
|
169
|
+
"@stackwright-pro/otters": PRO_VERSIONS["@stackwright-pro/otters"],
|
|
170
|
+
"@stackwright-pro/openapi": PRO_VERSIONS["@stackwright-pro/openapi"],
|
|
171
|
+
"@stackwright-pro/auth": PRO_VERSIONS["@stackwright-pro/auth"],
|
|
172
|
+
"@stackwright-pro/auth-nextjs": PRO_VERSIONS["@stackwright-pro/auth-nextjs"],
|
|
173
|
+
"@stackwright-pro/pulse": PRO_VERSIONS["@stackwright-pro/pulse"],
|
|
174
|
+
"@stackwright-pro/workflow-components": PRO_VERSIONS["@stackwright-pro/workflow-components"],
|
|
175
|
+
"@stackwright-pro/workflow": PRO_VERSIONS["@stackwright-pro/workflow"],
|
|
176
|
+
zod: "^4.0.0"
|
|
177
|
+
});
|
|
178
|
+
Object.assign(devDependencies, {
|
|
179
|
+
"@stoplight/prism-cli": "^5.14.2"
|
|
180
|
+
});
|
|
181
|
+
Object.assign(scripts, {
|
|
182
|
+
"dev:admin": "MOCK_USER=admin next dev",
|
|
183
|
+
"dev:analyst": "MOCK_USER=analyst next dev",
|
|
184
|
+
"dev:viewer": "MOCK_USER=viewer next dev",
|
|
185
|
+
prebuild: "node scripts/prebuild.js",
|
|
186
|
+
predev: "node scripts/prebuild.js"
|
|
187
|
+
});
|
|
188
|
+
pkg.dependencies = dependencies;
|
|
189
|
+
pkg.devDependencies = devDependencies;
|
|
190
|
+
pkg.scripts = scripts;
|
|
191
|
+
await import_fs_extra.default.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
|
|
192
|
+
}
|
|
121
193
|
async function addIntegrationToStackwrightYml(targetDir, specName, specFilename, mockUrl) {
|
|
122
194
|
const ymlPath = import_path.default.join(targetDir, "stackwright.yml");
|
|
123
195
|
const content = await import_fs_extra.default.readFile(ymlPath, "utf-8");
|
|
124
|
-
const config = import_js_yaml.default.load(content);
|
|
196
|
+
const config = import_js_yaml.default.load(content, { schema: import_js_yaml.default.CORE_SCHEMA });
|
|
125
197
|
const integration = {
|
|
126
198
|
type: "openapi",
|
|
127
199
|
name: specName,
|
|
@@ -219,12 +291,10 @@ Your project includes **SIX specialized AI agents** in \`node_modules/@stackwrig
|
|
|
219
291
|
**Start the otter raft:**
|
|
220
292
|
|
|
221
293
|
\`\`\`bash
|
|
222
|
-
|
|
294
|
+
npx @stackwright-pro/raft
|
|
223
295
|
\`\`\`
|
|
224
296
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
The raft is a Python state machine with a Rich terminal UI \u2014 it asks questions about your brand, auth, and data preferences, then coordinates specialist otters to build your app. All user interaction happens in the terminal; code-puppy is called as a one-shot subprocess for creative tasks only.
|
|
297
|
+
The raft verifies otter integrity, writes project context, and spawns code-puppy in foreman mode. The foreman asks questions about your brand, auth, and data preferences, then coordinates specialist otters to build your app. All state lives in \`.stackwright/\` \u2014 interrupt and resume anytime.
|
|
228
298
|
|
|
229
299
|
**Example session prompt:**
|
|
230
300
|
|
|
@@ -407,6 +477,8 @@ async function launch(targetDir, options) {
|
|
|
407
477
|
console.log(import_chalk.default.cyan.bold("\n\u{1F6A2} Launching Stackwright Pro...\n"));
|
|
408
478
|
const scaffoldOpts = {
|
|
409
479
|
name: options.name || dirName,
|
|
480
|
+
standalone: true,
|
|
481
|
+
// prevents `workspace:*` refs when CLI runs inside the Pro monorepo
|
|
410
482
|
...options.title !== void 0 && { title: options.title },
|
|
411
483
|
...options.theme !== void 0 && { theme: options.theme },
|
|
412
484
|
...options.force !== void 0 && { force: options.force },
|
|
@@ -414,13 +486,41 @@ async function launch(targetDir, options) {
|
|
|
414
486
|
};
|
|
415
487
|
await (0, import_cli.scaffold)(targetDir, scaffoldOpts);
|
|
416
488
|
console.log(import_chalk.default.green("\u2705 Base project scaffolded (hooks added Pro deps + MCP config)"));
|
|
489
|
+
await addProDepsToPackageJson(targetDir);
|
|
490
|
+
console.log(import_chalk.default.green("\u{1F9A6} Pro packages added to package.json"));
|
|
491
|
+
const verifyPkg = JSON.parse(
|
|
492
|
+
await import_fs_extra.default.readFile(import_path.default.join(targetDir, "package.json"), "utf-8")
|
|
493
|
+
);
|
|
494
|
+
const proDepCount = Object.keys(verifyPkg.dependencies || {}).filter(
|
|
495
|
+
(k) => k.startsWith("@stackwright-pro")
|
|
496
|
+
).length;
|
|
497
|
+
console.log(import_chalk.default.dim(` \u2192 package.json verified: ${proDepCount} @stackwright-pro/* deps ready`));
|
|
417
498
|
console.log(import_chalk.default.cyan("\n\u{1F4E6} Installing dependencies (this takes a moment)..."));
|
|
418
499
|
if (!options.skipInstall) {
|
|
419
500
|
try {
|
|
420
|
-
(0, import_child_process.execSync)("pnpm install", {
|
|
501
|
+
(0, import_child_process.execSync)("pnpm install --ignore-workspace", {
|
|
502
|
+
cwd: targetDir,
|
|
503
|
+
stdio: "inherit",
|
|
504
|
+
timeout: 12e4
|
|
505
|
+
});
|
|
421
506
|
console.log(import_chalk.default.green("\u2705 Dependencies installed"));
|
|
422
|
-
} catch {
|
|
423
|
-
|
|
507
|
+
} catch (err) {
|
|
508
|
+
const isTimeout = err instanceof Error && (err.message.includes("ETIMEDOUT") || err.message.includes("timeout"));
|
|
509
|
+
console.error(
|
|
510
|
+
import_chalk.default.red("\n\u274C pnpm install failed. Auth and Pro packages are NOT installed.")
|
|
511
|
+
);
|
|
512
|
+
console.error(
|
|
513
|
+
import_chalk.default.red(" Your project is in an incomplete state \u2014 do NOT run or deploy it.")
|
|
514
|
+
);
|
|
515
|
+
if (isTimeout) {
|
|
516
|
+
console.error(
|
|
517
|
+
import_chalk.default.yellow(" The install timed out (>2 min). Check your network connection.")
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
console.error(
|
|
521
|
+
import_chalk.default.yellow(` Fix the error above, then run: pnpm install --ignore-workspace`)
|
|
522
|
+
);
|
|
523
|
+
process.exit(1);
|
|
424
524
|
}
|
|
425
525
|
} else {
|
|
426
526
|
console.log(import_chalk.default.dim("\u2139\uFE0F Skipping install (--skip-install). Run: pnpm install"));
|
|
@@ -487,11 +587,29 @@ async function launch(targetDir, options) {
|
|
|
487
587
|
});
|
|
488
588
|
await import_fs_extra.default.writeFile(import_path.default.join(targetDir, "README.md"), readmeContent);
|
|
489
589
|
console.log(import_chalk.default.green("\u{1F4C4} README.md created"));
|
|
590
|
+
const initContext = {
|
|
591
|
+
projectRoot: targetDir,
|
|
592
|
+
projectName: options.name || dirName,
|
|
593
|
+
generatedBy: "launch-stackwright-pro",
|
|
594
|
+
version: "1.0"
|
|
595
|
+
};
|
|
596
|
+
if (specInfo) {
|
|
597
|
+
initContext.specPath = `specs/${specInfo.specFilename}`;
|
|
598
|
+
initContext.specName = specInfo.derivedName;
|
|
599
|
+
}
|
|
600
|
+
initContext.theme = options.theme || "corporate";
|
|
601
|
+
const stackwrightDir = import_path.default.join(targetDir, ".stackwright");
|
|
602
|
+
await import_fs_extra.default.ensureDir(stackwrightDir);
|
|
603
|
+
await import_fs_extra.default.writeFile(
|
|
604
|
+
import_path.default.join(stackwrightDir, "init-context.json"),
|
|
605
|
+
JSON.stringify(initContext, null, 2) + "\n",
|
|
606
|
+
"utf-8"
|
|
607
|
+
);
|
|
490
608
|
const relDir = import_path.default.relative(process.cwd(), targetDir) || ".";
|
|
491
609
|
console.log(import_chalk.default.cyan.bold("\n\u{1F389} All set! Here's what to do next:\n"));
|
|
492
610
|
console.log(import_chalk.default.white(` 1. cd ${relDir}`));
|
|
493
|
-
console.log(import_chalk.default.white(" 2.
|
|
494
|
-
console.log(import_chalk.default.dim(" (
|
|
611
|
+
console.log(import_chalk.default.white(" 2. npx @stackwright-pro/raft"));
|
|
612
|
+
console.log(import_chalk.default.dim(" (use --verbose for troubleshooting)"));
|
|
495
613
|
if (specInfo) {
|
|
496
614
|
console.log(import_chalk.default.cyan(`
|
|
497
615
|
\u{1F4E1} Your API spec was copied to specs/${specInfo.specFilename}`));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@stackwright-pro/launch-stackwright-pro\",\n \"version\": \"0.4.0-alpha.5\",\n \"description\": \"Launch a new Stackwright Pro project with OpenAPI integration, auth, and the otter raft\",\n \"license\": \"MIT\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Per-Aspera-LLC/stackwright-pro\"\n },\n \"keywords\": [\n \"stackwright\",\n \"stackwright-pro\",\n \"scaffolding\",\n \"openapi\",\n \"government\",\n \"hackathon\"\n ],\n \"files\": [\n \"dist\",\n \"templates\"\n ],\n \"bin\": {\n \"launch-stackwright-pro\": \"dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {\n \"@stackwright-pro/scaffold-hooks\": \"workspace:*\",\n \"@stackwright/cli\": \"^0.7.0\",\n \"@stackwright/scaffold-core\": \"^0.1.0\",\n \"chalk\": \"^5.6.2\",\n \"commander\": \"^14.0.3\",\n \"fs-extra\": \"^11.3\",\n \"js-yaml\": \"^4.1.0\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"^11.0\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^24.0.0\",\n \"typescript\": \"^5.0\",\n \"tsup\": \"^8.5\",\n \"vitest\": \"^4.0.18\"\n }\n}\n","import { Command } from 'commander';\nimport path from 'path';\nimport os from 'os';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\nimport yaml from 'js-yaml';\nimport { execSync } from 'child_process';\n\nimport { scaffold, ScaffoldOptions } from '@stackwright/cli';\nimport { runScaffoldHooks } from '@stackwright/scaffold-core';\nimport { registerProScaffoldHooks } from '@stackwright-pro/scaffold-hooks';\n// Register Pro hooks (adds deps, MCP config, etc.)\n// Must be called before scaffold() to ensure hooks run in the CLI's scaffold-core context\nregisterProScaffoldHooks();\n\nconst { version } = require('../package.json') as { version: string };\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface LaunchProOptions {\n name?: string;\n title?: string;\n theme?: string;\n force?: boolean;\n skipOtters?: boolean;\n skipInstall?: boolean;\n yes?: boolean;\n spec?: string;\n specName?: string;\n mock?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Template copying (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function copyProTemplate(templateName: string, destPath: string): Promise<void> {\n const src = path.resolve(__dirname, '..', 'templates', 'pro', templateName);\n await fs.copy(src, destPath);\n}\n\n// ---------------------------------------------------------------------------\n// Auth config (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function addAuthToStackwrightYml(targetDir: string): Promise<void> {\n const ymlPath = path.join(targetDir, 'stackwright.yml');\n const content = await fs.readFile(ymlPath, 'utf-8');\n const config = yaml.load(content) as Record<string, unknown>;\n\n config.auth = {\n type: 'pki',\n profile: 'dod_cac',\n source: 'gateway_headers',\n roles: [\n { name: 'ADMIN', permissions: ['*'] },\n { name: 'ANALYST', permissions: ['data:read', 'data:write'] },\n { name: 'VIEWER', permissions: ['data:read'] },\n ],\n protected_routes: [{ path: '/*', roles: ['VIEWER', 'ANALYST', 'ADMIN'] }],\n public_routes: ['/', '/getting-started'],\n };\n\n await fs.writeFile(ymlPath, yaml.dump(config, { lineWidth: 120 }));\n}\n\nasync function addIntegrationToStackwrightYml(\n targetDir: string,\n specName: string,\n specFilename: string,\n mockUrl?: string\n): Promise<void> {\n const ymlPath = path.join(targetDir, 'stackwright.yml');\n const content = await fs.readFile(ymlPath, 'utf-8');\n const config = yaml.load(content) as Record<string, unknown>;\n\n const integration: Record<string, unknown> = {\n type: 'openapi',\n name: specName,\n spec: `./specs/${specFilename}`,\n collections: [],\n };\n\n if (mockUrl) {\n integration.mockUrl = mockUrl;\n }\n\n config.integrations = [integration];\n\n await fs.writeFile(ymlPath, yaml.dump(config, { lineWidth: 120 }));\n}\n\n// ---------------------------------------------------------------------------\n// Spec handling (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function handleSpec(\n targetDir: string,\n specPath: string,\n specName?: string\n): Promise<{ specFilename: string; derivedName: string }> {\n const resolvedSpec = path.resolve(specPath);\n\n if (!fs.existsSync(resolvedSpec)) {\n throw new Error(`Spec file not found: ${resolvedSpec}`);\n }\n\n const specFilename = path.basename(resolvedSpec);\n const derivedName = specName || path.basename(specFilename, path.extname(specFilename));\n\n const specsDir = path.join(targetDir, 'specs');\n await fs.ensureDir(specsDir);\n await fs.copy(resolvedSpec, path.join(specsDir, specFilename));\n\n return { specFilename, derivedName };\n}\n\n// ---------------------------------------------------------------------------\n// README generator (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nfunction generateReadme(options: {\n projectName: string;\n hasSpec: boolean;\n specName?: string;\n specFilename?: string;\n hasOtters: boolean;\n hasMock: boolean;\n}): string {\n const { projectName, hasSpec, specName, specFilename, hasOtters, hasMock } = options;\n\n // Build API Integration section if spec is present\n const apiIntegrationSection = hasSpec\n ? `## 📡 API Integration\n\nYour OpenAPI spec was copied to \\`specs/${specFilename}\\` and wired up in \\`stackwright.yml\\`.\n\n**What gets generated:**\n\n\\`\\`\\`typescript\n// src/generated/${specName}/schemas.ts\nexport const EquipmentSchema = z.object({\n id: z.string(),\n name: z.string(),\n status: z.enum(['operational', 'maintenance', 'retired']),\n // ... Zod validation for runtime safety\n});\n\n// src/generated/${specName}/types.ts\nexport type Equipment = z.infer<typeof EquipmentSchema>;\n\n// src/generated/${specName}/client.ts\nexport class ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client {\n async getEquipment(id: string): Promise<Equipment> {\n // Auto-wired with auth, validation, error handling\n }\n}\n\\`\\`\\`\n\n**How it works:**\n1. The \\`predev\\` script in \\`package.json\\` runs \\`prebuild.js\\` before every \\`pnpm dev\\`\n2. Prebuild reads your spec and generates type-safe code\n3. You import and use it:\n\n\\`\\`\\`typescript\nimport { ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client } from '@/generated/${specName}/client';\nimport type { Equipment } from '@/generated/${specName}/types';\n\nconst client = new ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client();\nconst gear: Equipment = await client.getEquipment('123');\n\\`\\`\\`\n\nNo manual typing. No drift. No runtime surprises.\n\n`\n : '';\n\n // Build mock server section if enabled\n const mockSection = hasMock\n ? `## 🎭 Mock Server\n\nPrism mock server is configured to serve your API at **http://localhost:4010**.\n\n\\`\\`\\`bash\npnpm dev:mock # Starts Prism + Next.js together\n\\`\\`\\`\n\nThis starts:\n1. Prism mock server on port 4010 (serves your OpenAPI spec)\n2. Next.js dev server on port 3000\n\nThe generated API client is automatically configured to use the mock server.\n\n`\n : '';\n\n // Build AI Agents section if otters are present\n const aiAgentsSection = hasOtters\n ? `## 🦦 AI Agents (The Otter Raft)\n\nYour project includes **SIX specialized AI agents** in \\`node_modules/@stackwright-pro/otters/\\`:\n\n- \\`stackwright-pro-foreman-otter\\` - Master coordinator that orchestrates all specialist otters\n- \\`stackwright-pro-api-otter\\` - Discovers entities from OpenAPI specs\n- \\`stackwright-pro-auth-otter\\` - Configures CAC/OIDC auth, RBAC rules, and audit middleware\n- \\`stackwright-pro-data-otter\\` - Configures endpoint filters & ISR revalidation\n- \\`stackwright-pro-page-otter\\` - Generates pages auto-wired with data, theme, and auth\n- \\`stackwright-pro-dashboard-otter\\` - Builds live data dashboards\n\n**Start the otter raft:**\n\n\\`\\`\\`bash\nuvx stackwright-pro-raft\n\\`\\`\\`\n\n> **Local dev (before PyPI publish):** \\`python -m stackwright_pro.raft.cli_adapter foreman\\`\n\nThe raft is a Python state machine with a Rich terminal UI — it asks questions about your brand, auth, and data preferences, then coordinates specialist otters to build your app. All user interaction happens in the terminal; code-puppy is called as a one-shot subprocess for creative tasks only.\n\n**Example session prompt:**\n\n\"Build me a logistics dashboard from our OpenAPI spec. Connect to /equipment and /supplies endpoints.\"\n\n`\n : '';\n\n return `# ${projectName}\n\nA Stackwright Pro application with role-based auth, OpenAPI integration, and intelligent AI agents.\n\n## 🚀 Quick Start\n\n\\`\\`\\`bash\n# Start development server\npnpm dev\n\n# Open your browser\nopen http://localhost:3000\n\\`\\`\\`\n\n## 👥 Role-Based Development\n\nStackwright Pro includes **mock authentication** for local development with three pre-configured roles:\n\n\\`\\`\\`bash\npnpm dev:admin # Full permissions (*)\npnpm dev:analyst # Read & write data\npnpm dev:viewer # Read-only access\n\\`\\`\\`\n\n**How it works:**\n- Each script sets the \\`MOCK_USER\\` environment variable\n- \\`lib/mock-auth.ts\\` intercepts requests and injects the appropriate user context\n- Your pages & API routes respect the RBAC rules in \\`stackwright.yml\\`\n- No backend required for testing auth flows! 🎉\n\n**Pro tip:** Test your UI for all three roles to ensure proper permissions enforcement.\n\n${mockSection}## 📁 Project Structure\n\n\\`\\`\\`\n.\n├── pages/\n│ ├── _app.tsx # Pro version with AuthProvider + shadcn\n│ ├── index.tsx # Home page (auto-generated by Stackwright)\n│ ├── about/\n│ │ └── content.yml # Page content in YAML\n│ └── ...\n├── lib/\n│ └── mock-auth.ts # Dev-only auth mocking (no backend needed)\n├── scripts/\n│ └── prebuild.js # Auto-generates code from OpenAPI specs\n├── specs/ # OpenAPI spec files (if --spec was used)\n├── src/\n│ └── generated/ # Auto-generated types & clients\n│ └── {specName}/\n│ ├── schemas.ts # Zod schemas for runtime validation\n│ ├── types.ts # TypeScript types\n│ ├── client.ts # API client with auth\n│ └── provider.ts # CollectionProvider for Stackwright\n├── .stackwright/\n│ └── otters/ # AI agent configs (4 specialized otters)\n├── stackwright.yml # Theme, auth, API integrations\n└── package.json\n\\`\\`\\`\n\n**Key Files:**\n- \\`pages/_app.tsx\\` - Wraps your app with \\`AuthProvider\\` for RBAC\n- \\`stackwright.yml\\` - Single source of truth for theme, auth roles, and API wiring\n- \\`lib/mock-auth.ts\\` - Mocks CAC/PIV headers locally so you can test auth flows\n- \\`scripts/prebuild.js\\` - Runs before dev/build to generate types from your OpenAPI spec\n\n## 📄 Adding Pages\n\nStackwright uses **YAML for content**, so you never touch JSX unless you want to.\n\n**Example:** Create \\`pages/about/content.yml\\`:\n\n\\`\\`\\`yaml\ntitle: About Us\ndescription: Learn more about our mission\n\nsections:\n - type: main\n heading: Who We Are\n body: |\n We build mission-critical logistics systems for the Marine Corps.\n\n - type: feature_list\n title: Our Capabilities\n features:\n - icon: Security\n title: Zero Trust\n description: PKI-based auth with CAC/PIV\n - icon: Api\n title: Real-time Data\n description: OpenAPI-backed, Zod-validated\n\\`\\`\\`\n\nThat's it. Navigate to \\`/about\\` and it just works. No routing config, no React components.\n\n${apiIntegrationSection}## 🎨 Customizing Theme\n\nEdit \\`stackwright.yml\\` to change colors, fonts, spacing — applies everywhere instantly.\n\n\\`\\`\\`yaml\ntheme:\n id: my-theme\n name: My Custom Theme\n colors:\n primary: \"#C41E3A\" # Marine Corps red\n background: \"#FFFFFF\"\n text: \"#1A1A1A\"\n accent: \"#FFD700\" # Gold\n typography:\n fontFamily: \"'Inter', sans-serif\"\n h1Size: \"2.5rem\"\n spacing:\n unit: 8\n\\`\\`\\`\n\nNo CSS files. No theme provider boilerplate. Just YAML. Stackwright handles the rest.\n\n## 🔐 Auth Configuration\n\nStackwright Pro comes with **3 pre-configured roles** in \\`stackwright.yml\\`:\n\n\\`\\`\\`yaml\nauth:\n roles:\n - name: ADMIN\n permissions: ['*'] # Full access\n - name: ANALYST \n permissions: ['data:read', 'data:write'] # Read/write data\n - name: VIEWER\n permissions: ['data:read'] # Read-only\n\\`\\`\\`\n\n**Gate content in your YAML:**\n\n\\`\\`\\`yaml\nsections:\n - type: button\n label: Delete Equipment\n action: /api/equipment/delete\n auth:\n required_roles: [ADMIN]\n fallback: hide # Options: hide, disable, show_message\n\\`\\`\\`\n\nOnly admins see the button. Analysts and viewers? Button doesn't exist in the DOM.\n\n**Route protection:**\n\n\\`\\`\\`yaml\nauth:\n protected_routes:\n - path: /admin/*\n roles: [ADMIN]\n - path: /equipment/* \n roles: [ANALYST, ADMIN]\n public_routes:\n - /\n - /about\n\\`\\`\\`\n\nNo middleware to write. No useAuth hooks to remember. RBAC is declarative.\n\n${aiAgentsSection}## 📚 Learn More\n\n- **Stackwright Docs:** [https://stackwright.dev](https://stackwright.dev)\n- **OSS Repo:** [https://github.com/Per-Aspera-LLC/stackwright](https://github.com/Per-Aspera-LLC/stackwright)\n- **Pro Repo:** [https://github.com/Per-Aspera-LLC/stackwright-pro](https://github.com/Per-Aspera-LLC/stackwright-pro)\n\n**Questions?** File an issue or ping us in the discussions. We're here to help you ship faster.\n`;\n}\n\n// ---------------------------------------------------------------------------\n// Main launch flow\n// ---------------------------------------------------------------------------\n\nasync function launch(targetDir: string, options: LaunchProOptions): Promise<void> {\n const dirName = path.basename(targetDir);\n\n console.log(chalk.cyan.bold('\\n🚢 Launching Stackwright Pro...\\n'));\n\n // ------------------------------------------------------------------\n // 1. Scaffold base OSS project via @stackwright/cli\n // Hooks auto-handle: Pro deps, MCP config, role-based scripts\n // ------------------------------------------------------------------\n\n const scaffoldOpts: ScaffoldOptions = {\n name: options.name || dirName,\n ...(options.title !== undefined && { title: options.title }),\n ...(options.theme !== undefined && { theme: options.theme }),\n ...(options.force !== undefined && { force: options.force }),\n ...(options.yes !== undefined && { noInteractive: options.yes }),\n };\n\n await scaffold(targetDir, scaffoldOpts);\n console.log(chalk.green('✅ Base project scaffolded (hooks added Pro deps + MCP config)'));\n\n // ------------------------------------------------------------------\n // 1b. Run pnpm install — citizen devs shouldn't need to know this step exists\n // ------------------------------------------------------------------\n\n console.log(chalk.cyan('\\n📦 Installing dependencies (this takes a moment)...'));\n if (!options.skipInstall) {\n try {\n execSync('pnpm install', { cwd: targetDir, stdio: 'inherit', timeout: 120_000 });\n console.log(chalk.green('✅ Dependencies installed'));\n } catch {\n console.warn(chalk.yellow('⚠️ pnpm install failed — run it manually: pnpm install'));\n }\n } else {\n console.log(chalk.dim('ℹ️ Skipping install (--skip-install). Run: pnpm install'));\n }\n\n // Fire postInstall hooks now that install has run\n const dependencyMode: 'workspace' | 'standalone' = 'standalone';\n await runScaffoldHooks('postInstall', {\n targetDir,\n projectName: options.name || path.basename(targetDir),\n siteTitle: options.title || options.name || path.basename(targetDir),\n themeId: options.theme || 'corporate',\n packageJson: {},\n dependencyMode,\n });\n\n // ------------------------------------------------------------------\n // 2. Copy Pro templates (hooks can't handle these)\n // ------------------------------------------------------------------\n\n // Replace _app.tsx with Pro version (AuthProvider, shadcn, etc.)\n await copyProTemplate('_app.tsx', path.join(targetDir, 'pages', '_app.tsx'));\n\n // Add root content.yml for the home page\n await copyProTemplate('content.yml', path.join(targetDir, 'pages', 'content.yml'));\n\n // Replace next.config.js with Pro version (transpile pro pkgs)\n await copyProTemplate('next.config.js', path.join(targetDir, 'next.config.js'));\n\n // Add lib/mock-auth.ts\n await fs.ensureDir(path.join(targetDir, 'lib'));\n await copyProTemplate('mock-auth.ts', path.join(targetDir, 'lib', 'mock-auth.ts'));\n\n // Add yaml.d.ts for TypeScript support\n await copyProTemplate('yaml.d.ts', path.join(targetDir, 'yaml.d.ts'));\n\n // Add scripts/prebuild.js\n await fs.ensureDir(path.join(targetDir, 'scripts'));\n await copyProTemplate('prebuild.js', path.join(targetDir, 'scripts', 'prebuild.js'));\n\n console.log(chalk.green('🔐 Auth integration added (RBAC with 3 roles)'));\n\n // ------------------------------------------------------------------\n // 3. Add auth section to stackwright.yml\n // ------------------------------------------------------------------\n\n await addAuthToStackwrightYml(targetDir);\n\n // ------------------------------------------------------------------\n // 4. Handle --spec if provided\n // ------------------------------------------------------------------\n\n let specInfo: { specFilename: string; derivedName: string } | null = null;\n const MOCK_URL = 'http://localhost:4010';\n\n if (options.spec) {\n specInfo = await handleSpec(targetDir, options.spec, options.specName);\n\n // Pass mockUrl if --mock flag is set\n await addIntegrationToStackwrightYml(\n targetDir,\n specInfo.derivedName,\n specInfo.specFilename,\n options.mock ? MOCK_URL : undefined\n );\n console.log(chalk.green('📡 OpenAPI integration wired up'));\n\n if (options.mock) {\n console.log(chalk.green('🎭 Prism mock server configured'));\n }\n } else if (options.mock) {\n // --mock without --spec: use sample Petstore spec for demo\n console.log(\n chalk.yellow(\n '⚠️ No spec provided with --mock. Using sample Petstore spec for demo. Replace with your API spec.'\n )\n );\n\n const specsDir = path.join(targetDir, 'specs');\n await fs.ensureDir(specsDir);\n await copyProTemplate('petstore.yaml', path.join(specsDir, 'petstore.yaml'));\n\n specInfo = { specFilename: 'petstore.yaml', derivedName: 'petstore' };\n\n await addIntegrationToStackwrightYml(\n targetDir,\n specInfo.derivedName,\n specInfo.specFilename,\n MOCK_URL\n );\n console.log(chalk.green('📡 Sample Petstore spec wired up'));\n console.log(chalk.green('🎭 Prism mock server configured'));\n }\n\n // ------------------------------------------------------------------\n // 5. Generate README\n // ------------------------------------------------------------------\n\n const readmeContent = generateReadme({\n projectName: options.name || dirName,\n hasSpec: !!specInfo,\n ...(specInfo?.derivedName !== undefined && { specName: specInfo.derivedName }),\n ...(specInfo?.specFilename !== undefined && { specFilename: specInfo.specFilename }),\n hasOtters: !options.skipOtters,\n hasMock: !!options.mock,\n });\n\n await fs.writeFile(path.join(targetDir, 'README.md'), readmeContent);\n console.log(chalk.green('📄 README.md created'));\n\n // ------------------------------------------------------------------\n // 6. Print next steps\n // ------------------------------------------------------------------\n\n const relDir = path.relative(process.cwd(), targetDir) || '.';\n\n console.log(chalk.cyan.bold(\"\\n🎉 All set! Here's what to do next:\\n\"));\n console.log(chalk.white(` 1. cd ${relDir}`));\n console.log(chalk.white(' 2. uvx stackwright-pro-raft'));\n console.log(chalk.dim(' (local dev: python -m stackwright_pro.raft.cli_adapter foreman)'));\n\n if (specInfo) {\n console.log(chalk.cyan(`\\n📡 Your API spec was copied to specs/${specInfo.specFilename}`));\n console.log(chalk.dim(' The prebuild will generate types & client on first `pnpm dev`.'));\n }\n\n if (options.mock) {\n console.log(chalk.cyan('\\n🎭 Run with mock server:'));\n console.log(chalk.white(' pnpm dev:mock # Starts Prism + Next.js'));\n }\n\n if (!options.skipOtters) {\n console.log(chalk.cyan.bold('\\n🦦 The otter raft is ready to build your site!'));\n console.log(chalk.dim(' Run the command above to get started.\\n'));\n }\n}\n\n// ---------------------------------------------------------------------------\n// CLI definition\n// ---------------------------------------------------------------------------\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('launch-stackwright-pro')\n .description('🚢 Launch a new Stackwright Pro project with auth, OpenAPI, and the otter raft')\n .version(version)\n .argument('[directory]', 'Project directory', '.')\n .option('--name <name>', 'Project name (used in package.json)')\n .option('--title <title>', 'Site title shown in the app bar and browser tab')\n .option('--theme <themeId>', 'Theme ID (e.g., corporate, creative, minimal)')\n .option('--force', 'Launch even if the target directory is not empty')\n .option('--skip-otters', 'Skip copying otter raft configs')\n .option('-y, --yes', 'Skip all prompts, use defaults')\n .option('--mock', 'Configure Prism mock server for API development (runs on port 4010)')\n .option(\n '--spec <path>',\n 'Path to an OpenAPI spec (YAML or JSON) — copies into project and wires up integration'\n )\n .option(\n '--spec-name <name>',\n 'Name for the API integration (default: derived from spec filename)'\n )\n .option(\n '--skip-install',\n 'Skip automatic pnpm install (useful in CI or when using a different package manager)'\n )\n .action(async (directory: string, options: LaunchProOptions) => {\n const homeDir = os.homedir();\n const targetDir = path.resolve(directory);\n\n // Warn (don't block) when scaffolding outside home dir — unusual for a user-facing CLI\n if (!targetDir.startsWith(homeDir + path.sep) && targetDir !== homeDir) {\n console.warn(chalk.yellow(`⚠️ Scaffolding outside your home directory: ${targetDir}`));\n }\n\n await launch(targetDir, options);\n });\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((err: unknown) => {\n console.error(chalk.red('\\n❌ Launch failed:'), err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,SAAW;AAAA,MACX,eAAiB;AAAA,QACf,QAAU;AAAA,MACZ;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAS;AAAA,QACP;AAAA,QACA;AAAA,MACF;AAAA,MACA,KAAO;AAAA,QACL,0BAA0B;AAAA,MAC5B;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,KAAO;AAAA,QACP,MAAQ;AAAA,QACR,iBAAiB;AAAA,MACnB;AAAA,MACA,cAAgB;AAAA,QACd,mCAAmC;AAAA,QACnC,oBAAoB;AAAA,QACpB,8BAA8B;AAAA,QAC9B,OAAS;AAAA,QACT,WAAa;AAAA,QACb,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,MACA,iBAAmB;AAAA,QACjB,mBAAmB;AA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,YAA8B;AAC9D,UAAM,UAAU,UAAAC,QAAG,QAAQ;AAC3B,UAAM,YAAY,YAAAJ,QAAK,QAAQ,SAAS;AAGxC,QAAI,CAAC,UAAU,WAAW,UAAU,YAAAA,QAAK,GAAG,KAAK,cAAc,SAAS;AACtE,cAAQ,KAAK,aAAAG,QAAM,OAAO,0DAAgD,SAAS,EAAE,CAAC;AAAA,IACxF;AAEA,UAAM,OAAO,WAAW,OAAO;AAAA,EACjC,CAAC;AAEH,QAAM,QAAQ,WAAW,QAAQ,IAAI;AACvC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAiB;AAC7B,UAAQ,MAAM,aAAAA,QAAM,IAAI,yBAAoB,GAAG,GAAG;AAClD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["exports","module","path","fs","yaml","chalk","os"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/index.ts","../src/generated/workspace-versions.ts"],"sourcesContent":["{\n \"name\": \"@stackwright-pro/launch-stackwright-pro\",\n \"version\": \"0.4.0-alpha.50\",\n \"description\": \"Launch a new Stackwright Pro project with OpenAPI integration, auth, and the otter raft\",\n \"license\": \"MIT\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Per-Aspera-LLC/stackwright-pro\"\n },\n \"keywords\": [\n \"stackwright\",\n \"stackwright-pro\",\n \"scaffolding\",\n \"openapi\",\n \"government\",\n \"hackathon\"\n ],\n \"files\": [\n \"dist\",\n \"templates\"\n ],\n \"bin\": {\n \"launch-stackwright-pro\": \"dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"node ../../scripts/sync-versions.mjs && tsup\",\n \"sync-versions\": \"node ../../scripts/sync-versions.mjs\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {\n \"@stackwright-pro/auth\": \"workspace:*\",\n \"@stackwright-pro/auth-nextjs\": \"workspace:*\",\n \"@stackwright-pro/mcp\": \"workspace:*\",\n \"@stackwright-pro/openapi\": \"workspace:*\",\n \"@stackwright-pro/otters\": \"workspace:*\",\n \"@stackwright-pro/scaffold-hooks\": \"latest\",\n \"@stackwright/cli\": \"^0.7.1-alpha.0\",\n \"@stackwright/scaffold-core\": \"^0.1.0\",\n \"chalk\": \"^5.6.2\",\n \"commander\": \"^14.0.3\",\n \"fs-extra\": \"^11.3\",\n \"js-yaml\": \"^4.1.0\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"^11.0\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^24.0.0\",\n \"typescript\": \"^5.0\",\n \"tsup\": \"^8.5\",\n \"vitest\": \"^4.0.18\"\n }\n}\n","import { Command } from 'commander';\nimport path from 'path';\nimport os from 'os';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\nimport yaml from 'js-yaml';\nimport { execSync } from 'child_process';\n\nimport { scaffold, ScaffoldOptions } from '@stackwright/cli';\nimport { runScaffoldHooks } from '@stackwright/scaffold-core';\nimport { registerProScaffoldHooks } from '@stackwright-pro/scaffold-hooks';\nimport { PRO_VERSIONS, OSS_VERSIONS } from './generated/workspace-versions';\n// Register Pro hooks (adds deps, MCP config, etc.)\n// Must be called before scaffold() to ensure hooks run in the CLI's scaffold-core context\nregisterProScaffoldHooks();\n\nconst { version } = require('../package.json') as { version: string };\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface LaunchProOptions {\n name?: string;\n title?: string;\n theme?: string;\n force?: boolean;\n skipOtters?: boolean;\n skipInstall?: boolean;\n yes?: boolean;\n spec?: string;\n specName?: string;\n mock?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Template copying (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function copyProTemplate(templateName: string, destPath: string): Promise<void> {\n const src = path.resolve(__dirname, '..', 'templates', 'pro', templateName);\n await fs.copy(src, destPath);\n}\n\n// ---------------------------------------------------------------------------\n// Auth config (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function addAuthToStackwrightYml(targetDir: string): Promise<void> {\n const ymlPath = path.join(targetDir, 'stackwright.yml');\n const content = await fs.readFile(ymlPath, 'utf-8');\n const config = yaml.load(content, { schema: yaml.CORE_SCHEMA }) as Record<string, unknown>;\n\n config.auth = {\n type: 'pki',\n profile: 'dod_cac',\n source: 'gateway_headers',\n roles: [\n { name: 'ADMIN', permissions: ['*'] },\n { name: 'ANALYST', permissions: ['data:read', 'data:write'] },\n { name: 'VIEWER', permissions: ['data:read'] },\n ],\n protected_routes: [{ path: '/*', roles: ['VIEWER', 'ANALYST', 'ADMIN'] }],\n public_routes: ['/', '/getting-started'],\n };\n\n await fs.writeFile(ymlPath, yaml.dump(config, { lineWidth: 120 }));\n}\n\nasync function addProDepsToPackageJson(targetDir: string): Promise<void> {\n const pkgPath = path.join(targetDir, 'package.json');\n const content = await fs.readFile(pkgPath, 'utf-8');\n const pkg = JSON.parse(content) as Record<string, any>;\n\n const dependencies = (pkg.dependencies as Record<string, string>) || {};\n const devDependencies = (pkg.devDependencies as Record<string, string>) || {};\n const scripts = (pkg.scripts as Record<string, string>) || {};\n\n // Fix any workspace:* references that scaffold may have written\n // (happens when running from inside a pnpm workspace)\n for (const [pkgName, pinnedVersion] of Object.entries(OSS_VERSIONS)) {\n if (dependencies[pkgName] === 'workspace:*') {\n dependencies[pkgName] = pinnedVersion;\n }\n if (devDependencies[pkgName] === 'workspace:*') {\n devDependencies[pkgName] = pinnedVersion;\n }\n }\n\n // Pro runtime dependencies — exact versions from workspace at build time\n Object.assign(dependencies, {\n '@stackwright-pro/display-components': PRO_VERSIONS['@stackwright-pro/display-components'],\n '@stackwright-pro/mcp': PRO_VERSIONS['@stackwright-pro/mcp'],\n '@stackwright-pro/otters': PRO_VERSIONS['@stackwright-pro/otters'],\n '@stackwright-pro/openapi': PRO_VERSIONS['@stackwright-pro/openapi'],\n '@stackwright-pro/auth': PRO_VERSIONS['@stackwright-pro/auth'],\n '@stackwright-pro/auth-nextjs': PRO_VERSIONS['@stackwright-pro/auth-nextjs'],\n '@stackwright-pro/pulse': PRO_VERSIONS['@stackwright-pro/pulse'],\n '@stackwright-pro/workflow-components': PRO_VERSIONS['@stackwright-pro/workflow-components'],\n '@stackwright-pro/workflow': PRO_VERSIONS['@stackwright-pro/workflow'],\n zod: '^4.0.0',\n });\n\n // Pro dev dependencies\n Object.assign(devDependencies, {\n '@stoplight/prism-cli': '^5.14.2',\n });\n\n // Role-based dev scripts\n Object.assign(scripts, {\n 'dev:admin': 'MOCK_USER=admin next dev',\n 'dev:analyst': 'MOCK_USER=analyst next dev',\n 'dev:viewer': 'MOCK_USER=viewer next dev',\n prebuild: 'node scripts/prebuild.js',\n predev: 'node scripts/prebuild.js',\n });\n\n pkg.dependencies = dependencies;\n pkg.devDependencies = devDependencies;\n pkg.scripts = scripts;\n\n await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\\n', 'utf-8');\n}\n\nasync function addIntegrationToStackwrightYml(\n targetDir: string,\n specName: string,\n specFilename: string,\n mockUrl?: string\n): Promise<void> {\n const ymlPath = path.join(targetDir, 'stackwright.yml');\n const content = await fs.readFile(ymlPath, 'utf-8');\n const config = yaml.load(content, { schema: yaml.CORE_SCHEMA }) as Record<string, unknown>;\n\n const integration: Record<string, unknown> = {\n type: 'openapi',\n name: specName,\n spec: `./specs/${specFilename}`,\n collections: [],\n };\n\n if (mockUrl) {\n integration.mockUrl = mockUrl;\n }\n\n config.integrations = [integration];\n\n await fs.writeFile(ymlPath, yaml.dump(config, { lineWidth: 120 }));\n}\n\n// ---------------------------------------------------------------------------\n// Spec handling (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nasync function handleSpec(\n targetDir: string,\n specPath: string,\n specName?: string\n): Promise<{ specFilename: string; derivedName: string }> {\n const resolvedSpec = path.resolve(specPath);\n\n if (!fs.existsSync(resolvedSpec)) {\n throw new Error(`Spec file not found: ${resolvedSpec}`);\n }\n\n const specFilename = path.basename(resolvedSpec);\n const derivedName = specName || path.basename(specFilename, path.extname(specFilename));\n\n const specsDir = path.join(targetDir, 'specs');\n await fs.ensureDir(specsDir);\n await fs.copy(resolvedSpec, path.join(specsDir, specFilename));\n\n return { specFilename, derivedName };\n}\n\n// ---------------------------------------------------------------------------\n// README generator (Pro-specific - hooks can't handle these)\n// ---------------------------------------------------------------------------\n\nfunction generateReadme(options: {\n projectName: string;\n hasSpec: boolean;\n specName?: string;\n specFilename?: string;\n hasOtters: boolean;\n hasMock: boolean;\n}): string {\n const { projectName, hasSpec, specName, specFilename, hasOtters, hasMock } = options;\n\n // Build API Integration section if spec is present\n const apiIntegrationSection = hasSpec\n ? `## 📡 API Integration\n\nYour OpenAPI spec was copied to \\`specs/${specFilename}\\` and wired up in \\`stackwright.yml\\`.\n\n**What gets generated:**\n\n\\`\\`\\`typescript\n// src/generated/${specName}/schemas.ts\nexport const EquipmentSchema = z.object({\n id: z.string(),\n name: z.string(),\n status: z.enum(['operational', 'maintenance', 'retired']),\n // ... Zod validation for runtime safety\n});\n\n// src/generated/${specName}/types.ts\nexport type Equipment = z.infer<typeof EquipmentSchema>;\n\n// src/generated/${specName}/client.ts\nexport class ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client {\n async getEquipment(id: string): Promise<Equipment> {\n // Auto-wired with auth, validation, error handling\n }\n}\n\\`\\`\\`\n\n**How it works:**\n1. The \\`predev\\` script in \\`package.json\\` runs \\`prebuild.js\\` before every \\`pnpm dev\\`\n2. Prebuild reads your spec and generates type-safe code\n3. You import and use it:\n\n\\`\\`\\`typescript\nimport { ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client } from '@/generated/${specName}/client';\nimport type { Equipment } from '@/generated/${specName}/types';\n\nconst client = new ${specName!.charAt(0).toUpperCase() + specName!.slice(1)}Client();\nconst gear: Equipment = await client.getEquipment('123');\n\\`\\`\\`\n\nNo manual typing. No drift. No runtime surprises.\n\n`\n : '';\n\n // Build mock server section if enabled\n const mockSection = hasMock\n ? `## 🎭 Mock Server\n\nPrism mock server is configured to serve your API at **http://localhost:4010**.\n\n\\`\\`\\`bash\npnpm dev:mock # Starts Prism + Next.js together\n\\`\\`\\`\n\nThis starts:\n1. Prism mock server on port 4010 (serves your OpenAPI spec)\n2. Next.js dev server on port 3000\n\nThe generated API client is automatically configured to use the mock server.\n\n`\n : '';\n\n // Build AI Agents section if otters are present\n const aiAgentsSection = hasOtters\n ? `## 🦦 AI Agents (The Otter Raft)\n\nYour project includes **SIX specialized AI agents** in \\`node_modules/@stackwright-pro/otters/\\`:\n\n- \\`stackwright-pro-foreman-otter\\` - Master coordinator that orchestrates all specialist otters\n- \\`stackwright-pro-api-otter\\` - Discovers entities from OpenAPI specs\n- \\`stackwright-pro-auth-otter\\` - Configures CAC/OIDC auth, RBAC rules, and audit middleware\n- \\`stackwright-pro-data-otter\\` - Configures endpoint filters & ISR revalidation\n- \\`stackwright-pro-page-otter\\` - Generates pages auto-wired with data, theme, and auth\n- \\`stackwright-pro-dashboard-otter\\` - Builds live data dashboards\n\n**Start the otter raft:**\n\n\\`\\`\\`bash\nnpx @stackwright-pro/raft\n\\`\\`\\`\n\nThe raft verifies otter integrity, writes project context, and spawns code-puppy in foreman mode. The foreman asks questions about your brand, auth, and data preferences, then coordinates specialist otters to build your app. All state lives in \\`.stackwright/\\` — interrupt and resume anytime.\n\n**Example session prompt:**\n\n\"Build me a logistics dashboard from our OpenAPI spec. Connect to /equipment and /supplies endpoints.\"\n\n`\n : '';\n\n return `# ${projectName}\n\nA Stackwright Pro application with role-based auth, OpenAPI integration, and intelligent AI agents.\n\n## 🚀 Quick Start\n\n\\`\\`\\`bash\n# Start development server\npnpm dev\n\n# Open your browser\nopen http://localhost:3000\n\\`\\`\\`\n\n## 👥 Role-Based Development\n\nStackwright Pro includes **mock authentication** for local development with three pre-configured roles:\n\n\\`\\`\\`bash\npnpm dev:admin # Full permissions (*)\npnpm dev:analyst # Read & write data\npnpm dev:viewer # Read-only access\n\\`\\`\\`\n\n**How it works:**\n- Each script sets the \\`MOCK_USER\\` environment variable\n- \\`lib/mock-auth.ts\\` intercepts requests and injects the appropriate user context\n- Your pages & API routes respect the RBAC rules in \\`stackwright.yml\\`\n- No backend required for testing auth flows! 🎉\n\n**Pro tip:** Test your UI for all three roles to ensure proper permissions enforcement.\n\n${mockSection}## 📁 Project Structure\n\n\\`\\`\\`\n.\n├── pages/\n│ ├── _app.tsx # Pro version with AuthProvider + shadcn\n│ ├── index.tsx # Home page (auto-generated by Stackwright)\n│ ├── about/\n│ │ └── content.yml # Page content in YAML\n│ └── ...\n├── lib/\n│ └── mock-auth.ts # Dev-only auth mocking (no backend needed)\n├── scripts/\n│ └── prebuild.js # Auto-generates code from OpenAPI specs\n├── specs/ # OpenAPI spec files (if --spec was used)\n├── src/\n│ └── generated/ # Auto-generated types & clients\n│ └── {specName}/\n│ ├── schemas.ts # Zod schemas for runtime validation\n│ ├── types.ts # TypeScript types\n│ ├── client.ts # API client with auth\n│ └── provider.ts # CollectionProvider for Stackwright\n├── .stackwright/\n│ └── otters/ # AI agent configs (4 specialized otters)\n├── stackwright.yml # Theme, auth, API integrations\n└── package.json\n\\`\\`\\`\n\n**Key Files:**\n- \\`pages/_app.tsx\\` - Wraps your app with \\`AuthProvider\\` for RBAC\n- \\`stackwright.yml\\` - Single source of truth for theme, auth roles, and API wiring\n- \\`lib/mock-auth.ts\\` - Mocks CAC/PIV headers locally so you can test auth flows\n- \\`scripts/prebuild.js\\` - Runs before dev/build to generate types from your OpenAPI spec\n\n## 📄 Adding Pages\n\nStackwright uses **YAML for content**, so you never touch JSX unless you want to.\n\n**Example:** Create \\`pages/about/content.yml\\`:\n\n\\`\\`\\`yaml\ntitle: About Us\ndescription: Learn more about our mission\n\nsections:\n - type: main\n heading: Who We Are\n body: |\n We build mission-critical logistics systems for the Marine Corps.\n\n - type: feature_list\n title: Our Capabilities\n features:\n - icon: Security\n title: Zero Trust\n description: PKI-based auth with CAC/PIV\n - icon: Api\n title: Real-time Data\n description: OpenAPI-backed, Zod-validated\n\\`\\`\\`\n\nThat's it. Navigate to \\`/about\\` and it just works. No routing config, no React components.\n\n${apiIntegrationSection}## 🎨 Customizing Theme\n\nEdit \\`stackwright.yml\\` to change colors, fonts, spacing — applies everywhere instantly.\n\n\\`\\`\\`yaml\ntheme:\n id: my-theme\n name: My Custom Theme\n colors:\n primary: \"#C41E3A\" # Marine Corps red\n background: \"#FFFFFF\"\n text: \"#1A1A1A\"\n accent: \"#FFD700\" # Gold\n typography:\n fontFamily: \"'Inter', sans-serif\"\n h1Size: \"2.5rem\"\n spacing:\n unit: 8\n\\`\\`\\`\n\nNo CSS files. No theme provider boilerplate. Just YAML. Stackwright handles the rest.\n\n## 🔐 Auth Configuration\n\nStackwright Pro comes with **3 pre-configured roles** in \\`stackwright.yml\\`:\n\n\\`\\`\\`yaml\nauth:\n roles:\n - name: ADMIN\n permissions: ['*'] # Full access\n - name: ANALYST \n permissions: ['data:read', 'data:write'] # Read/write data\n - name: VIEWER\n permissions: ['data:read'] # Read-only\n\\`\\`\\`\n\n**Gate content in your YAML:**\n\n\\`\\`\\`yaml\nsections:\n - type: button\n label: Delete Equipment\n action: /api/equipment/delete\n auth:\n required_roles: [ADMIN]\n fallback: hide # Options: hide, disable, show_message\n\\`\\`\\`\n\nOnly admins see the button. Analysts and viewers? Button doesn't exist in the DOM.\n\n**Route protection:**\n\n\\`\\`\\`yaml\nauth:\n protected_routes:\n - path: /admin/*\n roles: [ADMIN]\n - path: /equipment/* \n roles: [ANALYST, ADMIN]\n public_routes:\n - /\n - /about\n\\`\\`\\`\n\nNo middleware to write. No useAuth hooks to remember. RBAC is declarative.\n\n${aiAgentsSection}## 📚 Learn More\n\n- **Stackwright Docs:** [https://stackwright.dev](https://stackwright.dev)\n- **OSS Repo:** [https://github.com/Per-Aspera-LLC/stackwright](https://github.com/Per-Aspera-LLC/stackwright)\n- **Pro Repo:** [https://github.com/Per-Aspera-LLC/stackwright-pro](https://github.com/Per-Aspera-LLC/stackwright-pro)\n\n**Questions?** File an issue or ping us in the discussions. We're here to help you ship faster.\n`;\n}\n\n// ---------------------------------------------------------------------------\n// Main launch flow\n// ---------------------------------------------------------------------------\n\nasync function launch(targetDir: string, options: LaunchProOptions): Promise<void> {\n const dirName = path.basename(targetDir);\n\n console.log(chalk.cyan.bold('\\n🚢 Launching Stackwright Pro...\\n'));\n\n // ------------------------------------------------------------------\n // 1. Scaffold base OSS project via @stackwright/cli\n // Hooks auto-handle: Pro deps, MCP config, role-based scripts\n // ------------------------------------------------------------------\n\n const scaffoldOpts: ScaffoldOptions = {\n name: options.name || dirName,\n standalone: true, // prevents `workspace:*` refs when CLI runs inside the Pro monorepo\n ...(options.title !== undefined && { title: options.title }),\n ...(options.theme !== undefined && { theme: options.theme }),\n ...(options.force !== undefined && { force: options.force }),\n ...(options.yes !== undefined && { noInteractive: options.yes }),\n };\n\n await scaffold(targetDir, scaffoldOpts);\n console.log(chalk.green('✅ Base project scaffolded (hooks added Pro deps + MCP config)'));\n\n // ------------------------------------------------------------------\n // 1b. Run pnpm install — citizen devs shouldn't need to know this step exists\n // ------------------------------------------------------------------\n\n // Patch Pro packages directly into package.json before install.\n // This bypasses the scaffold hooks system (which has a known version-resolution\n // issue) and guarantees pro deps land regardless of hook execution order.\n await addProDepsToPackageJson(targetDir);\n console.log(chalk.green('🦦 Pro packages added to package.json'));\n\n // Verify package.json has Pro deps before installing\n const verifyPkg = JSON.parse(\n await fs.readFile(path.join(targetDir, 'package.json'), 'utf-8')\n ) as Record<string, any>;\n const proDepCount = Object.keys((verifyPkg.dependencies as Record<string, string>) || {}).filter(\n (k) => k.startsWith('@stackwright-pro')\n ).length;\n console.log(chalk.dim(` → package.json verified: ${proDepCount} @stackwright-pro/* deps ready`));\n\n console.log(chalk.cyan('\\n📦 Installing dependencies (this takes a moment)...'));\n if (!options.skipInstall) {\n try {\n execSync('pnpm install --ignore-workspace', {\n cwd: targetDir,\n stdio: 'inherit',\n timeout: 120_000,\n });\n console.log(chalk.green('✅ Dependencies installed'));\n } catch (err: unknown) {\n const isTimeout =\n err instanceof Error &&\n (err.message.includes('ETIMEDOUT') || err.message.includes('timeout'));\n console.error(\n chalk.red('\\n❌ pnpm install failed. Auth and Pro packages are NOT installed.')\n );\n console.error(\n chalk.red(' Your project is in an incomplete state — do NOT run or deploy it.')\n );\n if (isTimeout) {\n console.error(\n chalk.yellow(' The install timed out (>2 min). Check your network connection.')\n );\n }\n console.error(\n chalk.yellow(` Fix the error above, then run: pnpm install --ignore-workspace`)\n );\n process.exit(1);\n }\n } else {\n console.log(chalk.dim('ℹ️ Skipping install (--skip-install). Run: pnpm install'));\n }\n\n // Fire postInstall hooks now that install has run\n const dependencyMode: 'workspace' | 'standalone' = 'standalone';\n await runScaffoldHooks('postInstall', {\n targetDir,\n projectName: options.name || path.basename(targetDir),\n siteTitle: options.title || options.name || path.basename(targetDir),\n themeId: options.theme || 'corporate',\n packageJson: {},\n dependencyMode,\n });\n\n // ------------------------------------------------------------------\n // 2. Copy Pro templates (hooks can't handle these)\n // ------------------------------------------------------------------\n\n // Replace _app.tsx with Pro version (AuthProvider, shadcn, etc.)\n await copyProTemplate('_app.tsx', path.join(targetDir, 'pages', '_app.tsx'));\n\n // Add root content.yml for the home page\n await copyProTemplate('content.yml', path.join(targetDir, 'pages', 'content.yml'));\n\n // Replace next.config.js with Pro version (transpile pro pkgs)\n await copyProTemplate('next.config.js', path.join(targetDir, 'next.config.js'));\n\n // Add lib/mock-auth.ts\n await fs.ensureDir(path.join(targetDir, 'lib'));\n await copyProTemplate('mock-auth.ts', path.join(targetDir, 'lib', 'mock-auth.ts'));\n\n // Add yaml.d.ts for TypeScript support\n await copyProTemplate('yaml.d.ts', path.join(targetDir, 'yaml.d.ts'));\n\n // Add scripts/prebuild.js\n await fs.ensureDir(path.join(targetDir, 'scripts'));\n await copyProTemplate('prebuild.js', path.join(targetDir, 'scripts', 'prebuild.js'));\n\n console.log(chalk.green('🔐 Auth integration added (RBAC with 3 roles)'));\n\n // ------------------------------------------------------------------\n // 3. Add auth section to stackwright.yml\n // ------------------------------------------------------------------\n\n await addAuthToStackwrightYml(targetDir);\n\n // ------------------------------------------------------------------\n // 4. Handle --spec if provided\n // ------------------------------------------------------------------\n\n let specInfo: { specFilename: string; derivedName: string } | null = null;\n const MOCK_URL = 'http://localhost:4010';\n\n if (options.spec) {\n specInfo = await handleSpec(targetDir, options.spec, options.specName);\n\n // Pass mockUrl if --mock flag is set\n await addIntegrationToStackwrightYml(\n targetDir,\n specInfo.derivedName,\n specInfo.specFilename,\n options.mock ? MOCK_URL : undefined\n );\n console.log(chalk.green('📡 OpenAPI integration wired up'));\n\n if (options.mock) {\n console.log(chalk.green('🎭 Prism mock server configured'));\n }\n } else if (options.mock) {\n // --mock without --spec: use sample Petstore spec for demo\n console.log(\n chalk.yellow(\n '⚠️ No spec provided with --mock. Using sample Petstore spec for demo. Replace with your API spec.'\n )\n );\n\n const specsDir = path.join(targetDir, 'specs');\n await fs.ensureDir(specsDir);\n await copyProTemplate('petstore.yaml', path.join(specsDir, 'petstore.yaml'));\n\n specInfo = { specFilename: 'petstore.yaml', derivedName: 'petstore' };\n\n await addIntegrationToStackwrightYml(\n targetDir,\n specInfo.derivedName,\n specInfo.specFilename,\n MOCK_URL\n );\n console.log(chalk.green('📡 Sample Petstore spec wired up'));\n console.log(chalk.green('🎭 Prism mock server configured'));\n }\n\n // ------------------------------------------------------------------\n // 5. Generate README\n // ------------------------------------------------------------------\n\n const readmeContent = generateReadme({\n projectName: options.name || dirName,\n hasSpec: !!specInfo,\n ...(specInfo?.derivedName !== undefined && { specName: specInfo.derivedName }),\n ...(specInfo?.specFilename !== undefined && { specFilename: specInfo.specFilename }),\n hasOtters: !options.skipOtters,\n hasMock: !!options.mock,\n });\n\n await fs.writeFile(path.join(targetDir, 'README.md'), readmeContent);\n console.log(chalk.green('📄 README.md created'));\n\n // ------------------------------------------------------------------\n // 5b. Write init-context.json for raft launcher\n // ------------------------------------------------------------------\n\n const initContext: Record<string, unknown> = {\n projectRoot: targetDir,\n projectName: options.name || dirName,\n generatedBy: 'launch-stackwright-pro',\n version: '1.0',\n };\n\n if (specInfo) {\n initContext.specPath = `specs/${specInfo.specFilename}`;\n initContext.specName = specInfo.derivedName;\n }\n\n initContext.theme = options.theme || 'corporate';\n\n const stackwrightDir = path.join(targetDir, '.stackwright');\n await fs.ensureDir(stackwrightDir);\n await fs.writeFile(\n path.join(stackwrightDir, 'init-context.json'),\n JSON.stringify(initContext, null, 2) + '\\n',\n 'utf-8'\n );\n\n // ------------------------------------------------------------------\n // 6. Print next steps\n // ------------------------------------------------------------------\n\n const relDir = path.relative(process.cwd(), targetDir) || '.';\n\n console.log(chalk.cyan.bold(\"\\n🎉 All set! Here's what to do next:\\n\"));\n console.log(chalk.white(` 1. cd ${relDir}`));\n console.log(chalk.white(' 2. npx @stackwright-pro/raft'));\n console.log(chalk.dim(' (use --verbose for troubleshooting)'));\n\n if (specInfo) {\n console.log(chalk.cyan(`\\n📡 Your API spec was copied to specs/${specInfo.specFilename}`));\n console.log(chalk.dim(' The prebuild will generate types & client on first `pnpm dev`.'));\n }\n\n if (options.mock) {\n console.log(chalk.cyan('\\n🎭 Run with mock server:'));\n console.log(chalk.white(' pnpm dev:mock # Starts Prism + Next.js'));\n }\n\n if (!options.skipOtters) {\n console.log(chalk.cyan.bold('\\n🦦 The otter raft is ready to build your site!'));\n console.log(chalk.dim(' Run the command above to get started.\\n'));\n }\n}\n\n// ---------------------------------------------------------------------------\n// CLI definition\n// ---------------------------------------------------------------------------\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('launch-stackwright-pro')\n .description('🚢 Launch a new Stackwright Pro project with auth, OpenAPI, and the otter raft')\n .version(version)\n .argument('[directory]', 'Project directory', '.')\n .option('--name <name>', 'Project name (used in package.json)')\n .option('--title <title>', 'Site title shown in the app bar and browser tab')\n .option('--theme <themeId>', 'Theme ID (e.g., corporate, creative, minimal)')\n .option('--force', 'Launch even if the target directory is not empty')\n .option('--skip-otters', 'Skip copying otter raft configs')\n .option('-y, --yes', 'Skip all prompts, use defaults')\n .option('--mock', 'Configure Prism mock server for API development (runs on port 4010)')\n .option(\n '--spec <path>',\n 'Path to an OpenAPI spec (YAML or JSON) — copies into project and wires up integration'\n )\n .option(\n '--spec-name <name>',\n 'Name for the API integration (default: derived from spec filename)'\n )\n .option(\n '--skip-install',\n 'Skip automatic pnpm install (useful in CI or when using a different package manager)'\n )\n .action(async (directory: string, options: LaunchProOptions) => {\n const homeDir = os.homedir();\n const targetDir = path.resolve(directory);\n\n // Warn (don't block) when scaffolding outside home dir — unusual for a user-facing CLI\n if (!targetDir.startsWith(homeDir + path.sep) && targetDir !== homeDir) {\n console.warn(chalk.yellow(`⚠️ Scaffolding outside your home directory: ${targetDir}`));\n }\n\n await launch(targetDir, options);\n });\n\n await program.parseAsync(process.argv);\n}\n\nmain().catch((err: unknown) => {\n console.error(chalk.red('\\n❌ Launch failed:'), err);\n process.exit(1);\n});\n","// AUTO-GENERATED — do not edit manually.\n// Run `pnpm sync-versions` or `pnpm build` to regenerate.\n//\n// PRO_VERSIONS: exact versions of @stackwright-pro/* packages in this workspace.\n// OSS_VERSIONS: minimum tested versions of @stackwright/* OSS packages (caret range).\n\n/**\n * Exact versions of every @stackwright-pro/* package currently in the workspace.\n * Used by launch-stackwright-pro and scaffold-hooks to pin deps in scaffolded projects.\n * Updated automatically on every build — never edit this file by hand.\n */\nexport const PRO_VERSIONS = {\n '@stackwright-pro/auth': '0.2.0-alpha.3',\n '@stackwright-pro/auth-nextjs': '0.2.0-alpha.3',\n '@stackwright-pro/display-components': '0.2.0-alpha.5',\n '@stackwright-pro/mcp': '0.2.0-alpha.29',\n '@stackwright-pro/openapi': '0.3.0-alpha.10',\n '@stackwright-pro/otters': '1.0.0-alpha.29',\n '@stackwright-pro/pulse': '0.3.0-alpha.7',\n '@stackwright-pro/workflow': '0.1.0-alpha.7',\n '@stackwright-pro/workflow-components': '0.1.0-alpha.9',\n} as const satisfies Record<string, string>;\n\n/**\n * Minimum tested versions of @stackwright/* OSS packages.\n * Caret ranges anchored to the last version resolved in pnpm-lock.yaml.\n * Updated automatically on every build.\n */\nexport const OSS_VERSIONS = {\n '@stackwright/build-scripts': '^0.7.0',\n '@stackwright/core': '^0.8.2',\n '@stackwright/icons': '^0.3.0',\n '@stackwright/mcp': '^0.2.0',\n '@stackwright/nextjs': '^0.3.1',\n '@stackwright/otters': '^0.2.0',\n '@stackwright/ui-shadcn': '^0.1.0',\n} as const satisfies Record<string, string>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,SAAW;AAAA,MACX,eAAiB;AAAA,QACf,QAAU;AAAA,MACZ;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAS;AAAA,QACP;AAAA,QACA;AAAA,MACF;AAAA,MACA,KAAO;AAAA,QACL,0BAA0B;AAAA,MAC5B;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,iBAAiB;AAAA,QACjB,KAAO;AAAA,QACP,MAAQ;AAAA,QACR,iBAAiB;AAAA,MACnB;AAAA,MACA,cAAgB;AAAA,QACd,yBAAyB;AAAA,QACzB,gCAAgC;AAAA,QAChC,wBAAwB;AAAA,QACxB,4BAA4B;AAAA,QAC5B,2BAA2B;AAAA,QAC3B,mCAAmC;AAAA,QACnC,oBAAoB;AAAA,QACpB,8BAA8B;AAAA,QAC9B,OAAS;AAAA,QACT,WAAa;AAAA,QACb,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,MACA,i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4C,CAAC;AAAA,EACrE;AACF;AAMA,eAAe,OAAsB;AACnC,QAAM,UAAU,IAAI,yBAAQ;AAE5B,UACG,KAAK,wBAAwB,EAC7B,YAAY,uFAAgF,EAC5F,QAAQ,OAAO,EACf,SAAS,eAAe,qBAAqB,GAAG,EAChD,OAAO,iBAAiB,qCAAqC,EAC7D,OAAO,mBAAmB,iDAAiD,EAC3E,OAAO,qBAAqB,+CAA+C,EAC3E,OAAO,WAAW,kDAAkD,EACpE,OAAO,iBAAiB,iCAAiC,EACzD,OAAO,aAAa,gCAAgC,EACpD,OAAO,UAAU,qEAAqE,EACtF;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,OAAO,WAAmB,YAA8B;AAC9D,UAAM,UAAU,UAAAC,QAAG,QAAQ;AAC3B,UAAM,YAAY,YAAAJ,QAAK,QAAQ,SAAS;AAGxC,QAAI,CAAC,UAAU,WAAW,UAAU,YAAAA,QAAK,GAAG,KAAK,cAAc,SAAS;AACtE,cAAQ,KAAK,aAAAG,QAAM,OAAO,0DAAgD,SAAS,EAAE,CAAC;AAAA,IACxF;AAEA,UAAM,OAAO,WAAW,OAAO;AAAA,EACjC,CAAC;AAEH,QAAM,QAAQ,WAAW,QAAQ,IAAI;AACvC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAiB;AAC7B,UAAQ,MAAM,aAAAA,QAAM,IAAI,yBAAoB,GAAG,GAAG;AAClD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["exports","module","path","fs","yaml","chalk","os"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackwright-pro/launch-stackwright-pro",
|
|
3
|
-
"version": "0.4.0-alpha.
|
|
3
|
+
"version": "0.4.0-alpha.50",
|
|
4
4
|
"description": "Launch a new Stackwright Pro project with OpenAPI integration, auth, and the otter raft",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -26,13 +26,18 @@
|
|
|
26
26
|
"launch-stackwright-pro": "dist/index.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@stackwright/
|
|
29
|
+
"@stackwright-pro/scaffold-hooks": "latest",
|
|
30
|
+
"@stackwright/cli": "^0.7.1-alpha.0",
|
|
30
31
|
"@stackwright/scaffold-core": "^0.1.0",
|
|
31
32
|
"chalk": "^5.6.2",
|
|
32
33
|
"commander": "^14.0.3",
|
|
33
34
|
"fs-extra": "^11.3",
|
|
34
35
|
"js-yaml": "^4.1.0",
|
|
35
|
-
"@stackwright-pro/
|
|
36
|
+
"@stackwright-pro/auth": "0.2.0-alpha.3",
|
|
37
|
+
"@stackwright-pro/auth-nextjs": "0.2.0-alpha.3",
|
|
38
|
+
"@stackwright-pro/mcp": "0.2.0-alpha.29",
|
|
39
|
+
"@stackwright-pro/openapi": "0.3.0-alpha.10",
|
|
40
|
+
"@stackwright-pro/otters": "1.0.0-alpha.29"
|
|
36
41
|
},
|
|
37
42
|
"devDependencies": {
|
|
38
43
|
"@types/fs-extra": "^11.0",
|
|
@@ -43,7 +48,8 @@
|
|
|
43
48
|
"vitest": "^4.0.18"
|
|
44
49
|
},
|
|
45
50
|
"scripts": {
|
|
46
|
-
"build": "tsup",
|
|
51
|
+
"build": "node ../../scripts/sync-versions.mjs && tsup",
|
|
52
|
+
"sync-versions": "node ../../scripts/sync-versions.mjs",
|
|
47
53
|
"dev": "tsup --watch",
|
|
48
54
|
"test": "vitest run",
|
|
49
55
|
"test:coverage": "vitest run --coverage"
|
|
@@ -1,105 +1,81 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stackwright Pro prebuild script
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Uses runPrebuild() from @stackwright/build-scripts directly with the pro
|
|
5
|
+
* content plugin, enabling pro content types to pass schema validation
|
|
6
|
+
* alongside OSS content types.
|
|
7
|
+
*
|
|
8
|
+
* Also runs the OpenAPI plugin for API client generation and extracts
|
|
9
|
+
* auth config for client-side use.
|
|
10
|
+
*
|
|
11
|
+
* Requires @stackwright/build-scripts >= 0.7.0
|
|
7
12
|
*/
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
10
16
|
const fs = require('fs');
|
|
11
17
|
const path = require('path');
|
|
12
18
|
const yaml = require('js-yaml');
|
|
19
|
+
const { runPrebuild } = require('@stackwright/build-scripts');
|
|
13
20
|
const { createOpenAPIPlugin } = require('@stackwright-pro/openapi');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Run stackwright-prebuild to generate _root.json, _site.json, etc.
|
|
17
|
-
*/
|
|
18
|
-
async function runStackwrightPrebuild(projectRoot) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
// Use pnpm exec to ensure we use the correct package manager
|
|
21
|
-
const proc = spawn(process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm', ['exec', 'stackwright-prebuild'], {
|
|
22
|
-
cwd: projectRoot,
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
shell: true,
|
|
25
|
-
});
|
|
26
|
-
proc.on('close', (code) => {
|
|
27
|
-
if (code === 0) {
|
|
28
|
-
resolve();
|
|
29
|
-
} else {
|
|
30
|
-
reject(new Error(`stackwright-prebuild exited with code ${code}`));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
proc.on('error', reject);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
21
|
+
const { createWorkflowPlugin } = require('@stackwright-pro/workflow');
|
|
22
|
+
const { proContentPlugin } = require('./scripts/pro-content-plugin');
|
|
36
23
|
|
|
37
24
|
/**
|
|
38
25
|
* Parse full stackwright.yml using js-yaml for complete config parsing
|
|
39
26
|
*/
|
|
40
27
|
function parseStackwrightYml(content) {
|
|
41
|
-
return yaml.load(content);
|
|
28
|
+
return yaml.load(content, { schema: yaml.CORE_SCHEMA });
|
|
42
29
|
}
|
|
43
30
|
|
|
44
31
|
async function main() {
|
|
45
|
-
|
|
46
|
-
const projectRoot = path.resolve(__dirname, '..');
|
|
47
|
-
|
|
48
|
-
const configPath = path.join(projectRoot, 'stackwright.yml');
|
|
49
|
-
if (!fs.existsSync(configPath)) {
|
|
50
|
-
console.log('No stackwright.yml found — skipping prebuild.');
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
32
|
+
const projectRoot = path.resolve(__dirname, '..');
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const fullConfig = parseStackwrightYml(configContent);
|
|
60
|
-
|
|
61
|
-
// Extract auth config and write as JSON for client-side use
|
|
62
|
-
if (fullConfig.auth) {
|
|
63
|
-
const authConfig = fullConfig.auth;
|
|
64
|
-
const srcDir = path.join(projectRoot, 'src');
|
|
65
|
-
|
|
66
|
-
if (!fs.existsSync(srcDir)) {
|
|
67
|
-
fs.mkdirSync(srcDir, { recursive: true });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
fs.writeFileSync(
|
|
71
|
-
path.join(srcDir, 'auth-config.json'),
|
|
72
|
-
JSON.stringify(authConfig, null, 2)
|
|
73
|
-
);
|
|
74
|
-
console.log('✓ Generated src/auth-config.json');
|
|
75
|
-
}
|
|
34
|
+
const configPath = path.join(projectRoot, 'stackwright.yml');
|
|
35
|
+
if (!fs.existsSync(configPath)) {
|
|
36
|
+
console.log('No stackwright.yml found — skipping prebuild.');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
76
39
|
|
|
77
|
-
|
|
78
|
-
|
|
40
|
+
const configContent = fs.readFileSync(configPath, 'utf-8');
|
|
41
|
+
const fullConfig = parseStackwrightYml(configContent);
|
|
79
42
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
43
|
+
// Assemble plugins
|
|
44
|
+
const workflowPlugin = createWorkflowPlugin();
|
|
45
|
+
const plugins = [proContentPlugin, workflowPlugin];
|
|
85
46
|
|
|
86
|
-
|
|
47
|
+
const integrations = fullConfig.integrations || [];
|
|
48
|
+
if (integrations.length > 0) {
|
|
49
|
+
plugins.push(createOpenAPIPlugin());
|
|
50
|
+
console.log(` OpenAPI plugin: loaded (${integrations.length} integrations)`);
|
|
51
|
+
}
|
|
87
52
|
|
|
88
|
-
|
|
53
|
+
// Run prebuild with all plugins
|
|
54
|
+
console.log('Generating content files...');
|
|
55
|
+
await runPrebuild({
|
|
56
|
+
projectRoot,
|
|
57
|
+
plugins,
|
|
58
|
+
unknownContentTypes: 'warn', // log warnings for unknown types instead of failing build
|
|
59
|
+
});
|
|
89
60
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
61
|
+
// Extract auth config and write as JSON for client-side use
|
|
62
|
+
if (fullConfig.auth) {
|
|
63
|
+
const srcDir = path.join(projectRoot, 'src');
|
|
64
|
+
if (!fs.existsSync(srcDir)) {
|
|
65
|
+
fs.mkdirSync(srcDir, { recursive: true });
|
|
95
66
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.
|
|
101
|
-
process.exit(1);
|
|
67
|
+
fs.writeFileSync(
|
|
68
|
+
path.join(srcDir, 'auth-config.json'),
|
|
69
|
+
JSON.stringify(fullConfig.auth, null, 2)
|
|
70
|
+
);
|
|
71
|
+
console.log('✓ Generated src/auth-config.json');
|
|
102
72
|
}
|
|
73
|
+
|
|
74
|
+
console.log('✓ Prebuild complete!');
|
|
103
75
|
}
|
|
104
76
|
|
|
105
|
-
main()
|
|
77
|
+
main().catch((err) => {
|
|
78
|
+
console.error('Prebuild failed:', err.message);
|
|
79
|
+
console.error(err.stack);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// packages/launch-stackwright-pro/templates/pro/scripts/pro-content-plugin.js
|
|
2
|
+
//
|
|
3
|
+
// Pro content type plugin for @stackwright/build-scripts >= 0.7.0
|
|
4
|
+
// Declares all @stackwright-pro/* content types so the prebuild
|
|
5
|
+
// validator does not reject them as unknown.
|
|
6
|
+
//
|
|
7
|
+
// contentItemSchemas: passthrough schemas for runtime validation
|
|
8
|
+
// knownContentTypeKeys: string keys so the prebuild skips "unknown type" errors
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const { z } = require('zod');
|
|
13
|
+
|
|
14
|
+
const PRO_CONTENT_TYPE_KEYS = [
|
|
15
|
+
// @stackwright-pro/display-components
|
|
16
|
+
'metric_card',
|
|
17
|
+
'status_badge',
|
|
18
|
+
'stat_bar',
|
|
19
|
+
'sparkline',
|
|
20
|
+
'activity_feed',
|
|
21
|
+
'dashboard_grid',
|
|
22
|
+
'data_table',
|
|
23
|
+
'json_viewer',
|
|
24
|
+
'action_bar',
|
|
25
|
+
'section',
|
|
26
|
+
'collection_listing',
|
|
27
|
+
// @stackwright-pro/pulse
|
|
28
|
+
'pulse_provider',
|
|
29
|
+
'metric_card_pulse',
|
|
30
|
+
'data_table_pulse',
|
|
31
|
+
'status_badge_pulse',
|
|
32
|
+
'stats_grid',
|
|
33
|
+
'alert_banner',
|
|
34
|
+
// @stackwright-pro/workflow-components
|
|
35
|
+
'workflow_mount',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const proContentPlugin = {
|
|
39
|
+
name: 'pro-content',
|
|
40
|
+
// Passthrough schemas — let the component handle its own prop validation at runtime
|
|
41
|
+
contentItemSchemas: PRO_CONTENT_TYPE_KEYS.map((type) =>
|
|
42
|
+
z.object({ type: z.literal(type) }).passthrough()
|
|
43
|
+
),
|
|
44
|
+
knownContentTypeKeys: PRO_CONTENT_TYPE_KEYS,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports = { proContentPlugin };
|