@ai-dossier/cli 0.14.0 → 0.18.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 +155 -0
- package/dist/cache-resolver.d.ts.map +1 -1
- package/dist/cache-resolver.js +2 -11
- package/dist/cache-resolver.js.map +1 -1
- package/dist/cap-log.d.ts +31 -0
- package/dist/cap-log.d.ts.map +1 -0
- package/dist/cap-log.js +30 -0
- package/dist/cap-log.js.map +1 -0
- package/dist/capability.d.ts +108 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +407 -0
- package/dist/capability.js.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/cap.d.ts +13 -0
- package/dist/commands/cap.d.ts.map +1 -0
- package/dist/commands/cap.js +105 -0
- package/dist/commands/cap.js.map +1 -0
- package/dist/commands/plan.d.ts +20 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +323 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/runstate.d.ts.map +1 -1
- package/dist/commands/runstate.js +51 -290
- package/dist/commands/runstate.js.map +1 -1
- package/dist/commands/sched.d.ts +11 -0
- package/dist/commands/sched.d.ts.map +1 -0
- package/dist/commands/sched.js +402 -0
- package/dist/commands/sched.js.map +1 -0
- package/dist/gh.d.ts +155 -0
- package/dist/gh.d.ts.map +1 -0
- package/dist/gh.js +357 -0
- package/dist/gh.js.map +1 -0
- package/dist/helpers.d.ts +7 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +19 -0
- package/dist/helpers.js.map +1 -1
- package/dist/issue-selection.js +2 -2
- package/dist/issue-selection.js.map +1 -1
- package/dist/jsonl-log.d.ts +14 -0
- package/dist/jsonl-log.d.ts.map +1 -0
- package/dist/jsonl-log.js +32 -0
- package/dist/jsonl-log.js.map +1 -0
- package/dist/plan-artifact.d.ts +123 -0
- package/dist/plan-artifact.d.ts.map +1 -0
- package/dist/plan-artifact.js +213 -0
- package/dist/plan-artifact.js.map +1 -0
- package/dist/run-log.d.ts.map +1 -1
- package/dist/run-log.js +2 -9
- package/dist/run-log.js.map +1 -1
- package/dist/runstate.d.ts +0 -2
- package/dist/runstate.d.ts.map +1 -1
- package/dist/runstate.js +2 -5
- package/dist/runstate.js.map +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -722,6 +722,161 @@ the selection could be read.
|
|
|
722
722
|
|
|
723
723
|
---
|
|
724
724
|
|
|
725
|
+
## Plan Artifacts (`plan`) — plan:v1
|
|
726
|
+
|
|
727
|
+
Issues used to be planned up to three times (triage, batch prep, plan-issue). The
|
|
728
|
+
`plan:v1` artifact replaces that with ONE canonical plan stored on the issue itself:
|
|
729
|
+
posting is append-only, readers take the LAST `plan:v1` comment, and consumers
|
|
730
|
+
validate-and-refine instead of replanning. It lives on the issue — not a file — because
|
|
731
|
+
batch preparation runs before any branch exists. Full format spec:
|
|
732
|
+
[docs/reference/plan-artifact.md](../docs/reference/plan-artifact.md).
|
|
733
|
+
|
|
734
|
+
```bash
|
|
735
|
+
# Post a plan (validates the five sections first; head= stamps current HEAD)
|
|
736
|
+
ai-dossier plan post --issue 462 --file plan.md
|
|
737
|
+
|
|
738
|
+
# Read the latest plan back (last plan:v1 comment wins)
|
|
739
|
+
ai-dossier plan get --issue 462 --json
|
|
740
|
+
|
|
741
|
+
# Deterministic validation — no model call anywhere
|
|
742
|
+
ai-dossier plan validate --issue 462
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### Subcommands
|
|
746
|
+
|
|
747
|
+
| Command | What it does | Writes? |
|
|
748
|
+
|---|---|---|
|
|
749
|
+
| `post` | Validates the file's five sections, stamps `head=`, comments it via `gh issue comment` | yes |
|
|
750
|
+
| `get` | Prints the latest artifact (raw in text mode, parsed fields with `--json`); exits 1 when no plan exists | no |
|
|
751
|
+
| `validate` | Deterministic checks against the local clone; prints a `{valid, reasons[]}` JSON verdict; exits 1 when invalid | no |
|
|
752
|
+
|
|
753
|
+
`validate` runs the deterministic checks — all five sections present, every Predicted
|
|
754
|
+
Files path exists at current HEAD (`git cat-file -e HEAD:<path>`), head-distance (commits
|
|
755
|
+
on HEAD since the plan's `head=` — an info reason when non-zero), and a risk-floor scan of
|
|
756
|
+
Predicted Files (auth/secrets, payments/billing, migrations/schema, protocol surfaces are
|
|
757
|
+
flagged as elevated-risk, info severity) — reporting `{check, severity, message}` reasons
|
|
758
|
+
(full check/severity table in [docs/reference/plan-artifact.md](../docs/reference/plan-artifact.md)).
|
|
759
|
+
Reasons carry `{check, severity, message}`; only `severity: "error"` fails validity —
|
|
760
|
+
`get` and `validate` are read-only aside from `post`'s comment. All three take `--repo
|
|
761
|
+
<owner/name>`; `post` also takes `--head <sha>` (7-40 lowercase hex, validated),
|
|
762
|
+
`--dry-run`, and `--json` (JSON result: `{posted, head, url}`, or `{posted: false,
|
|
763
|
+
dryRun: true, head, body}` in dry-run). `get` and `validate` take `--json` / emit JSON
|
|
764
|
+
respectively; `get --json` includes the comment's `author`.
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
## Scheduler core (`sched`)
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
ai-dossier sched enqueue --issues 101,105..109 [--mode full|slot] [--batch b1] [--deps 100,104] [--tier mechanical|mid|strong]
|
|
772
|
+
ai-dossier sched enqueue --from-manifest batch-prep.json
|
|
773
|
+
ai-dossier sched start [--interval <seconds>] [--once] [--json]
|
|
774
|
+
ai-dossier sched status [--json]
|
|
775
|
+
ai-dossier sched pause | resume
|
|
776
|
+
ai-dossier sched abandon --issue 42 [--reason "..."] | --batch b1 [--reason "..."]
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
The deterministic core of batch cycles (RFC-0001): a queue, worker slots, typed
|
|
780
|
+
issue/batch/slot state machines persisted to `~/.dossier/sched/<project>/state.json`
|
|
781
|
+
(`<project>` = `owner-repo` slug, falling back to the repo basename — the same convention
|
|
782
|
+
`fleet-cycle` uses for its logs), and — since #464 — the dispatch engine. **The scheduler
|
|
783
|
+
itself never invokes an LLM**: every mechanical decision (what is runnable, which slot gets
|
|
784
|
+
it, whether a unit completed, when a run stalled) is a pure function of state reconciled
|
|
785
|
+
against ground truth.
|
|
786
|
+
|
|
787
|
+
- **`enqueue`** records entries (issue, mode, batch id, dependency edges, model tier) from
|
|
788
|
+
flags or a batch-prep manifest (`--from-manifest`, a JSON file of entries — flags and
|
|
789
|
+
manifest can be combined). Invalid input is rejected *before* anything is persisted:
|
|
790
|
+
duplicate active issues, self-dependencies, dependency cycles, `slot` mode without a
|
|
791
|
+
batch, and conflicting `base_branch` on a joining batch member.
|
|
792
|
+
- **`start`** runs the dispatch engine (#464): a runnable unit is spawned as a detached
|
|
793
|
+
agent process (`claude -p --output-format json --model <tier model>` by default,
|
|
794
|
+
auto-falling back to `opencode run`; the command, prompt, and tier→model mapping are
|
|
795
|
+
all configurable in `config.json`'s `dispatch` section) with the prompt on stdin and
|
|
796
|
+
output journaled to `runs/<unit>.log`. On every ~60s tick it reconciles: an agent that
|
|
797
|
+
exited is **not** complete until `ai-dossier runstate last` / `gh` ground truth confirms
|
|
798
|
+
it (unverified exits and stalls are redispatched one tier stronger — mechanical → mid →
|
|
799
|
+
strong, cap 2 — then the unit fails and its transitive dependents are blocked);
|
|
800
|
+
externally-advanced state and orphaned pids after a restart are detected; a freed slot
|
|
801
|
+
is refilled in the same tick. `--once` runs a single tick (cron-style); Ctrl-C stops
|
|
802
|
+
the engine while spawned agents keep running. Pids are identity-guarded via
|
|
803
|
+
`/proc` start-times (a reused pid is never signalled; best-effort on macOS/Windows),
|
|
804
|
+
and a FAILED ground-truth poll (gh outage) pauses that unit's stall/verify decisions
|
|
805
|
+
instead of guessing — an outage never kills a healthy agent. All events are journaled
|
|
806
|
+
to `events.jsonl`, and `status` shows the live phase per unit.
|
|
807
|
+
- **`status`** renders the queue, slots (with pid, live phase, last-progress, recoveries),
|
|
808
|
+
batches, runnable units, and the blocked/failed sets. A blocked entry names every
|
|
809
|
+
unsatisfied dependency ("dependency #104 not merged (status: dispatched)"), so "why
|
|
810
|
+
isn't #42 running?" is a read, not an investigation. `--json` emits the same report
|
|
811
|
+
as data.
|
|
812
|
+
- **`pause`/`resume`** gate *new* assignments only — live units keep running.
|
|
813
|
+
- **`abandon --issue`** fails the entry (recording the reason) and releases its slot;
|
|
814
|
+
**`abandon --batch`** dissolves the batch and requeues every non-terminal member as
|
|
815
|
+
full-cycle — members already shipped keep their outcome.
|
|
816
|
+
|
|
817
|
+
State is written atomically (tmp + fsync + rename), so a process killed between writes
|
|
818
|
+
always leaves the previous complete state, and a scheduler restart resumes identically
|
|
819
|
+
from `state.json` (pre-#464 state files migrate on load). A corrupt state file is a loud
|
|
820
|
+
error naming the file — never a silent queue reset. Concurrency is serialized by a
|
|
821
|
+
`.sched-lock` directory mutex (stolen from dead holders). `config.json` holds
|
|
822
|
+
`max_slots` (default 3, bounds concurrently-live units), `stall_timeout_ms` (default
|
|
823
|
+
1 800 000), `reconcile_interval_ms` (default 60 000), and the optional `dispatch`
|
|
824
|
+
section; an issue with an unmerged dependency — or a batch behind an unmerged batch —
|
|
825
|
+
is never runnable.
|
|
826
|
+
|
|
827
|
+
Library consumers: see [`@ai-dossier/sched`](../packages/sched/README.md).
|
|
828
|
+
|
|
829
|
+
---
|
|
830
|
+
|
|
831
|
+
## Capabilities (`cap`)
|
|
832
|
+
|
|
833
|
+
```bash
|
|
834
|
+
ai-dossier cap list [--json] # inspect .dossier/automation/manifest.yaml
|
|
835
|
+
ai-dossier cap run test.focused # execute one capability
|
|
836
|
+
ai-dossier cap run test.focused -- --grep auth # extra args are shell-quoted and appended
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
A repo declares its deterministic, recurring operations — tests, lint, build, deps
|
|
840
|
+
install, worktree prep — in `.dossier/automation/manifest.yaml` so agents execute them
|
|
841
|
+
directly instead of re-reasoning (Progressive Determinism, RFC-0001; the scheduler's
|
|
842
|
+
slot-cycle fast path will consume the same manifest, #464). Entries should mostly
|
|
843
|
+
reference existing repo tooling (package scripts, Makefile targets):
|
|
844
|
+
|
|
845
|
+
```yaml
|
|
846
|
+
capabilities:
|
|
847
|
+
test.focused:
|
|
848
|
+
command: npm test -- --silent
|
|
849
|
+
lifecycle: active # active | shadow (listed, not executable)
|
|
850
|
+
description: Focused vitest suite
|
|
851
|
+
timeout_ms: 300000 # optional; default 5 min, timeout = automation-broken
|
|
852
|
+
assumptions: # probes run BEFORE the command; failure = automation-broken
|
|
853
|
+
- file-exists: package.json
|
|
854
|
+
- tool-version: node>=20
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
Extra args after `--` are shell-quoted and appended (they are data, not shell syntax):
|
|
858
|
+
|
|
859
|
+
```bash
|
|
860
|
+
ai-dossier cap run test.focused -- --grep auth # → npm test -- --silent --grep auth
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
`cap run` reports one of exactly four outcomes — the JSON envelope is the **last
|
|
864
|
+
stdout line**, and the exit code matches:
|
|
865
|
+
|
|
866
|
+
| Outcome | Exit | Meaning |
|
|
867
|
+
|---|---|---|
|
|
868
|
+
| `ok` | 0 | Command ran, exited 0 |
|
|
869
|
+
| `task-failed` | 1 | Command ran, legitimately failed (red tests) |
|
|
870
|
+
| `automation-broken` | 2 | Probe failed / command missing / timeout / abnormal termination — fall back to reasoning |
|
|
871
|
+
| `capability-unavailable` | 3 | Id not in manifest (or `shadow`) — no fast path |
|
|
872
|
+
|
|
873
|
+
A repo without `.dossier/automation/` is normal: `cap list` is empty and exits 0. Every
|
|
874
|
+
run appends telemetry (capability, outcome, exit code, duration, reason, cwd) to
|
|
875
|
+
`~/.dossier/caps.jsonl`. Full spec and the capability id vocabulary:
|
|
876
|
+
[docs/reference/capabilities.md](../docs/reference/capabilities.md).
|
|
877
|
+
|
|
878
|
+
---
|
|
879
|
+
|
|
725
880
|
## Run History (`history`)
|
|
726
881
|
|
|
727
882
|
Every `ai-dossier run` appends one JSON line to `~/.dossier/runs.jsonl` (append-only; disable with `dossier config auditLog false`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-resolver.d.ts","sourceRoot":"","sources":["../src/cache-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"cache-resolver.d.ts","sourceRoot":"","sources":["../src/cache-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,eAAO,MAAM,SAAS,QAA+C,CAAC;AACtE,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgCD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CA4BnF;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CActE;AAQD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,eAAe,CAAC,CAwF1B;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA2BnF;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,IAAI,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACpC,IAAI,CAsBN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO7E"}
|
package/dist/cache-resolver.js
CHANGED
|
@@ -34,6 +34,7 @@ const config_1 = require("./config");
|
|
|
34
34
|
const duration_1 = require("./duration");
|
|
35
35
|
const helpers_1 = require("./helpers");
|
|
36
36
|
const multi_registry_1 = require("./multi-registry");
|
|
37
|
+
const version_1 = require("./version");
|
|
37
38
|
exports.DEFAULT_RESOLUTION_TTL_SECONDS = 300;
|
|
38
39
|
exports.CACHE_DIR = node_path_1.default.join(node_os_1.default.homedir(), '.dossier', 'cache');
|
|
39
40
|
exports.RESOLUTION_DIR = node_path_1.default.join(exports.CACHE_DIR, '.resolution');
|
|
@@ -95,16 +96,6 @@ function writeResolution(dossierName, record) {
|
|
|
95
96
|
}
|
|
96
97
|
node_fs_1.default.writeFileSync(file, JSON.stringify(record, null, 2), { encoding: 'utf8', mode: 0o600 });
|
|
97
98
|
}
|
|
98
|
-
function compareSemver(a, b) {
|
|
99
|
-
const pa = a.split('.').map(Number);
|
|
100
|
-
const pb = b.split('.').map(Number);
|
|
101
|
-
for (let i = 0; i < 3; i++) {
|
|
102
|
-
const diff = (pa[i] || 0) - (pb[i] || 0);
|
|
103
|
-
if (diff !== 0)
|
|
104
|
-
return diff;
|
|
105
|
-
}
|
|
106
|
-
return 0;
|
|
107
|
-
}
|
|
108
99
|
/** Highest-semver version currently cached on disk for this name, or null. */
|
|
109
100
|
function highestCachedSemver(dossierName) {
|
|
110
101
|
try {
|
|
@@ -116,7 +107,7 @@ function highestCachedSemver(dossierName) {
|
|
|
116
107
|
.filter((f) => f.endsWith('.meta.json'))
|
|
117
108
|
.map((f) => f.replace('.meta.json', ''))
|
|
118
109
|
.filter((v) => node_fs_1.default.existsSync(node_path_1.default.join(dir, `${v}.ds.md`)))
|
|
119
|
-
.sort(
|
|
110
|
+
.sort(version_1.compareVersions);
|
|
120
111
|
return versions.length > 0 ? versions[versions.length - 1] : null;
|
|
121
112
|
}
|
|
122
113
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-resolver.js","sourceRoot":"","sources":["../src/cache-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;
|
|
1
|
+
{"version":3,"file":"cache-resolver.js","sourceRoot":"","sources":["../src/cache-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;AAoEH,0CA4BC;AAGD,kDAcC;AAoBD,oDA2FC;AAGD,0CA2BC;AAGD,4CAIC;AAOD,8CAEC;AAOD,8CAQC;AAaD,gDA4BC;AAOD,8CAOC;AAlVD,sDAAyB;AACzB,sDAAyB;AACzB,0DAA6B;AAC7B,qCAAqC;AACrC,yCA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CAAC,GAAG,EAAE,GAAG,OAAO,YAAY,CAAC,EACtC,IAAI,CAAC,SAAS,CACZ;YACE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,OAAO;YACP,eAAe,EAAE,cAAc;SAChC,EACD,IAAI,EACJ,CAAC,CACF,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,YAAY;YAAE,MAAM,GAAG,CAAC;QACjC,8EAA8E;IAChF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,GAAuB;IACvD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability run telemetry — append-only JSONL at ~/.dossier/caps.jsonl.
|
|
3
|
+
*
|
|
4
|
+
* Modeled on run-log.ts via the shared appendAuditJsonl helper (respects the
|
|
5
|
+
* auditLog config flag, mode 0600, never crashes the run). Kept separate from
|
|
6
|
+
* runs.jsonl because a dossier run entry (dossier, resolved_version,
|
|
7
|
+
* verification, llm…) does not describe a capability execution; `caps.jsonl`
|
|
8
|
+
* carries the capability run fields: capability, outcome, exit_code,
|
|
9
|
+
* duration_ms, reason, signal, cwd, timestamp.
|
|
10
|
+
*/
|
|
11
|
+
import type { CapabilityOutcome } from './capability';
|
|
12
|
+
export interface CapLogEntry {
|
|
13
|
+
timestamp: string;
|
|
14
|
+
capability: string;
|
|
15
|
+
outcome: CapabilityOutcome;
|
|
16
|
+
exit_code: number | null;
|
|
17
|
+
duration_ms: number;
|
|
18
|
+
/** Why a non-ok outcome happened, from the run envelope (postmortem traceability). */
|
|
19
|
+
reason: string | null;
|
|
20
|
+
/** Signal that killed the command, when abnormal termination occurred. */
|
|
21
|
+
signal: string | null;
|
|
22
|
+
cwd: string;
|
|
23
|
+
}
|
|
24
|
+
declare const CAP_LOG_FILE: string;
|
|
25
|
+
/**
|
|
26
|
+
* Append one JSONL line to ~/.dossier/caps.jsonl.
|
|
27
|
+
* Respects auditLog config flag. Never crashes the run.
|
|
28
|
+
*/
|
|
29
|
+
export declare function appendCapLog(entry: CapLogEntry): void;
|
|
30
|
+
export { CAP_LOG_FILE };
|
|
31
|
+
//# sourceMappingURL=cap-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cap-log.d.ts","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAItD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,YAAY,QAAsC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAErD;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/cap-log.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capability run telemetry — append-only JSONL at ~/.dossier/caps.jsonl.
|
|
4
|
+
*
|
|
5
|
+
* Modeled on run-log.ts via the shared appendAuditJsonl helper (respects the
|
|
6
|
+
* auditLog config flag, mode 0600, never crashes the run). Kept separate from
|
|
7
|
+
* runs.jsonl because a dossier run entry (dossier, resolved_version,
|
|
8
|
+
* verification, llm…) does not describe a capability execution; `caps.jsonl`
|
|
9
|
+
* carries the capability run fields: capability, outcome, exit_code,
|
|
10
|
+
* duration_ms, reason, signal, cwd, timestamp.
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CAP_LOG_FILE = void 0;
|
|
17
|
+
exports.appendCapLog = appendCapLog;
|
|
18
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
19
|
+
const config_1 = require("./config");
|
|
20
|
+
const jsonl_log_1 = require("./jsonl-log");
|
|
21
|
+
const CAP_LOG_FILE = node_path_1.default.join(config_1.CONFIG_DIR, 'caps.jsonl');
|
|
22
|
+
exports.CAP_LOG_FILE = CAP_LOG_FILE;
|
|
23
|
+
/**
|
|
24
|
+
* Append one JSONL line to ~/.dossier/caps.jsonl.
|
|
25
|
+
* Respects auditLog config flag. Never crashes the run.
|
|
26
|
+
*/
|
|
27
|
+
function appendCapLog(entry) {
|
|
28
|
+
(0, jsonl_log_1.appendAuditJsonl)(CAP_LOG_FILE, entry);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cap-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cap-log.js","sourceRoot":"","sources":["../src/cap-log.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AA0BH,oCAEC;AA1BD,0DAA6B;AAE7B,qCAAsC;AACtC,2CAA+C;AAe/C,MAAM,YAAY,GAAG,mBAAI,CAAC,IAAI,CAAC,mBAAU,EAAE,YAAY,CAAC,CAAC;AAUhD,oCAAY;AARrB;;;GAGG;AACH,SAAgB,YAAY,CAAC,KAAkB;IAC7C,IAAA,4BAAgB,EAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability manifest engine (RFC-0001 capabilities, issue #463).
|
|
3
|
+
*
|
|
4
|
+
* A repo declares its deterministic, recurring operations (test, lint, build,
|
|
5
|
+
* dependency install, worktree prep, …) in `.dossier/automation/manifest.yaml`.
|
|
6
|
+
* `ai-dossier cap list` inspects the manifest; `ai-dossier cap run <id>` executes
|
|
7
|
+
* one capability and reports one of exactly four outcomes, distinguishable by
|
|
8
|
+
* exit code and by a JSON envelope printed as the final stdout line:
|
|
9
|
+
*
|
|
10
|
+
* ok exit 0 — command ran, exit 0
|
|
11
|
+
* task-failed exit 1 — command ran, nonzero exit (e.g. red tests)
|
|
12
|
+
* automation-broken exit 2 — assumption probe failed, command missing,
|
|
13
|
+
* abnormal termination, timeout, or an
|
|
14
|
+
* invalid manifest
|
|
15
|
+
* capability-unavailable exit 3 — id not in the manifest (or lifecycle=shadow)
|
|
16
|
+
*
|
|
17
|
+
* The engine is pure logic (no CLI dependencies) so the scheduler's slot-cycle
|
|
18
|
+
* fast path (#464) can consume it directly later.
|
|
19
|
+
*/
|
|
20
|
+
/** Directory (relative to the run directory) that holds the automation manifest. */
|
|
21
|
+
export declare const AUTOMATION_DIR = ".dossier/automation";
|
|
22
|
+
/** File name of the manifest inside {@link AUTOMATION_DIR}. */
|
|
23
|
+
export declare const MANIFEST_FILE = "manifest.yaml";
|
|
24
|
+
export type CapabilityOutcome = 'ok' | 'task-failed' | 'automation-broken' | 'capability-unavailable';
|
|
25
|
+
export type CapabilityLifecycle = 'active' | 'shadow';
|
|
26
|
+
/** The four-way outcome contract, as process exit codes. */
|
|
27
|
+
export declare const CAPABILITY_EXIT_CODES: Record<CapabilityOutcome, number>;
|
|
28
|
+
/** Supported tool-version comparison operators (single source of truth). */
|
|
29
|
+
declare const TOOL_VERSION_OPS: readonly [">=", ">", "<=", "<", "==", "="];
|
|
30
|
+
type ToolVersionOp = (typeof TOOL_VERSION_OPS)[number];
|
|
31
|
+
export interface FileExistsProbe {
|
|
32
|
+
kind: 'file-exists';
|
|
33
|
+
/** Path relative to the directory the command runs in. */
|
|
34
|
+
target: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ToolVersionProbe {
|
|
37
|
+
kind: 'tool-version';
|
|
38
|
+
tool: string;
|
|
39
|
+
op: ToolVersionOp;
|
|
40
|
+
version: string;
|
|
41
|
+
}
|
|
42
|
+
export type CapabilityAssumption = FileExistsProbe | ToolVersionProbe;
|
|
43
|
+
export interface CapabilityEntry {
|
|
44
|
+
/** Command line to execute; extra `cap run` args are shell-quoted and appended after it. */
|
|
45
|
+
command: string;
|
|
46
|
+
lifecycle: CapabilityLifecycle;
|
|
47
|
+
assumptions?: CapabilityAssumption[];
|
|
48
|
+
description?: string;
|
|
49
|
+
/** Per-entry command timeout in ms (default 5 min; timeout → automation-broken). */
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface CapabilityManifest {
|
|
53
|
+
/** Absolute path of the manifest file, or null when no manifest exists. */
|
|
54
|
+
path: string | null;
|
|
55
|
+
capabilities: Record<string, CapabilityEntry>;
|
|
56
|
+
}
|
|
57
|
+
/** The manifest exists but does not conform to the schema. */
|
|
58
|
+
export declare class CapManifestError extends Error {
|
|
59
|
+
constructor(message: string);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Load the capability manifest for a directory. Absent `.dossier/automation/`
|
|
63
|
+
* is the normal portable state: returns an empty manifest with `path: null`.
|
|
64
|
+
* A present-but-invalid manifest throws {@link CapManifestError} whose message
|
|
65
|
+
* names the file.
|
|
66
|
+
*/
|
|
67
|
+
export declare function loadCapabilityManifest(cwd: string): CapabilityManifest;
|
|
68
|
+
/** Parse and validate manifest YAML into the capability map. */
|
|
69
|
+
export declare function parseCapabilityManifest(text: string): Record<string, CapabilityEntry>;
|
|
70
|
+
export interface ProbeResult {
|
|
71
|
+
ok: boolean;
|
|
72
|
+
reason: string;
|
|
73
|
+
}
|
|
74
|
+
/** Evaluate one assumption probe against the run directory. */
|
|
75
|
+
export declare function evaluateProbe(probe: CapabilityAssumption, cwd: string): ProbeResult;
|
|
76
|
+
export interface CapRunResult {
|
|
77
|
+
outcome: CapabilityOutcome;
|
|
78
|
+
capability: string;
|
|
79
|
+
/** The command line that ran (or would have run), null when unknown. */
|
|
80
|
+
command: string | null;
|
|
81
|
+
exit_code: number | null;
|
|
82
|
+
signal: string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Wall-clock duration of the run in milliseconds. Zero only when nothing was
|
|
85
|
+
* timed (unknown id, shadow refusal, invalid manifest); probe failures and
|
|
86
|
+
* spawn problems report real elapsed time.
|
|
87
|
+
*/
|
|
88
|
+
duration_ms: number;
|
|
89
|
+
/** Why a non-ok outcome happened (probe output, missing command, …). */
|
|
90
|
+
reason: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Quote one argv element so the shell receives it verbatim as a single word.
|
|
94
|
+
* POSIX single-quote scheme (the only fully safe one); args are data, not
|
|
95
|
+
* shell syntax — put syntax in the manifest `command`, not in run args.
|
|
96
|
+
*/
|
|
97
|
+
export declare function shellQuote(arg: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Resolve and execute one capability for a directory. Never throws for
|
|
100
|
+
* manifest/permission/exec problems — they are reported as outcomes — but a
|
|
101
|
+
* malformed manifest still surfaces as `automation-broken`, not a crash, so
|
|
102
|
+
* callers (the scheduler) can fall back to reasoning.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runCapabilityFromCwd(id: string, args: string[], cwd: string): CapRunResult;
|
|
105
|
+
/** Execute a capability from an already-loaded manifest. */
|
|
106
|
+
export declare function runCapability(manifest: CapabilityManifest, id: string, args: string[], cwd: string): CapRunResult;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=capability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,oFAAoF;AACpF,eAAO,MAAM,cAAc,wBAAwB,CAAC;AACpD,+DAA+D;AAC/D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GACzB,IAAI,GACJ,aAAa,GACb,mBAAmB,GACnB,wBAAwB,CAAC;AAE7B,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtD,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAKnE,CAAC;AAcF,4EAA4E;AAC5E,QAAA,MAAM,gBAAgB,4CAA6C,CAAC;AACpE,KAAK,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAgBvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,aAAa,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MA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