@specset/cli 0.3.1 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specset/cli",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "Command-line interface for Specset — authenticate, run GraphQL queries, and chat with Specset project agents.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://specset.com",
@@ -17,6 +17,7 @@ This is the core skill — setup and mechanics only. Domain workflows live in si
17
17
  | Skill | Use for |
18
18
  |---|---|
19
19
  | `specset-search` | Finding anything across specs, drawings, submittals, RFIs, documents, and closeout records |
20
+ | `specset-tools` | Calling Specset's own retrieval tools directly (`specset tools`, `specset mcp`) — deeper than search, lighter than the in-app agent |
20
21
  | `specset-projects` | Creating projects, uploading spec/drawing PDFs, publishing spec and drawing sets |
21
22
  | `specset-submittals` | Submittal lifecycle, attachments, approvers, and AI compliance reviews |
22
23
  | `specset-rfis` | RFI logging, tracking, and responses |
@@ -123,6 +124,20 @@ specset api --query '{ __type(name: "CreateSubmittalInput") { inputFields { name
123
124
 
124
125
  The domain skills document the operations that matter for each workflow, but they are not exhaustive — when an operation or argument doesn't match, introspect rather than guess.
125
126
 
127
+ ## Agent Tools and MCP
128
+
129
+ Beyond raw GraphQL, the CLI exposes Specset's own retrieval tools — semantic and keyword search over specs, drawings, submittals, RFIs, documents (plus closeout and schedule where enabled) — for an AI agent to call directly. Reach for these when you want the actual content to reason over, not just record previews.
130
+
131
+ - **As commands:** `specset tools list` to see what's available, then `specset tools run <name> --input '{...}'` (or `-F key=value`).
132
+ - **As a native MCP server:** `specset mcp` runs a stdio MCP server that surfaces these tools to an MCP client, reusing your CLI login, org, and host. Register it once:
133
+
134
+ ```bash
135
+ claude mcp add specset -- specset mcp # Claude Code
136
+ codex mcp add specset -- specset mcp # Codex
137
+ ```
138
+
139
+ See the `specset-tools` skill for the full workflow — project scoping, the `-F` JSON-parsing difference, and the `sb://` citation convention.
140
+
126
141
  ## Uploading Files
127
142
 
128
143
  Several workflows attach an uploaded file — submittal PDFs, RFI attachments, project documents, org logos. Files are uploaded directly to storage via a presigned URL, so attaching one is a three-step flow that needs `bash`, `curl`, and `jq`. The result is a **file id** you pass to whatever mutation consumes it.
@@ -18,6 +18,8 @@ Remember Variable Limitations from the `specset` skill: `-F` sends **strings onl
18
18
  - **`quickSearch`** — fast flat matching against titles and identifiers; use when the user roughly knows the record's name or number.
19
19
  - **Precise lookups** — when the user already has a spec section number or drawing sheet number, skip search and fetch directly.
20
20
 
21
+ > Need the actual content, not just previews and IDs? The `specset-tools` skill exposes Specset's own retrieval tools (`specset tools run searchSpecSections`, `searchDrawingSheets`, `searchDocuments`, …), which return expanded, citation-anchored markdown. Use `search`/`quickSearch` here to locate records cheaply; reach for `specset-tools` when you need to read and reason over the content.
22
+
21
23
  ## Unified Search: `search`
22
24
 
