@khoaha/spek-cli 1.0.3 → 1.0.5

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 (56) hide show
  1. package/dist/commands/svg-to-vd/handler.d.ts +14 -0
  2. package/dist/commands/svg-to-vd/handler.d.ts.map +1 -0
  3. package/dist/commands/svg-to-vd/handler.js +119 -0
  4. package/dist/commands/svg-to-vd/handler.js.map +1 -0
  5. package/dist/config/manager.d.ts +18 -0
  6. package/dist/config/manager.d.ts.map +1 -0
  7. package/dist/config/manager.js +53 -0
  8. package/dist/config/manager.js.map +1 -0
  9. package/dist/directus/client.d.ts +14 -0
  10. package/dist/directus/client.d.ts.map +1 -0
  11. package/dist/directus/client.js +81 -0
  12. package/dist/directus/client.js.map +1 -0
  13. package/dist/download/handler.d.ts +6 -0
  14. package/dist/download/handler.d.ts.map +1 -0
  15. package/dist/download/handler.js +100 -0
  16. package/dist/download/handler.js.map +1 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +209 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/prompts/index.d.ts +14 -0
  22. package/dist/prompts/index.d.ts.map +1 -0
  23. package/dist/prompts/index.js +69 -0
  24. package/dist/prompts/index.js.map +1 -0
  25. package/dist/types/index.d.ts +67 -0
  26. package/dist/types/index.d.ts.map +1 -0
  27. package/dist/types/index.js +2 -0
  28. package/dist/types/index.js.map +1 -0
  29. package/dist/utils/file-utils.d.ts +28 -0
  30. package/dist/utils/file-utils.d.ts.map +1 -0
  31. package/dist/utils/file-utils.js +61 -0
  32. package/dist/utils/file-utils.js.map +1 -0
  33. package/dist/utils/svg-converter.d.ts +44 -0
  34. package/dist/utils/svg-converter.d.ts.map +1 -0
  35. package/dist/utils/svg-converter.js +149 -0
  36. package/dist/utils/svg-converter.js.map +1 -0
  37. package/package.json +7 -1
  38. package/docs/ARCHITECTURE.md +0 -286
  39. package/docs/PUBLISH_QUICK_REFERENCE.md +0 -135
  40. package/docs/SVG_TO_VECTOR_DRAWABLE.md +0 -186
  41. package/docs/TESTING.md +0 -429
  42. package/docs/USAGE_EXAMPLES.md +0 -520
  43. package/docs/WINDOWS_DEVELOPMENT.md +0 -487
  44. package/docs/WORKFLOW.md +0 -479
  45. package/scripts/publish.ps1 +0 -193
  46. package/scripts/publish.sh +0 -170
  47. package/src/commands/svg-to-vd/handler.ts +0 -131
  48. package/src/config/manager.ts +0 -58
  49. package/src/directus/client.ts +0 -101
  50. package/src/download/handler.ts +0 -116
  51. package/src/index.ts +0 -231
  52. package/src/prompts/index.ts +0 -76
  53. package/src/types/index.ts +0 -72
  54. package/src/utils/file-utils.ts +0 -69
  55. package/src/utils/svg-converter.ts +0 -196
  56. package/tsconfig.json +0 -20
