caplets 0.10.0 → 0.11.0

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
@@ -28,8 +28,8 @@ exposed two ways: direct flat MCP aggregation versus Caplets progressive disclos
28
28
  | Initial Agent Surface | Direct Flat MCP | Caplets | Reduction |
29
29
  | ------------------------- | ----------------: | -----------: | ------------: |
30
30
  | Visible tools | 106 | 3 | 97.2% fewer |
31
- | Serialized MCP payload | 32,090 bytes | 8,358 bytes | 74.0% smaller |
32
- | Approx. context surface | 8,023 tokens | 2,090 tokens | 5,933 fewer |
31
+ | Serialized MCP payload | 32,090 bytes | 8,400 bytes | 73.8% smaller |
32
+ | Approx. context surface | 8,023 tokens | 2,100 tokens | 5,923 fewer |
33
33
  | Top-level name collisions | 3 duplicate names | 0 | eliminated |
34
34
 
35
35
  The important part: Caplets does not remove access to the downstream tools. It hides
@@ -74,8 +74,8 @@ the agent chooses that server and asks to search, list, inspect, or call them.
74
74
 
75
75
  ## What It Does
76
76
 
77
- - Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions, and explicit HTTP API action definitions from the user config file.
78
- - Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, GraphQL endpoint, or HTTP API.
77
+ - Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions, explicit HTTP API action definitions, and curated CLI tool definitions from the user config file.
78
+ - Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, GraphQL endpoint, HTTP API, or CLI tools backend.
79
79
  - Uses the configured server ID as the generated tool name.
80
80
  - Uses the configured `name` and `description` as the capability card shown to agents.
81
81
  - Starts downstream MCP servers and loads OpenAPI specs lazily when an operation needs them.
@@ -84,6 +84,7 @@ the agent chooses that server and asks to search, list, inspect, or call them.
84
84
  - Converts OpenAPI operations into MCP-style tool metadata and executes HTTP calls directly.
85
85
  - Converts configured GraphQL operations into MCP-style tool metadata, and can auto-generate GraphQL tools from schema root query and mutation fields.
86
86
  - Converts explicitly configured HTTP actions into MCP-style tool metadata and executes HTTP calls directly.
87
+ - Converts explicitly configured CLI actions into MCP-style tool metadata and executes commands directly without a shell.
87
88
  - Preserves downstream tool results instead of rewriting them into a custom format.
88
89
  - Redacts secrets from structured errors.
89
90
  - Supports static remote auth and OAuth token storage for remote servers.
@@ -218,7 +219,7 @@ the committed schema stays in sync with the Zod config validator.
218
219
 
219
220
  For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
220
221
  file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`,
221
- `graphqlEndpoint`, or `httpApi`;
222
+ `graphqlEndpoint`, `httpApi`, or `cliTools`;
222
223
  serverless Caplets are intentionally out of scope.
223
224
 
224
225
  Top-level files derive the Caplet ID from the filename:
@@ -301,6 +302,26 @@ httpApi:
301
302
  # Status API
302
303
  ```
303
304
 
305
+ CLI-backed Caplet files use `cliTools`:
306
+
307
+ ```md
308
+ ---
309
+ name: Repository CLI
310
+ description: Run curated repository workflows through local CLI commands.
311
+ cliTools:
312
+ cwd: /home/you/project
313
+ actions:
314
+ git_status:
315
+ description: Show concise Git working tree status.
316
+ command: git
317
+ args: ["status", "--short"]
318
+ annotations:
319
+ readOnlyHint: true
320
+ ---
321
+
322
+ # Repository CLI
323
+ ```
324
+
304
325
  Top-level files derive their Caplet ID from the filename. Directory-style Caplets use
305
326
  `linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
306
327
  normal Markdown links from `CAPLET.md`.
@@ -310,6 +331,8 @@ This repository includes polished working examples under [`caplets/`](caplets/):
310
331
  - `github`: GitHub's official MCP server container, using `GITHUB_PERSONAL_ACCESS_TOKEN`.
311
332
  - `linear`: Linear's hosted OAuth MCP endpoint.
312
333
  - `context7`: Context7 documentation lookup through `@upstash/context7-mcp`.
334
+ - `repo-cli`: Read-oriented repository CLI workflows through `git` and package scripts.
335
+ - `github-cli`: Read-oriented GitHub workflows through the `gh` CLI.
313
336
 
314
337
  Install every example from a repo's `caplets/` directory:
315
338
 
@@ -350,7 +373,7 @@ caplets init --force
350
373
 
351
374
  ### Caplet IDs
352
375
 
353
- Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, or `httpApis` is the
376
+ Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, `httpApis`, or `cliTools` is the
354
377
  stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it short and specific:
355
378
 
356
379
  ```json
