@boolesai/tspec-cli 1.2.0 → 1.3.1

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
@@ -17,6 +17,120 @@ Or run directly with npx:
17
17
  npx @boolesai/tspec-cli <command>
18
18
  ```
19
19
 
20
+ ## Plugin Installation
21
+
22
+ TSpec uses a plugin architecture to support different protocols. Plugins can be installed automatically or manually.
23
+
24
+ ### Installing Plugins via CLI
25
+
26
+ The easiest way to install plugins is using the `plugin:install` command:
27
+
28
+ ```bash
29
+ # Install HTTP/HTTPS protocol plugin
30
+ tspec plugin:install @tspec/http
31
+
32
+ # Install Web browser UI testing plugin
33
+ tspec plugin:install @tspec/web
34
+
35
+ # Install and add to global config
36
+ tspec plugin:install @tspec/http --global
37
+ ```
38
+
39
+ ### Manual Installation
40
+
41
+ You can also install plugins manually as npm packages:
42
+
43
+ ```bash
44
+ # Install HTTP/HTTPS protocol plugin
45
+ npm install -D @tspec/http
46
+
47
+ # Install Web browser UI testing plugin
48
+ npm install -D @tspec/web
49
+
50
+ # Install multiple plugins at once
51
+ npm install -D @tspec/http @tspec/web
52
+ ```
53
+
54
+ ### Plugin Configuration
55
+
56
+ TSpec uses JSON configuration files. Create a `tspec.config.json` file in your project root:
57
+
58
+ ```json
59
+ {
60
+ "plugins": [
61
+ "@tspec/http",
62
+ "@tspec/web"
63
+ ],
64
+ "pluginOptions": {
65
+ "@tspec/http": {
66
+ "timeout": 30000,
67
+ "followRedirects": true,
68
+ "maxRedirects": 5
69
+ },
70
+ "@tspec/web": {
71
+ "headless": true,
72
+ "timeout": 30000,
73
+ "slowMo": 0
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ #### Configuration Locations
80
+
81
+ TSpec supports dual configuration with local taking precedence:
82
+
83
+ | Location | Path | Priority |
84
+ |----------|------|----------|
85
+ | Local | `./tspec.config.json` (searched upward) | Higher |
86
+ | Global | `~/.tspec/tspec.config.json` | Lower |
87
+
88
+ When both configs exist, they are merged with local values overriding global ones.
89
+
90
+ #### Auto-Installation
91
+
92
+ When running `tspec run`, missing plugins in your config are automatically installed to `~/.tspec/plugins/`. Use `--no-auto-install` to disable this behavior.
93
+
94
+ ### Available Official Plugins
95
+
96
+ | Plugin | Protocol | Description | Package |
97
+ |--------|----------|-------------|----------|
98
+ | HTTP/HTTPS | `http`, `https` | REST API testing with axios | `@tspec/http` |
99
+ | Web UI | `web` | Browser testing with Puppeteer | `@tspec/web` |
100
+
101
+ ### Using Plugins
102
+
103
+ Once installed and configured, plugins are automatically loaded when running tests:
104
+
105
+ ```bash
106
+ # Run HTTP tests
107
+ tspec run tests/**/*.http.tcase
108
+
109
+ # Run Web UI tests
110
+ tspec run tests/**/*.web.tcase
111
+
112
+ # List loaded plugins and supported protocols
113
+ tspec list
114
+ ```
115
+
116
+ ### Custom Plugins
117
+
118
+ You can also install custom third-party plugins or create your own:
119
+
120
+ ```bash
121
+ # Install custom plugin from npm
122
+ tspec plugin:install my-custom-tspec-plugin
123
+
124
+ # Or use a local plugin path in tspec.config.json:
125
+ {
126
+ "plugins": [
127
+ "./plugins/my-custom-protocol"
128
+ ]
129
+ }
130
+ ```
131
+
132
+ For plugin development details, see the [Plugin Development Guide](../plugins/DEVELOPMENT.md).
133
+
20
134
  ## Commands
21
135
 
22
136
  ### `tspec validate`
@@ -59,6 +173,8 @@ tspec run <files...> [options]
59
173
  - `-v, --verbose` - Verbose output
60
174
  - `-q, --quiet` - Only output summary
61
175
  - `--fail-fast` - Stop on first failure
176
+ - `--config <path>` - Path to tspec.config.json
177
+ - `--no-auto-install` - Skip automatic plugin installation
62
178
 
63
179
  **Examples:**
64
180
  ```bash
@@ -131,6 +247,62 @@ tspec list
131
247
  tspec list --output json
132
248
  ```
133
249
 
250
+ ### `tspec plugin:install`
251
+
252
+ Install a TSpec plugin and add it to configuration.
253
+
254
+ ```bash
255
+ tspec plugin:install <plugin> [options]
256
+ ```
257
+
258
+ **Options:**
259
+ - `-o, --output <format>` - Output format: `json`, `text` (default: `text`)
260
+ - `-g, --global` - Add plugin to global config (`~/.tspec/tspec.config.json`)
261
+ - `-c, --config <path>` - Path to specific config file to update
262
+
263
+ **Examples:**
264
+ ```bash
265
+ # Install plugin (adds to local config if exists, otherwise global)
266
+ tspec plugin:install @tspec/http
267
+
268
+ # Install and add to global config
269
+ tspec plugin:install @tspec/web --global
270
+
271
+ # Install and add to specific config file
272
+ tspec plugin:install @tspec/http --config ./tspec.config.json
273
+ ```
274
+
275
+ ### `tspec plugin:list`
276
+
277
+ List all installed TSpec plugins and configuration sources.
278
+
279
+ ```bash
280
+ tspec plugin:list [options]
281
+ ```
282
+
283
+ **Alias:** `tspec plugins`
284
+
285
+ **Options:**
286
+ - `-o, --output <format>` - Output format: `json`, `text` (default: `text`)
287
+ - `-v, --verbose` - Show detailed plugin information
288
+ - `--health` - Run health checks on all plugins
289
+ - `-c, --config <path>` - Path to tspec.config.json
290
+
291
+ **Examples:**
292
+ ```bash
293
+ # List installed plugins
294
+ tspec plugin:list
295
+
296
+ # Show detailed information
297
+ tspec plugin:list --verbose
298
+
299
+ # Check plugin health status
300
+ tspec plugin:list --health
301
+
302
+ # JSON output
303
+ tspec plugin:list --output json
304
+ ```
305
+
134
306
  ### `tspec mcp`
135
307
 
136
308
  Start MCP (Model Context Protocol) server for AI tool integration.
@@ -143,7 +315,15 @@ This starts an MCP server over stdio that exposes TSpec commands as tools for AI
143
315
 
144
316
  ## MCP Integration
145
317
 
146
- TSpec CLI can run as an MCP server, exposing all commands as tools for AI assistants.
318
+ TSpec CLI can run as an MCP (Model Context Protocol) server, exposing all commands as tools for AI assistants. This enables AI assistants like Claude to execute TSpec commands directly through the MCP protocol.
319
+
320
+ ### Overview
321
+
322
+ The MCP server runs over stdio, providing a standardized interface for AI tools to:
323
+ - Execute test cases with customizable parameters
324
+ - Validate test case files for schema correctness
325
+ - Parse test specifications without execution
326
+ - Query supported protocols and configurations
147
327
 
148
328
  ### Available Tools
149
329
 
@@ -154,12 +334,17 @@ TSpec CLI can run as an MCP server, exposing all commands as tools for AI assist
154
334
  | `tspec_parse` | Parse and display test case information |
155
335
  | `tspec_list` | List supported protocols |
156
336
 
157
- ### Claude Desktop Configuration
337
+ ### Configuration
338
+
339
+ #### Claude Desktop
158
340
 
159
341
  Add the following to your Claude Desktop configuration file:
160
342
 
161
343
  **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
162
344
  **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
345
+ **Linux:** `~/.config/Claude/claude_desktop_config.json`
346
+
347
+ **Option 1: Using npx (recommended for always getting the latest version):**
163
348
 
164
349
  ```json
165
350
  {
@@ -172,7 +357,7 @@ Add the following to your Claude Desktop configuration file:
172
357
  }
173
358
  ```
174
359
 
175
- Or if installed globally:
360
+ **Option 2: Using global installation:**
176
361
 
177
362
  ```json
178
363
  {
@@ -185,15 +370,56 @@ Or if installed globally:
185
370
  }
186
371
  ```
187
372
 
373
+ **Option 3: Using absolute path (for development or specific versions):**
374
+
375
+ ```json
376
+ {
377
+ "mcpServers": {
378
+ "tspec": {
379
+ "command": "/path/to/tspec/cli/bin/tspec.js",
380
+ "args": ["mcp"]
381
+ }
382
+ }
383
+ }
384
+ ```
385
+
386
+ #### Other MCP Clients
387
+
388
+ For other MCP-compatible clients, start the server with:
389
+
390
+ ```bash
391
+ tspec mcp
392
+ ```
393
+
394
+ The server will communicate via stdio, waiting for JSON-RPC 2.0 formatted requests.
395
+
396
+ ### Server Behavior
397
+
398
+ - **Transport:** stdio (reads from stdin, writes to stdout)
399
+ - **Protocol:** JSON-RPC 2.0 over MCP
400
+ - **Lifecycle:** Runs indefinitely until explicitly terminated (Ctrl+C or SIGTERM)
401
+ - **Logging:** Error logs are written to stderr to avoid polluting stdio transport
402
+
188
403
  ### Tool Parameters
189
404
 
190
405
  #### tspec_run
191
406
 
407
+ Execute test cases with optional configuration.
408
+
409
+ **Parameters:**
410
+ - `files` (required): Array of file paths or glob patterns
411
+ - `concurrency` (optional): Maximum concurrent test execution (default: 5)
412
+ - `env` (optional): Environment variables as key-value object
413
+ - `params` (optional): Test parameters as key-value object
414
+ - `failFast` (optional): Stop on first failure (default: false)
415
+ - `output` (optional): Output format - "json" or "text" (default: "text")
416
+
417
+ **Example:**
192
418
  ```json
193
419
  {
194
420
  "files": ["tests/*.tcase"],
195
421
  "concurrency": 5,
196
- "env": { "API_HOST": "localhost" },
422
+ "env": { "API_HOST": "localhost", "API_PORT": "8080" },
197
423
  "params": { "timeout": "5000" },
198
424
  "failFast": false,
199
425
  "output": "text"
@@ -202,6 +428,13 @@ Or if installed globally:
202
428
 
203
429
  #### tspec_validate
204
430
 
431
+ Validate test case files for schema correctness.
432
+
433
+ **Parameters:**
434
+ - `files` (required): Array of file paths or glob patterns
435
+ - `output` (optional): Output format - "json" or "text" (default: "text")
436
+
437
+ **Example:**
205
438
  ```json
206
439
  {
207
440
  "files": ["tests/*.tcase"],
@@ -211,6 +444,16 @@ Or if installed globally:
211
444
 
212
445
  #### tspec_parse
213
446
 
447
+ Parse test case files without execution.
448
+
449
+ **Parameters:**
450
+ - `files` (required): Array of file paths or glob patterns
451
+ - `env` (optional): Environment variables for variable substitution
452
+ - `params` (optional): Parameters for variable substitution
453
+ - `verbose` (optional): Show detailed information (default: false)
454
+ - `output` (optional): Output format - "json" or "text" (default: "text")
455
+
456
+ **Example:**
214
457
  ```json
215
458
  {
216
459
  "files": ["tests/*.tcase"],
@@ -223,12 +466,35 @@ Or if installed globally:
223
466
 
224
467
  #### tspec_list
225
468
 
469
+ List supported protocols and configuration.
470
+
471
+ **Parameters:**
472
+ - `output` (optional): Output format - "json" or "text" (default: "text")
473
+
474
+ **Example:**
226
475
  ```json
227
476
  {
228
477
  "output": "text"
229
478
  }
230
479
  ```
231
480
 
481
+ ### Troubleshooting
482
+
483
+ **Server doesn't appear in Claude Desktop:**
484
+ - Verify the configuration file path is correct for your OS
485
+ - Check JSON syntax is valid (use a JSON validator)
486
+ - Restart Claude Desktop after configuration changes
487
+ - Check Claude Desktop logs for connection errors
488
+
489
+ **Server hangs or doesn't respond:**
490
+ - Ensure Node.js >= 18.0.0 is installed
491
+ - Verify `@boolesai/tspec-cli` is accessible (try running `tspec --version`)
492
+ - Check stderr output for error messages
493
+
494
+ **Permission errors:**
495
+ - Ensure the tspec executable has proper permissions
496
+ - For global installation, verify npm global bin directory is in PATH
497
+
232
498
  ## Exit Codes
233
499
 
234
500
  | Code | Description |