vibeos 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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +184 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
const REPO_URL = "https://github.com/claimhawk/vibeos.git";
|
|
6
|
+
const REPO_SSH = "git@github.com:claimhawk/vibeos.git";
|
|
7
|
+
function validateProjectName(name) {
|
|
8
|
+
// Only allow alphanumeric, hyphens, underscores, and dots
|
|
9
|
+
// Must start with alphanumeric
|
|
10
|
+
const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
11
|
+
return validPattern.test(name) && name.length <= 100;
|
|
12
|
+
}
|
|
13
|
+
function runCommand(command, args, cwd) {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
const proc = spawn(command, args, {
|
|
16
|
+
cwd,
|
|
17
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
18
|
+
});
|
|
19
|
+
let stdout = "";
|
|
20
|
+
let stderr = "";
|
|
21
|
+
proc.stdout?.on("data", (data) => {
|
|
22
|
+
stdout += data.toString();
|
|
23
|
+
process.stdout.write(data);
|
|
24
|
+
});
|
|
25
|
+
proc.stderr?.on("data", (data) => {
|
|
26
|
+
stderr += data.toString();
|
|
27
|
+
process.stderr.write(data);
|
|
28
|
+
});
|
|
29
|
+
proc.on("close", (code) => {
|
|
30
|
+
resolve({ code: code ?? 1, stdout, stderr });
|
|
31
|
+
});
|
|
32
|
+
proc.on("error", (error) => {
|
|
33
|
+
resolve({ code: 1, stdout, stderr: error.message });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async function checkCommandExists(command) {
|
|
38
|
+
const result = await runCommand("which", [command]);
|
|
39
|
+
return result.code === 0;
|
|
40
|
+
}
|
|
41
|
+
async function tryForkRepo(projectName) {
|
|
42
|
+
const hasGh = await checkCommandExists("gh");
|
|
43
|
+
if (!hasGh) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
console.log(" š“ Attempting to fork repository...");
|
|
47
|
+
// Fork the repo
|
|
48
|
+
const forkResult = await runCommand("gh", [
|
|
49
|
+
"repo",
|
|
50
|
+
"fork",
|
|
51
|
+
"claimhawk/vibeos",
|
|
52
|
+
"--clone=false",
|
|
53
|
+
]);
|
|
54
|
+
if (forkResult.code !== 0) {
|
|
55
|
+
console.log(" ā ļø Fork failed, will clone instead");
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
// Get the forked repo URL
|
|
59
|
+
const whoami = await runCommand("gh", ["api", "user", "-q", ".login"]);
|
|
60
|
+
if (whoami.code !== 0) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const username = whoami.stdout.trim();
|
|
64
|
+
const forkedUrl = `git@github.com:${username}/vibeos.git`;
|
|
65
|
+
// Clone the fork
|
|
66
|
+
const cloneResult = await runCommand("git", [
|
|
67
|
+
"clone",
|
|
68
|
+
forkedUrl,
|
|
69
|
+
projectName,
|
|
70
|
+
]);
|
|
71
|
+
if (cloneResult.code !== 0) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
// Add upstream remote
|
|
75
|
+
await runCommand("git", ["remote", "add", "upstream", REPO_SSH], join(process.cwd(), projectName));
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
async function cloneRepo(projectName) {
|
|
79
|
+
console.log(" š„ Cloning repository...");
|
|
80
|
+
const result = await runCommand("git", ["clone", REPO_URL, projectName]);
|
|
81
|
+
return result.code === 0;
|
|
82
|
+
}
|
|
83
|
+
async function startAgent(projectPath) {
|
|
84
|
+
const agentScript = join(projectPath, "agent.sh");
|
|
85
|
+
if (!existsSync(agentScript)) {
|
|
86
|
+
console.log(`
|
|
87
|
+
ā
VibesOS project created: ${projectPath}
|
|
88
|
+
|
|
89
|
+
Next steps:
|
|
90
|
+
cd ${projectPath}
|
|
91
|
+
# Start your AI coding agent and run: help
|
|
92
|
+
`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
console.log("\n š Starting agent...\n");
|
|
96
|
+
// Start the agent script interactively
|
|
97
|
+
const agent = spawn("bash", ["agent.sh"], {
|
|
98
|
+
cwd: projectPath,
|
|
99
|
+
stdio: "inherit",
|
|
100
|
+
});
|
|
101
|
+
agent.on("error", (error) => {
|
|
102
|
+
console.error(`Failed to start agent: ${error.message}`);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async function createProject(name) {
|
|
106
|
+
if (!validateProjectName(name)) {
|
|
107
|
+
console.error("Error: Invalid project name. Use only letters, numbers, hyphens, underscores, and dots.");
|
|
108
|
+
console.error("Name must start with a letter or number.");
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
const projectPath = join(process.cwd(), name);
|
|
112
|
+
if (existsSync(projectPath)) {
|
|
113
|
+
console.error(`Error: Directory "${name}" already exists.`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
console.log(`\nšø Creating VibesOS project: ${name}\n`);
|
|
117
|
+
// Try to fork first (if gh CLI is available)
|
|
118
|
+
const forked = await tryForkRepo(name);
|
|
119
|
+
if (!forked) {
|
|
120
|
+
// Fall back to regular clone
|
|
121
|
+
const cloned = await cloneRepo(name);
|
|
122
|
+
if (!cloned) {
|
|
123
|
+
console.error("Error: Failed to clone repository.");
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
console.log(`\nā
VibesOS project ready!`);
|
|
128
|
+
// Start the agent
|
|
129
|
+
await startAgent(projectPath);
|
|
130
|
+
}
|
|
131
|
+
function showHelp() {
|
|
132
|
+
console.log(`
|
|
133
|
+
šø VibesOS - Agentic Coding Operating System
|
|
134
|
+
|
|
135
|
+
Usage:
|
|
136
|
+
vibeos new <project-name> Create a new VibesOS project (fork + clone)
|
|
137
|
+
vibeos help Show this help message
|
|
138
|
+
|
|
139
|
+
Examples:
|
|
140
|
+
vibeos new my-app
|
|
141
|
+
vibeos new awesome-project
|
|
142
|
+
|
|
143
|
+
What happens:
|
|
144
|
+
1. Forks claimhawk/vibeos to your GitHub (if gh CLI available)
|
|
145
|
+
2. Clones the repo to <project-name>/
|
|
146
|
+
3. Starts the agent (if agent.sh exists)
|
|
147
|
+
|
|
148
|
+
Requirements:
|
|
149
|
+
- git (required)
|
|
150
|
+
- gh CLI (optional, for forking)
|
|
151
|
+
|
|
152
|
+
Learn more: https://github.com/claimhawk/vibeos
|
|
153
|
+
`);
|
|
154
|
+
}
|
|
155
|
+
async function main() {
|
|
156
|
+
const args = process.argv.slice(2);
|
|
157
|
+
const command = args[0];
|
|
158
|
+
switch (command) {
|
|
159
|
+
case "new": {
|
|
160
|
+
const projectName = args[1];
|
|
161
|
+
if (!projectName) {
|
|
162
|
+
console.error("Error: Please provide a project name.");
|
|
163
|
+
console.log("Usage: vibeos new <project-name>");
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
await createProject(projectName);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "help":
|
|
170
|
+
case "--help":
|
|
171
|
+
case "-h":
|
|
172
|
+
case undefined:
|
|
173
|
+
showHelp();
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
console.error(`Unknown command: ${command}`);
|
|
177
|
+
showHelp();
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
main().catch((error) => {
|
|
182
|
+
console.error("Error:", error.message);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vibeos",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "VibesOS - An Agentic Coding Operating System CLI",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vibeos": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"vibes",
|
|
17
|
+
"vibesos",
|
|
18
|
+
"agentic",
|
|
19
|
+
"coding",
|
|
20
|
+
"agent",
|
|
21
|
+
"ai",
|
|
22
|
+
"claude",
|
|
23
|
+
"kanban",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"author": "ClaimHawk",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/claimhawk/vibes-os.git"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"templates"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"typescript": "^5.7.0"
|
|
39
|
+
}
|
|
40
|
+
}
|