@makeitvisible/cli 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-01-24
11
+
12
+ ### Added
13
+
14
+ - Initial release of `@visible/cli`
15
+ - `visible analyze diff` command for git diff analysis
16
+ - `visible analyze pr` command for pull request analysis
17
+ - `visible analyze prompt` command for AI-powered codebase exploration
18
+ - "The Detective" AI agent for intelligent code navigation
19
+ - Artifact generation with structured output
20
+ - Support for posting artifacts to Visible API
21
+ - Programmatic API for library usage
22
+
23
+ ### Features
24
+
25
+ - Git diff analysis with automatic breaking change detection
26
+ - Pull request analysis with GitHub CLI integration
27
+ - AI-powered codebase exploration using OpenAI
28
+ - Structured artifact output with entry points, data flow, and key files
29
+ - Verbose mode for debugging agent behavior
30
+ - `--no-post` flag for local-only analysis
31
+
32
+ [Unreleased]: https://github.com/your-org/visible/compare/v0.1.0...HEAD
33
+ [0.1.0]: https://github.com/your-org/visible/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Visible Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ # @visible/cli
2
+
3
+ Transform technical changes into audience-friendly communication materials.
4
+
5
+ The Visible CLI helps technical teams analyze code, PRs, and repositories to generate artifacts that can be used for documentation, release notes, tutorials, and more.
6
+
7
+ ## Features
8
+
9
+ - **Git Diff Analysis**: Analyze git diffs between commits to extract context and generate artifacts
10
+ - **Pull Request Analysis**: Analyze GitHub PRs with automatic context extraction
11
+ - **AI-Powered Code Exploration**: Use "The Detective" agent to intelligently explore and understand codebases
12
+ - **Artifact Generation**: Create structured artifacts ready for documentation generation
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ # Install globally from npm
18
+ npm install -g @visible/cli
19
+
20
+ # Or use npx to run without installing
21
+ npx @visible/cli --help
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ # Get help
28
+ visible --help
29
+
30
+ # Analyze the latest commit
31
+ visible analyze diff
32
+
33
+ # Analyze a specific commit range
34
+ visible analyze diff HEAD~5..HEAD
35
+
36
+ # Analyze a pull request
37
+ visible analyze pr --url https://github.com/owner/repo/pull/123
38
+
39
+ # Explore a codebase with AI
40
+ visible analyze prompt "how does user authentication work"
41
+ ```
42
+
43
+ ## Configuration
44
+
45
+ The CLI requires the following environment variables:
46
+
47
+ ```bash
48
+ # Required for AI-powered code exploration (analyze prompt)
49
+ export OPENAI_API_KEY=sk-your-openai-api-key
50
+
51
+ # Required for posting artifacts to Visible API
52
+ export VISIBLE_API_BASE_URL=https://your-visible-instance.com
53
+ export VISIBLE_API_KEY=your-api-key
54
+
55
+ # Optional: For PR analysis via GitHub API
56
+ export GITHUB_TOKEN=ghp-your-github-token
57
+ ```
58
+
59
+ You can set these in your shell profile (`.bashrc`, `.zshrc`, etc.) or use a `.env` file with a tool like [direnv](https://direnv.net/).
60
+
61
+ ## Commands
62
+
63
+ ### `visible analyze diff [range]`
64
+
65
+ Analyze git diff between commits to create an artifact.
66
+
67
+ ```bash
68
+ # Analyze the latest commit
69
+ visible analyze diff
70
+
71
+ # Analyze a specific range
72
+ visible analyze diff HEAD~5..HEAD
73
+
74
+ # Skip posting to API (just preview the artifact)
75
+ visible analyze diff --no-post
76
+ ```
77
+
78
+ **Options:**
79
+ - `[range]` - Git commit range (default: `HEAD~1..HEAD`)
80
+ - `--no-post` - Skip posting artifact to Visible API
81
+
82
+ ### `visible analyze pr`
83
+
84
+ Analyze a pull request to create an artifact.
85
+
86
+ ```bash
87
+ # Analyze by PR URL
88
+ visible analyze pr --url https://github.com/owner/repo/pull/123
89
+
90
+ # Analyze by PR number (uses current repo)
91
+ visible analyze pr --number 123
92
+
93
+ # Skip posting to API
94
+ visible analyze pr --url https://github.com/owner/repo/pull/123 --no-post
95
+ ```
96
+
97
+ **Options:**
98
+ - `--url <url>` - Pull request URL
99
+ - `--number <number>` - Pull request number (uses current repo)
100
+ - `--no-post` - Skip posting artifact to Visible API
101
+
102
+ ### `visible analyze prompt "<query>"`
103
+
104
+ Explore your codebase with an AI agent (The Detective) that intelligently navigates files, follows imports, and understands code relationships.
105
+
106
+ ```bash
107
+ # Explore a feature
108
+ visible analyze prompt "how does user authentication work"
109
+
110
+ # Understand a specific flow
111
+ visible analyze prompt "explain the payment processing flow"
112
+
113
+ # Document an API endpoint
114
+ visible analyze prompt "describe the /api/users endpoint"
115
+
116
+ # Verbose mode to see agent's reasoning
117
+ visible analyze prompt "payment processing flow" --verbose
118
+
119
+ # Skip posting to API
120
+ visible analyze prompt "explain the search feature" --no-post
121
+ ```
122
+
123
+ **Options:**
124
+ - `<query>` - Natural language prompt describing what to analyze
125
+ - `-v, --verbose` - Show detailed agent activity
126
+ - `--no-post` - Skip posting artifact to Visible API
127
+
128
+ **How The Detective Agent works:**
129
+
130
+ 1. Searches for files related to your query
131
+ 2. Reads relevant files and follows imports
132
+ 3. Finds where components/functions are used (entry points)
133
+ 4. Traces data flow through the codebase
134
+ 5. Identifies key data structures and schemas
135
+ 6. Produces a structured artifact with:
136
+ - Entry points (how the feature is triggered)
137
+ - Data flow (step-by-step explanation)
138
+ - Key files and their purposes
139
+ - Data structures involved
140
+ - Usage examples from the codebase
141
+
142
+ ## Example Workflow
143
+
144
+ ```bash
145
+ # 1. Navigate to your project
146
+ cd your-project
147
+
148
+ # 2. Set up environment
149
+ export OPENAI_API_KEY=sk-xxx
150
+ export VISIBLE_API_BASE_URL=http://localhost:3000
151
+ export VISIBLE_API_KEY=my-key
152
+
153
+ # 3. Explore a feature and create an artifact
154
+ visible analyze prompt "how do users create new projects"
155
+
156
+ # 4. The CLI will output:
157
+ # - Investigation results (entry points, data flow, key files)
158
+ # - Post the artifact to the Visible API
159
+ # - Return a URL to continue in the dashboard
160
+ ```
161
+
162
+ ## Artifact Output
163
+
164
+ All commands generate artifacts with the following structure:
165
+
166
+ ```typescript
167
+ interface Artifact {
168
+ title: string;
169
+ description: string;
170
+ source: {
171
+ type: "pr" | "commit" | "code-section" | "repository";
172
+ reference: string;
173
+ url?: string;
174
+ };
175
+ context: {
176
+ summary: string;
177
+ technicalDetails: string[];
178
+ affectedComponents: string[];
179
+ breakingChanges: boolean;
180
+ keywords: string[];
181
+ };
182
+ guidelines: string[];
183
+ }
184
+ ```
185
+
186
+ ## Programmatic Usage
187
+
188
+ You can also use the CLI as a library:
189
+
190
+ ```typescript
191
+ import { analyzeDiff, analyzePR, investigateFeature } from "@visible/cli";
192
+
193
+ // Analyze a git diff
194
+ const diffResult = await analyzeDiff("HEAD~1..HEAD");
195
+
196
+ // Analyze a PR
197
+ const prResult = await analyzePR({ url: "https://github.com/org/repo/pull/123" });
198
+
199
+ // Investigate a feature
200
+ const investigation = await investigateFeature("how does authentication work", {
201
+ verbose: true,
202
+ onToolCall: (name, args) => console.log(`Tool: ${name}`),
203
+ });
204
+ ```
205
+
206
+ ## Requirements
207
+
208
+ - Node.js >= 20
209
+ - Git (for diff/PR analysis)
210
+ - OpenAI API key (for AI-powered exploration)
211
+ - GitHub CLI (`gh`) for PR analysis (optional but recommended)
212
+
213
+ ## Troubleshooting
214
+
215
+ ### "Missing OPENAI_API_KEY"
216
+
217
+ Set the `OPENAI_API_KEY` environment variable with your OpenAI API key.
218
+
219
+ ### "Not in a git repository"
220
+
221
+ Make sure you're running the CLI from within a git repository.
222
+
223
+ ### PR analysis fails
224
+
225
+ Ensure you have the GitHub CLI (`gh`) installed and authenticated:
226
+ ```bash
227
+ gh auth login
228
+ ```
229
+
230
+ ## License
231
+
232
+ MIT
233
+
234
+ ## Contributing
235
+
236
+ See the main [Visible repository](https://github.com/your-org/visible) for contribution guidelines.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node