Skip to content

feat: Interactive stack selection and multi-stack support in /setup #197

Closed

Description

@admarble

Summary

Follow-up from #188 - implement the "Nice to Have" features for stack-aware constitution templates.

Background

PR #193 implemented stack-aware constitution templates with auto-detection. This issue covers the optional enhancements that were deferred.

Proposed Features

1. Interactive Mode for Stack Confirmation

When running /setup, optionally prompt the user to confirm or customize the detected stack:

Detected stack: Next.js
? Is this correct? (Y/n/other)

If user selects "other", show a list of available stacks to choose from.

2. Multi-Stack Project Support

Some projects use multiple stacks (e.g., Next.js frontend + Python backend). Support:

  • Detecting multiple stacks in the same repo
  • Combining notes from multiple stacks into the constitution
  • Configuring primary vs secondary stacks

Acceptance Criteria

  • AC-1: /setup has an interactive mode (--interactive or -i flag)
  • AC-2: Interactive mode asks user to confirm detected stack
  • AC-3: User can select a different stack from available options
  • AC-4: Multi-stack detection identifies all stacks in repo
  • AC-5: Constitution can include notes from multiple stacks

Implementation Notes

  • Interactive mode should be opt-in (non-breaking change)
  • Multi-stack could list stacks by directory (e.g., frontend/ = Next.js, backend/ = Python)
  • Consider a .sequant/stack.json config for persisting user's stack choices

Related

