vibecodingmachine-core 2026.1.29-1711 → 2026.2.20-423

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 (44) hide show
  1. package/package.json +3 -2
  2. package/src/agents/validation.js +244 -0
  3. package/src/commands/agents.js +61 -0
  4. package/src/commands/base.js +162 -0
  5. package/src/commands/create-agent.js +96 -0
  6. package/src/commands/disable-agent.js +54 -0
  7. package/src/commands/enable-agent.js +54 -0
  8. package/src/commands/help.js +130 -0
  9. package/src/commands/registry.js +185 -0
  10. package/src/commands/requirements.js +131 -0
  11. package/src/commands/resolver.js +336 -0
  12. package/src/commands/settings.js +53 -0
  13. package/src/health-tracking/index.js +6 -0
  14. package/src/ide-integration/applescript-manager.cjs +747 -67
  15. package/src/ide-integration/applescript-manager.js +431 -110
  16. package/src/ide-integration/cline-cli-manager.cjs +2 -2
  17. package/src/ide-integration/cline-cli-manager.js +372 -0
  18. package/src/ide-integration/quota-detector.cjs +43 -1
  19. package/src/ide-integration/quota-detector.js +59 -1
  20. package/src/index.cjs +29 -2
  21. package/src/index.js +29 -0
  22. package/src/llm/direct-llm-manager.cjs +64 -0
  23. package/src/localization/translations/en.js +2 -2
  24. package/src/provider-registry.js +215 -0
  25. package/src/requirement-management/index.js +6 -0
  26. package/src/rui/base.js +212 -0
  27. package/src/rui/index.js +130 -0
  28. package/src/rui/registry.js +249 -0
  29. package/src/rui/resolver.js +356 -0
  30. package/src/sync/remote-control-server.js +362 -0
  31. package/src/sync/sync-engine-backup.js +559 -0
  32. package/src/sync/sync-engine-conflicts.js +262 -0
  33. package/src/sync/sync-engine-core.js +221 -0
  34. package/src/sync/sync-engine-file-ops.js +223 -0
  35. package/src/sync/sync-engine.js +110 -343
  36. package/src/timeout-management/index.js +6 -0
  37. package/src/utils/analyzer.js +286 -0
  38. package/src/utils/cleanup.js +408 -0
  39. package/src/utils/duplicate-detector.js +538 -0
  40. package/src/utils/file-monitor.js +236 -0
  41. package/src/utils/refactor-plan.js +518 -0
  42. package/src/utils/requirement-helpers.js +37 -6
  43. package/src/utils/requirements-parser.js +4 -2
  44. package/src/utils/specification-helpers.js +216 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibecodingmachine-core",
3
- "version": "2026.1.29-1711",
3
+ "version": "2026.02.20-0423",
4
4
  "description": "Shared core logic for Vibe Coding Machine IDE integration",
5
5
  "main": "src/index.cjs",
6
6
  "module": "src/index.js",
@@ -28,7 +28,8 @@
28
28
  "chrome-remote-interface": "^0.33.0",
29
29
  "fs-extra": "^11.1.1",
30
30
  "jsonwebtoken": "^9.0.2",
31
- "jwks-rsa": "^3.2.0"
31
+ "jwks-rsa": "^3.2.0",
32
+ "ws": "^8.18.0"
32
33
  },
