refacil-sdd-ai 4.2.4 → 4.4.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 +239 -214
- package/agents/auditor.md +189 -184
- package/agents/debugger.md +201 -204
- package/agents/implementer.md +150 -149
- package/agents/investigator.md +80 -89
- package/agents/proposer.md +219 -124
- package/agents/tester.md +140 -144
- package/agents/validator.md +153 -145
- package/bin/cli.js +158 -116
- package/lib/bus/askFulfillment.js +17 -17
- package/lib/bus/broker.js +599 -599
- package/lib/bus/ui/app.js +318 -318
- package/lib/commands/sdd.js +447 -0
- package/lib/hooks.js +236 -236
- package/lib/installer.js +58 -2
- package/lib/methodology-migration-pending.js +101 -136
- package/package.json +4 -6
- package/skills/apply/SKILL.md +139 -120
- package/skills/archive/SKILL.md +105 -107
- package/skills/ask/SKILL.md +78 -78
- package/skills/attend/SKILL.md +70 -70
- package/skills/bug/SKILL.md +121 -128
- package/skills/explore/SKILL.md +73 -63
- package/skills/guide/SKILL.md +79 -79
- package/skills/inbox/SKILL.md +43 -43
- package/skills/join/SKILL.md +82 -82
- package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
- package/skills/prereqs/SKILL.md +30 -37
- package/skills/propose/SKILL.md +103 -102
- package/skills/reply/SKILL.md +44 -44
- package/skills/review/SKILL.md +163 -126
- package/skills/review/checklist-back.md +92 -92
- package/skills/review/checklist-front.md +72 -72
- package/skills/review/checklist.md +114 -114
- package/skills/say/SKILL.md +38 -38
- package/skills/setup/SKILL.md +85 -141
- package/skills/setup/troubleshooting.md +38 -35
- package/skills/test/SKILL.md +104 -94
- package/skills/test/testing-patterns.md +63 -63
- package/skills/up-code/SKILL.md +108 -108
- package/skills/update/SKILL.md +109 -132
- package/skills/verify/SKILL.md +159 -132
- package/templates/compact-guidance.md +45 -45
- package/templates/methodology-guide.md +46 -42
- package/config/openspec-config.yaml +0 -8
- package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
> **
|
|
4
|
-
>
|
|
5
|
-
> tests,
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
src/
|
|
18
|
-
src/
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
### Arrange-Act-Assert (AAA)
|
|
24
|
-
```
|
|
25
|
-
// Arrange —
|
|
26
|
-
// Act —
|
|
27
|
-
// Assert —
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Naming conventions
|
|
31
|
-
```
|
|
32
|
-
#
|
|
33
|
-
should [
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
"should return product when valid id is provided"
|
|
37
|
-
"should throw error when input is empty"
|
|
38
|
-
"should update status when payment is confirmed"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Anti-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
## Mocks
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
- APIs
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- Loggers (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
- DTOs, mappers,
|
|
63
|
-
-
|
|
1
|
+
# Testing Patterns — Reference
|
|
2
|
+
|
|
3
|
+
> **NOTE**: This file is a generic reference. Generated tests must follow
|
|
4
|
+
> the actual project patterns (detected automatically). If the project already has
|
|
5
|
+
> tests, those patterns take priority over the ones in this file.
|
|
6
|
+
|
|
7
|
+
## Test file structure
|
|
8
|
+
|
|
9
|
+
The location of tests depends on the project. Common patterns:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
# Same directory (common in JS/TS, Go, Rust)
|
|
13
|
+
file.ts → file.spec.ts / file.test.ts
|
|
14
|
+
file.go → file_test.go
|
|
15
|
+
|
|
16
|
+
# Separate directory (common in Java, Python, some JS/TS)
|
|
17
|
+
src/service.java → test/service_test.java
|
|
18
|
+
src/module.py → tests/test_module.py
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Universal principles
|
|
22
|
+
|
|
23
|
+
### Arrange-Act-Assert (AAA)
|
|
24
|
+
```
|
|
25
|
+
// Arrange — prepare data and mocks
|
|
26
|
+
// Act — execute the operation
|
|
27
|
+
// Assert — verify the result
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Naming conventions
|
|
31
|
+
```
|
|
32
|
+
# Recommended format (adapt to language/framework):
|
|
33
|
+
should [verb] [result] when [condition]
|
|
34
|
+
|
|
35
|
+
# Examples:
|
|
36
|
+
"should return product when valid id is provided"
|
|
37
|
+
"should throw error when input is empty"
|
|
38
|
+
"should update status when payment is confirmed"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Anti-patterns to avoid
|
|
42
|
+
|
|
43
|
+
- Do NOT test private properties/methods directly
|
|
44
|
+
- Do NOT test internal implementation (call order) unless critical
|
|
45
|
+
- Do NOT create tests without assertions
|
|
46
|
+
- Do NOT create tests that depend on execution order
|
|
47
|
+
- Do NOT mock everything — only system boundaries (DB, external APIs, filesystem)
|
|
48
|
+
- Do NOT create brittle tests that break with cosmetic changes
|
|
49
|
+
- Do NOT duplicate the code logic in the test (the test must verify behavior, not re-implement)
|
|
50
|
+
|
|
51
|
+
## Mocks and Stubs
|
|
52
|
+
|
|
53
|
+
Mock only what is outside the test's control:
|
|
54
|
+
- Database calls
|
|
55
|
+
- External APIs / HTTP services
|
|
56
|
+
- File system (if applicable)
|
|
57
|
+
- Message queues
|
|
58
|
+
- Loggers (when they interfere with output)
|
|
59
|
+
|
|
60
|
+
Do not mock:
|
|
61
|
+
- Pure functions of the module itself
|
|
62
|
+
- DTOs, mappers, utilities without side effects
|
|
63
|
+
- Constants or static configuration
|
package/skills/up-code/SKILL.md
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refacil:up-code
|
|
3
|
-
description:
|
|
4
|
-
user-invocable: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# refacil:up-code —
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
**
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
###
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
1.
|
|
34
|
-
2.
|
|
35
|
-
3.
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
4.
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
1.
|
|
60
|
-
2.
|
|
61
|
-
3.
|
|
62
|
-
4.
|
|
63
|
-
5.
|
|
64
|
-
6.
|
|
65
|
-
7.
|
|
66
|
-
|
|
67
|
-
###
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
1.
|
|
74
|
-
```
|
|
75
|
-
===
|
|
76
|
-
|
|
77
|
-
Commit: [hash
|
|
78
|
-
Remote: origin/[
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
2. **
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
3.
|
|
89
|
-
- **GitHub** (url
|
|
90
|
-
- **Bitbucket** (url
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
4.
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Tip:
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**
|
|
103
|
-
|
|
104
|
-
##
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
1
|
+
---
|
|
2
|
+
name: refacil:up-code
|
|
3
|
+
description: Push code and create PR for integration — git add, commit, push, and PR to the target branch
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# refacil:up-code — Integrate Code and Publish Changes
|
|
8
|
+
|
|
9
|
+
Pushes changes to the remote repository and generates the PR for integration.
|
|
10
|
+
Applies the branch and integration policy defined in `refacil-prereqs/METHODOLOGY-CONTRACT.md` (no exceptions).
|
|
11
|
+
|
|
12
|
+
**Prerequisites**: `agents` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md` (branch policy applies without exceptions).
|
|
13
|
+
|
|
14
|
+
## Instructions
|
|
15
|
+
|
|
16
|
+
### Step 1: Detect and validate current branch
|
|
17
|
+
|
|
18
|
+
Run `git branch --show-current` to get the branch name.
|
|
19
|
+
|
|
20
|
+
- If the current branch is protected (according to `METHODOLOGY-CONTRACT.md`), **stop** and inform the user:
|
|
21
|
+
```
|
|
22
|
+
Cannot push code from a protected branch ([name]).
|
|
23
|
+
Branch validation is done in /refacil:apply or /refacil:bug before writing code.
|
|
24
|
+
Switch to your working branch (feature/*, fix/*, etc.) and run /refacil:up-code again.
|
|
25
|
+
```
|
|
26
|
+
- If the branch is a working branch (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continue.
|
|
27
|
+
|
|
28
|
+
### Step 2: Verify review (mandatory)
|
|
29
|
+
|
|
30
|
+
Before continuing, verify if there are active changes in `refacil-sdd/changes/` (exclude the `archive/` folder).
|
|
31
|
+
|
|
32
|
+
If there are active changes:
|
|
33
|
+
1. For each active folder, verify if the `.review-passed` file exists (hidden marker: **`METHODOLOGY-CONTRACT.md` §8** — do not conclude from `ls` without `-a`).
|
|
34
|
+
2. If **all** have `.review-passed` → continue to step 3.
|
|
35
|
+
3. If there is **one single** folder without `.review-passed`:
|
|
36
|
+
- Inform the user which one.
|
|
37
|
+
- Automatically run `/refacil:review <change-name>` on that change.
|
|
38
|
+
- If the review approves (creates `.review-passed`) → continue to step 3.
|
|
39
|
+
- If the review requires corrections → stop and inform the user of the findings.
|
|
40
|
+
4. If there are **multiple** folders without `.review-passed`:
|
|
41
|
+
- Stop the flow and ask the user to explicitly select which change to push.
|
|
42
|
+
- Run `/refacil:review <selected-change-name>` only for that change.
|
|
43
|
+
- Do not run automatic bulk review in this case.
|
|
44
|
+
|
|
45
|
+
**IMPORTANT**: `/refacil:review` internally verifies if `.review-passed` exists and if there are changes after it. It only re-runs if it detects new changes after the last approved review.
|
|
46
|
+
|
|
47
|
+
If there is no `refacil-sdd/changes/` folder or no active changes → continue to step 3 (nothing to review).
|
|
48
|
+
|
|
49
|
+
### Step 3: Verify pending changes
|
|
50
|
+
|
|
51
|
+
Run `git status` to verify if there are changes to push.
|
|
52
|
+
|
|
53
|
+
- If there are no pending changes or unpushed commits, inform the user and stop.
|
|
54
|
+
- If there are uncommitted changes, continue to step 4.
|
|
55
|
+
- If there are only unpushed commits (nothing to commit), jump directly to step 5.
|
|
56
|
+
|
|
57
|
+
### Step 4: Commit changes
|
|
58
|
+
|
|
59
|
+
1. Run `git status --short` and show the user the list of detected files.
|
|
60
|
+
2. Ask for explicit confirmation before staging everything.
|
|
61
|
+
3. If the user confirms global staging, use `git add -A`.
|
|
62
|
+
4. If the user requests partial staging, add only the indicated paths.
|
|
63
|
+
5. If the user provided a message as argument (`$ARGUMENTS`), use it as the commit message.
|
|
64
|
+
6. If no message was provided, generate a descriptive one based on the detected changes with `git diff --staged --stat`.
|
|
65
|
+
7. Run `git commit -m "[message]"`.
|
|
66
|
+
|
|
67
|
+
### Step 5: Push to remote
|
|
68
|
+
|
|
69
|
+
Run `git push -u origin [current-branch]` to push the changes.
|
|
70
|
+
|
|
71
|
+
### Step 6: Confirm and create PR
|
|
72
|
+
|
|
73
|
+
1. Show the push summary:
|
|
74
|
+
```
|
|
75
|
+
=== Code pushed ===
|
|
76
|
+
Branch: [branch-name]
|
|
77
|
+
Commit: [short-hash] [message]
|
|
78
|
+
Remote: origin/[branch-name]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
2. **Ask the user** which branch they want to create the PR to. Suggest `testing` as the default target:
|
|
82
|
+
```
|
|
83
|
+
Which branch do you want to create the PR to? (recommended: testing)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If the user indicates a different branch than `testing`, verify it exists on the remote with `git branch -r | grep <indicated-branch>` before generating the link. If it does not exist, inform the user and ask them to confirm or correct the name.
|
|
87
|
+
|
|
88
|
+
3. Get the remote repository URL with `git remote get-url origin` and determine the hosting to generate the correct link:
|
|
89
|
+
- **GitHub** (url contains `github.com`): `https://github.com/[owner]/[repo]/compare/[target-branch]...[current-branch]?expand=1`
|
|
90
|
+
- **Bitbucket** (url contains `bitbucket.org`): `https://bitbucket.org/[workspace]/[repo]/pull-requests/new?source=[current-branch]&dest=[target-branch]`
|
|
91
|
+
- If hosting cannot be determined, show both formats for the user to choose.
|
|
92
|
+
- Note: for SSH URLs (`git@github.com:owner/repo.git` or `git@bitbucket.org:workspace/repo.git`), extract owner/workspace and repo from the path after `:`.
|
|
93
|
+
|
|
94
|
+
4. Show the link to the user and recommend PR to `testing`:
|
|
95
|
+
```
|
|
96
|
+
Create your PR here: [link]
|
|
97
|
+
|
|
98
|
+
Tip: PR to testing is recommended to enable integrated testing
|
|
99
|
+
before promoting to other protected branches.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**This is the terminal step of the SDD flow.** Do not ask for a next skill — the cycle closes here. Apply the terminal step rule from `METHODOLOGY-CONTRACT.md §5`.
|
|
103
|
+
|
|
104
|
+
## Rules
|
|
105
|
+
|
|
106
|
+
- Strictly respect the protected branch and PR integration policy from `METHODOLOGY-CONTRACT.md`
|
|
107
|
+
- If the current branch is protected, **stop** — branch validation/change is done in `/refacil:apply` or `/refacil:bug`, not here
|
|
108
|
+
- Do not force push (--force) unless the user explicitly asks for it
|
package/skills/update/SKILL.md
CHANGED
|
@@ -1,132 +1,109 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refacil:update
|
|
3
|
-
description:
|
|
4
|
-
user-invocable: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# refacil:update —
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
refacil-sdd-ai migration-pending
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| # |
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| 1 | `AGENTS.md`
|
|
35
|
-
| 2 | `CLAUDE.md`
|
|
36
|
-
| 3 | `.cursorrules`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
- `.agents/
|
|
59
|
-
- `.agents/
|
|
60
|
-
- `.agents/
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
5. Ejecuta `openspec init --tools claude,cursor` para dejar el estado limpio.
|
|
111
|
-
|
|
112
|
-
## Paso 4: Limpiar flag de actualizacion pendiente
|
|
113
|
-
|
|
114
|
-
Tras migrar, elimina el flag en la raiz del repo si sigue existiendo:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
rm -f .refacil-pending-update
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Si no hubo cambios (Paso 1 dio exit 0), el flag obsoleto suele borrarse solo al proximo `check-update` (SessionStart) o al ejecutar `refacil-sdd-ai migration-pending` con exit 0; el `rm` manual solo hace falta si aplicaste migraciones a mano o quedo un vestigio.
|
|
121
|
-
|
|
122
|
-
## Paso 5: Resumen
|
|
123
|
-
|
|
124
|
-
Informar que archivos se crearon o modificaron. Mencionar que el bloque `compact-guidance` se sincronizara automaticamente en el proximo SessionStart.
|
|
125
|
-
|
|
126
|
-
## Reglas
|
|
127
|
-
|
|
128
|
-
- **Deteccion**: confiar en `refacil-sdd-ai migration-pending` (mismo criterio que `check-update` / `notify-update`).
|
|
129
|
-
- Solo aplica lo que este pendiente — no toca archivos que ya cumplen el patron.
|
|
130
|
-
- No inventa contenido: distribuye lo que ya existe en AGENTS.md sin agregar ni eliminar informacion.
|
|
131
|
-
- No ejecuta pasos de OpenSpec, hooks ni instalacion de skills.
|
|
132
|
-
- Extensible: nuevas reglas de deteccion se agregan en el paquete (`methodology-migration-pending.js`); esta skill actualiza la tabla de referencia y los pasos de aplicacion cuando cambie el contrato.
|
|
1
|
+
---
|
|
2
|
+
name: refacil:update
|
|
3
|
+
description: Detect and apply pending migrations of the SDD-AI methodology to the current project
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# refacil:update — Methodology Migrations
|
|
8
|
+
|
|
9
|
+
Detects the current repo state and applies only what is pending. Does not repeat full setup (hooks/skills install, `/refacil:setup` steps).
|
|
10
|
+
|
|
11
|
+
The `notify-update` hook uses the **same engine** as this command; do not manually re-evaluate the repo to decide if there is work to do.
|
|
12
|
+
|
|
13
|
+
## Step 1: Validate with the CLI (mandatory)
|
|
14
|
+
|
|
15
|
+
In the **repo root** (where `AGENTS.md` or `.claude/` is), run with `Bash`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
refacil-sdd-ai migration-pending
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- **Exit code 0**: no pending methodology migrations → inform the user that everything is up to date regarding this criterion and **finish** (without touching files).
|
|
22
|
+
- **Exit code 1**: at least one reason listed in stdout → continue to Step 2.
|
|
23
|
+
|
|
24
|
+
Optional for stable parsing: `refacil-sdd-ai migration-pending --json` → object `{ "pending": bool, "reasons": string[] }`.
|
|
25
|
+
|
|
26
|
+
Do not substitute this step with manual tree inspection unless the command fails (environment error); in that case document the error and ask to retry.
|
|
27
|
+
|
|
28
|
+
### Reference (reason → action mapping in Step 3)
|
|
29
|
+
|
|
30
|
+
The implementation lives in `lib/methodology-migration-pending.js` of the package; the table summarizes what it detects:
|
|
31
|
+
|
|
32
|
+
| # | Condition (summary) | Migration in Step 3 |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| 1 | `AGENTS.md` exists and `.agents/` folder does not | Restructure into `.agents/` + rewrite as index |
|
|
35
|
+
| 2 | `CLAUDE.md` has more than 5 lines or does not point to `AGENTS.md` | Replace with minimal index |
|
|
36
|
+
| 3 | `.cursorrules` has more than 5 lines or does not point to `AGENTS.md` | Replace with minimal index |
|
|
37
|
+
|
|
38
|
+
## Step 2: Confirm with the user
|
|
39
|
+
|
|
40
|
+
Show the user the same lines printed by `migration-pending` (or the `reasons` array from the JSON) and ask for confirmation before applying any changes.
|
|
41
|
+
|
|
42
|
+
## Step 3: Apply confirmed migrations
|
|
43
|
+
|
|
44
|
+
Run only the migrations that correspond to the detected reasons (see reference table above).
|
|
45
|
+
|
|
46
|
+
### Migration 1 — AGENTS.md → `.agents/` + index
|
|
47
|
+
|
|
48
|
+
1. Read the full content of `AGENTS.md`.
|
|
49
|
+
2. Identify and separate content that must NOT move to `.agents/`:
|
|
50
|
+
- `compact-guidance` block: between `<!-- refacil-sdd-ai:compact-guidance:start -->` and `<!-- refacil-sdd-ai:compact-guidance:end -->`
|
|
51
|
+
- Bus presentation block: between `<!-- refacil-bus:presentation:start -->` and `<!-- refacil-bus:presentation:end -->`
|
|
52
|
+
- Section `## SDD-AI Methodology`: table of `refacil:*` commands — always stays in `AGENTS.md`. If it exists, overwrite it with the updated table (see Step 6.2 of `refacil:setup`); if not, create it.
|
|
53
|
+
3. Create the `.agents/` folder.
|
|
54
|
+
4. Distribute the project content (everything except managed blocks) into files by area. Rules:
|
|
55
|
+
- **`.agents/summary.md` is always mandatory** — project description, mini stack table, essential scripts, critical rules condensed. If the original AGENTS.md does not have a clear summary, synthesize it from the available content.
|
|
56
|
+
- Other files are created **only if there is relevant content to redistribute**. Do not create empty files:
|
|
57
|
+
- `.agents/architecture.md` — modules, services, main flows, key patterns.
|
|
58
|
+
- `.agents/stack.md` — dependencies, environment variables, databases, integrations.
|
|
59
|
+
- `.agents/testing.md` — testing strategy, commands, conventions, fixtures.
|
|
60
|
+
- `.agents/commands.md` — development commands, aliases, CI/CD scripts.
|
|
61
|
+
- Adapt to the project type: a monorepo may need `.agents/services.md`; a simple library may combine testing and stack in one file. Use the same criterion as `/refacil:setup`.
|
|
62
|
+
5. Rewrite `AGENTS.md` as a pure index in this order:
|
|
63
|
+
- First line: brief project description.
|
|
64
|
+
- For each file in `.agents/`: area name + relative link + when to read it (one sentence).
|
|
65
|
+
- Section `## SDD-AI Methodology` with the updated `refacil:*` command table (see Step 6.2 of `refacil:setup` for the exact content).
|
|
66
|
+
- Managed blocks that already existed (compact-guidance, bus presentation) at the end, intact.
|
|
67
|
+
- If they did not exist, the compact-guidance block will be re-injected automatically at the next SessionStart.
|
|
68
|
+
|
|
69
|
+
### Migration 2 and 3 — CLAUDE.md / .cursorrules → minimal index
|
|
70
|
+
|
|
71
|
+
Overwrite with exactly this content:
|
|
72
|
+
|
|
73
|
+
**CLAUDE.md:**
|
|
74
|
+
```
|
|
75
|
+
# CLAUDE.md
|
|
76
|
+
|
|
77
|
+
Full project context: see `AGENTS.md`.
|
|
78
|
+
If it does not exist, run `/refacil:setup`.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**`.cursorrules`:**
|
|
82
|
+
```
|
|
83
|
+
# Cursor Rules
|
|
84
|
+
|
|
85
|
+
Full project context: see `AGENTS.md`.
|
|
86
|
+
If it does not exist, run `/refacil:setup`.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Step 4: Clear the pending update flag
|
|
90
|
+
|
|
91
|
+
After migrating, delete the flag in the repo root if it still exists:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rm -f .refacil-pending-update
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If there were no changes (Step 1 gave exit 0), the obsolete flag usually clears itself at the next `check-update` (SessionStart) or when running `refacil-sdd-ai migration-pending` with exit 0; the manual `rm` is only needed if you applied migrations manually or there is a leftover.
|
|
98
|
+
|
|
99
|
+
## Step 5: Summary
|
|
100
|
+
|
|
101
|
+
Report which files were created or modified. Mention that the `compact-guidance` block will be synced automatically at the next SessionStart.
|
|
102
|
+
|
|
103
|
+
## Rules
|
|
104
|
+
|
|
105
|
+
- **Detection**: trust `refacil-sdd-ai migration-pending` (same criterion as `check-update` / `notify-update`).
|
|
106
|
+
- Only apply what is pending — do not touch files that already meet the pattern.
|
|
107
|
+
- Do not invent content: distribute what already exists in AGENTS.md without adding or removing information.
|
|
108
|
+
- Does not re-run `refacil-sdd-ai init`, package hooks installation, or `/refacil:setup`-style scaffolding.
|
|
109
|
+
- Extensible: new detection rules are added in the package (`methodology-migration-pending.js`); this skill updates the reference table and application steps when the contract changes.
|