@allstak/wizard 0.1.4 → 0.1.6

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 (281) hide show
  1. package/CHANGELOG.md +42 -3
  2. package/LICENSE +191 -0
  3. package/README.md +35 -32
  4. package/dist/api/http.d.ts +2 -0
  5. package/dist/api/http.d.ts.map +1 -1
  6. package/dist/api/http.js +12 -1
  7. package/dist/api/http.js.map +1 -1
  8. package/dist/api/index.d.ts +1 -0
  9. package/dist/api/index.d.ts.map +1 -1
  10. package/dist/api/index.js +1 -0
  11. package/dist/api/index.js.map +1 -1
  12. package/dist/certification/fixtures.d.ts +4 -0
  13. package/dist/certification/fixtures.d.ts.map +1 -0
  14. package/dist/certification/fixtures.js +109 -0
  15. package/dist/certification/fixtures.js.map +1 -0
  16. package/dist/certification/gates.d.ts +10 -0
  17. package/dist/certification/gates.d.ts.map +1 -0
  18. package/dist/certification/gates.js +20 -0
  19. package/dist/certification/gates.js.map +1 -0
  20. package/dist/certification/index.d.ts +6 -0
  21. package/dist/certification/index.d.ts.map +1 -0
  22. package/dist/certification/index.js +5 -0
  23. package/dist/certification/index.js.map +1 -0
  24. package/dist/certification/live-backend.d.ts +50 -0
  25. package/dist/certification/live-backend.d.ts.map +1 -0
  26. package/dist/certification/live-backend.js +422 -0
  27. package/dist/certification/live-backend.js.map +1 -0
  28. package/dist/certification/packages.d.ts +3 -0
  29. package/dist/certification/packages.d.ts.map +1 -0
  30. package/dist/certification/packages.js +49 -0
  31. package/dist/certification/packages.js.map +1 -0
  32. package/dist/certification/process.d.ts +8 -0
  33. package/dist/certification/process.d.ts.map +1 -0
  34. package/dist/certification/process.js +77 -0
  35. package/dist/certification/process.js.map +1 -0
  36. package/dist/certification/report.d.ts +3 -0
  37. package/dist/certification/report.d.ts.map +1 -0
  38. package/dist/certification/report.js +38 -0
  39. package/dist/certification/report.js.map +1 -0
  40. package/dist/certification/runner.d.ts +3 -0
  41. package/dist/certification/runner.d.ts.map +1 -0
  42. package/dist/certification/runner.js +299 -0
  43. package/dist/certification/runner.js.map +1 -0
  44. package/dist/certification/runtime.d.ts +11 -0
  45. package/dist/certification/runtime.d.ts.map +1 -0
  46. package/dist/certification/runtime.js +60 -0
  47. package/dist/certification/runtime.js.map +1 -0
  48. package/dist/certification/types.d.ts +73 -0
  49. package/dist/certification/types.d.ts.map +1 -0
  50. package/dist/certification/types.js +2 -0
  51. package/dist/certification/types.js.map +1 -0
  52. package/dist/cli.js +70 -3
  53. package/dist/cli.js.map +1 -1
  54. package/dist/commands/certify.d.ts +18 -0
  55. package/dist/commands/certify.d.ts.map +1 -0
  56. package/dist/commands/certify.js +27 -0
  57. package/dist/commands/certify.js.map +1 -0
  58. package/dist/commands/init.d.ts.map +1 -1
  59. package/dist/commands/init.js +13 -0
  60. package/dist/commands/init.js.map +1 -1
  61. package/dist/commands/list.d.ts +5 -1
  62. package/dist/commands/list.d.ts.map +1 -1
  63. package/dist/commands/list.js +9 -3
  64. package/dist/commands/list.js.map +1 -1
  65. package/dist/commands/security-snapshot.d.ts +24 -0
  66. package/dist/commands/security-snapshot.d.ts.map +1 -0
  67. package/dist/commands/security-snapshot.js +113 -0
  68. package/dist/commands/security-snapshot.js.map +1 -0
  69. package/dist/index.d.ts +3 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +3 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/integrations/_scaffold.d.ts +2 -1
  74. package/dist/integrations/_scaffold.d.ts.map +1 -1
  75. package/dist/integrations/_scaffold.js +36 -13
  76. package/dist/integrations/_scaffold.js.map +1 -1
  77. package/dist/integrations/_simple-scaffold.d.ts +5 -2
  78. package/dist/integrations/_simple-scaffold.d.ts.map +1 -1
  79. package/dist/integrations/_simple-scaffold.js +3 -0
  80. package/dist/integrations/_simple-scaffold.js.map +1 -1
  81. package/dist/integrations/dotnet.d.ts.map +1 -1
  82. package/dist/integrations/dotnet.js +3 -0
  83. package/dist/integrations/dotnet.js.map +1 -1
  84. package/dist/integrations/expo/detect.d.ts +13 -0
  85. package/dist/integrations/expo/detect.d.ts.map +1 -0
  86. package/dist/integrations/expo/detect.js +38 -0
  87. package/dist/integrations/expo/detect.js.map +1 -0
  88. package/dist/integrations/expo/doctor.d.ts +6 -0
  89. package/dist/integrations/expo/doctor.d.ts.map +1 -0
  90. package/dist/integrations/expo/doctor.js +136 -0
  91. package/dist/integrations/expo/doctor.js.map +1 -0
  92. package/dist/integrations/expo/files.d.ts +15 -0
  93. package/dist/integrations/expo/files.d.ts.map +1 -0
  94. package/dist/integrations/expo/files.js +62 -0
  95. package/dist/integrations/expo/files.js.map +1 -0
  96. package/dist/integrations/expo/index.d.ts +24 -0
  97. package/dist/integrations/expo/index.d.ts.map +1 -0
  98. package/dist/integrations/expo/index.js +68 -0
  99. package/dist/integrations/expo/index.js.map +1 -0
  100. package/dist/integrations/expo/manifest.d.ts +3 -0
  101. package/dist/integrations/expo/manifest.d.ts.map +1 -0
  102. package/dist/integrations/expo/manifest.js +39 -0
  103. package/dist/integrations/expo/manifest.js.map +1 -0
  104. package/dist/integrations/expo/patch.d.ts +13 -0
  105. package/dist/integrations/expo/patch.d.ts.map +1 -0
  106. package/dist/integrations/expo/patch.js +215 -0
  107. package/dist/integrations/expo/patch.js.map +1 -0
  108. package/dist/integrations/expo/uninstall.d.ts +4 -0
  109. package/dist/integrations/expo/uninstall.d.ts.map +1 -0
  110. package/dist/integrations/expo/uninstall.js +77 -0
  111. package/dist/integrations/expo/uninstall.js.map +1 -0
  112. package/dist/integrations/expo.d.ts +8 -1
  113. package/dist/integrations/expo.d.ts.map +1 -1
  114. package/dist/integrations/expo.js +8 -11
  115. package/dist/integrations/expo.js.map +1 -1
  116. package/dist/integrations/fastify/detect.d.ts +3 -0
  117. package/dist/integrations/fastify/detect.d.ts.map +1 -0
  118. package/dist/integrations/fastify/detect.js +12 -0
  119. package/dist/integrations/fastify/detect.js.map +1 -0
  120. package/dist/integrations/fastify/doctor.d.ts +3 -0
  121. package/dist/integrations/fastify/doctor.d.ts.map +1 -0
  122. package/dist/integrations/fastify/doctor.js +81 -0
  123. package/dist/integrations/fastify/doctor.js.map +1 -0
  124. package/dist/integrations/fastify/files.d.ts +17 -0
  125. package/dist/integrations/fastify/files.d.ts.map +1 -0
  126. package/dist/integrations/fastify/files.js +51 -0
  127. package/dist/integrations/fastify/files.js.map +1 -0
  128. package/dist/integrations/fastify/index.d.ts +3 -0
  129. package/dist/integrations/fastify/index.d.ts.map +1 -0
  130. package/dist/integrations/fastify/index.js +47 -0
  131. package/dist/integrations/fastify/index.js.map +1 -0
  132. package/dist/integrations/fastify/manifest.d.ts +3 -0
  133. package/dist/integrations/fastify/manifest.d.ts.map +1 -0
  134. package/dist/integrations/fastify/manifest.js +34 -0
  135. package/dist/integrations/fastify/manifest.js.map +1 -0
  136. package/dist/integrations/fastify/patch.d.ts +27 -0
  137. package/dist/integrations/fastify/patch.d.ts.map +1 -0
  138. package/dist/integrations/fastify/patch.js +91 -0
  139. package/dist/integrations/fastify/patch.js.map +1 -0
  140. package/dist/integrations/fastify/uninstall.d.ts +4 -0
  141. package/dist/integrations/fastify/uninstall.d.ts.map +1 -0
  142. package/dist/integrations/fastify/uninstall.js +18 -0
  143. package/dist/integrations/fastify/uninstall.js.map +1 -0
  144. package/dist/integrations/fastify.d.ts +5 -1
  145. package/dist/integrations/fastify.d.ts.map +1 -1
  146. package/dist/integrations/fastify.js +5 -9
  147. package/dist/integrations/fastify.js.map +1 -1
  148. package/dist/integrations/flutter.d.ts.map +1 -1
  149. package/dist/integrations/flutter.js +3 -0
  150. package/dist/integrations/flutter.js.map +1 -1
  151. package/dist/integrations/go/index.d.ts +3 -0
  152. package/dist/integrations/go/index.d.ts.map +1 -0
  153. package/dist/integrations/go/index.js +199 -0
  154. package/dist/integrations/go/index.js.map +1 -0
  155. package/dist/integrations/go.d.ts.map +1 -1
  156. package/dist/integrations/go.js +5 -2
  157. package/dist/integrations/go.js.map +1 -1
  158. package/dist/integrations/java/index.d.ts +3 -0
  159. package/dist/integrations/java/index.d.ts.map +1 -0
  160. package/dist/integrations/java/index.js +472 -0
  161. package/dist/integrations/java/index.js.map +1 -0
  162. package/dist/integrations/java.d.ts.map +1 -1
  163. package/dist/integrations/java.js +5 -2
  164. package/dist/integrations/java.js.map +1 -1
  165. package/dist/integrations/js/manifest.d.ts.map +1 -1
  166. package/dist/integrations/js/manifest.js +3 -0
  167. package/dist/integrations/js/manifest.js.map +1 -1
  168. package/dist/integrations/nestjs/detect.d.ts +3 -0
  169. package/dist/integrations/nestjs/detect.d.ts.map +1 -0
  170. package/dist/integrations/nestjs/detect.js +12 -0
  171. package/dist/integrations/nestjs/detect.js.map +1 -0
  172. package/dist/integrations/nestjs/doctor.d.ts +3 -0
  173. package/dist/integrations/nestjs/doctor.d.ts.map +1 -0
  174. package/dist/integrations/nestjs/doctor.js +76 -0
  175. package/dist/integrations/nestjs/doctor.js.map +1 -0
  176. package/dist/integrations/nestjs/files.d.ts +18 -0
  177. package/dist/integrations/nestjs/files.d.ts.map +1 -0
  178. package/dist/integrations/nestjs/files.js +39 -0
  179. package/dist/integrations/nestjs/files.js.map +1 -0
  180. package/dist/integrations/nestjs/index.d.ts +3 -0
  181. package/dist/integrations/nestjs/index.d.ts.map +1 -0
  182. package/dist/integrations/nestjs/index.js +43 -0
  183. package/dist/integrations/nestjs/index.js.map +1 -0
  184. package/dist/integrations/nestjs/manifest.d.ts +3 -0
  185. package/dist/integrations/nestjs/manifest.d.ts.map +1 -0
  186. package/dist/integrations/nestjs/manifest.js +32 -0
  187. package/dist/integrations/nestjs/manifest.js.map +1 -0
  188. package/dist/integrations/nestjs/patch.d.ts +25 -0
  189. package/dist/integrations/nestjs/patch.d.ts.map +1 -0
  190. package/dist/integrations/nestjs/patch.js +66 -0
  191. package/dist/integrations/nestjs/patch.js.map +1 -0
  192. package/dist/integrations/nestjs/uninstall.d.ts +4 -0
  193. package/dist/integrations/nestjs/uninstall.d.ts.map +1 -0
  194. package/dist/integrations/nestjs/uninstall.js +18 -0
  195. package/dist/integrations/nestjs/uninstall.js.map +1 -0
  196. package/dist/integrations/nestjs.d.ts +5 -1
  197. package/dist/integrations/nestjs.d.ts.map +1 -1
  198. package/dist/integrations/nestjs.js +5 -9
  199. package/dist/integrations/nestjs.js.map +1 -1
  200. package/dist/integrations/next/index.js +2 -2
  201. package/dist/integrations/next/index.js.map +1 -1
  202. package/dist/integrations/next/manifest.d.ts.map +1 -1
  203. package/dist/integrations/next/manifest.js +4 -1
  204. package/dist/integrations/next/manifest.js.map +1 -1
  205. package/dist/integrations/next/patch.js +8 -3
  206. package/dist/integrations/next/patch.js.map +1 -1
  207. package/dist/integrations/next/uninstall.d.ts.map +1 -1
  208. package/dist/integrations/next/uninstall.js +10 -1
  209. package/dist/integrations/next/uninstall.js.map +1 -1
  210. package/dist/integrations/otel.d.ts.map +1 -1
  211. package/dist/integrations/otel.js +4 -1
  212. package/dist/integrations/otel.js.map +1 -1
  213. package/dist/integrations/php.d.ts.map +1 -1
  214. package/dist/integrations/php.js +16 -3
  215. package/dist/integrations/php.js.map +1 -1
  216. package/dist/integrations/python/index.d.ts +3 -0
  217. package/dist/integrations/python/index.d.ts.map +1 -0
  218. package/dist/integrations/python/index.js +222 -0
  219. package/dist/integrations/python/index.js.map +1 -0
  220. package/dist/integrations/python.d.ts.map +1 -1
  221. package/dist/integrations/python.js +5 -2
  222. package/dist/integrations/python.js.map +1 -1
  223. package/dist/integrations/react/doctor.d.ts.map +1 -1
  224. package/dist/integrations/react/doctor.js +41 -8
  225. package/dist/integrations/react/doctor.js.map +1 -1
  226. package/dist/integrations/react/index.d.ts.map +1 -1
  227. package/dist/integrations/react/index.js +1 -4
  228. package/dist/integrations/react/index.js.map +1 -1
  229. package/dist/integrations/react/manifest.d.ts.map +1 -1
  230. package/dist/integrations/react/manifest.js +4 -1
  231. package/dist/integrations/react/manifest.js.map +1 -1
  232. package/dist/integrations/react/patch.d.ts.map +1 -1
  233. package/dist/integrations/react/patch.js +120 -8
  234. package/dist/integrations/react/patch.js.map +1 -1
  235. package/dist/integrations/react/uninstall.d.ts.map +1 -1
  236. package/dist/integrations/react/uninstall.js +20 -1
  237. package/dist/integrations/react/uninstall.js.map +1 -1
  238. package/dist/integrations/react-native.d.ts.map +1 -1
  239. package/dist/integrations/react-native.js +3 -0
  240. package/dist/integrations/react-native.js.map +1 -1
  241. package/dist/integrations/ruby.d.ts.map +1 -1
  242. package/dist/integrations/ruby.js +3 -0
  243. package/dist/integrations/ruby.js.map +1 -1
  244. package/dist/output/human.d.ts.map +1 -1
  245. package/dist/output/human.js +38 -7
  246. package/dist/output/human.js.map +1 -1
  247. package/dist/registry/index.d.ts.map +1 -1
  248. package/dist/registry/index.js +9 -23
  249. package/dist/registry/index.js.map +1 -1
  250. package/dist/registry/manifest.d.ts +8 -0
  251. package/dist/registry/manifest.d.ts.map +1 -1
  252. package/dist/security-snapshot/builder.d.ts +3 -0
  253. package/dist/security-snapshot/builder.d.ts.map +1 -0
  254. package/dist/security-snapshot/builder.js +343 -0
  255. package/dist/security-snapshot/builder.js.map +1 -0
  256. package/dist/security-snapshot/client.d.ts +3 -0
  257. package/dist/security-snapshot/client.d.ts.map +1 -0
  258. package/dist/security-snapshot/client.js +38 -0
  259. package/dist/security-snapshot/client.js.map +1 -0
  260. package/dist/security-snapshot/index.d.ts +4 -0
  261. package/dist/security-snapshot/index.d.ts.map +1 -0
  262. package/dist/security-snapshot/index.js +3 -0
  263. package/dist/security-snapshot/index.js.map +1 -0
  264. package/dist/security-snapshot/types.d.ts +57 -0
  265. package/dist/security-snapshot/types.d.ts.map +1 -0
  266. package/dist/security-snapshot/types.js +2 -0
  267. package/dist/security-snapshot/types.js.map +1 -0
  268. package/dist/sourcemaps/next.js +3 -3
  269. package/dist/sourcemaps/next.js.map +1 -1
  270. package/dist/sourcemaps/vite.d.ts.map +1 -1
  271. package/dist/sourcemaps/vite.js +92 -9
  272. package/dist/sourcemaps/vite.js.map +1 -1
  273. package/docs/architecture/v02-sourcemaps-e2e-spec.md +1 -1
  274. package/docs/beta/expo.md +69 -0
  275. package/docs/beta/fastify.md +62 -0
  276. package/docs/beta/known-limitations.md +14 -14
  277. package/docs/beta/nestjs.md +69 -0
  278. package/docs/beta/next.md +7 -8
  279. package/docs/beta/react.md +23 -15
  280. package/docs/beta/reliability.md +33 -0
  281. package/package.json +11 -3
