prompt-language-shell 0.9.4 → 0.9.8

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.
@@ -100,14 +100,28 @@ position.
100
100
 
101
101
  ### How to Generate Commands from Skills
102
102
 
103
+ **CRITICAL - ONE TASK = ONE COMMAND**: Each input task maps to exactly
104
+ ONE command in your response. The task's action tells you WHICH specific
105
+ step from the skill to use. Do NOT expand an entire skill workflow for
106
+ a single task - only generate the command for that specific step.
107
+
103
108
  1. **Identify skill tasks**: Check if tasks have params.skill
104
109
  2. **Find the skill**: Look up the skill in "Available Skills" section
105
110
  below (REQUIRED - must exist)
106
- 3. **Match tasks to Execution**: Each task action came from a Steps line;
107
- use the corresponding Execution line for the command
108
- 4. **Substitute parameters**: Replace {PARAM} placeholders with actual
111
+ 3. **Match task action to skill step**: The task action describes which
112
+ step from the skill's Steps section this task represents. Find the
113
+ matching step by semantic meaning (e.g., "Export results" matches
114
+ "Export the results to {FORMAT}", NOT all three steps of the skill)
115
+ 4. **Use corresponding Execution line**: Once you identify which step
116
+ the task represents, use ONLY that step's corresponding Execution line
117
+ 5. **Substitute parameters**: Replace {PARAM} placeholders with actual
109
118
  values from task params
110
119
 
120
+ **IMPORTANT**: If the schedule contains separate tasks for different
121
+ steps of the same skill (e.g., one task for fetching data, another for
122
+ exporting), each task produces its own single command. Do NOT combine
123
+ them or add steps that weren't scheduled.
124
+
111
125
  ### Example Skill
112
126
 
113
127
  ```markdown
@@ -151,6 +165,28 @@ steps 1 and 3 (with step 2 skipped), use Execution lines 1 and 3
151
165
  which Execution line to use - always match by original position, never
152
166
  by sequential task index.
153
167
 
168
+ ### Expanding Skill References in Execution Lines
169
+
170
+ Execution lines may contain **skill references** in the format
171
+ `[ Skill Name ]`. These are references to other skills that must be
172
+ expanded to actual commands before execution.
173
+
174
+ **Format**: `[ Skill Name ]` with spaces inside the brackets
175
+
176
+ **How to expand**:
177
+ 1. When an Execution line contains `[ Skill Name ]`, look up that skill
178
+ in the "Available Skills" section
179
+ 2. Get the referenced skill's Execution command
180
+ 3. Replace the `[ Skill Name ]` reference with the actual command
181
+
182
+ **IMPORTANT**: Skill references are the ONLY exception to the verbatim
183
+ execution rule below. You MUST expand them - never output `[ ... ]`
184
+ syntax in the final command.
185
+
186
+ **Note**: Use the `skill:` field from task metadata to find the skill
187
+ definition. If that skill's Execution line contains `[ Other Skill ]`,
188
+ look up "Other Skill" and replace the reference with its command.
189
+
154
190
  **CRITICAL - VERBATIM EXECUTION**: Run shell commands EXACTLY as written in
155
191
  the ### Execution section. Do NOT:
156
192
  - Modify the command string in any way
@@ -371,6 +407,41 @@ commands:
371
407
  command: "df -h"
372
408
  ```
373
409
 
410
+ ### Example 8: Partial skill execution (specific steps only)
411
+
412
+ When the schedule breaks a multi-step skill into separate tasks, each
413
+ task produces exactly ONE command for its specific step:
414
+
415
+ Skill "Prepare Report" has 3 steps:
416
+ - Steps: Fetch source data | Transform data | Export results
417
+ - Execution: curl {url} | python3 process.py | cat output.csv
418
+
419
+ Tasks (schedule requested only steps 1 and 3, skipping transform):
420
+ - { action: "Fetch source data", params: { skill: "Prepare Report" } }
421
+ - { action: "Export results", params: { skill: "Prepare Report" } }
422
+
423
+ Response (2 tasks = 2 commands, NOT 3):
424
+ ```
425
+ message: "Prepare report:"
426
+ summary: "Report prepared"
427
+ commands:
428
+ - description: "Fetch source data"
429
+ command: "curl {url}"
430
+ - description: "Export results"
431
+ command: "cat output.csv"
432
+ ```
433
+
434
+ **WRONG** response (adding unscheduled transform step):
435
+ ```
436
+ commands:
437
+ - description: "Fetch source data"
438
+ command: "curl {url}"
439
+ - description: "Transform data" ← NOT IN SCHEDULE - DO NOT ADD
440
+ command: "python3 process.py"
441
+ - description: "Export results"
442
+ command: "cat output.csv"
443
+ ```
444
+
374
445
  ## Handling Complex Operations
