@omega.js/manager 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (416) hide show
  1. package/.claude-plugin/marketplace.json +14 -0
  2. package/LICENSE +98 -0
  3. package/README.md +165 -0
  4. package/bin/omega +2 -0
  5. package/bin/omg +2 -0
  6. package/claude-plugin/.claude-plugin/plugin.json +11 -0
  7. package/claude-plugin/.mcp.json +9 -0
  8. package/claude-plugin/README.md +139 -0
  9. package/claude-plugin/hooks/gate/mark.sh +58 -0
  10. package/claude-plugin/hooks/gate/run.sh +97 -0
  11. package/claude-plugin/hooks/guard/run.sh +249 -0
  12. package/claude-plugin/hooks/hooks.json +63 -0
  13. package/claude-plugin/hooks/inject/run.sh +127 -0
  14. package/claude-plugin/hooks/lib/omega-gate.sh +20 -0
  15. package/claude-plugin/hooks/lib/omega-scope.sh +41 -0
  16. package/claude-plugin/hooks/lib/omega-skills.sh +209 -0
  17. package/claude-plugin/hooks/quality/run.sh +132 -0
  18. package/claude-plugin/hooks/shape/run.sh +45 -0
  19. package/claude-plugin/mcp-router-launch.js +29 -0
  20. package/claude-plugin/skills/README.md +48 -0
  21. package/claude-plugin/skills/accessibility/SKILL.md +31 -0
  22. package/claude-plugin/skills/analytics/SKILL.md +30 -0
  23. package/claude-plugin/skills/backend/SKILL.md +25 -0
  24. package/claude-plugin/skills/brandcheck/SKILL.md +29 -0
  25. package/claude-plugin/skills/browser/SKILL.md +64 -0
  26. package/claude-plugin/skills/client/SKILL.md +24 -0
  27. package/claude-plugin/skills/desktop/SKILL.md +25 -0
  28. package/claude-plugin/skills/extension/SKILL.md +25 -0
  29. package/claude-plugin/skills/main/SKILL.md +54 -0
  30. package/claude-plugin/skills/manager/SKILL.md +25 -0
  31. package/claude-plugin/skills/seo/SKILL.md +36 -0
  32. package/claude-plugin/skills/theme/SKILL.md +33 -0
  33. package/claude-plugin/skills/web/SKILL.md +29 -0
  34. package/dist/cli-run.js +34 -0
  35. package/dist/cli.js +29 -0
  36. package/dist/commands/build.js +17 -0
  37. package/dist/commands/clean.js +16 -0
  38. package/dist/commands/company.js +46 -0
  39. package/dist/commands/deploy.js +143 -0
  40. package/dist/commands/dev.js +437 -0
  41. package/dist/commands/devlog.js +25 -0
  42. package/dist/commands/help.js +48 -0
  43. package/dist/commands/manage.js +53 -0
  44. package/dist/commands/migrate.js +76 -0
  45. package/dist/commands/onboard.js +31 -0
  46. package/dist/commands/pipeline.js +319 -0
  47. package/dist/commands/test.js +380 -0
  48. package/dist/commands/update.js +128 -0
  49. package/dist/commands/version.js +8 -0
  50. package/dist/company-init.js +167 -0
  51. package/dist/company.js +283 -0
  52. package/dist/config.js +1359 -0
  53. package/dist/devlog/index.js +226 -0
  54. package/dist/devlog/lib/collect-commits.js +136 -0
  55. package/dist/devlog/lib/generate-post.js +201 -0
  56. package/dist/devlog/lib/ghostii.js +122 -0
  57. package/dist/devlog/lib/project-map.js +98 -0
  58. package/dist/devlog/lib/publish-website.js +88 -0
  59. package/dist/index.js +45 -0
  60. package/dist/lib/agents-md.js +201 -0
  61. package/dist/lib/analytics-secret.js +22 -0
  62. package/dist/lib/argv.js +21 -0
  63. package/dist/lib/auth-admin.js +120 -0
  64. package/dist/lib/automation-client.js +210 -0
  65. package/dist/lib/backend-marketing.js +49 -0
  66. package/dist/lib/brand.js +240 -0
  67. package/dist/lib/bundle-id.js +53 -0
  68. package/dist/lib/claude-settings.js +125 -0
  69. package/dist/lib/company-scaffold.js +213 -0
  70. package/dist/lib/company.js +227 -0
  71. package/dist/lib/config-flow.js +350 -0
  72. package/dist/lib/config-write.js +41 -0
  73. package/dist/lib/custom-target.js +75 -0
  74. package/dist/lib/domain-utils.js +19 -0
  75. package/dist/lib/duration.js +39 -0
  76. package/dist/lib/env-order.js +236 -0
  77. package/dist/lib/env-secret.js +78 -0
  78. package/dist/lib/firestore-rest.js +326 -0
  79. package/dist/lib/framework-bin.js +156 -0
  80. package/dist/lib/gitignore.js +63 -0
  81. package/dist/lib/google-auth.js +495 -0
  82. package/dist/lib/google-token.js +66 -0
  83. package/dist/lib/jwt.js +31 -0
  84. package/dist/lib/legacy-oauth.js +59 -0
  85. package/dist/lib/node-version.js +127 -0
  86. package/dist/lib/owner-plan.js +78 -0
  87. package/dist/lib/package-scripts.js +152 -0
  88. package/dist/lib/preflight.js +470 -0
  89. package/dist/lib/product-create.js +144 -0
  90. package/dist/lib/run-command.js +74 -0
  91. package/dist/lib/run-gates.js +70 -0
  92. package/dist/lib/run-output.js +42 -0
  93. package/dist/lib/run-summary.js +384 -0
  94. package/dist/lib/scaffold.js +427 -0
  95. package/dist/lib/service-input.js +207 -0
  96. package/dist/lib/service-runner.js +466 -0
  97. package/dist/lib/stale.js +24 -0
  98. package/dist/lib/target-selection.js +155 -0
  99. package/dist/lib/verb-fanout.js +128 -0
  100. package/dist/lib/verify-live.js +188 -0
  101. package/dist/manage.js +311 -0
  102. package/dist/omega-bin.js +7 -0
  103. package/dist/onboard.js +532 -0
  104. package/dist/services/account/ensure/users.js +259 -0
  105. package/dist/services/account/index.js +97 -0
  106. package/dist/services/account/lib/backend-client.js +107 -0
  107. package/dist/services/account/lib/password.js +36 -0
  108. package/dist/services/account/lib/resolve-password.js +100 -0
  109. package/dist/services/advertising/ensure/sites.js +101 -0
  110. package/dist/services/advertising/index.js +101 -0
  111. package/dist/services/advertising/lib/adsense-api.js +41 -0
  112. package/dist/services/ai/ensure/keys.js +21 -0
  113. package/dist/services/ai/index.js +36 -0
  114. package/dist/services/analytics/ensure/google-firebase-link.js +230 -0
  115. package/dist/services/analytics/ensure/google-streams.js +256 -0
  116. package/dist/services/analytics/ensure/meta-pixel.js +22 -0
  117. package/dist/services/analytics/ensure/tiktok-pixel.js +22 -0
  118. package/dist/services/analytics/index.js +134 -0
  119. package/dist/services/analytics/lib/analytics-api.js +156 -0
  120. package/dist/services/analytics/lib/meta-api.js +83 -0
  121. package/dist/services/analytics/lib/pixel-account.js +78 -0
  122. package/dist/services/analytics/lib/pixel-provision.js +152 -0
  123. package/dist/services/analytics/lib/pixel-specs.js +57 -0
  124. package/dist/services/analytics/lib/pixel-token.js +88 -0
  125. package/dist/services/analytics/lib/property-flow.js +77 -0
  126. package/dist/services/analytics/lib/tiktok-api.js +157 -0
  127. package/dist/services/analytics/lib/tiktok-auth.js +153 -0
  128. package/dist/services/assets/ensure/logo-gen.js +68 -0
  129. package/dist/services/assets/index.js +109 -0
  130. package/dist/services/assets/lib/assets-config.js +168 -0
  131. package/dist/services/assets/lib/brandmark-api.js +160 -0
  132. package/dist/services/assets/lib/derived.js +113 -0
  133. package/dist/services/assets/lib/font-loader.js +67 -0
  134. package/dist/services/assets/lib/reconcile.js +122 -0
  135. package/dist/services/assets/lib/reset.js +118 -0
  136. package/dist/services/assets/lib/svg-logo-generator.js +154 -0
  137. package/dist/services/assets/lib/svg-to-black.js +32 -0
  138. package/dist/services/assets/write/favicons.js +82 -0
  139. package/dist/services/assets/write/icons.js +64 -0
  140. package/dist/services/assets/write/process.js +96 -0
  141. package/dist/services/assets/write/reconcile.js +30 -0
  142. package/dist/services/assets/write/social-icons.js +108 -0
  143. package/dist/services/assets/write/templates.js +345 -0
  144. package/dist/services/bookmark/ensure/sync.js +255 -0
  145. package/dist/services/bookmark/index.js +17 -0
  146. package/dist/services/campaigns/ensure/contact-person.js +40 -0
  147. package/dist/services/campaigns/ensure/custom-fields.js +84 -0
  148. package/dist/services/campaigns/ensure/domain-auth.js +92 -0
  149. package/dist/services/campaigns/ensure/event-webhook.js +89 -0
  150. package/dist/services/campaigns/ensure/link-branding.js +187 -0
  151. package/dist/services/campaigns/ensure/list.js +50 -0
  152. package/dist/services/campaigns/ensure/segments.js +109 -0
  153. package/dist/services/campaigns/ensure/sender-identity.js +153 -0
  154. package/dist/services/campaigns/ensure/unsubscribe-groups.js +116 -0
  155. package/dist/services/campaigns/index.js +79 -0
  156. package/dist/services/campaigns/lib/dns-sync.js +81 -0
  157. package/dist/services/campaigns/lib/segment-query.js +138 -0
  158. package/dist/services/campaigns/lib/sendgrid-api.js +287 -0
  159. package/dist/services/captcha/ensure/site-key.js +83 -0
  160. package/dist/services/captcha/index.js +78 -0
  161. package/dist/services/captcha/lib/console-url.js +45 -0
  162. package/dist/services/captcha/lib/recaptcha-api.js +36 -0
  163. package/dist/services/certificates/ensure/api-key.js +22 -0
  164. package/dist/services/certificates/ensure/bundle-ids.js +115 -0
  165. package/dist/services/certificates/ensure/certificates.js +187 -0
  166. package/dist/services/certificates/ensure/profiles.js +143 -0
  167. package/dist/services/certificates/index.js +225 -0
  168. package/dist/services/certificates/lib/apple-api.js +183 -0
  169. package/dist/services/certificates/lib/certificate-manager.js +252 -0
  170. package/dist/services/certificates/lib/identifier-manager.js +107 -0
  171. package/dist/services/certificates/lib/keychain.js +135 -0
  172. package/dist/services/certificates/lib/manual-walkthrough.js +165 -0
  173. package/dist/services/certificates/lib/profile-manager.js +115 -0
  174. package/dist/services/chat/data/baseline-knowledge.md +96 -0
  175. package/dist/services/chat/ensure/chat.js +106 -0
  176. package/dist/services/chat/ensure/user.js +45 -0
  177. package/dist/services/chat/index.js +139 -0
  178. package/dist/services/chat/lib/baseline-knowledge.js +137 -0
  179. package/dist/services/cloud/ensure/authentication.js +267 -0
  180. package/dist/services/cloud/ensure/billing.js +120 -0
  181. package/dist/services/cloud/ensure/cloud-messaging.js +105 -0
  182. package/dist/services/cloud/ensure/database.js +60 -0
  183. package/dist/services/cloud/ensure/firestore.js +79 -0
  184. package/dist/services/cloud/ensure/functions.js +49 -0
  185. package/dist/services/cloud/ensure/hosting.js +398 -0
  186. package/dist/services/cloud/ensure/oauth-consent.js +248 -0
  187. package/dist/services/cloud/ensure/project-settings.js +72 -0
  188. package/dist/services/cloud/ensure/sdk-config.js +95 -0
  189. package/dist/services/cloud/ensure/service-account.js +152 -0
  190. package/dist/services/cloud/ensure/services.js +103 -0
  191. package/dist/services/cloud/ensure/storage.js +47 -0
  192. package/dist/services/cloud/index.js +130 -0
  193. package/dist/services/cloud/lib/access-heal.js +130 -0
  194. package/dist/services/cloud/lib/firebase-api.js +662 -0
  195. package/dist/services/cloud/lib/project-flow.js +102 -0
  196. package/dist/services/directory/ensure/entry.js +48 -0
  197. package/dist/services/directory/index.js +64 -0
  198. package/dist/services/directory/lib/blocks.js +104 -0
  199. package/dist/services/disperse/index.js +45 -0
  200. package/dist/services/disperse/write/certs.js +117 -0
  201. package/dist/services/domain/ensure/nameservers.js +179 -0
  202. package/dist/services/domain/index.js +69 -0
  203. package/dist/services/domain/lib/namecheap-api.js +167 -0
  204. package/dist/services/domain/lib/registrars.js +46 -0
  205. package/dist/services/domain/lib/whitelist-walkthrough.js +76 -0
  206. package/dist/services/edge/ensure/cache-rules.js +105 -0
  207. package/dist/services/edge/ensure/dns-records.js +304 -0
  208. package/dist/services/edge/ensure/email-routing.js +292 -0
  209. package/dist/services/edge/ensure/rules-configuration.js +98 -0
  210. package/dist/services/edge/ensure/rules-managed-transforms.js +101 -0
  211. package/dist/services/edge/ensure/rules-redirect.js +107 -0
  212. package/dist/services/edge/ensure/rules-response-headers.js +90 -0
  213. package/dist/services/edge/ensure/rules-security.js +142 -0
  214. package/dist/services/edge/ensure/speed-scheduled-tests.js +98 -0
  215. package/dist/services/edge/ensure/workers.js +219 -0
  216. package/dist/services/edge/ensure/zone-settings.js +108 -0
  217. package/dist/services/edge/ensure/zone.js +183 -0
  218. package/dist/services/edge/index.js +73 -0
  219. package/dist/services/edge/lib/cloudflare-api.js +84 -0
  220. package/dist/services/edge/lib/dns-records-helpers.js +518 -0
  221. package/dist/services/edge/lib/read-cache.js +16 -0
  222. package/dist/services/edge/lib/ruleset-helper.js +108 -0
  223. package/dist/services/edge/workers/omega-api-proxy.js +43 -0
  224. package/dist/services/email/data/baseline-filter.md +4 -0
  225. package/dist/services/email/data/baseline-knowledge.md +86 -0
  226. package/dist/services/email/ensure/agent.js +107 -0
  227. package/dist/services/email/ensure/user.js +45 -0
  228. package/dist/services/email/index.js +138 -0
  229. package/dist/services/email/lib/baseline.js +82 -0
  230. package/dist/services/email/lib/knowledge-file.js +53 -0
  231. package/dist/services/forms/ensure/form.js +46 -0
  232. package/dist/services/forms/ensure/user.js +45 -0
  233. package/dist/services/forms/index.js +138 -0
  234. package/dist/services/migrations/ensure/notifications.js +189 -0
  235. package/dist/services/migrations/ensure/orders.js +34 -0
  236. package/dist/services/migrations/ensure/payment-provider.js +132 -0
  237. package/dist/services/migrations/ensure/payments-intents.js +34 -0
  238. package/dist/services/migrations/ensure/state-retirement.js +266 -0
  239. package/dist/services/migrations/ensure/targets-rename.js +124 -0
  240. package/dist/services/migrations/ensure/users.js +1176 -0
  241. package/dist/services/migrations/index.js +101 -0
  242. package/dist/services/migrations/lib/attribution-touch.js +64 -0
  243. package/dist/services/migrations/lib/ensure-metadata.js +144 -0
  244. package/dist/services/migrations/lib/migration-runner.js +473 -0
  245. package/dist/services/migrations/lib/sanitize-strings.js +112 -0
  246. package/dist/services/migrations/lib/schema-validator.js +154 -0
  247. package/dist/services/monitoring/ensure/dsn.js +54 -0
  248. package/dist/services/monitoring/ensure/projects.js +135 -0
  249. package/dist/services/monitoring/index.js +54 -0
  250. package/dist/services/monitoring/lib/sentry-api.js +94 -0
  251. package/dist/services/newsletter/ensure/custom-fields.js +90 -0
  252. package/dist/services/newsletter/ensure/publication.js +94 -0
  253. package/dist/services/newsletter/ensure/segments.js +140 -0
  254. package/dist/services/newsletter/ensure/webhook.js +108 -0
  255. package/dist/services/newsletter/index.js +64 -0
  256. package/dist/services/newsletter/lib/beehiiv-api.js +124 -0
  257. package/dist/services/newsletter/lib/segment-automation.js +577 -0
  258. package/dist/services/payment/ensure/chargebee-account.js +30 -0
  259. package/dist/services/payment/ensure/chargebee-products.js +359 -0
  260. package/dist/services/payment/ensure/chargebee-webhook.js +113 -0
  261. package/dist/services/payment/ensure/paypal-account.js +36 -0
  262. package/dist/services/payment/ensure/paypal-products.js +374 -0
  263. package/dist/services/payment/ensure/paypal-webhook.js +128 -0
  264. package/dist/services/payment/ensure/stripe-account.js +93 -0
  265. package/dist/services/payment/ensure/stripe-disputes.js +56 -0
  266. package/dist/services/payment/ensure/stripe-products.js +245 -0
  267. package/dist/services/payment/ensure/stripe-radar.js +74 -0
  268. package/dist/services/payment/ensure/stripe-webhook.js +130 -0
  269. package/dist/services/payment/index.js +163 -0
  270. package/dist/services/payment/lib/chargebee-api.js +338 -0
  271. package/dist/services/payment/lib/payment-utils.js +116 -0
  272. package/dist/services/payment/lib/paypal-api.js +354 -0
  273. package/dist/services/payment/lib/provider-setup.js +134 -0
  274. package/dist/services/payment/lib/stripe-api.js +152 -0
  275. package/dist/services/repo/ensure/org.js +70 -0
  276. package/dist/services/repo/ensure/pages.js +72 -0
  277. package/dist/services/repo/ensure/repo.js +90 -0
  278. package/dist/services/repo/index.js +52 -0
  279. package/dist/services/repo/lib/github-api.js +196 -0
  280. package/dist/services/search/ensure/ga-link.js +57 -0
  281. package/dist/services/search/ensure/property.js +137 -0
  282. package/dist/services/search/ensure/sitemaps.js +70 -0
  283. package/dist/services/search/index.js +61 -0
  284. package/dist/services/search/lib/search-console-api.js +92 -0
  285. package/dist/services/seo/ensure/github-repos.js +271 -0
  286. package/dist/services/seo/index.js +55 -0
  287. package/dist/services/seo/lib/gh-api.js +161 -0
  288. package/dist/services/seo/templates/developer-tool/.github/workflows/maintenance.yml +25 -0
  289. package/dist/services/seo/templates/developer-tool/.nvmrc +1 -0
  290. package/dist/services/seo/templates/developer-tool/_README.md.js +121 -0
  291. package/dist/services/seo/templates/developer-tool/_package.json.js +33 -0
  292. package/dist/services/seo/templates/developer-tool/src/index.js +120 -0
  293. package/dist/services/seo/templates/index.js +57 -0
  294. package/dist/services/server/ensure/brands.js +63 -0
  295. package/dist/services/server/index.js +42 -0
  296. package/dist/services/testing/ensure/target-checks.js +97 -0
  297. package/dist/services/testing/index.js +11 -0
  298. package/dist/services/testing/lib/checks.js +467 -0
  299. package/dist/services/update/index.js +20 -0
  300. package/dist/services/update/lib/cache.js +59 -0
  301. package/dist/services/update/lib/fingerprint.js +157 -0
  302. package/dist/services/update/write/targets.js +206 -0
  303. package/dist/services/workspace/ensure/agents.js +42 -0
  304. package/dist/services/workspace/ensure/claude-settings.js +34 -0
  305. package/dist/services/workspace/ensure/config.js +54 -0
  306. package/dist/services/workspace/ensure/defaults.js +60 -0
  307. package/dist/services/workspace/ensure/env-keys.js +55 -0
  308. package/dist/services/workspace/ensure/env-order.js +66 -0
  309. package/dist/services/workspace/ensure/env-rules.js +97 -0
  310. package/dist/services/workspace/ensure/gitignore.js +18 -0
  311. package/dist/services/workspace/ensure/scripts.js +126 -0
  312. package/dist/services/workspace/ensure/structure.js +97 -0
  313. package/dist/services/workspace/ensure/translation-sdk.js +148 -0
  314. package/dist/services/workspace/ensure/workflows.js +54 -0
  315. package/dist/services/workspace/index.js +8 -0
  316. package/dist/vendor/account/engine.js +182 -0
  317. package/dist/vendor/account/features.js +220 -0
  318. package/dist/vendor/account/index.js +53 -0
  319. package/dist/vendor/account/schema.js +272 -0
  320. package/dist/vendor/account/subscription.js +38 -0
  321. package/dist/vendor/config/company.js +31 -0
  322. package/dist/vendor/config/defaults.js +173 -0
  323. package/dist/vendor/config/demo.js +18 -0
  324. package/dist/vendor/config/desktop-artifacts.js +110 -0
  325. package/dist/vendor/config/edit.js +769 -0
  326. package/dist/vendor/config/env-delivery.js +145 -0
  327. package/dist/vendor/config/env-rules.js +93 -0
  328. package/dist/vendor/config/env-schema.js +1078 -0
  329. package/dist/vendor/config/env.js +445 -0
  330. package/dist/vendor/config/hooks.js +97 -0
  331. package/dist/vendor/config/index.js +237 -0
  332. package/dist/vendor/config/instances.js +208 -0
  333. package/dist/vendor/config/load.js +490 -0
  334. package/dist/vendor/config/merge.js +68 -0
  335. package/dist/vendor/config/order.js +139 -0
  336. package/dist/vendor/config/ports.js +374 -0
  337. package/dist/vendor/config/providers.js +32 -0
  338. package/dist/vendor/config/repo.js +142 -0
  339. package/dist/vendor/config/retired-keys.js +430 -0
  340. package/dist/vendor/config/schema.js +1610 -0
  341. package/dist/vendor/config/secrets.js +50 -0
  342. package/dist/vendor/config/seed.js +34 -0
  343. package/dist/vendor/config/site-global.js +205 -0
  344. package/dist/vendor/config/validate.js +554 -0
  345. package/dist/vendor/config/winback.js +61 -0
  346. package/dist/vendor/devkit/attach-log-file.js +262 -0
  347. package/dist/vendor/devkit/certs.js +199 -0
  348. package/dist/vendor/devkit/ci-workflows.js +520 -0
  349. package/dist/vendor/devkit/cli-router.js +156 -0
  350. package/dist/vendor/devkit/command-path.js +46 -0
  351. package/dist/vendor/devkit/deploy-record.js +180 -0
  352. package/dist/vendor/devkit/flows.js +317 -0
  353. package/dist/vendor/devkit/local-https.js +360 -0
  354. package/dist/vendor/devkit/local.js +1905 -0
  355. package/dist/vendor/devkit/logger.js +128 -0
  356. package/dist/vendor/devkit/omega-bin.js +345 -0
  357. package/dist/vendor/devkit/prompt.js +187 -0
  358. package/dist/vendor/devkit/safe-install.js +18 -0
  359. package/dist/vendor/devkit/stop-signals.js +28 -0
  360. package/dist/vendor/devkit/test/scope.js +162 -0
  361. package/dist/vendor/devkit/translate/cache.js +84 -0
  362. package/dist/vendor/devkit/translate/engine.js +243 -0
  363. package/dist/vendor/devkit/translate/index.js +49 -0
  364. package/dist/vendor/devkit/translate/languages.js +134 -0
  365. package/dist/vendor/devkit/translate/providers.js +188 -0
  366. package/dist/vendor/devkit/update.js +569 -0
  367. package/docs/AGENTS.md +200 -0
  368. package/docs/account.md +45 -0
  369. package/docs/advertising.md +46 -0
  370. package/docs/ai.md +34 -0
  371. package/docs/analytics.md +69 -0
  372. package/docs/assets.md +57 -0
  373. package/docs/bookmark.md +26 -0
  374. package/docs/brand.md +151 -0
  375. package/docs/campaigns.md +96 -0
  376. package/docs/captcha.md +46 -0
  377. package/docs/certificates.md +68 -0
  378. package/docs/chat.md +47 -0
  379. package/docs/cloud.md +110 -0
  380. package/docs/company.md +64 -0
  381. package/docs/directory.md +140 -0
  382. package/docs/disperse.md +46 -0
  383. package/docs/domain.md +56 -0
  384. package/docs/edge.md +234 -0
  385. package/docs/email.md +42 -0
  386. package/docs/forms.md +48 -0
  387. package/docs/index.md +109 -0
  388. package/docs/migration.md +203 -0
  389. package/docs/migrations.md +56 -0
  390. package/docs/monitoring.md +41 -0
  391. package/docs/newsletter.md +48 -0
  392. package/docs/payment.md +83 -0
  393. package/docs/repo.md +48 -0
  394. package/docs/search.md +44 -0
  395. package/docs/seo.md +34 -0
  396. package/docs/server.md +37 -0
  397. package/docs/shared/agent-docs.md +89 -0
  398. package/docs/shared/analytics.md +612 -0
  399. package/docs/shared/brands.md +51 -0
  400. package/docs/shared/breaking-changes.md +497 -0
  401. package/docs/shared/config.md +1387 -0
  402. package/docs/shared/deploys.md +215 -0
  403. package/docs/shared/icons.md +201 -0
  404. package/docs/shared/local-dev.md +147 -0
  405. package/docs/shared/logging.md +202 -0
  406. package/docs/shared/monitoring.md +153 -0
  407. package/docs/shared/publishing.md +183 -0
  408. package/docs/shared/rulings.md +34 -0
  409. package/docs/shared/testing.md +147 -0
  410. package/docs/shared/theming.md +604 -0
  411. package/docs/shared/translation.md +291 -0
  412. package/docs/shared/updates.md +61 -0
  413. package/docs/testing.md +34 -0
  414. package/docs/update.md +36 -0
  415. package/docs/workspace.md +64 -0
  416. package/package.json +88 -0
@@ -0,0 +1,128 @@
1
+ // Build-time logger — timestamped, tag-scoped console output for CLI commands, gulp
2
+ // tasks, and test runners. `new Logger('setup')` then logger.log/error/warn/info,
3
+ // which prints `[HH:MM:SS] [@omega.js/<package>:setup] message`.
4
+ //
5
+ // NOT for app/runtime logging — frameworks with runtime logging needs (e.g. desktop's
6
+ // Electron file-transport logger-lite) keep their own, and emit the same tag WITHOUT
7
+ // the timestamp (devtools stamps runtime lines).
8
+
9
+ // Libraries
10
+ const chalk = require('chalk').default;
11
+ const path = require('path');
12
+ // Plain fs, not fs-jetpack: this module is VENDORED into every framework, and
13
+ // vendoring requires the host to declare each runtime dependency the vendored
14
+ // code uses (tools/vendor.js) — a logger must not push a dep onto its hosts.
15
+ const fs = require('fs');
16
+
17
+ // The one identity tag: [@omega.js/<package>:<module>]. The package segment is
18
+ // derived from the file that CONSTRUCTED the logger — call sites stay
19
+ // `new Logger('setup')` and never name their own package.
20
+ //
21
+ // KNOWN LIMIT: the derivation reports whatever package owns the constructing
22
+ // file, so a CONSUMER file constructing one (a brand's own build script, a
23
+ // consumer hook) would stamp the consumer's package name — e.g.
24
+ // `[my-brand:deploy]`, not `[@omega.js/web:deploy]`. That is arguably the honest
25
+ // answer (the line really does come from consumer code), and no such call site
26
+ // exists today: every construction is inside a framework here or in its vendored
27
+ // dist copy. It stays a documented limit rather than a check because the repo
28
+ // guard (scripts/log-tags.test.js) cannot see consumer trees at all.
29
+ const FALLBACK_PACKAGE = '@omega.js/devkit';
30
+
31
+ // Cache the directory → package-name lookup; a build constructs many loggers.
32
+ const packageNameCache = new Map();
33
+
34
+ // Walk up from a directory to the nearest package.json and read its name.
35
+ function findPackageName(startDir) {
36
+ if (packageNameCache.has(startDir)) {
37
+ return packageNameCache.get(startDir);
38
+ }
39
+
40
+ let name = null;
41
+ let dir = startDir;
42
+ while (true) {
43
+ try {
44
+ const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
45
+ if (manifest && manifest.name) {
46
+ name = manifest.name;
47
+ break;
48
+ }
49
+ } catch (e) {
50
+ // No package.json here (or unreadable) — keep walking up.
51
+ }
52
+ const parent = path.dirname(dir);
53
+ if (parent === dir) { break; }
54
+ dir = parent;
55
+ }
56
+
57
+ packageNameCache.set(startDir, name);
58
+ return name;
59
+ }
60
+
61
+ // Derive the package segment from the first stack frame outside this file.
62
+ // A logger must NEVER throw, so every failure path lands on FALLBACK_PACKAGE:
63
+ // stack formats vary by runtime (and vendored/bundled copies can lose paths),
64
+ // and a mislabelled log line is always cheaper than a crashed build.
65
+ function derivePackage() {
66
+ try {
67
+ const frames = (new Error().stack || '').split('\n').slice(1);
68
+ for (const frame of frames) {
69
+ const match = frame.match(/\((.*):\d+:\d+\)\s*$/) || frame.match(/at (.*):\d+:\d+\s*$/);
70
+ if (!match) { continue; }
71
+ const file = match[1].replace(/^file:\/\//, '');
72
+ if (!path.isAbsolute(file)) { continue; }
73
+ if (file === __filename) { continue; }
74
+ return findPackageName(path.dirname(file)) || FALLBACK_PACKAGE;
75
+ }
76
+ } catch (e) {
77
+ // Fall through to the fallback below.
78
+ }
79
+ return FALLBACK_PACKAGE;
80
+ }
81
+
82
+ // Logger class
83
+ function Logger(name) {
84
+ const self = this;
85
+ self.name = name;
86
+ self.package = derivePackage();
87
+ }
88
+
89
+ // Make methods that log to console with the tag and time: [xx:xx:xx] [@omega.js/pkg:name] message
90
+ ['log', 'error', 'warn', 'info'].forEach((method) => {
91
+ Logger.prototype[method] = function () {
92
+ const time = new Date().toLocaleTimeString('en-US', {
93
+ hour12: false,
94
+ hour: '2-digit',
95
+ minute: '2-digit',
96
+ second: '2-digit',
97
+ });
98
+
99
+ let color;
100
+ switch (method) {
101
+ case 'warn':
102
+ color = chalk.yellow;
103
+ break;
104
+ case 'error':
105
+ color = chalk.red;
106
+ break;
107
+ default:
108
+ color = (text) => text;
109
+ }
110
+
111
+ const args = [`[${chalk.magenta(time)}] [${chalk.cyan(`${this.package}:${this.name}`)}]`, ...Array.from(arguments).map((arg) => {
112
+ if (typeof arg === 'string') {
113
+ return color(arg);
114
+ }
115
+ if (arg instanceof Error) {
116
+ return color(arg.stack);
117
+ }
118
+ return arg;
119
+ })];
120
+
121
+ console[method].apply(console, args);
122
+ };
123
+ });
124
+
125
+ // Export chalk as format
126
+ Logger.prototype.format = chalk;
127
+
128
+ module.exports = Logger;
@@ -0,0 +1,345 @@
1
+ /**
2
+ * omega-bin — the context-aware dispatcher behind every framework's `omega`/`omg` bin.
3
+ *
4
+ * Problem: every OMEGA framework ships the same bin names (`omega`, `omg`, `mgr`).
5
+ * In a brand monorepo with several targets, npm hoists all of them to the brand root
6
+ * and only ONE framework's file wins the node_modules/.bin link — so the bin that
7
+ * actually runs is arbitrary. This module makes any winner correct: it resolves
8
+ * the context that owns the CALLER'S cwd — nearest first, walking up — and runs
9
+ * THAT context's CLI:
10
+ *
11
+ * - an OMEGA PACKAGE'S OWN ROOT (package.json `name` is `@omega.js/*`) →
12
+ * that package's own CLI, or a refusal when it ships none. Checked FIRST,
13
+ * ahead of the dependency rule: a framework devDepends on other frameworks
14
+ * (extension and desktop on @omega.js/web for vendorAssets, the manager on
15
+ * @omega.js/backend), and reading those as a target made `omega test` in
16
+ * packages/extension run WEB's CLI, which scaffolded a web target into the
17
+ * package ([#757](https://github.com/Omega-JS-Stack/omega/issues/757))
18
+ * - a TARGET (nearest package.json declaring a framework, including the
19
+ * backend's functions/ layout) → that framework's CLI
20
+ * - a BRAND ROOT (config/omega.json5 with no framework declared nearer)
21
+ * → @omega.js/manager's CLI, so `omega test` at a brand root fans out
22
+ * over the brand's targets instead of guessing one framework
23
+ *
24
+ * Contract: every dispatch target exposes `exports['./cli']` → a module with
25
+ * `run()` that parses process.argv itself. Framework bin shims call
26
+ * `run({ hostName, hostRun })` — hostRun executes the host's own CLI via a
27
+ * RELATIVE require (vendor-safe), so the host never resolves itself by name.
28
+ *
29
+ * This module stays stdlib-only (fs/path/module): it is vendored into every
30
+ * framework dist and must never assume another package is installed.
31
+ */
32
+
33
+ const fs = require('fs');
34
+ const path = require('path');
35
+ const { createRequire } = require('module');
36
+
37
+ const FRAMEWORKS = [
38
+ '@omega.js/web',
39
+ '@omega.js/backend',
40
+ '@omega.js/desktop',
41
+ '@omega.js/extension',
42
+ ];
43
+
44
+ const MANAGER = '@omega.js/manager';
45
+
46
+ // Every package in the OMEGA monorepo carries this name prefix; no consumer
47
+ // target ever does. A manifest with it IS the package, never a project built
48
+ // on top of one (#757).
49
+ const OMEGA_SCOPE = '@omega.js/';
50
+
51
+ // Dirs that are a VIEW of the target one level up, never a context of their own:
52
+ // a backend's runtime cwd (functions/) and its staged build output (dist/,
53
+ // which carries a COMPOSED config/omega.json5 that would otherwise read as a
54
+ // brand root). Stdlib twin of @omega.js/config's TARGET_SUBDIRS — that module is
55
+ // the canonical list ([#307](https://github.com/Omega-JS-Stack/omega/issues/307)).
56
+ const TARGET_SUBDIRS = ['functions', 'dist'];
57
+
58
+ // The only verbs allowed to run with NO target context. The fallback exists for
59
+ // the bootstrap case (`npx omega onboard` in a fresh clone, #276) and for verbs
60
+ // that only READ; every other verb runs its target scaffold first (#675), so a
61
+ // run in a directory that owns no target WRITES one there — that is how a stray
62
+ // `omega deploy` at a workspace root scaffolded a whole desktop target into it
63
+ // ([#699](https://github.com/Omega-JS-Stack/omega/issues/699)).
64
+ //
65
+ // Tokens, not command names: a flag-style alias (`omega --deploy`, `omega -v`)
66
+ // selects a verb too, so every spelling of an allowed verb is listed —
67
+ // onboard/help/version across the router frameworks and the manager, plus
68
+ // backend's `cwd` and desktop's `logs`, the two read-only reporters.
69
+ const CONTEXTLESS_VERBS = new Set([
70
+ 'onboard', 'create', 'new', '-o', '--onboard',
71
+ 'help', 'h', '-h', '--help',
72
+ 'version', 'v', '-v', '--version',
73
+ 'cwd',
74
+ 'logs', 'log', '--logs', 'logs:read', 'logs:tail', 'logs:stream',
75
+ ]);
76
+
77
+ // The signing box's verbs. A box that hosts the Windows EV signing runner is a
78
+ // MACHINE, not a project: `omega runner` and `omega sign-windows` read their
79
+ // configuration from the runner home and run from any directory. Both belong
80
+ // to @omega.js/desktop, so with no target they go to desktop's CLI — the host
81
+ // when desktop won the bin link (a bare `npm i -g @omega.js/desktop`), else
82
+ // desktop resolved from the cwd (a monorepo checkout, a brand root) — and
83
+ // refuse naming the install when it is nowhere. They scaffold nothing
84
+ // ([#337](https://github.com/Omega-JS-Stack/omega/issues/337)).
85
+ const BOX_VERBS = new Set(['runner', 'sign-windows']);
86
+ const DESKTOP = '@omega.js/desktop';
87
+
88
+ /**
89
+ * The signing-box verb this invocation selects, or null. The ONE reading of
90
+ * "is this the box's", shared by the dispatcher below and by
91
+ * @omega.js/desktop's CLI (which skips the project `.env` cascade for exactly
92
+ * these) — two readings would drift, and the drift is a brand's token reaching
93
+ * the box.
94
+ *
95
+ * Both spellings count: the bare token (`omega runner status`) and the `--`
96
+ * flag desktop's alias table takes (`omega --runner`, `omega --sign-windows
97
+ * --smoke`). `--help` is never one: it prints help, in every spelling. A box
98
+ * verb sitting in an ARGUMENT position is not one either — `omega test runner`
99
+ * runs the test verb — so the first positional has to be the box verb itself.
100
+ *
101
+ * @param {string[]} argv - Arguments after the bin name.
102
+ * @returns {string|null} The box verb's canonical name, or null.
103
+ */
104
+ function boxVerbOf(argv) {
105
+ argv = argv || [];
106
+ if (argv.includes('--help') || argv.includes('-h')) return null;
107
+
108
+ const positional = argv.find((arg) => !arg.startsWith('-'));
109
+ if (positional && BOX_VERBS.has(positional)) return positional;
110
+
111
+ const flag = argv.find((arg) => arg.startsWith('--') && BOX_VERBS.has(arg.slice(2)));
112
+ return flag ? flag.slice(2) : null;
113
+ }
114
+
115
+ /**
116
+ * Boolean half of boxVerbOf — what callers that only need the yes/no ask.
117
+ *
118
+ * @param {string[]} argv - Arguments after the bin name.
119
+ * @returns {boolean}
120
+ */
121
+ function isBoxVerbArgv(argv) {
122
+ return boxVerbOf(argv) !== null;
123
+ }
124
+
125
+ function readPackage(dir) {
126
+ try {
127
+ return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
128
+ } catch (e) {
129
+ return null;
130
+ }
131
+ }
132
+
133
+ function frameworksOf(pkg) {
134
+ if (!pkg) return [];
135
+ const declared = Object.assign({}, pkg.dependencies || {}, pkg.devDependencies || {});
136
+ return FRAMEWORKS.filter((name) => declared[name]);
137
+ }
138
+
139
+ /**
140
+ * Is `dir` a brand-monorepo root? Carries a config/omega.json5 that is not
141
+ * itself a TARGET_SUBDIR view (functions/, dist/) and not a TARGET of a brand above
142
+ * it (directly under a targets/ dir whose parent also carries a brand config).
143
+ * Stdlib twin of @omega.js/config's resolveBrandRoot rule — that module is the
144
+ * canonical definition; this copy exists because the dispatcher cannot depend
145
+ * on @omega.js/config.
146
+ */
147
+ function isBrandRoot(dir) {
148
+ if (TARGET_SUBDIRS.includes(path.basename(path.resolve(dir)))) return false;
149
+ if (!fs.existsSync(path.join(dir, 'config', 'omega.json5'))) return false;
150
+
151
+ const parent = path.dirname(dir);
152
+ const isTargetOfBrand = path.basename(parent) === 'targets'
153
+ && fs.existsSync(path.join(path.dirname(parent), 'config', 'omega.json5'));
154
+
155
+ return !isTargetOfBrand;
156
+ }
157
+
158
+ /**
159
+ * Walk up from startDir to the nearest dispatch context. At each level, in
160
+ * order: the dir's own package.json being an OMEGA package, then declaring a
161
+ * framework, then brand-root-ness. IDENTITY beats dependency — a framework
162
+ * devDepends on other frameworks, and reading those as a target dispatched a
163
+ * framework's own root to a sibling framework's CLI (#757). Framework checks
164
+ * then come before the brand check so a standalone consumer (framework dep AND
165
+ * its own config/omega.json5 in one dir) dispatches as a target, not a brand.
166
+ * The CLI entry normalizes a functions/ cwd up to the target root
167
+ * (muscle-memory `cd functions` still works).
168
+ *
169
+ * The walk is BOUNDED at the nearest `.git` (that directory is still checked
170
+ * first): past the repo boundary is somebody else's tree, never this dir's
171
+ * dispatch context. Same bound as @omega.js/config's resolveBrandRoot and the
172
+ * Claude plugin's inject hook.
173
+ *
174
+ * @returns {{ kind: 'self', name: string, dir: string }
175
+ * | { kind: 'framework', name: string, dir: string }
176
+ * | { kind: 'brand', dir: string } | null} dir = the package's own root
177
+ * (self) / where the framework dep is declared (framework) / the brand root
178
+ * (brand)
179
+ */
180
+ function findTarget(startDir) {
181
+ let dir = path.resolve(startDir);
182
+ while (true) {
183
+ const pkg = readPackage(dir);
184
+
185
+ if (pkg && typeof pkg.name === 'string' && pkg.name.startsWith(OMEGA_SCOPE)) {
186
+ return { kind: 'self', name: pkg.name, dir };
187
+ }
188
+
189
+ const matches = frameworksOf(pkg);
190
+ if (matches.length > 1) {
191
+ // Targets are one-framework-per-target by design — a multi-framework
192
+ // manifest dispatches by FRAMEWORKS order, which must never be silent.
193
+ console.error(`omega: ${dir} declares ${matches.length} frameworks (${matches.join(', ')}) — dispatching ${matches[0]}`);
194
+ }
195
+ const own = matches[0] || null;
196
+ if (own) return { kind: 'framework', name: own, dir };
197
+
198
+ if (isBrandRoot(dir)) {
199
+ return { kind: 'brand', dir };
200
+ }
201
+
202
+ // Repo boundary — stop here rather than statting out through the host
203
+ // filesystem to /.
204
+ if (fs.existsSync(path.join(dir, '.git'))) return null;
205
+
206
+ const parent = path.dirname(dir);
207
+ if (parent === dir) return null;
208
+ dir = parent;
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Resolve a dispatch target's ./cli from where it is declared.
214
+ * @returns {{ cliPath: string } | { error: Error }} — callers decide whether an
215
+ * unresolvable target is fatal (cross-framework) or falls back (brand).
216
+ */
217
+ function tryResolveCli(name, fromDir) {
218
+ const req = createRequire(path.join(fromDir, 'package.json'));
219
+ try {
220
+ return { cliPath: req.resolve(`${name}/cli`) };
221
+ } catch (e) {
222
+ return { error: e };
223
+ }
224
+ }
225
+
226
+ /** Resolve a dispatch target's ./cli from where it is declared, with a clear failure. */
227
+ function resolveCli(name, fromDir, hint) {
228
+ const { cliPath, error } = tryResolveCli(name, fromDir);
229
+ if (error) {
230
+ console.error(`omega: found ${name} context (${fromDir}) but could not resolve '${name}/cli': ${error.message}`);
231
+ console.error(hint);
232
+ process.exit(1);
233
+ }
234
+ return cliPath;
235
+ }
236
+
237
+ /**
238
+ * The verb an invocation resolves to, as far as the dispatcher can see it: the
239
+ * frameworks' own resolution rules minus their per-framework alias tables.
240
+ * `--help`/`-h` wins outright (cli-router routes it ahead of positionals, so
241
+ * `omega deploy --help` prints help), then the first positional token, then the
242
+ * first flag-style alias. A bare `omega` has no verb — every CLI defaults to help.
243
+ *
244
+ * @param {string[]} argv - Arguments after the bin name.
245
+ * @returns {string|null} The selecting token, or null for a bare invocation.
246
+ */
247
+ function verbOf(argv) {
248
+ if (argv.includes('--help') || argv.includes('-h')) return 'help';
249
+ return argv.find((arg) => !arg.startsWith('-')) || argv[0] || null;
250
+ }
251
+
252
+ async function run({ hostName, hostRun, argv = process.argv.slice(2) }) {
253
+ const target = findTarget(process.cwd());
254
+
255
+ // No context — the bootstrap case (a verb run in a fresh directory has
256
+ // no framework dep yet, by definition). Run the HOST framework's CLI, exactly
257
+ // like the pre-dispatcher bins did, and say which one so a hoist-winner at a
258
+ // brand root is never a silent mystery.
259
+ if (!target) {
260
+ // …but ONLY for a verb that cannot write. The fallback hands a mutating verb
261
+ // to whichever framework won npm's bin link, and that verb scaffolds its own
262
+ // target into the cwd — a directory that owns no target is never where that
263
+ // should land (#699). Twin of ensure-target's refusal (devkit scaffold-guard.js).
264
+ const verb = verbOf(argv);
265
+ const boxVerb = boxVerbOf(argv);
266
+ if (boxVerb) {
267
+ if (hostName === DESKTOP) return hostRun();
268
+ const { cliPath } = tryResolveCli(DESKTOP, process.cwd());
269
+ if (!cliPath) {
270
+ console.error(`omega: "${boxVerb}" is ${DESKTOP}'s — a signing box runs it from any directory, but ${DESKTOP} is not installed here (from ${process.cwd()}). \`npm i -g ${DESKTOP}\`, then run it again.`);
271
+ process.exit(1);
272
+ }
273
+ console.error(`omega: no target context found from ${process.cwd()} — "${boxVerb}" is a signing-box verb, running ${DESKTOP}`);
274
+ return require(cliPath).run();
275
+ }
276
+ if (verb && !CONTEXTLESS_VERBS.has(verb)) {
277
+ console.error(`omega: refusing to run "${verb}" — ${process.cwd()} is not inside an OMEGA target (no framework dependency and no config/omega.json5 above it). Nothing was scaffolded.`);
278
+ console.error('Run it from a target directory, or `npx omega onboard` to create one here. Without a target, only onboard (create, new), help, version, cwd and logs run; the signing box\'s runner and sign-windows run through @omega.js/desktop.');
279
+ process.exit(1);
280
+ }
281
+
282
+ console.error(`omega: no target context found from ${process.cwd()} — running ${hostName}`);
283
+ return hostRun();
284
+ }
285
+
286
+ // An OMEGA package's OWN root — run ITS CLI, so `omega test` in
287
+ // packages/extension runs the extension's self-test. A package is never a
288
+ // target: nothing here may reach the host fallback, whose ensure-target would
289
+ // scaffold a consumer project into the framework source tree (#757).
290
+ if (target.kind === 'self') {
291
+ if (target.name === hostName) return hostRun();
292
+
293
+ const { cliPath, error } = tryResolveCli(target.name, target.dir);
294
+ if (!cliPath) {
295
+ // Two different facts share one refusal: a package that exports no
296
+ // `./cli` at all (config, devkit, ...) versus one that declares it but
297
+ // cannot resolve it right now (an unbuilt dist, a fresh clone before
298
+ // `npm install`). Name the one that applies.
299
+ const reason = error && error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'
300
+ ? 'which ships no CLI'
301
+ : `whose './cli' did not resolve (${error ? error.message : 'unknown'}; an unbuilt dist? run its prepare)`;
302
+ console.error(`omega: refusing to run — ${target.dir} is the ${target.name} package itself, ${reason}, and an OMEGA package is never a target. Nothing was scaffolded.`);
303
+ process.exit(1);
304
+ }
305
+ return require(cliPath).run();
306
+ }
307
+
308
+ // A brand root — the manager owns brand-level commands (`omega test` fans
309
+ // out over targets/*). Resolve it from the brand root and hand over.
310
+ if (target.kind === 'brand') {
311
+ const { cliPath } = tryResolveCli(MANAGER, target.dir);
312
+
313
+ // Brand-SHAPED is not always a brand: every verb's ensureTarget scaffolds
314
+ // config/omega.json5 into a standalone project before its framework dep lands
315
+ // in package.json, so the walk classifies a fresh target as a brand root. With
316
+ // no manager installed there is no brand-level CLI to hand over to — fall
317
+ // back to the host framework rather than dead-ending (#194). A real brand
318
+ // root still dispatches to the manager the moment it exists.
319
+ if (!cliPath) {
320
+ // When the HOST is the manager itself (its own bin in a fresh template
321
+ // clone), "install the manager" would name the thing about to run —
322
+ // that message is for framework hosts only.
323
+ if (hostName === MANAGER) {
324
+ console.error(`omega: brand-shaped directory at ${target.dir} with no installed ${MANAGER} — running the bundled ${hostName} (run npm install to use the pinned version)`);
325
+ } else {
326
+ console.error(`omega: brand-shaped directory at ${target.dir} but ${MANAGER} is not installed — running ${hostName} instead (install ${MANAGER} at the brand root, or \`mgr i local\` for a monorepo link, if this really is a brand)`);
327
+ }
328
+ return hostRun();
329
+ }
330
+ return require(cliPath).run();
331
+ }
332
+
333
+ // The bin that won npm's .bin link belongs to this target's framework — run it directly.
334
+ if (target.name === hostName) {
335
+ return hostRun();
336
+ }
337
+
338
+ // The target belongs to a DIFFERENT framework — resolve its CLI from where the
339
+ // dependency is declared and hand over.
340
+ const cliPath = resolveCli(target.name, target.dir,
341
+ 'Is the framework installed? Try npm install, or `mgr i local` for a monorepo link.');
342
+ return require(cliPath).run();
343
+ }
344
+
345
+ module.exports = { run, findTarget, isBrandRoot, verbOf, isBoxVerbArgv, TARGET_SUBDIRS, CONTEXTLESS_VERBS, BOX_VERBS, FRAMEWORKS, MANAGER };
@@ -0,0 +1,187 @@
1
+ /**
2
+ * TTY-safe interactive prompts — the one wrapper every OMEGA package uses
3
+ * instead of importing @inquirer/prompts directly.
4
+ *
5
+ * Semantics:
6
+ * - No TTY (CI, cron, `node --test`, company-mode child processes — always
7
+ * piped): input/select/checkbox THROW immediately instead of hanging
8
+ * forever; confirm auto-returns its default (`default ?? true`) unless
9
+ * the call passes { required: true } — destructive or critical
10
+ * confirmations must never be auto-accepted.
11
+ * - omega-manager's setParallelMode() global is gone by construction:
12
+ * parallel execution is company mode, which runs each brand as a child
13
+ * process with piped stdio, so the TTY check already covers it.
14
+ * - Callers that have a non-prompting fallback (print instructions + warn)
15
+ * gate on isInteractive() instead of catching the throw.
16
+ *
17
+ * Test seam: setPromptStreams({ input, output }) routes the REAL inquirer
18
+ * prompts through the given streams (@inquirer's context argument) — tests
19
+ * drive actual keystrokes, no mocks. An input stream with isTTY = true
20
+ * counts as interactive.
21
+ */
22
+ const { input: _input, select: _select, checkbox: _checkbox, confirm: _confirm, password: _password } = require('@inquirer/prompts');
23
+
24
+ let _streams = null;
25
+
26
+ /**
27
+ * Route prompts through the given { input, output } streams (test seam).
28
+ * Pass null to restore process stdio.
29
+ */
30
+ function setPromptStreams(streams) {
31
+ _streams = streams || null;
32
+ }
33
+
34
+ function effectiveInput() {
35
+ return _streams?.input || process.stdin;
36
+ }
37
+
38
+ /**
39
+ * Whether prompts can run: the effective input stream is a TTY, unless
40
+ * OMEGA_NON_INTERACTIVE=1 forces headless (the pipeline command sets it so
41
+ * a child run can never prompt, whatever terminal the parent holds).
42
+ */
43
+ function isInteractive() {
44
+ if (process.env.OMEGA_NON_INTERACTIVE === '1') {
45
+ return false;
46
+ }
47
+ return Boolean(effectiveInput().isTTY);
48
+ }
49
+
50
+ /**
51
+ * The effective { input, output } streams prompts run on (the test seam
52
+ * when set, process stdio otherwise). Flow helpers (flows.js) read
53
+ * keypresses and draw spinners on these so the same fake-stream harness
54
+ * drives them.
55
+ */
56
+ function getPromptStreams() {
57
+ return {
58
+ input: effectiveInput(),
59
+ output: _streams?.output || process.stdout,
60
+ };
61
+ }
62
+
63
+ function assertInteractive() {
64
+ if (!isInteractive()) {
65
+ throw new Error(
66
+ 'Interactive prompt blocked: no TTY available. '
67
+ + 'Run in an interactive terminal to fill in missing config.',
68
+ );
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Text input. Throws without a TTY.
74
+ */
75
+ function input(opts) {
76
+ assertInteractive();
77
+ return _input(opts, _streams || undefined);
78
+ }
79
+
80
+ /**
81
+ * Masked secret input (echoes nothing). Throws without a TTY.
82
+ */
83
+ function password(opts) {
84
+ assertInteractive();
85
+ return _password(opts, _streams || undefined);
86
+ }
87
+
88
+ /**
89
+ * Single-choice list. Throws without a TTY.
90
+ */
91
+ function select(opts) {
92
+ assertInteractive();
93
+ return _select(opts, _streams || undefined);
94
+ }
95
+
96
+ /**
97
+ * Multi-choice list. Throws without a TTY.
98
+ */
99
+ function checkbox(opts) {
100
+ assertInteractive();
101
+ return _checkbox(opts, _streams || undefined);
102
+ }
103
+
104
+ /**
105
+ * Yes/no confirmation. Without a TTY, non-required confirms auto-return
106
+ * their default value; pass { required: true } for confirmations that must
107
+ * never be auto-accepted (those throw instead).
108
+ */
109
+ function confirm(opts) {
110
+ if (!isInteractive() && !opts?.required) {
111
+ return Promise.resolve(opts?.default ?? true);
112
+ }
113
+
114
+ assertInteractive();
115
+ return _confirm(opts, _streams || undefined);
116
+ }
117
+
118
+ /**
119
+ * Launch the OS browser for a URL. Dependency-free `open`: darwin `open`,
120
+ * win32 `start`, else `xdg-open`. Fire-and-forget; failures are the
121
+ * caller's printed-URL fallback. Exposed for tests (openCommand).
122
+ */
123
+ function openCommand() {
124
+ if (process.platform === 'darwin') {
125
+ return 'open';
126
+ }
127
+ if (process.platform === 'win32') {
128
+ return 'start';
129
+ }
130
+ return 'xdg-open';
131
+ }
132
+
133
+ function openInBrowser(url) {
134
+ const { spawn } = require('node:child_process');
135
+ try {
136
+ const child = spawn(openCommand(), [url], { stdio: 'ignore', detached: true, shell: process.platform === 'win32' });
137
+ child.unref();
138
+ return true;
139
+ } catch (e) {
140
+ return false;
141
+ }
142
+ }
143
+
144
+ /**
145
+ * The ONE wording for the Enter gate in front of every browser open —
146
+ * pressEnterToOpen and flows.openBrowserAndPoll both speak it, so every
147
+ * URL ask in the walkthrough is synonymous.
148
+ */
149
+ function enterToOpenMessage(label = 'this page') {
150
+ return `Press Enter to open ${label} in your browser...`;
151
+ }
152
+
153
+ /**
154
+ * The onboarding walkthrough pattern (omega-manager convention): "Press
155
+ * Enter to open <label> in your browser". Interactive: waits for Enter,
156
+ * opens the URL, returns true. Non-interactive: prints the URL and returns
157
+ * false so callers know the human never saw a browser. The URL is always
158
+ * printed either way — terminals with link support stay clickable.
159
+ */
160
+ async function pressEnterToOpen(url, label = 'this page') {
161
+ const output = _streams?.output || process.stdout;
162
+ output.write(` → ${url}\n`);
163
+
164
+ if (!isInteractive()) {
165
+ return false;
166
+ }
167
+
168
+ await _input({ message: enterToOpenMessage(label) }, _streams || undefined);
169
+ // Via module.exports so tests can stub the actual browser launch
170
+ module.exports.openInBrowser(url);
171
+ return true;
172
+ }
173
+
174
+ module.exports = {
175
+ isInteractive,
176
+ getPromptStreams,
177
+ input,
178
+ password,
179
+ select,
180
+ checkbox,
181
+ confirm,
182
+ setPromptStreams,
183
+ enterToOpenMessage,
184
+ pressEnterToOpen,
185
+ openInBrowser,
186
+ openCommand,
187
+ };
@@ -0,0 +1,18 @@
1
+ // safeInstall(command) — run a shell command, routing `npm install` through Socket
2
+ // Firewall (sfw) when it's available so dependency trees are scanned for malware,
3
+ // typosquats, and supply-chain attacks before download. Non-install commands and
4
+ // machines without sfw pass through unchanged.
5
+
6
+ const { execute } = require('node-powertools');
7
+
8
+ let _hasSfw;
9
+ async function safeInstall(command, options) {
10
+ if (_hasSfw === undefined) {
11
+ _hasSfw = await execute('sfw --version', { log: false }).then(() => true).catch(() => false);
12
+ }
13
+ const isInstall = /^npm\s+(install|i)\b/.test(command);
14
+ const prefix = (_hasSfw && isInstall) ? 'sfw ' : '';
15
+ return execute(`${prefix}${command}`, options || { log: true });
16
+ }
17
+
18
+ module.exports = { safeInstall };