duaer-spec 0.5.0 → 0.5.1
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/.cursor/rules/agents-workflow.mdc +12 -5
- package/.cursor/rules/duaer-spec.mdc +3 -0
- package/AGENTS.md +13 -5
- package/bin/duaer.mjs +16 -0
- package/docs/agent/change-checklist.md +1 -1
- package/docs/agent/workflow.md +4 -2
- package/package.json +1 -1
|
@@ -14,16 +14,23 @@ integration branch in their baseline.
|
|
|
14
14
|
Use English for code, identifiers, comments, commits, specs, and docs unless
|
|
15
15
|
the project explicitly overrides.
|
|
16
16
|
|
|
17
|
-
## Isolated development
|
|
17
|
+
## Isolated development (mandatory worktree)
|
|
18
18
|
|
|
19
19
|
Before editing files for a new request:
|
|
20
20
|
|
|
21
21
|
1. Update local integration branch (`main` here; or project override)
|
|
22
22
|
2. Create a unique branch: `<type>/<short-description>`
|
|
23
|
-
3. Create a dedicated worktree
|
|
24
|
-
4.
|
|
25
|
-
5. Never
|
|
26
|
-
|
|
23
|
+
3. Create a dedicated worktree at **`.worktree/<request-id>`** (required — not optional)
|
|
24
|
+
4. Develop only inside that worktree
|
|
25
|
+
5. Never develop in the primary checkout or on the long-lived branch
|
|
26
|
+
6. Never reuse or modify another agent's branch/worktree
|
|
27
|
+
7. Never commit `.worktree/` (must stay gitignored)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
mkdir -p .worktree
|
|
31
|
+
git worktree add .worktree/<request-id> -b <type>/<request-id> main
|
|
32
|
+
cd .worktree/<request-id>
|
|
33
|
+
```
|
|
27
34
|
## Immutable habits
|
|
28
35
|
|
|
29
36
|
- Spec-sync: behavior changes update the relevant project specs/docs (and ADR when architecture/security/contracts change)
|
|
@@ -16,6 +16,9 @@ If this conflicts with root `AGENTS.md` (worktrees, commits, Issue/PR),
|
|
|
16
16
|
|
|
17
17
|
For new behavior, fixes, refactors that change product behavior, or architecture:
|
|
18
18
|
|
|
19
|
+
0. **Isolate first (mandatory):** update integration branch, create
|
|
20
|
+
`<type>/<short-description>`, add worktree at `.worktree/<request-id>`,
|
|
21
|
+
work only there. Never skip the worktree. Never commit `.worktree/`.
|
|
19
22
|
1. **Silently follow** the procedure in `.cursor/skills/duaer-do/SKILL.md`
|
|
20
23
|
(assign Brief → light tasks → implement → converge → handoff line).
|
|
21
24
|
2. Do **not** wait for `/duaer-do` or any other skill invocation.
|
package/AGENTS.md
CHANGED
|
@@ -115,20 +115,27 @@ Before modifying any file, the agent must:
|
|
|
115
115
|
|
|
116
116
|
1. Update the primary checkout's local `main`
|
|
117
117
|
2. Create a unique branch from the updated `main`
|
|
118
|
-
3. Create a dedicated worktree
|
|
119
|
-
4. Enter
|
|
118
|
+
3. Create a dedicated worktree **under the project** at `.worktree/<request-id>`
|
|
119
|
+
4. Enter that worktree
|
|
120
120
|
5. Only then begin development
|
|
121
121
|
|
|
122
|
+
Worktrees live in **`.worktree/`** at the repository root. That directory is
|
|
123
|
+
**mandatory**, not optional, and **must never be committed** (see `.gitignore`).
|
|
124
|
+
|
|
122
125
|
Example:
|
|
123
126
|
|
|
124
127
|
```bash
|
|
125
128
|
git switch main
|
|
126
129
|
git pull --ff-only
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
mkdir -p .worktree
|
|
131
|
+
git worktree add .worktree/<request-id> -b <type>/<request-id> main
|
|
132
|
+
cd .worktree/<request-id>
|
|
129
133
|
```
|
|
130
134
|
|
|
131
135
|
Branch and worktree names must be unique and clearly associated with the request.
|
|
136
|
+
Do **not** place request worktrees outside the repo (for example `../worktrees/`)
|
|
137
|
+
unless the project baseline explicitly overrides this and still keeps them
|
|
138
|
+
untracked.
|
|
132
139
|
|
|
133
140
|
**This repository's default integration branch is `main`.** Adopting projects
|
|
134
141
|
may substitute another long-lived branch (for example `develop`); document that
|
|
@@ -211,7 +218,7 @@ Once the request branch is merged into local `main`, remove its worktree and
|
|
|
211
218
|
delete the merged branch. Never leave a merged worktree on disk.
|
|
212
219
|
|
|
213
220
|
```bash
|
|
214
|
-
git worktree remove
|
|
221
|
+
git worktree remove .worktree/<request-id>
|
|
215
222
|
git branch -d <type>/<request-id>
|
|
216
223
|
git worktree prune
|
|
217
224
|
```
|
|
@@ -220,6 +227,7 @@ git worktree prune
|
|
|
220
227
|
* The worktree must be clean first
|
|
221
228
|
* Use `git branch -d` (not `-D`)
|
|
222
229
|
* Delete only your own worktree and branch
|
|
230
|
+
* Never commit `.worktree/` (ignored)
|
|
223
231
|
|
|
224
232
|
## Development Workflow
|
|
225
233
|
|
package/bin/duaer.mjs
CHANGED
|
@@ -194,6 +194,21 @@ function installMethod(target, opts) {
|
|
|
194
194
|
|
|
195
195
|
copyPath(join(PKG_ROOT, 'DUADER.md'), join(target, 'DUADER.md'), opts)
|
|
196
196
|
console.log(' DUADER.md')
|
|
197
|
+
ensureWorktreeGitignore(target)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function ensureWorktreeGitignore(target) {
|
|
201
|
+
const gi = join(target, '.gitignore')
|
|
202
|
+
const line = '.worktree/'
|
|
203
|
+
let text = existsSync(gi) ? readFileSync(gi, 'utf8') : ''
|
|
204
|
+
if (text.split(/\r?\n/).some((l) => l.trim() === line)) {
|
|
205
|
+
console.log(' .gitignore already ignores .worktree/')
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
if (text.length && !text.endsWith('\n')) text += '\n'
|
|
209
|
+
text += `# duaer-spec: mandatory request worktrees (do not commit)\n${line}\n`
|
|
210
|
+
writeFileSync(gi, text, 'utf8')
|
|
211
|
+
console.log(' .gitignore ← .worktree/')
|
|
197
212
|
}
|
|
198
213
|
|
|
199
214
|
function installOps(target, opts) {
|
|
@@ -220,6 +235,7 @@ function installOps(target, opts) {
|
|
|
220
235
|
)
|
|
221
236
|
}
|
|
222
237
|
console.log(' docs/agent/')
|
|
238
|
+
ensureWorktreeGitignore(target)
|
|
223
239
|
|
|
224
240
|
const baselineSrc = join(PKG_ROOT, 'docs', 'baseline.md')
|
|
225
241
|
const baselineDst = join(target, 'docs', 'baseline.md')
|
|
@@ -45,7 +45,7 @@ See [R6](workflow.md#r6--merge-a-linked-pull-request-whose-principle-is-sound-th
|
|
|
45
45
|
- [ ] Existing uncommitted work is identified and preserved.
|
|
46
46
|
- [ ] `origin/main` fetched; local `main` fast-forwarded when clean.
|
|
47
47
|
- [ ] Dedicated `<type>/<short-description>` branch and worktree created from
|
|
48
|
-
that commit.
|
|
48
|
+
that commit under **`.worktree/<request-id>`** (mandatory; never commit `.worktree/`).
|
|
49
49
|
- [ ] Shared toolchains/caches reused where safe; mutable state stays local.
|
|
50
50
|
- [ ] Current branch is not `main` before implementation begins.
|
|
51
51
|
|
package/docs/agent/workflow.md
CHANGED
|
@@ -45,10 +45,12 @@ handling. They cannot be relaxed without explicit human override.
|
|
|
45
45
|
> branch and finishes only after it is merged into `main`.**
|
|
46
46
|
|
|
47
47
|
- Before editing: preserve existing uncommitted work; fetch and fast-forward
|
|
48
|
-
local `main` when clean; create a new request branch and
|
|
49
|
-
|
|
48
|
+
local `main` when clean; create a new request branch and a dedicated worktree
|
|
49
|
+
at **`.worktree/<request-id>`** under the project root. Worktrees are
|
|
50
|
+
**mandatory**. Never stash or overwrite another agent's work merely to start.
|
|
50
51
|
- Name branches `<type>/<short-description>` (for example `feat/adopt-docs`).
|
|
51
52
|
- Do not implement in the primary checkout or reuse another request's worktree.
|
|
53
|
+
- Keep `.worktree/` gitignored — never commit request worktrees.
|
|
52
54
|
- Reuse shared toolchains and caches where safe; keep mutable or
|
|
53
55
|
concurrency-sensitive state worktree-local and ignored.
|
|
54
56
|
- After validation: merge into local `main` (or via PR/MR when required), then
|