Skip to content

Commit 90120eb

Browse files
committed
feat: Add planning mode and git operations documentation
- Introduced `mermaid-init.js` for dynamic mermaid diagram rendering based on theme. - Expanded commands documentation with new sections for Planning & Tasks, Git Operations, and Workflows & Agents. - Created a new `git.md` file detailing Git operations and auto-commit features. - Added `planning.md` to describe the Planning Mode for task management. - Implemented `workflow.md` for saving and orchestrating agent workflows. - Enhanced `tools.md` with real-time tool execution updates and approval requirements. - Added unit tests for command handling, action buttons, base block widgets, and block UI components.
1 parent 906c2a3 commit 90120eb

12 files changed

Lines changed: 1097 additions & 60 deletions

File tree

docs/javascripts/mermaid-init.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
document$.subscribe(() => {
2+
mermaid.initialize({
3+
theme: document.body.getAttribute('data-md-color-scheme') === 'slate' ? 'dark' : 'default'
4+
});
5+
})

docs/user/commands.md

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,48 @@ All commands are prefixed with `/` and executed from the input prompt.
2828
| `/compact` | Summarize conversation to reduce tokens |
2929
| `/context` | Inspect current AI context messages |
3030

31+
## Planning & Tasks
32+
33+
| Command | Description |
34+
|---------|-------------|
35+
| `/plan <goal>` | Generate a plan for the goal |
36+
| `/plan show` | Show current plan |
37+
| `/plan approve` | Approve all pending steps |
38+
| `/plan execute` | Start executing approved steps |
39+
| `/plan save <name>` | Save plan as workflow template |
40+
| `/plan load <name>` | Load saved plan |
41+
| `/todo` | Open task manager |
42+
| `/todo add <task>` | Add a new task |
43+
| `/todo list` | List tasks in chat |
44+
| `/todo done <id>` | Mark task as done |
45+
| `/todo del <id>` | Delete task |
46+
47+
## Git Operations
48+
49+
| Command | Description |
50+
|---------|-------------|
51+
| `/diff [file]` | Show diff for file or all changes |
52+
| `/commit [message]` | Commit staged changes |
53+
| `/undo` | Revert last AI commit |
54+
| `/git log` | Show recent commits |
55+
| `/git stash` | Stash changes |
56+
| `/git checkout <file>` | Discard changes |
57+
58+
## Workflows & Agents
59+
60+
| Command | Description |
61+
|---------|-------------|
62+
| `/workflow` | Browse workflows |
63+
| `/workflow run <name>` | Run a workflow |
64+
| `/workflow save [name]` | Save session as workflow |
65+
| `/bg <goal>` | Start background task |
66+
| `/bg list` | List background tasks |
67+
| `/bg status <id>` | Show task status |
68+
| `/bg logs <id>` | Show task logs |
69+
| `/bg cancel <id>` | Cancel running task |
70+
| `/orchestrate <goal>` | Start multi-agent task |
71+
| `/agents` | List agent profiles |
72+
3173
## Prompt/Persona Commands
3274

3375
| Command | Description |
@@ -38,18 +80,6 @@ All commands are prefixed with `/` and executed from the input prompt.
3880
| `/prompts dir` | Show prompts directory path |
3981
| `/prompts reload` | Reload prompts from disk |
4082

41-
### Built-in Prompts
42-
43-
| Key | Name | Description |
44-
|-----|------|-------------|
45-
| `default` | Default | Balanced assistant |
46-
| `concise` | Concise | Minimal responses |
47-
| `agent` | Agent | Task execution optimized |
48-
| `code` | Orchestration Helper | Automation focus |
49-
| `devops` | DevOps | System admin focus |
50-
51-
Add custom prompts in `~/.null/prompts/` as `.txt` or `.md` files.
52-
5383
## Session Commands
5484

5585
| Command | Description |
@@ -62,6 +92,14 @@ Add custom prompts in `~/.null/prompts/` as `.txt` or `.md` files.
6292
| `/session list` | List saved sessions |
6393
| `/session new` | Start new session |
6494