@@ -1,9 +1,22 @@
1
1
  import { simpleScaffold } from './_simple-scaffold.js';
2
2
  export const phpIntegration = simpleScaffold({
3
3
  id: 'php',
4
- title: 'PHP / Laravel',
4
+ title: 'PHP / Laravel (manual setup only)',
5
5
  sdkPackage: 'allstak/sdk-php',
6
- stability: 'experimental',
7
- reason: 'PHP scaffolding writes env vars only; composer.json mutation and Laravel service-provider registration are not auto-applied in v0.1.',
6
+ stability: 'unsupported',
7
+ runtimeStatus: 'experimental',
8
+ wizardAutomation: 'unsupported',
9
+ public: false,
10
+ reason: 'Laravel/PHP automated onboarding is intentionally unsupported until composer.json mutation, Laravel service-provider registration, request middleware, DB instrumentation, and fixture builds are validated. Use the PHP SDK README for manual setup.',
11
+ capabilities: [],
12
+ unsupportedCapabilities: [
13
+ 'install-package',
14
+ 'write-env',
15
+ 'patch-entry',
16
+ 'patch-framework-config',
17
+ 'wire-source-maps',
18
+ 'live-validate-event',
19
+ ],
20
+ docsUrl: 'https://github.com/allstak-io/sdks/tree/main/allstak-php-sdk#readme',
8
21
  });
