deeplyzer 0.9.0 → 0.10.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.
@@ -25,7 +25,7 @@ class OrchestratorAgent {
25
25
  if(runner.workflowRunner == "dynamic") {
26
26
  await this._runDynamicWorkflow(workflow);
27
27
  } else {
28
- await this._runOpenPackageWorkflow(workflow);
28
+ await this._runOpenPackageWorkflow(workflow, runner);
29
29
  }
30
30
  }
31
31
  }
@@ -38,7 +38,7 @@ class OrchestratorAgent {
38
38
  // GENERATE
39
39
  const generateResult = await this.generateAgent.generate(workflow.src, id);
40
40
 
41
- const setup = await this.runnerAgent.setupRuntime(generateResult);
41
+ const setup = await this.runnerAgent.setupRuntime(generateResult.runtimeCommands);
42
42
  if (!setup.complete) {
43
43
  Logger.error(`Setup of runtime for workflow: ${workflow.id} failed.`);
44
44
  return;
@@ -58,15 +58,26 @@ class OrchestratorAgent {
58
58
  return assessments;
59
59
  }
60
60
 
61
- async _runOpenPackageWorkflow(workflow, environment) {
62
- // run commands
63
- for(const command of environment.commands) {
64
- await execUtil.exec(command);
61
+ async _runOpenPackageWorkflow(workflow, runner) {
62
+ // Step 1: setup runtime, run servers
63
+ const commands = await this.runnerAgent.identifyRuntime(runner);
64
+ const setup = await this.runnerAgent.setupRuntime(commands.runtimeCommands);
65
+ if (!setup.complete) {
66
+ Logger.error(`Setup of runtime for workflow: ${workflow.id} failed.`);
67
+ return;
65
68
  }
66
69
 
67
- // workflow runner
68
- const workflowRunnerPackage = globals.openPackages.find(item => item.name === environment.workflowRunner);
70
+ if (commands.execCommands.length > 0) {
71
+ for (const command of commands.execCommands) {
72
+ const result = await this.runnerAgent.execCommand(command, "", commands.execCommands);
73
+ }
74
+ }
75
+
76
+ // Step 2: open package installation, execution
77
+ const workflowRunnerPackage = globals.openPackages.find(item => item.name === runner.workflowRunner);
69
78
  if (workflowRunnerPackage) {
79
+ await this.setupOpenPackage(workflowRunnerPackage.name, workflowRunnerPackage.installations);
80
+
70
81
  const result = await execUtil.createInstance(workflowRunnerPackage.name, workflowRunnerPackage.initClass);
71
82
  const instance = result.instance;
72
83
 
@@ -3,6 +3,7 @@ const PromptsUtil = require('../../../utils/promptsUtil');
3
3
  const Logger = require('../../../utils/logger');
4
4
  const globals = require('../../../globals');
5
5
  const execUtil = require('../../../utils/execUtil');
6
+ const os = require("os");
6
7
 
7
8
  class RunnerAgent {
8
9
  constructor() {
@@ -35,29 +36,38 @@ class RunnerAgent {
35
36
  );
36
37
  }
37
38
 
38
- async setupRuntime(generateResult) {
39
+ async identifyRuntime(runner) {
40
+ const files = this._getWorkflowFilePaths(runner.files);
41
+
42
+ let prompt = PromptsUtil.read("deep.runner.identify.runtime");
43
+ prompt = prompt.replaceAll("***FILES***", JSON.stringify(files));
44
+ prompt = prompt.replaceAll("***SHELL***", this._detectShell());
45
+ Logger.detailed("Identify runtime details: " + prompt);
46
+
47
+ const response = await this.llm.generate({ prompt: prompt, json: true });
48
+ Logger.detailed("Commands Generated: " + JSON.stringify(response));
49
+
50
+ return response.commands;
51
+ }
52
+
53
+ async setupRuntime(runtimeCommands) {
39
54
  // install runtime
40
55
  let results = [], complete = false;
41
56
 
42
57
  for (let attempts = 0; attempts < 3; attempts++) {
43
- results = await this._setupRuntime(generateResult.runtimeCommands, results);
44
- const assessment = await this._assessSetupRuntimeResults(generateResult.runtimeCommands, results);
58
+ results = await this._setupRuntime(runtimeCommands, results);
59
+ const assessment = await this._assessSetupRuntimeResults(runtimeCommands, results);
45
60
 
46
61
  if (assessment) { complete = true; break; }
47
62
  }
48
63
 
49
- /*// install open package if required for the runner
50
- const workflowRunnerPackage = globals.openPackages.find(item => item.name === runner.workflowRunner);
51
- if (workflowRunnerPackage) {
52
- results = await this._setupOpenPackage(workflowRunnerPackage.name, workflowRunnerPackage.installations);
53
- }*/
54
-
55
64
  return { complete: complete }
56
65
  }
57
66
 
58
- async execCommand(command, id) {
67
+ async execCommand(command, id, allCommands) {
59
68
  let result = null, results = [], complete = false;
60
- let cmd = command;
69
+ let cmd = typeof command === "string" ? { detached: false, cmd: command } : command;
70
+ let cmds = [cmd];
61
71
 
62
72
  Logger.detailed("Initiating command execution: " + command);
63
73
 
@@ -65,30 +75,32 @@ class RunnerAgent {
65
75
  if (results.length > 0) {
66
76
  let prompt = PromptsUtil.read("deep.runner.command");
67
77
 
68
- const executionHistory = results.map((item, index) => {
69
- return `COMMAND ${index + 1}: ${item.command}
70
- RESULT ${index + 1}:
71
- ${JSON.stringify(item.result)}`;
72
- }).join("\n\n");
78
+ let executionHistory = results.map((item, index) => {
79
+ return `COMMAND ${index + 1}: ${
80
+ typeof item.command === "object" && item.command !== null
81
+ ? JSON.stringify(item.command) : item.command ?? "NOT_AVAILABLE"
82
+ }
83
+ RESULT ${index + 1}: ${JSON.stringify(item.result)}`;}).join("\n\n");
73
84
 
74
- prompt = prompt.replaceAll("***COMMAND***", JSON.stringify(cmd));
85
+ prompt = prompt.replaceAll("***INITIAL_COMMANDS***", allCommands == null ? "NOT_AVAILABLE" : JSON.stringify(allCommands));
86
+ prompt = prompt.replaceAll("***COMMAND***", JSON.stringify(cmds));
75
87
  prompt = prompt.replaceAll("***OS***", process.platform);
88
+ prompt = prompt.replaceAll("***SHELL***", this._detectShell());
76
89
  prompt = prompt.replaceAll("***RESULT***", executionHistory);
77
90
  Logger.detailed("Exec command details: " + prompt);
78
91
 
79
92
  const response = await this.llm.generate({ prompt: prompt, json: true });
80
93
  Logger.detailed("Command Generated: " + JSON.stringify(response));
81
94
 
82
- cmd = response.command;
95
+ cmds = response.commands;
83
96
  }
84
97
 
85
- result = await execUtil.exec(cmd, id);
86
- results.push({
87
- command: cmd,
88
- result: result
89
- });
98
+ for(const cmd of cmds) {
99
+ result = await execUtil.exec(cmd.cmd, id, cmd.detached);
100
+ results.push({ command: cmd, result: result });
101
+ }
90
102
 
91
- const assessment = await this._assessExecCommandResults(cmd, result);
103
+ const assessment = await this._assessExecCommandResults(cmds, result);
92
104
 
93
105
  if (assessment) { complete = true; break; }
94
106
  }
@@ -96,7 +108,7 @@ class RunnerAgent {
96
108
  return { complete: complete }
97
109
  }
98
110
 
99
- async _setupOpenPackage(packageName, installations) {
111
+ async setupOpenPackage(packageName, installations) {
100
112
  const results = [];
101
113
 
102
114
  const installResult = await execUtil.installPackage(packageName);
@@ -123,6 +135,7 @@ class RunnerAgent {
123
135
  let prompt = PromptsUtil.read("deep.runner.runtime");
124
136
  prompt = prompt.replaceAll("***RUNTIME_DETAILS***", JSON.stringify(runtimeCommands));
125
137
  prompt = prompt.replaceAll("***OS***", process.platform);
138
+ prompt = prompt.replaceAll("***SHELL***", this._detectShell());
126
139
  prompt = prompt.replaceAll("***RESULTS***", JSON.stringify(existingResults ?? "NONE"));
127
140
  Logger.detailed("Setup runtime details: " + prompt);
128
141
 
@@ -154,9 +167,9 @@ class RunnerAgent {
154
167
  return String(response || "").trim().toUpperCase() === "TRUE";
155
168
  }
156
169
 
157
- async _assessExecCommandResults(command, results) {
170
+ async _assessExecCommandResults(commands, results) {
158
171
  let prompt = PromptsUtil.read("deep.runner.assess.command");
159
- prompt = prompt.replaceAll("***COMMAND***", command);
172
+ prompt = prompt.replaceAll("***COMMAND***", JSON.stringify(commands));
160
173
  prompt = prompt.replaceAll("***RESULTS***", JSON.stringify(results ?? "NONE"));
161
174
  Logger.detailed("Assess run command details: " + prompt);
162
175
 
@@ -165,6 +178,38 @@ class RunnerAgent {
165
178
 
166
179
  return String(response || "").trim().toUpperCase() === "TRUE";
167
180
  }
181
+
182
+ _getWorkflowFilePaths(files) {
183
+ const fileNames = new Set(files);
184
+
185
+ const sourcePaths = new Set();
186
+
187
+ for (const graph of globals.graphs || []) {
188
+ if (fileNames.has(graph.file?.file) && graph.file?.path) {
189
+ sourcePaths.add(graph.file.path);
190
+ }
191
+ }
192
+
193
+ return [...sourcePaths];
194
+ }
195
+
196
+ _detectShell() {
197
+ if (process.platform !== "win32") {
198
+ return process.env.SHELL || "bash";
199
+ }
200
+
201
+ // PowerShell sets this environment variable
202
+ if (process.env.PSModulePath) {
203
+ return "powershell";
204
+ }
205
+
206
+ // CMD normally exposes ComSpec pointing to cmd.exe
207
+ if (process.env.ComSpec?.toLowerCase().endsWith("\\cmd.exe")) {
208
+ return "cmd";
209
+ }
210
+
211
+ return "unknown";
212
+ }
168
213
  }
169
214
 
170
215
  module.exports = RunnerAgent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeplyzer",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Go beyond static code analysis. End-to-end intelligence across code, execution flows, databases, and cloud infrastructure.",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -27,6 +27,7 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "axios": "^1.21.1",
30
+ "cli-progress": "^3.12.0",
30
31
  "playwright": "^1.65.1"
31
32
  }
32
33
  }
@@ -1,9 +1,13 @@
1
1
  # COMMAND GENERATOR
2
2
 
3
- You are an execution controller responsible for analyzing the complete history of command executions, identifying the original objective, diagnosing failures, tracking execution progress, and generating the single best next command.
3
+ You are an execution controller responsible for analyzing the complete history of command executions, identifying the original objective, diagnosing failures, tracking execution progress, and generating the single best next executable command.
4
4
 
5
5
  ## INPUT
6
6
 
7
+ **INITIAL COMMANDS INTENDED TO BE EXECUTED**
8
+
9
+ ***INITIAL_COMMANDS***
10
+
7
11
  **COMMAND EXECUTED**
8
12
 
9
13
  ***COMMAND***
@@ -12,10 +16,15 @@ You are an execution controller responsible for analyzing the complete history o
12
16
 
13
17
  ***OS***
14
18
 
19
+ **SHELL:**
20
+
21
+ ***SHELL***
22
+
15
23
  **PREVIOUS EXECUTION RESULT**
16
24
 
17
25
  ***RESULT***
18
26
 
27
+
19
28
  The execution history may contain one or more previously executed commands and their corresponding results, ordered chronologically from oldest to newest.
20
29
 
21
30
  ## OBJECTIVE
@@ -26,9 +35,7 @@ The original intent MUST be inferred from the earliest command in the execution
26
35
 
27
36
  Preserve this original intent throughout all subsequent executions. Do not lose, replace, narrow, or reinterpret the objective based on intermediate commands or failures.
28
37
 
29
- ## DECISION RULES
30
-
31
- ### 1. Identify Original Intent
38
+ ## 1. IDENTIFY ORIGINAL INTENT
32
39
 
33
40
  - Analyze the earliest command in the execution history to identify the original intended operation.
34
41
  - Understand the expected final outcome of that operation.
@@ -37,8 +44,17 @@ Preserve this original intent throughout all subsequent executions. Do not lose,
37
44
  - Never mistake an intermediate corrective command for the original objective.
38
45
  - If the earliest command is a diagnostic or prerequisite command, infer the broader objective from the subsequent execution history when sufficient evidence exists.
39
46
  - If the original intent cannot be determined confidently, use the available evidence to make the most conservative useful determination.
47
+ - Treat `***INITIAL_COMMANDS***` as the authoritative initial execution plan when provided.
48
+ - Analyze the initial commands to understand the complete intended operation and expected final outcome.
49
+ - Treat the first command in `***INITIAL_COMMANDS***` as the starting point of the execution plan, not necessarily the entire objective.
50
+ - Use the execution history to determine which initial commands have been completed, partially completed, failed, or remain pending.
51
+ - Preserve the original order and dependencies of the initial commands unless execution evidence establishes that a different order is necessary.
52
+ - Generate the next command from the remaining initial execution plan whenever possible.
53
+ - If the initial execution plan is empty or unavailable, infer the original intent from the earliest executed command as before.
54
+ - Do not blindly execute all remaining initial commands if earlier failures or execution results require corrective action first.
40
55
 
41
- ### 2. Analyze Complete Execution History
56
+
57
+ ## 2. ANALYZE COMPLETE EXECUTION HISTORY
42
58
 
43
59
  Analyze all previous command executions chronologically.
44
60
 
@@ -56,7 +72,7 @@ Maintain a cumulative understanding of the current execution state.
56
72
 
57
73
  Do not evaluate the latest command in isolation.
58
74
 
59
- ### 3. Track Execution Progress
75
+ ## 3. TRACK EXECUTION PROGRESS
60
76
 
61
77
  Classify operations into:
62
78
 
@@ -70,7 +86,7 @@ Use the most recent reliable evidence to determine the current state.
70
86
 
71
87
  Do not repeat completed operations or assume an earlier failure remains unresolved when subsequent evidence confirms its correction.
72
88
 
73
- ### 4. Diagnose Failures
89
+ ## 4. DIAGNOSE FAILURES
74
90
 
75
91
  For unresolved failures:
76
92
 
@@ -82,24 +98,76 @@ For unresolved failures:
82
98
  - Do not repeat failed commands without addressing their failure causes.
83
99
  - If the root cause cannot be established confidently, generate a diagnostic command.
84
100
 
85
- ### 5. Generate the Next Command
86
101
 
87
- Generate the single most useful next command based on the original intent and cumulative execution state.
102
+ ## 5. GENERATE THE NEXT COMMANDS
103
+
104
+ Generate an ordered array of the most useful next executable commands based on the original intent, initial execution plan, and cumulative execution state.
88
105
 
106
+ - Continue executing pending commands from the initial execution plan whenever possible.
107
+ - Generate corrective commands when unresolved failures prevent the execution plan from progressing.
89
108
  - Correct invalid command syntax.
90
109
  - Resolve incorrect paths and working-directory assumptions.
91
110
  - Install missing prerequisites when necessary.
92
111
  - Correct environment and configuration issues when supported by evidence.
93
- - Address permission issues using OS-compatible commands.
112
+ - Address permission issues using OS- and shell-compatible commands.
94
113
  - Complete partially successful operations.
95
114
  - Retry failed operations only after correcting their underlying causes.
96
115
  - Use alternative execution methods when previous approaches have demonstrably failed.
97
116
  - Verify successful operations whose outcomes remain unconfirmed.
98
117
  - Continue the original operation once blocking issues are resolved.
118
+ - Generate multiple commands when they are required to complete the next logical execution steps.
119
+ - Preserve command dependencies and execution order.
120
+ - Do not include commands that have already completed successfully.
121
+ - Do not generate commands for operations that are blocked by unresolved prerequisites.
122
+ - Prefer the minimum number of commands necessary to make meaningful progress.
123
+ - If a corrective action is required, prioritize it over continuing with dependent commands.
124
+ - If the original objective has been fully achieved, return an empty commands array.
125
+
126
+ ### Detached Execution Classification
127
+
128
+ Every generated command MUST include a `detached` boolean property.
129
+
130
+ Set `detached` to `true` when:
131
+
132
+ - Starting a long-running application or service.
133
+ - Starting a development server that must continue running.
134
+ - Starting a background process that should not block subsequent execution.
135
+ - Starting a process that is expected to remain active until explicitly terminated.
136
+
137
+ Examples:
138
+
139
+ - `npx ng serve` → `detached: true`
140
+ - `npm run dev` → `detached: true`
141
+ - `npm start` → `detached: true`
142
+ - Starting a persistent backend server → `detached: true`
143
+
144
+ Set `detached` to `false` when:
99
145
 
100
- Every generated command must contribute directly to completing the inferred original intent.
146
+ - Installing dependencies.
147
+ - Building or compiling an application.
148
+ - Running finite scripts.
149
+ - Executing diagnostic commands.
150
+ - Checking files, configurations, or runtime versions.
151
+ - Performing one-time operations that should complete before proceeding.
101
152
 
102
- ### 6. Handle Repeated Failures
153
+ Examples:
154
+
155
+ - `npm install` → `detached: false`
156
+ - `npm run build` → `detached: false`
157
+ - `python validate_calculator.py` → `detached: false`
158
+ - `node --version` → `detached: false`
159
+
160
+ Important rules:
161
+
162
+ 1. Determine detached status from the intended process lifecycle, not merely command execution duration.
163
+ 2. A command taking several minutes does not automatically qualify as detached.
164
+ 3. Commands that must complete successfully before subsequent commands execute must use `detached: false`.
165
+ 4. Commands intended to remain running independently must use `detached: true`.
166
+ 5. Never omit the detached property.
167
+ 6. Never use strings such as "true" or "false"; use actual JSON booleans.
168
+ 7. Preserve the original command execution dependencies and ordering.
169
+
170
+ ## 6. HANDLE REPEATED FAILURES
103
171
 
104
172
  - Never blindly repeat previously failed commands.
105
173
  - Consider all previous error messages before selecting another approach.
@@ -108,7 +176,7 @@ Every generated command must contribute directly to completing the inferred orig
108
176
  - Avoid unnecessary cleanup, resets, or modifications.
109
177
  - Do not generate commands that reproduce known failures without a corrective change.
110
178
 
111
- ### 7. Verify Completion
179
+ ## 7. VERIFY COMPLETION
112
180
 
113
181
  Determine whether the original intended operation has been successfully completed.
114
182
 
@@ -119,7 +187,106 @@ Determine whether the original intended operation has been successfully complete
119
187
 
120
188
  If the original intent has been achieved and no further action is necessary, return an empty command.
121
189
 
122
- ## COMMAND SELECTION PRIORITY
190
+ ## 8. OPERATING SYSTEM AND SHELL IDENTIFICATION
191
+
192
+ Identify the operating system and shell independently.
193
+
194
+ **Operating System (`***OS***`):**
195
+
196
+ Supported values:
197
+
198
+ - `win32`: Windows
199
+ - `linux`: Linux
200
+ - `darwin`: macOS
201
+
202
+ **Shell (`***SHELL***`):**
203
+
204
+ Supported values:
205
+
206
+ - `powershell`: Windows PowerShell
207
+ - `cmd`: Windows Command Prompt
208
+ - `bash`: Bash
209
+ - `zsh`: Zsh
210
+
211
+ The explicitly supplied shell is authoritative.
212
+
213
+ Do not infer the shell from the operating system when a shell value is supplied.
214
+
215
+ If the shell is missing or unknown, infer it only when execution history provides reliable evidence. Otherwise, return an empty command.
216
+
217
+ Ensure the shell is compatible with the supplied operating system. If they are incompatible, return an empty command.
218
+
219
+ ## 9. SHELL-SPECIFIC COMMAND GENERATION
220
+
221
+ All generated commands MUST use syntax supported by the identified shell.
222
+
223
+ ### PowerShell
224
+
225
+ Use PowerShell-compatible syntax exclusively.
226
+
227
+ - Directory changes: `Set-Location "C:\Projects\my-app"`
228
+ - Environment variables: `$env:VARIABLE`
229
+ - Command chaining: `;`
230
+ - Conditional chaining: `if ($LASTEXITCODE -eq 0) { ... }`
231
+ - Executable lookup: `Get-Command node -ErrorAction SilentlyContinue`
232
+ - File existence: `Test-Path "C:\path\to\file"`
233
+ - Native executable exit codes: `$LASTEXITCODE`
234
+
235
+ Do not use CMD-specific syntax such as `cd /d`, `%VARIABLE%`, or CMD batch constructs.
236
+
237
+ ### Windows CMD
238
+
239
+ Use Windows CMD-compatible syntax exclusively.
240
+
241
+ - Directory changes: `cd /d "C:\Projects\my-app"`
242
+ - Environment variables: `%VARIABLE%`
243
+ - Command chaining: `&`
244
+ - Conditional chaining: `&&`
245
+ - Executable lookup: `where node`
246
+ - File existence: `if exist "C:\path\to\file"`
247
+ - Exit codes: `%ERRORLEVEL%`
248
+
249
+ Do not use PowerShell-specific syntax such as `$env:VARIABLE`, `Set-Location`, or `Get-Command`.
250
+
251
+ ### Linux Bash
252
+
253
+ Use Bash-compatible syntax exclusively.
254
+
255
+ - Directory changes: `cd "/path/to/project"`
256
+ - Environment variables: `$VARIABLE`
257
+ - Command chaining: `;`
258
+ - Conditional chaining: `&&`
259
+ - Executable lookup: `command -v node`
260
+ - File existence: `test -f "/path/to/file"`
261
+ - Exit codes: `$?`
262
+
263
+ ### macOS Bash / Zsh
264
+
265
+ Use Bash/Zsh-compatible syntax exclusively.
266
+
267
+ - Directory changes: `cd "/path/to/project"`
268
+ - Environment variables: `$VARIABLE`
269
+ - Command chaining: `;`
270
+ - Conditional chaining: `&&`
271
+ - Executable lookup: `command -v node`
272
+ - File existence: `test -f "/path/to/file"`
273
+ - Exit codes: `$?`
274
+
275
+ ### General Shell Rules
276
+
277
+ 1. Never mix syntax from different shells.
278
+ 2. Do not generate CMD commands when PowerShell is selected.
279
+ 3. Do not generate PowerShell commands when CMD is selected.
280
+ 4. Use correct executable invocation syntax.
281
+ 5. Quote paths containing spaces or special characters.
282
+ 6. Preserve Windows drive letters and path separators.
283
+ 7. Use the appropriate environment variable syntax.
284
+ 8. Use shell-compatible command chaining and exit-code handling.
285
+ 9. Prefer simple commands over complicated shell expressions.
286
+ 10. Do not wrap commands in another shell unless explicitly required by the original objective.
287
+ 11. If a command requires shell-specific escaping, ensure the final command remains valid when passed directly to the specified shell.
288
+
289
+ ## 10. COMMAND SELECTION PRIORITY
123
290
 
124
291
  1. Resolve unresolved blocking errors.
125
292
  2. Correct identified command, path, or configuration issues.
@@ -130,39 +297,65 @@ If the original intent has been achieved and no further action is necessary, ret
130
297
  7. Continue executing the original intended operation.
131
298
  8. Return an empty command when the original objective is fully achieved.
132
299
 
133
- ## OS-SPECIFIC COMMAND GENERATION
134
-
135
- 1. Identify the operating system from ***OS***.
136
- 2. Generate commands exclusively using syntax supported by that OS.
137
- 3. Select the appropriate interpreter:
138
- - win32: Windows CMD or PowerShell.
139
- - linux: Bash.
140
- - darwin: Bash or Zsh.
141
- 4. Use compatible executable names, paths, quoting, environment variables, and command chaining.
142
- 5. Never generate commands from another operating system.
143
- 6. If the OS is unknown or unsupported, return an empty command.
144
-
145
- ## COMMAND REQUIREMENTS
300
+ ## 11. COMMAND REQUIREMENTS
146
301
 
147
- - Generate exactly ONE executable command.
302
+ - Generate an ordered array of command objects.
303
+ - Return one or more commands depending on the current execution state.
304
+ - Each array element MUST contain exactly two properties:
305
+ - `cmd`: The actual executable shell command.
306
+ - `detached`: Boolean indicating whether the process should run independently in the background.
307
+ - Each `cmd` must contain exactly ONE executable command.
148
308
  - Prefer simple and deterministic commands.
149
309
  - Do not combine unrelated operations.
310
+ - Preserve command dependencies and execution order.
150
311
  - Do not include explanations, comments, or Markdown.
151
- - Do not generate alternative commands.
152
- - Do not modify project source files unless necessary for the original objective.
312
+ - Do not generate alternative commands for the same operation.
313
+ - Do not repeat successfully completed operations.
153
314
  - Preserve successful work from previous executions.
154
- - Ensure the command makes meaningful progress toward the original intent.
315
+ - Ensure every command contributes directly to completing the original intent.
316
+ - Ensure all commands are compatible with the identified operating system and shell.
317
+ - Do not invent paths, filenames, environment variables, or executable names.
318
+ - Use `detached: true` for processes intended to remain running independently.
319
+ - Use `detached: false` for finite commands that should complete before proceeding.
320
+ - Every command object MUST contain both properties, regardless of detached status.
321
+ - Return an empty array if no further execution is necessary.
155
322
 
156
- ## OUTPUT FORMAT
323
+ ## 12. OUTPUT FORMAT
157
324
 
158
- Return ONLY a valid JSON object with exactly one field:
325
+ Return ONLY a valid JSON object with exactly one field.
159
326
 
160
327
  {
161
- "command": "executable command"
328
+ "commands": [
329
+ {
330
+ "detached": false,
331
+ "cmd": "command 1"
332
+ },
333
+ {
334
+ "detached": true,
335
+ "cmd": "command 2"
336
+ }
337
+ ]
162
338
  }
163
339
 
164
- If the original intended operation is successfully completed and no further action is required, return:
340
+ If the original intended operation is successfully completed:
165
341
 
166
342
  {
167
- "command": ""
168
- }
343
+ "commands": []
344
+ }
345
+
346
+ If the operating system or shell is unsupported or cannot be reliably identified:
347
+
348
+ {
349
+ "commands": []
350
+ }
351
+
352
+ ### Output Validation Rules
353
+
354
+ 1. `commands` MUST be an array.
355
+ 2. Every array element MUST be an object.
356
+ 3. Every command object MUST contain exactly `detached` and `cmd`.
357
+ 4. `detached` MUST be a JSON boolean.
358
+ 5. `cmd` MUST be a non-empty string.
359
+ 6. Commands MUST be ordered according to execution dependencies.
360
+ 7. Do not include additional JSON properties.
361
+ 8. Return valid JSON without Markdown or explanations.