aiblueprint-cli 1.1.8 → 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.
Files changed (40) hide show
  1. package/claude-code-config/scripts/command-validator/README.md +147 -0
  2. package/claude-code-config/scripts/command-validator/biome.json +29 -0
  3. package/claude-code-config/scripts/command-validator/bun.lockb +0 -0
  4. package/claude-code-config/scripts/command-validator/dist/cli.js +544 -0
  5. package/claude-code-config/scripts/command-validator/package.json +27 -0
  6. package/claude-code-config/scripts/command-validator/src/__tests__/validator.test.ts +148 -0
  7. package/claude-code-config/scripts/command-validator/src/cli.ts +118 -0
  8. package/claude-code-config/scripts/command-validator/src/lib/security-rules.ts +172 -0
  9. package/claude-code-config/scripts/command-validator/src/lib/types.ts +33 -0
  10. package/claude-code-config/scripts/command-validator/src/lib/validator.ts +360 -0
  11. package/claude-code-config/scripts/command-validator/vitest.config.ts +7 -0
  12. package/claude-code-config/scripts/statusline/package.json +1 -3
  13. package/claude-code-config/scripts/statusline/src/index.ts +5 -107
  14. package/claude-code-config/scripts/statusline/src/lib/context.ts +66 -87
  15. package/claude-code-config/scripts/statusline/src/lib/formatters.ts +16 -186
  16. package/claude-code-config/scripts/statusline/statusline.config.ts +4 -101
  17. package/dist/cli.js +938 -12
  18. package/package.json +1 -1
  19. package/claude-code-config/agents/fix-grammar.md +0 -49
  20. package/claude-code-config/agents/snipper.md +0 -36
  21. package/claude-code-config/commands/claude-memory.md +0 -190
  22. package/claude-code-config/commands/cleanup-context.md +0 -82
  23. package/claude-code-config/commands/debug.md +0 -91
  24. package/claude-code-config/commands/deep-code-analysis.md +0 -87
  25. package/claude-code-config/commands/epct/code.md +0 -171
  26. package/claude-code-config/commands/epct/deploy.md +0 -116
  27. package/claude-code-config/commands/epct/explore.md +0 -97
  28. package/claude-code-config/commands/epct/plan.md +0 -132
  29. package/claude-code-config/commands/epct/tasks.md +0 -206
  30. package/claude-code-config/commands/explain-architecture.md +0 -113
  31. package/claude-code-config/commands/melvynx-plugin.md +0 -1
  32. package/claude-code-config/commands/prompt-agent.md +0 -126
  33. package/claude-code-config/commands/prompt-command.md +0 -225
  34. package/claude-code-config/scripts/statusline/data/.gitignore +0 -5
  35. package/claude-code-config/scripts/statusline/src/commands/CLAUDE.md +0 -3
  36. package/claude-code-config/scripts/statusline/src/commands/spend-month.ts +0 -60
  37. package/claude-code-config/scripts/statusline/src/commands/spend-today.ts +0 -42
  38. package/claude-code-config/scripts/statusline/src/lib/git.ts +0 -100
  39. package/claude-code-config/scripts/statusline/src/lib/spend.ts +0 -119
  40. package/claude-code-config/scripts/statusline/src/lib/usage-limits.ts +0 -147
@@ -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
+ }