@nclamvn/vibecode-cli 1.0.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/LICENSE +21 -0
- package/README.md +91 -0
- package/bin/vibecode.js +65 -0
- package/package.json +45 -0
- package/src/commands/doctor.js +130 -0
- package/src/commands/init.js +62 -0
- package/src/commands/lock.js +105 -0
- package/src/commands/start.js +222 -0
- package/src/commands/status.js +80 -0
- package/src/config/constants.js +89 -0
- package/src/config/templates.js +194 -0
- package/src/core/contract.js +103 -0
- package/src/core/session.js +115 -0
- package/src/core/state-machine.js +95 -0
- package/src/core/workspace.js +152 -0
- package/src/index.js +12 -0
- package/src/ui/branding.js +36 -0
- package/src/ui/output.js +96 -0
- package/src/ui/prompts.js +120 -0
- package/src/utils/files.js +84 -0
- package/src/utils/hash.js +34 -0
- package/templates/blueprint.md +61 -0
- package/templates/contract.md +61 -0
- package/templates/intake.md +37 -0
- package/templates/vibecode.yaml +15 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// VIBECODE CLI - File Utilities
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import yaml from 'yaml';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Check if path exists
|
|
11
|
+
*/
|
|
12
|
+
export async function pathExists(targetPath) {
|
|
13
|
+
try {
|
|
14
|
+
await fs.access(targetPath);
|
|
15
|
+
return true;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Read JSON file
|
|
23
|
+
*/
|
|
24
|
+
export async function readJson(filePath) {
|
|
25
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Write JSON file
|
|
31
|
+
*/
|
|
32
|
+
export async function writeJson(filePath, data) {
|
|
33
|
+
await fs.writeFile(filePath, JSON.stringify(data, null, 2), 'utf-8');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Read YAML file
|
|
38
|
+
*/
|
|
39
|
+
export async function readYaml(filePath) {
|
|
40
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
41
|
+
return yaml.parse(content);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Write YAML file
|
|
46
|
+
*/
|
|
47
|
+
export async function writeYaml(filePath, data) {
|
|
48
|
+
await fs.writeFile(filePath, yaml.stringify(data), 'utf-8');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Read markdown file
|
|
53
|
+
*/
|
|
54
|
+
export async function readMarkdown(filePath) {
|
|
55
|
+
return await fs.readFile(filePath, 'utf-8');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Write markdown file
|
|
60
|
+
*/
|
|
61
|
+
export async function writeMarkdown(filePath, content) {
|
|
62
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Ensure directory exists
|
|
67
|
+
*/
|
|
68
|
+
export async function ensureDir(dirPath) {
|
|
69
|
+
await fs.ensureDir(dirPath);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get current working directory name
|
|
74
|
+
*/
|
|
75
|
+
export function getCurrentDirName() {
|
|
76
|
+
return path.basename(process.cwd());
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Append to file
|
|
81
|
+
*/
|
|
82
|
+
export async function appendToFile(filePath, content) {
|
|
83
|
+
await fs.appendFile(filePath, content + '\n', 'utf-8');
|
|
84
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// VIBECODE CLI - Hash Utilities
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
import crypto from 'crypto';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generate SHA256 hash (first 32 chars)
|
|
9
|
+
*/
|
|
10
|
+
export function generateHash(content) {
|
|
11
|
+
return crypto
|
|
12
|
+
.createHash('sha256')
|
|
13
|
+
.update(content)
|
|
14
|
+
.digest('hex')
|
|
15
|
+
.substring(0, 32);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Generate spec hash from contract content
|
|
20
|
+
*/
|
|
21
|
+
export function generateSpecHash(contractContent, timestamp) {
|
|
22
|
+
const hashInput = `${contractContent}_${timestamp}`;
|
|
23
|
+
return generateHash(hashInput);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generate session ID
|
|
28
|
+
*/
|
|
29
|
+
export function generateSessionId() {
|
|
30
|
+
const now = new Date();
|
|
31
|
+
const timestamp = now.toISOString().replace(/[:.]/g, '-').substring(0, 19);
|
|
32
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
33
|
+
return `${timestamp}_session-${random}`;
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 📘 BLUEPRINT: [Project Name]
|
|
2
|
+
|
|
3
|
+
## Session: [session_id]
|
|
4
|
+
## Created: [timestamp]
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🎯 Project Overview
|
|
9
|
+
|
|
10
|
+
| Field | Value |
|
|
11
|
+
|-------|-------|
|
|
12
|
+
| Type | [Type] |
|
|
13
|
+
| Name | [Name] |
|
|
14
|
+
| Goal | [Goal] |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📐 Architecture
|
|
19
|
+
|
|
20
|
+
[Describe architecture here]
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🎨 Design System
|
|
25
|
+
|
|
26
|
+
### Colors
|
|
27
|
+
- Primary: #______
|
|
28
|
+
- Secondary: #______
|
|
29
|
+
|
|
30
|
+
### Typography
|
|
31
|
+
- Headings: [Font]
|
|
32
|
+
- Body: [Font]
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 💻 Tech Stack
|
|
37
|
+
|
|
38
|
+
- Framework:
|
|
39
|
+
- Styling:
|
|
40
|
+
- Database:
|
|
41
|
+
- Auth:
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📁 File Structure
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
[Define structure]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ✅ Checkpoint
|
|
54
|
+
|
|
55
|
+
- [ ] Structure approved
|
|
56
|
+
- [ ] Design approved
|
|
57
|
+
- [ ] Tech stack approved
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
*Generated by Vibecode CLI v1.0*
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 📜 CONTRACT: [Project Name]
|
|
2
|
+
|
|
3
|
+
## Session: [session_id]
|
|
4
|
+
## Created: [timestamp]
|
|
5
|
+
## Status: DRAFT
|
|
6
|
+
## Spec Hash: [hash when locked]
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🎯 Goal
|
|
11
|
+
|
|
12
|
+
[Define clear goal here]
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ✅ In-Scope
|
|
17
|
+
|
|
18
|
+
- [ ] [Deliverable 1]
|
|
19
|
+
- [ ] [Deliverable 2]
|
|
20
|
+
- [ ] [Deliverable 3]
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ❌ Out-of-Scope
|
|
25
|
+
|
|
26
|
+
- [What is NOT included]
|
|
27
|
+
- [Explicitly excluded items]
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 📦 Deliverables
|
|
32
|
+
|
|
33
|
+
| # | Item | Description | Status |
|
|
34
|
+
|---|------|-------------|--------|
|
|
35
|
+
| 1 | [Item] | [Description] | ⬜ |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ✔️ Acceptance Criteria
|
|
40
|
+
|
|
41
|
+
- [ ] [Criterion 1]
|
|
42
|
+
- [ ] [Criterion 2]
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ⚠️ Risks & Mitigations
|
|
47
|
+
|
|
48
|
+
| Risk | Mitigation |
|
|
49
|
+
|------|------------|
|
|
50
|
+
| [Risk] | [Mitigation] |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 🔙 Rollback Plan
|
|
55
|
+
|
|
56
|
+
[Define rollback strategy]
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
*Generated by Vibecode CLI v1.0*
|
|
61
|
+
*Lock this contract with `vibecode lock` when ready*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 📥 INTAKE: [Project Name]
|
|
2
|
+
|
|
3
|
+
## Captured: [timestamp]
|
|
4
|
+
## Session: [session_id]
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🎯 Mô tả dự án
|
|
9
|
+
|
|
10
|
+
[Description goes here]
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Parsed Information
|
|
15
|
+
|
|
16
|
+
### Project Type
|
|
17
|
+
[To be detected]
|
|
18
|
+
|
|
19
|
+
### Key Requirements
|
|
20
|
+
- [To be extracted]
|
|
21
|
+
|
|
22
|
+
### Target Users
|
|
23
|
+
[To be identified]
|
|
24
|
+
|
|
25
|
+
### Constraints
|
|
26
|
+
[To be noted]
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## ✅ Status
|
|
31
|
+
|
|
32
|
+
- [x] Intake captured
|
|
33
|
+
- [ ] Ready for Blueprint
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
*Generated by Vibecode CLI v1.0*
|