grg-kit-cli 0.2.0 → 0.3.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # grg-kit-cli
2
2
 
3
- CLI tool for pulling GRG Kit resources into your Angular project with simple, memorable commands.
3
+ CLI tool for initializing Angular projects with GRG Kit and adding blocks.
4
4
 
5
5
  ## Installation
6
6
 
@@ -11,44 +11,28 @@ npm install -g grg-kit-cli
11
11
  ## Quick Start
12
12
 
13
13
  ```bash
14
- # Interactive mode (easiest way to get started)
15
- grg
16
- # or
17
- grg interactive
18
- grg i
19
-
20
- # Or use direct commands
21
- grg init # Initialize with theme
22
- grg add theme:claude # Add specific resources
23
- grg list # Browse available resources
24
- ```
25
-
26
- ## Commands
14
+ # Initialize GRG Kit (theme + all components + spartan-ng examples)
15
+ grg init
27
16
 
28
- ### `grg` or `grg interactive` or `grg i`
17
+ # Initialize with a specific theme
18
+ grg init --theme claude
29
19
 
30
- Interactive mode - browse and add resources with a guided interface.
20
+ # Add blocks
21
+ grg add block --auth
22
+ grg add block --shell
23
+ grg add block --all
31
24
 
32
- ```bash
33
- grg
34
- grg interactive
35
- grg i
25
+ # List available resources
26
+ grg list
27
+ grg list blocks
28
+ grg list themes
36
29
  ```
37
30
 
38
- **What it does:**
39
- - Presents a simple menu to choose actions
40
- - Browse resources with descriptions
41
- - Select multiple examples at once
42
- - Minimal surface area, focused experience
43
-
44
- **Perfect for:**
45
- - First-time users
46
- - Exploring available resources
47
- - Quick resource selection
31
+ ## Commands
48
32
 
49
33
  ### `grg init`
50
34
 
51
- Initialize GRG Kit in your Angular project with themes directory and configuration.
35
+ Initialize GRG Kit in your Angular project. Downloads theme, all components, and all spartan-ng examples in one shot.
52
36
 
53
37
  ```bash
54
38
  grg init [options]
@@ -63,8 +47,10 @@ Examples:
63
47
  ```
64
48
 
65
49
  **What it does:**
66
- - Creates `src/themes` directory
50
+ - Creates `src/themes`, `src/app/components`, `src/app/spartan-examples` directories
67
51
  - Downloads the selected theme
52
+ - Downloads all GRG Kit components
53
+ - Downloads all spartan-ng examples (56+)
68
54
  - Updates `src/styles.css` with theme import
69
55
 
70
56
  **Available themes:**
@@ -75,187 +61,126 @@ Examples:
75
61
  - `amber-minimal` - Warm amber accents
76
62
  - `mocks` - Theme for mockups and prototypes
77
63
 
78
- ### `grg add <resource>`
64
+ ### `grg add block`
79
65
 
80
- Add a GRG Kit resource to your project.
66
+ Add blocks to your project.
81
67
 
82
68
  ```bash
83
- grg add <category>:<name> [options]
69
+ grg add block [options]
84
70
 
85
71
  Options:
72
+ --all Add all blocks
73
+ --auth Add authentication block (login, signup, forgot password)
74
+ --shell Add app shell block (sidebar, header, content area)
75
+ --settings Add settings block (settings page with sidebar navigation)
86
76
  -o, --output <path> Custom output directory
87
77
 
88
78
  Examples:
89
- grg add theme:claude
90
- grg add component:stepper
91
- grg add layout:dashboard
92
- grg add examples:button
93
- grg add examples:all
79
+ grg add block --auth
80
+ grg add block --shell --settings
81
+ grg add block --all
94
82
  ```
95
83
 
96
- **Resource format:** `<category>:<name>`
97
-
98
- **Categories:**
99
- - `theme` - Pre-built theme files
100
- - `component` - Reusable components
101
- - `layout` - Page layouts
102
- - `examples` - Spartan-NG component examples
103
-
104
84
  ### `grg list [category]`
105
85
 
106
- List available GRG Kit resources.
86
+ List available blocks and themes.
107
87
 