package/docs/WORKFLOW.md DELETED
@@ -1,479 +0,0 @@
1
- # Complete Workflow with CLI Tool
2
-
3
- ## Overview
4
-
5
- This document illustrates how the CLI tool fits into the complete SpeX ecosystem workflow.
6
-
7
- ## Architecture Diagram
8
-
9
- ```mermaid
10
- graph TB
11
- subgraph "Design Phase"
12
- A[Figma Design] --> B[SpeX Plugin]
13
- end
14
-
15
- subgraph "Export Options"
16
- B --> C{Export Destination}
17
- C -->|Local| D[Local File System]
18
- C -->|Vault| E[Directus Vault]
19
- end
20
-
21
- subgraph "Distribution"
22
- E --> F[File ID Generated]
23
- F --> G[Share File ID]
24
- G --> H[Team Members]
25
- end
26
-
27
- subgraph "Download & Access"
28
- H --> I[CLI Tool]
29
- I --> J[npx spek-cli -d file-id]
30
- J --> K[Download from Directus]
31
- K --> L[Extract to Local Directory]
32
- end
33
-
34
- subgraph "Development"
35
- D --> M[MCP Server]
36
- L --> M
37
- M --> N[Cursor AI]
38
- N --> O[AI-Powered Code Generation]
39
- end
40
-
41
- style B fill:#6A5AE0,stroke:#333,color:#fff
42
- style E fill:#10B981,stroke:#333,color:#fff
43
- style I fill:#F59E0B,stroke:#333,color:#fff
44
- style N fill:#3B82F6,stroke:#333,color:#fff
45
- ```
46
-
47
- ## Detailed Workflow
48
-
49
- ### Phase 1: Design & Export
50
-
51
- ```mermaid
52
- sequenceDiagram
53
- participant Designer
54
- participant Figma
55
- participant Plugin
56
- participant Directus
57
-
58
- Designer->>Figma: Create component library
59
- Designer->>Plugin: Open SpeX plugin
60
- Designer->>Plugin: Configure export settings
61
- Designer->>Plugin: Select "Export to Vault"
62
- Plugin->>Directus: Upload ZIP file
63
- Directus-->>Plugin: Return file ID
64
- Plugin->>Designer: Show success dialog with file ID
65
- ```
66
-
67
- **Actions:**
68
- 1. Designer creates components in Figma
69
- 2. Opens SpeX plugin
70
- 3. Configures metadata (optional)
71
- 4. Clicks "Export to Vault"
72
- 5. Plugin uploads to Directus
73
- 6. Designer receives file ID
74
-
75
- ### Phase 2: Distribution
76
-
77
- ```mermaid
78
- graph LR
79
- A[Designer] --> B[Copy File ID]
80
- B --> C[Share via Slack/Email]
81
- C --> D[Developer 1]
82
- C --> E[Developer 2]
83
- C --> F[Developer N]
84
-
85
- style A fill:#6A5AE0,stroke:#333,color:#fff
86
- style D fill:#10B981,stroke:#333,color:#fff
87
- style E fill:#10B981,stroke:#333,color:#fff
88
- style F fill:#10B981,stroke:#333,color:#fff
89
- ```
90
-
91
- **Actions:**
92
- 1. Designer copies file ID from plugin
93
- 2. Shares via team communication channel
94
- 3. Multiple developers can access same specs
95
-
96
- ### Phase 3: Download with CLI
97
-
98
- ```mermaid
99
- sequenceDiagram
100
- participant Dev as Developer
101
- participant CLI as CLI Tool
102
- participant Config as Config File
103
- participant Directus
104
- participant FS as File System
105
-
106
- Dev->>CLI: npx spek-cli -d abc123
107
-
108
- alt First Run
109
- CLI->>Dev: Prompt: Directus URL?
110
- Dev->>CLI: https://company.directus.app
111
- CLI->>Dev: Prompt: Access Token?
112
- Dev->>CLI: token_xyz...
113
- CLI->>Config: Save config
114
- end
115
-
116
- CLI->>Config: Load config
117
- CLI->>Directus: Authenticate & download
118
- Directus-->>CLI: ZIP file
119
- CLI->>FS: Extract to current directory
120
- CLI->>Dev: ✓ Success!
121
- ```
122
-
123
- **Actions:**
124
- 1. Developer runs CLI command with file ID
125
- 2. First-time setup (if needed)
126
- 3. CLI downloads from Directus
127
- 4. Files extracted to current directory
128
-
129
- ### Phase 4: AI-Powered Development
130
-
131
- ```mermaid
132
- sequenceDiagram
133
- participant Dev as Developer
134
- participant Cursor as Cursor AI
135
- participant MCP as MCP Server
136
- participant Specs as Spec Files
137
-
138
- Dev->>MCP: Start MCP server
139
- MCP->>Specs: Load specifications
140
- Dev->>Cursor: Open project
141
- Cursor->>MCP: Connect via MCP protocol
142
-
143
- Dev->>Cursor: "Generate Button component"
144
- Cursor->>MCP: Query button specs
145
- MCP-->>Cursor: Return button specification
146
- Cursor->>Cursor: Generate code from specs
147
- Cursor-->>Dev: Show generated code
148
-
149
- Dev->>Cursor: Accept & apply
150
- ```
151
-
152
- **Actions:**
153
- 1. Developer starts MCP server
154
- 2. Opens Cursor AI
155
- 3. Asks AI to generate components
156
- 4. AI queries specs via MCP
157
- 5. AI generates code matching design system
158
-
159
- ## Use Case Scenarios
160
-
161
- ### Scenario 1: Solo Developer
162
-
163
- ```
164
- Designer/Developer → Figma → Plugin → Export Local → MCP Server → Cursor AI
165
- ```
166
-
167
- **Workflow:**
168
- - Same person designs and codes
169
- - Exports directly to local file system
170
- - No need for CLI tool
171
- - Direct MCP integration
172
-
173
- ### Scenario 2: Small Team (2-5 people)
174
-
175
- ```
176
- Designer → Figma → Plugin → Export to Vault → Share File ID
177
-
178
- Developer 1 ← CLI Tool ← File ID |
179
- Developer 2 ← CLI Tool ← File ID ←-------------------+
180
- ```
181
-
182
- **Workflow:**
183
- - Designer exports to Directus vault
184
- - Shares file ID via Slack
185
- - Each developer downloads with CLI
186
- - Developers use MCP for AI integration
187
-
188
- ### Scenario 3: Large Team (5+ people)
189
-
190
- ```
191
- Design Team → Figma → Plugin → Export to Vault → File ID in Wiki/Docs
192
-
193
- Dev Team (many) ← CLI Tool ← File ID from Documentation
194
-
195
- CI/CD Pipeline (automated download)
196
- ```
197
-
198
- **Workflow:**
199
- - Design team maintains component library
200
- - Regular exports to vault
201
- - File IDs documented in team wiki
202
- - Developers download as needed
203
- - CI/CD automates spec downloads
204
-
205
- ### Scenario 4: CI/CD Integration
206
-
207
- ```
208
- GitHub Actions → CLI Tool → Download Specs → Commit to Repo → Deploy
209
- ```
210
-
211
- **Workflow:**
212
- - Automated workflow triggered manually or on schedule
213
- - CLI downloads latest specs
214
- - Commits to repository
215
- - Triggers deployment pipeline
216
-
217
- ## Comparison: Local vs. Vault Export
218
-
219
- ### Local Export
220
-
221
- **Pros:**
222
- - ✅ Immediate access
223
- - ✅ No external dependencies
224
- - ✅ Works offline
225
- - ✅ No authentication needed
226
-
227
- **Cons:**
228
- - ❌ Manual file sharing
229
- - ❌ Version control challenges
230
- - ❌ No centralized storage
231
- - ❌ Difficult for teams
232
-
233
- **Best For:**
234
- - Solo developers
235
- - Quick prototypes
236
- - Offline work
237
- - Simple projects
238
-
239
- ### Vault Export (with CLI)
240
-
241
- **Pros:**
242
- - ✅ Centralized storage
243
- - ✅ Easy sharing (just file ID)
244
- - ✅ Version history in Directus
245
- - ✅ Access control
246
- - ✅ Team collaboration
247
-
248
- **Cons:**
249
- - ❌ Requires Directus instance
250
- - ❌ Needs authentication
251
- - ❌ Requires internet connection
252
- - ❌ Extra step (CLI download)
253
-
254
- **Best For:**
255
- - Team projects
256
- - Enterprise environments
257
- - Version control needs
258
- - Distributed teams
259
-
260
- ## Integration Points
261
-
262
- ### 1. Figma Plugin ↔ Directus
263
-
264
- **Protocol:** Directus SDK (REST API)
265
-
266
- **Flow:**
267
- ```
268
- Plugin → Directus SDK → POST /files → Upload ZIP → Return file ID
269
- ```
270
-
271
- ### 2. CLI Tool ↔ Directus
272
-
273
- **Protocol:** Directus SDK (REST API)
274
-
275
- **Flow:**
276
- ```
277
- CLI → Directus SDK → GET /assets/:id → Download ZIP → Extract
278
- ```
279
-
280
- ### 3. MCP Server ↔ Cursor AI
281
-
282
- **Protocol:** Model Context Protocol (stdio)
283
-
284
- **Flow:**
285
- ```
286
- Cursor → MCP Request → Read Spec Files → MCP Response → Cursor
287
- ```
288
-
289
- ### 4. Plugin ↔ MCP Server (Optional)
290
-
291
- **Protocol:** WebSocket
292
-
293
- **Flow:**
294
- ```
295
- Plugin → WebSocket → Send Specs → MCP Server → Serve to Cursor
296
- ```
297
-
298
- ## Configuration Requirements
299
-
300
- ### For Plugin (Vault Export)
301
-
302
- ```json
303
- {
304
- "directusUrl": "https://company.directus.app",
305
- "accessToken": "plugin_token_xyz",
306
- "collectionName": "figma_specs",
307
- "folderName": "Design Specs"
308
- }
309
- ```
310
-
311
- ### For CLI Tool
312
-
313
- ```json
314
- {
315
- "directusUrl": "https://company.directus.app",
316
- "accessToken": "cli_token_xyz",
317
- "createdAt": "2026-02-13T..."
318
- }
319
- ```
320
-
321
- **Note:** Plugin and CLI can use different tokens with different permissions.
322
-
323
- ### For MCP Server
324
-
325
- ```json
326
- {
327
- "mcpServers": {
328
- "spex-local": {
329
- "command": "npx",
330
- "args": ["-y", "spex-mcp", "--mode", "local", "--port", "8080"]
331
- }
332
- }
333
- }
334
- ```
335
-
336
- ## Security Considerations
337
-
338
- ### Access Tokens
339
-
340
- **Plugin Token:**
341
- - Needs: `files:create`, `items:create`
342
- - Purpose: Upload specs to vault
343
- - Scope: Write access to specific collection
344
-
345
- **CLI Token:**
346
- - Needs: `files:read`
347
- - Purpose: Download specs from vault
348
- - Scope: Read access to files
349
-
350
- **Best Practice:**
351
- - Use separate tokens for plugin and CLI
352
- - Restrict permissions to minimum required
353
- - Rotate tokens regularly
354
- - Store in secure configuration files
355
-
356
- ### File Sharing
357
-
358
- **File ID Sharing:**
359
- - File IDs are UUIDs (not sequential)
360
- - Difficult to guess
361
- - Still requires authentication to download
362
- - Can be shared via any channel
363
-
364
- **Access Control:**
365
- - Directus handles authentication
366
- - File permissions managed in Directus
367
- - Can restrict by user/role
368
- - Audit logs available
369
-
370
- ## Performance Considerations
371
-
372
- ### Download Speed
373
-
374
- **Factors:**
375
- - Network bandwidth
376
- - Directus server location
377
- - File size (typically 1-10MB)
378
- - Compression ratio
379
-
380
- **Typical Times:**
381
- - Small specs (<1MB): 1-3 seconds
382
- - Medium specs (1-5MB): 3-10 seconds
383
- - Large specs (5-10MB): 10-30 seconds
384
-
385
- ### Extraction Speed
386
-
387
- **Factors:**
388
- - Disk I/O speed
389
- - Number of files in ZIP
390
- - Directory structure depth
391
-
392
- **Typical Times:**
393
- - Most specs: <1 second
394
- - Large specs: 1-3 seconds
395
-
396
- ## Troubleshooting
397
-
398
- ### Common Issues
399
-
400
- **1. Authentication Failed**
401
- ```bash
402
- ❌ Error: Authentication failed. Please check your access token.
403
-
404
- Solution:
405
- 1. Check token is valid in Directus
406
- 2. Verify token has files:read permission
407
- 3. Reset config: rm ~/.spek-cli/config.json
408
- ```
409
-
410
- **2. File Not Found**
411
- ```bash
412
- ❌ Error: File not found: abc123
413
-
414
- Solution:
415
- 1. Verify file ID is correct
416
- 2. Check file exists in Directus
417
- 3. Ensure you have permission to access file
418
- ```
419
-
420
- **3. Network Error**
421
- ```bash
422
- ❌ Error: Failed to download file: Network request failed
423
-
424
- Solution:
425
- 1. Check internet connection
426
- 2. Verify Directus URL is accessible
427
- 3. Check firewall/proxy settings
428
- ```
429
-
430
- **4. Overwrite Prompt Not Showing**
431
- ```bash
432
- # Files extracted without prompt
433
-
434
- Reason:
435
- - No conflicting files in current directory
436
- - Only prompts if files would be overwritten
437
- ```
438
-
439
- ## Future Enhancements
440
-
441
- ### Planned Features
442
-
443
- 1. **Progress Bar**
444
- - Show download progress
445
- - Estimate time remaining
446
-
447
- 2. **Multiple Instances**
448
- - Support multiple Directus instances
449
- - Switch between configs easily
450
-
451
- 3. **Batch Download**
452
- - Download multiple file IDs at once
453
- - Parallel downloads
454
-
455
- 4. **Custom Output**
456
- - Specify extraction directory
457
- - Organize by version/date
458
-
459
- 5. **Integration Commands**
460
- - `spek-cli list` - List available files
461
- - `spek-cli search` - Search by metadata
462
- - `spek-cli history` - Download history
463
-
464
- ## Conclusion
465
-
466
- The CLI tool completes the SpeX ecosystem by providing:
467
-
468
- 1. **Easy Distribution:** Share specs via simple file ID
469
- 2. **Team Collaboration:** Multiple developers access same specs
470
- 3. **Version Control:** Directus manages spec versions
471
- 4. **Automation:** CI/CD integration possible
472
- 5. **Security:** Access control via Directus
473
-
474
- **Complete Workflow:**
475
- ```
476
- Design → Export → Share → Download → Develop
477
- ↓ ↓ ↓ ↓ ↓
478
- Figma Plugin File ID CLI Tool Cursor AI
479
- ```
@@ -1,193 +0,0 @@
1
- ##############################################################################
2
- # npm Publish Script (Windows PowerShell)
3
- #
4
- # Usage:
5
- # .\scripts\publish.ps1 [version]
6
- #
7
- # Arguments:
8
- # version - One of: patch, minor, major, or specific version (e.g., 1.2.3)
9
- # Default: patch
10
- #
11
- # Environment Variables:
12
- # NPM_ACCESS_TOKEN - Required for authentication (set in .env)
13
- #
14
- # Examples:
15
- # .\scripts\publish.ps1 # Bump patch version (1.0.0 -> 1.0.1)
16
- # .\scripts\publish.ps1 minor # Bump minor version (1.0.0 -> 1.1.0)
17
- # .\scripts\publish.ps1 major # Bump major version (1.0.0 -> 2.0.0)
18
- # .\scripts\publish.ps1 2.5.3 # Set specific version
19
- ##############################################################################
20
-
21
- param(
22
- [string]$VersionType = "patch"
23
- )
24
-
25
- $ErrorActionPreference = "Stop"
26
-
27
- # Script directory
28
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
29
- $ProjectDir = Split-Path -Parent $ScriptDir
30
-
31
- # Load .env file if exists
32
- $EnvFile = Join-Path $ProjectDir ".env"
33
- if (Test-Path $EnvFile) {
34
- Write-Host "Loading .env file..." -ForegroundColor Blue
35
- Get-Content $EnvFile | ForEach-Object {
36
- if ($_ -match '^([^#][^=]+)=(.+)$') {
37
- $name = $matches[1].Trim()
38
- $value = $matches[2].Trim()
39
- [Environment]::SetEnvironmentVariable($name, $value, "Process")
40
- }
41
- }
42
- }
43
-
44
- # Check for NPM_ACCESS_TOKEN
45
- if (-not $env:NPM_ACCESS_TOKEN) {
46
- Write-Host "❌ Error: NPM_ACCESS_TOKEN not found" -ForegroundColor Red
47
- Write-Host "Please set NPM_ACCESS_TOKEN in .env file" -ForegroundColor Yellow
48
- exit 1
49
- }
50
-
51
- # Validate version type
52
- if ($VersionType -notmatch '^(patch|minor|major|[0-9]+\.[0-9]+\.[0-9]+)$') {
53
- Write-Host "❌ Invalid version type: $VersionType" -ForegroundColor Red
54
- Write-Host "Use: patch, minor, major, or specific version (e.g., 1.2.3)" -ForegroundColor Yellow
55
- exit 1
56
- }
57
-
58
- Write-Host ""
59
- Write-Host "╔══════════════════════════════════════╗" -ForegroundColor Blue
60
- Write-Host "║ 📦 npm Publish Script ║" -ForegroundColor Blue
61
- Write-Host "╚══════════════════════════════════════╝" -ForegroundColor Blue
62
- Write-Host ""
63
-
64
- # Step 1: Check git status
65
- Write-Host "1️⃣ Checking git status..." -ForegroundColor Blue
66
- $gitStatus = git status --porcelain
67
- if ($gitStatus) {
68
- Write-Host "⚠️ Warning: You have uncommitted changes" -ForegroundColor Yellow
69
- $response = Read-Host "Continue anyway? (y/N)"
70
- if ($response -ne 'y' -and $response -ne 'Y') {
71
- Write-Host "❌ Aborted" -ForegroundColor Red
72
- exit 1
73
- }
74
- }
75
- Write-Host "✓ Git status checked" -ForegroundColor Green
76
- Write-Host ""
77
-
78
- # Step 2: Clean install
79
- Write-Host "2️⃣ Clean install dependencies..." -ForegroundColor Blue
80
- if (Test-Path "node_modules") {
81
- Remove-Item -Recurse -Force "node_modules"
82
- }
83
- if (Test-Path "package-lock.json") {
84
- Remove-Item -Force "package-lock.json"
85
- }
86
- npm install
87
- Write-Host "✓ Dependencies installed" -ForegroundColor Green
88
- Write-Host ""
89
-
90
- # Step 3: Build
91
- Write-Host "3️⃣ Building TypeScript..." -ForegroundColor Blue
92
- npm run build
93
- if (-not (Test-Path "dist")) {
94
- Write-Host "❌ Error: dist/ directory not found after build" -ForegroundColor Red
95
- exit 1
96
- }
97
- Write-Host "✓ Build successful" -ForegroundColor Green
98
- Write-Host ""
99
-
100
- # Step 4: Test build output
101
- Write-Host "4️⃣ Testing build output..." -ForegroundColor Blue
102
- if (-not (Test-Path "dist\index.js")) {
103
- Write-Host "❌ Error: dist\index.js not found" -ForegroundColor Red
104
- exit 1
105
- }
106
- try {
107
- node dist\index.js --version | Out-Null
108
- } catch {
109
- Write-Host "⚠️ Warning: Version check failed (might be expected)" -ForegroundColor Yellow
110
- }
111
- Write-Host "✓ Build output verified" -ForegroundColor Green
112
- Write-Host ""
113
-
114
- # Step 5: Bump version
115
- Write-Host "5️⃣ Bumping version ($VersionType)..." -ForegroundColor Blue
116
- npm version $VersionType --no-git-tag-version
117
- $packageJson = Get-Content "package.json" | ConvertFrom-Json
118
- $newVersion = $packageJson.version
119
- Write-Host "✓ Version bumped to: $newVersion" -ForegroundColor Green
120
- Write-Host ""
121
-
122
- # Step 6: Create .npmrc with token
123
- Write-Host "6️⃣ Configuring npm authentication..." -ForegroundColor Blue
124
- $npmrcPath = Join-Path $ProjectDir ".npmrc"
125
- "//registry.npmjs.org/:_authToken=$env:NPM_ACCESS_TOKEN" | Out-File -FilePath $npmrcPath -Encoding ASCII
126
- Write-Host "✓ npm authentication configured" -ForegroundColor Green
127
- Write-Host ""
128
-
129
- # Step 7: Dry run publish
130
- Write-Host "7️⃣ Running dry-run publish..." -ForegroundColor Blue
131
- npm publish --dry-run
132
- Write-Host "✓ Dry-run successful" -ForegroundColor Green
133
- Write-Host ""
134
-
135
- # Step 8: Confirm publish
136
- Write-Host "┌────────────────────────────────────┐" -ForegroundColor Yellow
137
- Write-Host "│ Ready to publish v$newVersion" -ForegroundColor Yellow
138
- Write-Host "│ Package: spek-cli │" -ForegroundColor Yellow
139
- Write-Host "└────────────────────────────────────┘" -ForegroundColor Yellow
140
- Write-Host ""
141
- $response = Read-Host "Proceed with publish? (y/N)"
142
- if ($response -ne 'y' -and $response -ne 'Y') {
143
- Write-Host "❌ Publish cancelled" -ForegroundColor Red
144
- Remove-Item -Force $npmrcPath
145
- exit 1
146
- }
147
-
148
- # Step 9: Publish to npm
149
- Write-Host "9️⃣ Publishing to npm..." -ForegroundColor Blue
150
- npm publish --access public
151
- Write-Host "✓ Published successfully!" -ForegroundColor Green
152
- Write-Host ""
153
-
154
- # Step 10: Cleanup
155
- Write-Host "🧹 Cleaning up..." -ForegroundColor Blue
156
- Remove-Item -Force $npmrcPath
157
- Write-Host "✓ Cleanup complete" -ForegroundColor Green
158
- Write-Host ""
159
-
160
- # Step 11: Create git tag
161
- Write-Host "🏷️ Creating git tag..." -ForegroundColor Blue
162
- git add package.json
163
- try {
164
- git commit -m "chore: bump version to v$newVersion"
165
- } catch {
166
- Write-Host "No changes to commit" -ForegroundColor Gray
167
- }
168
- git tag "v$newVersion"
169
- Write-Host "✓ Git tag created: v$newVersion" -ForegroundColor Green
170
- Write-Host ""
171
-
172
- # Step 12: Test installation
173
- Write-Host "🧪 Testing installation..." -ForegroundColor Blue
174
- Write-Host "Run this command to test:" -ForegroundColor Yellow
175
- Write-Host " npx spek-cli@$newVersion --version" -ForegroundColor Green
176
- Write-Host "Or:" -ForegroundColor Yellow
177
- Write-Host " npx spek-cli --version" -ForegroundColor Green
178
- Write-Host ""
179
-
180
- # Success summary
181
- Write-Host "╔══════════════════════════════════════╗" -ForegroundColor Green
182
- Write-Host "║ ✅ Publish Complete! ║" -ForegroundColor Green
183
- Write-Host "╚══════════════════════════════════════╝" -ForegroundColor Green
184
- Write-Host ""
185
- Write-Host "Package: spek-cli" -ForegroundColor Blue
186
- Write-Host "Version: $newVersion" -ForegroundColor Blue
187
- Write-Host "Registry: https://www.npmjs.com/package/spek-cli" -ForegroundColor Blue
188
- Write-Host ""
189
- Write-Host "Next steps:" -ForegroundColor Yellow
190
- Write-Host " 1. Push git tag: git push origin v$newVersion" -ForegroundColor Green
191
- Write-Host " 2. Test install: npx spek-cli@$newVersion" -ForegroundColor Green
192
- Write-Host " 3. Verify on npm: https://www.npmjs.com/package/spek-cli" -ForegroundColor Green
193
- Write-Host ""