Skip to content

feat: add question-render fenced markers and Claude transformer#2186

Open
Rohan-1920 wants to merge 1 commit intogithub:mainfrom
Rohan-1920:feat/question-render-transformer
Open

feat: add question-render fenced markers and Claude transformer#2186
Rohan-1920 wants to merge 1 commit intogithub:mainfrom
Rohan-1920:feat/question-render-transformer

Conversation

@Rohan-1920
Copy link
Copy Markdown

🚀 PR: Add Claude-native AskUserQuestion Rendering Pipeline

Overview

  • Adds a non-invasive transformation layer for Claude Code integration in spec-kit
  • Converts Markdown question tables into structured AskUserQuestion payloads
  • Only applies to Claude integration — all other agents remain unchanged
  • No changes to CLI behavior or core command logic

Changes

Templates

  • Added fenced markers to isolate question-rendering blocks in:

    • templates/commands/clarify.md
    • templates/commands/checklist.md
  • Markers used:

    • <!-- speckit:question-render:begin -->
    • <!-- speckit:question-render:end -->
  • No changes to existing logic or structure


Core Module

New file: src/specify_cli/core/question_transformer.py

  • Detects fenced question blocks

  • Parses:

    • Option | Description (clarify)
    • Option | Candidate | Why It Matters (checklist)
  • Converts into AskUserQuestion payload

  • Extra behavior:

    • Recommended option prioritized (clarify)
    • Adds fallback option: “Provide my own short answer (≤10 words)”
    • Safe handling for duplicates
    • Returns original content unchanged when no markers exist

Claude Integration

  • Updated src/specify_cli/integrations/claude/__init__.py
  • Transformation applied only for Claude Code
  • Other integrations remain byte-identical

Agents Fix

  • Updated src/specify_cli/agents.py
  • Fixed {SCRIPT} / {AGENT_SCRIPT} resolution logic
  • Improved cross-platform compatibility

Tests

Unit Tests

  • tests/test_question_transformer.py
    • 31 tests covering parsing, edge cases, and mapping logic

Integration Tests

  • tests/integrations/test_integration_claude.py
    • 8 tests covering:
      • AskUserQuestion generation
      • clarify & checklist flows
      • no Markdown leakage in Claude output
      • non-Claude agents remain unchanged

Backward Compatibility

  • Non-Claude agents are fully unaffected
  • HTML comment markers are invisible to all other systems
  • No CLI flags or config changes introduced
  • No changes to existing command behavior

Result

  • Before: Markdown table-based questions with manual selection
  • After (Claude only): Native AskUserQuestion UI with structured selection and fallback option

@Rohan-1920 Rohan-1920 requested a review from mnriem as a code owner April 12, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant