@stackwright-pro/otters 1.0.0-alpha.4 → 1.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +7 -6
- package/scripts/generate-checksums.js +0 -1
- package/scripts/install-agents.js +5 -2
- package/scripts/launch-raft.cjs +13 -0
- package/scripts/strip-artifact-schemas.cjs +133 -0
- package/src/checksums.json +9 -7
- package/src/stackwright-pro-api-otter.json +38 -92
- package/src/stackwright-pro-auth-otter.json +24 -791
- package/src/stackwright-pro-dashboard-otter.json +21 -660
- package/src/stackwright-pro-data-otter.json +21 -534
- package/src/stackwright-pro-designer-otter.json +29 -0
- package/src/stackwright-pro-foreman-otter.json +19 -657
- package/src/stackwright-pro-page-otter.json +7 -4
- package/src/stackwright-pro-theme-otter.json +27 -0
- package/src/stackwright-pro-workflow-otter.json +28 -0
- package/src/python-bridge.ts +0 -391
- package/src/question-adapter.ts +0 -296
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
PROPRIETARY SOFTWARE LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Per Aspera LLC. All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary and confidential property of Per Aspera LLC ("Company").
|
|
7
|
+
|
|
8
|
+
RESTRICTIONS: You may not use, copy, modify, merge, publish, distribute,
|
|
9
|
+
sublicense, sell, or otherwise exploit this Software or any portion thereof
|
|
10
|
+
without the express prior written consent of the Company.
|
|
11
|
+
|
|
12
|
+
GOVERNMENT USE: Use, duplication, or disclosure by the U.S. Government is
|
|
13
|
+
subject to restrictions as set forth in FAR 52.227-19 (Commercial Computer
|
|
14
|
+
Software - Restricted Rights) and DFARS 252.227-7013 (Rights in Technical
|
|
15
|
+
Data and Computer Software), as applicable.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED. IN NO EVENT SHALL THE COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
19
|
+
OTHER LIABILITY ARISING FROM THE USE OF THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
For licensing inquiries: legal@peraspera.com
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackwright-pro/otters",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.40",
|
|
4
4
|
"description": "Stackwright Pro Otter Raft - AI agents for enterprise features (CAC auth, API dashboards, government use cases)",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/Per-Aspera-LLC/stackwright-pro"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"vitest": "^4.
|
|
12
|
-
"zod": "^
|
|
11
|
+
"vitest": "^4.1.7",
|
|
12
|
+
"zod": "^4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./src": "./src",
|
|
16
|
-
"./pro-foreman": "./src/stackwright-pro-foreman-otter.json"
|
|
16
|
+
"./pro-foreman": "./src/stackwright-pro-foreman-otter.json",
|
|
17
|
+
"./pro-workflow": "./src/stackwright-pro-workflow-otter.json"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"scripts",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"access": "public"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
|
-
"@stackwright-pro/mcp": "^0.2.0-alpha.
|
|
27
|
+
"@stackwright-pro/mcp": "^0.2.0-alpha.53"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"generate-checksums": "node scripts/generate-checksums.js",
|
|
@@ -8,14 +8,17 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const os = require('os');
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// Allow test overrides via env vars — production paths are the default.
|
|
12
|
+
// STACKWRIGHT_AGENTS_DIR: override destination (normally ~/.code_puppy/agents/)
|
|
13
|
+
// STACKWRIGHT_OTTERS_SRC_DIR: override source (normally <package>/src/)
|
|
14
|
+
const AGENTS_DIR = process.env.STACKWRIGHT_AGENTS_DIR || path.join(os.homedir(), '.code_puppy', 'agents');
|
|
12
15
|
|
|
13
16
|
// Resolve package root relative to this script's location
|
|
14
17
|
const scriptDir = __dirname;
|
|
15
18
|
const packageRoot = path.resolve(scriptDir, '..');
|
|
16
19
|
|
|
17
20
|
// All Pro otters are in the src/ directory
|
|
18
|
-
const srcDir = path.join(packageRoot, 'src');
|
|
21
|
+
const srcDir = process.env.STACKWRIGHT_OTTERS_SRC_DIR || path.join(packageRoot, 'src');
|
|
19
22
|
|
|
20
23
|
async function installAgents() {
|
|
21
24
|
try {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ⚠️ DEPRECATED — This launcher has been replaced by @stackwright-pro/raft.
|
|
4
|
+
// Run: npx @stackwright-pro/raft
|
|
5
|
+
// This file is kept for users who may have cached a previous install.
|
|
6
|
+
// It will be removed in a future release.
|
|
7
|
+
|
|
8
|
+
console.error('⚠️ launch-raft in @stackwright-pro/otters is deprecated.');
|
|
9
|
+
console.error(' Use: npx @stackwright-pro/raft');
|
|
10
|
+
console.error('');
|
|
11
|
+
console.error(' Install: npm install -g @stackwright-pro/raft');
|
|
12
|
+
console.error(' Or run directly: npx @stackwright-pro/raft');
|
|
13
|
+
process.exit(1);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* strip-artifact-schemas.cjs
|
|
4
|
+
*
|
|
5
|
+
* Removes hardcoded artifact schema JSON blocks from specialist otter system_prompts.
|
|
6
|
+
* These are now injected dynamically via build_specialist_prompt (REQUIRED_ARTIFACT_SCHEMA).
|
|
7
|
+
*
|
|
8
|
+
* Run: node packages/otters/scripts/strip-artifact-schemas.cjs
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
const OTTERS_DIR = path.join(__dirname, '..', 'src');
|
|
15
|
+
const REFERENCE_LINE =
|
|
16
|
+
'**Artifact shape:** See the **REQUIRED_ARTIFACT_SCHEMA** section in your prompt for the canonical artifact shape. Use it when calling `stackwright_pro_validate_artifact`.';
|
|
17
|
+
|
|
18
|
+
function stripArtifactSchemaFromArray(promptArray) {
|
|
19
|
+
// Strategy: find the index of the ```json opening fence,
|
|
20
|
+
// then find the matching closing ``` fence.
|
|
21
|
+
// Replace everything from the fence through the closing fence + surrounding context
|
|
22
|
+
// with the REFERENCE_LINE.
|
|
23
|
+
|
|
24
|
+
const result = [];
|
|
25
|
+
let i = 0;
|
|
26
|
+
let stripped = false;
|
|
27
|
+
|
|
28
|
+
while (i < promptArray.length) {
|
|
29
|
+
const item = promptArray[i];
|
|
30
|
+
|
|
31
|
+
// Detect start of a JSON code block fence
|
|
32
|
+
if (typeof item === 'string' && item.trim() === '```json') {
|
|
33
|
+
// Find the closing fence
|
|
34
|
+
let j = i + 1;
|
|
35
|
+
while (j < promptArray.length && promptArray[j].trim() !== '```') {
|
|
36
|
+
j++;
|
|
37
|
+
}
|
|
38
|
+
// j now points to the closing ``` (or end of array)
|
|
39
|
+
|
|
40
|
+
// Replace this entire block with the reference line
|
|
41
|
+
// (but only the first JSON block per otter — the artifact schema block)
|
|
42
|
+
if (!stripped) {
|
|
43
|
+
result.push(REFERENCE_LINE);
|
|
44
|
+
stripped = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Skip past the closing fence
|
|
48
|
+
i = j + 1;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
result.push(item);
|
|
53
|
+
i++;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function stripArtifactSchemaFromString(str) {
|
|
60
|
+
// For cases where the schema is embedded in a longer string as a ```json...``` block
|
|
61
|
+
// Replace the first ```json ... ``` block with the reference line
|
|
62
|
+
const jsonFenceRegex = /```json[\s\S]*?```/;
|
|
63
|
+
if (jsonFenceRegex.test(str)) {
|
|
64
|
+
return str.replace(jsonFenceRegex, REFERENCE_LINE);
|
|
65
|
+
}
|
|
66
|
+
return str;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function processOtterFile(filePath) {
|
|
70
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
71
|
+
const otter = JSON.parse(raw);
|
|
72
|
+
|
|
73
|
+
if (!Array.isArray(otter.system_prompt)) {
|
|
74
|
+
console.log(` ⚠️ ${path.basename(filePath)}: system_prompt is not an array — skipping`);
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Check if the artifact schema block is spread across array elements (```json as its own element)
|
|
79
|
+
// or embedded within a longer string
|
|
80
|
+
const hasFenceAsElement = otter.system_prompt.some(
|
|
81
|
+
(s) => typeof s === 'string' && s.trim() === '```json'
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const hasEmbeddedFence = otter.system_prompt.some(
|
|
85
|
+
(s) => typeof s === 'string' && s.includes('```json')
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
let modified = false;
|
|
89
|
+
|
|
90
|
+
if (hasFenceAsElement) {
|
|
91
|
+
// Multi-element block — strip using array strategy
|
|
92
|
+
const original = JSON.stringify(otter.system_prompt);
|
|
93
|
+
otter.system_prompt = stripArtifactSchemaFromArray(otter.system_prompt);
|
|
94
|
+
if (JSON.stringify(otter.system_prompt) !== original) {
|
|
95
|
+
modified = true;
|
|
96
|
+
}
|
|
97
|
+
} else if (hasEmbeddedFence) {
|
|
98
|
+
// Embedded fence within a string — strip using string replacement
|
|
99
|
+
const original = JSON.stringify(otter.system_prompt);
|
|
100
|
+
otter.system_prompt = otter.system_prompt.map((s) =>
|
|
101
|
+
typeof s === 'string' ? stripArtifactSchemaFromString(s) : s
|
|
102
|
+
);
|
|
103
|
+
if (JSON.stringify(otter.system_prompt) !== original) {
|
|
104
|
+
modified = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (modified) {
|
|
109
|
+
fs.writeFileSync(filePath, JSON.stringify(otter, null, 2) + '\n');
|
|
110
|
+
console.log(` ✅ ${path.basename(filePath)}: artifact schema block removed`);
|
|
111
|
+
} else {
|
|
112
|
+
console.log(
|
|
113
|
+
` ℹ️ ${path.basename(filePath)}: no artifact schema block found (may already be clean)`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return modified;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log('Stripping hardcoded artifact schema blocks from specialist otters...\n');
|
|
121
|
+
|
|
122
|
+
const otterFiles = fs
|
|
123
|
+
.readdirSync(OTTERS_DIR)
|
|
124
|
+
.filter((f) => f.endsWith('-otter.json') && f !== 'stackwright-pro-foreman-otter.json')
|
|
125
|
+
.map((f) => path.join(OTTERS_DIR, f));
|
|
126
|
+
|
|
127
|
+
let totalModified = 0;
|
|
128
|
+
for (const filePath of otterFiles) {
|
|
129
|
+
const modified = processOtterFile(filePath);
|
|
130
|
+
if (modified) totalModified++;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log(`\nDone. ${totalModified} otter file(s) modified.`);
|
package/src/checksums.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0",
|
|
3
3
|
"algorithm": "sha256",
|
|
4
|
-
"generated": "2026-04-15T13:32:12.453Z",
|
|
5
4
|
"files": {
|
|
6
|
-
"stackwright-pro-api-otter.json": "
|
|
7
|
-
"stackwright-pro-auth-otter.json": "
|
|
8
|
-
"stackwright-pro-dashboard-otter.json": "
|
|
9
|
-
"stackwright-pro-data-otter.json": "
|
|
10
|
-
"stackwright-pro-
|
|
11
|
-
"stackwright-pro-
|
|
5
|
+
"stackwright-pro-api-otter.json": "9fbaed0ce6116b82d0289f24432037d04637c89b8e73062ed946e5d49b294734",
|
|
6
|
+
"stackwright-pro-auth-otter.json": "bf0e66e35d15ba818ba6ff1a007df34975565bacbb35cc0c80151fb1da13e573",
|
|
7
|
+
"stackwright-pro-dashboard-otter.json": "89e81ac161147ab532034b40e4f7863dcd7d03ef33fd94c97d19c3e56fb91a9e",
|
|
8
|
+
"stackwright-pro-data-otter.json": "3bdf0da3b90282a72598c242507fa6806dee9ac589ccdae5555dc1254a697373",
|
|
9
|
+
"stackwright-pro-designer-otter.json": "af09ac8f06385bdbac63e2820daa2ff7d38b8ff1ff383c161f07e3fb9d9359c5",
|
|
10
|
+
"stackwright-pro-foreman-otter.json": "582a26766a5bc80ef9f3aef53e82794c7f47f618bd28e4e70583bfc2b569398c",
|
|
11
|
+
"stackwright-pro-page-otter.json": "9a5672f0758c81539337d86955e2892cd412547b4f111c2aa098eed1e62d7626",
|
|
12
|
+
"stackwright-pro-theme-otter.json": "08bb04009fdfb8743b10ac4d503cbaddaf8d7c804ba9b606aaed9cc516fd8e93",
|
|
13
|
+
"stackwright-pro-workflow-otter.json": "c90d6773b2287aa9a640c2715ca0e75f44c13e99fddcfb89ced36603f38930ce"
|
|
12
14
|
}
|
|
13
15
|
}
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
"name": "stackwright-pro-api-otter",
|
|
4
4
|
"display_name": "Stackwright Pro API Otter 🦦",
|
|
5
5
|
"description": "Analyzes API specs and extracts entity definitions",
|
|
6
|
-
"tools": [
|
|
6
|
+
"tools": [
|
|
7
|
+
"agent_run_shell_command",
|
|
8
|
+
"list_files",
|
|
9
|
+
"cp_list_files",
|
|
10
|
+
"cp_read_file",
|
|
11
|
+
"stackwright_pro_write_phase_questions",
|
|
12
|
+
"stackwright_pro_validate_artifact"
|
|
13
|
+
],
|
|
14
|
+
"mcp_servers": ["stackwright-pro-mcp"],
|
|
7
15
|
"user_prompt": "Hey! 🦦 I'm the API Otter. Give me an OpenAPI spec path and I'll extract what entities and endpoints it exposes.",
|
|
8
16
|
"system_prompt": [
|
|
9
17
|
"## YOUR JOB",
|
|
@@ -22,39 +30,11 @@
|
|
|
22
30
|
"",
|
|
23
31
|
"## OUTPUT FORMAT",
|
|
24
32
|
"",
|
|
25
|
-
"**
|
|
26
|
-
"",
|
|
27
|
-
"Return ONLY valid JSON \u2014 no markdown fences, no prose, no comments. Use one of these two shapes:",
|
|
28
|
-
"",
|
|
29
|
-
"SUCCESS SHAPE:",
|
|
30
|
-
"```json",
|
|
31
|
-
"{",
|
|
32
|
-
" \"entities\": [",
|
|
33
|
-
" {",
|
|
34
|
-
" \"name\": \"Shipment\",",
|
|
35
|
-
" \"endpoint\": \"/shipments\",",
|
|
36
|
-
" \"method\": \"GET\",",
|
|
37
|
-
" \"revalidate\": 60,",
|
|
38
|
-
" \"mutationType\": null",
|
|
39
|
-
" }",
|
|
40
|
-
" ],",
|
|
41
|
-
" \"auth\": {",
|
|
42
|
-
" \"type\": \"bearer\",",
|
|
43
|
-
" \"header\": \"Authorization\",",
|
|
44
|
-
" \"envVar\": \"MARINE_LOGISTICS_API_TOKEN\"",
|
|
45
|
-
" },",
|
|
46
|
-
" \"baseUrl\": \"https://api.marine-logistics.mil/v2\",",
|
|
47
|
-
" \"specPath\": \"./specs/marine-combat-logistics.yaml\"",
|
|
48
|
-
"}",
|
|
49
|
-
"```",
|
|
33
|
+
"**Parse the spec, then call `stackwright_pro_validate_artifact` directly as your final step.**",
|
|
50
34
|
"",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
" \"error\": \"Spec file not found at ./specs/missing.yaml\",",
|
|
55
|
-
" \"specPath\": \"./specs/missing.yaml\"",
|
|
56
|
-
"}",
|
|
57
|
-
"```",
|
|
35
|
+
"Artifact shape (fill all fields with real values from the spec — never leave placeholders):",
|
|
36
|
+
"",
|
|
37
|
+
"**Artifact shape:** See the **REQUIRED_ARTIFACT_SCHEMA** section in your prompt for the canonical artifact shape. Use it when calling `stackwright_pro_validate_artifact`.",
|
|
58
38
|
"",
|
|
59
39
|
"Field notes:",
|
|
60
40
|
"- entities[].revalidate: seconds for ISR cache (from x-revalidate extension), or null",
|
|
@@ -63,6 +43,22 @@
|
|
|
63
43
|
" (cac = DoD Common Access Card / PKI certificate authentication)",
|
|
64
44
|
"- auth.envVar: environment variable name that will hold the credential",
|
|
65
45
|
"",
|
|
46
|
+
"If the spec is missing, unreadable, or unsupported format — respond: `⛔ ARTIFACT_ERROR: spec-unavailable — [reason]` and do not call validate_artifact.",
|
|
47
|
+
"",
|
|
48
|
+
"Call:",
|
|
49
|
+
"```",
|
|
50
|
+
"stackwright_pro_validate_artifact({",
|
|
51
|
+
" phase: \"api\",",
|
|
52
|
+
" artifact: { version, generatedBy, entities, auth, baseUrl, specPath }",
|
|
53
|
+
"})",
|
|
54
|
+
"```",
|
|
55
|
+
"",
|
|
56
|
+
"- If `valid: true` → respond: `✅ ARTIFACT_WRITTEN: <artifactPath from result>`",
|
|
57
|
+
"- If `valid: false` → read the `retryPrompt` field, correct the artifact, and retry the call once.",
|
|
58
|
+
"- If still `valid: false` after retry → respond: `⛔ ARTIFACT_ERROR: [violation] — [retryPrompt text]`",
|
|
59
|
+
"",
|
|
60
|
+
"**Never return JSON as your response body.** The Foreman no longer calls `validate_artifact` — you call it directly.",
|
|
61
|
+
"",
|
|
66
62
|
"---",
|
|
67
63
|
"",
|
|
68
64
|
"## SCOPE BOUNDARIES",
|
|
@@ -79,10 +75,11 @@
|
|
|
79
75
|
"- Generate API client classes (BaseApiClient, etc.)",
|
|
80
76
|
"- Write to src/generated/ or any other directory",
|
|
81
77
|
"",
|
|
78
|
+
"✅ Call `stackwright_pro_validate_artifact({ phase: \"api\", artifact })` directly as your final write step.",
|
|
79
|
+
"",
|
|
82
80
|
"**WHY:** TypeScript type generation is @stackwright-pro/openapi's job at build time.",
|
|
83
81
|
"The otter's job is discovery and configuration — not code generation.",
|
|
84
|
-
"If you find yourself
|
|
85
|
-
"Return your JSON artifact to the Foreman instead.",
|
|
82
|
+
"You have no other file-write tools. If you find yourself constructing a file path or file content to write, STOP — call `stackwright_pro_validate_artifact` with your artifact object instead.",
|
|
86
83
|
"---",
|
|
87
84
|
"",
|
|
88
85
|
"## TERMINATION",
|
|
@@ -92,67 +89,16 @@
|
|
|
92
89
|
"The Foreman handles all routing after receiving your artifact.",
|
|
93
90
|
"",
|
|
94
91
|
"You are invoked ONE TIME by the Foreman with full context in this prompt.",
|
|
95
|
-
"The spec path will be provided in the prompt
|
|
92
|
+
"The spec path will be provided in the prompt — you do not need to ask the user for it.",
|
|
96
93
|
"",
|
|
97
94
|
"---",
|
|
98
95
|
"",
|
|
99
96
|
"## QUESTION_COLLECTION_MODE",
|
|
100
97
|
"",
|
|
101
|
-
"
|
|
102
|
-
"",
|
|
103
|
-
"
|
|
104
|
-
"",
|
|
105
|
-
"
|
|
106
|
-
"",
|
|
107
|
-
"{",
|
|
108
|
-
" \"questions\": [",
|
|
109
|
-
" {",
|
|
110
|
-
" \"id\": \"api-1\",",
|
|
111
|
-
" \"question\": \"Do you have an existing OpenAPI spec?\",",
|
|
112
|
-
" \"type\": \"confirm\",",
|
|
113
|
-
" \"required\": true,",
|
|
114
|
-
" \"default\": \"no\"",
|
|
115
|
-
" },",
|
|
116
|
-
" {",
|
|
117
|
-
" \"id\": \"api-2\",",
|
|
118
|
-
" \"question\": \"What is the URL or path to your OpenAPI spec?\",",
|
|
119
|
-
" \"type\": \"text\",",
|
|
120
|
-
" \"required\": true,",
|
|
121
|
-
" \"dependsOn\": { \"questionId\": \"api-1\", \"value\": \"yes\" }",
|
|
122
|
-
" },",
|
|
123
|
-
" {",
|
|
124
|
-
" \"id\": \"api-3\",",
|
|
125
|
-
" \"question\": \"What is your API authentication method?\",",
|
|
126
|
-
" \"type\": \"select\",",
|
|
127
|
-
" \"options\": [",
|
|
128
|
-
" { \"label\": \"No auth\", \"value\": \"none\" },",
|
|
129
|
-
" { \"label\": \"API Key\", \"value\": \"api-key\" },",
|
|
130
|
-
" { \"label\": \"OAuth2\", \"value\": \"oauth2\" },",
|
|
131
|
-
" { \"label\": \"OIDC/SAML\", \"value\": \"oidc\" },",
|
|
132
|
-
" { \"label\": \"CAC/PIV (DoD)\", \"value\": \"cac\" }",
|
|
133
|
-
" ],",
|
|
134
|
-
" \"required\": true",
|
|
135
|
-
" },",
|
|
136
|
-
" {",
|
|
137
|
-
" \"id\": \"api-4\",",
|
|
138
|
-
" \"question\": \"Which entities from the spec do you need?\",",
|
|
139
|
-
" \"type\": \"multi-select\",",
|
|
140
|
-
" \"options\": [",
|
|
141
|
-
" { \"label\": \"I will tell you after you parse it\", \"value\": \"discover\" }",
|
|
142
|
-
" ],",
|
|
143
|
-
" \"required\": false,",
|
|
144
|
-
" \"help\": \"You can select specific entities or let me discover them after parsing the spec.\"",
|
|
145
|
-
" }",
|
|
146
|
-
" ],",
|
|
147
|
-
" \"requiredPackages\": {",
|
|
148
|
-
" \"dependencies\": {",
|
|
149
|
-
" \"@stackwright-pro/openapi\": \"latest\",",
|
|
150
|
-
" \"zod\": \"^3.23.0\"",
|
|
151
|
-
" },",
|
|
152
|
-
" \"devPackages\": {",
|
|
153
|
-
" \"@stoplight/prism-cli\": \"^5.14.2\"",
|
|
154
|
-
" }",
|
|
155
|
-
" }",
|
|
156
|
-
"}"
|
|
98
|
+
"⚠️ GUARD: Only enter QUESTION_COLLECTION_MODE if the prompt contains the literal string `QUESTION_COLLECTION_MODE=true`. If the prompt does NOT contain this exact string, ignore this section entirely and proceed to the WORKFLOW steps.",
|
|
99
|
+
"",
|
|
100
|
+
"When the prompt contains `QUESTION_COLLECTION_MODE=true`:\n\n1. Check for a `BUILD_CONTEXT:` section in the prompt. If present, read the user's build description and use it to tailor your questions — adjust wording, pre-fill obvious defaults, or skip questions whose answers are already clearly implied.\n2. Check for a `PRIOR_ANSWERS:` section in the prompt. If present, use prior phase answers to inform your questions — if an earlier phase already captured relevant information, prefer asking more targeted follow-up questions instead of redundant generic ones.\n3. Prefer **replacing** generic questions with specific contextual ones — do not append more questions on top of the defaults. Keep the total question count similar to the standard set.\n4. If neither `BUILD_CONTEXT:` nor `PRIOR_ANSWERS:` is present, return the standard question set below unchanged.\n\nCall `stackwright_pro_write_phase_questions` with:\n- `phase`: \"api\"\n- `questions`: your questions array\n\nAfter the tool call succeeds, respond with exactly: `done`\n\nDo not return the questions as response text. Do not call any other tools.",
|
|
101
|
+
"",
|
|
102
|
+
"{\n \"questions\": [\n {\n \"id\": \"api-1\",\n \"question\": \"Does your app pull live data from a backend service your IT team set up?\",\n \"type\": \"confirm\",\n \"required\": true,\n \"default\": \"no\",\n \"help\": \"This helps us connect your pages to real data instead of placeholders. If unsure, ask your IT team if there is an API or data service involved.\"\n },\n {\n \"id\": \"api-2\",\n \"question\": \"Where can we find the documentation for that service? (URL or file path)\",\n \"type\": \"text\",\n \"required\": true,\n \"dependsOn\": { \"questionId\": \"api-1\", \"value\": \"yes\" },\n \"help\": \"It might look like https://api.yourcompany.com/docs or a local file path like ./specs/service.yaml — your IT team would know.\"\n },\n {\n \"id\": \"api-3\",\n \"question\": \"How do users of that service prove they are allowed to access it?\",\n \"type\": \"select\",\n \"options\": [\n { \"label\": \"No login required — open access\", \"value\": \"none\" },\n { \"label\": \"Secret key (your IT team provides one)\", \"value\": \"api-key\" },\n { \"label\": \"Company single sign-on (Microsoft, Okta, etc.)\", \"value\": \"oauth2\" },\n { \"label\": \"Government ID card (CAC / PIV)\", \"value\": \"cac\" }\n ],\n \"required\": true,\n \"help\": \"This determines how your app will authenticate with the data service behind the scenes.\"\n },\n {\n \"id\": \"api-4\",\n \"question\": \"What kinds of information do you want to display? (e.g. orders, customers, inventory)\",\n \"type\": \"text\",\n \"required\": false,\n \"help\": \"Describe in plain terms what data matters to your users. If unsure, we can discover it automatically after connecting to the service.\"\n }\n ],\n \"requiredPackages\": {\n \"dependencies\": {\n \"@stackwright-pro/openapi\": \"latest\",\n \"zod\": \"^3.23.0\"\n },\n \"devPackages\": {\n \"@stoplight/prism-cli\": \"^5.14.2\"\n }\n }\n}"
|
|
157
103
|
]
|
|
158
104
|
}
|