Skip to content

Commit eb03b34

Browse files
committed
Initial commit
0 parents  commit eb03b34

File tree

9 files changed

+1664
-0
lines changed

9 files changed

+1664
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# OpenAI API Configuration
2+
# Get your API key from https://platform.openai.com/api-keys
3+
OPENAI_API_KEY=your-api-key-here
4+
5+
# Optional: Specify default model (defaults to gpt-5-mini)
6+
# OPENAI_MODEL=gpt-5-mini

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
config.json
3+
.DS_Store
4+
*.log
5+
.env
6+
dist/
7+
build/
8+
.claude/settings.local.json

.npmignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Development and configuration files
2+
.env
3+
.env.example
4+
.gitignore
5+
.git/
6+
.claude/
7+
*.log
8+
9+
# Test files
10+
test/
11+
tests/
12+
*.test.js
13+
*.spec.js
14+
15+
# Documentation source files (README.md is included by default)
16+
docs/
17+
PUBLISHING.md
18+
19+
# Build and temp files
20+
dist/
21+
build/
22+
*.swp
23+
.DS_Store
24+
node_modules/
25+
26+
# IDE files
27+
.vscode/
28+
.idea/
29+
*.sublime-*
30+
31+
# CI/CD
32+
.github/
33+
.gitlab-ci.yml
34+
.travis.yml
35+
36+
# Other
37+
npm-debug.log*
38+
yarn-debug.log*
39+
yarn-error.log*

