prompt-language-shell 0.6.8 → 0.7.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.js CHANGED
@@ -4,6 +4,7 @@ import { existsSync, readFileSync } from 'fs';
4
4
  import { dirname, join } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { render } from 'ink';
7
+ import { DebugLevel } from './services/configuration.js';
7
8
  import { Main } from './ui/Main.js';
8
9
  const __filename = fileURLToPath(import.meta.url);
9
10
  const __dirname = dirname(__filename);
@@ -20,7 +21,7 @@ const app = {
20
21
  version: packageJson.version,
21
22
  description: packageJson.description,
22
23
  isDev,
23
- isDebug: false,
24
+ debug: DebugLevel.None,
24
25
  };
25
26
  // Get command from command-line arguments
26
27
  const args = process.argv.slice(2);
@@ -1,5 +1,6 @@
1
1
  import Anthropic from '@anthropic-ai/sdk';
2
2
  import { getAvailableConfigStructure, getConfiguredKeys, } from './configuration.js';
3
+ import { logPrompt, logResponse } from './logger.js';
3
4
  import { formatSkillsForPrompt, loadSkillsWithValidation } from './skills.js';
4
5
  import { toolRegistry } from './registry.js';
5
6
  /**
@@ -70,7 +71,7 @@ export class AnthropicService {
70
71
  if (toolName === 'config') {
71
72
  const configStructure = getAvailableConfigStructure();
72
73
  const configuredKeys = getConfiguredKeys();
73
- const configSection = '\n\n## Available Configuration\n\n' +
74
+ const configSection = '\n## Available Configuration\n\n' +
74
75
  'Config structure (key: description):\n' +
75
76
  JSON.stringify(configStructure, null, 2) +
76
77
  '\n\nConfigured keys (keys that exist in config file):\n' +
@@ -85,7 +86,15 @@ export class AnthropicService {
85
86
  name: 'web_search',
86
87
  });
87
88
  }
89
+ // Collect debug components
90
+ const debug = [];
91
+ // Log prompt at Verbose level
92
+ const promptDebug = logPrompt(toolName, command, systemPrompt);
93
+ if (promptDebug) {
94
+ debug.push(promptDebug);
95
+ }
88
96
  // Call API with tool
97
+ const startTime = Date.now();
89
98
  const response = await this.client.messages.create({
90
99
  model: this.model,
91
100
  max_tokens: 1024,
@@ -99,6 +108,12 @@ export class AnthropicService {
99
108
  },
100
109
  ],
101
110
  });
111
+ const duration = Date.now() - startTime;
112
+ // Log response at Verbose level
113
+ const responseDebug = logResponse(toolName, response, duration);
114
+ if (responseDebug) {
115
+ debug.push(responseDebug);
116
+ }
102
117
  // Check for truncation
103
118
  if (response.stop_reason === 'max_tokens') {
104
119
  throw new Error('Response was truncated due to length. Please simplify your request or break it into smaller parts.');
@@ -113,6 +128,7 @@ export class AnthropicService {
113
128
  message: '',
114
129
  tasks: [],
115
130
  answer: cleanAnswerText(textContent.text),
131
+ debug,
116
132
  };
117
133
  }
118
134
  }
@@ -143,6 +159,7 @@ export class AnthropicService {
143
159
  message: input.message,
144
160
  tasks: [],
145
161
  commands: input.commands,
162
+ debug,
146
163
  };
147
164
  }
148
165
  // Handle answer tool response
@@ -157,6 +174,7 @@ export class AnthropicService {
157
174
  message: '',
158
175
  tasks: [],
159
176
  answer: cleanAnswerText(input.answer),
177
+ debug,
160
178
  };
161
179
  }
162
180
  // Handle plan and introspect tool responses
@@ -175,6 +193,7 @@ export class AnthropicService {
175
193
  return {
176
194
  message: input.message,
177
195
  tasks: input.tasks,
196
+ debug,
178
197
  };
179
198
  }
180
199
  }
@@ -252,6 +252,17 @@ export function createMessage(text) {
252
252
  },
253
253
  };
254
254
  }
255
+ export function createDebugDefinition(title, content, color) {
256
+ return {
257
+ id: randomUUID(),
258
+ name: ComponentName.Debug,
259
+ props: {
260
+ title,
261
+ content,
262
+ color,
263
+ },
264
+ };
265
+ }
255
266
  export function createRefinement(text, onAborted) {
256
267
  return {
257
268
  id: randomUUID(),
@@ -9,6 +9,13 @@ export var AnthropicModel;
9
9
  AnthropicModel["Opus"] = "claude-opus-4-1";
10
10
  })(AnthropicModel || (AnthropicModel = {}));
11
11
  export const SUPPORTED_MODELS = Object.values(AnthropicModel);
12
+ export var DebugLevel;
13
+ (function (DebugLevel) {
14
+ DebugLevel["None"] = "none";
15
+ DebugLevel["Info"] = "info";
16
+ DebugLevel["Verbose"] = "verbose";
17
+ })(DebugLevel || (DebugLevel = {}));
18
+ export const SUPPORTED_DEBUG_LEVELS = Object.values(DebugLevel);
12
19
  export var ConfigDefinitionType;
13
20
  (function (ConfigDefinitionType) {
14
21
  ConfigDefinitionType["RegExp"] = "regexp";
@@ -62,8 +69,17 @@ function validateConfig(parsed) {
62
69
  if (config.settings && typeof config.settings === 'object') {
63
70
  const settings = config.settings;
64
71
  validatedConfig.settings = {};
65
- if ('debug' in settings && typeof settings.debug === 'boolean') {
66
- validatedConfig.settings.debug = settings.debug;
72
+ if ('debug' in settings) {
73
+ // Handle migration from boolean to enum
74
+ if (typeof settings.debug === 'boolean') {
75
+ validatedConfig.settings.debug = settings.debug
76
+ ? DebugLevel.Info
77
+ : DebugLevel.None;
78
+ }
79
+ else if (typeof settings.debug === 'string' &&
80
+ SUPPORTED_DEBUG_LEVELS.includes(settings.debug)) {
81
+ validatedConfig.settings.debug = settings.debug;
82
+ }
67
83
  }
68
84
  }
69
85
  return validatedConfig;
@@ -139,10 +155,10 @@ export function saveDebugSetting(debug) {
139
155
  export function loadDebugSetting() {
140
156
  try {
141
157
  const config = loadConfig();
142
- return config.settings?.debug ?? false;
158
+ return config.settings?.debug ?? DebugLevel.None;
143
159
  }
144
160
  catch {
145
- return false;
161
+ return DebugLevel.None;
146
162
  }
147
163
  }
148
164
  /**
@@ -193,8 +209,10 @@ const coreConfigSchema = {
193
209
  description: 'Anthropic model',
194
210
  },
195
211
  'settings.debug': {
196
- type: ConfigDefinitionType.Boolean,
212
+ type: ConfigDefinitionType.Enum,
197
213
  required: false,
214
+ values: SUPPORTED_DEBUG_LEVELS,
215
+ default: DebugLevel.None,
198
216
  description: 'Debug mode',
199
217
  },
200
218
  };
@@ -0,0 +1,64 @@
1
+ import { createDebugDefinition } from './components.js';
2
+ import { DebugLevel, loadDebugSetting } from './configuration.js';
3
+ import { Palette } from './colors.js';
4
+ /**
5
+ * Debug logger for the application
6
+ * Logs information based on the current debug level setting
7
+ */
8
+ let currentDebugLevel = DebugLevel.None;
9
+ /**
10
+ * Initialize the logger with the current debug level from config
11
+ */
12
+ export function initializeLogger() {
13
+ currentDebugLevel = loadDebugSetting();
14
+ }
15
+ /**
16
+ * Set the debug level (used for testing or runtime changes)
17
+ */
18
+ export function setDebugLevel(debug) {
19
+ currentDebugLevel = debug;
20
+ }
21
+ /**
22
+ * Get the current debug level
23
+ */
24
+ export function getDebugLevel() {
25
+ return currentDebugLevel;
26
+ }
27
+ /**
28
+ * Create debug component for system prompts sent to the LLM
29
+ * Only creates at Verbose level
30
+ */
31
+ export function logPrompt(toolName, command, instructions) {
32
+ if (currentDebugLevel !== DebugLevel.Verbose) {
33
+ return null;
34
+ }
35
+ const content = [
36
+ '',
37
+ `Tool: ${toolName}`,
38
+ `Command: ${command}`,
39
+ '',
40
+ instructions,
41
+ ].join('\n');
42
+ // Calculate stats for the instructions
43
+ const lines = instructions.split('\n').length;
44
+ const bytes = Buffer.byteLength(instructions, 'utf-8');
45
+ const title = `SYSTEM PROMPT (${String(lines)} lines, ${String(bytes)} bytes)`;
46
+ return createDebugDefinition(title, content, Palette.Gray);
47
+ }
48
+ /**
49
+ * Create debug component for LLM responses received
50
+ * Only creates at Verbose level
51
+ */
52
+ export function logResponse(toolName, response, durationMs) {
53
+ if (currentDebugLevel !== DebugLevel.Verbose) {
54
+ return null;
55
+ }
56
+ const content = [
57
+ '',
58
+ `Tool: ${toolName}`,
59
+ '',
60
+ JSON.stringify(response, null, 2),
61
+ ].join('\n');
62
+ const title = `LLM RESPONSE (${String(durationMs)} ms)`;
63
+ return createDebugDefinition(title, content, Palette.AshGray);
64
+ }
@@ -1,4 +1,4 @@
1
- import { loadDebugSetting } from './configuration.js';
1
+ import { DebugLevel, loadDebugSetting } from './configuration.js';
2
2
  export { formatDuration } from './utils.js';
