vibe-coding-master 0.0.4 → 0.0.6
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/backend/server.js +5 -2
- package/package.json +3 -1
- package/scripts/verify-package.mjs +113 -0
package/dist/backend/server.js
CHANGED
|
@@ -135,11 +135,11 @@ export function createDefaultServerDeps(options = {}) {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
export function getDefaultStaticDir() {
|
|
138
|
-
return path.
|
|
138
|
+
return path.join(getAppRoot(), "dist-frontend");
|
|
139
139
|
}
|
|
140
140
|
function resolveVcmctlCommand() {
|
|
141
|
+
const appRoot = getAppRoot();
|
|
141
142
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
142
|
-
const appRoot = path.resolve(path.dirname(currentModulePath), "../..");
|
|
143
143
|
const sourceCli = path.join(appRoot, "src", "cli", "vcmctl.ts");
|
|
144
144
|
const tsxCli = path.join(appRoot, "node_modules", "tsx", "dist", "cli.mjs");
|
|
145
145
|
if (currentModulePath.includes(`${path.sep}src${path.sep}`) && existsSync(tsxCli) && existsSync(sourceCli)) {
|
|
@@ -154,6 +154,9 @@ function resolveVcmctlCommand() {
|
|
|
154
154
|
}
|
|
155
155
|
return "vcmctl";
|
|
156
156
|
}
|
|
157
|
+
function getAppRoot() {
|
|
158
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
159
|
+
}
|
|
157
160
|
function quoteShellArg(value) {
|
|
158
161
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
159
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibe-coding-master",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Local GUI session cockpit for Claude Code role sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"clean": "node scripts/clean-build.mjs",
|
|
25
25
|
"fix:node-pty": "node scripts/fix-node-pty-spawn-helper.mjs",
|
|
26
26
|
"postinstall": "node scripts/fix-node-pty-spawn-helper.mjs",
|
|
27
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
28
|
+
"prepack": "npm run build && npm run verify:package",
|
|
27
29
|
"dev": "tsx src/main.ts --dev",
|
|
28
30
|
"build": "npm run clean && tsc -p tsconfig.node.json && vite build",
|
|
29
31
|
"start": "node dist/main.js",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
const appRoot = process.cwd();
|
|
5
|
+
const requiredFiles = [
|
|
6
|
+
"README.md",
|
|
7
|
+
"package.json",
|
|
8
|
+
"scripts/fix-node-pty-spawn-helper.mjs",
|
|
9
|
+
"dist/main.js",
|
|
10
|
+
"dist/cli/vcmctl.js",
|
|
11
|
+
"dist/backend/server.js",
|
|
12
|
+
"dist/backend/runtime/node-pty-runtime.js",
|
|
13
|
+
"dist/backend/ws/terminal-ws.js",
|
|
14
|
+
"dist/backend/services/session-service.js",
|
|
15
|
+
"dist/backend/services/project-service.js",
|
|
16
|
+
"dist/backend/services/message-service.js",
|
|
17
|
+
"dist/shared/constants.js",
|
|
18
|
+
"dist/shared/validation/slug-check.js",
|
|
19
|
+
"dist/shared/validation/artifact-check.js",
|
|
20
|
+
"dist-frontend/index.html"
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const requiredFileEntries = [
|
|
24
|
+
"dist",
|
|
25
|
+
"dist-frontend",
|
|
26
|
+
"docs",
|
|
27
|
+
"scripts",
|
|
28
|
+
"README.md"
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
async function main() {
|
|
32
|
+
const pkg = JSON.parse(await readText("package.json"));
|
|
33
|
+
assertArrayIncludes(pkg.files, requiredFileEntries, "package.json files");
|
|
34
|
+
assertEqual(pkg.bin?.vcm, "dist/main.js", "package.json bin.vcm");
|
|
35
|
+
assertEqual(pkg.bin?.vcmctl, "dist/cli/vcmctl.js", "package.json bin.vcmctl");
|
|
36
|
+
|
|
37
|
+
for (const file of requiredFiles) {
|
|
38
|
+
await assertFile(file);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await assertStartsWith("dist/main.js", "#!/usr/bin/env node", "vcm bin shebang");
|
|
42
|
+
await assertStartsWith("dist/cli/vcmctl.js", "#!/usr/bin/env node", "vcmctl bin shebang");
|
|
43
|
+
|
|
44
|
+
const server = await readText("dist/backend/server.js");
|
|
45
|
+
assertIncludes(server, 'path.join(getAppRoot(), "dist-frontend")', "packaged static dir must resolve from app root");
|
|
46
|
+
assertNotIncludes(server, 'path.resolve("dist-frontend")', "packaged static dir must not resolve from caller cwd");
|
|
47
|
+
|
|
48
|
+
const indexHtml = await readText("dist-frontend/index.html");
|
|
49
|
+
const assetPaths = [...indexHtml.matchAll(/(?:src|href)="\/([^"]+)"/g)].map((match) => match[1]);
|
|
50
|
+
if (assetPaths.length === 0) {
|
|
51
|
+
fail("dist-frontend/index.html does not reference any built assets");
|
|
52
|
+
}
|
|
53
|
+
for (const assetPath of assetPaths) {
|
|
54
|
+
await assertFile(path.join("dist-frontend", assetPath));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`Package verification passed: ${requiredFiles.length + assetPaths.length} required files checked.`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function readText(relativePath) {
|
|
61
|
+
return fs.readFile(path.join(appRoot, relativePath), "utf8");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function assertFile(relativePath) {
|
|
65
|
+
const absolutePath = path.join(appRoot, relativePath);
|
|
66
|
+
const stat = await fs.stat(absolutePath).catch(() => null);
|
|
67
|
+
if (!stat?.isFile()) {
|
|
68
|
+
fail(`Missing required package file: ${relativePath}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function assertStartsWith(relativePath, expected, label) {
|
|
73
|
+
const content = await readText(relativePath);
|
|
74
|
+
if (!content.startsWith(expected)) {
|
|
75
|
+
fail(`${label} failed for ${relativePath}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function assertArrayIncludes(actual, expectedEntries, label) {
|
|
80
|
+
if (!Array.isArray(actual)) {
|
|
81
|
+
fail(`${label} must be an array`);
|
|
82
|
+
}
|
|
83
|
+
for (const entry of expectedEntries) {
|
|
84
|
+
if (!actual.includes(entry)) {
|
|
85
|
+
fail(`${label} missing ${entry}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function assertEqual(actual, expected, label) {
|
|
91
|
+
if (actual !== expected) {
|
|
92
|
+
fail(`${label} expected ${expected}, got ${actual}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function assertIncludes(content, expected, label) {
|
|
97
|
+
if (!content.includes(expected)) {
|
|
98
|
+
fail(`${label}: missing ${expected}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function assertNotIncludes(content, unexpected, label) {
|
|
103
|
+
if (content.includes(unexpected)) {
|
|
104
|
+
fail(`${label}: found ${unexpected}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function fail(message) {
|
|
109
|
+
console.error(`Package verification failed: ${message}`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
await main();
|