project-compass 4.3.6 → 4.3.7

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/CONTRIBUTING.md CHANGED
@@ -2,22 +2,986 @@
2
2
 
3
3
  Thank you for your interest in helping to navigate the project universe! 🚀
4
4
 
5
+ This document provides **COMPLETE** guidelines for contributing to Project Compass (v4.3.6).
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [Core Principles](#core-principles)
12
+ 2. [Working with AI Agents](#working-with-ai-agents)
13
+ 3. [Development Workflow](#development-workflow)
14
+ 4. [Project Structure](#project-structure)
15
+ 5. [Code Style Requirements](#code-style-requirements)
16
+ 6. [Testing Requirements](#testing-requirements)
17
+ 7. [CLI Commands Reference](#cli-commands-reference)
18
+ 8. [TUI Features Reference](#tui-features-reference)
19
+ 9. [Framework Detection](#framework-detection)
20
+ 10. [Adding New Features](#adding-new-features)
21
+ 11. [Bug Fix Guidelines](#bug-fix-guidelines)
22
+ 12. [Deployment](#deployment)
23
+
24
+ ---
25
+
5
26
  ## Core Principles
6
- 1. **High Fidelity:** The UI should feel like a cockpit, not just a text list.
7
- 2. **Safety First:** Commands should be executed safely, and critical actions (like `rm` or `kill`) should have a confirmation gate.
8
- 3. **Speed:** Operations must be non-blocking. Use Ink's async components or background processes via `execa`.
27
+
28
+ ### 1. High Fidelity
29
+ The UI should feel like a cockpit, not just a text list. Every pixel counts.
30
+
31
+ - **Visual Clarity**: Use `kleur` for colors
32
+ - **Animations**: Spinners, progress bars, status indicators
33
+ - **Layout**: Use Ink's `Box` component with proper flexbox properties
34
+ - **Borders**: Use `borderStyle` (single, double, round, bold)
35
+
36
+ ### 2. Safety First
37
+ Commands should be executed safely, and critical actions (like `rm` or `kill`) should have a confirmation gate.
38
+
39
+ - **Confirmation**: `Shift+Q` shows confirmation when tasks are running
40
+ - **Process Cleanup**: `handleKillTask()` and `killAllTasks()` handle cleanup
41
+ - **No Auto-Run**: Commands only execute when explicitly requested by user
42
+
43
+ ### 3. Speed
44
+ Operations must be non-blocking. Use Ink's async components or background processes via `execa`.
45
+
46
+ - **Async Operations**: Project scanning, command execution use async/await
47
+ - **Streaming**: Log output streams in real-time via `stdout.on('data')`
48
+ - **Caching**: Framework plugins cached in `cachedFrameworkPlugins`
49
+
50
+ ### 4. Zero Hallucinations
51
+ Framework detection must be based on actual dependencies, not just file existence.
52
+
53
+ - **Use `dependencyMatches()`**: NOT `hasProjectFile()` for framework matching
54
+ - **Verify Dependencies**: Check `project.metadata.dependencies`
55
+ - **Test Edge Cases**: Projects without frameworks should show "none"
56
+
57
+ ### 5. ESM Only
58
+ All code uses ECMAScript modules (`import/export`).
59
+
60
+ - **No CommonJS**: No `require()` or `module.exports`
61
+ - **Import/Export**: Use `import` and `export default`
62
+ - **Dynamic Import**: Use `await import()` for `compass.config.js`
63
+
64
+ ---
9
65
 
10
66
  ## Working with AI Agents
67
+
11
68
  This repository is "AI-First." Always update `AGENTS.md` after making structural changes to the code or adding new core components. This helps subsequent agents (and humans!) maintain high-velocity context.
12
69
 
13
- ## Workflow
14
- 1. **Fork and Branch:** Create a branch for your feature or fix.
15
- 2. **Code Style:** Follow the existing ESM pattern.
16
- 3. **Testing:** Run `npm start` and verify AI Horizon (`Shift+O`) and Port Config (`Shift+R`) functionality. (like a multi-repo folder) to ensure the UI remains performant.
17
- 4. **Commits:** Use conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`).
70
+ ### Files to Update After Changes:
71
+
72
+ 1. **`AGENTS.md`** - Add new components, update file references, add new features
73
+ 2. **`PROJECT_CONTEXT.md`** - Update context, add bug fixes, document enhancements
74
+ 3. **`README.md`** - Update with new CLI commands, TUI features
75
+ 4. **`ARHITECTURE.md`** - Document architectural changes
76
+ 5. **`commands.md`** - Add ALL new keyboard shortcuts, CLI arguments
77
+ 6. **`CONTRIBUTING.md`** - Update this file with new workflows
78
+
79
+ ### AI Agent Context Quick Reference:
80
+
81
+ | File | Purpose | When to Update |
82
+ |------|---------|-----------------|
83
+ | `AGENTS.md` | AI agent context | After structural changes |
84
+ | `PROJECT_CONTEXT.md` | Technical context | After bug fixes, enhancements |
85
+ | `README.md` | User documentation | After new features |
86
+ | `ARHITECTURE.md` | Architecture docs | After architectural changes |
87
+ | `commands.md` | Command reference | After new commands/shortcuts |
88
+ | `CONTRIBUTING.md` | Contributor guide | After workflow changes |
89
+
90
+ ---
91
+
92
+ ## Development Workflow
93
+
94
+ ### 1. Fork and Branch
95
+
96
+ ```bash
97
+ # Fork on GitHub, then clone
98
+ git clone https://github.com/YOUR-USERNAME/project-compass.git
99
+ cd project-compass
100
+
101
+ # Create feature branch
102
+ git checkout -b feature/your-feature-name
103
+ # or
104
+ git checkout -b fix/your-bug-fix
105
+ ```
106
+
107
+ ### 2. Code Style
108
+
109
+ Follow the existing ESM pattern. Use `import/export`. Components use `React.createElement` (aliased as `create`), NOT JSX.
110
+
111
+ #### Correct Pattern (ESM + createElement):
112
+
113
+ ```javascript
114
+ import React, { useState, useMemo } from 'react';
115
+ import { Box, Text } from 'ink';
116
+
117
+ const create = React.createElement;
118
+
119
+ export default function MyComponent({ prop1, prop2 }) {
120
+ const [state, setState] = useState('');
121
+
122
+ return create(
123
+ Box,
124
+ { flexDirection: 'column' },
125
+ create(Text, null, 'Hello ', state),
126
+ create(Text, { color: 'cyan' }, prop1)
127
+ );
128
+ }
129
+ ```
130
+
131
+ #### Incorrect Patterns:
132
+
133
+ ```javascript
134
+ // ❌ NO JSX
135
+ const element = <Box><Text>Hello</Text></Box>;
136
+
137
+ // ❌ NO CommonJS
138
+ const React = require('react');
139
+ module.exports = MyComponent;
140
+ ```
141
+
142
+ ### 3. Linting
143
+
144
+ Run `npm run lint` before committing.
145
+
146
+ ```bash
147
+ # Check for errors
148
+ npm run lint
149
+
150
+ # Auto-fix (if available)
151
+ npm run lint -- --fix
152
+ ```
153
+
154
+ **ESLint Configuration**: `eslint.config.cjs`
155
+ - **Rules**: `no-unused-vars` (warn on unused variables)
156
+ - **Parser**: `@eslint/js` with espree
157
+ - **Environment**: Node.js + ES6
158
+
159
+ ### 4. Testing
160
+
161
+ #### Test TUI Mode:
162
+
163
+ ```bash
164
+ # Start the TUI
165
+ npm start
166
+
167
+ # Test with specific view
168
+ node src/cli.js --studio
169
+ node src/cli.js --ai
170
+ node src/cli.js --task
171
+ ```
172
+
173
+ #### Test Headless Mode (No TUI):
174
+
175
+ ```bash
176
+ # Test project detection
177
+ node src/cli.js --mode test
178
+ node src/cli.js --mode test --dir /path/to/workspace
179
+
180
+ # Test new CLI features
181
+ node src/cli.js --list-projects
182
+ node src/cli.js --project-info 0
183
+ node src/cli.js --run "echo test"
184
+ node src/cli.js --add-pkg "express"
185
+ node src/cli.js --studio-check
186
+ node src/cli.js --scaffold python-basic --name test
187
+ ```
188
+
189
+ #### Test AI Horizon:
190
+
191
+ 1. Launch TUI: `npm start`
192
+ 2. Press `Shift+O` or `0` (in detail view)
193
+ 3. Configure AI provider (OpenRouter/Gemini/Claude/Ollama)
194
+ 4. Enter API token
195
+ 5. Press `Enter` to analyze
196
+ 6. Review/edit suggestions
197
+ 7. Press `S` to save
198
+
199
+ #### Test with Multi-Project Workspaces:
200
+
201
+ ```bash
202
+ # Create test workspace
203
+ mkdir -p /tmp/test-workspace
204
+ cd /tmp/test-workspace
205
+
206
+ # Create sample projects
207
+ mkdir node-project && cd node-project && npm init -y && cd ..
208
+ mkdir python-project && cd python-project && echo '{"name": "fastapi", "dependencies": {"fastapi": "*"}}' > pyproject.toml && cd ..
209
+ mkdir rust-project && cd rust-project && cargo init && cd ..
210
+
211
+ # Test detection
212
+ node /path/to/project-compass/src/cli.js --list-projects --dir /tmp/test-workspace
213
+ ```
214
+
215
+ #### Test with Projects Without Frameworks:
216
+
217
+ ```bash
218
+ # Create simple Python project (no framework)
219
+ mkdir -p /tmp/simple-python
220
+ echo 'print("Hello")' > /tmp/simple-python/main.py
221
+
222
+ # Detect - should show "Frameworks: none"
223
+ node /path/to/project-compass/src/cli.js --list-projects --dir /tmp/simple-python
224
+ ```
225
+
226
+ ### 5. Commits
227
+
228
+ Use conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`).
229
+
230
+ #### Commit Message Format:
231
+
232
+ ```
233
+ <type>(<scope>): <subject>
234
+
235
+ <body>
236
+
237
+ <footer>
238
+ ```
239
+
240
+ #### Examples:
241
+
242
+ ```bash
243
+ # Feature
244
+ git commit -m "feat(compass-config): integrate compass-config.js into project detection"
245
+
246
+ # Bug fix
247
+ git commit -m "fix(frameworks): prevent hallucination in fastapi matcher"
248
+
249
+ # Docs
250
+ git commit -m "docs(README): update with all CLI commands and features"
251
+
252
+ # Refactor
253
+ git commit -m "refactor(cli): add comprehensive CLI mode support"
254
+
255
+ # Performance
256
+ git commit -m "perf(detection): cache framework plugins for faster loading"
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Project Structure
262
+
263
+ ```
264
+ project-compass/
265
+ ├── package.json # NPM package config (v4.3.6)
266
+ ├── README.md # Main documentation (COMPREHENSIVE)
267
+ ├── ARCHITECTURE.md # Architecture documentation
268
+ ├── commands.md # All commands & shortcuts
269
+ ├── CONTRIBUTING.md # This file (contribution guidelines)
270
+ ├── AGENTS.md # AI agent context
271
+ ├── PROJECT_CONTEXT.md # Technical context for agents
272
+ ├── LICENSE # MIT License
273
+ ├── eslint.config.cjs # ESLint configuration
274
+ ├── assets/ # Screenshots and branding
275
+ ├── src/
276
+ │ ├── cli.js # Entry point (840+ lines)
277
+ │ │ # - parseArgs() (lines 766-781)
278
+ │ │ # - main() (lines 783-840+)
279
+ │ │ # - Compass component (lines 163-763)
280
+ │ │ # - useScanner() (lines 67-90)
281
+ │ │ # - runProjectCommand() (lines 264-310)
282
+ │ │ # - addLogToTask() (lines 203-216)
283
+ │ │ # - handleKillTask() (lines 236-255)
284
+ │ │ # - killAllTasks() (lines 257-262)
285
+ │ │ # - saveConfig() (lines 38-45)
286
+ │ │ # - loadConfig() (lines 47-65)
287
+ │ ├── projectDetection.js # Orchestrator (189 lines)
288
+ │ │ # - discoverProjects(root) (lines 146-180)
289
+ │ │ # - applyFrameworkPlugins(project) (lines 114-144)
290
+ │ │ # - matchesPlugin(project, plugin) (lines 83-112)
291
+ │ │ # - getFrameworkPlugins() (lines 75-81)
292
+ │ │ # - loadUserFrameworks() (lines 31-71)
293
+ │ ├── configPaths.js # Config directory paths
294
+ │ │ # - CONFIG_DIR: ~/.project-compass/
295
+ │ │ # - CONFIG_PATH: ~/.project-compass/config.json
296
+ │ │ # - PLUGIN_FILE: ~/.project-compass/plugins.json
297
+ │ │ # - ensureConfigDir()
298
+ │ ├── detectors/
299
+ │ │ ├── utils.js # Shared utilities (148 lines)
300
+ │ │ │ # - checkBinary(name)
301
+ │ │ │ # - hasProjectFile(projectPath, file)
302
+ │ │ │ # - getPackageManager(projectPath, language)
303
+ │ │ │ # - dependencyMatches(project, needle)
304
+ │ │ │ # - parseCommandTokens(value)
305
+ │ │ │ # - getLockfileInfo(projectPath)
306
+ │ │ ├── node.js # Node.js detection (140 lines)
307
+ │ │ │ # Priority: 100, Files: package.json
308
+ │ │ ├── python.js # Python detection (208 lines)
309
+ │ │ │ # Priority: 95, Files: pyproject.toml, etc.
310
+ │ │ ├── rust.js # Rust detection (136 lines)
311
+ │ │ │ # Priority: 90, Files: Cargo.toml
312
+ │ │ ├── go.js # Go detection
313
+ │ │ │ # Priority: 85, Files: go.mod
314
+ │ │ ├── java.js # Java detection
315
+ │ │ │ # Priority: 80, Files: pom.xml, build.gradle
316
+ │ │ ├── php.js # PHP detection
317
+ │ │ │ # Priority: 75, Files: composer.json
318
+ │ │ ├── ruby.js # Ruby detection
319
+ │ │ │ # Priority: 70, Files: Gemfile
320
+ │ │ ├── dotnet.js # .NET detection
321
+ │ │ │ # Priority: 65, Files: *.csproj
322
+ │ │ ├── generic.js # Generic fallback
323
+ │ │ │ # Priority: 10, Files: Makefile, build.sh
324
+ │ │ ├── compass-config.js # Project config loader (39 lines)
325
+ │ │ │ # - loadProjectConfig(projectPath)
326
+ │ │ │ # - saveProjectConfig(projectPath, config)
327
+ │ │ └── frameworks.js # 40+ built-in plugins (877 lines)
328
+ │ │ # Node.js: Next.js, React, Vue, etc.
329
+ │ │ # Python: FastAPI, Flask, Django, etc.
330
+ │ │ # Rust: Actix, Rocket, Axum, etc.
331
+ │ │ # Go: Gin, Echo, Fiber, etc.
332
+ │ │ # Java: Spring Boot, Quarkus, etc.
333
+ │ │ # PHP: Laravel, Symfony, etc.
334
+ │ │ # Ruby: Rails, Sinatra, etc.
335
+ │ │ # .NET: ASP.NET Core, Blazor, etc.
336
+ │ ├── components/
337
+ │ │ ├── Navigator.js # Paginated project list (110 lines)
338
+ │ │ ├── Header.js # Top bar (60 lines)
339
+ │ │ ├── Footer.js # Bottom bar with stdin (81 lines)
340
+ │ │ ├── TaskManager.js # Orbit Task Manager (82 lines)
341
+ │ │ ├── PackageRegistry.js # Dependency management (156 lines)
342
+ │ │ ├── ProjectArchitect.js # Scaffolding (113 lines)
343
+ │ │ ├── AIHorizon.js # AI analysis (426 lines)
344
+ │ │ └── Studio.js # Environment check (64 lines)
345
+ ├── node_modules/ # Dependencies
346
+ └── ~/.project-compass/ # User config directory (NOT in repo)
347
+ ├── config.json # Main configuration
348
+ └── plugins.json # Custom framework plugins
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Code Style Requirements
354
+
355
+ ### 1. Component Creation
356
+
357
+ ALL components use `React.createElement` (aliased as `create`), NOT JSX:
358
+
359
+ ```javascript
360
+ import React from 'react';
361
+ import { Box, Text } from 'ink';
362
+
363
+ const create = React.createElement;
364
+
365
+ export default function MyComponent({ prop1, prop2 }) {
366
+ return create(
367
+ Box,
368
+ { flexDirection: 'column', padding: 1 },
369
+ create(Text, { bold: true, color: 'cyan' }, 'Title'),
370
+ create(Text, { dimColor: true }, prop1)
371
+ );
372
+ }
373
+ ```
374
+
375
+ ### 2. State Management
376
+
377
+ Use React hooks (NOT class components):
378
+
379
+ ```javascript
380
+ import { useState, useMemo, useCallback, useEffect } from 'react';
381
+
382
+ export default function MyComponent() {
383
+ const [state, setState] = useState(initialValue);
384
+ const memoized = useMemo(() => expensiveComputation(state), [state]);
385
+ const callback = useCallback(() => { /* ... */ }, []);
386
+
387
+ useEffect(() => {
388
+ // Side effect
389
+ return () => { /* cleanup */ };
390
+ }, []);
391
+ }
392
+ ```
393
+
394
+ ### 3. Input Handling
395
+
396
+ Use Ink's `useInput` hook:
397
+
398
+ ```javascript
399
+ import { useInput } from 'ink';
400
+
401
+ useInput((input, key) => {
402
+ if (key.return) { /* handle Enter */ }
403
+ if (key.escape) { /* handle Escape */ }
404
+ if (key.upArrow) { /* handle Up */ }
405
+ if (key.downArrow) { /* handle Down */ }
406
+ if (input) { /* handle character input */ }
407
+ });
408
+ ```
409
+
410
+ ### 4. Async Operations
411
+
412
+ Use async/await, NOT callbacks:
413
+
414
+ ```javascript
415
+ // ✅ Correct
416
+ async function discoverProjects(root) {
417
+ const result = await someAsyncOperation(root);
418
+ return result;
419
+ }
420
+
421
+ // ❌ Incorrect
422
+ function discoverProjects(root, callback) {
423
+ someAsyncOperation(root, callback);
424
+ }
425
+ ```
426
+
427
+ ### 5. Error Handling
428
+
429
+ Always catch errors and provide meaningful messages:
430
+
431
+ ```javascript
432
+ try {
433
+ const data = await fetch(url);
434
+ return data;
435
+ } catch (error) {
436
+ console.error(`Failed to fetch: ${error.message}`);
437
+ return null;
438
+ }
439
+ ```
440
+
441
+ ---
442
+
443
+ ## Testing Requirements
444
+
445
+ ### 1. Lint Check (MANDATORY)
446
+
447
+ ```bash
448
+ npm run lint
449
+ # Must pass with 0 errors before committing
450
+ ```
451
+
452
+ ### 2. CLI Mode Tests
453
+
454
+ Test ALL CLI arguments:
455
+
456
+ ```bash
457
+ # Help and version
458
+ node src/cli.js --help
459
+ node src/cli.js --version
460
+
461
+ # Project detection
462
+ node src/cli.js --mode test --dir /path/to/workspace
463
+ node src/cli.js --list-projects --dir /path/to/workspace
464
+ node src/cli.js --list-projects --json
465
+ node src/cli.js --project-info 0
466
+
467
+ # Run commands
468
+ node src/cli.js --run "echo test" --dir /path/to/project
469
+
470
+ # Package management
471
+ node src/cli.js --add-pkg "express" --dir /path/to/project
472
+ node src/cli.js --remove-pkg "lodash" --dir /path/to/project
473
+
474
+ # Scaffolding
475
+ node src/cli.js --scaffold python-basic --name test --dir /tmp
476
+
477
+ # Environment check
478
+ node src/cli.js --studio-check
479
+ ```
480
+
481
+ ### 3. TUI Mode Tests
482
+
483
+ Launch TUI and test ALL features:
484
+
485
+ ```bash
486
+ npm start
487
+ ```
488
+
489
+ #### Test Navigation:
490
+ - ↑/↓ to move projects
491
+ - PgUp/PgDn to jump pages
492
+ - Enter to toggle detail view
493
+ - ? to toggle help overlay
494
+
495
+ #### Test Quick Actions (Detail View):
496
+ - 0 for AI analysis
497
+ - B/T/R/I for build/test/run/install
498
+ - 1-9 for numbered commands
499
+
500
+ #### Test Views:
501
+ - Shift+O for AI Horizon
502
+ - Shift+T for Task Manager
503
+ - Shift+P for Package Registry
504
+ - Shift+N for Project Architect
505
+ - Shift+A for Studio
506
+
507
+ #### Test Toggles:
508
+ - Shift+B for Art Board
509
+ - Shift+H for Help Cards
510
+ - Shift+S for Structure Guide
511
+
512
+ #### Test Task Management:
513
+ - Shift+K to kill task
514
+ - Shift+R to rename task
515
+ - Shift+X to clear logs
516
+ - Shift+E to export logs
517
+
518
+ ### 4. Framework Detection Tests
519
+
520
+ #### Test with Projects WITH Frameworks:
521
+
522
+ ```bash
523
+ # Should detect FastAPI
524
+ node src/cli.js --list-projects --dir /path/to/fastapi-project
525
+ # Output should show: Frameworks: FastAPI
526
+
527
+ # Should detect Next.js
528
+ node src/cli.js --list-projects --dir /path/to/nextjs-project
529
+ # Output should show: Frameworks: Next.js
530
+ ```
531
+
532
+ #### Test with Projects WITHOUT Frameworks:
533
+
534
+ ```bash
535
+ # Should show "Frameworks: none"
536
+ node src/cli.js --list-projects --dir /path/to/simple-python
537
+ node src/cli.js --list-projects --dir /path/to/simple-node
538
+ ```
539
+
540
+ ### 5. AI Horizon Tests
541
+
542
+ 1. Launch: `npm start`
543
+ 2. Select project with `↑/↓`
544
+ 3. Press `Shift+O` or `0`
545
+ 4. Select AI provider with `↑/↓`, press `Enter`
546
+ 5. Enter model, press `Enter`
547
+ 6. Enter API token, press `Enter`
548
+ 7. Press `Enter` to analyze
549
+ 8. Review suggestions (↑/↓ to select, `E` to edit)
550
+ 9. Press `S` to save
551
+
552
+ ---
553
+
554
+ ## CLI Commands Reference
555
+
556
+ ### All CLI Arguments (Complete List):
557
+
558
+ ```bash
559
+ # Basic
560
+ project-compass # Launch TUI (default: navigator)
561
+ project-compass --help # Show help (-h)
562
+ project-compass --version # Show version (-v)
563
+
564
+ # Direct view launch
565
+ project-compass --studio # Launch in Studio view
566
+ project-compass --ai # Launch in AI Horizon view
567
+ project-compass --task # Launch in Task Manager view
568
+ project-compass --tasks # Alias for --task
569
+
570
+ # Project detection (no TUI)
571
+ project-compass --mode test # Simple detection (legacy)
572
+ project-compass --list-projects # Detailed listing (RECOMMENDED)
573
+ project-compass --project-info <n> # Show project by index
574
+ project-compass --list-projects --json # JSON output
575
+
576
+ # Run commands
577
+ project-compass --run "cmd" --dir /path # Run command directly
578
+
579
+ # Package management
580
+ project-compass --add-pkg "pkg" --dir /path # Add package
581
+ project-compass --remove-pkg "pkg" --dir /path # Remove package
582
+
583
+ # Project scaffolding
584
+ project-compass --scaffold <template> --name <n> --dir <d>
585
+
586
+ # Environment
587
+ project-compass --studio-check # Check runtimes
588
+
589
+ # Directory specification
590
+ project-compass --dir /path/to/workspace # Specify working directory
591
+
592
+ # AI analysis (requires TUI)
593
+ project-compass --ai-analyze # Shows message to use TUI mode
594
+ ```
595
+
596
+ ### NPM Scripts:
597
+
598
+ ```bash
599
+ npm start # node src/cli.js
600
+ npm run test # node src/cli.js --mode test
601
+ npm run lint # eslint src
602
+ npm run run -- "cmd" # node src/cli.js --run "cmd"
603
+ ```
604
+
605
+ ---
606
+
607
+ ## TUI Features Reference
608
+
609
+ ### All Keyboard Shortcuts (Complete List):
610
+
611
+ #### Navigation:
612
+ | Key | Action |
613
+ |-----|--------|
614
+ | `↑` / `↓` | Move project focus |
615
+ | `PgUp` / `PgDn` | Jump full project page |
616
+ | `Enter` | Toggle project Detail View |
617
+ | `Esc` | Global Back: Return to Main Navigator |
618
+ | `?` | Toggle help overlay |
619
+
620
+ #### Quick Actions (Detail View):
621
+ | Key | Action |
622
+ |-----|--------|
623
+ | `0` | Quick AI Analysis |
624
+ | `B` / `T` / `R` / `I` | Build / Test / Run / Install |
625
+ | `1-9` | Run numbered commands |
626
+ | `Shift+1-9` (A-Z) | Run commands 10+ |
627
+
628
+ #### Views:
629
+ | Key | Action |
630
+ |-----|--------|
631
+ | `Shift+O` | AI Horizon Dashboard |
632
+ | `Shift+T` | Orbit Task Manager |
633
+ | `Shift+P` | Package Registry |
634
+ | `Shift+N` | Project Architect |
635
+ | `Shift+A` | Omni-Studio |
636
+
637
+ #### UI Toggles:
638
+ | Key | Action |
639
+ |-----|--------|
640
+ | `Shift+B` | Toggle Art Board |
641
+ | `Shift+H` | Toggle Help Cards |
642
+ | `Shift+S` | Toggle Structure Guide |
643
+
644
+ #### Task Management:
645
+ | Key | Action |
646
+ |-----|--------|
647
+ | `Shift+K` | Kill running process |
648
+ | `Shift+R` | Rename task / Configure port |
649
+ | `Shift+D` | Detach from task |
650
+ | `Shift+X` | Clear active logs |
651
+ | `Shift+E` | Export logs to .txt |
652
+ | `Shift+L` | Rerun last command |
653
+
654
+ #### Log Scrolling:
655
+ | Key | Action |
656
+ |-----|--------|
657
+ | `Shift+↑` | Scroll logs up |
658
+ | `Shift+↓` | Scroll logs down |
659
+
660
+ #### Project Configuration:
661
+ | Key | Action |
662
+ |-----|--------|
663
+ | `Shift+C` | Add custom command |
664
+ | `Shift+R` | Configure port (Detail View) |
665
+
666
+ #### System:
667
+ | Key | Action |
668
+ |-----|--------|
669
+ | `Shift+Q` | Quit (confirm if tasks running) |
670
+ | `Ctrl+C` | Interrupt running command |
671
+
672
+ ---
673
+
674
+ ## Framework Detection
675
+
676
+ ### How Framework Detection Works:
677
+
678
+ 1. **Project Detection**: `projectDetection.js` runs detectors in priority order (100-10)
679
+ 2. **Detector Build**: Each detector returns project object with metadata
680
+ 3. **Plugin Application**: `frameworks.js` and `plugins.json` applied
681
+ 4. **Dependency Matching**: Use `dependencyMatches()` (NOT `hasProjectFile()`)
682
+
683
+ ### Adding a New Detector:
684
+
685
+ 1. Create `src/detectors/yourlang.js`:
686
+
687
+ ```javascript
688
+ import fs from 'fs';
689
+ import path from 'path';
690
+ import { checkBinary, hasProjectFile } from './utils.js';
691
+
692
+ export default {
693
+ type: 'yourlang',
694
+ label: 'Your Language',
695
+ icon: '🚀',
696
+ priority: 80, // Higher = preferred
697
+ files: ['manifest.ext'],
698
+ binaries: ['yourlang'],
699
+ async build(projectPath, manifest) {
700
+ const missingBinaries = this.binaries.filter(b => !checkBinary(b));
701
+ // Parse manifest, detect metadata
702
+ const commands = {
703
+ install: { label: 'Install', command: ['yourlang', 'install'], source: 'builtin' },
704
+ run: { label: 'Run', command: ['yourlang', 'run'], source: 'builtin' }
705
+ };
706
+ return {
707
+ id: `${projectPath}::yourlang`,
708
+ path: projectPath,
709
+ name: path.basename(projectPath),
710
+ type: 'Your Language',
711
+ icon: '🚀',
712
+ priority: this.priority,
713
+ commands,
714
+ metadata: { /* ... */ },
715
+ manifest: path.basename(manifest),
716
+ description: '...',
717
+ missingBinaries,
718
+ frameworks: [],
719
+ extra: { /* ... */ }
720
+ };
721
+ }
722
+ }
723
+ ```
724
+
725
+ 2. Import in `projectDetection.js`:
726
+
727
+ ```javascript
728
+ import yourDetector from './detectors/yourlang.js';
729
+ // Add to detectors array (higher priority = first)
730
+ const detectors = [
731
+ yourDetector, // Priority 80
732
+ // ... other detectors
733
+ ];
734
+ ```
735
+
736
+ ### Adding a New Framework Plugin:
737
+
738
+ #### Built-in (`src/detectors/frameworks.js`):
739
+
740
+ ```javascript
741
+ {
742
+ id: 'your-framework',
743
+ name: 'Your Framework',
744
+ icon: '🚀',
745
+ description: 'Description here',
746
+ languages: ['Node.js'], // Which languages
747
+ priority: 100, // Boosts project priority
748
+ match(project) {
749
+ // Use dependencyMatches() NOT hasProjectFile()
750
+ return dependencyMatches(project, 'your-framework');
751
+ },
752
+ commands(project) {
753
+ const pm = project.metadata?.packageManager || 'npm';
754
+ return {
755
+ install: { label: 'Install', command: [pm, 'install'], source: 'framework' },
756
+ run: { label: 'Run', command: [pm, 'run', 'dev'], source: 'framework' }
757
+ };
758
+ }
759
+ }
760
+ ```
761
+
762
+ #### Custom (`~/.project-compass/plugins.json`):
763
+
764
+ ```json
765
+ {
766
+ "plugins": [
767
+ {
768
+ "name": "Your Framework",
769
+ "icon": "🚀",
770
+ "languages": ["Node.js"],
771
+ "files": ["your.config.js"],
772
+ "dependencies": ["your-framework"],
773
+ "priority": 100,
774
+ "commands": {
775
+ "dev": { "label": "Dev", "command": ["your-cli", "dev"] }
776
+ }
777
+ }
778
+ ]
779
+ }
780
+ ```
781
+
782
+ ### ⚠️ Important: No Hallucinations!
783
+
784
+ **Wrong** (causes hallucinations):
785
+
786
+ ```javascript
787
+ match(project) {
788
+ return dependencyMatches(project, 'fastapi') || hasProjectFile(project.path, 'main.py');
789
+ // ❌ This will match ANY project with main.py!
790
+ }
791
+ ```
792
+
793
+ **Correct**:
794
+
795
+ ```javascript
796
+ match(project) {
797
+ return dependencyMatches(project, 'fastapi');
798
+ // ✅ Only matches if fastapi is in dependencies
799
+ }
800
+ ```
801
+
802
+ ---
803
+
804
+ ## Adding New Features
805
+
806
+ ### Adding a New CLI Argument:
807
+
808
+ 1. Update `parseArgs()` in `src/cli.js` (lines 766-781):
809
+
810
+ ```javascript
811
+ else if (token === '--your-flag' && tokens[i + 1]) {
812
+ args.yourFlag = tokens[i + 1];
813
+ i += 1;
814
+ }
815
+ ```
816
+
817
+ 2. Update `main()` in `src/cli.js` (lines 783-840+):
818
+
819
+ ```javascript
820
+ if (args.yourFlag) {
821
+ // Implement feature
822
+ console.log('Your feature here');
823
+ return;
824
+ }
825
+ ```
826
+
827
+ 3. Update help text in `main()` (lines 791-836):
828
+
829
+ ```javascript
830
+ console.log(' --your-flag <value> ' + kleur.dim('# Your flag description)');
831
+ ```
832
+
833
+ 4. Update ALL markdown files:
834
+ - `commands.md`
835
+ - `README.md`
836
+ - `AGENTS.md`
837
+ - `PROJECT_CONTEXT.md`
838
+
839
+ ### Adding a New TUI View:
840
+
841
+ 1. Create component in `src/components/YourView.js`:
842
+
843
+ ```javascript
844
+ import React, { memo } from 'react';
845
+ import { Box, Text, useInput } from 'ink';
846
+
847
+ const create = React.createElement;
848
+
849
+ const YourView = memo(({ prop1, prop2 }) => {
850
+ useInput((input, key) => {
851
+ if (key.escape) { /* return to navigator */ }
852
+ });
853
+
854
+ return create(
855
+ Box,
856
+ { flexDirection: 'column', borderStyle: 'double', borderColor: 'cyan', padding: 1 },
857
+ create(Text, { bold: true, color: 'cyan' }, 'Your View'),
858
+ // ... more UI
859
+ );
860
+ });
861
+
862
+ export default YourView;
863
+ ```
864
+
865
+ 2. Import in `src/cli.js`:
866
+
867
+ ```javascript
868
+ import YourView from './components/YourView.js';
869
+ ```
870
+
871
+ 3. Add to `renderView()` switch statement:
872
+
873
+ ```javascript
874
+ case 'yourview':
875
+ return create(YourView, { prop1, prop2 });
876
+ ```
877
+
878
+ 4. Add keyboard shortcut in `useInput` handler:
879
+
880
+ ```javascript
881
+ if (shiftCombo('Y')) { clearAndSwitch('yourview'); return; }
882
+ ```
883
+
884
+ 5. Update ALL markdown files with new shortcut.
885
+
886
+ ---
887
+
888
+ ## Bug Fix Guidelines
889
+
890
+ ### Bug Fix Process:
891
+
892
+ 1. **Reproduce**: Create minimal reproduction case
893
+ 2. **Identify Root Cause**: Trace through code
894
+ 3. **Fix**: Implement minimal fix
895
+ 4. **Test**: Verify fix works + no regressions
896
+ 5. **Document**: Update markdown files
897
+
898
+ ### Example Bug Fix (Framework Hallucination):
899
+
900
+ #### 1. Bug Report:
901
+ "Simple Python project with `main.py` detected as FastAPI"
902
+
903
+ #### 2. Root Cause Analysis:
904
+ ```javascript
905
+ // In src/detectors/frameworks.js line 328:
906
+ match(project) {
907
+ return dependencyMatches(project, 'fastapi') || hasProjectFile(project.path, 'main.py');
908
+ // ❌ hasProjectFile() causes false positive
909
+ }
910
+ ```
911
+
912
+ #### 3. Fix:
913
+ ```javascript
914
+ // Fixed:
915
+ match(project) {
916
+ return dependencyMatches(project, 'fastapi');
917
+ // ✅ Only matches actual dependencies
918
+ }
919
+ ```
920
+
921
+ #### 4. Test:
922
+ ```bash
923
+ # Before fix:
924
+ node src/cli.js --list-projects --dir /tmp/simple-python
925
+ # Frameworks: FastAPI ❌ (WRONG!)
926
+
927
+ # After fix:
928
+ node src/cli.js --list-projects --dir /tmp/simple-python
929
+ # Frameworks: none ✅ (CORRECT!)
930
+ ```
931
+
932
+ #### 5. Document:
933
+ - Update `AGENTS.md` with fix
934
+ - Update `PROJECT_CONTEXT.md` with fix
935
+ - Update `README.md` with fix
936
+ - Update `commands.md` if needed
937
+
938
+ ---
18
939
 
19
940
  ## Deployment
20
- All production versions are managed by Satyaa and the primary agent, Clawdy. Any `npm version` bump must include an update to `package-lock.json`.
941
+
942
+ ### Version Bump:
943
+
944
+ ```bash
945
+ # Patch version (4.3.6 → 4.3.7)
946
+ npm version patch
947
+
948
+ # Minor version (4.3.6 → 4.4.0)
949
+ npm version minor
950
+
951
+ # Major version (4.3.6 → 5.0.0)
952
+ npm version major
953
+ ```
954
+
955
+ ### Publish to NPM:
956
+
957
+ ```bash
958
+ # Build (if needed)
959
+ npm run build
960
+
961
+ # Publish
962
+ npm publish
963
+
964
+ # Tag on GitHub
965
+ git tag v4.3.6
966
+ git push origin v4.3.6
967
+ ```
968
+
969
+ ### Production Releases:
970
+
971
+ All production versions are managed by **Satyaa** and the primary agent, **Clawdy**.
972
+
973
+ Any `npm version` bump must include an update to `package-lock.json`.
21
974
 
22
975
  ---
23
- *Navigate the future.*
976
+
977
+ ## Recent Fixes to Be Aware Of (v4.3.6)
978
+
979
+ 1. **Framework Hallucination Bug FIXED**: Projects without frameworks no longer show random frameworks
980
+ 2. **compass-config.js Integrated**: Now loaded during project detection
981
+ 3. **AI Horizon Improved**: Raw AI output displayed, better JSON parsing
982
+ 4. **Node.js Detector Fixed**: No longer adds generic "Node.js" as a framework
983
+ 5. **Framework Deduplication**: `applyFrameworkPlugins()` avoids duplicates
984
+
985
+ ---
986
+
987
+ *Navigate the future.*