3
3
  /**
4
4
  * Returns a natural language confirmation message for plan execution.
@@ -96,7 +96,7 @@ export const FeedbackMessages = {
96
96
  */
97
97
  export function formatErrorMessage(error) {
98
98
  const rawMessage = error instanceof Error ? error.message : 'Unknown error occurred';
99
- if (loadDebugSetting()) {
99
+ if (loadDebugSetting() !== DebugLevel.None) {
100
100
  return rawMessage;
101
101
  }
102
102
  // Try to extract message from Anthropic API error format
@@ -24,6 +24,10 @@ export async function handleRefinement(selectedTasks, service, originalCommand,
24
24
  const refinedResult = await service.processWithTool(refinedCommand, 'plan');
25
25
  // Complete the Refinement component
26
26
  handlers.completeActive();
27
+ // Add debug components to timeline if present
28
+ if (refinedResult.debug && refinedResult.debug.length > 0) {
29
+ handlers.addToTimeline(...refinedResult.debug);
30
+ }
27
31
  // Route refined tasks to appropriate components
28
32
  routeTasksWithConfirm(refinedResult.tasks, refinedResult.message, service, originalCommand, handlers, false // No DEFINE tasks in refined result
29
33
  );
@@ -131,7 +131,6 @@ export function formatSkillsForPrompt(skills) {
131
131
  return '';
132
132
  }
133
133
  const header = `
134
-
135
134
  ## Available Skills
136
135
 
137
136
  The following skills define domain-specific workflows. When the user's
@@ -147,7 +146,7 @@ brackets for additional information. Use commas instead. For example:
147
146
  - WRONG: "Build project Alpha (the legacy version)"
148
147
 
149
148
  `;
150
- const skillsContent = skills.join('\n\n');
149
+ const skillsContent = skills.map((s) => s.trim()).join('\n\n');
151
150
  return header + skillsContent;
152
151
  }
153
152
  /**
@@ -5,9 +5,9 @@ command-line concierge. Your role is to **answer questions** and provide
5
5
  up-to-date information when a task with type "answer" has been planned and
6
6
  confirmed.
7
7
 
8
- **IMPORTANT**: Use web search to find current, accurate information. This tool
9
- is designed for quick answers from the terminal without needing to open a web
10
- browser. Always search for the latest data rather than relying solely on
8
+ **IMPORTANT**: Use web search to find current, accurate information. This
9
+ tool is designed for quick answers from the terminal without needing to open a
10
+ web browser. Always search for the latest data rather than relying solely on
11
11
  training data.
12
12
 
13
13
  ## Execution Flow
@@ -60,11 +60,11 @@ TypeScript code compiles to JavaScript and runs anywhere JavaScript runs.
60
60
 
61
61
  Bad answer (too verbose):
62
62
  ```
63
- TypeScript is a strongly typed programming language that builds on JavaScript,
64
- giving you better tooling at any scale. TypeScript adds additional syntax to
65
- JavaScript to support a tighter integration with your editor. It catches errors
66
- early in development by checking types. TypeScript code converts to JavaScript
67
- which runs anywhere.
63
+ TypeScript is a strongly typed programming language that builds on
64
+ JavaScript, giving you better tooling at any scale. TypeScript adds
65
+ additional syntax to JavaScript to support a tighter integration with your
66
+ editor. It catches errors early in development by checking types. TypeScript
67
+ code converts to JavaScript which runs anywhere.
68
68
  ```
69
69
 
70
70
  ### Example 2: Technical explanation
@@ -101,7 +101,8 @@ They enable cleaner, more reusable component logic.
101
101
 
102
102
  ## Guidelines
103
103
 
104
- 1. **Be direct**: Answer the question immediately, don't introduce your answer
104
+ 1. **Be direct**: Answer the question immediately, don't introduce your
105
+ answer
105
106
  2. **Be accurate**: Provide correct, factual information
106
107
  3. **Be concise**: Respect the 4-line, 80-character constraints strictly
107
108
  4. **Be helpful**: Focus on what the user needs to know
@@ -1,33 +1,40 @@
1
1
  ## Overview
2
2
 
3
- You are the CONFIG tool for "pls" (please), a professional command-line concierge.
4
- Your role is to determine which configuration settings the user wants to configure
5
- based on their query.
3
+ You are the CONFIG tool for "pls" (please), a professional command-line
4
+ concierge. Your role is to determine which configuration settings the user
5
+ wants to configure based on their query.
6
6
 
7
7
  ## Input
8
8
 
9
9
  You will receive:
10
- - `configStructure`: Object mapping config keys to descriptions (e.g., {"anthropic.key": "Anthropic API key", "settings.debug": "Debug mode (optional)"})
11
- - `configuredKeys`: Array of keys that exist in the user's config file (e.g., ["anthropic.key", "anthropic.model", "settings.debug"])
10
+ - `configStructure`: Object mapping config keys to descriptions (e.g.,
11
+ {"anthropic.key": "Anthropic API key", "settings.debug": "Debug mode
12
+ (optional)"})
13
+ - `configuredKeys`: Array of keys that exist in the user's config file
14
+ (e.g., ["anthropic.key", "anthropic.model", "settings.debug"])
12
15
  - `query`: User's request (e.g., "app", "mode", "anthropic", or empty)
13
16
 
14
17
  ## Task
15
18
 
16
- Determine which config keys the user wants to configure and return them as tasks.
19
+ Determine which config keys the user wants to configure and return them
20
+ as tasks.
17
21
 
18
22
  ## Mapping Rules
19
23
 
20
24
  ### Query: "app" or empty/unclear
21
25
  - Return all **required** config keys (those needed for the app to work)
22
- - Also include any keys marked as "(optional)" that appear in `configuredKeys` (optional settings that exist in user's config file)
23
- - Also include any keys marked as "(discovered)" (they exist in user's config file but aren't in schema)
26
+ - Also include any keys marked as "(optional)" that appear in
27
+ `configuredKeys` (optional settings that exist in user's config file)
28
+ - Also include any keys marked as "(discovered)" (they exist in user's
29
+ config file but aren't in schema)
24
30
  - Required keys: `anthropic.key`, `anthropic.model`
25
31
 
26
32
  ### Query: "mode"
27
33
  - Return only: `settings.debug`
28
34
 
29
35
  ### Query: "anthropic"
30
- - Return all keys starting with `anthropic.` (usually `anthropic.key` and `anthropic.model`)
36
+ - Return all keys starting with `anthropic.` (usually `anthropic.key` and
37
+ `anthropic.model`)
31
38
 
32
39
  ### Other queries
33
40
  - Match the query against config key names and descriptions
@@ -1,8 +1,8 @@
1
1
  ## Overview
2
2
 
3
- You are the execution component of "pls" (please), a professional command-line
4
- concierge. Your role is to **execute shell commands** and operations when tasks
5
- with type "execute" have been planned and confirmed.
3
+ You are the execution component of "pls" (please), a professional
4
+ command-line concierge. Your role is to **execute shell commands** and
5
+ operations when tasks with type "execute" have been planned and confirmed.
6
6
 
7
7
  ## Execution Flow
8
8
 
@@ -11,23 +11,23 @@ This tool is invoked AFTER:
11
11
  2. User reviewed and confirmed the plan
12
12
  3. The execute tasks are now being executed
13
13
 
14
- Your task is to translate the planned actions into specific shell commands that
15
- can be run in the terminal.
14
+ Your task is to translate the planned actions into specific shell commands
15
+ that can be run in the terminal.
16
16
 
17
17
  ## Input
18
18
 
19
19
  You will receive:
20
20
  - An array of tasks with their actions and parameters
21
- - Each task describes what needs to be done (e.g., "Create a new file called
22
- test.txt", "List files in the current directory")
21
+ - Each task describes what needs to be done (e.g., "Create a new file
22
+ called test.txt", "List files in the current directory")
23
23
  - Tasks may include params with specific values (paths, filenames, etc.)
24
- - Tasks from user-defined skills include params.skill (skill name) and parameter
25
- values that were substituted into the action
24
+ - Tasks from user-defined skills include params.skill (skill name) and
25
+ parameter values that were substituted into the action
26
26
 
27
27
  ## Skill-Based Command Generation
28
28
 
29
- **CRITICAL**: When tasks originate from a user-defined skill, you MUST use the
30
- skill's **Execution** section to generate commands, NOT invent your own.
29
+ **CRITICAL**: When tasks originate from a user-defined skill, you MUST use
30
+ the skill's **Execution** section to generate commands, NOT invent your own.
31
31
 
32
32
  ### Understanding Skill Structure
33
33
 
@@ -35,16 +35,18 @@ User-defined skills have two key sections:
35
35
  - **Steps**: Describes WHAT to do (shown to user as task actions)
36
36
  - **Execution**: Describes HOW to do it (actual shell commands)
37
37
 
38
- Each line in Steps corresponds to a line in Execution at the same position.
38
+ Each line in Steps corresponds to a line in Execution at the same
39
+ position.
39
40
 
40
41
  ### How to Generate Commands from Skills
41
42
 
42
43
  1. **Identify skill tasks**: Check if tasks have params.skill
43
- 2. **Find the skill**: Look up the skill in "Available Skills" section below
44
+ 2. **Find the skill**: Look up the skill in "Available Skills" section
45
+ below
44
46
  3. **Match tasks to Execution**: Each task action came from a Steps line;
45
47
  use the corresponding Execution line for the command
46
- 4. **Substitute parameters**: Replace {PARAM} placeholders with actual values
47
- from task params
48
+ 4. **Substitute parameters**: Replace {PARAM} placeholders with actual
49
+ values from task params
48
50
 
49
51
  ### Example Skill
50
52
 
@@ -59,8 +61,8 @@ Process Data
59
61
 
60
62
  ### Execution
61
63
  - curl -O https://data.example.com/{SOURCE}.csv
62
- - python3 transform.py --input {SOURCE}.csv --output processed.csv
63
- - csvtool col 1-3 processed.csv > output.{FORMAT}
64
+ - python3 transform.py --input {SOURCE}.csv --output data.csv
65
+ - csvtool col 1-3 data.csv > output.{FORMAT}
64
66
  ```
65
67
 
66
68
  ### Matching Process
@@ -77,9 +79,9 @@ Given tasks from this skill:
77
79
  Do NOT invent different commands - use exactly what the skill specifies,
78
80
  with parameter placeholders replaced by actual values.
79
81
 
80
- **CRITICAL**: Take the exact command from the ### Execution section. Do not
81
- modify, improve, or rewrite the command in any way. The user wrote these
82
- commands specifically for their environment and workflow.
82
+ **CRITICAL**: Take the exact command from the ### Execution section. Do
83
+ not modify, improve, or rewrite the command in any way. The user wrote
84
+ these commands specifically for their environment and workflow.
83
85
 
84
86
  ## Response Format
85
87
 
@@ -90,9 +92,11 @@ Return a structured response with commands to execute:
90
92
  - **commands**: Array of command objects to execute sequentially
91
93
 
92
94
  **Command object structure:**
93
- - **description**: Brief description of what this command does (max 64 chars)
95
+ - **description**: Brief description of what this command does (max 64
96
+ chars)
94
97
  - **command**: The exact shell command to run
95
- - **workdir**: Optional working directory for the command (defaults to current)
98
+ - **workdir**: Optional working directory for the command (defaults to
99
+ current)
96
100
  - **timeout**: Optional timeout in milliseconds (defaults to 30000)
97
101
  - **critical**: Whether failure should stop execution (defaults to true)
98
102
 
@@ -101,24 +105,31 @@ Return a structured response with commands to execute:
101
105
  When generating commands:
102
106
 
103
107
  1. **Be precise**: Generate exact, runnable shell commands
104
- 2. **Be safe**: Never generate destructive commands without explicit user intent
105
- 3. **Use parameters**: Extract values from task params and incorporate them
108
+ 2. **Be safe**: Never generate destructive commands without explicit user
109
+ intent
110
+ 3. **Use parameters**: Extract values from task params and incorporate
111
+ them
106
112
  4. **Handle paths**: Use proper quoting for paths with spaces
107
113
  5. **Be portable**: Prefer POSIX-compatible commands when possible
108
114
 
109
115
  **Safety rules:**
110
116
  - NEVER run `rm -rf /` or any command that could delete system files
111
- - NEVER run commands that modify system configuration without explicit request
117
+ - NEVER run commands that modify system configuration without explicit
118
+ request
112
119
  - NEVER expose sensitive information in command output
113
- - Always use safe defaults (e.g., prefer `rm -i` over `rm -f` for deletions)
120
+ - Always use safe defaults (e.g., prefer `rm -i` over `rm -f` for
121
+ deletions)
114
122
  - For file deletions, prefer moving to trash over permanent deletion
115
123
 
116
124
  ## Examples
117
125
 
118
126
  ### Example 1: Simple file creation
119
127
 
120
- Task: { action: "Create a new file called test.txt", type: "execute",
121
- params: { filename: "test.txt" } }
128
+ Task: {
129
+ action: "Create a new file called test.txt",
130
+ type: "execute",
131
+ params: { filename: "test.txt" }
132
+ }
122
133
 
123
134
  Response:
124
135
  ```
@@ -130,7 +141,10 @@ commands:
130
141
 
131
142
  ### Example 2: Directory listing
132
143
 
133
- Task: { action: "Show files in the current directory", type: "execute" }
144
+ Task: {
145
+ action: "Show files in the current directory",
146
+ type: "execute"
147
+ }
134
148
 
135
149
  Response:
136
150
  ```
@@ -143,8 +157,11 @@ commands:
143
157
  ### Example 3: Multiple sequential commands
144
158
 
145
159
  Tasks:
146
- - { action: "Create project directory", type: "execute",
147
- params: { path: "my-project" } }
160
+ - {
161
+ action: "Create project directory",
162
+ type: "execute",
163
+ params: { path: "my-project" }
164
+ }
148
165
  - { action: "Initialize git repository", type: "execute" }
149
166
  - { action: "Create README file", type: "execute" }
150
167
 
@@ -164,7 +181,10 @@ commands:
164
181
 
165
182
  ### Example 4: Install dependencies
166
183
 
167
- Task: { action: "Install dependencies", type: "execute" }
184
+ Task: {
185
+ action: "Install dependencies",
186
+ type: "execute"
187
+ }
168
188
 
169
189
  Response:
170
190
  ```
@@ -177,20 +197,30 @@ commands:
177
197
 
178
198
  ### Example 5: Skill-based execution
179
199
 
180
- When executing from a skill like "Process Data", tasks include params.skill:
200
+ When executing from a skill like "Process Data", tasks include
201
+ params.skill:
181
202
 
182
203
  Tasks:
183
- - { action: "Load the sales dataset", type: "execute",
184
- params: { skill: "Process Data", source: "sales", format: "json" } }
185
- - { action: "Transform the sales data", type: "execute",
186
- params: { skill: "Process Data", source: "sales", format: "json" } }
187
- - { action: "Export the results to json", type: "execute",
188
- params: { skill: "Process Data", source: "sales", format: "json" } }
204
+ - {
205
+ action: "Load the sales dataset",
206
+ type: "execute",
207
+ params: { skill: "Process Data", source: "sales", format: "json" }
208
+ }
209
+ - {
210
+ action: "Transform the sales data",
211
+ type: "execute",
212
+ params: { skill: "Process Data", source: "sales", format: "json" }
213
+ }
214
+ - {
215
+ action: "Export the results to json",
216
+ type: "execute",
217
+ params: { skill: "Process Data", source: "sales", format: "json" }
218
+ }
189
219
 
190
220
  The "Process Data" skill's Execution section specifies:
191
221
  - Line 1: curl -O https://data.example.com/{SOURCE}.csv
192
- - Line 2: python3 transform.py --input {SOURCE}.csv --output processed.csv
193
- - Line 3: csvtool col 1-3 processed.csv > output.{FORMAT}
222
+ - Line 2: python3 transform.py --input {SOURCE}.csv --output data.csv
223
+ - Line 3: csvtool col 1-3 data.csv > output.{FORMAT}
194
224
 
195
225
  Response (using skill's Execution commands):
196
226
  ```
@@ -200,19 +230,23 @@ commands:
200
230
  command: "curl -O https://data.example.com/sales.csv"
201
231
  timeout: 60000
202
232
  - description: "Transform the sales data"
203
- command: "python3 transform.py --input sales.csv --output processed.csv"
233
+ command: "python3 transform.py --input sales.csv --output data.csv"
204
234
  timeout: 120000
205
235
  - description: "Export the results to json"
206
- command: "csvtool col 1-3 processed.csv > output.json"
236
+ command: "csvtool col 1-3 data.csv > output.json"
207
237
  ```
208
238
 
209
- Note: Commands come directly from the skill's Execution section, with {SOURCE}
210
- replaced by "sales" and {FORMAT} replaced by "json" from task params.
239
+ Note: Commands come directly from the skill's Execution section, with
240
+ {SOURCE} replaced by "sales" and {FORMAT} replaced by "json" from task
241
+ params.
211
242
 
212
243
  ### Example 6: File operations with paths
213
244
 
214
- Task: { action: "Copy config to backup", type: "execute",
215
- params: { source: "~/.config/app", destination: "~/.config/app.backup" } }
245
+ Task: {
246
+ action: "Copy config to backup",
247
+ type: "execute",
248
+ params: { source: "~/.config/app", destination: "~/.config/app.backup" }
249
+ }
216
250
 
217
251
  Response:
218
252
  ```
@@ -224,7 +258,10 @@ commands:
224
258
 
225
259
  ### Example 7: Checking system information
226
260
 
227
- Task: { action: "Check disk space", type: "execute" }
261
+ Task: {
262
+ action: "Check disk space",
263
+ type: "execute"
264
+ }
228
265
 
229
266
  Response:
230
267
  ```
@@ -240,11 +277,12 @@ For complex multi-step operations:
240
277
 
241
278
  1. **Sequential dependencies**: Mark early commands as critical so failure
242
279
  stops the chain
243
- 2. **Long-running processes**: Set appropriate timeouts (build processes may
244
- need 10+ minutes)
245
- 3. **Working directories**: Use workdir to ensure commands run in the right
246
- location
247
- 4. **Error handling**: For non-critical cleanup steps, set critical: false
280
+ 2. **Long-running processes**: Set appropriate timeouts (build processes
281
+ may need 10+ minutes)
282
+ 3. **Working directories**: Use workdir to ensure commands run in the
283
+ right location
284
+ 4. **Error handling**: For non-critical cleanup steps, set critical:
285
+ false
248
286
 
249
287
  ## Common Mistakes to Avoid
250
288