README.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Vibe Spec
2+
3+
A command-line tool for generating specifications based on Claude Code session logs.
4+
5+
## Problem Statement
6+
7+
Coding with an AI assistant is an iterative process: you describe what you want, report issues, request changes, and so on. As a result, the description of what the application should do is split onto multiple messages exchanged between you and the assistant.
8+
9+
For example, the following conversation log snippet shows how a user incrementally refines the requirements for a 3D sculpting application:
10+
11+
```
12+
[14:06] It works. But I want to modify the mouse interactions. Left click should add matter, and middle click should be used to move the camera
13+
14+
[14:08] Now, I want the "add matter" action to be more realistic. For that, you'll have to consider that clicking on an object is like adding more patter to the surface of the object, updating its geometry instead of rendering another sphere. I really want a sculpting tool.
15+
16+
[14:11] I want that when I keep the left mouse button down, it keeps adding more matter
17+
18+
[14:14] Now I want a toolbar that lets me add primitive shapes (sphere, cube, cylinder, etc) as well as selecting the "add matter" tool. The app should start with an empty scene. The user can add a.g. a sphere, then select the "add matter" tool, and start sculpting that sphere.
19+
20+
[14:19] the sculpt tool no longer works on the objects I've added
21+
22+
[14:20] No, it still doesn't work, clicking on a sphere I just added doesn't deform it
23+
24+
[14:36] When adding matter, the existing vertices grow, and after some time the sculpting tool doesn't work because I'm modifying large triangles, i.e. planes without inner mesh. I think we should fix this by adding a dynamic mesh subdivision system: when the user clicks on a mesh to sculpt it, if the geometry of that spot isn't fine enough, subdivide it to let the user add more details.
25+
26+
[15:20] there seems to be a problem with the subdivision and with the sculpt tool. Let me explain the problem. First, when I use the sculpt tool, the mesh sometimes shows holes. This means the subdivision creates an incorrect geometry, and some divided triangles are along non-divided triangles. Second, the sculpt button doesn't seem to alter the existing mesh in the right way. It should move vertices in the direction of the average normal of all the triangles in the location of the tool. By the way, I'd like a preview of the sculpt tool size, that shows the affected region.
27+
28+
```
29+
30+
The assistant managed to implement the requested features (source code [marmelab/sculpt-3D](https://github.com/marmelab/sculpt-3D)):
31+
32+
https://github.com/user-attachments/assets/3f3c7f82-a05a-400a-be55-bfd3fc1ea78a
33+
34+
However, this process has a significant drawback: there is no single source of truth that describes what the application does, making it hard to understand the full scope of the project later on.
35+
36+
This tool addresses that problem by parsing the conversation logs and reconstructing a clear, structured view of the application's functionality.
37+
38+
For example:
39+
40+
> ### Sculpt Tools
41+
>
42+
> Sculpt tools provide clay-like deformation capabilities with three primary operations: Add, Subtract, and Push.
43+
>
44+
> Users can select these tools from the toolbar to modify the selected object interactively. With a sculpt tool active and an object selected, moving over the mesh reveals a circular brush preview indicating the affected area. Pressing and holding the pointer down on the mesh begins operation, raycasting to determine hit position and triangle. Add/Subtract displace vertices along an averaged local normal; Push displaces in world-space drag direction. Brush parameters include Brush Size Strength. Users can adjust these via keyboard shortcuts (+/- for size, Shift+ +/- for strength) or UI controls.
45+
>
46+
> Business/validation rules:
47+
> - Sculpting must be continuous and localized;
48+
> - Sculpting operations automatically subdivide the mesh for detail;
49+
> - Affected vertices are limited to brush radius and adjacency rings;
50+
> - Per-frame displacement is clamped to prevent inverted normals or self-intersection;
51+
> - Symmetry options allow mirroring across X, Y, Z axes.
52+
> - Sculpt tools don't cause tearing or mesh artifacts.
53+
>
54+
> Mobile UI adjustments: An optional modal dialog provides compact controls for brushSize, brushStrength and symmetry toggles. This dialog is optional and defaults to collapsed on tool selection to keep the canvas clear.
55+
56+
## Installation
57+
58+
```bash
59+
# Install globally
60+
npm install -g vibe-spec
61+
62+
# Or with yarn
63+
yarn global add vibe-spec
64+
```
65+
66+
To use the specification generation feature, you need an OpenAI API key:
67+
68+
1. Get an API key from [OpenAI Platform](https://platform.openai.com/api-keys)
69+
70+
2. Set up your API key using one of these methods:
71+
72+
**Option A: Environment Variable (Recommended)**
73+
```bash
74+
export OPENAI_API_KEY=your-api-key-here
75+
```
76+
77+
**Option B: .env file in your project directory**
78+
79+
Create a `.env` file in your current working directory (where you run `vibe-spec`):
80+
```bash
81+
echo "OPENAI_API_KEY=your-api-key-here" > .env
82+
```
83+
84+
## Usage
85+
86+
```bash
87+
# List all available projects
88+
vibe-spec list
89+
90+
# Show statistics for the current directory (when in a project directory)
91+
vibe-spec stats
92+
93+
# Parse logs for the current directory (when in a project directory)
94+
vibe-spec logs
95+
96+
# Generate specification for the current directory (when in a project directory)
97+
vibe-spec spec
98+
99+
# You can also specify a project name directly:
100+
vibe-spec logs project-name
101+
vibe-spec stats project-name
102+
vibe-spec spec project-name
103+
```
104+
105+
## Log Parsing Options
106+
107+
```bash
108+
# Export messages to a JSON file
109+
vibe-spec logs --export conversation.json
110+
111+
# Show only user messages (hide assistant responses)
112+
vibe-spec logs --no-assistant
113+
114+
# Include tool usage indicators in assistant messages (hidden by default)
115+
vibe-spec logs --include-tools
116+
117+
# Include command executions and outputs (hidden by default)
118+
vibe-spec logs --include-commands
119+
120+
# Search for specific keywords in messages
121+
vibe-spec logs --search "component"
122+
123+
# Limit the number of messages displayed
124+
vibe-spec logs --limit 10
125+
126+
# Hide timestamps
127+
vibe-spec logs --no-timestamp
128+
129+
# Show session IDs
130+
vibe-spec logs --show-session
131+
132+
# Show message UUIDs
133+
vibe-spec logs --show-uuid
134+
135+
# Show original raw content for commands
136+
vibe-spec logs --include-commands --show-original
137+
```
138+
139+
## Specification Generation Options
140+
141+
```bash
142+
# Generate spec to terminal
143+
vibe-spec spec
144+
145+
# Save specification to a file
146+
vibe-spec spec -o spec.md
147+
148+
# Update an existing specification (append new findings)
149+
vibe-spec spec -o spec.md --update
150+
151+
# Use a specific OpenAI model (default: gpt-5-mini)
152+
vibe-spec spec --model gpt-5
153+
154+
# Adjust chunk size for processing (default: 50 messages)
155+
vibe-spec spec --chunk-size 100
156+
157+
# Include tool usage in the analysis
158+
vibe-spec spec --include-tools
159+
```
160+
161+
## How It Works
162+
163+
The tool:
164+
1. Reads JSONL files from `~/.claude/projects/`
165+
2. Parses both user and assistant messages
166+
3. Filters out tool results and metadata by default
167+
4. Presents conversations in chronological order
168+
5. Provides various formatting and export options
169+
170+
## Requirements
171+
172+
- Node.js >= 14.0.0
173+
- npm or yarn
174+
- Access to `~/.claude/projects/` directory
175+
- OpenAI API key (for specification generation)
176+
177+
## Next Steps
178+
179+
- Support other coding AI platforms (e.g., GitHub Copilot, Gemini CLI, etc.)
180+
- Add an MCP server to trigger spec update via commands (e.g. `update specs`)
181+
182+
## License
183+
184+
MIT

0 commit comments

Comments
 (0)