@braingrid/cli 0.0.8 → 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 (49) hide show
  1. package/CHANGELOG.md +29 -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 +13 -4
  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/dist/services/project-service.d.ts +2 -2
  41. package/dist/services/project-service.d.ts.map +1 -1
  42. package/dist/services/project-service.js +4 -0
  43. package/dist/services/project-service.js.map +1 -1
  44. package/package.json +11 -29
  45. package/dist/.build-info.json +0 -9
  46. package/dist/test/setup.d.ts +0 -2
  47. package/dist/test/setup.d.ts.map +0 -1
  48. package/dist/test/setup.js +0 -40
  49. package/dist/test/setup.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,9 +5,24 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.9] - 2025-10-04
9
+
10
+ ### Added
11
+
12
+ - `-v` shorthand flag for `--version` command
13
+
14
+ ### Fixed
15
+
16
+ - API response handling for `project show --repo` and `project show --repo --limit` commands
17
+ - Now correctly handles `ListProjectsWithRepositoryResponse` (with `total_count`) vs `ListProjectsResponse` (with `pagination`)
18
+ - Fixed bug where optional `total_count` check could cause pagination info to not display
19
+ - Added `formatProjectListPagination()` helper function to eliminate code duplication
20
+ - Simplified `ProjectService.listProjects()` to use union type consistently
21
+
8
22
  ## [0.0.8] - 2025-10-03
9
23
 
10
24
  ### Fixed
25
+
11
26
  - Claude Code detection in `braingrid status` command with 3-tier detection strategy
12
27
  - Priority 1: Check `~/.claude/local/claude` (after `claude migrate-installer`)
13
28
  - Priority 2: Try executing `claude --version` (shell alias detection)
@@ -16,11 +31,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
31
  - Added comprehensive test coverage for all detection methods
17
32
 
18
33
  ### Changed
34
+
19
35
  - README comment alignment in usage sections for better readability
20
36
 
21
37
  ## [0.0.7] - 2025-10-03
22
38
 
23
39
  ### Added
40
+
24
41
  - `braingrid init` command to initialize repositories with BrainGrid projects
25
42
  - Auto-detects project from git remote (owner/name)
26
43
  - Manual mode with `--project <id>` to specify project by ID
@@ -42,30 +59,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
59
  - 36 new tests for init, update, and auto-detection features
43
60
 
44
61
  ### Changed
62
+
45
63
  - Updated `--repository` as primary alias for `--repo` in project show command (both still work)
46
64
  - Project configuration now stores API repository data instead of git-derived data
47
65
  - Simplified QuickStart workflow with auto-detection examples
48
66
  - Enhanced error messages to guide users to run `braingrid init` when needed
49
67
 
50
68
  ### Fixed
69
+
51
70
  - Terminal crash issue in status command by removing interactive shell flag
52
71
  - Data consistency by using API repository values instead of mixing git-derived data
53
72
 
54
73
  ## [0.0.6] - 2025-10-02
55
74
 
56
75
  ### Added
76
+
57
77
  - `/cut-release` slash command for streamlined release workflow
58
78
  - `pnpm docs:sync` command to sync CLI documentation to main BrainGrid repository
59
79
  - Repository-aware project commands with automatic git context detection
60
80
  - Collapsible installation and update command tabs in documentation
61
81
 
62
82
  ### Changed
83
+
63
84
  - Enhanced project commands to automatically detect and include git repository context
64
85
  - Improved README with spec-driven development explanation
65
86
 
66
87
  ## [0.0.5] - 2025-10-02
67
88
 
68
89
  ### Added
90
+
69
91
  - IDEA and REVIEW requirement statuses for enhanced workflow management
70
92
  - Emoji mappings: 💡 for IDEA, 👀 for REVIEW
71
93
  - Natural language keyword parsing for new statuses
@@ -74,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
74
96
  - Updated CLI help text to include new statuses
75
97
 
76
98
  ### Changed
99
+
77
100
  - RequirementStatus type now supports 6 statuses: IDEA, PLANNED, IN_PROGRESS, REVIEW, COMPLETED, CANCELLED
78
101
  - Status workflow: IDEA → PLANNED → IN_PROGRESS → REVIEW → COMPLETED/CANCELLED
79
102
  - Updated README badges to use @braingrid organization
@@ -82,6 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
82
105
  ## [0.0.4] - 2025-10-02
83
106
 
84
107
  ### Added
108
+
85
109
  - Comprehensive test coverage improvement from 26.15% to 64.9%
86
110
  - 529 passing tests covering utils, services, and handlers
87
111
  - Handler layer tests achieving 96.28% coverage (all core handlers 92-100%)
@@ -91,6 +115,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
91
115
  - CLI tools detection (Claude Code, Cursor, git)
92
116
 
93
117
  ### Changed
118
+
94
119
  - Renamed package from `@braingridai/cli` to `@braingrid/cli`
95
120
  - Updated repository URL to main braingrid repo
96
121
  - Refactored from React-based CLI to Commander.js pattern
@@ -98,6 +123,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
98
123
  - Enhanced status command with authentication, git, and tool information
99
124
 
100
125
  ### Fixed
126
+
101
127
  - Task handler number type (string for proper padding)
102
128
  - Repository URL format in package.json
103
129
  - Test coverage for all critical paths
@@ -105,14 +131,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105
131
  ## [0.0.3] - 2024-01-XX
106
132
 
107
133
  ### Changed
134
+
108
135
  - Initial npm publication as `@braingrid/cli`
109
136
 
110
137
  ## [0.0.2] - 2024-01-XX
111
138
 
112
139
  ### Changed
140
+
113
141
  - Initial version as `@braingridai/cli`
114
142
 
115
143
  ## [0.0.1] - 2024-01-XX
116
144
 
117
145
  ### Added
146
+
118
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.8';
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"}