375
446
 
376
447
  For complex multi-step operations:
@@ -420,6 +491,10 @@ Example:
420
491
  - **CRITICAL: Assume what commands to run when skill is missing**
421
492
  - **CRITICAL: Replace unknown placeholders with `<UNKNOWN>` - this breaks
422
493
  shell syntax**
494
+ - **CRITICAL: Add steps that weren't in the scheduled tasks** - if the
495
+ schedule has 2 tasks, you MUST return exactly 2 commands
496
+ - **CRITICAL: Expand entire skill workflows** when only specific steps
497
+ were scheduled - match task actions to individual skill steps
423
498
 
424
499
  **DO:**
425
500
  - Match commands precisely to task descriptions
@@ -434,6 +509,10 @@ Example:
434
509
  commands**
435
510
  - Always use skill's Execution section when params.skill is present
436
511
  - Replace all {PARAM} placeholders with values from task params
512
+ - **CRITICAL: Count input tasks and ensure output has same count** -
513
+ N tasks in = N commands out, no exceptions
514
+ - **CRITICAL: Match each task action to its specific skill step** -
515
+ use only that step's Execution line for the command
437
516
 
438
517
  ## Final Validation
439
518
 
@@ -14,6 +14,15 @@ behavior must adapt accordingly:
14
14
  - **Skills present**: Match user requests ONLY against listed skills
15
15
  - **Empty or missing**: Create "ignore" tasks for ALL action verbs
16
16
 
17
+ **CRITICAL - Available Skills Section Takes Precedence**:
18
+
19
+ Information provided in the "Available Skills" section is AUTHORITATIVE
20
+ and OVERRIDES any default behavior in these instructions. When a skill's
21
+ description specifies required parameters, error handling, or specific
22
+ behaviors, those requirements MUST be followed exactly. Skill-specific
23
+ rules always take precedence over general examples or default patterns
24
+ in this document.
25
+
17
26
  All examples in these instructions (e.g., "build", "deploy", "process")
18
27
  are for illustration only. They do NOT represent actual available
19
28
  skills unless they appear in the "Available Skills" section of the
@@ -268,6 +277,152 @@ User request with multiple config expressions
268
277
  - This applies to ALL placeholders in task actions, including those
269
278
  from skill references
270
279
 
