Skip to content

Commit 7bdcbbe

Browse files
jwaldripclaude
andcommitted
feat: add /setup skill and enforce ticket creation during elaboration
- Create /setup skill that auto-detects VCS, hosting, CI/CD, and MCP providers, then writes .ai-dlc/settings.yml via guided wizard - Add Phase 6.75 hard validation gate in elaborate to block handoff when epic/ticket fields are empty (with loop-back to Phase 6.5) - Add Step 0c soft warning in construct when ticket fields are missing - Prompt users to run /setup when settings.yml doesn't exist yet Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 78e4055 commit 7bdcbbe

File tree

4 files changed

+371
-1
lines changed

4 files changed

+371
-1
lines changed

plugin/hooks/inject-context.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ if [ -z "$ITERATION_JSON" ]; then
213213

214214
echo "**To resume:** \`/resume <slug>\` or \`/resume\` if only one"
215215
echo ""
216+
if [ ! -f ".ai-dlc/settings.yml" ]; then
217+
echo "> **Tip:** Run \`/setup\` to configure providers and VCS settings. This enables automatic ticket sync during elaboration."
218+
echo ""
219+
fi
216220
# Inject provider context for pre-elaboration awareness
217221
CONFIG_LIB="${CLAUDE_PLUGIN_ROOT}/lib/config.sh"
218222
if [ -f "$CONFIG_LIB" ]; then
@@ -231,6 +235,10 @@ if [ -z "$ITERATION_JSON" ]; then
231235
echo ""
232236
echo "No active AI-DLC task. Run \`/elaborate\` to start a new task."
233237
echo ""
238+
if [ ! -f ".ai-dlc/settings.yml" ]; then
239+
echo "> **First time?** Run \`/setup\` to configure AI-DLC for this project (auto-detects providers, VCS settings, etc.)"
240+
echo ""
241+
fi
234242
# Inject provider context
235243
CONFIG_LIB="${CLAUDE_PLUGIN_ROOT}/lib/config.sh"
236244
if [ -f "$CONFIG_LIB" ]; then

plugin/skills/construct/SKILL.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,47 @@ if git remote get-url origin &>/dev/null; then
147147
fi
148148
```
149149

150+
### Step 0c: Provider Sync Check
151+
152+
Check if a ticketing provider is configured and warn if ticket fields are unpopulated. This is a **warning only** — construction proceeds regardless. The elaboration gate (Phase 6.75) is the hard enforcement point; this catches cases where elaboration predated provider configuration.
153+
154+
```bash
155+
source "${CLAUDE_PLUGIN_ROOT}/lib/config.sh"
156+
PROVIDERS=$(load_providers)
157+
TICKETING_TYPE=$(echo "$PROVIDERS" | jq -r '.ticketing.type // empty')
158+
159+
if [ -n "$TICKETING_TYPE" ]; then
160+
INTENT_DIR=".ai-dlc/${INTENT_SLUG}"
161+
MISSING=""
162+
163+
# Check epic field in intent.md
164+
if [ -f "$INTENT_DIR/intent.md" ]; then
165+
EPIC=$(han parse yaml epic -r --default "" < "$INTENT_DIR/intent.md" 2>/dev/null || echo "")
166+
if [ -z "$EPIC" ]; then
167+
MISSING="${MISSING}\n- intent.md: epic field is empty"
168+
fi
169+
fi
170+
171+
# Check ticket field in each unit file
172+
for unit_file in "$INTENT_DIR"/unit-*.md; do
173+
[ -f "$unit_file" ] || continue
174+
TICKET=$(han parse yaml ticket -r --default "" < "$unit_file" 2>/dev/null || echo "")
175+
if [ -z "$TICKET" ]; then
176+
MISSING="${MISSING}\n- $(basename "$unit_file"): ticket field is empty"
177+
fi
178+
done
179+
180+
if [ -n "$MISSING" ]; then
181+
echo ""
182+
echo "> **WARNING: Ticketing provider '${TICKETING_TYPE}' is configured but some ticket fields are empty:**"
183+
echo -e "$MISSING"
184+
echo ">"
185+
echo "> Consider running \`/elaborate\` to sync tickets, or populate fields manually."
186+
echo ""
187+
fi
188+
fi
189+
```
190+
150191
### Step 1: Load State
151192

152193
```bash

plugin/skills/elaborate/SKILL.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ This ensures builders can pull the intent branch when working remotely. Note in
764764

765765
## Phase 6.5: Sync to Ticketing Provider
766766

767-
If a ticketing provider is configured and MCP tools are available:
767+
If a ticketing provider is configured and MCP tools are available, you **MUST** complete all steps below. Phase 6.75 will validate that all tickets were created — you cannot proceed to handoff with missing tickets.
768768

769769
1. **Epic handling**:
770770
- If `epic` field in intent.md frontmatter is already populated (provided by product), use that existing epic — do not create a new one
@@ -795,6 +795,60 @@ If a ticketing provider is configured and MCP tools are available:
795795

796796
---
797797

798+
## Phase 6.75: Ticket Sync Validation
799+
800+
This phase validates that Phase 6.5 was completed correctly. It runs automatically after Phase 6.5.
801+
802+
### Step 1: Check if ticketing is configured
803+
804+
```bash
805+
source "${CLAUDE_PLUGIN_ROOT}/lib/config.sh"
806+
PROVIDERS=$(load_providers)
807+
TICKETING_TYPE=$(echo "$PROVIDERS" | jq -r '.ticketing.type // empty')
808+
```
809+
810+
- If `TICKETING_TYPE` is empty → **skip this phase**, proceed to Phase 7.
811+
812+
### Step 2: Verify MCP tools are available
813+
814+
Use `ToolSearch` to check for ticketing MCP tools (search for the provider type, e.g., `"jira"`, `"linear"`, `"github issues"`).
815+
816+
- If no MCP tools found → log warning: `"Ticketing provider '${TICKETING_TYPE}' configured but MCP tools not available — skipping ticket validation"` → proceed to Phase 7.
817+
818+
### Step 3: Hard validation (provider + MCP tools available)
819+
820+
Read the intent and unit files and check for populated ticket fields:
821+
822+
1. **Epic check**: Read `intent.md` frontmatter. Check the `epic:` field.
823+
- If `epic:` is empty or missing → **FAIL**
824+
825+
2. **Ticket check**: Scan all `unit-*.md` files in the intent directory. Check each file's `ticket:` frontmatter field.
826+
- If ANY unit has an empty or missing `ticket:` field → **FAIL**
827+
828+
### On FAIL:
829+
830+
**DO NOT proceed to Phase 7.** Instead:
831+
832+
1. Report exactly what is missing:
833+
```
834+
Ticket sync validation failed:
835+
- intent.md: epic field is empty
836+
- unit-02-auth-middleware.md: ticket field is empty
837+
- unit-04-api-routes.md: ticket field is empty
838+
```
839+
840+
2. Loop back to **Phase 6.5** to create the missing tickets/epic.
841+
842+
3. After Phase 6.5 completes, re-run this validation (Phase 6.75).
843+
844+
4. Only proceed to Phase 7 when all `epic:` and `ticket:` fields are populated.
845+
846+
### On PASS:
847+
848+
Log: `"Ticket sync validation passed — all epic and ticket fields populated."` → proceed to Phase 7.
849+
850+
---
851+
798852
## Phase 7: Handoff to Construction
799853

800854
Tell the user:

0 commit comments

Comments
 (0)