@posthog/wizard 2.8.0 → 2.9.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 (222) hide show
  1. package/README.md +11 -0
  2. package/dist/bin.js +289 -167
  3. package/dist/bin.js.map +1 -1
  4. package/dist/src/__tests__/cli.test.js +92 -59
  5. package/dist/src/__tests__/cli.test.js.map +1 -1
  6. package/dist/src/__tests__/wizard-abort.test.js +34 -13
  7. package/dist/src/__tests__/wizard-abort.test.js.map +1 -1
  8. package/dist/src/frameworks/android/android-wizard-agent.js +2 -2
  9. package/dist/src/frameworks/android/android-wizard-agent.js.map +1 -1
  10. package/dist/src/frameworks/angular/angular-wizard-agent.js +2 -2
  11. package/dist/src/frameworks/angular/angular-wizard-agent.js.map +1 -1
  12. package/dist/src/frameworks/astro/astro-wizard-agent.js +2 -2
  13. package/dist/src/frameworks/astro/astro-wizard-agent.js.map +1 -1
  14. package/dist/src/frameworks/django/django-wizard-agent.js +2 -2
  15. package/dist/src/frameworks/django/django-wizard-agent.js.map +1 -1
  16. package/dist/src/frameworks/fastapi/fastapi-wizard-agent.js +2 -2
  17. package/dist/src/frameworks/fastapi/fastapi-wizard-agent.js.map +1 -1
  18. package/dist/src/frameworks/flask/flask-wizard-agent.js +2 -2
  19. package/dist/src/frameworks/flask/flask-wizard-agent.js.map +1 -1
  20. package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.js +2 -2
  21. package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.js.map +1 -1
  22. package/dist/src/frameworks/javascript-web/javascript-web-wizard-agent.js +2 -2
  23. package/dist/src/frameworks/javascript-web/javascript-web-wizard-agent.js.map +1 -1
  24. package/dist/src/frameworks/laravel/laravel-wizard-agent.js +2 -2
  25. package/dist/src/frameworks/laravel/laravel-wizard-agent.js.map +1 -1
  26. package/dist/src/frameworks/nextjs/nextjs-wizard-agent.js +2 -2
  27. package/dist/src/frameworks/nextjs/nextjs-wizard-agent.js.map +1 -1
  28. package/dist/src/frameworks/nuxt/nuxt-wizard-agent.js +2 -2
  29. package/dist/src/frameworks/nuxt/nuxt-wizard-agent.js.map +1 -1
  30. package/dist/src/frameworks/python/python-wizard-agent.js +2 -2
  31. package/dist/src/frameworks/python/python-wizard-agent.js.map +1 -1
  32. package/dist/src/frameworks/rails/rails-wizard-agent.js +2 -2
  33. package/dist/src/frameworks/rails/rails-wizard-agent.js.map +1 -1
  34. package/dist/src/frameworks/react-native/react-native-wizard-agent.js +2 -2
  35. package/dist/src/frameworks/react-native/react-native-wizard-agent.js.map +1 -1
  36. package/dist/src/frameworks/react-router/react-router-wizard-agent.js +2 -2
  37. package/dist/src/frameworks/react-router/react-router-wizard-agent.js.map +1 -1
  38. package/dist/src/frameworks/ruby/ruby-wizard-agent.js +2 -2
  39. package/dist/src/frameworks/ruby/ruby-wizard-agent.js.map +1 -1
  40. package/dist/src/frameworks/svelte/svelte-wizard-agent.js +2 -2
  41. package/dist/src/frameworks/svelte/svelte-wizard-agent.js.map +1 -1
  42. package/dist/src/frameworks/swift/swift-wizard-agent.js +2 -2
  43. package/dist/src/frameworks/swift/swift-wizard-agent.js.map +1 -1
  44. package/dist/src/frameworks/tanstack-router/tanstack-router-wizard-agent.js +2 -2
  45. package/dist/src/frameworks/tanstack-router/tanstack-router-wizard-agent.js.map +1 -1
  46. package/dist/src/frameworks/tanstack-start/tanstack-start-wizard-agent.js +2 -2
  47. package/dist/src/frameworks/tanstack-start/tanstack-start-wizard-agent.js.map +1 -1
  48. package/dist/src/frameworks/vue/vue-wizard-agent.js +2 -2
  49. package/dist/src/frameworks/vue/vue-wizard-agent.js.map +1 -1
  50. package/dist/src/lib/__tests__/agent-interface.test.js +29 -1
  51. package/dist/src/lib/__tests__/agent-interface.test.js.map +1 -1
  52. package/dist/src/lib/agent/__tests__/agent-prompt.test.js +57 -0
  53. package/dist/src/lib/agent/__tests__/agent-prompt.test.js.map +1 -0
  54. package/dist/src/lib/{agent-interface.d.ts → agent/agent-interface.d.ts} +18 -6
  55. package/dist/src/lib/{agent-interface.js → agent/agent-interface.js} +63 -13
  56. package/dist/src/lib/agent/agent-interface.js.map +1 -0
  57. package/dist/src/lib/agent/agent-prompt.d.ts +23 -0
  58. package/dist/src/lib/agent/agent-prompt.js +47 -0
  59. package/dist/src/lib/agent/agent-prompt.js.map +1 -0
  60. package/dist/src/lib/agent/agent-runner.d.ts +78 -0
  61. package/dist/src/lib/agent/agent-runner.js +323 -0
  62. package/dist/src/lib/agent/agent-runner.js.map +1 -0
  63. package/dist/src/lib/agent/commandments.js.map +1 -0
  64. package/dist/src/lib/constants.d.ts +10 -1
  65. package/dist/src/lib/constants.js +13 -1
  66. package/dist/src/lib/constants.js.map +1 -1
  67. package/dist/src/lib/detection/__tests__/context.test.js +72 -0
  68. package/dist/src/lib/detection/__tests__/context.test.js.map +1 -0
  69. package/dist/src/lib/detection/__tests__/features.test.d.ts +1 -0
  70. package/dist/src/lib/detection/__tests__/features.test.js +75 -0
  71. package/dist/src/lib/detection/__tests__/features.test.js.map +1 -0
  72. package/dist/src/lib/detection/__tests__/package-manager.test.d.ts +1 -0
  73. package/dist/src/lib/{__tests__/package-manager-detection.test.js → detection/__tests__/package-manager.test.js} +25 -25
  74. package/dist/src/lib/detection/__tests__/package-manager.test.js.map +1 -0
  75. package/dist/src/lib/detection/context.d.ts +31 -0
  76. package/dist/src/lib/detection/context.js +92 -0
  77. package/dist/src/lib/detection/context.js.map +1 -0
  78. package/dist/src/lib/detection/features.d.ts +16 -0
  79. package/dist/src/lib/detection/features.js +56 -0
  80. package/dist/src/lib/detection/features.js.map +1 -0
  81. package/dist/src/lib/detection/framework.d.ts +14 -0
  82. package/dist/src/lib/detection/framework.js +35 -0
  83. package/dist/src/lib/detection/framework.js.map +1 -0
  84. package/dist/src/lib/detection/index.d.ts +3 -0
  85. package/dist/src/lib/detection/index.js +11 -0
  86. package/dist/src/lib/detection/index.js.map +1 -0
  87. package/dist/src/lib/{package-manager-detection.js → detection/package-manager.js} +3 -3
  88. package/dist/src/lib/detection/package-manager.js.map +1 -0
  89. package/dist/src/lib/framework-config.d.ts +1 -1
  90. package/dist/src/lib/framework-config.js.map +1 -1
  91. package/dist/src/lib/health-checks/endpoints.js +2 -1
  92. package/dist/src/lib/health-checks/endpoints.js.map +1 -1
  93. package/dist/src/lib/middleware/benchmark.js +1 -1
  94. package/dist/src/lib/middleware/benchmark.js.map +1 -1
  95. package/dist/src/lib/middleware/benchmarks/compaction-tracker.js +1 -1
  96. package/dist/src/lib/middleware/benchmarks/compaction-tracker.js.map +1 -1
  97. package/dist/src/lib/middleware/benchmarks/json-writer.js +1 -1
  98. package/dist/src/lib/middleware/benchmarks/json-writer.js.map +1 -1
  99. package/dist/src/lib/middleware/benchmarks/summary.js +1 -1
  100. package/dist/src/lib/middleware/benchmarks/summary.js.map +1 -1
  101. package/dist/src/lib/middleware/config.js +1 -1
  102. package/dist/src/lib/middleware/config.js.map +1 -1
  103. package/dist/src/lib/version.d.ts +1 -1
  104. package/dist/src/lib/version.js +1 -1
  105. package/dist/src/lib/version.js.map +1 -1
  106. package/dist/src/lib/wizard-session.d.ts +16 -7
  107. package/dist/src/lib/wizard-session.js +2 -0
  108. package/dist/src/lib/wizard-session.js.map +1 -1
  109. package/dist/src/lib/wizard-tools.d.ts +28 -1
  110. package/dist/src/lib/wizard-tools.js +24 -0
  111. package/dist/src/lib/wizard-tools.js.map +1 -1
  112. package/dist/src/lib/workflows/__tests__/agent-skill.test.d.ts +1 -0
  113. package/dist/src/lib/workflows/__tests__/agent-skill.test.js +66 -0
  114. package/dist/src/lib/workflows/__tests__/agent-skill.test.js.map +1 -0
  115. package/dist/src/lib/workflows/__tests__/revenue-analytics-detect.test.d.ts +1 -0
  116. package/dist/src/lib/workflows/__tests__/revenue-analytics-detect.test.js +101 -0
  117. package/dist/src/lib/workflows/__tests__/revenue-analytics-detect.test.js.map +1 -0
  118. package/dist/src/lib/workflows/__tests__/workflow-registry.test.d.ts +1 -0
  119. package/dist/src/lib/workflows/__tests__/workflow-registry.test.js +32 -0
  120. package/dist/src/lib/workflows/__tests__/workflow-registry.test.js.map +1 -0
  121. package/dist/src/lib/workflows/__tests__/workflow-step.test.d.ts +1 -0
  122. package/dist/src/lib/workflows/__tests__/workflow-step.test.js +54 -0
  123. package/dist/src/lib/workflows/__tests__/workflow-step.test.js.map +1 -0
  124. package/dist/src/lib/workflows/agent-skill/index.d.ts +44 -0
  125. package/dist/src/lib/workflows/agent-skill/index.js +47 -0
  126. package/dist/src/lib/workflows/agent-skill/index.js.map +1 -0
  127. package/dist/src/lib/workflows/agent-skill/steps.d.ts +8 -0
  128. package/dist/src/lib/workflows/agent-skill/steps.js +32 -0
  129. package/dist/src/lib/workflows/agent-skill/steps.js.map +1 -0
  130. package/dist/src/lib/workflows/posthog-integration/detect.d.ts +12 -0
  131. package/dist/src/lib/workflows/posthog-integration/detect.js +57 -0
  132. package/dist/src/lib/workflows/posthog-integration/detect.js.map +1 -0
  133. package/dist/src/lib/workflows/posthog-integration/index.d.ts +3 -0
  134. package/dist/src/lib/workflows/posthog-integration/index.js +152 -0
  135. package/dist/src/lib/workflows/posthog-integration/index.js.map +1 -0
  136. package/dist/src/lib/workflows/posthog-integration/steps.d.ts +9 -0
  137. package/dist/src/lib/workflows/posthog-integration/steps.js +100 -0
  138. package/dist/src/lib/workflows/posthog-integration/steps.js.map +1 -0
  139. package/dist/src/lib/workflows/revenue-analytics/detect.d.ts +40 -0
  140. package/dist/src/lib/workflows/revenue-analytics/detect.js +156 -0
  141. package/dist/src/lib/workflows/revenue-analytics/detect.js.map +1 -0
  142. package/dist/src/lib/workflows/revenue-analytics/index.d.ts +4 -0
  143. package/dist/src/lib/workflows/revenue-analytics/index.js +30 -0
  144. package/dist/src/lib/workflows/revenue-analytics/index.js.map +1 -0
  145. package/dist/src/lib/workflows/revenue-analytics/steps.d.ts +8 -0
  146. package/dist/src/lib/workflows/revenue-analytics/steps.js +48 -0
  147. package/dist/src/lib/workflows/revenue-analytics/steps.js.map +1 -0
  148. package/dist/src/lib/workflows/workflow-registry.d.ts +18 -0
  149. package/dist/src/lib/workflows/workflow-registry.js +32 -0
  150. package/dist/src/lib/workflows/workflow-registry.js.map +1 -0
  151. package/dist/src/lib/workflows/workflow-step.d.ts +126 -0
  152. package/dist/src/lib/workflows/workflow-step.js +28 -0
  153. package/dist/src/lib/workflows/workflow-step.js.map +1 -0
  154. package/dist/src/steps/add-mcp-server-to-clients/index.d.ts +2 -1
  155. package/dist/src/steps/add-mcp-server-to-clients/index.js.map +1 -1
  156. package/dist/src/ui/logging-ui.d.ts +6 -3
  157. package/dist/src/ui/logging-ui.js +7 -0
  158. package/dist/src/ui/logging-ui.js.map +1 -1
  159. package/dist/src/ui/tui/__tests__/flows.test.d.ts +1 -0
  160. package/dist/src/ui/tui/__tests__/flows.test.js +115 -0
  161. package/dist/src/ui/tui/__tests__/flows.test.js.map +1 -0
  162. package/dist/src/ui/tui/__tests__/router.test.d.ts +1 -0
  163. package/dist/src/ui/tui/__tests__/router.test.js +87 -0
  164. package/dist/src/ui/tui/__tests__/router.test.js.map +1 -0
  165. package/dist/src/ui/tui/__tests__/store.test.js +100 -10
  166. package/dist/src/ui/tui/__tests__/store.test.js.map +1 -1
  167. package/dist/src/ui/tui/flows.d.ts +17 -6
  168. package/dist/src/ui/tui/flows.js +28 -52
  169. package/dist/src/ui/tui/flows.js.map +1 -1
  170. package/dist/src/ui/tui/ink-ui.d.ts +6 -3
  171. package/dist/src/ui/tui/ink-ui.js +7 -0
  172. package/dist/src/ui/tui/ink-ui.js.map +1 -1
  173. package/dist/src/ui/tui/primitives/ProgressList.d.ts +3 -1
  174. package/dist/src/ui/tui/primitives/ProgressList.js +2 -2
  175. package/dist/src/ui/tui/primitives/ProgressList.js.map +1 -1
  176. package/dist/src/ui/tui/router.js +1 -1
  177. package/dist/src/ui/tui/router.js.map +1 -1
  178. package/dist/src/ui/tui/screen-registry.js +2 -0
  179. package/dist/src/ui/tui/screen-registry.js.map +1 -1
  180. package/dist/src/ui/tui/screens/ManagedSettingsScreen.js.map +1 -1
  181. package/dist/src/ui/tui/screens/OutroScreen.js +1 -1
  182. package/dist/src/ui/tui/screens/OutroScreen.js.map +1 -1
  183. package/dist/src/ui/tui/screens/RevenueIntroScreen.d.ts +16 -0
  184. package/dist/src/ui/tui/screens/RevenueIntroScreen.js +64 -0
  185. package/dist/src/ui/tui/screens/RevenueIntroScreen.js.map +1 -0
  186. package/dist/src/ui/tui/screens/RunScreen.js +1 -1
  187. package/dist/src/ui/tui/screens/RunScreen.js.map +1 -1
  188. package/dist/src/ui/tui/screens/SettingsOverrideScreen.js.map +1 -1
  189. package/dist/src/ui/tui/screens/health/HealthCheckScreen.js +2 -2
  190. package/dist/src/ui/tui/screens/health/HealthCheckScreen.js.map +1 -1
  191. package/dist/src/ui/tui/start-tui.js +2 -2
  192. package/dist/src/ui/tui/start-tui.js.map +1 -1
  193. package/dist/src/ui/tui/store.d.ts +46 -21
  194. package/dist/src/ui/tui/store.js +105 -47
  195. package/dist/src/ui/tui/store.js.map +1 -1
  196. package/dist/src/ui/wizard-ui.d.ts +13 -3
  197. package/dist/src/ui/wizard-ui.js.map +1 -1
  198. package/dist/src/utils/file-utils.d.ts +8 -0
  199. package/dist/src/utils/file-utils.js +32 -0
  200. package/dist/src/utils/file-utils.js.map +1 -1
  201. package/dist/src/utils/wizard-abort.d.ts +3 -0
  202. package/dist/src/utils/wizard-abort.js +5 -3
  203. package/dist/src/utils/wizard-abort.js.map +1 -1
  204. package/npm-shrinkwrap.json +2 -2
  205. package/package.json +1 -1
  206. package/dist/src/__tests__/run.test.js +0 -95
  207. package/dist/src/__tests__/run.test.js.map +0 -1
  208. package/dist/src/lib/__tests__/package-manager-detection.test.js.map +0 -1
  209. package/dist/src/lib/agent-interface.js.map +0 -1
  210. package/dist/src/lib/agent-runner.d.ts +0 -9
  211. package/dist/src/lib/agent-runner.js +0 -385
  212. package/dist/src/lib/agent-runner.js.map +0 -1
  213. package/dist/src/lib/commandments.js.map +0 -1
  214. package/dist/src/lib/package-manager-detection.js.map +0 -1
  215. package/dist/src/run.d.ts +0 -23
  216. package/dist/src/run.js +0 -154
  217. package/dist/src/run.js.map +0 -1
  218. /package/dist/src/{__tests__/run.test.d.ts → lib/agent/__tests__/agent-prompt.test.d.ts} +0 -0
  219. /package/dist/src/lib/{commandments.d.ts → agent/commandments.d.ts} +0 -0
  220. /package/dist/src/lib/{commandments.js → agent/commandments.js} +0 -0
  221. /package/dist/src/lib/{__tests__/package-manager-detection.test.d.ts → detection/__tests__/context.test.d.ts} +0 -0
  222. /package/dist/src/lib/{package-manager-detection.d.ts → detection/package-manager.d.ts} +0 -0
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const fs = __importStar(require("fs"));
37
+ const path = __importStar(require("path"));
38
+ const os = __importStar(require("os"));
39
+ const features_js_1 = require("../features.js");
40
+ const wizard_session_js_1 = require("../../wizard-session.js");
41
+ function makeTmpDir() {
42
+ return fs.mkdtempSync(path.join(os.tmpdir(), 'features-detect-'));
43
+ }
44
+ function cleanup(dir) {
45
+ fs.rmSync(dir, { recursive: true, force: true });
46
+ }
47
+ function writePackageJson(dir, deps = {}) {
48
+ fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ dependencies: deps }));
49
+ }
50
+ describe('discoverFeatures', () => {
51
+ let tmpDir;
52
+ beforeEach(() => {
53
+ tmpDir = makeTmpDir();
54
+ });
55
+ afterEach(() => cleanup(tmpDir));
56
+ it('returns empty when no package.json exists', () => {
57
+ expect((0, features_js_1.discoverFeatures)(tmpDir)).toEqual([]);
58
+ });
59
+ it('detects Stripe and LLM features from known packages', () => {
60
+ writePackageJson(tmpDir, { stripe: '13.0.0', openai: '4.0.0' });
61
+ const features = (0, features_js_1.discoverFeatures)(tmpDir);
62
+ expect(features).toContain(wizard_session_js_1.DiscoveredFeature.Stripe);
63
+ expect(features).toContain(wizard_session_js_1.DiscoveredFeature.LLM);
64
+ expect(features).toHaveLength(2);
65
+ });
66
+ it('returns empty for unrelated dependencies', () => {
67
+ writePackageJson(tmpDir, { react: '18.0.0', express: '4.0.0' });
68
+ expect((0, features_js_1.discoverFeatures)(tmpDir)).toEqual([]);
69
+ });
70
+ it('handles malformed package.json gracefully', () => {
71
+ fs.writeFileSync(path.join(tmpDir, 'package.json'), 'not valid json');
72
+ expect((0, features_js_1.discoverFeatures)(tmpDir)).toEqual([]);
73
+ });
74
+ });
75
+ //# sourceMappingURL=features.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.test.js","sourceRoot":"","sources":["../../../../../src/lib/detection/__tests__/features.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AAC,MAAM,CAAC,CAAC;QAE1C,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,qCAAiB,CAAC,MAAM,CAAC,CAAC;QACrD,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,qCAAiB,CAAC,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,gBAAgB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,MAAM,CAAC,IAAA,8BAAgB,EAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACtE,MAAM,CAAC,IAAA,8BAAgB,EAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { discoverFeatures } from '../features.js';\nimport { DiscoveredFeature } from '../../wizard-session.js';\n\nfunction makeTmpDir(): string {\n return fs.mkdtempSync(path.join(os.tmpdir(), 'features-detect-'));\n}\n\nfunction cleanup(dir: string): void {\n fs.rmSync(dir, { recursive: true, force: true });\n}\n\nfunction writePackageJson(\n dir: string,\n deps: Record<string, string> = {},\n): void {\n fs.writeFileSync(\n path.join(dir, 'package.json'),\n JSON.stringify({ dependencies: deps }),\n );\n}\n\ndescribe('discoverFeatures', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = makeTmpDir();\n });\n afterEach(() => cleanup(tmpDir));\n\n it('returns empty when no package.json exists', () => {\n expect(discoverFeatures(tmpDir)).toEqual([]);\n });\n\n it('detects Stripe and LLM features from known packages', () => {\n writePackageJson(tmpDir, { stripe: '13.0.0', openai: '4.0.0' });\n const features = discoverFeatures(tmpDir);\n\n expect(features).toContain(DiscoveredFeature.Stripe);\n expect(features).toContain(DiscoveredFeature.LLM);\n expect(features).toHaveLength(2);\n });\n\n it('returns empty for unrelated dependencies', () => {\n writePackageJson(tmpDir, { react: '18.0.0', express: '4.0.0' });\n expect(discoverFeatures(tmpDir)).toEqual([]);\n });\n\n it('handles malformed package.json gracefully', () => {\n fs.writeFileSync(path.join(tmpDir, 'package.json'), 'not valid json');\n expect(discoverFeatures(tmpDir)).toEqual([]);\n });\n});\n"]}
@@ -36,12 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const fs = __importStar(require("fs"));
37
37
  const path = __importStar(require("path"));
