@seamward/cli 0.1.0-alpha.10
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 +31 -0
- package/README.md +428 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +659 -0
- package/dist/cli.js.map +1 -0
- package/dist/connection-key.d.ts +5 -0
- package/dist/connection-key.js +6 -0
- package/dist/connection-key.js.map +1 -0
- package/dist/contract-sync.d.ts +134 -0
- package/dist/contract-sync.js +603 -0
- package/dist/contract-sync.js.map +1 -0
- package/dist/discovery.d.ts +47 -0
- package/dist/discovery.js +496 -0
- package/dist/discovery.js.map +1 -0
- package/dist/existing-webhook-binding.d.ts +9 -0
- package/dist/existing-webhook-binding.js +196 -0
- package/dist/existing-webhook-binding.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/observation-sync.d.ts +28 -0
- package/dist/observation-sync.js +101 -0
- package/dist/observation-sync.js.map +1 -0
- package/dist/project-metadata.d.ts +7 -0
- package/dist/project-metadata.js +104 -0
- package/dist/project-metadata.js.map +1 -0
- package/dist/remote-api.d.ts +10 -0
- package/dist/remote-api.js +61 -0
- package/dist/remote-api.js.map +1 -0
- package/dist/setup-engine.d.ts +127 -0
- package/dist/setup-engine.js +765 -0
- package/dist/setup-engine.js.map +1 -0
- package/dist/setup-plan.d.ts +197 -0
- package/dist/setup-plan.js +1240 -0
- package/dist/setup-plan.js.map +1 -0
- package/dist/source-instrumentation.d.ts +10 -0
- package/dist/source-instrumentation.js +291 -0
- package/dist/source-instrumentation.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/examples/node-service/README.md +42 -0
- package/examples/node-service/contracts/orders.openapi.yaml +18 -0
- package/examples/node-service/package.json +11 -0
- package/examples/node-service/src/server.ts +13 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Seamward CLI Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Seamward. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and its accompanying documentation are proprietary to Seamward.
|
|
6
|
+
Possession, installation, or availability through a package registry does not
|
|
7
|
+
grant a licence to use, copy, modify, distribute, sublicense, sell, or create
|
|
8
|
+
derivative works from the software.
|
|
9
|
+
|
|
10
|
+
You may use the software only to the extent expressly permitted by a written
|
|
11
|
+
agreement with Seamward, including an applicable customer, evaluation, pilot,
|
|
12
|
+
or partner agreement. If that agreement conflicts with this notice, the
|
|
13
|
+
written agreement controls.
|
|
14
|
+
|
|
15
|
+
Except where applicable law does not permit the restriction, you may not:
|
|
16
|
+
|
|
17
|
+
1. redistribute, publish, sublicense, lease, sell, or transfer the software;
|
|
18
|
+
2. reverse engineer, decompile, disassemble, or attempt to derive source code
|
|
19
|
+
from any distributed binary or package; or
|
|
20
|
+
3. remove or alter proprietary notices.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS" TO THE MAXIMUM EXTENT PERMITTED BY LAW,
|
|
23
|
+
WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF
|
|
24
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
|
25
|
+
NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY LAW, SEAMWARD IS NOT
|
|
26
|
+
LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES,
|
|
27
|
+
OR FOR LOSS OF DATA, REVENUE, PROFITS, OR BUSINESS OPPORTUNITY, ARISING FROM OR
|
|
28
|
+
RELATED TO THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
No trademark rights are granted. All rights not expressly granted in a written
|
|
31
|
+
agreement with Seamward are reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# Seamward setup CLI
|
|
2
|
+
|
|
3
|
+
`@seamward/cli` discovers integration boundaries in a local codebase and builds
|
|
4
|
+
a deterministic, reviewable setup plan. The alpha release scans TypeScript,
|
|
5
|
+
JavaScript, Python, PHP, and Go for HTTP, webhook, queue, and scheduled-feed
|
|
6
|
+
operations.
|
|
7
|
+
|
|
8
|
+
Discovery and setup previews are read-only. The CLI does not upload source
|
|
9
|
+
code, read `.env` files, or modify application handlers. The scanner records
|
|
10
|
+
file names, line numbers, operation categories, confidence, and redacted target
|
|
11
|
+
hints. It does not include source lines in its output. Interactive review writes
|
|
12
|
+
local review state only after an explicit confirmation.
|
|
13
|
+
|
|
14
|
+
## Support matrix
|
|
15
|
+
|
|
16
|
+
| Target | Discovery | Generated collector bootstrap | Instrumentation |
|
|
17
|
+
| -------------------------------- | ----------------- | ----------------------------- | ------------------------------ |
|
|
18
|
+
| Node.js 22+ TypeScript, ESM | Alpha | Yes | Review required |
|
|
19
|
+
| Node.js 22+ JavaScript, ESM | Alpha | Yes | Review required |
|
|
20
|
+
| Node.js 22+ JavaScript, CommonJS | Alpha | ESM bridge (`.mjs`) | Review required |
|
|
21
|
+
| Browser or edge JavaScript | Discovery only | No | Unsupported |
|
|
22
|
+
| Python | Discovery preview | No | Direct REST, manual |
|
|
23
|
+
| PHP | Discovery preview | No | Direct REST, manual |
|
|
24
|
+
| Go | Discovery preview | No | Direct REST, manual |
|
|
25
|
+
| Monorepo root | Refused | No | Run from one service directory |
|
|
26
|
+
|
|
27
|
+
Discovery uses deterministic lexical detectors, not a compiler. Review every
|
|
28
|
+
finding before instrumenting it. Tests, fixtures, generated output, ignored
|
|
29
|
+
dependencies, scripts, mocks, tools, provider simulators, secret files, and
|
|
30
|
+
`.gitignore` matches are excluded by default.
|
|
31
|
+
|
|
32
|
+
## Coding-agent setup with MCP
|
|
33
|
+
|
|
34
|
+
Use `@seamward/setup-mcp` when your coding agent supports local stdio MCP
|
|
35
|
+
servers. It wraps this package's discovery and planning engine, so the CLI and
|
|
36
|
+
agent workflow produce the same plan. The difference is responsibility:
|
|
37
|
+
|
|
38
|
+
- the local MCP analyzes automatically and presents one readable local proposal;
|
|
39
|
+
- one local approval covers the dependency, generated file, and reviewed source
|
|
40
|
+
changes;
|
|
41
|
+
- the MCP applies supported JavaScript or TypeScript source changes, runs the
|
|
42
|
+
project verification scripts, and records evidence as one reversible local
|
|
43
|
+
operation;
|
|
44
|
+
- one remote approval either registers and activates the exact reviewed
|
|
45
|
+
contract or links an exact already-active version to local setup evidence;
|
|
46
|
+
- a final read-only status check reports whether traffic has arrived;
|
|
47
|
+
- the CLI remains the deterministic fallback for terminals and CI.
|
|
48
|
+
|
|
49
|
+
Start by asking the agent: "Set up Seamward in this project." The MCP owns
|
|
50
|
+
discovery, previews, repository verification, and environment-file safety. The
|
|
51
|
+
interactive workflow does not ask a user to name a provider, guess a protocol,
|
|
52
|
+
select a contract path in the prompt, or copy internal plan values between
|
|
53
|
+
calls. See the
|
|
54
|
+
[`@seamward/setup-mcp` package](https://www.npmjs.com/package/@seamward/setup-mcp)
|
|
55
|
+
for the supported workflow and status states.
|
|
56
|
+
|
|
57
|
+
Automatic MCP instrumentation currently covers outbound Node.js HTTP client
|
|
58
|
+
calls and inbound Node.js webhook handlers. Inbound HTTP servers, queues, and
|
|
59
|
+
scheduled feeds are discovered, then routed to a manual setup guide before any
|
|
60
|
+
local approval. The CLI remains available for explicit planning across every
|
|
61
|
+
discovered protocol.
|
|
62
|
+
|
|
63
|
+
Local MCP evidence stores current file hashes. Older alpha state is migrated
|
|
64
|
+
only during the approved local apply and only when generated targets can be
|
|
65
|
+
proven safe.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm add -D @seamward/cli@alpha
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The CLI and generated Node bootstrap require Node.js 22 or newer. The generated
|
|
74
|
+
plan pins collector installation to `@seamward/collector@0.1.0-alpha.3`, the
|
|
75
|
+
first release with Connection-key and multi-protocol wrappers used by this
|
|
76
|
+
setup schema. Regenerate and review the plan before changing that dependency.
|
|
77
|
+
|
|
78
|
+
## Discover and prepare a plan
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm exec seamward discover .
|
|
82
|
+
pnpm exec seamward setup .
|
|
83
|
+
pnpm exec seamward setup . --write
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
One Seamward Integration has exactly one direction and protocol. When discovery
|
|
87
|
+
finds more than one compatible scope, `setup` refuses to build an ambiguous
|
|
88
|
+
single-key plan. Select one scope explicitly:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pnpm exec seamward setup . \
|
|
92
|
+
--direction outbound \
|
|
93
|
+
--protocol http-api \
|
|
94
|
+
--contract contracts/provider.openapi.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Valid protocols are `http-api`, `http-webhook`, `queue`, and
|
|
98
|
+
`scheduled-feed`. The plan records the selected `integrationScope` and every
|
|
99
|
+
`excludedIntegrationScope`. Complete and verify each scope separately. Each
|
|
100
|
+
scope needs its own Integration and Connection key. Never reuse one
|
|
101
|
+
Integration's key for a different direction or protocol.
|
|
102
|
+
|
|
103
|
+
Contract files do not declare whether they describe your inbound API or a
|
|
104
|
+
provider you call. Discovery therefore never assigns one by file name or
|
|
105
|
+
proximity. Pass `--contract` for each reviewed contract that belongs to the
|
|
106
|
+
selected scope. Other discovered artifacts remain visible in
|
|
107
|
+
`unassignedContracts` and cannot be registered from that plan.
|
|
108
|
+
|
|
109
|
+
OpenAPI assignment is limited to `http-api` and `http-webhook` scopes. A mixed
|
|
110
|
+
OpenAPI document is split by the selected scope: HTTP API plans register
|
|
111
|
+
`paths`, while webhook plans register `webhooks`. Use an operation-bound JSON
|
|
112
|
+
Schema for queue and scheduled-feed Integrations.
|
|
113
|
+
|
|
114
|
+
`setup` previews `.seamward/setup-plan.json` and, for a declared backend Node
|
|
115
|
+
service, a scope-named file such as
|
|
116
|
+
`src/seamward.outbound-http-api.generated.ts`. JavaScript uses `.js` or `.mjs`.
|
|
117
|
+
`--write` creates only those generated files. Existing files are never replaced
|
|
118
|
+
unless `--force` is also supplied. Symbolic-link destinations and paths outside
|
|
119
|
+
the selected service root are rejected.
|
|
120
|
+
|
|
121
|
+
The generated bootstrap reads the scoped Connection-key and Integration-owned
|
|
122
|
+
ingest-token names printed in the plan. For example:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
SEAMWARD_CONNECTION_KEY_OUTBOUND_HTTP_API
|
|
126
|
+
SEAMWARD_INGEST_TOKEN_OUTBOUND_HTTP_API
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Run and verify one selected scope before replacing `.seamward/setup-plan.json`
|
|
130
|
+
with another scope. Scope-named bootstrap files remain separate, so a mixed
|
|
131
|
+
service can import one collector per Integration after each plan is reviewed.
|
|
132
|
+
|
|
133
|
+
The plan's `review_required` and `manual` actions remain application changes for
|
|
134
|
+
an engineer to make. `verify` exits non-zero while any action remains pending:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pnpm exec seamward verify .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Verification checks the plan fingerprint, exact generated contents, collector
|
|
141
|
+
dependency, and pending actions. It does not claim that a regex finding is
|
|
142
|
+
already instrumented.
|
|
143
|
+
|
|
144
|
+
## Complete reviewed actions
|
|
145
|
+
|
|
146
|
+
After implementing the proposed instrumentation, bind the selected actions to
|
|
147
|
+
the current implementation files:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pnpm exec seamward review . --source-backed
|
|
151
|
+
pnpm exec seamward verify .
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The CLI presents numbered descriptions containing the operation kind,
|
|
155
|
+
direction, file, and line. Select `all` or a comma-separated set of numbers,
|
|
156
|
+
add an optional review note, and confirm once. The action identifiers remain in
|
|
157
|
+
the machine-readable plan and local audit state; an interactive user does not
|
|
158
|
+
copy them. Only the final affirmative confirmation writes a timestamped entry
|
|
159
|
+
to `.seamward/setup-state.json`, bound to the current plan fingerprint.
|
|
160
|
+
|
|
161
|
+
Source-backed review records current hashes for the implementation files named
|
|
162
|
+
by the selected actions. It does not edit application source, install
|
|
163
|
+
dependencies, register a contract, or prove business correctness. A later file
|
|
164
|
+
change makes that evidence stale. Review without `--source-backed` records a
|
|
165
|
+
legacy `attested_only` decision and does not satisfy source-backed completion.
|
|
166
|
+
For TypeScript and JavaScript, a single reviewed wrapper or adapter factory in
|
|
167
|
+
one file may serve several findings in that file. Every selected action is
|
|
168
|
+
bound to the same current file hash. Static evidence proves that the planned
|
|
169
|
+
wrapper boundary exists, not that every route ran. Project tests and the first
|
|
170
|
+
accepted observation remain separate requirements.
|
|
171
|
+
|
|
172
|
+
For deterministic non-interactive automation, preview or record every pending
|
|
173
|
+
instrumentation action with `--all`:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
pnpm exec seamward review . --all
|
|
177
|
+
pnpm exec seamward review . \
|
|
178
|
+
--all \
|
|
179
|
+
--source-backed \
|
|
180
|
+
--evidence "instrumented and reviewed in src/provider.ts" \
|
|
181
|
+
--write
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Bare `review .` requires an interactive terminal. In CI or redirected input,
|
|
185
|
+
use `--all` so the command never waits for input.
|
|
186
|
+
The review command accepts instrumentation actions only. A contract-registration
|
|
187
|
+
action remains pending until `contracts register --write` receives a successful
|
|
188
|
+
API response containing the registered draft id.
|
|
189
|
+
|
|
190
|
+
`verify` exits zero only when generated artifacts still match the plan, the
|
|
191
|
+
required collector dependency is present, source-backed evidence is current,
|
|
192
|
+
the required contract is registered and active, and the first accepted
|
|
193
|
+
observation has been recorded. A new setup-plan fingerprint invalidates
|
|
194
|
+
completion state from an older plan; review the new findings instead of copying
|
|
195
|
+
the old state file.
|
|
196
|
+
|
|
197
|
+
The assisted setup path can reconcile an already-active version without a
|
|
198
|
+
remote write. It requires an exact match for the Integration, declared version,
|
|
199
|
+
import format, contract document, and every imported operation selector and
|
|
200
|
+
schema fingerprint. JSON Schema reconciliation also requires the same explicit
|
|
201
|
+
operation binding. A mismatch remains incomplete and requires a fresh remote
|
|
202
|
+
review.
|
|
203
|
+
|
|
204
|
+
The packaged [Node service example](examples/node-service) contains one webhook,
|
|
205
|
+
one outbound provider call, and one OpenAPI document you can use to inspect the
|
|
206
|
+
discovery and setup-plan output.
|
|
207
|
+
|
|
208
|
+
## Register one contract draft
|
|
209
|
+
|
|
210
|
+
Create a scoped API key with `contracts:write`. Keep the key in your secret
|
|
211
|
+
manager or temporary shell environment. The Connection key identifies the
|
|
212
|
+
Integration and is public routing configuration.
|
|
213
|
+
|
|
214
|
+
The CLI uses `https://api.seamward.com` by default. For local development, set
|
|
215
|
+
`SEAMWARD_MANAGEMENT_API_URL=http://127.0.0.1:4100`. An explicit `--endpoint`
|
|
216
|
+
value takes precedence over the environment variable. Non-local HTTP endpoints
|
|
217
|
+
are rejected.
|
|
218
|
+
|
|
219
|
+
The saved plan must first bind the reviewed file to this Integration scope:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
pnpm exec seamward setup . \
|
|
223
|
+
--direction outbound \
|
|
224
|
+
--protocol http-api \
|
|
225
|
+
--contract contracts/provider.openapi.json \
|
|
226
|
+
--write
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
export SEAMWARD_API_KEY=replace_with_scoped_key
|
|
231
|
+
export SEAMWARD_CONNECTION_KEY_OUTBOUND_HTTP_API=replace_with_connection_key
|
|
232
|
+
|
|
233
|
+
pnpm exec seamward contracts register . \
|
|
234
|
+
--version 2026-08 \
|
|
235
|
+
--file contracts/provider.openapi.json
|
|
236
|
+
|
|
237
|
+
pnpm exec seamward contracts register . \
|
|
238
|
+
--version 2026-08 \
|
|
239
|
+
--file contracts/provider.openapi.json \
|
|
240
|
+
--write
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The first command previews the destination and lifecycle effect. Only
|
|
244
|
+
`--write` sends the document. One invocation registers exactly one immutable
|
|
245
|
+
draft, never several partial versions. Contract files are limited to 1 MB,
|
|
246
|
+
must match the fingerprint in the reviewed plan, and must resolve inside the
|
|
247
|
+
project. `example`, `examples`, and code-sample fields are removed by default.
|
|
248
|
+
Use `--include-examples` only after reviewing those values.
|
|
249
|
+
|
|
250
|
+
After a successful `--write`, the CLI records the matching
|
|
251
|
+
`register_contract` action as completed with the returned draft id. It does
|
|
252
|
+
not complete instrumentation actions.
|
|
253
|
+
|
|
254
|
+
The JSON preview is a local dry-run. It validates the selected file and plan
|
|
255
|
+
fingerprint without calling the Seamward API and reports:
|
|
256
|
+
|
|
257
|
+
| Field | Meaning |
|
|
258
|
+
| ---------------------- | ------------------------------------------------------------- |
|
|
259
|
+
| `applied` | Always `false` in a preview |
|
|
260
|
+
| `operation` | `contract_registration` |
|
|
261
|
+
| `integrationId` | Destination derived from the public Connection key |
|
|
262
|
+
| `declaredVersion` | Immutable version label requested on the command line |
|
|
263
|
+
| `files` | The one reviewed contract file |
|
|
264
|
+
| `format` | `openapi` or `json_schema` |
|
|
265
|
+
| `fingerprint` | SHA-256 fingerprint recorded in the setup plan |
|
|
266
|
+
| `byteSize` | Source contract file size before upload |
|
|
267
|
+
| `removedExampleFields` | Number of example or code-sample fields that would be removed |
|
|
268
|
+
| `operationBinding` | Validated JSON Schema binding, when required |
|
|
269
|
+
| `examples` | Whether examples would be removed or included |
|
|
270
|
+
|
|
271
|
+
The preview requires the scoped Connection-key environment variable printed in
|
|
272
|
+
the plan so it can show the destination, but it does not require
|
|
273
|
+
`SEAMWARD_API_KEY`. A JSON Schema preview fails before network access when
|
|
274
|
+
`--binding` is absent, outside the project, malformed, or contains an invalid
|
|
275
|
+
selector.
|
|
276
|
+
|
|
277
|
+
If the network drops after the server accepts a registration, the CLI retries
|
|
278
|
+
once. The API returns the existing version only when the document and every
|
|
279
|
+
operation selector are identical. A different document or selector with the
|
|
280
|
+
same declared version remains a conflict.
|
|
281
|
+
|
|
282
|
+
JSON Schema describes one operation and therefore needs an explicit binding:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"method": "POST",
|
|
287
|
+
"routeTemplate": "/candidates",
|
|
288
|
+
"payloadLocation": "response",
|
|
289
|
+
"statusSelector": "201"
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
pnpm exec seamward contracts register . \
|
|
295
|
+
--version 2026-08 \
|
|
296
|
+
--file contracts/candidate.schema.json \
|
|
297
|
+
--binding contracts/candidate.binding.json \
|
|
298
|
+
--write
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Swagger 2.0 is not accepted. Convert it to OpenAPI 3 before discovery.
|
|
302
|
+
|
|
303
|
+
## Activate a reviewed contract
|
|
304
|
+
|
|
305
|
+
Activation changes the schema used for analysis and requires a key with
|
|
306
|
+
`contracts:read` and `contracts:activate`. It is a separate, explicit command
|
|
307
|
+
with an optimistic concurrency precondition. Preview it first:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
pnpm exec seamward contracts status .
|
|
311
|
+
|
|
312
|
+
pnpm exec seamward contracts activate . \
|
|
313
|
+
--contract contract_target \
|
|
314
|
+
--expected contract_current
|
|
315
|
+
|
|
316
|
+
pnpm exec seamward contracts activate . \
|
|
317
|
+
--contract contract_target \
|
|
318
|
+
--expected contract_current \
|
|
319
|
+
--write
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Use `--expected none` only when the Integration has no active version. Use
|
|
323
|
+
`--reason rollback` for an intentional rollback. Contract versions are
|
|
324
|
+
immutable and do not have a delete command.
|
|
325
|
+
|
|
326
|
+
If an activation response is lost, a retry reconciles successfully only when
|
|
327
|
+
the requested target is already active. Any other conflict requires a new
|
|
328
|
+
status review.
|
|
329
|
+
|
|
330
|
+
## Check the first accepted observation
|
|
331
|
+
|
|
332
|
+
After starting the instrumented service, send one representative request or
|
|
333
|
+
message. The scoped API key needs `observations:read`:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
pnpm exec seamward observations check .
|
|
337
|
+
pnpm exec seamward observations check . --write
|
|
338
|
+
pnpm exec seamward verify .
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
The first command previews the remote result. `--write` stores the accepted
|
|
342
|
+
observation id and timestamp in local setup state. The query begins after the
|
|
343
|
+
latest source evidence and activation, so older traffic cannot complete a new
|
|
344
|
+
setup. When the plan has a contract, the check also confirms that the locally
|
|
345
|
+
recorded contract version is still active. One observation proves connectivity
|
|
346
|
+
for the Integration, not coverage of every discovered operation.
|
|
347
|
+
|
|
348
|
+
The setup MCP uses `contracts:read` to review and reconcile an exact active
|
|
349
|
+
version. It needs `contracts:write` and `contracts:activate` only when it must
|
|
350
|
+
create and activate a new version. The observation check needs
|
|
351
|
+
`observations:read`. An interrupted local reconciliation is retry-safe and does
|
|
352
|
+
not repeat a remote mutation.
|
|
353
|
+
|
|
354
|
+
## Programmatic use
|
|
355
|
+
|
|
356
|
+
The package exports the same deterministic building blocks for tools that need
|
|
357
|
+
structured results instead of CLI JSON:
|
|
358
|
+
|
|
359
|
+
| Import | Value exports | Type exports |
|
|
360
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
361
|
+
| `@seamward/cli` | `discoverSources`, `scanProject` | `ContractArtifact`, discovery result, finding, protocol, language, direction, confidence, input, and option types |
|
|
362
|
+
| `@seamward/cli` | `createSetupPlan`, `discoverIntegrationScopes`, `applySetupPlan`, `inspectSetupPlanFiles`, `inspectSetupActionEvidence`, `inspectSetupCompletionState`, `inspectSetupRemoteLifecycle`, `completedSetupActionIds`, `operatorReviewableSetupActions`, `reviewSetupActions`, `recordSourceBackedSetupEvidence`, `resetSetupCompletionState`, `setupCompletionStateFingerprint`, `supportedCollectorVersion` | setup plan, scope, action, completion state, remote lifecycle, evidence, file inspection, runtime, package-manager, apply, and review types |
|
|
363
|
+
| `@seamward/cli` | `previewPlanContract`, `registerPlanContracts`, `readContractStatus`, `readMatchingActivePlanContract`, `reconcileActivePlanContract`, `previewPlanContractActivation`, `validatePlanContractActivation`, `activatePlanContractVersion`, `activateContractVersion`, `checkFirstSetupObservation` | registration, exact-active matching, reconciliation, status, plan activation, low-level activation, observation, and JSON Schema binding types |
|
|
364
|
+
| `@seamward/cli` | `createLocalSetupEngine`, `readSetupPlan`, `verifySetup`, `readProjectMetadata` | local setup engine, analysis, selection, verification, and project metadata types |
|
|
365
|
+
| `@seamward/cli` | `SeamwardRemoteApiError` | stable remote API error code types |
|
|
366
|
+
| `@seamward/cli` | `parseConnectionKey`, `cliVersion` | `ParsedConnectionKey` |
|
|
367
|
+
| `@seamward/cli/cli` | `runCli` | `CliIo` |
|
|
368
|
+
|
|
369
|
+
Use `runCli` only when embedding the command dispatcher with an explicit I/O
|
|
370
|
+
adapter. Do not import files from `dist`, `src`, or other internal paths.
|
|
371
|
+
|
|
372
|
+
`activateContractVersion` remains exported for alpha compatibility but is
|
|
373
|
+
deprecated. It bypasses setup-plan ownership and source-evidence checks. New
|
|
374
|
+
tools must use `previewPlanContractActivation` and then
|
|
375
|
+
`activatePlanContractVersion` so the exact plan, source evidence, active
|
|
376
|
+
version, and approval remain locked together.
|
|
377
|
+
|
|
378
|
+
This package is an alpha release. Command output, TypeScript types, generated
|
|
379
|
+
file schema, detector coverage, and programmatic signatures may change between
|
|
380
|
+
alpha versions. Pin an exact version and review the changelog and generated
|
|
381
|
+
plan before upgrading. Discovery findings remain advisory and require an
|
|
382
|
+
engineer review.
|
|
383
|
+
|
|
384
|
+
## Privacy and limitations
|
|
385
|
+
|
|
386
|
+
- Application source remains local. Plans do not contain source lines.
|
|
387
|
+
- Literal URL paths are replaced with `<redacted-path>`.
|
|
388
|
+
- Contract documents are the only files uploaded by this CLI. Their exact file,
|
|
389
|
+
fingerprint, size boundary, target Integration, and version are reviewed
|
|
390
|
+
before `--write`.
|
|
391
|
+
- Field names in contracts remain visible because structural matching needs
|
|
392
|
+
them. Remove confidential descriptions and extensions before registration.
|
|
393
|
+
- The CLI never edits `.env` or deployed configuration.
|
|
394
|
+
- Non-Node and browser projects receive discovery guidance, not a claim of
|
|
395
|
+
automatic instrumentation.
|
|
396
|
+
- Run the CLI from one deployable service directory in a monorepo.
|
|
397
|
+
|
|
398
|
+
## Troubleshooting
|
|
399
|
+
|
|
400
|
+
- **Verification reports missing Seamward credentials:** upgrade to the latest
|
|
401
|
+
CLI and generated bootstrap, then rerun the reviewed local apply. The setup
|
|
402
|
+
engine gives the generated collector an allowlisted, credential-free
|
|
403
|
+
verification environment, so it cannot start or transmit an observation.
|
|
404
|
+
Project verification scripts still run exactly as the repository defines
|
|
405
|
+
them and may perform their own file or network access. Normal application
|
|
406
|
+
startup still requires the Connection key and ingest token.
|
|
407
|
+
- **Automatic instrumentation is unsupported:** no source or generated change
|
|
408
|
+
is retained. Use the manual integration guide or refactor the boundary into a
|
|
409
|
+
supported shape, then create and review a fresh plan. Do not mix plan-owned
|
|
410
|
+
setup with unrelated automated edits.
|
|
411
|
+
- **No plan found:** run `seamward setup . --write` first.
|
|
412
|
+
- **Multiple Integration scopes:** rerun `setup` with one `--direction` and
|
|
413
|
+
`--protocol`. Use a distinct Integration and Connection key for every scope.
|
|
414
|
+
- **Plan fingerprint mismatch:** run a fresh read-only setup preview, review the
|
|
415
|
+
changed findings, then explicitly replace generated artifacts if appropriate.
|
|
416
|
+
- **Generated file conflict:** move or review the existing file. Use `--force`
|
|
417
|
+
only for a file previously generated by Seamward.
|
|
418
|
+
- **Setup lock remains after a crash:** a lock whose recorded process is still
|
|
419
|
+
running must be left in place. If the recorded process no longer exists,
|
|
420
|
+
inspect the named lock, remove only that lock file, and rerun the command.
|
|
421
|
+
Seamward never steals or replaces a lock automatically.
|
|
422
|
+
- **Multiple contracts discovered:** pass exactly one `--file`.
|
|
423
|
+
- **JSON Schema binding invalid:** include `routeTemplate` and
|
|
424
|
+
`payloadLocation`; remove unsupported fields.
|
|
425
|
+
- **Verification incomplete:** install the collector when requested and review
|
|
426
|
+
every pending instrumentation or contract action.
|
|
427
|
+
- **403 response:** create a workspace-scoped key with the documented contract
|
|
428
|
+
scope. Credentials are not printed in command output.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface CliIo {
|
|
3
|
+
cwd(): string;
|
|
4
|
+
stdout(value: string): void;
|
|
5
|
+
stderr(value: string): void;
|
|
6
|
+
env?(name: string): string | undefined;
|
|
7
|
+
fetchFn?: typeof fetch;
|
|
8
|
+
isInteractive?(): boolean;
|
|
9
|
+
prompt?(question: string): Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function runCli(arguments_: string[], io?: CliIo): Promise<number>;
|