jetic-cli 0.2.0 → 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 +75 -544
- package/dist/index.js +214 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,583 +1,156 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="public/jetic_white_bg.png" alt="Jetic Banner" width="
|
|
2
|
+
<img src="public/jetic_white_bg.png" alt="Jetic Banner" width="140">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center">Jetic </h1>
|
|
5
|
+
<h1 align="center">Jetic CLI</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>AI-Native API Behavior Testing, Discovery &
|
|
8
|
+
<strong>AI-Native API Behavior Testing, Discovery & Simulation Platform</strong>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<em>
|
|
12
|
+
<em>Zero-config static source scanning → Behavioral model graph → Automated API simulations & Visual Traces</em>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="#-
|
|
17
|
-
<a href="#-
|
|
18
|
-
<a href="#-
|
|
19
|
-
<a href="#-
|
|
20
|
-
<a href="#-
|
|
21
|
-
<a href="#-cli-command-reference">CLI Reference</a> •
|
|
22
|
-
<a href="#-jetic-studio-dashboard">Jetic Studio</a> •
|
|
23
|
-
<a href="#-artifact--file-schemas">File Schemas</a>
|
|
16
|
+
<a href="#-quickstart">Quickstart</a> •
|
|
17
|
+
<a href="#-the-4-phase-workflow">4-Phase Workflow</a> •
|
|
18
|
+
<a href="#-ai-ide-integration-mcp">AI IDE Setup</a> •
|
|
19
|
+
<a href="#-cli-commands">CLI Reference</a> •
|
|
20
|
+
<a href="#-jetic-studio">Jetic Studio</a>
|
|
24
21
|
</p>
|
|
25
22
|
|
|
26
23
|
<p align="center">
|
|
27
24
|
<a href="https://www.npmjs.com/package/jetic-cli"><img src="https://img.shields.io/npm/v/jetic-cli.svg" alt="NPM Version"></a>
|
|
28
25
|
<img src="https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen" alt="Node Version">
|
|
29
|
-
<img src="https://img.shields.io/badge/pnpm-%3E%3D9.0.0-orange" alt="PNPM Workspace">
|
|
30
26
|
<img src="https://img.shields.io/badge/AST-ts--morph-blueviolet" alt="ts-morph">
|
|
31
27
|
<img src="https://img.shields.io/badge/license-ISC-green.svg" alt="License">
|
|
32
28
|
</p>
|
|
33
29
|
|
|
34
30
|
---
|
|
35
31
|
|
|
36
|
-
##
|
|
32
|
+
## ⚡ Quickstart
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
<a href="https://www.youtube.com/watch?v=YOUR_VIDEO_ID">
|
|
40
|
-
<img src="../../screenshots/jetic_overview.JPG" alt="Watch the Jetic demo video" width="720">
|
|
41
|
-
</a>
|
|
42
|
-
</p>
|
|
43
|
-
|
|
44
|
-
<!-- TODO: paste the real demo video ID above (replace YOUR_VIDEO_ID).
|
|
45
|
-
Optionally swap the thumbnail for a dedicated screenshots/demo-thumbnail.png. -->
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## ⚡ The Problem
|
|
50
|
-
|
|
51
|
-
Traditional API testing tools (Postman, Insomnia, generic test runners) force developers to manually write hundreds of repetitive test scripts, hardcode authorization tokens, guess parameter validation limits, and painstakingly string together sequential operations (*Register User → Login → Save Token → Create Resource → Update Resource → Delete Resource*).
|
|
52
|
-
|
|
53
|
-
Furthermore, conventional HTTP runners only check if an endpoint returns a `200 OK`. They do **not** understand what your API is actually *supposed* to do, what business constraints govern your handlers, or how state flows across endpoint boundaries.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 💡 The Jetic Solution
|
|
58
|
-
|
|
59
|
-
**`jetic-cli`** is an agentic, code-native developer platform that **automatically understands, models, simulates, and traces an application's API behavior directly from its backend source code.**
|
|
60
|
-
|
|
61
|
-
1. 🔍 **Zero-Execution Source Code Scanning**: Jetic parses your TypeScript/Express Abstract Syntax Tree (AST via `ts-morph`) without running your server. It follows imports across controllers, services, middleware, and type declarations to discover routes, parameters, validation constraints, and auth schemes.
|
|
62
|
-
2. 🧠 **Declarative Behavioral Graph (`model.json`)**: Generates a versioned, strongly-typed behavioral graph mapping paths, HTTP methods, request schemas, response shapes, and exact source code provenance (file + line numbers).
|
|
63
|
-
3. 🤖 **AI-Driven Stateful Workflow Generation**: Uses AI to synthesize multi-step, end-to-end user journeys (`.jetic/workflows/*.json`).
|
|
64
|
-
4. 💾 **Pre/Post State Capture & Dynamic Injection**: Captures input parameters (like faker-generated email/password) before HTTP calls and response fields (like JWT tokens and resource IDs via JSONPath) after HTTP calls into `.jetic/memory.json`, automatically injecting them into subsequent headers (e.g. `Authorization: Bearer {{workflow:accessToken}}`) or body fields.
|
|
65
|
-
5. 📈 **Embedded Jetic Studio Dashboard**: Serves the local developer web IDE via `jetic dev` for visual API exploration, AST source code viewing, real-time SSE workflow execution, runtime memory editing, and ReactFlow trace graph visualizer.
|
|
66
|
-
|
|
67
|
-
> [!NOTE]
|
|
68
|
-
> **Framework & Language Support**: Automated AST source code scanning currently supports **Node.js & Express (TypeScript)** projects.
|
|
69
|
-
> For backends built with other languages or frameworks (e.g., Python/FastAPI, Go, Rust, Java, NestJS), you can manually add and manage endpoints directly inside **Jetic Studio** on the **Behavioral Model** page (`/model`) using the **"Add Endpoint"** button.
|
|
70
|
-
> **Easiest option for any stack**: use the [AI IDE setup below](#-start-with-your-ai-ide-recommended-no-ai-key) — your editor's AI reads the code and authors the model through Jetic MCP tools, no scanner or AI key required.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## ✨ Key Features
|
|
75
|
-
|
|
76
|
-
- 🔍 **AST Source Discovery**: Deeply inspects Express/TypeScript source code using `ts-morph`. Recursively resolves imported controllers, services, helpers, and types up to configurable depths.
|
|
77
|
-
- 🧩 **Nested Router & Middleware Resolution**: Seamlessly flattens complex nested Express router chains (e.g. `app.use('/api/orders', ordersRouter)` $\rightarrow$ `router.post('/checkout')`).
|
|
78
|
-
- 🧠 **Constraint & Business Logic Extraction**: Extracts validation logic directly from `if` statements (e.g. `if (password.length < 8)` $\rightarrow$ `minLength: 8`) and schema definitions, enabling intelligent data generation rather than blind fuzzing.
|
|
79
|
-
- 🔗 **Stateful Workflow Engine**: Synthesizes and executes multi-step workflows with full variable interpolation, auto-generating dynamic test data via `@faker-js/faker`.
|
|
80
|
-
- 📥 **Input & Output Memory Capture**:
|
|
81
|
-
- `captureInput`: Saves generated request body values (e.g. `admin_email`) to `.jetic/memory.json` *before* firing requests so subsequent steps can reuse them.
|
|
82
|
-
- `capture`: Saves response JSONPath fields (e.g. `data.accessToken`, `data.workspace.id`) to `.jetic/memory.json` *after* success.
|
|
83
|
-
- `inject`: Automatically injects memory values into headers (e.g. `header:Authorization = Bearer {{workflow:accessToken}}`) or body fields.
|
|
84
|
-
- 🖥️ **Jetic Studio Dashboard**: Modern React 19 + Vite + TailwindCSS + ReactFlow local developer web IDE (`jetic dev`) for visual API exploration, AST source code viewing, real-time SSE workflow execution, runtime memory editing, and node-graph trace debugging.
|
|
85
|
-
- 💻 **Feature-Rich CLI Command Suite**: Lightweight command-line interface bringing API intelligence, scanning, simulation, memory control, and config management straight to your terminal.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## ⚙️ How Jetic Works
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
┌────────────────────────┐
|
|
93
|
-
│ Backend Source Code │ (TypeScript / Express)
|
|
94
|
-
└───────────┬────────────┘
|
|
95
|
-
│
|
|
96
|
-
▼
|
|
97
|
-
┌────────────────────────┐
|
|
98
|
-
│ packages/scanner │ (AST parsing via ts-morph & ImportResolver)
|
|
99
|
-
└───────────┬────────────┘
|
|
100
|
-
│
|
|
101
|
-
▼
|
|
102
|
-
┌────────────────────────┐
|
|
103
|
-
│ .jetic/model.json │ (Behavioral Model: Endpoints, Schemas, Constraints, Auth, Source Provenance)
|
|
104
|
-
└───────────┬────────────┘
|
|
105
|
-
│
|
|
106
|
-
┌──────┴───────────────────────────┐
|
|
107
|
-
▼ ▼
|
|
108
|
-
┌──────────────┐ ┌────────────────────────┐
|
|
109
|
-
│ jetic scan │ │ jetic simulate │ (Single-endpoint or AI Workflows)
|
|
110
|
-
└──────────────┘ └───────────┬────────────┘
|
|
111
|
-
│
|
|
112
|
-
┌────────────────────┴───────────────────┐
|
|
113
|
-
▼ ▼
|
|
114
|
-
┌─────────────────────────┐ ┌────────────────────────┐
|
|
115
|
-
│ .jetic/memory.json │ │ Jetic Studio │
|
|
116
|
-
│ (Capture & Inject State)│ │ (/traces Observability)│
|
|
117
|
-
└─────────────────────────┘ └────────────────────────┘
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
1. **Scan (`jetic scan`)**: `ExpressScanner` and `ImportResolver` inspect your project root and `tsconfig.json`. They extract route paths, parameters, middleware chains, controller logic, and TypeScript types.
|
|
121
|
-
2. **Model (`.jetic/model.json`)**: Normalizes scanner output into a strongly typed `BehavioralModel` containing endpoint metadata, discovered constraints, expected request/response schemas, security schemes, and source references (`routes/auth.ts:42`).
|
|
122
|
-
3. **Synthesize Workflows (`jetic simulate workflow`)**: AI analyzes `model.json` to create end-to-end integration workflows. Step dependencies, input/output captures, and header injections are configured automatically.
|
|
123
|
-
4. **Run & Capture / Inject**: The simulator engine executes requests step-by-step. `captureInput` saves faker credentials pre-flight, `capture` reads response JSONPath fields post-flight, and `inject` dynamically constructs request headers/bodies for downstream steps.
|
|
124
|
-
5. **Trace & Observe**: Results are persisted as execution trace records and rendered in **Jetic Studio** (`/traces`) as an interactive ReactFlow node graph.
|
|
125
|
-
|
|
126
|
-
> [!TIP]
|
|
127
|
-
> **No AI key? Any backend stack? Skip the terminal AI commands.** Connect [`jetic mcp`](#jetic-mcp) to your AI code editor and let the agent do the same flow conversationally — it reads your code, builds `model.json`, authors workflows, and runs them, using your editor's own model. See [Start with Your AI IDE](#-start-with-your-ai-ide-recommended-no-ai-key).
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## 🚀 Getting Started
|
|
132
|
-
|
|
133
|
-
### Prerequisites
|
|
134
|
-
|
|
135
|
-
- **Node.js**: `v20.0.0` or higher
|
|
136
|
-
- **pnpm** / **npm** / **yarn**
|
|
137
|
-
|
|
138
|
-
### Installation
|
|
139
|
-
|
|
140
|
-
Install `jetic-cli` globally via npm:
|
|
34
|
+
Get started in under **60 seconds** — **no AI keys or third-party provider setup required**.
|
|
141
35
|
|
|
36
|
+
### 1. Install globally
|
|
142
37
|
```bash
|
|
143
38
|
npm install -g jetic-cli
|
|
144
39
|
```
|
|
145
40
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
npx jetic-cli --help
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
> [!NOTE]
|
|
153
|
-
> **Package Name vs Executable Command**: The CLI package is published on NPM as **`jetic-cli`** (`npm install -g jetic-cli`). Once installed, npm registers the **`jetic`** binary executable command in your system `PATH` so you can directly run `jetic init`, `jetic scan`, `jetic dev`, etc.
|
|
154
|
-
|
|
155
|
-
### Start with Your AI IDE (Recommended, No AI Key)
|
|
156
|
-
|
|
157
|
-
The fastest way to use Jetic is **through the AI assistant already inside your code editor** — opencode, Antigravity, Cursor, Claude Code, Windsurf, or VS Code. Your editor's model drives Jetic's 18 MCP tools directly: **no OpenRouter/OpenAI key, no `jetic config ai`, and no `jetic scan` needed to begin**. This path also works for **any backend stack** (Express, FastAPI, Go, Java, NestJS…), because the AI reads your code and models it via MCP.
|
|
158
|
-
|
|
159
|
-
#### Step 1 — Initialize your backend (10 seconds, once per project)
|
|
160
|
-
|
|
41
|
+
### 2. Initialize & Scan your backend
|
|
42
|
+
Navigate to your backend project directory (e.g., Express + TypeScript):
|
|
161
43
|
```bash
|
|
162
|
-
|
|
44
|
+
# Scaffold .jetic/ directory
|
|
163
45
|
jetic init
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
#### Step 2 — Connect the MCP server to your editor (once per editor)
|
|
167
|
-
|
|
168
|
-
opencode (`opencode.json` — global or project root):
|
|
169
|
-
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"$schema": "https://opencode.ai/config.json",
|
|
173
|
-
"mcp": {
|
|
174
|
-
"jetic": {
|
|
175
|
-
"type": "local",
|
|
176
|
-
"command": ["cmd", "/c", "jetic", "mcp"],
|
|
177
|
-
"cwd": "C:/path/to/your-backend",
|
|
178
|
-
"enabled": true
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
> Windows needs `cmd /c` (npm shims are `.cmd` files); on macOS/Linux use `"command": ["jetic", "mcp"]`. Point `cwd` at your backend root so Jetic finds `.jetic/model.json`. Using Antigravity, Cursor, Claude Code/Desktop, Windsurf, or VS Code? Same `jetic mcp` server — per-editor snippets live in the [mcp-server guide](https://github.com/jeticlabs/Jetic/tree/main/packages/mcp-server).
|
|
185
|
-
|
|
186
|
-
Restart the editor (or refresh its MCP panel) and confirm the `jetic_*` tools appear.
|
|
187
46
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Paste these into your editor's agent chat, in order:
|
|
191
|
-
|
|
192
|
-
**1. Meet Jetic** — *first message in a fresh project:*
|
|
193
|
-
> I've installed the Jetic MCP tools. Summarize what you can do with them, then read my project's model summary and tell me what's in it.
|
|
194
|
-
|
|
195
|
-
**2. Re-analyse the whole project** — *builds your entire `model.json` from code:*
|
|
196
|
-
> Help me re-analyse the whole project: find ALL API endpoints in this codebase — routes, controllers, middleware, auth guards, request/response shapes — and add every missing endpoint to my .jetic/model.json using the jetic tools. Include security, middleware chains, parameters, and response schemas. When done, run jetic_verify_model and fix all errors.
|
|
197
|
-
|
|
198
|
-
**3. Zoom into one area** — *repeat per module until coverage is complete:*
|
|
199
|
-
> Analyse ONLY src/modules/payments: add/update all of its endpoints in the model with full detail (middleware, auth, validation constraints), then verify.
|
|
200
|
-
|
|
201
|
-
**4. Create a workflow** — *the agent validates before saving, then runs it:*
|
|
202
|
-
> Help create a workflow called "Shopper checkout" with these steps: (1) register a user with a faker email and capture the credentials, (2) log in and capture the access token, (3) create an order with the Bearer token and expect 201. Validate it BEFORE saving, then save it and simulate it against http://localhost:3000.
|
|
203
|
-
|
|
204
|
-
**5. Negative / conditional test** — *expect a specific status:*
|
|
205
|
-
> Help create a workflow called "Forbidden admin action" where a normal non-admin user logs in and calls DELETE /api/admin/users/:id expecting 403. Validate, save, and simulate it.
|
|
206
|
-
|
|
207
|
-
**6. Live-test & verify loop** — *anytime your API changes:*
|
|
208
|
-
> Test POST /api/auth/login against my local server at http://localhost:4000 with a realistic payload and tell me whether the response matches the model. Then verify the whole model and fix any issues.
|
|
209
|
-
|
|
210
|
-
Behind the scenes the agent follows the structured order — `jetic_init` (first time in a repo), `jetic_scan` for Express or `jetic_add_endpoint` per endpoint otherwise (middleware, security, constraints), `jetic_verify_model`, then `jetic_validate_workflow` → `jetic_create_workflow` → `jetic_simulate_workflow`. If a step fails, just paste the error back — the validation messages say exactly how to fix it.
|
|
211
|
-
|
|
212
|
-
### Quickstart — Terminal Flow (Needs an AI Key)
|
|
213
|
-
|
|
214
|
-
Prefer the terminal, or want Express auto-discovery? This flow uses `jetic scan` plus AI workflow generation, which requires your own AI provider key (`jetic config ai`). The [AI IDE path above](#-start-with-your-ai-ide-recommended-no-ai-key) needs no key.
|
|
215
|
-
|
|
216
|
-
Navigate to your TypeScript/Express backend directory:
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
# 1. Initialize Jetic workspace directory (.jetic/)
|
|
220
|
-
jetic init
|
|
221
|
-
|
|
222
|
-
# 2. Configure AI credentials for workflow generation (OpenRouter or OpenAI)
|
|
223
|
-
# Windows PowerShell: $env:OPENROUTER_API_KEY="your-key"
|
|
224
|
-
# Linux/macOS: export OPENROUTER_API_KEY="your-key"
|
|
225
|
-
jetic config ai --provider openrouter --model anthropic/claude-3.5-sonnet --key-env OPENROUTER_API_KEY
|
|
226
|
-
|
|
227
|
-
# 3. Scan source code and generate .jetic/model.json
|
|
228
|
-
jetic scan
|
|
229
|
-
|
|
230
|
-
# 4. Inspect discovered API model and AST source code provenance
|
|
231
|
-
jetic inspect
|
|
232
|
-
|
|
233
|
-
# 5. Run AI workflow simulation against live local backend
|
|
234
|
-
jetic simulate workflow --goal "Admin registers workspace, logs in, creates class and logs out"
|
|
235
|
-
|
|
236
|
-
# 6. Launch Jetic Studio local web dashboard
|
|
237
|
-
jetic dev
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 💻 CLI Command Reference
|
|
243
|
-
|
|
244
|
-
### `jetic init`
|
|
245
|
-
Initializes a `.jetic/` directory in the current working directory with a default `config.json`.
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
jetic init
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
### `jetic scan`
|
|
254
|
-
Parses backend source code (via `tsconfig.json` and AST resolution), extracts endpoints, schemas, constraints, and source provenance, and writes `.jetic/model.json`.
|
|
255
|
-
|
|
256
|
-
```bash
|
|
47
|
+
# Static AST scan of backend source code to build .jetic/model.json
|
|
257
48
|
jetic scan
|
|
258
49
|
```
|
|
259
50
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
### `jetic inspect`
|
|
263
|
-
Displays summary metrics or deep inspection details for discovered API endpoints.
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
# Display project summary (endpoint count, methods breakdown, security rules)
|
|
267
|
-
jetic inspect
|
|
268
|
-
|
|
269
|
-
# Inspect a specific endpoint (shows AST source provenance, parameters, response schema)
|
|
270
|
-
jetic inspect endpoint GET /api/orders/:id
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
### `jetic simulate endpoint`
|
|
276
|
-
Simulates single endpoints or the entire API model against a target environment server using generated data.
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
# Simulate all endpoints in model.json
|
|
280
|
-
jetic simulate endpoint --all
|
|
281
|
-
|
|
282
|
-
# Simulate a specific endpoint with detailed response logs
|
|
283
|
-
jetic simulate endpoint POST /api/auth/login --verbose
|
|
284
|
-
|
|
285
|
-
# Run simulations against a specific environment defined in model.json
|
|
286
|
-
jetic simulate endpoint --all --env staging
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
### `jetic simulate workflow`
|
|
292
|
-
Generates and executes multi-step AI-driven workflow integration tests with automatic state capture and header injection.
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
# Generate and run an AI workflow for a custom natural-language goal
|
|
296
|
-
jetic simulate workflow --goal "User signs up, verifies email, creates project, and invites member"
|
|
297
|
-
|
|
298
|
-
# List all saved workflows in .jetic/workflows/
|
|
299
|
-
jetic simulate workflow --list
|
|
300
|
-
|
|
301
|
-
# Execute an existing workflow JSON file
|
|
302
|
-
jetic simulate workflow --workflow .jetic/workflows/user-onboarding.json
|
|
303
|
-
|
|
304
|
-
# Generate workflow JSON without running HTTP requests
|
|
305
|
-
jetic simulate workflow --goal "Create order and pay" --generate-only
|
|
306
|
-
|
|
307
|
-
# Clear runtime memory before executing
|
|
308
|
-
jetic simulate workflow --workflow .jetic/workflows/user-onboarding.json --clear-memory
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
### `jetic dev`
|
|
314
|
-
Starts the **Jetic Studio** backend API server and serves the local web dashboard interface.
|
|
315
|
-
|
|
51
|
+
### 3. Launch Jetic Studio or connect your AI IDE
|
|
316
52
|
```bash
|
|
317
|
-
# Launch
|
|
53
|
+
# Option A: Launch the visual developer dashboard (http://localhost:8787)
|
|
318
54
|
jetic dev
|
|
319
55
|
|
|
320
|
-
#
|
|
321
|
-
jetic dev --port 9000
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
### `jetic memory`
|
|
327
|
-
Views and manages key-value entries stored in `.jetic/memory.json`.
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# List all stored memory keys and values across scopes
|
|
331
|
-
jetic memory list
|
|
332
|
-
|
|
333
|
-
# Get value for a key (defaults to global scope or specify scope:key)
|
|
334
|
-
jetic memory get workflow:accessToken
|
|
335
|
-
|
|
336
|
-
# Set a key-value entry
|
|
337
|
-
jetic memory set workflow:accessToken "eyJhbGciOi..."
|
|
338
|
-
|
|
339
|
-
# Delete a key
|
|
340
|
-
jetic memory delete workflow:accessToken
|
|
341
|
-
|
|
342
|
-
# Clear all stored memory
|
|
343
|
-
jetic memory clear
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
### `jetic mcp`
|
|
349
|
-
Launches the **Jetic Model Context Protocol (MCP) Server** over stdio, giving the AI assistant inside your code editor 18 typed tools to inspect, author, validate, and live-test endpoints and workflows — no AI key needed (the editor's own model is used).
|
|
350
|
-
|
|
351
|
-
```bash
|
|
352
|
-
# Launch MCP Server over stdio (uses current directory as project root)
|
|
56
|
+
# Option B: Run MCP server for AI IDE assistant (Cursor, Antigravity, VS Code, opencode)
|
|
353
57
|
jetic mcp
|
|
354
|
-
|
|
355
|
-
# Pin to a project explicitly (same as JETIC_PROJECT_PATH env var)
|
|
356
|
-
jetic mcp --project C:/path/to/your-backend
|
|
357
58
|
```
|
|
358
59
|
|
|
359
|
-
> **Start here instead:** [Start with Your AI IDE](#-start-with-your-ai-ide-recommended-no-ai-key) — install, one `jetic init`, one editor config snippet, and copy-paste chat prompts. Per-editor configs (opencode, Antigravity, Cursor, Claude Code/Desktop, Windsurf, VS Code): [mcp-server guide](https://github.com/jeticlabs/Jetic/tree/main/packages/mcp-server).
|
|
360
|
-
|
|
361
|
-
#### MCP Tools Provided to IDE Assistants (18 — structured order: init → model → simulate):
|
|
362
|
-
- **Setup**: `jetic_init` (scaffold `.jetic/` for new repos, detects Express) · `jetic_scan` (keyless Express+TS auto-scan, merge keeps hand-added endpoints)
|
|
363
|
-
- **Read**: `jetic_read_model` (full model or summary) · `jetic_list_endpoints` (filter by method/tag/resource/path) · `jetic_get_endpoint` (full structural detail) · `jetic_verify_model` (duplicates, unbound params, bad status codes, dangling sources) · `jetic_list_workflows`
|
|
364
|
-
- **Author endpoints** (full fidelity: middleware chains, security, pagination, rate limits, ownership, produces/consumes, constraints): `jetic_add_endpoint` · `jetic_update_endpoint` · `jetic_delete_endpoint` · `jetic_manage_environment`
|
|
365
|
-
- **Author workflows** (validate → create → simulate loop with memory data-flow checks): `jetic_validate_workflow` · `jetic_create_workflow` · `jetic_update_workflow` · `jetic_delete_workflow`
|
|
366
|
-
- **Run live** (needs a running server): `jetic_test_endpoint` (custom headers/body/query supported) · `jetic_simulate_workflow` (+ `jetic_simulate` alias)
|
|
367
|
-
|
|
368
60
|
---
|
|
369
61
|
|
|
370
|
-
|
|
371
|
-
Configures AI providers, API key environment variables, and project settings.
|
|
62
|
+
## 🔄 The 4-Phase Workflow
|
|
372
63
|
|
|
373
|
-
|
|
374
|
-
# Interactively or explicitly configure AI provider settings
|
|
375
|
-
jetic config ai --provider openrouter --model anthropic/claude-3.5-sonnet --key-env OPENROUTER_API_KEY
|
|
64
|
+
Jetic operates on a strict, predictable 4-phase lifecycle for total model fidelity:
|
|
376
65
|
|
|
377
|
-
# View current configuration
|
|
378
|
-
jetic config list
|
|
379
66
|
```
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
Checks for updates and upgrades Jetic dependencies across the workspace.
|
|
385
|
-
|
|
386
|
-
```bash
|
|
387
|
-
jetic upgrade
|
|
67
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
68
|
+
│ 1. INITIALIZE │ ──► │ 2. SCAN & MODEL │ ──► │ 3. VERIFY │ ──► │ 4. SIMULATE │
|
|
69
|
+
│ (jetic init) │ │ (jetic scan) │ │ (jetic verify) │ │ (jetic simulate)│
|
|
70
|
+
└─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
388
71
|
```
|
|
389
72
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
**Jetic Studio** (`jetic dev`) is a sleek, dark-mode local web application designed specifically for visual API discovery, source provenance checking, AI workflow debugging, runtime memory control, and visual trace observability.
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
### 1. 📊 Workspace Overview (`/overview`)
|
|
399
|
-
The command center for your API model. Provides high-level metrics, endpoint distribution charts, security posture summaries, and quick links to recently discovered routes and workflow runs.
|
|
400
|
-
|
|
401
|
-
- **Key Highlights**: Endpoint totals, method breakdown bar, secured route percentages, recent endpoint shortcuts, active workflow list, and top memory keys preview.
|
|
402
|
-
|
|
403
|
-

|
|
404
|
-
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
### 2. 🧩 Behavioral Model (`/model`)
|
|
408
|
-
Interactive visual explorer for `.jetic/model.json`.
|
|
409
|
-
|
|
410
|
-
- **Key Highlights**: HTTP method filtering (GET, POST, PUT, DELETE, PATCH), full-text search, request/response schema inspection cards, security badges (JWT, Bearer, API Keys), middleware lists, environment switcher, and instant **Inspect** trigger buttons.
|
|
411
|
-
- **Manual Endpoint Creation ("Add Endpoint")**: For non-Express/TypeScript projects or custom routes, click the **"Add Endpoint"** button to manually define HTTP methods, paths, parameters, schemas, and authentication requirements directly from the interface.
|
|
412
|
-
|
|
413
|
-

|
|
414
|
-
|
|
415
|
-

|
|
73
|
+
1. **Phase 1 — Initialize (`jetic init`)**: Scaffolds the `.jetic/` directory and empty `model.json` in your project root.
|
|
74
|
+
2. **Phase 2 — Scan & Model (`jetic scan`)**: Keyless AST scan parses routes, controllers, middleware, and TypeScript interfaces. For non-Express backends (FastAPI, Go, NestJS), endpoints can be added manually or via MCP.
|
|
75
|
+
3. **Phase 3 — Verify (`jetic_verify_model`)**: Validates model structure and ensures all fields (descriptions, tags, parameter/response details) are complete and error-free.
|
|
76
|
+
4. **Phase 4 — Simulate (`jetic simulate`)**: Executes multi-step workflows with dynamic state capture (`captureInput` / `capture`) and header injection (`Authorization: Bearer {{workflow:token}}`).
|
|
416
77
|
|
|
417
78
|
---
|
|
418
79
|
|
|
419
|
-
|
|
420
|
-
Deep-dive inspection page for any single API endpoint.
|
|
421
|
-
|
|
422
|
-
- **Key Highlights**:
|
|
423
|
-
- **AST Source Code Viewer**: Live preview of the backend handler source code centered on the exact line number (e.g. `routes/orders.ts:42`).
|
|
424
|
-
- **Related Files Navigator**: Automatically parses imports to show connected controllers, services, and type declaration files.
|
|
425
|
-
- **Schema Explorer**: Field-by-field breakdown of request body, query parameters, path params, response definitions, and discovered constraints.
|
|
426
|
-
- **Interactive REST Client**: Test live endpoints directly from the browser using real or auto-generated fake data with authorization header injection.
|
|
427
|
-
|
|
428
|
-

|
|
429
|
-
|
|
430
|
-
---
|
|
80
|
+
## 🤖 AI IDE Integration (MCP)
|
|
431
81
|
|
|
432
|
-
|
|
433
|
-
Visual AI workflow builder and step-by-step runner.
|
|
82
|
+
Jetic comes with a built-in **Model Context Protocol (MCP)** server so your editor's AI assistant (opencode, Antigravity, Cursor, Claude Code, VS Code) can manage your API model directly — **using your editor's own model with no API keys**.
|
|
434
83
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
84
|
+
### Setup (e.g. `opencode.json` or Cursor `mcp.json`):
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcp": {
|
|
88
|
+
"jetic": {
|
|
89
|
+
"type": "local",
|
|
90
|
+
"command": ["jetic", "mcp"],
|
|
91
|
+
"enabled": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
*(On Windows, use `"command": ["cmd", "/c", "jetic", "mcp"]`)*
|
|
439
97
|
|
|
440
|
-
|
|
98
|
+
### Recommended Agent Prompts:
|
|
99
|
+
> 1. *"Run `jetic_get_session_phase` and guide me through building the API model for this project."*
|
|
100
|
+
> 2. *"Scan the backend, check endpoint completeness, fill missing descriptions/tags, and run `jetic_verify_model`."*
|
|
101
|
+
> 3. *"What workflow or integration test would you like to simulate against local environment?"*
|
|
441
102
|
|
|
442
103
|
---
|
|
443
104
|
|
|
444
|
-
|
|
445
|
-
Real-time state and key-value store inspector for `.jetic/memory.json`.
|
|
446
|
-
|
|
447
|
-
- **Key Highlights**:
|
|
448
|
-
- View authorization tokens (JWTs, session cookies), user credentials, resource IDs, and custom variables.
|
|
449
|
-
- Add, edit, or delete entries across `workflow` and `global` memory scopes.
|
|
450
|
-
- Clear state between simulation runs.
|
|
105
|
+
## 💻 CLI Commands
|
|
451
106
|
|
|
452
|
-
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `jetic init` | Scaffold `.jetic/` folder and initial configuration |
|
|
110
|
+
| `jetic scan` | Static AST source code scan for Express/TypeScript backends |
|
|
111
|
+
| `jetic inspect` | Inspect summary metrics or specific endpoint schemas in terminal |
|
|
112
|
+
| `jetic simulate endpoint` | Test live HTTP endpoints against local/staging server |
|
|
113
|
+
| `jetic simulate workflow` | Execute multi-step stateful workflows from `.jetic/workflows/` |
|
|
114
|
+
| `jetic dev` | Launch local **Jetic Studio** dashboard UI on port `8787` |
|
|
115
|
+
| `jetic memory` | View, set, or clear runtime variable memory (`.jetic/memory.json`) |
|
|
116
|
+
| `jetic mcp` | Start stdio MCP server for AI IDE integration |
|
|
453
117
|
|
|
454
118
|
---
|
|
455
119
|
|
|
456
|
-
|
|
457
|
-
Interactive ReactFlow node-graph visualizer for workflow execution traces.
|
|
120
|
+
## 🖥️ Jetic Studio
|
|
458
121
|
|
|
459
|
-
|
|
460
|
-
- **Node Graph Flow**: Visualizes steps as HTTP nodes connected by variable capture memory nodes.
|
|
461
|
-
- **Timeline Bar**: Proportional duration breakdown (ms) showing step latencies and pass/fail statuses.
|
|
462
|
-
- **Step Detail Drawer**: Click any node to open a side drawer detailing HTTP headers (injected vs standard), raw request body, JSON response body, expected status checks, and JSONPath capture rules.
|
|
122
|
+
Run `jetic dev` to open the local web developer studio:
|
|
463
123
|
|
|
464
|
-
|
|
124
|
+
- **Behavioral Model (`/model`)**: Explore endpoints, request/response schemas, and AST source code lines.
|
|
125
|
+
- **AI Simulations (`/simulations`)**: Visual step-by-step workflow runner with real-time SSE execution logs.
|
|
126
|
+
- **Memory Inspector (`/memory`)**: Edit captured tokens, fake test data, and session variables.
|
|
127
|
+
- **Visual Traces (`/traces`)**: Interactive node-graph execution visualizer powered by ReactFlow.
|
|
465
128
|
|
|
466
129
|
---
|
|
467
130
|
|
|
468
|
-
## 📄
|
|
469
|
-
|
|
470
|
-
### `.jetic/model.json` (Behavioral Model)
|
|
131
|
+
## 📄 Behavioral Model Preview (`.jetic/model.json`)
|
|
471
132
|
|
|
472
133
|
```json
|
|
473
134
|
{
|
|
474
135
|
"version": "0.3",
|
|
475
|
-
"
|
|
476
|
-
"
|
|
477
|
-
"name": "express-shop",
|
|
478
|
-
"language": "typescript",
|
|
479
|
-
"framework": "express"
|
|
480
|
-
},
|
|
481
|
-
"environments": [
|
|
482
|
-
{ "name": "local", "baseUrl": "http://localhost:3000" }
|
|
483
|
-
],
|
|
484
|
-
"securitySchemes": {
|
|
485
|
-
"bearerAuth": {
|
|
486
|
-
"type": "http",
|
|
487
|
-
"scheme": "bearer",
|
|
488
|
-
"obtainedFrom": {
|
|
489
|
-
"endpoint": "POST /api/auth/login",
|
|
490
|
-
"field": "data.accessToken"
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
},
|
|
136
|
+
"project": { "name": "my-api", "language": "typescript", "framework": "express" },
|
|
137
|
+
"environments": [{ "name": "local", "baseUrl": "http://localhost:3000" }],
|
|
494
138
|
"endpoints": [
|
|
495
139
|
{
|
|
496
140
|
"id": "post-api-auth-login",
|
|
497
141
|
"method": "POST",
|
|
498
142
|
"path": "/api/auth/login",
|
|
499
|
-
"
|
|
500
|
-
"
|
|
501
|
-
"file": "src/routes/auth.routes.ts",
|
|
502
|
-
"line": 14
|
|
503
|
-
},
|
|
143
|
+
"description": "User authentication endpoint",
|
|
144
|
+
"tags": ["auth"],
|
|
504
145
|
"requestBody": {
|
|
505
|
-
"contentType": "application/json",
|
|
506
146
|
"fields": {
|
|
507
|
-
"
|
|
508
|
-
"
|
|
147
|
+
"email": { "type": "string", "format": "email", "required": true },
|
|
148
|
+
"password": { "type": "string", "minLength": 8, "required": true }
|
|
509
149
|
}
|
|
510
150
|
},
|
|
511
151
|
"responses": {
|
|
512
|
-
"200": {
|
|
513
|
-
|
|
514
|
-
"schema": {
|
|
515
|
-
"data.accessToken": "string",
|
|
516
|
-
"data.user.id": "string"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
"middleware": []
|
|
521
|
-
}
|
|
522
|
-
]
|
|
523
|
-
}
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
### `.jetic/workflows/admin-onboarding.json` (Workflow Definition)
|
|
529
|
-
|
|
530
|
-
```json
|
|
531
|
-
{
|
|
532
|
-
"name": "Admin creates workspace, creates class and logs out",
|
|
533
|
-
"generatedAt": "2026-08-30T10:15:00.000Z",
|
|
534
|
-
"steps": [
|
|
535
|
-
{
|
|
536
|
-
"name": "Admin setup workspace",
|
|
537
|
-
"method": "POST",
|
|
538
|
-
"path": "/api/workspaces/setup",
|
|
539
|
-
"description": "Register workspace and initial admin credentials",
|
|
540
|
-
"body": {
|
|
541
|
-
"workspace_name": "{{faker.company.name}}",
|
|
542
|
-
"admin_email": "{{faker.internet.email}}",
|
|
543
|
-
"admin_password": "{{faker.internet.password}}"
|
|
544
|
-
},
|
|
545
|
-
"captureInput": {
|
|
546
|
-
"workflow:adminEmail": "admin_email",
|
|
547
|
-
"workflow:adminPassword": "admin_password"
|
|
548
|
-
},
|
|
549
|
-
"capture": {
|
|
550
|
-
"workflow:workspaceID": "data.workspace.id"
|
|
551
|
-
},
|
|
552
|
-
"expectStatus": 201
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
"name": "Admin login",
|
|
556
|
-
"method": "POST",
|
|
557
|
-
"path": "/api/auth/login",
|
|
558
|
-
"description": "Authenticate using captured admin credentials",
|
|
559
|
-
"body": {
|
|
560
|
-
"user_email": "{{workflow:adminEmail}}",
|
|
561
|
-
"user_password": "{{workflow:adminPassword}}"
|
|
562
|
-
},
|
|
563
|
-
"capture": {
|
|
564
|
-
"workflow:accessToken": "data.accessToken"
|
|
565
|
-
},
|
|
566
|
-
"expectStatus": 200
|
|
567
|
-
},
|
|
568
|
-
{
|
|
569
|
-
"name": "Create class",
|
|
570
|
-
"method": "POST",
|
|
571
|
-
"path": "/api/classes",
|
|
572
|
-
"description": "Create class in workspace using Bearer token",
|
|
573
|
-
"inject": {
|
|
574
|
-
"header:Authorization": "Bearer {{workflow:accessToken}}"
|
|
575
|
-
},
|
|
576
|
-
"body": {
|
|
577
|
-
"name": "{{faker.word.noun}} Class",
|
|
578
|
-
"workspaceId": "{{workflow:workspaceID}}"
|
|
579
|
-
},
|
|
580
|
-
"expectStatus": 201
|
|
152
|
+
"200": { "description": "Returns JWT token", "schema": { "token": "string" } }
|
|
153
|
+
}
|
|
581
154
|
}
|
|
582
155
|
]
|
|
583
156
|
}
|
|
@@ -585,49 +158,7 @@ Interactive ReactFlow node-graph visualizer for workflow execution traces.
|
|
|
585
158
|
|
|
586
159
|
---
|
|
587
160
|
|
|
588
|
-
### `.jetic/memory.json` (Runtime State)
|
|
589
|
-
|
|
590
|
-
```json
|
|
591
|
-
{
|
|
592
|
-
"workflow": {
|
|
593
|
-
"adminEmail": "admin_test_8421@example.com",
|
|
594
|
-
"adminPassword": "Password123!",
|
|
595
|
-
"workspaceID": "ws_98124712",
|
|
596
|
-
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
597
|
-
},
|
|
598
|
-
"global": {
|
|
599
|
-
"baseUrl": "http://localhost:3000"
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
---
|
|
605
|
-
|
|
606
|
-
## 🗺️ Roadmap & Vision
|
|
607
|
-
|
|
608
|
-
- [x] **Zero-Execution AST Scanner**: Deep TypeScript/Express source parser via `ts-morph` with import resolver.
|
|
609
|
-
- [x] **Declarative Behavioral Modeling**: Versioned `.jetic/model.json` schema with source code line references.
|
|
610
|
-
- [x] **Stateful AI Workflow Engine**: Multi-step simulation generation with `captureInput`, `capture`, and `inject`.
|
|
611
|
-
- [x] **Jetic Studio Local Dashboard**: React 19 IDE with REST simulator, AI builder, memory editor, and ReactFlow trace visualizer (`jetic dev`).
|
|
612
|
-
- [ ] **State-Machine Transition Testing**: Automatic state transition verification (e.g. `payment.capture()` valid when `authorized`, invalid when `refunded`).
|
|
613
|
-
- [ ] **Security & Authorization Vulnerability Auditor**: Automatic IDOR (Insecure Direct Object Reference) and privilege escalation scenario synthesizer.
|
|
614
|
-
- [ ] **Plugin Ecosystem SDK**: Custom extensions for GraphQL, Webhooks, gRPC, and custom LLM tool-calling agent test suites.
|
|
615
|
-
|
|
616
|
-
---
|
|
617
|
-
|
|
618
|
-
## 🤝 Contributing
|
|
619
|
-
|
|
620
|
-
We welcome contributions! Please see our [CONTRIBUTING.md](../../CONTRIBUTING.md) guide for instructions on setting up your local development environment, running tests across monorepo packages, and submitting Pull Requests.
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
## 📝 License
|
|
625
|
-
|
|
626
|
-
This project is licensed under the [ISC License](../../LICENSE).
|
|
627
|
-
|
|
628
|
-
---
|
|
629
|
-
|
|
630
161
|
<p align="center">
|
|
631
|
-
<i>Built with ❤️ by the Jetic Team
|
|
162
|
+
<i>Built with ❤️ by the Jetic Team.</i>
|
|
632
163
|
</p>
|
|
633
164
|
|
package/dist/index.js
CHANGED
|
@@ -269018,17 +269018,87 @@ var require_validation_tools = __commonJS({
|
|
|
269018
269018
|
}
|
|
269019
269019
|
}
|
|
269020
269020
|
}
|
|
269021
|
+
const fieldCompleteness = {};
|
|
269022
|
+
for (const ep of model.endpoints) {
|
|
269023
|
+
const routeKey = `${ep.method.toUpperCase()} ${ep.path}`;
|
|
269024
|
+
const missing = [];
|
|
269025
|
+
if (!ep.description || ep.description.trim() === "") {
|
|
269026
|
+
missing.push("description");
|
|
269027
|
+
issues.push({
|
|
269028
|
+
severity: "warning",
|
|
269029
|
+
endpointId: ep.id,
|
|
269030
|
+
route: routeKey,
|
|
269031
|
+
code: "MISSING_FIELD_DESCRIPTION",
|
|
269032
|
+
message: `Endpoint "${routeKey}" has no description.`,
|
|
269033
|
+
recommendation: "Add a concise description of what this endpoint does."
|
|
269034
|
+
});
|
|
269035
|
+
}
|
|
269036
|
+
if (!ep.tags || ep.tags.length === 0) {
|
|
269037
|
+
missing.push("tags");
|
|
269038
|
+
issues.push({
|
|
269039
|
+
severity: "warning",
|
|
269040
|
+
endpointId: ep.id,
|
|
269041
|
+
route: routeKey,
|
|
269042
|
+
code: "MISSING_FIELD_TAGS",
|
|
269043
|
+
message: `Endpoint "${routeKey}" has no tags.`,
|
|
269044
|
+
recommendation: 'Add at least one tag to group this endpoint (e.g. "auth", "users").'
|
|
269045
|
+
});
|
|
269046
|
+
}
|
|
269047
|
+
if (ep.parameters) {
|
|
269048
|
+
for (const p of ep.parameters) {
|
|
269049
|
+
if (!p.description || p.description.trim() === "") {
|
|
269050
|
+
const field = `parameters[${p.name}].description`;
|
|
269051
|
+
missing.push(field);
|
|
269052
|
+
issues.push({
|
|
269053
|
+
severity: "warning",
|
|
269054
|
+
endpointId: ep.id,
|
|
269055
|
+
route: routeKey,
|
|
269056
|
+
code: "MISSING_FIELD_PARAM_DESCRIPTION",
|
|
269057
|
+
message: `Parameter "${p.name}" on "${routeKey}" has no description.`,
|
|
269058
|
+
recommendation: `Add a description to parameter "${p.name}".`
|
|
269059
|
+
});
|
|
269060
|
+
}
|
|
269061
|
+
}
|
|
269062
|
+
}
|
|
269063
|
+
if (ep.responses) {
|
|
269064
|
+
for (const [statusCode, resp] of Object.entries(ep.responses)) {
|
|
269065
|
+
const r = resp;
|
|
269066
|
+
if (!r.description || String(r.description).trim() === "") {
|
|
269067
|
+
const field = `responses[${statusCode}].description`;
|
|
269068
|
+
missing.push(field);
|
|
269069
|
+
issues.push({
|
|
269070
|
+
severity: "warning",
|
|
269071
|
+
endpointId: ep.id,
|
|
269072
|
+
route: routeKey,
|
|
269073
|
+
code: "MISSING_FIELD_RESPONSE_DESCRIPTION",
|
|
269074
|
+
message: `Response "${statusCode}" on "${routeKey}" has no description.`,
|
|
269075
|
+
recommendation: `Add a description to the ${statusCode} response (e.g. "User created successfully").`
|
|
269076
|
+
});
|
|
269077
|
+
}
|
|
269078
|
+
}
|
|
269079
|
+
}
|
|
269080
|
+
if (missing.length > 0) {
|
|
269081
|
+
fieldCompleteness[ep.id] = { missingFields: missing };
|
|
269082
|
+
}
|
|
269083
|
+
}
|
|
269084
|
+
const allFieldsFilled = Object.keys(fieldCompleteness).length === 0;
|
|
269021
269085
|
const errors = issues.filter((i) => i.severity === "error");
|
|
269022
269086
|
const warnings = issues.filter((i) => i.severity === "warning");
|
|
269023
269087
|
return {
|
|
269024
269088
|
filePath,
|
|
269025
269089
|
isValid: errors.length === 0,
|
|
269090
|
+
allFieldsFilled,
|
|
269026
269091
|
totalEndpoints: model.endpoints.length,
|
|
269027
269092
|
summary: {
|
|
269028
269093
|
errorsCount: errors.length,
|
|
269029
269094
|
warningsCount: warnings.length
|
|
269030
269095
|
},
|
|
269031
|
-
issues
|
|
269096
|
+
issues,
|
|
269097
|
+
fieldCompleteness,
|
|
269098
|
+
phaseGate: {
|
|
269099
|
+
phase3Complete: errors.length === 0 && allFieldsFilled,
|
|
269100
|
+
message: errors.length === 0 && allFieldsFilled ? "Model is valid and all fields are complete. You may advance to Phase 4 \u2014 ask the user what simulation or workflow they want to build." : "Fix all errors and fill missing fields before proceeding to Phase 4."
|
|
269101
|
+
}
|
|
269032
269102
|
};
|
|
269033
269103
|
}
|
|
269034
269104
|
}
|
|
@@ -284234,6 +284304,112 @@ var require_serial_transport = __commonJS({
|
|
|
284234
284304
|
}
|
|
284235
284305
|
});
|
|
284236
284306
|
|
|
284307
|
+
// ../../packages/mcp-server/dist/tools/session-tools.js
|
|
284308
|
+
var require_session_tools = __commonJS({
|
|
284309
|
+
"../../packages/mcp-server/dist/tools/session-tools.js"(exports2) {
|
|
284310
|
+
"use strict";
|
|
284311
|
+
init_cjs_shims();
|
|
284312
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
284313
|
+
exports2.getSessionPhaseSchema = void 0;
|
|
284314
|
+
exports2.handleGetSessionPhase = handleGetSessionPhase;
|
|
284315
|
+
var zod_1 = require("zod");
|
|
284316
|
+
var types_1 = require_types();
|
|
284317
|
+
var validation_tools_1 = require_validation_tools();
|
|
284318
|
+
exports2.getSessionPhaseSchema = zod_1.z.object({
|
|
284319
|
+
projectPath: zod_1.z.string().optional().describe("Path to the project root or .jetic folder (defaults to JETIC_PROJECT_PATH / cwd)")
|
|
284320
|
+
});
|
|
284321
|
+
function checkAllFieldsFilled(model) {
|
|
284322
|
+
let incompleteCount = 0;
|
|
284323
|
+
for (const ep of model.endpoints) {
|
|
284324
|
+
let incomplete = false;
|
|
284325
|
+
if (!ep.description || ep.description.trim() === "")
|
|
284326
|
+
incomplete = true;
|
|
284327
|
+
if (!ep.tags || ep.tags.length === 0)
|
|
284328
|
+
incomplete = true;
|
|
284329
|
+
if (ep.parameters) {
|
|
284330
|
+
for (const p of ep.parameters) {
|
|
284331
|
+
if (!p.description || p.description.trim() === "") {
|
|
284332
|
+
incomplete = true;
|
|
284333
|
+
break;
|
|
284334
|
+
}
|
|
284335
|
+
}
|
|
284336
|
+
}
|
|
284337
|
+
if (ep.responses) {
|
|
284338
|
+
for (const resp of Object.values(ep.responses)) {
|
|
284339
|
+
const r = resp;
|
|
284340
|
+
if (!r.description || String(r.description).trim() === "") {
|
|
284341
|
+
incomplete = true;
|
|
284342
|
+
break;
|
|
284343
|
+
}
|
|
284344
|
+
}
|
|
284345
|
+
}
|
|
284346
|
+
if (incomplete)
|
|
284347
|
+
incompleteCount++;
|
|
284348
|
+
}
|
|
284349
|
+
return { allFilled: incompleteCount === 0, incompleteCount };
|
|
284350
|
+
}
|
|
284351
|
+
function handleGetSessionPhase(args) {
|
|
284352
|
+
const { model, exists } = (0, types_1.loadModel)(args.projectPath);
|
|
284353
|
+
if (!exists) {
|
|
284354
|
+
return {
|
|
284355
|
+
phase: 1,
|
|
284356
|
+
phaseName: "init",
|
|
284357
|
+
modelExists: false,
|
|
284358
|
+
endpointsCount: 0,
|
|
284359
|
+
modelIsValid: false,
|
|
284360
|
+
allFieldsFilled: false,
|
|
284361
|
+
nextAction: "PHASE 1 \u2014 INITIALIZE: No .jetic/model.json found. Call jetic_init now to scaffold the project. Do not proceed until modelExists is true."
|
|
284362
|
+
};
|
|
284363
|
+
}
|
|
284364
|
+
const endpointsCount = model.endpoints?.length ?? 0;
|
|
284365
|
+
if (endpointsCount === 0) {
|
|
284366
|
+
return {
|
|
284367
|
+
phase: 2,
|
|
284368
|
+
phaseName: "scan",
|
|
284369
|
+
modelExists: true,
|
|
284370
|
+
endpointsCount: 0,
|
|
284371
|
+
modelIsValid: false,
|
|
284372
|
+
allFieldsFilled: false,
|
|
284373
|
+
nextAction: "PHASE 2 \u2014 SCAN: Model exists but has no endpoints. If the project has tsconfig.json (Express+TypeScript), call jetic_scan. Otherwise read the source code and call jetic_add_endpoint for every API route. Do not proceed to Phase 3 until endpointsCount > 0."
|
|
284374
|
+
};
|
|
284375
|
+
}
|
|
284376
|
+
let modelIsValid = false;
|
|
284377
|
+
try {
|
|
284378
|
+
const verification = (0, validation_tools_1.handleVerifyModel)({ projectPath: args.projectPath });
|
|
284379
|
+
modelIsValid = verification.isValid;
|
|
284380
|
+
} catch {
|
|
284381
|
+
modelIsValid = false;
|
|
284382
|
+
}
|
|
284383
|
+
const { allFilled, incompleteCount } = checkAllFieldsFilled(model);
|
|
284384
|
+
if (!modelIsValid || !allFilled) {
|
|
284385
|
+
const reasons = [];
|
|
284386
|
+
if (!modelIsValid)
|
|
284387
|
+
reasons.push("model has validation errors (call jetic_verify_model to see them)");
|
|
284388
|
+
if (!allFilled)
|
|
284389
|
+
reasons.push(`${incompleteCount} endpoint(s) have incomplete fields (missing description, tags, parameter descriptions, or response descriptions \u2014 call jetic_verify_model to see the full list)`);
|
|
284390
|
+
return {
|
|
284391
|
+
phase: 3,
|
|
284392
|
+
phaseName: "verify",
|
|
284393
|
+
modelExists: true,
|
|
284394
|
+
endpointsCount,
|
|
284395
|
+
modelIsValid,
|
|
284396
|
+
allFieldsFilled: allFilled,
|
|
284397
|
+
nextAction: `PHASE 3 \u2014 VERIFY: ${reasons.join("; ")}. Fix all issues with jetic_update_endpoint / jetic_add_endpoint, then call jetic_verify_model until both modelIsValid and allFieldsFilled are true. Do not touch any workflow tool until Phase 4 is reached.`
|
|
284398
|
+
};
|
|
284399
|
+
}
|
|
284400
|
+
return {
|
|
284401
|
+
phase: 4,
|
|
284402
|
+
phaseName: "simulate",
|
|
284403
|
+
modelExists: true,
|
|
284404
|
+
endpointsCount,
|
|
284405
|
+
modelIsValid: true,
|
|
284406
|
+
allFieldsFilled: true,
|
|
284407
|
+
nextAction: 'PHASE 4 \u2014 SIMULATE: The model is valid and complete. ASK THE USER: "What simulation or workflow do you want to build?" Wait for their answer before calling any workflow tool. Do not invent a workflow goal \u2014 the user must specify it.'
|
|
284408
|
+
};
|
|
284409
|
+
}
|
|
284410
|
+
}
|
|
284411
|
+
});
|
|
284412
|
+
|
|
284237
284413
|
// ../../packages/mcp-server/dist/server.js
|
|
284238
284414
|
var require_server3 = __commonJS({
|
|
284239
284415
|
"../../packages/mcp-server/dist/server.js"(exports2) {
|
|
@@ -284294,6 +284470,7 @@ var require_server3 = __commonJS({
|
|
|
284294
284470
|
var workflow_tools_1 = require_workflow_tools();
|
|
284295
284471
|
var workflow_authoring_tools_1 = require_workflow_authoring_tools();
|
|
284296
284472
|
var project_tools_1 = require_project_tools();
|
|
284473
|
+
var session_tools_1 = require_session_tools();
|
|
284297
284474
|
exports2.JETIC_MCP_SERVER_NAME = "jetic-mcp-server";
|
|
284298
284475
|
function getJeticMcpVersion() {
|
|
284299
284476
|
try {
|
|
@@ -284306,13 +284483,37 @@ var require_server3 = __commonJS({
|
|
|
284306
284483
|
return "0.1.0";
|
|
284307
284484
|
}
|
|
284308
284485
|
exports2.JETIC_MCP_INSTRUCTIONS = [
|
|
284309
|
-
"Jetic MCP manages API behavioral models in `.jetic/`.
|
|
284310
|
-
"
|
|
284311
|
-
"
|
|
284312
|
-
"
|
|
284313
|
-
"
|
|
284314
|
-
"
|
|
284315
|
-
"
|
|
284486
|
+
"Jetic MCP manages API behavioral models in `.jetic/`. You MUST follow this strict 4-phase order. Never skip, reorder, or bypass any phase.",
|
|
284487
|
+
"",
|
|
284488
|
+
"\u2501\u2501 PHASE 1 \u2014 INITIALIZE \u2501\u2501",
|
|
284489
|
+
"Call `jetic_get_session_phase` at the very start of every session. If phase=1 (modelExists:false), call `jetic_init` to scaffold .jetic/model.json.",
|
|
284490
|
+
"Gate: DO NOT advance to Phase 2 until modelExists is true.",
|
|
284491
|
+
"",
|
|
284492
|
+
"\u2501\u2501 PHASE 2 \u2014 SCAN \u2501\u2501",
|
|
284493
|
+
"Populate the model with endpoints:",
|
|
284494
|
+
" \u2022 Express+TypeScript (tsconfig.json present): call `jetic_scan` (static, keyless, no AI provider needed).",
|
|
284495
|
+
" \u2022 Any other stack or scan gaps: read the source code and call `jetic_add_endpoint` for every route (include middleware chains, security, constraints, pagination, produces/consumes).",
|
|
284496
|
+
"Gate: DO NOT advance to Phase 3 until endpointsCount > 0.",
|
|
284497
|
+
"",
|
|
284498
|
+
"\u2501\u2501 PHASE 3 \u2014 VERIFY \u2501\u2501",
|
|
284499
|
+
"Call `jetic_verify_model`. Fix every error AND every MISSING_FIELD_* warning:",
|
|
284500
|
+
" \u2022 Fill `description` on every endpoint.",
|
|
284501
|
+
" \u2022 Add at least one `tag` per endpoint.",
|
|
284502
|
+
" \u2022 Add `description` to every parameter.",
|
|
284503
|
+
" \u2022 Add `description` to every response status code.",
|
|
284504
|
+
"Use `jetic_update_endpoint` to fill gaps. Call `jetic_verify_model` again after each batch of updates.",
|
|
284505
|
+
"Gate: DO NOT advance to Phase 4 until jetic_get_session_phase returns phase=4 (modelIsValid AND allFieldsFilled both true).",
|
|
284506
|
+
"",
|
|
284507
|
+
"\u2501\u2501 PHASE 4 \u2014 SIMULATE \u2501\u2501",
|
|
284508
|
+
'STOP. Ask the user: "What simulation or workflow do you want to build?"',
|
|
284509
|
+
"Wait for their explicit answer. Then and only then: author the workflow with `jetic_validate_workflow` (dry run) \u2192 `jetic_create_workflow` \u2192 `jetic_simulate_workflow`.",
|
|
284510
|
+
"Chain steps using capture/captureInput (producer) + inject or {{workflow:key}} (consumer). Use {{human:key}} ONLY for values unknowable beforehand (OTP codes, real secrets).",
|
|
284511
|
+
"Never start Phase 4 without an explicit user-specified goal.",
|
|
284512
|
+
"",
|
|
284513
|
+
"\u2501\u2501 GENERAL RULES \u2501\u2501",
|
|
284514
|
+
"No AI-provider setup is needed: never ask for OpenRouter/OpenAI keys and never use `jetic config ai`.",
|
|
284515
|
+
"Mutating tools write to disk \u2014 confirm intent with the user before destructive operations (delete/overwrite).",
|
|
284516
|
+
"Project resolution: every tool accepts an optional `projectPath`. If omitted, falls back to JETIC_PROJECT_PATH env var, then cwd."
|
|
284316
284517
|
].join("\n");
|
|
284317
284518
|
var READ_ONLY = {
|
|
284318
284519
|
readOnlyHint: true,
|
|
@@ -284360,7 +284561,10 @@ var require_server3 = __commonJS({
|
|
|
284360
284561
|
}
|
|
284361
284562
|
});
|
|
284362
284563
|
};
|
|
284363
|
-
register("
|
|
284564
|
+
register("jetic_get_session_phase", "Get session phase", "ALWAYS CALL THIS FIRST. Returns the current workflow phase (1=init, 2=scan, 3=verify, 4=simulate), gate conditions (modelExists, endpointsCount, modelIsValid, allFieldsFilled), and the exact nextAction the AI must take. Never skip phase gates.", session_tools_1.getSessionPhaseSchema.shape, READ_ONLY, session_tools_1.handleGetSessionPhase);
|
|
284565
|
+
register("jetic_init", "Initialize Jetic project", "PHASE 1: Scaffolds .jetic/model.json (+ workflows/, config.json) for repos that have none. Refuses to clobber an existing model (pass overwrite:true to replace). Reports whether auto-scan applies (Express+TypeScript) and what to do next.", project_tools_1.initProjectSchema.shape, WRITES_MODEL, project_tools_1.handleInitProject);
|
|
284566
|
+
register("jetic_scan", "Scan Express project", "PHASE 2 (Express+TypeScript only \u2014 requires tsconfig.json): Static AST scan that fills model.json with routes, middleware, and auth heuristics. Keyless \u2014 no AI provider involved. Default merge upserts scanned routes and keeps hand-added endpoints; overwrite replaces all endpoints. Fails with guidance for non-Express stacks (model those manually with jetic_add_endpoint).", project_tools_1.scanProjectSchema.shape, WRITES_MODEL, project_tools_1.handleScanProject);
|
|
284567
|
+
register("jetic_read_model", "Read Jetic model", "Reads .jetic/model.json from the workspace and returns the full behavioral model or a metadata summary.", model_tools_1.readModelSchema.shape, READ_ONLY, model_tools_1.handleReadModel);
|
|
284364
284568
|
register("jetic_list_endpoints", "List endpoints", "Lists API endpoints discovered in .jetic/model.json with optional filters by method, tag, resource, or path substring.", model_tools_1.listEndpointsSchema.shape, READ_ONLY, model_tools_1.handleListEndpoints);
|
|
284365
284569
|
register("jetic_get_endpoint", "Get endpoint details", "Returns full structural details (parameters, request body, schemas, security, responses) of one endpoint, looked up by ID or by method + path.", model_tools_1.getEndpointSchema.shape, READ_ONLY, model_tools_1.handleGetEndpoint);
|
|
284366
284570
|
register("jetic_add_endpoint", "Add endpoint", "Adds a new endpoint definition to .jetic/model.json (or updates the existing method+path route when overwriteIfExists is true, the default). Adheres to the Jetic Behavioral Model schema.", endpoint_tools_1.addEndpointSchema.shape, WRITES_MODEL, endpoint_tools_1.handleAddEndpoint);
|
|
@@ -284376,8 +284580,6 @@ var require_server3 = __commonJS({
|
|
|
284376
284580
|
register("jetic_create_workflow", "Create workflow", "Creates a .jetic/workflows/<slug>.json workflow from ordered steps with capture/inject memory chaining. Refuses to save when validation errors exist (error messages say exactly how to fix); use validateOnly for a dry run. Can also migrate an embedded model.json workflow via fromModelWorkflow.", workflow_authoring_tools_1.createWorkflowSchema.shape, WRITES_MODEL, workflow_authoring_tools_1.handleCreateWorkflow);
|
|
284377
284581
|
register("jetic_update_workflow", "Update workflow", "Updates a saved file workflow: rename, description/environment, full steps replacement, or appendSteps. Validates before writing and refuses to save on errors.", workflow_authoring_tools_1.updateWorkflowSchema.shape, WRITES_MODEL, workflow_authoring_tools_1.handleUpdateWorkflow);
|
|
284378
284582
|
register("jetic_delete_workflow", "Delete workflow", "Deletes a saved .jetic/workflows/*.json workflow file by slug, name, or path. Destructive: confirm with the user before calling. Cannot delete model.json-embedded workflows.", workflow_authoring_tools_1.deleteWorkflowSchema.shape, DESTRUCTIVE, workflow_authoring_tools_1.handleDeleteWorkflow);
|
|
284379
|
-
register("jetic_init", "Initialize Jetic project", "Step 1 of the structured order: scaffolds .jetic/model.json (+ workflows/, config.json) for repos that have none. Refuses to clobber an existing model (pass overwrite:true to replace). Reports whether auto-scan applies (Express+TypeScript) and what to do next.", project_tools_1.initProjectSchema.shape, WRITES_MODEL, project_tools_1.handleInitProject);
|
|
284380
|
-
register("jetic_scan", "Scan Express project", "Step 2a for Express+TypeScript projects (requires tsconfig.json): static AST scan that fills model.json with routes, middleware, and auth heuristics. Keyless \u2014 no AI provider involved. Default merge upserts scanned routes and keeps hand-added endpoints; overwrite replaces all endpoints. Fails with guidance for non-Express stacks (model those manually).", project_tools_1.scanProjectSchema.shape, WRITES_MODEL, project_tools_1.handleScanProject);
|
|
284381
284583
|
return server;
|
|
284382
284584
|
}
|
|
284383
284585
|
async function runMcpServer2() {
|
|
@@ -287274,7 +287476,7 @@ var mcpCommand = new import_commander10.Command("mcp").description("Launch Model
|
|
|
287274
287476
|
|
|
287275
287477
|
// src/index.ts
|
|
287276
287478
|
var program = new import_commander11.Command();
|
|
287277
|
-
program.name("jetic").description("AI-Native API Behavior Testing").version("0.1
|
|
287479
|
+
program.name("jetic").description("AI-Native API Behavior Testing").version("0.2.1");
|
|
287278
287480
|
program.addCommand(initCommand);
|
|
287279
287481
|
program.addCommand(scanCommand);
|
|
287280
287482
|
program.addCommand(inspectCommand);
|