Commit Graph

18 Commits

Author SHA1 Message Date
wbtiger acabd0dba1 Fix /issue alias + Claude Code-style welcome banner
- Add "/issue" as alias for "/issues"
- Welcome banner: bold GITLINK TUI logo, project context,
  organized sections (Views/Actions/Shortcuts)
- Tip line at bottom for discoverability

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:26:57 +08:00
wbtiger d16535ffac UX overhaul: / completion, welcome message, Ctrl+hotkeys, /switch
Chat-First with UX polish:
- Welcome message on startup (project context + command hints)
- /command Tab completion with inline hint display
- /switch command for project switching
- Ctrl+I/R/B/O/L/S hotkeys for quick view access
- Aliases: /i=/issues, /h=/help, /s=/switch, /rel=/releases
- Help bar shows Ctrl+ shortcuts in view mode
- /quit to exit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:22:40 +08:00
wbtiger 813a0114aa Refactor to Chat-First architecture
Default: full-screen chat (like Claude Code)
- Type to send messages, /commands to switch views
- /issues, /pr, /ci, /code, /releases, /help, /quit
- Esc returns from any view back to chat
- Ctrl+A opens context-aware AI action menu
- View modes still support j/k navigation etc.

Removed: tab bar (no longer needed with /command routing)
StatusBar hint updated for new interaction model

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:14:09 +08:00
wbtiger 440fe62ab5 Fix chat input: use tea.KeyRunes/KeySpace for text detection
Key changes:
- isTextKey() uses msg.Type (KeyRunes/KeySpace) instead of msg.String()
- keyToChar() reads msg.Runes instead of msg.String() for proper char input
- Chat mode: any text key enters chat, Esc leaves, Enter sends
- "/" or ":" or "i" also enter chat mode
- j/k/1-7 etc. work normally in view mode, do NOT trigger chat

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:04:47 +08:00
wbtiger 13e5c19697 Add bottom quick bar chat — type anywhere to chat with AI
Three-state interaction model:
- StateNormal: view navigation (j/k, 1-7 tabs, Enter select)
- StateQuickBar: any non-hotkey typing opens bottom input bar
  Enter to send, Esc to dismiss
- StateAIMenu: Ctrl+A popup overlay

Layout: main view on top, quick bar (5 lines) at bottom when active

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:58:38 +08:00
wbtiger 4f941db0ae Add Ctrl+A popup menu + arrow key navigation
- Ctrl+A now opens a centered overlay menu with AI actions
- j/k or up/down arrow to navigate menu items
- Enter to select, Esc to cancel
- Arrow keys (up/down/left/right) forwarded to sub-views
- StatusBar hint updated to show both j/k and arrow keys

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:25:16 +08:00
wbtiger 895fb6322c Make gitlink the canonical entry point
- Binary built as "gitlink", supports both:
  gitlink        → starts TUI (default)
  gitlink tui    → starts TUI (explicit subcommand)
- Future: can add gitlink issue, gitlink pr, etc. as CLI subcommands

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:17:29 +08:00
wbtiger 4470c279db Add auth transport and Ctrl+A menu unit tests
- pkg/auth/auth_test.go: Transport with/without token, content-type header,
  NewHTTPClient, IsLoggedIn, LoadToken from file
- tui/agent/menu_test.go: ViewAIActions for all view types (Issue/PR/CI/
  Code/Release/Home/Unknown), FormatMenu

87 tests passing, 0 failures — no API key required

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:02:06 +08:00
wbtiger 7a3d5f2016 Phase 5: Polish — Markdown, Notifications, Search, Final integration
- tui/ui/markdown.go: Glamour-based terminal markdown renderer
- tui/views/notifications.go: Notification center (success/error/warning/info)
- tui/views/search.go: Global search view (repos + users, incremental input)
- Issue detail now renders markdown descriptions via RenderMarkdown
- 72 tests passing, build clean

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:54:21 +08:00
wbtiger 113288b17f Phase 4: SDD Engine + Hooks + Sessions + File Tools + Ctrl+A Menu
Step 0: SDD Engine (tui/spec/)
- Engine executes Spec through phases → steps → gate verification
- Hook system: OnStep/OnGate/OnDone callbacks
- Event channel for real-time progress tracking (EngineEvents)
- Manual stepping via RunPhase()
- 7 tests: full run, step failure, progress tracking, events, hooks, status

Step 1: Hook System + Session Manager (tui/harness/)
- HookSystem: PreToolUse/PostToolUse/Stop/SessionStart/SessionEnd
- Register/Fire/Remove/List operations
- SessionManager: JSONL-based save/load/list/fork/delete
- 10 tests: hooks register/fire/error/remove/list/multiple, session save/load/notfound/list/fork/delete

Step 2: File Tools (tui/tools/)
- file_read: safe file reading with path traversal protection, 50KB limit
- file_write: safe file writing with auto mkdir, path protection
- file_glob: pattern-based file search with 100 result limit
- 10 tests: read success/notfound/absolute/traversal/nopath, write success/absolute/nested, glob success/nomatches/nopattern

Step 3: Ctrl+A Menu + Agent Integration
- ViewAIActions(): context-aware menu items for each view type
- Agent panel wired into app.go (LLM client with graceful fallback)
- Ctrl+A shows real menu actions in status bar

