@code-insights/cli 1.0.0 → 1.0.2

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 (2) hide show
  1. package/README.md +11 -125
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,20 +7,15 @@ Full documentation: [docs.code-insights.app](https://docs.code-insights.app)
7
7
  ## Prerequisites
8
8
 
9
9
  - **Node.js** 18 or later
10
- - **pnpm** >= 9 (`npm install -g pnpm` if needed)
11
- - A **Firebase project** with Firestore enabled (see [Quick Start](../README.md#quick-start))
10
+ - A **Firebase project** with Firestore enabled (see [Quick Start](https://docs.code-insights.app/getting-started/quick-start/))
12
11
 
13
12
  ## Installation
14
13
 
15
14
  ```bash
16
- # From the repo root
17
- cd cli
18
- pnpm install
19
- pnpm build
20
- npm link # Makes `code-insights` available globally
15
+ npm install -g @code-insights/cli
21
16
  ```
22
17
 
23
- After linking, verify it works:
18
+ Verify it works:
24
19
 
25
20
  ```bash
26
21
  code-insights --version
@@ -33,18 +28,18 @@ code-insights --version
33
28
  Configure Code Insights with your Firebase credentials.
34
29
 
35
30
  ```bash
36
- # Quick setup — import directly from JSON files (recommended)
31
+ # Quick setup — import directly from files (recommended)
37
32
  code-insights init \
38
33
  --from-json ~/Downloads/serviceAccountKey.json \
39
- --web-config ~/Downloads/firebase-web-config.json
34
+ --web-config ~/Downloads/firebase-web-config.js
40
35
 
41
36
  # Interactive setup — prompts for each value
42
37
  code-insights init
43
38
  ```
44
39
 
45
40
  **Flags:**
46
- - `--from-json <path>` — Path to the Firebase service account JSON (downloaded from Firebase Console > Project Settings > Service Accounts)
47
- - `--web-config <path>` — Path to the Firebase web SDK config JSON (saved from Firebase Console > Project Settings > General > Your Apps)
41
+ - `--from-json <path>` — Path to the Firebase service account key (downloaded from Firebase Console > Project Settings > Service Accounts)
42
+ - `--web-config <path>` — Path to the Firebase web SDK config (saved from Firebase Console > Project Settings > General > Your Apps). Accepts both JSON and the JavaScript snippet from Firebase.
48
43
 
49
44
  You can use one flag, both, or neither. Any values not provided via flags will be collected interactively.
50
45
 
@@ -169,119 +164,10 @@ Sessions are automatically titled based on:
169
164
  3. Session character detection (deep focus, bug hunt, etc.)
170
165
  4. Fallback to timestamp
171
166
 
172
- ## Project Structure
167
+ ## Contributing
173
168
 
174
- ```
175
- cli/
176
- ├── src/
177
- │ ├── commands/
178
- │ │ ├── init.ts # Interactive Firebase configuration
179
- │ │ ├── sync.ts # Main sync logic
180
- │ │ ├── connect.ts # Generate dashboard connection URL
181
- │ │ ├── status.ts # Status display
182
- │ │ ├── reset.ts # Clear all data
183
- │ │ └── install-hook.ts # Hook management
184
- │ ├── firebase/
185
- │ │ └── client.ts # Firestore operations
186
- │ ├── parser/
187
- │ │ ├── jsonl.ts # JSONL file parsing
188
- │ │ └── titles.ts # Title generation
189
- │ ├── utils/
190
- │ │ ├── config.ts # Config management
191
- │ │ ├── device.ts # Device identification
192
- │ │ └── firebase-json.ts # Firebase JSON validation & URL generation
193
- │ ├── types.ts # TypeScript types
194
- │ └── index.ts # CLI entry point
195
- ├── dist/ # Compiled output
196
- ├── package.json
197
- └── tsconfig.json
198
- ```
199
-
200
- ## Development
201
-
202
- ```bash
203
- pnpm dev # Watch mode — recompiles on save
204
- pnpm build # One-time compile
205
- pnpm lint # Run ESLint
206
- ```
207
-
208
- The CLI is written in TypeScript with ES Modules and compiled to `dist/`. After `npm link`, changes rebuild automatically in watch mode.
169
+ See [CONTRIBUTING.md](https://github.com/melagiri/code-insights/blob/master/CONTRIBUTING.md) for development setup, code style, and PR guidelines.
209
170
 
210
- See [CONTRIBUTING.md](../CONTRIBUTING.md) for the full development workflow, code style, and PR guidelines.
171
+ ## License
211
172
 
212
- ## Firestore Collections
213
-
214
- The CLI writes to these collections:
215
-
216
- ### `projects`
217
- ```typescript
218
- {
219
- id: string; // Hash of git remote URL or path
220
- name: string; // Project directory name
221
- path: string; // Full path on syncing device
222
- gitRemoteUrl: string | null;
223
- projectIdSource: 'git-remote' | 'path-hash';
224
- sessionCount: number;
225
- lastActivity: Timestamp;
226
- }
227
- ```
228
-
229
- ### `sessions`
230
- ```typescript
231
- {
232
- id: string; // From JSONL filename
233
- projectId: string;
234
- projectName: string;
235
- projectPath: string;
236
- gitRemoteUrl: string | null;
237
- summary: string | null;
238
- generatedTitle: string | null;
239
- titleSource: 'claude' | 'user_message' | 'insight' | 'character' | 'fallback' | null;
240
- sessionCharacter: 'deep_focus' | 'bug_hunt' | 'feature_build' | 'exploration' | 'refactor' | 'learning' | 'quick_task' | null;
241
- startedAt: Timestamp;
242
- endedAt: Timestamp;
243
- messageCount: number;
244
- userMessageCount: number;
245
- assistantMessageCount: number;
246
- toolCallCount: number;
247
- gitBranch: string | null;
248
- claudeVersion: string | null;
249
- deviceId: string;
250
- deviceHostname: string;
251
- devicePlatform: string;
252
- syncedAt: Timestamp; // Server timestamp
253
- // Usage stats (present when token data is available)
254
- totalInputTokens?: number;
255
- totalOutputTokens?: number;
256
- cacheCreationTokens?: number;
257
- cacheReadTokens?: number;
258
- estimatedCostUsd?: number;
259
- modelsUsed?: string[];
260
- primaryModel?: string;
261
- usageSource?: 'jsonl';
262
- }
263
- ```
264
-
265
- ### `messages`
266
- ```typescript
267
- {
268
- id: string;
269
- sessionId: string;
270
- type: 'user' | 'assistant' | 'system';
271
- content: string; // Max 10,000 chars (truncated)
272
- thinking: string | null; // Extracted thinking content (max 5,000 chars)
273
- toolCalls: Array<{ id: string; name: string; input: string }>; // Input max 1,000 chars
274
- toolResults: Array<{ toolUseId: string; output: string }>; // Output max 2,000 chars
275
- timestamp: Timestamp;
276
- parentId: string | null;
277
- // Per-message usage (assistant messages only)
278
- usage?: {
279
- inputTokens: number;
280
- outputTokens: number;
281
- cacheCreationTokens: number;
282
- cacheReadTokens: number;
283
- model: string;
284
- estimatedCostUsd: number;
285
- };
286
- }
287
- ```
173
+ MIT License — see [LICENSE](https://github.com/melagiri/code-insights/blob/master/LICENSE) for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-insights/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Sync your AI coding sessions to Firebase for analysis",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",