108
88
  ```bash
109
89
  grg list [category]
110
90
 
111
91
  Examples:
112
- grg list # Show all categories
92
+ grg list # Show overview
93
+ grg list blocks # List all blocks
113
94
  grg list themes # List all themes
114
- grg list components
115
- grg list layouts
116
- grg list examples
117
95
  ```
118
96
 
119
- ### `grg metadata`
97
+ ### `grg llm-prompts`
120
98
 
121
- Output structured metadata about all available commands and resources (for MCP servers and LLMs).
99
+ Generate LLM-specific prompts and rules for AI assistants (Windsurf, Cursor, etc.).
122
100
 
123
101
  ```bash
124
- grg metadata [options]
102
+ grg llm-prompts [options]
125
103
 
126
104
  Options:
127
- -f, --format <type> Output format: json, yaml (default: "json")
105
+ -o, --output <path> Output directory for rules (default: ".windsurf/rules")
128
106
 
129
107
  Examples:
130
- grg metadata
131
- grg metadata --format json
108
+ grg llm-prompts
109
+ grg llm-prompts --output .cursor/rules
132
110
  ```
133
111
 
134
- **Purpose:**
135
- This command outputs structured JSON/YAML metadata that can be consumed by:
136
- - MCP (Model Context Protocol) servers
137
- - LLMs for automated resource discovery
138
- - CI/CD pipelines
139
- - Documentation generators
140
-
141
112
  ## MCP Server Integration
142
113
 
143
- The CLI is designed to work seamlessly with MCP servers. The `metadata` command provides structured information that LLMs can use to:
114
+ For AI assistants to automatically discover and use GRG Kit resources:
115
+
116
+ ### 1. Install the MCP Server
117
+
118
+ ```bash
119
+ npm install -g @grg-kit/mcp-server
120
+ ```
144
121
 
145
- 1. **Discover available resources** - Themes, components, layouts, examples
146
- 2. **Understand command usage** - Syntax, options, examples
147
- 3. **Execute commands automatically** - Based on user intent
148
- 4. **Provide contextual help** - Descriptions, tags, dependencies
122
+ ### 2. Configure Your AI Assistant
149
123
 
150
- ### Metadata Structure
124
+ **Windsurf** (`~/.codeium/windsurf/mcp_config.json`):
151
125
 
152
126
  ```json
153
127
  {
154
- "version": "0.1.0",
155
- "name": "grg-kit-cli",
156
- "description": "CLI tool for pulling GRG Kit resources into Angular projects",
157
- "commands": [
158
- {
159
- "name": "init",
160
- "description": "Initialize GRG Kit in your Angular project",
161
- "usage": "grg init [options]",
162
- "options": [...],
163
- "examples": [...],
164
- "effects": [...]
128
+ "mcpServers": {
129
+ "grg-kit": {
130
+ "command": "grg-mcp-server"
165
131
  }
166
- ],
167
- "resources": {
168
- "themes": [...],
169
- "components": [...],
170
- "layouts": [...],
171
- "examples": {...}
172
132
  }
173
133
  }
174
134
  ```
175
135
 
176
- ## Examples
177
-
178
- ### Initialize a new project
179
-
180
- ```bash
181
- # Initialize with default theme
182
- grg init
183
-
184
- # Initialize with Claude theme
185
- grg init --theme claude
186
- ```
187
-
188
- ### Add resources
189
-
190
- ```bash
191
- # Add a different theme
192
- grg add theme:modern-minimal
193
-
194
- # Add a component
195
- grg add component:stepper
136
+ **Cursor** (`~/.cursor/mcp_config.json`):
196
137
 
197
- # Add a layout
198
- grg add layout:dashboard
199
-
200
- # Add all Spartan-NG examples
201
- grg add examples:all
202
-
203
- # Add specific component examples
204
- grg add examples:button
205
- grg add examples:dialog
206
- ```
207
-
208
- ### Browse resources
209
-
210
- ```bash
211
- # See all categories
212
- grg list
213
-
214
- # See all themes
215
- grg list themes
216
-
217
- # See all components
218
- grg list components
219
-
220
- # See all examples
221
- grg list examples
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "grg-kit": {
142
+ "command": "grg-mcp-server"
143
+ }
144
+ }
145
+ }
222
146
  ```
223
147
 
224
- ## Comparison with degit
148
+ ### 3. Generate AI Rules
225
149
 
