@contextium/cli 0.6.7 → 0.7.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 +227 -227
- package/dist/commands/marketplace.d.ts +3 -0
- package/dist/commands/marketplace.d.ts.map +1 -0
- package/dist/commands/marketplace.js +178 -0
- package/dist/commands/marketplace.js.map +1 -0
- package/dist/commands/new-file.d.ts.map +1 -1
- package/dist/commands/new-file.js +4 -0
- package/dist/commands/new-file.js.map +1 -1
- package/dist/commands/setup-claude.js +3 -3
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +9 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/index.js +44 -36
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +2 -1
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/claude-permissions.d.ts +4 -0
- package/dist/lib/claude-permissions.d.ts.map +1 -0
- package/dist/lib/claude-permissions.js +41 -0
- package/dist/lib/claude-permissions.js.map +1 -0
- package/dist/lib/msal.js +18 -18
- package/dist/lib/wizard-state.d.ts +22 -0
- package/dist/lib/wizard-state.d.ts.map +1 -0
- package/dist/lib/wizard-state.js +23 -0
- package/dist/lib/wizard-state.js.map +1 -0
- package/dist/lib/wizard.d.ts +4 -0
- package/dist/lib/wizard.d.ts.map +1 -0
- package/dist/lib/wizard.js +910 -0
- package/dist/lib/wizard.js.map +1 -0
- package/package.json +62 -58
package/README.md
CHANGED
|
@@ -1,227 +1,227 @@
|
|
|
1
|
-
# Contextium CLI
|
|
2
|
-
|
|
3
|
-
Command-line interface for Contextium that allows developers to fetch and pipe documentation to external AI tools.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Build the CLI
|
|
9
|
-
npm run build
|
|
10
|
-
|
|
11
|
-
# Link for local development
|
|
12
|
-
npm link
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Setup
|
|
16
|
-
|
|
17
|
-
### 1. Initialize a Project
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Navigate to your project directory
|
|
21
|
-
cd /path/to/your/project
|
|
22
|
-
|
|
23
|
-
# Initialize Contextium with your workspace and project
|
|
24
|
-
contextium init \
|
|
25
|
-
--api-key YOUR_API_KEY \
|
|
26
|
-
--workspace your-workspace-slug \
|
|
27
|
-
--project your-project-slug \
|
|
28
|
-
--api-url http://localhost:3001/api/v1
|
|
29
|
-
|
|
30
|
-
# Or use environment variable for API key
|
|
31
|
-
export CONTEXTIUM_API_KEY=your_api_key
|
|
32
|
-
contextium init --workspace your-workspace-slug --project your-project-slug
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
This creates:
|
|
36
|
-
- `.contextiumrc` - Configuration file
|
|
37
|
-
- `.contextium-cache/` - Local cache directory
|
|
38
|
-
- Updates `.gitignore` to exclude cache directory
|
|
39
|
-
|
|
40
|
-
### 2. Sync Files
|
|
41
|
-
|
|
42
|
-
Download all project files to local cache:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Sync all files
|
|
46
|
-
contextium sync
|
|
47
|
-
|
|
48
|
-
# Sync specific files
|
|
49
|
-
contextium sync README.md API_GUIDE.md
|
|
50
|
-
|
|
51
|
-
# Sync files with specific tags
|
|
52
|
-
contextium sync --tag foundation-context --tag always-include
|
|
53
|
-
|
|
54
|
-
# Force re-download all files
|
|
55
|
-
contextium sync --force
|
|
56
|
-
|
|
57
|
-
# Dry run to see what would be synced
|
|
58
|
-
contextium sync --dry-run
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Usage
|
|
62
|
-
|
|
63
|
-
### Check Status
|
|
64
|
-
|
|
65
|
-
Check which files are cached and up-to-date:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
contextium status
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Output:
|
|
72
|
-
```
|
|
73
|
-
Project: My Project
|
|
74
|
-
Project ID: abc-123
|
|
75
|
-
Workspace: my-workspace
|
|
76
|
-
|
|
77
|
-
✓ README.md v3 (up to date)
|
|
78
|
-
↓ API_GUIDE.md v2 (v5 available, 3 versions behind)
|
|
79
|
-
? SETUP.md (not cached)
|
|
80
|
-
|
|
81
|
-
2 file(s) need update - run 'contextium sync'
|
|
82
|
-
1 file(s) not cached - run 'contextium sync'
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Output File Content
|
|
86
|
-
|
|
87
|
-
Output file content to stdout for piping to AI tools:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Output all files
|
|
91
|
-
contextium cat --all
|
|
92
|
-
|
|
93
|
-
# Output specific files
|
|
94
|
-
contextium cat README.md API_GUIDE.md
|
|
95
|
-
|
|
96
|
-
# Output files with specific tags
|
|
97
|
-
contextium cat --tag always-include
|
|
98
|
-
|
|
99
|
-
# Include metadata headers
|
|
100
|
-
contextium cat --all --with-meta
|
|
101
|
-
|
|
102
|
-
# Output as JSON
|
|
103
|
-
contextium cat --all --format json
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Pipe to External AI Tools
|
|
107
|
-
|
|
108
|
-
The primary use case - pipe documentation to AI tools like Cursor, Claude, or Copilot:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# Pipe all documentation to clipboard
|
|
112
|
-
contextium cat --all | pbcopy
|
|
113
|
-
|
|
114
|
-
# Pipe to Cursor
|
|
115
|
-
contextium cat --all | cursor --add-context
|
|
116
|
-
|
|
117
|
-
# Pipe foundation docs to Claude
|
|
118
|
-
contextium cat --tag foundation-context | claude --context
|
|
119
|
-
|
|
120
|
-
# Pipe specific files
|
|
121
|
-
contextium cat README.md API_GUIDE.md | cursor --add-context
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Search Files
|
|
125
|
-
|
|
126
|
-
Search for files in your project:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
# Search by filename or content
|
|
130
|
-
contextium search "authentication"
|
|
131
|
-
|
|
132
|
-
# Search with tag filter
|
|
133
|
-
contextium search "api" --tag backend
|
|
134
|
-
|
|
135
|
-
# Limit results
|
|
136
|
-
contextium search "guide" --limit 5
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Configuration
|
|
140
|
-
|
|
141
|
-
The `.contextiumrc` file contains your project configuration:
|
|
142
|
-
|
|
143
|
-
```json
|
|
144
|
-
{
|
|
145
|
-
"api_key": "your-api-key",
|
|
146
|
-
"api_url": "http://localhost:3001/api/v1",
|
|
147
|
-
"project_id": "project-uuid",
|
|
148
|
-
"workspace": "workspace-slug",
|
|
149
|
-
"cache": {
|
|
150
|
-
"enabled": true,
|
|
151
|
-
"ttl": 3600,
|
|
152
|
-
"directory": ".contextium-cache",
|
|
153
|
-
"max_size_mb": 100
|
|
154
|
-
},
|
|
155
|
-
"sync": {
|
|
156
|
-
"auto": true,
|
|
157
|
-
"on_command": ["build", "test"],
|
|
158
|
-
"notify_changes": true,
|
|
159
|
-
"interval": 300
|
|
160
|
-
},
|
|
161
|
-
"files": {
|
|
162
|
-
"include": [],
|
|
163
|
-
"exclude": ["DEPRECATED_*.md", "DRAFT_*.md"],
|
|
164
|
-
"tags": ["foundation-context", "always-include"],
|
|
165
|
-
"auto_include_tags": true
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## Workflow Example
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# 1. Initialize in your project
|
|
174
|
-
cd ~/projects/my-app
|
|
175
|
-
contextium init --workspace my-company --project my-app
|
|
176
|
-
|
|
177
|
-
# 2. Sync all documentation
|
|
178
|
-
contextium sync
|
|
179
|
-
|
|
180
|
-
# 3. Start coding with AI assistance
|
|
181
|
-
# Pipe all relevant docs to your AI tool
|
|
182
|
-
contextium cat --tag always-include | cursor --add-context
|
|
183
|
-
|
|
184
|
-
# 4. Update when docs change
|
|
185
|
-
contextium status # Check for updates
|
|
186
|
-
contextium sync # Download latest versions
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Cache Management
|
|
190
|
-
|
|
191
|
-
The CLI caches files locally for faster access:
|
|
192
|
-
|
|
193
|
-
- Cache directory: `.contextium-cache/`
|
|
194
|
-
- TTL: 1 hour (configurable)
|
|
195
|
-
- Auto-syncs based on configuration
|
|
196
|
-
- Use `--no-cache` flag to bypass cache
|
|
197
|
-
|
|
198
|
-
## Development
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Build
|
|
202
|
-
npm run build
|
|
203
|
-
|
|
204
|
-
# Watch mode
|
|
205
|
-
npm run dev
|
|
206
|
-
|
|
207
|
-
# Type check
|
|
208
|
-
npm run type-check
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Architecture
|
|
212
|
-
|
|
213
|
-
The CLI is designed to be a lightweight bridge between your Contextium documentation repository and external AI coding tools:
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
Your Project
|
|
217
|
-
↓
|
|
218
|
-
Contextium CLI (fetch docs)
|
|
219
|
-
↓
|
|
220
|
-
Local Cache (.contextium-cache/)
|
|
221
|
-
↓
|
|
222
|
-
Pipe to AI Tool (Cursor, Claude, Copilot)
|
|
223
|
-
↓
|
|
224
|
-
AI-assisted Development
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
For more information, see the [Platform Specification](../../Resources/CONTEXTHUB_PLATFORM_SPEC.md).
|
|
1
|
+
# Contextium CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for Contextium that allows developers to fetch and pipe documentation to external AI tools.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Build the CLI
|
|
9
|
+
npm run build
|
|
10
|
+
|
|
11
|
+
# Link for local development
|
|
12
|
+
npm link
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### 1. Initialize a Project
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Navigate to your project directory
|
|
21
|
+
cd /path/to/your/project
|
|
22
|
+
|
|
23
|
+
# Initialize Contextium with your workspace and project
|
|
24
|
+
contextium init \
|
|
25
|
+
--api-key YOUR_API_KEY \
|
|
26
|
+
--workspace your-workspace-slug \
|
|
27
|
+
--project your-project-slug \
|
|
28
|
+
--api-url http://localhost:3001/api/v1
|
|
29
|
+
|
|
30
|
+
# Or use environment variable for API key
|
|
31
|
+
export CONTEXTIUM_API_KEY=your_api_key
|
|
32
|
+
contextium init --workspace your-workspace-slug --project your-project-slug
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This creates:
|
|
36
|
+
- `.contextiumrc` - Configuration file
|
|
37
|
+
- `.contextium-cache/` - Local cache directory
|
|
38
|
+
- Updates `.gitignore` to exclude cache directory
|
|
39
|
+
|
|
40
|
+
### 2. Sync Files
|
|
41
|
+
|
|
42
|
+
Download all project files to local cache:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Sync all files
|
|
46
|
+
contextium sync
|
|
47
|
+
|
|
48
|
+
# Sync specific files
|
|
49
|
+
contextium sync README.md API_GUIDE.md
|
|
50
|
+
|
|
51
|
+
# Sync files with specific tags
|
|
52
|
+
contextium sync --tag foundation-context --tag always-include
|
|
53
|
+
|
|
54
|
+
# Force re-download all files
|
|
55
|
+
contextium sync --force
|
|
56
|
+
|
|
57
|
+
# Dry run to see what would be synced
|
|
58
|
+
contextium sync --dry-run
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
### Check Status
|
|
64
|
+
|
|
65
|
+
Check which files are cached and up-to-date:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
contextium status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Output:
|
|
72
|
+
```
|
|
73
|
+
Project: My Project
|
|
74
|
+
Project ID: abc-123
|
|
75
|
+
Workspace: my-workspace
|
|
76
|
+
|
|
77
|
+
✓ README.md v3 (up to date)
|
|
78
|
+
↓ API_GUIDE.md v2 (v5 available, 3 versions behind)
|
|
79
|
+
? SETUP.md (not cached)
|
|
80
|
+
|
|
81
|
+
2 file(s) need update - run 'contextium sync'
|
|
82
|
+
1 file(s) not cached - run 'contextium sync'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Output File Content
|
|
86
|
+
|
|
87
|
+
Output file content to stdout for piping to AI tools:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Output all files
|
|
91
|
+
contextium cat --all
|
|
92
|
+
|
|
93
|
+
# Output specific files
|
|
94
|
+
contextium cat README.md API_GUIDE.md
|
|
95
|
+
|
|
96
|
+
# Output files with specific tags
|
|
97
|
+
contextium cat --tag always-include
|
|
98
|
+
|
|
99
|
+
# Include metadata headers
|
|
100
|
+
contextium cat --all --with-meta
|
|
101
|
+
|
|
102
|
+
# Output as JSON
|
|
103
|
+
contextium cat --all --format json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Pipe to External AI Tools
|
|
107
|
+
|
|
108
|
+
The primary use case - pipe documentation to AI tools like Cursor, Claude, or Copilot:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Pipe all documentation to clipboard
|
|
112
|
+
contextium cat --all | pbcopy
|
|
113
|
+
|
|
114
|
+
# Pipe to Cursor
|
|
115
|
+
contextium cat --all | cursor --add-context
|
|
116
|
+
|
|
117
|
+
# Pipe foundation docs to Claude
|
|
118
|
+
contextium cat --tag foundation-context | claude --context
|
|
119
|
+
|
|
120
|
+
# Pipe specific files
|
|
121
|
+
contextium cat README.md API_GUIDE.md | cursor --add-context
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Search Files
|
|
125
|
+
|
|
126
|
+
Search for files in your project:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Search by filename or content
|
|
130
|
+
contextium search "authentication"
|
|
131
|
+
|
|
132
|
+
# Search with tag filter
|
|
133
|
+
contextium search "api" --tag backend
|
|
134
|
+
|
|
135
|
+
# Limit results
|
|
136
|
+
contextium search "guide" --limit 5
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Configuration
|
|
140
|
+
|
|
141
|
+
The `.contextiumrc` file contains your project configuration:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"api_key": "your-api-key",
|
|
146
|
+
"api_url": "http://localhost:3001/api/v1",
|
|
147
|
+
"project_id": "project-uuid",
|
|
148
|
+
"workspace": "workspace-slug",
|
|
149
|
+
"cache": {
|
|
150
|
+
"enabled": true,
|
|
151
|
+
"ttl": 3600,
|
|
152
|
+
"directory": ".contextium-cache",
|
|
153
|
+
"max_size_mb": 100
|
|
154
|
+
},
|
|
155
|
+
"sync": {
|
|
156
|
+
"auto": true,
|
|
157
|
+
"on_command": ["build", "test"],
|
|
158
|
+
"notify_changes": true,
|
|
159
|
+
"interval": 300
|
|
160
|
+
},
|
|
161
|
+
"files": {
|
|
162
|
+
"include": [],
|
|
163
|
+
"exclude": ["DEPRECATED_*.md", "DRAFT_*.md"],
|
|
164
|
+
"tags": ["foundation-context", "always-include"],
|
|
165
|
+
"auto_include_tags": true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Workflow Example
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# 1. Initialize in your project
|
|
174
|
+
cd ~/projects/my-app
|
|
175
|
+
contextium init --workspace my-company --project my-app
|
|
176
|
+
|
|
177
|
+
# 2. Sync all documentation
|
|
178
|
+
contextium sync
|
|
179
|
+
|
|
180
|
+
# 3. Start coding with AI assistance
|
|
181
|
+
# Pipe all relevant docs to your AI tool
|
|
182
|
+
contextium cat --tag always-include | cursor --add-context
|
|
183
|
+
|
|
184
|
+
# 4. Update when docs change
|
|
185
|
+
contextium status # Check for updates
|
|
186
|
+
contextium sync # Download latest versions
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Cache Management
|
|
190
|
+
|
|
191
|
+
The CLI caches files locally for faster access:
|
|
192
|
+
|
|
193
|
+
- Cache directory: `.contextium-cache/`
|
|
194
|
+
- TTL: 1 hour (configurable)
|
|
195
|
+
- Auto-syncs based on configuration
|
|
196
|
+
- Use `--no-cache` flag to bypass cache
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Build
|
|
202
|
+
npm run build
|
|
203
|
+
|
|
204
|
+
# Watch mode
|
|
205
|
+
npm run dev
|
|
206
|
+
|
|
207
|
+
# Type check
|
|
208
|
+
npm run type-check
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Architecture
|
|
212
|
+
|
|
213
|
+
The CLI is designed to be a lightweight bridge between your Contextium documentation repository and external AI coding tools:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
Your Project
|
|
217
|
+
↓
|
|
218
|
+
Contextium CLI (fetch docs)
|
|
219
|
+
↓
|
|
220
|
+
Local Cache (.contextium-cache/)
|
|
221
|
+
↓
|
|
222
|
+
Pipe to AI Tool (Cursor, Claude, Copilot)
|
|
223
|
+
↓
|
|
224
|
+
AI-assisted Development
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
For more information, see the [Platform Specification](../../Resources/CONTEXTHUB_PLATFORM_SPEC.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/commands/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,eAAO,MAAM,kBAAkB,SACqC,CAAA"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { ApiClient } from '../lib/api-client.js';
|
|
3
|
+
import { loadConfig } from '../lib/config.js';
|
|
4
|
+
import { chalk, ora } from '../lib/output.js';
|
|
5
|
+
export const marketplaceCommand = new Command('marketplace')
|
|
6
|
+
.description('Browse and install from the Contextium marketplace');
|
|
7
|
+
// ─── marketplace list ────────────────────────────────────────────────────────
|
|
8
|
+
marketplaceCommand
|
|
9
|
+
.command('list')
|
|
10
|
+
.description('Browse marketplace listings')
|
|
11
|
+
.option('-q, --query <text>', 'Search query')
|
|
12
|
+
.option('-t, --type <type>', 'Filter by type: skill, agent, mcp_server')
|
|
13
|
+
.option('-c, --category <category>', 'Filter by category')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
const spinner = ora('Loading marketplace...').start();
|
|
16
|
+
try {
|
|
17
|
+
const config = await loadConfig();
|
|
18
|
+
const client = new ApiClient(config.api_key, config.api_url);
|
|
19
|
+
const params = {};
|
|
20
|
+
if (options.query)
|
|
21
|
+
params.q = options.query;
|
|
22
|
+
if (options.type)
|
|
23
|
+
params.type = options.type;
|
|
24
|
+
if (options.category)
|
|
25
|
+
params.category = options.category;
|
|
26
|
+
const { data: res } = await client.get('/marketplace/listings', { params });
|
|
27
|
+
const listings = res.data || res || [];
|
|
28
|
+
spinner.stop();
|
|
29
|
+
if (listings.length === 0) {
|
|
30
|
+
const filters = [
|
|
31
|
+
options.query && `"${options.query}"`,
|
|
32
|
+
options.type && `type:${options.type}`,
|
|
33
|
+
options.category && `category:${options.category}`,
|
|
34
|
+
].filter(Boolean).join(' ');
|
|
35
|
+
console.log(chalk.yellow(`\nNo marketplace listings found${filters ? ` for ${filters}` : ''}`));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.log(chalk.bold(`\nMarketplace (${listings.length} listing${listings.length !== 1 ? 's' : ''}):\n`));
|
|
39
|
+
for (const listing of listings) {
|
|
40
|
+
const typeLabel = listing.type === 'mcp_server' ? 'mcp' : listing.type;
|
|
41
|
+
console.log(` ${chalk.cyan(listing.name)} ${chalk.dim(`[${typeLabel}]`)}`);
|
|
42
|
+
console.log(chalk.gray(` slug: ${listing.slug}`));
|
|
43
|
+
if (listing.category)
|
|
44
|
+
console.log(chalk.gray(` category: ${listing.category}`));
|
|
45
|
+
if (listing.shortDescription)
|
|
46
|
+
console.log(chalk.gray(` ${listing.shortDescription}`));
|
|
47
|
+
if (listing.installCount)
|
|
48
|
+
console.log(chalk.gray(` installs: ${listing.installCount}`));
|
|
49
|
+
if (listing.averageRating)
|
|
50
|
+
console.log(chalk.gray(` rating: ${listing.averageRating.toFixed(1)}/5`));
|
|
51
|
+
console.log();
|
|
52
|
+
}
|
|
53
|
+
console.log(chalk.dim(` Use "contextium marketplace show <slug>" for details`));
|
|
54
|
+
console.log(chalk.dim(` Use "contextium marketplace install <slug> -w <workspace>" to install`));
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
spinner.fail(`Failed to load marketplace: ${error.message}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// ─── marketplace show ─────────────────────────────────────────────────────────
|
|
62
|
+
marketplaceCommand
|
|
63
|
+
.command('show <slug>')
|
|
64
|
+
.description('Show details of a marketplace listing')
|
|
65
|
+
.action(async (slug) => {
|
|
66
|
+
const spinner = ora(`Loading ${slug}...`).start();
|
|
67
|
+
try {
|
|
68
|
+
const config = await loadConfig();
|
|
69
|
+
const client = new ApiClient(config.api_key, config.api_url);
|
|
70
|
+
const { data: res } = await client.get(`/marketplace/listings/${slug}`);
|
|
71
|
+
const listing = res.data || res;
|
|
72
|
+
spinner.stop();
|
|
73
|
+
const typeLabel = listing.type === 'mcp_server' ? 'mcp_server' : listing.type;
|
|
74
|
+
console.log(chalk.bold(`\n${listing.name} [${typeLabel}]\n`));
|
|
75
|
+
console.log(` ${chalk.dim('Slug:')} ${listing.slug}`);
|
|
76
|
+
if (listing.category)
|
|
77
|
+
console.log(` ${chalk.dim('Category:')} ${listing.category}`);
|
|
78
|
+
if (listing.installCount !== undefined)
|
|
79
|
+
console.log(` ${chalk.dim('Installs:')} ${listing.installCount}`);
|
|
80
|
+
if (listing.averageRating) {
|
|
81
|
+
console.log(` ${chalk.dim('Rating:')} ${listing.averageRating.toFixed(1)}/5 (${listing.ratingCount || 0} reviews)`);
|
|
82
|
+
}
|
|
83
|
+
if (listing.tags?.length)
|
|
84
|
+
console.log(` ${chalk.dim('Tags:')} ${listing.tags.join(', ')}`);
|
|
85
|
+
if (listing.shortDescription) {
|
|
86
|
+
console.log(`\n ${listing.shortDescription}`);
|
|
87
|
+
}
|
|
88
|
+
if (listing.longDescription) {
|
|
89
|
+
console.log(`\n${chalk.bold('Description:')}\n${listing.longDescription}`);
|
|
90
|
+
}
|
|
91
|
+
if (listing.configSchema && Object.keys(listing.configSchema).length > 0) {
|
|
92
|
+
console.log(`\n${chalk.bold('Configuration:')}`);
|
|
93
|
+
for (const [key, cfg] of Object.entries(listing.configSchema)) {
|
|
94
|
+
const req = cfg.required ? chalk.red(' (required)') : chalk.dim(' (optional)');
|
|
95
|
+
console.log(` ${chalk.cyan(key)}${req}`);
|
|
96
|
+
console.log(chalk.gray(` ${cfg.description}`));
|
|
97
|
+
if (cfg.example)
|
|
98
|
+
console.log(chalk.gray(` example: ${cfg.example}`));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (listing.versions?.length) {
|
|
102
|
+
console.log(`\n${chalk.bold('Latest Version:')} ${listing.versions[0].version}`);
|
|
103
|
+
if (listing.versions[0].changelog) {
|
|
104
|
+
console.log(chalk.gray(` ${listing.versions[0].changelog}`));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (listing.ratings?.length) {
|
|
108
|
+
console.log(`\n${chalk.bold('Recent Reviews:')}`);
|
|
109
|
+
listing.ratings.slice(0, 3).forEach((r) => {
|
|
110
|
+
console.log(` ${chalk.yellow('★'.repeat(r.rating))}${chalk.dim('★'.repeat(5 - r.rating))} ${r.review || ''}`);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
console.log();
|
|
114
|
+
console.log(chalk.dim(`Install with: contextium marketplace install ${listing.slug} -w <workspace>`));
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
spinner.fail(`Failed to load listing: ${error.message}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
// ─── marketplace install ──────────────────────────────────────────────────────
|
|
122
|
+
marketplaceCommand
|
|
123
|
+
.command('install <slug>')
|
|
124
|
+
.description('Install a marketplace listing into a workspace')
|
|
125
|
+
.requiredOption('-w, --workspace <workspace>', 'Workspace name, slug, or ID')
|
|
126
|
+
.action(async (slug, options) => {
|
|
127
|
+
const spinner = ora(`Installing ${slug}...`).start();
|
|
128
|
+
try {
|
|
129
|
+
const config = await loadConfig();
|
|
130
|
+
const client = new ApiClient(config.api_key, config.api_url);
|
|
131
|
+
// Resolve workspace name/slug → ID
|
|
132
|
+
const { data: wsRes } = await client.get('/workspaces');
|
|
133
|
+
const workspaces = wsRes.data || wsRes || [];
|
|
134
|
+
const workspace = workspaces.find((w) => w.id === options.workspace ||
|
|
135
|
+
w.slug?.toLowerCase().trim() === options.workspace.toLowerCase().trim() ||
|
|
136
|
+
w.name?.toLowerCase().trim() === options.workspace.toLowerCase().trim());
|
|
137
|
+
if (!workspace) {
|
|
138
|
+
spinner.stop();
|
|
139
|
+
console.log(chalk.dim('Available workspaces:'));
|
|
140
|
+
workspaces.forEach((w) => console.log(chalk.dim(` - ${w.name} (${w.slug})`)));
|
|
141
|
+
throw new Error(`Workspace '${options.workspace}' not found`);
|
|
142
|
+
}
|
|
143
|
+
const { data: res } = await client.post(`/marketplace/listings/${slug}/import`, {
|
|
144
|
+
workspaceId: workspace.id,
|
|
145
|
+
});
|
|
146
|
+
const result = res.data || res;
|
|
147
|
+
spinner.stop();
|
|
148
|
+
console.log(chalk.green(`\n✓ "${slug}" installed successfully!\n`));
|
|
149
|
+
if (result.type === 'skill' || result.skill) {
|
|
150
|
+
const skill = result.skill || result;
|
|
151
|
+
console.log(` Type: skill`);
|
|
152
|
+
if (skill.name)
|
|
153
|
+
console.log(` Name: ${skill.name}`);
|
|
154
|
+
if (skill.id)
|
|
155
|
+
console.log(` ID: ${skill.id}`);
|
|
156
|
+
console.log();
|
|
157
|
+
console.log(chalk.dim(` Use "contextium skills list -w ${options.workspace}" to see it`));
|
|
158
|
+
}
|
|
159
|
+
else if (result.type === 'agent' || result.agent) {
|
|
160
|
+
const agent = result.agent || result;
|
|
161
|
+
console.log(` Type: agent`);
|
|
162
|
+
if (agent.name)
|
|
163
|
+
console.log(` Name: ${agent.name}`);
|
|
164
|
+
if (agent.id)
|
|
165
|
+
console.log(` ID: ${agent.id}`);
|
|
166
|
+
console.log();
|
|
167
|
+
console.log(chalk.dim(` Use "contextium agents list -w ${options.workspace}" to see it`));
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
console.log(JSON.stringify(result, null, 2));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
spinner.fail(`Failed to install ${slug}: ${error.message}`);
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../src/commands/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;KACzD,WAAW,CAAC,oDAAoD,CAAC,CAAA;AAEpE,gFAAgF;AAEhF,kBAAkB;KACf,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,oBAAoB,EAAE,cAAc,CAAC;K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C,EAAE;gBAAE,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;YACjD,OAAO,CAAC,GAAG,EAAE,CAAA;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oCAAoC,OAAO,CAAC,SAAS,aAAa,CAAC,CAAC,CAAA;QAC5F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,qBAAqB,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-file.d.ts","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"new-file.d.ts","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,cAAc,SAoFvB,CAAA"}
|
|
@@ -48,6 +48,10 @@ export const newFileCommand = new Command('new')
|
|
|
48
48
|
if (options.fromFile) {
|
|
49
49
|
content = await fs.readFile(options.fromFile, 'utf-8');
|
|
50
50
|
}
|
|
51
|
+
if (!content) {
|
|
52
|
+
spinner.fail('File content is required. Use -c <text> to provide content or -f <filepath> to read from a local file.');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
51
55
|
const data = {
|
|
52
56
|
title: options.title,
|
|
53
57
|
path: options.path,
|