@deftai/directive-content 0.79.3 → 0.80.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/Taskfile.yml +3 -0
- package/UPGRADING.md +11 -0
- package/commands.md +8 -2
- package/contracts/runtime-authority.md +54 -0
- package/package.json +1 -1
- package/packs/skills/skills-pack-0.1.json +23 -23
- package/scm/github.md +8 -0
- package/skills/deft-directive-pre-pr/SKILL.md +22 -2
- package/skills/deft-directive-release/SKILL.md +15 -0
- package/skills/deft-directive-review-cycle/SKILL.md +28 -0
- package/tasks/coverage.yml +15 -0
- package/templates/agent-prompt-preamble.md +1 -7
- package/templates/agents-entry.md +6 -2
package/Taskfile.yml
CHANGED
package/UPGRADING.md
CHANGED
|
@@ -422,6 +422,17 @@ All documentation (README, AGENTS.md, this file, `deft-directive-sync` skill) no
|
|
|
422
422
|
|
|
423
423
|
---
|
|
424
424
|
|
|
425
|
+
## Coverage hotspots + pre-PR headroom (#2683)
|
|
426
|
+
|
|
427
|
+
After `deft update` / deposit, consumer projects gain:
|
|
428
|
+
|
|
429
|
+
- `deft coverage:hotspots` (and deposited `task coverage:hotspots`) — cheap branch headroom + hotspot report from the latest `coverage/coverage-final.json`; `--json` for agents.
|
|
430
|
+
- Updated `deft-directive-pre-pr` guidance — run targeted coverage on changed modules first, exercise both sides of new branches, aim for ≥ project floor + 0.3–0.5pp headroom, then use `coverage:hotspots` before full `task check`.
|
|
431
|
+
|
|
432
|
+
This complements (does not replace) `deft verify:forward-coverage` (#1310) or `--allow-coverage-debt=#N` (#2573).
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
425
436
|
## Node runtime (#1828 / #1530)
|
|
426
437
|
|
|
427
438
|
After Wave 8, live deft gates run through the TypeScript engine. **Node.js and pnpm are required consumer runtimes** alongside Python (`uv`) — not optional extras for framework contributors only.
|
package/commands.md
CHANGED
|
@@ -181,18 +181,22 @@ Current status: the validation, extractor, provider, registry, generated MAP, an
|
|
|
181
181
|
- `task verify:xbrief-conformance` -- validate xBRIEF conformance surfaces.
|
|
182
182
|
- `task verify:cache-fresh` -- validate cache freshness where required.
|
|
183
183
|
- `task verify:capacity`, `task verify:wip-cap`, and `task verify:judgment-gates` -- policy/capacity gates.
|
|
184
|
+
- `task coverage:hotspots` / `deft coverage:hotspots` -- read the latest coverage report, compare global metrics to the project's vitest thresholds, fail closed below the branch floor or below configured headroom (default 0.3pp), and list lowest modules plus uncovered branch samples for git-diff paths (`--json` for agents). Complements `deft verify:forward-coverage` (#1310) and `--allow-coverage-debt=#N` (#2573); does not replace them.
|
|
184
185
|
|
|
185
186
|
Use `task --list` for the exact current verify namespace.
|
|
186
187
|
|
|
187
188
|
### Agent-host direct-write hooks (#2438, #2596)
|
|
188
189
|
|
|
189
|
-
`directive init` and `deft update` idempotently merge Directive-owned entries into `.claude/settings.json`, `.grok/hooks/deft.json`, `.cursor/hooks.json`, and `.codex/hooks.json` while preserving unrelated settings. `SessionStart` refreshes resume bookkeeping on a non-blocking path. `PreToolUse` covers direct edit/write tools and denies them until both existing gates pass: a fresh gated session ritual and an active/running xBRIEF accepted by canonical preflight.
|
|
190
|
+
`directive init` and `deft update` idempotently merge Directive-owned entries into `.claude/settings.json`, `.grok/hooks/deft.json`, `.cursor/hooks.json`, and `.codex/hooks.json` while preserving unrelated settings. `SessionStart` refreshes resume bookkeeping on a non-blocking path. `PreToolUse` covers direct edit/write tools and denies them until both existing gates pass: a fresh gated session ritual and an active/running xBRIEF accepted by canonical preflight. A second `PreToolUse` matcher covers spawn/Task tools (`Task`, `SubagentStart`, `spawn_subagent`, `start_agent`, `CreateAgent`) with the same pre-`start_agent` gate stack; explore spawns (`subagent_type: explore`) pass without implementation gates.
|
|
191
|
+
|
|
192
|
+
- **Read-only explore (#1185):** Prefer Grok role deposit `default_capability_mode = "read-only"` (see [issue #1185](https://github.com/deftai/directive/issues/1185)). Hooks also deny direct writes when `DEFT_HOOK_READ_ONLY=1` or the host payload signals read-only capability. Implementation spawns remain blocked in read-only posture unless explicitly marked explore.
|
|
190
193
|
|
|
191
194
|
- Verify registration: `deft verify:hooks-installed --scope=agent` (or `--scope=all` for git + agent hooks).
|
|
192
195
|
- Repair missing/drifted entries: `deft update`.
|
|
196
|
+
- **Compact re-arm (#2113):** Cursor `preCompact` and Claude/Grok `PreCompact`/`PostCompact` call `deft hook:dispatch --event session.compact` to mark the gated session ritual stale after context compaction/resume; the existing PreToolUse gate then denies direct writes until `deft session:start` and `deft verify:session-ritual -- --tier=gated`. Codex has no native compact hook — operators must re-run the mutation ritual manually after compaction.
|
|
193
197
|
- Codex project hooks are trust-gated by Codex. Directive verifies only that the registrations are structurally current; after an install or changed hook hash, open `/hooks` in Codex and review/approve the project hook commands. Runtime trust cannot be inferred from the file alone.
|
|
194
198
|
- Directive writes only `.codex/hooks.json`; it does not parse or modify `.codex/config.toml`. Codex can also load inline hooks from `config.toml`, so avoid defining duplicate Directive commands there or they may run more than once. See the [Codex hooks documentation](https://learn.chatgpt.com/docs/hooks).
|
|
195
|
-
- The P0 hook slice does not classify shell-mediated writes, MCP mutations, richer unified-exec calls, WebSearch
|
|
199
|
+
- The P0 hook slice does not classify shell-mediated writes, MCP mutations, richer unified-exec calls, or WebSearch by default. **Runtime authority (#1394)** adds opt-in path allow/deny lists and graduated `scopes` (`edits`, `push`, `merge`) under `plan.policy.runtimeAuthority` — inspect with `deft policy:show --field=runtimeAuthority`. When `enabled: true`, PreToolUse denies classifiable direct-write targets outside `allowPaths` or matching `denyPaths` after ritual/scope/read-only gates; `scopes.edits` gates all direct writes. `push` / `merge` scopes are schema-only until Shell/MCP matchers land (host gap — TODO).
|
|
196
200
|
|
|
197
201
|
## Session-start ritual (#1149)
|
|
198
202
|
|
|
@@ -209,6 +213,8 @@ Full always-on contract for the interactive session-start ritual and its gated v
|
|
|
209
213
|
### Mutable ritual (mutation posture)
|
|
210
214
|
|
|
211
215
|
- ! On **mutation** session start, run `deft session:start` (or `task session:start` in framework source) after loading AGENTS.md. Records quick-tier ritual in `.deft/ritual-state.json`: alignment confirmation, branch-policy disclosure, `deft verify:tools` guidance, default-branch sync warnings, and `deft triage:welcome` one-liner. State is worktree- and HEAD-bound; stale after `plan.policy.sessionRitualStalenessHours` hours (default 4).
|
|
216
|
+
- ~ Mutable `deft session:start` also performs a bounded, non-fatal release-availability probe against the public npm registry after disclosing it. It skips read-only sessions, framework source checkouts, non-release pins, and `DEFT_NO_NETWORK=1`; identical latest-version notices throttle for 24 hours in `xbrief/.triage-cache/release-availability-state.json`. This is separate from `deft doctor`, whose bare and gated invocations remain offline by default (#2182). Refs #1692.
|
|
217
|
+
- ~ At safe idle points (clean tree, no in-flight story), mutation session start and `deft scope:complete` may also run the staleness tickler: an interactive, consent-based offer to upgrade Directive (`npm i -g @deftai/directive@latest`) and/or migrate xBRIEF (`deft migrate:xbrief`). Escalation tiers, snooze windows, and opt-out live under `plan.policy.stalenessTickler` — inspect with `deft policy:show --field=stalenessTickler`. State persists in `xbrief/.triage-cache/staleness-tickler-state.json`. Skips framework source checkouts, dirty trees, CI/headless (`DEFT_SESSION_RITUAL_SKIP=1`), and typed opt-out. Refs #2488 / #2489.
|
|
212
218
|
- ! Before any code-writing tool call or `start_agent` implementation dispatch, run `deft verify:session-ritual -- --tier=gated`. Gated tier fails closed unless quick-tier state is fresh; lazily records `deft doctor` and `deft verify:cache-fresh` entrypoints. Step 0 of the pre-`start_agent` gate stack.
|
|
213
219
|
- ? Postpone with `deft session:start -- --defer step=reason` (`alignment`, `branch_policy`, `triage_welcome`, `doctor`, `cache_fresh`).
|
|
214
220
|
- Headless workers / CI MAY set `DEFT_SESSION_RITUAL_SKIP=1`; verifier exits 0 but warns when bypass hides failure.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Runtime authority policy (#1394)
|
|
2
|
+
|
|
3
|
+
Typed session-level enforcement under `plan.policy.runtimeAuthority` in `xbrief/PROJECT-DEFINITION.xbrief.json`.
|
|
4
|
+
|
|
5
|
+
## Defaults
|
|
6
|
+
|
|
7
|
+
| Field | Default | Notes |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `enabled` | `false` | Opt-in — existing projects unchanged until enabled |
|
|
10
|
+
| `allowPaths` | `[]` | Empty = allow all paths (when enabled) |
|
|
11
|
+
| `denyPaths` | `[]` | Deny wins over allow |
|
|
12
|
+
| `scopes.edits` | `true` | Direct Write/Edit/StrReplace tools |
|
|
13
|
+
| `scopes.push` | `false` | Schema only — Shell matcher TODO |
|
|
14
|
+
| `scopes.merge` | `false` | Schema only — Shell matcher TODO |
|
|
15
|
+
|
|
16
|
+
## Path globs
|
|
17
|
+
|
|
18
|
+
Gitignore-style globs via the shared `matchPath` helper (`src/**`, `**/AGENTS.md`, etc.). Paths are normalized to project-relative POSIX before matching.
|
|
19
|
+
|
|
20
|
+
## Evaluation order (PreToolUse)
|
|
21
|
+
|
|
22
|
+
1. Ritual / scope / read-only / spawn gates (existing #2438 / #1185 stack)
|
|
23
|
+
2. Runtime authority path + `scopes.edits` (this policy)
|
|
24
|
+
|
|
25
|
+
Policy load failures fail open (host crash behavior unchanged).
|
|
26
|
+
|
|
27
|
+
## Inspection
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
deft policy:show --field=runtimeAuthority
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"plan": {
|
|
38
|
+
"policy": {
|
|
39
|
+
"runtimeAuthority": {
|
|
40
|
+
"enabled": true,
|
|
41
|
+
"allowPaths": ["src/**", "xbrief/**", "packages/**"],
|
|
42
|
+
"denyPaths": [".env", "secrets/**"],
|
|
43
|
+
"scopes": { "edits": true, "push": false, "merge": false }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Deferred (host gap)
|
|
51
|
+
|
|
52
|
+
- Shell/Bash `git push`, `gh pr merge`, MCP mutations — not on the direct-write PreToolUse matcher today. `scopes.push` / `scopes.merge` are reserved for a follow-on Shell matcher (#1394 phase 2).
|
|
53
|
+
|
|
54
|
+
Refs #2437 Core T1 Wave C.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-content",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "Shippable Directive framework content in the consumer .deft/core/ layout (C1 flatten), plus the engine surfaces (.githooks/, Taskfile.yml, tasks/) the deposit wires. Python-free per #2022 Phase 3. Refs #11, #1669, #1967.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|