226
- ### Before (with degit):
227
150
  ```bash
228
- npx degit gh:Genesis-Research/grg-kit/templates/ui/themes/grg-theme.css src/themes/grg-theme.css
229
- npx degit gh:Genesis-Research/grg-kit/templates/spartan-examples src/app/spartan-examples
151
+ cd your-angular-project
152
+ grg llm-prompts
230
153
  ```
231
154
 
232
- ### After (with @grg-kit/cli):
233
- ```bash
234
- grg add theme:grg-theme
235
- grg add examples:all
236
- ```
155
+ ### 4. Restart Your IDE
237
156
 
238
- **Benefits:**
239
- - āœ… Shorter, memorable commands
240
- - āœ… Built-in resource discovery
241
- - āœ… Automatic path management
242
- - āœ… Helpful error messages
243
- - āœ… MCP server integration
244
- - āœ… Structured metadata for LLMs
157
+ **What this enables:**
158
+ - āœ… AI automatically searches GRG Kit before writing custom code
159
+ - āœ… AI knows about themes, components, blocks, and examples
160
+ - āœ… AI follows GRG Kit design system patterns
161
+ - āœ… AI can install blocks directly via MCP tools
245
162
 
246
- ## Development
163
+ ## Quick Reference
247
164
 
248
165
  ```bash
249
- # Install dependencies
250
- npm install
251
-
252
- # Link for local development
253
- npm link
254
-
255
- # Test commands
256
- grg --help
257
- grg list
258
- grg metadata
166
+ # Initialize project
167
+ grg init # Default theme
168
+ grg init --theme claude # Custom theme
169
+
170
+ # Add blocks
171
+ grg add block --auth # Auth pages
172
+ grg add block --shell # App shell
173
+ grg add block --settings # Settings page
174
+ grg add block --auth --shell # Multiple blocks
175
+ grg add block --all # All blocks
176
+
177
+ # List resources
178
+ grg list # Overview
179
+ grg list blocks # Available blocks
180
+ grg list themes # Available themes
181
+
182
+ # AI setup
183
+ grg llm-prompts # Generate AI rules
259
184
  ```
260
185
 
261
186
  ## License
package/bin/grg.js CHANGED
@@ -4,53 +4,44 @@ const { Command } = require('commander');
4
4
  const { add } = require('../commands/add');
5
5
  const { list } = require('../commands/list');
6
6
  const { init } = require('../commands/init');
7
- const { metadata } = require('../commands/metadata');
8
- const { interactive } = require('../commands/interactive');
7
+ const { llmPrompts } = require('../commands/llm-prompts');
9
8
 
10
9
  const program = new Command();
11
10
 
12
11
  program
13
12
  .name('grg')
14
- .description('GRG Kit CLI - Pull themes, components, and examples into your Angular project')
15
- .version('0.1.2');
13
+ .description('GRG Kit CLI - Initialize your Angular project with GRG Kit components and add blocks')
14
+ .version('0.3.0');
16
15
 
17
- // Interactive command (default if no args)
18
- program
19
- .command('interactive', { isDefault: false })
20
- .alias('i')
21
- .description('Interactive mode - browse and add resources with a guided interface')
22
- .action(interactive);
23
-
24
- // Init command
16
+ // Init command - sets up everything in one shot
25
17
  program
26
18
  .command('init')
27
- .description('Initialize GRG Kit in your Angular project with themes directory and configuration')
19
+ .description('Initialize GRG Kit: sets up styles.css with theme, adds all components and spartan-ng examples')
28
20
  .option('-t, --theme <name>', 'Theme to install (grg-theme, claude, clean-slate, modern-minimal, amber-minimal, mocks)', 'grg-theme')
29
21
  .action(init);
30
22
 
31
- // Add command
23
+ // Add block command
32
24
  program
33
- .command('add <resource>')
34
- .description('Add a GRG Kit resource to your project')
35
- .option('-o, --output <path>', 'Output directory for the resource')
25
+ .command('add block')
26
+ .description('Add blocks to your project')
27
+ .option('--all', 'Add all blocks')
28
+ .option('--auth', 'Add authentication block (login, signup, forgot password)')
29
+ .option('--shell', 'Add app shell block (sidebar, header, content area)')
30
+ .option('--settings', 'Add settings block (settings page with sidebar navigation)')
31
+ .option('-o, --output <path>', 'Custom output directory')
36
32
  .action(add);
