@generacy-ai/generacy 0.0.0-preview-20260304013206

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 (244) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +207 -0
  3. package/bin/generacy.js +11 -0
  4. package/dist/agency/index.d.ts +68 -0
  5. package/dist/agency/index.d.ts.map +1 -0
  6. package/dist/agency/index.js +28 -0
  7. package/dist/agency/index.js.map +1 -0
  8. package/dist/agency/network.d.ts +41 -0
  9. package/dist/agency/network.d.ts.map +1 -0
  10. package/dist/agency/network.js +133 -0
  11. package/dist/agency/network.js.map +1 -0
  12. package/dist/agency/subprocess.d.ts +58 -0
  13. package/dist/agency/subprocess.d.ts.map +1 -0
  14. package/dist/agency/subprocess.js +216 -0
  15. package/dist/agency/subprocess.js.map +1 -0
  16. package/dist/cli/commands/agent.d.ts +10 -0
  17. package/dist/cli/commands/agent.d.ts.map +1 -0
  18. package/dist/cli/commands/agent.js +216 -0
  19. package/dist/cli/commands/agent.js.map +1 -0
  20. package/dist/cli/commands/doctor/checks/agency-mcp.d.ts +3 -0
  21. package/dist/cli/commands/doctor/checks/agency-mcp.d.ts.map +1 -0
  22. package/dist/cli/commands/doctor/checks/agency-mcp.js +51 -0
  23. package/dist/cli/commands/doctor/checks/agency-mcp.js.map +1 -0
  24. package/dist/cli/commands/doctor/checks/anthropic-key.d.ts +3 -0
  25. package/dist/cli/commands/doctor/checks/anthropic-key.d.ts.map +1 -0
  26. package/dist/cli/commands/doctor/checks/anthropic-key.js +68 -0
  27. package/dist/cli/commands/doctor/checks/anthropic-key.js.map +1 -0
  28. package/dist/cli/commands/doctor/checks/config.d.ts +3 -0
  29. package/dist/cli/commands/doctor/checks/config.d.ts.map +1 -0
  30. package/dist/cli/commands/doctor/checks/config.js +81 -0
  31. package/dist/cli/commands/doctor/checks/config.js.map +1 -0
  32. package/dist/cli/commands/doctor/checks/devcontainer.d.ts +3 -0
  33. package/dist/cli/commands/doctor/checks/devcontainer.d.ts.map +1 -0
  34. package/dist/cli/commands/doctor/checks/devcontainer.js +58 -0
  35. package/dist/cli/commands/doctor/checks/devcontainer.js.map +1 -0
  36. package/dist/cli/commands/doctor/checks/docker.d.ts +3 -0
  37. package/dist/cli/commands/doctor/checks/docker.d.ts.map +1 -0
  38. package/dist/cli/commands/doctor/checks/docker.js +71 -0
  39. package/dist/cli/commands/doctor/checks/docker.js.map +1 -0
  40. package/dist/cli/commands/doctor/checks/env-file.d.ts +3 -0
  41. package/dist/cli/commands/doctor/checks/env-file.d.ts.map +1 -0
  42. package/dist/cli/commands/doctor/checks/env-file.js +56 -0
  43. package/dist/cli/commands/doctor/checks/env-file.js.map +1 -0
  44. package/dist/cli/commands/doctor/checks/github-token.d.ts +3 -0
  45. package/dist/cli/commands/doctor/checks/github-token.d.ts.map +1 -0
  46. package/dist/cli/commands/doctor/checks/github-token.js +99 -0
  47. package/dist/cli/commands/doctor/checks/github-token.js.map +1 -0
  48. package/dist/cli/commands/doctor/checks/npm-packages.d.ts +3 -0
  49. package/dist/cli/commands/doctor/checks/npm-packages.d.ts.map +1 -0
  50. package/dist/cli/commands/doctor/checks/npm-packages.js +117 -0
  51. package/dist/cli/commands/doctor/checks/npm-packages.js.map +1 -0
  52. package/dist/cli/commands/doctor/formatter.d.ts +27 -0
  53. package/dist/cli/commands/doctor/formatter.d.ts.map +1 -0
  54. package/dist/cli/commands/doctor/formatter.js +162 -0
  55. package/dist/cli/commands/doctor/formatter.js.map +1 -0
  56. package/dist/cli/commands/doctor/index.d.ts +5 -0
  57. package/dist/cli/commands/doctor/index.d.ts.map +1 -0
  58. package/dist/cli/commands/doctor/index.js +8 -0
  59. package/dist/cli/commands/doctor/index.js.map +1 -0
  60. package/dist/cli/commands/doctor/registry.d.ts +48 -0
  61. package/dist/cli/commands/doctor/registry.d.ts.map +1 -0
  62. package/dist/cli/commands/doctor/registry.js +166 -0
  63. package/dist/cli/commands/doctor/registry.js.map +1 -0
  64. package/dist/cli/commands/doctor/runner.d.ts +14 -0
  65. package/dist/cli/commands/doctor/runner.d.ts.map +1 -0
  66. package/dist/cli/commands/doctor/runner.js +257 -0
  67. package/dist/cli/commands/doctor/runner.js.map +1 -0
  68. package/dist/cli/commands/doctor/types.d.ts +87 -0
  69. package/dist/cli/commands/doctor/types.d.ts.map +1 -0
  70. package/dist/cli/commands/doctor/types.js +2 -0
  71. package/dist/cli/commands/doctor/types.js.map +1 -0
  72. package/dist/cli/commands/doctor.d.ts +12 -0
  73. package/dist/cli/commands/doctor.d.ts.map +1 -0
  74. package/dist/cli/commands/doctor.js +97 -0
  75. package/dist/cli/commands/doctor.js.map +1 -0
  76. package/dist/cli/commands/init/conflicts.d.ts +36 -0
  77. package/dist/cli/commands/init/conflicts.d.ts.map +1 -0
  78. package/dist/cli/commands/init/conflicts.js +165 -0
  79. package/dist/cli/commands/init/conflicts.js.map +1 -0
  80. package/dist/cli/commands/init/github.d.ts +32 -0
  81. package/dist/cli/commands/init/github.d.ts.map +1 -0
  82. package/dist/cli/commands/init/github.js +161 -0
  83. package/dist/cli/commands/init/github.js.map +1 -0
  84. package/dist/cli/commands/init/index.d.ts +21 -0
  85. package/dist/cli/commands/init/index.d.ts.map +1 -0
  86. package/dist/cli/commands/init/index.js +175 -0
  87. package/dist/cli/commands/init/index.js.map +1 -0
  88. package/dist/cli/commands/init/prompts.d.ts +15 -0
  89. package/dist/cli/commands/init/prompts.d.ts.map +1 -0
  90. package/dist/cli/commands/init/prompts.js +281 -0
  91. package/dist/cli/commands/init/prompts.js.map +1 -0
  92. package/dist/cli/commands/init/repo-utils.d.ts +32 -0
  93. package/dist/cli/commands/init/repo-utils.d.ts.map +1 -0
  94. package/dist/cli/commands/init/repo-utils.js +112 -0
  95. package/dist/cli/commands/init/repo-utils.js.map +1 -0
  96. package/dist/cli/commands/init/resolver.d.ts +20 -0
  97. package/dist/cli/commands/init/resolver.d.ts.map +1 -0
  98. package/dist/cli/commands/init/resolver.js +273 -0
  99. package/dist/cli/commands/init/resolver.js.map +1 -0
  100. package/dist/cli/commands/init/summary.d.ts +21 -0
  101. package/dist/cli/commands/init/summary.d.ts.map +1 -0
  102. package/dist/cli/commands/init/summary.js +100 -0
  103. package/dist/cli/commands/init/summary.js.map +1 -0
  104. package/dist/cli/commands/init/types.d.ts +53 -0
  105. package/dist/cli/commands/init/types.d.ts.map +1 -0
  106. package/dist/cli/commands/init/types.js +2 -0
  107. package/dist/cli/commands/init/types.js.map +1 -0
  108. package/dist/cli/commands/init/writer.d.ts +22 -0
  109. package/dist/cli/commands/init/writer.d.ts.map +1 -0
  110. package/dist/cli/commands/init/writer.js +96 -0
  111. package/dist/cli/commands/init/writer.js.map +1 -0
  112. package/dist/cli/commands/orchestrator.d.ts +11 -0
  113. package/dist/cli/commands/orchestrator.d.ts.map +1 -0
  114. package/dist/cli/commands/orchestrator.js +291 -0
  115. package/dist/cli/commands/orchestrator.js.map +1 -0
  116. package/dist/cli/commands/run.d.ts +10 -0
  117. package/dist/cli/commands/run.d.ts.map +1 -0
  118. package/dist/cli/commands/run.js +167 -0
  119. package/dist/cli/commands/run.js.map +1 -0
  120. package/dist/cli/commands/setup/auth.d.ts +11 -0
  121. package/dist/cli/commands/setup/auth.d.ts.map +1 -0
  122. package/dist/cli/commands/setup/auth.js +108 -0
  123. package/dist/cli/commands/setup/auth.js.map +1 -0
  124. package/dist/cli/commands/setup/build.d.ts +11 -0
  125. package/dist/cli/commands/setup/build.d.ts.map +1 -0
  126. package/dist/cli/commands/setup/build.js +212 -0
  127. package/dist/cli/commands/setup/build.js.map +1 -0
  128. package/dist/cli/commands/setup/services.d.ts +11 -0
  129. package/dist/cli/commands/setup/services.d.ts.map +1 -0
  130. package/dist/cli/commands/setup/services.js +294 -0
  131. package/dist/cli/commands/setup/services.js.map +1 -0
  132. package/dist/cli/commands/setup/workspace.d.ts +11 -0
  133. package/dist/cli/commands/setup/workspace.d.ts.map +1 -0
  134. package/dist/cli/commands/setup/workspace.js +215 -0
  135. package/dist/cli/commands/setup/workspace.js.map +1 -0
  136. package/dist/cli/commands/setup.d.ts +7 -0
  137. package/dist/cli/commands/setup.d.ts.map +1 -0
  138. package/dist/cli/commands/setup.js +19 -0
  139. package/dist/cli/commands/setup.js.map +1 -0
  140. package/dist/cli/commands/validate.d.ts +10 -0
  141. package/dist/cli/commands/validate.d.ts.map +1 -0
  142. package/dist/cli/commands/validate.js +164 -0
  143. package/dist/cli/commands/validate.js.map +1 -0
  144. package/dist/cli/commands/worker.d.ts +10 -0
  145. package/dist/cli/commands/worker.d.ts.map +1 -0
  146. package/dist/cli/commands/worker.js +224 -0
  147. package/dist/cli/commands/worker.js.map +1 -0
  148. package/dist/cli/index.d.ts +14 -0
  149. package/dist/cli/index.d.ts.map +1 -0
  150. package/dist/cli/index.js +68 -0
  151. package/dist/cli/index.js.map +1 -0
  152. package/dist/cli/utils/config.d.ts +49 -0
  153. package/dist/cli/utils/config.d.ts.map +1 -0
  154. package/dist/cli/utils/config.js +110 -0
  155. package/dist/cli/utils/config.js.map +1 -0
  156. package/dist/cli/utils/exec.d.ts +39 -0
  157. package/dist/cli/utils/exec.d.ts.map +1 -0
  158. package/dist/cli/utils/exec.js +68 -0
  159. package/dist/cli/utils/exec.js.map +1 -0
  160. package/dist/cli/utils/logger.d.ts +47 -0
  161. package/dist/cli/utils/logger.d.ts.map +1 -0
  162. package/dist/cli/utils/logger.js +97 -0
  163. package/dist/cli/utils/logger.js.map +1 -0
  164. package/dist/config/index.d.ts +10 -0
  165. package/dist/config/index.d.ts.map +1 -0
  166. package/dist/config/index.js +13 -0
  167. package/dist/config/index.js.map +1 -0
  168. package/dist/config/loader.d.ts +104 -0
  169. package/dist/config/loader.d.ts.map +1 -0
  170. package/dist/config/loader.js +266 -0
  171. package/dist/config/loader.js.map +1 -0
  172. package/dist/config/schema.d.ts +304 -0
  173. package/dist/config/schema.d.ts.map +1 -0
  174. package/dist/config/schema.js +160 -0
  175. package/dist/config/schema.js.map +1 -0
  176. package/dist/config/validator.d.ts +60 -0
  177. package/dist/config/validator.d.ts.map +1 -0
  178. package/dist/config/validator.js +112 -0
  179. package/dist/config/validator.js.map +1 -0
  180. package/dist/health/server.d.ts +47 -0
  181. package/dist/health/server.d.ts.map +1 -0
  182. package/dist/health/server.js +92 -0
  183. package/dist/health/server.js.map +1 -0
  184. package/dist/index.d.ts +21 -0
  185. package/dist/index.d.ts.map +1 -0
  186. package/dist/index.js +22 -0
  187. package/dist/index.js.map +1 -0
  188. package/dist/orchestrator/async-event-queue.d.ts +28 -0
  189. package/dist/orchestrator/async-event-queue.d.ts.map +1 -0
  190. package/dist/orchestrator/async-event-queue.js +57 -0
  191. package/dist/orchestrator/async-event-queue.js.map +1 -0
  192. package/dist/orchestrator/client.d.ts +110 -0
  193. package/dist/orchestrator/client.d.ts.map +1 -0
  194. package/dist/orchestrator/client.js +288 -0
  195. package/dist/orchestrator/client.js.map +1 -0
  196. package/dist/orchestrator/event-bus.d.ts +195 -0
  197. package/dist/orchestrator/event-bus.d.ts.map +1 -0
  198. package/dist/orchestrator/event-bus.js +557 -0
  199. package/dist/orchestrator/event-bus.js.map +1 -0
  200. package/dist/orchestrator/heartbeat.d.ts +71 -0
  201. package/dist/orchestrator/heartbeat.d.ts.map +1 -0
  202. package/dist/orchestrator/heartbeat.js +116 -0
  203. package/dist/orchestrator/heartbeat.js.map +1 -0
  204. package/dist/orchestrator/index.d.ts +25 -0
  205. package/dist/orchestrator/index.d.ts.map +1 -0
  206. package/dist/orchestrator/index.js +15 -0
  207. package/dist/orchestrator/index.js.map +1 -0
  208. package/dist/orchestrator/job-handler.d.ts +109 -0
  209. package/dist/orchestrator/job-handler.d.ts.map +1 -0
  210. package/dist/orchestrator/job-handler.js +612 -0
  211. package/dist/orchestrator/job-handler.js.map +1 -0
  212. package/dist/orchestrator/job-queue.d.ts +81 -0
  213. package/dist/orchestrator/job-queue.d.ts.map +1 -0
  214. package/dist/orchestrator/job-queue.js +206 -0
  215. package/dist/orchestrator/job-queue.js.map +1 -0
  216. package/dist/orchestrator/label-monitor-bridge.d.ts +25 -0
  217. package/dist/orchestrator/label-monitor-bridge.d.ts.map +1 -0
  218. package/dist/orchestrator/label-monitor-bridge.js +57 -0
  219. package/dist/orchestrator/label-monitor-bridge.js.map +1 -0
  220. package/dist/orchestrator/log-buffer.d.ts +74 -0
  221. package/dist/orchestrator/log-buffer.d.ts.map +1 -0
  222. package/dist/orchestrator/log-buffer.js +104 -0
  223. package/dist/orchestrator/log-buffer.js.map +1 -0
  224. package/dist/orchestrator/redis-job-queue.d.ts +44 -0
  225. package/dist/orchestrator/redis-job-queue.d.ts.map +1 -0
  226. package/dist/orchestrator/redis-job-queue.js +300 -0
  227. package/dist/orchestrator/redis-job-queue.js.map +1 -0
  228. package/dist/orchestrator/router.d.ts +125 -0
  229. package/dist/orchestrator/router.d.ts.map +1 -0
  230. package/dist/orchestrator/router.js +143 -0
  231. package/dist/orchestrator/router.js.map +1 -0
  232. package/dist/orchestrator/server.d.ts +62 -0
  233. package/dist/orchestrator/server.d.ts.map +1 -0
  234. package/dist/orchestrator/server.js +711 -0
  235. package/dist/orchestrator/server.js.map +1 -0
  236. package/dist/orchestrator/types.d.ts +184 -0
  237. package/dist/orchestrator/types.d.ts.map +1 -0
  238. package/dist/orchestrator/types.js +6 -0
  239. package/dist/orchestrator/types.js.map +1 -0
  240. package/dist/orchestrator/worker-registry.d.ts +110 -0
  241. package/dist/orchestrator/worker-registry.d.ts.map +1 -0
  242. package/dist/orchestrator/worker-registry.js +191 -0
  243. package/dist/orchestrator/worker-registry.js.map +1 -0
  244. package/package.json +80 -0
