@stackwright-pro/otters 0.2.1 → 0.2.2

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 CHANGED
@@ -1,108 +1,132 @@
1
- # Stackwright Pro Otter Raft 🦦
1
+ # @stackwright-pro/otters
2
2
 
3
- AI agents for building Stackwright Pro projects with live API integration.
3
+ 🦦🦦 **Stackwright Pro Otter Raft** AI agents for full-stack API integration.
4
4
 
5
- ## The Pro Raft
5
+ A coordinated team of specialized AI agents (otters) that extend the OSS otter raft with API-first capabilities, live data dashboards, and enterprise auth integration.
6
6
 
7
- | Otter | Role | What it does |
8
- |-------|------|--------------|
9
- | **Foreman Pro Otter** | Coordinator | Orchestrates API → Data → Dashboard pipeline |
10
- | **API Otter** | API Explorer | Discovers entities from OpenAPI specs |
11
- | **Data Otter** | Configuration | Generates endpoint filters, configures ISR |
12
- | **Dashboard Otter** | Page Builder | Builds pages displaying live API data |
7
+ ---
13
8
 
14
- ## Quick Start
9
+ ## Installation
15
10
 
16
11
  ```bash
17
- # Start with Foreman Pro Otter
18
- code-puppy invoke stackwright-pro-foreman-otter
12
+ npm install @stackwright-pro/otters
13
+ # or
14
+ pnpm add @stackwright-pro/otters
15
+ ```
16
+
17
+ The postinstall script automatically installs Pro otters to `~/.code_puppy/agents/` for code-puppy discovery.
19
18
 
20
- # Or individual otters
21
- code-puppy invoke stackwright-pro-api-otter
22
- code-puppy invoke stackwright-pro-data-otter
23
- code-puppy invoke stackwright-pro-dashboard-otter
19
+ If you need to re-run the installation:
20
+
21
+ ```bash
22
+ node node_modules/@stackwright-pro/otters/scripts/install-agents.js
24
23
  ```
25
24
 
26
- ## What Pro Adds
25
+ ---
27
26
 
28
- | Feature | OSS Stackwright | Pro Stackwright |
29
- |---------|-----------------|-----------------|
30
- | Content source | YAML files | Live API data |
31
- | Data freshness | Build-time | Real-time (ISR) |
32
- | API integration | None | OpenAPI → typed client |
33
- | Enterprise security | None | Approved-specs validation |
27
+ ## The Pro Otter Raft
34
28
 
35
- ## Prerequisites
29
+ | Otter | Role | Output |
30
+ |-------|------|--------|
31
+ | 🦦🦦 **Foreman Otter** | Project coordinator | Orchestrates full-stack builds |
32
+ | 🦦📡 **API Otter** | OpenAPI discovery | API entity types, endpoints |
33
+ | 🦦📊 **Dashboard Otter** | Live data views | Typed API components |
34
+ | 🦦🔗 **Data Otter** | Endpoint integration | ISR config, filters |
36
35
 
37
- 1. **Stackwright Pro packages installed:**
38
- ```bash
39
- pnpm add @stackwright-pro/openapi
40
- ```
36
+ ---
41
37
 
42
- 2. **Pro MCP server running:**
43
- ```bash
44
- # The .code-puppy.json auto-starts the Pro MCP server
45
- code-puppy invoke stackwright-pro-foreman-otter
46
- ```
38
+ ## Pro vs OSS Otters
47
39
 
48
- 3. **OpenAPI spec** (URL or local file):
49
- - Government: `https://api.gov.mil/logistics/v1/openapi.yaml`
50
- - Enterprise: `https://api.internal.com/openapi.json`
51
- - Local: `./specs/my-api.yaml`
40
+ | Feature | OSS | Pro |
41
+ |---------|-----|-----|
42
+ | Static site generation | ✅ | ✅ |
43
+ | OpenAPI integration | ❌ | ✅ |
44
+ | Live data dashboards | ❌ | ✅ |
45
+ | Zod schema generation | ❌ | ✅ |
46
+ | Typed API clients | ❌ | ✅ |
47
+ | ISR configuration | ❌ | ✅ |
52
48
 
