@egbe-ai/opencode 0.0.0-stage → 0.1.8
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/LICENSE +4 -0
- package/README.md +124 -2
- package/index.js +5 -0
- package/package.json +55 -4
- package/plugin.js +230 -0
- package/session-log.js +315 -0
- package/skills/.egbe-catalog/manifest.json +1 -0
- package/skills/egbe-os-analytics/SKILL.md +499 -0
- package/skills/egbe-os-analytics/canonical-events.v1.json +256 -0
- package/skills/egbe-os-analytics/references/session-funnel.md +130 -0
- package/skills/egbe-os-analytics/references/workflows/activation-tracking.md +147 -0
- package/skills/egbe-os-analytics/references/workflows/landing-click-tracking.md +209 -0
- package/skills/egbe-os-analytics/references/workflows/payment-lifecycle-tracking.md +122 -0
- package/skills/egbe-os-analytics/references/workflows/product-funnel-tracking.md +77 -0
- package/skills/egbe-os-analytics/references/workflows/signup-lifecycle-tracking.md +208 -0
- package/skills/egbe-os-analytics/scripts/umami_funnel.py +927 -0
- package/skills/egbe-os-apollo-lead-finder/SKILL.md +135 -0
- package/skills/egbe-os-apollo-lead-finder/references/operations.md +240 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/enrich.js +6 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/enrich.sh +4 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/find-leads.js +6 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/find-leads.sh +4 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/lib/apollo-client.js +343 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/lib/connection-identity.js +17 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/lib/helpers.js +127 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/lib/places-filters.js +217 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/lib/sourcing.js +153 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/places-leads.js +653 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/places-leads.sh +4 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/search.js +6 -0
- package/skills/egbe-os-apollo-lead-finder/scripts/search.sh +4 -0
- package/skills/egbe-os-campaign-landing-page/SKILL.md +95 -0
- package/skills/egbe-os-campaign-landing-page/agents/openai.yaml +4 -0
- package/skills/egbe-os-campaign-landing-page/references/leads-calendar-and-tracking.md +66 -0
- package/skills/egbe-os-campaign-landing-page/references/os-wiring.md +58 -0
- package/skills/egbe-os-campaign-landing-page/references/qa.md +40 -0
- package/skills/egbe-os-campaign-landing-page/references/routing.md +32 -0
- package/skills/egbe-os-db/SKILL.md +174 -0
- package/skills/egbe-os-deploy/SKILL.md +412 -0
- package/skills/egbe-os-design/SKILL.md +182 -0
- package/skills/egbe-os-design-landing-page/SKILL.md +117 -0
- package/skills/egbe-os-design-landing-page/agents/openai.yaml +4 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/.dockerignore +11 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/AGENTS.md +31 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/Dockerfile +21 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/eslint.config.mjs +18 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/next.config.ts +11 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/package.json +36 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/postcss.config.mjs +7 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/public/.gitkeep +1 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/sentry.edge.config.ts +13 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/sentry.server.config.ts +13 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/app/global-error.tsx +19 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/app/globals.css +22 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/app/layout.tsx +21 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/app/page.tsx +3 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/app/privacy/page.tsx +28 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/components/egbe-analytics.tsx +39 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/instrumentation-client.ts +15 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/instrumentation.ts +13 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/lib/egbe-observability.generated.ts +20 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/src/lib/utils.ts +6 -0
- package/skills/egbe-os-design-landing-page/assets/scaffold/tsconfig.json +34 -0
- package/skills/egbe-os-design-landing-page/references/application-preparation.md +44 -0
- package/skills/egbe-os-design-landing-page/references/page-inputs.md +22 -0
- package/skills/egbe-os-destination-readiness/SKILL.md +132 -0
- package/skills/egbe-os-destination-readiness/references/checks.md +130 -0
- package/skills/egbe-os-destination-readiness/references/network-requirements.md +34 -0
- package/skills/egbe-os-destination-readiness/references/report.md +116 -0
- package/skills/egbe-os-domains/SKILL.md +189 -0
- package/skills/egbe-os-errors/SKILL.md +259 -0
- package/skills/egbe-os-git/SKILL.md +275 -0
- package/skills/egbe-os-git/references/issues.md +33 -0
- package/skills/egbe-os-google-ads/SKILL.md +163 -0
- package/skills/egbe-os-google-ads/references/artifacts.md +133 -0
- package/skills/egbe-os-google-ads/references/campaigns.md +157 -0
- package/skills/egbe-os-google-ads/references/conversions.md +153 -0
- package/skills/egbe-os-google-ads/references/delivery.md +128 -0
- package/skills/egbe-os-google-ads/references/keyword-ideas.md +40 -0
- package/skills/egbe-os-google-ads/references/reporting.md +105 -0
- package/skills/egbe-os-google-ads/references/search-assets.md +219 -0
- package/skills/egbe-os-google-ads/references/server-conversions.md +119 -0
- package/skills/egbe-os-google-auth/SKILL.md +285 -0
- package/skills/egbe-os-google-auth/agents/openai.yaml +4 -0
- package/skills/egbe-os-gtm-knowledge/SKILL.md +151 -0
- package/skills/egbe-os-images/SKILL.md +163 -0
- package/skills/egbe-os-images/references/stock-images.md +21 -0
- package/skills/egbe-os-instantly-campaign-launcher/SKILL.md +127 -0
- package/skills/egbe-os-instantly-campaign-launcher/references/instantly-ops.md +260 -0
- package/skills/egbe-os-instantly-campaign-launcher/references/observation-and-scheduling.md +188 -0
- package/skills/egbe-os-instantly-campaign-launcher/references/reply-handling.md +116 -0
- package/skills/egbe-os-instantly-campaign-launcher/references/run-spec-template.json +65 -0
- package/skills/egbe-os-instantly-campaign-launcher/references/run-state.md +145 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/conclude-campaign.js +158 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/install-crons.js +956 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/launch-campaign.js +2008 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/campaign-metrics.js +124 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/confirmed-opt-outs.js +208 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/connection-identity.js +17 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/create-once.js +23 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/gtm-identity.js +125 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/helpers.js +545 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/html-body.js +266 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/instantly-client.js +328 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/outreach-db.js +370 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/recipient-exclusion/index.js +86 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/replenish-test-harness.js +53 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/reply-queue.js +67 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/run-config.js +103 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/lib/sender-selection.js +105 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/monitor-campaign.js +607 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/outreach-report.js +147 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/replenish-leads.js +619 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/reply-worker.js +258 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/run-cron-job.js +32 -0
- package/skills/egbe-os-instantly-campaign-launcher/scripts/send-reply.js +260 -0
- package/skills/egbe-os-linkedin-ads/SKILL.md +114 -0
- package/skills/egbe-os-linkedin-ads/references/destination-requirements.md +30 -0
- package/skills/egbe-os-linkedin-ads/references/runtime/api-reference.md +154 -0
- package/skills/egbe-os-linkedin-ads/references/runtime/artifacts.md +63 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/build-paused.md +44 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/conversions.md +88 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/launch-and-pause.md +49 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/monitoring.md +35 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/readiness.md +63 -0
- package/skills/egbe-os-linkedin-ads/references/workflows/targeting-and-creative.md +52 -0
- package/skills/egbe-os-llm/SKILL.md +160 -0
- package/skills/egbe-os-mail/SKILL.md +180 -0
- package/skills/egbe-os-me/SKILL.md +119 -0
- package/skills/egbe-os-meta-ads/SKILL.md +114 -0
- package/skills/egbe-os-meta-ads/references/creative/creative-specs.md +15 -0
- package/skills/egbe-os-meta-ads/references/creative/talking-head.md +35 -0
- package/skills/egbe-os-meta-ads/references/destination-requirements.md +30 -0
- package/skills/egbe-os-meta-ads/references/runtime/api-reference.md +436 -0
- package/skills/egbe-os-meta-ads/references/runtime/artifacts.md +51 -0
- package/skills/egbe-os-meta-ads/references/runtime/insights-reference.md +187 -0
- package/skills/egbe-os-meta-ads/references/runtime/pixel-install.md +196 -0
- package/skills/egbe-os-meta-ads/references/runtime/shared-analytics-attribution.md +16 -0
- package/skills/egbe-os-meta-ads/references/workflows/build-paused.md +36 -0
- package/skills/egbe-os-meta-ads/references/workflows/launch-ready.md +16 -0
- package/skills/egbe-os-meta-ads/references/workflows/launch.md +23 -0
- package/skills/egbe-os-meta-ads/references/workflows/monitoring.md +72 -0
- package/skills/egbe-os-meta-ads/references/workflows/pause.md +17 -0
- package/skills/egbe-os-meta-ads/references/workflows/recovery.md +23 -0
- package/skills/egbe-os-meta-ads/scripts/check-pixel.py +229 -0
- package/skills/egbe-os-meta-ads/scripts/validate-meta-artifacts.py +187 -0
- package/skills/egbe-os-notifications/SKILL.md +78 -0
- package/skills/egbe-os-openai-ads/SKILL.md +149 -0
- package/skills/egbe-os-openai-ads/references/creative/chat-card.md +51 -0
- package/skills/egbe-os-openai-ads/references/destination-requirements.md +29 -0
- package/skills/egbe-os-openai-ads/references/runtime/api-reference.md +219 -0
- package/skills/egbe-os-openai-ads/references/runtime/artifacts.md +169 -0
- package/skills/egbe-os-openai-ads/references/workflows/build-paused.md +40 -0
- package/skills/egbe-os-openai-ads/references/workflows/conversions.md +40 -0
- package/skills/egbe-os-openai-ads/references/workflows/creative-assembly.md +24 -0
- package/skills/egbe-os-openai-ads/references/workflows/launch.md +27 -0
- package/skills/egbe-os-openai-ads/references/workflows/monitoring.md +54 -0
- package/skills/egbe-os-openai-ads/references/workflows/pause.md +22 -0
- package/skills/egbe-os-openai-ads/references/workflows/readiness.md +37 -0
- package/skills/egbe-os-openai-ads/references/workflows/tracking.md +32 -0
- package/skills/egbe-os-openai-ads/scripts/validate-openai-artifacts.py +271 -0
- package/skills/egbe-os-organic-trend-watch/SKILL.md +139 -0
- package/skills/egbe-os-organic-trend-watch/agents/openai.yaml +4 -0
- package/skills/egbe-os-organic-trend-watch/references/analysis-and-adaptation.md +54 -0
- package/skills/egbe-os-organic-trend-watch/references/collection-and-analysis.md +117 -0
- package/skills/egbe-os-organic-trend-watch/references/output-contract.md +133 -0
- package/skills/egbe-os-organic-trend-watch/references/provider-contract.md +169 -0
- package/skills/egbe-os-organic-trend-watch/references/runtime-contract.md +204 -0
- package/skills/egbe-os-organic-trend-watch/references/visual-analysis-prompt.md +17 -0
- package/skills/egbe-os-organic-trend-watch/scripts/_analysis.py +612 -0
- package/skills/egbe-os-organic-trend-watch/scripts/_contract.py +1133 -0
- package/skills/egbe-os-organic-trend-watch/scripts/_provider_inputs.py +165 -0
- package/skills/egbe-os-organic-trend-watch/scripts/analyze-visual-evidence.py +315 -0
- package/skills/egbe-os-organic-trend-watch/scripts/build-provider-inputs.py +88 -0
- package/skills/egbe-os-organic-trend-watch/scripts/connection_identity.py +22 -0
- package/skills/egbe-os-organic-trend-watch/scripts/egbe_artifacts.py +24 -0
- package/skills/egbe-os-organic-trend-watch/scripts/finalize-receipt.py +106 -0
- package/skills/egbe-os-organic-trend-watch/scripts/normalize-videos.py +647 -0
- package/skills/egbe-os-organic-trend-watch/scripts/prepare-visual-evidence.py +324 -0
- package/skills/egbe-os-organic-trend-watch/scripts/render-result.py +30 -0
- package/skills/egbe-os-organic-trend-watch/scripts/run-apify.py +723 -0
- package/skills/egbe-os-organic-trend-watch/scripts/run-state.py +192 -0
- package/skills/egbe-os-organic-trend-watch/scripts/validate-context.py +27 -0
- package/skills/egbe-os-organic-trend-watch/scripts/validate-runtime.py +137 -0
- package/skills/egbe-os-payments/SKILL.md +215 -0
- package/skills/egbe-os-payments/agents/openai.yaml +4 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/.egbe/scaffolds/billing-nextjs-subscription.v1.json +5 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/AGENTS.append.md +13 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/db/migrations/1000_egbe_billing.sql +66 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/package.fragment.json +12 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/scripts/billing-sync.mjs +162 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/account/billing/error.tsx +11 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/account/billing/loading.tsx +8 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/account/billing/page.tsx +121 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/api/billing/checkout/route.ts +102 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/api/billing/portal/route.ts +54 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/api/billing/status/route.ts +22 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/app/api/payments/webhook/route.ts +65 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/components/egbe-billing/plan-badge.tsx +16 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/billing-sync.test.mjs +58 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/catalog.ts +82 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/checkout-payload.ts +47 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/foundation-contract.test.mjs +59 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/lifecycle.d.ts +16 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/lifecycle.mjs +82 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/lifecycle.test.mjs +94 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/os-client.ts +96 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/plans.json +17 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/repository.ts +325 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/signature.d.ts +6 -0
- package/skills/egbe-os-payments/assets/scaffolds/billing-nextjs-subscription/src/lib/egbe-billing/signature.mjs +22 -0
- package/skills/egbe-os-payments/references/contracts/plan-catalog.md +46 -0
- package/skills/egbe-os-payments/references/security/durable-verification.md +64 -0
- package/skills/egbe-os-payments/references/security/server-integration.md +26 -0
- package/skills/egbe-os-payments/references/security/webhook-and-entitlements.md +152 -0
- package/skills/egbe-os-payments/references/ux/billing-experience.md +47 -0
- package/skills/egbe-os-payments/references/workflows/account-billing.md +64 -0
- package/skills/egbe-os-payments/references/workflows/discounts-and-promotion-codes.md +265 -0
- package/skills/egbe-os-payments/references/workflows/one-time-purchase.md +75 -0
- package/skills/egbe-os-payments/references/workflows/product-checkout.md +355 -0
- package/skills/egbe-os-payments/references/workflows/subscription-lifecycle.md +55 -0
- package/skills/egbe-os-playbook/SKILL.md +79 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/email-outreach.md +91 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/google-search.md +40 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/linkedin.md +24 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/meta.md +23 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/openai.md +15 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/channels/reddit.md +56 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/choose-test.md +73 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/evaluate.md +91 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/market.md +96 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition/run-test.md +111 -0
- package/skills/egbe-os-playbook/playbooks/market-and-acquisition.md +56 -0
- package/skills/egbe-os-playbook/playbooks/product/business-loop.md +141 -0
- package/skills/egbe-os-playbook/playbooks/product/collaboration.md +26 -0
- package/skills/egbe-os-playbook/playbooks/product/deliver.md +75 -0
- package/skills/egbe-os-playbook/playbooks/product/diagnose.md +80 -0
- package/skills/egbe-os-playbook/playbooks/product/evaluate.md +67 -0
- package/skills/egbe-os-playbook/playbooks/product/experience.md +132 -0
- package/skills/egbe-os-playbook/playbooks/product/loop-examples.md +67 -0
- package/skills/egbe-os-playbook/playbooks/product/offer.md +65 -0
- package/skills/egbe-os-playbook/playbooks/product/value.md +91 -0
- package/skills/egbe-os-playbook/playbooks/product.md +67 -0
- package/skills/egbe-os-playbook/references/catalog.md +127 -0
- package/skills/egbe-os-playbook/references/changes.md +167 -0
- package/skills/egbe-os-playbook/scripts/playbook-changes.py +6 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/__init__.py +1 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/cli.py +57 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/operations.py +137 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/protocol.py +132 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/storage.py +180 -0
- package/skills/egbe-os-playbook/scripts/playbook_changes/transport.py +113 -0
- package/skills/egbe-os-product-auth/SKILL.md +151 -0
- package/skills/egbe-os-product-auth/agents/openai.yaml +4 -0
- package/skills/egbe-os-product-auth/assets/db/README.md +102 -0
- package/skills/egbe-os-product-auth/assets/db/create-validation-session.mjs +223 -0
- package/skills/egbe-os-product-auth/assets/db/migrate.mjs +64 -0
- package/skills/egbe-os-product-auth/assets/db/migrations/0001_auth.sql +33 -0
- package/skills/egbe-os-product-auth/assets/db/migrations/0002_auth_identities.sql +16 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-auth-database/AGENTS.append.md +17 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-auth-database/package.fragment.json +10 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/AGENTS.append.md +9 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/package.fragment.json +13 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/src/lib/egbe-product/db.ts +31 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/src/lib/egbe-product/identity.ts +94 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/src/lib/egbe-product/index.ts +3 -0
- package/skills/egbe-os-product-auth/assets/scaffolds/product-nextjs-postgres/src/lib/egbe-product/session.ts +91 -0
- package/skills/egbe-os-product-auth/references/contracts/live-auth-interface.md +108 -0
- package/skills/egbe-os-product-auth/references/frameworks/nextjs.md +34 -0
- package/skills/egbe-os-product-auth/references/security/session-and-credentials.md +73 -0
- package/skills/egbe-os-product-auth/references/ux/auth-experience.md +58 -0
- package/skills/egbe-os-product-auth/references/workflows/account-recovery.md +22 -0
- package/skills/egbe-os-product-auth/references/workflows/build-auth.md +212 -0
- package/skills/egbe-os-product-auth/references/workflows/google.md +34 -0
- package/skills/egbe-os-product-auth/references/workflows/passwordless-email.md +65 -0
- package/skills/egbe-os-product-build/SKILL.md +111 -0
- package/skills/egbe-os-product-build/agents/openai.yaml +4 -0
- package/skills/egbe-os-product-build/references/capabilities.md +25 -0
- package/skills/egbe-os-product-build/references/engineering.md +72 -0
- package/skills/egbe-os-product-build/references/execution.md +55 -0
- package/skills/egbe-os-product-build/references/foundations.md +93 -0
- package/skills/egbe-os-product-build/references/interface-quality.md +32 -0
- package/skills/egbe-os-product-build/references/workflows/private-review-handoff.md +86 -0
- package/skills/egbe-os-product-build/scripts/scaffold.py +296 -0
- package/skills/egbe-os-product-demo-video/SKILL.md +118 -0
- package/skills/egbe-os-product-demo-video/references/recording.md +32 -0
- package/skills/egbe-os-product-market-research/SKILL.md +159 -0
- package/skills/egbe-os-product-market-research/agents/openai.yaml +4 -0
- package/skills/egbe-os-product-market-research/references/catalog.v1.json +177 -0
- package/skills/egbe-os-product-market-research/references/config/channel-footprint-sources.v1.json +99 -0
- package/skills/egbe-os-product-market-research/references/config/creative-taxonomy.v1.json +367 -0
- package/skills/egbe-os-product-market-research/references/contracts/creative-video.md +75 -0
- package/skills/egbe-os-product-market-research/references/contracts/funnel-teardown.md +235 -0
- package/skills/egbe-os-product-market-research/references/contracts/geography-comparison.md +71 -0
- package/skills/egbe-os-product-market-research/references/contracts/lifecycle-capture.md +119 -0
- package/skills/egbe-os-product-market-research/references/contracts/research-artifacts.md +520 -0
- package/skills/egbe-os-product-market-research/references/contracts/walk-mechanics.v2.json +18 -0
- package/skills/egbe-os-product-market-research/references/prompts/acquisition-channels.md +137 -0
- package/skills/egbe-os-product-market-research/references/prompts/acquisition-channels.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/competitive-landscape.md +118 -0
- package/skills/egbe-os-product-market-research/references/prompts/competitive-landscape.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/demand-validation.md +154 -0
- package/skills/egbe-os-product-market-research/references/prompts/demand-validation.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/market-size-and-dynamics.md +100 -0
- package/skills/egbe-os-product-market-research/references/prompts/market-size-and-dynamics.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/pricing-and-monetization.md +126 -0
- package/skills/egbe-os-product-market-research/references/prompts/pricing-and-monetization.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/target-audience.md +98 -0
- package/skills/egbe-os-product-market-research/references/prompts/target-audience.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/unit-economics.md +217 -0
- package/skills/egbe-os-product-market-research/references/prompts/unit-economics.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/prompts/value-proposition.md +113 -0
- package/skills/egbe-os-product-market-research/references/prompts/value-proposition.user.md +4 -0
- package/skills/egbe-os-product-market-research/references/workflows/acquisition-channels.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/channel-footprint.md +163 -0
- package/skills/egbe-os-product-market-research/references/workflows/community-demand.md +100 -0
- package/skills/egbe-os-product-market-research/references/workflows/competitive-landscape.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/competitor-ads.md +82 -0
- package/skills/egbe-os-product-market-research/references/workflows/competitor-set.md +300 -0
- package/skills/egbe-os-product-market-research/references/workflows/creative-patterns.md +228 -0
- package/skills/egbe-os-product-market-research/references/workflows/demand-validation.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/fleet-prior.md +80 -0
- package/skills/egbe-os-product-market-research/references/workflows/funnel-teardown.md +184 -0
- package/skills/egbe-os-product-market-research/references/workflows/geography-comparison.md +84 -0
- package/skills/egbe-os-product-market-research/references/workflows/keyword-economics.md +122 -0
- package/skills/egbe-os-product-market-research/references/workflows/lifecycle-capture.md +218 -0
- package/skills/egbe-os-product-market-research/references/workflows/local-research.md +55 -0
- package/skills/egbe-os-product-market-research/references/workflows/market-size-and-dynamics.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/preview.md +175 -0
- package/skills/egbe-os-product-market-research/references/workflows/pricing-and-monetization.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/recommendations.md +35 -0
- package/skills/egbe-os-product-market-research/references/workflows/review-mining.md +76 -0
- package/skills/egbe-os-product-market-research/references/workflows/target-audience.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/tiktok-reels-market-trends.md +46 -0
- package/skills/egbe-os-product-market-research/references/workflows/unit-economics.md +27 -0
- package/skills/egbe-os-product-market-research/references/workflows/value-proposition.md +27 -0
- package/skills/egbe-os-product-market-research/scripts/build-organic-trend-context.py +167 -0
- package/skills/egbe-os-product-market-research/scripts/build-preview-context.py +91 -0
- package/skills/egbe-os-product-market-research/scripts/build-research-query.py +225 -0
- package/skills/egbe-os-product-market-research/scripts/channel-footprint-model.py +294 -0
- package/skills/egbe-os-product-market-research/scripts/connection_identity.py +22 -0
- package/skills/egbe-os-product-market-research/scripts/creative-model.py +364 -0
- package/skills/egbe-os-product-market-research/scripts/creative-selection.py +113 -0
- package/skills/egbe-os-product-market-research/scripts/creative-semantics.py +365 -0
- package/skills/egbe-os-product-market-research/scripts/creative-video.py +542 -0
- package/skills/egbe-os-product-market-research/scripts/egbe_artifacts.py +24 -0
- package/skills/egbe-os-product-market-research/scripts/finalize-organic-trend-watch.py +304 -0
- package/skills/egbe-os-product-market-research/scripts/funnel-email-review.py +97 -0
- package/skills/egbe-os-product-market-research/scripts/funnel-model.py +966 -0
- package/skills/egbe-os-product-market-research/scripts/funnel_features.py +50 -0
- package/skills/egbe-os-product-market-research/scripts/geography-comparison-contract.py +172 -0
- package/skills/egbe-os-product-market-research/scripts/geography-comparison.py +169 -0
- package/skills/egbe-os-product-market-research/scripts/keyword-forecast.py +61 -0
- package/skills/egbe-os-product-market-research/scripts/keyword-locale-publication.py +136 -0
- package/skills/egbe-os-product-market-research/scripts/lifecycle-start.py +190 -0
- package/skills/egbe-os-product-market-research/scripts/persist-research-report.py +63 -0
- package/skills/egbe-os-product-market-research/scripts/research-artifact-io.py +281 -0
- package/skills/egbe-os-product-market-research/scripts/research-evidence.py +496 -0
- package/skills/egbe-os-product-market-research/scripts/research-policy.py +33 -0
- package/skills/egbe-os-product-market-research/scripts/research-section-runtime.py +343 -0
- package/skills/egbe-os-product-market-research/scripts/research-section-workflow.py +288 -0
- package/skills/egbe-os-product-market-research/scripts/research_integrity.py +122 -0
- package/skills/egbe-os-product-market-research/scripts/review-research-completion.py +306 -0
- package/skills/egbe-os-product-market-research/scripts/run-acquisition-channels.py +72 -0
- package/skills/egbe-os-product-market-research/scripts/run-channel-footprint.py +2258 -0
- package/skills/egbe-os-product-market-research/scripts/run-community-demand.py +1603 -0
- package/skills/egbe-os-product-market-research/scripts/run-competitive-landscape.py +66 -0
- package/skills/egbe-os-product-market-research/scripts/run-competitor-ads.py +1156 -0
- package/skills/egbe-os-product-market-research/scripts/run-competitor-set.py +2514 -0
- package/skills/egbe-os-product-market-research/scripts/run-creative-patterns.py +2042 -0
- package/skills/egbe-os-product-market-research/scripts/run-demand-validation.py +72 -0
- package/skills/egbe-os-product-market-research/scripts/run-fleet-prior.py +652 -0
- package/skills/egbe-os-product-market-research/scripts/run-funnel-teardown.py +493 -0
- package/skills/egbe-os-product-market-research/scripts/run-keyword-economics.py +1443 -0
- package/skills/egbe-os-product-market-research/scripts/run-lifecycle-capture.py +1543 -0
- package/skills/egbe-os-product-market-research/scripts/run-market-size-and-dynamics.py +66 -0
- package/skills/egbe-os-product-market-research/scripts/run-os-research.py +311 -0
- package/skills/egbe-os-product-market-research/scripts/run-pricing-and-monetization.py +71 -0
- package/skills/egbe-os-product-market-research/scripts/run-review-mining.py +1051 -0
- package/skills/egbe-os-product-market-research/scripts/run-target-audience.py +66 -0
- package/skills/egbe-os-product-market-research/scripts/run-unit-economics.py +71 -0
- package/skills/egbe-os-product-market-research/scripts/run-value-proposition.py +67 -0
- package/skills/egbe-os-product-market-research/scripts/upsert-markdown-section.py +156 -0
- package/skills/egbe-os-product-market-research/scripts/walk-funnels.py +249 -0
- package/skills/egbe-os-product-market-research/scripts/write-preview.py +710 -0
- package/skills/egbe-os-product-market-research/scripts/write-recommendations.py +272 -0
- package/skills/egbe-os-product-report/SKILL.md +150 -0
- package/skills/egbe-os-product-report/references/artifacts.md +84 -0
- package/skills/egbe-os-product-report/references/brief.md +34 -0
- package/skills/egbe-os-product-report/references/daily.md +76 -0
- package/skills/egbe-os-product-report/references/sources.md +68 -0
- package/skills/egbe-os-product-routines/SKILL.md +166 -0
- package/skills/egbe-os-product-routines/references/catalog.md +22 -0
- package/skills/egbe-os-product-routines/references/continuation-check.md +41 -0
- package/skills/egbe-os-product-routines/references/product-reporting.md +163 -0
- package/skills/egbe-os-product-routines/references/run-preset.md +32 -0
- package/skills/egbe-os-quickstart/scripts/egbe-curl.py +357 -0
- package/skills/egbe-os-quiz-funnel/SKILL.md +152 -0
- package/skills/egbe-os-quiz-funnel/agents/openai.yaml +4 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-engine.d.mts +224 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-engine.mjs +652 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-engine.test.mjs +764 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-history.d.mts +31 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-history.mjs +87 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-history.test.mjs +265 -0
- package/skills/egbe-os-quiz-funnel/assets/engine/quiz-reference.test.mjs +254 -0
- package/skills/egbe-os-quiz-funnel/assets/examples/egbe-docs/product/quizzes/books-checkup/QUIZ.md +195 -0
- package/skills/egbe-os-quiz-funnel/assets/examples/egbe-docs/product/quizzes/books-checkup/quiz.json +421 -0
- package/skills/egbe-os-quiz-funnel/assets/examples/egbe-docs/product/quizzes/books-checkup/quiz.public.json +369 -0
- package/skills/egbe-os-quiz-funnel/assets/examples/egbe-docs/product/quizzes/books-checkup/validation.json +21 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/index.html +26 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/quiz-bootstrap.js +31 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/quiz-early-actions.mjs +11 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/quiz-first-screen.mjs +32 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/quiz-page.mjs +480 -0
- package/skills/egbe-os-quiz-funnel/assets/reference/quiz.css +264 -0
- package/skills/egbe-os-quiz-funnel/references/competitor-teardown.md +159 -0
- package/skills/egbe-os-quiz-funnel/references/conversion-handoff.md +156 -0
- package/skills/egbe-os-quiz-funnel/references/implementation.md +207 -0
- package/skills/egbe-os-quiz-funnel/references/inputs.md +37 -0
- package/skills/egbe-os-quiz-funnel/references/measurement.md +122 -0
- package/skills/egbe-os-quiz-funnel/references/spec-contract.md +335 -0
- package/skills/egbe-os-quiz-funnel/references/verification.md +101 -0
- package/skills/egbe-os-quiz-funnel/references/walk-mechanics.v2.json +18 -0
- package/skills/egbe-os-quiz-funnel/scripts/compile-quiz-spec.py +1869 -0
- package/skills/egbe-os-quiz-funnel/scripts/prepare-research-identity.py +66 -0
- package/skills/egbe-os-reddit-ads/SKILL.md +121 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/bold-statement/schema.json +41 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/bold-statement/template.html +106 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/data-proof/schema.json +61 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/data-proof/template.html +151 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/honest-breakdown/schema.json +91 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/honest-breakdown/template.html +185 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/question-hook/schema.json +51 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/question-hook/template.html +121 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/reddit-post-style/schema.json +87 -0
- package/skills/egbe-os-reddit-ads/assets/static-banners/reddit-post-style/template.html +212 -0
- package/skills/egbe-os-reddit-ads/references/creative/html-to-png-pipeline.md +123 -0
- package/skills/egbe-os-reddit-ads/references/creative/static-banner-qa.md +12 -0
- package/skills/egbe-os-reddit-ads/references/creative/static-banner-system.md +16 -0
- package/skills/egbe-os-reddit-ads/references/destination-requirements.md +36 -0
- package/skills/egbe-os-reddit-ads/references/runtime/api-reference.md +435 -0
- package/skills/egbe-os-reddit-ads/references/runtime/artifacts.md +57 -0
- package/skills/egbe-os-reddit-ads/references/runtime/monitoring.md +64 -0
- package/skills/egbe-os-reddit-ads/references/runtime/pixel-and-tracking.md +49 -0
- package/skills/egbe-os-reddit-ads/references/runtime/policies.md +19 -0
- package/skills/egbe-os-reddit-ads/references/runtime/shared-analytics-attribution.md +14 -0
- package/skills/egbe-os-reddit-ads/references/workflows/build-paused.md +35 -0
- package/skills/egbe-os-reddit-ads/references/workflows/launch-ready.md +19 -0
- package/skills/egbe-os-reddit-ads/references/workflows/launch.md +32 -0
- package/skills/egbe-os-reddit-ads/references/workflows/readiness.md +9 -0
- package/skills/egbe-os-reddit-ads/scripts/capture-ad.sh +178 -0
- package/skills/egbe-os-reddit-ads/scripts/validate-reddit-artifacts.py +187 -0
- package/skills/egbe-os-report-ui/SKILL.md +133 -0
- package/skills/egbe-os-report-ui/assets/egbe-wordmark.svg +9 -0
- package/skills/egbe-os-report-ui/assets/examples/components.html +417 -0
- package/skills/egbe-os-report-ui/assets/examples/editorial.html +209 -0
- package/skills/egbe-os-report-ui/assets/scaffold.html +179 -0
- package/skills/egbe-os-report-ui/references/components.md +209 -0
- package/skills/egbe-os-research/SKILL.md +125 -0
- package/skills/egbe-os-saas-unit-economics/SKILL.md +188 -0
- package/skills/egbe-os-scrape/SKILL.md +160 -0
- package/skills/egbe-os-search/SKILL.md +182 -0
- package/skills/egbe-os-search/references/google-places.md +81 -0
- package/skills/egbe-os-support/SKILL.md +149 -0
- package/skills/egbe-os-telemetry/SKILL.md +344 -0
- package/skills/egbe-os-telemetry/references/harnesses/claude-code.md +97 -0
- package/skills/egbe-os-telemetry/references/harnesses/codex.md +22 -0
- package/skills/egbe-os-telemetry/references/harnesses/hermes.md +39 -0
- package/skills/egbe-os-telemetry/references/harnesses/openclaw.md +139 -0
- package/skills/egbe-os-telemetry/references/harnesses/opencode.md +28 -0
- package/skills/egbe-os-tools/SKILL.md +180 -0
- package/skills/egbe-os-tools/references/theona.md +26 -0
- package/skills/egbe-os-wallet/SKILL.md +181 -0
- package/skills/egbe-setup/EGBE.md +484 -0
- package/skills/egbe-setup/SKILL.md +116 -0
- package/skills/egbe-setup/references/project.md +80 -0
- package/state.js +37 -0
- package/update.js +361 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
|
|
3
|
+
import { Pool, type QueryResult, type QueryResultRow } from "pg";
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
// Preserve one pool across Next.js development reloads.
|
|
7
|
+
// eslint-disable-next-line no-var
|
|
8
|
+
var __egbeProductPool: Pool | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function createPool(): Pool {
|
|
12
|
+
const connectionString = process.env.DATABASE_URL;
|
|
13
|
+
if (!connectionString) {
|
|
14
|
+
throw new Error("DATABASE_URL is required by the product foundation");
|
|
15
|
+
}
|
|
16
|
+
return new Pool({ connectionString });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function productDatabase(): Pool {
|
|
20
|
+
if (!globalThis.__egbeProductPool) {
|
|
21
|
+
globalThis.__egbeProductPool = createPool();
|
|
22
|
+
}
|
|
23
|
+
return globalThis.__egbeProductPool;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function queryProductDatabase<Row extends QueryResultRow = QueryResultRow>(
|
|
27
|
+
text: string,
|
|
28
|
+
values: readonly unknown[] = [],
|
|
29
|
+
): Promise<QueryResult<Row>> {
|
|
30
|
+
return productDatabase().query<Row>(text, [...values]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
|
|
3
|
+
import { productDatabase } from "./db";
|
|
4
|
+
import type { ProductAccount } from "./session";
|
|
5
|
+
|
|
6
|
+
export type VerifiedExternalIdentity = {
|
|
7
|
+
provider: string;
|
|
8
|
+
subject: string;
|
|
9
|
+
email: string;
|
|
10
|
+
emailVerified: true;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function normalized(value: string, label: string): string {
|
|
14
|
+
const result = value.trim().toLowerCase();
|
|
15
|
+
if (!result) throw new Error(`${label} is required`);
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Resolve one verified provider identity to the product's local account. */
|
|
20
|
+
export async function resolveOrCreateExternalAccount(
|
|
21
|
+
identity: VerifiedExternalIdentity,
|
|
22
|
+
): Promise<ProductAccount> {
|
|
23
|
+
if (identity.emailVerified !== true) {
|
|
24
|
+
throw new Error("External account email must be provider-verified");
|
|
25
|
+
}
|
|
26
|
+
const provider = normalized(identity.provider, "provider");
|
|
27
|
+
const subject = identity.subject.trim();
|
|
28
|
+
const email = normalized(identity.email, "email");
|
|
29
|
+
if (!subject) throw new Error("subject is required");
|
|
30
|
+
|
|
31
|
+
const client = await productDatabase().connect();
|
|
32
|
+
try {
|
|
33
|
+
await client.query("begin");
|
|
34
|
+
await client.query(
|
|
35
|
+
"select pg_advisory_xact_lock(hashtextextended($1 || ':' || $2, 0))",
|
|
36
|
+
[provider, subject],
|
|
37
|
+
);
|
|
38
|
+
const existing = await client.query<{
|
|
39
|
+
id: string;
|
|
40
|
+
email: string;
|
|
41
|
+
created_at: Date;
|
|
42
|
+
}>(
|
|
43
|
+
`select u.id, u.email, u.created_at
|
|
44
|
+
from auth_identities i
|
|
45
|
+
join users u on u.id = i.user_id
|
|
46
|
+
where i.provider = $1 and i.subject = $2
|
|
47
|
+
for update of i`,
|
|
48
|
+
[provider, subject],
|
|
49
|
+
);
|
|
50
|
+
if (existing.rows[0]) {
|
|
51
|
+
await client.query("commit");
|
|
52
|
+
const row = existing.rows[0];
|
|
53
|
+
return { id: row.id, email: row.email, createdAt: row.created_at };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const user = await client.query<{
|
|
57
|
+
id: string;
|
|
58
|
+
email: string;
|
|
59
|
+
created_at: Date;
|
|
60
|
+
}>(
|
|
61
|
+
`insert into users (email, password_hash)
|
|
62
|
+
values ($1, null)
|
|
63
|
+
on conflict ((lower(email))) do update set updated_at = users.updated_at
|
|
64
|
+
returning id, email, created_at`,
|
|
65
|
+
[email],
|
|
66
|
+
);
|
|
67
|
+
await client.query(
|
|
68
|
+
`insert into auth_identities (user_id, provider, subject, email_at_link)
|
|
69
|
+
values ($1, $2, $3, $4)
|
|
70
|
+
on conflict (provider, subject) do nothing`,
|
|
71
|
+
[user.rows[0].id, provider, subject, email],
|
|
72
|
+
);
|
|
73
|
+
const linked = await client.query<{
|
|
74
|
+
id: string;
|
|
75
|
+
email: string;
|
|
76
|
+
created_at: Date;
|
|
77
|
+
}>(
|
|
78
|
+
`select u.id, u.email, u.created_at
|
|
79
|
+
from auth_identities i
|
|
80
|
+
join users u on u.id = i.user_id
|
|
81
|
+
where i.provider = $1 and i.subject = $2`,
|
|
82
|
+
[provider, subject],
|
|
83
|
+
);
|
|
84
|
+
const row = linked.rows[0];
|
|
85
|
+
if (!row) throw new Error("External identity could not be linked");
|
|
86
|
+
await client.query("commit");
|
|
87
|
+
return { id: row.id, email: row.email, createdAt: row.created_at };
|
|
88
|
+
} catch (error) {
|
|
89
|
+
await client.query("rollback");
|
|
90
|
+
throw error;
|
|
91
|
+
} finally {
|
|
92
|
+
client.release();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
|
|
3
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
4
|
+
import { cookies } from "next/headers";
|
|
5
|
+
|
|
6
|
+
import { queryProductDatabase } from "./db";
|
|
7
|
+
|
|
8
|
+
export const PRODUCT_SESSION_COOKIE = "egbe_session";
|
|
9
|
+
export const PRODUCT_SESSION_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
10
|
+
|
|
11
|
+
export type ProductAccount = {
|
|
12
|
+
id: string;
|
|
13
|
+
email: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export class ProductAuthenticationRequired extends Error {
|
|
18
|
+
constructor() {
|
|
19
|
+
super("Product authentication is required");
|
|
20
|
+
this.name = "ProductAuthenticationRequired";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function hashProductSessionToken(token: string): string {
|
|
25
|
+
return createHash("sha256").update(token, "utf8").digest("hex");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function createProductSession(userId: string): Promise<void> {
|
|
29
|
+
const token = randomBytes(32).toString("base64url");
|
|
30
|
+
const expiresAt = new Date(Date.now() + PRODUCT_SESSION_TTL_SECONDS * 1000);
|
|
31
|
+
await queryProductDatabase(
|
|
32
|
+
`insert into sessions (user_id, token_hash, expires_at)
|
|
33
|
+
values ($1, $2, $3)`,
|
|
34
|
+
[userId, hashProductSessionToken(token), expiresAt],
|
|
35
|
+
);
|
|
36
|
+
const jar = await cookies();
|
|
37
|
+
jar.set(PRODUCT_SESSION_COOKIE, token, {
|
|
38
|
+
httpOnly: true,
|
|
39
|
+
sameSite: "lax",
|
|
40
|
+
secure: process.env.NODE_ENV === "production",
|
|
41
|
+
path: "/",
|
|
42
|
+
expires: expiresAt,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function resolveProductSession(
|
|
47
|
+
token: string | undefined,
|
|
48
|
+
): Promise<ProductAccount | null> {
|
|
49
|
+
if (!token) return null;
|
|
50
|
+
const result = await queryProductDatabase<{
|
|
51
|
+
id: string;
|
|
52
|
+
email: string;
|
|
53
|
+
created_at: Date;
|
|
54
|
+
}>(
|
|
55
|
+
`select u.id, u.email, u.created_at
|
|
56
|
+
from sessions s
|
|
57
|
+
join users u on u.id = s.user_id
|
|
58
|
+
where s.token_hash = $1
|
|
59
|
+
and s.revoked_at is null
|
|
60
|
+
and s.expires_at > now()
|
|
61
|
+
limit 1`,
|
|
62
|
+
[hashProductSessionToken(token)],
|
|
63
|
+
);
|
|
64
|
+
const row = result.rows[0];
|
|
65
|
+
return row ? { id: row.id, email: row.email, createdAt: row.created_at } : null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function currentProductAccount(): Promise<ProductAccount | null> {
|
|
69
|
+
const jar = await cookies();
|
|
70
|
+
return resolveProductSession(jar.get(PRODUCT_SESSION_COOKIE)?.value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function requireProductAccount(): Promise<ProductAccount> {
|
|
74
|
+
const account = await currentProductAccount();
|
|
75
|
+
if (!account) throw new ProductAuthenticationRequired();
|
|
76
|
+
return account;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function revokeCurrentProductSession(): Promise<void> {
|
|
80
|
+
const jar = await cookies();
|
|
81
|
+
const token = jar.get(PRODUCT_SESSION_COOKIE)?.value;
|
|
82
|
+
if (token) {
|
|
83
|
+
await queryProductDatabase(
|
|
84
|
+
`update sessions
|
|
85
|
+
set revoked_at = coalesce(revoked_at, now())
|
|
86
|
+
where token_hash = $1`,
|
|
87
|
+
[hashProductSessionToken(token)],
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
jar.delete(PRODUCT_SESSION_COOKIE);
|
|
91
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Live Auth Interface Contract
|
|
2
|
+
|
|
3
|
+
These attributes are stable test interfaces. They do not replace semantic HTML
|
|
4
|
+
or visible labels, and they must not appear in user-facing copy.
|
|
5
|
+
|
|
6
|
+
## Routes
|
|
7
|
+
|
|
8
|
+
New products expose:
|
|
9
|
+
|
|
10
|
+
- `/signup` for account creation;
|
|
11
|
+
- `/login` for durable login;
|
|
12
|
+
- one protected continuation selected by the shared navigation.
|
|
13
|
+
|
|
14
|
+
Present the selected account-entry methods. When Google exists, its control
|
|
15
|
+
carries `data-auth-google` and calls a same-origin product start route; it never
|
|
16
|
+
contains `OS_API_KEY` or links directly to a provider token endpoint. These
|
|
17
|
+
markers describe real controls, not a requirement to add a provider or form.
|
|
18
|
+
|
|
19
|
+
Existing products may retain their working routes. A bounded repair preserves
|
|
20
|
+
them rather than adding entry routes for verification. Any exposed canonical
|
|
21
|
+
routes or aliases must resolve to the working flow, not a disconnected duplicate.
|
|
22
|
+
|
|
23
|
+
The authorized protected continuation renders `data-auth-protected` on its
|
|
24
|
+
stable page root. A signed-out request must redirect to the product's working
|
|
25
|
+
login entry or return an explicit 401/403 response; merely rendering signed-out
|
|
26
|
+
navigation on otherwise public content is not route protection.
|
|
27
|
+
|
|
28
|
+
For the primary protected browser UI, redirect signed-out users to that login
|
|
29
|
+
entry and preserve the same-origin continuation in that redirect. Explicit
|
|
30
|
+
401/403 responses are suitable for protected API endpoints, not the main UI
|
|
31
|
+
continuation.
|
|
32
|
+
|
|
33
|
+
## Email forms, when selected
|
|
34
|
+
|
|
35
|
+
Signup:
|
|
36
|
+
|
|
37
|
+
- email input: `data-signup-email`;
|
|
38
|
+
- password input when used: `data-signup-password`;
|
|
39
|
+
- submit control: `data-signup-submit`;
|
|
40
|
+
- visible error container: `data-auth-error`.
|
|
41
|
+
|
|
42
|
+
An email path has only the fields it requires: email and password
|
|
43
|
+
for email/password, or email alone for passwordless email. Do not ask
|
|
44
|
+
for name, full name, company, username, password confirmation, or profile data
|
|
45
|
+
during signup. Hidden CSRF, attribution, and safe return-path inputs are
|
|
46
|
+
allowed. Use the account email as the initial signed-in identity until a later
|
|
47
|
+
profile flow collects additional data.
|
|
48
|
+
|
|
49
|
+
Login:
|
|
50
|
+
|
|
51
|
+
- email input: `data-login-email`;
|
|
52
|
+
- password input when used: `data-login-password`;
|
|
53
|
+
- submit control: `data-login-submit`;
|
|
54
|
+
- visible error container: `data-auth-error`.
|
|
55
|
+
|
|
56
|
+
Use real `label` associations, `type`, `name`, and `autocomplete` values in
|
|
57
|
+
addition to these attributes.
|
|
58
|
+
|
|
59
|
+
The verification interface does not require native HTML form submission. A
|
|
60
|
+
native form may expose its real same-origin POST `action`. A JavaScript-enhanced
|
|
61
|
+
form instead exposes the real production endpoint used by its submit handler as
|
|
62
|
+
`data-auth-action` on the form or marked submit control. When that endpoint
|
|
63
|
+
expects JSON rather than form data, add `data-auth-encoding="json"`; form encoding
|
|
64
|
+
is the default. Inputs still need stable `name` values so the same payload can be
|
|
65
|
+
verified without browser automation.
|
|
66
|
+
|
|
67
|
+
`data-auth-action` must point to the same server implementation used by the
|
|
68
|
+
product UI. Do not add a test-only endpoint, skip credential validation, or
|
|
69
|
+
manufacture authenticated responses for verification. The action must remain on
|
|
70
|
+
the product origin and accept POST requests. A JSON action should return a
|
|
71
|
+
same-origin `next` path when navigation is handled by the client; native redirects
|
|
72
|
+
already provide that destination.
|
|
73
|
+
|
|
74
|
+
For passwordless email, the signup/login action requests the real message; it
|
|
75
|
+
does not claim an authenticated session. Authentication completes only when the
|
|
76
|
+
one-time live link establishes server-verified state. The request response and
|
|
77
|
+
visible pending state must distinguish an accepted request from an immediate
|
|
78
|
+
mail-provider failure without exposing account existence.
|
|
79
|
+
|
|
80
|
+
## Shared Navigation
|
|
81
|
+
|
|
82
|
+
Render one state marker in the shared navigation:
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<nav data-auth-state="signed-out">...</nav>
|
|
86
|
+
<nav data-auth-state="signed-in">...</nav>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The signed-in state contains:
|
|
90
|
+
|
|
91
|
+
- `data-auth-user-menu` on the menu trigger or stable wrapper;
|
|
92
|
+
- `data-auth-identity` on the displayed non-sensitive identity;
|
|
93
|
+
- `data-auth-continue` on a same-origin link to the protected continuation;
|
|
94
|
+
- `data-auth-signout` on the logout control.
|
|
95
|
+
|
|
96
|
+
Logout may be a native POST form or a JavaScript control. A JavaScript logout
|
|
97
|
+
control exposes its real same-origin endpoint with `data-auth-action` and, when
|
|
98
|
+
needed, `data-auth-encoding="json"`. It does not need to be wrapped in a form.
|
|
99
|
+
|
|
100
|
+
The signed-out state links to the same working login entry and retains the
|
|
101
|
+
product's normal primary CTA.
|
|
102
|
+
|
|
103
|
+
## Behavioral Meaning
|
|
104
|
+
|
|
105
|
+
The signed-in marker may render only after the server has verified the session.
|
|
106
|
+
It must survive reload. Logout must switch the navigation back to signed-out and
|
|
107
|
+
make the continuation inaccessible. Do not set signed-in UI state from an email,
|
|
108
|
+
query parameter, localStorage value, or unverified cookie payload.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Next.js Auth Integration
|
|
2
|
+
|
|
3
|
+
Apply the egbe-os-product-auth contracts using the app's installed Next.js version and
|
|
4
|
+
existing data layer.
|
|
5
|
+
|
|
6
|
+
- Keep marketing and signed-in layouts separate when the app already uses route
|
|
7
|
+
groups, but render auth state through shared navigation components.
|
|
8
|
+
- Resolve session state on the server for layouts and protected pages. Do not
|
|
9
|
+
trust a client-only context as authorization.
|
|
10
|
+
- Put credential/session operations in server-only modules. Keep database and
|
|
11
|
+
cookie APIs out of client components.
|
|
12
|
+
- Use route handlers or server actions consistently with the existing app. For a
|
|
13
|
+
new product without an established auth implementation, prefer stable route
|
|
14
|
+
handlers for signup, login, and logout. Existing Server Action forms remain
|
|
15
|
+
valid when their rendered POST form is directly usable.
|
|
16
|
+
- For passwordless email, consume the one-time credential in a server Route
|
|
17
|
+
Handler or equivalent response boundary that can atomically update durable
|
|
18
|
+
state, set the session cookie, and redirect to a clean URL. Do not consume it
|
|
19
|
+
in a rendered page component or through a read followed by an unconditional
|
|
20
|
+
update.
|
|
21
|
+
- When a Client Component submits auth with `fetch`, expose the same production
|
|
22
|
+
route handler through the live auth interface `data-auth-action` contract. Do
|
|
23
|
+
not create a verifier-only route or duplicate the credential/session logic.
|
|
24
|
+
- Use middleware/proxy only as an early redirect layer. The protected server
|
|
25
|
+
route must still verify the session.
|
|
26
|
+
- Run idempotent migrations during a controlled build/deploy step, not through a
|
|
27
|
+
public `/api/init` route.
|
|
28
|
+
- Mark session-dependent rendering dynamic according to the installed Next.js
|
|
29
|
+
version so signed-in navigation is not cached as another user's state.
|
|
30
|
+
|
|
31
|
+
Prefer a maintained auth library already configured in the repository when it
|
|
32
|
+
supports the local account/session authority and selected account-entry paths.
|
|
33
|
+
If the product has no library, keep the custom implementation small and follow
|
|
34
|
+
the applicable method workflows and shared session-and-credentials contract.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Session And Credential Security
|
|
2
|
+
|
|
3
|
+
## Credentials
|
|
4
|
+
|
|
5
|
+
- Normalize email consistently and enforce uniqueness in the database.
|
|
6
|
+
- For an email/password profile, hash passwords with a maintained implementation
|
|
7
|
+
such as Argon2id, scrypt, or bcrypt with an appropriate work factor and store
|
|
8
|
+
only the hash.
|
|
9
|
+
- For a provider or passwordless profile, store only the provider identity or
|
|
10
|
+
hashed one-time credential state that profile requires. Do not invent a local
|
|
11
|
+
password or placeholder password hash.
|
|
12
|
+
- Never log passwords, provider secrets, one-time credentials, session tokens,
|
|
13
|
+
or complete auth request bodies.
|
|
14
|
+
- Keep credential and account-entry failures account-neutral. For passwords,
|
|
15
|
+
return the same invalid-credentials response for unknown email and wrong
|
|
16
|
+
password.
|
|
17
|
+
- Apply bounded rate limiting to signup, login, and recovery mutations.
|
|
18
|
+
|
|
19
|
+
## Sessions
|
|
20
|
+
|
|
21
|
+
- Generate a cryptographically random opaque session id.
|
|
22
|
+
- Store revocable server-side session state; prefer storing a hash of the token.
|
|
23
|
+
- For a new custom Node/Postgres profile, hash the raw token as SHA-256
|
|
24
|
+
hexadecimal in `sessions.token_hash` and default to the `egbe_session`
|
|
25
|
+
cookie. Keep the request-time resolver and the bundled private validation
|
|
26
|
+
helper on one contract. If an existing working resolver already uses this
|
|
27
|
+
authoritative state and hash contract under another cookie name, preserve
|
|
28
|
+
it and pass that real name through the helper's `--cookie-name` option; do
|
|
29
|
+
not rename a working session solely for validation setup.
|
|
30
|
+
- Rotate/create a new session after signup and login.
|
|
31
|
+
- Set the browser cookie with `HttpOnly`, `Secure` on HTTPS,
|
|
32
|
+
`SameSite=Lax` or stricter, `Path=/`, and an explicit expiry.
|
|
33
|
+
- Validate expiry and revocation on every protected request.
|
|
34
|
+
- On logout, revoke the server record before clearing the cookie.
|
|
35
|
+
- Do not use localStorage, readable client tokens, a user id, or an email address
|
|
36
|
+
as proof of authentication.
|
|
37
|
+
|
|
38
|
+
## Request And Redirect Safety
|
|
39
|
+
|
|
40
|
+
- Protect state-changing requests with the framework's same-origin/CSRF
|
|
41
|
+
mechanism.
|
|
42
|
+
- Check that response privacy headers and request protection work together for
|
|
43
|
+
the transport actually used. A native form POST can send `Origin: null` under
|
|
44
|
+
`Referrer-Policy: no-referrer`, even to its own origin; a direct HTTP probe
|
|
45
|
+
supplying the expected `Origin` does not exercise that browser behavior.
|
|
46
|
+
Choose a compatible policy for ordinary forms or use the framework's complete
|
|
47
|
+
supported CSRF mechanism. Keep the stricter privacy policy on one-time
|
|
48
|
+
credential exchange responses. Do not fix a rejected form by disabling CSRF
|
|
49
|
+
checks or trusting `null` as a same-origin identity. See the
|
|
50
|
+
[Fetch origin-header rules](https://fetch.spec.whatwg.org/#append-a-request-origin-header).
|
|
51
|
+
- Accept return destinations only when they are safe same-origin relative paths.
|
|
52
|
+
- Do not place passwords, session ids, or user identity in URLs. A short-lived
|
|
53
|
+
one-time email credential may appear only in its intended HTTPS exchange link;
|
|
54
|
+
redact it from logs and analytics and remove it from the browser URL after
|
|
55
|
+
exchange.
|
|
56
|
+
- Keep authentication and authorization checks on the server. Client state may
|
|
57
|
+
render UX, but it cannot grant access.
|
|
58
|
+
- Do not add demo users, in-memory fallback sessions, public route bypasses, or
|
|
59
|
+
fail-open behavior when the database is unavailable.
|
|
60
|
+
|
|
61
|
+
## Private Validation Identity
|
|
62
|
+
|
|
63
|
+
After real account entry has been proved, dependent Product and Billing work
|
|
64
|
+
may create or reuse one isolated validation identity directly through the
|
|
65
|
+
server-side session authority. The raw token must exist only in a private
|
|
66
|
+
mode-`0600` state file, while the database stores only its hash. Load that
|
|
67
|
+
cookie into an isolated browser session; never add a public test-login route,
|
|
68
|
+
fixed credential, committed secret, or production bypass.
|
|
69
|
+
|
|
70
|
+
The validation identity is authenticated setup for exercising protected
|
|
71
|
+
behavior. Its existence is not evidence for signup, login, credential or email
|
|
72
|
+
exchange, logout, or recovery. Those flows still require their real Auth-owned
|
|
73
|
+
proof.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Authentication Experience
|
|
2
|
+
|
|
3
|
+
## Shared Navigation
|
|
4
|
+
|
|
5
|
+
Authentication changes the existing shared navigation instead of adding a
|
|
6
|
+
second header.
|
|
7
|
+
|
|
8
|
+
Signed out:
|
|
9
|
+
|
|
10
|
+
- keep the primary product/first-value CTA;
|
|
11
|
+
- show a clear login action;
|
|
12
|
+
- do not force signup before first value when the product supports public
|
|
13
|
+
activation.
|
|
14
|
+
|
|
15
|
+
Signed in:
|
|
16
|
+
|
|
17
|
+
- replace guest login/signup controls with a recognizable user-menu trigger;
|
|
18
|
+
- show a non-sensitive identity such as name or email;
|
|
19
|
+
- provide one clear action to continue into the existing protected experience;
|
|
20
|
+
- provide logout;
|
|
21
|
+
- keep the menu keyboard accessible and usable in the mobile navigation.
|
|
22
|
+
|
|
23
|
+
## Forms
|
|
24
|
+
|
|
25
|
+
- Present the selected methods with the accepted hierarchy; use a clear semantic
|
|
26
|
+
separator when more than one method is offered. Do not add an unselected
|
|
27
|
+
method to fill a form or layout.
|
|
28
|
+
- Match the email method: show exactly email and password for the password
|
|
29
|
+
profile, or exactly email for passwordless email.
|
|
30
|
+
- Do not ask for name, company, username, password confirmation, or other
|
|
31
|
+
profile data before the account exists; use email as the initial identity.
|
|
32
|
+
- Use persistent visible labels and correct profile-appropriate autocomplete
|
|
33
|
+
values.
|
|
34
|
+
- Explain the product benefit or continuation, not internal auth mechanics.
|
|
35
|
+
- Cross-link signup and login.
|
|
36
|
+
- Show password requirements before submission only when passwords are used.
|
|
37
|
+
- Disable repeat submission while pending and preserve entered email on errors.
|
|
38
|
+
- Move focus to a concise visible error without revealing account existence.
|
|
39
|
+
- Provide password visibility controls with an accessible name when useful.
|
|
40
|
+
|
|
41
|
+
## Continuity
|
|
42
|
+
|
|
43
|
+
After signup/login, send the user to the intended useful route. If a public
|
|
44
|
+
first-value result led to signup, explain what will be saved or continued and
|
|
45
|
+
restore that exact result after authentication.
|
|
46
|
+
|
|
47
|
+
Do not redirect to an empty page, a missing route, the auth page itself, or
|
|
48
|
+
localhost. If the accepted destination is not implemented, a minimal protected
|
|
49
|
+
verification surface may show current-user identity and logout. It proves only
|
|
50
|
+
the auth mechanism, not the completed product journey; do not invent a dashboard
|
|
51
|
+
or placeholder feature controls to stand in for the missing destination.
|
|
52
|
+
|
|
53
|
+
## Recovery And Verification
|
|
54
|
+
|
|
55
|
+
Show recovery or verification UI only when the server flow and mail delivery
|
|
56
|
+
actually work. Never ship dead "Forgot password" or "Resend" controls. Follow
|
|
57
|
+
the account-recovery workflow for password recovery or separate verification,
|
|
58
|
+
and the passwordless-email workflow for email sign-in links.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Password Recovery And Email Verification
|
|
2
|
+
|
|
3
|
+
Use this workflow only when password recovery or a separate email-verification
|
|
4
|
+
step is in scope. Passwordless account entry belongs to
|
|
5
|
+
`references/workflows/passwordless-email.md`.
|
|
6
|
+
|
|
7
|
+
1. Read the live Egbe OS `egbe-os-mail` skill and use its supported delivery path.
|
|
8
|
+
2. Generate random, single-use, short-lived tokens and store only token hashes.
|
|
9
|
+
3. Bind tokens to one purpose and user. Invalidate them after use and after a
|
|
10
|
+
newer token is issued.
|
|
11
|
+
4. Always return a neutral response from recovery requests so account existence
|
|
12
|
+
is not disclosed.
|
|
13
|
+
5. Build links from the verified deployed HTTPS host and a same-origin path.
|
|
14
|
+
6. After reset, revoke older sessions and create a fresh session only after the
|
|
15
|
+
new credential succeeds.
|
|
16
|
+
7. Consume a token atomically so concurrent requests cannot both succeed.
|
|
17
|
+
8. Verify the actual email and live link before promising recovery or
|
|
18
|
+
verification in the UI.
|
|
19
|
+
|
|
20
|
+
Canonical analytics names and delivery remain owned by the Egbe OS `egbe-os-analytics`
|
|
21
|
+
skill. Add events such as email verification only through its analytics
|
|
22
|
+
workflow.
|