95+
## Collaboration
96+
97+
| Command | Description |
98+
|---------|-------------|
99+
| `/share` | Share current session |
100+
| `/share team` | Share to team workspace |
101+
| `/import <url>` | Import shared session |
102+
65103
## MCP Commands
66104

67105
| Command | Description |
@@ -75,17 +113,6 @@ Add custom prompts in `~/.null/prompts/` as `.txt` or `.md` files.
75113
| `/mcp disable <name>` | Disable MCP server |
76114
| `/mcp reconnect [name]` | Reconnect to server(s) |
77115
| `/tools` | Browse available MCP tools |
78-
| `/tools-ui` | (Deprecated) Same as `/tools` |
79-
80-
## Task Management
81-
82-
| Command | Description |
83-
|---------|-------------|
84-
| `/todo` | Open task dashboard |
85-
| `/todo add <task>` | Add a new task |
86-
| `/todo list` | List tasks in chat |
87-
| `/todo done <id>` | Mark task as done |
88-
| `/todo del <id>` | Delete task |
89116

90117
## Configuration Commands
91118

@@ -104,12 +131,29 @@ Add custom prompts in `~/.null/prompts/` as `.txt` or `.md` files.
104131
| `/ssh-list` | List saved SSH hosts |
105132
| `/ssh-del <alias>` | Delete SSH host |
106133

107-
## Built-in Shell Commands
108-
109-
These work in CLI mode without `/` prefix:
134+
## Advanced
110135

