aimship 0.1.0-preview.11 → 0.1.0-preview.13
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/CONTRIBUTING.md +3 -3
- package/README.md +6 -10
- package/README.zh-CN.md +6 -10
- package/docs/cli.md +23 -25
- package/docs/guide.md +314 -148
- package/docs/guide.zh-CN.md +314 -148
- package/lib/approvals.mjs +77 -13
- package/lib/cli.mjs +27 -21
- package/lib/delivery.mjs +15 -12
- package/lib/discovery.mjs +25 -0
- package/lib/documents.mjs +159 -65
- package/lib/install.mjs +1 -1
- package/lib/language.mjs +41 -0
- package/lib/location.mjs +65 -0
- package/lib/state.mjs +54 -87
- package/lib/view.mjs +36 -34
- package/package.json +1 -1
- package/skills/aimship/SKILL.md +3 -3
- package/skills/aimship/references/artifact-map.json +165 -9
- package/skills/aimship/references/core.md +17 -13
- package/skills/aimship/references/document-patterns.md +17 -11
- package/skills/aimship/references/document-review.md +1 -3
- package/skills/aimship/references/hosts.md +11 -9
- package/skills/aimship/references/recovery.md +9 -13
- package/skills/aimship/references/sources-and-changes.md +11 -4
- package/skills/aimship/references/stages/diagnose.md +1 -1
- package/skills/aimship/references/stages/frame.md +1 -1
- package/skills/aimship/references/stages/handoff.md +1 -1
- package/skills/aimship/references/stages/implement.md +2 -2
- package/skills/aimship/references/stages/plan.md +1 -1
- package/skills/aimship/references/stages/requirements.md +1 -1
- package/skills/aimship/references/stages/review.md +1 -1
- package/skills/aimship/references/stages/scope.md +1 -1
- package/skills/aimship/references/stages/tech-design.md +1 -1
- package/skills/aimship/references/stages/test-design.md +1 -1
- package/skills/aimship/references/stages/verify.md +2 -2
- package/skills/aimship/references/templates/change-log.md +0 -2
- package/skills/aimship/references/templates/diagnosis.md +0 -7
- package/skills/aimship/references/templates/handoff.md +0 -6
- package/skills/aimship/references/templates/plan.md +2 -8
- package/skills/aimship/references/templates/prd.md +0 -7
- package/skills/aimship/references/templates/review.md +0 -3
- package/skills/aimship/references/templates/scope.md +0 -7
- package/skills/aimship/references/templates/tech-design.md +0 -7
- package/skills/aimship/references/templates/testing.md +2 -8
- package/lib/migrate.mjs +0 -77
|
@@ -20,4 +20,4 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use the selected PRD/Scope requirement entry. Preserve the
|
|
23
|
+
Use the selected PRD/Scope requirement entry. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
@@ -20,6 +20,6 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use handoff.md. Preserve the
|
|
23
|
+
Use handoff.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
Use the derived completion assessment alongside goal and acceptance. A user-authorized scope without cases/verification may be finished as an explicitly untested partial handoff, never standard complete delivery. No next-session prompt is needed at the final endpoint.
|
|
@@ -20,6 +20,6 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use plan.md. Preserve the
|
|
23
|
+
Use plan.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
|
-
Update TASK/B status and actual execution in the existing
|
|
25
|
+
Update TASK/B status and actual execution in plan.md's execution section, citing the existing task/batch numbers. Keep approved task definitions unchanged unless the plan itself changes; preserve planned versus actual and code versions. Do not generate implementation.md.
|
|
@@ -20,7 +20,7 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use plan.md. Preserve the
|
|
23
|
+
Use plan.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
## Human document review
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use the selected PRD/Scope requirement entry. Preserve the
|
|
23
|
+
Use the selected PRD/Scope requirement entry. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
## Human document review
|
|
26
26
|
|
|
@@ -20,6 +20,6 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use review.md. Preserve the
|
|
23
|
+
Use review.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
Record reviewOf with the actual implementation-run IDs; mark overall: true only for an overall review. The batch review shares that batch’s suggested session, while overall review has its own suggestion. Resolve findings before continuation; a suggestion never substitutes for a passing review.
|
|
@@ -20,7 +20,7 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use the selected PRD/Scope requirement entry. Preserve the
|
|
23
|
+
Use the selected PRD/Scope requirement entry. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
## Human document review
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use tech-design.md. Preserve the
|
|
23
|
+
Use tech-design.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
Technical design does not require finished SQL before its review. After its approval, contract produces and presents database.sql for one target, or database-<id>.sql per independent target. No SQL for no database change.
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use testing.md. Preserve the
|
|
23
|
+
Use testing.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
25
|
## Human document review
|
|
26
26
|
|
|
@@ -20,6 +20,6 @@ Use [the shared core](../core.md) for state, evidence and continuation rules. Re
|
|
|
20
20
|
|
|
21
21
|
## Artifact contract
|
|
22
22
|
|
|
23
|
-
Use testing.md. Preserve the
|
|
23
|
+
Use testing.md. Preserve the ordinary template headings and section order. Follow [document patterns](../document-patterns.md) and the single [artifact map](../artifact-map.json). Keep this run independent even when its document is shared. New runs need a precise result location; adopted work is not a newly executed stage.
|
|
24
24
|
|
|
25
|
-
Append RUN records in testing.md,
|
|
25
|
+
Append RUN records in testing.md, citing TC numbers, the tested document version and exact objects. Evidence goes in .aimship/evidence/; no installation diagnostics or repeated state output in ordinary deliveries.
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="changes"></a>
|
|
6
5
|
## Important changes
|
|
7
6
|
|
|
8
7
|
CHG, reason/decision source, before/after, affected IDs/objects, actions/results and remaining work. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="remaining"></a>
|
|
11
9
|
## Unfinished impact handling
|
|
12
10
|
|
|
13
11
|
One decision stays one record; no edit audit. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,37 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="goals"></a>
|
|
6
5
|
## Investigation goal and scope
|
|
7
6
|
|
|
8
7
|
Commission and authorized scope. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="symptoms"></a>
|
|
11
9
|
## Observed and expected behavior
|
|
12
10
|
|
|
13
11
|
Facts versus hypotheses. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="environment"></a>
|
|
16
13
|
## Environment and reproduction
|
|
17
14
|
|
|
18
15
|
Exact versions and reproducible conditions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="evidence"></a>
|
|
21
17
|
## Checks and evidence
|
|
22
18
|
|
|
23
19
|
Operations, observations and source refs. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="causes"></a>
|
|
26
21
|
## Cause assessment
|
|
27
22
|
|
|
28
23
|
Confirmed causes versus unverified hypotheses. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="unknowns"></a>
|
|
31
25
|
## Impact and unknowns
|
|
32
26
|
|
|
33
27
|
Dependent work and recovery conditions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
34
28
|
|
|
35
|
-
<a id="conclusion"></a>
|
|
36
29
|
## Conclusion and next action
|
|
37
30
|
|
|
38
31
|
Investigation endpoint is not automatically repair completion. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,32 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="goals"></a>
|
|
6
5
|
## Current goal comparison
|
|
7
6
|
|
|
8
7
|
REQ/AC and actual results, including explicit goal changes. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="artifacts"></a>
|
|
11
9
|
## Artifacts, repositories and versions
|
|
12
10
|
|
|
13
11
|
Links, actual checkout/worktree, branch/commit and uncommitted paths; no Git uses file digests. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="usage"></a>
|
|
16
13
|
## Usage
|
|
17
14
|
|
|
18
15
|
Actual commands and entry points. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="results"></a>
|
|
21
17
|
## Review and verification
|
|
22
18
|
|
|
23
19
|
Scopes, versions, results and evidence. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="limits"></a>
|
|
26
21
|
## Limitations and remaining work
|
|
27
22
|
|
|
28
23
|
Unverified work and recovery conditions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="outcomes"></a>
|
|
31
25
|
## Acceptance, integration, release and continuation
|
|
32
26
|
|
|
33
27
|
Independent facts; prepared version is not a release. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,32 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="basis"></a>
|
|
6
5
|
## Implementation basis and scope
|
|
7
6
|
|
|
8
7
|
Current requirements, design, contracts and actual repositories. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="batches"></a>
|
|
11
9
|
## Batches and dependencies
|
|
12
10
|
|
|
13
11
|
B ID, goal, dependencies and integration arrangement. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="tasks"></a>
|
|
16
13
|
## Tasks and completion criteria
|
|
17
14
|
|
|
18
|
-
TASK, batch, REQ/AC or risk, repository ID, file/module, planned change
|
|
15
|
+
TASK, batch, REQ/AC or risk, repository ID, file/module, planned change and completion criteria. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="validation"></a>
|
|
21
17
|
## Review and independent verification arrangement
|
|
22
18
|
|
|
23
19
|
Each batch review, overall review then independent verification; no per-batch full test gates. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="execution"></a>
|
|
26
21
|
## Task status and execution records
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
Current status, actual changes, artifact references and object versions by existing TASK/B; preserve the approved tasks above and distinguish pre-existing changes. Record progress here, for example a table of Task | Status | Actual result. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="remaining"></a>
|
|
31
25
|
## Deviations, blockers and remaining work
|
|
32
26
|
|
|
33
27
|
Unfinished effects and recovery, not a second stage ledger. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,37 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="info"></a>
|
|
6
5
|
## Document information and sources
|
|
7
6
|
|
|
8
7
|
Identify this delivery, revision and adopted inputs. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="goals"></a>
|
|
11
9
|
## Background, goals and non-goals
|
|
12
10
|
|
|
13
11
|
Separate known facts, requirements and assumptions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="scope"></a>
|
|
16
13
|
## Scope, engineering objects and endpoint
|
|
17
14
|
|
|
18
15
|
Included/excluded work, repository IDs, authorization and endpoint. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="requirements"></a>
|
|
21
17
|
## Requirements and behavior
|
|
22
18
|
|
|
23
19
|
REQ, type, actor/object, trigger/precondition, behavior, observable result, boundaries/errors, source and AC. Shared business rules, access control (even one role), performance and reliability need independent identity when independently testable. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="states"></a>
|
|
26
21
|
## States, interaction and recovery
|
|
27
22
|
|
|
28
23
|
Allowed transitions, terminal states, errors and recovery; say why inapplicable. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="acceptance"></a>
|
|
31
25
|
## Acceptance criteria
|
|
32
26
|
|
|
33
27
|
AC, requirement reference, condition, operation, decidable expected result. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
34
28
|
|
|
35
|
-
<a id="arrangement"></a>
|
|
36
29
|
## Dependencies, questions and stage arrangement
|
|
37
30
|
|
|
38
31
|
Selected order, artifact locations/reuse, dependencies, Q with impact/status/decision source. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="basis"></a>
|
|
6
5
|
## Review basis and scope
|
|
7
6
|
|
|
8
7
|
Exact repositories/objects, baseline and differences. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="reviews"></a>
|
|
11
9
|
## Review records
|
|
12
10
|
|
|
13
11
|
REV, batch/overall/repair scope, TASK/REQ/AC, reviewer/date, findings, dispositions and recheck conclusions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="conclusion"></a>
|
|
16
13
|
## Open findings and current conclusion
|
|
17
14
|
|
|
18
15
|
Preserve historical findings and old object basis; review is not execution. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,37 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="info"></a>
|
|
6
5
|
## Document information and source versions
|
|
7
6
|
|
|
8
7
|
Delivery identity and adopted versions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="goals"></a>
|
|
11
9
|
## Goal, engineering objects and endpoint
|
|
12
10
|
|
|
13
11
|
Actual repository IDs, authorized objects and endpoint. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="adoption"></a>
|
|
16
13
|
## Source mapping and adopted scope
|
|
17
14
|
|
|
18
15
|
Source/version/original ID or section, adoption decision, requirement reference, AC and gaps; do not copy the full PRD. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="exclusions"></a>
|
|
21
17
|
## Exclusions and constraints
|
|
22
18
|
|
|
23
19
|
Explicitly delimit this commission. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="decisions"></a>
|
|
26
21
|
## Conflicts, gaps and supplementary decisions
|
|
27
22
|
|
|
28
23
|
Preserve sources; identify decision authority and pending source updates. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="acceptance"></a>
|
|
31
25
|
## Acceptance basis
|
|
32
26
|
|
|
33
27
|
AC, requirement/source identity, conditions, actions and expected results. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
34
28
|
|
|
35
|
-
<a id="arrangement"></a>
|
|
36
29
|
## Authorization, questions and stage arrangement
|
|
37
30
|
|
|
38
31
|
Selected order, artifact locations/reuse, permissions and open Q. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,37 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="basis"></a>
|
|
6
5
|
## Basis and engineering context
|
|
7
6
|
|
|
8
7
|
Current requirements and actual engineering constraints. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="architecture"></a>
|
|
11
9
|
## Architecture and key flows
|
|
12
10
|
|
|
13
11
|
Ordered explanation or diagram of the important flow. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="modules"></a>
|
|
16
13
|
## Modules and interaction implementation
|
|
17
14
|
|
|
18
15
|
Repository ID, responsibility, actual path, new/change, requirement refs; entry/state/data flow for interaction. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="data"></a>
|
|
21
17
|
## Data, interfaces and SQL
|
|
22
18
|
|
|
23
19
|
Structures, indexes, consistency, contract authority, database type/version/schema basis, SQL order and execution boundary. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="errors"></a>
|
|
26
21
|
## Errors and nonfunctional design
|
|
27
22
|
|
|
28
23
|
Recovery, access, performance, observability, cache/messages when relevant. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="risks"></a>
|
|
31
25
|
## Tradeoffs and risks
|
|
32
26
|
|
|
33
27
|
Reasons, alternatives, compatibility and technical risks. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
34
28
|
|
|
35
|
-
<a id="coverage"></a>
|
|
36
29
|
## Requirement coverage and questions
|
|
37
30
|
|
|
38
31
|
REQ/AC to module/operation/SQL section and unresolved Q. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
@@ -2,32 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Delivery: <deliveryId from init>; document revision: <revision>.
|
|
4
4
|
|
|
5
|
-
<a id="basis"></a>
|
|
6
5
|
## Basis and scope
|
|
7
6
|
|
|
8
7
|
Current AC and risks; adopted cases location/version if verify-only. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
9
8
|
|
|
10
|
-
<a id="environment"></a>
|
|
11
9
|
## Environment, data and execution conditions
|
|
12
10
|
|
|
13
11
|
Tools, permissions, commands and unavailable conditions. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
14
12
|
|
|
15
|
-
<a id="cases"></a>
|
|
16
13
|
## Test cases
|
|
17
14
|
|
|
18
|
-
TC,
|
|
15
|
+
TC, REQ/AC or risk, type/level, preconditions, operations, concrete expected result, method/entry. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
19
16
|
|
|
20
|
-
<a id="coverage"></a>
|
|
21
17
|
## Coverage and verification arrangement
|
|
22
18
|
|
|
23
19
|
AC, requirements, TC, gaps and execution group/order. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
24
20
|
|
|
25
|
-
<a id="runs"></a>
|
|
26
21
|
## Execution and retest records
|
|
27
22
|
|
|
28
|
-
RUN, TC
|
|
23
|
+
RUN, TC, testing document version, exact code/build or document object, command/operation, assertions, actual results and evidence. Not executed until actually run; append failures/retests. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
|
29
24
|
|
|
30
|
-
<a id="conclusion"></a>
|
|
31
25
|
## Defects, current conclusion and remaining work
|
|
32
26
|
|
|
33
27
|
Separate passed, failed, blocked and unexecuted; explain applicability after change. Replace guidance with actual content; explain inapplicability, never prefill a result.
|
package/lib/migrate.mjs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { atomicWrite, exists, fail, hash, json, noSymlinks, readJSON, withLock } from './io.mjs';
|
|
4
|
-
import { statePaths, validateState, assertInstallationComplete, readState } from './state.mjs';
|
|
5
|
-
import { savedResult } from './view.mjs';
|
|
6
|
-
|
|
7
|
-
export async function migrateState(directory, revision, rulesVersion, runtime, input) {
|
|
8
|
-
assertInstallationComplete(runtime);
|
|
9
|
-
if (rulesVersion !== runtime.version || runtime.version !== runtime.activeVersion) fail('VERSION_MISMATCH','Migration requires the active tool.','Bind the active version.');
|
|
10
|
-
if (!input || Object.keys(input).length !== 1 || typeof input.compatibilityRef !== 'string' || !input.compatibilityRef.trim()) fail('USAGE','Migration input is {compatibilityRef}.','Record the assessment and old/new document disposition first.');
|
|
11
|
-
const old=statePaths(directory,true), modern=statePaths(directory);
|
|
12
|
-
await noSymlinks(modern.internal); await fs.mkdir(modern.internal,{recursive:true});
|
|
13
|
-
return withLock(old.lock,()=>withLock(modern.lock,async()=>{
|
|
14
|
-
const journalPath=path.join(modern.internal,'migration.json');
|
|
15
|
-
for (const file of [journalPath,old.statePath,old.backup,modern.statePath,path.join(modern.internal,'legacy/state.json'),path.join(modern.internal,'legacy/state.previous.json')]) await noSymlinks(file);
|
|
16
|
-
let journal;
|
|
17
|
-
if (await exists(journalPath)) {
|
|
18
|
-
journal=await readJSON(journalPath);
|
|
19
|
-
if (journal.protocol !== 1 || journal.revision !== revision || journal.compatibilityRef !== input.compatibilityRef) fail('MIGRATION_CONFLICT','Migration parameters or journal differ.','Inspect recorded migration; never overwrite the copies.');
|
|
20
|
-
if (journal.status==='complete') {
|
|
21
|
-
if (await exists(old.statePath)) fail('LAYOUT_CONFLICT','A root state reappeared after migration.','Inspect both states before proceeding.');
|
|
22
|
-
return {state:(await readState(directory)).state,migration:'already-complete'};
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
if (await exists(modern.statePath) || await exists(modern.backup)) fail('LAYOUT_CONFLICT','Target state/recovery already exists.','Inspect both layouts; do not merge by timestamp.');
|
|
26
|
-
await noSymlinks(old.statePath); await noSymlinks(old.backup);
|
|
27
|
-
const raw=await fs.readFile(old.statePath,'utf8'), state=JSON.parse(raw);
|
|
28
|
-
validateState(state);
|
|
29
|
-
if (state.schemaVersion!==1) fail('UNKNOWN_SCHEMA','Only schema 1 root state can migrate.','Keep unknown formats read-only.');
|
|
30
|
-
if (state.revision!==revision) fail('REVISION_CONFLICT','Legacy revision changed.','Read and reassess before migration.');
|
|
31
|
-
const next={...state,schemaVersion:2,revision:state.revision+1,updatedAt:new Date().toISOString(),documentPolicy:{authority:'legacy'},documents:[],legacyRunIds:state.stageRuns.map(r=>r.id),migration:{fromSchema:1,compatibilityRef:input.compatibilityRef}};
|
|
32
|
-
// validate the assessment reference with the ordinary state reference protocol.
|
|
33
|
-
validateState({...next,next:{...next.next,inputRefs:[input.compatibilityRef]}});
|
|
34
|
-
const backupRaw=await exists(old.backup)?await fs.readFile(old.backup,'utf8'):null;
|
|
35
|
-
journal={protocol:1,status:'prepared',revision,compatibilityRef:input.compatibilityRef,sourceHash:hash(raw),backupHash:backupRaw===null?null:hash(backupRaw),targetHash:hash(json(next)),target:next};
|
|
36
|
-
const legacyDir=path.join(modern.internal,'legacy'); await noSymlinks(legacyDir); await fs.mkdir(legacyDir,{recursive:true});
|
|
37
|
-
for (const [name,bytes] of [['state.json',raw],['state.previous.json',backupRaw]]) {
|
|
38
|
-
if(bytes===null) continue;
|
|
39
|
-
const file=path.join(legacyDir,name);
|
|
40
|
-
if(await exists(file) && hash(await fs.readFile(file))!==hash(bytes)) fail('MIGRATION_CONFLICT','Legacy backup differs.','Preserve all copies and resolve manually.');
|
|
41
|
-
if(!await exists(file)) await atomicWrite(file,bytes);
|
|
42
|
-
}
|
|
43
|
-
await atomicWrite(journalPath,json(journal));
|
|
44
|
-
}
|
|
45
|
-
validateState(journal.target);
|
|
46
|
-
if (hash(json(journal.target))!==journal.targetHash) fail('MIGRATION_CONFLICT','Migration target checksum changed.','Inspect journal and preserved source.');
|
|
47
|
-
const legacyCopy=path.join(modern.internal,'legacy/state.json');
|
|
48
|
-
if(hash(await fs.readFile(legacyCopy))!==journal.sourceHash) fail('MIGRATION_CONFLICT','Preserved source changed.','Recover the original source before resuming.');
|
|
49
|
-
const recoveryCopy=path.join(modern.internal,'legacy/state.previous.json');
|
|
50
|
-
if (journal.backupHash !== null && (!await exists(recoveryCopy) || hash(await fs.readFile(recoveryCopy))!==journal.backupHash)) fail('MIGRATION_CONFLICT','Preserved recovery copy is missing or changed.','Repair the preserved copy from the original recovery material before resuming.');
|
|
51
|
-
if(await exists(old.statePath) && hash(await fs.readFile(old.statePath))!==journal.sourceHash) fail('MIGRATION_CONFLICT','Legacy state changed during migration.','Reconcile facts; do not overwrite either copy.');
|
|
52
|
-
if(await exists(modern.statePath) && hash(await fs.readFile(modern.statePath))!==journal.targetHash) fail('MIGRATION_CONFLICT','Target state changed during migration.','Reconcile both states.');
|
|
53
|
-
if(await exists(old.backup) && hash(await fs.readFile(old.backup))!==journal.backupHash) fail('MIGRATION_CONFLICT','Legacy recovery copy changed.','Preserve both recovery copies.');
|
|
54
|
-
if(!await exists(modern.statePath)) await atomicWrite(modern.statePath,json(journal.target));
|
|
55
|
-
await fs.rm(old.statePath,{force:true}); await fs.rm(old.backup,{force:true});
|
|
56
|
-
await atomicWrite(journalPath,json({...journal,status:'complete'}));
|
|
57
|
-
return savedResult(directory,journal.target);
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Discovery is intentionally bounded to named material roots, never the home or code tree.
|
|
62
|
-
export async function scanDeliveries(root) {
|
|
63
|
-
const records=[],issues=[],seen=new Map();
|
|
64
|
-
for(const entry of await fs.readdir(root,{withFileTypes:true})) {
|
|
65
|
-
if(!entry.isDirectory() || entry.name.startsWith('.')) continue;
|
|
66
|
-
const directory=path.join(root,entry.name);
|
|
67
|
-
if(!await exists(path.join(directory,'state.json')) && !await exists(path.join(directory,'.aimship/state.json'))) continue;
|
|
68
|
-
try {
|
|
69
|
-
const read=await readState(directory), id=read.state.deliveryId;
|
|
70
|
-
if(read.conflict || read.readOnly) {issues.push({directory,reason:read.conflict?'layout-conflict':'unknown-schema',candidates:read.candidates}); continue;}
|
|
71
|
-
if(seen.has(id)) {issues.push({directory,reason:'duplicate-delivery-id',other:seen.get(id)}); continue;}
|
|
72
|
-
seen.set(id,directory);
|
|
73
|
-
records.push({directory,statePath:read.statePath,deliveryId:id,rulesVersion:read.state.rulesVersion,repositories:read.state.repositories,currentRun:read.state.currentRun,stageRuns:read.state.stageRuns,outcome:read.state.outcome,next:read.state.next,updatedAt:read.state.updatedAt,migration:read.migration?.status??null});
|
|
74
|
-
} catch(error) {issues.push({directory,reason:error.code??error.message});}
|
|
75
|
-
}
|
|
76
|
-
return {root:path.resolve(root),records,issues,limits:'Named root immediate children only. Records may be stale; unknown roots and non-Aimship work are outside this check. Agent must assess actual writing intent and checkout/worktree identity.'};
|
|
77
|
-
}
|