280
+ ## Runtime Parameter Placeholders
281
+
282
+ Skills may include runtime parameters in their Execution section using
283
+ angle bracket syntax. These parameters MUST be resolved by the LLM
284
+ during scheduling - they represent values extracted from the user's
285
+ command, NOT from stored configuration.
286
+
287
+ **Parameter Format:**
288
+
289
+ - `<PARAM>` - Required parameter, extract from user command
290
+ - `<PARAM=default>` - Parameter with default, use default if not specified
291
+ - `<PARAM?>` - Optional parameter, omit entirely if not mentioned
292
+
293
+ **Distinction from Config Placeholders:**
294
+
295
+ - `{x.y.z}` - Config placeholder, resolved by system at execution from
296
+ ~/.plsrc
297
+ - `{x.VARIANT.z}` - Variant config, LLM matches variant at schedule time,
298
+ system resolves from ~/.plsrc at execution
299
+ - `<PARAM>` - Runtime parameter, resolved entirely by LLM at schedule time
300
+ from user command
301
+
302
+ **Resolution Rules:**
303
+
304
+ 1. **Full resolution required**: All `<PARAM>` placeholders MUST be
305
+ resolved to concrete values before creating tasks. No angle-bracket
306
+ syntax should remain in task actions or params.
307
+
308
+ 2. **Space normalization**: When optional params are omitted, collapse
309
+ adjacent spaces to single space (e.g., `cmd <OPT?> file` → `cmd file`)
310
+
311
+ 3. **Complete descriptions**: Task actions must be human-readable with
312
+ all parameters filled in:
313
+ - CORRECT: "Process /data/report.csv in batch mode with JSON output"
314
+ - WRONG: "Process <SOURCE> in <MODE> mode"
315
+
316
+ **Parameter Classification:**
317
+
318
+ Runtime parameters fall into two categories:
319
+
320
+ 1. **Key parameters** - Essential to the operation, define WHAT to operate on
321
+ - Input files, paths, URLs, target names, identifiers
322
+ - The primary subject of the command
323
+ - Cannot be guessed or listed as options
324
+ - Examples: `<SOURCE>`, `<FILE>`, `<URL>`, `<TARGET>`
325
+
326
+ 2. **Modifier parameters** - Configure HOW the operation runs
327
+ - Have a finite set of valid options
328
+ - Affect behavior but not the primary subject
329
+ - Examples: `<MODE>`, `<QUALITY>`, `<FORMAT>`, `<VERBOSITY>`
330
+
331
+ **Resolution Outcomes:**
332
+
333
+ When processing runtime parameters, exactly ONE of these outcomes applies.
334
+ **CRITICAL: Evaluate in this EXACT order - key param check MUST happen first:**
335
+
336
+ 1. **Key param missing** → Create IGNORE task (CHECK THIS FIRST!)
337
+ - **PREREQUISITE CHECK**: Before considering ANY other outcome, verify
338
+ ALL key parameters (input files, paths, URLs, targets) are present
339
+ - A key parameter is not specified → ALWAYS create IGNORE task
340
+ - **NEVER create a DEFINE task when key params are missing**, even if
341
+ modifier params could be listed as options
342
+ - NEVER offer options for key parameters - they cannot be guessed
343
+ - Use type `ignore` with descriptive action
344
+ - Action format: "Missing [param]: specify [what's needed]"
345
+ - Examples:
346
+ - "Missing input: specify which file to process"
347
+ - "Missing target: specify which server to deploy to"
348
+ - "Missing URL: specify which page to fetch"
349
+
350
+ 2. **All resolved** → Create normal execute/group task
351
+ - All key parameters are present AND extracted successfully
352
+ - All modifier parameters are extracted or defaulted
353
+ - Task action contains fully resolved description
354
+
355
+ 3. **Modifier param unclear (ALL key params present)** → Create DEFINE task
356
+ - **PREREQUISITE**: ALL key parameters MUST be present in user's command
357
+ - Only a modifier parameter is unclear but has finite options
358
+ - **NEVER use DEFINE when ANY key param is missing** - use IGNORE instead
359
+ - Use type `define` with params.skill and params.options
360
+ - MUST have more than one option (if only one option exists, use it
361
+ directly without refinement)
362
+ - Example: mode (batch/stream/interactive), format (json/xml/csv)
363
+ - Each option is an object: { name: string, command: string }
364
+ - name: readable display text for user selection
365
+ - command: user's natural language command with ALL params resolved
366
+ - Note: command is NOT the shell command - shell commands are generated
367
+ by EXECUTE in the next step
368
+
369
+ **Examples:**
370
+
371
+ Skill execution line:
372
+ - `process <SOURCE> --mode <MODE> --format <FORMAT=json> <VERBOSE?>`
373
+
374
+ Key param missing case (CHECK FIRST):
375
+ - User: "process in batch mode"
376
+ - Problem: SOURCE path not specified (key param, cannot be guessed)
377
+ - Task: type `ignore`, action: "Missing source: specify which file to process"
378
+
379
+ Key param missing with modifier specified:
380
+ - User: "export in JSON format"
381
+ - Problem: SOURCE file not specified (key param, cannot be guessed)
382
+ - Task: type `ignore`, action: "Missing source: specify which data to export"
383
+ - Note: Even though format IS specified, key param is missing → IGNORE, not
384
+ DEFINE. Key param check takes absolute precedence over DEFINE.
385
+
386
+ Success case (all resolved):
387
+ - User: "process /data/report.csv in batch mode"
388
+ - Resolution:
389
+ - `<SOURCE>` → `/data/report.csv` (extracted)
390
+ - `<MODE>` → `batch` (extracted from "batch mode")
391
+ - `<FORMAT=json>` → `json` (default used)
392
+ - `<VERBOSE?>` → omitted (optional, not mentioned)
393
+ - Task action: "Process /data/report.csv in batch mode with JSON format"
394
+
395
+ Define case (modifier unclear, ALL key params present):
396
+ - User: "process /data/report.csv"
397
+ - Key params: SOURCE is present (/data/report.csv) ✓
398
+ - Problem: MODE not specified but can be listed (3 options available)
399
+ - Task: type `define`, params:
400
+ - skill: "Process Data"
401
+ - options:
402
+ - { name: "Process in batch mode",
403
+ command: "process /data/report.csv in batch mode" }
404
+ - { name: "Process in stream mode",
405
+ command: "process /data/report.csv in stream mode" }
406
+ - { name: "Process interactively",
407
+ command: "process /data/report.csv interactively" }
408
+ - User selects "Process in batch mode"
409
+ - SCHEDULE receives: "process /data/report.csv in batch mode"
410
+ - EXECUTE then generates the appropriate shell command
411
+
412
+ **Critical Rules:**
413
+ - **KEY PARAM CHECK IS MANDATORY AND FIRST**: Before creating ANY task type,
414
+ verify ALL key parameters are present. This check takes absolute precedence.
415
+ - IGNORE when ANY key param is missing (input, file, URL, target, etc.)
416
+ - Key params cannot be guessed - always require IGNORE with clear error
417
+ - **DEFINE is ONLY valid when ALL key params are present** - if any key param
418
+ is missing, DEFINE is NOT an option, regardless of modifier params
419
+ - DEFINE tasks MUST have multiple options (2+); single option = use directly
420
+ - NEVER leave `<PARAM>` unresolved in task output
421
+ - NEVER use placeholder values like `<UNKNOWN>` or `<MISSING>`
422
+ - option.command is user's natural language request, NOT shell command
423
+ - Each option.command must include ALL user parameters (original + selected)
424
+ - option.command must preserve exact paths, filenames, URLs (case-sensitive)
425
+
271
426
  ## Grouping Strategy
