@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.
- package/.claude-plugin/marketplace.json +14 -0
- package/LICENSE +98 -0
- package/README.md +165 -0
- package/bin/omega +2 -0
- package/bin/omg +2 -0
- package/claude-plugin/.claude-plugin/plugin.json +11 -0
- package/claude-plugin/.mcp.json +9 -0
- package/claude-plugin/README.md +139 -0
- package/claude-plugin/hooks/gate/mark.sh +58 -0
- package/claude-plugin/hooks/gate/run.sh +97 -0
- package/claude-plugin/hooks/guard/run.sh +249 -0
- package/claude-plugin/hooks/hooks.json +63 -0
- package/claude-plugin/hooks/inject/run.sh +127 -0
- package/claude-plugin/hooks/lib/omega-gate.sh +20 -0
- package/claude-plugin/hooks/lib/omega-scope.sh +41 -0
- package/claude-plugin/hooks/lib/omega-skills.sh +209 -0
- package/claude-plugin/hooks/quality/run.sh +132 -0
- package/claude-plugin/hooks/shape/run.sh +45 -0
- package/claude-plugin/mcp-router-launch.js +29 -0
- package/claude-plugin/skills/README.md +48 -0
- package/claude-plugin/skills/accessibility/SKILL.md +31 -0
- package/claude-plugin/skills/analytics/SKILL.md +30 -0
- package/claude-plugin/skills/backend/SKILL.md +25 -0
- package/claude-plugin/skills/brandcheck/SKILL.md +29 -0
- package/claude-plugin/skills/browser/SKILL.md +64 -0
- package/claude-plugin/skills/client/SKILL.md +24 -0
- package/claude-plugin/skills/desktop/SKILL.md +25 -0
- package/claude-plugin/skills/extension/SKILL.md +25 -0
- package/claude-plugin/skills/main/SKILL.md +54 -0
- package/claude-plugin/skills/manager/SKILL.md +25 -0
- package/claude-plugin/skills/seo/SKILL.md +36 -0
- package/claude-plugin/skills/theme/SKILL.md +33 -0
- package/claude-plugin/skills/web/SKILL.md +29 -0
- package/dist/cli-run.js +34 -0
- package/dist/cli.js +29 -0
- package/dist/commands/build.js +17 -0
- package/dist/commands/clean.js +16 -0
- package/dist/commands/company.js +46 -0
- package/dist/commands/deploy.js +143 -0
- package/dist/commands/dev.js +437 -0
- package/dist/commands/devlog.js +25 -0
- package/dist/commands/help.js +48 -0
- package/dist/commands/manage.js +53 -0
- package/dist/commands/migrate.js +76 -0
- package/dist/commands/onboard.js +31 -0
- package/dist/commands/pipeline.js +319 -0
- package/dist/commands/test.js +380 -0
- package/dist/commands/update.js +128 -0
- package/dist/commands/version.js +8 -0
- package/dist/company-init.js +167 -0
- package/dist/company.js +283 -0
- package/dist/config.js +1359 -0
- package/dist/devlog/index.js +226 -0
- package/dist/devlog/lib/collect-commits.js +136 -0
- package/dist/devlog/lib/generate-post.js +201 -0
- package/dist/devlog/lib/ghostii.js +122 -0
- package/dist/devlog/lib/project-map.js +98 -0
- package/dist/devlog/lib/publish-website.js +88 -0
- package/dist/index.js +45 -0
- package/dist/lib/agents-md.js +201 -0
- package/dist/lib/analytics-secret.js +22 -0
- package/dist/lib/argv.js +21 -0
- package/dist/lib/auth-admin.js +120 -0
- package/dist/lib/automation-client.js +210 -0
- package/dist/lib/backend-marketing.js +49 -0
- package/dist/lib/brand.js +240 -0
- package/dist/lib/bundle-id.js +53 -0
- package/dist/lib/claude-settings.js +125 -0
- package/dist/lib/company-scaffold.js +213 -0
- package/dist/lib/company.js +227 -0
- package/dist/lib/config-flow.js +350 -0
- package/dist/lib/config-write.js +41 -0
- package/dist/lib/custom-target.js +75 -0
- package/dist/lib/domain-utils.js +19 -0
- package/dist/lib/duration.js +39 -0
- package/dist/lib/env-order.js +236 -0
- package/dist/lib/env-secret.js +78 -0
- package/dist/lib/firestore-rest.js +326 -0
- package/dist/lib/framework-bin.js +156 -0
- package/dist/lib/gitignore.js +63 -0
- package/dist/lib/google-auth.js +495 -0
- package/dist/lib/google-token.js +66 -0
- package/dist/lib/jwt.js +31 -0
- package/dist/lib/legacy-oauth.js +59 -0
- package/dist/lib/node-version.js +127 -0
- package/dist/lib/owner-plan.js +78 -0
- package/dist/lib/package-scripts.js +152 -0
- package/dist/lib/preflight.js +470 -0
- package/dist/lib/product-create.js +144 -0
- package/dist/lib/run-command.js +74 -0
- package/dist/lib/run-gates.js +70 -0
- package/dist/lib/run-output.js +42 -0
- package/dist/lib/run-summary.js +384 -0
- package/dist/lib/scaffold.js +427 -0
- package/dist/lib/service-input.js +207 -0
- package/dist/lib/service-runner.js +466 -0
- package/dist/lib/stale.js +24 -0
- package/dist/lib/target-selection.js +155 -0
- package/dist/lib/verb-fanout.js +128 -0
- package/dist/lib/verify-live.js +188 -0
- package/dist/manage.js +311 -0
- package/dist/omega-bin.js +7 -0
- package/dist/onboard.js +532 -0
- package/dist/services/account/ensure/users.js +259 -0
- package/dist/services/account/index.js +97 -0
- package/dist/services/account/lib/backend-client.js +107 -0
- package/dist/services/account/lib/password.js +36 -0
- package/dist/services/account/lib/resolve-password.js +100 -0
- package/dist/services/advertising/ensure/sites.js +101 -0
- package/dist/services/advertising/index.js +101 -0
- package/dist/services/advertising/lib/adsense-api.js +41 -0
- package/dist/services/ai/ensure/keys.js +21 -0
- package/dist/services/ai/index.js +36 -0
- package/dist/services/analytics/ensure/google-firebase-link.js +230 -0
- package/dist/services/analytics/ensure/google-streams.js +256 -0
- package/dist/services/analytics/ensure/meta-pixel.js +22 -0
- package/dist/services/analytics/ensure/tiktok-pixel.js +22 -0
- package/dist/services/analytics/index.js +134 -0
- package/dist/services/analytics/lib/analytics-api.js +156 -0
- package/dist/services/analytics/lib/meta-api.js +83 -0
- package/dist/services/analytics/lib/pixel-account.js +78 -0
- package/dist/services/analytics/lib/pixel-provision.js +152 -0
- package/dist/services/analytics/lib/pixel-specs.js +57 -0
- package/dist/services/analytics/lib/pixel-token.js +88 -0
- package/dist/services/analytics/lib/property-flow.js +77 -0
- package/dist/services/analytics/lib/tiktok-api.js +157 -0
- package/dist/services/analytics/lib/tiktok-auth.js +153 -0
- package/dist/services/assets/ensure/logo-gen.js +68 -0
- package/dist/services/assets/index.js +109 -0
- package/dist/services/assets/lib/assets-config.js +168 -0
- package/dist/services/assets/lib/brandmark-api.js +160 -0
- package/dist/services/assets/lib/derived.js +113 -0
- package/dist/services/assets/lib/font-loader.js +67 -0
- package/dist/services/assets/lib/reconcile.js +122 -0
- package/dist/services/assets/lib/reset.js +118 -0
- package/dist/services/assets/lib/svg-logo-generator.js +154 -0
- package/dist/services/assets/lib/svg-to-black.js +32 -0
- package/dist/services/assets/write/favicons.js +82 -0
- package/dist/services/assets/write/icons.js +64 -0
- package/dist/services/assets/write/process.js +96 -0
- package/dist/services/assets/write/reconcile.js +30 -0
- package/dist/services/assets/write/social-icons.js +108 -0
- package/dist/services/assets/write/templates.js +345 -0
- package/dist/services/bookmark/ensure/sync.js +255 -0
- package/dist/services/bookmark/index.js +17 -0
- package/dist/services/campaigns/ensure/contact-person.js +40 -0
- package/dist/services/campaigns/ensure/custom-fields.js +84 -0
- package/dist/services/campaigns/ensure/domain-auth.js +92 -0
- package/dist/services/campaigns/ensure/event-webhook.js +89 -0
- package/dist/services/campaigns/ensure/link-branding.js +187 -0
- package/dist/services/campaigns/ensure/list.js +50 -0
- package/dist/services/campaigns/ensure/segments.js +109 -0
- package/dist/services/campaigns/ensure/sender-identity.js +153 -0
- package/dist/services/campaigns/ensure/unsubscribe-groups.js +116 -0
- package/dist/services/campaigns/index.js +79 -0
- package/dist/services/campaigns/lib/dns-sync.js +81 -0
- package/dist/services/campaigns/lib/segment-query.js +138 -0
- package/dist/services/campaigns/lib/sendgrid-api.js +287 -0
- package/dist/services/captcha/ensure/site-key.js +83 -0
- package/dist/services/captcha/index.js +78 -0
- package/dist/services/captcha/lib/console-url.js +45 -0
- package/dist/services/captcha/lib/recaptcha-api.js +36 -0
- package/dist/services/certificates/ensure/api-key.js +22 -0
- package/dist/services/certificates/ensure/bundle-ids.js +115 -0
- package/dist/services/certificates/ensure/certificates.js +187 -0
- package/dist/services/certificates/ensure/profiles.js +143 -0
- package/dist/services/certificates/index.js +225 -0
- package/dist/services/certificates/lib/apple-api.js +183 -0
- package/dist/services/certificates/lib/certificate-manager.js +252 -0
- package/dist/services/certificates/lib/identifier-manager.js +107 -0
- package/dist/services/certificates/lib/keychain.js +135 -0
- package/dist/services/certificates/lib/manual-walkthrough.js +165 -0
- package/dist/services/certificates/lib/profile-manager.js +115 -0
- package/dist/services/chat/data/baseline-knowledge.md +96 -0
- package/dist/services/chat/ensure/chat.js +106 -0
- package/dist/services/chat/ensure/user.js +45 -0
- package/dist/services/chat/index.js +139 -0
- package/dist/services/chat/lib/baseline-knowledge.js +137 -0
- package/dist/services/cloud/ensure/authentication.js +267 -0
- package/dist/services/cloud/ensure/billing.js +120 -0
- package/dist/services/cloud/ensure/cloud-messaging.js +105 -0
- package/dist/services/cloud/ensure/database.js +60 -0
- package/dist/services/cloud/ensure/firestore.js +79 -0
- package/dist/services/cloud/ensure/functions.js +49 -0
- package/dist/services/cloud/ensure/hosting.js +398 -0
- package/dist/services/cloud/ensure/oauth-consent.js +248 -0
- package/dist/services/cloud/ensure/project-settings.js +72 -0
- package/dist/services/cloud/ensure/sdk-config.js +95 -0
- package/dist/services/cloud/ensure/service-account.js +152 -0
- package/dist/services/cloud/ensure/services.js +103 -0
- package/dist/services/cloud/ensure/storage.js +47 -0
- package/dist/services/cloud/index.js +130 -0
- package/dist/services/cloud/lib/access-heal.js +130 -0
- package/dist/services/cloud/lib/firebase-api.js +662 -0
- package/dist/services/cloud/lib/project-flow.js +102 -0
- package/dist/services/directory/ensure/entry.js +48 -0
- package/dist/services/directory/index.js +64 -0
- package/dist/services/directory/lib/blocks.js +104 -0
- package/dist/services/disperse/index.js +45 -0
- package/dist/services/disperse/write/certs.js +117 -0
- package/dist/services/domain/ensure/nameservers.js +179 -0
- package/dist/services/domain/index.js +69 -0
- package/dist/services/domain/lib/namecheap-api.js +167 -0
- package/dist/services/domain/lib/registrars.js +46 -0
- package/dist/services/domain/lib/whitelist-walkthrough.js +76 -0
- package/dist/services/edge/ensure/cache-rules.js +105 -0
- package/dist/services/edge/ensure/dns-records.js +304 -0
- package/dist/services/edge/ensure/email-routing.js +292 -0
- package/dist/services/edge/ensure/rules-configuration.js +98 -0
- package/dist/services/edge/ensure/rules-managed-transforms.js +101 -0
- package/dist/services/edge/ensure/rules-redirect.js +107 -0
- package/dist/services/edge/ensure/rules-response-headers.js +90 -0
- package/dist/services/edge/ensure/rules-security.js +142 -0
- package/dist/services/edge/ensure/speed-scheduled-tests.js +98 -0
- package/dist/services/edge/ensure/workers.js +219 -0
- package/dist/services/edge/ensure/zone-settings.js +108 -0
- package/dist/services/edge/ensure/zone.js +183 -0
- package/dist/services/edge/index.js +73 -0
- package/dist/services/edge/lib/cloudflare-api.js +84 -0
- package/dist/services/edge/lib/dns-records-helpers.js +518 -0
- package/dist/services/edge/lib/read-cache.js +16 -0
- package/dist/services/edge/lib/ruleset-helper.js +108 -0
- package/dist/services/edge/workers/omega-api-proxy.js +43 -0
- package/dist/services/email/data/baseline-filter.md +4 -0
- package/dist/services/email/data/baseline-knowledge.md +86 -0
- package/dist/services/email/ensure/agent.js +107 -0
- package/dist/services/email/ensure/user.js +45 -0
- package/dist/services/email/index.js +138 -0
- package/dist/services/email/lib/baseline.js +82 -0
- package/dist/services/email/lib/knowledge-file.js +53 -0
- package/dist/services/forms/ensure/form.js +46 -0
- package/dist/services/forms/ensure/user.js +45 -0
- package/dist/services/forms/index.js +138 -0
- package/dist/services/migrations/ensure/notifications.js +189 -0
- package/dist/services/migrations/ensure/orders.js +34 -0
- package/dist/services/migrations/ensure/payment-provider.js +132 -0
- package/dist/services/migrations/ensure/payments-intents.js +34 -0
- package/dist/services/migrations/ensure/state-retirement.js +266 -0
- package/dist/services/migrations/ensure/targets-rename.js +124 -0
- package/dist/services/migrations/ensure/users.js +1176 -0
- package/dist/services/migrations/index.js +101 -0
- package/dist/services/migrations/lib/attribution-touch.js +64 -0
- package/dist/services/migrations/lib/ensure-metadata.js +144 -0
- package/dist/services/migrations/lib/migration-runner.js +473 -0
- package/dist/services/migrations/lib/sanitize-strings.js +112 -0
- package/dist/services/migrations/lib/schema-validator.js +154 -0
- package/dist/services/monitoring/ensure/dsn.js +54 -0
- package/dist/services/monitoring/ensure/projects.js +135 -0
- package/dist/services/monitoring/index.js +54 -0
- package/dist/services/monitoring/lib/sentry-api.js +94 -0
- package/dist/services/newsletter/ensure/custom-fields.js +90 -0
- package/dist/services/newsletter/ensure/publication.js +94 -0
- package/dist/services/newsletter/ensure/segments.js +140 -0
- package/dist/services/newsletter/ensure/webhook.js +108 -0
- package/dist/services/newsletter/index.js +64 -0
- package/dist/services/newsletter/lib/beehiiv-api.js +124 -0
- package/dist/services/newsletter/lib/segment-automation.js +577 -0
- package/dist/services/payment/ensure/chargebee-account.js +30 -0
- package/dist/services/payment/ensure/chargebee-products.js +359 -0
- package/dist/services/payment/ensure/chargebee-webhook.js +113 -0
- package/dist/services/payment/ensure/paypal-account.js +36 -0
- package/dist/services/payment/ensure/paypal-products.js +374 -0
- package/dist/services/payment/ensure/paypal-webhook.js +128 -0
- package/dist/services/payment/ensure/stripe-account.js +93 -0
- package/dist/services/payment/ensure/stripe-disputes.js +56 -0
- package/dist/services/payment/ensure/stripe-products.js +245 -0
- package/dist/services/payment/ensure/stripe-radar.js +74 -0
- package/dist/services/payment/ensure/stripe-webhook.js +130 -0
- package/dist/services/payment/index.js +163 -0
- package/dist/services/payment/lib/chargebee-api.js +338 -0
- package/dist/services/payment/lib/payment-utils.js +116 -0
- package/dist/services/payment/lib/paypal-api.js +354 -0
- package/dist/services/payment/lib/provider-setup.js +134 -0
- package/dist/services/payment/lib/stripe-api.js +152 -0
- package/dist/services/repo/ensure/org.js +70 -0
- package/dist/services/repo/ensure/pages.js +72 -0
- package/dist/services/repo/ensure/repo.js +90 -0
- package/dist/services/repo/index.js +52 -0
- package/dist/services/repo/lib/github-api.js +196 -0
- package/dist/services/search/ensure/ga-link.js +57 -0
- package/dist/services/search/ensure/property.js +137 -0
- package/dist/services/search/ensure/sitemaps.js +70 -0
- package/dist/services/search/index.js +61 -0
- package/dist/services/search/lib/search-console-api.js +92 -0
- package/dist/services/seo/ensure/github-repos.js +271 -0
- package/dist/services/seo/index.js +55 -0
- package/dist/services/seo/lib/gh-api.js +161 -0
- package/dist/services/seo/templates/developer-tool/.github/workflows/maintenance.yml +25 -0
- package/dist/services/seo/templates/developer-tool/.nvmrc +1 -0
- package/dist/services/seo/templates/developer-tool/_README.md.js +121 -0
- package/dist/services/seo/templates/developer-tool/_package.json.js +33 -0
- package/dist/services/seo/templates/developer-tool/src/index.js +120 -0
- package/dist/services/seo/templates/index.js +57 -0
- package/dist/services/server/ensure/brands.js +63 -0
- package/dist/services/server/index.js +42 -0
- package/dist/services/testing/ensure/target-checks.js +97 -0
- package/dist/services/testing/index.js +11 -0
- package/dist/services/testing/lib/checks.js +467 -0
- package/dist/services/update/index.js +20 -0
- package/dist/services/update/lib/cache.js +59 -0
- package/dist/services/update/lib/fingerprint.js +157 -0
- package/dist/services/update/write/targets.js +206 -0
- package/dist/services/workspace/ensure/agents.js +42 -0
- package/dist/services/workspace/ensure/claude-settings.js +34 -0
- package/dist/services/workspace/ensure/config.js +54 -0
- package/dist/services/workspace/ensure/defaults.js +60 -0
- package/dist/services/workspace/ensure/env-keys.js +55 -0
- package/dist/services/workspace/ensure/env-order.js +66 -0
- package/dist/services/workspace/ensure/env-rules.js +97 -0
- package/dist/services/workspace/ensure/gitignore.js +18 -0
- package/dist/services/workspace/ensure/scripts.js +126 -0
- package/dist/services/workspace/ensure/structure.js +97 -0
- package/dist/services/workspace/ensure/translation-sdk.js +148 -0
- package/dist/services/workspace/ensure/workflows.js +54 -0
- package/dist/services/workspace/index.js +8 -0
- package/dist/vendor/account/engine.js +182 -0
- package/dist/vendor/account/features.js +220 -0
- package/dist/vendor/account/index.js +53 -0
- package/dist/vendor/account/schema.js +272 -0
- package/dist/vendor/account/subscription.js +38 -0
- package/dist/vendor/config/company.js +31 -0
- package/dist/vendor/config/defaults.js +173 -0
- package/dist/vendor/config/demo.js +18 -0
- package/dist/vendor/config/desktop-artifacts.js +110 -0
- package/dist/vendor/config/edit.js +769 -0
- package/dist/vendor/config/env-delivery.js +145 -0
- package/dist/vendor/config/env-rules.js +93 -0
- package/dist/vendor/config/env-schema.js +1078 -0
- package/dist/vendor/config/env.js +445 -0
- package/dist/vendor/config/hooks.js +97 -0
- package/dist/vendor/config/index.js +237 -0
- package/dist/vendor/config/instances.js +208 -0
- package/dist/vendor/config/load.js +490 -0
- package/dist/vendor/config/merge.js +68 -0
- package/dist/vendor/config/order.js +139 -0
- package/dist/vendor/config/ports.js +374 -0
- package/dist/vendor/config/providers.js +32 -0
- package/dist/vendor/config/repo.js +142 -0
- package/dist/vendor/config/retired-keys.js +430 -0
- package/dist/vendor/config/schema.js +1610 -0
- package/dist/vendor/config/secrets.js +50 -0
- package/dist/vendor/config/seed.js +34 -0
- package/dist/vendor/config/site-global.js +205 -0
- package/dist/vendor/config/validate.js +554 -0
- package/dist/vendor/config/winback.js +61 -0
- package/dist/vendor/devkit/attach-log-file.js +262 -0
- package/dist/vendor/devkit/certs.js +199 -0
- package/dist/vendor/devkit/ci-workflows.js +520 -0
- package/dist/vendor/devkit/cli-router.js +156 -0
- package/dist/vendor/devkit/command-path.js +46 -0
- package/dist/vendor/devkit/deploy-record.js +180 -0
- package/dist/vendor/devkit/flows.js +317 -0
- package/dist/vendor/devkit/local-https.js +360 -0
- package/dist/vendor/devkit/local.js +1905 -0
- package/dist/vendor/devkit/logger.js +128 -0
- package/dist/vendor/devkit/omega-bin.js +345 -0
- package/dist/vendor/devkit/prompt.js +187 -0
- package/dist/vendor/devkit/safe-install.js +18 -0
- package/dist/vendor/devkit/stop-signals.js +28 -0
- package/dist/vendor/devkit/test/scope.js +162 -0
- package/dist/vendor/devkit/translate/cache.js +84 -0
- package/dist/vendor/devkit/translate/engine.js +243 -0
- package/dist/vendor/devkit/translate/index.js +49 -0
- package/dist/vendor/devkit/translate/languages.js +134 -0
- package/dist/vendor/devkit/translate/providers.js +188 -0
- package/dist/vendor/devkit/update.js +569 -0
- package/docs/AGENTS.md +200 -0
- package/docs/account.md +45 -0
- package/docs/advertising.md +46 -0
- package/docs/ai.md +34 -0
- package/docs/analytics.md +69 -0
- package/docs/assets.md +57 -0
- package/docs/bookmark.md +26 -0
- package/docs/brand.md +151 -0
- package/docs/campaigns.md +96 -0
- package/docs/captcha.md +46 -0
- package/docs/certificates.md +68 -0
- package/docs/chat.md +47 -0
- package/docs/cloud.md +110 -0
- package/docs/company.md +64 -0
- package/docs/directory.md +140 -0
- package/docs/disperse.md +46 -0
- package/docs/domain.md +56 -0
- package/docs/edge.md +234 -0
- package/docs/email.md +42 -0
- package/docs/forms.md +48 -0
- package/docs/index.md +109 -0
- package/docs/migration.md +203 -0
- package/docs/migrations.md +56 -0
- package/docs/monitoring.md +41 -0
- package/docs/newsletter.md +48 -0
- package/docs/payment.md +83 -0
- package/docs/repo.md +48 -0
- package/docs/search.md +44 -0
- package/docs/seo.md +34 -0
- package/docs/server.md +37 -0
- package/docs/shared/agent-docs.md +89 -0
- package/docs/shared/analytics.md +612 -0
- package/docs/shared/brands.md +51 -0
- package/docs/shared/breaking-changes.md +497 -0
- package/docs/shared/config.md +1387 -0
- package/docs/shared/deploys.md +215 -0
- package/docs/shared/icons.md +201 -0
- package/docs/shared/local-dev.md +147 -0
- package/docs/shared/logging.md +202 -0
- package/docs/shared/monitoring.md +153 -0
- package/docs/shared/publishing.md +183 -0
- package/docs/shared/rulings.md +34 -0
- package/docs/shared/testing.md +147 -0
- package/docs/shared/theming.md +604 -0
- package/docs/shared/translation.md +291 -0
- package/docs/shared/updates.md +61 -0
- package/docs/testing.md +34 -0
- package/docs/update.md +36 -0
- package/docs/workspace.md +64 -0
- package/package.json +88 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* node-version — resolve which Node a target's commands run under, from its
|
|
3
|
+
* own `.nvmrc` (friction #15: one brand spans Node majors — web pins 24,
|
|
4
|
+
* backend functions pin 22 — so the manager drives each target's commands
|
|
5
|
+
* under THAT target's Node instead of whatever it was launched with).
|
|
6
|
+
*
|
|
7
|
+
* Ported from legacy omega-manager's update-service resolution: the pinned
|
|
8
|
+
* major is matched against nvm's installed versions ($NVM_DIR/versions/node,
|
|
9
|
+
* highest patch wins) and that version's bin dir is prepended to PATH for
|
|
10
|
+
* the spawned command — node, npm, and npx all resolve to it. No .nvmrc →
|
|
11
|
+
* inherited PATH. Pinned major not installed → a hard error naming the
|
|
12
|
+
* `nvm install` to run.
|
|
13
|
+
*/
|
|
14
|
+
const path = require('node:path');
|
|
15
|
+
const os = require('node:os');
|
|
16
|
+
const jetpack = require('fs-jetpack');
|
|
17
|
+
|
|
18
|
+
/** nvm's installed-versions dir (resolved per call — tests override NVM_DIR). */
|
|
19
|
+
function nvmVersionsDir() {
|
|
20
|
+
return path.join(process.env.NVM_DIR || path.join(os.homedir(), '.nvm'), 'versions', 'node');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parse the Node major out of an .nvmrc spec ('v24/*', 'v24', '24', '24.1.0' → 24).
|
|
25
|
+
*
|
|
26
|
+
* @param {string} content - Raw .nvmrc content.
|
|
27
|
+
* @returns {number|null} The major, or null when unparseable.
|
|
28
|
+
*/
|
|
29
|
+
function parseNvmrcMajor(content) {
|
|
30
|
+
const match = String(content || '').trim().match(/^v?(\d+)/);
|
|
31
|
+
return match ? Number(match[1]) : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Find the target's .nvmrc — the target root is the ONE authored home (the
|
|
36
|
+
* backend's stage step copies it into dist/ for the Firebase runtime).
|
|
37
|
+
*
|
|
38
|
+
* @param {string} targetDir - The target directory commands run in.
|
|
39
|
+
* @returns {{ spec: string, file: string }|null} The trimmed spec + its file.
|
|
40
|
+
*/
|
|
41
|
+
function findNvmrc(targetDir) {
|
|
42
|
+
const file = path.join(targetDir, '.nvmrc');
|
|
43
|
+
const content = jetpack.read(file);
|
|
44
|
+
if (content && content.trim()) {
|
|
45
|
+
return { spec: content.trim(), file };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Find the highest nvm-installed Node for a major (24 → { version, binDir }).
|
|
52
|
+
*
|
|
53
|
+
* @param {number} major - Required Node major.
|
|
54
|
+
* @returns {{ version: string, binDir: string }|null} Best install, or null.
|
|
55
|
+
*/
|
|
56
|
+
function findInstalledNode(major) {
|
|
57
|
+
const versions = (jetpack.list(nvmVersionsDir()) || [])
|
|
58
|
+
.map((name) => {
|
|
59
|
+
const match = name.match(/^v(\d+)\.(\d+)\.(\d+)$/);
|
|
60
|
+
return match ? { name, parts: [Number(match[1]), Number(match[2]), Number(match[3])] } : null;
|
|
61
|
+
})
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.filter((v) => v.parts[0] === major)
|
|
64
|
+
.sort((a, b) => b.parts[1] - a.parts[1] || b.parts[2] - a.parts[2]);
|
|
65
|
+
|
|
66
|
+
if (!versions.length) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
version: versions[0].name,
|
|
71
|
+
binDir: path.join(nvmVersionsDir(), versions[0].name, 'bin'),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Resolve which Node a target's commands should run under.
|
|
77
|
+
*
|
|
78
|
+
* @param {string} targetDir - The directory the command will run in.
|
|
79
|
+
* @returns {null|object} null (no/unparseable .nvmrc: inherited PATH),
|
|
80
|
+
* { major, spec, file, version, binDir } (binDir null when the current
|
|
81
|
+
* Node already matches), or { major, spec, file, error } (major not
|
|
82
|
+
* installed in nvm).
|
|
83
|
+
*/
|
|
84
|
+
function resolveTargetNode(targetDir) {
|
|
85
|
+
const found = findNvmrc(targetDir);
|
|
86
|
+
if (!found) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const major = parseNvmrcMajor(found.spec);
|
|
91
|
+
if (!major) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const currentMajor = Number(process.versions.node.split('.')[0]);
|
|
96
|
+
if (major === currentMajor) {
|
|
97
|
+
return { major, spec: found.spec, file: found.file, version: `v${process.versions.node}`, binDir: null };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const installed = findInstalledNode(major);
|
|
101
|
+
if (!installed) {
|
|
102
|
+
return {
|
|
103
|
+
major,
|
|
104
|
+
spec: found.spec,
|
|
105
|
+
file: found.file,
|
|
106
|
+
error: `Node v${major} required by .nvmrc (${found.spec}) is not installed — run: nvm install ${major}`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return { major, spec: found.spec, file: found.file, version: installed.version, binDir: installed.binDir };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Env overrides for a spawned command so node/npm/npx resolve to the target's
|
|
115
|
+
* Node ({} when the inherited PATH is already right).
|
|
116
|
+
*
|
|
117
|
+
* @param {object|null} resolved - A resolveTargetNode() result.
|
|
118
|
+
* @returns {object} Env override ({ PATH } or {}).
|
|
119
|
+
*/
|
|
120
|
+
function nodeEnvFor(resolved) {
|
|
121
|
+
if (!resolved?.binDir) {
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
124
|
+
return { PATH: `${resolved.binDir}${path.delimiter}${process.env.PATH}` };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = { parseNvmrcMajor, findInstalledNode, resolveTargetNode, nodeEnvFor };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared comp-plan reconciliation for the operator-product services
|
|
3
|
+
* (forms, chat, email): the brand's owner account on the product is
|
|
4
|
+
* set to the configured plan as an internal comp.
|
|
5
|
+
*
|
|
6
|
+
* Diff-synced on the subscription's leaf fields, and the patch masks only
|
|
7
|
+
* those leaves — sibling subscription fields written by the product's own
|
|
8
|
+
* backend (trial, cancellation flags, …) survive, exactly like the admin
|
|
9
|
+
* SDK merge-write this replaces. A missing user document is created by the
|
|
10
|
+
* same patch.
|
|
11
|
+
*/
|
|
12
|
+
const chalk = require('chalk').default;
|
|
13
|
+
|
|
14
|
+
const SUBSCRIPTION_FIELD_PATHS = [
|
|
15
|
+
'subscription.product.id',
|
|
16
|
+
'subscription.product.name',
|
|
17
|
+
'subscription.status',
|
|
18
|
+
'subscription.payment.provider',
|
|
19
|
+
'subscription.payment.frequency',
|
|
20
|
+
'subscription.payment.price',
|
|
21
|
+
'subscription.payment.resourceId',
|
|
22
|
+
'subscription.payment.orderId',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Ensure the owner account's subscription matches the comp plan.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} params
|
|
29
|
+
* @param {Object} params.db - FirestoreREST client (or test fake)
|
|
30
|
+
* @param {string} params.ownerUid - The owner account's UID
|
|
31
|
+
* @param {{ id: string, name: string }} params.plan - The plan to grant
|
|
32
|
+
* @param {boolean} params.dryRun - Report the patch instead of writing it
|
|
33
|
+
* @returns {'synced'|'planned'|'updated'}
|
|
34
|
+
*/
|
|
35
|
+
async function ensureOwnerPlan({ db, ownerUid, plan, dryRun }) {
|
|
36
|
+
// Subscription shape matches the @omega.js/backend user schema
|
|
37
|
+
const desired = {
|
|
38
|
+
product: { id: plan.id, name: plan.name },
|
|
39
|
+
status: 'active',
|
|
40
|
+
payment: {
|
|
41
|
+
provider: 'internal',
|
|
42
|
+
frequency: 'annually',
|
|
43
|
+
price: 0,
|
|
44
|
+
resourceId: null,
|
|
45
|
+
orderId: null,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const user = await db.getDoc(`users/${ownerUid}`);
|
|
50
|
+
const sub = user?.subscription || {};
|
|
51
|
+
|
|
52
|
+
const drifted = sub.product?.id !== plan.id
|
|
53
|
+
|| sub.product?.name !== plan.name
|
|
54
|
+
|| sub.status !== 'active'
|
|
55
|
+
|| sub.payment?.provider !== 'internal'
|
|
56
|
+
|| sub.payment?.frequency !== 'annually'
|
|
57
|
+
|| sub.payment?.price !== 0
|
|
58
|
+
|| (sub.payment?.resourceId ?? null) !== null
|
|
59
|
+
|| (sub.payment?.orderId ?? null) !== null;
|
|
60
|
+
|
|
61
|
+
if (!drifted) {
|
|
62
|
+
console.log(` ${chalk.green('✓')} User ${chalk.dim(ownerUid)} already on ${chalk.cyan(plan.name)} plan ${chalk.dim('(internal)')}`);
|
|
63
|
+
return 'synced';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (dryRun) {
|
|
67
|
+
console.log(` ${chalk.yellow('[DRY RUN]')} Would set user ${chalk.cyan(ownerUid)} to ${chalk.cyan(plan.name)} plan ${chalk.dim('(internal)')}`);
|
|
68
|
+
return 'planned';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await db.patchDoc(`users/${ownerUid}`, { subscription: desired }, SUBSCRIPTION_FIELD_PATHS);
|
|
72
|
+
|
|
73
|
+
console.log(` ${chalk.green('✓')} User ${chalk.dim(ownerUid)} set to ${chalk.cyan(plan.name)} plan ${chalk.dim('(internal)')}`);
|
|
74
|
+
|
|
75
|
+
return 'updated';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = { ensureOwnerPlan, SUBSCRIPTION_FIELD_PATHS };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand-root package.json script healing — guarantees a `deploy` script, so
|
|
3
|
+
* `npm run deploy` works in every brand, and migrates the legacy
|
|
4
|
+
* `start: 'omega'` shape to the current convention (`npm start` boots the dev
|
|
5
|
+
* stack, `npm run manage` runs the manage cycle — as the NAMED verb
|
|
6
|
+
* `omega manage` since #229). Script VALUES only, and
|
|
7
|
+
* only the ones named here: every other script, key, and ordering is untouched.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// The scripts minted when a brand root is missing them
|
|
11
|
+
const DEPLOY_SCRIPT = 'omega deploy';
|
|
12
|
+
const START_SCRIPT = 'omega dev';
|
|
13
|
+
const MANAGE_SCRIPT = 'omega manage';
|
|
14
|
+
|
|
15
|
+
// The pre-migration `start` value: a bare manage cycle on `npm start`
|
|
16
|
+
const LEGACY_START_SCRIPT = 'omega';
|
|
17
|
+
|
|
18
|
+
// The pre-migration `manage` value: a bare `omega` prints help now (#229),
|
|
19
|
+
// so a brand still carrying it would run nothing at all
|
|
20
|
+
const LEGACY_MANAGE_SCRIPT = 'omega';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Heal a package.json's scripts map. Pure — never touches disk.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} pkg - parsed package.json
|
|
26
|
+
* @returns {{ scripts: Object, changes: string[] }}
|
|
27
|
+
* scripts = the healed map (same key order, minted scripts appended)
|
|
28
|
+
* changes = one `key: 'value'` line per heal, empty when converged
|
|
29
|
+
*/
|
|
30
|
+
function healPackageScripts(pkg) {
|
|
31
|
+
const scripts = { ...((pkg || {}).scripts || {}) };
|
|
32
|
+
const changes = [];
|
|
33
|
+
|
|
34
|
+
// The migration: only the legacy value moves — a brand that customized
|
|
35
|
+
// `start` to something of its own keeps it
|
|
36
|
+
if (scripts.start === LEGACY_START_SCRIPT) {
|
|
37
|
+
scripts.start = START_SCRIPT;
|
|
38
|
+
changes.push(`start: '${START_SCRIPT}'`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Minted whenever missing (a new key overwrites nothing): the manager's own
|
|
42
|
+
// retry hints print `npm run manage`, so every brand root must answer it.
|
|
43
|
+
// The same migration rule as `start` above — only the legacy value moves,
|
|
44
|
+
// a brand that customized `manage` keeps it.
|
|
45
|
+
if (!scripts.manage) {
|
|
46
|
+
scripts.manage = MANAGE_SCRIPT;
|
|
47
|
+
changes.push(`manage: '${MANAGE_SCRIPT}'`);
|
|
48
|
+
} else if (scripts.manage === LEGACY_MANAGE_SCRIPT) {
|
|
49
|
+
scripts.manage = MANAGE_SCRIPT;
|
|
50
|
+
changes.push(`manage: '${MANAGE_SCRIPT}'`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!scripts.deploy) {
|
|
54
|
+
scripts.deploy = DEPLOY_SCRIPT;
|
|
55
|
+
changes.push(`deploy: '${DEPLOY_SCRIPT}'`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { scripts, changes };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// The command #675 retired. Every pre-#675 framework `projectScripts` chained
|
|
62
|
+
// it — as the head (`npx omega setup && npx omega emulator`), mid-chain
|
|
63
|
+
// (`npx omega clean && npx omega setup && npm run gulp --`), or alone
|
|
64
|
+
// (`setup: 'npx omega setup'`). The command is gone, so any script still
|
|
65
|
+
// naming it dies at `Unknown command "setup"` (#707): the segment is
|
|
66
|
+
// framework-authored residue, never consumer intent.
|
|
67
|
+
const RETIRED_SETUP_COMMAND = 'npx omega setup';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The pre-#675 residue check: does this script value still run the retired
|
|
71
|
+
* command as one leg of its `&&` chain?
|
|
72
|
+
*/
|
|
73
|
+
function hasRetiredSetup(value) {
|
|
74
|
+
return value.split('&&').some((segment) => segment.trim() === RETIRED_SETUP_COMMAND);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The value with the retired leg dropped — `''` when the whole script WAS the
|
|
79
|
+
* retired command and nothing else is left to run.
|
|
80
|
+
*/
|
|
81
|
+
function withoutRetiredSetup(value) {
|
|
82
|
+
return value
|
|
83
|
+
.split('&&')
|
|
84
|
+
.map((segment) => segment.trim())
|
|
85
|
+
.filter((segment) => segment !== RETIRED_SETUP_COMMAND)
|
|
86
|
+
.join(' && ');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sync a TARGET manifest's scripts to its framework's own `projectScripts`
|
|
91
|
+
* declaration. ONE ownership policy (#689): a key the framework declares is
|
|
92
|
+
* FRAMEWORK-owned and takes the default value on every run — the walk and the
|
|
93
|
+
* framework's own ensureTarget agree, so a hand-edited standard script is
|
|
94
|
+
* rewritten either way and hook points are the customization seam. A key the
|
|
95
|
+
* framework never declares is the consumer's own and is never touched.
|
|
96
|
+
*
|
|
97
|
+
* Two rules, in order:
|
|
98
|
+
*
|
|
99
|
+
* 1. One-time migration (#707): a value still naming the retired
|
|
100
|
+
* `npx omega setup` (#675) is framework-authored residue — it takes the
|
|
101
|
+
* manifest's current value, or, for a key the manifest no longer declares,
|
|
102
|
+
* just loses that leg (and the key goes when nothing is left to run). Once
|
|
103
|
+
* rewritten nothing matches again, so no standing machinery accrues.
|
|
104
|
+
* 2. Overwrite-to-default for every declared key. This also covers the
|
|
105
|
+
* onboard→dev cycle break (#675): the framework's ensureTarget writes these
|
|
106
|
+
* on the first verb run, but the dev fan-out reaches that verb THROUGH
|
|
107
|
+
* these scripts, so a freshly scaffolded target needs them before any verb
|
|
108
|
+
* has ever run.
|
|
109
|
+
*
|
|
110
|
+
* `brandOwnedKeys` carves the exception out per key, never per target: a
|
|
111
|
+
* custom-server backend (#584) names its own `start`/`deploy` because those
|
|
112
|
+
* verbs refuse in that mode, so those keys are skipped by BOTH rules — never
|
|
113
|
+
* written, never scaffolded, not even a placeholder to delete.
|
|
114
|
+
*
|
|
115
|
+
* @param {Object} pkg - parsed target package.json
|
|
116
|
+
* @param {Object} projectScripts - the framework package's projectScripts map
|
|
117
|
+
* @param {string[]} [brandOwnedKeys] - declared keys this target owns instead
|
|
118
|
+
* @returns {{ scripts: Object, changes: string[], skipped: string[] }}
|
|
119
|
+
* skipped = the brand-owned keys the framework declares, for the report
|
|
120
|
+
*/
|
|
121
|
+
function syncTargetScripts(pkg, projectScripts, brandOwnedKeys = []) {
|
|
122
|
+
const scripts = { ...((pkg || {}).scripts || {}) };
|
|
123
|
+
const manifest = projectScripts || {};
|
|
124
|
+
const brandOwned = new Set(brandOwnedKeys);
|
|
125
|
+
const changes = [];
|
|
126
|
+
|
|
127
|
+
for (const [key, value] of Object.entries(scripts)) {
|
|
128
|
+
if (brandOwned.has(key) || !hasRetiredSetup(value)) continue;
|
|
129
|
+
|
|
130
|
+
const healed = manifest[key] === undefined ? withoutRetiredSetup(value) : manifest[key];
|
|
131
|
+
if (healed) {
|
|
132
|
+
scripts[key] = healed;
|
|
133
|
+
changes.push(`${key}: '${healed}' (was '${RETIRED_SETUP_COMMAND}')`);
|
|
134
|
+
} else {
|
|
135
|
+
delete scripts[key];
|
|
136
|
+
changes.push(`${key}: removed (was '${RETIRED_SETUP_COMMAND}')`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
141
|
+
if (brandOwned.has(key) || scripts[key] === value) continue;
|
|
142
|
+
|
|
143
|
+
scripts[key] = value;
|
|
144
|
+
changes.push(`${key}: '${value}'`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const skipped = Object.keys(manifest).filter((key) => brandOwned.has(key));
|
|
148
|
+
|
|
149
|
+
return { scripts, changes, skipped };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
module.exports = { healPackageScripts, syncTargetScripts, DEPLOY_SCRIPT, START_SCRIPT, MANAGE_SCRIPT };
|