prompt-language-shell 0.6.4 → 0.6.6

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/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Your personal command-line concierge. Ask politely, and it gets things done.
4
4
 
5
- > **Note:** This project is in early preview. Features and APIs may change as
6
- > development continues.
5
+ > **Note:** This project is in early preview. Features and APIs will change.
6
+ > See [roadmap](#roadmap).
7
7
 
8
8
  ## Installation
9
9
 
@@ -13,14 +13,14 @@ npm install -g prompt-language-shell
13
13
 
14
14
  ## Setup
15
15
 
16
- On first run, `pls` walks you through a quick setup. Your settings will be saved to `~/.plsrc`.
16
+ On first run, `pls` walks you through a quick setup.
17
+ Your settings will be saved to `~/.plsrc`.
17
18
 
18
19
  ## Usage
19
20
 
20
21
  Type `pls` followed by your request in natural language.
21
22
 
22
- To see what `pls` can
23
- do, start by listing available capabilities:
23
+ To see what `pls` can do, start by listing available capabilities:
24
24
 
25
25
  ```
26
26
  $ pls list skills
@@ -98,6 +98,8 @@ Skills let you teach `pls` about your project-specific workflows. Create
98
98
  markdown files in `~/.pls/skills/` to define custom operations that `pls` can
99
99
  understand and execute.
100
100
 
101
+ For complete documentation, see [docs/SKILLS.md](./docs/SKILLS.md).
102
+
101
103
  ### Structure
102
104
 
103
105
  Each skill file uses a simple markdown format:
@@ -155,6 +157,13 @@ $ pls build dev
155
157
  $ pls build test
156
158
  ```
157
159
 
160
+ ## Roadmap
161
+
162
+ - **0.7** - Comprehend skill, simplified prompts, better debugging
163
+ - **0.8** - Sequential and interlaced skill execution
164
+ - **0.9** - Learn skill, codebase refinement, complex dependency handling
165
+ - **1.0** - Production release
166
+
158
167
  ## Development
159
168
 
160
169
  See [CLAUDE.md](./CLAUDE.md) for development guidelines and architecture.
@@ -88,6 +88,8 @@ These MUST appear AFTER Execute and BEFORE user skills:
88
88
  If skills are provided in the "Available Skills" section below, include them
89
89
  in the response. For each skill:
90
90
  - Extract the skill name from the first heading (# Skill Name)
91
+ - If the skill name contains "(INCOMPLETE)", preserve it exactly in the task
92
+ action
91
93
  - Extract a brief description from the Description or Overview section
92
94
  - Keep descriptions concise (1-2 lines maximum)
93
95
  - If the user specified a filter (e.g., "skills for deployment"), only include
@@ -1,6 +1,6 @@
1
1
  import Anthropic from '@anthropic-ai/sdk';
2
2
  import { getAvailableConfigStructure, getConfiguredKeys, } from './configuration.js';
3
- import { formatSkillsForPrompt, loadSkills } from './skills.js';
3
+ import { formatSkillsForPrompt, loadSkillsWithValidation } from './skills.js';
4
4
  import { toolRegistry } from './tool-registry.js';
5
5
  /**
6
6
  * Wraps text to ensure no line exceeds the specified width.
@@ -62,7 +62,7 @@ export class AnthropicService {
62
62
  toolName === 'introspect' ||
63
63
  toolName === 'execute' ||
64
64
  toolName === 'validate') {
65
- const skills = loadSkills();
65
+ const skills = loadSkillsWithValidation();
66
66
  const skillsSection = formatSkillsForPrompt(skills);
67
67
  systemPrompt += skillsSection;
68
68
  }
@@ -5,25 +5,47 @@ import { expandSkillReferences } from './skill-expander.js';
5
5
  import { getConfigType, parseSkillMarkdown } from './skill-parser.js';
6
6
  /**
7
7
  * Validate config requirements for execute tasks
8
- * Returns missing config requirements
8
+ * Returns validation result with missing config and validation errors
9
9
  */
10
10
  export function validateExecuteTasks(tasks) {
11
11
  const userConfig = loadUserConfig();
12
12
  const missing = [];
13
13
  const seenPaths = new Set();
14
- // Load and parse all skills for validation
14
+ const validationErrors = [];
15
+ const seenSkills = new Set();
16
+ // Load all skills (including invalid ones for validation)
15
17
  const skillContents = loadSkills();
16
- const parsedSkills = skillContents
17
- .map((content) => parseSkillMarkdown(content))
18
- .filter((s) => s !== null);
18
+ const parsedSkills = skillContents.map((content) => parseSkillMarkdown(content));
19
19
  const skillLookup = (name) => parsedSkills.find((s) => s.name === name) || null;
20
+ // Check for invalid skills being used in tasks
21
+ for (const task of tasks) {
22
+ const skillName = typeof task.params?.skill === 'string' ? task.params.skill : null;
23
+ if (skillName && !seenSkills.has(skillName)) {
24
+ seenSkills.add(skillName);
25
+ // Check if this skill is invalid
26
+ const skill = skillLookup(skillName);
27
+ if (skill && !skill.isValid) {
28
+ validationErrors.push({
29
+ skill: skill.name,
30
+ issues: [skill.validationError || 'Unknown validation error'],
31
+ });
32
+ }
33
+ }
34
+ }
35
+ // If there are validation errors, return early
36
+ if (validationErrors.length > 0) {
37
+ return {
38
+ missingConfig: [],
39
+ validationErrors,
40
+ };
41
+ }
20
42
  for (const task of tasks) {
21
43
  // Check if task originates from a skill
22
44
  const skillName = typeof task.params?.skill === 'string' ? task.params.skill : null;
23
45
  if (skillName) {
24
46
  // Task comes from a skill - check skill's Execution section
25
47
  const skill = skillLookup(skillName);
26
- if (!skill || !skill.execution) {
48
+ if (!skill) {
27
49
  continue;
28
50
  }
29
51
  // Get variant from task params (if any)
@@ -106,5 +128,8 @@ export function validateExecuteTasks(tasks) {
106
128
  }
107
129
  }
108
130
  }
109
- return missing;
131
+ return {
132
+ missingConfig: missing,
133
+ validationErrors: [],
134
+ };
110
135
  }
@@ -37,10 +37,6 @@ export function expandSkillReferences(execution, skillLookup, visited = new Set(
37
37
  expanded.push(line);
38
38
  continue;
39
39
  }
40
- if (!skill.execution || skill.execution.length === 0) {
41
- // Referenced skill has no execution, skip
42
- continue;
43
- }
44
40
  // Recursively expand referenced skill's execution
45
41
  const newVisited = new Set(visited);
46
42
  newVisited.add(skillName);
@@ -62,7 +58,7 @@ export function getReferencedSkills(execution, skillLookup, visited = new Set())
62
58
  }
63
59
  referenced.add(skillName);
64
60
  const skill = skillLookup(skillName);
65
- if (skill && skill.execution) {
61
+ if (skill) {
66
62
  const newVisited = new Set(visited);
67
63
  newVisited.add(skillName);
68
64
  const nested = getReferencedSkills(skill.execution, skillLookup, newVisited);
@@ -1,40 +1,85 @@
1
1
  import YAML from 'yaml';
2
2
  /**
3
- * Parse a skill markdown file into structured definition
3
+ * Validate a skill without parsing it fully
4
+ * Returns validation error if skill is invalid, null if valid
4
5
  */
5
- export function parseSkillMarkdown(content) {
6
+ export function validateSkill(content) {
6
7
  const sections = extractSections(content);
7
- // Name is required
8
+ // Name is required for error reporting
9
+ const skillName = sections.name || 'Unknown skill';
10
+ // Check required sections
8
11
  if (!sections.name) {
9
- return null;
12
+ return {
13
+ skillName,
14
+ error: 'The skill file is missing a Name section',
15
+ };
10
16
  }
11
- // Description is required
12
17
  if (!sections.description) {
13
- return null;
18
+ return {
19
+ skillName,
20
+ error: 'The skill file is missing a Description section',
21
+ };
14
22
  }
15
- // Steps are required
16
23
  if (!sections.steps || sections.steps.length === 0) {
17
- return null;
18
- }
19
- // Validate execution and steps have same count (if execution exists)
20
- if (sections.execution &&
21
- sections.execution.length !== sections.steps.length) {
22
- return null;
23
- }
24
+ return {
25
+ skillName,
26
+ error: 'The skill file is missing a Steps section',
27
+ };
28
+ }
29
+ if (!sections.execution || sections.execution.length === 0) {
30
+ return {
31
+ skillName,
32
+ error: 'The skill file is missing an Execution section',
33
+ };
34
+ }
35
+ // Execution and steps must have same count
36
+ if (sections.execution.length !== sections.steps.length) {
37
+ return {
38
+ skillName,
39
+ error: `The skill has ${String(sections.steps.length)} steps but ${String(sections.execution.length)} execution lines`,
40
+ };
41
+ }
42
+ return null;
43
+ }
44
+ /**
45
+ * Parse a skill markdown file into structured definition
46
+ */
47
+ export function parseSkillMarkdown(content) {
48
+ const sections = extractSections(content);
49
+ // Validate the skill
50
+ const validationError = validateSkill(content);
51
+ // For invalid skills, return minimal definition with error
52
+ if (validationError) {
53
+ return {
54
+ name: sections.name || 'Unknown skill',
55
+ description: sections.description || '',
56
+ steps: sections.steps || [],
57
+ execution: sections.execution || [],
58
+ isValid: false,
59
+ validationError: validationError.error,
60
+ isIncomplete: true,
61
+ };
62
+ }
63
+ // Valid skill - all required fields are present (validation passed)
64
+ const description = sections.description;
24
65
  const skill = {
25
66
  name: sections.name,
26
- description: sections.description,
67
+ description,
27
68
  steps: sections.steps,
69
+ execution: sections.execution,
70
+ isValid: true,
28
71
  };
72
+ // Check if skill is incomplete (valid but needs more documentation)
73
+ const MIN_DESCRIPTION_LENGTH = 20;
74
+ if (description.trim().length < MIN_DESCRIPTION_LENGTH) {
75
+ skill.isIncomplete = true;
76
+ }
29
77
  if (sections.aliases && sections.aliases.length > 0) {
30
78
  skill.aliases = sections.aliases;
31
79
  }
32
80
  if (sections.config) {
33
81
  skill.config = sections.config;
34
82
  }
35
- if (sections.execution && sections.execution.length > 0) {
36
- skill.execution = sections.execution;
37
- }
38
83
  return skill;
39
84
  }
40
85
  /**
@@ -46,8 +91,8 @@ function extractSections(content) {
46
91
  let currentSection = null;
47
92
  let sectionLines = [];
48
93
  for (const line of lines) {
49
- // Check for section headers (### SectionName)
50
- const headerMatch = line.match(/^###\s+(.+)$/);
94
+ // Check for section headers (any valid markdown header: #, ##, ###, etc.)
95
+ const headerMatch = line.match(/^#{1,6}\s+(.+)$/);
51
96
  if (headerMatch) {
52
97
  // Process previous section
53
98
  if (currentSection) {
@@ -35,18 +35,26 @@ export function loadSkills() {
35
35
  }
36
36
  /**
37
37
  * Load and parse all skill definitions
38
- * Returns structured skill definitions
38
+ * Returns structured skill definitions (including invalid skills)
39
39
  */
40
40
  export function loadSkillDefinitions() {
41
41
  const skillContents = loadSkills();
42
- const definitions = [];
43
- for (const content of skillContents) {
42
+ return skillContents.map((content) => parseSkillMarkdown(content));
43
+ }
44
+ /**
45
+ * Load skills and mark incomplete ones in their markdown
46
+ * Returns array of skill markdown with status markers
47
+ */
48
+ export function loadSkillsWithValidation() {
49
+ const skillContents = loadSkills();
50
+ return skillContents.map((content) => {
44
51
  const parsed = parseSkillMarkdown(content);
45
- if (parsed) {
46
- definitions.push(parsed);
52
+ // If skill is incomplete (either validation failed or needs more documentation), append (INCOMPLETE) to the name
53
+ if (parsed.isIncomplete) {
54
+ return content.replace(/^(#{1,6}\s+Name\s*\n+)(.+?)(\n|$)/im, `$1$2 (INCOMPLETE)$3`);
47
55
  }
48
- }
49
- return definitions;
56
+ return content;
57
+ });
50
58
  }
51
59
  /**
52
60
  * Create skill lookup function from definitions
@@ -72,6 +80,10 @@ export function formatSkillsForPrompt(skills) {
72
80
  The following skills define domain-specific workflows. When the user's
73
81
  query matches a skill, incorporate the skill's steps into your plan.
74
82
 
83
+ Skills marked with (INCOMPLETE) have validation errors or need more
84
+ documentation, and cannot be executed. These should be listed in
85
+ introspection with their markers.
86
+
75
87
  **IMPORTANT**: When creating options from skill descriptions, do NOT use
76
88
  brackets for additional information. Use commas instead. For example:
77
89
  - CORRECT: "Build project Alpha, the legacy version"
@@ -125,9 +125,19 @@ function executeTasksAfterConfirm(tasks, service, userRequest, handlers) {
125
125
  }
126
126
  else {
127
127
  // Execute tasks with validation
128
- const missingConfig = validateExecuteTasks(tasks);
129
- if (missingConfig.length > 0) {
130
- handlers.addToQueue(createValidateDefinition(missingConfig, userRequest, service, (error) => {
128
+ const validation = validateExecuteTasks(tasks);
129
+ if (validation.validationErrors.length > 0) {
130
+ // Show error feedback for invalid skills
131
+ const errorMessages = validation.validationErrors.map((error) => {
132
+ const issuesList = error.issues
133
+ .map((issue) => ` - ${issue}`)
134
+ .join('\n');
135
+ return `Invalid skill definition "${error.skill}":\n\n${issuesList}`;
136
+ });
137
+ handlers.addToQueue(createFeedback(FeedbackType.Failed, errorMessages.join('\n\n')));
138
+ }
139
+ else if (validation.missingConfig.length > 0) {
140
+ handlers.addToQueue(createValidateDefinition(validation.missingConfig, userRequest, service, (error) => {
131
141
  handlers.onError(error);
132
142
  }, () => {
133
143
  handlers.addToQueue(createExecuteDefinition(tasks, service));
@@ -24,23 +24,31 @@ function parseCapabilityFromTask(task) {
24
24
  const colonIndex = task.action.indexOf(':');
25
25
  if (colonIndex === -1) {
26
26
  const upperName = task.action.toUpperCase();
27
+ // Check for status markers
28
+ const isIncomplete = task.action.includes('(INCOMPLETE)');
29
+ const cleanName = task.action.replace(/\s*\(INCOMPLETE\)\s*/gi, '').trim();
27
30
  return {
28
- name: task.action,
31
+ name: cleanName,
29
32
  description: '',
30
33
  isBuiltIn: BUILT_IN_CAPABILITIES.has(upperName),
31
34
  isIndirect: INDIRECT_CAPABILITIES.has(upperName),
35
+ isIncomplete,
32
36
  };
33
37
  }
34
38
  const name = task.action.substring(0, colonIndex).trim();
35
39
  const description = task.action.substring(colonIndex + 1).trim();
36
- const upperName = name.toUpperCase();
40
+ // Check for status markers
41
+ const isIncomplete = name.includes('(INCOMPLETE)');
42
+ const cleanName = name.replace(/\s*\(INCOMPLETE\)\s*/gi, '').trim();
43
+ const upperName = cleanName.toUpperCase();
37
44
  const isBuiltIn = BUILT_IN_CAPABILITIES.has(upperName);
38
45
  const isIndirect = INDIRECT_CAPABILITIES.has(upperName);
39
46
  return {
40
- name,
47
+ name: cleanName,
41
48
  description,
42
49
  isBuiltIn,
43
50
  isIndirect,
51
+ isIncomplete,
44
52
  };
45
53
  }
46
54
  export function Introspect({ tasks, state, status, service, children, debug = false, handlers, }) {
package/dist/ui/Report.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from 'ink';
3
3
  import { Colors } from '../services/colors.js';
4
- function CapabilityItem({ name, description, isBuiltIn, isIndirect, }) {
4
+ function CapabilityItem({ name, description, isBuiltIn, isIndirect, isIncomplete, }) {
5
5
  const color = isIndirect
6
6
  ? Colors.Origin.Indirect
7
7
  : isBuiltIn
8
8
  ? Colors.Origin.BuiltIn
9
9
  : Colors.Origin.UserProvided;
10
- return (_jsxs(Box, { children: [_jsx(Text, { children: "- " }), _jsx(Text, { color: color, children: name }), _jsxs(Text, { children: [" - ", description] })] }));
10
+ return (_jsxs(Box, { children: [_jsx(Text, { children: "- " }), _jsx(Text, { color: color, children: name }), _jsxs(Text, { children: [" - ", description] }), isIncomplete && _jsx(Text, { color: Colors.Status.Warning, children: " (incomplete)" })] }));
11
11
  }
12
12
  export function Report({ message, capabilities }) {
13
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginLeft: 1, children: _jsx(Text, { children: message }) }), _jsx(Box, { flexDirection: "column", marginLeft: 3, marginTop: 1, children: capabilities.map((capability, index) => (_jsx(CapabilityItem, { name: capability.name, description: capability.description, isBuiltIn: capability.isBuiltIn, isIndirect: capability.isIndirect }, index))) })] }));
13
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginLeft: 1, children: _jsx(Text, { children: message }) }), _jsx(Box, { flexDirection: "column", marginLeft: 3, marginTop: 1, children: capabilities.map((capability, index) => (_jsx(CapabilityItem, { name: capability.name, description: capability.description, isBuiltIn: capability.isBuiltIn, isIndirect: capability.isIndirect, isIncomplete: capability.isIncomplete }, index))) })] }));
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prompt-language-shell",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
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",