38
38
  const os = __importStar(require("os"));
39
- const package_manager_detection_1 = require("../package-manager-detection");
40
- jest.mock('../../utils/debug');
41
- jest.mock('../../telemetry', () => ({
39
+ const package_manager_1 = require("../package-manager");
40
+ jest.mock('../../../utils/debug');
41
+ jest.mock('../../../telemetry', () => ({
42
42
  traceStep: (_name, fn) => fn(),
43
43
  }));
44
- jest.mock('../../utils/analytics', () => ({
44
+ jest.mock('../../../utils/analytics', () => ({
45
45
  analytics: { setTag: jest.fn() },
46
46
  }));
47
47
  function makeTmpDir() {
@@ -60,14 +60,14 @@ describe('detectNodePackageManagers', () => {
60
60
  });
61
61
  afterEach(() => cleanup(tmpDir));
62
62
  it('returns empty when no lockfile exists', async () => {
63
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
63
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
64
64
  expect(result.detected).toHaveLength(0);
65
65
  expect(result.primary).toBeNull();
66
66
  expect(result.recommendation).toContain('No lockfile found');
67
67
  });
68
68
  it('detects npm via package-lock.json', async () => {
69
69
  fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
70
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
70
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
71
71
  expect(result.detected).toHaveLength(1);
72
72
  expect(result.primary?.name).toBe('npm');
73
73
  expect(result.primary?.installCommand).toBe('npm add');
@@ -75,28 +75,28 @@ describe('detectNodePackageManagers', () => {
75
75
  });
76
76
  it('detects pnpm via pnpm-lock.yaml', async () => {
77
77
  fs.writeFileSync(path.join(tmpDir, 'pnpm-lock.yaml'), '');
78
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
78
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
79
79
  expect(result.detected).toHaveLength(1);
80
80
  expect(result.primary?.name).toBe('pnpm');
81
81
  expect(result.primary?.installCommand).toBe('pnpm add');
82
82
  });
83
83
  it('detects yarn v1 via yarn.lock', async () => {
84
84
  fs.writeFileSync(path.join(tmpDir, 'yarn.lock'), '# yarn lockfile v1\n');
85
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
85
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
86
86
  expect(result.detected).toHaveLength(1);
87
87
  expect(result.primary?.name).toBe('yarn');
88
88
  expect(result.primary?.label).toContain('V1');
89
89
  });
90
90
  it('detects yarn v2+ via yarn.lock with __metadata', async () => {
91
91
  fs.writeFileSync(path.join(tmpDir, 'yarn.lock'), '__metadata:\n version: 8\n');
92
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
92
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
93
93
  expect(result.detected).toHaveLength(1);
94
94
  expect(result.primary?.name).toBe('yarn');
95
95
  expect(result.primary?.label).toContain('V2');
96
96
  });
97
97
  it('detects bun via bun.lockb', async () => {
98
98
  fs.writeFileSync(path.join(tmpDir, 'bun.lockb'), '');
99
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
99
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
100
100
  expect(result.detected).toHaveLength(1);
101
101
  expect(result.primary?.name).toBe('bun');
102
102
  expect(result.primary?.installCommand).toBe('bun add');
@@ -104,13 +104,13 @@ describe('detectNodePackageManagers', () => {
104
104
  it('detects multiple package managers', async () => {
105
105
  fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
106
106
  fs.writeFileSync(path.join(tmpDir, 'pnpm-lock.yaml'), '');
107
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
107
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
108
108
  expect(result.detected.length).toBeGreaterThanOrEqual(2);
109
109
  expect(result.recommendation).toContain('Multiple');
110
110
  });
111
111
  it('includes runCommand in detected entries', async () => {
112
112
  fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
113
- const result = await (0, package_manager_detection_1.detectNodePackageManagers)(tmpDir);
113
+ const result = await (0, package_manager_1.detectNodePackageManagers)(tmpDir);
114
114
  expect(result.primary?.runCommand).toBe('npm run');
115
115
  });
116
116
  });
@@ -125,52 +125,52 @@ describe('detectPythonPackageManagers', () => {
125
125
  afterEach(() => cleanup(tmpDir));
126
126
  it('detects uv via uv.lock', async () => {
127
127
  fs.writeFileSync(path.join(tmpDir, 'uv.lock'), '');
128
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
128
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
129
129
  expect(result.primary?.name).toBe('uv');
130
130
  expect(result.primary?.installCommand).toBe('uv add');
131
131
  expect(result.primary?.runCommand).toBe('uv run');
132
132
  });
133
133
  it('detects poetry via pyproject.toml [tool.poetry]', async () => {
134
134
  fs.writeFileSync(path.join(tmpDir, 'pyproject.toml'), '[tool.poetry]\nname = "test"\n');
135
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
135
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
136
136
  expect(result.primary?.name).toBe('poetry');
137
137
  expect(result.primary?.installCommand).toBe('poetry add');
138
138
  });
139
139
  it('detects poetry via poetry.lock', async () => {
140
140
  fs.writeFileSync(path.join(tmpDir, 'poetry.lock'), '');
141
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
141
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
142
142
  expect(result.primary?.name).toBe('poetry');
143
143
  });
144
144
  it('detects pdm via pyproject.toml [tool.pdm]', async () => {
145
145
  fs.writeFileSync(path.join(tmpDir, 'pyproject.toml'), '[tool.pdm]\n');
146
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
146
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
147
147
  expect(result.primary?.name).toBe('pdm');
148
148
  });
149
149
  it('detects pipenv via Pipfile', async () => {
150
150
  fs.writeFileSync(path.join(tmpDir, 'Pipfile'), '');
151
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
151
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
152
152
  expect(result.primary?.name).toBe('pipenv');
153
153
  expect(result.primary?.installCommand).toBe('pipenv install');
154
154
  });
155
155
  it('detects conda via environment.yml', async () => {
156
156
  fs.writeFileSync(path.join(tmpDir, 'environment.yml'), '');
157
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
157
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
158
158
  expect(result.primary?.name).toBe('conda');
159
159
  });
160
160
  it('detects pip via requirements.txt', async () => {
161
161
  fs.writeFileSync(path.join(tmpDir, 'requirements.txt'), 'flask==2.0\n');
162
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
162
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
163
163
  expect(result.primary?.name).toBe('pip');
164
164
  expect(result.primary?.installCommand).toBe('pip install');
165
165
  });
166
166
  it('falls back to unknown when no markers exist', async () => {
167
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
167
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
168
168
  expect(result.primary?.name).toBe('pip');
169
169
  expect(result.primary?.label).toContain('default');
170
170
  });
171
171
  it('returns a recommendation string', async () => {
172
172
  fs.writeFileSync(path.join(tmpDir, 'uv.lock'), '');
173
- const result = await (0, package_manager_detection_1.detectPythonPackageManagers)(tmpDir);
173
+ const result = await (0, package_manager_1.detectPythonPackageManagers)(tmpDir);
174
174
  expect(result.recommendation).toContain('uv');
175
175
  expect(result.recommendation).toContain('uv add');
176
176
  });
@@ -180,9 +180,9 @@ describe('detectPythonPackageManagers', () => {
180
180
  // ---------------------------------------------------------------------------
181
181
  describe('static package manager helpers', () => {
182
182
  it.each([
183
- { fn: package_manager_detection_1.composerPackageManager, name: 'composer' },
184
- { fn: package_manager_detection_1.swiftPackageManager, name: 'spm' },
185
- { fn: package_manager_detection_1.gradlePackageManager, name: 'gradle' },
183
+ { fn: package_manager_1.composerPackageManager, name: 'composer' },
184
+ { fn: package_manager_1.swiftPackageManager, name: 'spm' },
185
+ { fn: package_manager_1.gradlePackageManager, name: 'gradle' },
186
186
  ])('$name returns valid PackageManagerInfo', async ({ fn }) => {
187
187
  const result = await fn();
188
188
  expect(result.detected).toHaveLength(1);
@@ -192,4 +192,4 @@ describe('static package manager helpers', () => {
192
192
  expect(result.recommendation).toBeTruthy();
193
193
  });
194
194
  });
195
- //# sourceMappingURL=package-manager-detection.test.js.map
195
+ //# sourceMappingURL=package-manager.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-manager.test.js","sourceRoot":"","sources":["../../../../../src/lib/detection/__tests__/package-manager.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACz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AAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,EAAE,CAAC,IAAI,CAAC;QACN,EAAE,EAAE,EAAE,wCAAsB,EAAE,IAAI,EAAE,UAAU,EAAE;QAChD,EAAE,EAAE,EAAE,qCAAmB,EAAE,IAAI,EAAE,KAAK,EAAE;QACxC,EAAE,EAAE,EAAE,sCAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC7C,CAAC,CAAC,wCAAwC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,UAAU,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport {\n detectNodePackageManagers,\n detectPythonPackageManagers,\n composerPackageManager,\n swiftPackageManager,\n gradlePackageManager,\n} from '../package-manager';\n\njest.mock('../../../utils/debug');\njest.mock('../../../telemetry', () => ({\n traceStep: (_name: string, fn: () => unknown) => fn(),\n}));\njest.mock('../../../utils/analytics', () => ({\n analytics: { setTag: jest.fn() },\n}));\n\nfunction makeTmpDir(): string {\n return fs.mkdtempSync(path.join(os.tmpdir(), 'pm-detect-'));\n}\n\nfunction cleanup(dir: string): void {\n fs.rmSync(dir, { recursive: true, force: true });\n}\n\n// ---------------------------------------------------------------------------\n// Node.js detection\n// ---------------------------------------------------------------------------\n\ndescribe('detectNodePackageManagers', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = makeTmpDir();\n });\n afterEach(() => cleanup(tmpDir));\n\n it('returns empty when no lockfile exists', async () => {\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(0);\n expect(result.primary).toBeNull();\n expect(result.recommendation).toContain('No lockfile found');\n });\n\n it('detects npm via package-lock.json', async () => {\n fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(1);\n expect(result.primary?.name).toBe('npm');\n expect(result.primary?.installCommand).toBe('npm add');\n expect(result.recommendation).toContain('npm');\n });\n\n it('detects pnpm via pnpm-lock.yaml', async () => {\n fs.writeFileSync(path.join(tmpDir, 'pnpm-lock.yaml'), '');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(1);\n expect(result.primary?.name).toBe('pnpm');\n expect(result.primary?.installCommand).toBe('pnpm add');\n });\n\n it('detects yarn v1 via yarn.lock', async () => {\n fs.writeFileSync(path.join(tmpDir, 'yarn.lock'), '# yarn lockfile v1\\n');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(1);\n expect(result.primary?.name).toBe('yarn');\n expect(result.primary?.label).toContain('V1');\n });\n\n it('detects yarn v2+ via yarn.lock with __metadata', async () => {\n fs.writeFileSync(\n path.join(tmpDir, 'yarn.lock'),\n '__metadata:\\n version: 8\\n',\n );\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(1);\n expect(result.primary?.name).toBe('yarn');\n expect(result.primary?.label).toContain('V2');\n });\n\n it('detects bun via bun.lockb', async () => {\n fs.writeFileSync(path.join(tmpDir, 'bun.lockb'), '');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected).toHaveLength(1);\n expect(result.primary?.name).toBe('bun');\n expect(result.primary?.installCommand).toBe('bun add');\n });\n\n it('detects multiple package managers', async () => {\n fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');\n fs.writeFileSync(path.join(tmpDir, 'pnpm-lock.yaml'), '');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.detected.length).toBeGreaterThanOrEqual(2);\n expect(result.recommendation).toContain('Multiple');\n });\n\n it('includes runCommand in detected entries', async () => {\n fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');\n const result = await detectNodePackageManagers(tmpDir);\n expect(result.primary?.runCommand).toBe('npm run');\n });\n});\n\n// ---------------------------------------------------------------------------\n// Python detection\n// ---------------------------------------------------------------------------\n\ndescribe('detectPythonPackageManagers', () => {\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = makeTmpDir();\n });\n afterEach(() => cleanup(tmpDir));\n\n it('detects uv via uv.lock', async () => {\n fs.writeFileSync(path.join(tmpDir, 'uv.lock'), '');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('uv');\n expect(result.primary?.installCommand).toBe('uv add');\n expect(result.primary?.runCommand).toBe('uv run');\n });\n\n it('detects poetry via pyproject.toml [tool.poetry]', async () => {\n fs.writeFileSync(\n path.join(tmpDir, 'pyproject.toml'),\n '[tool.poetry]\\nname = \"test\"\\n',\n );\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('poetry');\n expect(result.primary?.installCommand).toBe('poetry add');\n });\n\n it('detects poetry via poetry.lock', async () => {\n fs.writeFileSync(path.join(tmpDir, 'poetry.lock'), '');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('poetry');\n });\n\n it('detects pdm via pyproject.toml [tool.pdm]', async () => {\n fs.writeFileSync(path.join(tmpDir, 'pyproject.toml'), '[tool.pdm]\\n');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('pdm');\n });\n\n it('detects pipenv via Pipfile', async () => {\n fs.writeFileSync(path.join(tmpDir, 'Pipfile'), '');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('pipenv');\n expect(result.primary?.installCommand).toBe('pipenv install');\n });\n\n it('detects conda via environment.yml', async () => {\n fs.writeFileSync(path.join(tmpDir, 'environment.yml'), '');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('conda');\n });\n\n it('detects pip via requirements.txt', async () => {\n fs.writeFileSync(path.join(tmpDir, 'requirements.txt'), 'flask==2.0\\n');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('pip');\n expect(result.primary?.installCommand).toBe('pip install');\n });\n\n it('falls back to unknown when no markers exist', async () => {\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.primary?.name).toBe('pip');\n expect(result.primary?.label).toContain('default');\n });\n\n it('returns a recommendation string', async () => {\n fs.writeFileSync(path.join(tmpDir, 'uv.lock'), '');\n const result = await detectPythonPackageManagers(tmpDir);\n expect(result.recommendation).toContain('uv');\n expect(result.recommendation).toContain('uv add');\n });\n});\n\n// ---------------------------------------------------------------------------\n// Static helpers\n// ---------------------------------------------------------------------------\n\ndescribe('static package manager helpers', () => {\n it.each([\n { fn: composerPackageManager, name: 'composer' },\n { fn: swiftPackageManager, name: 'spm' },\n { fn: gradlePackageManager, name: 'gradle' },\n ])('$name returns valid PackageManagerInfo', async ({ fn }) => {\n const result = await fn();\n expect(result.detected).toHaveLength(1);\n expect(result.primary).toBe(result.detected[0]);\n expect(result.primary?.name).toBeTruthy();\n expect(result.primary?.installCommand).toBeTruthy();\n expect(result.recommendation).toBeTruthy();\n });\n});\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Framework context gathering — run gatherContext and version checks
3
+ * for a detected framework.
4
+ *
5
+ * Pure functions: take a framework config and options, return results.
6
+ * No store mutations, no UI calls.
7
+ */
8
+ import type { FrameworkConfig } from '../framework-config.js';
9
+ import type { WizardOptions } from '../../utils/types.js';
10
+ /**
11
+ * Run a framework's `gatherContext()` to collect variant-specific
12
+ * metadata (e.g., router type for Next.js, Expo vs bare for React Native).
13
+ *
14
+ * Returns the gathered context, or an empty object on failure/timeout.
15
+ */
16
+ export declare function gatherFrameworkContext(config: FrameworkConfig, options: WizardOptions): Promise<Record<string, unknown>>;
17
+ export interface VersionCheckResult {
18
+ /** Whether the installed version is supported */
19
+ supported: true | {
20
+ current: string;
21
+ minimum: string;
22
+ docsUrl: string;
23
+ };
24
+ }
25
+ /**
26
+ * Check whether the installed framework version meets the minimum requirement.
27
+ *
28
+ * Returns `{ supported: true }` if the version is fine (or no check is needed).
29
+ * Returns the version details if unsupported.
30
+ */
31
+ export declare function checkFrameworkVersion(config: FrameworkConfig, options: WizardOptions): Promise<VersionCheckResult>;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ /**
3
+ * Framework context gathering — run gatherContext and version checks
4
+ * for a detected framework.
5
+ *
6
+ * Pure functions: take a framework config and options, return results.
7
+ * No store mutations, no UI calls.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.gatherFrameworkContext = gatherFrameworkContext;
44
+ exports.checkFrameworkVersion = checkFrameworkVersion;
45
+ const semver = __importStar(require("semver"));
46
+ const constants_js_1 = require("../constants.js");
47
+ /**
48
+ * Run a framework's `gatherContext()` to collect variant-specific
49
+ * metadata (e.g., router type for Next.js, Expo vs bare for React Native).
50
+ *
51
+ * Returns the gathered context, or an empty object on failure/timeout.
52
+ */
53
+ async function gatherFrameworkContext(config, options) {
54
+ if (!config.metadata.gatherContext)
55
+ return {};
56
+ try {
57
+ return await Promise.race([
58
+ config.metadata.gatherContext(options),
59
+ new Promise((resolve) => setTimeout(() => resolve({}), constants_js_1.DETECTION_TIMEOUT_MS)),
60
+ ]);
61
+ }
62
+ catch {
63
+ return {};
64
+ }
65
+ }
66
+ /**
67
+ * Check whether the installed framework version meets the minimum requirement.
68
+ *
69
+ * Returns `{ supported: true }` if the version is fine (or no check is needed).
70
+ * Returns the version details if unsupported.
71
+ */
72
+ async function checkFrameworkVersion(config, options) {
73
+ if (!config.detection.minimumVersion ||
74
+ !config.detection.getInstalledVersion) {
75
+ return { supported: true };
76
+ }
77
+ const version = await config.detection.getInstalledVersion(options);
78
+ if (!version)
79
+ return { supported: true };
80
+ const coerced = semver.coerce(version);
81
+ if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {
82
+ return {
83
+ supported: {
84
+ current: version,
85
+ minimum: config.detection.minimumVersion,
86
+ docsUrl: config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl,
87
+ },
88
+ };
89
+ }
90
+ return { supported: true };
91
+ }
92
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/detection/context.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaH,wDAgBC;AAmBD,sDA2BC;AAzED,+CAAiC;AACjC,kDAAuD;AAIvD;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,MAAuB,EACvB,OAAsB;IAEtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9C,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC;YACxB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;YACtC,IAAI,OAAO,CAAwB,CAAC,OAAO,EAAE,EAAE,CAC7C,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,mCAAoB,CAAC,CACpD;SACF,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAaD;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CACzC,MAAuB,EACvB,OAAsB;IAEtB,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc;QAChC,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,EACrC,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACpE,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACnE,OAAO;YACL,SAAS,EAAE;gBACT,OAAO,EAAE,OAAO;gBAChB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc;gBACxC,OAAO,EACL,MAAM,CAAC,QAAQ,CAAC,yBAAyB,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO;aACvE;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/**\n * Framework context gathering — run gatherContext and version checks\n * for a detected framework.\n *\n * Pure functions: take a framework config and options, return results.\n * No store mutations, no UI calls.\n */\n\nimport * as semver from 'semver';\nimport { DETECTION_TIMEOUT_MS } from '../constants.js';\nimport type { FrameworkConfig } from '../framework-config.js';\nimport type { WizardOptions } from '../../utils/types.js';\n\n/**\n * Run a framework's `gatherContext()` to collect variant-specific\n * metadata (e.g., router type for Next.js, Expo vs bare for React Native).\n *\n * Returns the gathered context, or an empty object on failure/timeout.\n */\nexport async function gatherFrameworkContext(\n config: FrameworkConfig,\n options: WizardOptions,\n): Promise<Record<string, unknown>> {\n if (!config.metadata.gatherContext) return {};\n\n try {\n return await Promise.race([\n config.metadata.gatherContext(options),\n new Promise<Record<string, never>>((resolve) =>\n setTimeout(() => resolve({}), DETECTION_TIMEOUT_MS),\n ),\n ]);\n } catch {\n return {};\n }\n}\n\nexport interface VersionCheckResult {\n /** Whether the installed version is supported */\n supported:\n | true\n | {\n current: string;\n minimum: string;\n docsUrl: string;\n };\n}\n\n/**\n * Check whether the installed framework version meets the minimum requirement.\n *\n * Returns `{ supported: true }` if the version is fine (or no check is needed).\n * Returns the version details if unsupported.\n */\nexport async function checkFrameworkVersion(\n config: FrameworkConfig,\n options: WizardOptions,\n): Promise<VersionCheckResult> {\n if (\n !config.detection.minimumVersion ||\n !config.detection.getInstalledVersion\n ) {\n return { supported: true };\n }\n\n const version = await config.detection.getInstalledVersion(options);\n if (!version) return { supported: true };\n\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n return {\n supported: {\n current: version,\n minimum: config.detection.minimumVersion,\n docsUrl:\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl,\n },\n };\n }\n\n return { supported: true };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Feature discovery — scan project dependencies for known SDK patterns
3
+ * that indicate additional PostHog workflows are relevant.
4
+ *
5
+ * Pure function: takes an install dir, returns a set of discovered features.
6
+ * No store mutations, no UI calls.
7
+ */
8
+ import { DiscoveredFeature } from '../wizard-session.js';
9
+ /**
10
+ * Scan `package.json` at `installDir` for dependencies that indicate
11
+ * additional PostHog features (Stripe revenue analytics, LLM observability, etc.)
12
+ *
13
+ * Returns an array of discovered features, or empty if nothing found
14
+ * or no package.json exists.
15
+ */
16
+ export declare function discoverFeatures(installDir: string): DiscoveredFeature[];
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * Feature discovery — scan project dependencies for known SDK patterns
4
+ * that indicate additional PostHog workflows are relevant.
5
+ *
6
+ * Pure function: takes an install dir, returns a set of discovered features.
7
+ * No store mutations, no UI calls.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.discoverFeatures = discoverFeatures;
11
+ const fs_1 = require("fs");
12
+ const path_1 = require("path");
13
+ const wizard_session_js_1 = require("../wizard-session.js");
14
+ const STRIPE_PACKAGES = ['stripe', '@stripe/stripe-js'];
15
+ const LLM_PACKAGES = [
16
+ 'openai',
17
+ '@anthropic-ai/sdk',
18
+ 'ai',
19
+ '@ai-sdk/openai',
20
+ 'langchain',
21
+ '@langchain/openai',
22
+ '@langchain/langgraph',
23
+ '@google/generative-ai',
24
+ '@google/genai',
25
+ '@instructor-ai/instructor',
26
+ '@mastra/core',
27
+ 'portkey-ai',
28
+ ];
29
+ /**
30
+ * Scan `package.json` at `installDir` for dependencies that indicate
31
+ * additional PostHog features (Stripe revenue analytics, LLM observability, etc.)
32
+ *
33
+ * Returns an array of discovered features, or empty if nothing found
34
+ * or no package.json exists.
35
+ */
36
+ function discoverFeatures(installDir) {
37
+ const features = [];
38
+ try {
39
+ const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(installDir, 'package.json'), 'utf-8'));
40
+ const depNames = Object.keys({
41
+ ...pkg.dependencies,
42
+ ...pkg.devDependencies,
43
+ });
44
+ if (depNames.some((d) => STRIPE_PACKAGES.includes(d))) {
45
+ features.push(wizard_session_js_1.DiscoveredFeature.Stripe);
46
+ }
47
+ if (depNames.some((d) => LLM_PACKAGES.includes(d))) {
48
+ features.push(wizard_session_js_1.DiscoveredFeature.LLM);
49
+ }
50
+ }
51
+ catch {
52
+ // No package.json or parse error — skip feature discovery
53
+ }
54
+ return features;
55
+ }
56
+ //# sourceMappingURL=features.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.js","sourceRoot":"","sources":["../../../../src/lib/detection/features.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA8BH,4CA2BC;AAvDD,2BAAkC;AAClC,+BAA4B;AAC5B,4DAAyD;AAEzD,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAExD,MAAM,YAAY,GAAG;IACnB,QAAQ;IACR,mBAAmB;IACnB,IAAI;IACJ,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,sBAAsB;IACtB,uBAAuB;IACvB,eAAe;IACf,2BAA2B;IAC3B,cAAc;IACd,YAAY;CACb,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,UAAkB;IACjD,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,UAAU,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAIxD,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,GAAG,GAAG,CAAC,YAAY;YACnB,GAAG,GAAG,CAAC,eAAe;SACvB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,QAAQ,CAAC,IAAI,CAAC,qCAAiB,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,QAAQ,CAAC,IAAI,CAAC,qCAAiB,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,0DAA0D;IAC5D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Feature discovery — scan project dependencies for known SDK patterns\n * that indicate additional PostHog workflows are relevant.\n *\n * Pure function: takes an install dir, returns a set of discovered features.\n * No store mutations, no UI calls.\n */\n\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport { DiscoveredFeature } from '../wizard-session.js';\n\nconst STRIPE_PACKAGES = ['stripe', '@stripe/stripe-js'];\n\nconst LLM_PACKAGES = [\n 'openai',\n '@anthropic-ai/sdk',\n 'ai',\n '@ai-sdk/openai',\n 'langchain',\n '@langchain/openai',\n '@langchain/langgraph',\n '@google/generative-ai',\n '@google/genai',\n '@instructor-ai/instructor',\n '@mastra/core',\n 'portkey-ai',\n];\n\n/**\n * Scan `package.json` at `installDir` for dependencies that indicate\n * additional PostHog features (Stripe revenue analytics, LLM observability, etc.)\n *\n * Returns an array of discovered features, or empty if nothing found\n * or no package.json exists.\n */\nexport function discoverFeatures(installDir: string): DiscoveredFeature[] {\n const features: DiscoveredFeature[] = [];\n\n try {\n const pkg = JSON.parse(\n readFileSync(join(installDir, 'package.json'), 'utf-8'),\n ) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n const depNames = Object.keys({\n ...pkg.dependencies,\n ...pkg.devDependencies,\n });\n\n if (depNames.some((d) => STRIPE_PACKAGES.includes(d))) {\n features.push(DiscoveredFeature.Stripe);\n }\n\n if (depNames.some((d) => LLM_PACKAGES.includes(d))) {\n features.push(DiscoveredFeature.LLM);\n }\n } catch {\n // No package.json or parse error — skip feature discovery\n }\n\n return features;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Framework detection — identify which PostHog-supported framework
3
+ * is present in the project directory.
4
+ *
5
+ * Pure function: takes an install dir, returns the detected integration
6
+ * (or undefined). No store mutations, no UI calls.
7
+ */
8
+ import { Integration } from '../constants.js';
9
+ /**
10
+ * Loop through all registered frameworks and return the first one
11
+ * whose `detect()` predicate matches the given directory.
12
+ * Returns undefined if no framework is detected or detection times out.
13
+ */
14
+ export declare function detectFramework(installDir: string): Promise<Integration | undefined>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Framework detection — identify which PostHog-supported framework
4
+ * is present in the project directory.
5
+ *
6
+ * Pure function: takes an install dir, returns the detected integration
7
+ * (or undefined). No store mutations, no UI calls.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.detectFramework = detectFramework;
11
+ const constants_js_1 = require("../constants.js");
12
+ const registry_js_1 = require("../registry.js");
13
+ /**
14
+ * Loop through all registered frameworks and return the first one
15
+ * whose `detect()` predicate matches the given directory.
16
+ * Returns undefined if no framework is detected or detection times out.
17
+ */
18
+ async function detectFramework(installDir) {
19
+ for (const integration of Object.values(constants_js_1.Integration)) {
20
+ const config = registry_js_1.FRAMEWORK_REGISTRY[integration];
21
+ try {
22
+ const detected = await Promise.race([
23
+ config.detection.detect({ installDir }),
24
+ new Promise((resolve) => setTimeout(() => resolve(false), constants_js_1.DETECTION_TIMEOUT_MS)),
25
+ ]);
26
+ if (detected) {
27
+ return integration;
28
+ }
29
+ }
30
+ catch {
31
+ // Skip frameworks whose detection throws
32
+ }
33
+ }
34
+ }
35
+ //# sourceMappingURL=framework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.js","sourceRoot":"","sources":["../../../../src/lib/detection/framework.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAUH,0CAmBC;AA3BD,kDAAoE;AACpE,gDAAoD;AAEpD;;;;GAIG;AACI,KAAK,UAAU,eAAe,CACnC,UAAkB;IAElB,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,0BAAW,CAAC,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,gCAAkB,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;gBAClC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;gBACvC,IAAI,OAAO,CAAQ,CAAC,OAAO,EAAE,EAAE,CAC7B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,mCAAoB,CAAC,CACvD;aACF,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Framework detection — identify which PostHog-supported framework\n * is present in the project directory.\n *\n * Pure function: takes an install dir, returns the detected integration\n * (or undefined). No store mutations, no UI calls.\n */\n\nimport { Integration, DETECTION_TIMEOUT_MS } from '../constants.js';\nimport { FRAMEWORK_REGISTRY } from '../registry.js';\n\n/**\n * Loop through all registered frameworks and return the first one\n * whose `detect()` predicate matches the given directory.\n * Returns undefined if no framework is detected or detection times out.\n */\nexport async function detectFramework(\n installDir: string,\n): Promise<Integration | undefined> {\n for (const integration of Object.values(Integration)) {\n const config = FRAMEWORK_REGISTRY[integration];\n try {\n const detected = await Promise.race([\n config.detection.detect({ installDir }),\n new Promise<false>((resolve) =>\n setTimeout(() => resolve(false), DETECTION_TIMEOUT_MS),\n ),\n ]);\n if (detected) {\n return integration;\n }\n } catch {\n // Skip frameworks whose detection throws\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { detectFramework } from './framework.js';
2
+ export { discoverFeatures } from './features.js';
3
+ export { gatherFrameworkContext, checkFrameworkVersion, type VersionCheckResult, } from './context.js';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkFrameworkVersion = exports.gatherFrameworkContext = exports.discoverFeatures = exports.detectFramework = void 0;
4
+ var framework_js_1 = require("./framework.js");
5
+ Object.defineProperty(exports, "detectFramework", { enumerable: true, get: function () { return framework_js_1.detectFramework; } });
6
+ var features_js_1 = require("./features.js");
7
+ Object.defineProperty(exports, "discoverFeatures", { enumerable: true, get: function () { return features_js_1.discoverFeatures; } });
8
+ var context_js_1 = require("./context.js");
9
+ Object.defineProperty(exports, "gatherFrameworkContext", { enumerable: true, get: function () { return context_js_1.gatherFrameworkContext; } });
10
+ Object.defineProperty(exports, "checkFrameworkVersion", { enumerable: true, get: function () { return context_js_1.checkFrameworkVersion; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/detection/index.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AACxB,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,2CAIsB;AAHpB,oHAAA,sBAAsB,OAAA;AACtB,mHAAA,qBAAqB,OAAA","sourcesContent":["export { detectFramework } from './framework.js';\nexport { discoverFeatures } from './features.js';\nexport {\n gatherFrameworkContext,\n checkFrameworkVersion,\n type VersionCheckResult,\n} from './context.js';\n"]}
@@ -14,8 +14,8 @@ exports.composerPackageManager = composerPackageManager;
14
14
  exports.swiftPackageManager = swiftPackageManager;
15
15
  exports.bundlerPackageManager = bundlerPackageManager;
16
16
  exports.gradlePackageManager = gradlePackageManager;
17
- const package_manager_1 = require("../utils/package-manager");
18
- const utils_1 = require("../frameworks/python/utils");
17
+ const package_manager_1 = require("../../utils/package-manager");
18
+ const utils_1 = require("../../frameworks/python/utils");
19
19
  // ---------------------------------------------------------------------------
20
20
  // Node.js helper
21
21
  // ---------------------------------------------------------------------------
@@ -180,4 +180,4 @@ function gradlePackageManager() {
180
180
  recommendation: 'Add dependencies to build.gradle(.kts) using implementation().',
181
181
  });
182
182
  }
183
- //# sourceMappingURL=package-manager-detection.js.map
183
+ //# sourceMappingURL=package-manager.js.map