53
- ## Example Workflow
49
+ ---
50
+
51
+ ## How It Works
52
+
53
+ ### The Pro Pipeline
54
54
 
55
55
  ```
56
- > "Build me a logistics dashboard from our government API"
57
-
58
- FOREMAN PRO OTTER:
59
- ├─► API OTTER: What spec should I use?
60
-
61
- "Here's the approved government API: https://api.gov.mil/logistics/v1/openapi.yaml"
62
-
63
- ├─► API OTTER: *discovers 47 entities*
64
- │ └─► Found: Equipment, Supplies, Personnel, Vehicles, Facilities...
65
-
66
- "Which entities do you want to display?"
67
-
68
- │ "Equipment, Supplies, and Vehicles"
69
-
70
- ├─► DATA OTTER: *generates endpoint filters*
71
- │ └─► Configured: /equipment/**, /supplies/**, /vehicles/**
72
-
73
- *configures ISR*
74
- │ └─► Equipment: revalidate=60s, Supplies: revalidate=120s
75
-
76
- ├─► DASHBOARD OTTER: *builds pages*
77
- │ └─► Created: /equipment, /supplies, /vehicles
78
-
79
- └─► "Done! Your logistics dashboard is ready."
56
+ User Request (with OpenAPI spec)
57
+
58
+
59
+ ┌────────────────────────┐
60
+ Pro Foreman Otter │ ◄── Entry point (extends OSS Foreman)
61
+ "Starting API build..."
62
+ └───────┬────────────────┘
63
+
64
+
65
+ ┌────────────────────────┐
66
+ API Otter │ ◄── OpenAPI typed client
67
+ (entity discovery)
68
+ └───────┬────────────────┘
69
+ creates src/generated/*
70
+
71
+ ┌────────────────────────┐
72
+ Dashboard Otter │ ◄── Live API data views
73
+ (components) │
74
+ └───────┬────────────────┘
75
+ creates pages/api/*
76
+
77
+ ┌────────────────────────┐
78
+ Data Otter │ ◄── ISR + endpoint config
79
+ │ (filters, refresh) │
80
+ └───────┬────────────────┘
81
+
82
+ USER
83
+ ```
84
+
85
+ ### Invoking Pro Otters
86
+
87
+ ```bash
88
+ # Full-stack API build
89
+ code-puppy -i -a stackwright-pro-foreman-otter
90
+
91
+ # API entity discovery
92
+ code-puppy -i -a stackwright-pro-api-otter
93
+
94
+ # Live dashboard generation
95
+ code-puppy -i -a stackwright-pro-dashboard-otter
96
+
97
+ # ISR configuration
98
+ code-puppy -i -a stackwright-pro-data-otter
80
99
  ```
81
100
 
82
- ## Enterprise Mode
101
+ ---
83
102
 
84
- For government/defense environments, enable approved-specs validation:
103
+ ## Package Structure
85
104
 
86
- ```yaml
87
- # stackwright.yml
88
- prebuild:
89
- security:
90
- enabled: true
91
- allowlist:
92
- - name: Logistics API
93
- url: https://api.gov.mil/logistics/v1/openapi.yaml
94
- sha256: a1b2c3d4e5f6...
95
105
  ```
106
+ @stackwright-pro/otters/
107
+ ├── package.json
108
+ ├── README.md
109
+ ├── MCP_TOOLS.md # MCP tool documentation
110
+ ├── PRO_OTTER_ARCHITECTURE.md # Architecture details
111
+ ├── scripts/
112
+ │ └── install-agents.js # Postinstall script
113
+ ├── stackwright-pro-foreman-otter.json
114
+ ├── stackwright-pro-api-otter.json
115
+ ├── stackwright-pro-dashboard-otter.json
116
+ └── stackwright-pro-data-otter.json
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Dependencies
96
122
 
97
- This ensures:
98
- - Only pre-approved API specs are used
99
- - Spec integrity verified via SHA-256
100
- - SSRF attacks blocked
123
+ Pro otters require:
101
124
 
