cvm-server 0.15.3 → 0.16.0-next.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/main.cjs +449 -297
- package/package.json +13 -1
- package/programs/planexecutor.ts +122 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cvm-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-next.0",
|
|
4
4
|
"description": "Cognitive Virtual Machine (CVM) - A deterministic bytecode VM with AI cognitive operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"bin",
|
|
30
|
+
"programs",
|
|
30
31
|
"main.cjs",
|
|
31
32
|
"README.md",
|
|
32
33
|
"LICENSE"
|
|
@@ -102,6 +103,17 @@
|
|
|
102
103
|
]
|
|
103
104
|
}
|
|
104
105
|
},
|
|
106
|
+
"publish-next": {
|
|
107
|
+
"executor": "nx:run-commands",
|
|
108
|
+
"dependsOn": [
|
|
109
|
+
"build"
|
|
110
|
+
],
|
|
111
|
+
"options": {
|
|
112
|
+
"commands": [
|
|
113
|
+
"cd apps/cvm-server/dist && npm publish --tag next --otp={args.otp}"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
105
117
|
"release": {
|
|
106
118
|
"executor": "nx:run-commands",
|
|
107
119
|
"options": {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/// <reference no-default-lib="true"/>
|
|
2
|
+
declare function CC(prompt: string): string;
|
|
3
|
+
declare var fs: any;
|
|
4
|
+
|
|
5
|
+
function main() {
|
|
6
|
+
var raw = fs.readFile(".cvm/uplan.json");
|
|
7
|
+
if (raw === null) {
|
|
8
|
+
console.log("ERROR: Cannot read .cvm/uplan.json — run parsePlan first");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
var data = JSON.parse(raw);
|
|
12
|
+
var mission = data.mission;
|
|
13
|
+
var blocks = data.blocks;
|
|
14
|
+
var sourceFile = data.sourceFile;
|
|
15
|
+
|
|
16
|
+
var submitDone = " Respond with done when complete.";
|
|
17
|
+
var submitTest = " Respond with passed if ALL criteria are checked, or failed if ANY is not met.";
|
|
18
|
+
var toolsReminder = " Use Read, Edit, Write, Bash tools for file operations and commands.";
|
|
19
|
+
|
|
20
|
+
console.log("=== TDDAB PlanExecutor ===");
|
|
21
|
+
console.log("Plan: " + sourceFile);
|
|
22
|
+
console.log("Blocks: " + blocks.length);
|
|
23
|
+
|
|
24
|
+
var completedBlocks = [];
|
|
25
|
+
|
|
26
|
+
var progressRaw = fs.readFile(".cvm/uplan-progress.json");
|
|
27
|
+
var skipBlocks = [];
|
|
28
|
+
if (progressRaw !== null) {
|
|
29
|
+
skipBlocks = JSON.parse(progressRaw);
|
|
30
|
+
console.log("Resuming: " + skipBlocks.length + " blocks already completed");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
CC("MISSION BRIEFING: " + mission + " This plan has " + blocks.length + " blocks to implement in sequence." + toolsReminder + submitDone);
|
|
34
|
+
|
|
35
|
+
var blockIndex = 0;
|
|
36
|
+
|
|
37
|
+
while (blockIndex < blocks.length) {
|
|
38
|
+
var block = blocks[blockIndex];
|
|
39
|
+
var blockNum = blockIndex + 1;
|
|
40
|
+
var progress = blockNum + "/" + blocks.length;
|
|
41
|
+
|
|
42
|
+
var shouldSkip = false;
|
|
43
|
+
var si = 0;
|
|
44
|
+
while (si < skipBlocks.length) {
|
|
45
|
+
if (skipBlocks[si] === block.id) {
|
|
46
|
+
shouldSkip = true;
|
|
47
|
+
}
|
|
48
|
+
si = si + 1;
|
|
49
|
+
}
|
|
50
|
+
if (shouldSkip) {
|
|
51
|
+
console.log("SKIP block " + block.id + " (already completed)");
|
|
52
|
+
completedBlocks.push(block.id);
|
|
53
|
+
blockIndex = blockIndex + 1;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log("");
|
|
58
|
+
console.log("=== Block " + progress + ": " + block.id + " - " + block.title + " ===");
|
|
59
|
+
|
|
60
|
+
CC("RED PHASE [" + progress + "] block " + block.id + ": " + block.title + ". " +
|
|
61
|
+
"CONTEXT: " + block.intro + " " +
|
|
62
|
+
"Write ONLY the failing tests listed below. Do NOT implement any production code yet. " +
|
|
63
|
+
"TESTS TO WRITE: " + block.red + " " +
|
|
64
|
+
block.planRef + toolsReminder + submitDone);
|
|
65
|
+
|
|
66
|
+
console.log("RED done for " + block.id);
|
|
67
|
+
|
|
68
|
+
CC("GREEN PHASE [" + progress + "] block " + block.id + ": " + block.title + ". " +
|
|
69
|
+
"Implement the minimum code to make all failing tests pass. " +
|
|
70
|
+
"CONTEXT: " + block.intro + " " +
|
|
71
|
+
block.planRef + toolsReminder + submitDone);
|
|
72
|
+
|
|
73
|
+
console.log("GREEN done for " + block.id);
|
|
74
|
+
|
|
75
|
+
var verifyPrompt = "VERIFY PHASE [" + progress + "] block " + block.id + ": " + block.title + ". " +
|
|
76
|
+
"Run all tests and typecheck. Then verify EACH criterion below. " +
|
|
77
|
+
"Mark each one as you check it: " +
|
|
78
|
+
"SUCCESS CRITERIA: " + block.success + " " +
|
|
79
|
+
"Are ALL criteria checked [x]?" + toolsReminder + submitTest;
|
|
80
|
+
|
|
81
|
+
var testResult = CC(verifyPrompt);
|
|
82
|
+
console.log("VERIFY result for " + block.id + ": " + testResult);
|
|
83
|
+
|
|
84
|
+
var fixAttempt = 0;
|
|
85
|
+
while (testResult === "failed") {
|
|
86
|
+
fixAttempt = fixAttempt + 1;
|
|
87
|
+
console.log("Fix attempt " + fixAttempt + " for " + block.id);
|
|
88
|
+
|
|
89
|
+
CC("FIX PHASE [" + progress + "] block " + block.id + " (attempt " + fixAttempt + "). " +
|
|
90
|
+
"Tests or criteria failed. Debug the issue and fix it. " +
|
|
91
|
+
"CRITERIA THAT MUST PASS: " + block.success + " " +
|
|
92
|
+
block.planRef + toolsReminder + submitDone);
|
|
93
|
+
|
|
94
|
+
testResult = CC("RE-VERIFY [" + progress + "] block " + block.id + " (after fix " + fixAttempt + "). " +
|
|
95
|
+
"Run all tests and typecheck again. Check EACH criterion: " +
|
|
96
|
+
"SUCCESS CRITERIA: " + block.success + " " +
|
|
97
|
+
"Are ALL criteria now checked [x]?" + toolsReminder + submitTest);
|
|
98
|
+
|
|
99
|
+
console.log("RE-VERIFY result for " + block.id + ": " + testResult);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
CC("COMMIT PHASE [" + progress + "] block " + block.id + ": " + block.title + ". " +
|
|
103
|
+
"All tests pass and all criteria verified. " +
|
|
104
|
+
"Git add and commit with message: feat: " + block.title + "." + submitDone);
|
|
105
|
+
|
|
106
|
+
completedBlocks.push(block.id);
|
|
107
|
+
fs.writeFile(".cvm/uplan-progress.json", JSON.stringify(completedBlocks));
|
|
108
|
+
console.log("Block " + block.id + " COMPLETED (" + completedBlocks.length + "/" + blocks.length + ")");
|
|
109
|
+
|
|
110
|
+
blockIndex = blockIndex + 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log("");
|
|
114
|
+
console.log("=== ALL " + completedBlocks.length + " BLOCKS COMPLETED ===");
|
|
115
|
+
console.log("Completed: " + JSON.stringify(completedBlocks));
|
|
116
|
+
|
|
117
|
+
CC("FINAL REVIEW: All " + completedBlocks.length + " blocks are done. " +
|
|
118
|
+
"Run a final full test suite to confirm no regressions. " +
|
|
119
|
+
"Report the final status." + toolsReminder + submitDone);
|
|
120
|
+
|
|
121
|
+
console.log("TDDAB execution complete.");
|
|
122
|
+
}
|