Commit Graph

7 Commits

Author SHA1 Message Date
Dhanji R. Prasanna
78f9207d27 Add interactive mode to studio
New commands:
- studio cli (alias: c) - Start a new interactive g3 session in an isolated worktree
- studio resume <id> (alias: r) - Resume a paused interactive session
- Bare 'studio' now defaults to 'studio cli'

Session changes:
- Added SessionStatus::Paused for sessions that can be resumed
- Added SessionType enum (OneShot, Interactive) for future use
- Interactive sessions use inherited stdio for direct TTY access
- Sessions are marked as Paused when user exits g3

Workflow:
1. studio        # creates worktree, runs g3 interactively
2. (work in g3, exit when done)
3. studio resume <id>  # continue working
4. studio accept <id>  # merge to main when finished
2026-01-16 06:48:24 +05:30
Dhanji R. Prasanna
25d35529e7 Fix --accept flag being passed through to g3 in studio run
When --accept was passed after positional args (e.g., 'studio run --agent
carmack task --accept'), clap's trailing_var_arg captured it as part of
g3_args instead of parsing it as the studio flag. This caused g3 to error
with 'unexpected argument --accept'.

- Extract filter_accept_flag() helper to detect and remove --accept from
  trailing args
- Set auto_accept=true if --accept found in either position
- Add 5 unit tests for the filtering logic
2026-01-15 21:05:13 +05:30
Dhanji R. Prasanna
04e3c69b0a Add --accept flag to studio run command
Automatically accept the session after g3 completes successfully,
but only if there are commits on the branch.

Changes:
- Add --accept flag to Run command (stripped, not passed to g3)
- Add has_commits_on_branch() helper using git rev-list --count
- Auto-accept triggers merge to main and cleanup when:
  1. g3 exits successfully (exit code 0)
  2. Branch has commits ahead of main
- Show warning if --accept set but no commits exist

Usage: studio run --agent carmack --accept
2026-01-15 06:43:35 +05:30
Dhanji R. Prasanna
c65d082c5d Make --agent optional in Studio for one-shot mode
Studio can now run g3 without specifying an agent:

  # Agent mode (existing)
  studio run --agent carmack "fix the bug"

  # One-shot mode (new)
  studio run "fix the bug"

When no agent is specified, sessions are created under the 'single'
directory in .worktrees/sessions/single/<session-id>/

This makes Studio a complete replacement for Flock mode.
2026-01-13 14:42:20 +05:30
Dhanji R. Prasanna
f6b84d864a Rename G3 -> g3 in docs and comments
Standardize project name to lowercase 'g3' throughout documentation,
comments, and configuration files. Environment variables (G3_*) are
unchanged as they follow the uppercase convention.
2026-01-13 14:36:33 +05:30
Dhanji R. Prasanna
30bb63715e Fix studio status to show full markdown-formatted summary
Changes:
- Fix JSON path for session logs: now reads from context_window.conversation_history
  (with fallback to messages for backwards compatibility)
- Remove 500-character truncation to show full summary
- Add termimad dependency for terminal markdown rendering
- Display summary with proper markdown formatting (headers, bold, code, lists)

The extract_session_summary() function was looking for messages at the wrong
JSON path. Session logs store conversation history at context_window.conversation_history,
not at the top-level messages key.
2026-01-12 10:13:58 +05:30
Dhanji R. Prasanna
6c17f269d7 Add studio tool for multi-agent workspace management
Studio enables running multiple g3 agents concurrently without conflicts
by using git worktrees for isolation.

Features:
- studio run --agent <name> [args...]: Create worktree, spawn g3, tail output
- studio list: Show all active sessions
- studio status <id>: Show session details and summary
- studio accept <id>: Merge session branch to main and cleanup
- studio discard <id>: Delete session without merging

Each session gets:
- Isolated worktree at .worktrees/sessions/<agent>/<session-id>
- Dedicated branch: sessions/<agent>/<session-id>
- Short UUID (8 chars) for easy reference
- Automatic --workspace and --agent flags passed to g3
2026-01-12 07:26:17 +05:30