Skip to content

Commit 463fc35

Browse files
gerredclaude
andcommitted
Update documentation organization and content
- Add tools and commands directories with individual documentation files - Update SUMMARY.md to list all tools and commands alphabetically - Fix links in tool-system-deep-dive.md and command-system-deep-dive.md - Update contact information and consulting section in README.md 📤 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1257319 commit 463fc35

40 files changed

+6766
-66
lines changed

src/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ For a deeper exploration of specific subsystems, the tool and command system dee
5757

5858
## Connect and Support
5959

60-
I'm actively working on research and implementation in this space. If you're interested in:
60+
I'm actively building in this space and available for consulting. If you need help with:
6161

6262
- Verticalized agents for specific domains
63-
- Agents in production environments
64-
- AI engineering consulting or research
63+
- Production agent deployments
64+
- Practical AI system architecture
65+
- Making this stuff actually work in real environments
6566

66-
You can reach me at [email protected] or on Twitter [@devgerred](https://x.com/devgerred).
67+
Reach out [by email](mailto:[email protected]) or on X [@devgerred](https://x.com/devgerred).
6768

68-
If you find this work valuable, consider supporting my ongoing research through [Ko-fi](https://ko-fi.com/gerred).
69+
If this work's valuable to you, you can support my ongoing research through [Ko-fi](https://ko-fi.com/gerred).
6970

7071
---
7172

src/SUMMARY.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,40 @@
1313
- [Real-World Examples](real-world-examples.md)
1414
- [Lessons Learned and Implementation Challenges](lessons-learned-and-implementation-challenges.md)
1515
- [Tool System Deep Dive](tool-system-deep-dive.md)
16+
- [Agent](tools/agent.md)
17+
- [Architect](tools/architect.md)
18+
- [Bash](tools/bash.md)
19+
- [FileEdit](tools/fileedit.md)
20+
- [FileRead](tools/fileread.md)
21+
- [FileWrite](tools/filewrite.md)
22+
- [Glob](tools/glob.md)
23+
- [Grep](tools/grep.md)
24+
- [LS](tools/ls.md)
25+
- [MCP](tools/mcp.md)
26+
- [MemoryRead](tools/memoryread.md)
27+
- [NotebookEdit](tools/notebookedit.md)
28+
- [NotebookRead](tools/notebookread.md)
29+
- [StickerRequest](tools/stickerrequest.md)
30+
- [Think](tools/think.md)
1631
- [Command System Deep Dive](command-system-deep-dive.md)
17-
- [Comments](comments.md)
32+
- [approvedtools](commands/approvedtools.md)
33+
- [bug](commands/bug.md)
34+
- [clear](commands/clear.md)
35+
- [commands](commands/commands.md)
36+
- [compact](commands/compact.md)
37+
- [config](commands/config.md)
38+
- [cost](commands/cost.md)
39+
- [ctx-viz](commands/ctx-viz.md)
40+
- [doctor](commands/doctor.md)
41+
- [help](commands/help.md)
42+
- [init](commands/init.md)
43+
- [listen](commands/listen.md)
44+
- [login](commands/login.md)
45+
- [logout](commands/logout.md)
46+
- [model](commands/model.md)
47+
- [onboarding](commands/onboarding.md)
48+
- [pr-comments](commands/pr-comments.md)
49+
- [release-notes](commands/release-notes.md)
50+
- [resume](commands/resume.md)
51+
- [review](commands/review.md)
52+
- [terminalsetup](commands/terminalsetup.md)

src/command-system-deep-dive.md

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,52 @@ The Claude Code command system provides a suite of slash commands that users can
44

55
Commands are integrated into the CLI through the Commander.js library and follow a consistent structure for both CLI arguments and interactive slash commands. The command system allows Claude Code to extend beyond simple conversational capabilities into a fully-featured developer tool.
66

7-
### approvedTools Command
7+
### Command Categories
88

9-
The `approvedTools` command manages which tools Claude has permission to use in a given project.
9+
Claude Code's commands can be broadly categorized into several functional groups:
1010

11-
#### Implementation
12-
13-
This command is implemented in `commands/approvedTools.ts` and provides functionality to list and remove tools from the approved list. The implementation uses a simple handler pattern with two key functions:
14-
15-
1. `handleListApprovedTools`: Lists all tools that are approved for use in the current directory.
16-
2. `handleRemoveApprovedTool`: Removes a specific tool from the approved list.
17-
18-
The command follows a configurable pattern that supports dependency injection:
19-
20-
```typescript
21-
export type ProjectConfigHandler = {
22-
getCurrentProjectConfig: () => ProjectConfig
23-
saveCurrentProjectConfig: (config: ProjectConfig) => void
24-
}
25-
26-
// Default config handler using the real implementation
27-
const defaultConfigHandler: ProjectConfigHandler = {
28-
getCurrentProjectConfig: getCurrentProjectConfigDefault,
29-
saveCurrentProjectConfig: saveCurrentProjectConfigDefault,
30-
}
31-
```
11+
#### Environment Management
12+
- [approvedtools](commands/approvedtools.md): Manage tool permissions
13+
- [commands](commands/commands.md): List available commands
14+
- [config](commands/config.md): Configure Claude Code settings
15+
- [init](commands/init.md): Create KODING.md for project setup
16+
- [terminalsetup](commands/terminalsetup.md): Configure terminal keybindings
17+
- [doctor](commands/doctor.md): Check installation health
3218

33-
This design makes the command testable by allowing the injection of mock config handlers.
19+
#### Authentication
20+
- [login](commands/login.md): Authenticate with Anthropic
21+
- [logout](commands/logout.md): Sign out and remove credentials
22+
- [model](commands/model.md): Configure AI model settings
3423

35-
#### CLI Integration
24+
#### Context Management
25+
- [clear](commands/clear.md): Reset conversation and free context space
26+
- [compact](commands/compact.md): Summarize and condense conversation
27+
- [ctx-viz](commands/ctx-viz.md): Visualize token usage
28+
- [resume](commands/resume.md): Continue previous conversations
3629

37-
In `cli.tsx`, the command is registered as a subcommand under the main `claude` command:
38-
39-
```typescript
40-
const allowedTools = program
41-
.command('approved-tools')
42-
.description('Manage approved tools')
43-
44-
allowedTools
45-
.command('list')
46-
.description('List all approved tools')
47-
.action(async () => {
48-
const result = handleListApprovedTools(getCwd())
49-
console.log(result)
50-
process.exit(0)
51-
})
30+
#### User Experience
31+
- [help](commands/help.md): View available commands and usage
32+
- [onboarding](commands/onboarding.md): Guided first-run experience
33+
- [listen](commands/listen.md): Enable speech recognition
34+
- [bug](commands/bug.md): Submit feedback and bug reports
35+
- [release-notes](commands/release-notes.md): View version changes
5236

53-
allowedTools
54-
.command('remove <tool>')
55-
.description('Remove a tool from the list of approved tools')
56-
.action(async (tool: string) => {
57-
const result = handleRemoveApprovedTool(tool)
58-
logEvent('tengu_approved_tool_remove', {
59-
tool,
60-
success: String(result.success),
61-
})
62-
console.log(result.message)
63-
process.exit(result.success ? 0 : 1)
64-
})
65-
```
37+
#### GitHub Integration
38+
- [pr-comments](commands/pr-comments.md): View GitHub pull request comments
39+
- [review](commands/review.md): Review GitHub pull requests
6640

67-
This allows users to use commands like:
68-
- `claude approved-tools list` - To list all approved tools
69-
- `claude approved-tools remove <tool>` - To remove a specific tool from the approved list
41+
#### Analytics
42+
- [cost](commands/cost.md): Track API usage and expenses
7043

71-
#### Security Implications
44+
### Command Implementation Structure
7245

73-
The `approvedTools` command plays an important security role in Claude Code's permission system. It allows users to revoke permissions for specific tools, providing a mechanism to limit what Claude can do in a project. This is particularly important for tools that have the potential to modify files or execute commands.
46+
Each command follows a consistent structure and typically falls into one of these implementation types:
7447

75-
### bug Command
48+
1. **Local Commands** (`type: 'local'`): Perform direct actions without rendering a UI
49+
2. **JSX Commands** (`type: 'local-jsx'`): Render interactive React components
50+
3. **Prompt Commands** (`type: 'prompt'`): Formulate specific requests to Claude
7651

77-
The `bug` command provides users with a way to submit bug reports and feedback directly from the CLI interface.
52+
Click on any command above to view its detailed implementation and functionality.
7853

7954
#### Implementation
8055

src/commands/approvedtools.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
### approvedTools Command
2+
3+
The `approvedTools` command manages which tools Claude has permission to use in a given project.
4+
5+
#### Implementation
6+
7+
This command is implemented in `commands/approvedTools.ts` and provides functionality to list and remove tools from the approved list. The implementation uses a simple handler pattern with two key functions:
8+
9+
1. `handleListApprovedTools`: Lists all tools that are approved for use in the current directory.
10+
2. `handleRemoveApprovedTool`: Removes a specific tool from the approved list.
11+
12+
The command follows a configurable pattern that supports dependency injection:
13+
14+
```typescript
15+
export type ProjectConfigHandler = {
16+
getCurrentProjectConfig: () => ProjectConfig;
17+
saveCurrentProjectConfig: (config: ProjectConfig) => void;
18+
};
19+
20+
// Default config handler using the real implementation
21+
const defaultConfigHandler: ProjectConfigHandler = {
22+
getCurrentProjectConfig: getCurrentProjectConfigDefault,
23+
saveCurrentProjectConfig: saveCurrentProjectConfigDefault,
24+
};
25+
```
26+
27+
This design makes the command testable by allowing the injection of mock config handlers.
28+
29+
#### CLI Integration
30+
31+
In `cli.tsx`, the command is registered as a subcommand under the main `claude` command:
32+
33+
```typescript
34+
const allowedTools = program
35+
.command("approved-tools")
36+
.description("Manage approved tools");
37+
38+
allowedTools
39+
.command("list")
40+
.description("List all approved tools")
41+
.action(async () => {
42+
const result = handleListApprovedTools(getCwd());
43+
console.log(result);
44+
process.exit(0);
45+
});
46+
47+
allowedTools
48+
.command("remove <tool>")
49+
.description("Remove a tool from the list of approved tools")
50+
.action(async (tool: string) => {
51+
const result = handleRemoveApprovedTool(tool);
52+
logEvent("tengu_approved_tool_remove", {
53+
tool,
54+
success: String(result.success),
55+
});
56+
console.log(result.message);
57+
process.exit(result.success ? 0 : 1);
58+
});
59+
```
60+
61+
This allows users to use commands like:
62+
63+
- `claude approved-tools list` - To list all approved tools
64+
- `claude approved-tools remove <tool>` - To remove a specific tool from the approved list
65+
66+
#### Security Implications
67+
68+
The `approvedTools` command plays an important security role in Claude Code's permission system. It allows users to revoke permissions for specific tools, providing a mechanism to limit what Claude can do in a project. This is particularly important for tools that have the potential to modify files or execute commands.
69+

src/commands/bug.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
### bug Command
2+
3+
The `bug` command provides users with a way to submit bug reports and feedback directly from the CLI interface.
4+
5+
#### Implementation
6+
7+
The command is implemented in `commands/bug.tsx` and leverages React components to create an interactive feedback form:
8+
9+
```typescript
10+
import { Command } from "../commands";
11+
import { Bug } from "../components/Bug";
12+
import * as React from "react";
13+
import { PRODUCT_NAME } from "../constants/product";
14+
15+
const bug = {
16+
type: "local-jsx",
17+
name: "bug",
18+
description: `Submit feedback about ${PRODUCT_NAME}`,
19+
isEnabled: true,
20+
isHidden: false,
21+
async call(onDone) {
22+
return <Bug onDone={onDone} />;
23+
},
24+
userFacingName() {
25+
return "bug";
26+
},
27+
} satisfies Command;
28+
29+
export default bug;
30+
```
31+
32+
Unlike pure command-line commands, this command uses the `type: 'local-jsx'` designation, which allows it to render a React component as its output. This enables a rich, interactive interface for gathering bug reports.
33+
34+
#### UI Component
35+
36+
The core functionality is housed in the `Bug` component in `components/Bug.tsx`. Key aspects of this component include:
37+
38+
1. **Multi-Step Form**: The UI guides users through a multi-step process:
39+
40+
- User input (description of the bug)
41+
- Consent for information collection
42+
- Submission
43+
- Completion
44+
45+
2. **Information Collection**: The component collects:
46+
47+
- User-provided bug description
48+
- Environment information (platform, terminal, version)
49+
- Git repository metadata (disabled in the current implementation)
50+
- Model settings (without API keys)
51+
52+
3. **GitHub Integration**: After submission, users can create a GitHub issue with pre-filled information including:
53+
54+
- Bug description
55+
- Environment info
56+
- Model settings
57+
58+
4. **Privacy Considerations**: The component has been carefully designed to avoid collecting sensitive information:
59+
- No API keys are included
60+
- Personal identifiers have been removed
61+
- Direct submission to Anthropic's feedback endpoint has been commented out
62+
63+
#### Technical Features
64+
65+
Several technical aspects of the implementation are worth noting:
66+
67+
1. **Stateful Form Management**: Uses React's `useState` to manage the form state through multiple steps.
68+
69+
2. **Terminal Adaptation**: Adapts to terminal size using the `useTerminalSize` hook to ensure a good experience regardless of window size.
70+
71+
3. **Keyboard Navigation**: Implements customized keyboard handling with `useInput` from Ink to enable intuitive navigation.
72+
73+
4. **Error Handling**: Includes robust error handling for submission failures.
74+
75+
5. **Title Generation**: Originally included a capability to generate a concise title for the bug report using Claude's Haiku endpoint (currently commented out).
76+
77+
6. **Browser Integration**: Uses the `openBrowser` utility to open the user's default web browser to the GitHub issues page with pre-filled information.
78+
79+
#### Design Considerations
80+
81+
The bug command exemplifies several design principles of Claude Code's command system:
82+
83+
1. **Rich Terminal UI**: Unlike traditional CLI tools that might just accept arguments, the command provides a fully interactive experience with visual feedback.
84+
85+
2. **Progressive Disclosure**: Information about what will be collected is clearly shown before submission.
86+
87+
3. **Simple Escape Paths**: Users can easily cancel at any point using Escape or Ctrl+C/D.
88+
89+
4. **Clear Status Indicators**: The UI clearly shows the current step and available actions at all times.
90+
91+
This command demonstrates how Claude Code effectively leverages React and Ink to create sophisticated terminal user interfaces for commands that require complex interaction.
92+

0 commit comments

Comments
 (0)