9
22
  //# sourceMappingURL=php.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"php.js","sourceRoot":"","sources":["../../src/integrations/php.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,eAAe;IACtB,UAAU,EAAE,iBAAiB;IAC7B,SAAS,EAAE,cAAc;IACzB,MAAM,EACJ,sIAAsI;CACzI,CAAC,CAAC"}
1
+ {"version":3,"file":"php.js","sourceRoot":"","sources":["../../src/integrations/php.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,mCAAmC;IAC1C,UAAU,EAAE,iBAAiB;IAC7B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,cAAc;IAC7B,gBAAgB,EAAE,aAAa;IAC/B,MAAM,EAAE,KAAK;IACb,MAAM,EACJ,uPAAuP;IACzP,YAAY,EAAE,EAAE;IAChB,uBAAuB,EAAE;QACvB,iBAAiB;QACjB,WAAW;QACX,aAAa;QACb,wBAAwB;QACxB,kBAAkB;QAClB,qBAAqB;KACtB;IACD,OAAO,EAAE,qEAAqE;CAC/E,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Integration } from '../../registry/types.js';
2
+ export declare const pythonIntegration: Integration;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/python/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAA4C,MAAM,yBAAyB,CAAC;AA2ErG,eAAO,MAAM,iBAAiB,EAAE,WA2E/B,CAAC"}
@@ -0,0 +1,222 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { writeStandardEnv, removeStandardEnv } from '../_shared.js';
4
+ /**
5
+ * AllStak Python integration for the wizard.
6
+ *
7
+ * Python projects are not patched at the source-AST level (we don't auto-edit
8
+ * user code in main.py / asgi.py / wsgi.py — too many shapes, too easy to
9
+ * regress). Instead the wizard:
10
+ *
11
+ * - confirms the project is a real Python project (pyproject.toml or
12
+ * requirements.txt) and surfaces which web framework was detected,
13
+ * - writes the standard ALLSTAK_* env vars to .env, idempotently,
14
+ * - validates that the customer has installed the `allstak` package and
15
+ * populated the env file,
16
+ * - on uninstall, cleanly removes the env block.
17
+ *
18
+ * Package install/uninstall is intentionally a no-op: the wizard's package-
19
+ * manager abstraction is JS-only (npm/pnpm/yarn/bun), and we'd rather print
20
+ * a precise pip/poetry instruction than half-automate it. This mirrors the
21
+ * Java integration.
22
+ */
23
+ const SDK_PACKAGE = 'allstak';
24
+ function inspectProject(projectRoot) {
25
+ const pyprojectPath = resolve(projectRoot, 'pyproject.toml');
26
+ const requirementsPath = resolve(projectRoot, 'requirements.txt');
27
+ const hasPyproject = existsSync(pyprojectPath);
28
+ const hasRequirements = existsSync(requirementsPath);
29
+ const evidence = [];
30
+ if (hasPyproject)
31
+ evidence.push('pyproject.toml');
32
+ if (hasRequirements)
33
+ evidence.push('requirements.txt');
34
+ const declared = collectDeclaredDeps(projectRoot, hasPyproject, hasRequirements);
35
+ let pythonFramework = 'unknown';
36
+ if (declared.has('fastapi'))
37
+ pythonFramework = 'fastapi';
38
+ else if (declared.has('django'))
39
+ pythonFramework = 'django';
40
+ else if (declared.has('flask'))
41
+ pythonFramework = 'flask';
42
+ if (pythonFramework !== 'unknown')
43
+ evidence.push(`framework: ${pythonFramework}`);
44
+ return { hasPyproject, hasRequirements, pythonFramework, evidence };
45
+ }
46
+ function collectDeclaredDeps(projectRoot, hasPyproject, hasRequirements) {
47
+ const found = new Set();
48
+ if (hasPyproject) {
49
+ try {
50
+ const text = readFileSync(resolve(projectRoot, 'pyproject.toml'), 'utf8');
51
+ // Best-effort: don't bring a TOML parser. Match `"x"` and `"x>=…"` strings
52
+ // anywhere in the file — that catches PEP 621 / poetry / hatch dependency arrays
53
+ // without trying to interpret which array they belong to.
54
+ const matches = text.matchAll(/["']([a-zA-Z0-9_.-]+)(?:\[[^\]]+\])?(?:[<>=!~]=?[^"']*)?["']/g);
55
+ for (const m of matches)
56
+ found.add(m[1].toLowerCase());
57
+ }
58
+ catch { /* ignore */ }
59
+ }
60
+ if (hasRequirements) {
61
+ try {
62
+ const text = readFileSync(resolve(projectRoot, 'requirements.txt'), 'utf8');
63
+ for (const raw of text.split(/\r?\n/)) {
64
+ const line = raw.trim();
65
+ if (!line || line.startsWith('#') || line.startsWith('-'))
66
+ continue;
67
+ const m = line.match(/^([a-zA-Z0-9_.-]+)/);
68
+ if (m)
69
+ found.add(m[1].toLowerCase());
70
+ }
71
+ }
72
+ catch { /* ignore */ }
73
+ }
74
+ return found;
75
+ }
76
+ export const pythonIntegration = {
77
+ id: 'python',
78
+ manifest: {
79
+ id: 'python',
80
+ title: 'Python (FastAPI / Flask / Django)',
81
+ sdkPackage: SDK_PACKAGE,
82
+ additionalPackages: [],
83
+ stability: 'beta',
84
+ runtimeStatus: 'beta',
85
+ wizardAutomation: 'assisted',
86
+ public: true,
87
+ stabilityNote: 'Runtime Beta (certification score 34). Wizard writes ALLSTAK_* env vars, verifies the allstak package is declared, and reports framework-specific setup. Package install is left to the user (pip / poetry / uv).',
88
+ capabilities: ['write-env'],
89
+ unsupportedCapabilities: ['install-package', 'patch-entry', 'live-validate-event'],
90
+ compatibility: [],
91
+ files: [
92
+ { path: 'pyproject.toml', kind: 'optional', description: 'Python project metadata (PEP 621 / poetry / hatch)' },
93
+ { path: 'requirements.txt', kind: 'optional', description: 'pip requirements file' },
94
+ { path: '.env', kind: 'created', description: 'AllStak environment variables' },
95
+ ],
96
+ supportedPackageManagers: [],
97
+ docsUrl: 'https://docs.allstak.dev/sdks/python',
98
+ },
99
+ async detect(ctx) {
100
+ const project = inspectProject(ctx.projectRoot);
101
+ if (!project.hasPyproject && !project.hasRequirements) {
102
+ return { ok: false, reason: 'No pyproject.toml or requirements.txt found' };
103
+ }
104
+ return { ok: true, reason: project.evidence.join(', ') };
105
+ },
106
+ async plan(ctx) {
107
+ const project = inspectProject(ctx.projectRoot);
108
+ const lines = [];
109
+ lines.push(`detect Python project (${project.pythonFramework})`);
110
+ lines.push(`write ALLSTAK_* to .env`);
111
+ lines.push(`verify ${SDK_PACKAGE} is declared as a dependency (manual install: pip install ${SDK_PACKAGE})`);
112
+ if (project.pythonFramework === 'fastapi') {
113
+ lines.push('FastAPI detected — recommend AllStakFastAPI(app) in your app factory');
114
+ }
115
+ else if (project.pythonFramework === 'flask') {
116
+ lines.push('Flask detected — recommend AllStakFlask(app) in your app factory');
117
+ }
118
+ else if (project.pythonFramework === 'django') {
119
+ lines.push('Django detected — recommend adding allstak.integrations.django.AllStakMiddleware to MIDDLEWARE');
120
+ }
121
+ else {
122
+ lines.push('No web framework detected — only the Python client init is required (allstak.init(...))');
123
+ }
124
+ return lines;
125
+ },
126
+ // Intentionally a no-op: pip / poetry / uv are out of scope for the
127
+ // wizard's package-manager abstraction (npm/pnpm/yarn/bun). The user
128
+ // runs `pip install allstak` themselves; we verify it via doctor().
129
+ async install() { },
130
+ async patch(ctx, tx) {
131
+ await writeStandardEnv(ctx, tx, '.env');
132
+ },
133
+ async validate(ctx) {
134
+ return doctorPython(ctx);
135
+ },
136
+ async uninstall(ctx, tx) {
137
+ await removeStandardEnv(tx, resolve(ctx.projectRoot, '.env'));
138
+ },
139
+ async repair(ctx, tx) {
140
+ await writeStandardEnv(ctx, tx, '.env');
141
+ },
142
+ async doctor(ctx) {
143
+ return doctorPython(ctx);
144
+ },
145
+ };
146
+ function doctorPython(ctx) {
147
+ const project = inspectProject(ctx.projectRoot);
148
+ const declared = collectDeclaredDeps(ctx.projectRoot, project.hasPyproject, project.hasRequirements);
149
+ const checks = [];
150
+ checks.push({
151
+ name: 'python-project',
152
+ status: project.hasPyproject || project.hasRequirements ? 'pass' : 'fail',
153
+ detail: project.hasPyproject || project.hasRequirements
154
+ ? `found ${project.evidence.join(', ')}`
155
+ : 'no pyproject.toml or requirements.txt at project root',
156
+ fix: 'create a pyproject.toml or requirements.txt for your Python project',
157
+ });
158
+ const sdkDeclared = declared.has(SDK_PACKAGE);
159
+ checks.push({
160
+ name: 'sdk-declared',
161
+ status: sdkDeclared ? 'pass' : 'warn',
162
+ detail: sdkDeclared
163
+ ? `${SDK_PACKAGE} is declared in project dependencies`
164
+ : `${SDK_PACKAGE} is not declared in pyproject.toml or requirements.txt`,
165
+ fix: `add ${SDK_PACKAGE} to your dependencies (pip install ${SDK_PACKAGE} && pip freeze | grep -i ${SDK_PACKAGE} >> requirements.txt)`,
166
+ });
167
+ const envPath = resolve(ctx.projectRoot, '.env');
168
+ let envOk = false;
169
+ let envDetail = '.env not found';
170
+ if (existsSync(envPath)) {
171
+ try {
172
+ const text = readFileSync(envPath, 'utf8');
173
+ envOk = /^\s*ALLSTAK_API_KEY\s*=/m.test(text);
174
+ envDetail = envOk ? '.env declares ALLSTAK_API_KEY' : '.env present but ALLSTAK_API_KEY is missing';
175
+ }
176
+ catch (e) {
177
+ envDetail = `failed to read .env: ${e.message}`;
178
+ }
179
+ }
180
+ checks.push({
181
+ name: 'env-vars',
182
+ status: envOk ? 'pass' : 'warn',
183
+ detail: envDetail,
184
+ fix: 'run `allstak-wizard install` (or set ALLSTAK_API_KEY in .env manually)',
185
+ });
186
+ if (project.pythonFramework === 'fastapi') {
187
+ checks.push({
188
+ name: 'fastapi-setup',
189
+ status: 'warn',
190
+ detail: 'Wizard cannot auto-edit your FastAPI app code. Wire AllStakFastAPI(app) yourself.',
191
+ fix: 'from allstak.integrations.fastapi import AllStakFastAPI; AllStakFastAPI(app, service="...")',
192
+ });
193
+ }
194
+ else if (project.pythonFramework === 'flask') {
195
+ checks.push({
196
+ name: 'flask-setup',
197
+ status: 'warn',
198
+ detail: 'Wizard cannot auto-edit your Flask app code. Wire AllStakFlask(app) yourself.',
199
+ fix: 'from allstak.integrations.flask import AllStakFlask; AllStakFlask(app)',
200
+ });
201
+ }
202
+ else if (project.pythonFramework === 'django') {
203
+ checks.push({
204
+ name: 'django-setup',
205
+ status: 'warn',
206
+ detail: 'Wizard cannot auto-edit Django settings. Add the AllStak middleware yourself.',
207
+ fix: "MIDDLEWARE = ['allstak.integrations.django.AllStakMiddleware', ...]",
208
+ });
209
+ }
210
+ else {
211
+ checks.push({
212
+ name: 'framework-setup',
213
+ status: 'skip',
214
+ detail: 'No web framework detected — only allstak.init(...) is required at process startup.',
215
+ });
216
+ }
217
+ const failed = checks.some((c) => c.status === 'fail');
218
+ const warned = checks.some((c) => c.status === 'warn');
219
+ const summary = failed ? 'broken' : warned ? 'degraded' : 'ok';
220
+ return { integration: 'python', checks, summary };
221
+ }
222
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/python/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,GAAG,SAAS,CAAC;AAS9B,SAAS,cAAc,CAAC,WAAmB;IACzC,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAC7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,YAAY;QAAE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClD,IAAI,eAAe;QAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;IACjF,IAAI,eAAe,GAAqC,SAAS,CAAC;IAClE,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,eA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M,iBAAiB,mCAO5B,CAAC"}
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/integrations/python.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,mCAU5B,CAAC"}
@@ -3,7 +3,10 @@ export const pythonIntegration = simpleScaffold({
3
3
  id: 'python',
4
4
  title: 'Python (FastAPI / Django / Flask)',
5
5
  sdkPackage: 'allstak (PyPI)',
6
- stability: 'experimental',
7
- reason: 'Python scaffolding writes env vars only. Entry-point patching across Django settings.py / FastAPI app factory / Flask create_app is not auto-applied in v0.1; users must call `allstak.init(...)` themselves.',
6
+ stability: 'beta',
7
+ runtimeStatus: 'beta',
8
+ wizardAutomation: 'manual',
9
+ public: true,
10
+ reason: 'Runtime SDK is Beta (certification score 34). Wizard automation is manual/light setup only: env vars are written, but Django settings.py, FastAPI app factory, and Flask create_app are not patched automatically in v0.1.',
8
11
  });
9
12
  //# sourceMappingURL=python.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/integrations/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC9C,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,mCAAmC;IAC1C,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,cAAc;IACzB,MAAM,EACJ,+MAA+M;CAClN,CAAC,CAAC"}
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/integrations/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC9C,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,mCAAmC;IAC1C,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,QAAQ;IAC1B,MAAM,EAAE,IAAI;IACZ,MAAM,EACJ,4NAA4N;CAC/N,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,yBAAyB,CAAC;AAMxF,wBAAsB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA8D3E"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,yBAAyB,CAAC;AAMxF,wBAAsB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAgF3E"}
@@ -14,21 +14,39 @@ export async function doctorReact(ctx) {
14
14
  fix: installed ? undefined : `Run: allstak-wizard -i react`,
15
15
  });