Activity

  1. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    📋 Spec Review — Implementation Plan

    Acceptance Criteria Checklist

    AC Description Verification Status
    AC-1 /setup has an interactive mode (--interactive or -i flag) Integration Test ✅ Already implemented
    AC-2 Interactive mode asks user to confirm detected stack Integration Test ✅ Already implemented
    AC-3 User can select a different stack from available options Integration Test ✅ Already implemented
    AC-4 Multi-stack detection identifies all stacks in repo Unit Test 🔲 New implementation
    AC-5 Constitution can include notes from multiple stacks Integration Test 🔲 New implementation

    Key Finding

    AC-1, AC-2, and AC-3 are already implemented in src/commands/init.ts:

    • Flag handling: lines 62-68
    • Stack confirmation prompt: lines 216-228
    • Stack selection list: lines 235-253

    The primary work is AC-4 and AC-5 for multi-stack support.


    Implementation Plan

    Phase 1: Verify Existing Features (AC-1, AC-2, AC-3)

    • Add integration tests to confirm existing behavior
    • Verify all 9 stacks from STACKS constant are listed in selection

    Phase 2: Multi-Stack Detection (AC-4)

    1. Create detectAllStacks() function in src/lib/stacks.ts

      • Traverse root and immediate subdirectories (1 level deep)
      • Return Array<{ stack: string, path: string }>
      • Skip node_modules/, .git/, vendor/, etc.
    2. Add unit tests with fixture directories

    Phase 3: Multi-Stack Selection UI (AC-4, AC-5)

    1. Extend interactive mode with multi-stack checkbox selection
    2. Create stack config persistence in .claude/.sequant/stack.json
      interface StackConfig {
        primary: { name: string, path?: string };
        additional?: Array<{ name: string, path?: string }>;
      }

    Phase 4: Combined Stack Notes (AC-5)

    1. Extend getStackNotes() to accept array of stacks
    2. Update template processing to read from stack config
    3. Generate combined {{STACK_NOTES}} with all stack sections

    Verification Criteria

    AC-4 Test Scenario:

    Given: Monorepo with frontend/next.config.js and backend/requirements.txt
    When: detectAllStacks() is called
    Then: Returns [{ stack: "nextjs", path: "frontend" }, { stack: "python", path: "backend" }]
    

    AC-5 Test Scenario:

    Given: User selected Next.js (primary) and Python (additional)
    When: Constitution is generated
    Then: constitution.md contains both "### Next.js" and "### Python" sections
    

    Open Questions

    1. Detection depth: Default to 1 level (immediate subdirectories) or configurable?

      • Recommendation: 1 level to avoid performance issues
    2. Primary vs additional distinction: Should primary stack determine dev URL and commands?

      • Recommendation: Yes, additional stacks add notes only
    3. Selection UI: Checkbox multi-select or sequential prompts?

      • Recommendation: Checkbox for single-step selection

    Recommended Workflow

    Phases: spec → exec → qa
    Quality Loop: Disabled (well-defined feature, no breaking changes)


    Generated by /spec 197

  2. added
    planned
    on Jan 31, 2026
  3. added a commit that references this issue on Jan 31, 2026
  4. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    🚀 Implementation Progress Update

    AC Coverage Summary

    AC Description Status Evidence
    AC-1 /setup has an interactive mode (--interactive or -i flag) ✅ Implemented src/commands/init.ts:66 (pre-existing)
    AC-2 Interactive mode asks user to confirm detected stack ✅ Implemented src/commands/init.ts:280-293 (pre-existing)
    AC-3 User can select a different stack from available options ✅ Implemented src/commands/init.ts:307-323 (pre-existing)
    AC-4 Multi-stack detection identifies all stacks in repo ✅ Implemented src/lib/stacks.ts:486-535 (new)
    AC-5 Constitution can include notes from multiple stacks ✅ Implemented src/lib/stacks.ts:712-752 (new)

    Key Files Changed

    File Changes
    src/lib/stacks.ts Added detectStackInDirectory(), detectAllStacks(), getMultiStackNotes()
    src/lib/stack-config.ts New module for .sequant/stack.json persistence
    src/commands/init.ts Multi-stack detection UI with checkbox selection
    src/lib/templates.ts Extended to pass additionalStacks to template processing

    Test Results

    • npm test: 143 tests pass for changed files (stacks, stack-config, init, templates)
    • npm run build: Compiles successfully

    PR Status

    ✅ Created: #214

    Self-Evaluation

    • Worked as expected: Yes - all AC items implemented
    • Test coverage confidence: High - added 73 new tests for new functionality
    • Weakest part: Manual testing of interactive UI not performed in this session
    • Honest assessment: Implementation complete, ready for QA

    Generated by /exec 197

  5. admarble commented on Jan 31, 2026

    @admarble
    ContributorAuthor

    🔍 QA Review for Issue #197

    AC Coverage

    AC Description Status Notes
    AC-1 /setup has interactive mode flag ✅ MET Pre-existing --interactive option
    AC-2 Interactive mode confirms detected stack ✅ MET Prompt at init.ts:289-301
    AC-3 User can select different stack ✅ MET Full stack list at init.ts:307-327
    AC-4 Multi-stack detection ✅ MET detectAllStacks() at stacks.ts:494-537
    AC-5 Constitution includes multi-stack notes ✅ MET getMultiStackNotes() at stacks.ts:722-751

    Coverage: 5/5 AC items fully met ✅


    CI Status ❌

    Check Status
    build (20.x) ❌ FAILURE (lint)
    typecheck ✅ SUCCESS
    validate-skills ✅ SUCCESS

    Failure cause: 2 unused imports:

    • src/commands/init.ts:14 - type DetectedStack never used
    • src/lib/stacks.ts:6 - join from "path" never used

    Quality Metrics

    Metric Value Status
    Files changed 7 OK
    Lines added +948 Large but justified
    Type issues (any) 9 WARN (inquirer types)
    Deleted tests 0 OK
    New tests 132 ✅ Excellent

    Test Results

    All 132 tests for changed files pass:

    • stacks.test.ts - 100 tests ✅
    • stack-config.test.ts - 15 tests ✅
    • init.test.ts - 17 tests ✅

    Verdict: AC_NOT_MET

    Reason: CI lint failure blocks merge.

    All acceptance criteria are functionally met. Fix required:

    1. Remove type DetectedStack import from init.ts:14
    2. Remove import { join } from "path" from stacks.ts:6

    Next Steps

    1. Fix lint failures (2 lines to remove)
    2. Push and verify CI passes
    3. Re-run /qa 197

    Generated by /qa 197

  6. added 3 commits that reference this issue on Jan 31, 2026
  7. added a commit that references this issue on Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions