@esotech/contextuate 2.0.0 → 2.1.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 (105) hide show
  1. package/README.md +169 -1
  2. package/dist/commands/claude.d.ts +21 -0
  3. package/dist/commands/claude.js +213 -0
  4. package/dist/commands/context.d.ts +1 -0
  5. package/dist/commands/create.d.ts +3 -0
  6. package/dist/commands/index.d.ts +4 -0
  7. package/dist/commands/init.d.ts +7 -0
  8. package/dist/commands/init.js +67 -6
  9. package/dist/commands/install.d.ts +28 -0
  10. package/dist/commands/install.js +116 -11
  11. package/dist/commands/monitor.d.ts +55 -0
  12. package/dist/commands/monitor.js +1007 -0
  13. package/dist/commands/remove.d.ts +3 -0
  14. package/dist/commands/run.d.ts +6 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +113 -1
  17. package/dist/monitor/daemon/circuit-breaker.d.ts +121 -0
  18. package/dist/monitor/daemon/circuit-breaker.js +552 -0
  19. package/dist/monitor/daemon/cli.d.ts +8 -0
  20. package/dist/monitor/daemon/cli.js +82 -0
  21. package/dist/monitor/daemon/index.d.ts +137 -0
  22. package/dist/monitor/daemon/index.js +695 -0
  23. package/dist/monitor/daemon/notifier.d.ts +25 -0
  24. package/dist/monitor/daemon/notifier.js +98 -0
  25. package/dist/monitor/daemon/processor.d.ts +89 -0
  26. package/dist/monitor/daemon/processor.js +455 -0
  27. package/dist/monitor/daemon/state.d.ts +80 -0
  28. package/dist/monitor/daemon/state.js +162 -0
  29. package/dist/monitor/daemon/watcher.d.ts +47 -0
  30. package/dist/monitor/daemon/watcher.js +171 -0
  31. package/dist/monitor/daemon/wrapper-manager.d.ts +106 -0
  32. package/dist/monitor/daemon/wrapper-manager.js +374 -0
  33. package/dist/monitor/hooks/emit-event.js +652 -0
  34. package/dist/monitor/persistence/file-store.d.ts +88 -0
  35. package/dist/monitor/persistence/file-store.js +335 -0
  36. package/dist/monitor/persistence/index.d.ts +7 -0
  37. package/dist/monitor/persistence/index.js +10 -0
  38. package/dist/monitor/server/adapters/redis.d.ts +38 -0
  39. package/dist/monitor/server/adapters/redis.js +213 -0
  40. package/dist/monitor/server/adapters/unix-socket.d.ts +33 -0
  41. package/dist/monitor/server/adapters/unix-socket.js +182 -0
  42. package/dist/monitor/server/broker.d.ts +135 -0
  43. package/dist/monitor/server/broker.js +475 -0
  44. package/dist/monitor/server/cli.d.ts +8 -0
  45. package/dist/monitor/server/cli.js +98 -0
  46. package/dist/monitor/server/fastify.d.ts +16 -0
  47. package/dist/monitor/server/fastify.js +184 -0
  48. package/dist/monitor/server/index.d.ts +36 -0
  49. package/dist/monitor/server/index.js +153 -0
  50. package/dist/monitor/server/websocket.d.ts +80 -0
  51. package/dist/monitor/server/websocket.js +453 -0
  52. package/dist/monitor/ui/assets/index-4IssW9On.js +59 -0
  53. package/dist/monitor/ui/assets/index-vo9hLe5R.css +32 -0
  54. package/dist/monitor/ui/favicon.png +0 -0
  55. package/dist/monitor/ui/index.html +14 -0
  56. package/dist/monitor/ui/logo.png +0 -0
  57. package/dist/monitor/ui/logo.svg +1 -0
  58. package/dist/runtime/driver.d.ts +16 -0
  59. package/dist/runtime/tools.d.ts +10 -0
  60. package/dist/templates/README.md +33 -7
  61. package/dist/templates/agents/aegis.md +4 -0
  62. package/dist/templates/agents/archon.md +13 -22
  63. package/dist/templates/agents/atlas.md +4 -0
  64. package/dist/templates/agents/canvas.md +4 -0
  65. package/dist/templates/agents/chronicle.md +4 -0
  66. package/dist/templates/agents/chronos.md +4 -0
  67. package/dist/templates/agents/cipher.md +4 -0
  68. package/dist/templates/agents/crucible.md +4 -0
  69. package/dist/templates/agents/echo.md +4 -0
  70. package/dist/templates/agents/forge.md +4 -0
  71. package/dist/templates/agents/ledger.md +4 -0
  72. package/dist/templates/agents/meridian.md +4 -0
  73. package/dist/templates/agents/nexus.md +4 -0
  74. package/dist/templates/agents/pythia.md +217 -0
  75. package/dist/templates/agents/scribe.md +4 -0
  76. package/dist/templates/agents/sentinel.md +4 -0
  77. package/dist/templates/agents/{oracle.md → thoth.md} +11 -7
  78. package/dist/templates/agents/unity.md +4 -0
  79. package/dist/templates/agents/vox.md +4 -0
  80. package/dist/templates/agents/weaver.md +4 -0
  81. package/dist/templates/framework-agents/documentation-expert.md +3 -3
  82. package/dist/templates/framework-agents/tools-expert.md +8 -8
  83. package/dist/templates/skills/consult.md +138 -0
  84. package/dist/templates/skills/orchestrate.md +173 -0
  85. package/dist/templates/skills/pythia.md +37 -0
  86. package/dist/templates/standards/agent-roles.md +68 -21
  87. package/dist/templates/standards/coding-standards.md +9 -26
  88. package/dist/templates/templates/context.md +17 -2
  89. package/dist/templates/templates/contextuate.md +21 -28
  90. package/dist/templates/templates/standards/go.md +167 -0
  91. package/dist/templates/templates/standards/java.md +167 -0
  92. package/dist/templates/templates/standards/javascript.md +292 -0
  93. package/dist/templates/templates/standards/php.md +181 -0
  94. package/dist/templates/templates/standards/python.md +175 -0
  95. package/dist/templates/tools/agent-creator.md +252 -0
  96. package/dist/templates/tools/agent-creator.tool.md +2 -2
  97. package/dist/templates/tools/quickref.md +216 -0
  98. package/dist/templates/tools/spawn.md +31 -0
  99. package/dist/templates/tools/standards-detector.md +301 -0
  100. package/dist/templates/version.json +1 -1
  101. package/dist/types/monitor.d.ts +660 -0
  102. package/dist/types/monitor.js +75 -0
  103. package/dist/utils/git.d.ts +9 -0
  104. package/dist/utils/tokens.d.ts +10 -0
  105. package/package.json +18 -5
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.installAgentsCommand = installAgentsCommand;
7
7
  exports.installStandardsCommand = installStandardsCommand;
