@claudemini/shit-cli 1.4.0 → 1.6.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.
@@ -1,138 +0,0 @@
1
- # shit-cli Design Philosophy
2
-
3
- ## Core Vision
4
-
5
- ### 1. Human-AI Interaction Memory System
6
- Long-term memory storage for human-AI interactions, not just temporary logs. Each session is analyzed for semantic meaning — what was the intent, what changed, what's the risk.
7
-
8
- ### 2. Code Review Bot Data Support
9
- Provide reliable, structured data to support code review automation. The bot doesn't need to parse raw events — it gets pre-classified changes, risk assessments, and review hints.
10
-
11
- ## Architecture
12
-
13
- ```
14
- Human ↔ AI (Claude Code)
15
- ↓ (hooks)
16
- Event Ingestion (log.js)
17
-
18
- Semantic Extraction (extract.js)
19
-
20
- Session State (session.js) + Reports (report.js)
21
-
22
- Memory System (.shit-logs + index.json)
23
-
24
- Code Review Bot / Human Queries
25
- ```
26
-
27
- ### Three-Layer Architecture
28
-
29
- 1. **Ingestion Layer** — `log.js` reads stdin, parses events, dispatches
30
- 2. **Intelligence Layer** — `extract.js` classifies intent, changes, risk
31
- 3. **Storage Layer** — `session.js` manages state, `report.js` generates outputs
32
-
33
- ## Semantic Model
34
-
35
- ### Intent Extraction
36
- From user prompts, extract:
37
- - **Goal**: What the user is trying to accomplish
38
- - **Type**: bugfix, feature, refactor, debug, test, docs, etc.
39
- - **Scope**: Which domains are involved (auth, api, database, etc.)
40
-
41
- ### Change Extraction
42
- From tool events, extract:
43
- - **Files**: Categorized (source, test, config, doc, script, infra, deps, migration)
44
- - **Operations**: What was done to each file (read, write, edit)
45
- - **Commands**: Categorized (test, build, git, deploy, install, lint, database)
46
-
47
- ### Session Classification
48
- Combining intent + changes:
49
- - **Type**: Dominant activity category
50
- - **Risk**: Assessment based on file count, config changes, test coverage
51
- - **Review Hints**: Actionable flags for code review bots
52
-
53
- ## File Structure
54
-
55
- ```
56
- .shit-logs/
57
- ├── index.json # Cross-session index (file history, session types)
58
- └── <session-id>/
59
- ├── events.jsonl # Raw hook events (complete history)
60
- ├── state.json # Incremental processing state
61
- ├── summary.json # Bot data interface (v2 schema)
62
- ├── summary.txt # Human-readable semantic report
63
- ├── prompts.txt # User prompts with timestamps
64
- └── metadata.json # Lightweight session metadata
65
- ```
66
-
67
- ## Key Design Decisions
68
-
69
- ### 1. Rule-Based Classification (No AI Dependency)
70
- Intent and change classification use simple pattern matching rules. This ensures:
71
- - Zero latency — runs during hook processing
72
- - Zero cost — no API calls
73
- - Predictable — deterministic output
74
- - Offline — works without network
75
-
76
- ### 2. Cross-Session Index
77
- The `index.json` file enables:
78
- - File history queries ("how often was this file changed?")
79
- - Session type filtering ("show all bugfix sessions")
80
- - Risk tracking over time
81
- - Bot can query without scanning all sessions
82
-
83
- ### 3. summary.json v2 Schema
84
- Upgraded from v1 (statistics-only) to v2 (semantic):
85
- - **v1**: event counts, file lists, tool usage
86
- - **v2**: intent, type, risk, review_hints, categorized changes/commands
87
-
88
- ### 4. Incremental Processing
89
- State is maintained incrementally in `state.json`. Each event updates the state, and reports are regenerated from the latest state. This means:
90
- - Fast processing per event (~5ms)
91
- - Reports always reflect current session state
92
- - No need to re-read events.jsonl
93
-
94
- ### 5. Best-Effort Shadow Branches
95
- Git shadow branches and index updates are best-effort — failures don't affect core logging. This ensures hooks never block Claude Code.
96
-
97
- ## Bot Integration Patterns
98
-
99
- ### Direct File Read
100
- ```javascript
101
- const summary = JSON.parse(fs.readFileSync('.shit-logs/<id>/summary.json'));
102
- // Use summary.review_hints for automated review decisions
103
- ```
104
-
105
- ### Cross-Session Query
106
- ```javascript
107
- const index = JSON.parse(fs.readFileSync('.shit-logs/index.json'));
108
- // Find all sessions that touched a specific file
109
- const sessions = index.file_history['src/auth/service.ts'];
110
- // Filter by type or risk
111
- const risky = index.sessions.filter(s => s.risk === 'high');
112
- ```
113
-
114
- ### CLI Query (for humans)
115
- ```bash
116
- shit query --file=src/auth/service.ts # File history
117
- shit query --type=bugfix --recent=5 # Recent bugfixes
118
- shit query --risk=high --json # High-risk as JSON
119
- ```
120
-
121
- ## Comparison with `.entire`
122
-
123
- | Aspect | `.entire` | `.shit-logs` |
124
- |--------|-----------|--------------|
125
- | **Data Source** | Full transcript | Hook events |
126
- | **Intelligence** | Raw messages | Semantic extraction |
127
- | **Bot Interface** | Parse messages | Structured JSON (v2) |
128
- | **Cross-Session** | No | Index with file history |
129
- | **Review Hints** | No | Tests, risk, coverage |
130
- | **Purpose** | Conversation memory | Operation intelligence |
131
-
132
- ## Future Enhancements
133
-
134
- - AI-powered intent extraction (optional, when available)
135
- - Diff-level change tracking (what exactly changed in each edit)
136
- - Session linking (detect related sessions across time)
137
- - Anomaly detection (unusual patterns in session activity)
138
- - Bot API endpoint (serve session data over HTTP)
package/QUICKSTART.md DELETED
@@ -1,109 +0,0 @@
1
- # Quick Start Guide
2
-
3
- ## Installation
4
-
5
- ```bash
6
- # Clone or download shit-cli
7
- cd ~/Desktop/shit-cli
8
-
9
- # Install globally
10
- npm link
11
-
12
- # Or add to PATH
13
- echo 'export PATH="$HOME/Desktop/shit-cli/bin:$PATH"' >> ~/.zshrc
14
- source ~/.zshrc
15
- ```
16
-
17
- ## Setup (One-time)
18
-
19
- ```bash
20
- # Navigate to your project
21
- cd /path/to/your/project
22
-
23
- # Initialize hooks
24
- shit init
25
- ```
26
-
27
- This creates `.claude/settings.json` with all necessary hooks.
28
-
29
- ## Verify Installation
30
-
31
- ```bash
32
- # Check if shit is available
33
- shit help
34
-
35
- # Should output:
36
- # shit-cli - Session-based Hook Intelligence Tracker
37
- # Usage: shit <command> [options]
38
- # ...
39
- ```
40
-
41
- ## Usage
42
-
43
- Once initialized, hooks will automatically log events to `~/.shit-logs/`.
44
-
45
- ### View your sessions
46
-
47
- ```bash
48
- # List all sessions
49
- shit list
50
-
51
- # View specific session
52
- shit view <session-id>
53
- ```
54
-
55
- ### Clean up old logs
56
-
57
- ```bash
58
- # Preview what will be deleted
59
- shit clean --days=7 --dry-run
60
-
61
- # Actually delete
62
- shit clean --days=7
63
- ```
64
-
65
- ## Troubleshooting
66
-
67
- ### Command not found: shit
68
-
69
- If `npm link` doesn't work, use the full path:
70
-
71
- ```bash
72
- node ~/Desktop/shit-cli/bin/shit.js init
73
- ```
74
-
75
- Or create an alias:
76
-
77
- ```bash
78
- echo 'alias shit="node ~/Desktop/shit-cli/bin/shit.js"' >> ~/.zshrc
79
- source ~/.zshrc
80
- ```
81
-
82
- ### Hooks not working
83
-
84
- 1. Check if `.claude/settings.json` exists in your project
85
- 2. Verify hooks are registered: `cat .claude/settings.json`
86
- 3. Restart Claude Code
87
-
88
- ### Logs not appearing
89
-
90
- 1. Check log directory: `ls -la ~/.shit-logs/`
91
- 2. Verify hooks are being triggered (check Claude Code output)
92
- 3. Test manually:
93
- ```bash
94
- echo '{"session_id":"test-123","hook_event_name":"Test"}' | shit log test
95
- shit list
96
- ```
97
-
98
- ## Uninstall
99
-
100
- ```bash
101
- # Remove global link
102
- npm unlink -g shit-cli
103
-
104
- # Remove logs
105
- rm -rf ~/.shit-logs
106
-
107
- # Remove hooks from project
108
- # Edit .claude/settings.json and remove shit-related hooks
109
- ```