23
25
  ```graphql
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: specset-tools
3
+ description: Use when an agent should call Specset's own retrieval tools directly — semantic/keyword search and structured reads over specs, drawings, submittals, RFIs, documents, closeout, and schedule — via `specset tools` or a `specset mcp` server. Deeper than raw GraphQL search; lighter than delegating to the in-app agent.
4
+ allowed-tools: Bash Read AskUserQuestion
5
+ ---
6
+
7
+ # Specset Agent Tools (`specset tools`, `specset mcp`)
8
+
9
+ Requires the `specset` CLI, logged in with an active org. If a command fails with `command not found`, `Not logged in`, or `No active organization`, follow First-Run Setup in the `specset` skill.
10
+
11
+ These are the same read-only retrieval tools Specset's own in-app agent uses — exposed so external agents can call them directly. Everything here is read-only; nothing needs user confirmation.
12
+
13
+ ## When to use which surface
14
+
15
+ There are three tiers of Specset retrieval. Pick the lightest one that answers the question:
16
+
17
+ 1. **Typed GraphQL search** (`specset-search` skill: `search`, `quickSearch`, `specSectionByNumber`, …) — cheapest, returns previews and IDs. Best for "does X exist / find the record."
18
+ 2. **Agent tools** (this skill) — the middle tier. `searchSpecSections` / `searchDrawingSheets` / `searchDocuments` return expanded, citation-anchored markdown (the real retrieval), and the `get*Content` tools read full sections. Best when you need the actual content to reason over.
19
+ 3. **In-app agent** (`specset-agent` skill: `specset agent chat`) — heaviest. Delegates the whole question to Specset's agent, which reasons and synthesizes. Best when the answer needs cross-document judgment, not just retrieval.
20
+
21
+ ## Listing tools
22
+
23
+ ```bash
24
+ specset tools list
25
+ specset tools list --project <projectId|sb://project/...>
26
+ specset tools list --json # full input schemas
27
+ ```
28
+
29
+ The listing includes usage guidance and marks project-scoped tools. The exact set depends on the org (closeout and schedule tools require their SKUs) and on whether a project is in scope.
30
+
31
+ ## Running a tool
32
+
33
+ Provide input as a JSON object (`--input`) or as repeated `-F key=value` fields. **Unlike `specset api -F` (strings only), `specset tools run -F` JSON-parses each value**, so numbers, booleans, and lists work:
34
+
35
+ ```bash
36
+ # JSON input
37
+ specset tools run searchSpecSections \
38
+ --project <projectId> \
39
+ --input '{"query": "concrete curing requirements"}'
40
+
41
+ # Field form (values are JSON-parsed, string fallback)
42
+ specset tools run searchSpecSections --project <projectId> \
43
+ -F query="fire rating" -F keywords='["ASTM E119"]' -F limit=5
44
+
45
+ # Read a specific section's full content using an ID from a search result
46
+ specset tools run getSpecSectionContent -F id='sb://spec/....'
47
+ ```
48
+
49
+ Output is the tool's JSON payload (`{ success, message?, result? }`); a `{ success: false }` payload exits non-zero.
50
+
51
+ ### Identifiers are citation IDs, not links
52
+
53
+ Tool results embed identifiers shaped like `sb://spec/<uuid>` or `sb://drawing/<uuid>`. Pass them back into other tools verbatim (e.g. into `getSpecSectionContent`, `getDrawingSheet`). They are **not** web URLs — don't present them to a person as clickable links.
54
+
55
+ ### Project scoping
56
+
57
+ Most tools are project-scoped. Either pass `--project` (a UUID or `sb://project/...`), or include `projectId` in the tool input. Use `listProjects` to discover project IDs. With `--project` set, per-call `projectId` becomes optional.
58
+
59
+ ## Downloading source files (drawings, documents, specs, submittals, RFIs)
60
+
61
+ The retrieval tools return **extracted text**, which is authoritative for schedules, notes, and spec paragraphs — but cannot answer spatial/visual questions (routing, clearances, what a plan view actually shows) and never carries the original file. Every entity has a download command, and **each accepts its `sb://` citation URL verbatim** (as returned by issues, search, and tool results — any `#page=`/`#nodeId=` fragment is ignored) or a bare UUID:
62
+
63
+ ```bash
64
+ # Drawing sheets — image (rendered PNG, default), pdf (single-sheet), file (whole set).
65
+ # Also accepts a sheet number with --project. Read the PNG with vision to inspect geometry.
66
+ specset drawings download 'sb://drawing/<uuid>#nodeId=d1' --out /tmp/sheets/
67
+ specset drawings download E308 --project <projectId> --format pdf
68
+
69
+ # Project documents — also covers RFI attachments and closeout documents,
70
+ # which all reference a document:
71
+ specset docs download 'sb://doc/<uuid>'
72
+
73
+ # Spec sections — per-section PDF slice (default) or the whole source spec file.
74
+ # Also accepts a section number with --project:
75
+ specset specs download '23 31 19' --project <projectId>
76
+ specset specs download 'sb://spec/<uuid>' --asset book
77
+
78
+ # Submittals — compiled package (default when present), cover sheet, or attachments.
79
+ # --list shows the asset inventory first:
80
+ specset submittals download 'sb://sub/<uuid>' --list
81
+ specset submittals download 'sb://sub/<uuid>' --asset attachment --index 2
82
+ specset submittals download 'sb://sub/<uuid>' --asset attachment --all --out ./sub-42/
83
+
84
+ # RFIs — question + response attachments:
85
+ specset rfis download 'sb://rfi/<uuid>' --list
86
+ specset rfis download 'sb://rfi/<uuid>' --all --out ./rfi-7/
87
+
88
+ # Raw file resources — the escape hatch when you already hold an sb://file id:
89
+ specset files download 'sb://file/<uuid>'
90
+ ```
91
+
92
+ All commands support `--json` (structured `{files: [{path, bytes, ...}]}` output) and `--out` (file path, or directory for multi-file downloads). A citation passed to the wrong command errors with the right one to use.
93
+
94
+ Typical loop for drawings: search or `getDrawingSheetContent` to find the sheet → hit a visual question the text can't settle → `drawings download` → **read the PNG with your vision/file-reading tool**.
95
+
96
+ ## MCP server (Claude Code, Codex, other MCP clients)
97
+
98
+ `specset mcp` runs a stdio MCP server that exposes these tools natively, reusing your CLI login, org, and host config. Register it once and the client can call the tools directly:
99
+
100
+ ```bash
101
+ # Claude Code
102
+ claude mcp add specset -- specset mcp
103
+ # Optionally pin a project and/or host:
104
+ claude mcp add specset -- specset mcp --project <projectId> --host https://app.specbook.ai
105
+
106
+ # Codex
107
+ codex mcp add specset -- specset mcp
108
+ ```
109
+
110
+ Notes:
111
+ - The server writes only the MCP protocol to stdout; diagnostics go to stderr.
112
+ - Scope (org, optional project, host) is fixed for the life of the server — restart it to change scope.
113
+ - If the session expires mid-run, tool calls return an actionable error; run `specset login` and restart the server.
114
+
115
+ ## Stability
116
+
117
+ This surface is experimental — tool names and input schemas may change. For automation you need to keep stable, prefer the typed `search` / `quickSearch` GraphQL queries in the `specset-search` skill.