aiblueprint-cli 1.1.7 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -11
- package/claude-code-config/agents/action.md +36 -0
- package/claude-code-config/agents/explore-codebase.md +6 -1
- package/claude-code-config/agents/explore-docs.md +1 -1
- package/claude-code-config/agents/websearch.md +1 -1
- package/claude-code-config/commands/commit.md +1 -1
- package/claude-code-config/commands/oneshot.md +57 -0
- package/claude-code-config/hooks/hooks.json +15 -0
- package/claude-code-config/scripts/command-validator/README.md +147 -0
- package/claude-code-config/scripts/command-validator/biome.json +29 -0
- package/claude-code-config/scripts/command-validator/bun.lockb +0 -0
- package/claude-code-config/scripts/command-validator/dist/cli.js +544 -0
- package/claude-code-config/scripts/command-validator/package.json +27 -0
- package/claude-code-config/scripts/command-validator/src/__tests__/validator.test.ts +148 -0
- package/claude-code-config/scripts/command-validator/src/cli.ts +118 -0
- package/claude-code-config/scripts/command-validator/src/lib/security-rules.ts +172 -0
- package/claude-code-config/scripts/command-validator/src/lib/types.ts +33 -0
- package/claude-code-config/scripts/command-validator/src/lib/validator.ts +360 -0
- package/claude-code-config/scripts/command-validator/vitest.config.ts +7 -0
- package/claude-code-config/scripts/statusline/CLAUDE.md +178 -0
- package/claude-code-config/scripts/statusline/README.md +105 -0
- package/claude-code-config/scripts/statusline/biome.json +34 -0
- package/claude-code-config/scripts/statusline/bun.lockb +0 -0
- package/claude-code-config/scripts/statusline/fixtures/test-input.json +25 -0
- package/claude-code-config/scripts/statusline/package.json +19 -0
- package/claude-code-config/scripts/statusline/src/index.ts +39 -0
- package/claude-code-config/scripts/statusline/src/lib/context.ts +82 -0
- package/claude-code-config/scripts/statusline/src/lib/formatters.ts +48 -0
- package/claude-code-config/scripts/statusline/src/lib/types.ts +25 -0
- package/claude-code-config/scripts/statusline/statusline.config.ts +25 -0
- package/claude-code-config/scripts/statusline/test.ts +20 -0
- package/claude-code-config/scripts/statusline/tsconfig.json +27 -0
- package/dist/cli.js +1086 -76
- package/package.json +1 -2
- package/claude-code-config/agents/snipper.md +0 -36
- package/claude-code-config/commands/claude-memory.md +0 -190
- package/claude-code-config/commands/cleanup-context.md +0 -82
- package/claude-code-config/commands/debug.md +0 -91
- package/claude-code-config/commands/deep-code-analysis.md +0 -87
- package/claude-code-config/commands/explain-architecture.md +0 -113
- package/claude-code-config/commands/prompt-agent.md +0 -126
- package/claude-code-config/commands/prompt-command.md +0 -225
- package/claude-code-config/output-styles/assistant.md +0 -15
- package/claude-code-config/output-styles/honnest.md +0 -9
- package/claude-code-config/output-styles/senior-dev.md +0 -14
- package/claude-code-config/scripts/statusline-ccusage.sh +0 -188
- package/claude-code-config/scripts/statusline.readme.md +0 -194
- /package/claude-code-config/{hooks → scripts}/hook-post-file.ts +0 -0
package/README.md
CHANGED
|
@@ -7,6 +7,21 @@ A comprehensive CLI tool for supercharging Claude Code with security, productivi
|
|
|
7
7
|
|
|
8
8
|
## 🚀 Quick Start
|
|
9
9
|
|
|
10
|
+
### Option 1: Install as Claude Code Plugin (Recommended)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Add the AIBlueprint marketplace
|
|
14
|
+
/plugin marketplace add melvynx/aiblueprint
|
|
15
|
+
|
|
16
|
+
# Install the base plugin
|
|
17
|
+
/plugin install aibp-base@AIBlueprint
|
|
18
|
+
|
|
19
|
+
# Or install directly from GitHub
|
|
20
|
+
/plugin install github:melvynx/aiblueprint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Option 2: Use the CLI Tool
|
|
24
|
+
|
|
10
25
|
```bash
|
|
11
26
|
# Run immediately without installation
|
|
12
27
|
bunx aiblueprint-cli@latest claude-code setup
|
|
@@ -18,7 +33,8 @@ aiblueprint claude-code setup
|
|
|
18
33
|
|
|
19
34
|
## 📋 Table of Contents
|
|
20
35
|
|
|
21
|
-
- [Installation
|
|
36
|
+
- [Plugin Installation](#-plugin-installation)
|
|
37
|
+
- [CLI Installation & Usage](#-cli-installation--usage)
|
|
22
38
|
- [Command Reference](#command-reference)
|
|
23
39
|
- [Available Features](#available-features)
|
|
24
40
|
- [Configuration System](#configuration-system)
|
|
@@ -27,7 +43,63 @@ aiblueprint claude-code setup
|
|
|
27
43
|
- [Security Features](#security-features)
|
|
28
44
|
- [Development](#development)
|
|
29
45
|
|
|
30
|
-
##
|
|
46
|
+
## 🔌 Plugin Installation
|
|
47
|
+
|
|
48
|
+
### Install from Claude Code Plugin Marketplace
|
|
49
|
+
|
|
50
|
+
The easiest way to get started is by installing AIBlueprint as a Claude Code plugin:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Step 1: Add the AIBlueprint marketplace
|
|
54
|
+
/plugin marketplace add melvynx/aiblueprint
|
|
55
|
+
|
|
56
|
+
# Step 2: Install the aibp-base plugin
|
|
57
|
+
/plugin install aibp-base@AIBlueprint
|
|
58
|
+
|
|
59
|
+
# Alternative: Install directly from GitHub
|
|
60
|
+
/plugin install github:melvynx/aiblueprint
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### What Gets Installed
|
|
64
|
+
|
|
65
|
+
The `aibp-base` plugin includes:
|
|
66
|
+
- ✅ **16 Custom Commands** - `/commit`, `/create-pull-request`, `/deep-code-analysis`, etc.
|
|
67
|
+
- ✅ **3 Specialized Agents** - explore-codebase, Snipper, websearch
|
|
68
|
+
- ✅ **Security Hooks** - Command validation and TypeScript processing
|
|
69
|
+
- ✅ **Custom Statusline** - Git status, cost tracking, and token usage
|
|
70
|
+
- ✅ **Notification Sounds** - Audio alerts for task completion
|
|
71
|
+
|
|
72
|
+
### Plugin Management
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# List installed plugins
|
|
76
|
+
/plugin list
|
|
77
|
+
|
|
78
|
+
# Update plugin to latest version
|
|
79
|
+
/plugin update aibp-base
|
|
80
|
+
|
|
81
|
+
# Remove plugin
|
|
82
|
+
/plugin uninstall aibp-base
|
|
83
|
+
|
|
84
|
+
# View marketplace plugins
|
|
85
|
+
/plugin marketplace list
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Plugin vs CLI Tool
|
|
89
|
+
|
|
90
|
+
**Plugin Installation (Recommended)**:
|
|
91
|
+
- ✅ Automatic updates via marketplace
|
|
92
|
+
- ✅ No CLI tool installation needed
|
|
93
|
+
- ✅ Direct integration with Claude Code
|
|
94
|
+
- ✅ Easy to manage and update
|
|
95
|
+
|
|
96
|
+
**CLI Tool Installation**:
|
|
97
|
+
- ✅ More control over installation
|
|
98
|
+
- ✅ Custom folder locations
|
|
99
|
+
- ✅ Interactive feature selection
|
|
100
|
+
- ✅ Symlink management for other tools
|
|
101
|
+
|
|
102
|
+
## 💾 CLI Installation & Usage
|
|
31
103
|
|
|
32
104
|
### Installation Methods
|
|
33
105
|
|
|
@@ -67,6 +139,7 @@ bunx aiblueprint-cli@latest claude-code setup # Creates .claude/ in project roo
|
|
|
67
139
|
|---------|-------------|---------|
|
|
68
140
|
| `bunx aiblueprint-cli@latest claude-code setup` | Interactive setup with feature selection | `-f, --folder <path>` (alias for --claudeCodeFolder), `--claudeCodeFolder <path>`, `--codexFolder <path>`, `--openCodeFolder <path>`, `--factoryAiFolder <path>`, `-s, --skip` |
|
|
69
141
|
| `bunx aiblueprint-cli@latest claude-code symlink` | Create symlinks between CLI tools (Codex, OpenCode, FactoryAI) | `--claudeCodeFolder <path>`, `--codexFolder <path>`, `--openCodeFolder <path>`, `--factoryAiFolder <path>` |
|
|
142
|
+
| `bunx aiblueprint-cli@latest claude-code statusline` | Setup custom statusline with git status, costs, and token usage | `-f, --folder <path>` |
|
|
70
143
|
| `bunx aiblueprint-cli@latest claude-code add hook <type>` | Install specific hook | `-f, --folder <path>` |
|
|
71
144
|
| `bunx aiblueprint-cli@latest claude-code add commands [name]` | List or install commands | `-f, --folder <path>` |
|
|
72
145
|
|
|
@@ -89,6 +162,10 @@ bunx aiblueprint-cli@latest claude-code add commands deep-code-analysis # Instal
|
|
|
89
162
|
# Create symlinks between CLI tools
|
|
90
163
|
bunx aiblueprint-cli@latest claude-code symlink # Interactive symlink manager
|
|
91
164
|
bunx aiblueprint-cli@latest claude-code symlink --factoryAiFolder ~/.factory # With custom paths
|
|
165
|
+
|
|
166
|
+
# Setup statusline
|
|
167
|
+
bunx aiblueprint-cli@latest claude-code statusline # Quick statusline setup
|
|
168
|
+
bunx aiblueprint-cli@latest claude-code statusline --folder ~/.my-claude # Custom location
|
|
92
169
|
```
|
|
93
170
|
|
|
94
171
|
### Hook Types Available
|
|
@@ -121,6 +198,7 @@ The CLI intelligently determines where to install configurations:
|
|
|
121
198
|
- **Cost tracking** - Session costs, daily limits, and token usage via ccusage
|
|
122
199
|
- **Real-time updates** - Command-triggered statusline refresh
|
|
123
200
|
- **Colored output** - Visual indicators for different status types
|
|
201
|
+
- **Quick setup** - Install with one command: `pnpm dlx aiblueprint-cli claude-code statusline`
|
|
124
202
|
|
|
125
203
|
### 🤖 AIBlueprint Commands (16 Available)
|
|
126
204
|
|
|
@@ -147,12 +225,6 @@ The CLI intelligently determines where to install configurations:
|
|
|
147
225
|
- **Snipper** (blue) - Rapid code modification specialist with minimal output
|
|
148
226
|
- **websearch** (yellow) - Quick web research with authoritative sources
|
|
149
227
|
|
|
150
|
-
### 🎨 Output Styles (3 Personalities)
|
|
151
|
-
|
|
152
|
-
- **Assistant** - Professional "Bob" persona with honest, task-focused communication
|
|
153
|
-
- **senior-dev** - Casual engineering teammate style, direct and conversational
|
|
154
|
-
- **Honest Friend** - WhatsApp-style brutally honest feedback from a successful friend
|
|
155
|
-
|
|
156
228
|
### 🔊 Notification Sounds
|
|
157
229
|
- **Finish sound** - Audio alert for completed operations (macOS afplay)
|
|
158
230
|
- **Need-human sound** - Audio alert for attention requests
|
|
@@ -179,7 +251,7 @@ The CLI automatically manages your `~/.claude/settings.json` with:
|
|
|
179
251
|
{
|
|
180
252
|
"statusLine": {
|
|
181
253
|
"type": "command",
|
|
182
|
-
"command": "
|
|
254
|
+
"command": "bun ~/.claude/scripts/statusline/src/index.ts",
|
|
183
255
|
"padding": 0
|
|
184
256
|
},
|
|
185
257
|
"hooks": {
|
|
@@ -397,7 +469,6 @@ claude-code-config/ # Template repository
|
|
|
397
469
|
├── hooks/ # Hook scripts
|
|
398
470
|
├── agents/ # Agent configurations
|
|
399
471
|
├── scripts/ # Utility scripts
|
|
400
|
-
├── output-styles/ # Style templates
|
|
401
472
|
└── song/ # Notification sounds
|
|
402
473
|
```
|
|
403
474
|
|
|
@@ -454,4 +525,4 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
454
525
|
|
|
455
526
|
**Created by AIBlueprint** - Enhancing Claude Code for modern development workflows.
|
|
456
527
|
|
|
457
|
-
Need help? [Open an issue](https://github.com/
|
|
528
|
+
Need help? [Open an issue](https://github.com/melvynx/aiblueprint/issues) or check our [documentation](https://docs.aiblueprint.dev).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: action
|
|
3
|
+
description: Conditional action executor - performs actions only when specific conditions are met
|
|
4
|
+
color: purple
|
|
5
|
+
model: haiku
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Batch conditional executor. Handle ≤5 tasks. VERIFY INDEPENDENTLY before each action.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **VERIFY each item yourself** (never trust input):
|
|
13
|
+
- **Exports/Types**: Grep for `import.*{name}` in codebase
|
|
14
|
+
- **Files**: Check framework patterns via explore-docs, then Grep for imports
|
|
15
|
+
- **Dependencies**: Grep for `from 'pkg'` or `require('pkg')`
|
|
16
|
+
|
|
17
|
+
2. **Execute ONLY if verified unused**:
|
|
18
|
+
- If used → Skip with reason, continue next
|
|
19
|
+
- If unused → Execute action, confirm success
|
|
20
|
+
|
|
21
|
+
3. **Report**: Count executed, count skipped with reasons
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- **MANDATORY**: Verify each item independently using Grep/explore-docs
|
|
26
|
+
- **Skip if used**: Continue to next task
|
|
27
|
+
- **Max 5 tasks**: Process all in batch
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
"Verify and remove: lodash, axios, moment"
|
|
32
|
+
|
|
33
|
+
1. Grep `lodash` → Found in utils.ts → Skip
|
|
34
|
+
2. Grep `axios` → Not found → `pnpm remove axios` → Done
|
|
35
|
+
3. Grep `moment` → Not found → `pnpm remove moment` → Done
|
|
36
|
+
Report: "Removed 2/3: axios, moment. Skipped: lodash (used in utils.ts)"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: explore-codebase
|
|
3
3
|
description: Use this agent whenever you need to explore the codebase to realize a feature.
|
|
4
4
|
color: yellow
|
|
5
|
-
model:
|
|
5
|
+
model: haiku
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a codebase exploration specialist. Your only job is to find and present ALL relevant code and logic for the requested feature.
|
|
@@ -56,3 +56,8 @@ Related to: [How it connects to the feature]
|
|
|
56
56
|
- External services to research: [list]
|
|
57
57
|
|
|
58
58
|
Focus on discovering and documenting existing code. Be thorough - include everything that might be relevant.
|
|
59
|
+
|
|
60
|
+
## Exa MCP
|
|
61
|
+
|
|
62
|
+
- You can use Exa web search for quick search
|
|
63
|
+
- Avoid using it too much, maximum 2-3 calls and then use WebSearch. Each call cost 0.05$
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: explore-docs
|
|
3
3
|
description: Use this agent IMMEDIATELY when the user asks about library features, implementation methods, "how to do X with Y library", documentation searches, or ANY question about using/implementing specific libraries or frameworks (in any language) - launches Context7 and WebFetch for precise technical information with code examples
|
|
4
4
|
color: yellow
|
|
5
|
-
model:
|
|
5
|
+
model: haiku
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a documentation exploration specialist. Your mission is to retrieve precise, actionable documentation with code examples while eliminating superficial content.
|
|
@@ -14,7 +14,7 @@ You are a git commit automation tool. Create minimal, clean commits for a tidy g
|
|
|
14
14
|
- `feat: [what was added]`
|
|
15
15
|
- `update: [what was modified]`
|
|
16
16
|
- `refactor: [what was reorganized]`
|
|
17
|
-
4. **Push**: `git push`
|
|
17
|
+
4. **Push**: `git push` immediatelyne
|
|
18
18
|
|
|
19
19
|
## Message Rules
|
|
20
20
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Ultra-fast feature implementation - Explore then Code then Test
|
|
3
|
+
argument-hint: <feature-description>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a rapid implementation specialist. Implement features at maximum speed using the OneShot methodology.
|
|
7
|
+
|
|
8
|
+
**You need to always ULTRA THINK.**
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **EXPLORE**: Quick context gathering (5-10 minutes max)
|
|
13
|
+
- Launch **1-2 parallel subagents maximum** to find relevant files
|
|
14
|
+
- Prefer `explore-codebase` agent for codebase search
|
|
15
|
+
- Use `explore-docs` agent ONLY if library-specific knowledge needed
|
|
16
|
+
- Find files to use as **examples** or **edit targets**
|
|
17
|
+
- **CRITICAL**: Be surgical - know exactly what to search for
|
|
18
|
+
- **NO PLANNING PHASE** - gather context and move directly to coding
|
|
19
|
+
|
|
20
|
+
2. **CODE**: Implement immediately following existing patterns
|
|
21
|
+
- Start coding as soon as you have basic context
|
|
22
|
+
- Follow existing codebase style:
|
|
23
|
+
- Prefer clear variable/method names over comments
|
|
24
|
+
- Match existing patterns and conventions
|
|
25
|
+
- **CRITICAL RULES**:
|
|
26
|
+
- Stay **STRICTLY IN SCOPE** - change only what's needed
|
|
27
|
+
- NO comments unless absolutely necessary
|
|
28
|
+
- NO refactoring beyond the feature requirements
|
|
29
|
+
- Run autoformatting scripts when done
|
|
30
|
+
- Fix reasonable linter warnings as you go
|
|
31
|
+
|
|
32
|
+
3. **TEST**: Validate with ESLint and TypeScript
|
|
33
|
+
- **First check package.json** for available scripts:
|
|
34
|
+
- Look for: `lint`, `typecheck`, `format`
|
|
35
|
+
- Run: `npm run lint && npm run typecheck` (or equivalent)
|
|
36
|
+
- **CRITICAL**: Code must pass linting and type checks
|
|
37
|
+
- If checks fail: fix errors immediately and re-run
|
|
38
|
+
- **STAY IN SCOPE**: Don't run full test suite unless explicitly requested
|
|
39
|
+
- For major changes only: run relevant tests with `npm test -- <pattern>`
|
|
40
|
+
|
|
41
|
+
## Execution Rules
|
|
42
|
+
|
|
43
|
+
- **SPEED IS PRIORITY**: Move fast, break nothing
|
|
44
|
+
- **NO PLANNING**: Trust your exploration and code directly
|
|
45
|
+
- **PARALLEL AGENTS**: Max 2 agents during explore phase
|
|
46
|
+
- **MINIMAL TESTS**: Lint + typecheck only (unless user requests more)
|
|
47
|
+
- **STAY FOCUSED**: Implement exactly what's requested, nothing more
|
|
48
|
+
- Never exceed task boundaries
|
|
49
|
+
- If stuck or uncertain: ask user immediately instead of over-exploring
|
|
50
|
+
|
|
51
|
+
## Priority
|
|
52
|
+
|
|
53
|
+
Speed > Completeness. Ship fast, iterate later.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
User: $ARGUMENTS
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Command Validator
|
|
2
|
+
|
|
3
|
+
A secure command validation package for Claude Code's PreToolUse hook. This package validates bash commands before execution to prevent dangerous operations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Comprehensive Security Rules**: Blocks dangerous commands (rm -rf /, dd, mkfs, etc.)
|
|
8
|
+
- **Pattern Matching**: Detects malicious patterns like fork bombs, backdoors, and data exfiltration
|
|
9
|
+
- **Path Protection**: Prevents writes to system directories (/etc, /usr, /bin, etc.)
|
|
10
|
+
- **Command Chaining**: Validates chained commands (&&, ||, ;)
|
|
11
|
+
- **Fully Tested**: 82+ tests with Vitest ensuring reliable validation
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### As a Claude Code Hook
|
|
22
|
+
|
|
23
|
+
The validator is configured as a PreToolUse hook in Claude Code settings:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"hooks": {
|
|
28
|
+
"PreToolUse": [
|
|
29
|
+
{
|
|
30
|
+
"matcher": "Bash",
|
|
31
|
+
"hooks": [
|
|
32
|
+
{
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "bun /Users/melvynx/.claude/scripts/command-validator/src/cli.ts"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Programmatic Usage
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { CommandValidator } from "./src/lib/validator";
|
|
47
|
+
|
|
48
|
+
const validator = new CommandValidator();
|
|
49
|
+
const result = validator.validate("rm -rf /");
|
|
50
|
+
|
|
51
|
+
if (!result.isValid) {
|
|
52
|
+
console.log(`Blocked: ${result.violations.join(", ")}`);
|
|
53
|
+
console.log(`Severity: ${result.severity}`);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Testing
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Run all tests
|
|
61
|
+
bun test
|
|
62
|
+
|
|
63
|
+
# Run tests with UI
|
|
64
|
+
bun test:ui
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Test Coverage
|
|
68
|
+
|
|
69
|
+
The test suite includes:
|
|
70
|
+
|
|
71
|
+
### Safe Commands (Must Allow)
|
|
72
|
+
- Standard utilities: ls, git, npm, pnpm, node, python
|
|
73
|
+
- File operations: cat, cp, mv, mkdir, touch
|
|
74
|
+
- Safe command chains with &&
|
|
75
|
+
|
|
76
|
+
### Dangerous Commands (Must Block)
|
|
77
|
+
- System destruction: rm -rf /, dd, mkfs, fdisk
|
|
78
|
+
- Privilege escalation: sudo, chmod, chown, passwd
|
|
79
|
+
- Network attacks: nc, nmap, telnet
|
|
80
|
+
- Malicious patterns: fork bombs, backdoors, log manipulation
|
|
81
|
+
- Sensitive file access: /etc/passwd, /etc/shadow, /etc/sudoers
|
|
82
|
+
|
|
83
|
+
### Special Cases
|
|
84
|
+
- rm -rf safety: Allows deletions in safe paths (/Users/melvynx/Developer/, /tmp/)
|
|
85
|
+
- Protected paths: Blocks dangerous operations on /etc, /usr, /bin, etc.
|
|
86
|
+
- Binary content detection
|
|
87
|
+
- Command length limits
|
|
88
|
+
|
|
89
|
+
## Architecture
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
src/
|
|
93
|
+
├── cli.ts # CLI entry point (used by Claude Code hook)
|
|
94
|
+
├── lib/
|
|
95
|
+
│ ├── types.ts # TypeScript interfaces
|
|
96
|
+
│ ├── security-rules.ts # Security rules database
|
|
97
|
+
│ └── validator.ts # Core validation logic
|
|
98
|
+
└── __tests__/
|
|
99
|
+
└── validator.test.ts # Comprehensive test suite
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Security Rules
|
|
103
|
+
|
|
104
|
+
### Critical Commands
|
|
105
|
+
- `del`, `format`, `mkfs`, `shred`, `dd`, `fdisk`, `parted`
|
|
106
|
+
|
|
107
|
+
### Privilege Escalation
|
|
108
|
+
- `sudo`, `su`, `passwd`, `chpasswd`, `usermod`, `chmod`, `chown`
|
|
109
|
+
|
|
110
|
+
### Network Commands
|
|
111
|
+
- `nc`, `netcat`, `nmap`, `telnet`, `ssh-keygen`, `iptables`
|
|
112
|
+
|
|
113
|
+
### System Manipulation
|
|
114
|
+
- `systemctl`, `service`, `kill`, `killall`, `mount`, `umount`
|
|
115
|
+
|
|
116
|
+
### Protected Paths
|
|
117
|
+
- `/etc/`, `/usr/`, `/sbin/`, `/boot/`, `/sys/`, `/proc/`, `/dev/`, `/root/`
|
|
118
|
+
|
|
119
|
+
## Security Logs
|
|
120
|
+
|
|
121
|
+
Security events are logged to `data/security.log` inside the package directory. The log file contains:
|
|
122
|
+
- Timestamp
|
|
123
|
+
- Session ID
|
|
124
|
+
- Tool name
|
|
125
|
+
- Command (truncated to 500 chars)
|
|
126
|
+
- Blocked/allowed status
|
|
127
|
+
- Severity level
|
|
128
|
+
- Violations detected
|
|
129
|
+
|
|
130
|
+
The `data/` folder is gitignored to prevent committing sensitive log data.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Run linter
|
|
136
|
+
bun run lint
|
|
137
|
+
|
|
138
|
+
# Format code
|
|
139
|
+
bun run format
|
|
140
|
+
|
|
141
|
+
# Type check
|
|
142
|
+
bunx tsc --noEmit
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab"
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true,
|
|
19
|
+
"suspicious": {
|
|
20
|
+
"noControlCharactersInRegex": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"javascript": {
|
|
25
|
+
"formatter": {
|
|
26
|
+
"quoteStyle": "double"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
Binary file
|