@@ -367,7 +390,7 @@ stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it sho
367
390
  ```
368
391
 
369
392
  Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
370
- `openapiEndpoints`, `graphqlEndpoints`, and `httpApis`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
393
+ `openapiEndpoints`, `graphqlEndpoints`, `httpApis`, and `cliTools`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
371
394
 
372
395
  ### Stdio Servers
373
396
 
@@ -537,6 +560,49 @@ parsed `body` when present, and `elapsedMs`; non-2xx responses set `isError`, re
537
560
  timeouts are enforced, response bodies are capped by `maxResponseBytes` (default `1000000`), and
538
561
  errors redact secrets.
539
562
 
563
+ ### CLI Tools
564
+
565
+ Use `cliTools` for curated local command-line workflows. Each action is an explicitly configured
566
+ tool; Caplets does not expose arbitrary shell access and always spawns `command` plus `args`
567
+ without shell interpolation.
568
+
569
+ ```json
570
+ {
571
+ "name": "Repository CLI",
572
+ "description": "Run curated repository workflows through local CLI commands.",
573
+ "cwd": "/home/you/project",
574
+ "timeoutMs": 60000,
575
+ "maxOutputBytes": 1000000,
576
+ "actions": {
577
+ "git_status": {
578
+ "description": "Show concise Git working tree status.",
579
+ "command": "git",
580
+ "args": ["status", "--short"],
581
+ "annotations": { "readOnlyHint": true }
582
+ },
583
+ "run_tests": {
584
+ "description": "Run the package test script.",
585
+ "command": "pnpm",
586
+ "args": ["run", "test"],
587
+ "timeoutMs": 120000,
588
+ "annotations": { "readOnlyHint": true }
589
+ }
590
+ }
591
+ }
592
+ ```
593
+
594
+ CLI actions can set `inputSchema`, `outputSchema`, `env`, action-level `cwd`, `timeoutMs`,
595
+ `maxOutputBytes`, `output: {"type":"json"}`, and MCP annotations. `$input.field` references are
596
+ supported inside `args`, `env`, and `cwd` strings. Caplets performs basic required-field and
597
+ primitive-type validation before spawning. Results are returned as structured content with
598
+ `exitCode`, `stdout`, `stderr`, and `elapsedMs`; non-zero exits set `isError`.
599
+
600
+ Generate a reviewable CLI Caplet manifest from a repository:
601
+
602
+ ```sh
603
+ caplets author cli repo-tools --repo . --include git,gh,package --output -
604
+ ```
605
+
540
606
  ### Authentication
541
607
 
542
608
  Remote servers can use:
@@ -0,0 +1,41 @@
1
+ ---
2
+ $schema: https://raw.githubusercontent.com/spiritledsoftware/caplets/main/schemas/caplet.schema.json
3
+ name: GitHub CLI
4
+ description: Inspect GitHub pull requests and issues through curated gh CLI commands.
5
+ tags:
6
+ - cli
7
+ - github
8
+ - code
9
+ cliTools:
10
+ actions:
11
+ gh_pr_status:
12
+ description: Show pull request status for the current branch as JSON.
13
+ command: gh
14
+ args:
15
+ - pr
16
+ - status
17
+ - --json
18
+ - currentBranch
19
+ output:
20
+ type: json
21
+ annotations:
22
+ readOnlyHint: true
23
+ openWorldHint: true
24
+ gh_issue_list:
25
+ description: List open GitHub issues as JSON.
26
+ command: gh
27
+ args:
28
+ - issue
29
+ - list
30
+ - --json
31
+ - number,title,state,url
32
+ output:
33
+ type: json
34
+ annotations:
35
+ readOnlyHint: true
36
+ openWorldHint: true
37
+ ---
38
+
39
+ # GitHub CLI
40
+
41
+ Use this Caplet to expose read-oriented GitHub workflows through `gh` without giving the agent an unrestricted shell.
@@ -0,0 +1,37 @@
1
+ ---
2
+ $schema: https://raw.githubusercontent.com/spiritledsoftware/caplets/main/schemas/caplet.schema.json
3
+ name: Repository CLI
4
+ description: Inspect and run common local repository workflows through curated CLI tools.
5
+ tags:
6
+ - cli
7
+ - code
8
+ cliTools:
9
+ actions:
10
+ git_status:
11
+ description: Show concise Git working tree status.
12
+ command: git
13
+ args:
14
+ - status
15
+ - --short
16
+ annotations:
17
+ readOnlyHint: true
18
+ git_current_branch:
19
+ description: Print the current Git branch name.
20
+ command: git
21
+ args:
22
+ - branch
23
+ - --show-current
24
+ annotations:
25
+ readOnlyHint: true
26
+ package_test:
27
+ description: Run the repository test script with pnpm.
28
+ command: pnpm
29
+ args:
30
+ - run
31
+ - test
32
+ timeoutMs: 120000
33
+ ---
34
+
35
+ # Repository CLI
36
+
37
+ Use this Caplet to expose a small, typed set of local repository commands without giving an agent arbitrary shell access.