@cisco_open/linting-orchestrator 1.0.0-rc.4
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 +201 -0
- package/NOTICE +5 -0
- package/README.md +43 -0
- package/build/cli/api-client.d.ts +170 -0
- package/build/cli/api-client.d.ts.map +1 -0
- package/build/cli/api-client.js +284 -0
- package/build/cli/api-client.js.map +1 -0
- package/build/cli/commands/agents.d.ts +7 -0
- package/build/cli/commands/agents.d.ts.map +1 -0
- package/build/cli/commands/agents.js +694 -0
- package/build/cli/commands/agents.js.map +1 -0
- package/build/cli/commands/completion.d.ts +9 -0
- package/build/cli/commands/completion.d.ts.map +1 -0
- package/build/cli/commands/completion.js +177 -0
- package/build/cli/commands/completion.js.map +1 -0
- package/build/cli/commands/config.d.ts +10 -0
- package/build/cli/commands/config.d.ts.map +1 -0
- package/build/cli/commands/config.js +284 -0
- package/build/cli/commands/config.js.map +1 -0
- package/build/cli/commands/health.d.ts +11 -0
- package/build/cli/commands/health.d.ts.map +1 -0
- package/build/cli/commands/health.js +38 -0
- package/build/cli/commands/health.js.map +1 -0
- package/build/cli/commands/help.d.ts +6 -0
- package/build/cli/commands/help.d.ts.map +1 -0
- package/build/cli/commands/help.js +20 -0
- package/build/cli/commands/help.js.map +1 -0
- package/build/cli/commands/history.d.ts +11 -0
- package/build/cli/commands/history.d.ts.map +1 -0
- package/build/cli/commands/history.js +50 -0
- package/build/cli/commands/history.js.map +1 -0
- package/build/cli/commands/jobs.d.ts +12 -0
- package/build/cli/commands/jobs.d.ts.map +1 -0
- package/build/cli/commands/jobs.js +84 -0
- package/build/cli/commands/jobs.js.map +1 -0
- package/build/cli/commands/lint.d.ts +15 -0
- package/build/cli/commands/lint.d.ts.map +1 -0
- package/build/cli/commands/lint.js +384 -0
- package/build/cli/commands/lint.js.map +1 -0
- package/build/cli/commands/ps.d.ts +8 -0
- package/build/cli/commands/ps.d.ts.map +1 -0
- package/build/cli/commands/ps.js +74 -0
- package/build/cli/commands/ps.js.map +1 -0
- package/build/cli/commands/reproduce.d.ts +9 -0
- package/build/cli/commands/reproduce.d.ts.map +1 -0
- package/build/cli/commands/reproduce.js +31 -0
- package/build/cli/commands/reproduce.js.map +1 -0
- package/build/cli/commands/reset.d.ts +5 -0
- package/build/cli/commands/reset.d.ts.map +1 -0
- package/build/cli/commands/reset.js +13 -0
- package/build/cli/commands/reset.js.map +1 -0
- package/build/cli/commands/results.d.ts +13 -0
- package/build/cli/commands/results.d.ts.map +1 -0
- package/build/cli/commands/results.js +129 -0
- package/build/cli/commands/results.js.map +1 -0
- package/build/cli/commands/rulesets/check.d.ts +12 -0
- package/build/cli/commands/rulesets/check.d.ts.map +1 -0
- package/build/cli/commands/rulesets/check.js +226 -0
- package/build/cli/commands/rulesets/check.js.map +1 -0
- package/build/cli/commands/rulesets/index.d.ts +5 -0
- package/build/cli/commands/rulesets/index.d.ts.map +1 -0
- package/build/cli/commands/rulesets/index.js +6 -0
- package/build/cli/commands/rulesets/index.js.map +1 -0
- package/build/cli/commands/rulesets/view.d.ts +16 -0
- package/build/cli/commands/rulesets/view.d.ts.map +1 -0
- package/build/cli/commands/rulesets/view.js +100 -0
- package/build/cli/commands/rulesets/view.js.map +1 -0
- package/build/cli/commands/start.d.ts +16 -0
- package/build/cli/commands/start.d.ts.map +1 -0
- package/build/cli/commands/start.js +167 -0
- package/build/cli/commands/start.js.map +1 -0
- package/build/cli/commands/status.d.ts +9 -0
- package/build/cli/commands/status.d.ts.map +1 -0
- package/build/cli/commands/status.js +46 -0
- package/build/cli/commands/status.js.map +1 -0
- package/build/cli/commands/stop.d.ts +11 -0
- package/build/cli/commands/stop.d.ts.map +1 -0
- package/build/cli/commands/stop.js +78 -0
- package/build/cli/commands/stop.js.map +1 -0
- package/build/cli/config-manager.d.ts +134 -0
- package/build/cli/config-manager.d.ts.map +1 -0
- package/build/cli/config-manager.js +288 -0
- package/build/cli/config-manager.js.map +1 -0
- package/build/cli/formatters.d.ts +62 -0
- package/build/cli/formatters.d.ts.map +1 -0
- package/build/cli/formatters.js +715 -0
- package/build/cli/formatters.js.map +1 -0
- package/build/cli/history-manager.d.ts +97 -0
- package/build/cli/history-manager.d.ts.map +1 -0
- package/build/cli/history-manager.js +201 -0
- package/build/cli/history-manager.js.map +1 -0
- package/build/cli/index.d.ts +16 -0
- package/build/cli/index.d.ts.map +1 -0
- package/build/cli/index.js +335 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/list-rulesets.d.ts +15 -0
- package/build/cli/list-rulesets.d.ts.map +1 -0
- package/build/cli/list-rulesets.js +193 -0
- package/build/cli/list-rulesets.js.map +1 -0
- package/build/cli/utils/connection-error.d.ts +9 -0
- package/build/cli/utils/connection-error.d.ts.map +1 -0
- package/build/cli/utils/connection-error.js +30 -0
- package/build/cli/utils/connection-error.js.map +1 -0
- package/build/cli/utils/embedded-server.d.ts +21 -0
- package/build/cli/utils/embedded-server.d.ts.map +1 -0
- package/build/cli/utils/embedded-server.js +61 -0
- package/build/cli/utils/embedded-server.js.map +1 -0
- package/build/cli/utils/mode-validator.d.ts +13 -0
- package/build/cli/utils/mode-validator.d.ts.map +1 -0
- package/build/cli/utils/mode-validator.js +31 -0
- package/build/cli/utils/mode-validator.js.map +1 -0
- package/build/cli/utils/port-checker.d.ts +20 -0
- package/build/cli/utils/port-checker.d.ts.map +1 -0
- package/build/cli/utils/port-checker.js +49 -0
- package/build/cli/utils/port-checker.js.map +1 -0
- package/build/config.d.ts +57 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +527 -0
- package/build/config.js.map +1 -0
- package/build/document-accessor.d.ts +79 -0
- package/build/document-accessor.d.ts.map +1 -0
- package/build/document-accessor.js +148 -0
- package/build/document-accessor.js.map +1 -0
- package/build/formatters/reproduce-markdown.d.ts +14 -0
- package/build/formatters/reproduce-markdown.d.ts.map +1 -0
- package/build/formatters/reproduce-markdown.js +182 -0
- package/build/formatters/reproduce-markdown.js.map +1 -0
- package/build/formatters/sarif-builder.d.ts +86 -0
- package/build/formatters/sarif-builder.d.ts.map +1 -0
- package/build/formatters/sarif-builder.js +276 -0
- package/build/formatters/sarif-builder.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +174 -0
- package/build/index.js.map +1 -0
- package/build/logger.d.ts +38 -0
- package/build/logger.d.ts.map +1 -0
- package/build/logger.js +105 -0
- package/build/logger.js.map +1 -0
- package/build/mock-server.d.ts +2 -0
- package/build/mock-server.d.ts.map +1 -0
- package/build/mock-server.js +290 -0
- package/build/mock-server.js.map +1 -0
- package/build/orchestrator.d.ts +149 -0
- package/build/orchestrator.d.ts.map +1 -0
- package/build/orchestrator.js +874 -0
- package/build/orchestrator.js.map +1 -0
- package/build/ruleset-loader.d.ts +79 -0
- package/build/ruleset-loader.d.ts.map +1 -0
- package/build/ruleset-loader.js +514 -0
- package/build/ruleset-loader.js.map +1 -0
- package/build/schemas.d.ts +2568 -0
- package/build/schemas.d.ts.map +1 -0
- package/build/schemas.js +674 -0
- package/build/schemas.js.map +1 -0
- package/build/server.d.ts +39 -0
- package/build/server.d.ts.map +1 -0
- package/build/server.js +834 -0
- package/build/server.js.map +1 -0
- package/build/storage/memory-storage.d.ts +190 -0
- package/build/storage/memory-storage.d.ts.map +1 -0
- package/build/storage/memory-storage.js +629 -0
- package/build/storage/memory-storage.js.map +1 -0
- package/build/storage/redis-storage.d.ts +134 -0
- package/build/storage/redis-storage.d.ts.map +1 -0
- package/build/storage/redis-storage.js +236 -0
- package/build/storage/redis-storage.js.map +1 -0
- package/build/storage/storage-adapter.d.ts +189 -0
- package/build/storage/storage-adapter.d.ts.map +1 -0
- package/build/storage/storage-adapter.js +36 -0
- package/build/storage/storage-adapter.js.map +1 -0
- package/build/types.d.ts +981 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/version.d.ts +40 -0
- package/build/utils/version.d.ts.map +1 -0
- package/build/utils/version.js +94 -0
- package/build/utils/version.js.map +1 -0
- package/build/validation.d.ts +95 -0
- package/build/validation.d.ts.map +1 -0
- package/build/validation.js +150 -0
- package/build/validation.js.map +1 -0
- package/build/worker-pool.d.ts +137 -0
- package/build/worker-pool.d.ts.map +1 -0
- package/build/worker-pool.js +549 -0
- package/build/worker-pool.js.map +1 -0
- package/build/worker.d.ts +2 -0
- package/build/worker.d.ts.map +1 -0
- package/build/worker.js +427 -0
- package/build/worker.js.map +1 -0
- package/package.json +110 -0
- package/rulesets/CHANGELOG.md +25 -0
- package/rulesets/config/rulesets.yaml +96 -0
- package/rulesets/sources/README.md +47 -0
- package/rulesets/sources/example/oas-recommended/v1.0.0/ruleset.yaml +6 -0
- package/rulesets/sources/example/oas-recommended/v2.0.0/ruleset.yaml +14 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Command
|
|
3
|
+
* Generates LLM-friendly documentation in markdown format
|
|
4
|
+
* Like a man page but optimized for AI agents
|
|
5
|
+
*/
|
|
6
|
+
export async function agentsCommand() {
|
|
7
|
+
console.log(generateAgentDocumentation());
|
|
8
|
+
}
|
|
9
|
+
function generateAgentDocumentation() {
|
|
10
|
+
return `# Linting Orchestrator — For AI Agents
|
|
11
|
+
|
|
12
|
+
## OVERVIEW
|
|
13
|
+
|
|
14
|
+
The **linting orchestrator** is an independent microservice that orchestrates quality assurance checks on API specifications using Spectral and custom rule engines.
|
|
15
|
+
|
|
16
|
+
- **Type:** HTTP API Server + CLI Tool
|
|
17
|
+
- **Purpose:** Validate and lint API specifications (OpenAPI, AsyncAPI, Arazzo) against configurable rulesets
|
|
18
|
+
- **Architecture:** Worker-pool based with document caching and dynamic scaling
|
|
19
|
+
- **Deployment:** Three modes (Embedded/Standalone/Companion)
|
|
20
|
+
- **Performance:** 100-200 documents/minute, 60% faster with cache hits
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## QUICK START FOR AGENTS
|
|
25
|
+
|
|
26
|
+
### 1. Check if the orchestrator is running
|
|
27
|
+
|
|
28
|
+
\`\`\`bash
|
|
29
|
+
curl -s http://localhost:3003/health | jq
|
|
30
|
+
\`\`\`
|
|
31
|
+
|
|
32
|
+
Expected response:
|
|
33
|
+
\`\`\`json
|
|
34
|
+
{
|
|
35
|
+
"status": "healthy",
|
|
36
|
+
"version": "0.5.0",
|
|
37
|
+
"workerPool": {"activeWorkers": 6, "maxWorkers": 15}
|
|
38
|
+
}
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
### 2. List Available Rulesets
|
|
42
|
+
|
|
43
|
+
\`\`\`bash
|
|
44
|
+
curl -s http://localhost:3003/rulesets | jq
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
### 3. Lint a Document
|
|
48
|
+
|
|
49
|
+
\`\`\`bash
|
|
50
|
+
# Submit lint job
|
|
51
|
+
curl -X POST http://localhost:3003/lint \\
|
|
52
|
+
-H "Content-Type: application/json" \\
|
|
53
|
+
-d '{
|
|
54
|
+
"documentId": "doc-uuid",
|
|
55
|
+
"rulesetName": "pubhub",
|
|
56
|
+
"rulesetVersion": "1.1.0"
|
|
57
|
+
}'
|
|
58
|
+
|
|
59
|
+
# Returns: {"jobId": "job-abc-123", "status": "queued"}
|
|
60
|
+
|
|
61
|
+
# Poll for results
|
|
62
|
+
curl -s http://localhost:3003/lint/job-abc-123
|
|
63
|
+
|
|
64
|
+
# Get results when completed
|
|
65
|
+
curl -s http://localhost:3003/lint/job-abc-123/results | jq
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## ARCHITECTURE
|
|
71
|
+
|
|
72
|
+
### Components
|
|
73
|
+
|
|
74
|
+
1. **HTTP API Server** (port 3003)
|
|
75
|
+
- Accepts lint requests, returns job IDs
|
|
76
|
+
- RESTful endpoints for job status and results
|
|
77
|
+
- Health monitoring and statistics
|
|
78
|
+
|
|
79
|
+
2. **Job Orchestrator**
|
|
80
|
+
- Manages job lifecycle and task distribution
|
|
81
|
+
- Handles retries with exponential backoff
|
|
82
|
+
- Aggregates results from workers
|
|
83
|
+
|
|
84
|
+
3. **Worker Pool Manager**
|
|
85
|
+
- Manages persistent worker threads
|
|
86
|
+
- Pre-loads rulesets (200-500ms saved per job)
|
|
87
|
+
- Document affinity caching (60% faster)
|
|
88
|
+
- Auto-scaling based on load (5-30 workers)
|
|
89
|
+
|
|
90
|
+
4. **Workers**
|
|
91
|
+
- Execute Spectral linting in isolated threads
|
|
92
|
+
- Cache last document (LRU, 50MB max per worker)
|
|
93
|
+
- Pre-loaded with specific rulesets
|
|
94
|
+
|
|
95
|
+
5. **Storage Adapter**
|
|
96
|
+
- Pluggable result storage (memory, Redis)
|
|
97
|
+
- Cache invalidation support
|
|
98
|
+
- TTL-based expiration
|
|
99
|
+
|
|
100
|
+
### Zero-Copy Architecture
|
|
101
|
+
|
|
102
|
+
Workers receive **file paths**, not document content:
|
|
103
|
+
- Minimizes memory copies between threads
|
|
104
|
+
- 50-100ms saved per large document
|
|
105
|
+
- Enables document caching at worker level
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## DEPLOYMENT MODES
|
|
110
|
+
|
|
111
|
+
| Mode | Use Case | Workers | Document Store |
|
|
112
|
+
|------|----------|---------|----------------|
|
|
113
|
+
| **Embedded** | CLI embedded | 10 | ~/.spectify/uploads/ |
|
|
114
|
+
| **Standalone** | Dedicated server | 30 | /var/spectify/uploads/ |
|
|
115
|
+
| **Companion** | MCP-managed | 15 | Shared with MCP |
|
|
116
|
+
|
|
117
|
+
### Starting the Server
|
|
118
|
+
|
|
119
|
+
\`\`\`bash
|
|
120
|
+
# Embedded mode (embedded in CLI)
|
|
121
|
+
spectify start
|
|
122
|
+
|
|
123
|
+
# Standalone mode (dedicated daemon)
|
|
124
|
+
spectifyd
|
|
125
|
+
|
|
126
|
+
# Or with custom config
|
|
127
|
+
spectifyd --port 3003 --document-store /var/spectify/uploads
|
|
128
|
+
\`\`\`
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## HTTP API REFERENCE
|
|
133
|
+
|
|
134
|
+
### POST /lint - Submit Lint Job
|
|
135
|
+
|
|
136
|
+
**Request:**
|
|
137
|
+
\`\`\`json
|
|
138
|
+
{
|
|
139
|
+
"documentId": "550e8400-e29b-41d4-a716-446655440000",
|
|
140
|
+
"rulesetName": "pubhub",
|
|
141
|
+
"rulesetVersion": "1.1.0",
|
|
142
|
+
"options": {
|
|
143
|
+
"forceRun": false,
|
|
144
|
+
"failOnError": false
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
**Response:** 202 Accepted
|
|
150
|
+
\`\`\`json
|
|
151
|
+
{
|
|
152
|
+
"jobId": "job-uuid-123",
|
|
153
|
+
"status": "queued",
|
|
154
|
+
"estimatedCompletion": "2025-12-19T10:05:30Z"
|
|
155
|
+
}
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
### GET /lint/:jobId - Get Job Status
|
|
159
|
+
|
|
160
|
+
**Response:** 200 OK
|
|
161
|
+
\`\`\`json
|
|
162
|
+
{
|
|
163
|
+
"jobId": "job-uuid-123",
|
|
164
|
+
"status": "running",
|
|
165
|
+
"progress": {
|
|
166
|
+
"totalTasks": 1,
|
|
167
|
+
"completedTasks": 0,
|
|
168
|
+
"runningTasks": 1,
|
|
169
|
+
"percentage": 0
|
|
170
|
+
},
|
|
171
|
+
"submittedAt": "2025-12-19T10:05:00Z"
|
|
172
|
+
}
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
### GET /lint/:jobId/results - Get Results
|
|
176
|
+
|
|
177
|
+
**Response:** 200 OK (when completed)
|
|
178
|
+
\`\`\`json
|
|
179
|
+
{
|
|
180
|
+
"jobId": "job-uuid-123",
|
|
181
|
+
"documentId": "doc-uuid",
|
|
182
|
+
"status": "completed",
|
|
183
|
+
"summary": {
|
|
184
|
+
"totalIssues": 15,
|
|
185
|
+
"errorCount": 5,
|
|
186
|
+
"warningCount": 8,
|
|
187
|
+
"infoCount": 2
|
|
188
|
+
},
|
|
189
|
+
"results": [
|
|
190
|
+
{
|
|
191
|
+
"code": "operation-description",
|
|
192
|
+
"message": "Operation must have a description",
|
|
193
|
+
"severity": "error",
|
|
194
|
+
"path": ["paths", "/users", "get"],
|
|
195
|
+
"range": {"start": {"line": 10, "character": 0}}
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"executionTime": 245,
|
|
199
|
+
"cacheHit": false
|
|
200
|
+
}
|
|
201
|
+
\`\`\`
|
|
202
|
+
|
|
203
|
+
### GET /rulesets - List Available Rulesets
|
|
204
|
+
|
|
205
|
+
**Response:** 200 OK
|
|
206
|
+
\`\`\`json
|
|
207
|
+
{
|
|
208
|
+
"rulesets": [
|
|
209
|
+
{
|
|
210
|
+
"name": "pubhub",
|
|
211
|
+
"displayName": "PubHub Readiness Analyzer",
|
|
212
|
+
"description": "60+ rules for DevNet publication",
|
|
213
|
+
"versions": ["1.0.0", "1.1.0"],
|
|
214
|
+
"defaultVersion": "1.1.0",
|
|
215
|
+
"tags": ["devnet", "publishing", "quality"]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
\`\`\`
|
|
220
|
+
|
|
221
|
+
### GET /rulesets/:name - Get Ruleset Details
|
|
222
|
+
|
|
223
|
+
**Response:** 200 OK
|
|
224
|
+
\`\`\`json
|
|
225
|
+
{
|
|
226
|
+
"name": "pubhub",
|
|
227
|
+
"displayName": "PubHub Readiness Analyzer",
|
|
228
|
+
"versions": ["1.0.0", "1.1.0"],
|
|
229
|
+
"defaultVersion": "1.1.0",
|
|
230
|
+
"rules": [
|
|
231
|
+
{
|
|
232
|
+
"code": "info-description",
|
|
233
|
+
"severity": "error",
|
|
234
|
+
"message": "Info object must have a description"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
### GET /health - Health Check
|
|
241
|
+
|
|
242
|
+
**Response:** 200 OK
|
|
243
|
+
\`\`\`json
|
|
244
|
+
{
|
|
245
|
+
"status": "healthy",
|
|
246
|
+
"version": "0.5.0",
|
|
247
|
+
"uptime": 3600,
|
|
248
|
+
"workerPool": {
|
|
249
|
+
"activeWorkers": 6,
|
|
250
|
+
"idleWorkers": 4,
|
|
251
|
+
"maxWorkers": 15
|
|
252
|
+
},
|
|
253
|
+
"stats": {
|
|
254
|
+
"totalJobs": 125,
|
|
255
|
+
"completedJobs": 120,
|
|
256
|
+
"failedJobs": 2,
|
|
257
|
+
"cacheHitRate": 0.45
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
\`\`\`
|
|
261
|
+
|
|
262
|
+
### GET /stats - Statistics
|
|
263
|
+
|
|
264
|
+
**Response:** 200 OK
|
|
265
|
+
\`\`\`json
|
|
266
|
+
{
|
|
267
|
+
"totalJobs": 125,
|
|
268
|
+
"activeJobs": 3,
|
|
269
|
+
"completedJobs": 120,
|
|
270
|
+
"failedJobs": 2,
|
|
271
|
+
"cacheHits": 56,
|
|
272
|
+
"cacheMisses": 69,
|
|
273
|
+
"cacheHitRate": 0.448,
|
|
274
|
+
"averageExecutionTime": 245,
|
|
275
|
+
"workerStats": {
|
|
276
|
+
"active": 6,
|
|
277
|
+
"idle": 4,
|
|
278
|
+
"busy": 3
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
\`\`\`
|
|
282
|
+
|
|
283
|
+
### DELETE /cache/:documentId - Invalidate Cache
|
|
284
|
+
|
|
285
|
+
**Response:** 204 No Content
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## CLI USAGE
|
|
290
|
+
|
|
291
|
+
### Available Commands
|
|
292
|
+
|
|
293
|
+
\`\`\`bash
|
|
294
|
+
spectify start [options] # Start server
|
|
295
|
+
spectify stop [options] # Stop server
|
|
296
|
+
spectify ps [options] # List running processes
|
|
297
|
+
spectify lint <file> [options] # Lint a document
|
|
298
|
+
spectify status <jobId> # Check job status
|
|
299
|
+
spectify results <jobId> # Get job results
|
|
300
|
+
spectify history [options] # Show lint history
|
|
301
|
+
spectify rulesets [options] # List rulesets
|
|
302
|
+
spectify health [options] # Check server health
|
|
303
|
+
spectify config [action] # Manage configuration
|
|
304
|
+
spectify completion [--shell] # Generate shell completion
|
|
305
|
+
spectify --agents # Show this documentation
|
|
306
|
+
spectify --help # Show help
|
|
307
|
+
spectify --version # Show version
|
|
308
|
+
\`\`\`
|
|
309
|
+
|
|
310
|
+
### Lint Command Examples
|
|
311
|
+
|
|
312
|
+
\`\`\`bash
|
|
313
|
+
# Basic lint
|
|
314
|
+
spectify lint openapi.yaml
|
|
315
|
+
|
|
316
|
+
# With specific ruleset
|
|
317
|
+
spectify lint api.yaml --ruleset contract --version 1.0.0
|
|
318
|
+
|
|
319
|
+
# Force bypass cache
|
|
320
|
+
spectify lint api.yaml --no-cache
|
|
321
|
+
|
|
322
|
+
# Show all issues (no limit)
|
|
323
|
+
spectify lint api.yaml --show-all
|
|
324
|
+
|
|
325
|
+
# Use custom server
|
|
326
|
+
spectify lint api.yaml --server http://server.company.com:3003
|
|
327
|
+
\`\`\`
|
|
328
|
+
|
|
329
|
+
### Configuration
|
|
330
|
+
|
|
331
|
+
\`\`\`bash
|
|
332
|
+
# Show current configuration
|
|
333
|
+
spectify config show
|
|
334
|
+
|
|
335
|
+
# Set default mode
|
|
336
|
+
spectify config set mode standalone
|
|
337
|
+
|
|
338
|
+
# Set default server URL (e.g. remote Docker host)
|
|
339
|
+
spectify config set url http://localhost:3003
|
|
340
|
+
|
|
341
|
+
# Reset to defaults
|
|
342
|
+
spectify config reset
|
|
343
|
+
\`\`\`
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## CONFIGURATION
|
|
348
|
+
|
|
349
|
+
### Default Configuration
|
|
350
|
+
|
|
351
|
+
Located at \`config/default.yaml\` or via environment variables:
|
|
352
|
+
|
|
353
|
+
\`\`\`yaml
|
|
354
|
+
server:
|
|
355
|
+
port: 3003
|
|
356
|
+
host: 0.0.0.0
|
|
357
|
+
|
|
358
|
+
workerPool:
|
|
359
|
+
minWorkersPerRuleset: 1
|
|
360
|
+
maxWorkersPerRuleset: 2
|
|
361
|
+
totalMaxWorkers: 15
|
|
362
|
+
documentCache:
|
|
363
|
+
enabled: true
|
|
364
|
+
maxDocumentsPerWorker: 1
|
|
365
|
+
ttlSeconds: 300
|
|
366
|
+
|
|
367
|
+
documentStore:
|
|
368
|
+
type: local
|
|
369
|
+
baseDir: ./uploads
|
|
370
|
+
|
|
371
|
+
storage:
|
|
372
|
+
type: memory
|
|
373
|
+
ttl: 3600
|
|
374
|
+
|
|
375
|
+
logging:
|
|
376
|
+
level: info
|
|
377
|
+
format: json
|
|
378
|
+
|
|
379
|
+
rulesets:
|
|
380
|
+
directory: ./rulesets
|
|
381
|
+
defaultVersion: latest
|
|
382
|
+
cacheEnabled: true
|
|
383
|
+
\`\`\`
|
|
384
|
+
|
|
385
|
+
### Environment Variables
|
|
386
|
+
|
|
387
|
+
\`\`\`bash
|
|
388
|
+
PORT=3003 # Server port
|
|
389
|
+
DOCUMENT_STORE_DIR=./uploads # Document storage path
|
|
390
|
+
TOTAL_MAX_WORKERS=15 # Max worker threads
|
|
391
|
+
STORAGE_TYPE=memory # Storage backend (memory|redis)
|
|
392
|
+
LOG_LEVEL=info # Logging level
|
|
393
|
+
\`\`\`
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## AVAILABLE RULESETS
|
|
398
|
+
|
|
399
|
+
### 1. PubHub (pubhub)
|
|
400
|
+
|
|
401
|
+
**Purpose:** DevNet PubHub publication readiness
|
|
402
|
+
**Rules:** 60+
|
|
403
|
+
**Versions:** 1.0.0, 1.1.0 (default)
|
|
404
|
+
|
|
405
|
+
**Categories:**
|
|
406
|
+
- Developer Experience (14 rules)
|
|
407
|
+
- Publishing Requirements (12 rules)
|
|
408
|
+
- PubHub Rendering (9 rules)
|
|
409
|
+
- API Design (25+ rules)
|
|
410
|
+
|
|
411
|
+
**Example rules:**
|
|
412
|
+
- \`info-description\`: Info must have description
|
|
413
|
+
- \`operation-description\`: Operations must have descriptions
|
|
414
|
+
- \`operation-summary\`: Operations must have summaries
|
|
415
|
+
- \`tag-description\`: Tags must have descriptions
|
|
416
|
+
|
|
417
|
+
### 2. Contract (contract)
|
|
418
|
+
|
|
419
|
+
**Purpose:** API contract validation
|
|
420
|
+
**Rules:** 62+
|
|
421
|
+
**Versions:** 1.0.0 (default)
|
|
422
|
+
|
|
423
|
+
**Categories:**
|
|
424
|
+
- Versioning
|
|
425
|
+
- Documentation
|
|
426
|
+
- Operations
|
|
427
|
+
- Schemas
|
|
428
|
+
|
|
429
|
+
### 3. API Insights (api-insights)
|
|
430
|
+
|
|
431
|
+
**Purpose:** Cisco API Insights compatibility
|
|
432
|
+
**Rules:** 50+
|
|
433
|
+
**Versions:** 2025.11.19
|
|
434
|
+
|
|
435
|
+
**Categories:**
|
|
436
|
+
- REST Guidelines
|
|
437
|
+
- Best Practices
|
|
438
|
+
- Common Mistakes
|
|
439
|
+
|
|
440
|
+
### 4. Documentation (documentation)
|
|
441
|
+
|
|
442
|
+
**Purpose:** Documentation quality
|
|
443
|
+
**Rules:** 20+
|
|
444
|
+
|
|
445
|
+
### 5. Quality (quality)
|
|
446
|
+
|
|
447
|
+
**Purpose:** General API quality
|
|
448
|
+
**Rules:** 15+
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## INTEGRATION PATTERNS
|
|
453
|
+
|
|
454
|
+
### Pattern 1: Direct HTTP API
|
|
455
|
+
|
|
456
|
+
\`\`\`typescript
|
|
457
|
+
// Submit lint job
|
|
458
|
+
const response = await fetch('http://localhost:3003/lint', {
|
|
459
|
+
method: 'POST',
|
|
460
|
+
headers: {'Content-Type': 'application/json'},
|
|
461
|
+
body: JSON.stringify({
|
|
462
|
+
documentId: 'doc-uuid',
|
|
463
|
+
rulesetName: 'pubhub'
|
|
464
|
+
})
|
|
465
|
+
});
|
|
466
|
+
const { jobId } = await response.json();
|
|
467
|
+
|
|
468
|
+
// Poll for completion
|
|
469
|
+
let status = 'running';
|
|
470
|
+
while (status === 'running' || status === 'queued') {
|
|
471
|
+
const statusRes = await fetch(\`http://localhost:3003/lint/\${jobId}\`);
|
|
472
|
+
({ status } = await statusRes.json());
|
|
473
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Get results
|
|
477
|
+
const resultsRes = await fetch(\`http://localhost:3003/lint/\${jobId}/results\`);
|
|
478
|
+
const results = await resultsRes.json();
|
|
479
|
+
\`\`\`
|
|
480
|
+
|
|
481
|
+
### Pattern 2: CLI Automation
|
|
482
|
+
|
|
483
|
+
\`\`\`bash
|
|
484
|
+
#!/bin/bash
|
|
485
|
+
# Lint all OpenAPI files in directory
|
|
486
|
+
|
|
487
|
+
for file in apis/*.yaml; do
|
|
488
|
+
echo "Linting $file..."
|
|
489
|
+
spectify lint "$file" --ruleset pubhub
|
|
490
|
+
|
|
491
|
+
if [ $? -eq 0 ]; then
|
|
492
|
+
echo "✓ $file passed"
|
|
493
|
+
else
|
|
494
|
+
echo "✗ $file failed"
|
|
495
|
+
fi
|
|
496
|
+
done
|
|
497
|
+
\`\`\`
|
|
498
|
+
|
|
499
|
+
### Pattern 3: MCP Integration
|
|
500
|
+
|
|
501
|
+
The orchestrator integrates with MCP OpenAPI Analyzer to access uploaded documents:
|
|
502
|
+
|
|
503
|
+
\`\`\`bash
|
|
504
|
+
# 1. Upload document to MCP
|
|
505
|
+
curl -X POST http://localhost:3002/upload \\
|
|
506
|
+
-H "Content-Type: application/x-yaml" \\
|
|
507
|
+
--data-binary @api.yaml
|
|
508
|
+
# Returns: {"documentId": "550e8400..."}
|
|
509
|
+
|
|
510
|
+
# 2. Lint via the orchestrator
|
|
511
|
+
curl -X POST http://localhost:3003/lint \\
|
|
512
|
+
-H "Content-Type: application/json" \\
|
|
513
|
+
-d '{"documentId": "550e8400...", "rulesetName": "pubhub"}'
|
|
514
|
+
|
|
515
|
+
# 3. Get results
|
|
516
|
+
curl http://localhost:3003/lint/<jobId>/results
|
|
517
|
+
\`\`\`
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## PERFORMANCE CHARACTERISTICS
|
|
522
|
+
|
|
523
|
+
### Execution Times
|
|
524
|
+
|
|
525
|
+
- **Ruleset loading:** 200-500ms (once per worker)
|
|
526
|
+
- **Document parsing:** 10-50ms (small), 100-200ms (large)
|
|
527
|
+
- **Rule execution:** 50-300ms (depends on ruleset size)
|
|
528
|
+
- **Cache lookup:** 5-10ms
|
|
529
|
+
- **Cache hit speedup:** 60% faster
|
|
530
|
+
|
|
531
|
+
### Throughput
|
|
532
|
+
|
|
533
|
+
- **Without cache:** 100-150 docs/minute (15 workers)
|
|
534
|
+
- **With cache:** 150-200 docs/minute (45% hit rate)
|
|
535
|
+
- **Single document:** 1-3 seconds (cold start), 0.5-1s (cached)
|
|
536
|
+
|
|
537
|
+
### Resource Usage
|
|
538
|
+
|
|
539
|
+
- **Memory:** 200-500MB base + 50MB per worker
|
|
540
|
+
- **CPU:** Scales with core count (1-2 workers per core)
|
|
541
|
+
- **Disk:** Minimal (results cached in memory by default)
|
|
542
|
+
|
|
543
|
+
### Scaling Limits
|
|
544
|
+
|
|
545
|
+
- **Max workers:** 30 (recommended), configurable to CPU cores
|
|
546
|
+
- **Max concurrent jobs:** 100+
|
|
547
|
+
- **Document size:** Up to 50MB (configurable)
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## ERROR HANDLING
|
|
552
|
+
|
|
553
|
+
### Common HTTP Status Codes
|
|
554
|
+
|
|
555
|
+
- **200 OK:** Request successful
|
|
556
|
+
- **202 Accepted:** Job submitted, check status
|
|
557
|
+
- **400 Bad Request:** Invalid request (missing documentId, etc.)
|
|
558
|
+
- **404 Not Found:** Job, document, or ruleset not found
|
|
559
|
+
- **409 Conflict:** Cached result already exists (use forceRun=true)
|
|
560
|
+
- **500 Internal Server Error:** Server error, check logs
|
|
561
|
+
- **503 Service Unavailable:** Server overloaded or starting up
|
|
562
|
+
|
|
563
|
+
### Job Statuses
|
|
564
|
+
|
|
565
|
+
- **queued:** Job submitted, waiting for worker
|
|
566
|
+
- **running:** Currently executing
|
|
567
|
+
- **completed:** Finished successfully
|
|
568
|
+
- **failed:** Execution failed (check error details)
|
|
569
|
+
|
|
570
|
+
### Retry Strategy
|
|
571
|
+
|
|
572
|
+
The orchestrator automatically retries failed tasks:
|
|
573
|
+
- **Max retries:** 2 (configurable)
|
|
574
|
+
- **Backoff:** Exponential (100ms, 200ms, 400ms)
|
|
575
|
+
- **Retry conditions:** Worker crashes, timeout, transient errors
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
## TROUBLESHOOTING FOR AGENTS
|
|
580
|
+
|
|
581
|
+
### Problem: Server not responding
|
|
582
|
+
|
|
583
|
+
\`\`\`bash
|
|
584
|
+
# Check if server is running
|
|
585
|
+
curl -s http://localhost:3003/health
|
|
586
|
+
|
|
587
|
+
# If not, start it
|
|
588
|
+
spectify start
|
|
589
|
+
# or
|
|
590
|
+
spectifyd
|
|
591
|
+
\`\`\`
|
|
592
|
+
|
|
593
|
+
### Problem: Job stuck in "queued" status
|
|
594
|
+
|
|
595
|
+
**Cause:** Worker pool not initialized or overloaded
|
|
596
|
+
|
|
597
|
+
**Solution:**
|
|
598
|
+
\`\`\`bash
|
|
599
|
+
# Check worker status
|
|
600
|
+
curl -s http://localhost:3003/stats | jq '.workerStats'
|
|
601
|
+
|
|
602
|
+
# Restart server if needed
|
|
603
|
+
spectify stop && spectify start
|
|
604
|
+
\`\`\`
|
|
605
|
+
|
|
606
|
+
### Problem: "Document not found" error
|
|
607
|
+
|
|
608
|
+
**Cause:** Document not uploaded or expired
|
|
609
|
+
|
|
610
|
+
**Solution:**
|
|
611
|
+
1. Verify document exists: \`curl http://localhost:3002/documents/<docId>\`
|
|
612
|
+
2. Re-upload document if needed
|
|
613
|
+
3. Check document store path configuration
|
|
614
|
+
|
|
615
|
+
### Problem: Cache stale after document update
|
|
616
|
+
|
|
617
|
+
**Solution:**
|
|
618
|
+
\`\`\`bash
|
|
619
|
+
# Invalidate cache for specific document
|
|
620
|
+
curl -X DELETE http://localhost:3003/cache/<documentId>
|
|
621
|
+
|
|
622
|
+
# Or force bypass cache
|
|
623
|
+
curl -X POST http://localhost:3003/lint \\
|
|
624
|
+
-d '{"documentId": "...", "rulesetName": "pubhub", "options": {"forceRun": true}}'
|
|
625
|
+
\`\`\`
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## AGENT RECOMMENDATIONS
|
|
630
|
+
|
|
631
|
+
### When to use the linting orchestrator
|
|
632
|
+
|
|
633
|
+
✅ **Good for:**
|
|
634
|
+
- Automated API quality checks in CI/CD
|
|
635
|
+
- Batch validation of multiple documents
|
|
636
|
+
- Pre-publication readiness checks
|
|
637
|
+
- Integration with custom workflows
|
|
638
|
+
- High-performance linting (100+ docs/min)
|
|
639
|
+
|
|
640
|
+
❌ **Not ideal for:**
|
|
641
|
+
- Interactive web-based linting (use API Insights)
|
|
642
|
+
- Visual diff and changelog generation
|
|
643
|
+
- Team collaboration with dashboards
|
|
644
|
+
- Long-term version history tracking
|
|
645
|
+
|
|
646
|
+
### Integration Best Practices
|
|
647
|
+
|
|
648
|
+
1. **Always check health** before submitting jobs
|
|
649
|
+
2. **Poll with exponential backoff** (1s, 2s, 4s, max 30s)
|
|
650
|
+
3. **Handle all HTTP status codes** gracefully
|
|
651
|
+
4. **Cache ruleset info** (changes infrequently)
|
|
652
|
+
5. **Use forceRun=true** when document updated
|
|
653
|
+
6. **Invalidate cache** after document modifications
|
|
654
|
+
7. **Set reasonable timeouts** (30s for status, 5min for results)
|
|
655
|
+
|
|
656
|
+
### Example Agent Workflow
|
|
657
|
+
|
|
658
|
+
\`\`\`
|
|
659
|
+
1. User provides OpenAPI file
|
|
660
|
+
2. Check if the orchestrator is running (GET /health)
|
|
661
|
+
3. If not running, suggest: "spectify start"
|
|
662
|
+
4. Submit lint job (POST /lint)
|
|
663
|
+
5. Poll status every 2-3 seconds (GET /lint/:jobId)
|
|
664
|
+
6. When completed, fetch results (GET /lint/:jobId/results)
|
|
665
|
+
7. Parse and present issues to user
|
|
666
|
+
8. Offer to fix issues or explain errors
|
|
667
|
+
\`\`\`
|
|
668
|
+
|
|
669
|
+
---
|
|
670
|
+
|
|
671
|
+
## ADDITIONAL RESOURCES
|
|
672
|
+
|
|
673
|
+
- **Repository:** https://github.com/cisco-open/linting-orchestrator
|
|
674
|
+
- **API Documentation:** docs/quick-start-api.md
|
|
675
|
+
- **CLI Documentation:** docs/quick-start-cli.md
|
|
676
|
+
- **Architecture:** docs/internal/design/lint-orchestrator-design.md
|
|
677
|
+
- **Integration Guide:** docs/internal/integrations/spectify-mcp.md
|
|
678
|
+
- **Installation:** docs/installation.md
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## VERSION
|
|
683
|
+
|
|
684
|
+
**Linting Orchestrator v0.5.0**
|
|
685
|
+
- API Version: 0.5.0
|
|
686
|
+
- CLI Version: 0.5.0
|
|
687
|
+
- Updated: December 19, 2025
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
*This documentation is generated for AI agents and LLMs. For human-readable documentation, see the main README.md or docs/ directory.*
|
|
692
|
+
`;
|
|
693
|
+
}
|
|
694
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/cli/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,0BAA0B;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0qBR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell Completion Command
|
|
3
|
+
* Generates bash completion script
|
|
4
|
+
*/
|
|
5
|
+
export interface CompletionOptions {
|
|
6
|
+
shell?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function completionCommand(options: CompletionOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/completion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjF"}
|