@plainconceptsplatform/agent-harness 2.4.0 → 2.5.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 +435 -437
- package/cli/fragments/archive/az.md +97 -95
- package/cli/fragments/archive/gh.md +96 -94
- package/cli/fragments/archive/gl.md +96 -94
- package/cli/fragments/archive/none.md +75 -73
- package/cli/fragments/guardrails/codegraph.md +5 -7
- package/cli/fragments/guardrails/humanizer.md +4 -4
- package/cli/fragments/guardrails/memory.md +4 -4
- package/cli/fragments/guardrails/rtk.md +3 -3
- package/cli/fragments/guardrails/simple-english.md +4 -4
- package/cli/fragments/ops-backlog/az.md +1 -1
- package/cli/fragments/ops-backlog/gh.md +1 -1
- package/cli/fragments/ops-backlog/jira.md +1 -1
- package/cli/fragments/ops-evidence/az.md +44 -41
- package/cli/fragments/ops-evidence/gh.md +54 -53
- package/cli/fragments/ops-evidence/jira.md +42 -38
- package/cli/fragments/ops-review/az.md +1 -1
- package/cli/fragments/ops-review/gh.md +1 -1
- package/cli/fragments/ops-review/gl.md +1 -1
- package/cli/fragments/ops-ship/az.md +81 -80
- package/cli/fragments/ops-ship/gh.md +68 -68
- package/cli/fragments/ops-ship/gl.md +85 -85
- package/cli/presets/agents-content.json +34 -53
- package/cli/steps/copy/agents.js +18 -17
- package/cli/steps/copy/opencode-json.js +5 -1
- package/cli/steps/copy/skills.js +98 -5
- package/cli/steps/optimization/patch-guardrails.js +5 -3
- package/cli/utils/copy.js +8 -3
- package/cli/utils/update-manifest.js +28 -2
- package/harness/.agents/skills/pc-guardrails-generic/SKILL.md +47 -68
- package/harness/.agents/skills/pc-make-architecture/SKILL.md +31 -51
- package/harness/.agents/skills/pc-make-design/SKILL.md +45 -68
- package/harness/.agents/skills/pc-make-engineer/SKILL.md +59 -219
- package/harness/.agents/skills/pc-make-engineer/signal-mapping.md +53 -68
- package/harness/.agents/skills/pc-make-engineer/template.md +42 -80
- package/harness/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -18
- package/harness/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -29
- package/harness/.agents/skills/pc-make-guardrails/SKILL.md +43 -74
- package/harness/.agents/skills/pc-make-guardrails/category-reference.md +10 -5
- package/harness/.agents/skills/pc-make-merge-risk-assess/category-reference.md +26 -7
- package/harness/.agents/skills/pc-make-user-model/SKILL.md +56 -66
- package/harness/.agents/skills/pc-ops-evidence/SKILL.md +133 -127
- package/harness/.agents/skills/pc-plan-apply/SKILL.md +14 -5
- package/harness/.agents/skills/pc-plan-apply/simple-mode.md +21 -21
- package/harness/.agents/skills/pc-plan-archive/SKILL.md +66 -66
- package/harness/.agents/skills/pc-plan-explore/SKILL.md +19 -2
- package/harness/.agents/skills/pc-plan-goal/SKILL.md +11 -7
- package/harness/.agents/skills/pc-plan-goal/output-mode.md +1 -0
- package/harness/.agents/skills/pc-plan-goal/output.md +71 -65
- package/harness/.agents/skills/pc-plan-propose/SKILL.md +1 -1
- package/harness/.agents/skills/pc-plan-quick/SKILL.md +46 -62
- package/harness/.agents/skills/pc-plan-story/SKILL.md +48 -149
- package/harness/.agents/skills/pc-repo-help/SKILL.md +89 -91
- package/harness/.agents/skills/pc-repo-initialize/SKILL.md +112 -130
- package/harness/.agents/skills/pc-repo-onboard/SKILL.md +32 -87
- package/harness/.agents/skills/pc-repo-verify/SKILL.md +2 -0
- package/harness/.agents/skills/pc-userstory-az/SKILL.md +71 -157
- package/harness/.agents/skills/pc-userstory-browser/SKILL.md +50 -122
- package/harness/.agents/skills/pc-userstory-gh/SKILL.md +63 -120
- package/harness/.agents/skills/pc-userstory-jira/SKILL.md +74 -131
- package/harness/.opencode/commands/init.md +5 -5
- package/harness/.opencode/commands/make-architecture.md +5 -5
- package/harness/.opencode/commands/make-design.md +5 -5
- package/harness/.opencode/commands/make-engineer.md +5 -5
- package/harness/.opencode/commands/make-evidence-scaffold.md +5 -5
- package/harness/.opencode/commands/make-guardrails.md +5 -5
- package/harness/.opencode/commands/make-user-model.md +5 -5
- package/harness/.opencode/commands/plan-apply.md +9 -9
- package/harness/.opencode/commands/plan-goal.md +5 -5
- package/harness/.opencode/commands/plan-quick.md +5 -5
- package/harness/.opencode/commands/plan-story.md +9 -9
- package/harness/.opencode/commands/repo-audit.md +5 -5
- package/harness/.opencode/commands/repo-initialize.md +5 -5
- package/harness/.opencode/commands/repo-onboard.md +5 -5
- package/harness/.opencode/commands/repo-verify.md +5 -5
- package/harness/.opencode/plugins/pc-subagent-monitor.js +82 -2
- package/harness/.opencode/plugins/pc-subagent-tiers.js +9 -6
- package/harness/.opencode/plugins/pc-system-reminders.js +312 -3
- package/harness/AGENTS.md +49 -71
- package/harness/opencode.jsonc +1 -1
- package/package.json +1 -1
|
@@ -1,95 +1,97 @@
|
|
|
1
|
-
2. **Find the oldest change with a completed PR**
|
|
2
|
-
|
|
3
|
-
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
If empty, report a blocker and stop.
|
|
10
|
-
|
|
11
|
-
List completed PRs:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
az repos pr list --repository {repo} --status completed --query "sort_by(@, &closedDate)[].{name:title,sourceRefName:sourceRefName,closedDate:closedDate,pullRequestId:pullRequestId}"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Match each change to a completed PR using its ID and slug as search hints:
|
|
18
|
-
- No match → skip (record as blocked: `no merged PR found`).
|
|
19
|
-
- One match → eligible.
|
|
20
|
-
- Multiple matches → ask the user which PR belongs to that change.
|
|
21
|
-
|
|
22
|
-
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `closedDate` as the candidate.
|
|
23
|
-
|
|
24
|
-
3. **Confirm the candidate**
|
|
25
|
-
|
|
26
|
-
Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
Oldest unarchived merged change found:
|
|
30
|
-
ID: {change-id}
|
|
31
|
-
Title: {title from resolved PR}
|
|
32
|
-
PR ID: {pullRequestId}
|
|
33
|
-
Merged: {closedDate}
|
|
34
|
-
|
|
35
|
-
Proceed with archiving? [yes/no]
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Stop if the user does not confirm.
|
|
39
|
-
|
|
40
|
-
4. **Archive the change**
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
git checkout -b archive/{change-id}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
-
|
|
48
|
-
5. **Update docs**
|
|
49
|
-
|
|
50
|
-
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
-
|
|
52
|
-
6. **Create the archive PR**
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
git
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- Never
|
|
1
|
+
2. **Find the oldest change with a completed PR**
|
|
2
|
+
|
|
3
|
+
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
If empty, report a blocker and stop.
|
|
10
|
+
|
|
11
|
+
List completed PRs:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
az repos pr list --repository {repo} --status completed --query "sort_by(@, &closedDate)[].{name:title,sourceRefName:sourceRefName,closedDate:closedDate,pullRequestId:pullRequestId}"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Match each change to a completed PR using its ID and slug as search hints:
|
|
18
|
+
- No match → skip (record as blocked: `no merged PR found`).
|
|
19
|
+
- One match → eligible.
|
|
20
|
+
- Multiple matches → ask the user which PR belongs to that change.
|
|
21
|
+
|
|
22
|
+
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `closedDate` as the candidate.
|
|
23
|
+
|
|
24
|
+
3. **Confirm the candidate**
|
|
25
|
+
|
|
26
|
+
Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Oldest unarchived merged change found:
|
|
30
|
+
ID: {change-id}
|
|
31
|
+
Title: {title from resolved PR}
|
|
32
|
+
PR ID: {pullRequestId}
|
|
33
|
+
Merged: {closedDate}
|
|
34
|
+
|
|
35
|
+
Proceed with archiving? [yes/no]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Stop if the user does not confirm.
|
|
39
|
+
|
|
40
|
+
4. **Archive the change**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git checkout -b archive/{change-id}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
+
|
|
48
|
+
5. **Update docs**
|
|
49
|
+
|
|
50
|
+
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
+
|
|
52
|
+
6. **Create the archive PR**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Stage specific paths only: a shared tree may hold another agent's or a
|
|
56
|
+
# person's edits, and -A commits them under this message.
|
|
57
|
+
git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
|
|
58
|
+
git commit -m "archive: {title} ({change-id})"
|
|
59
|
+
git push origin archive/{change-id}
|
|
60
|
+
|
|
61
|
+
az repos pr create \
|
|
62
|
+
--repository {repo} \
|
|
63
|
+
--source-branch refs/heads/archive/{change-id} \
|
|
64
|
+
--target-branch "refs/heads/$DEFAULT_BRANCH" \
|
|
65
|
+
--title "archive: {title} ({change-id})" \
|
|
66
|
+
--description "Archive SDD artifacts for {change-id} after merge of {sourceRefName}." \
|
|
67
|
+
--auto-complete
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If work was stashed in step 1, restore it after the PR is created unless the user opts out.
|
|
71
|
+
|
|
72
|
+
7. **Report**
|
|
73
|
+
|
|
74
|
+
Display:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Archive complete
|
|
78
|
+
|
|
79
|
+
Change ID: {change-id}
|
|
80
|
+
Title: {title}
|
|
81
|
+
Original PR: {original-pr-link}
|
|
82
|
+
Archive PR: {archive-pr-link}
|
|
83
|
+
|
|
84
|
+
Documentation updates:
|
|
85
|
+
- ARCHITECTURE.md: {count} changes applied
|
|
86
|
+
- DESIGN.md: {count} changes applied
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Rules
|
|
90
|
+
|
|
91
|
+
- All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
|
|
92
|
+
- Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
|
|
93
|
+
- Use change ID and slug only as search hints; do not assume the source branch name.
|
|
94
|
+
- The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
|
|
95
|
+
- Never proceed if the selected PR is not completed.
|
|
96
|
+
- Never use browser tools or direct web requests for Azure DevOps. Use `az` CLI only.
|
|
97
|
+
- Never invent or guess PR, branch, or merge metadata.
|
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
2. **Find the oldest change with a completed PR**
|
|
2
|
-
|
|
3
|
-
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
If empty, report a blocker and stop.
|
|
10
|
-
|
|
11
|
-
List completed PRs:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
gh pr list --repo {owner}/{repo} --state merged --json title,headRefName,mergedAt,number --jq 'sort_by(.mergedAt) | .[] | {name: .title, sourceRefName: .headRefName, mergedAt: .mergedAt, pullRequestId: .number}'
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Match each change to a completed PR using its ID and slug as search hints:
|
|
18
|
-
- No match → skip (record as blocked: `no merged PR found`).
|
|
19
|
-
- One match → eligible.
|
|
20
|
-
- Multiple matches → ask the user which PR belongs to that change.
|
|
21
|
-
|
|
22
|
-
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `mergedAt` as the candidate.
|
|
23
|
-
|
|
24
|
-
3. **Confirm the candidate**
|
|
25
|
-
|
|
26
|
-
Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
Oldest unarchived merged change found:
|
|
30
|
-
ID: {change-id}
|
|
31
|
-
Title: {title from resolved PR}
|
|
32
|
-
PR ID: {pullRequestId}
|
|
33
|
-
Merged: {mergedAt}
|
|
34
|
-
|
|
35
|
-
Proceed with archiving? [yes/no]
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Stop if the user does not confirm.
|
|
39
|
-
|
|
40
|
-
4. **Archive the change**
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
git checkout -b archive/{change-id}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
-
|
|
48
|
-
5. **Update docs**
|
|
49
|
-
|
|
50
|
-
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
-
|
|
52
|
-
6. **Create the archive PR**
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
git
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
- Never
|
|
1
|
+
2. **Find the oldest change with a completed PR**
|
|
2
|
+
|
|
3
|
+
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
If empty, report a blocker and stop.
|
|
10
|
+
|
|
11
|
+
List completed PRs:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gh pr list --repo {owner}/{repo} --state merged --json title,headRefName,mergedAt,number --jq 'sort_by(.mergedAt) | .[] | {name: .title, sourceRefName: .headRefName, mergedAt: .mergedAt, pullRequestId: .number}'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Match each change to a completed PR using its ID and slug as search hints:
|
|
18
|
+
- No match → skip (record as blocked: `no merged PR found`).
|
|
19
|
+
- One match → eligible.
|
|
20
|
+
- Multiple matches → ask the user which PR belongs to that change.
|
|
21
|
+
|
|
22
|
+
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** PR `mergedAt` as the candidate.
|
|
23
|
+
|
|
24
|
+
3. **Confirm the candidate**
|
|
25
|
+
|
|
26
|
+
Show the candidate (ID, title, PR ID, merged date) and any blocked changes, then ask:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Oldest unarchived merged change found:
|
|
30
|
+
ID: {change-id}
|
|
31
|
+
Title: {title from resolved PR}
|
|
32
|
+
PR ID: {pullRequestId}
|
|
33
|
+
Merged: {mergedAt}
|
|
34
|
+
|
|
35
|
+
Proceed with archiving? [yes/no]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Stop if the user does not confirm.
|
|
39
|
+
|
|
40
|
+
4. **Archive the change**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git checkout -b archive/{change-id}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
+
|
|
48
|
+
5. **Update docs**
|
|
49
|
+
|
|
50
|
+
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
+
|
|
52
|
+
6. **Create the archive PR**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Stage specific paths only: a shared tree may hold another agent's or a
|
|
56
|
+
# person's edits, and -A commits them under this message.
|
|
57
|
+
git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
|
|
58
|
+
git commit -m "archive: {title} ({change-id})"
|
|
59
|
+
git push origin archive/{change-id}
|
|
60
|
+
|
|
61
|
+
gh pr create \
|
|
62
|
+
--repo {owner}/{repo} \
|
|
63
|
+
--base "$DEFAULT_BRANCH" \
|
|
64
|
+
--head archive/{change-id} \
|
|
65
|
+
--title "archive: {title} ({change-id})" \
|
|
66
|
+
--body "Archive SDD artifacts for {change-id} after merge."
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If work was stashed in step 1, restore it after the PR is created unless the user opts out.
|
|
70
|
+
|
|
71
|
+
7. **Report**
|
|
72
|
+
|
|
73
|
+
Display:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
Archive complete
|
|
77
|
+
|
|
78
|
+
Change ID: {change-id}
|
|
79
|
+
Title: {title}
|
|
80
|
+
Original PR: {original-pr-link}
|
|
81
|
+
Archive PR: {archive-pr-link}
|
|
82
|
+
|
|
83
|
+
Documentation updates:
|
|
84
|
+
- ARCHITECTURE.md: {count} changes applied
|
|
85
|
+
- DESIGN.md: {count} changes applied
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
- All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
|
|
91
|
+
- Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
|
|
92
|
+
- Use change ID and slug only as search hints; do not assume the source branch name.
|
|
93
|
+
- The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which PR if multiple match one change).
|
|
94
|
+
- Never proceed if the selected PR is not completed.
|
|
95
|
+
- Never use browser tools or direct web requests for GitHub. Use `gh` CLI only.
|
|
96
|
+
- Never invent or guess PR, branch, or merge metadata.
|
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
2. **Find the oldest change with a completed MR**
|
|
2
|
-
|
|
3
|
-
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
If empty, report a blocker and stop.
|
|
10
|
-
|
|
11
|
-
List completed merge requests:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
glab mr list --repo {owner}/{repo} --merged --output json --jq 'sort_by(.merged_at) | .[] | {name: .title, sourceRefName: .source_branch, mergedAt: .merged_at, mergeRequestId: .iid}'
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Match each change to a completed MR using its ID and slug as search hints:
|
|
18
|
-
- No match → skip (record as blocked: `no merged MR found`).
|
|
19
|
-
- One match → eligible.
|
|
20
|
-
- Multiple matches → ask the user which MR belongs to that change.
|
|
21
|
-
|
|
22
|
-
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** MR `merged_at` as the candidate.
|
|
23
|
-
|
|
24
|
-
3. **Confirm the candidate**
|
|
25
|
-
|
|
26
|
-
Show the candidate (ID, title, MR ID, merged date) and any blocked changes, then ask:
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
Oldest unarchived merged change found:
|
|
30
|
-
ID: {change-id}
|
|
31
|
-
Title: {title from resolved MR}
|
|
32
|
-
MR ID: {iid}
|
|
33
|
-
Merged: {merged_at}
|
|
34
|
-
|
|
35
|
-
Proceed with archiving? [yes/no]
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Stop if the user does not confirm.
|
|
39
|
-
|
|
40
|
-
4. **Archive the change**
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
git checkout -b archive/{change-id}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
-
|
|
48
|
-
5. **Update docs**
|
|
49
|
-
|
|
50
|
-
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
-
|
|
52
|
-
6. **Create the archive MR**
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
git
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
- Never
|
|
1
|
+
2. **Find the oldest change with a completed MR**
|
|
2
|
+
|
|
3
|
+
List unarchived changes (top-level only, excludes `archive/`):
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
find "$REPO_ROOT/openspec/changes" -mindepth 1 -maxdepth 1 -type d -not -name 'archive' | sort
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
If empty, report a blocker and stop.
|
|
10
|
+
|
|
11
|
+
List completed merge requests:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
glab mr list --repo {owner}/{repo} --merged --output json --jq 'sort_by(.merged_at) | .[] | {name: .title, sourceRefName: .source_branch, mergedAt: .merged_at, mergeRequestId: .iid}'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Match each change to a completed MR using its ID and slug as search hints:
|
|
18
|
+
- No match → skip (record as blocked: `no merged MR found`).
|
|
19
|
+
- One match → eligible.
|
|
20
|
+
- Multiple matches → ask the user which MR belongs to that change.
|
|
21
|
+
|
|
22
|
+
If nothing is eligible, report a blocker and stop. Otherwise select the eligible change with the **oldest** MR `merged_at` as the candidate.
|
|
23
|
+
|
|
24
|
+
3. **Confirm the candidate**
|
|
25
|
+
|
|
26
|
+
Show the candidate (ID, title, MR ID, merged date) and any blocked changes, then ask:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Oldest unarchived merged change found:
|
|
30
|
+
ID: {change-id}
|
|
31
|
+
Title: {title from resolved MR}
|
|
32
|
+
MR ID: {iid}
|
|
33
|
+
Merged: {merged_at}
|
|
34
|
+
|
|
35
|
+
Proceed with archiving? [yes/no]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Stop if the user does not confirm.
|
|
39
|
+
|
|
40
|
+
4. **Archive the change**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git checkout -b archive/{change-id}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Load `@openspec-archive-change` skill and follow it to archive the change.
|
|
47
|
+
|
|
48
|
+
5. **Update docs**
|
|
49
|
+
|
|
50
|
+
Compare the archived change's specs against `ARCHITECTURE.md` and `DESIGN.md`. If updates are needed, show them and get user approval before applying.
|
|
51
|
+
|
|
52
|
+
6. **Create the archive MR**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Stage specific paths only: a shared tree may hold another agent's or a
|
|
56
|
+
# person's edits, and -A commits them under this message.
|
|
57
|
+
git add openspec/changes/ # plus ARCHITECTURE.md / DESIGN.md if step 5 updated them
|
|
58
|
+
git commit -m "archive: {title} ({change-id})"
|
|
59
|
+
git push origin archive/{change-id}
|
|
60
|
+
|
|
61
|
+
glab mr create \
|
|
62
|
+
--repo {owner}/{repo} \
|
|
63
|
+
--source-branch "archive/{change-id}" \
|
|
64
|
+
--target-branch "$DEFAULT_BRANCH" \
|
|
65
|
+
--title "archive: {title} ({change-id})" \
|
|
66
|
+
--description "Archive SDD artifacts for {change-id} after merge."
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If work was stashed in step 1, restore it after the MR is created unless the user opts out.
|
|
70
|
+
|
|
71
|
+
7. **Report**
|
|
72
|
+
|
|
73
|
+
Display:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
Archive complete
|
|
77
|
+
|
|
78
|
+
Change ID: {change-id}
|
|
79
|
+
Title: {title}
|
|
80
|
+
Original MR: {original-mr-link}
|
|
81
|
+
Archive MR: {archive-mr-link}
|
|
82
|
+
|
|
83
|
+
Documentation updates:
|
|
84
|
+
- ARCHITECTURE.md: {count} changes applied
|
|
85
|
+
- DESIGN.md: {count} changes applied
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
- All OpenSpec paths resolve from `git rev-parse --show-toplevel`. Never use `/openspec/...`.
|
|
91
|
+
- Only process top-level directories in `$REPO_ROOT/openspec/changes/`; exclude `archive/`.
|
|
92
|
+
- Use change ID and slug only as search hints; do not assume the source branch name.
|
|
93
|
+
- The oldest eligible merged change is the only candidate: never ask the user which change to archive (but do ask which MR if multiple match one change).
|
|
94
|
+
- Never proceed if the selected MR is not completed.
|
|
95
|
+
- Never use browser tools or direct web requests for GitLab. Use `glab` CLI only.
|
|
96
|
+
- Never invent or guess MR, branch, or merge metadata.
|