16
16
  const envPath = resolve(ctx.projectRoot, envFileFor(ctx));
17
- const envOk = existsSync(envPath) && readFileSync(envPath, 'utf8').includes('ALLSTAK_API_KEY');
17
+ const envText = existsSync(envPath) ? readFileSync(envPath, 'utf8') : '';
18
+ const envOk = /\b(?:VITE_)?ALLSTAK_API_KEY\s*=/.test(envText);
18
19
  checks.push({
19
20
  name: 'env-vars',
20
21
  status: envOk ? 'pass' : 'warn',
21
- detail: envOk ? envFileFor(ctx) : 'ALLSTAK_API_KEY not found in env file',
22
+ detail: envOk ? envFileFor(ctx) : 'ALLSTAK_API_KEY or VITE_ALLSTAK_API_KEY not found in env file',
22
23
  });
23
24
  const entry = locateEntry(ctx.projectRoot);
24
25
  if (entry) {
25
26
  const src = readFileSync(entry, 'utf8');
26
- const wrapped = src.includes('AllStakProvider') || src.includes('allstak-wizard:');
27
+ const semantic = inspectReactEntry(src);
27
28
  checks.push({
28
- name: 'entry-patched',
29
- status: wrapped ? 'pass' : 'fail',
30
- detail: wrapped ? entry : `${entry} does not include AllStakProvider`,
31
- fix: wrapped ? undefined : 'Run: allstak-wizard repair -i react',
29
+ name: 'runtime-init',
30
+ status: semantic.hasInit ? 'pass' : 'fail',
31
+ detail: semantic.hasInit
32
+ ? 'AllStak init or AllStakProvider configuration found'
33
+ : `${entry} does not configure AllStak runtime`,
34
+ fix: semantic.hasInit ? undefined : 'Run: allstak-wizard repair -i react',
35
+ });
36
+ checks.push({
37
+ name: 'render-boundary',
38
+ status: semantic.hasBoundary ? 'pass' : 'fail',
39
+ detail: semantic.hasBoundary
40
+ ? 'AllStak provider/error boundary found in render tree'
41
+ : `${entry} does not wrap the React render tree with AllStakProvider or AllStakErrorBoundary`,
42
+ fix: semantic.hasBoundary ? undefined : 'Run: allstak-wizard repair -i react',
43
+ });
44
+ checks.push({
45
+ name: 'duplicate-setup',
46
+ status: semantic.duplicateSetup ? 'warn' : 'pass',
47
+ detail: semantic.duplicateSetup
48
+ ? 'Multiple AllStak root providers/boundaries detected; review for duplicate setup'
49
+ : 'No duplicate root setup detected',
32
50
  });
33
51
  }