37
33
 
38
34
  // List command
39
35
  program
40
36
  .command('list [category]')
41
- .description('List available GRG Kit resources (themes, components, layouts, examples)')
37
+ .description('List available blocks and components')
42
38
  .action(list);
43
39
 
44
- // Metadata command (for MCP server integration)
40
+ // LLM Prompts command
45
41
  program
46
- .command('metadata')
47
- .description('Output structured metadata about all available commands and resources (JSON format for MCP servers)')
48
- .option('-f, --format <type>', 'Output format (json, yaml)', 'json')
49
- .action(metadata);
50
-
51
- // If no command provided, run interactive mode
52
- if (process.argv.length === 2) {
53
- interactive();
54
- } else {
55
- program.parse();
56
- }
42
+ .command('llm-prompts')
43
+ .description('Generate LLM-specific prompts and rules for AI assistants (Windsurf, Cursor, etc.)')
44
+ .option('-o, --output <path>', 'Output directory for rules', '.windsurf/rules')
45
+ .action(llmPrompts);
46
+
47
+ program.parse();
package/commands/add.js CHANGED
@@ -4,122 +4,80 @@ const ora = require('ora');
4
4
  const { RESOURCES, REPO } = require('../config/resources');
5
5
 
6
6
  /**
7
- * Add command - downloads a specific resource
8
- * Format: grg add <category>:<name>
7
+ * Add command - downloads blocks
8
+ * Format: grg add block [options]
9
9
  * Examples:
10
- * grg add theme:claude
11
- * grg add component:stepper
12
- * grg add examples:button
13
- * grg add examples:all
10
+ * grg add block --auth
11
+ * grg add block --shell --settings
12
+ * grg add block --all
14
13
  */
