agentplane 0.3.1 → 0.3.3
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/assets/AGENTS.md +5 -4
- package/assets/agents/CODER.json +4 -3
- package/assets/agents/DOCS.json +1 -1
- package/assets/agents/INTEGRATOR.json +1 -1
- package/assets/agents/ORCHESTRATOR.json +1 -0
- package/assets/agents/PLANNER.json +1 -0
- package/assets/agents/TESTER.json +3 -1
- package/assets/policy/dod.code.md +2 -2
- package/assets/policy/dod.core.md +16 -2
- package/assets/policy/dod.docs.md +2 -2
- package/assets/policy/incidents.md +44 -1
- package/assets/policy/workflow.direct.md +10 -5
- package/bin/agentplane.js +116 -18
- package/bin/dist-guard.js +78 -10
- package/bin/runtime-context.d.ts +23 -0
- package/bin/runtime-context.js +94 -0
- package/bin/runtime-watch.d.ts +26 -0
- package/bin/runtime-watch.js +116 -0
- package/bin/stale-dist-policy.d.ts +6 -0
- package/bin/stale-dist-policy.js +44 -0
- package/dist/.build-manifest.json +2480 -5
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +9 -12
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +23 -18
- package/dist/backends/task-backend/shared/constants.d.ts +1 -0
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -0
- package/dist/backends/task-backend/shared/doc.d.ts +1 -0
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/doc.js +4 -1
- package/dist/backends/task-backend/shared/export.js +3 -3
- package/dist/cli/bootstrap-guide.d.ts +16 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -0
- package/dist/cli/bootstrap-guide.js +112 -0
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +62 -203
- package/dist/cli/command-snippets.d.ts +2 -2
- package/dist/cli/command-snippets.js +2 -2
- package/dist/cli/run-cli/catalog.d.ts +7 -0
- package/dist/cli/run-cli/catalog.d.ts.map +1 -0
- package/dist/cli/run-cli/catalog.js +22 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +11 -0
- package/dist/cli/run-cli/commands/core.js +1 -1
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-config.js +2 -0
- package/dist/cli/run-cli/commands/init.js +5 -14
- package/dist/cli/run-cli/error-guidance.d.ts +9 -0
- package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
- package/dist/cli/run-cli/error-guidance.js +180 -0
- package/dist/cli/run-cli/globals.d.ts +22 -0
- package/dist/cli/run-cli/globals.d.ts.map +1 -0
- package/dist/cli/run-cli/globals.js +197 -0
- package/dist/cli/run-cli/update-warning.d.ts +6 -0
- package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
- package/dist/cli/run-cli/update-warning.js +64 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +5 -476
- package/dist/cli/spec/docs-render.d.ts.map +1 -1
- package/dist/cli/spec/docs-render.js +14 -1
- package/dist/commands/doctor/archive.d.ts +4 -0
- package/dist/commands/doctor/archive.d.ts.map +1 -0
- package/dist/commands/doctor/archive.js +211 -0
- package/dist/commands/doctor/fixes.d.ts +9 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -0
- package/dist/commands/doctor/fixes.js +40 -0
- package/dist/commands/doctor/layering.d.ts +2 -0
- package/dist/commands/doctor/layering.d.ts.map +1 -0
- package/dist/commands/doctor/layering.js +87 -0
- package/dist/commands/doctor/runtime.d.ts +4 -0
- package/dist/commands/doctor/runtime.d.ts.map +1 -0
- package/dist/commands/doctor/runtime.js +56 -0
- package/dist/commands/doctor/workflow.d.ts +6 -0
- package/dist/commands/doctor/workflow.d.ts.map +1 -0
- package/dist/commands/doctor/workflow.js +62 -0
- package/dist/commands/doctor/workspace.d.ts +2 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -0
- package/dist/commands/doctor/workspace.js +165 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +16 -305
- package/dist/commands/doctor.spec.d.ts +1 -0
- package/dist/commands/doctor.spec.d.ts.map +1 -1
- package/dist/commands/doctor.spec.js +15 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +1 -0
- package/dist/commands/finish.spec.d.ts +1 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +23 -2
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +19 -0
- package/dist/commands/release/apply.command.d.ts +2 -7
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +159 -382
- package/dist/commands/release/apply.mutation.d.ts +7 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -0
- package/dist/commands/release/apply.mutation.js +107 -0
- package/dist/commands/release/apply.preflight.d.ts +25 -0
- package/dist/commands/release/apply.preflight.d.ts.map +1 -0
- package/dist/commands/release/apply.preflight.js +338 -0
- package/dist/commands/release/apply.reporting.d.ts +4 -0
- package/dist/commands/release/apply.reporting.d.ts.map +1 -0
- package/dist/commands/release/apply.reporting.js +24 -0
- package/dist/commands/release/apply.types.d.ts +46 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -0
- package/dist/commands/release/apply.types.js +1 -0
- package/dist/commands/runtime.command.d.ts +28 -0
- package/dist/commands/runtime.command.d.ts.map +1 -0
- package/dist/commands/runtime.command.js +169 -0
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +7 -3
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +3 -33
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +2 -2
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +2 -2
- package/dist/commands/task/close-noop.d.ts.map +1 -1
- package/dist/commands/task/close-noop.js +2 -2
- package/dist/commands/task/comment.js +2 -2
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +3 -3
- package/dist/commands/task/doc-template.d.ts +10 -0
- package/dist/commands/task/doc-template.d.ts.map +1 -0
- package/dist/commands/task/doc-template.js +104 -0
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +36 -1
- package/dist/commands/task/finish.d.ts +1 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +26 -10
- package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.command.js +5 -1
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +136 -2
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +4 -110
- package/dist/commands/task/new.spec.js +3 -3
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +5 -4
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +7 -52
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +2 -2
- package/dist/commands/task/shared/dependencies.d.ts +15 -0
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
- package/dist/commands/task/shared/dependencies.js +143 -0
- package/dist/commands/task/shared/docs.d.ts +21 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -0
- package/dist/commands/task/shared/docs.js +121 -0
- package/dist/commands/task/shared/listing.d.ts +20 -0
- package/dist/commands/task/shared/listing.d.ts.map +1 -0
- package/dist/commands/task/shared/listing.js +127 -0
- package/dist/commands/task/shared/tags.d.ts +24 -0
- package/dist/commands/task/shared/tags.d.ts.map +1 -0
- package/dist/commands/task/shared/tags.js +177 -0
- package/dist/commands/task/shared/transitions.d.ts +42 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -0
- package/dist/commands/task/shared/transitions.js +175 -0
- package/dist/commands/task/shared.d.ts +5 -106
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +5 -681
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +7 -5
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +9 -25
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +5 -1
- package/dist/commands/upgrade/apply.d.ts +44 -0
- package/dist/commands/upgrade/apply.d.ts.map +1 -0
- package/dist/commands/upgrade/apply.js +180 -0
- package/dist/commands/upgrade/report.d.ts +21 -0
- package/dist/commands/upgrade/report.d.ts.map +1 -0
- package/dist/commands/upgrade/report.js +81 -0
- package/dist/commands/upgrade/source.d.ts +35 -0
- package/dist/commands/upgrade/source.d.ts.map +1 -0
- package/dist/commands/upgrade/source.js +109 -0
- package/dist/commands/upgrade/types.d.ts +31 -0
- package/dist/commands/upgrade/types.d.ts.map +1 -0
- package/dist/commands/upgrade/types.js +1 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +11 -7
- package/dist/commands/upgrade.d.ts +1 -35
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +54 -320
- package/dist/shared/diagnostics.d.ts +23 -0
- package/dist/shared/diagnostics.d.ts.map +1 -0
- package/dist/shared/diagnostics.js +57 -0
- package/dist/shared/errors.d.ts +2 -0
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +2 -0
- package/dist/shared/repo-cli-version.d.ts +13 -0
- package/dist/shared/repo-cli-version.d.ts.map +1 -0
- package/dist/shared/repo-cli-version.js +63 -0
- package/dist/shared/runtime-source.d.ts +33 -0
- package/dist/shared/runtime-source.d.ts.map +1 -0
- package/dist/shared/runtime-source.js +156 -0
- package/dist/shared/version-compare.d.ts +7 -0
- package/dist/shared/version-compare.d.ts.map +1 -0
- package/dist/shared/version-compare.js +30 -0
- package/package.json +2 -2
package/assets/AGENTS.md
CHANGED
|
@@ -17,7 +17,7 @@ Detailed procedures live in canonical modules from `## CANONICAL DOCS`.
|
|
|
17
17
|
- Repository type: user project initialized with `agentplane`.
|
|
18
18
|
- Gateway role: keep this file compact and deterministic; move scenario-specific details to policy modules.
|
|
19
19
|
- CLI rule: use `agentplane` from `PATH`; if unavailable, stop and request installation guidance (do not invent repo-local entrypoints).
|
|
20
|
-
- Startup shortcut: run `## COMMANDS -> Preflight`, then apply `## LOAD RULES` before any mutation.
|
|
20
|
+
- Startup shortcut: run `## COMMANDS -> Preflight`, then read `docs/user/agent-bootstrap.generated.mdx`, then apply `## LOAD RULES` before any mutation.
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ Priority order (highest first):
|
|
|
28
28
|
1. Enforcement: CI, tests, linters, hooks, CLI validations.
|
|
29
29
|
2. Policy gateway: `AGENTS.md`.
|
|
30
30
|
3. Canonical policy modules from `## CANONICAL DOCS`.
|
|
31
|
-
4. CLI guidance: `agentplane quickstart`, `agentplane role <ROLE>`, `.agentplane/config.json`.
|
|
31
|
+
4. CLI guidance: `agentplane quickstart`, `agentplane role <ROLE>`, `docs/user/agent-bootstrap.generated.mdx`, `.agentplane/config.json`.
|
|
32
32
|
5. Reference examples from `## REFERENCE EXAMPLES`.
|
|
33
33
|
|
|
34
34
|
Conflict rule:
|
|
@@ -66,7 +66,7 @@ agentplane task plan set <task-id> --text "..." --updated-by <ROLE>
|
|
|
66
66
|
agentplane task plan approve <task-id> --by ORCHESTRATOR
|
|
67
67
|
agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."
|
|
68
68
|
agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
|
|
69
|
-
agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>
|
|
69
|
+
agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Verification
|
|
@@ -83,6 +83,7 @@ node .agentplane/policy/check-routing.mjs
|
|
|
83
83
|
## TOOLING
|
|
84
84
|
|
|
85
85
|
- Use `## COMMANDS` as the canonical command source.
|
|
86
|
+
- Use `docs/user/agent-bootstrap.generated.mdx` as the canonical startup path for agent onboarding.
|
|
86
87
|
- For policy changes, routing validation MUST pass via `node .agentplane/policy/check-routing.mjs`.
|
|
87
88
|
|
|
88
89
|
---
|
|
@@ -194,5 +195,5 @@ Detailed DoD rules are in `.agentplane/policy/dod.core.md`, `.agentplane/policy/
|
|
|
194
195
|
## CHANGE CONTROL
|
|
195
196
|
|
|
196
197
|
- Follow incident-log, immutability, and policy-budget rules in `.agentplane/policy/governance.md`.
|
|
197
|
-
- Record situational incident rules only in `.agentplane/policy/incidents.md
|
|
198
|
+
- Record situational incident rules only in `.agentplane/policy/incidents.md`; do not load/read that file during normal startup unless the task directly touches it or recovery/incident handling requires it.
|
|
198
199
|
- Keep `AGENTS.md` as a gateway; move detailed procedures to canonical modules.
|
package/assets/agents/CODER.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"outputs": [
|
|
10
10
|
"Code and config updates describing exact hunks, commands run, and rationale.",
|
|
11
11
|
"Transition guidance for the referenced task (status suggestions, blockers, follow-ups).",
|
|
12
|
-
"
|
|
12
|
+
"Task README updates aligned with the active doc contract, including acceptance-oriented Verify Steps and task-local Findings when needed."
|
|
13
13
|
],
|
|
14
14
|
"permissions": [
|
|
15
15
|
"Project files: read + write within the active task scope.",
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"Confirm task context and readiness before editing; keep diffs minimal and task-scoped.",
|
|
22
22
|
"Document edits with before/after snippets and cite the exact files touched.",
|
|
23
23
|
"Run necessary commands (tests/linters/formatters) and summarize key output lines only.",
|
|
24
|
-
"Prefer declared verify commands;
|
|
25
|
-
"
|
|
24
|
+
"Prefer declared verify commands; treat `Verify Steps` as the acceptance contract and request PLANNER updates when the contract itself drifts.",
|
|
25
|
+
"Record local deviations, follow-ups, and incident candidates in the task-local observation section (`Notes` for v2, `Findings` for v3); do not promote directly into policy incidents.",
|
|
26
|
+
"Coordinate handoffs to TESTER/REVIEWER/DOCS only when those roles already have explicit executable tasks; otherwise keep findings and verification in the same task.",
|
|
26
27
|
"Avoid task closure in branch_pr; keep commits task-scoped and update status via agentplane."
|
|
27
28
|
]
|
|
28
29
|
}
|
package/assets/agents/DOCS.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"workflow": [
|
|
19
19
|
"Follow shared workflow rules in AGENTS.md and `agentplane quickstart` / `agentplane role <ROLE>` output.",
|
|
20
|
-
"Create/update task README content via agentplane task doc set;
|
|
20
|
+
"Create/update task README content via agentplane task doc set; keep the active doc_version contract explicit and treat v3 `Findings` as task-local observation memory, not policy incidents.",
|
|
21
21
|
"Update user/developer docs minimally to reflect behavior and match existing tone.",
|
|
22
22
|
"Keep PR artifact docs and notes current when required; add handoff notes for INTEGRATOR.",
|
|
23
23
|
"Avoid extra commits and standalone docs-only tasks unless documentation itself is the independent deliverable."
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"Follow shared workflow rules in AGENTS.md and `agentplane quickstart` / `agentplane role <ROLE>` output.",
|
|
21
21
|
"Operate from the repo root on the pinned base branch; run pr check -> integrate -> finish via agentplane.",
|
|
22
22
|
"Use configured base branch and task branch prefix when referencing branches; check config if uncertain.",
|
|
23
|
-
"Ensure verify commands are run/recorded; update PR artifacts and task README as needed.",
|
|
23
|
+
"Ensure verify commands are run/recorded against the declared Verify Steps contract; update PR artifacts and task README findings as needed.",
|
|
24
24
|
"When closing multiple tasks, use batch finish so the same commit metadata and verification note apply.",
|
|
25
25
|
"Check `closure_commit_requires_approval` in .agentplane/config.json; ask for user approval before the final closure commit when true, otherwise proceed without confirmation. Optionally clean task branches/worktrees after closure."
|
|
26
26
|
]
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"Convert the first user message into an execution plan; do not create tasks until the user approves it.",
|
|
20
20
|
"Restate the user goal and constraints, then draft a numbered execution plan with agent assignments and expected outcomes.",
|
|
21
21
|
"Build a task graph from the approved plan: split into atomic tasks, each with one specific owner from existing agent IDs; schedule CREATOR if a required agent is missing.",
|
|
22
|
+
"When task artifacts are part of scope, keep the active README contract explicit: Verify Steps define acceptance, and task-local observations stay in Notes/Findings rather than policy incidents.",
|
|
22
23
|
"For development work, select the minimal role set needed for risk and workflow mode; do not split work by role labels alone.",
|
|
23
24
|
"Use TESTER/REVIEWER/INTEGRATOR as independent tasks only when risk, mode (`branch_pr`), or a hard verification/integration boundary requires it; otherwise keep work in one executable task.",
|
|
24
25
|
"If the user explicitly requests agent optimization, invoke UPDATER and pause until its analysis is complete.",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"If task graph planning yields exactly one work item, create exactly one task and keep full traceability there.",
|
|
22
22
|
"Split goals into atomic tasks with one specific owner each; set depends_on explicitly (use [] for none).",
|
|
23
23
|
"Create tasks with valid parameters: non-empty title/description/owner, at least one meaningful tag, deduped depends_on/verify.",
|
|
24
|
+
"Write Plans as executable steps and treat Verify Steps as concrete acceptance checks; keep task-local observations in Notes/Findings rather than policy incidents.",
|
|
24
25
|
"Before creating a new task, check open tasks (`TODO|DOING|BLOCKED`) and reuse/update a matching task when scope and owner align.",
|
|
25
26
|
"Do not create separate tasks for role handoffs unless there is an independent deliverable, a different required owner, or an explicit dependency boundary.",
|
|
26
27
|
"Do not create standalone tasks for scaffolding/doc bookkeeping/status transitions; keep those updates inside the executable task unless there is a real deliverable boundary.",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"outputs": [
|
|
11
11
|
"New or updated tests covering relevant behavior and edge cases.",
|
|
12
12
|
"A short list of executed local commands with key pass/fail lines only.",
|
|
13
|
-
"
|
|
13
|
+
"Verification outcomes mapped to Verify Steps plus task-local findings on remaining gaps or follow-ups."
|
|
14
14
|
],
|
|
15
15
|
"permissions": [
|
|
16
16
|
"Project files: read + write for tests and minimal supporting code.",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"Add the smallest set of high-value tests (happy path + edge/regression).",
|
|
23
23
|
"Keep tests deterministic and fast; avoid network calls and time-based flakiness.",
|
|
24
24
|
"Run targeted tests first and summarize only the key output lines.",
|
|
25
|
+
"Check results against `Verify Steps` as the acceptance contract, not just against ad-hoc commands.",
|
|
26
|
+
"Record residual gaps in the task-local observation section (`Notes` for v2, `Findings` for v3) rather than escalating them directly into policy incidents.",
|
|
25
27
|
"If test infrastructure is missing, document the blocker in the same task first; request a PLANNER task only if it is a separate, independent deliverable."
|
|
26
28
|
]
|
|
27
29
|
}
|
|
@@ -8,9 +8,9 @@ Apply when task changes implementation/source code.
|
|
|
8
8
|
- Run all checks listed in task `## Verify Steps` (or record approved skips)
|
|
9
9
|
- `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`
|
|
10
10
|
|
|
11
|
-
## Verification
|
|
11
|
+
## Verification evidence contract
|
|
12
12
|
|
|
13
|
-
Record verification in task
|
|
13
|
+
Record verification via `agentplane verify ...` and keep residual gaps or follow-ups in the task-local observation section (`Notes` in `doc_version=2`, `Findings` in `doc_version=3`) using this compact template:
|
|
14
14
|
|
|
15
15
|
- `Command`: exact command string.
|
|
16
16
|
- `Result`: `pass` or `fail`.
|
|
@@ -10,9 +10,11 @@ The task is complete only if all core checks are true:
|
|
|
10
10
|
6. Drift was either absent or explicitly re-approved.
|
|
11
11
|
7. Final repo state contains no unintended tracked changes.
|
|
12
12
|
|
|
13
|
-
## Required task
|
|
13
|
+
## Required task README contract
|
|
14
14
|
|
|
15
|
-
Every non-trivial task README must
|
|
15
|
+
Every non-trivial task README must satisfy the active `doc_version` contract.
|
|
16
|
+
|
|
17
|
+
Legacy `doc_version=2` tasks use:
|
|
16
18
|
|
|
17
19
|
- `Summary`
|
|
18
20
|
- `Scope`
|
|
@@ -22,6 +24,18 @@ Every non-trivial task README must contain non-empty sections:
|
|
|
22
24
|
- `Rollback Plan`
|
|
23
25
|
- `Notes`
|
|
24
26
|
|
|
27
|
+
Target `doc_version=3` tasks use:
|
|
28
|
+
|
|
29
|
+
- `Summary`
|
|
30
|
+
- `Scope`
|
|
31
|
+
- `Plan`
|
|
32
|
+
- `Verify Steps`
|
|
33
|
+
- `Verification`
|
|
34
|
+
- `Rollback Plan`
|
|
35
|
+
- `Findings`
|
|
36
|
+
|
|
37
|
+
`Findings` is task-local. Policy incidents are curated separately in `.agentplane/policy/incidents.md`.
|
|
38
|
+
|
|
25
39
|
## Material drift criteria
|
|
26
40
|
|
|
27
41
|
Treat drift as material and require re-approval when at least one is true:
|
|
@@ -8,9 +8,9 @@ Apply when task changes docs or policy files only.
|
|
|
8
8
|
- `agentplane doctor`
|
|
9
9
|
- Targeted lint/tests if docs generation or scripts were changed.
|
|
10
10
|
|
|
11
|
-
## Verification
|
|
11
|
+
## Verification evidence contract
|
|
12
12
|
|
|
13
|
-
Record docs/policy verification in task
|
|
13
|
+
Record docs/policy verification via `agentplane verify ...` and keep residual deviations or follow-ups in the task-local observation section (`Notes` in `doc_version=2`, `Findings` in `doc_version=3`) using this template:
|
|
14
14
|
|
|
15
15
|
- `Command`: exact command string.
|
|
16
16
|
- `Result`: `pass` or `fail`.
|
|
@@ -33,4 +33,47 @@ example:end -->
|
|
|
33
33
|
|
|
34
34
|
## Entries
|
|
35
35
|
|
|
36
|
-
-
|
|
36
|
+
- id: INC-20260308-01
|
|
37
|
+
date: 2026-03-08
|
|
38
|
+
scope: release apply internal push path
|
|
39
|
+
failure: release apply re-entered local pre-push hooks and could stall after creating the local release commit and tag
|
|
40
|
+
rule: Release orchestration MUST push its own release refs without recursively re-entering local pre-push hooks.
|
|
41
|
+
evidence: task 202603061532-9Y41NM; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 4
|
|
42
|
+
enforcement: test + command implementation
|
|
43
|
+
state: stabilized
|
|
44
|
+
|
|
45
|
+
- id: INC-20260308-02
|
|
46
|
+
date: 2026-03-08
|
|
47
|
+
scope: stale-dist guard in framework checkout
|
|
48
|
+
failure: stale-dist enforcement treated git dirtiness as stale runtime and blocked diagnostics or rebuilt checkouts incorrectly
|
|
49
|
+
rule: Stale-dist freshness MUST compare current runtime inputs against the recorded build snapshot, and read-only diagnostics MUST warn-and-run instead of hard-failing on dirty runtime trees.
|
|
50
|
+
evidence: tasks 202603072032-2M0V8V, 202603072032-1BC7VQ, 202603072032-V9VGT2, 202603072032-4D9ASG
|
|
51
|
+
enforcement: test + runtime guard
|
|
52
|
+
state: stabilized
|
|
53
|
+
|
|
54
|
+
- id: INC-20260308-03
|
|
55
|
+
date: 2026-03-08
|
|
56
|
+
scope: framework checkout PATH resolution
|
|
57
|
+
failure: contributors inside the framework repo could execute an older global agentplane binary instead of the checkout they were editing
|
|
58
|
+
rule: Inside the framework checkout, agentplane resolved from PATH MUST hand off to the repo-local runtime by default unless an explicit global opt-out is set.
|
|
59
|
+
evidence: tasks 202603071647-M0Q79C, 202603071647-Y4BZ1T, 202603071647-25WS52
|
|
60
|
+
enforcement: test + wrapper logic
|
|
61
|
+
state: stabilized
|
|
62
|
+
|
|
63
|
+
- id: INC-20260308-04
|
|
64
|
+
date: 2026-03-08
|
|
65
|
+
scope: release mutation generated surfaces
|
|
66
|
+
failure: release apply could leave version-sensitive generated docs stale until later parity checks failed
|
|
67
|
+
rule: Release mutation MUST regenerate and stage generated docs that encode released package versions as part of the release commit itself.
|
|
68
|
+
evidence: task 202603071745-T3QE04; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 5
|
|
69
|
+
enforcement: test + release mutation
|
|
70
|
+
state: stabilized
|
|
71
|
+
|
|
72
|
+
- id: INC-20260308-05
|
|
73
|
+
date: 2026-03-08
|
|
74
|
+
scope: release mutation repository CLI expectation
|
|
75
|
+
failure: repository-owned framework.cli.expected_version could drift behind the actual released version because release apply did not persist it
|
|
76
|
+
rule: Release mutation MUST keep framework.cli.expected_version aligned with the released package version whenever repository config is present.
|
|
77
|
+
evidence: tasks 202603081315-Y4D6AE, 202603081538-GF7P9C; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 3
|
|
78
|
+
enforcement: test + release mutation
|
|
79
|
+
state: stabilized
|
|
@@ -7,8 +7,10 @@ Use this module when `workflow_mode=direct`.
|
|
|
7
7
|
1. CHECKPOINT A: run preflight and publish summary.
|
|
8
8
|
2. CHECKPOINT B: build task graph and obtain explicit user approval.
|
|
9
9
|
3. Create/reuse task ID.
|
|
10
|
-
4. Fill task docs
|
|
11
|
-
|
|
10
|
+
4. Fill task docs for the active README contract.
|
|
11
|
+
- `doc_version=2`: `Summary/Scope/Plan/Risks/Verify Steps/Rollback/Notes`
|
|
12
|
+
- `doc_version=3`: `Summary/Scope/Plan/Verify Steps/Verification/Rollback/Findings`
|
|
13
|
+
Batched doc updates are allowed: sections may be updated in one turn/message via one full-doc payload or multiple `task doc set` operations, as long as approval has not started yet.
|
|
12
14
|
5. Approve plan (if required), then start task sequentially.
|
|
13
15
|
6. Implement changes in current checkout.
|
|
14
16
|
7. Run verification commands from loaded DoD modules.
|
|
@@ -23,7 +25,7 @@ agentplane task plan set <task-id> --text "..." --updated-by <ROLE>
|
|
|
23
25
|
agentplane task plan approve <task-id> --by ORCHESTRATOR
|
|
24
26
|
agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."
|
|
25
27
|
agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
|
|
26
|
-
agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>
|
|
28
|
+
agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
## ERROR RECOVERY
|
|
@@ -31,16 +33,19 @@ agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "...
|
|
|
31
33
|
If any step fails:
|
|
32
34
|
|
|
33
35
|
1. Stop mutation immediately.
|
|
34
|
-
2. Record failure details in task
|
|
36
|
+
2. Record failure details in the task-local observation section.
|
|
37
|
+
- `doc_version=2`: task `Notes`
|
|
38
|
+
- `doc_version=3`: task `Findings`
|
|
35
39
|
3. Mark task blocked: `agentplane block <task-id> --author <ROLE> --body "Blocked: ..."`.
|
|
36
40
|
4. Request re-approval before scope/risk changes.
|
|
37
|
-
5. If failure is process/policy-related,
|
|
41
|
+
5. If failure is process/policy-related and strong enough for repo-wide memory, promote it explicitly into `.agentplane/policy/incidents.md`.
|
|
38
42
|
|
|
39
43
|
## Constraints
|
|
40
44
|
|
|
41
45
|
- MUST NOT perform mutating actions before explicit user approval.
|
|
42
46
|
- Task documentation updates MAY be batched within one turn before approval.
|
|
43
47
|
- MUST run `task plan approve` then `task start-ready` as `Step 1 -> wait -> Step 2` (never parallel).
|
|
48
|
+
- In direct mode, `finish` auto-creates the deterministic close commit by default; use `--no-close-commit` only for explicit manual handling.
|
|
44
49
|
- MUST stop and request re-approval on material drift.
|
|
45
50
|
- Do not use worktrees in direct mode.
|
|
46
51
|
- Do not perform `branch_pr`-only operations.
|
package/bin/agentplane.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { stat } from "node:fs/promises";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import { distExists, isPackageBuildFresh } from "./dist-guard.js";
|
|
7
|
+
import { getWatchedRuntimePathsForPackage } from "./runtime-watch.js";
|
|
8
|
+
import { classifyStaleDistPolicy } from "./stale-dist-policy.js";
|
|
9
|
+
import { isPathInside, resolveFrameworkBinaryContext } from "./runtime-context.js";
|
|
6
10
|
|
|
7
11
|
async function exists(p) {
|
|
8
12
|
try {
|
|
@@ -14,15 +18,12 @@ async function exists(p) {
|
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
async function maybeWarnGlobalBinaryInRepoCheckout() {
|
|
17
|
-
const cwd = process.cwd();
|
|
18
|
-
const repoCli = path.join(cwd, "packages", "agentplane", "src", "cli.ts");
|
|
19
|
-
const repoBin = path.join(cwd, "packages", "agentplane", "bin", "agentplane.js");
|
|
20
|
-
if (!(await exists(repoCli)) || !(await exists(repoBin))) return;
|
|
21
|
-
|
|
22
21
|
const thisBin = fileURLToPath(import.meta.url);
|
|
22
|
+
const context = resolveFrameworkBinaryContext({ cwd: process.cwd(), thisBin });
|
|
23
|
+
if (!context.inFrameworkCheckout || context.isRepoLocalBinary) return;
|
|
24
|
+
|
|
23
25
|
const normalizedThis = path.resolve(thisBin);
|
|
24
|
-
const normalizedRepo = path.resolve(repoBin);
|
|
25
|
-
if (normalizedThis === normalizedRepo) return;
|
|
26
|
+
const normalizedRepo = path.resolve(context.checkout.repoBin);
|
|
26
27
|
|
|
27
28
|
process.stderr.write(
|
|
28
29
|
"warning: running global agentplane binary inside repository checkout.\n" +
|
|
@@ -36,6 +37,77 @@ async function maybeWarnGlobalBinaryInRepoCheckout() {
|
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
function shouldUseGlobalBinaryInFramework() {
|
|
41
|
+
return (process.env.AGENTPLANE_USE_GLOBAL_IN_FRAMEWORK ?? "").trim() === "1";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isRepoLocalHandoffInvocation() {
|
|
45
|
+
return (process.env.AGENTPLANE_REPO_LOCAL_HANDOFF ?? "").trim() === "1";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function inferRuntimeMode(context) {
|
|
49
|
+
if (context.inFrameworkCheckout && context.isRepoLocalRuntime) {
|
|
50
|
+
return isRepoLocalHandoffInvocation() ? "repo-local-handoff" : "repo-local";
|
|
51
|
+
}
|
|
52
|
+
if (context.inFrameworkCheckout && shouldUseGlobalBinaryInFramework()) {
|
|
53
|
+
return "global-forced-in-framework";
|
|
54
|
+
}
|
|
55
|
+
if (context.inFrameworkCheckout) {
|
|
56
|
+
return "global-in-framework";
|
|
57
|
+
}
|
|
58
|
+
return "global-installed";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function primeRuntimeEnv(context) {
|
|
62
|
+
process.env.AGENTPLANE_RUNTIME_ACTIVE_BIN = context.thisBin;
|
|
63
|
+
process.env.AGENTPLANE_RUNTIME_MODE = inferRuntimeMode(context);
|
|
64
|
+
if (!isRepoLocalHandoffInvocation()) {
|
|
65
|
+
delete process.env.AGENTPLANE_RUNTIME_HANDOFF_FROM;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function handoffToRepoLocalBinary(context) {
|
|
70
|
+
const repoBin = context.checkout?.repoBin;
|
|
71
|
+
if (!repoBin) return false;
|
|
72
|
+
|
|
73
|
+
process.stderr.write(
|
|
74
|
+
`info: detected framework checkout; delegating to repo-local binary: ${repoBin}\n`,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const result = spawnSync(process.execPath, [repoBin, ...process.argv.slice(2)], {
|
|
78
|
+
cwd: process.cwd(),
|
|
79
|
+
stdio: "inherit",
|
|
80
|
+
env: {
|
|
81
|
+
...process.env,
|
|
82
|
+
AGENTPLANE_REPO_LOCAL_HANDOFF: "1",
|
|
83
|
+
AGENTPLANE_RUNTIME_MODE: "repo-local-handoff",
|
|
84
|
+
AGENTPLANE_RUNTIME_ACTIVE_BIN: path.resolve(repoBin),
|
|
85
|
+
AGENTPLANE_RUNTIME_HANDOFF_FROM: context.thisBin,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (result.error) {
|
|
90
|
+
process.stderr.write(`error: failed to launch repo-local binary: ${result.error.message}\n`);
|
|
91
|
+
process.exitCode = 2;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
process.exitCode = result.status ?? (result.signal ? 1 : 0);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function maybeHandoffToRepoLocalBinary() {
|
|
100
|
+
if (shouldUseGlobalBinaryInFramework() || isRepoLocalHandoffInvocation()) return false;
|
|
101
|
+
|
|
102
|
+
const context = resolveFrameworkBinaryContext({
|
|
103
|
+
cwd: process.cwd(),
|
|
104
|
+
thisBin: fileURLToPath(import.meta.url),
|
|
105
|
+
});
|
|
106
|
+
if (!context.inFrameworkCheckout || context.isRepoLocalBinary) return false;
|
|
107
|
+
|
|
108
|
+
return handoffToRepoLocalBinary(context);
|
|
109
|
+
}
|
|
110
|
+
|
|
39
111
|
function isHooksRunCommitMsgInvocation(argv) {
|
|
40
112
|
const args = argv.slice(2).map((value) => String(value ?? "").trim());
|
|
41
113
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -45,11 +117,6 @@ function isHooksRunCommitMsgInvocation(argv) {
|
|
|
45
117
|
return false;
|
|
46
118
|
}
|
|
47
119
|
|
|
48
|
-
function isPathInside(baseDir, targetPath) {
|
|
49
|
-
const rel = path.relative(path.resolve(baseDir), path.resolve(targetPath));
|
|
50
|
-
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
120
|
async function assertDistUpToDate() {
|
|
54
121
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
55
122
|
const agentplaneRoot = path.resolve(here, "..");
|
|
@@ -74,11 +141,16 @@ async function assertDistUpToDate() {
|
|
|
74
141
|
{
|
|
75
142
|
name: "agentplane",
|
|
76
143
|
root: agentplaneRoot,
|
|
77
|
-
watchedPaths:
|
|
144
|
+
watchedPaths: getWatchedRuntimePathsForPackage("agentplane"),
|
|
78
145
|
},
|
|
79
146
|
];
|
|
80
|
-
if (await exists(path.join(coreRoot, "src")))
|
|
81
|
-
checks.push({
|
|
147
|
+
if (await exists(path.join(coreRoot, "src"))) {
|
|
148
|
+
checks.push({
|
|
149
|
+
name: "core",
|
|
150
|
+
root: coreRoot,
|
|
151
|
+
watchedPaths: getWatchedRuntimePathsForPackage("@agentplaneorg/core"),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
82
154
|
|
|
83
155
|
const staleReasons = [];
|
|
84
156
|
for (const check of checks) {
|
|
@@ -104,6 +176,24 @@ async function assertDistUpToDate() {
|
|
|
104
176
|
return true;
|
|
105
177
|
}
|
|
106
178
|
|
|
179
|
+
const commandPolicy = classifyStaleDistPolicy(process.argv);
|
|
180
|
+
if (commandPolicy.mode === "warn_and_run") {
|
|
181
|
+
const commandText = process.argv
|
|
182
|
+
.slice(2)
|
|
183
|
+
.map((value) => String(value ?? "").trim())
|
|
184
|
+
.filter(Boolean)
|
|
185
|
+
.join(" ");
|
|
186
|
+
process.stderr.write(
|
|
187
|
+
"warning: allowing read-only diagnostic command to run with a stale repo build inside the framework checkout.\n" +
|
|
188
|
+
`command: ${commandText || "<unknown>"}\n` +
|
|
189
|
+
`detected: ${staleReasons.join(", ")}\n` +
|
|
190
|
+
"rebuild recommended:\n" +
|
|
191
|
+
" bun run --filter=@agentplaneorg/core build\n" +
|
|
192
|
+
" bun run --filter=agentplane build\n",
|
|
193
|
+
);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
107
197
|
process.stderr.write(
|
|
108
198
|
"error: refusing to run a stale repo build (manifest/git quick-check failed).\n" +
|
|
109
199
|
"Fix:\n" +
|
|
@@ -119,6 +209,14 @@ async function assertDistUpToDate() {
|
|
|
119
209
|
return true;
|
|
120
210
|
}
|
|
121
211
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
212
|
+
const runtimeContext = resolveFrameworkBinaryContext({
|
|
213
|
+
cwd: process.cwd(),
|
|
214
|
+
thisBin: fileURLToPath(import.meta.url),
|
|
215
|
+
});
|
|
216
|
+
primeRuntimeEnv(runtimeContext);
|
|
217
|
+
|
|
218
|
+
if (!maybeHandoffToRepoLocalBinary()) {
|
|
219
|
+
await maybeWarnGlobalBinaryInRepoCheckout();
|
|
220
|
+
const ok = isHooksRunCommitMsgInvocation(process.argv) ? true : await assertDistUpToDate();
|
|
221
|
+
if (ok) await import("../dist/cli.js");
|
|
222
|
+
}
|
package/bin/dist-guard.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { readFile, stat } from "node:fs/promises";
|
|
4
|
+
import { collectWatchedRuntimeSnapshot, compareWatchedRuntimeSnapshots } from "./runtime-watch.js";
|
|
4
5
|
|
|
5
6
|
async function exists(p) {
|
|
6
7
|
try {
|
|
@@ -33,12 +34,13 @@ function resolveGitHead(cwd) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
function listGitPaths(cwd, args) {
|
|
37
|
+
function listGitPaths(cwd, args, options = {}) {
|
|
38
|
+
const trimLines = options.trimLines ?? true;
|
|
37
39
|
try {
|
|
38
40
|
const out = execFileSync("git", args, { cwd, encoding: "utf8" });
|
|
39
41
|
return out
|
|
40
42
|
.split(/\r?\n/u)
|
|
41
|
-
.map((line) => line.trim())
|
|
43
|
+
.map((line) => (trimLines ? line.trim() : line))
|
|
42
44
|
.filter(Boolean);
|
|
43
45
|
} catch {
|
|
44
46
|
return [];
|
|
@@ -50,14 +52,19 @@ function uniqueSorted(values) {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
function workingTreeChangedPaths(cwd, watchedPaths) {
|
|
53
|
-
const lines = listGitPaths(
|
|
54
|
-
|
|
55
|
-
"--porcelain",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const lines = listGitPaths(
|
|
56
|
+
cwd,
|
|
57
|
+
["status", "--porcelain", "--untracked-files=all", "--", ...watchedPaths],
|
|
58
|
+
{ trimLines: false },
|
|
59
|
+
);
|
|
60
|
+
return uniqueSorted(
|
|
61
|
+
lines
|
|
62
|
+
.map((line) => {
|
|
63
|
+
const normalized = String(line ?? "");
|
|
64
|
+
return normalized.length > 3 ? normalized.slice(3).trim() : "";
|
|
65
|
+
})
|
|
66
|
+
.filter(Boolean),
|
|
67
|
+
);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
function committedChangedPathsSince(cwd, fromGitHead, watchedPaths) {
|
|
@@ -77,6 +84,45 @@ async function fileMtimeMs(p) {
|
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
|
|
87
|
+
function parseManifestSnapshot(manifest) {
|
|
88
|
+
if (
|
|
89
|
+
!Array.isArray(manifest?.watched_runtime_paths) ||
|
|
90
|
+
!Array.isArray(manifest?.watched_runtime_files) ||
|
|
91
|
+
typeof manifest?.watched_runtime_snapshot_hash !== "string"
|
|
92
|
+
) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const watchedPaths = manifest.watched_runtime_paths.filter((value) => typeof value === "string");
|
|
97
|
+
const files = manifest.watched_runtime_files
|
|
98
|
+
.filter(
|
|
99
|
+
(value) =>
|
|
100
|
+
value &&
|
|
101
|
+
typeof value === "object" &&
|
|
102
|
+
typeof value.path === "string" &&
|
|
103
|
+
typeof value.sha256 === "string" &&
|
|
104
|
+
typeof value.size_bytes === "number",
|
|
105
|
+
)
|
|
106
|
+
.map((value) => ({
|
|
107
|
+
path: value.path,
|
|
108
|
+
sha256: value.sha256,
|
|
109
|
+
size_bytes: value.size_bytes,
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
if (
|
|
113
|
+
watchedPaths.length !== manifest.watched_runtime_paths.length ||
|
|
114
|
+
files.length !== manifest.watched_runtime_files.length
|
|
115
|
+
) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
watchedPaths,
|
|
121
|
+
files,
|
|
122
|
+
snapshotHash: manifest.watched_runtime_snapshot_hash,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
80
126
|
export async function isPackageBuildFresh(packageRoot, options = {}) {
|
|
81
127
|
const watchedPaths = options.watchedPaths ?? ["src"];
|
|
82
128
|
const manifestPath = path.join(packageRoot, "dist", ".build-manifest.json");
|
|
@@ -86,6 +132,28 @@ export async function isPackageBuildFresh(packageRoot, options = {}) {
|
|
|
86
132
|
}
|
|
87
133
|
|
|
88
134
|
const currentHead = resolveGitHead(packageRoot);
|
|
135
|
+
const manifestSnapshot = parseManifestSnapshot(manifest);
|
|
136
|
+
if (manifestSnapshot) {
|
|
137
|
+
const currentSnapshot = await collectWatchedRuntimeSnapshot(
|
|
138
|
+
packageRoot,
|
|
139
|
+
manifestSnapshot.watchedPaths,
|
|
140
|
+
);
|
|
141
|
+
const comparison = compareWatchedRuntimeSnapshots(manifestSnapshot, currentSnapshot);
|
|
142
|
+
if (!comparison.ok) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
reason: "watched_runtime_snapshot_changed",
|
|
146
|
+
changedPaths: comparison.changedPaths,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (manifest.git_head && currentHead && manifest.git_head !== currentHead) {
|
|
151
|
+
return { ok: true, reason: "fresh_after_snapshot_match", changedPaths: [] };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return { ok: true, reason: "fresh", changedPaths: [] };
|
|
155
|
+
}
|
|
156
|
+
|
|
89
157
|
const changedPaths = uniqueSorted([
|
|
90
158
|
...committedChangedPathsSince(packageRoot, manifest.git_head, watchedPaths),
|
|
91
159
|
...workingTreeChangedPaths(packageRoot, watchedPaths),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FrameworkCheckout = {
|
|
2
|
+
repoRoot: string;
|
|
3
|
+
packageRoot: string;
|
|
4
|
+
repoBin: string;
|
|
5
|
+
repoCli: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type FrameworkBinaryContext = {
|
|
9
|
+
inFrameworkCheckout: boolean;
|
|
10
|
+
isRepoLocalBinary: boolean;
|
|
11
|
+
isRepoLocalRuntime: boolean;
|
|
12
|
+
checkout: FrameworkCheckout | null;
|
|
13
|
+
thisBin: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function findFrameworkCheckout(startDir: string): FrameworkCheckout | null;
|
|
17
|
+
|
|
18
|
+
export function isPathInside(baseDir: string, targetPath: string): boolean;
|
|
19
|
+
|
|
20
|
+
export function resolveFrameworkBinaryContext(options: {
|
|
21
|
+
cwd: string;
|
|
22
|
+
thisBin: string;
|
|
23
|
+
}): FrameworkBinaryContext;
|