111136
| Command | Description |
112137
|---------|-------------|
113-
| `cd <path>` | Change directory |
114-
| `pwd` | Print working directory |
115-
| `clear` | Clear terminal screen |
138+
| `/map` | Visualize project architecture |
139+
| `/cmd <description>` | Translate natural language to shell command |
140+
| `/explain <command>` | Explain a shell command |
141+
| `/fix` | Auto-correct the last error |
142+
| `/watch` | Monitor output for errors and auto-fix |
143+
144+
---
145+
146+
## Global Shortcuts
147+
148+
| Shortcut | Action |
149+
|----------|--------|
150+
| `Ctrl+Space` | Toggle between AI and CLI modes |
151+
| `Ctrl+P` | Open command palette |
152+
| `Ctrl+\` | Toggle file sidebar |
153+
| `Ctrl+R` | History search |
154+
| `Ctrl+F` | Find in blocks |
155+
| `Ctrl+L` | Clear screen/history |
156+
| `F1` | Open Help |
157+
| `F2` | Select Model |
158+
| `F3` | Open Settings |
159+
| `F4` | Manage Providers |

docs/user/git.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Git Operations
2+
3+
Null Terminal integrates deeply with Git to make version control seamless within your AI workflow. Every AI edit becomes a trackable git operation with auto-generated commit messages.
4+
5+
## Overview
6+
7+
The `GitManager` handles all git interactions, ensuring that changes made by the AI are properly staged, committed, and documented.
8+
9+
## Features
10+
11+
### Auto-Commit
12+
13+
When enabled, the AI will automatically commit changes after writing files. It analyzes the diff and generates a conventional commit message.
14+
15+
```
16+
┌─────────────────────────────────────────────────────────────┐
17+
│ 🔄 AI Commit: feat(auth): add JWT refresh token support │
18+
├─────────────────────────────────────────────────────────────┤
19+
│ Files changed: 3 │
20+
│ M src/auth/handler.py (+45, -12) │
21+
│ A src/auth/jwt.py (+120) │
22+
│ M tests/test_auth.py (+30, -5) │
23+
│ ─────────────────────────────────────────────────────────── │
24+
│ [View Diff] [Revert] [Amend] │
25+
└─────────────────────────────────────────────────────────────┘
26+
```
27+
28+
### Diff Viewer
29+
30+
Inspect changes before or after they are applied.
31+
32+
```bash
33+
/diff src/auth/handler.py
34+
```
35+
36+
### Context Awareness
37+
38+
The AI is aware of your repository's state, including:
39+
- Current branch
40+
- Modified files
41+
- Recent commits
42+
43+
This allows for smarter suggestions and context-aware actions.
44+
45+
## Commands
46+
47+
| Command | Description |
48+
|---------|-------------|
49+
| `/diff [file]` | Show diff for file or all changes |
50+
| `/commit [message]` | Commit staged changes (AI generates message if empty) |
51+
| `/undo` | Revert the last AI commit |
52+
| `/git log` | Show recent commits with AI badges |
53+
| `/git stash` | Stash current changes |
54+
| `/git checkout <file>` | Discard changes to a file |
55+
56+
## Configuration
57+
58+
Configure git behavior in `~/.null/config.json`:
59+
60+
```json
61+
{
62+
"git": {
63+
"auto_commit": true,
64+
"commit_format": "conventional",
65+
"sign_commits": false,
66+
"show_diff_on_commit": true,
67+
"allow_revert": true
68+
}
69+
}
70+
```
71+
72+
## Workflow Example
73+
74+
1. **AI Change**: You ask the AI to "Refactor the login function".
75+
2. **Auto-Commit**: The AI modifies `login.py`. Null Terminal detects the change, stages it, generates a commit message like `refactor(auth): simplify login logic`, and commits it.
76+
3. **Review**: You see the commit block. You click "View Diff" to verify the changes.
77+
4. **Undo (Optional)**: If the change isn't what you wanted, you type `/undo` to revert the commit and restore the file.

docs/user/index.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Null Terminal User Guide
22

3-
Null Terminal is a block-based terminal emulator with integrated multi-provider AI chat and autonomous agent capabilities.
3+
Null Terminal is a block-based terminal emulator with integrated multi-provider AI chat and autonomous agent capabilities. It bridges the gap between traditional CLI tools and modern AI assistance.
44

55
## Quick Start
66

@@ -27,14 +27,15 @@ Every command and AI interaction creates a distinct "block" in the terminal:
2727

2828
Toggle between modes with `Ctrl+Space` or `/ai`.
2929

30-
### Agent Mode
30+
### Agent Capabilities
3131
Enable autonomous task execution where the AI can:
32-
- Execute shell commands
33-
- Read and write files
34-
- Use MCP tools
35-
- Chain multiple operations together
32+
- Execute shell commands and file operations
33+
- **Plan Complex Tasks**: Create roadmaps with `/plan`
34+
- **Git Integration**: Auto-commit changes with generated messages
35+
- **Use MCP Tools**: Connect to external services (databases, cloud, etc.)
36+
- **Orchestrate Workflows**: Run multi-agent tasks
3637

37-
Toggle with `/agent` command.
38+
Toggle agent mode with `/agent`.
3839

3940
## Essential Shortcuts
4041

@@ -48,28 +49,23 @@ Toggle with `/agent` command.
4849
| `F3` | Change theme |
4950
| `Escape` | Cancel current operation |
5051

51-
## Essential Commands
52-
53-
| Command | Description |
54-
|---------|-------------|
55-
| `/ai` | Toggle AI mode |
56-
| `/agent` | Toggle agent mode |
57-
| `/model` | Select AI model |
58-
| `/provider` | Configure AI provider |
59-
| `/config` | Open settings |
60-
| `/help` | Show help |
61-
| `/clear` | Clear history |
62-
| `/export` | Export conversation |
63-
| `/todo` | Open task dashboard |
64-
| `/prompts` | Manage system prompts |
52+
## Feature Highlights
53+
54+
- **Planning Mode**: Review and approve AI plans before execution. [Learn more](planning.md)
55+
- **Git Operations**: Seamless integration with git workflows. [Learn more](git.md)
56+
- **Workflows & Agents**: Save sessions and run background tasks. [Learn more](workflow.md)
57+
- **MCP Integration**: Connect 100+ external tools. [Learn more](mcp.md)
6558

6659
## Documentation
6760

6861
- [Commands Reference](commands.md) - All slash commands
6962
- [Keyboard Shortcuts](shortcuts.md) - All keyboard shortcuts
7063
- [AI Providers](providers.md) - Setting up AI providers
71-
- [Configuration](configuration.md) - Settings and options
64+
- [Planning Mode](planning.md) - Task planning and execution
65+
- [Git Operations](git.md) - Version control integration
66+
- [Workflows & Agents](workflow.md) - Templates and multi-agent tasks
7267
- [MCP Servers](mcp.md) - Model Context Protocol setup
68+
- [Configuration](configuration.md) - Settings and options
7369
- [Themes](themes.md) - Customizing appearance
7470
- [Tools & Agent Mode](tools.md) - AI tool use
7571
- [Sessions](sessions.md) - Saving and loading sessions

docs/user/planning.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Planning Mode
2+
3+
Null Terminal includes a powerful Planning Mode that allows you to create, review, and execute detailed roadmaps for your AI tasks. This ensures you have control over the AI's approach before any code is written.
4+
5+
## Overview
6+
7+
Planning Mode breaks down complex objectives into a series of actionable steps. You can review the plan, edit specific steps, and execute them sequentially or all at once.
8+
9+
## Usage
10+
11+
To start planning mode, use the `/plan` command followed by your goal:
12+
13+
```bash
14+
/plan Refactor the authentication module to use JWTs
15+
```
16+
17+
The AI will analyze your request and generate a structured plan.
18+
19+
### Plan Interface
20+
21+
The plan is displayed as an interactive block in your terminal:
22+
23+
```
24+
┌─────────────────────────────────────────────────────────────┐
25+
│ 📋 Plan: Refactor authentication module [Edit] │
26+
├─────────────────────────────────────────────────────────────┤
27+
│ ☑ 1. Read current auth implementation │
28+
│ └─ read_file: src/auth/handler.py │
29+
│ ☐ 2. Identify security vulnerabilities [Skip] [✓] │
30+
│ └─ Analyze for common auth pitfalls │
31+
│ ☐ 3. Create new JWT-based auth module [Skip] [✓] │
32+
│ └─ write_file: src/auth/jwt_handler.py │
33+
│ ☐ 4. Update tests [Skip] [✓] │
34+
│ └─ Modify existing test cases │
35+
│ ─────────────────────────────────────────────────────────── │
36+
│ [Approve All] [Execute] [Cancel] │
37+
└─────────────────────────────────────────────────────────────┘
38+
```
39+
40+
### Interacting with Plans
41+
42+
- **Approve All**: Accepts the entire plan and begins execution.
43+
- **Execute**: Starts executing the approved steps.
44+
- **Edit**: Allows you to modify the plan's goal or steps.
45+
- **Skip**: Skips a specific step.
46+
- **✓ (Check)**: Manually marks a step as complete.
47+
48+
## Commands
49+
50+
| Command | Description |
51+
|---------|-------------|
52+
| `/plan <goal>` | Generate a plan for the goal |
53+
| `/plan show` | Show the current plan |
54+
| `/plan approve` | Approve all pending steps |
55+
| `/plan execute` | Start executing approved steps |
56+
| `/plan save <name>` | Save the current plan as a workflow template |
57+
| `/plan load <name>` | Load a saved plan |
58+
59+
## Configuration
60+
61+
Planning mode behavior can be customized in your `~/.null/config.json`:
62+
63+
```json
64+
{
65+
"planning": {
66+
"enabled": true,
67+
"auto_approve_read_only": true,
68+
"max_steps": 20,
69+
"require_approval": true,
70+
"save_plans": true
71+
}
72+
}
73+
```
74+
75+
## Best Practices
76+
77+
1. **Be Specific**: The more specific your goal, the better the generated plan.
78+
2. **Review Critical Steps**: Pay close attention to steps involving file writes or deletions.
79+
3. **Iterate**: Use the edit functionality to refine the plan if the AI misses something.

0 commit comments

Comments
 (0)