@denizokcu/haze 0.3.0 → 0.4.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +31 -19
  3. package/dist/cli/commands/chat.d.ts +1 -1
  4. package/dist/cli/commands/chat.js +144 -52
  5. package/dist/cli/commands/commands.js +105 -114
  6. package/dist/cli/commands/streaming.d.ts +33 -5
  7. package/dist/cli/commands/streaming.js +235 -103
  8. package/dist/cli/contextReport.d.ts +1 -0
  9. package/dist/cli/contextReport.js +47 -0
  10. package/dist/config/contextFiles.d.ts +25 -0
  11. package/dist/config/contextFiles.js +53 -0
  12. package/dist/core/agent/compaction.d.ts +3 -0
  13. package/dist/core/agent/compaction.js +23 -3
  14. package/dist/core/agent/contextBudget.d.ts +33 -0
  15. package/dist/core/agent/contextBudget.js +88 -0
  16. package/dist/core/agent/requestAssembly.d.ts +22 -0
  17. package/dist/core/agent/requestAssembly.js +146 -0
  18. package/dist/core/agent/toolOutputStore.d.ts +11 -0
  19. package/dist/core/agent/toolOutputStore.js +33 -0
  20. package/dist/core/agent/workState.d.ts +38 -0
  21. package/dist/core/agent/workState.js +89 -0
  22. package/dist/core/goal/completionPolicy.js +1 -1
  23. package/dist/core/goal/sessionGoal.d.ts +2 -0
  24. package/dist/core/goal/sessionGoal.js +8 -1
  25. package/dist/core/log/llmLog.d.ts +68 -0
  26. package/dist/core/log/llmLog.js +55 -0
  27. package/dist/core/session/sessionStore.d.ts +6 -0
  28. package/dist/core/session/sessionStore.js +5 -0
  29. package/dist/core/subagent/subagentRunner.d.ts +4 -1
  30. package/dist/core/subagent/subagentRunner.js +5 -15
  31. package/dist/core/validation/outputParser.js +15 -2
  32. package/dist/llm/client.d.ts +39 -0
  33. package/dist/llm/client.js +46 -2
  34. package/dist/llm/hazeTools.d.ts +37 -12
  35. package/dist/llm/hazeTools.js +133 -55
  36. package/dist/llm/systemPrompt.d.ts +6 -1
  37. package/dist/llm/systemPrompt.js +42 -81
  38. package/dist/skills/builder/SkillBuilder.d.ts +16 -2
  39. package/dist/skills/builder/SkillBuilder.js +68 -65
  40. package/dist/skills/skillTools.d.ts +2 -19
  41. package/dist/skills/skillTools.js +28 -19
  42. package/package.json +2 -1
@@ -60,6 +60,7 @@ Every skill you create must include, in this order:
60
60
  - Evidence rule: require final answers to be grounded in actual inspected content, but do not require exhaustive citations.
61
61
 
62
62
  Infer the user's intent from their wording and make that intent explicit in the Focused prompt. A good focused prompt states what the skill should accomplish, not just what commands it should run.
63
+ Users often phrase skill requests with meta-framing like "create a skill that...", "make me a skill for...", "build a ... skill", or the equivalent in any language. Strip that framing. The skill must perform the underlying intent end-to-end; it must not be a skill whose job is to "create" or "build" the thing the user named. Example: "create a security review skill" means the skill IS a security reviewer, not a skill that creates security reviewers.
63
64
  Favor skills that a small or slower model can follow in one pass. The model should be able to finish with a concise response after a small number of tool calls.
64
65
  Avoid fragile skills that stop after one empty command or one truncated command, but do not over-correct by requiring exhaustive inspection. Encode only common, necessary fallbacks.
65
66
  For diff/review skills, keep the default path simple: get status/stat/name-only, inspect unstaged and staged diffs if present, and if no changes or target exist, return a short no-changes response. Use targeted per-file diffs only when the full diff is too large or truncated.