33
34
  "optionalDependencies": {
34
35
  "node-pty": "^1.0.0"
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Agent Guideline Validation System
3
+ * Validates that AI agents follow constitutional requirements
4
+ */
5
+
6
+ class AgentGuidelineValidator {
7
+ constructor() {
8
+ this.violations = [];
9
+ }
10
+
11
+ /**
12
+ * Validate agent's compliance with AGENTS.md guidelines
13
+ * @param {Object} context - Agent context and actions
14
+ * @returns {Object} Validation result
15
+ */
16
+ validateAgentCompliance(context) {
17
+ this.violations = [];
18
+
19
+ // Check if agent read AGENTS.md first
20
+ if (!context.readAgentsMd) {
21
+ this.violations.push({
22
+ type: 'AGENTS_MD_NOT_READ',
23
+ message: 'Agent must read AGENTS.md before making changes',
24
+ severity: 'error'
25
+ });
26
+ }
27
+
28
+ // Check if agent followed constitution
29
+ if (!context.followedConstitution) {
30
+ this.violations.push({
31
+ type: 'CONSTITUTION_NOT_FOLLOWED',
32
+ message: 'Agent must follow constitution guidelines',
33
+ severity: 'error'
34
+ });
35
+ }
36
+
37
+ // Check if agent used RUI pattern
38
+ if (!context.usedRUIPattern) {
39
+ this.violations.push({
40
+ type: 'RUI_PATTERN_NOT_USED',
41
+ message: 'Agent must use RUI pattern for interfaces',
42
+ severity: 'warning'
43
+ });
44
+ }
45
+
46
+ // Check packages/core modifications
47
+ if (context.modifiedCorePackage && !context.ranNpmInstall) {
48
+ this.violations.push({
49
+ type: 'NPM_INSTALL_NOT_RUN',
50
+ message: 'Agent must run npm install after modifying packages/core',
51
+ severity: 'error'
52
+ });
53
+ }
54
+
55
+ // Check file size compliance
56
+ if (context.createdLargeFiles) {
57
+ this.violations.push({
58
+ type: 'FILE_SIZE_LIMIT_EXCEEDED',
59
+ message: 'Files must not exceed 555 lines',
60
+ severity: 'error'
61
+ });
62
+ }
63
+
64
+ // Check for trailing whitespace
65
+ if (context.hasTrailingWhitespace) {
66
+ this.violations.push({
67
+ type: 'TRAILING_WHITESPACE',
68
+ message: 'Files must not have trailing whitespace',
69
+ severity: 'warning'
70
+ });
71
+ }
72
+
73
+ // Check for missing newlines
74
+ if (context.missingNewlines) {
75
+ this.violations.push({
76
+ type: 'MISSING_NEWLINES',
77
+ message: 'Files must end with newline (POSIX standard)',
78
+ severity: 'warning'
79
+ });
80
+ }
81
+
82
+ // Check for duplicate code
83
+ if (context.createdDuplicateCode) {
84
+ this.violations.push({
85
+ type: 'DUPLICATE_CODE',
86
+ message: 'Agent should merge duplicate code, not create new duplicates',
87
+ severity: 'error'
88
+ });
89
+ }
90
+
91
+ // Check for fallback code
92
+ if (context.createdFallbackCode) {
93
+ this.violations.push({
94
+ type: 'FALLBACK_CODE_CREATED',
95
+ message: 'Agent should log errors instead of creating fallback code',
96
+ severity: 'error'
97
+ });
98
+ }
99
+
100
+ // Check test-first development
101
+ this.validateTestFirst(context);
102
+
103
+ return {
104
+ compliant: this.violations.length === 0,
105
+ violations: this.violations,
106
+ summary: this.generateSummary()
107
+ };
108
+ }
109
+
110
+ /**
111
+ * Generate validation summary
112
+ * @private
113
+ */
114
+ generateSummary() {
115
+ const errors = this.violations.filter(v => v.severity === 'error');
116
+ const warnings = this.violations.filter(v => v.severity === 'warning');
117
+
118
+ return {
119
+ total: this.violations.length,
120
+ errors: errors.length,
121
+ warnings: warnings.length,
122
+ criticalIssues: errors.map(e => e.message)
123
+ };
124
+ }
125
+
126
+ /**
127
+ * Check if agent followed test-first development
128
+ * @param {Object} context - Agent context
129
+ * @returns {boolean} Whether test-first was followed
130
+ */
131
+ validateTestFirst(context) {
132
+ if (!context.wroteTestsFirst) {
133
+ this.violations.push({
134
+ type: 'TESTS_NOT_WRITTEN_FIRST',
135
+ message: 'Tests must be written before implementation (TDD approach)',
136
+ severity: 'error'
137
+ });
138
+ }
139
+
140
+ return context.wroteTestsFirst;
141
+ }
142
+
143
+ /**
144
+ * Check if agent performed code cleanup
145
+ * @param {Object} context - Agent context
146
+ * @returns {boolean} Whether cleanup was performed
147
+ */
148
+ validateCodeCleanup(context) {
149
+ if (!context.performedCodeCleanup) {
150
+ this.violations.push({
151
+ type: 'CODE_CLEANUP_NOT_PERFORMED',
152
+ message: 'Agent must perform code cleanup pass after implementation',
153
+ severity: 'warning'
154
+ });
155
+ }
156
+
157
+ return context.performedCodeCleanup;
158
+ }
159
+
160
+ /**
161
+ * Validate file size compliance
162
+ * @param {Array} files - Files to check
163
+ * @returns {Object} File size validation result
164
+ */
165
+ validateFileSize(files) {
166
+ const violations = [];
167
+
168
+ for (const file of files) {
169
+ if (file.lineCount > 555) {
170
+ violations.push({
171
+ file: file.path,
172
+ lines: file.lineCount,
173
+ message: `File exceeds 555 lines: ${file.lineCount} lines`
174
+ });
175
+ }
176
+ }
177
+
178
+ return {
179
+ compliant: violations.length === 0,
180
+ violations
181
+ };
182
+ }
183
+
184
+ /**
185
+ * Get constitutional requirements checklist
186
+ * @returns {Array} Array of requirement items
187
+ */
188
+ getConstitutionalChecklist() {
189
+ return [
190
+ {
191
+ id: 'read_agents_md',
192
+ description: 'Read AGENTS.md before making changes',
193
+ required: true
194
+ },
195
+ {
196
+ id: 'follow_constitution',
197
+ description: 'Follow constitution guidelines',
198
+ required: true
199
+ },
200
+ {
201
+ id: 'use_rui_pattern',
202
+ description: 'Use RUI pattern for interfaces',
203
+ required: true
204
+ },
205
+ {
206
+ id: 'library_first',
207
+ description: 'Use packages/core for business logic',
208
+ required: true
209
+ },
210
+ {
211
+ id: 'npm_install_after_core',
212
+ description: 'Run npm install after modifying packages/core',
213
+ required: true
214
+ },
215
+ {
216
+ id: 'test_first',
217
+ description: 'Write tests before implementation',
218
+ required: true
219
+ },
220
+ {
221
+ id: 'file_size_limit',
222
+ description: 'Keep files under 555 lines',
223
+ required: true
224
+ },
225
+ {
226
+ id: 'code_cleanup',
227
+ description: 'Perform code cleanup pass',
228
+ required: true
229
+ },
230
+ {
231
+ id: 'no_fallbacks',
232
+ description: 'Do not create fallback code',
233
+ required: true
234
+ },
235
+ {
236
+ id: 'merge_ready_code',
237
+ description: 'Code must be merge-ready (no trailing whitespace, proper newlines)',
238
+ required: true
239
+ }
240
+ ];
241
+ }
242
+ }
243
+
244
+ module.exports = AgentGuidelineValidator;
@@ -0,0 +1,61 @@
1
+ const RUICommand = require('./base');
2
+
3
+ /**
4
+ * RUI Command: List Agents
5
+ * Implements GET agents command following RUI pattern
6
+ */
7
+
8
+ class ListAgentsCommand extends RUICommand {
9
+ constructor() {
10
+ super({
11
+ verb: 'GET',
12
+ resource: 'agents',
13
+ description: 'List all available agents with their status and configuration',
14
+ shortcuts: ['la', 'list ag', 'get ag'],
15
+ synonyms: ['list', 'get'],
16
+ handler: async (params = {}) => {
17
+ // This would integrate with the actual agent system
18
+ // For now, return mock data for testing
19
+ return {
20
+ agents: [
21
+ {
22
+ id: 'cursor-cli',
23
+ name: 'Cursor CLI Agent',
24
+ status: 'enabled',
25
+ description: 'Manages Cursor CLI integration',
26
+ configuration: {
27
+ timeout: 30000,
28
+ autoSave: true
29
+ }
30
+ },
31
+ {
32
+ id: 'claude-cli',
33
+ name: 'Claude CLI Agent',
34
+ status: 'disabled',
35
+ description: 'Manages Claude CLI integration',
36
+ configuration: {
37
+ timeout: 25000,
38
+ autoSave: false
39
+ }
40
+ },
41
+ {
42
+ id: 'test-agent',
43
+ name: 'Test Agent',
44
+ status: 'enabled',
45
+ description: 'Test agent for development',
46
+ configuration: {
47
+ timeout: 10000,
48
+ debug: true
49
+ }
50
+ }
51
+ ],
52
+ total: 3,
53
+ enabled: 2,
54
+ disabled: 1
55
+ };
56
+ }
57
+ });
58
+ }
59
+ }
60
+
61
+ module.exports = ListAgentsCommand;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Base RUI Command Interface
3
+ * Defines the standard interface for all RUI commands
4
+ */
5
+
6
+ class RUICommand {
7
+ constructor(options = {}) {
8
+ this.verb = options.verb;
9
+ this.resource = options.resource;
10
+ this.description = options.description;
11
+ this.handler = options.handler;
12
+ this.shortcuts = options.shortcuts || [];
13
+ this.synonyms = options.synonyms || [];
14
+ this.parameters = options.parameters || [];
15
+ this.examples = options.examples || [];
16
+ this.registeredAt = new Date();
17
+ }
18
+
19
+ /**
20
+ * Execute the command with given parameters
21
+ * @param {Object} params - Command parameters
22
+ * @returns {Promise<Object>} Command execution result
23
+ */
24
+ async execute(params = {}) {
25
+ const startTime = Date.now();
26
+
27
+ try {
28
+ // Validate parameters
29
+ this.validateParameters(params);
30
+
31
+ // Execute the handler
32
+ const result = await this.handler(params);
33
+
34
+ return {
35
+ success: true,
36
+ data: result,
37
+ executionTime: Date.now() - startTime,
38
+ command: `${this.verb} ${this.resource}`
39
+ };
40
+ } catch (error) {
41
+ return {
42
+ success: false,
43
+ error: error.message,
44
+ executionTime: Date.now() - startTime,
45
+ command: `${this.verb} ${this.resource}`
46
+ };
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Get command signature for help
52
+ * @returns {string} Command signature
53
+ */
54
+ getSignature() {
55
+ const parts = [this.verb, this.resource];
56
+
57
+ if (this.parameters.length > 0) {
58
+ const paramStr = this.parameters
59
+ .map(param => {
60
+ const required = param.required ? '' : '[]';
61
+ return `<${param.name}${required}>`;
62
+ })
63
+ .join(' ');
64
+ parts.push(paramStr);
65
+ }
66
+
67
+ return parts.join(' ');
68
+ }
69
+
70
+ /**
71
+ * Get all available shortcuts
72
+ * @returns {Array} Array of shortcuts
73
+ */
74
+ getShortcuts() {
75
+ return [...this.shortcuts];
76
+ }
77
+
78
+ /**
79
+ * Get all synonyms
80
+ * @returns {Array} Array of synonyms
81
+ */
82
+ getSynonyms() {
83
+ return [...this.synonyms];
84
+ }
85
+
86
+ /**
87
+ * Get command examples
88
+ * @returns {Array} Array of examples
89
+ */
90
+ getExamples() {
91
+ return [...this.examples];
92
+ }
93
+
94
+ /**
95
+ * Validate parameters against command definition
96
+ * @private
97
+ */
98
+ validateParameters(params) {
99
+ for (const param of this.parameters) {
100
+ if (param.required && !(param.name in params)) {
101
+ throw new Error(`Required parameter missing: ${param.name}`);
102
+ }
103
+
104
+ if (param.name in params) {
105
+ const value = params[param.name];
106
+ this.validateParameterValue(param, value);
107
+ }
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Validate individual parameter value
113
+ * @private
114
+ */
115
+ validateParameterValue(param, value) {
116
+ if (param.type && typeof value !== param.type) {
117
+ throw new Error(`Parameter ${param.name} must be of type ${param.type}, got ${typeof value}`);
118
+ }
119
+
120
+ if (param.validation && !param.validation.every(rule => this.validateRule(rule, value))) {
121
+ throw new Error(`Parameter ${param.name} validation failed: ${value}`);
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Validate a single validation rule
127
+ * @private
128
+ */
129
+ validateRule(rule, value) {
130
+ if (rule.startsWith('enum:')) {
131
+ const allowedValues = rule.substring(5).split(',').map(v => v.trim());
132
+ return allowedValues.includes(value);
133
+ }
134
+
135
+ if (rule.startsWith('regex:')) {
136
+ const pattern = new RegExp(rule.substring(6));
137
+ return pattern.test(value);
138
+ }
139
+
140
+ return true; // Default to valid
141
+ }
142
+
143
+ /**
144
+ * Get command metadata
145
+ * @returns {Object} Command metadata
146
+ */
147
+ getMetadata() {
148
+ return {
149
+ verb: this.verb,
150
+ resource: this.resource,
151
+ description: this.description,
152
+ shortcuts: this.shortcuts,
153
+ synonyms: this.synonyms,
154
+ parameters: this.parameters,
155
+ examples: this.examples,
156
+ signature: this.getSignature(),
157
+ registeredAt: this.registeredAt
158
+ };
159
+ }
160
+ }
161
+
162
+ module.exports = RUICommand;
@@ -0,0 +1,96 @@
1
+ const RUICommand = require('./base');
2
+
3
+ /**
4
+ * RUI Command: Create Agent
5
+ * Implements POST agent command following RUI pattern
6
+ */
7
+
8
+ class CreateAgentCommand extends RUICommand {
9
+ constructor() {
10
+ super({
11
+ verb: 'POST',
12
+ resource: 'agents',
13
+ description: 'Create a new agent with specified configuration',
14
+ shortcuts: ['ca', 'create ag', 'post ag'],
15
+ synonyms: ['create', 'post', 'add'],
16
+ parameters: [
17
+ {
18
+ name: 'name',
19
+ type: 'string',
20
+ required: true,
21
+ description: 'Unique identifier for the agent'
22
+ },
23
+ {
24
+ name: 'description',
25
+ type: 'string',
26
+ required: false,
27
+ description: 'Human-readable description of the agent'
28
+ },
29
+ {
30
+ name: 'type',
31
+ type: 'string',
32
+ required: true,
33
+ description: 'Type of agent (cli, gui, service)',
34
+ enum: ['cli', 'gui', 'service']
35
+ },
36
+ {
37
+ name: 'configuration',
38
+ type: 'object',
39
+ required: false,
40
+ description: 'Initial configuration for the agent'
41
+ }
42
+ ],
43
+ examples: [
44
+ 'app create agent test-agent --name "Test Agent" --type cli --description "Agent for testing"',
45
+ 'app ca test-agent --name "Test Agent" --type cli',
46
+ 'app post agents --name "API Agent" --type service'
47
+ ]
48
+ });
49
+ }
50
+
51
+ async execute(params = {}) {
52
+ // Validate required parameters
53
+ if (!params.name) {
54
+ throw new Error('Required parameter missing: name');
55
+ }
56
+
57
+ if (!params.type) {
58
+ throw new Error('Required parameter missing: type');
59
+ }
60
+
61
+ // Validate type
62
+ const validTypes = ['cli', 'gui', 'service'];
63
+ if (!validTypes.includes(params.type)) {
64
+ throw new Error(`Invalid type: ${params.type}. Must be one of: ${validTypes.join(', ')}`);
65
+ }
66
+
67
+ // This would create the agent in the actual system
68
+ // For now, return success response for testing
69
+ return {
70
+ success: true,
71
+ data: {
72
+ agent: {
73
+ id: this.generateAgentId(params.name),
74
+ name: params.name,
75
+ description: params.description || `Agent ${params.name}`,
76
+ type: params.type,
77
+ configuration: params.configuration || {},
78
+ status: 'created',
79
+ createdAt: new Date().toISOString()
80
+ }
81
+ },
82
+ message: `Agent ${params.name} created successfully`
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Generate unique agent ID
88
+ * @private
89
+ */
90
+ generateAgentId(name) {
91
+ // Convert to lowercase, replace spaces with hyphens
92
+ return name.toLowerCase().replace(/\s+/g, '-');
93
+ }
94
+ }
95
+
96
+ module.exports = CreateAgentCommand;
@@ -0,0 +1,54 @@
1
+ const RUICommand = require('./base');
2
+
3
+ /**
4
+ * RUI Command: Disable Agent
5
+ * Implements agent disable action following RUI pattern
6
+ */
7
+
8
+ class DisableAgentCommand extends RUICommand {
9
+ constructor() {
10
+ super({
11
+ verb: 'PUT', // Using PUT for update operations
12
+ resource: 'agents',
13
+ description: 'Disable a specific agent',
14
+ shortcuts: ['ad', 'disable ag', 'put ag disable'],
15
+ synonyms: ['disable', 'deactivate'],
16
+ parameters: [
17
+ {
18
+ name: 'agentId',
19
+ type: 'string',
20
+ required: true,
21
+ description: 'ID of the agent to disable'
22
+ }
23
+ ],
24
+ examples: [
25
+ 'app disable agent test-agent',
26
+ 'app ad test-agent',
27
+ 'app put agents test-agent --status disabled'
28
+ ]
29
+ });
30
+ }
31
+
32
+ async execute(params = {}) {
33
+ // Validate required parameters
34
+ if (!params.agentId) {
35
+ throw new Error('Required parameter missing: agentId');
36
+ }
37
+
38
+ // This would integrate with the actual agent management system
39
+ // For now, return success response for testing
40
+ return {
41
+ success: true,
42
+ data: {
43
+ agent: {
44
+ id: params.agentId,
45
+ status: 'disabled',
46
+ disabledAt: new Date().toISOString()
47
+ }
48
+ },
49
+ message: `Agent ${params.agentId} disabled successfully`
50
+ };
51
+ }
52
+ }
53
+
54
+ module.exports = DisableAgentCommand;
@@ -0,0 +1,54 @@
1
+ const RUICommand = require('./base');
2
+
3
+ /**
4
+ * RUI Command: Enable Agent
5
+ * Implements agent enable action following RUI pattern
6
+ */
7
+
8
+ class EnableAgentCommand extends RUICommand {
9
+ constructor() {
10
+ super({
11
+ verb: 'PUT', // Using PUT for update operations
12
+ resource: 'agents',
13
+ description: 'Enable a specific agent',
14
+ shortcuts: ['ae', 'enable ag', 'put ag enable'],
15
+ synonyms: ['enable', 'activate'],
16
+ parameters: [
17
+ {
18
+ name: 'agentId',
19
+ type: 'string',
20
+ required: true,
21
+ description: 'ID of the agent to enable'
22
+ }
23
+ ],
24
+ examples: [
25
+ 'app enable agent test-agent',
26
+ 'app ae test-agent',
27
+ 'app put agents test-agent --status enabled'
28
+ ]
29
+ });
30
+ }
31
+
32
+ async execute(params = {}) {
33
+ // Validate required parameters
34
+ if (!params.agentId) {
35
+ throw new Error('Required parameter missing: agentId');
36
+ }
37
+
38
+ // This would integrate with the actual agent management system
39
+ // For now, return success response for testing
40
+ return {
41
+ success: true,
42
+ data: {
43
+ agent: {
44
+ id: params.agentId,
45
+ status: 'enabled',
46
+ enabledAt: new Date().toISOString()
47
+ }
48
+ },
49
+ message: `Agent ${params.agentId} enabled successfully`
50
+ };
51
+ }
52
+ }
53
+
54
+ module.exports = EnableAgentCommand;