@esotech/contextuate 2.1.1 → 2.1.2

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 (35) hide show
  1. package/dist/commands/doctor.d.ts +6 -0
  2. package/dist/commands/doctor.js +131 -0
  3. package/dist/commands/init.d.ts +0 -2
  4. package/dist/commands/init.js +164 -228
  5. package/dist/index.js +7 -0
  6. package/dist/templates/agents/aegis.md +1 -1
  7. package/dist/templates/agents/archon.md +116 -8
  8. package/dist/templates/agents/atlas.md +17 -17
  9. package/dist/templates/agents/canvas.md +1 -1
  10. package/dist/templates/agents/chronicle.md +1 -1
  11. package/dist/templates/agents/chronos.md +1 -1
  12. package/dist/templates/agents/cipher.md +1 -1
  13. package/dist/templates/agents/crucible.md +1 -1
  14. package/dist/templates/agents/echo.md +1 -1
  15. package/dist/templates/agents/forge.md +1 -1
  16. package/dist/templates/agents/ledger.md +34 -3
  17. package/dist/templates/agents/meridian.md +1 -1
  18. package/dist/templates/agents/nexus.md +1 -1
  19. package/dist/templates/agents/pythia.md +1 -1
  20. package/dist/templates/agents/scribe.md +1 -1
  21. package/dist/templates/agents/sentinel.md +1 -1
  22. package/dist/templates/agents/thoth.md +1 -1
  23. package/dist/templates/agents/unity.md +1 -1
  24. package/dist/templates/agents/vox.md +1 -1
  25. package/dist/templates/agents/weaver.md +1 -1
  26. package/dist/templates/commands/consult.md +1 -1
  27. package/dist/templates/commands/orchestrate.md +5 -129
  28. package/dist/templates/framework-agents/documentation-expert.md +3 -3
  29. package/dist/templates/framework-agents/tools-expert.md +3 -3
  30. package/dist/templates/templates/contextuate.md +1 -1
  31. package/dist/templates/tools/agent-creator.md +4 -4
  32. package/dist/templates/tools/standards-detector.md +1 -1
  33. package/dist/utils/tools.d.ts +60 -0
  34. package/dist/utils/tools.js +260 -0
  35. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ interface DoctorOptions {
2
+ fix?: boolean;
3
+ install?: boolean;
4
+ }
5
+ export declare function doctorCommand(options?: DoctorOptions): Promise<void>;
6
+ export {};
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.doctorCommand = doctorCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const tools_1 = require("../utils/tools");
11
+ async function doctorCommand(options = {}) {
12
+ console.log(chalk_1.default.blue('╔════════════════════════════════════════╗'));
13
+ console.log(chalk_1.default.blue('║ Contextuate Doctor ║'));
14
+ console.log(chalk_1.default.blue('╚════════════════════════════════════════╝'));
15
+ console.log('');
16
+ const installDir = 'docs/ai/.contextuate';
17
+ // Check if Contextuate is installed
18
+ if (!fs_extra_1.default.existsSync(installDir)) {
19
+ console.log(chalk_1.default.red('[ERROR] Contextuate is not installed in this project.'));
20
+ console.log(chalk_1.default.gray(' Run: contextuate init'));
21
+ return;
22
+ }
23
+ // Read existing config
24
+ let config = await (0, tools_1.readContextuateConfig)(installDir);
25
+ const configExists = config !== null;
26
+ if (!configExists) {
27
+ console.log(chalk_1.default.yellow('[WARN] contextuate.json not found. Will create one.'));
28
+ }
29
+ // Detect tools
30
+ console.log(chalk_1.default.blue('[INFO] Checking tool availability...'));
31
+ let tools = (0, tools_1.detectTools)();
32
+ (0, tools_1.printToolStatus)(tools);
33
+ // Offer to install missing tools if --install flag or interactive
34
+ if (options.install || options.fix) {
35
+ tools = await (0, tools_1.promptInstallTools)(tools, false);
36
+ }
37
+ else if (!tools.ripgrep.installed) {
38
+ console.log('');
39
+ console.log(chalk_1.default.gray(' Tip: Run "contextuate doctor --install" to install missing tools'));
40
+ }
41
+ // Update or create config
42
+ console.log('');
43
+ console.log(chalk_1.default.blue('[INFO] Updating contextuate.json...'));
44
+ const now = new Date().toISOString();
45
+ if (config) {
46
+ // Update existing config
47
+ config.tools = tools;
48
+ config.updated = now;
49
+ }
50
+ else {
51
+ // Create new config - try to read version.json for migration
52
+ const versionJsonPath = path_1.default.join(installDir, 'version.json');
53
+ let pkgInfo = {
54
+ name: '@esotech/contextuate',
55
+ version: '0.0.0',
56
+ description: 'AI Context Framework',
57
+ repository: 'https://github.com/esotech/contextuate'
58
+ };
59
+ if (fs_extra_1.default.existsSync(versionJsonPath)) {
60
+ try {
61
+ const versionData = JSON.parse(await fs_extra_1.default.readFile(versionJsonPath, 'utf-8'));
62
+ pkgInfo = {
63
+ name: versionData.name || pkgInfo.name,
64
+ version: versionData.version || pkgInfo.version,
65
+ description: versionData.description || pkgInfo.description,
66
+ repository: versionData.repository || pkgInfo.repository
67
+ };
68
+ }
69
+ catch {
70
+ // Use defaults
71
+ }
72
+ }
73
+ config = {
74
+ ...pkgInfo,
75
+ initialized: now,
76
+ updated: now,
77
+ tools
78
+ };
79
+ }
80
+ await (0, tools_1.writeContextuateConfig)(installDir, config);
81
+ console.log(chalk_1.default.green('[OK] contextuate.json updated'));
82
+ // Remove old version.json if it exists (migration)
83
+ const versionJsonPath = path_1.default.join(installDir, 'version.json');
84
+ if (fs_extra_1.default.existsSync(versionJsonPath)) {
85
+ await fs_extra_1.default.remove(versionJsonPath);
86
+ console.log(chalk_1.default.yellow('[CLEANUP] Removed legacy version.json (migrated to contextuate.json)'));
87
+ }
88
+ // Process template variables if --fix flag
89
+ if (options.fix) {
90
+ console.log('');
91
+ console.log(chalk_1.default.blue('[INFO] Processing template variables...'));
92
+ const agentsDir = 'docs/ai/agents';
93
+ const frameworkAgentsDir = path_1.default.join(installDir, 'agents');
94
+ let totalProcessed = 0;
95
+ if (fs_extra_1.default.existsSync(agentsDir)) {
96
+ const count = await (0, tools_1.processTemplateDirectory)(agentsDir, tools);
97
+ totalProcessed += count;
98
+ }
99
+ if (fs_extra_1.default.existsSync(frameworkAgentsDir)) {
100
+ const count = await (0, tools_1.processTemplateDirectory)(frameworkAgentsDir, tools);
101
+ totalProcessed += count;
102
+ }
103
+ if (totalProcessed > 0) {
104
+ console.log(chalk_1.default.green(`[OK] Updated template variables in ${totalProcessed} file(s)`));
105
+ }
106
+ else {
107
+ console.log(chalk_1.default.gray('[--] No template variables to update'));
108
+ }
109
+ }
110
+ // Summary
111
+ console.log('');
112
+ console.log(chalk_1.default.green('╔════════════════════════════════════════╗'));
113
+ console.log(chalk_1.default.green('║ Doctor Check Complete ║'));
114
+ console.log(chalk_1.default.green('╚════════════════════════════════════════╝'));
115
+ console.log('');
116
+ // Report issues
117
+ const issues = [];
118
+ if (!tools.ripgrep.installed) {
119
+ issues.push('ripgrep not installed (code search will use slower grep)');
120
+ }
121
+ if (issues.length > 0) {
122
+ console.log(chalk_1.default.yellow('Issues found:'));
123
+ issues.forEach(issue => console.log(chalk_1.default.yellow(` - ${issue}`)));
124
+ console.log('');
125
+ console.log(chalk_1.default.gray('Run "contextuate doctor --fix" to attempt automatic fixes'));
126
+ }
127
+ else {
128
+ console.log(chalk_1.default.green('All checks passed!'));
129
+ }
130
+ console.log('');
131
+ }
@@ -1,7 +1,5 @@
1
1
  export declare function initCommand(platformArgs: string[] | {
2
2
  force?: boolean;
3
- agents?: string[];
4
3
  }, options?: {
5
4
  force?: boolean;
6
- agents?: string[];
7
5
  }): Promise<void>;