8
8
  exports.installToolsCommand = installToolsCommand;
9
+ exports.installSkillsCommand = installSkillsCommand;
9
10
  exports.installCommand = installCommand;
10
11
  const inquirer_1 = __importDefault(require("inquirer"));
11
12
  const chalk_1 = __importDefault(require("chalk"));
@@ -33,6 +34,7 @@ async function discoverTemplates() {
33
34
  agents: [],
34
35
  standards: [],
35
36
  tools: [],
37
+ skills: [],
36
38
  };
37
39
  // Discover agents
38
40
  const agentDir = path_1.default.join(templateSource, 'agents');
@@ -47,16 +49,24 @@ async function discoverTemplates() {
47
49
  if (fs_extra_1.default.existsSync(standardsDir)) {
48
50
  const files = await fs_extra_1.default.readdir(standardsDir);
49
51
  result.standards = files
50
- .filter(f => f.endsWith('.standards.md'))
51
- .map(f => f.replace('.standards.md', ''));
52
+ .filter(f => f.endsWith('.md'))
53
+ .map(f => f.replace('.md', ''));
52
54
  }
53
55
  // Discover tools
54
56
  const toolsDir = path_1.default.join(templateSource, 'tools');
55
57
  if (fs_extra_1.default.existsSync(toolsDir)) {
56
58
  const files = await fs_extra_1.default.readdir(toolsDir);
57
59
  result.tools = files
58
- .filter(f => f.endsWith('.tool.md'))
59
- .map(f => f.replace('.tool.md', ''));
60
+ .filter(f => f.endsWith('.md'))
61
+ .map(f => f.replace('.md', ''));
62
+ }
63
+ // Discover skills
64
+ const skillsDir = path_1.default.join(templateSource, 'skills');
65
+ if (fs_extra_1.default.existsSync(skillsDir)) {
66
+ const files = await fs_extra_1.default.readdir(skillsDir);
67
+ result.skills = files
68
+ .filter(f => f.endsWith('.md'))
69
+ .map(f => f.replace('.md', ''));
60
70
  }
61
71
  return result;
62
72
  }