@@ -67,13 +68,14 @@ Do not require exact line citations for every finding in generated skills; requi
67
68
  `;
68
69
  const generatedSkillSchema = z.object({
69
70
  name: z.string().min(1).describe('Meaningful kebab-case skill name with 2-4 words'),
71
+ intent: z.string().min(1).describe('The underlying purpose the skill performs, with any "create a skill" / "make me a skill" framing stripped away. States what the skill DOES, in the same language the user used. Example: input "create a security review skill" -> intent "security review".'),
70
72
  files: z.array(z.object({
71
73
  path: z.string().min(1).describe('Relative file path inside the skill directory'),
72
74
  content: z.string().describe('Complete file content'),
73
75
  })).min(1).describe('Generated skill files, including SKILL.md'),
74
76
  });
75
77
  const SKILL_NAME_STOP_WORDS = new Set([
76
- 'a', 'an', 'the', 'to', 'for', 'with', 'and', 'or', 'of', 'in', 'on', 'my', 'our', 'me', 'i', 'from', 'against', 'as', 'by', 'into', 'using', 'use', 'when', 'asks', 'ask',
78
+ 'a', 'an', 'the', 'to', 'for', 'with', 'and', 'or', 'of', 'in', 'on', 'my', 'our', 'me', 'i', 'from', 'against', 'as', 'by', 'into', 'using', 'use', 'when', 'asks', 'ask', 'skill', 'skills',
77
79
  ]);
78
80
  const SKILL_NAME_TRAILING_FILLER_WORDS = new Set([
79
81
  'write', 'create', 'make', 'build', 'generate', 'do', 'run', 'handle', 'help', 'using', 'with', 'for', 'to',
@@ -90,16 +92,31 @@ export function slug(s) {
90
92
  words.push(words[0] === 'custom' ? 'skill' : 'workflow');
91
93
  return words.join('-');
92
94
  }
95
+ /**
96
+ * Coerce a user-typed skill name into a directory-safe kebab-case slug.
97
+ * Unlike slug(), this preserves every word the user typed (no stop-word stripping)
98
+ * so explicit names like "create a skill" come through as "create-a-skill", not "skill".
99
+ * Returns '' when the input collapses to nothing usable.
100
+ */
101
+ export function toSkillDirName(raw) {
102
+ const collapsed = raw.trim().toLowerCase().replace(/[\s_]+/g, '-');
103
+ const stripped = collapsed.replace(/[^a-z0-9-]/g, '');
104
+ const trimmed = stripped.replace(/^-+|-+$/g, '').replace(/-{2,}/g, '-');
105
+ return trimmed;
106
+ }
93
107
  function yamlString(value) {
94
108
  return JSON.stringify(value);
95
109
  }
96
- function fallbackSkill(description) {
97
- const name = slug(description);
110
+ const DEFAULT_SKILL_ROLE = 'You are a focused, practical assistant for this workflow.';
111
+ function fallbackSkill(input) {
112
+ const name = input.name;
113
+ const role = input.role?.trim() || DEFAULT_SKILL_ROLE;
98
114
  return {
99
115
  name,
116
+ intent: input.description,
100
117
  files: [{
101
118
  path: 'SKILL.md',
102
- content: `---\nname: ${name}\ndescription: ${yamlString(`Use when the user asks: ${description}`)}\n---\n\n# Role\n\nYou are a focused, practical assistant for this workflow.\n\n# Focused prompt\n\nAccomplish the user's intended outcome with the smallest reliable workflow: ${description}\n\n# Inputs to inspect\n\nIdentify the concrete commands, files, diffs, logs, or project state needed for this workflow. Inspect actual content, not only summaries.\n\n# Procedure\n\n1. Confirm the relevant project state.\n2. Inspect the primary input for the workflow.\n3. If the primary input is empty, unavailable, or truncated, inspect natural fallback inputs or narrower targeted inputs before stopping.\n4. For large inputs, inspect summaries first, then targeted files, sections, or commands most relevant to the goal.\n5. Perform the requested analysis or implementation using the inspected evidence.\n6. Produce the final answer using the output template below.\n\n# Stop conditions\n\nOnly say there is nothing to do after every relevant input source has been checked and is empty.\n\n# Blocker policy\n\nOnly stop as blocked for a concrete tool failure, missing permission, unavailable dependency, or ambiguous requirement that prevents progress. Truncated output is not a blocker when narrower follow-up inspection is possible.\n\n# Output template\n\n## Summary\n- <one-to-three bullets with the result>\n\n## Actions or findings\n- <concrete actions taken or findings discovered>\n\n## Evidence inspected\n- <commands, files, diffs, or outputs used>\n\n## Next step\n- <recommended next action, or "None" if complete>\n${STANDARD_SKILL_REQUIREMENTS}\n# References\n\nAdd relative file references here if this skill needs examples, templates, or supporting docs.\n`,
119
+ content: `---\nname: ${name}\ndescription: ${yamlString(`Use when the user asks: ${input.description}`)}\n---\n\n# Role\n\n${role}\n\n# Focused prompt\n\nAccomplish the user's intended outcome with the smallest reliable workflow: ${input.description}\n\n# Inputs to inspect\n\nIdentify the concrete commands, files, diffs, logs, or project state needed for this workflow. Inspect actual content, not only summaries.\n\n# Procedure\n\n1. Confirm the relevant project state.\n2. Inspect the primary input for the workflow.\n3. If the primary input is empty, unavailable, or truncated, inspect natural fallback inputs or narrower targeted inputs before stopping.\n4. For large inputs, inspect summaries first, then targeted files, sections, or commands most relevant to the goal.\n5. Perform the requested analysis or implementation using the inspected evidence.\n6. Produce the final answer using the output template below.\n\n# Stop conditions\n\nOnly say there is nothing to do after every relevant input source has been checked and is empty.\n\n# Blocker policy\n\nOnly stop as blocked for a concrete tool failure, missing permission, unavailable dependency, or ambiguous requirement that prevents progress. Truncated output is not a blocker when narrower follow-up inspection is possible.\n\n# Output template\n\n## Summary\n- <one-to-three bullets with the result>\n\n## Actions or findings\n- <concrete actions taken or findings discovered>\n\n## Evidence inspected\n- <commands, files, diffs, or outputs used>\n\n## Next step\n- <recommended next action, or "None" if complete>\n${STANDARD_SKILL_REQUIREMENTS}\n# References\n\nAdd relative file references here if this skill needs examples, templates, or supporting docs.\n`,
103
120
  }],
