@braingrid/cli 0.0.9 → 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.
Files changed (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +7 -3
  3. package/dist/build-config.d.ts +4 -8
  4. package/dist/build-config.d.ts.map +1 -1
  5. package/dist/build-config.js +21 -8
  6. package/dist/build-config.js.map +1 -1
  7. package/dist/cli.js +297 -276
  8. package/dist/cli.js.map +1 -1
  9. package/dist/handlers/auth.handlers.d.ts +7 -1
  10. package/dist/handlers/auth.handlers.d.ts.map +1 -1
  11. package/dist/handlers/auth.handlers.js +80 -21
  12. package/dist/handlers/auth.handlers.js.map +1 -1
  13. package/dist/handlers/project.handlers.d.ts.map +1 -1
  14. package/dist/handlers/project.handlers.js +1 -0
  15. package/dist/handlers/project.handlers.js.map +1 -1
  16. package/dist/rpc/registry.d.ts +97 -0
  17. package/dist/rpc/registry.d.ts.map +1 -0
  18. package/dist/rpc/registry.js +119 -0
  19. package/dist/rpc/registry.js.map +1 -0
  20. package/dist/rpc/server.d.ts +76 -0
  21. package/dist/rpc/server.d.ts.map +1 -0
  22. package/dist/rpc/server.js +420 -0
  23. package/dist/rpc/server.js.map +1 -0
  24. package/dist/rpc/transport.d.ts +84 -0
  25. package/dist/rpc/transport.d.ts.map +1 -0
  26. package/dist/rpc/transport.js +296 -0
  27. package/dist/rpc/transport.js.map +1 -0
  28. package/dist/services/__mocks__/utils.d.ts +16 -0
  29. package/dist/services/__mocks__/utils.d.ts.map +1 -0
  30. package/dist/services/__mocks__/utils.js +21 -0
  31. package/dist/services/__mocks__/utils.js.map +1 -0
  32. package/dist/services/auth.d.ts +18 -0
  33. package/dist/services/auth.d.ts.map +1 -1
  34. package/dist/services/auth.js +92 -42
  35. package/dist/services/auth.js.map +1 -1
  36. package/dist/services/oauth2-auth.d.ts +16 -0
  37. package/dist/services/oauth2-auth.d.ts.map +1 -1
  38. package/dist/services/oauth2-auth.js +74 -0
  39. package/dist/services/oauth2-auth.js.map +1 -1
  40. package/package.json +11 -29
  41. package/dist/.build-info.json +0 -9
  42. package/dist/test/setup.d.ts +0 -2
  43. package/dist/test/setup.d.ts.map +0 -1
  44. package/dist/test/setup.js +0 -40
  45. package/dist/test/setup.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -8,9 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [0.0.9] - 2025-10-04
9
9
 
10
10
  ### Added
11
+
11
12
  - `-v` shorthand flag for `--version` command
12
13
 
13
14
  ### Fixed
15
+
14
16
  - API response handling for `project show --repo` and `project show --repo --limit` commands
15
17
  - Now correctly handles `ListProjectsWithRepositoryResponse` (with `total_count`) vs `ListProjectsResponse` (with `pagination`)
16
18
  - Fixed bug where optional `total_count` check could cause pagination info to not display
@@ -20,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
22
  ## [0.0.8] - 2025-10-03
21
23
 
22
24
  ### Fixed
25
+
23
26
  - Claude Code detection in `braingrid status` command with 3-tier detection strategy
24
27
  - Priority 1: Check `~/.claude/local/claude` (after `claude migrate-installer`)
25
28
  - Priority 2: Try executing `claude --version` (shell alias detection)
@@ -28,11 +31,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
28
31
  - Added comprehensive test coverage for all detection methods
29
32
 
30
33
  ### Changed
34
+
31
35
  - README comment alignment in usage sections for better readability
32
36
 
33
37
  ## [0.0.7] - 2025-10-03
34
38
 
35
39
  ### Added
40
+
36
41
  - `braingrid init` command to initialize repositories with BrainGrid projects
37
42
  - Auto-detects project from git remote (owner/name)
38
43
  - Manual mode with `--project <id>` to specify project by ID
@@ -54,30 +59,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
54
59
  - 36 new tests for init, update, and auto-detection features
55
60
 
56
61
  ### Changed
62
+
57
63
  - Updated `--repository` as primary alias for `--repo` in project show command (both still work)
58
64
  - Project configuration now stores API repository data instead of git-derived data
59
65
  - Simplified QuickStart workflow with auto-detection examples
60
66
  - Enhanced error messages to guide users to run `braingrid init` when needed
61
67
 
62
68
  ### Fixed
69
+
63
70
  - Terminal crash issue in status command by removing interactive shell flag
64
71
  - Data consistency by using API repository values instead of mixing git-derived data
65
72
 
66
73
  ## [0.0.6] - 2025-10-02
67
74
 
68
75
  ### Added
76
+
69
77
  - `/cut-release` slash command for streamlined release workflow
70
78
  - `pnpm docs:sync` command to sync CLI documentation to main BrainGrid repository
71
79
  - Repository-aware project commands with automatic git context detection
72
80
  - Collapsible installation and update command tabs in documentation
73
81
 
74
82
  ### Changed
83
+
75
84
  - Enhanced project commands to automatically detect and include git repository context
76
85
  - Improved README with spec-driven development explanation
77
86
 
78
87
  ## [0.0.5] - 2025-10-02
79
88
 
80
89
  ### Added
90
+
81
91
  - IDEA and REVIEW requirement statuses for enhanced workflow management
82
92
  - Emoji mappings: 💡 for IDEA, 👀 for REVIEW
83
93
  - Natural language keyword parsing for new statuses
@@ -86,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
86
96
  - Updated CLI help text to include new statuses
87
97
 
88
98
  ### Changed
99
+
89
100
  - RequirementStatus type now supports 6 statuses: IDEA, PLANNED, IN_PROGRESS, REVIEW, COMPLETED, CANCELLED
90
101
  - Status workflow: IDEA → PLANNED → IN_PROGRESS → REVIEW → COMPLETED/CANCELLED
91
102
  - Updated README badges to use @braingrid organization
@@ -94,6 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
94
105
  ## [0.0.4] - 2025-10-02
95
106
 
96
107
  ### Added
108
+
97
109
  - Comprehensive test coverage improvement from 26.15% to 64.9%
98
110
  - 529 passing tests covering utils, services, and handlers
99
111
  - Handler layer tests achieving 96.28% coverage (all core handlers 92-100%)
@@ -103,6 +115,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
103
115
  - CLI tools detection (Claude Code, Cursor, git)
104
116
 
105
117
  ### Changed
118
+
106
119
  - Renamed package from `@braingridai/cli` to `@braingrid/cli`
107
120
  - Updated repository URL to main braingrid repo
108
121
  - Refactored from React-based CLI to Commander.js pattern
@@ -110,6 +123,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
110
123
  - Enhanced status command with authentication, git, and tool information
111
124
 
112
125
  ### Fixed
126
+
113
127
  - Task handler number type (string for proper padding)
114
128
  - Repository URL format in package.json
115
129
  - Test coverage for all critical paths
@@ -117,14 +131,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
117
131
  ## [0.0.3] - 2024-01-XX
118
132
 
119
133
  ### Changed
134
+
120
135
  - Initial npm publication as `@braingrid/cli`
121
136
 
122
137
  ## [0.0.2] - 2024-01-XX
123
138
 
124
139
  ### Changed
140
+
125
141
  - Initial version as `@braingridai/cli`
126
142
 
127
143
  ## [0.0.1] - 2024-01-XX
128
144
 
129
145
  ### Added
146
+
130
147
  - Initial CLI implementation
package/README.md CHANGED
@@ -5,9 +5,10 @@
5
5
  <p>Turn thoughts into AI-ready specs and ship 100 faster.</p>
6
6
  <h3>A CLI for spec-driven development.</h3>
7
7
 
8
- [![npm version](https://img.shields.io/npm/v/@braingrid/cli.svg?color=blue&logo=npm)](https://www.npmjs.com/package/@braingrid/cli)
9
- [![Downloads](https://img.shields.io/npm/dm/@braingrid/cli.svg?color=green)](https://www.npmjs.com/package/@braingrid/cli)
10
- [![GitHub stars](https://img.shields.io/github/stars/BrainGridAI/braingrid?style=social)](https://github.com/BrainGridAI/braingrid)
8
+ [![npm version](https://img.shields.io/npm/v/@braingrid/cli.svg?color=blue&logo=npm)](https://www.npmjs.com/package/@braingrid/cli)
9
+ [![Downloads](https://img.shields.io/npm/dm/@braingrid/cli.svg?color=green)](https://www.npmjs.com/package/@braingrid/cli)
10
+ [![GitHub stars](https://img.shields.io/github/stars/BrainGridAI/braingrid?style=social)](https://github.com/BrainGridAI/braingrid)
11
+
11
12
  </div>
12
13
 
13
14
  ---
@@ -29,6 +30,7 @@
29
30
  - 📊 **Track Progress** - Manage and update task statuses
30
31
  - 💾 **Multiple Output Formats** - View data as formatted tables or JSON for scripting
31
32
  - 🔍 **Environment Detection** - Automatically detect git repository info and installed AI coding tools
33
+ - 🔌 **JSON-RPC Mode** - Programmatic access via JSON-RPC 2.0 protocol for IDE integration
32
34
 
33
35
  ---
34
36
 
@@ -63,6 +65,7 @@ braingrid task create -r REQ-1 --title "Implement login endpoint"
63
65
  # 6. View tasks for a requirement
64
66
  braingrid task list -r REQ-1
65
67
  ```
68
+
66
69
  ---
67
70
 
68
71
  ## Usage
@@ -90,6 +93,7 @@ braingrid init --project PROJ-123 --force # Manually specify and force reinitia
90
93
  ```
91
94
 
92
95
  The `init` command:
96
+
93
97
  - **Auto-detect mode** (default): Fetches the project linked to your current git repository
94
98
  - **Manual mode** (`--project`): Fetches a specific project by ID, bypassing git detection
95
99
  - Creates a `.braingrid/project.json` file in the `.braingrid/` directory
@@ -1,14 +1,10 @@
1
1
  /**
2
- * BUILD_ENV is set at build time and determines which configuration to use.
3
- * - 'production': Uses production URLs, ignores NODE_ENV (for npm published package)
4
- * - 'development': Allows NODE_ENV to override URLs (for local development)
2
+ * BUILD_ENV determines which configuration to use.
3
+ * - 'production': Uses production URLs (when NODE_ENV=production)
4
+ * - 'development': Uses development/local URLs (default)
5
5
  */
6
6
  export declare const BUILD_ENV: 'production' | 'development';
7
- /**
8
- * CLI_VERSION is set at build time from package.json
9
- * Used for update checks and version display
10
- */
11
- export declare const CLI_VERSION = "development";
7
+ export declare const CLI_VERSION: string;
12
8
  /**
13
9
  * Production configuration
14
10
  * Used when BUILD_ENV === 'production' (npm published package)
@@ -1 +1 @@
1
- {"version":3,"file":"build-config.d.ts","sourceRoot":"","sources":["../src/build-config.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,YAAY,GAAG,aAA6B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC"}
1
+ {"version":3,"file":"build-config.d.ts","sourceRoot":"","sources":["../src/build-config.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,YAAY,GAAG,aAC8B,CAAC;AAgBtE,eAAO,MAAM,WAAW,QAAe,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC"}
@@ -1,16 +1,29 @@
1
- // Build-time configuration constants
2
- // These values are replaced during production builds
1
+ import { readFileSync } from 'node:fs';
2
+ import { join, dirname } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
3
6
  /**
4
- * BUILD_ENV is set at build time and determines which configuration to use.
5
- * - 'production': Uses production URLs, ignores NODE_ENV (for npm published package)
6
- * - 'development': Allows NODE_ENV to override URLs (for local development)
7
+ * BUILD_ENV determines which configuration to use.
8
+ * - 'production': Uses production URLs (when NODE_ENV=production)
9
+ * - 'development': Uses development/local URLs (default)
7
10
  */
8
- export const BUILD_ENV = 'production';
11
+ export const BUILD_ENV = process.env.NODE_ENV === 'production' ? 'production' : 'development';
9
12
  /**
10
- * CLI_VERSION is set at build time from package.json
13
+ * CLI_VERSION read from package.json at runtime
11
14
  * Used for update checks and version display
12
15
  */
13
- export const CLI_VERSION = '0.0.9';
16
+ function getVersion() {
17
+ try {
18
+ const packagePath = join(__dirname, '..', 'package.json');
19
+ const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));
20
+ return pkg.version;
21
+ }
22
+ catch {
23
+ return 'unknown';
24
+ }
25
+ }
26
+ export const CLI_VERSION = getVersion();
14
27
  /**
15
28
  * Production configuration
16
29
  * Used when BUILD_ENV === 'production' (npm published package)
@@ -1 +1 @@
1
- {"version":3,"file":"build-config.js","sourceRoot":"","sources":["../src/build-config.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,qDAAqD;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAiC,aAAa,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,MAAM,EAAE,0BAA0B;IAClC,aAAa,EAAE,0CAA0C;IACzD,cAAc,EAAE,mCAAmC;CAC1C,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE,8BAA8B;IACtC,aAAa,EAAE,qDAAqD;IACpE,cAAc,EAAE,mCAAmC;CAC1C,CAAC"}
1
+ {"version":3,"file":"build-config.js","sourceRoot":"","sources":["../src/build-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC;AAEtE;;;GAGG;AACH,SAAS,UAAU;IAClB,IAAI,CAAC;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,OAAO,GAAG,CAAC,OAAO,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,MAAM,EAAE,0BAA0B;IAClC,aAAa,EAAE,0CAA0C;IACzD,cAAc,EAAE,mCAAmC;CAC1C,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE,8BAA8B;IACtC,aAAa,EAAE,qDAAqD;IACpE,cAAc,EAAE,mCAAmC;CAC1C,CAAC"}