15
- async function add(resource, options) {
16
- const [category, name] = resource.split(':');
14
+ async function add(options) {
15
+ // Determine which blocks to add
16
+ const blocksToAdd = [];
17
+
18
+ if (options.all) {
19
+ blocksToAdd.push(...RESOURCES.blocks);
20
+ } else {
21
+ if (options.auth) {
22
+ const block = RESOURCES.blocks.find(b => b.name === 'auth');
23
+ if (block) blocksToAdd.push(block);
24
+ }
25
+ if (options.shell) {
26
+ const block = RESOURCES.blocks.find(b => b.name === 'shell');
27
+ if (block) blocksToAdd.push(block);
28
+ }
29
+ if (options.settings) {
30
+ const block = RESOURCES.blocks.find(b => b.name === 'settings');
31
+ if (block) blocksToAdd.push(block);
32
+ }
33
+ }
17
34
 
18
- if (!category || !name) {
19
- console.error(chalk.red('Error: Invalid resource format. Use <category>:<name>'));
20
- console.log(chalk.yellow('Examples:'));
21
- console.log(' grg add theme:claude');
22
- console.log(' grg add component:stepper');
23
- console.log(' grg add examples:button');
24
- console.log(' grg add examples:all');
35
+ if (blocksToAdd.length === 0) {
36
+ console.log(chalk.yellow('\nNo blocks specified. Use one of the following options:\n'));
37
+ console.log(chalk.cyan(' grg add block --all'), chalk.gray(' Add all blocks'));
38
+ console.log(chalk.cyan(' grg add block --auth'), chalk.gray(' Add authentication block'));
39
+ console.log(chalk.cyan(' grg add block --shell'), chalk.gray(' Add app shell block'));
40
+ console.log(chalk.cyan(' grg add block --settings'), chalk.gray(' Add settings block'));
41
+ console.log(chalk.gray('\nRun'), chalk.cyan('grg list blocks'), chalk.gray('for more details'));
25
42
  process.exit(1);
26
43
  }
27
44
 
28
- let resourceData;
29
- let sourcePath;
30
- let outputPath;
31
-
32
- // Find the resource
33
- switch (category) {
34
- case 'theme':
35
- resourceData = RESOURCES.themes.find(t => t.name === name);
36
- if (resourceData) {
37
- sourcePath = resourceData.path;
38
- outputPath = options.output || resourceData.defaultOutput;
39
- }
40
- break;
41
-
42
- case 'component':
43
- resourceData = RESOURCES.components.find(c => c.name === name);
44
- if (resourceData) {
45
- sourcePath = resourceData.path;
46
- outputPath = options.output || resourceData.defaultOutput;
47
- }
48
- break;
49
-
50
- case 'layout':
51
- resourceData = RESOURCES.layouts.find(l => l.name === name);
52
- if (resourceData) {
53
- sourcePath = resourceData.path;
54
- outputPath = options.output || resourceData.defaultOutput;
55
- }
56
- break;
57
-
58
- case 'examples':
59
- if (name === 'all') {
60
- resourceData = RESOURCES.examples.all;
61
- sourcePath = resourceData.path;
62
- outputPath = options.output || resourceData.defaultOutput;
63
- } else {
64
- resourceData = RESOURCES.examples.components.find(e => e.name === name);
65
- if (resourceData) {
66
- sourcePath = resourceData.path;
67
- outputPath = options.output || resourceData.defaultOutput;
68
- }
69
- }
70
- break;
71
-
72
- default:
73
- console.error(chalk.red(`Error: Unknown category "${category}"`));
74
- console.log(chalk.yellow('Valid categories: theme, component, layout, examples'));
75
- process.exit(1);
76
- }
45
+ console.log(chalk.bold.cyan(`\nšŸ“¦ Adding ${blocksToAdd.length} block(s)\n`));
77
46
 
78
- if (!resourceData) {
79
- console.error(chalk.red(`Error: Resource "${name}" not found in category "${category}"`));
80
- console.log(chalk.yellow(`\nRun ${chalk.cyan('grg list ' + category + 's')} to see available resources`));
81
- process.exit(1);
82
- }
47
+ const spinner = ora();
83
48
 
84
- // Download the resource
85
- const spinner = ora(`Downloading ${resourceData.title}...`).start();
49
+ for (const block of blocksToAdd) {
50
+ const outputPath = options.output
51
+ ? `${options.output}/${block.name}`
52
+ : block.defaultOutput;
86
53
 
87
- try {
88
- const emitter = degit(`${REPO}/${sourcePath}`, {
89
- cache: false,
90
- force: true,
91
- verbose: false,
92
- });
54
+ spinner.start(`Downloading ${block.title}...`);
93
55
 
94
- await emitter.clone(outputPath);
56
+ try {
57
+ const emitter = degit(`${REPO}/${block.path}`, {
58
+ cache: false,
59
+ force: true,
60
+ verbose: false,
61
+ });
95
62
 
96
- spinner.succeed(chalk.green(`āœ“ ${resourceData.title} added successfully!`));
97
- console.log(chalk.gray(` Location: ${outputPath}`));
98
-
99
- if (resourceData.description) {
100
- console.log(chalk.gray(` ${resourceData.description}`));
101
- }
63
+ await emitter.clone(outputPath);
102
64
 
103
- // Show next steps for themes
104
- if (category === 'theme') {
105
- console.log(chalk.yellow('\nNext steps:'));
106
- console.log(chalk.gray(` 1. Import the theme in your src/styles.css:`));
107
- console.log(chalk.cyan(` @import './${outputPath.replace('src/', '')}';`));
108
- }
65
+ spinner.succeed(chalk.green(`āœ“ ${block.title} added`));
66
+ console.log(chalk.gray(` Location: ${outputPath}`));
67
+
68
+ // Show dependencies if any
69
+ if (block.dependencies && block.dependencies.length > 0) {
70
+ console.log(chalk.gray(` Dependencies: ${block.dependencies.join(', ')}`));
71
+ }
72
+ console.log();
109
73
 
110
- // Show dependencies if any
111
- if (resourceData.dependencies && resourceData.dependencies.length > 0) {
112
- console.log(chalk.yellow('\nRequired dependencies:'));
113
- resourceData.dependencies.forEach(dep => {
114
- console.log(chalk.gray(` - ${dep}`));
115
- });
74
+ } catch (error) {
75
+ spinner.fail(chalk.red(`Failed to download ${block.title}`));
76
+ console.error(chalk.red(error.message));
116
77
  }
117
-
118
- } catch (error) {
119
- spinner.fail(chalk.red('Failed to download resource'));
120
- console.error(chalk.red(error.message));
121
- process.exit(1);
122
78
  }
79
+
80
+ console.log(chalk.bold.green('✨ Done!'));
123
81
  }
124
82
 
125
83
  module.exports = { add };