@momentiq/dark-factory-cli 1.0.0 → 2.0.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 +121 -40
- package/dist/adapters/codex-sdk.d.ts +66 -0
- package/dist/adapters/codex-sdk.d.ts.map +1 -1
- package/dist/adapters/codex-sdk.js +321 -4
- package/dist/adapters/codex-sdk.js.map +1 -1
- package/dist/adapters/critic-result-schema.d.ts +15 -10
- package/dist/adapters/critic-result-schema.d.ts.map +1 -1
- package/dist/adapters/critic-result-schema.js +10 -0
- package/dist/adapters/critic-result-schema.js.map +1 -1
- package/dist/adapters/cursor-cli.d.ts +19 -1
- package/dist/adapters/cursor-cli.d.ts.map +1 -1
- package/dist/adapters/cursor-cli.js +96 -14
- package/dist/adapters/cursor-cli.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/static-schema-lint.d.ts +68 -0
- package/dist/adapters/static-schema-lint.d.ts.map +1 -0
- package/dist/adapters/static-schema-lint.js +813 -0
- package/dist/adapters/static-schema-lint.js.map +1 -0
- package/dist/branch-protection/spec-default.yaml +2 -2
- package/dist/cli.d.ts +17 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +414 -113
- package/dist/cli.js.map +1 -1
- package/dist/commands/findings.d.ts +6 -0
- package/dist/commands/findings.d.ts.map +1 -0
- package/dist/commands/findings.js +196 -0
- package/dist/commands/findings.js.map +1 -0
- package/dist/commands/show.d.ts +11 -0
- package/dist/commands/show.d.ts.map +1 -0
- package/dist/commands/show.js +78 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/skills.d.ts +6 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +248 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +85 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/compact/index.d.ts +2 -0
- package/dist/compact/index.d.ts.map +1 -0
- package/dist/compact/index.js +3 -0
- package/dist/compact/index.js.map +1 -0
- package/dist/compact/lockfile.d.ts +53 -0
- package/dist/compact/lockfile.d.ts.map +1 -0
- package/dist/compact/lockfile.js +626 -0
- package/dist/compact/lockfile.js.map +1 -0
- package/dist/cycle-doc-validator/validate_cycle_doc.py +39 -9
- package/dist/doctor.d.ts +51 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +497 -1
- package/dist/doctor.js.map +1 -1
- package/dist/evidence/docker-build.d.ts +6 -0
- package/dist/evidence/docker-build.d.ts.map +1 -0
- package/dist/evidence/docker-build.js +199 -0
- package/dist/evidence/docker-build.js.map +1 -0
- package/dist/evidence/index.d.ts +1 -0
- package/dist/evidence/index.d.ts.map +1 -1
- package/dist/evidence/index.js +6 -0
- package/dist/evidence/index.js.map +1 -1
- package/dist/handoff/handoff-verb.d.ts.map +1 -1
- package/dist/handoff/handoff-verb.js +6 -3
- package/dist/handoff/handoff-verb.js.map +1 -1
- package/dist/handoff/ports.d.ts +8 -0
- package/dist/handoff/ports.d.ts.map +1 -1
- package/dist/handoff/real-clients.js +1 -1
- package/dist/handoff/real-clients.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/show-status-core.d.ts +63 -0
- package/dist/lib/show-status-core.d.ts.map +1 -0
- package/dist/lib/show-status-core.js +156 -0
- package/dist/lib/show-status-core.js.map +1 -0
- package/dist/mcp/prompts.d.ts.map +1 -1
- package/dist/mcp/prompts.js +113 -78
- package/dist/mcp/prompts.js.map +1 -1
- package/dist/mcp/resources.js +1 -1
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/doctor.d.ts.map +1 -1
- package/dist/mcp/tools/doctor.js +5 -0
- package/dist/mcp/tools/doctor.js.map +1 -1
- package/dist/mcp/tools/findings.d.ts +0 -22
- package/dist/mcp/tools/findings.d.ts.map +1 -1
- package/dist/mcp/tools/findings.js +5 -73
- package/dist/mcp/tools/findings.js.map +1 -1
- package/dist/mcp/tools/handoff.d.ts.map +1 -1
- package/dist/mcp/tools/handoff.js +10 -17
- package/dist/mcp/tools/handoff.js.map +1 -1
- package/dist/mcp/tools/review-bypass.d.ts.map +1 -1
- package/dist/mcp/tools/review-bypass.js +22 -1
- package/dist/mcp/tools/review-bypass.js.map +1 -1
- package/dist/mcp/tools/skills-install.d.ts +6 -0
- package/dist/mcp/tools/skills-install.d.ts.map +1 -0
- package/dist/mcp/tools/skills-install.js +260 -0
- package/dist/mcp/tools/skills-install.js.map +1 -0
- package/dist/mcp/tools/stats-gate.d.ts.map +1 -1
- package/dist/mcp/tools/stats-gate.js +63 -15
- package/dist/mcp/tools/stats-gate.js.map +1 -1
- package/dist/policy/baseline.d.ts.map +1 -1
- package/dist/policy/baseline.js +11 -3
- package/dist/policy/baseline.js.map +1 -1
- package/dist/policy/gate.d.ts +1 -1
- package/dist/policy/gate.d.ts.map +1 -1
- package/dist/policy/gate.js +96 -12
- package/dist/policy/gate.js.map +1 -1
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +123 -4
- package/dist/prompt.js.map +1 -1
- package/dist/report.d.ts +130 -3
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +367 -10
- package/dist/report.js.map +1 -1
- package/dist/runner.d.ts +6 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +213 -4
- package/dist/runner.js.map +1 -1
- package/dist/self-consistency.d.ts +144 -0
- package/dist/self-consistency.d.ts.map +1 -0
- package/dist/self-consistency.js +368 -0
- package/dist/self-consistency.js.map +1 -0
- package/dist/skills/config.d.ts +176 -0
- package/dist/skills/config.d.ts.map +1 -0
- package/dist/skills/config.js +251 -0
- package/dist/skills/config.js.map +1 -0
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +8 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/install.d.ts +62 -0
- package/dist/skills/install.d.ts.map +1 -0
- package/dist/skills/install.js +315 -0
- package/dist/skills/install.js.map +1 -0
- package/dist/skills/template.d.ts +42 -0
- package/dist/skills/template.d.ts.map +1 -0
- package/dist/skills/template.js +95 -0
- package/dist/skills/template.js.map +1 -0
- package/dist/trusted-surface/rebind.d.ts.map +1 -1
- package/dist/trusted-surface/rebind.js +199 -2
- package/dist/trusted-surface/rebind.js.map +1 -1
- package/package.json +36 -2
- package/skills/README.md +89 -0
- package/skills/chief-engineer-blitz/SKILL.md.tmpl +443 -0
- package/skills/chief-engineer-blitz/skill.json +53 -0
- package/skills/chief-engineer-review/SKILL.md.tmpl +184 -0
- package/skills/chief-engineer-review/references/review-examples.md.tmpl +130 -0
- package/skills/chief-engineer-review/skill.json +67 -0
- package/skills/chief-engineer-review/templates/code-review-prompt.md.tmpl +111 -0
- package/skills/chief-engineer-review/templates/escalation-prompt.md.tmpl +56 -0
- package/skills/chief-engineer-review/templates/plan-review-prompt.md.tmpl +74 -0
- package/skills/skill-schema.json +73 -0
package/README.md
CHANGED
|
@@ -4,9 +4,8 @@ Dark Factory OSS CLI — multi-vendor adversarial critic orchestration.
|
|
|
4
4
|
|
|
5
5
|
## What this package gives you
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
subcommands:
|
|
7
|
+
Nine Dark Factory services, consumable as a TypeScript library and (where
|
|
8
|
+
relevant) as `df` subcommands:
|
|
10
9
|
|
|
11
10
|
1. **Critic Orchestrator** (`./adapters/*`) — vendor-neutral adapter contract
|
|
12
11
|
(`CriticAdapter`) with concrete adapters for Cursor SDK, OpenAI Codex SDK,
|
|
@@ -23,33 +22,31 @@ subcommands:
|
|
|
23
22
|
5. **Cycle-Doc Trailer Validator** (`./cycle-doc-validator/*` + `df validate-cycle-doc`)
|
|
24
23
|
— enforces per-PR `Cycle:` / `Issue:` / `ProjectItem:` trailer rules.
|
|
25
24
|
6. **Merge Queue Admission Policy** (`./policy/merge-queue.ts` + `df admit-pr`) —
|
|
26
|
-
plan-vs-code PR classifier
|
|
27
|
-
|
|
28
|
-
`
|
|
29
|
-
|
|
25
|
+
plan-vs-code PR classifier + the typed ruleset shape
|
|
26
|
+
(`defaultMainRulesetShape`, `defaultCeReviewRulesetShape`,
|
|
27
|
+
`defaultMergeQueueRule`) that consumers declare so the branch-protection
|
|
28
|
+
auditor can detect drift against it.
|
|
30
29
|
7. **Branch-Protection Drift Detector** (`./branch-protection/*` + `df audit-branch-protection`)
|
|
31
30
|
— compares a declarative `spec.yaml` against the live GitHub ruleset.
|
|
32
31
|
8. **Audit / Compliance Trail** (`./evidence/audit-trail.ts` + `df audit stats`) —
|
|
33
32
|
the `_runs.ndjson` NDJSON sink + read/summarize/agreement-rate/quorum-stats
|
|
34
|
-
helpers behind
|
|
35
|
-
|
|
33
|
+
helpers behind `make agent-review-stats`. Every critic run, every gate
|
|
34
|
+
verdict, every bypass invocation appends here.
|
|
36
35
|
9. **Cycle Tracker Sync + PR Attribution** (`./cycle-tracker-sync/*` + `df sync-trackers` + `df attribute-pr`)
|
|
37
36
|
— reconciles GitHub tracker issues with cycle docs + writes the
|
|
38
37
|
`Cycle Ref` custom field on PR project items.
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
critic / aggregator logic lands in Phase F.
|
|
39
|
+
The package also ships five reusable GitHub Actions workflows
|
|
40
|
+
(`.github/workflows/*.yml`) that consumers wire up via `uses:`. See the
|
|
41
|
+
[root README](../../README.md#reusable-workflows) for the consumer wiring
|
|
42
|
+
pattern.
|
|
45
43
|
|
|
46
44
|
## Status
|
|
47
45
|
|
|
48
|
-
`
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`df critic` subcommand is the CI cold-path API-key version.
|
|
46
|
+
`1.0.0` — shipped on npm. Library API + the hook-facing binary surface
|
|
47
|
+
(`review`, `gate-push`, `doctor`, `gates`, `stats`) are stable. The
|
|
48
|
+
`df critic` subcommand is the CI cold-path (API-key) counterpart to the
|
|
49
|
+
subscription-auth local hooks.
|
|
53
50
|
|
|
54
51
|
## Install
|
|
55
52
|
|
|
@@ -87,44 +84,56 @@ await runValidateCycleDoc({
|
|
|
87
84
|
df --help
|
|
88
85
|
df --version
|
|
89
86
|
|
|
90
|
-
#
|
|
91
|
-
# script verbatim, so `df <sub> --help` returns the Python argparse
|
|
87
|
+
# Python-backed subcommands — each forwards remaining argv to the bundled
|
|
88
|
+
# Python script verbatim, so `df <sub> --help` returns the Python argparse
|
|
89
|
+
# banner.
|
|
92
90
|
df validate-cycle-doc --help
|
|
93
91
|
df audit-branch-protection --use-bundled-default-spec --repo owner/repo
|
|
94
92
|
df sync-trackers --dry-run
|
|
95
93
|
df attribute-pr # env-driven; needs PR_NUMBER, PR_NODE_ID, PR_BODY_FILE, PROJECT_TOKEN
|
|
96
94
|
|
|
97
|
-
#
|
|
95
|
+
# Pure-TS subcommands.
|
|
98
96
|
df audit stats --path .git/agent-reviews/_runs.ndjson
|
|
99
97
|
df admit-pr --files-stdin # newline-separated file paths on stdin
|
|
100
|
-
df admit-pr --files docs/roadmap/cycles/
|
|
98
|
+
df admit-pr --files docs/roadmap/cycles/cycle1.md,packages/cli/src/cli.ts
|
|
101
99
|
|
|
102
|
-
#
|
|
100
|
+
# Hook-facing subcommands (subscription cost model).
|
|
103
101
|
df review --commit HEAD --profile local --foreground
|
|
104
|
-
df gate-push # local pre-push, reads stdin
|
|
102
|
+
df gate-push # local pre-push, reads stdin (default: gate HEAD only)
|
|
103
|
+
df gate-push --full-range # legacy: gate every commit in the push range
|
|
105
104
|
df gate-push --commit HEAD --ci # CI replay
|
|
106
105
|
df doctor --profile local # env + per-adapter auth check
|
|
107
106
|
df gates # static gates, no LLM
|
|
108
107
|
df stats # alias for `df audit stats`
|
|
109
108
|
|
|
110
|
-
#
|
|
111
|
-
|
|
109
|
+
# Audit-mode inspection (NOT a gate).
|
|
110
|
+
df findings --range origin/main..HEAD # per-commit findings for the range
|
|
111
|
+
df findings --range origin/main..HEAD --json # df_findings-shaped JSON array
|
|
112
|
+
|
|
113
|
+
# Stdio Model Context Protocol server — exposes the CLI surface to any
|
|
114
|
+
# MCP-speaking agent.
|
|
112
115
|
df mcp # start the stdio MCP server
|
|
113
116
|
df mcp --help # config snippets for Claude Code, Cursor, Codex
|
|
117
|
+
|
|
118
|
+
# Bundled-skill installer (consumer-shape — implements DFP #192).
|
|
119
|
+
df skills list # list bundled skills (name, version, summary)
|
|
120
|
+
df skills install <name> # render + write .claude/skills/<name>/
|
|
121
|
+
df skills install --all # install every skill declared `enabled: true`
|
|
122
|
+
# in darkfactory.yaml
|
|
123
|
+
df skills install <name> --force # overwrite a hand-edited rendered file
|
|
114
124
|
```
|
|
115
125
|
|
|
116
126
|
> **Note on `--use-bundled-default-spec`**: the bundled `spec-default.yaml`
|
|
117
|
-
>
|
|
118
|
-
> `agent-critic
|
|
119
|
-
>
|
|
120
|
-
> repo's own dogfood gate. Consumers SHOULD author their own `spec.yaml`
|
|
127
|
+
> asserts the standard Dark Factory required-status-check contexts (e.g.
|
|
128
|
+
> `agent-critic`, `cycle-doc-validation`). It exists as a working starting
|
|
129
|
+
> point for first-run audits. Consumers SHOULD author their own `spec.yaml`
|
|
121
130
|
> matching their repo's actual posture — running the bundled default
|
|
122
131
|
> against an arbitrary repo will surface drift against contexts that
|
|
123
132
|
> don't exist there.
|
|
124
133
|
|
|
125
134
|
## For consumer repos — hook wiring + subscription cost model
|
|
126
135
|
|
|
127
|
-
The
|
|
136
|
+
The hook-facing subcommands (`review`, `gate-push`, `doctor`, `gates`,
|
|
128
137
|
`stats`) are designed to power consumer repos' `.husky/post-commit` and
|
|
129
138
|
`.husky/pre-push` hooks. The **cost model** is critical: per-commit critic
|
|
130
139
|
invocations from API tokens cost $1000s/week on a busy repo, while
|
|
@@ -136,7 +145,8 @@ Codex / Claude CLI logins) are flat-rate.
|
|
|
136
145
|
| Subcommand | Hook | Cost model |
|
|
137
146
|
| --- | --- | --- |
|
|
138
147
|
| `df review` | `.husky/post-commit` (background) | **Subscription** — consumes Cursor / Codex / Claude CLI logins via the active profile's `auth` pins. No API spend by default. |
|
|
139
|
-
| `df gate-push` | `.husky/pre-push` | Free — reads pre-existing artifacts, no LLM calls. |
|
|
148
|
+
| `df gate-push` | `.husky/pre-push` | Free — reads pre-existing artifacts, no LLM calls. Default (Cycle 13 / dark-factory-platform#149): gates the HEAD commit only; intermediate commits are iteration receipts (`df findings --range` surfaces them un-gated). Opt-in legacy: `--full-range` or `DF_GATE_FULL_RANGE=1` gates every commit in the range. **Soundness caveat:** HEAD's per-SHA artifact reviews `parent..HEAD` only, NOT `base..HEAD` — use `--full-range` or the CI cold-path `agent-critic` workflow (which reviews the full PR diff) when cumulative-state evidence is required. |
|
|
149
|
+
| `df findings --range <base>..<head>` | None (operator-run) | Free. Walks every commit's per-SHA artifact in the range for audit-mode inspection. NOT a gate; does not re-run critics. The companion-surface to the final-commit-only `df gate-push` default. |
|
|
140
150
|
| `df doctor` | None (operator-run) | Free. Validates that per-adapter auth source is reachable. |
|
|
141
151
|
| `df gates` | None (operator-run) | Free. Runs static quality gates per `validation.requiredQualityGates`. |
|
|
142
152
|
| `df stats` | None (operator-run) | Free. Reads `.git/agent-reviews/_runs.ndjson`. |
|
|
@@ -251,12 +261,12 @@ API — see `packages/cli/src/doppler-bootstrap.ts` for the
|
|
|
251
261
|
## System requirements
|
|
252
262
|
|
|
253
263
|
- **Node.js >=20**
|
|
254
|
-
- **Python 3.11+** — required for services #5, #7, #9. The
|
|
255
|
-
|
|
264
|
+
- **Python 3.11+** — required for services #5, #7, #9. The package bundles
|
|
265
|
+
the source Python scripts (`validate_cycle_doc.py`,
|
|
256
266
|
`audit_branch_protection.py`, `sync_cycle_trackers.py`,
|
|
257
267
|
`attribute_pr_cycle_ref.py`) and wraps each in a TypeScript subprocess
|
|
258
|
-
spawn.
|
|
259
|
-
|
|
268
|
+
spawn. A pure-TS rewrite is on the roadmap and will eliminate this
|
|
269
|
+
dependency in a future release.
|
|
260
270
|
- **`gh` CLI** (authenticated) — all four Python scripts shell out to `gh api`
|
|
261
271
|
for GitHub queries. CI invocations provide `GH_TOKEN` / `PROJECT_TOKEN`
|
|
262
272
|
via environment.
|
|
@@ -276,8 +286,79 @@ The bundled Python scripts resolve the consumer repo root in this order:
|
|
|
276
286
|
The TypeScript wrappers set `DF_REPO_ROOT` automatically when a `repoRoot`
|
|
277
287
|
option is supplied — pass it when invoking outside a git worktree.
|
|
278
288
|
|
|
289
|
+
## Bundled skills (`df skills install` — DFP #192)
|
|
290
|
+
|
|
291
|
+
The CLI ships a small set of **consumer-shape templated skills** that any
|
|
292
|
+
repo adopting Dark Factory can install with one command — no fork, no
|
|
293
|
+
hand-edit. The skill body templates live in this repo under `skills/<name>/`;
|
|
294
|
+
the renderer substitutes `{{REPO_NAME}}`, `{{ADR_DIR}}`,
|
|
295
|
+
`{{CYCLE_DOCS_DIR}}`, `{{QUALITY_GATE_TARGETS}}`, etc. against the
|
|
296
|
+
consumer's `darkfactory.yaml` at install time.
|
|
297
|
+
|
|
298
|
+
**Bundled today:**
|
|
299
|
+
|
|
300
|
+
- **`chief-engineer-review`** — AI-native architectural review (autonomous
|
|
301
|
+
+ conversational modes). Originated in `momentiq-ai/sage3c`.
|
|
302
|
+
- **`chief-engineer-blitz`** — orchestrated multi-PR delivery doctrine (six
|
|
303
|
+
phases: Plan → Spec → Implement → Triage → Validate → Closure).
|
|
304
|
+
Originated in `momentiq-ai/dark-factory-platform`.
|
|
305
|
+
|
|
306
|
+
**Consumer setup (one-time per repo):**
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# 1. Author darkfactory.yaml at repo root (see the schema below).
|
|
310
|
+
# 2. Install:
|
|
311
|
+
df skills install --all # installs every skill marked enabled
|
|
312
|
+
# … or one at a time:
|
|
313
|
+
df skills install chief-engineer-review
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**`darkfactory.yaml` schema** (every key optional — install falls back to
|
|
317
|
+
sensible defaults):
|
|
318
|
+
|
|
319
|
+
```yaml
|
|
320
|
+
repo:
|
|
321
|
+
displayName: "My Repo"
|
|
322
|
+
slug: "my-repo"
|
|
323
|
+
ownerRepo: "my-org/my-repo"
|
|
324
|
+
docs:
|
|
325
|
+
manifesto: docs/PRINCIPLES.md
|
|
326
|
+
adrDir: docs/ADR
|
|
327
|
+
cycleDocsDir: docs/roadmap/cycles
|
|
328
|
+
rfcDir: docs/rfcs
|
|
329
|
+
prdDir: docs/prds
|
|
330
|
+
agents:
|
|
331
|
+
chiefEngineer: .claude/agents/chief-engineer.md
|
|
332
|
+
qualityGates:
|
|
333
|
+
- make quality-gates
|
|
334
|
+
- make test
|
|
335
|
+
worktreeRoot: .claude/worktrees
|
|
336
|
+
agentCommitterOrg: my-org # for the claude-code+<handle>@<org>.ai committer
|
|
337
|
+
skills:
|
|
338
|
+
chief-engineer-review:
|
|
339
|
+
enabled: true
|
|
340
|
+
chief-engineer-blitz:
|
|
341
|
+
enabled: true
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Re-install semantics:**
|
|
345
|
+
|
|
346
|
+
- A re-install with identical inputs is a no-op (the rendered file carries
|
|
347
|
+
an `install-hash` in its `GENERATED` header; matching hash → unchanged).
|
|
348
|
+
- A re-install with different inputs (config changed, template upstream
|
|
349
|
+
changed) overwrites the rendered file.
|
|
350
|
+
- A re-install where the rendered file has been hand-edited (no `GENERATED`
|
|
351
|
+
header detected) is **skipped** — pass `--force` to overwrite.
|
|
352
|
+
|
|
353
|
+
**MCP tool parity:** the `df mcp` server exposes `df_skills_install` +
|
|
354
|
+
`df_skills_list` with the same semantics, so MCP-speaking agents (Claude
|
|
355
|
+
Code, Cursor) can install skills programmatically without shelling out.
|
|
356
|
+
|
|
357
|
+
**Adding a new bundled skill:** see `skills/README.md` for the manifest +
|
|
358
|
+
template authoring rules.
|
|
359
|
+
|
|
279
360
|
## License
|
|
280
361
|
|
|
281
|
-
Apache-2.0. The OSS critic surface is a public artifact.
|
|
282
|
-
|
|
283
|
-
|
|
362
|
+
Apache-2.0. The OSS critic surface is a public artifact. The hosted Dark
|
|
363
|
+
Factory runtime layers proprietary calibrated prompts and a calibrated
|
|
364
|
+
bypass-classifier on top of this CLI; those are out-of-scope here.
|
|
@@ -61,6 +61,9 @@ export type CodexExecHook = (binaryPath: string, args: readonly string[], option
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function probeCodexLoginStatus(cliPath: string, exec?: CodexExecHook, timeoutMs?: number): Promise<CodexAuthProbeOutcome>;
|
|
63
63
|
export declare const DEFAULT_REASONING_EFFORT: "high";
|
|
64
|
+
export type CodexSandboxMode = "read-only" | "workspace-write" | "danger-full-access";
|
|
65
|
+
export declare const CODEX_SANDBOX_MODES: readonly CodexSandboxMode[];
|
|
66
|
+
export declare const DEFAULT_SANDBOX_MODE: CodexSandboxMode;
|
|
64
67
|
/**
|
|
65
68
|
* Test-shape compatible with the `@openai/codex-sdk` Codex / Thread
|
|
66
69
|
* classes. The unit tests pass a mock conforming to this shape; production
|
|
@@ -219,6 +222,21 @@ export interface CodexSdkAdapterOptions {
|
|
|
219
222
|
* enum). Exported for direct unit testing.
|
|
220
223
|
*/
|
|
221
224
|
export declare function resolveCodexReasoningEffort(critic: CriticConfig): string;
|
|
225
|
+
/**
|
|
226
|
+
* Issue #68 — resolve the Codex `sandboxMode` from `critic.model.params`.
|
|
227
|
+
*
|
|
228
|
+
* Falls back to {@link DEFAULT_SANDBOX_MODE} ("read-only") when unset OR
|
|
229
|
+
* when the value is malformed (typo, wrong type). The typo-tolerance is
|
|
230
|
+
* intentional: a relaxed sandbox setting silently corrupting an SDK call
|
|
231
|
+
* would be worse than the operator's misconfiguration loudly defaulting
|
|
232
|
+
* to the safe value at review time.
|
|
233
|
+
*
|
|
234
|
+
* Operators opt into `workspace-write` or `danger-full-access` when the
|
|
235
|
+
* container is the security boundary (hosted W3 worker on GKE Autopilot
|
|
236
|
+
* lacks SYS_ADMIN, so bwrap's `read-only` sandbox fails at startup with
|
|
237
|
+
* `bwrap: No permissions to create a new namespace`).
|
|
238
|
+
*/
|
|
239
|
+
export declare function resolveCodexSandboxMode(critic: CriticConfig): CodexSandboxMode;
|
|
222
240
|
/**
|
|
223
241
|
* Probe a thrown error for a Codex SDK structured error code. The
|
|
224
242
|
* Codex SDK surfaces errors as plain `Error` instances; some SDK
|
|
@@ -229,6 +247,54 @@ export declare function resolveCodexReasoningEffort(critic: CriticConfig): strin
|
|
|
229
247
|
* Exported for unit testing.
|
|
230
248
|
*/
|
|
231
249
|
export declare function extractCodexErrorCode(err: unknown): string | null;
|
|
250
|
+
export declare const SANDBOX_INIT_FAILURE_CODE: "sandbox_init_failure";
|
|
251
|
+
/**
|
|
252
|
+
* Issue #109 — scan a string for known environmental sandbox-init
|
|
253
|
+
* failure signatures. Returns the FIRST matching substring (trimmed to
|
|
254
|
+
* the matched line) so the error envelope's detail message carries the
|
|
255
|
+
* actual citation, or `null` if no pattern matches.
|
|
256
|
+
*
|
|
257
|
+
* Pure function — exported for direct unit testing. The conservative
|
|
258
|
+
* pattern list lives in {@link SANDBOX_INIT_FAILURE_PATTERNS} (see the
|
|
259
|
+
* comment there for the "what counts as environmental" contract).
|
|
260
|
+
*/
|
|
261
|
+
export declare function detectSandboxInitFailure(text: string): string | null;
|
|
262
|
+
/**
|
|
263
|
+
* Issue #109 — scan a Codex turn's `items[]` for command_execution
|
|
264
|
+
* outputs whose `aggregated_output` cites a known sandbox-init failure.
|
|
265
|
+
* The codex CLI's bwrap wrapper writes its initialization error to the
|
|
266
|
+
* spawned command's stderr, which the SDK surfaces in the item's
|
|
267
|
+
* `aggregated_output` field. The model then frequently fabricates a
|
|
268
|
+
* CHANGES_REQUESTED finding citing the failure as a "blocker"; this
|
|
269
|
+
* scan catches the failure before the fabricated finding is admitted.
|
|
270
|
+
*
|
|
271
|
+
* Returns the FIRST matching line found across `status: "failed"`
|
|
272
|
+
* command_execution items, or `null` if no failed item's output cites a
|
|
273
|
+
* sandbox-init failure.
|
|
274
|
+
*
|
|
275
|
+
* PR #112 false-positive guard (rounds 1-3): detection is gated SOLELY
|
|
276
|
+
* on `status === "failed"` items AND the signature regexes are
|
|
277
|
+
* line-anchored at column 0 (multiline `^`). Both gates are
|
|
278
|
+
* load-bearing because the Codex CLI's `handle_exec_command_end` maps
|
|
279
|
+
* any non-zero `exit_code` to `CommandExecutionStatus = "failed"`
|
|
280
|
+
* (`completed` only on `exit_code == 0`). So a legitimate `git diff
|
|
281
|
+
* --exit-code` that finds a diff arrives as `status: "failed",
|
|
282
|
+
* exit_code: 1` with diff content in `aggregated_output` — and when
|
|
283
|
+
* the PR under review touches this repo's pattern list, that diff
|
|
284
|
+
* content contains the bwrap citation prefixed by `+` / `-` / context
|
|
285
|
+
* whitespace. The line anchor ensures only stderr-shaped occurrences
|
|
286
|
+
* (citation at column 0, as real bwrap/landlock stderr always writes
|
|
287
|
+
* them) classify, not diff-prefixed source content. Without the
|
|
288
|
+
* anchor, real APPROVED / CHANGES_REQUESTED verdicts get silently
|
|
289
|
+
* erased from quorum on every PR that touches the pattern list. The
|
|
290
|
+
* SDK-thrown-Error path in `runOnce`'s catch block remains the
|
|
291
|
+
* secondary detection point for startup failures that prevent any
|
|
292
|
+
* command_execution stream from emitting.
|
|
293
|
+
*
|
|
294
|
+
* Items without an `aggregated_output` string are skipped. Pure
|
|
295
|
+
* function — exported for direct unit testing.
|
|
296
|
+
*/
|
|
297
|
+
export declare function detectSandboxInitFailureInItems(items: readonly unknown[]): string | null;
|
|
232
298
|
/**
|
|
233
299
|
* Issue #2103 — strict auth resolver. Validates `critic.auth` against
|
|
234
300
|
* the codex adapter vocabulary ({@link C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