@@ -0,0 +1,117 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const PACKAGE_NAME = '@generacy-ai/generacy';
5
+ /**
6
+ * Read the expected version from our own package.json.
7
+ */
8
+ function getExpectedVersion() {
9
+ const thisDir = dirname(fileURLToPath(import.meta.url));
10
+ // checks/ → doctor/ → commands/ → cli/ → src/ → packages/generacy/
11
+ const pkgPath = join(thisDir, '..', '..', '..', '..', '..', 'package.json');
12
+ const raw = readFileSync(pkgPath, 'utf-8');
13
+ const pkg = JSON.parse(raw);
14
+ return pkg.version;
15
+ }
16
+ /**
17
+ * Compare two semver version strings (major.minor.patch).
18
+ * Returns true if `installed` >= `expected`.
19
+ */
20
+ function isVersionSatisfied(installed, expected) {
21
+ const parse = (v) => v
22
+ .replace(/^v/, '')
23
+ .split('.')
24
+ .map((n) => parseInt(n, 10) || 0);
25
+ const inst = parse(installed);
26
+ const exp = parse(expected);
27
+ for (let i = 0; i < Math.max(inst.length, exp.length); i++) {
28
+ const a = inst[i] ?? 0;
29
+ const b = exp[i] ?? 0;
30
+ if (a > b)
31
+ return true;
32
+ if (a < b)
33
+ return false;
34
+ }
35
+ return true; // equal
36
+ }
37
+ export const npmPackagesCheck = {
38
+ id: 'npm-packages',
39
+ label: 'NPM Packages',
40
+ category: 'packages',
41
+ dependencies: [],
42
+ priority: 'P2',
43
+ async run(context) {
44
+ const root = context.projectRoot ?? process.cwd();
45
+ const installedPkgPath = join(root, 'node_modules', PACKAGE_NAME, 'package.json');
46
+ // Check if node_modules exists at all
47
+ if (!existsSync(join(root, 'node_modules'))) {
48
+ return {
49
+ status: 'fail',
50
+ message: 'Packages not installed',
51
+ suggestion: 'Run `pnpm install`',
52
+ detail: `Expected node_modules at ${join(root, 'node_modules')}`,
53
+ };
54
+ }
55
+ // Check if our package is installed
56
+ if (!existsSync(installedPkgPath)) {
57
+ return {
58
+ status: 'fail',
59
+ message: `${PACKAGE_NAME} is not installed`,
60
+ suggestion: 'Run `pnpm install`',
61
+ detail: `Expected at ${installedPkgPath}`,
62
+ };
63
+ }
64
+ // Read installed version
65
+ let installedVersion;
66
+ try {
67
+ const raw = readFileSync(installedPkgPath, 'utf-8');
68
+ const pkg = JSON.parse(raw);
69
+ if (!pkg.version) {
70
+ return {
71
+ status: 'warn',
72
+ message: `${PACKAGE_NAME} has no version field`,
73
+ suggestion: 'Run `pnpm install` to reinstall packages',
74
+ detail: `File: ${installedPkgPath}`,
75
+ };
76
+ }
77
+ installedVersion = pkg.version;
78
+ }
79
+ catch (error) {
80
+ const message = error instanceof Error ? error.message : 'Unknown read error';
81
+ return {
82
+ status: 'fail',
83
+ message: `Failed to read ${PACKAGE_NAME} package info`,
84
+ suggestion: 'Run `pnpm install` to reinstall packages',
85
+ detail: message,
86
+ };
87
+ }
88
+ // Get expected version from our own package.json
89
+ let expectedVersion;
90
+ try {
91
+ expectedVersion = getExpectedVersion();
92
+ }
93
+ catch {
94
+ // If we can't read our own version, just report the installed one as pass
95
+ return {
96
+ status: 'pass',
97
+ message: `${PACKAGE_NAME} v${installedVersion} installed`,
98
+ detail: `Could not determine expected version for comparison`,
99
+ };
100
+ }
101
+ // Compare versions
102
+ if (!isVersionSatisfied(installedVersion, expectedVersion)) {
103
+ return {
104
+ status: 'warn',
105
+ message: `Version mismatch: installed v${installedVersion}, expected ≥ ${expectedVersion}`,
106
+ suggestion: `Update ${PACKAGE_NAME} to v${expectedVersion} or newer`,
107
+ detail: `Installed: ${installedVersion}, Expected: ≥ ${expectedVersion}`,
108
+ };
109
+ }
110
+ return {
111
+ status: 'pass',
112
+ message: `${PACKAGE_NAME} v${installedVersion} (expected ≥ ${expectedVersion})`,
113
+ detail: `File: ${installedPkgPath}`,
114
+ };
115
+ },
116
+ };
117
+ //# sourceMappingURL=npm-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-packages.js","sourceRoot":"","sources":["../../../../../src/cli/commands/doctor/checks/npm-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C;;GA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;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { CheckDefinition, DoctorReport } from './types.js';
2
+ /**
3
+ * Format a doctor report as color-coded text output grouped by category.
4
+ *
5
+ * Example output:
6
+ * ```
7
+ * Generacy Doctor
8
+ * ===============
9
+ *
10
+ * System
11
+ * ✓ Docker Docker daemon is running (v27.0.3)
12
+ * ✓ Dev Container .devcontainer/devcontainer.json present
13
+ *
14
+ * Configuration
15
+ * ✓ Config File .generacy/config.yaml is valid
16
+ * ✗ Env File .generacy/generacy.env not found
17
+ * → Run `generacy init` to generate the env file
18
+ *
19
+ * Result: 2 passed, 1 failed, 0 warnings, 0 skipped
20
+ * ```
21
+ */
22
+ export declare function formatText(report: DoctorReport, checks: CheckDefinition[], verbose: boolean): string;
23
+ /**
24
+ * Format a doctor report as pretty-printed JSON.
25
+ */
26
+ export declare function formatJson(report: DoctorReport): string;
27
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EAEb,MAAM,YAAY,CAAC;AA4EpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,eAAe,EAAE,EACzB,OAAO,EAAE,OAAO,GACf,MAAM,CA6DR;AAMD;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEvD"}
@@ -0,0 +1,162 @@
1
+ // ---------------------------------------------------------------------------
2
+ // ANSI escape helpers
3
+ // ---------------------------------------------------------------------------
4
+ const ANSI = {
5
+ reset: '\x1b[0m',
6
+ bold: '\x1b[1m',
7
+ dim: '\x1b[2m',
8
+ green: '\x1b[32m',
9
+ red: '\x1b[31m',
10
+ yellow: '\x1b[33m',
11
+ };
12
+ /** Whether color output is disabled via `NO_COLOR` env var. */
13
+ function isColorDisabled() {
14
+ return 'NO_COLOR' in process.env;
15
+ }
16
+ function color(code, text) {
17
+ if (isColorDisabled())
18
+ return text;
19
+ return `${code}${text}${ANSI.reset}`;
20
+ }
21
+ // ---------------------------------------------------------------------------
22
+ // Status symbols and styling
23
+ // ---------------------------------------------------------------------------
24
+ const CATEGORY_LABELS = {
25
+ system: 'System',
26
+ config: 'Configuration',
27
+ credentials: 'Credentials',
28
+ packages: 'Packages',
29
+ services: 'Services',
30
+ };
31
+ /** Ordered list of categories for consistent output. */
32
+ const CATEGORY_ORDER = [
33
+ 'system',
34
+ 'config',
35
+ 'credentials',
36
+ 'packages',
37
+ 'services',
38
+ ];
39
+ function statusSymbol(status) {
40
+ switch (status) {
41
+ case 'pass':
42
+ return color(ANSI.green, '✓');
43
+ case 'fail':
44
+ return color(ANSI.red, '✗');
45
+ case 'warn':
46
+ return color(ANSI.yellow, '!');
47
+ case 'skip':
48
+ return color(ANSI.dim, '-');
49
+ }
50
+ }
51
+ function statusColor(status, text) {
52
+ switch (status) {
53
+ case 'pass':
54
+ return color(ANSI.green, text);
55
+ case 'fail':
56
+ return color(ANSI.red, text);
57
+ case 'warn':
58
+ return color(ANSI.yellow, text);
59
+ case 'skip':
60
+ return color(ANSI.dim, text);
61
+ }
62
+ }
63
+ // ---------------------------------------------------------------------------
64
+ // Text formatter
65
+ // ---------------------------------------------------------------------------
66
+ /**
67
+ * Format a doctor report as color-coded text output grouped by category.
68
+ *
69
+ * Example output:
70
+ * ```
71
+ * Generacy Doctor
72
+ * ===============
73
+ *
74
+ * System
75
+ * ✓ Docker Docker daemon is running (v27.0.3)
76
+ * ✓ Dev Container .devcontainer/devcontainer.json present
77
+ *
78
+ * Configuration
79
+ * ✓ Config File .generacy/config.yaml is valid
80
+ * ✗ Env File .generacy/generacy.env not found
81
+ * → Run `generacy init` to generate the env file
82
+ *
83
+ * Result: 2 passed, 1 failed, 0 warnings, 0 skipped
84
+ * ```
85
+ */
86
+ export function formatText(report, checks, verbose) {
87
+ const lines = [];
88
+ // Header
89
+ lines.push(color(ANSI.bold, 'Generacy Doctor'));
90
+ lines.push('===============');
91
+ lines.push('');
92
+ // Build a lookup from check ID → definition for label padding
93
+ const checkDefs = new Map(checks.map((c) => [c.id, c]));
94
+ // Group entries by category (preserving order within each category)
95
+ const grouped = groupByCategory(report.checks);
96
+ for (const category of CATEGORY_ORDER) {
97
+ const entries = grouped.get(category);
98
+ if (!entries || entries.length === 0)
99
+ continue;
100
+ lines.push(color(ANSI.bold, CATEGORY_LABELS[category]));
101
+ // Compute label padding for alignment within this category
102
+ const maxLabelLen = Math.max(...entries.map((e) => {
103
+ const def = checkDefs.get(e.id);
104
+ return (def?.label ?? e.label).length;
105
+ }));
106
+ for (const entry of entries) {
107
+ const def = checkDefs.get(entry.id);
108
+ const label = def?.label ?? entry.label;
109
+ const paddedLabel = label.padEnd(maxLabelLen);
110
+ const symbol = statusSymbol(entry.status);
111
+ lines.push(` ${symbol} ${paddedLabel} ${entry.message}`);
112
+ // Suggestion line (fail/warn)
113
+ if (entry.suggestion && (entry.status === 'fail' || entry.status === 'warn')) {
114
+ lines.push(statusColor(entry.status, ` → ${entry.suggestion}`));
115
+ }
116
+ // Detail line (verbose only)
117
+ if (verbose && entry.detail) {
118
+ lines.push(color(ANSI.dim, ` ${entry.detail}`));
119
+ }
120
+ }
121
+ lines.push('');
122
+ }
123
+ // Summary line
124
+ const { passed, failed, warnings, skipped } = report.summary;
125
+ const parts = [
126
+ color(ANSI.green, `${passed} passed`),
127
+ color(ANSI.red, `${failed} failed`),
128
+ color(ANSI.yellow, `${warnings} warnings`),
129
+ color(ANSI.dim, `${skipped} skipped`),
130
+ ];
131
+ lines.push(`Result: ${parts.join(', ')}`);
132
+ return lines.join('\n');
133
+ }
134
+ // ---------------------------------------------------------------------------
135
+ // JSON formatter
136
+ // ---------------------------------------------------------------------------
137
+ /**
138
+ * Format a doctor report as pretty-printed JSON.
139
+ */
140
+ export function formatJson(report) {
141
+ return JSON.stringify(report, null, 2);
142
+ }
143
+ // ---------------------------------------------------------------------------
144
+ // Helpers
145
+ // ---------------------------------------------------------------------------
146
+ /**
147
+ * Group check entries by their category, preserving insertion order within
148
+ * each group.
149
+ */
150
+ function groupByCategory(entries) {
151
+ const map = new Map();
152
+ for (const entry of entries) {
153
+ let group = map.get(entry.category);
154
+ if (!group) {
155
+ group = [];
156
+ map.set(entry.category, group);
157
+ }
158
+ group.push(entry);
159
+ }
160
+ return map;
161
+ }
162
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/formatter.ts"],"names":[],"mappings":"AAOA,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,UAAU;CACV,CAAC;AAEX,+DAA+D;AAC/D,SAAS,eAAe;IACtB,OAAO,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;AACnC,CAAC;AAED,SAAS,KAAK,CAAC,IAAY,EAAE,IAAY;IACvC,IAAI,eAAe,EAAE;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,MAAM,eAAe,GAAkC;IACrD,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,eAAe;IACvB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,wDAAwD;AACxD,MAAM,cAAc,GAAoB;IACtC,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,UAAU;I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E;AAE9E;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAoB;IAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,eAAe,CACtB,OAAiC;IAEjC,MAAM,GAAG,GAAG,IAAI,GAAG,EAA2C,CAAC;IAC/D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,CAAC;YACX,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { CheckCategory, CheckContext, CheckDefinition, CheckResult, DoctorOptions, DoctorReport, DoctorReportCheckEntry, DoctorReportSummary, FixResult, } from './types.js';
2
+ export { CheckRegistry } from './registry.js';
3
+ export { runChecks } from './runner.js';
4
+ export { formatJson, formatText } from './formatter.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ // Barrel re-exports for the doctor module.
2
+ // Registry
3
+ export { CheckRegistry } from './registry.js';
4
+ // Runner
5
+ export { runChecks } from './runner.js';
6
+ // Formatter
7
+ export { formatJson, formatText } from './formatter.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAe3C,WAAW;AACX,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,YAAY;AACZ,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { CheckDefinition } from './types.js';
2
+ export declare class CheckRegistry {
3
+ private checks;
4
+ /**
5
+ * Register a health check. Throws if a check with the same ID is already
6
+ * registered.
7
+ */
8
+ register(check: CheckDefinition): void;
9
+ /** Return all registered checks (insertion order). */
10
+ getChecks(): CheckDefinition[];
11
+ /** Return a registered check by ID, or `undefined` if not found. */
12
+ getCheck(id: string): CheckDefinition | undefined;
13
+ /**
14
+ * Resolve which checks to run and return them in dependency (topological)
15
+ * order.
16
+ *
17
+ * - When `check` is specified, only those checks (and their transitive
18
+ * dependencies) are included.
19
+ * - When `skip` is specified, those checks are excluded from the result.
20
+ * - Throws on unknown check names in either list.
21
+ * - Throws on circular dependencies.
22
+ */
23
+ resolve(options?: {
24
+ check?: string[];
25
+ skip?: string[];
26
+ }): CheckDefinition[];
27
+ /** Throw if any IDs in the list are not registered. */
28
+ private validateIds;
29
+ /**
30
+ * Starting from a set of check IDs, expand to include all transitive
31
+ * dependencies.
32
+ */
33
+ private expandDependencies;
34
+ /**
35
+ * Validate that every dependency referenced by candidates exists within the
36
+ * candidate set. This catches the case where a skipped check is a
37
+ * dependency of an included check.
38
+ */
39
+ private validateDependencies;
40
+ /**
41
+ * Kahn's algorithm for topological sort. Detects cycles and throws if one
42
+ * is found.
43
+ *
44
+ * Only considers checks within the `candidates` set.
45
+ */
46
+ private topologicalSort;
47
+ }
48
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAOtC,sDAAsD;IACtD,SAAS,IAAI,eAAe,EAAE;IAI9B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIjD;;;;;;;;;OASG;IACH,OAAO,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO,GAAG,eAAe,EAAE;IAmC/E,uDAAuD;IACvD,OAAO,CAAC,WAAW;IAWnB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAsB1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CA8DxB"}
@@ -0,0 +1,166 @@
1
+ // ---------------------------------------------------------------------------
2
+ // CheckRegistry — manages check registration and dependency resolution
3
+ // ---------------------------------------------------------------------------
4
+ export class CheckRegistry {
5
+ checks = new Map();
6
+ /**
7
+ * Register a health check. Throws if a check with the same ID is already
8
+ * registered.
9
+ */
10
+ register(check) {
11
+ if (this.checks.has(check.id)) {
12
+ throw new Error(`Duplicate check ID: '${check.id}'`);
13
+ }
14
+ this.checks.set(check.id, check);
15
+ }
16
+ /** Return all registered checks (insertion order). */
17
+ getChecks() {
18
+ return [...this.checks.values()];
19
+ }
20
+ /** Return a registered check by ID, or `undefined` if not found. */
21
+ getCheck(id) {
22
+ return this.checks.get(id);
23
+ }
24
+ /**
25
+ * Resolve which checks to run and return them in dependency (topological)
26
+ * order.
27
+ *
28
+ * - When `check` is specified, only those checks (and their transitive
29
+ * dependencies) are included.
30
+ * - When `skip` is specified, those checks are excluded from the result.
31
+ * - Throws on unknown check names in either list.
32
+ * - Throws on circular dependencies.
33
+ */
34
+ resolve(options = {}) {
35
+ const { check: includeIds, skip: skipIds } = options;
36
+ // Validate that all referenced IDs exist
37
+ this.validateIds(includeIds, '--check');
38
+ this.validateIds(skipIds, '--skip');
39
+ // Determine the candidate set of checks
40
+ let candidates;
41
+ if (includeIds && includeIds.length > 0) {
42
+ // Start with requested checks, then expand to include all transitive deps
43
+ candidates = this.expandDependencies(includeIds);
44
+ }
45
+ else {
46
+ candidates = new Set(this.checks.keys());
47
+ }
48
+ // Remove skipped checks
49
+ if (skipIds) {
50
+ for (const id of skipIds) {
51
+ candidates.delete(id);
52
+ }
53
+ }
54
+ // Validate that all dependencies within candidates are satisfied
55
+ this.validateDependencies(candidates);
56
+ // Topological sort the candidates
57
+ return this.topologicalSort(candidates);
58
+ }
59
+ // -------------------------------------------------------------------------
60
+ // Private helpers
61
+ // -------------------------------------------------------------------------
62
+ /** Throw if any IDs in the list are not registered. */
63
+ validateIds(ids, flag) {
64
+ if (!ids)
65
+ return;
66
+ const unknown = ids.filter((id) => !this.checks.has(id));
67
+ if (unknown.length > 0) {
68
+ throw new Error(`Unknown check${unknown.length > 1 ? 's' : ''} passed to ${flag}: ${unknown.map((id) => `'${id}'`).join(', ')}. ` +
69
+ `Available checks: ${[...this.checks.keys()].join(', ')}`);
70
+ }
71
+ }
72
+ /**
73
+ * Starting from a set of check IDs, expand to include all transitive
74
+ * dependencies.
75
+ */
76
+ expandDependencies(ids) {
77
+ const result = new Set();
78
+ const stack = [...ids];
79
+ while (stack.length > 0) {
80
+ const id = stack.pop();
81
+ if (result.has(id))
82
+ continue;
83
+ result.add(id);
84
+ const check = this.checks.get(id);
85
+ if (check) {
86
+ for (const dep of check.dependencies) {
87
+ if (!result.has(dep)) {
88
+ stack.push(dep);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ return result;
94
+ }
95
+ /**
96
+ * Validate that every dependency referenced by candidates exists within the
97
+ * candidate set. This catches the case where a skipped check is a
98
+ * dependency of an included check.
99
+ */
100
+ validateDependencies(candidates) {
101
+ for (const id of candidates) {
102
+ const check = this.checks.get(id);
103
+ for (const dep of check.dependencies) {
104
+ if (!this.checks.has(dep)) {
105
+ throw new Error(`Check '${id}' depends on '${dep}', which is not registered`);
106
+ }
107
+ }
108
+ }
109
+ }
110
+ /**
111
+ * Kahn's algorithm for topological sort. Detects cycles and throws if one
112
+ * is found.
113
+ *
114
+ * Only considers checks within the `candidates` set.
115
+ */
116
+ topologicalSort(candidates) {
117
+ // Build in-degree map and adjacency list (within candidates only)
118
+ const inDegree = new Map();
119
+ const dependents = new Map();
120
+ for (const id of candidates) {
121
+ inDegree.set(id, 0);
122
+ dependents.set(id, []);
123
+ }
124
+ for (const id of candidates) {
125
+ const check = this.checks.get(id);
126
+ for (const dep of check.dependencies) {
127
+ if (candidates.has(dep)) {
128
+ inDegree.set(id, (inDegree.get(id) ?? 0) + 1);
129
+ dependents.get(dep).push(id);
130
+ }
131
+ }
132
+ }
133
+ // Seed the queue with all nodes that have zero in-degree
134
+ const queue = [];
135
+ for (const [id, degree] of inDegree) {
136
+ if (degree === 0) {
137
+ queue.push(id);
138
+ }
139
+ }
140
+ // Sort the initial queue for deterministic output (alphabetical)
141
+ queue.sort();
142
+ const sorted = [];
143
+ while (queue.length > 0) {
144
+ const id = queue.shift();
145
+ sorted.push(this.checks.get(id));
146
+ // Collect newly freed dependents, then sort for determinism
147
+ const freed = [];
148
+ for (const dependent of dependents.get(id)) {
149
+ const newDegree = inDegree.get(dependent) - 1;
150
+ inDegree.set(dependent, newDegree);
151
+ if (newDegree === 0) {
152
+ freed.push(dependent);
153
+ }
154
+ }
155
+ freed.sort();
156
+ queue.push(...freed);
157
+ }
158
+ // If we didn't process every candidate, there's a cycle
159
+ if (sorted.length !== candidates.size) {
160
+ const remaining = [...candidates].filter((id) => !sorted.some((c) => c.id === id));
161
+ throw new Error(`Circular dependency detected among checks: ${remaining.join(', ')}`);
162
+ }
163
+ return sorted;
164
+ }
165
+ }
166
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/registry.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,uEAAuE;AACvE,8EAA8E;AAE9E,MAAM,OAAO,aAAa;IAChB,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,KAAsB;QAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,sDAAsD;IACtD,SAAS;QACP,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,oEAAoE;IACpE,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,UAAiD,EAAE;QACzD,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAErD,yCAAyC;QACzC,IAAI,CAAC,W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ions, DoctorReport } from './types.js';
2
+ /**
3
+ * Execute an ordered list of checks, running independent checks concurrently
4
+ * within each dependency tier.
5
+ *
6
+ * The `checks` array **must** be in topological (dependency) order — as
7
+ * returned by `CheckRegistry.resolve()`. The runner groups them into tiers
8
+ * where all items in a tier have their dependencies satisfied by earlier tiers,
9
+ * then runs each tier concurrently via `Promise.all`.
10
+ *
11
+ * @returns A `DoctorReport` containing per-check results and a summary.
12
+ */
13
+ export declare function runChecks(checks: CheckDefinition[], options: DoctorOptions): Promise<DoctorReport>;
14
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/doctor/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEf,aAAa,EACb,YAAY,EAGb,MAAM,YAAY,CAAC;AAyBpB;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,eAAe,EAAE,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAoDvB"}