prompt-language-shell 0.1.8 → 0.2.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/config/PLAN.md +204 -63
- package/dist/tools/plan.tool.js +1 -1
- package/dist/types/components.js +10 -1
- package/dist/ui/Command.js +17 -1
- package/package.json +1 -1
package/dist/config/PLAN.md
CHANGED
|
@@ -18,6 +18,13 @@ Your task is to create structured task definitions that:
|
|
|
18
18
|
Each task should be precise and unambiguous, ready to be executed by the
|
|
19
19
|
appropriate handler.
|
|
20
20
|
|
|
21
|
+
**IMPORTANT**: While the primary use case involves building specific
|
|
22
|
+
software products, all instructions and examples in this document are
|
|
23
|
+
intentionally generic. This ensures the planning algorithm is not biased
|
|
24
|
+
toward any particular domain and can be validated to work correctly across
|
|
25
|
+
all scenarios. Do NOT assume or infer domain-specific context unless
|
|
26
|
+
explicitly provided in skills or user requests.
|
|
27
|
+
|
|
21
28
|
## Skills Integration
|
|
22
29
|
|
|
23
30
|
If skills are provided in the "Available Skills" section below, you MUST
|
|
@@ -26,29 +33,69 @@ use them when the user's query matches a skill's domain.
|
|
|
26
33
|
When a query matches a skill:
|
|
27
34
|
1. Recognize the semantic match between the user's request and the skill
|
|
28
35
|
description
|
|
29
|
-
2.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
2. Check if the skill has parameters (e.g. {PROJECT}) or describes
|
|
37
|
+
multiple variants in its description
|
|
38
|
+
3. If skill requires parameters and user didn't specify which variant:
|
|
39
|
+
- Create a "define" type task with options listing all variants from the
|
|
40
|
+
skill description
|
|
41
|
+
- Extract variants from the skill's description section
|
|
42
|
+
4. If user specified the variant or skill has no parameters:
|
|
43
|
+
- Extract the individual steps from the skill's "Steps" section
|
|
44
|
+
- Replace parameter placeholders (e.g., {BROWSER}) with the specified value
|
|
45
|
+
- Create a task definition for each step with:
|
|
46
|
+
- action: clear, professional description starting with a capital letter
|
|
47
|
+
- type: category of operation (if the skill specifies it or you
|
|
48
|
+
can infer it)
|
|
49
|
+
- params: any specific parameters mentioned in the step
|
|
50
|
+
5. If the user's query includes additional requirements beyond the skill,
|
|
35
51
|
append those as additional task definitions
|
|
36
|
-
|
|
52
|
+
6. NEVER replace the skill's detailed steps with a generic restatement
|
|
37
53
|
|
|
38
|
-
Example 1:
|
|
54
|
+
Example 1 - Skill with parameter, variant specified:
|
|
55
|
+
- Skill has {PROJECT} parameter with variants: Alpha, Beta, Gamma
|
|
39
56
|
- Skill steps: "- Navigate to the {PROJECT} root directory. - Execute the
|
|
40
57
|
{PROJECT} generation script. - Compile the {PROJECT}'s source code"
|
|
41
|
-
- User: "build
|
|
58
|
+
- User: "build Alpha"
|
|
42
59
|
- Correct: Three tasks with actions following the skill's steps, with
|
|
43
|
-
{PROJECT} replaced by "
|
|
44
|
-
- WRONG: One task with action "Build
|
|
60
|
+
{PROJECT} replaced by "Alpha"
|
|
61
|
+
- WRONG: One task with action "Build Alpha"
|
|
62
|
+
|
|
63
|
+
Example 2 - Skill with parameter, variant NOT specified:
|
|
64
|
+
- Same skill as Example 1
|
|
65
|
+
- User: "build"
|
|
66
|
+
- Correct: One task with type "define", action "Clarify which project to
|
|
67
|
+
build", params { options: ["Build Alpha", "Build Beta", "Build Gamma"] }
|
|
68
|
+
- WRONG: Three tasks with {PROJECT} unreplaced or defaulted
|
|
45
69
|
|
|
46
|
-
Example
|
|
70
|
+
Example 3 - Skill without parameters:
|
|
47
71
|
- Skill steps: "- Check prerequisites. - Run compilation. - Execute tests"
|
|
48
72
|
- User: "run tests and generate a report"
|
|
49
73
|
- Correct: Four tasks (the three from skill + one for report generation)
|
|
50
74
|
- WRONG: Two tasks ("run tests", "generate a report")
|
|
51
75
|
|
|
76
|
+
### Skills and Unclear Requests
|
|
77
|
+
|
|
78
|
+
When a request is vague and could match multiple skills or multiple operations
|
|
79
|
+
within a skill domain, use the "define" type to present concrete options
|
|
80
|
+
derived from available skills:
|
|
81
|
+
|
|
82
|
+
1. Examine all available skills to identify which ones could apply
|
|
83
|
+
2. For each applicable skill, extract specific, executable commands with their
|
|
84
|
+
parameters
|
|
85
|
+
3. Present these as concrete options, NOT generic categories
|
|
86
|
+
4. Each option should be something the user can directly select and execute
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
- Available skills: "Build Product" (variant A, variant B), "Deploy
|
|
90
|
+
Product" (staging, production), "Verify Product" (quick check, full
|
|
91
|
+
validation)
|
|
92
|
+
- User: "do something with the product"
|
|
93
|
+
- Correct: Create "define" task with options: ["Build product variant A",
|
|
94
|
+
"Build product variant B", "Deploy product to staging", "Deploy product
|
|
95
|
+
to production", "Run quick verification", "Run full validation"]
|
|
96
|
+
- WRONG: Generic options like ["Build", "Deploy", "Verify"] - these
|
|
97
|
+
require further clarification
|
|
98
|
+
|
|
52
99
|
## Evaluation of Requests
|
|
53
100
|
|
|
54
101
|
Before processing any request, evaluate its nature and respond appropriately:
|
|
@@ -64,50 +111,100 @@ Examples that should be aborted as offensive:
|
|
|
64
111
|
- Requests to create malware or exploit vulnerabilities
|
|
65
112
|
- Requests with offensive, discriminatory, or abusive language
|
|
66
113
|
|
|
67
|
-
**For
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
114
|
+
**For requests with clear intent:**
|
|
115
|
+
|
|
116
|
+
1. **Information requests** - Use "answer" type when request asks for
|
|
117
|
+
information:
|
|
118
|
+
- Verbs: "explain", "answer", "describe", "tell me", "say", "what
|
|
119
|
+
is", "how does"
|
|
120
|
+
- Examples:
|
|
121
|
+
- "explain TypeScript" → type: "answer"
|
|
122
|
+
- "tell me about Docker" → type: "answer"
|
|
123
|
+
- "what is the current directory" → type: "answer"
|
|
124
|
+
|
|
125
|
+
2. **Skill-based requests** - Use skills when verb matches a defined skill:
|
|
126
|
+
- If "build" skill exists and user says "build" → Use the build skill
|
|
127
|
+
- If "deploy" skill exists and user says "deploy" → Use the deploy skill
|
|
128
|
+
- Extract steps from the matching skill and create tasks for each step
|
|
129
|
+
|
|
130
|
+
3. **Logical consequences** - Infer natural workflow steps:
|
|
131
|
+
- "build" and "deploy" skills exist, user says "build and release" →
|
|
132
|
+
Most likely means "build and deploy" since "release" often means
|
|
133
|
+
"deploy" after building
|
|
134
|
+
- Use context and available skills to infer the logical interpretation
|
|
135
|
+
- IMPORTANT: Only infer if matching skills exist. If no matching skill
|
|
136
|
+
exists, use "ignore" type
|
|
137
|
+
|
|
138
|
+
**For requests with unclear subject:**
|
|
139
|
+
|
|
140
|
+
When the intent verb is clear but the subject is ambiguous, use "define"
|
|
141
|
+
type ONLY if there are concrete skill-based options:
|
|
142
|
+
|
|
143
|
+
- "explain x" where x is ambiguous (e.g., "explain x" - does user mean the
|
|
144
|
+
letter X or something called X?) → Create "define" type with params
|
|
145
|
+
{ options: ["Explain the letter X", "Explain X web portal", "Explain X
|
|
146
|
+
programming concept"] } - but only if these map to actual domain knowledge
|
|
147
|
+
|
|
148
|
+
**For skill-based disambiguation:**
|
|
149
|
+
|
|
150
|
+
When a skill exists but requires parameters or has multiple variants,
|
|
151
|
+
use "define" type:
|
|
152
|
+
|
|
153
|
+
1. **Skill requires parameters** - Ask which variant:
|
|
154
|
+
- "build" + build skill with {PRODUCT} parameter (Alpha, Beta, Gamma,
|
|
155
|
+
Delta) → Create "define" type with params { options: ["Build Alpha",
|
|
156
|
+
"Build Beta", "Build Gamma", "Build Delta"] }
|
|
157
|
+
- User must specify which variant to execute the skill with
|
|
158
|
+
|
|
159
|
+
2. **Skill has multiple distinct operations** - Ask which one:
|
|
160
|
+
- "deploy" + deploy skill defining staging, production, canary
|
|
161
|
+
environments → Create "define" type with params { options: ["Deploy to
|
|
162
|
+
staging environment", "Deploy to production environment", "Deploy to
|
|
163
|
+
canary environment"] }
|
|
164
|
+
|
|
165
|
+
3. **Skill has single variant or user specifies variant** - Execute directly:
|
|
166
|
+
- "build Alpha" + build skill with {PRODUCT} parameter → Replace
|
|
167
|
+
{PRODUCT} with "Alpha" and execute skill steps
|
|
168
|
+
- "deploy staging" + deploy skill with {ENV} parameter → Replace {ENV}
|
|
169
|
+
with "staging" and execute that command
|
|
170
|
+
- No disambiguation needed
|
|
171
|
+
|
|
172
|
+
4. **User specifies "all"** - Spread into multiple tasks:
|
|
173
|
+
- "deploy all" + deploy skill defining staging and production → Create
|
|
174
|
+
two tasks: one for staging deployment, one for production deployment
|
|
175
|
+
- "build all" + build skill with multiple product variants → Create four
|
|
176
|
+
tasks: one for Alpha, one for Beta, one for Gamma, one for Delta
|
|
177
|
+
|
|
178
|
+
**For requests with no matching skills:**
|
|
179
|
+
|
|
180
|
+
Use "ignore" type:
|
|
181
|
+
- "do stuff" with no skills to map to → Create task with type "ignore",
|
|
182
|
+
action "Ignore unknown 'do stuff' request"
|
|
183
|
+
- "handle it" with no matching skill → Create task with type "ignore",
|
|
184
|
+
action "Ignore unknown 'handle it' request"
|
|
185
|
+
- "lint" with no lint skill → Create task with type "ignore", action
|
|
186
|
+
"Ignore unknown 'lint' request"
|
|
187
|
+
|
|
188
|
+
IMPORTANT: The action for "ignore" type should be brief and professional:
|
|
189
|
+
"Ignore unknown 'X' request" where X is the vague verb or phrase. Do NOT
|
|
190
|
+
add lengthy explanations or suggestions in the action field.
|
|
191
|
+
|
|
192
|
+
**Critical rules:**
|
|
193
|
+
|
|
194
|
+
- NEVER create "define" type with generic categories like "Run tests",
|
|
195
|
+
"Build project" unless these map to actual skill commands
|
|
196
|
+
- NEVER create "define" type without a matching skill. The "define" type
|
|
197
|
+
is ONLY for disambiguating between multiple variants/operations within
|
|
198
|
+
an existing skill
|
|
199
|
+
- Each "define" option MUST be immediately executable (not requiring
|
|
200
|
+
further clarification)
|
|
201
|
+
- Options MUST come from defined skills with concrete commands
|
|
202
|
+
- If no skills exist to provide options, use "ignore" type instead of
|
|
203
|
+
"define"
|
|
204
|
+
- Example of WRONG usage: "deploy" with NO deploy skill → Creating
|
|
205
|
+
"define" type with options ["Deploy to staging", "Deploy to production"]
|
|
206
|
+
- this violates the rule because there's no deploy skill to derive these
|
|
207
|
+
from
|
|
111
208
|
|
|
112
209
|
**For legitimate requests:**
|
|
113
210
|
If the request is clear enough to understand the intent, even if informal or
|
|
@@ -126,9 +223,16 @@ When creating task definitions, focus on:
|
|
|
126
223
|
- **Type**: Categorize the operation using one of these supported types:
|
|
127
224
|
- `config` - Configuration changes, settings updates
|
|
128
225
|
- `plan` - Planning or breaking down tasks
|
|
129
|
-
- `execute` - Shell commands, running programs, scripts, compiling,
|
|
130
|
-
|
|
131
|
-
- `
|
|
226
|
+
- `execute` - Shell commands, running programs, scripts, compiling,
|
|
227
|
+
building
|
|
228
|
+
- `answer` - Answering questions, explaining concepts, providing
|
|
229
|
+
information
|
|
230
|
+
- `report` - Generating summaries, creating reports, displaying
|
|
231
|
+
results
|
|
232
|
+
- `define` - Presenting skill-based options when request matches
|
|
233
|
+
multiple skill variants
|
|
234
|
+
- `ignore` - Request is too vague and cannot be mapped to skills or
|
|
235
|
+
inferred from context
|
|
132
236
|
|
|
133
237
|
Omit the type field if none of these categories clearly fit the operation.
|
|
134
238
|
|
|
@@ -303,8 +407,8 @@ Simple requests should remain as single tasks:
|
|
|
303
407
|
|
|
304
408
|
Only split when tasks are truly distinct operations:
|
|
305
409
|
|
|
306
|
-
- "install deps, run tests" → Two tasks with actions "Install
|
|
307
|
-
(type: execute) and "Run tests" (type: execute)
|
|
410
|
+
- "install deps, run tests" → Two tasks with actions "Install
|
|
411
|
+
dependencies" (type: execute) and "Run tests" (type: execute)
|
|
308
412
|
- "create file; add content" → Two tasks with actions "Create a file" (type:
|
|
309
413
|
execute) and "Add content" (type: execute)
|
|
310
414
|
- "build project and deploy" → Two tasks with actions "Build the project"
|
|
@@ -315,8 +419,10 @@ Only split when tasks are truly distinct operations:
|
|
|
315
419
|
Split only when multiple distinct queries or operations are needed:
|
|
316
420
|
|
|
317
421
|
- "tell me weather in Wro, is it over 70 deg" → Two tasks:
|
|
318
|
-
1. Action "Show the weather in Wrocław" (type: answer, params
|
|
319
|
-
|
|
422
|
+
1. Action "Show the weather in Wrocław" (type: answer, params
|
|
423
|
+
{ city: "Wrocław" })
|
|
424
|
+
2. Action "Check if the temperature is above 70 degrees" (type:
|
|
425
|
+
answer)
|
|
320
426
|
- "pls what is 7th prime and how many are to 1000" → Two tasks:
|
|
321
427
|
1. Action "Find the 7th prime number" (type: answer)
|
|
322
428
|
2. Action "Count how many prime numbers are below 1000" (type: answer)
|
|
@@ -326,3 +432,38 @@ Split only when multiple distinct queries or operations are needed:
|
|
|
326
432
|
- "find config file and show its contents" → Two tasks:
|
|
327
433
|
1. Action "Find the config file" (type: execute)
|
|
328
434
|
2. Action "Show its contents" (type: report)
|
|
435
|
+
|
|
436
|
+
### Correct Examples: Skill-Based Requests
|
|
437
|
+
|
|
438
|
+
Examples showing proper use of skills and disambiguation:
|
|
439
|
+
|
|
440
|
+
- "build" with build skill requiring {PROJECT} parameter (Alpha, Beta, Gamma,
|
|
441
|
+
Delta) → One task: type "define", action "Clarify which project to build",
|
|
442
|
+
params { options: ["Build Alpha", "Build Beta", "Build Gamma", "Build
|
|
443
|
+
Delta"] }
|
|
444
|
+
- "build Alpha" with same build skill → Three tasks extracted from skill
|
|
445
|
+
steps: "Navigate to the Alpha project's root directory", "Execute the Alpha
|
|
446
|
+
project generation script", "Compile the Alpha source code"
|
|
447
|
+
- "build all" with same build skill → Twelve tasks (3 steps × 4 projects)
|
|
448
|
+
- "deploy" with deploy skill (staging, production, canary) → One task: type
|
|
449
|
+
"define", action "Clarify which environment to deploy to", params
|
|
450
|
+
{ options: ["Deploy to staging environment", "Deploy to production
|
|
451
|
+
environment", "Deploy to canary environment"] }
|
|
452
|
+
- "deploy all" with deploy skill (staging, production) → Two tasks: one for
|
|
453
|
+
staging deployment, one for production deployment
|
|
454
|
+
- "build and run" with build and run skills → Create tasks from build skill
|
|
455
|
+
+ run skill
|
|
456
|
+
- "build Beta and lint" with build skill (has {PROJECT} parameter) but NO
|
|
457
|
+
lint skill → Four tasks: three from build skill (with {PROJECT}=Beta) +
|
|
458
|
+
one "ignore" type for unknown "lint"
|
|
459
|
+
|
|
460
|
+
### Correct Examples: Requests Without Matching Skills
|
|
461
|
+
|
|
462
|
+
- "lint" with NO lint skill → One task: type "ignore", action "Ignore
|
|
463
|
+
unknown 'lint' request"
|
|
464
|
+
- "format" with NO format skill → One task: type "ignore", action "Ignore
|
|
465
|
+
unknown 'format' request"
|
|
466
|
+
- "build" with NO build skill → One task: type "ignore", action "Ignore
|
|
467
|
+
unknown 'build' request"
|
|
468
|
+
- "do stuff" with NO skills → One task: type "ignore", action "Ignore
|
|
469
|
+
unknown 'do stuff' request"
|
package/dist/tools/plan.tool.js
CHANGED
|
@@ -16,7 +16,7 @@ export const planTool = {
|
|
|
16
16
|
},
|
|
17
17
|
type: {
|
|
18
18
|
type: 'string',
|
|
19
|
-
description: 'Type of task: "config" (settings), "plan" (planning), "execute" (shell/programs/finding files), "answer" (questions), "report" (summaries)',
|
|
19
|
+
description: 'Type of task: "config" (settings), "plan" (planning), "execute" (shell/programs/finding files), "answer" (questions), "report" (summaries), "define" (skill-based disambiguation), "ignore" (too vague)',
|
|
20
20
|
},
|
|
21
21
|
params: {
|
|
22
22
|
type: 'object',
|
package/dist/types/components.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var TaskType;
|
|
2
|
+
(function (TaskType) {
|
|
3
|
+
TaskType["Config"] = "config";
|
|
4
|
+
TaskType["Plan"] = "plan";
|
|
5
|
+
TaskType["Execute"] = "execute";
|
|
6
|
+
TaskType["Answer"] = "answer";
|
|
7
|
+
TaskType["Report"] = "report";
|
|
8
|
+
TaskType["Define"] = "define";
|
|
9
|
+
TaskType["Ignore"] = "ignore";
|
|
10
|
+
})(TaskType || (TaskType = {}));
|
package/dist/ui/Command.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
+
import { TaskType } from '../types/components.js';
|
|
4
5
|
import { Spinner } from './Spinner.js';
|
|
5
6
|
const MIN_PROCESSING_TIME = 1000; // purely for visual effect
|
|
7
|
+
function getTaskActionColor(taskType) {
|
|
8
|
+
return taskType === TaskType.Ignore ? 'yellow' : 'white';
|
|
9
|
+
}
|
|
10
|
+
function getTaskTypeColor(taskType) {
|
|
11
|
+
if (taskType === TaskType.Ignore)
|
|
12
|
+
return 'red';
|
|
13
|
+
if (taskType === TaskType.Define)
|
|
14
|
+
return 'blue';
|
|
15
|
+
return 'greenBright';
|
|
16
|
+
}
|
|
17
|
+
function shouldDimTaskType(taskType) {
|
|
18
|
+
return taskType !== TaskType.Define;
|
|
19
|
+
}
|
|
6
20
|
export function Command({ command, state, service, tasks, error: errorProp, systemPrompt: systemPromptProp, }) {
|
|
7
21
|
const done = state?.done ?? false;
|
|
8
22
|
const [processedTasks, setProcessedTasks] = useState(tasks || []);
|
|
@@ -49,5 +63,7 @@ export function Command({ command, state, service, tasks, error: errorProp, syst
|
|
|
49
63
|
mounted = false;
|
|
50
64
|
};
|
|
51
65
|
}, [command, done, service]);
|
|
52
|
-
return (_jsxs(Box, { alignSelf: "flex-start", marginBottom: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: ["> pls ", command] }), isLoading && (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Spinner, {})] }))] }), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) })), processedTasks.length > 0 && (_jsx(Box, { flexDirection: "column", children: processedTasks.map((task, index) => (_jsxs(Box, { children: [_jsx(Text, { color: "whiteBright", children: ' - ' }), _jsx(Text, { color:
|
|
66
|
+
return (_jsxs(Box, { alignSelf: "flex-start", marginBottom: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: ["> pls ", command] }), isLoading && (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Spinner, {})] }))] }), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) })), processedTasks.length > 0 && (_jsx(Box, { flexDirection: "column", children: processedTasks.map((task, index) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "whiteBright", children: ' - ' }), _jsx(Text, { color: getTaskActionColor(task.type), children: task.action }), _jsxs(Text, { color: getTaskTypeColor(task.type), dimColor: shouldDimTaskType(task.type), children: [' ', "(", task.type, ")"] })] }), (task.type === TaskType.Define &&
|
|
67
|
+
task.params?.options &&
|
|
68
|
+
Array.isArray(task.params.options) && (_jsx(Box, { flexDirection: "column", marginLeft: 4, children: task.params.options.map((option, optIndex) => (_jsx(Box, { children: _jsxs(Text, { color: "whiteBright", dimColor: true, children: ["- ", String(option)] }) }, optIndex))) })))] }, index))) }))] }));
|
|
53
69
|
}
|