72 tests passing, build clean

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:51:21 +08:00
wbtiger 53417c75df Phase 3: Agent Loop + LLM Client + AI Panel + Tools + Spec Engine
Step 0: Unit tests (34 total, all passing)
- pkg/context: parseRemoteURL, parsePathSegments
- pkg/output: Parse (success/string data/error/no data), APIError
- pkg/client: JSON suffix, URL building, New, APIError
- pkg/config: DefaultConfig, ConfigDir, ConfigPath, Load
- pkg/llm: NewClient (no key/custom model/default model)
- tui/navigation: Push/Pop stack, Params
- tui/store: parseIssues, parsePRs, parseComments, getItems
- tui/agent: ContextBuilder, parseToolCalls
- tui/tools: registry All/Get, getStr

Step 1: LLM Client (pkg/llm)
- Anthropic API integration with streaming support
- Model configurable via GITLINK_TUI_MODEL env var
- QuickChat helper for non-streaming queries

Step 2-5: Agent Harness
- tui/agent/context.go: System prompt builder (skills doc + API ref + view context)
- tui/agent/loop.go: ReACT loop with tool calling (10 turn max)
- tui/agent/panel.go: AI Panel with Chat/Spec/Log/Context tabs
- tui/tools/registry.go: 7 tools (issue_list/view, pr_list, repo_info,
  ci_builds, release_list, file_read)
- tui/spec/spec.go: Spec data structures (Phase/Step/Gate)
- tui/views/execution_dashboard.go: Execution progress + decision UI

Verify: go build ./... passes, go test ./... (34 tests pass)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 15:24:26 +08:00
wbtiger 6aa7934231 Phase 3 Step 0: Add unit tests for pkg/ and tui/ modules
Tests added:
- pkg/context: parseRemoteURL (SSH/HTTPS/no .git), parsePathSegments
- pkg/output: Parse (success/string data/error/no data), APIError
- pkg/client: JSON suffix, URL building, New(), APIError
- pkg/config: DefaultConfig, ConfigDir, ConfigPath, Load (non-existent)
- tui/navigation: Push/Pop stack, Params set/get
- tui/store: parseIssues, parsePRs, parseComments, getItems

Fix: Issue.Number json tag changed from "number" to "project_issues_index"
to match GitLink API response format.

21 tests passing, 0 failures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 15:08:44 +08:00
wbtiger b27a267536 Phase 2: Core Views — Issue Board, PRs, CI, Code, Release, PM
Step 1: API data layer
- Added LoadIssues/LoadPRs/LoadCIBuilds/LoadReleases/LoadIssueDetail
  async commands to store
- Data types: Issue, PullRequest, CIBuild, Release, Comment
- API response parser using parseJSONList helper
- Verified against live GitLink API (Gitlink/gitlink-cli project)

Step 2: Issue Board + Detail
- Kanban view: 4 columns (New/In Progress/Resolved/Closed)
- j/k navigation, h/l column switching, / filter
- Issue detail: title, description, status/priority/assignee
  metadata sidebar, comments thread

Step 3: PR List + CI Dashboard + Release List
- PR list with state badges (open/merged/closed)
- CI dashboard with build status icons (pass/fail/run)
- Release list with versions

Step 4: Code View + PM + Integration
- Code view: file tree + content viewer, j/k/Enter navigation
- PM dashboard placeholder
- All views wired into app.go, tab switching triggers data load

Verification: go build ./... passes

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 15:01:54 +08:00
wbtiger eed569cabe Add CLAUDE.md with SDD+Harness development guidelines
Mandatory workflow: Spec → Approve → Execute → Verify → Done
Before any code, produce a Spec with success criteria and verification
steps. User must approve before execution begins.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 14:34:12 +08:00
wbtiger 2f11023782 Phase 1: Harness Foundation — independent project
Project structure:
- pkg/auth/     HTTP transport with access_token injection
- pkg/client/   GitLink API client (.json suffix, error handling)
- pkg/config/   YAML config (reuses gitlink-cli config format)
- pkg/context/  Git remote owner/repo auto-detection
- pkg/output/   API response envelope parsing

TUI (Bubble Tea):
- main.go                    Entry point
- tui/app.go                 Root model, view routing, global keys
- tui/store/store.go         Central state (auth + project context)
- tui/navigation/router.go   Stack-based back navigation
- tui/ui/                    Theme, styles, keymap, StatusBar, TabBar
- tui/views/home.go          Dashboard + onboarding wizard

Keybindings: Ctrl+A (AI), Ctrl+Space (chat), Ctrl+P (commands), ? (help)
navigation: 1-7 tabs, j/k/Enter/Esc, Tab

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 14:26:12 +08:00
wbtiger b760e4de1f Simplify interaction model: unified Ctrl+A for all AI actions
- Replace 6+ AI hotkeys (Ctrl+E/R/D/K/G/J) with a single Ctrl+A
  context-aware menu. Agent dynamically generates 3-4 options based
  on current view context. Enter selects the most likely action.
- Dual entry: same intent can be expressed via Ctrl+A menu (fast) or
  AI Panel chat (flexible). Both enter the same Agent Engine.
- Final keymap: only 4 global keys to remember (Ctrl+A, Ctrl+Space,
  Ctrl+P, ?)
- Update README to reflect simplified interaction model

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 13:47:28 +08:00
wbtiger 7086d60c50 Add initial design document for GitLink TUI
Comprehensive architecture and design plan for an AI-native,
GitLink-integrated terminal application covering the full software
engineering lifecycle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 13:12:59 +08:00
wbtiger 473bd44f85 Initial commit 2026-05-17 13:07:47 +08:00