34
52
  else {
@@ -51,7 +69,7 @@ export async function doctorReact(ctx) {
51
69
  ? `wired in ${status.configFile}`
52
70
  : status.state === 'drifted'
53
71
  ? `drift: ${status.reason}`
54
- : '@allstak/js/vite plugin not wired (source maps disabled)',
72
+ : '@allstak/react/vite source-map plugin not wired (source maps disabled)',
55
73
  });
56
74
  }
57
75
  }
@@ -62,4 +80,19 @@ export async function doctorReact(ctx) {
62
80
  : 'ok';
63
81
  return { integration: 'react', checks, summary };
64
82
  }
83
+ function inspectReactEntry(src) {
84
+ const semantic = src.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
85
+ const providerTags = semantic.match(/<AllStakProvider\b/g)?.length ?? 0;
86
+ const boundaryTags = semantic.match(/<AllStakErrorBoundary\b/g)?.length ?? 0;
87
+ const rootTags = semantic.match(/<AllStakRoot\b/g)?.length ?? 0;
88
+ const hasProviderImport = /from\s+['"]@allstak\/react['"]/.test(semantic)
89
+ && /\b(AllStakProvider|AllStakErrorBoundary|AllStak)\b/.test(semantic);
90
+ const hasProviderInit = providerTags > 0 || /AllStak\.init\s*\(/.test(semantic);
91
+ const hasBoundary = providerTags > 0 || boundaryTags > 0 || rootTags > 0;
92
+ return {
93
+ hasInit: hasProviderImport && hasProviderInit,
94
+ hasBoundary: hasProviderImport && hasBoundary,
95
+ duplicateSetup: providerTags + boundaryTags + rootTags > 2,
96
+ };
97
+ }
65
98
  //# sourceMappingURL=doctor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/integrations/react/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAkB;IAClD,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5E,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QACnC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,yBA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B,CAAC;AAU1E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,EAAE,WA+C9B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAU1E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,EAAE,WA4C9B,CAAC"}
@@ -32,15 +32,12 @@ export const reactIntegration = {
32
32
  const entry = locateEntry(ctx.projectRoot);
33
33
  lines.push(entry ? `patch entry: ${entry}` : `create entry init block (no entry detected)`);
34
34
  if (ctx.detected.hasViteConfig && !ctx.skipSourceMaps) {
35
- lines.push(`wire @allstak/js Vite plugin in vite.config.*`);
35
+ lines.push(`wire @allstak/react Vite source-map plugin in vite.config.*`);
36
36
  }
37
37
  return lines;
38
38
  },
39
39
  async install(ctx) {
40
40
  const packages = [reactManifest.sdkPackage];
41
- if (ctx.detected.hasViteConfig && !ctx.skipSourceMaps) {
42
- packages.push('@allstak/js');
43
- }
44
41
  await runPackageInstall(ctx, packages);
45
42
  },
46
43
  async patch(ctx, tx) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBA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EAAE,MAAM,4BAA4B,CAAC;AAEtE,eAAO,MAAM,aAAa,EAAE,mBA6B3B,CAAC"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,eAAO,MAAM,aAAa,EAAE,mBAgC3B,CAAC"}
@@ -2,8 +2,11 @@ export const reactManifest = {
2
2
  id: 'react',
3
3
  title: 'React (browser, Vite or CRA)',
4
4
  sdkPackage: '@allstak/react',
5
- additionalPackages: ['@allstak/js'],
5
+ additionalPackages: [],
6
6
  stability: 'stable',
7
+ runtimeStatus: 'stable',
8
+ wizardAutomation: 'assisted',
9
+ public: true,
7
10
  stabilityNote: null,
8
11
  capabilities: [
9
12
  'install-package',
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/integrations/react/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,8BAA8B;IACrC,UAAU,EAAE,gBAAgB;IAC5B,kBAAkB,EAAE,CAAC,aAAa,CAAC;IACnC,SAAS,EAAE,QAAQ;IACnB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE;QACZ,iBAAiB;QACjB,WAAW;QACX,aAAa;QACb,sBAAsB;QACtB,kBAAkB;KACnB;IACD,uBAAuB,EAAE,CAAC,qBAAqB,EAAE,iBAAiB,EAAE,qBAAqB,CAAC;IAC1F,aAAa,EAAE;QACb,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/E;IACD,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0CAA0C,EAAE;QAChG,EAAE,IAAI,EA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AI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0CAA0C,EAAE;QAChG,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE;QAC3E,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE;QAC1C,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE;QAC3E,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE;QAC3C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,4CAA4C,EAAE;QACvG,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE;KAC7C;IACD,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC;IACtE,OAAO,EAAE,mEAAmE;CAC7E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAU7D,wBAAsB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CASnF"}
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/integrations/react/patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAY7D,wBAAsB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CASnF"}
@@ -1,3 +1,5 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { parseModule } from 'magicast';
1
3
  import { writeStandardEnv } from '../_shared.js';
2
4
  import { patchJsModule, ensureImport } from '../../patchers/js-ast.js';
3
5
  import { appendManagedBlock } from '../../patchers/source-block.js';
@@ -24,16 +26,126 @@ async function patchEntry(ctx, tx) {
24
26
  await patchJsModule(tx, entry, (mod) => {
25
27
  ensureImport(mod, { from: PKG, named: ['AllStakProvider'] });
26
28
  });
29
+ const current = readFileSync(entry, 'utf8');
30
+ if (isReactEntryAlreadyIntegrated(current)) {
31
+ return;
32
+ }
33
+ const patched = patchReactRenderTree(current, ctx);
34
+ if (patched.changed) {
35
+ await tx.write(entry, patched.code, async (_path, content) => {
36
+ parseModule(content);
37
+ });
38
+ return;
39
+ }
27
40
  const block = [
28
- `// allstak-wizard: import this provider into your render tree.`,
29
- `// Example:`,
30
- `// <AllStakProvider apiKey={import.meta.env?.VITE_ALLSTAK_API_KEY ?? process.env.ALLSTAK_API_KEY}`,
31
- `// environment={'${ctx.environment}'}`,
32
- `// release={'${ctx.release ?? ''}'}>`,
33
- `// <App />`,
34
- `// </AllStakProvider>`,
35
- `// (Wizard does NOT rewrite ReactDOM.createRoot to avoid breaking custom roots.)`,
41
+ `// allstak-wizard: manual review required.`,
42
+ `// The wizard imported AllStakProvider but could not safely wrap the root render call.`,
43
+ `// Wrap your existing createRoot(...).render(...) tree with:`,
44
+ `// <AllStakRoot>`,
45
+ `// ...existing app tree...`,
46
+ `// </AllStakRoot>`,
36
47
  ].join('\n');
37
48
  await appendManagedBlock(tx, entry, block, { style: 'slash', validateJs: true });
38
49
  }
50
+ function isReactEntryAlreadyIntegrated(src) {
51
+ const semantic = stripComments(src);
52
+ return semantic.includes('<AllStakProvider') || semantic.includes('<AllStakRoot');
53
+ }
54
+ function patchReactRenderTree(src, ctx) {
55
+ if (stripComments(src).includes('<AllStakProvider') || stripComments(src).includes('<AllStakRoot')) {
56
+ return { changed: false, code: src };
57
+ }
58
+ const renderStart = src.indexOf('.render(');
59
+ if (renderStart < 0)
60
+ return { changed: false, code: src };
61
+ const open = src.indexOf('(', renderStart);
62
+ const close = findMatching(src, open, '(', ')');
63
+ if (open < 0 || close < 0)
64
+ return { changed: false, code: src };
65
+ const renderBody = src.slice(open + 1, close).trim();
66
+ if (!renderBody || renderBody.includes('AllStakRoot') || renderBody.includes('AllStakProvider')) {
67
+ return { changed: false, code: src };
68
+ }
69
+ let code = src;
70
+ code = ensureReactNodeImport(code);
71
+ code = ensureAllStakRootComponent(code, ctx);
72
+ const adjustedOpen = code.indexOf('.render(');
73
+ const adjustedParen = code.indexOf('(', adjustedOpen);
74
+ const adjustedClose = findMatching(code, adjustedParen, '(', ')');
75
+ if (adjustedOpen < 0 || adjustedParen < 0 || adjustedClose < 0) {
76
+ return { changed: false, code: src };
77
+ }
78
+ const adjustedBody = code.slice(adjustedParen + 1, adjustedClose).trim();
79
+ const wrapped = `\n <AllStakRoot>\n ${adjustedBody}\n </AllStakRoot>,\n`;
80
+ code = `${code.slice(0, adjustedParen + 1)}${wrapped}${code.slice(adjustedClose)}`;
81
+ return { changed: code !== src, code };
82
+ }
83
+ function ensureReactNodeImport(src) {
84
+ if (src.includes("from 'react'") && src.includes('ReactNode'))
85
+ return src;
86
+ if (src.includes('from "react"') && src.includes('ReactNode'))
87
+ return src;
88
+ if (/import\s+type\s+\{\s*ReactNode\s*\}\s+from\s+['"]react['"]/.test(src))
89
+ return src;
90
+ return `import type { ReactNode } from 'react';\n${src}`;
91
+ }
92
+ function ensureAllStakRootComponent(src, ctx) {
93
+ if (src.includes('function AllStakRoot('))
94
+ return src;
95
+ const component = [
96
+ '',
97
+ 'function AllStakRoot({ children }: { children: ReactNode }) {',
98
+ ' const apiKey = import.meta.env.VITE_ALLSTAK_API_KEY;',
99
+ ' if (!apiKey) return <>{children}</>;',
100
+ ' return (',
101
+ ' <AllStakProvider',
102
+ ' apiKey={apiKey}',
103
+ ' host={import.meta.env.VITE_ALLSTAK_HOST}',
104
+ ` environment={import.meta.env.VITE_ALLSTAK_ENVIRONMENT ?? '${ctx.environment}'}`,
105
+ ` release={import.meta.env.VITE_ALLSTAK_RELEASE ?? '${ctx.release ?? ''}'}`,
106
+ ' enableHttpTracking',
107
+ ' tracesSampleRate={1}',
108
+ ' >',
109
+ ' {children}',
110
+ ' </AllStakProvider>',
111
+ ' );',
112
+ '}',
113
+ '',
114
+ ].join('\n');
115
+ const renderIndex = src.indexOf('.render(');
116
+ if (renderIndex < 0)
117
+ return src;
118
+ const lineStart = src.lastIndexOf('\n', renderIndex);
119
+ return `${src.slice(0, lineStart + 1)}${component}${src.slice(lineStart + 1)}`;
120
+ }
121
+ function findMatching(src, openIndex, openChar, closeChar) {
122
+ if (openIndex < 0 || src[openIndex] !== openChar)
123
+ return -1;
124
+ let depth = 0;
125
+ let quote = null;
126
+ for (let i = openIndex; i < src.length; i += 1) {
127
+ const ch = src[i];
128
+ const prev = src[i - 1];
129
+ if (quote) {
130
+ if (ch === quote && prev !== '\\')
131
+ quote = null;
132
+ continue;
133
+ }
134
+ if (ch === '"' || ch === "'" || ch === '`') {
135
+ quote = ch;
136
+ continue;
137
+ }
138
+ if (ch === openChar)
139
+ depth += 1;
140
+ if (ch === closeChar) {
141
+ depth -= 1;
142
+ if (depth === 0)
143
+ return i;
144
+ }
145
+ }
146
+ return -1;
147
+ }
148
+ function stripComments(src) {
149
+ return src.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
150
+ }
39
151
  //# sourceMappingURL=patch.js.map