duaer-spec 0.1.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/.cursor/rules/agents-workflow.mdc +50 -0
- package/.cursor/rules/ai-ui-copy.mdc +12 -0
- package/.cursor/rules/duaer-spec.mdc +33 -0
- package/.cursor/skills/duaer-analyze/SKILL.md +259 -0
- package/.cursor/skills/duaer-checklist/SKILL.md +383 -0
- package/.cursor/skills/duaer-clarify/SKILL.md +291 -0
- package/.cursor/skills/duaer-constitution/SKILL.md +177 -0
- package/.cursor/skills/duaer-converge/SKILL.md +277 -0
- package/.cursor/skills/duaer-git-commit/SKILL.md +68 -0
- package/.cursor/skills/duaer-git-feature/SKILL.md +94 -0
- package/.cursor/skills/duaer-git-initialize/SKILL.md +54 -0
- package/.cursor/skills/duaer-git-remote/SKILL.md +50 -0
- package/.cursor/skills/duaer-git-validate/SKILL.md +54 -0
- package/.cursor/skills/duaer-implement/SKILL.md +226 -0
- package/.cursor/skills/duaer-plan/SKILL.md +166 -0
- package/.cursor/skills/duaer-specify/SKILL.md +345 -0
- package/.cursor/skills/duaer-tasks/SKILL.md +214 -0
- package/.cursor/skills/duaer-taskstoissues/SKILL.md +109 -0
- package/.duaer/extensions/.registry +23 -0
- package/.duaer/extensions/git/README.md +119 -0
- package/.duaer/extensions/git/commands/duaer.git.commit.md +63 -0
- package/.duaer/extensions/git/commands/duaer.git.feature.md +82 -0
- package/.duaer/extensions/git/commands/duaer.git.initialize.md +49 -0
- package/.duaer/extensions/git/commands/duaer.git.remote.md +45 -0
- package/.duaer/extensions/git/commands/duaer.git.validate.md +49 -0
- package/.duaer/extensions/git/config-template.yml +79 -0
- package/.duaer/extensions/git/extension.yml +142 -0
- package/.duaer/extensions/git/git-config.yml +79 -0
- package/.duaer/extensions/git/scripts/bash/auto-commit.sh +211 -0
- package/.duaer/extensions/git/scripts/bash/create-new-feature-branch.sh +626 -0
- package/.duaer/extensions/git/scripts/bash/git-common.sh +56 -0
- package/.duaer/extensions/git/scripts/bash/initialize-repo.sh +54 -0
- package/.duaer/extensions/git/scripts/powershell/auto-commit.ps1 +230 -0
- package/.duaer/extensions/git/scripts/powershell/create-new-feature-branch.ps1 +592 -0
- package/.duaer/extensions/git/scripts/powershell/git-common.ps1 +52 -0
- package/.duaer/extensions/git/scripts/powershell/initialize-repo.ps1 +69 -0
- package/.duaer/extensions/git/scripts/python/auto_commit.py +195 -0
- package/.duaer/extensions/git/scripts/python/create_new_feature_branch.py +634 -0
- package/.duaer/extensions/git/scripts/python/git_common.py +81 -0
- package/.duaer/extensions/git/scripts/python/initialize_repo.py +89 -0
- package/.duaer/extensions.yml +167 -0
- package/.duaer/init-options.json +9 -0
- package/.duaer/integration.json +15 -0
- package/.duaer/integrations/cursor-agent.manifest.json +17 -0
- package/.duaer/integrations/duaer.manifest.json +19 -0
- package/.duaer/memory/.constitution-template.json +4 -0
- package/.duaer/memory/constitution.md +37 -0
- package/.duaer/memory/project-context.md +24 -0
- package/.duaer/memory/testing.md +14 -0
- package/.duaer/scripts/bash/check-prerequisites.sh +243 -0
- package/.duaer/scripts/bash/common.sh +926 -0
- package/.duaer/scripts/bash/create-new-feature.sh +407 -0
- package/.duaer/scripts/bash/resolve-template.sh +57 -0
- package/.duaer/scripts/bash/setup-plan.sh +85 -0
- package/.duaer/scripts/bash/setup-tasks.sh +94 -0
- package/.duaer/templates/checklist-template.md +45 -0
- package/.duaer/templates/constitution-template.md +50 -0
- package/.duaer/templates/plan-template.md +113 -0
- package/.duaer/templates/spec-template.md +131 -0
- package/.duaer/templates/tasks-template.md +252 -0
- package/.duaer/workflows/duaer/workflow.yml +78 -0
- package/.duaer/workflows/workflow-registry.json +13 -0
- package/ADOPT.md +75 -0
- package/AGENTS.md +290 -0
- package/CHANGELOG.md +28 -0
- package/DUADER.md +57 -0
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/bin/duaer.mjs +298 -0
- package/docs/agent/README.md +12 -0
- package/docs/agent/change-checklist.md +130 -0
- package/docs/agent/e2e-test-plan.md +33 -0
- package/docs/agent/workflow.md +127 -0
- package/docs/baseline.md +10 -0
- package/package.json +49 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "duaer-converge"
|
|
3
|
+
description: "Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it."
|
|
4
|
+
compatibility: "Requires duaer-spec project structure with .duaer/ directory"
|
|
5
|
+
metadata:
|
|
6
|
+
author: "duaer-spec"
|
|
7
|
+
source: "duaer-spec"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## User Input
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
$ARGUMENTS
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
18
|
+
|
|
19
|
+
## Pre-Execution Checks
|
|
20
|
+
|
|
21
|
+
**Check for extension hooks (before convergence)**:
|
|
22
|
+
|
|
23
|
+
- Check if `.duaer/extensions.yml` exists in the project root.
|
|
24
|
+
- If it exists, read it and look for entries under the `hooks.before_converge` key
|
|
25
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
26
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
27
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
28
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
29
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
30
|
+
- When constructing command invocations from hook command names, replace dots (`.`) with hyphens (`-`). For example, `duaer.git.commit` → `/duaer-git-commit`.
|
|
31
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
32
|
+
- **Optional hook** (`optional: true`):
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
## Extension Hooks
|
|
36
|
+
|
|
37
|
+
**Optional Pre-Hook**: {extension}
|
|
38
|
+
Command: `/{command}`
|
|
39
|
+
Description: {description}
|
|
40
|
+
|
|
41
|
+
Prompt: {prompt}
|
|
42
|
+
To execute: `/{command}`
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Mandatory hook** (`optional: false`):
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
## Extension Hooks
|
|
49
|
+
|
|
50
|
+
**Automatic Pre-Hook**: {extension}
|
|
51
|
+
Executing: `/{command}`
|
|
52
|
+
EXECUTE_COMMAND: {command}
|
|
53
|
+
|
|
54
|
+
Wait for the result of the hook command before proceeding to the Goal.
|
|
55
|
+
```
|
|
56
|
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:duaer-...` or `$duaer-...`). Emitting the block alone does not run the hook.
|
|
57
|
+
|
|
58
|
+
- If no hooks are registered or `.duaer/extensions.yml` does not exist, skip silently
|
|
59
|
+
|
|
60
|
+
## Goal
|
|
61
|
+
|
|
62
|
+
Close the gap between what a feature's specification, plan, and tasks call for and what the
|
|
63
|
+
codebase currently implements. Read `spec.md`, `plan.md`, and `tasks.md` as the **sole
|
|
64
|
+
source of intent** (with the constitution as governing constraints), assess the current
|
|
65
|
+
state of the code, determine which requirements, acceptance criteria, plan decisions, and
|
|
66
|
+
existing tasks are unmet, incomplete, or only partially satisfied, and **append each piece
|
|
67
|
+
of remaining work as a new, traceable task** at the bottom of `tasks.md` so that
|
|
68
|
+
`/duaer-implement` can complete it. This command MUST run only after
|
|
69
|
+
`/duaer-implement` has run on the current `tasks.md`, and after `/duaer-tasks` has produced a complete `tasks.md`.
|
|
70
|
+
|
|
71
|
+
This is **not** a diff tool and does **not** track changes. It assesses the present state
|
|
72
|
+
of the code relative to the feature's artifacts — no git, no branch comparison, no history.
|
|
73
|
+
|
|
74
|
+
## Operating Constraints
|
|
75
|
+
|
|
76
|
+
**APPEND-ONLY, NEVER REWRITE**: The command's **only** write is appending a new
|
|
77
|
+
`## Phase N: Convergence` section to `tasks.md`. It MUST NOT:
|
|
78
|
+
|
|
79
|
+
- modify `spec.md` or `plan.md` in any way;
|
|
80
|
+
- rewrite, renumber, reorder, or delete any existing task (including tasks from a prior
|
|
81
|
+
Convergence phase);
|
|
82
|
+
- modify, create, or delete any application code — completing the appended tasks is the
|
|
83
|
+
job of `/duaer-implement`.
|
|
84
|
+
|
|
85
|
+
When the codebase already satisfies everything, the command MUST leave `tasks.md`
|
|
86
|
+
**byte-for-byte unchanged** (no empty Convergence header) and report a clean result.
|
|
87
|
+
|
|
88
|
+
**Constitution Authority**: The project constitution (`.duaer/memory/constitution.md`) is
|
|
89
|
+
**non-negotiable**. Code that violates a MUST principle is the highest-severity finding and
|
|
90
|
+
produces a corresponding remediation task. If the constitution is an unfilled template,
|
|
91
|
+
skip constitution checks gracefully rather than failing.
|
|
92
|
+
|
|
93
|
+
## Execution Steps
|
|
94
|
+
|
|
95
|
+
### 1. Initialize Convergence Context
|
|
96
|
+
|
|
97
|
+
Run `.duaer/scripts/bash/check-prerequisites.sh --json --require-spec --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
|
98
|
+
|
|
99
|
+
- SPEC = FEATURE_DIR/spec.md
|
|
100
|
+
- PLAN = FEATURE_DIR/plan.md
|
|
101
|
+
- TASKS = FEATURE_DIR/tasks.md
|
|
102
|
+
- CONSTITUTION = `.duaer/memory/constitution.md` (if present)
|
|
103
|
+
If `spec.md`, `plan.md`, or `tasks.md` is missing, STOP with a clear, actionable message naming the
|
|
104
|
+
prerequisite command to run (`/duaer-specify` for a missing spec, `/duaer-plan` for a missing plan,
|
|
105
|
+
`/duaer-tasks` for missing tasks). Do not produce partial output.
|
|
106
|
+
For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
|
|
107
|
+
|
|
108
|
+
### 2. Load Artifacts (Progressive Disclosure)
|
|
109
|
+
|
|
110
|
+
Load only the minimal necessary context from each artifact:
|
|
111
|
+
|
|
112
|
+
**From spec.md:**
|
|
113
|
+
|
|
114
|
+
- Functional Requirements (FR-###)
|
|
115
|
+
- Success Criteria (SC-###) — include only items requiring buildable work; exclude
|
|
116
|
+
post-launch outcome metrics and business KPIs
|
|
117
|
+
- User Stories and their Acceptance Scenarios
|
|
118
|
+
- Edge Cases (if present)
|
|
119
|
+
|
|
120
|
+
**From plan.md:**
|
|
121
|
+
|
|
122
|
+
- Architecture/stack choices and technical decisions
|
|
123
|
+
- Data Model references
|
|
124
|
+
- Phases and named touch-points (files/components the plan says will be created or edited)
|
|
125
|
+
- Technical constraints
|
|
126
|
+
|
|
127
|
+
**From tasks.md:**
|
|
128
|
+
|
|
129
|
+
- Task IDs (to compute the next ID and next phase number)
|
|
130
|
+
- Descriptions, phase grouping, and referenced file paths
|
|
131
|
+
|
|
132
|
+
**From constitution (if not an unfilled template):**
|
|
133
|
+
|
|
134
|
+
- Principle names and MUST/SHOULD normative statements
|
|
135
|
+
|
|
136
|
+
### 3. Build the Intent Inventory
|
|
137
|
+
|
|
138
|
+
Create an internal model (do not echo raw artifacts):
|
|
139
|
+
|
|
140
|
+
- **Requirements inventory**: one stable key per FR-### / SC-### / user-story acceptance
|
|
141
|
+
scenario (e.g. `US1/AC2`), plus the plan decisions and constitution principles that
|
|
142
|
+
impose buildable obligations.
|
|
143
|
+
- **Code-scope map**: from the file paths named in `plan.md` and `tasks.md`, plus a keyword
|
|
144
|
+
search for the concepts each requirement describes, derive the set of source files and
|
|
145
|
+
components in scope for assessment. Bound the assessment to these — do **not** infer
|
|
146
|
+
scope beyond what the artifacts define.
|
|
147
|
+
|
|
148
|
+
### 4. Assess the Codebase and Classify Findings
|
|
149
|
+
|
|
150
|
+
For each item in the intent inventory, inspect the current code in scope and produce a
|
|
151
|
+
`Finding` only where there is a gap. Classify every finding by **gap type**:
|
|
152
|
+
|
|
153
|
+
- **`missing`**: the required work is absent from the code entirely.
|
|
154
|
+
- **`partial`**: the work exists but does not yet fully satisfy the requirement /
|
|
155
|
+
acceptance criterion / plan decision.
|
|
156
|
+
- **`contradicts`**: the code does something that conflicts with stated intent or a
|
|
157
|
+
constitution MUST principle.
|
|
158
|
+
- **`unrequested`**: the code contains work not called for by the spec, plan, or tasks
|
|
159
|
+
(surfaced for awareness — converge does **not** delete code, it only appends a task to
|
|
160
|
+
review/justify or remove it).
|
|
161
|
+
|
|
162
|
+
Each `Finding` records: a stable id, the `source-ref` it traces to, the `gap-type`, a
|
|
163
|
+
severity, and a short human-readable description with the evidence (the file/area observed).
|
|
164
|
+
|
|
165
|
+
**Edge cases:**
|
|
166
|
+
|
|
167
|
+
- **Little or no code yet**: treat the entire specified scope as `missing` remaining work
|
|
168
|
+
rather than failing.
|
|
169
|
+
- **Nothing remains**: produce zero findings and follow the converged branch in Step 7.
|
|
170
|
+
|
|
171
|
+
### 5. Assign Severity
|
|
172
|
+
|
|
173
|
+
- **CRITICAL**: violates a constitution MUST principle, or a `missing`/`contradicts` gap
|
|
174
|
+
that blocks baseline functionality of a P1 user story.
|
|
175
|
+
- **HIGH**: a `missing` or `partial` gap on a core functional requirement or acceptance
|
|
176
|
+
criterion.
|
|
177
|
+
- **MEDIUM**: a `partial` gap on a secondary requirement, or an `unrequested` addition with
|
|
178
|
+
unclear justification.
|
|
179
|
+
- **LOW**: minor partial gaps, polish, or low-risk `unrequested` additions.
|
|
180
|
+
|
|
181
|
+
### 6. Present the In-Session Findings Summary
|
|
182
|
+
|
|
183
|
+
Before appending anything, output a compact, severity-graded summary (no file writes yet):
|
|
184
|
+
|
|
185
|
+
## Convergence Findings
|
|
186
|
+
|
|
187
|
+
| ID | Gap Type | Severity | Source | Evidence | Remaining Work |
|
|
188
|
+
|----|----------|----------|--------|----------|----------------|
|
|
189
|
+
| F1 | missing | HIGH | FR-008 | Example: no append-only guard detected in path/to/module.py when writing tasks.md | Add append-only enforcement |
|
|
190
|
+
|
|
191
|
+
**Summary metrics:**
|
|
192
|
+
|
|
193
|
+
- Requirements / acceptance criteria checked
|
|
194
|
+
- Plan decisions checked
|
|
195
|
+
- Constitution principles checked (or "skipped — template")
|
|
196
|
+
- Findings by gap type (missing / partial / contradicts / unrequested)
|
|
197
|
+
- Findings by severity
|
|
198
|
+
|
|
199
|
+
### 7. Append Convergence Tasks (or report converged)
|
|
200
|
+
|
|
201
|
+
**If there are one or more actionable findings** (`tasks_appended` outcome):
|
|
202
|
+
|
|
203
|
+
Append to the **end** of `tasks.md`, per the append contract:
|
|
204
|
+
|
|
205
|
+
1. Scan all existing task IDs; let `M` be the maximum. Determine the next phase number `N`
|
|
206
|
+
(highest existing phase + 1).
|
|
207
|
+
2. Write a single new section header `## Phase N: Convergence`.
|
|
208
|
+
3. Emit one checklist item per actionable finding, ordered CRITICAL/HIGH first, assigning
|
|
209
|
+
zero-padded IDs `T{M+1:03d}, T{M+2:03d}, …`:
|
|
210
|
+
|
|
211
|
+
```markdown
|
|
212
|
+
- [ ] T042 <imperative description> per <source-ref> (<gap-type>)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`<source-ref>` traces the task to its origin: e.g. `FR-003`, `SC-002`,
|
|
216
|
+
`US1/AC2`, `plan: storage decision`, `Constitution II`.
|
|
217
|
+
|
|
218
|
+
`<gap-type>` is one of `missing`, `partial`, `contradicts`, `unrequested`.
|
|
219
|
+
|
|
220
|
+
Constitution-violation tasks MUST be emitted first and described as
|
|
221
|
+
`CRITICAL`.
|
|
222
|
+
4. Never reuse or renumber existing IDs. If a prior Convergence phase exists, add a new,
|
|
223
|
+
separately-numbered one below it — do not touch the old one.
|
|
224
|
+
|
|
225
|
+
**If there are no actionable findings** (`converged` outcome):
|
|
226
|
+
|
|
227
|
+
- Do **not** modify `tasks.md` at all — no empty phase header.
|
|
228
|
+
- Report: **"✅ Converged — the implementation satisfies the spec, plan, and tasks."**
|
|
229
|
+
- Include the summary counts of what was checked.
|
|
230
|
+
|
|
231
|
+
### 8. Provide Next Actions (Handoff)
|
|
232
|
+
|
|
233
|
+
- On `tasks_appended`: state how many tasks were appended under which phase, and recommend
|
|
234
|
+
running `/duaer-implement` to complete them; note that a follow-up converge
|
|
235
|
+
run will find fewer or no remaining items.
|
|
236
|
+
- On `converged`: recommend proceeding to review / opening a PR. No further implement pass
|
|
237
|
+
is needed for this feature's specified scope.
|
|
238
|
+
|
|
239
|
+
### 9. Check for extension hooks
|
|
240
|
+
|
|
241
|
+
After producing the result, check if `.duaer/extensions.yml` exists in the project root.
|
|
242
|
+
|
|
243
|
+
- If it exists, read it and look for entries under the `hooks.after_converge` key
|
|
244
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
245
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
246
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
247
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
248
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
249
|
+
- Report the convergence outcome (`converged` or `tasks_appended`) in-session before listing
|
|
250
|
+
any hooks, so users can decide whether to run optional follow-up commands.
|
|
251
|
+
- When constructing command invocations from hook command names, replace dots (`.`) with hyphens (`-`). For example, `duaer.git.commit` → `/duaer-git-commit`.
|
|
252
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
253
|
+
- **Optional hook** (`optional: true`):
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
## Extension Hooks
|
|
257
|
+
|
|
258
|
+
**Optional Hook**: {extension}
|
|
259
|
+
Command: `/{command}`
|
|
260
|
+
Description: {description}
|
|
261
|
+
|
|
262
|
+
Prompt: {prompt}
|
|
263
|
+
To execute: `/{command}`
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
- **Mandatory hook** (`optional: false`):
|
|
267
|
+
|
|
268
|
+
```text
|
|
269
|
+
## Extension Hooks
|
|
270
|
+
|
|
271
|
+
**Automatic Hook**: {extension}
|
|
272
|
+
Executing: `/{command}`
|
|
273
|
+
EXECUTE_COMMAND: {command}
|
|
274
|
+
```
|
|
275
|
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:duaer-...` or `$duaer-...`). Emitting the block alone does not run the hook.
|
|
276
|
+
|
|
277
|
+
- If no hooks are registered or `.duaer/extensions.yml` does not exist, skip silently
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: duaer-git-commit
|
|
3
|
+
description: Auto-commit changes after a Duaer command completes
|
|
4
|
+
compatibility: Requires duaer-spec project structure with .duaer/ directory
|
|
5
|
+
metadata:
|
|
6
|
+
author: github-duaer-spec
|
|
7
|
+
source: git:commands/duaer.git.commit.md
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Auto-Commit Changes
|
|
11
|
+
|
|
12
|
+
Automatically stage and commit all changes after a Duaer command completes.
|
|
13
|
+
|
|
14
|
+
## Behavior
|
|
15
|
+
|
|
16
|
+
This command is invoked as a hook after (or before) core commands. It:
|
|
17
|
+
|
|
18
|
+
1. Determines the event name from the hook context (e.g., if invoked as an `after_specify` hook, the event is `after_specify`; if `before_plan`, the event is `before_plan`)
|
|
19
|
+
2. Checks `.duaer/extensions/git/git-config.yml` for the `auto_commit` section
|
|
20
|
+
3. Looks up the specific event key to see if auto-commit is enabled
|
|
21
|
+
4. Falls back to `auto_commit.default` if no event-specific key exists
|
|
22
|
+
5. Determines the commit message based on `commit_style` (see below)
|
|
23
|
+
6. If enabled and there are uncommitted changes, runs `git add .` + `git commit`
|
|
24
|
+
|
|
25
|
+
## Commit Message Styles
|
|
26
|
+
|
|
27
|
+
Controlled by the `commit_style` key in `.duaer/extensions/git/git-config.yml`:
|
|
28
|
+
|
|
29
|
+
- **`fixed`** (default): use the per-command `message` if configured, otherwise a generic `[Duaer] Auto-commit <phase> <command>` message.
|
|
30
|
+
- **`conventional`**: inspect the actual changes (`git diff` / `git status`) since the last commit and generate a single-line [Conventional Commit](https://www.conventionalcommits.org/) message (`type(scope): subject`, e.g. `feat: add OAuth specification` or `docs: update implementation plan`) that accurately summarizes the change. Write this message to a temporary file and pass the file's path to the script (see Execution below). The configured `message` values are ignored in this mode.
|
|
31
|
+
|
|
32
|
+
## Execution
|
|
33
|
+
|
|
34
|
+
Determine the event name from the hook that triggered this command, then run the script:
|
|
35
|
+
|
|
36
|
+
- **Bash**: `.duaer/extensions/git/scripts/bash/auto-commit.sh <event_name> [--message-file <path>]`
|
|
37
|
+
- **PowerShell**: `.duaer/extensions/git/scripts/powershell/auto-commit.ps1 <event_name> [-MessageFile <path>]`
|
|
38
|
+
|
|
39
|
+
Replace `<event_name>` with the actual hook event (e.g., `after_specify`, `before_plan`, `after_implement`). Only pass a generated message when `commit_style: conventional` is configured — first check `.duaer/extensions/git/git-config.yml` for the value of `commit_style`:
|
|
40
|
+
|
|
41
|
+
- If `conventional`: inspect the diff and generate a Conventional Commit message. **Do not interpolate the generated message directly into a shell command string** — its content is derived from repository changes and may contain characters (quotes, `$(...)`, backticks) that a shell would execute or that would break command quoting. Instead, write the message to a temporary file using your file-editing tool (not a shell `echo`/`printf`), then pass that file's path via `--message-file <path>` (Bash) or `-MessageFile <path>` (PowerShell).
|
|
42
|
+
- If `fixed` or absent: run the script with just `<event_name>`; it uses the configured/static message.
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
In `.duaer/extensions/git/git-config.yml`:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
# "fixed" (default) uses the messages below; "conventional" asks the agent
|
|
50
|
+
# to generate a Conventional Commit message from the diff instead.
|
|
51
|
+
commit_style: fixed
|
|
52
|
+
|
|
53
|
+
auto_commit:
|
|
54
|
+
default: false # Global toggle — set true to enable for all commands
|
|
55
|
+
after_specify:
|
|
56
|
+
enabled: true # Override per-command
|
|
57
|
+
message: "[Duaer] Add specification"
|
|
58
|
+
after_plan:
|
|
59
|
+
enabled: false
|
|
60
|
+
message: "[Duaer] Add implementation plan"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Graceful Degradation
|
|
64
|
+
|
|
65
|
+
- If Git is not available or the current directory is not a repository: skips with a warning
|
|
66
|
+
- If no config file exists: skips (disabled by default)
|
|
67
|
+
- If no changes to commit: skips with a message
|
|
68
|
+
- If `commit_style: conventional` is set and no generated message was supplied: fails with a clear error instead of silently falling back to the fixed message format
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: duaer-git-feature
|
|
3
|
+
description: Create a feature branch with sequential or timestamp numbering
|
|
4
|
+
compatibility: Requires duaer-spec project structure with .duaer/ directory
|
|
5
|
+
metadata:
|
|
6
|
+
author: github-duaer-spec
|
|
7
|
+
source: git:commands/duaer.git.feature.md
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Create Feature Branch
|
|
11
|
+
|
|
12
|
+
Create and switch to a new git feature branch for the given specification. This command handles **branch creation only** — the spec directory and files are created by the core `/duaer-specify` workflow.
|
|
13
|
+
|
|
14
|
+
## User Input
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
21
|
+
|
|
22
|
+
## Environment Variable Override
|
|
23
|
+
|
|
24
|
+
If the user explicitly provided `GIT_BRANCH_NAME` (e.g., via environment variable, argument, or in their request), pass it through to the script by setting the `GIT_BRANCH_NAME` environment variable before invoking the script. When `GIT_BRANCH_NAME` is set:
|
|
25
|
+
- The script uses the exact value as the branch name, bypassing all prefix/suffix generation
|
|
26
|
+
- `--short-name`, `--number`, and `--timestamp` flags are ignored
|
|
27
|
+
- `FEATURE_NUM` is extracted when the final path segment starts with a numeric or timestamp feature marker (for example `042-name`, `feat/042-name`, or `jdoe/app/042-name`), otherwise set to the full branch name
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
- Verify Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
|
32
|
+
- If Git is not available, warn the user and skip branch creation
|
|
33
|
+
|
|
34
|
+
## Branch Numbering Mode
|
|
35
|
+
|
|
36
|
+
Determine the branch numbering strategy by checking configuration in this order:
|
|
37
|
+
|
|
38
|
+
1. Check `.duaer/extensions/git/git-config.yml` for `branch_numbering` value
|
|
39
|
+
2. Check `.duaer/init-options.json` for `feature_numbering` value (inherit from core)
|
|
40
|
+
3. Check `.duaer/init-options.json` for `branch_numbering` value (deprecated, backward compatibility — will be removed in a future release)
|
|
41
|
+
4. Default to `sequential` if none of the above exist
|
|
42
|
+
|
|
43
|
+
## Branch Name Template
|
|
44
|
+
|
|
45
|
+
Check `.duaer/extensions/git/git-config.yml` for an optional `branch_template` value. If it is empty or missing, use the default branch shape `{number}-{slug}`. If it is set, `{slug}` must not appear before `{number}`, its final path segment must start with `{number}-`, and the script expands these tokens:
|
|
46
|
+
|
|
47
|
+
- `{author}`: sanitized Git config author (`user.name`, falling back to the email local part)
|
|
48
|
+
- `{app}`: sanitized Duaer init directory name
|
|
49
|
+
- `{number}`: sequential number or timestamp
|
|
50
|
+
- `{slug}`: generated short branch slug
|
|
51
|
+
|
|
52
|
+
For monorepos, a template such as `{author}/{app}/{number}-{slug}` creates names like `jdoe/web/008-guided-tour` while preserving per-project feature numbering.
|
|
53
|
+
|
|
54
|
+
The script also accepts `branch_prefix` as a shorthand for simple namespaces; it expands to `<branch_prefix>/{number}-{slug}`.
|
|
55
|
+
|
|
56
|
+
## Execution
|
|
57
|
+
|
|
58
|
+
**本仓库**:功能分支必须从已更新的 `develop` 创建;热修不要用本脚本默认前缀,改为 `GIT_BRANCH_NAME=fix/<短名>` 且基线为 `main`。见 `GIT.md`。
|
|
59
|
+
|
|
60
|
+
功能默认:
|
|
61
|
+
|
|
62
|
+
1. `git fetch origin && git checkout develop && git pull --ff-only origin develop`
|
|
63
|
+
2. 再跑下面的脚本(将得到 `feat/{number}-{slug}`)
|
|
64
|
+
|
|
65
|
+
Generate a concise short name (2-4 words) for the branch:
|
|
66
|
+
- Analyze the feature description and extract the most meaningful keywords
|
|
67
|
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
|
68
|
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
|
69
|
+
|
|
70
|
+
Run the appropriate script based on your platform:
|
|
71
|
+
|
|
72
|
+
- **Bash**: `.duaer/extensions/git/scripts/bash/create-new-feature-branch.sh --json --short-name "<short-name>" "<feature description>"`
|
|
73
|
+
- **Bash (timestamp)**: `.duaer/extensions/git/scripts/bash/create-new-feature-branch.sh --json --timestamp --short-name "<short-name>" "<feature description>"`
|
|
74
|
+
- **PowerShell**: `.duaer/extensions/git/scripts/powershell/create-new-feature-branch.ps1 -Json -ShortName "<short-name>" "<feature description>"`
|
|
75
|
+
- **PowerShell (timestamp)**: `.duaer/extensions/git/scripts/powershell/create-new-feature-branch.ps1 -Json -Timestamp -ShortName "<short-name>" "<feature description>"`
|
|
76
|
+
|
|
77
|
+
**IMPORTANT**:
|
|
78
|
+
- Do NOT pass `--number` — the script determines the correct next number automatically
|
|
79
|
+
- Always include the JSON flag (`--json` for Bash, `-Json` for PowerShell) so the output can be parsed reliably
|
|
80
|
+
- You must only ever run this script once per feature
|
|
81
|
+
- The JSON output will contain `BRANCH_NAME` and `FEATURE_NUM`
|
|
82
|
+
- Do not manually expand `branch_template`; the script reads the git extension config and applies it consistently
|
|
83
|
+
|
|
84
|
+
## Graceful Degradation
|
|
85
|
+
|
|
86
|
+
If Git is not installed or the current directory is not a Git repository:
|
|
87
|
+
- Branch creation is skipped with a warning: `[specify] Warning: Git repository not detected; skipped branch creation`
|
|
88
|
+
- The script still outputs `BRANCH_NAME` and `FEATURE_NUM` so the caller can reference them
|
|
89
|
+
|
|
90
|
+
## Output
|
|
91
|
+
|
|
92
|
+
The script outputs JSON with:
|
|
93
|
+
- `BRANCH_NAME`: The branch name (e.g., `003-user-auth`, `20260319-143022-user-auth`, or `jdoe/web/003-user-auth`)
|
|
94
|
+
- `FEATURE_NUM`: The numeric or timestamp prefix used
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: duaer-git-initialize
|
|
3
|
+
description: Initialize a Git repository with an initial commit
|
|
4
|
+
compatibility: Requires duaer-spec project structure with .duaer/ directory
|
|
5
|
+
metadata:
|
|
6
|
+
author: github-duaer-spec
|
|
7
|
+
source: git:commands/duaer.git.initialize.md
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Initialize Git Repository
|
|
11
|
+
|
|
12
|
+
Initialize a Git repository in the current project directory if one does not already exist.
|
|
13
|
+
|
|
14
|
+
## Execution
|
|
15
|
+
|
|
16
|
+
Run the appropriate script from the project root:
|
|
17
|
+
|
|
18
|
+
- **Bash**: `.duaer/extensions/git/scripts/bash/initialize-repo.sh`
|
|
19
|
+
- **PowerShell**: `.duaer/extensions/git/scripts/powershell/initialize-repo.ps1`
|
|
20
|
+
|
|
21
|
+
If the extension scripts are not found, fall back to:
|
|
22
|
+
- **Bash**: `git init && git add . && git commit -m "Initial commit from Specify template"`
|
|
23
|
+
- **PowerShell**: `git init; git add .; git commit -m "Initial commit from Specify template"`
|
|
24
|
+
|
|
25
|
+
The script handles all checks internally:
|
|
26
|
+
- Skips if Git is not available
|
|
27
|
+
- Skips if already inside a Git repository
|
|
28
|
+
- Runs `git init`, `git add .`, and `git commit` with an initial commit message
|
|
29
|
+
|
|
30
|
+
## Customization
|
|
31
|
+
|
|
32
|
+
Replace the script to add project-specific Git initialization steps:
|
|
33
|
+
- Custom `.gitignore` templates
|
|
34
|
+
- Default branch naming (`git config init.defaultBranch`)
|
|
35
|
+
- Git LFS setup
|
|
36
|
+
- Git hooks installation
|
|
37
|
+
- Commit signing configuration
|
|
38
|
+
- Git Flow initialization
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
On success:
|
|
43
|
+
- `[OK] Git repository initialized`
|
|
44
|
+
|
|
45
|
+
## Graceful Degradation
|
|
46
|
+
|
|
47
|
+
If Git is not installed:
|
|
48
|
+
- Warn the user
|
|
49
|
+
- Skip repository initialization
|
|
50
|
+
- The project continues to function without Git (specs can still be created under `specs/`)
|
|
51
|
+
|
|
52
|
+
If Git is installed but `git init`, `git add .`, or `git commit` fails:
|
|
53
|
+
- Surface the error to the user
|
|
54
|
+
- Stop this command rather than continuing with a partially initialized repository
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: duaer-git-remote
|
|
3
|
+
description: Detect Git remote URL for GitHub integration
|
|
4
|
+
compatibility: Requires duaer-spec project structure with .duaer/ directory
|
|
5
|
+
metadata:
|
|
6
|
+
author: github-duaer-spec
|
|
7
|
+
source: git:commands/duaer.git.remote.md
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Detect Git Remote URL
|
|
11
|
+
|
|
12
|
+
Detect the Git remote URL for integration with GitHub services (e.g., issue creation).
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
|
17
|
+
- If Git is not available, output a warning and return empty:
|
|
18
|
+
```
|
|
19
|
+
[specify] Warning: Git repository not detected; cannot determine remote URL
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Execution
|
|
23
|
+
|
|
24
|
+
Run the following command to get the remote URL:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git config --get remote.origin.url
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Output
|
|
31
|
+
|
|
32
|
+
Parse the remote URL and determine:
|
|
33
|
+
|
|
34
|
+
1. **Repository owner**: Extract from the URL (e.g., `github` from `https://github.com/github/duaer-spec.git`)
|
|
35
|
+
2. **Repository name**: Extract from the URL (e.g., `duaer-spec` from `https://github.com/github/duaer-spec.git`)
|
|
36
|
+
3. **Is GitHub**: Whether the remote points to a GitHub repository
|
|
37
|
+
|
|
38
|
+
Supported URL formats:
|
|
39
|
+
- HTTPS: `https://github.com/<owner>/<repo>.git`
|
|
40
|
+
- SSH: `git@github.com:<owner>/<repo>.git`
|
|
41
|
+
|
|
42
|
+
> [!CAUTION]
|
|
43
|
+
> ONLY report a GitHub repository if the remote URL actually points to github.com.
|
|
44
|
+
> Do NOT assume the remote is GitHub if the URL format doesn't match.
|
|
45
|
+
|
|
46
|
+
## Graceful Degradation
|
|
47
|
+
|
|
48
|
+
If Git is not installed, the directory is not a Git repository, or no remote is configured:
|
|
49
|
+
- Return an empty result
|
|
50
|
+
- Do NOT error — other workflows should continue without Git remote information
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: duaer-git-validate
|
|
3
|
+
description: Validate current branch follows feature branch naming conventions
|
|
4
|
+
compatibility: Requires duaer-spec project structure with .duaer/ directory
|
|
5
|
+
metadata:
|
|
6
|
+
author: github-duaer-spec
|
|
7
|
+
source: git:commands/duaer.git.validate.md
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Validate Feature Branch
|
|
11
|
+
|
|
12
|
+
Validate that the current Git branch follows the expected feature branch naming conventions.
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
|
17
|
+
- If Git is not available, output a warning and skip validation:
|
|
18
|
+
```
|
|
19
|
+
[specify] Warning: Git repository not detected; skipped branch validation
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Validation Rules
|
|
23
|
+
|
|
24
|
+
Get the current branch name:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git rev-parse --abbrev-ref HEAD
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The branch name's final path segment must start with one of these feature markers:
|
|
31
|
+
|
|
32
|
+
1. **Sequential**: `[0-9]{3,}-` (e.g., `001-feature-name`, `042-fix-bug`, `1000-big-feature`, `jdoe/web/008-guided-tour`)
|
|
33
|
+
2. **Timestamp**: `[0-9]{8}-[0-9]{6}-` (e.g., `20260319-143022-feature-name`, `jdoe/web/20260319-143022-feature-name`)
|
|
34
|
+
|
|
35
|
+
## Execution
|
|
36
|
+
|
|
37
|
+
If on a feature branch (matches either pattern):
|
|
38
|
+
- Output: `✓ On feature branch: <branch-name>`
|
|
39
|
+
- Check if the corresponding spec directory exists under `specs/`:
|
|
40
|
+
- For sequential branches, look for `specs/<prefix>-*` where prefix matches the numeric portion, regardless of branch namespace prefixes
|
|
41
|
+
- For timestamp branches, look for `specs/<prefix>-*` where prefix matches the `YYYYMMDD-HHMMSS` portion, regardless of branch namespace prefixes
|
|
42
|
+
- If spec directory exists: `✓ Spec directory found: <path>`
|
|
43
|
+
- If spec directory missing: `⚠ No spec directory found for prefix <prefix>`
|
|
44
|
+
|
|
45
|
+
If NOT on a feature branch:
|
|
46
|
+
- Output: `✗ Not on a feature branch. Current branch: <branch-name>`
|
|
47
|
+
- Output: `Feature branches should be named like: 001-feature-name, 20260319-143022-feature-name, or <namespace>/001-feature-name`
|
|
48
|
+
|
|
49
|
+
## Graceful Degradation
|
|
50
|
+
|
|
51
|
+
If Git is not installed or the directory is not a Git repository:
|
|
52
|
+
- Check the `SPECIFY_FEATURE` environment variable as a fallback
|
|
53
|
+
- If set, validate that value against the naming patterns
|
|
54
|
+
- If not set, skip validation with a warning
|