@counterfact-labs/cli 0.1.3 → 0.2.4
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 +176 -42
- package/bundle/client-release.json +7 -0
- package/bundle/sealed.json +908 -0
- package/dist/adapters/anthropic.js +151 -0
- package/dist/adapters/completion.js +112 -0
- package/dist/adapters/durable-write.js +34 -0
- package/dist/adapters/files.js +144 -0
- package/dist/adapters/folder-path.js +6 -0
- package/dist/adapters/git-ignore.js +49 -0
- package/dist/adapters/git.js +44 -0
- package/dist/adapters/ignored-files.js +36 -0
- package/dist/adapters/instructions.js +35 -0
- package/dist/adapters/models.js +51 -0
- package/dist/adapters/output-paths.js +92 -0
- package/dist/adapters/prompt-cache.js +28 -0
- package/dist/adapters/public-instructions.js +36 -0
- package/dist/adapters/quality.js +6 -0
- package/dist/adapters/relay-plan.js +15 -0
- package/dist/adapters/release.js +62 -0
- package/dist/adapters/report.js +29 -0
- package/dist/adapters/repository-files.js +199 -0
- package/dist/adapters/repository-root.js +120 -0
- package/dist/adapters/results.js +9 -0
- package/dist/adapters/settings.js +26 -0
- package/dist/adapters/snapshot.js +68 -0
- package/dist/analysis-core/analysis/analysis-flags.js +1 -0
- package/dist/analysis-core/analysis/code-agents/skipped-files.js +1 -0
- package/dist/analysis-core/analysis/finding-quality/config.js +1 -0
- package/dist/analysis-core/analysis/finding-quality/policy.js +1 -0
- package/dist/analysis-core/analysis/headlines/attachment.js +1 -0
- package/dist/analysis-core/analysis/headlines/input.js +1 -0
- package/dist/analysis-core/analysis/headlines/types.js +1 -0
- package/dist/analysis-core/analysis/schemas.js +1 -0
- package/dist/analysis-core/analysis/source-notes/types.js +1 -0
- package/dist/analysis-core/chunks/2PSNOSJ2.js +1 -0
- package/dist/analysis-core/chunks/3227KXHF.js +1 -0
- package/dist/analysis-core/chunks/326F4XNG.js +1 -0
- package/dist/analysis-core/chunks/3CKW5JIF.js +1 -0
- package/dist/analysis-core/chunks/3GUKUEEJ.js +1 -0
- package/dist/analysis-core/chunks/3MTXB4MK.js +6 -0
- package/dist/analysis-core/chunks/4F6ZIHXU.js +1 -0
- package/dist/analysis-core/chunks/57M4OQJM.js +1 -0
- package/dist/analysis-core/chunks/6YCABS5T.js +1 -0
- package/dist/analysis-core/chunks/724WZMYW.js +2 -0
- package/dist/analysis-core/chunks/74FPPPIG.js +1 -0
- package/dist/analysis-core/chunks/7OYIBWX3.js +1 -0
- package/dist/analysis-core/chunks/D6AWHLRI.js +1 -0
- package/dist/analysis-core/chunks/DRGDIIFA.js +1 -0
- package/dist/analysis-core/chunks/E7TFIHC5.js +1 -0
- package/dist/analysis-core/chunks/EH3QQ3T4.js +1 -0
- package/dist/analysis-core/chunks/FSLWD2PE.js +1 -0
- package/dist/analysis-core/chunks/FTODBFQW.js +1 -0
- package/dist/analysis-core/chunks/HPIAEQHE.js +37 -0
- package/dist/analysis-core/chunks/HTLIRVP7.js +1 -0
- package/dist/analysis-core/chunks/IBCFGUHI.js +1 -0
- package/dist/analysis-core/chunks/IVDDV6CU.js +14 -0
- package/dist/analysis-core/chunks/J4AXGE5W.js +1 -0
- package/dist/analysis-core/chunks/JF4GYMOZ.js +1 -0
- package/dist/analysis-core/chunks/JKWTHRUR.js +1 -0
- package/dist/analysis-core/chunks/K5OTWBTT.js +22 -0
- package/dist/analysis-core/chunks/KU5DINLW.js +1 -0
- package/dist/analysis-core/chunks/MJGB25S5.js +1 -0
- package/dist/analysis-core/chunks/MXXNED6N.js +7 -0
- package/dist/analysis-core/chunks/NCWEOJVJ.js +6 -0
- package/dist/analysis-core/chunks/O652FQQH.js +1 -0
- package/dist/analysis-core/chunks/OFBJNHC6.js +1 -0
- package/dist/analysis-core/chunks/PYKAERZZ.js +1 -0
- package/dist/analysis-core/chunks/QDYMR6KS.js +1 -0
- package/dist/analysis-core/chunks/QMIXCT62.js +1 -0
- package/dist/analysis-core/chunks/QV2EOS7U.js +1 -0
- package/dist/analysis-core/chunks/SL27GMEN.js +1 -0
- package/dist/analysis-core/chunks/STZOC7LN.js +1 -0
- package/dist/analysis-core/chunks/T2SAP7OV.js +60 -0
- package/dist/analysis-core/chunks/T5TREZCQ.js +1 -0
- package/dist/analysis-core/chunks/T66VDFXF.js +1 -0
- package/dist/analysis-core/chunks/TDNTU4TF.js +1 -0
- package/dist/analysis-core/chunks/U5HOEVPE.js +1 -0
- package/dist/analysis-core/chunks/UEWL3GMQ.js +1 -0
- package/dist/analysis-core/chunks/V7BFUTM7.js +1 -0
- package/dist/analysis-core/chunks/VGYWI4X2.js +1 -0
- package/dist/analysis-core/chunks/Y7JGSUOA.js +1 -0
- package/dist/analysis-core/chunks/ZAA44GPI.js +1 -0
- package/dist/analysis-core/contracts/requests.js +1 -0
- package/dist/analysis-core/conventions/analysis-fit.js +1 -0
- package/dist/analysis-core/conventions/file-admission.js +1 -0
- package/dist/analysis-core/data/finding-types.js +1 -0
- package/dist/analysis-core/errors.js +1 -0
- package/dist/analysis-core/findings/presentation.js +1 -0
- package/dist/analysis-core/github/repo-key.js +1 -0
- package/dist/analysis-core/import/outside-loader-sources.js +1 -0
- package/dist/analysis-core/index.js +6 -0
- package/dist/analysis-core/llm/cache-policy.js +1 -0
- package/dist/analysis-core/llm/cost.js +1 -0
- package/dist/analysis-core/llm/execution.js +1 -0
- package/dist/analysis-core/llm/output-limit.js +1 -0
- package/dist/analysis-core/llm/slots.js +1 -0
- package/dist/analysis-core/llm/stable-json.js +1 -0
- package/dist/analysis-core/llm/structured-output-error.js +1 -0
- package/dist/analysis-core/map-limit.js +1 -0
- package/dist/analysis-core/requests/answer-formats.js +1 -0
- package/dist/analysis-core/requests/check-diagnostics.js +1 -0
- package/dist/analysis-core/requests/headline-request.js +1 -0
- package/dist/analysis-core/requests/instruction-text.js +1 -0
- package/dist/analysis-core/requests/local-plan.js +1 -0
- package/dist/analysis-core/requests/registry.js +1 -0
- package/dist/analysis-core/requests/schema-descriptions.js +1 -0
- package/dist/analysis-core/requests/shape-finding-input.js +1 -0
- package/dist/analysis-core/requests/template-version.js +1 -0
- package/dist/analysis-core/requests/tools.js +1 -0
- package/dist/analysis-core/settings.js +1 -0
- package/dist/bundle/seal/deserialise.js +75 -0
- package/dist/bundle/seal/encryption.js +25 -0
- package/dist/bundle/seal/metadata.js +69 -0
- package/dist/bundle/seal/open.js +38 -0
- package/dist/bundle/seal/planned-calls.js +20 -0
- package/dist/bundle/seal/signature.js +51 -0
- package/dist/cli/agent-folder.js +17 -0
- package/dist/cli/api-types.js +2 -0
- package/dist/cli/api.js +1 -0
- package/dist/{claude-code-permission.js → cli/claude-code-permission.js} +4 -3
- package/dist/cli/commands/analyze.js +75 -0
- package/dist/cli/commands/login.js +51 -0
- package/dist/cli/completion-recovery.js +18 -0
- package/dist/{context.js → cli/context.js} +8 -14
- package/dist/cli/development-relay.js +34 -0
- package/dist/cli/email-sign-in.js +56 -0
- package/dist/{git.js → cli/git.js} +12 -8
- package/dist/cli/intake-payload.js +18 -0
- package/dist/{main.js → cli/main.js} +23 -12
- package/dist/{mcp.js → cli/mcp.js} +109 -40
- package/dist/cli/output.js +10 -0
- package/dist/cli/relay-check.js +239 -0
- package/dist/cli/relay-preparation.js +33 -0
- package/dist/cli/sign-in-input.js +97 -0
- package/dist/{sign-in.js → cli/sign-in.js} +2 -1
- package/dist/cli/suggested-email.js +10 -0
- package/dist/cli/summary.js +30 -0
- package/dist/contract/cli-api-messages.js +5 -0
- package/dist/contract/cli-refusals.js +24 -0
- package/dist/contract/cli-version.js +1 -0
- package/dist/contract/console-url.js +8 -0
- package/dist/contract/console.js +131 -0
- package/dist/contract/email-sign-in-messages.js +18 -0
- package/dist/contract/messages.js +252 -0
- package/dist/contract/release-key.js +2 -0
- package/dist/contract/runtime-environment.js +37 -0
- package/dist/core/analysis/finding-quality/config.js +4 -0
- package/dist/core/analysis/run-to-end.js +55 -0
- package/dist/core/analysis/structural-run.js +16 -0
- package/dist/gatekeeper/attestation.js +67 -0
- package/dist/gatekeeper/certificate-algorithms.js +18 -0
- package/dist/gatekeeper/certificate-path.js +99 -0
- package/dist/gatekeeper/cli-api.js +174 -0
- package/dist/gatekeeper/client.js +76 -0
- package/dist/gatekeeper/connection-exchange.js +61 -0
- package/dist/gatekeeper/connection.js +140 -0
- package/dist/gatekeeper/console.js +175 -0
- package/dist/gatekeeper/loopback.js +5 -0
- package/dist/gatekeeper/model.js +70 -0
- package/dist/gatekeeper/production-attestation.js +149 -0
- package/dist/gatekeeper/trust/hardware.js +21 -0
- package/dist/gatekeeper/trust/policy.js +42 -0
- package/dist/gatekeeper/trust/production.json +25 -0
- package/dist/setup-pings/client.js +31 -0
- package/dist/setup-pings/contract.js +2 -0
- package/dist/setup-pings/policy.js +3 -0
- package/dist/setup-pings/state.js +261 -0
- package/dist/setup-pings/worker.js +95 -0
- package/dist/transport/base64url.js +9 -0
- package/dist/transport/http-response.js +89 -0
- package/dist/transport/tls-exporter.js +5 -0
- package/package.json +57 -11
- package/LICENSE +0 -1
- package/dist/api-types.js +0 -2
- package/dist/api.js +0 -97
- package/dist/commands/check.js +0 -104
- package/dist/commands/login.js +0 -9
- package/dist/files.js +0 -99
- package/dist/gitignore.js +0 -70
- package/dist/output.js +0 -23
- package/dist/secret-files.js +0 -5
- /package/dist/{browser.js → cli/browser.js} +0 -0
- /package/dist/{commands → cli/commands}/balance.js +0 -0
- /package/dist/{commands → cli/commands}/finding.js +0 -0
- /package/dist/{commands → cli/commands}/logout.js +0 -0
- /package/dist/{credentials.js → cli/credentials.js} +0 -0
package/README.md
CHANGED
|
@@ -1,66 +1,200 @@
|
|
|
1
|
-
#
|
|
1
|
+
# counterfact-local
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Counterfact analysis that runs on the customer's machine. In a source checkout, the development runner reads a local
|
|
4
|
+
folder, sends selected analysis inputs directly to Anthropic with your developer key, and saves the results locally.
|
|
5
|
+
The customer CLI archive contains compiled analysis code and a signed encrypted instruction bundle. Relay execution
|
|
6
|
+
needs no provider key or readable instructions locally. The installed command connects through the production gatekeeper and saves only cleaned findings and their provenance
|
|
7
|
+
to the console. An analysis charges the balance directly; it has no price confirmation step. Reviewed public release pins are required before it can run.
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
The local and hosted products remain supported. Shared rules and request instructions live in this repository's
|
|
10
|
+
private workspace package, `@counterfact-labs/analysis-core`. A future pinned release will let the hosted product
|
|
11
|
+
use this owner after benchmark parity and a tested rollback; this workspace move does not switch hosted analysis.
|
|
12
|
+
|
|
13
|
+
## Run a local analysis
|
|
14
|
+
|
|
15
|
+
Use Node.js 22 or later and install the pinned dependencies:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm ci
|
|
9
19
|
```
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
Set `ANTHROPIC_API_KEY` in your shell to your Anthropic development key, then run these commands from this checkout:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx tsx cli/check.ts --help
|
|
25
|
+
npx tsx cli/check.ts /path/to/agent
|
|
26
|
+
npx tsx cli/check.ts /path/to/agent --output /path/to/results
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Analysis makes paid model calls and needs a provider connection. The command reads source files without modifying
|
|
30
|
+
them, prints a readable summary, and writes `findings.json` and `summary.md` to the agent's `.counterfact/` directory
|
|
31
|
+
by default. `--output` chooses another directory. Reports can contain source excerpts; existing reports at those
|
|
32
|
+
paths are replaced after a completed analysis. Exit status is zero when analysis completes, including when it finds
|
|
33
|
+
problems, and nonzero for invalid arguments, a missing key or a failed run.
|
|
34
|
+
|
|
35
|
+
For a free run of the complete findings flow using committed recordings, with no key or network access:
|
|
12
36
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
counterfact-labs check ./support-agent --yes
|
|
16
|
-
counterfact-labs finding <finding-id>
|
|
17
|
-
counterfact-labs balance
|
|
18
|
-
counterfact-labs logout
|
|
37
|
+
```bash
|
|
38
|
+
npm run bench:replay
|
|
19
39
|
```
|
|
20
40
|
|
|
21
|
-
|
|
41
|
+
The replay prints precision, recall and comparison with the saved baseline, and fails if either score leaves its noise
|
|
42
|
+
band. It cannot buy missing model answers. See [how local analysis works](docs/how-local-analysis-works.md) for file
|
|
43
|
+
selection, limits, switches and request construction.
|
|
22
44
|
|
|
23
|
-
|
|
45
|
+
The current code lives in `packages/core/` (shared rules, types, requests and trusted instructions),
|
|
46
|
+
`cli/` (runner and summary), `core/` (local model-driving steps and orchestration), `adapters/` (runtime I/O), `bundle/` (local
|
|
47
|
+
instruction loading, execution wiring and sealing), and `bench/` (offline parity checks). The
|
|
48
|
+
[canonical analysis guide](packages/core/docs/how-we-analyze-an-agent.md) explains shared rules. Working rules are in
|
|
49
|
+
[AGENTS.md](AGENTS.md); copied-code sources are in [provenance.md](docs/provenance.md).
|
|
24
50
|
|
|
25
|
-
|
|
51
|
+
## Running the tests
|
|
26
52
|
|
|
27
|
-
|
|
53
|
+
```bash
|
|
54
|
+
npm run typecheck
|
|
55
|
+
npm run lint
|
|
56
|
+
npm test
|
|
57
|
+
```
|
|
28
58
|
|
|
29
|
-
|
|
59
|
+
Tests use scripted answers, fake transports and committed recordings, with no real model calls. The instruction guard
|
|
60
|
+
runs with `npm test`, or by itself:
|
|
30
61
|
|
|
31
|
-
```
|
|
32
|
-
|
|
62
|
+
```bash
|
|
63
|
+
npx tsx --test core/instruction-text.test.ts core/test/instruction-text.test.ts
|
|
33
64
|
```
|
|
34
65
|
|
|
35
|
-
|
|
66
|
+
## Verify live API acceptance
|
|
67
|
+
|
|
68
|
+
With `ANTHROPIC_API_KEY` set, this developer command sends one request for every registered template and answer
|
|
69
|
+
format, using the committed fictional Golu example and production model choices:
|
|
36
70
|
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
command = "npx"
|
|
40
|
-
args = ["-y", "@counterfact-labs/cli@latest", "mcp"]
|
|
41
|
-
tool_timeout_sec = 900
|
|
71
|
+
```bash
|
|
72
|
+
npx tsx scripts/relay/live-acceptance.ts --budget-ledger /tmp/relay-acceptance-budget.json
|
|
42
73
|
```
|
|
43
74
|
|
|
44
|
-
|
|
75
|
+
It prints JSON with each route's acceptance or exact API error and measured dollar cost, and exits nonzero if any
|
|
76
|
+
request was not accepted. Output is limited to 64 tokens per request; incomplete answers still establish API
|
|
77
|
+
acceptance. The persistent ledger reserves counted input and maximum output before spending, with a hard $3 cap.
|
|
78
|
+
Reuse the ledger to preserve that cap across invocations; each run gives its entries a unique run identifier.
|
|
79
|
+
Duplicate entries report `duplicate_entry` rather than `budget`; uncertain charges still stop further spending.
|
|
80
|
+
The ledger holds a `<ledger-file>.lock` file while running. If a run is killed and later runs print
|
|
81
|
+
`Live acceptance failed.`, remove only that lock file after confirming no capture process is still running.
|
|
82
|
+
Keep the ledger itself so earlier spending and uncertain charges remain reserved.
|
|
83
|
+
Second opinions are disabled in local analysis, so that registered route uses the existing Anthropic parity
|
|
84
|
+
fixture's checker model. This command is separate from offline tests and must be run explicitly.
|
|
85
|
+
|
|
86
|
+
## Use the published CLI
|
|
87
|
+
|
|
88
|
+
The package is `@counterfact-labs/cli` 0.2.0 and requires Node.js 22 or later. Its executable is
|
|
89
|
+
`counterfact-labs`. Login keeps browser sign-in and adds `--email` and verify-only `--code`. MCP adds
|
|
90
|
+
`sign_in_with_code` and optional email arguments; logout, balance and finding lookup retain their commands and tool names.
|
|
91
|
+
With `CF_EMAIL_SIGN_IN=0`, login help, arguments and the full MCP tool/status contract retain their previous behavior.
|
|
92
|
+
`mcp` exposes `analyze_agent` and reports `analyzeToolAllowed`; the old analysis command and tool names are refused.
|
|
93
|
+
`analyze [path]` runs locally through the relay; `--yes`, `--dry-run`, and the MCP
|
|
94
|
+
`confirm` argument are removed. Each requested analysis runs once without a price prompt. Prices belong on the website
|
|
95
|
+
and top-up page; an uncovered balance refuses with a top-up link.
|
|
96
|
+
|
|
97
|
+
The archive also ships `bundle/client-release.json` with its public Ed25519 verification key and local/relay versions,
|
|
98
|
+
and the gatekeeper's public production trust policy. Production trust has no environment override. With exactly
|
|
99
|
+
`CF_RELAY_DEV=1`, development startup accepts separate issuer trust, a bundle and public release pins through
|
|
100
|
+
`CF_RELAY_DEV_TRUST`, `CF_RELAY_DEV_BUNDLE` and `CF_RELAY_DEV_RELEASE`. This exception permits only HTTPS loopback
|
|
101
|
+
connections (`localhost`, `127.x.x.x` or `::1`) and does not establish sealed execution.
|
|
102
|
+
The checked-in release pins and production image trust remain unconfigured; installing reviewed pins and ciphertext
|
|
103
|
+
is a release prerequisite.
|
|
104
|
+
|
|
105
|
+
The npx commands below work once 0.2.0 is tagged `latest`.
|
|
106
|
+
Use npx to run the newest release:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx -y @counterfact-labs/cli@latest login
|
|
110
|
+
npx -y @counterfact-labs/cli@latest balance
|
|
111
|
+
npx -y @counterfact-labs/cli@latest analyze ./agent
|
|
112
|
+
npx -y @counterfact-labs/cli@latest finding <id>
|
|
113
|
+
npx -y @counterfact-labs/cli@latest mcp
|
|
114
|
+
```
|
|
45
115
|
|
|
46
|
-
|
|
116
|
+
To sign in with an emailed code, run:
|
|
47
117
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Always show the returned sign-in link and code, so I can sign in on any device.
|
|
51
|
-
When I ask to check an agent, use Counterfact's check_agent tool with its folder path.
|
|
52
|
-
Call it without confirm first. Show me the selected files and price, and get my
|
|
53
|
-
agreement before calling again with confirm: true. If the files or price change,
|
|
54
|
-
show me a fresh preview and ask again. Use get_finding for an explanation, quoted
|
|
55
|
-
lines and suggested fixes. Use get_balance for the balance and top-up link.
|
|
56
|
-
After editing prompts, skills or tool definitions, suggest a check and wait for
|
|
57
|
-
me to ask for it.
|
|
118
|
+
```bash
|
|
119
|
+
npx -y @counterfact-labs/cli@latest login --email reader@example.test
|
|
58
120
|
```
|
|
59
121
|
|
|
60
|
-
|
|
122
|
+
Enter the code from your email when prompted. Without a terminal, this command sends the code and prints how to finish. Complete sign-in with:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx -y @counterfact-labs/cli@latest login --email reader@example.test --code <code>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The command saves your sign-in on this computer. Run login without --email to use browser sign-in.
|
|
129
|
+
|
|
130
|
+
Passing --code puts the code in process arguments and may leave it in your shell history. Use the hidden terminal prompt to avoid that.
|
|
61
131
|
|
|
62
|
-
|
|
132
|
+
Set CF_EMAIL_SIGN_IN=0 before starting the command or MCP server to restore the original browser sign-in tools and terminal commands. Restart the MCP server after changing this setting.
|
|
63
133
|
|
|
64
|
-
|
|
134
|
+
MCP sign_in_with_code receives the code as a tool argument, so it remains in your MCP client's transcript. Counterfact does not repeat it in tool results, logs, or reports. Use the hidden terminal prompt if you want to keep the code out of the MCP transcript.
|
|
135
|
+
|
|
136
|
+
Or install globally: `npm install -g @counterfact-labs/cli@latest`.
|
|
137
|
+
|
|
138
|
+
If you use Claude Code's sandbox, allow relay.counterfactlabs.com and app.counterfactlabs.com when Claude Code asks,
|
|
139
|
+
or add both to the sandbox's allowed domains.
|
|
140
|
+
|
|
141
|
+
The command uses the existing saved sign-in and sends `X-Counterfact-CLI-Version: 0.2.0`. It asks
|
|
142
|
+
`/api/cli/checks/mode` before reading source or starting paid work. Upload, paused, update-required and unavailable
|
|
143
|
+
responses stop the analysis; the command never falls back to uploading files. Settings are captured at command start.
|
|
144
|
+
The analysis uses a committed Git folder. Admitted files must match that commit; unrelated local output files are ignored.
|
|
145
|
+
The console owns prices, expressed in millionths of a dollar.
|
|
146
|
+
|
|
147
|
+
The installed command uses the relay address in `bundle/client-release.json` and saved sign-in. The relay runner sends
|
|
148
|
+
repository facts and the admitted file list (paths and sizes, without contents or absolute checkout paths) to
|
|
149
|
+
`POST /api/cli/checks` to start local analysis. The console decides the project and returns its id. Development can
|
|
150
|
+
override `CF_RELAY_URL`; normal use needs no transport switches or provider key. `COUNTERFACT_URL` retains the
|
|
151
|
+
development server override.
|
|
152
|
+
|
|
153
|
+
Release stays blocked while `relayUrl` and `projectContext` are unconfigured in the checked-in metadata. Set
|
|
154
|
+
`projectContext` to `checks` only after local start support is reviewed. The release validator requires both settings
|
|
155
|
+
along with the signed bundle and trust pins; an environment override cannot bypass the project-context pin.
|
|
156
|
+
|
|
157
|
+
## Build and release the customer CLI archive
|
|
158
|
+
|
|
159
|
+
Generate `bundle/sealed.json` with the existing release tooling and externally supplied release keys. Install the
|
|
160
|
+
reviewed public verification key, matching local/relay versions, HTTPS relay origin and reviewed project-context support
|
|
161
|
+
in `bundle/client-release.json`, and the reviewed
|
|
162
|
+
production trust policy in `gatekeeper/trust/production.json`. These trust files cannot be overridden through the
|
|
163
|
+
environment. Then run:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run release:cli
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The release command builds, packs, verifies the archive contents and prints its SHA-256 hash. Only compiled runtime
|
|
170
|
+
modules, the encrypted bundle and release metadata ship, together with npm's mandatory package metadata and README.
|
|
171
|
+
The trusted core remains a development dependency; its readable instructions are excluded from the installed CLI.
|
|
172
|
+
The installed runtime dependencies also exclude TypeScript. The trusted shared-core archive used by hosted
|
|
173
|
+
integrations continues to ship its readable instructions.
|
|
174
|
+
The archive exposes `@counterfact-labs/cli/gatekeeper` for injected verified connections.
|
|
175
|
+
|
|
176
|
+
The release workflow runs only through a manual GitHub Actions trigger and publishes the verified archive with
|
|
177
|
+
`--tag next`, using the `NPM_TOKEN` secret. It refuses unconfigured bundle and trust pins. No release or publish is
|
|
178
|
+
performed by this implementation task. After the launch decision, move the public default explicitly:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm dist-tag add @counterfact-labs/cli@0.2.0 latest
|
|
182
|
+
```
|
|
65
183
|
|
|
66
|
-
|
|
184
|
+
The source-only `cli/check.ts` development runner accepts `CF_LOCAL_RELAY=1`, `CF_RELAY_URL`, `CF_CONSOLE_URL`,
|
|
185
|
+
and `CF_CONSOLE_TOKEN`. Other switch values retain direct source execution. The installed command
|
|
186
|
+
uses the saved sign-in and release configuration described above. Completed runs save local reports and a private
|
|
187
|
+
`completion.json` record containing the exact findings payload and analysis identity, with no bearer or reservation
|
|
188
|
+
capability. A pending upload is retried on the next invocation using current credentials. The source runner's
|
|
189
|
+
`--retry-upload` explicitly retries a previously completed upload without buying another analysis. Keep this record
|
|
190
|
+
private because findings can contain excerpts. The source runner prints the saved analysis id and project findings
|
|
191
|
+
link; the installed command prints finding ids and the full-results link. Failures report only trusted settlement/status
|
|
192
|
+
facts; a local error cannot promise a refund. Customer source
|
|
193
|
+
files travel only through the gatekeeper to the attested relay. Relay failures stop the run.
|
|
194
|
+
|
|
195
|
+
Offline package tests install real archives in a clean temporary directory, inspect the installed dependencies for
|
|
196
|
+
readable instructions, run the linked executable and complete the analysis stages with a scripted provider and an
|
|
197
|
+
injected verified connection. A separate end-to-end test uses real loopback gatekeeper TLS and the real relay runtime.
|
|
198
|
+
Server storage and settlement still require the disposable PostgreSQL integration run.
|
|
199
|
+
Reviewed server compatibility for variable-size check batches, split scope limits, settings-selected variants and the
|
|
200
|
+
optional headline stage remains a launch gate; offline fakes do not establish those production contracts.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"verificationKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAbBab1PYdmBKXxCvoJ47toJhQvxPevo9nlZnb0zbDWoc=\n-----END PUBLIC KEY-----\n",
|
|
3
|
+
"relayVersion": "relay-1.0.1",
|
|
4
|
+
"localVersion": "0.2.4",
|
|
5
|
+
"relayUrl": "https://relay.counterfactlabs.com:8443",
|
|
6
|
+
"projectContext": "checks"
|
|
7
|
+
}
|