atxtechbro / atxtechbro/dotfiles

Make close-issue command AI provider agnostic and CLI-callable

Open
#1,303 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Problem
The current `close-issue` command is tightly coupled to Claude Code's interactive shell environment and cannot be:
1. Called from the command line outside of Claude Code
2. Used with other AI providers (Amazon Q, Cursor, etc.)

## Solution
Create a provider-agnostic CLI tool that can be invoked both inside and outside interactive AI sessions.

## Implementation Plan

### 1. Create Standalone CLI Script (`bin/close-issue`)
- Shell script callable from command line: `close-issue 123`
- Support multiple AI providers via environment variables or flags
- Work both inside and outside Claude Code interactive sessions
- Use `claude -p` for non-interactive execution when using Claude

### 2. Extract Core Logic to Provider-Agnostic Module
- Move prompt generation from `.claude/command-templates/close-issue.md`
- Create `utils/close-issue-prompt.py` that:
- Aggregates knowledge base (like `.github/scripts/aggregate-knowledge.sh`)
- Generates the full prompt with injected procedures
- Returns formatted prompt for any AI provider

### 3. Update Template System for Multi-Provider Support
- Modify `utils/generate-commands.sh` to generate provider-specific wrappers
- Each provider gets a thin wrapper that calls the core CLI script
- Remove Claude-specific logging from core logic

### 4. Create Provider Abstraction Layer
- Support providers: Claude, Amazon Q, Cursor, generic LLM CLI
- Provider detection via environment variables or config
- Fallback chain: Claude → Amazon Q → Cursor → generic

### 5. Implementation Details
- **bin/close-issue**: Main CLI entry point
- Parse arguments (issue number, optional provider)
- Set up worktree (git operations)
- Generate prompt via Python module
- Execute via appropriate AI provider
- **utils/close-issue-prompt.py**: Prompt generation
- Load and inject knowledge base
- Process template placeholders
- Return complete prompt text
- **Provider adapters**: Thin wrappers for each AI tool
- Claude: `claude -p "$PROMPT"`
- Others: Similar non-interactive invocations

### 6. Maintain Backward Compatibility
- Keep `/close-issue` slash command working
- Update it to call the new CLI script internally
- Preserve existing logging for interactive sessions

## Benefits
- ✅ AI provider agnosticism via abstraction layer
- ✅ CLI-callable outside interactive sessions
- ✅ Reusable core logic across providers
- ✅ Maintains existing slash command functionality
- ✅ Follows systems-stewardship principle (single source of truth)

## Principles
- **systems-stewardship**: Single source of truth for issue closing logic
- **ai-provider-agnosticism**: Work across different AI tools
- **backward-compatibility**: Preserve existing workflows

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing .claude/command-templates/close-issue.md, utils/generate-commands.sh, and .github/scripts/aggregate-knowledge.sh to trace the current workflow. Then inspect how the /close-issue command sets up worktrees, generates prompts, and invokes Claude. Done means bin/close-issue works from and outside interactive sessions, supports the listed provider paths, and preserves the existing slash command behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
cli, devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.