From b8ca9d1c6763454bf3bcb319bfbb71665f9534d4 Mon Sep 17 00:00:00 2001 From: Pedram Amini Date: Sun, 7 Dec 2025 09:05:42 -0600 Subject: [PATCH] OAuth enabled but no valid token found. Starting authentication... Found expired OAuth token, attempting refresh... Token refresh successful ## CHANGES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added CLI tool for remote control and automation magic! 🚀 • Introduced web interface for mobile device remote control! 📱 • Created shared code structure across all processes nicely! 🏗️ • Expanded template variables system with 30+ dynamic options! 🎯 • Migrated slash commands to customizable AI command system! ✨ • Added 16 beautiful themes across dark/light/vibe modes! 🎨 • Improved Auto Run with document paths and loop counters! 🔄 • Enhanced CLI with playbook execution and JSON streaming! 📊 • Fixed slash command autocomplete for multiline input handling! 🐛 • Restructured project with dedicated CLI and web directories! 📁 --- CONTRIBUTING.md | 94 ++++++++++++++++----------- README.md | 62 ++++++++++++++---- src/renderer/components/InputArea.tsx | 3 +- 3 files changed, 107 insertions(+), 52 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b977cff..5d572c5c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,15 +48,25 @@ maestro/ │ │ ├── process-manager.ts │ │ ├── preload.ts # Secure IPC bridge │ │ └── utils/ # Shared utilities -│ └── renderer/ # React frontend (UI) -│ ├── App.tsx # Main coordinator -│ ├── components/ # React components -│ ├── hooks/ # Custom React hooks -│ ├── services/ # IPC wrappers (git, process) -│ ├── contexts/ # React contexts -│ ├── constants/ # Themes, shortcuts, priorities -│ ├── types/ # TypeScript definitions -│ └── utils/ # Frontend utilities +│ ├── renderer/ # React frontend (Desktop UI) +│ │ ├── App.tsx # Main coordinator +│ │ ├── components/ # React components +│ │ ├── hooks/ # Custom React hooks +│ │ ├── services/ # IPC wrappers (git, process) +│ │ ├── contexts/ # React contexts +│ │ ├── constants/ # Themes, shortcuts, priorities +│ │ ├── types/ # TypeScript definitions +│ │ └── utils/ # Frontend utilities +│ ├── cli/ # CLI tool (maestro-cli) +│ │ ├── index.ts # CLI entry point +│ │ ├── commands/ # Command implementations +│ │ ├── services/ # CLI services (storage, batch processor) +│ │ └── output/ # Output formatters (human, JSONL) +│ ├── shared/ # Shared code across processes +│ │ ├── theme-types.ts # Theme type definitions +│ │ └── templateVariables.ts # Template variable system +│ └── web/ # Web interface (Remote Control) +│ └── ... # Mobile-optimized React app ├── build/ # Application icons ├── .github/workflows/ # CI/CD automation └── dist/ # Build output (generated) @@ -65,16 +75,19 @@ maestro/ ## Development Scripts ```bash -npm run dev # Start dev server with hot reload -npm run build # Full production build -npm run build:main # Build main process only -npm run build:renderer # Build renderer only -npm start # Start built application -npm run clean # Clean build artifacts -npm run package # Package for all platforms -npm run package:mac # Package for macOS -npm run package:win # Package for Windows -npm run package:linux # Package for Linux +npm run dev # Start dev server with hot reload +npm run dev:web # Start web interface dev server +npm run build # Full production build (main + renderer + web + CLI) +npm run build:main # Build main process only +npm run build:renderer # Build renderer only +npm run build:web # Build web interface only +npm run build:cli # Build CLI tool only +npm start # Start built application +npm run clean # Clean build artifacts +npm run package # Package for all platforms +npm run package:mac # Package for macOS +npm run package:win # Package for Windows +npm run package:linux # Package for Linux ``` ## Common Development Tasks @@ -144,47 +157,50 @@ npm run package:linux # Package for Linux ### Adding a Slash Command -Add to `src/renderer/slashCommands.ts`: +Slash commands are now **Custom AI Commands** defined in Settings, not in code. They are prompt macros that get substituted and sent to the AI agent. + +To add a built-in slash command that users see by default, add it to the Custom AI Commands default list in `useSettings.ts`. Each command needs: ```typescript { command: '/mycommand', description: 'Does something useful', - terminalOnly: false, // Optional: restrict to terminal mode - execute: (context) => { - const { activeSessionId, setSessions } = context; - // Your logic - } + prompt: 'The prompt text with {{TEMPLATE_VARIABLES}}', } ``` +For commands that need programmatic behavior (not just prompts), handle them in `App.tsx` where slash commands are processed before being sent to the agent. + ### Adding a New Theme +Maestro has 16 themes across 3 modes: dark, light, and vibe. + Add to `src/renderer/constants/themes.ts`: ```typescript 'my-theme': { id: 'my-theme', name: 'My Theme', - mode: 'dark', // or 'light' + mode: 'dark', // 'dark', 'light', or 'vibe' colors: { - bgMain: '#...', - bgSidebar: '#...', - bgActivity: '#...', - border: '#...', - textMain: '#...', - textDim: '#...', - accent: '#...', - accentDim: 'rgba(...)', - accentText: '#...', - success: '#...', - warning: '#...', - error: '#...', + bgMain: '#...', // Main background + bgSidebar: '#...', // Sidebar background + bgActivity: '#...', // Activity/hover background + border: '#...', // Border color + textMain: '#...', // Primary text + textDim: '#...', // Secondary/dimmed text + accent: '#...', // Accent color + accentDim: 'rgba(...)', // Dimmed accent (with alpha) + accentText: '#...', // Text in accent contexts + accentForeground: '#...', // Text ON accent backgrounds (contrast) + success: '#...', // Success state (green) + warning: '#...', // Warning state (yellow/orange) + error: '#...', // Error state (red) } } ``` -Then add the ID to `ThemeId` type in `src/renderer/types/index.ts`. +Then add the ID to `ThemeId` type in `src/shared/theme-types.ts` and to the `isValidThemeId` function. ### Adding an IPC Handler diff --git a/README.md b/README.md index 0800db79..d6b9e8af 100644 --- a/README.md +++ b/README.md @@ -232,27 +232,58 @@ Create your own slash commands in **Settings > Custom AI Commands**. Each comman Commands support **template variables** that are automatically substituted at runtime: +#### Session Variables | Variable | Description | |----------|-------------| +| `{{SESSION_ID}}` | Maestro session ID (unique identifier) | | `{{SESSION_NAME}}` | Current session name | | `{{AGENT_SESSION_ID}}` | Agent session ID (for conversation continuity) | -| `{{PROJECT_NAME}}` | Project folder name | +| `{{TOOL_TYPE}}` | Agent type (claude-code, aider, etc.) | +| `{{AGENT_NAME}}` | Agent name (same as session name) | +| `{{AGENT_GROUP}}` | Agent's group name (if grouped) | + +#### Project Variables +| Variable | Description | +|----------|-------------| | `{{PROJECT_PATH}}` | Full path to project directory | -| `{{GIT_BRANCH}}` | Current git branch (if in a git repo) | +| `{{PROJECT_NAME}}` | Project folder name (last segment of path) | +| `{{CWD}}` | Current working directory | +| `{{AUTORUN_FOLDER}}` | Auto Run documents folder path | + +#### Auto Run Variables +| Variable | Description | +|----------|-------------| +| `{{DOCUMENT_NAME}}` | Current Auto Run document name (without .md) | +| `{{DOCUMENT_PATH}}` | Full path to current Auto Run document | +| `{{LOOP_NUMBER}}` | Current loop iteration (starts at 1) | + +#### Date/Time Variables +| Variable | Description | +|----------|-------------| | `{{DATE}}` | Current date (YYYY-MM-DD) | -| `{{DAY}}` | Day of month (01-31) | -| `{{MONTH}}` | Month (01-12) | | `{{TIME}}` | Current time (HH:MM:SS) | +| `{{DATETIME}}` | Full datetime (YYYY-MM-DD HH:MM:SS) | +| `{{TIMESTAMP}}` | Unix timestamp in milliseconds | +| `{{DATE_SHORT}}` | Short date (MM/DD/YY) | +| `{{TIME_SHORT}}` | Short time (HH:MM) | +| `{{YEAR}}` | Current year (YYYY) | +| `{{MONTH}}` | Current month (01-12) | +| `{{DAY}}` | Current day (01-31) | | `{{WEEKDAY}}` | Day of week (Monday, Tuesday, etc.) | +#### Git & Context Variables +| Variable | Description | +|----------|-------------| +| `{{GIT_BRANCH}}` | Current git branch name (requires git repo) | +| `{{IS_GIT_REPO}}` | "true" or "false" | +| `{{CONTEXT_USAGE}}` | Current context window usage percentage | + **Example**: A custom `/standup` command with prompt: ``` It's {{WEEKDAY}}, {{DATE}}. I'm on branch {{GIT_BRANCH}} in {{PROJECT_NAME}}. Summarize what I worked on yesterday and suggest priorities for today. ``` -See the full list of available variables in the **Template Variables** section within the Custom AI Commands panel. - ## Auto Run Auto Run is a file-system-based document runner that lets you batch-process tasks using AI agents. Select a folder containing markdown documents with task checkboxes, and Maestro will work through them one by one, spawning a fresh AI session for each task. @@ -407,20 +438,27 @@ maestro-cli list agents --group # Show agent details (history, usage stats, cost) maestro-cli show agent -# List playbooks for an agent +# List all playbooks (or filter by agent) +maestro-cli list playbooks maestro-cli list playbooks --agent # Show playbook details maestro-cli show playbook # Run a playbook -maestro-cli run +maestro-cli playbook # Dry run (shows what would be executed) -maestro-cli run --dry-run +maestro-cli playbook --dry-run # Run without writing to history -maestro-cli run --no-history +maestro-cli playbook --no-history + +# Wait for agent if busy, with verbose output +maestro-cli playbook --wait --verbose + +# Debug mode for troubleshooting +maestro-cli playbook --debug ``` ### JSON Output @@ -443,7 +481,7 @@ maestro-cli list groups --json {"type":"group","id":"group-def456","name":"Backend","emoji":"⚙️","timestamp":...} # Running a playbook with JSON streams events -maestro-cli run --json +maestro-cli playbook --json {"type":"start","timestamp":...,"playbook":{...}} {"type":"document_start","timestamp":...,"document":"tasks.md","taskCount":5} {"type":"task_start","timestamp":...,"taskIndex":0} @@ -456,7 +494,7 @@ maestro-cli run --json ```bash # Run a playbook every hour (use --json for log parsing) -0 * * * * /usr/local/bin/maestro-cli run --json >> /var/log/maestro.jsonl 2>&1 +0 * * * * /usr/local/bin/maestro-cli playbook --json >> /var/log/maestro.jsonl 2>&1 ``` ### Requirements diff --git a/src/renderer/components/InputArea.tsx b/src/renderer/components/InputArea.tsx index 14fef220..bfc768f3 100644 --- a/src/renderer/components/InputArea.tsx +++ b/src/renderer/components/InputArea.tsx @@ -561,7 +561,8 @@ export const InputArea = React.memo(function InputArea(props: InputAreaProps) { setInputValue(value); // Show slash command autocomplete when typing / - if (value.startsWith('/') && !value.includes(' ')) { + // Close when there's a space or newline (user is adding arguments or multiline content) + if (value.startsWith('/') && !value.includes(' ') && !value.includes('\n')) { // Only reset selection when modal first opens, not on every keystroke if (!slashCommandOpen) { setSelectedSlashCommandIndex(0);