102
- ## MCP Tools
125
+ - **@stackwright-pro/mcp** — MCP server for API tooling
126
+ - **@stackwright/otters** — OSS otters (installed automatically)
103
127
 
104
- See [MCP_TOOLS.md](./MCP_TOOLS.md) for full reference.
128
+ ---
105
129
 
106
- ## Architecture
130
+ ## License
107
131
 
108
- See [PRO_OTTER_ARCHITECTURE.md](./PRO_OTTER_ARCHITECTURE.md) for detailed architecture.
132
+ MIT
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "@stackwright-pro/otters",
3
- "version": "0.2.1",
4
- "description": "Pro Otter Raft - AI agents for building full-stack Stackwright Pro projects with live API integration",
5
- "license": "PROPRIETARY",
3
+ "version": "0.2.2",
4
+ "description": "Stackwright Pro Otter Raft - AI agents for full-stack API integration",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/Per-Aspera-LLC/stackwright-pro"
9
+ },
6
10
  "files": [
7
- "*.json",
8
- "*.md"
11
+ "scripts"
9
12
  ],
10
13
  "peerDependencies": {
11
- "@stackwright-pro/mcp": "latest"
14
+ "@stackwright-pro/mcp": "*"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node scripts/install-agents.js"
12
18
  }
13
19
  }
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Post-install script for @stackwright-pro/otters
4
+ * Copies Pro agent JSON files to ~/.code_puppy/agents/ for code-puppy discovery
5
+ */
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const os = require('os');
10
+
11
+ const AGENTS_DIR = path.join(os.homedir(), '.code_puppy', 'agents');
12
+
13
+ // Resolve package root relative to this script's location
14
+ const scriptDir = __dirname;
15
+ const packageRoot = scriptDir.endsWith('/scripts')
16
+ ? path.dirname(scriptDir) // Running from within the package
17
+ : path.join(scriptDir, 'packages', 'otters'); // Running from monorepo root
18
+
19
+ async function installAgents() {
20
+ try {
21
+ // Ensure ~/.code_puppy/agents/ exists
22
+ await fs.promises.mkdir(AGENTS_DIR, { recursive: true });
23
+
24
+ // Copy all JSON files from package root to ~/.code_puppy/agents/
25
+ const files = await fs.promises.readdir(packageRoot);
26
+
27
+ let installedCount = 0;
28
+ for (const file of files) {
29
+ if (file.endsWith('-otter.json')) {
30
+ const srcPath = path.join(packageRoot, file);
31
+ const destPath = path.join(AGENTS_DIR, file);
32
+
33
+ await fs.promises.copyFile(srcPath, destPath);
34
+ console.log(`✅ Installed Pro agent: ${file}`);
35
+ installedCount++;
36
+ }
37
+ }
38
+
39
+ if (installedCount > 0) {
40
+ console.log(`\n🦦🦦 Pro otters installed to ${AGENTS_DIR}`);
41
+ console.log(' Run "code-puppy -i -a stackwright-pro-foreman-otter" to start!');
42
+ } else {
43
+ console.log('⚠️ No Pro otter files found to install');
44
+ }
45
+ } catch (error) {
46
+ // Don't fail the install if this script has issues
47
+ console.warn(`⚠️ Failed to install Pro otters: ${error.message}`);
48
+ }
49
+ }
50
+
51
+ installAgents();
package/.code-puppy.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "mcpServers": [
3
- {
4
- "name": "stackwright-pro-mcp",
5
- "command": "pnpm",
6
- "args": ["exec", "stackwright-pro-mcp"],
7
- "autoStart": true,
8
- "workingDirectory": "${PROJECT_ROOT}"
9
- }
10
- ]
11
- }
package/CHANGELOG.md DELETED
@@ -1,24 +0,0 @@
1
- # @stackwright-pro/otters
2
-
3
- ## 0.2.1
4
-
5
- ### Patch Changes
6
-
7
- - Fix peerDependencies to use latest instead of workspace:\*
8
-
9
- ## 0.2.0
10
-
11
- ### Minor Changes
12
-
13
- - 7c0e91f: ### `@stackwright-pro/display-components` (patch)
14
- - **JSX type fix**: Fixed JSX type definitions for improved React compatibility
15
-
16
- ### `@stackwright-pro/launch-stackwright-pro` (minor)
17
- - **Otters as packages refactor**: Moved otter templates from inline to separate packages, updated template references
18
-
19
- ### `@stackwright-pro/otters` (minor)
20
- - **New package**: Created dedicated otters package with StackHawk brand otters (API, dashboard, data, foreman), MCP tools, and architecture documentation
21
-
22
- ### Patch Changes
23
-
24
- - @stackwright-pro/mcp@0.1.1
package/MCP_TOOLS.md DELETED
@@ -1,264 +0,0 @@
1
- # Stackwright Pro MCP Tools Reference
2
-
3
- This document defines the MCP tools available for Pro Otters.
4
-
5
- ## Tool Naming Convention
6
-
7
- All Pro tools use the `stackwright_pro_` prefix to distinguish from OSS tools:
8
- - `stackwright_pro_*` — Pro-specific tools
9
- - `stackwright_*` — OSS Stackwright tools
10
-
11
- ## Available Tools
12
-
13
- ### API Discovery Tools
14
-
15
- #### `stackwright_pro_list_entities`
16
-
17
- Lists available entities from an OpenAPI spec or Zod schemas.
18
-
19
- **Arguments:**
20
- ```typescript
21
- {
22
- specPath?: string; // Path to OpenAPI spec (YAML/JSON)
23
- schemaPath?: string; // Path to compiled Zod schemas
24
- projectRoot?: string; // Project root (auto-detected if omitted)
25
- }
26
- ```
27
-
28
- **Returns:**
29
- ```typescript
30
- {
31
- success: boolean;
32
- entities: {
33
- name: string; // "Equipment", "Supplies"
34
- slug: string; // "equipment", "supplies"
35
- endpoint: string; // "/equipment", "/supplies/{id}"
36
- fieldCount: number; // Number of fields
37
- fields: {
38
- name: string;
39
- type: string;
40
- required: boolean;
41
- description?: string;
42
- }[];
43
- sourceFile: string;
44
- }[];
45
- errors?: string[];
46
- }
47
- ```
48
-
49
- **Example:**
50
- ```
51
- stackwright_pro_list_entities --specPath ./api.yaml
52
- ```
53
-
54
- ---
55
-
56
- #### `stackwright_pro_generate_filter`
57
-
58
- Generates endpoint filter configuration from selected entities.
59
-
60
- **Arguments:**
61
- ```typescript
62
- {
63
- selectedEntities: string[]; // Entity slugs to include
64
- projectRoot?: string; // Project root
65
- outputFormat?: 'yaml' | 'json';
66
- }
67
- ```
68
-
69
- **Returns:**
70
- ```typescript
71
- {
72
- success: boolean;
73
- filter: {
74
- include?: string[]; // Endpoint patterns to include
75
- exclude?: string[]; // Endpoint patterns to exclude
76
- };
77
- yaml?: string; // YAML snippet for stackwright.yml
78
- errors?: string[];
79
- }
80
- ```
81
-
82
- **Example:**
83
- ```
84
- stackwright_pro_generate_filter --selectedEntities equipment,supplies
85
- ```
86
-
87
- ---
88
-
89
- #### `stackwright_pro_validate_spec`
90
-
91
- Validates an OpenAPI spec against approved-specs configuration.
92
-
93
- **Arguments:**
94
- ```typescript
95
- {
96
- specPath: string;
97
- configPath?: string; // Path to stackwright.yml with prebuild.security config
98
- }
99
- ```
100
-
101
- **Returns:**
102
- ```typescript
103
- {
104
- valid: boolean;
105
- specUrl: string;
106
- errorCode?: 'SPEC_NOT_ON_ALLOWLIST' | 'SPEC_MODIFIED' | 'DOWNLOAD_FAILED';
107
- error?: string;
108
- }
109
- ```
110
-
111
- ---
112
-
113
- #### `stackwright_pro_discover_and_filter`
114
-
115
- Convenience wrapper: list entities, let user select, generate filter.
116
-
117
- **Arguments:**
118
- ```typescript
119
- {
120
- specPath: string;
121
- projectRoot?: string;
122
- }
123
- ```
124
-
125
- **Returns:**
126
- ```typescript
127
- {
128
- success: boolean;
129
- entities: Entity[]; // All discovered entities
130
- selectedEntities: string[]; // User-selected slugs
131
- filter: FilterConfig; // Generated filter
132
- yaml: string; // Ready-to-use YAML snippet
133
- }
134
- ```
135
-
136
- ---
137
-
138
- ### ISR Configuration Tools
139
-
140
- #### `stackwright_pro_configure_isr`
141
-
142
- Configures ISR (Incremental Static Regeneration) for API-backed collections.
143
-
144
- **Arguments:**
145
- ```typescript
146
- {
147
- collection: string; // Collection name
148
- revalidateSeconds?: number; // Revalidation interval (default: 60)
149
- fallback?: 'blocking' | 'true' | 'false';
150
- projectRoot?: string;
151
- }
152
- ```
153
-
154
- **Returns:**
155
- ```typescript
156
- {
157
- success: boolean;
158
- collection: string;
159
- config: {
160
- revalidate: number;
161
- fallback: 'blocking' | 'true' | 'false';
162
- };
163
- yaml: string; // YAML snippet to add to stackwright.yml
164
- }
165
- ```
166
-
167
- ---
168
-
169
- ### Dashboard Generation Tools
170
-
171
- #### `stackwright_pro_generate_dashboard`
172
-
173
- Generates a dashboard page configuration from API entities.
174
-
175
- **Arguments:**
176
- ```typescript
177
- {
178
- entities: string[]; // Entity slugs to include
179
- layout: 'grid' | 'table' | 'mixed';
180
- projectRoot?: string;
181
- }
182
- ```
183
-
184
- **Returns:**
185
- ```typescript
186
- {
187
- success: boolean;
188
- pageConfig: {
189
- slug: string;
190
- content: YAMLContent;
191
- };
192
- validationResult: ValidationResult;
193
- }
194
- ```
195
-
196
- ---
197
-
198
- ### Enterprise Security Tools
199
-
200
- #### `stackwright_pro_add_approved_spec`
201
-
202
- Adds a spec to the approved-specs allowlist.
203
-
204
- **Arguments:**
205
- ```typescript
206
- {
207
- name: string;
208
- url: string;
209
- sha256: string;
210
- configPath?: string; // Path to stackwright.yml
211
- }
212
- ```
213
-
214
- **Returns:**
215
- ```typescript
216
- {
217
- success: boolean;
218
- message: string;
219
- config: PrebuildSecurityConfig;
220
- }
221
- ```
222
-
223
- ---
224
-
225
- #### `stackwright_pro_list_approved_specs`
226
-
227
- Lists all approved specs in the configuration.
228
-
229
- **Arguments:**
230
- ```typescript
231
- {
232
- configPath?: string; // Path to stackwright.yml
233
- }
234
- ```
235
-
236
- **Returns:**
237
- ```typescript
238
- {
239
- specs: {
240
- name: string;
241
- url: string;
242
- sha256: string;
243
- }[];
244
- securityEnabled: boolean;
245
- }
246
- ```
247
-
248
- ---
249
-
250
- ## Usage by Otter
251
-
252
- | Otter | Tools Used |
253
- |-------|------------|
254
- | API Otter | `stackwright_pro_list_entities`, `stackwright_pro_validate_spec` |
255
- | Data Otter | `stackwright_pro_generate_filter`, `stackwright_pro_configure_isr` |
256
- | Dashboard Otter | `stackwright_pro_generate_dashboard`, `stackwright_render_page` |
257
- | Foreman Pro Otter | All of the above + `stackwright_scaffold_project` |
258
-
259
- ## Future Tools (Phase 2)
260
-
261
- - `stackwright_pro_test_api_connection` — Test API connectivity
262
- - `stackwright_pro_generate_types` — Generate TypeScript types from spec
263
- - `stackwright_pro_generate_zod_schemas` — Generate Zod schemas
264
- - `stackwright_pro_export_collection` — Export API data to file