@@ -85,6 +95,13 @@ async function listTemplates() {
85
95
  else {
86
96
  console.log(' (none found)');
87
97
  }
98
+ console.log(chalk_1.default.cyan('\nSkills (Slash Commands):'));
99
+ if (templates.skills.length > 0) {
100
+ templates.skills.forEach(s => console.log(` - /${s}`));
101
+ }
102
+ else {
103
+ console.log(' (none found)');
104
+ }
88
105
  console.log('');
89
106
  }
90
107
  // Copy helper
@@ -137,8 +154,8 @@ async function installStandards(names, force) {
137
154
  const normalized = name.toLowerCase().trim();
138
155
  const matched = templates.standards.find(s => s.toLowerCase() === normalized);
139
156
  if (matched) {
140
- const src = path_1.default.join(templateSource, 'templates/standards', `${matched}.standards.md`);
141
- const dest = path_1.default.join('docs/ai/standards', `${matched}.standards.md`);
157
+ const src = path_1.default.join(templateSource, 'templates/standards', `${matched}.md`);
158
+ const dest = path_1.default.join('docs/ai/standards', `${matched}.md`);
142
159
  if (await copyFile(src, dest, force)) {
143
160
  installed++;
144
161
  }
@@ -158,8 +175,8 @@ async function installTools(names, force) {
158
175
  const normalized = name.toLowerCase().trim();
159
176
  const matched = templates.tools.find(t => t.toLowerCase() === normalized);
160
177
  if (matched) {
161
- const src = path_1.default.join(templateSource, 'tools', `${matched}.tool.md`);
162
- const dest = path_1.default.join('docs/ai/.contextuate/tools', `${matched}.tool.md`);
178
+ const src = path_1.default.join(templateSource, 'tools', `${matched}.md`);
179
+ const dest = path_1.default.join('docs/ai/.contextuate/tools', `${matched}.md`);
163
180
  if (await copyFile(src, dest, force)) {
164
181
  installed++;
165
182
  }
@@ -170,6 +187,44 @@ async function installTools(names, force) {
170
187
  }
171
188
  return installed;
172
189
  }
190
+ // Install skills (slash commands)
191
+ // Skills are installed to docs/ai/skills/ and symlinked to docs/ai/commands/ for Claude Code
192
+ async function installSkills(names, force) {
193
+ const templateSource = getTemplateSource();
194
+ const templates = await discoverTemplates();
195
+ let installed = 0;
196
+ for (const name of names) {
197
+ const normalized = name.toLowerCase().trim().replace(/^\//, ''); // Remove leading slash if present
198
+ const matched = templates.skills.find(s => s.toLowerCase() === normalized);
199
+ if (matched) {
200
+ const src = path_1.default.join(templateSource, 'skills', `${matched}.md`);
201
+ const skillDest = path_1.default.join('docs/ai/skills', `${matched}.md`);
202
+ const commandDest = path_1.default.join('docs/ai/commands', `${matched}.md`);
203
+ // Install skill file to skills/
204
+ if (await copyFile(src, skillDest, force)) {
205
+ installed++;
206
+ // Create symlink in commands/ for Claude Code to pick up
207
+ await fs_extra_1.default.ensureDir(path_1.default.dirname(commandDest));
208
+ const symlinkTarget = path_1.default.relative(path_1.default.dirname(commandDest), skillDest);
209
+ if (fs_extra_1.default.existsSync(commandDest)) {
210
+ if (force) {
211
+ await fs_extra_1.default.remove(commandDest);
212
+ }
213
+ else {
214
+ console.log(chalk_1.default.yellow(`[SKIP] Symlink already exists: ${commandDest}`));
215
+ continue;
216
+ }
217
+ }
218
+ await fs_extra_1.default.symlink(symlinkTarget, commandDest);
219
+ console.log(chalk_1.default.green(`[OK] Symlinked: ${commandDest} -> ${symlinkTarget}`));
220
+ }
221
+ }
222
+ else {
223
+ console.log(chalk_1.default.yellow(`[WARN] Skill "${name}" not found. Use --list to see available skills.`));
224
+ }
225
+ }
226
+ return installed;
227
+ }
173
228
  // Subcommand handlers
174
229
  async function installAgentsCommand(names, options) {
175
230
  const templates = await discoverTemplates();
@@ -182,8 +237,14 @@ async function installAgentsCommand(names, options) {
182
237
  return;
183
238
  }
184
239
  console.log(chalk_1.default.blue('\n[INFO] Installing agents...\n'));
185
- const count = await installAgents(agentsToInstall, options.force || false);
186
- console.log(chalk_1.default.green(`\n[OK] Installed ${count} agent(s)\n`));
240
+ const agentCount = await installAgents(agentsToInstall, options.force || false);
241
+ // By default, also install skills when installing agents (unless explicitly disabled)
242
+ let skillCount = 0;
243
+ if (options.includeSkills !== false && templates.skills.length > 0) {
244
+ console.log(chalk_1.default.blue('\n[INFO] Installing skills (slash commands)...\n'));
245
+ skillCount = await installSkills(templates.skills, options.force || false);
246
+ }
247
+ console.log(chalk_1.default.green(`\n[OK] Installed ${agentCount} agent(s) and ${skillCount} skill(s)\n`));
187
248
  }
188
249
  async function installStandardsCommand(names, options) {
189
250
  const templates = await discoverTemplates();
@@ -213,6 +274,20 @@ async function installToolsCommand(names, options) {
213
274
  const count = await installTools(toolsToInstall, options.force || false);
214
275
  console.log(chalk_1.default.green(`\n[OK] Installed ${count} tool(s)\n`));
215
276
  }
277
+ async function installSkillsCommand(names, options) {
278
+ const templates = await discoverTemplates();
279
+ const useAll = options.all || names.includes('all');
280
+ const skillsToInstall = useAll ? templates.skills : names;
281
+ if (skillsToInstall.length === 0) {
282
+ console.log(chalk_1.default.yellow('No skills specified. Use "all" or provide skill names.'));
283
+ console.log(chalk_1.default.gray('Available skills:'));
284
+ templates.skills.forEach(s => console.log(` - /${s}`));
285
+ return;
286
+ }
287
+ console.log(chalk_1.default.blue('\n[INFO] Installing skills (slash commands)...\n'));
288
+ const count = await installSkills(skillsToInstall, options.force || false);
289
+ console.log(chalk_1.default.green(`\n[OK] Installed ${count} skill(s)\n`));
290
+ }
216
291
  // Main install command (flag style or interactive)
217
292
  async function installCommand(options) {
218
293
  // Handle --list flag
@@ -223,7 +298,7 @@ async function installCommand(options) {
223
298
  const templates = await discoverTemplates();
224
299
  const force = options.force || false;
225
300
  // Check if any flags were provided
226
- const hasFlags = options.agents || options.standards || options.tools || options.all;
301
+ const hasFlags = options.agents || options.standards || options.tools || options.skills || options.all;
227
302
  if (!hasFlags) {
228
303
  // Interactive mode
229
304
  try {
@@ -234,6 +309,7 @@ async function installCommand(options) {
234
309
  message: 'What would you like to install?',
235
310
  choices: [
236
311
  { name: 'Agents (AI persona definitions)', value: 'agents' },
312
+ { name: 'Skills (Slash commands like /orchestrate)', value: 'skills' },
237
313
  { name: 'Language Standards (coding guidelines)', value: 'standards' },
238
314
  { name: 'Tools (AI tool guides)', value: 'tools' },
239
315
  ],
@@ -248,6 +324,7 @@ async function installCommand(options) {
248
324
  let selectedAgents = [];
249
325
  let selectedStandards = [];
250
326
  let selectedTools = [];
327
+ let selectedSkills = [];
251
328
  if (categories.includes('agents') && templates.agents.length > 0) {
252
329
  const { agents } = await inquirer_1.default.prompt([
253
330
  {
@@ -302,6 +379,24 @@ async function installCommand(options) {
302
379
  ]);
303
380
  selectedTools = tools.includes('__all__') ? templates.tools : tools;
304
381
  }
382
+ if (categories.includes('skills') && templates.skills.length > 0) {
383
+ const { skills } = await inquirer_1.default.prompt([
384
+ {
385
+ type: 'checkbox',
386
+ name: 'skills',
387
+ message: 'Select skills (slash commands) to install:',
388
+ choices: [
389
+ { name: 'Select All', value: '__all__' },
390
+ new inquirer_1.default.Separator(),
391
+ ...templates.skills.map(s => ({
392
+ name: `/${s}`,
393
+ value: s,
394
+ })),
395
+ ],
396
+ },
397
+ ]);
398
+ selectedSkills = skills.includes('__all__') ? templates.skills : skills;
399
+ }
305
400
  // Install selected items
306
401
  let totalInstalled = 0;
307
402
  if (selectedAgents.length > 0) {
@@ -316,6 +411,10 @@ async function installCommand(options) {
316
411
  console.log(chalk_1.default.blue('\n[INFO] Installing tools...'));
317
412
  totalInstalled += await installTools(selectedTools, force);
318
413
  }
414
+ if (selectedSkills.length > 0) {
415
+ console.log(chalk_1.default.blue('\n[INFO] Installing skills...'));
416
+ totalInstalled += await installSkills(selectedSkills, force);
417
+ }
319
418
  console.log(chalk_1.default.green(`\n[OK] Installation complete. ${totalInstalled} file(s) installed.\n`));
320
419
  }
321
420
  catch (error) {
@@ -335,6 +434,7 @@ async function installCommand(options) {
335
434
  totalInstalled += await installAgents(templates.agents, force);
336
435
  totalInstalled += await installStandards(templates.standards, force);
337
436
  totalInstalled += await installTools(templates.tools, force);
437
+ totalInstalled += await installSkills(templates.skills, force);
338
438
  }
339
439
  else {
340
440
  // Handle individual flags
@@ -353,6 +453,11 @@ async function installCommand(options) {
353
453
  console.log(chalk_1.default.blue('\n[INFO] Installing tools...'));
354
454
  totalInstalled += await installTools(toolsToInstall, force);
355
455
  }
456
+ if (options.skills && options.skills.length > 0) {
457
+ const skillsToInstall = options.skills.includes('all') ? templates.skills : options.skills;
458
+ console.log(chalk_1.default.blue('\n[INFO] Installing skills...'));
459
+ totalInstalled += await installSkills(skillsToInstall, force);
460
+ }
356
461
  }
357
462
  console.log(chalk_1.default.green(`\n[OK] Installation complete. ${totalInstalled} file(s) installed.\n`));
358
463
  }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Monitor Command
3
+ *
4
+ * CLI commands for the Contextuate Monitor feature.
5
+ * - contextuate monitor init: Interactive setup
6
+ * - contextuate monitor [start]: Start the monitor server
7
+ * - contextuate monitor status: Show server status
8
+ */
9
+ /**
10
+ * Initialize monitor command
11
+ */
12
+ export declare function monitorInitCommand(options?: {
13
+ global?: boolean;
14
+ project?: boolean;
15
+ }): Promise<void>;
16
+ /**
17
+ * Start monitor server command
18
+ */
19
+ export declare function monitorStartCommand(options: {
20
+ port?: number;
21
+ wsPort?: number;
22
+ noOpen?: boolean;
23
+ foreground?: boolean;
24
+ }): Promise<void>;
25
+ /**
26
+ * Stop monitor server command
27
+ */
28
+ export declare function monitorStopCommand(options: {
29
+ all?: boolean;
30
+ }): Promise<void>;
31
+ /**
32
+ * Show monitor status command
33
+ */
34
+ export declare function monitorStatusCommand(): Promise<void>;
35
+ /**
36
+ * Start daemon command
37
+ */
38
+ export declare function monitorDaemonStartCommand(options: {
39
+ detach?: boolean;
40
+ }): Promise<void>;
41
+ /**
42
+ * Stop daemon command
43
+ */
44
+ export declare function monitorDaemonStopCommand(): Promise<void>;
45
+ /**
46
+ * Show daemon status command
47
+ */
48
+ export declare function monitorDaemonStatusCommand(): Promise<void>;
49
+ /**
50
+ * View daemon logs command
51
+ */
52
+ export declare function monitorDaemonLogsCommand(options: {
53
+ follow?: boolean;
54
+ lines?: number;
55
+ }): Promise<void>;