diff --git a/apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx b/apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx index 18a08fa70b..e3edec625b 100644 --- a/apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx +++ b/apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx @@ -39,7 +39,6 @@ import { useOrganizationWithMembers } from '@/app/api/organizations/hooks'; import { useOrgKiloClawNavState } from '@/hooks/useOrgKiloClaw'; import SidebarMenuList from './SidebarMenuList'; import SidebarUserFooter from './SidebarUserFooter'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; import { useFeatureFlagEnabled } from 'posthog-js/react'; import { canManageOrganizationBilling } from '@kilocode/app-shared/organizations'; @@ -61,6 +60,7 @@ export default function OrganizationAppSidebar({ // Feature flags const isAutoTriageFeatureEnabled = useFeatureFlagEnabled('auto-triage-feature'); const isAppBuilderEnabled = useFeatureFlagEnabled('app-builder-feature'); + const isDeployEnabled = useFeatureFlagEnabled('deploy-feature'); const isDevelopment = process.env.NODE_ENV === 'development'; // Get current organization role and data @@ -233,7 +233,7 @@ export default function OrganizationAppSidebar({ { title: 'Auto Fix', icon: Wrench, url: `/organizations/${organizationId}/auto-fix` }, ] : []), - ...(ENABLE_DEPLOY_FEATURE + ...(isDeployEnabled || isDevelopment ? [ { title: 'Deploy', @@ -287,15 +287,11 @@ export default function OrganizationAppSidebar({ }, ] : []), - ...(ENABLE_DEPLOY_FEATURE - ? [ - { - title: 'Integrations', - icon: Cable, - url: `/organizations/${organizationId}/integrations`, - }, - ] - : []), + { + title: 'Integrations', + icon: Cable, + url: `/organizations/${organizationId}/integrations`, + }, ...(hasOwnerLevelAccess && currentOrg?.plan === 'enterprise' ? [ { diff --git a/apps/web/src/app/(app)/components/PersonalAppSidebar.tsx b/apps/web/src/app/(app)/components/PersonalAppSidebar.tsx index 8be8ec769c..0fe0fefe22 100644 --- a/apps/web/src/app/(app)/components/PersonalAppSidebar.tsx +++ b/apps/web/src/app/(app)/components/PersonalAppSidebar.tsx @@ -35,7 +35,6 @@ import OrganizationSwitcher from './OrganizationSwitcher'; import SidebarMenuList from './SidebarMenuList'; import SidebarPromoBanner from './SidebarPromoBanner'; import SidebarUserFooter from './SidebarUserFooter'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; import { isEnabledForUser } from '@/lib/code-indexing/util'; import { useFeatureFlagEnabled } from 'posthog-js/react'; import { usePathname } from 'next/navigation'; @@ -59,6 +58,7 @@ export default function PersonalAppSidebar(props: React.ComponentProps; }) { - await getUserFromAuthOrRedirect(); + const user = await getUserFromAuthOrRedirect(); - if (!ENABLE_DEPLOY_FEATURE) { + const isDeployEnabled = await isFeatureFlagEnabled('deploy-feature', user.id); + const isDevelopment = process.env.NODE_ENV === 'development'; + + if (!isDeployEnabled && !isDevelopment) { return notFound(); } diff --git a/apps/web/src/app/(app)/deploy/page.tsx b/apps/web/src/app/(app)/deploy/page.tsx index 6be54599ca..923dc686f1 100644 --- a/apps/web/src/app/(app)/deploy/page.tsx +++ b/apps/web/src/app/(app)/deploy/page.tsx @@ -1,12 +1,15 @@ import { getUserFromAuthOrRedirect } from '@/lib/user/server'; import { DeployPageClient } from './DeployPageClient'; import { notFound } from 'next/navigation'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; +import { isFeatureFlagEnabled } from '@/lib/posthog-feature-flags'; export default async function DeployPage() { - await getUserFromAuthOrRedirect('/users/sign_in?callbackPath=/deploy'); + const user = await getUserFromAuthOrRedirect('/users/sign_in?callbackPath=/deploy'); - if (!ENABLE_DEPLOY_FEATURE) { + const isDeployEnabled = await isFeatureFlagEnabled('deploy-feature', user.id); + const isDevelopment = process.env.NODE_ENV === 'development'; + + if (!isDeployEnabled && !isDevelopment) { return notFound(); } diff --git a/apps/web/src/app/(app)/organizations/[id]/deploy/[deploymentId]/page.tsx b/apps/web/src/app/(app)/organizations/[id]/deploy/[deploymentId]/page.tsx index 0010996925..da2dec52f3 100644 --- a/apps/web/src/app/(app)/organizations/[id]/deploy/[deploymentId]/page.tsx +++ b/apps/web/src/app/(app)/organizations/[id]/deploy/[deploymentId]/page.tsx @@ -2,16 +2,19 @@ import { getUserFromAuthOrRedirect } from '@/lib/user/server'; import { DeployPageClient } from '../DeployPageClient'; import { notFound } from 'next/navigation'; import { OrganizationByPageLayout } from '@/components/organizations/OrganizationByPageLayout'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; +import { isFeatureFlagEnabled } from '@/lib/posthog-feature-flags'; export default async function OrgDeploymentDetailPage({ params, }: { params: Promise<{ id: string; deploymentId: string }>; }) { - await getUserFromAuthOrRedirect('/users/sign_in'); + const user = await getUserFromAuthOrRedirect('/users/sign_in'); - if (!ENABLE_DEPLOY_FEATURE) { + const isDeployEnabled = await isFeatureFlagEnabled('deploy-feature', user.id); + const isDevelopment = process.env.NODE_ENV === 'development'; + + if (!isDeployEnabled && !isDevelopment) { return notFound(); } diff --git a/apps/web/src/app/(app)/organizations/[id]/deploy/page.tsx b/apps/web/src/app/(app)/organizations/[id]/deploy/page.tsx index fcfdb8a5c4..9140a23651 100644 --- a/apps/web/src/app/(app)/organizations/[id]/deploy/page.tsx +++ b/apps/web/src/app/(app)/organizations/[id]/deploy/page.tsx @@ -2,16 +2,19 @@ import { getUserFromAuthOrRedirect } from '@/lib/user/server'; import { DeployPageClient } from './DeployPageClient'; import { notFound } from 'next/navigation'; import { OrganizationByPageLayout } from '@/components/organizations/OrganizationByPageLayout'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; +import { isFeatureFlagEnabled } from '@/lib/posthog-feature-flags'; export default async function OrganizationDeployPage({ params, }: { params: Promise<{ id: string }>; }) { - await getUserFromAuthOrRedirect('/users/sign_in'); + const user = await getUserFromAuthOrRedirect('/users/sign_in'); - if (!ENABLE_DEPLOY_FEATURE) { + const isDeployEnabled = await isFeatureFlagEnabled('deploy-feature', user.id); + const isDevelopment = process.env.NODE_ENV === 'development'; + + if (!isDeployEnabled && !isDevelopment) { return notFound(); } diff --git a/apps/web/src/app/(app)/organizations/[id]/integrations/page.tsx b/apps/web/src/app/(app)/organizations/[id]/integrations/page.tsx index bf1001e823..a5815637c3 100644 --- a/apps/web/src/app/(app)/organizations/[id]/integrations/page.tsx +++ b/apps/web/src/app/(app)/organizations/[id]/integrations/page.tsx @@ -3,16 +3,10 @@ import { IntegrationsPageClient } from './IntegrationsPageClient'; import { OrganizationByPageLayout } from '@/components/organizations/OrganizationByPageLayout'; import { SetPageTitle } from '@/components/SetPageTitle'; import { getUserFromAuthOrRedirect } from '@/lib/user/server'; -import { notFound } from 'next/navigation'; -import { ENABLE_DEPLOY_FEATURE } from '@/lib/constants'; export default async function IntegrationsPage({ params }: { params: Promise<{ id: string }> }) { await getUserFromAuthOrRedirect('/users/sign_in'); - if (!ENABLE_DEPLOY_FEATURE) { - return notFound(); - } - return (