docs: remove retired protocol names from current guides

This commit is contained in:
cflmy committed 2026-11-24 17:04:27 +08:00
1 parent 3fe1ca3c0c
commit 867cd72ced
5 files changed
+70 -58

No files matched your search

+55 -44
View File
@@ -1,12 +1,12 @@
# External tools: CLI Tool Protocol v1
# External tools: current CLI Tool protocol
The core does not contain `view`, `knowledge`, `prove`, `lint` or any other
product command. A tool is a **separate executable** registered by the user; the
CLI only dispatches unknown top-level commands to registered tools and never
scans `PATH` for a guessed name.
Normative contract: [`../../spec/cli-tool.md`](../../spec/cli-tool.md)
(implemented and frozen for protocol v1).
Normative contract: [`../../spec/cli-tool.md`](../../spec/cli-tool.md) and
[`../../spec/schemas/cli-tool.schema.json`](../../spec/schemas/cli-tool.schema.json).
## 1. Package layout
@@ -20,7 +20,7 @@ marqdo-view/
examples/
```
`tool.json` for the `3.0.0-rc.2` candidate:
`tool.json` for the `3.0.0-rc.3` candidate:
```json
{
@@ -30,22 +30,19 @@ marqdo-view/
"version": "0.1.0",
"command": "view",
"entrypoint": "bin/marqdo-view",
"compatibility": {
"marqdo": ">=3.0.0-beta.1,<4.0.0",
"analysis": [2],
"trace": [2]
}
"requires": {"api_revision": 1, "analysis": 3, "observation": 1}
}
```
- `version` is the **tool's** SemVer.
- `compatibility.marqdo` is the **core product** range. A stable-only
`>=3.0.0,<4.0.0` does not match a beta core; opt in explicitly. The CLI
rejects a mismatched range at install and dispatch time with a
`requires marqdo …` diagnostic.
- `analysis`/`trace` are declared only if the tool consumes them; the current
development branch provides Analysis v2/v3 and Trace v2. Declare
`analysis: [2, 3]` when the reader handles both versions.
- `version` is the **tool's** SemVer. It identifies the artifact; it does not
promise compatibility with retired core protocols.
- `requires.api_revision` is required and must equal the current core revision.
- `requires.analysis` and `requires.observation` are optional. Declare one only
when the tool consumes that contract, and declare it as a **single exact
integer**; arrays, ranges and "highest shared version" negotiation do not
exist.
- A mismatched requirement fails install and dispatch with
`tool.protocol_incompatible`; there is no negotiation and no fallback.
- `command` must match `^[a-z][a-z0-9-]*$` and must not collide with a built-in
command (`init`, `run`, `call`, `check`, `inspect`, `fmt`, `plugin`, `add`,
`remove`, `lock`, `sync`, `tool`, `help`).
@@ -72,11 +69,13 @@ The tool receives:
| Variable | Meaning |
|---|---|
| `MARQDO_BIN` | absolute path of the running `marqdo` executable |
| `MARQDO_TOOL_PROTOCOL` | `1` |
| `MARQDO_PROTOCOL_ANALYSIS` | Highest shared Analysis version. Read the artifact envelope for its actual version. |
| `MARQDO_PROTOCOL_TRACE` | `2` when Trace v2 was negotiated |
| `MARQDO_API_REVISION` | the single current tool API revision (`1`) |
Call `$MARQDO_BIN` with an argv array; do not assume `marqdo` is on `PATH`.
The retired `MARQDO_TOOL_PROTOCOL`, `MARQDO_PROTOCOL_ANALYSIS` and
`MARQDO_PROTOCOL_TRACE` variables are not exported: version selection is not
negotiated. A registration written by a retired manifest/record format is
rejected with a "remove and reinstall" diagnostic and is never rewritten.
## 3. Consume the public protocols
@@ -86,28 +85,37 @@ Static input (View/Knowledge/Proof):
"$MARQDO_BIN" check index.mq.md --refs --emit ./analysis.json
```
Dynamic input:
Dynamic input uses the single Observation contract. The same run can deliver
the event stream on stdout and an atomic JSON snapshot in one invocation:
```bash
"$MARQDO_BIN" run index.mq.md --trace-file ./trace.json
# live JSONL events
"$MARQDO_BIN" run index.mq.md --output jsonl
"$MARQDO_BIN" call index.mq.md main --arg n=5 --output jsonl
# one JSON snapshot, from the same execution
"$MARQDO_BIN" run index.mq.md --output json --observation-file ./observation.json
# both destinations, still one execution
"$MARQDO_BIN" call index.mq.md main --arg n=5 --output jsonl \
--observation-file ./observation.json
```
Live dynamic input (Execution Events v1):
Consume the stdout line stream as NDJSON; do not pass another `--output` in the
same invocation. Every event carries `schema: "marqdo.observation"` and
`schema_version: 1`; read `stream.opened` for the capture policy and reject any
other format identifier. The JSON snapshot wraps the same events, so a consumer
must not treat it as a second protocol or renumber them. A tool server may
convert the stream to its own SSE/websocket transport; the CLI never implements
HTTP/SSE. Live and file destinations are rejected under `--mode strict` in the
current tree; the tool must surface that refusal instead of pretending
real-time support. The retired `--json`, `--trace-file` and `--event-stream`
options are rejected, not aliased.
```bash
"$MARQDO_BIN" run index.mq.md --event-stream jsonl
"$MARQDO_BIN" call index.mq.md main --arg n=5 --event-stream jsonl
```
Consume the stdout line stream as NDJSON; do not pass `--json` in the same
invocation. Negotiate by reading `stream.opened` (`marqdo.execution-events`,
`schema_version: 1`) and reject unknown majors. A tool server may convert the
stream to its own SSE/websocket transport; the CLI never implements HTTP/SSE.
This option is unavailable under `--mode strict` in the current tree and the
tool must surface that refusal instead of pretending real-time support.
See [analysis-observation.md](analysis-observation.md) for fields and digest rules. Do not
depend on `inspect --ir`: that JSON is not a frozen cross-repository protocol.
See [analysis-observation.md](analysis-observation.md) for fields and digest rules. A
consumer must verify the exact Analysis bytes (SHA-256) and each module source
digest before attributing a span. Do not depend on `inspect --ir`: that JSON is
not a frozen cross-repository protocol.
The `view` tool renders the **original Markdown**, not the Analysis JSON; the
Analysis is an index, not a replacement for the source text.
@@ -122,13 +130,16 @@ Checksums verify bundle integrity only; they are not publisher authentication.
- Test against a **frozen** `marqdo` binary: hash it before/after the suite and
fail if it changes.
- Cover the negative paths: unknown schema major, incompatible `marqdo` range,
reserved command, traversal/symlink entrypoint, tampered bundle file, missing
entrypoint, tool crash/exit-status propagation.
- Match a real Analysis v2/Trace v2 schema (`spec/schemas/`) and check
`source.analysis_digest`.
- Include README, minimal example, supported CLI product range, protocol
versions, platform matrix, reproducible artifact hashes and limitations.
- Cover the negative paths: unknown schema/schema_version, incompatible
`api_revision`/`analysis`/`observation` requirement, array requirements,
retired record format, reserved command, traversal/symlink entrypoint,
tampered bundle file, missing entrypoint, tool crash/exit-status propagation.
- Validate against the current Analysis and Observation schemas
(`spec/schemas/`) and check `source.analysis_digest` plus the module source
digest before using event spans.
- Include README, minimal example, supported CLI product range, the exact
protocol requirements, platform matrix, reproducible artifact hashes and
limitations.
- The archive ships `examples/tool-samples/{sample-view,sample-knowledge,sample-proof}`
as independent source examples and `examples/tool-unknown-name/` as a
runnable dispatch fixture.