104
121
  };
105
122
  }
@@ -130,20 +147,21 @@ function extractJson(text) {
130
147
  function parseGeneratedSkill(text, description) {
131
148
  const parsed = JSON.parse(extractJson(text));
132
149
  const name = typeof parsed.name === 'string' && parsed.name.trim() ? slug(parsed.name) : slug(description);
150
+ const intent = typeof parsed.intent === 'string' && parsed.intent.trim() ? parsed.intent.trim() : description;
133
151
  const files = Array.isArray(parsed.files) ? parsed.files.filter((file) => {
134
152
  return typeof file === 'object' && file != null && typeof file.path === 'string' && typeof file.content === 'string';
135
153
  }) : [];
136
154
  if (!files.some(file => file.path === 'SKILL.md'))
137
155
  throw new Error('Generated skill did not include SKILL.md');
138
- return { name, files };
156
+ return { name, intent, files };
139
157
  }
140
- async function descriptionFromSkillSummary(description, finalName, files) {
158
+ async function descriptionFromSkillSummary(intent, finalName, files) {
141
159
  const skillMd = files.find(file => file.path === 'SKILL.md')?.content;
142
160
  if (!skillMd)
143
- return normalizeSkillDescription(`the user asks: ${description}`);
161
+ return normalizeSkillDescription(`the user asks: ${intent}`);
144
162
  const activeModel = await model();
145
163
  if (!activeModel)
146
- return normalizeSkillDescription(`the user asks: ${description}`);
164
+ return normalizeSkillDescription(`the user asks: ${intent}`);
147
165
  const result = await generateObject({
148
166
  model: activeModel,
149
167
  schema: z.object({ description: z.string().min(1).describe('Final Use when description that tells an LLM when to invoke this skill') }),
@@ -152,7 +170,7 @@ async function descriptionFromSkillSummary(description, finalName, files) {
152
170
  prompt: [
153
171
  'Write the final Haze skill frontmatter description after reading the entire generated SKILL.md.',
154
172
  '',
155
- `Original user request: ${description}`,
173
+ `Skill purpose (intent): ${intent}`,
156
174
  `Final skill name: ${finalName}`,
157
175
  '',
158
176
  'Description rules:',
@@ -167,38 +185,7 @@ async function descriptionFromSkillSummary(description, finalName, files) {
167
185
  skillMd,
168
186
  ].join('\n'),
169
187
  });
170
- return normalizeSkillDescription(result.object.description || `the user asks: ${description}`);
171
- }
172
- async function nameFromSkillSummary(description, generatedName, files) {
173
- const skillMd = files.find(file => file.path === 'SKILL.md')?.content;
174
- if (!skillMd)
175
- return slug(generatedName || description);
176
- const activeModel = await model();
177
- if (!activeModel)
178
- return slug(generatedName || description);
179
- const result = await generateObject({
180
- model: activeModel,
181
- schema: z.object({ name: z.string().min(1).describe('Final meaningful 2-4 word kebab-case skill name') }),
182
- schemaName: 'GeneratedHazeSkillName',
183
- schemaDescription: 'A final skill name chosen from the complete generated SKILL.md.',
184
- prompt: [
185
- 'Choose the final Haze skill directory name after reading the entire generated SKILL.md.',
186
- '',
187
- `Original user request: ${description}`,
188
- `Draft/generated name: ${generatedName}`,
189
- '',
190
- 'Naming rules:',
191
- '- Return 2-4 meaningful words in kebab-case.',
192
- '- The name must summarize the whole skill workflow, not just copy the first words of the request.',
193
- '- Do not include a loose trailing word from a cut-off sentence. Bad: commit-current-changes-write. Good: commit-current-changes.',
194
- '- Prefer nouns that convey the outcome, such as review, commit, release-notes, migration, validation, or triage.',
195
- '- Avoid vague words like helper, workflow, custom-skill, write, create, make, or do unless they are essential to the meaning.',
196
- '',
197
- 'Generated SKILL.md:',
198
- skillMd,
199
- ].join('\n'),
200
- });
201
- return slug(result.object.name || generatedName || description);
188
+ return normalizeSkillDescription(result.object.description || `the user asks: ${intent}`);
202
189
  }
203
190
  function assertSafeGeneratedFile(filePath) {
204
191
  if (path.isAbsolute(filePath))
@@ -210,10 +197,11 @@ function assertSafeGeneratedFile(filePath) {
210
197
  throw new Error('Generated skill file path is empty');
211
198
  return normalized;
212
199
  }
213
- async function generateSkill(description) {
200
+ async function generateSkill(input) {
214
201
  const activeModel = await model();
215
202
  if (!activeModel)
216
203
  throw new Error('No model provider configured. Run /provider to choose or add a provider before using /create-skill.');
204
+ const role = input.role?.trim() || DEFAULT_SKILL_ROLE;
217
205
  const result = await generateObject({
218
206
  model: activeModel,
219
207
  system: SKILL_CREATOR_SKILL,
@@ -221,17 +209,27 @@ async function generateSkill(description) {
221
209
  schemaName: 'GeneratedHazeSkill',
222
210
  schemaDescription: 'A generated Haze Markdown skill and optional referenced files.',
223
211
  prompt: [
224
- 'Create a Haze skill from this user description:',
225
- description,
212
+ 'A user is creating a Haze skill via a 3-step wizard. They have already chosen the NAME and the ROLE; you do NOT choose those.',
213
+ '',
214
+ `User-chosen skill name (use VERBATIM in frontmatter, do not rename): ${input.name}`,
215
+ `User-chosen Role text (paste VERBATIM into the # Role section): ${role}`,
216
+ `Skill description (the work the skill should do): ${input.description}`,
217
+ '',
218
+ 'Step 1 — Extract the intent from the description.',
219
+ 'The description may contain meta-framing in ANY language: phrases like "create a skill that...", "make me a skill for...", "build a ... skill", or the equivalent verbs and nouns in any other language. Strip that framing and capture what the skill should actually DO. Put the result in the `intent` field, in the same language the user used.',
220
+ '- "create a security review skill" -> intent: "security review"',
221
+ '- "make me a skill that finds TODOs" -> intent: "finds TODOs"',
222
+ '- "crée une compétence qui vérifie le style du code" -> intent: "vérifie le style du code"',
223
+ 'The intent must describe the work the skill performs, not the act of creating a skill. If the description already states the purpose cleanly (e.g. "review code"), copy it through unchanged.',
226
224
  '',
227
- 'Rules:',
225
+ 'Step 2 — Build the skill around the intent, not the framing.',
226
+ `- The skill name in frontmatter MUST be exactly: ${input.name} — do not invent a different name.`,
227
+ `- The # Role section MUST contain exactly this text (do not rephrase): ${role}`,
228
+ '- The skill MUST perform the intent end-to-end. It must NOT be a skill whose job is to "create" or "build" the thing the user named.',
229
+ '- Bad: for intent "security review", the Role says "You create a security reviewer." Good: the Role says "You are a security reviewer" and the skill actually performs security review.',
228
230
  '- SKILL.md must include frontmatter with name and description.',
229
- '- The skill name must be 2-4 meaningful words in kebab-case and convey the workflow intent, for example "branch-diff-review" or "release-notes-draft".',
230
- '- Pick the name as if it were written after summarizing the complete SKILL.md, not by truncating the first words of the request.',
231
- '- Do not include loose trailing words from cut-off sentences. Bad: "commit-current-changes-write". Good: "commit-current-changes".',
232
- '- Avoid vague names like "helper", "workflow", or "custom-skill" unless paired with a specific domain word.',
233
231
  '- The frontmatter description must start with "Use when".',
234
- '- Infer the user intent from the description and make it explicit in the Focused prompt.',
232
+ '- Make the intent explicit in the Focused prompt.',
235
233
  '- The body must start with these headings immediately after frontmatter: Role, Focused prompt.',
236
234
  '- The body must then include these headings: Inputs to inspect, Procedure, Fallbacks, Stop conditions, Blocker policy, Output template.',
237
235
  '- The Focused prompt must describe the desired outcome and definition of success, not just restate the trigger.',
@@ -249,46 +247,51 @@ async function generateSkill(description) {
249
247
  ].join('\n'),
250
248
  });
251
249
  const generated = result.object;
252
- const draftName = slug(generated.name || description);
253
- const finalName = await nameFromSkillSummary(description, draftName, generated.files).catch(() => draftName);
254
- const finalDescription = await descriptionFromSkillSummary(description, finalName, generated.files).catch(() => normalizeSkillDescription(`the user asks: ${description}`));
250
+ const intent = generated.intent?.trim() || input.description;
251
+ // The user already named the skill — use it verbatim, do NOT run nameFromSkillSummary.
252
+ const finalName = input.name;
253
+ const finalDescription = await descriptionFromSkillSummary(intent, finalName, generated.files).catch(() => normalizeSkillDescription(`the user asks: ${intent}`));
255
254
  const files = generated.files.map(file => file.path === 'SKILL.md' ? { ...file, content: withSkillDescription(file.content, finalDescription) } : file);
256
- return { name: finalName, files };
255
+ return { name: finalName, intent, files };
257
256
  }
258
- export async function createSkill(description) {
259
- const generated = await generateSkill(description).catch(error => {
257
+ export async function createSkill(input) {
258
+ const name = toSkillDirName(input.name);
259
+ if (!name)
260
+ throw new Error('Skill name must contain at least one letter or number.');
261
+ const normalizedInput = { ...input, name, role: input.role?.trim() || undefined };
262
+ const generated = await generateSkill(normalizedInput).catch(error => {
260
263
  const message = error instanceof Error ? error.message : String(error);
261
264
  if (message.startsWith('No model provider configured.'))
262
265
  throw error instanceof Error ? error : new Error(message);
263
- return fallbackSkill(description);
266
+ return fallbackSkill(normalizedInput);
264
267
  });
265
- const name = generated.name || fallbackSkill(description).name;
266
- const dir = path.join(GLOBAL_SKILLS_DIR, name);
268
+ const finalName = generated.name || name;
269
+ const dir = path.join(GLOBAL_SKILLS_DIR, finalName);
267
270
  const skillFile = path.join(dir, 'SKILL.md');
268
271
  await fs.ensureDir(dir);
269
272
  if (await fs.pathExists(skillFile))
270
- throw new Error(`Skill already exists: ${name}`);
273
+ throw new Error(`Skill already exists: ${finalName}`);
271
274
  for (const generatedFile of generated.files) {
272
275
  const safePath = assertSafeGeneratedFile(generatedFile.path);
273
276
  const absolutePath = path.join(dir, safePath);
274
277
  await fs.ensureDir(path.dirname(absolutePath));
275
- const content = safePath === 'SKILL.md' ? withSkillName(withStandardRequirements(generatedFile.content), name) : generatedFile.content;
278
+ const content = safePath === 'SKILL.md' ? withSkillName(withStandardRequirements(generatedFile.content), finalName) : generatedFile.content;
276
279
  await fs.writeFile(absolutePath, content, 'utf8');
277
280
  }
278
281
  if (!(await fs.pathExists(skillFile))) {
279
- const fallback = fallbackSkill(description);
282
+ const fallback = fallbackSkill(normalizedInput);
280
283
  await fs.writeFile(skillFile, fallback.files[0].content, 'utf8');
281
284
  }
282
285
  const loaded = await loadSkill(dir, 'global');
283
286
  if (!loaded)
284
287
  throw new Error('Generated skill is missing SKILL.md');
285
- if (loaded.name !== name) {
288
+ if (loaded.name !== finalName) {
286
289
  const nextDir = path.join(GLOBAL_SKILLS_DIR, loaded.name);
287
290
  if (await fs.pathExists(nextDir))
288
291
  throw new Error(`Skill already exists: ${loaded.name}`);
289
292
  await fs.move(dir, nextDir);
290
293
  return { name: loaded.name, dir: nextDir, file: path.join(nextDir, 'SKILL.md') };
291
294
  }
292
- return { name, dir, file: skillFile };
295
+ return { name: finalName, dir, file: skillFile };
293
296
  }
294
- export const internals = { SKILL_CREATOR_SKILL, STANDARD_SKILL_REQUIREMENTS, parseGeneratedSkill, fallbackSkill, withStandardRequirements, withSkillName, withSkillDescription, normalizeSkillDescription };
297
+ export const internals = { SKILL_CREATOR_SKILL, STANDARD_SKILL_REQUIREMENTS, parseGeneratedSkill, fallbackSkill, withStandardRequirements, withSkillName, withSkillDescription, normalizeSkillDescription, toSkillDirName };
@@ -1,20 +1,3 @@
1
+ import { type ToolSet } from 'ai';
1
2
  import type { SkillRegistry } from './types.js';
2
- declare function toolNameForSkill(name: string): string;
3
- export declare function buildSkillTools(registry: SkillRegistry): {
4
- [k: string]: import("ai").Tool<{
5
- reason?: string | undefined;
6
- }, {
7
- name: string;
8
- description: string;
9
- reason: string | undefined;
10
- instructions: string;
11
- references: {
12
- path: string;
13
- content: string;
14
- }[];
15
- }>;
16
- };
17
- export declare const internals: {
18
- toolNameForSkill: typeof toolNameForSkill;
19
- };
20
- export {};
3
+ export declare function buildSkillTools(registry: SkillRegistry): ToolSet;
@@ -1,25 +1,34 @@
1
1
  import { tool } from 'ai';
2
2
  import { z } from 'zod';
3
- function toolNameForSkill(name) {
4
- return `skill_${name.replace(/[^a-zA-Z0-9_]/g, '_')}`;
5
- }
6
3
  export function buildSkillTools(registry) {
7
- const entries = [...registry.skills.values()].map(skill => [toolNameForSkill(skill.name), tool({
8
- description: skill.description,
4
+ if (registry.skills.size === 0)
5
+ return {};
6
+ const catalog = [...registry.skills.values()].map(skill => `${skill.name}: ${skill.description}`).join('\n');
7
+ return {
8
+ skill: tool({
9
+ description: `Load one installed Markdown workflow by name. Available skills:\n${catalog}`,
9
10
  inputSchema: z.object({
10
- reason: z.string().optional().describe('Why this skill is relevant to the current task'),
11
- }),
12
- execute: async ({ reason }) => ({
13
- name: skill.name,
14
- description: skill.description,
15
- reason,
16
- instructions: skill.body,
17
- references: skill.references.map(reference => ({
18
- path: reference.path,
19
- content: reference.content,
20
- })),
11
+ name: z.string().min(1).describe('Exact skill name from the catalog'),
12
+ reference: z.string().optional().describe('Optional referenced path to load after reading the skill instructions'),
21
13
  }),
22
- })]);
23
- return Object.fromEntries(entries);
14
+ execute: async ({ name, reference }) => {
15
+ const skill = registry.skills.get(name);
16
+ if (!skill)
17
+ return { ok: false, error: `Unknown skill: ${name}`, available: [...registry.skills.keys()] };
18
+ if (reference) {
19
+ const selected = skill.references.find(item => item.path === reference);
20
+ return selected
21
+ ? { ok: true, name: skill.name, reference: { path: selected.path, content: selected.content } }
22
+ : { ok: false, error: `Unknown reference for ${name}: ${reference}`, availableReferences: skill.references.map(item => item.path) };
23
+ }
24
+ return {
25
+ ok: true,
26
+ name: skill.name,
27
+ description: skill.description,
28
+ instructions: skill.body,
29
+ references: skill.references.map(item => item.path),
30
+ };
31
+ },
32
+ }),
33
+ };
24
34
  }
25
- export const internals = { toolNameForSkill };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A pragmatic agentic CLI for building apps from the terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,6 +39,7 @@
39
39
  "lint": "eslint src/",
40
40
  "lint:fix": "eslint src/ --fix",
41
41
  "typecheck": "tsc --noEmit",
42
+ "context:report": "node --import tsx src/cli/contextReport.ts",
42
43
  "haze": "tsx src/cli/index.ts",
43
44
  "prepublishOnly": "npm run typecheck && npm run build"
44
45
  },