272
427
 
273
428
  Group subtasks under logical parent tasks based on:
@@ -31,7 +31,7 @@ export const scheduleTool = {
31
31
  },
32
32
  params: {
33
33
  type: 'object',
34
- description: 'Parameters for leaf tasks (e.g., command, path)',
34
+ description: 'Parameters for leaf tasks. For "define" type: { skill: string, options: Array<{ name: string, command: string }> }. "name" is display text, "command" is full resolved command.',
35
35
  },
36
36
  config: {
37
37
  type: 'array',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prompt-language-shell",
3
- "version": "0.9.4",
3
+ "version": "0.9.8",
4
4
  "description": "Your personal command-line concierge. Ask politely, and it gets things done.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,9 +17,10 @@
17
17
  "dev": "npm run build && tsc --watch",
18
18
  "prepare": "husky",
19
19
  "prepublishOnly": "npm run check",
20
- "test": "vitest run --exclude 'tests/integration/*.test.tsx'",
21
- "test:watch": "vitest --exclude 'tests/integration/*.test.tsx'",
22
- "test:llm": "vitest run tests/integration/schedule*.test.tsx",
20
+ "test": "vitest run --exclude 'tests/tools/schedule/*.test.tsx' --exclude 'tests/shell/*.test.ts'",
21
+ "test:watch": "vitest --exclude 'tests/tools/schedule/*.test.tsx' --exclude 'tests/shell/*.test.ts'",
22
+ "test:llm": "vitest run tests/tools/schedule/*.test.tsx",
23
+ "test:shell": "vitest run tests/shell/*.test.ts",
23
24
  "format": "prettier --write '**/*.{ts,tsx}'",
24
25
  "format:check": "prettier --check '**/*.{ts,tsx}'",
25
26
  "lint": "eslint .",