@sylphx/cli 0.14.0 → 0.14.2

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/dist/main.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@sylphx/cli",
18
- version: "0.14.0",
18
+ version: "0.14.2",
19
19
  description: "Sylphx Platform CLI \u2014 deploy and manage your applications from the terminal. 63 commands across deployment, logs, env vars, domains, databases, storage, monitoring, self-service (user), admin (users/quotas/audit/invitations/jwt-keys/project-migrate), and more.",
20
20
  type: "module",
21
21
  homepage: "https://sylphx.com",
@@ -71,7 +71,7 @@ var init_package = __esm({
71
71
  "@effect/cli": "0.75.1",
72
72
  "@effect/platform": "0.96.0",
73
73
  "@effect/platform-bun": "0.89.0",
74
- "@sylphx/sdk": "0.14.0",
74
+ "@sylphx/sdk": "0.15.0",
75
75
  chalk: "^5.3.0",
76
76
  effect: "3.21.0",
77
77
  eventsource: "^2.0.2",
@@ -314,6 +314,80 @@ var init_admin_anomalies = __esm({
314
314
  }
315
315
  });
316
316
 
317
+ // ../contract/dist/endpoints/admin-anomalies.js
318
+ var adminAnomaliesEndpoints;
319
+ var init_admin_anomalies2 = __esm({
320
+ "../contract/dist/endpoints/admin-anomalies.js"() {
321
+ "use strict";
322
+ init_endpoint();
323
+ init_admin_anomalies();
324
+ adminAnomaliesEndpoints = {
325
+ stats: defineEndpoint({
326
+ method: "GET",
327
+ path: "/operator/anomalies/stats",
328
+ response: AdminAnomalyStatsResult,
329
+ plane: "management",
330
+ summary: "Anomaly counts by status",
331
+ tags: ["admin-anomalies"]
332
+ }),
333
+ list: defineEndpoint({
334
+ method: "GET",
335
+ path: "/operator/anomalies/",
336
+ query: AdminListAnomaliesQuery,
337
+ response: AdminListAnomaliesResult,
338
+ plane: "management",
339
+ summary: "List spending anomalies with filters + pagination",
340
+ tags: ["admin-anomalies"]
341
+ }),
342
+ get: defineEndpoint({
343
+ method: "GET",
344
+ path: "/operator/anomalies/:anomalyId",
345
+ params: AdminAnomalyIdParams,
346
+ response: AdminGetAnomalyResult,
347
+ plane: "management",
348
+ summary: "Get a single anomaly by ID",
349
+ tags: ["admin-anomalies"]
350
+ }),
351
+ acknowledge: defineEndpoint({
352
+ method: "POST",
353
+ path: "/operator/anomalies/:anomalyId/acknowledge",
354
+ params: AdminAnomalyIdParams,
355
+ response: AdminAnomalyActionResult,
356
+ plane: "management",
357
+ summary: "Mark an anomaly as acknowledged",
358
+ tags: ["admin-anomalies"]
359
+ }),
360
+ dismiss: defineEndpoint({
361
+ method: "POST",
362
+ path: "/operator/anomalies/:anomalyId/dismiss",
363
+ params: AdminAnomalyIdParams,
364
+ response: AdminAnomalyActionResult,
365
+ plane: "management",
366
+ summary: "Dismiss an anomaly as a false positive",
367
+ tags: ["admin-anomalies"]
368
+ }),
369
+ resolve: defineEndpoint({
370
+ method: "POST",
371
+ path: "/operator/anomalies/:anomalyId/resolve",
372
+ params: AdminAnomalyIdParams,
373
+ body: AdminResolveAnomalyInput,
374
+ response: AdminAnomalyActionResult,
375
+ plane: "management",
376
+ summary: "Resolve an anomaly with notes",
377
+ tags: ["admin-anomalies"]
378
+ }),
379
+ errorsOverview: defineEndpoint({
380
+ method: "GET",
381
+ path: "/operator/anomalies/errors/overview",
382
+ response: AdminErrorsOverviewResult,
383
+ plane: "management",
384
+ summary: "Cross-project error monitoring overview",
385
+ tags: ["admin-anomalies"]
386
+ })
387
+ };
388
+ }
389
+ });
390
+
317
391
  // ../contract/dist/schemas/admin-apm.js
318
392
  import { Schema as Schema3 } from "effect";
319
393
  var AdminApmHttpMethod, AdminApmPeriod, AdminApmOverviewResult, AdminApmEndpointMetrics, AdminApmTrendPoint, AdminApmSlowestEndpoint, AdminApmErrorEndpoint, AdminApmHourlyVolumePoint, AdminApmProjectParams, AdminApmDateRangeQuery, AdminApmEndpointsQuery, AdminApmEndpointTrendQuery, AdminApmTopEndpointsQuery, AdminApmEndpointsResult, AdminApmEndpointTrendResult, AdminApmSlowestEndpointsResult, AdminApmErrorEndpointsResult, AdminApmHourlyVolumeResult;
@@ -1709,6 +1783,199 @@ var init_admin_billing = __esm({
1709
1783
  }
1710
1784
  });
1711
1785
 
1786
+ // ../contract/dist/endpoints/admin-billing.js
1787
+ var adminBillingEndpoints;
1788
+ var init_admin_billing2 = __esm({
1789
+ "../contract/dist/endpoints/admin-billing.js"() {
1790
+ "use strict";
1791
+ init_endpoint();
1792
+ init_admin_billing();
1793
+ adminBillingEndpoints = {
1794
+ // ── Overview ───────────────────────────────────────────────────────────
1795
+ overview: defineEndpoint({
1796
+ method: "GET",
1797
+ path: "/operator/billing/overview",
1798
+ response: AdminBillingUnknownResult,
1799
+ plane: "management",
1800
+ summary: "Billing overview for the current user's org",
1801
+ tags: ["admin-billing"]
1802
+ }),
1803
+ // ── Stats ──────────────────────────────────────────────────────────────
1804
+ stats: defineEndpoint({
1805
+ method: "GET",
1806
+ path: "/operator/billing/stats",
1807
+ response: AdminBillingUnknownResult,
1808
+ plane: "management",
1809
+ summary: "Platform-wide billing statistics",
1810
+ tags: ["admin-billing"]
1811
+ }),
1812
+ // ── Usage ──────────────────────────────────────────────────────────────
1813
+ platformUsage: defineEndpoint({
1814
+ method: "GET",
1815
+ path: "/operator/billing/usage/platform",
1816
+ query: AdminBillingUsageQuery,
1817
+ response: AdminBillingUnknownResult,
1818
+ plane: "management",
1819
+ summary: "Platform-wide usage report",
1820
+ tags: ["admin-billing"]
1821
+ }),
1822
+ orgUsage: defineEndpoint({
1823
+ method: "GET",
1824
+ path: "/operator/billing/usage/orgs/:orgId",
1825
+ params: AdminBillingOrgParams,
1826
+ query: AdminBillingUsageQuery,
1827
+ response: AdminBillingUnknownResult,
1828
+ plane: "management",
1829
+ summary: "Per-org usage report",
1830
+ tags: ["admin-billing"]
1831
+ }),
1832
+ orgMonthlySummary: defineEndpoint({
1833
+ method: "GET",
1834
+ path: "/operator/billing/usage/orgs/:orgId/monthly",
1835
+ params: AdminBillingOrgParams,
1836
+ query: AdminBillingMonthlyQuery,
1837
+ response: AdminBillingUnknownResult,
1838
+ plane: "management",
1839
+ summary: "Per-org monthly usage summary",
1840
+ tags: ["admin-billing"]
1841
+ }),
1842
+ // ── Balances ───────────────────────────────────────────────────────────
1843
+ listBalances: defineEndpoint({
1844
+ method: "GET",
1845
+ path: "/operator/billing/balances",
1846
+ query: AdminBillingListQuery,
1847
+ response: AdminBillingUnknownResult,
1848
+ plane: "management",
1849
+ summary: "List all org balances",
1850
+ tags: ["admin-billing"]
1851
+ }),
1852
+ getBalance: defineEndpoint({
1853
+ method: "GET",
1854
+ path: "/operator/billing/balances/:orgId",
1855
+ params: AdminBillingOrgParams,
1856
+ response: AdminBillingUnknownResult,
1857
+ plane: "management",
1858
+ summary: "Get org balance details",
1859
+ tags: ["admin-billing"]
1860
+ }),
1861
+ getTransactions: defineEndpoint({
1862
+ method: "GET",
1863
+ path: "/operator/billing/balances/:orgId/transactions",
1864
+ params: AdminBillingOrgParams,
1865
+ query: AdminBillingTransactionsQuery,
1866
+ response: AdminBillingUnknownResult,
1867
+ plane: "management",
1868
+ summary: "Get org balance transactions",
1869
+ tags: ["admin-billing"]
1870
+ }),
1871
+ addCredits: defineEndpoint({
1872
+ method: "POST",
1873
+ path: "/operator/billing/balances/:orgId/credits",
1874
+ params: AdminBillingOrgParams,
1875
+ body: AdminBillingAddCreditsInput,
1876
+ response: AdminBillingUnknownResult,
1877
+ plane: "management",
1878
+ summary: "Add credits to an org balance",
1879
+ tags: ["admin-billing"]
1880
+ }),
1881
+ updateBalanceSettings: defineEndpoint({
1882
+ method: "PATCH",
1883
+ path: "/operator/billing/balances/:orgId/settings",
1884
+ params: AdminBillingOrgParams,
1885
+ body: AdminBillingUpdateSettingsInput,
1886
+ response: AdminBillingUnknownResult,
1887
+ plane: "management",
1888
+ summary: "Update balance settings (alerts + auto top-up)",
1889
+ tags: ["admin-billing"]
1890
+ }),
1891
+ // ── Invoices ───────────────────────────────────────────────────────────
1892
+ listInvoices: defineEndpoint({
1893
+ method: "GET",
1894
+ path: "/operator/billing/invoices",
1895
+ query: AdminBillingListQuery,
1896
+ response: AdminBillingUnknownResult,
1897
+ plane: "management",
1898
+ summary: "List invoices across all orgs",
1899
+ tags: ["admin-billing"]
1900
+ }),
1901
+ getInvoice: defineEndpoint({
1902
+ method: "GET",
1903
+ path: "/operator/billing/invoices/:invoiceId",
1904
+ params: AdminBillingInvoiceParams,
1905
+ response: AdminBillingUnknownResult,
1906
+ plane: "management",
1907
+ summary: "Get invoice details",
1908
+ tags: ["admin-billing"]
1909
+ }),
1910
+ getOrgInvoices: defineEndpoint({
1911
+ method: "GET",
1912
+ path: "/operator/billing/orgs/:orgId/invoices",
1913
+ params: AdminBillingOrgParams,
1914
+ query: AdminBillingListQuery,
1915
+ response: AdminBillingUnknownResult,
1916
+ plane: "management",
1917
+ summary: "List invoices for a specific org",
1918
+ tags: ["admin-billing"]
1919
+ }),
1920
+ generateInvoice: defineEndpoint({
1921
+ method: "POST",
1922
+ path: "/operator/billing/orgs/:orgId/invoices",
1923
+ success: { status: 201 },
1924
+ params: AdminBillingOrgParams,
1925
+ body: AdminBillingGenerateInvoiceInput,
1926
+ response: AdminBillingUnknownResult,
1927
+ plane: "management",
1928
+ summary: "Generate a manual invoice for an org",
1929
+ tags: ["admin-billing"]
1930
+ }),
1931
+ finalizeInvoice: defineEndpoint({
1932
+ method: "POST",
1933
+ path: "/operator/billing/invoices/:invoiceId/finalize",
1934
+ params: AdminBillingInvoiceParams,
1935
+ response: AdminBillingUnknownResult,
1936
+ plane: "management",
1937
+ summary: "Finalize a draft invoice",
1938
+ tags: ["admin-billing"]
1939
+ }),
1940
+ // ── Pricing ────────────────────────────────────────────────────────────
1941
+ getPricing: defineEndpoint({
1942
+ method: "GET",
1943
+ path: "/operator/billing/pricing",
1944
+ response: AdminBillingUnknownResult,
1945
+ plane: "management",
1946
+ summary: "Get pricing configuration",
1947
+ tags: ["admin-billing"]
1948
+ }),
1949
+ updatePricing: defineEndpoint({
1950
+ method: "PATCH",
1951
+ path: "/operator/billing/pricing",
1952
+ body: AdminBillingUpdatePricingInput,
1953
+ response: AdminBillingUnknownResult,
1954
+ plane: "management",
1955
+ summary: "Update pricing configuration",
1956
+ tags: ["admin-billing"]
1957
+ }),
1958
+ // ── Analysis ───────────────────────────────────────────────────────────
1959
+ costAnalysis: defineEndpoint({
1960
+ method: "GET",
1961
+ path: "/operator/billing/analysis/costs",
1962
+ response: AdminBillingUnknownResult,
1963
+ plane: "management",
1964
+ summary: "Platform-wide cost analysis",
1965
+ tags: ["admin-billing"]
1966
+ }),
1967
+ topConsumers: defineEndpoint({
1968
+ method: "GET",
1969
+ path: "/operator/billing/analysis/top-consumers",
1970
+ response: AdminBillingUnknownResult,
1971
+ plane: "management",
1972
+ summary: "Ranked list of top resource consumers",
1973
+ tags: ["admin-billing"]
1974
+ })
1975
+ };
1976
+ }
1977
+ });
1978
+
1712
1979
  // ../contract/dist/schemas/admin-bootstrap.js
1713
1980
  import { Schema as Schema8 } from "effect";
1714
1981
  var ResetBootstrapWindowInput, ResetBootstrapWindowResult;
@@ -2384,6 +2651,124 @@ var init_admin_config = __esm({
2384
2651
  }
2385
2652
  });
2386
2653
 
2654
+ // ../contract/dist/endpoints/admin-config.js
2655
+ var adminConfigEndpoints;
2656
+ var init_admin_config2 = __esm({
2657
+ "../contract/dist/endpoints/admin-config.js"() {
2658
+ "use strict";
2659
+ init_endpoint();
2660
+ init_admin_config();
2661
+ adminConfigEndpoints = {
2662
+ getReferralConfig: defineEndpoint({
2663
+ method: "GET",
2664
+ path: "/operator/config/projects/:projectId/referral-config",
2665
+ params: AdminConfigProjectParams,
2666
+ response: AdminGetReferralConfigResult,
2667
+ plane: "management",
2668
+ summary: "Get referral program config for a project",
2669
+ tags: ["admin-config"]
2670
+ }),
2671
+ updateReferralConfig: defineEndpoint({
2672
+ method: "PATCH",
2673
+ path: "/operator/config/projects/:projectId/referral-config",
2674
+ params: AdminConfigProjectParams,
2675
+ body: AdminUpdateReferralConfigInput,
2676
+ response: AdminUpdateReferralConfigResult,
2677
+ plane: "management",
2678
+ summary: "Update referral program config",
2679
+ tags: ["admin-config"]
2680
+ }),
2681
+ getConsentConfig: defineEndpoint({
2682
+ method: "GET",
2683
+ path: "/operator/config/projects/:projectId/consent-config",
2684
+ params: AdminConfigProjectParams,
2685
+ response: AdminGetConsentConfigResult,
2686
+ plane: "management",
2687
+ summary: "Get consent banner config for a project",
2688
+ tags: ["admin-config"]
2689
+ }),
2690
+ updateConsentConfig: defineEndpoint({
2691
+ method: "PATCH",
2692
+ path: "/operator/config/projects/:projectId/consent-config",
2693
+ params: AdminConfigProjectParams,
2694
+ body: AdminUpdateConsentConfigInput,
2695
+ response: AdminUpdateConsentConfigResult,
2696
+ plane: "management",
2697
+ summary: "Update consent banner config",
2698
+ tags: ["admin-config"]
2699
+ }),
2700
+ getPushCredentials: defineEndpoint({
2701
+ method: "GET",
2702
+ path: "/operator/config/projects/:projectId/push-credentials",
2703
+ params: AdminConfigProjectParams,
2704
+ response: AdminGetPushCredentialsResult,
2705
+ plane: "management",
2706
+ summary: "Get push credentials (secrets redacted)",
2707
+ tags: ["admin-config"]
2708
+ }),
2709
+ updatePushCredentials: defineEndpoint({
2710
+ method: "PATCH",
2711
+ path: "/operator/config/projects/:projectId/push-credentials",
2712
+ params: AdminConfigProjectParams,
2713
+ body: AdminUpdatePushCredentialsInput,
2714
+ response: AdminUpdatePushCredentialsResult,
2715
+ plane: "management",
2716
+ summary: "Update push credentials",
2717
+ tags: ["admin-config"]
2718
+ }),
2719
+ exportUsers: defineEndpoint({
2720
+ method: "POST",
2721
+ path: "/operator/config/projects/:projectId/users/export",
2722
+ params: AdminConfigProjectParams,
2723
+ response: AdminExportUsersResult,
2724
+ plane: "management",
2725
+ summary: "Export app users as CSV",
2726
+ tags: ["admin-config"]
2727
+ }),
2728
+ getOAuthProviders: defineEndpoint({
2729
+ method: "GET",
2730
+ path: "/operator/config/oauth-providers",
2731
+ response: AdminOAuthProvidersResult,
2732
+ plane: "management",
2733
+ summary: "List platform OAuth providers configured by environment",
2734
+ tags: ["admin-config"]
2735
+ }),
2736
+ notificationsOverview: defineEndpoint({
2737
+ method: "GET",
2738
+ path: "/operator/config/notifications/overview",
2739
+ response: AdminOverviewResult,
2740
+ plane: "management",
2741
+ summary: "Platform-wide push notification stats",
2742
+ tags: ["admin-config"]
2743
+ }),
2744
+ referralsOverview: defineEndpoint({
2745
+ method: "GET",
2746
+ path: "/operator/config/referrals/overview",
2747
+ response: AdminOverviewResult,
2748
+ plane: "management",
2749
+ summary: "Platform-wide referral program stats",
2750
+ tags: ["admin-config"]
2751
+ }),
2752
+ flagsOverview: defineEndpoint({
2753
+ method: "GET",
2754
+ path: "/operator/config/flags/overview",
2755
+ response: AdminOverviewResult,
2756
+ plane: "management",
2757
+ summary: "Platform-wide feature flags overview",
2758
+ tags: ["admin-config"]
2759
+ }),
2760
+ webhooksOverview: defineEndpoint({
2761
+ method: "GET",
2762
+ path: "/operator/config/webhooks/overview",
2763
+ response: AdminOverviewResult,
2764
+ plane: "management",
2765
+ summary: "Platform-wide webhook delivery stats (7 day)",
2766
+ tags: ["admin-config"]
2767
+ })
2768
+ };
2769
+ }
2770
+ });
2771
+
2387
2772
  // ../contract/dist/schemas/admin-consent.js
2388
2773
  import { Schema as Schema15 } from "effect";
2389
2774
  var AdminConsentCategory, AdminConsentType, AdminConsentProjectParams, AdminConsentTypeParams, AdminCreateConsentTypeInput, AdminUpdateConsentTypeInput, AdminReorderConsentTypesInput, AdminBulkDeleteConsentTypesInput, AdminListConsentTypesQuery, AdminListUserConsentsQuery, AdminExportUserConsentsQuery, AdminConsentTypeWithStats, AdminListConsentTypesResult, AdminConsentTypeResult, AdminConsentSuccessResult, AdminBulkDeleteConsentTypesResult, AdminConsentStatsResult, AdminConsentProjectOverviewResult, AdminUserConsentRecord, AdminListUserConsentsResult, AdminExportUserConsentsResult, AdminConsentUnknownResult;
@@ -2525,6 +2910,136 @@ var init_admin_consent = __esm({
2525
2910
  }
2526
2911
  });
2527
2912
 
2913
+ // ../contract/dist/endpoints/admin-consent.js
2914
+ var adminConsentEndpoints;
2915
+ var init_admin_consent2 = __esm({
2916
+ "../contract/dist/endpoints/admin-consent.js"() {
2917
+ "use strict";
2918
+ init_endpoint();
2919
+ init_admin_consent();
2920
+ adminConsentEndpoints = {
2921
+ // ── Consent types ──────────────────────────────────────────────────────
2922
+ listTypes: defineEndpoint({
2923
+ method: "GET",
2924
+ path: "/operator/consent/projects/:projectId/consent-types",
2925
+ params: AdminConsentProjectParams,
2926
+ query: AdminListConsentTypesQuery,
2927
+ response: AdminListConsentTypesResult,
2928
+ plane: "management",
2929
+ summary: "List consent types for a project",
2930
+ tags: ["admin-consent"]
2931
+ }),
2932
+ createType: defineEndpoint({
2933
+ method: "POST",
2934
+ path: "/operator/consent/projects/:projectId/consent-types",
2935
+ success: { status: 201 },
2936
+ params: AdminConsentProjectParams,
2937
+ body: AdminCreateConsentTypeInput,
2938
+ response: AdminConsentType,
2939
+ plane: "management",
2940
+ summary: "Create a consent type",
2941
+ tags: ["admin-consent"]
2942
+ }),
2943
+ updateType: defineEndpoint({
2944
+ method: "PATCH",
2945
+ path: "/operator/consent/projects/:projectId/consent-types/:typeId",
2946
+ params: AdminConsentTypeParams,
2947
+ body: AdminUpdateConsentTypeInput,
2948
+ response: AdminConsentType,
2949
+ plane: "management",
2950
+ summary: "Update a consent type",
2951
+ tags: ["admin-consent"]
2952
+ }),
2953
+ deleteType: defineEndpoint({
2954
+ method: "DELETE",
2955
+ path: "/operator/consent/projects/:projectId/consent-types/:typeId",
2956
+ params: AdminConsentTypeParams,
2957
+ response: AdminConsentSuccessResult,
2958
+ plane: "management",
2959
+ summary: "Soft-delete a consent type",
2960
+ tags: ["admin-consent"]
2961
+ }),
2962
+ reactivateType: defineEndpoint({
2963
+ method: "POST",
2964
+ path: "/operator/consent/projects/:projectId/consent-types/:typeId/reactivate",
2965
+ params: AdminConsentTypeParams,
2966
+ response: AdminConsentSuccessResult,
2967
+ plane: "management",
2968
+ summary: "Reactivate a soft-deleted consent type",
2969
+ tags: ["admin-consent"]
2970
+ }),
2971
+ reorderTypes: defineEndpoint({
2972
+ method: "POST",
2973
+ path: "/operator/consent/projects/:projectId/consent-types/reorder",
2974
+ params: AdminConsentProjectParams,
2975
+ body: AdminReorderConsentTypesInput,
2976
+ response: AdminConsentSuccessResult,
2977
+ plane: "management",
2978
+ summary: "Reorder consent types",
2979
+ tags: ["admin-consent"]
2980
+ }),
2981
+ bulkDeleteTypes: defineEndpoint({
2982
+ method: "POST",
2983
+ path: "/operator/consent/projects/:projectId/consent-types/bulk-delete",
2984
+ params: AdminConsentProjectParams,
2985
+ body: AdminBulkDeleteConsentTypesInput,
2986
+ response: AdminBulkDeleteConsentTypesResult,
2987
+ plane: "management",
2988
+ summary: "Bulk soft-delete consent types",
2989
+ tags: ["admin-consent"]
2990
+ }),
2991
+ // ── User consents ──────────────────────────────────────────────────────
2992
+ listUserConsents: defineEndpoint({
2993
+ method: "GET",
2994
+ path: "/operator/consent/projects/:projectId/user-consents",
2995
+ params: AdminConsentProjectParams,
2996
+ query: AdminListUserConsentsQuery,
2997
+ response: AdminListUserConsentsResult,
2998
+ plane: "management",
2999
+ summary: "List user consent records for a project",
3000
+ tags: ["admin-consent"]
3001
+ }),
3002
+ exportUserConsents: defineEndpoint({
3003
+ method: "POST",
3004
+ path: "/operator/consent/projects/:projectId/user-consents/export",
3005
+ params: AdminConsentProjectParams,
3006
+ query: AdminExportUserConsentsQuery,
3007
+ response: AdminExportUserConsentsResult,
3008
+ plane: "management",
3009
+ summary: "Export user consent records as CSV (GDPR compliance)",
3010
+ tags: ["admin-consent"]
3011
+ }),
3012
+ // ── Stats / overview ───────────────────────────────────────────────────
3013
+ stats: defineEndpoint({
3014
+ method: "GET",
3015
+ path: "/operator/consent/projects/:projectId/consent-stats",
3016
+ params: AdminConsentProjectParams,
3017
+ response: AdminConsentStatsResult,
3018
+ plane: "management",
3019
+ summary: "Per-project consent stats",
3020
+ tags: ["admin-consent"]
3021
+ }),
3022
+ projectOverview: defineEndpoint({
3023
+ method: "GET",
3024
+ path: "/operator/consent/projects/:projectId/consent-overview",
3025
+ params: AdminConsentProjectParams,
3026
+ response: AdminConsentProjectOverviewResult,
3027
+ plane: "management",
3028
+ summary: "Per-project consent overview dashboard",
3029
+ tags: ["admin-consent"]
3030
+ }),
3031
+ platformOverview: defineEndpoint({
3032
+ method: "GET",
3033
+ path: "/operator/consent/overview",
3034
+ response: AdminConsentUnknownResult,
3035
+ plane: "management",
3036
+ summary: "Platform-wide consent overview",
3037
+ tags: ["admin-consent"]
3038
+ })
3039
+ };
3040
+ }
3041
+ });
3042
+
2528
3043
  // ../contract/dist/schemas/admin-env-services.js
2529
3044
  import { Schema as Schema16 } from "effect";
2530
3045
  var Reason3, ImageDigest2, EnvId, ServiceName, AdminEnvServiceRepointInput, AdminEnvServiceRepointResult;
@@ -12146,7 +12661,7 @@ function validateServiceInstanceRange(service) {
12146
12661
  }
12147
12662
  return true;
12148
12663
  }
12149
- var Slug2, ManifestEnvName, ManifestRegion, MachineSize, BuildMachineSize, BuildpackName, BuildStrategy, ServiceType, ManifestServiceInstanceCount, DeployStrategy, WwwRedirect, ManifestProjectSection, ManifestBuildSection, ManifestDeploySection, ManifestServiceBuildSection, ManifestServiceHealthSection, ManifestServiceSection, ManifestMigrationEngine, ManifestMigrationDestructivePolicy, ManifestMigrationsSection, ManifestDatabaseSection, ManifestEnvValue, ManifestDomainSection, ManifestManagedResourceTier, PostgresTier, PostgresVersion, SearchTier, KvTier, ManifestVolumeTier, ManifestVolumeSharing, ManifestDatabaseEngine, ManifestDatabaseResource, ManifestKvResource, ManifestSearchResource, ManifestVolumeResource, ManifestResourcesSection, ManifestCiSection, ManifestServiceOverride, ManifestEnvironmentOverride, ManifestEnvironmentsMap, SylphxManifest;
12664
+ var Slug2, ManifestEnvName, ManifestRegion, MachineSize, BuildMachineSize, BuildpackName, BuildStrategy, ServiceType, ManifestServiceInstanceCount, DeployStrategy, WwwRedirect, ManifestProjectSection, ManifestBuildSection, ManifestImageBuildSection, ManifestDeploySection, ManifestServiceBuildSection, ManifestServiceHealthSection, ManifestServiceSection, ManifestMigrationEngine, ManifestMigrationDestructivePolicy, ManifestMigrationsSection, ManifestDatabaseSection, ManifestEnvValue, ManifestDomainSection, ManifestManagedResourceTier, PostgresTier, PostgresVersion, SearchTier, KvTier, ManifestVolumeTier, ManifestVolumeSharing, ManifestDatabaseEngine, ManifestDatabaseResource, ManifestKvResource, ManifestSearchResource, ManifestVolumeResource, ManifestResourcesSection, ManifestCiSection, ManifestServiceOverride, ManifestEnvironmentOverride, ManifestEnvironmentsMap, SylphxManifest;
12150
12665
  var init_project_manifest = __esm({
12151
12666
  "../contract/dist/schemas/project-manifest.js"() {
12152
12667
  "use strict";
@@ -12207,6 +12722,13 @@ var init_project_manifest = __esm({
12207
12722
  /** Reserved for reproducible-builds (ADR-069) metadata. */
12208
12723
  reproducible: Schema91.optional(Schema91.Boolean)
12209
12724
  });
12725
+ ManifestImageBuildSection = Schema91.Struct({
12726
+ strategy: Schema91.optional(BuildStrategy),
12727
+ dockerfile: Schema91.optional(Schema91.String),
12728
+ context: Schema91.optional(Schema91.String),
12729
+ docker_context: Schema91.optional(Schema91.String),
12730
+ build_command: Schema91.optional(Schema91.String)
12731
+ });
12210
12732
  ManifestDeploySection = Schema91.Struct({
12211
12733
  /**
12212
12734
  * Command run before traffic cutover (DB migrations via expand-and-
@@ -12222,13 +12744,7 @@ var init_project_manifest = __esm({
12222
12744
  /** Grace period before SIGKILL (seconds). */
12223
12745
  graceful_shutdown: Schema91.optional(Schema91.Number.pipe(Schema91.int(), Schema91.between(0, 300)))
12224
12746
  });
12225
- ManifestServiceBuildSection = Schema91.Struct({
12226
- strategy: Schema91.optional(BuildStrategy),
12227
- dockerfile: Schema91.optional(Schema91.String),
12228
- context: Schema91.optional(Schema91.String),
12229
- docker_context: Schema91.optional(Schema91.String),
12230
- build_command: Schema91.optional(Schema91.String)
12231
- });
12747
+ ManifestServiceBuildSection = ManifestImageBuildSection;
12232
12748
  ManifestServiceHealthSection = Schema91.Struct({
12233
12749
  mode: Schema91.optional(Schema91.Literal("http", "tcp", "command")),
12234
12750
  path: Schema91.optional(Schema91.String),
@@ -12249,7 +12765,14 @@ var init_project_manifest = __esm({
12249
12765
  * apps that need one migration/release hook tied to a specific image.
12250
12766
  */
12251
12767
  release_command: Schema91.optional(Schema91.String),
12252
- /** Service port; required for `web` when it cannot be detected automatically. */
12768
+ /**
12769
+ * Advanced internal app listen-port override.
12770
+ *
12771
+ * Public URLs never expose this value — HTTP(S) remains 80/443 via platform
12772
+ * routing. When omitted for `type="web"`, the platform injects a default PORT
12773
+ * and wires the runtime to it.
12774
+ * `type="worker"` services must omit the field.
12775
+ */
12253
12776
  port: Schema91.optional(Schema91.Number.pipe(Schema91.int(), Schema91.between(1, 65535))),
12254
12777
  /** Explicit instance count. */
12255
12778
  instances: Schema91.optional(ManifestServiceInstanceCount),
@@ -12292,7 +12815,9 @@ var init_project_manifest = __esm({
12292
12815
  image: Slug2,
12293
12816
  command: Schema91.String.pipe(Schema91.minLength(1)),
12294
12817
  timeout: Schema91.optional(Schema91.String),
12295
- destructive_policy: Schema91.optional(ManifestMigrationDestructivePolicy)
12818
+ destructive_policy: Schema91.optional(ManifestMigrationDestructivePolicy),
12819
+ build: Schema91.optional(ManifestImageBuildSection),
12820
+ watch_paths: Schema91.optional(Schema91.Array(Schema91.String))
12296
12821
  });
12297
12822
  ManifestDatabaseSection = Schema91.Struct({
12298
12823
  migrations: Schema91.optional(ManifestMigrationsSection)
@@ -12379,6 +12904,7 @@ var init_project_manifest = __esm({
12379
12904
  name: Slug2,
12380
12905
  type: Schema91.optional(ServiceType),
12381
12906
  command: Schema91.optional(Schema91.String),
12907
+ /** Advanced internal app listen-port override; see ManifestServiceSection.port. */
12382
12908
  port: Schema91.optional(Schema91.Number.pipe(Schema91.int(), Schema91.between(1, 65535))),
12383
12909
  instances: Schema91.optional(ManifestServiceInstanceCount),
12384
12910
  instance_type: Schema91.optional(MachineSize),
@@ -14948,17 +15474,17 @@ var init_webhooks = __esm({
14948
15474
 
14949
15475
  // ../contract/dist/schemas/workspaces.js
14950
15476
  import { Schema as Schema112 } from "effect";
14951
- var WorkspaceStatus, WorkspaceVolumeSharing, WorkspaceVolumeStatus, ManagedWorkspaceVolume, ManagedWorkspace, WorkspaceProjectParams, WorkspaceProjectIdParams, WorkspaceIdParams, CreateWorkspaceInput, ForkWorkspaceInput, ListWorkspacesResult, WorkspaceResult, DeleteWorkspaceResult;
15477
+ var WorkspaceStatus, WorkspaceStorageSharing, WorkspaceStorageStatus, ManagedWorkspaceStorage, ManagedWorkspace, WorkspaceProjectParams, WorkspaceProjectIdParams, WorkspaceIdParams, CreateWorkspaceInput, ForkWorkspaceInput, ListWorkspacesResult, WorkspaceResult, DeleteWorkspaceResult;
14952
15478
  var init_workspaces = __esm({
14953
15479
  "../contract/dist/schemas/workspaces.js"() {
14954
15480
  "use strict";
14955
15481
  init_ids();
14956
15482
  WorkspaceStatus = Schema112.Literal("provisioning", "ready", "error", "archived");
14957
- WorkspaceVolumeSharing = Schema112.Literal("single-writer", "shared");
14958
- WorkspaceVolumeStatus = Schema112.Literal("provisioning", "active", "error");
14959
- ManagedWorkspaceVolume = Schema112.Struct({
14960
- sharing: WorkspaceVolumeSharing,
14961
- status: WorkspaceVolumeStatus
15483
+ WorkspaceStorageSharing = Schema112.Literal("single-writer", "shared");
15484
+ WorkspaceStorageStatus = Schema112.Literal("provisioning", "active", "error");
15485
+ ManagedWorkspaceStorage = Schema112.Struct({
15486
+ sharing: WorkspaceStorageSharing,
15487
+ status: WorkspaceStorageStatus
14962
15488
  });
14963
15489
  ManagedWorkspace = Schema112.Struct({
14964
15490
  id: WorkspaceId,
@@ -14972,7 +15498,7 @@ var init_workspaces = __esm({
14972
15498
  statusMessage: Schema112.optional(Schema112.NullOr(Schema112.String)),
14973
15499
  createdAt: Schema112.String,
14974
15500
  updatedAt: Schema112.String,
14975
- volume: Schema112.optional(ManagedWorkspaceVolume)
15501
+ storage: Schema112.optional(ManagedWorkspaceStorage)
14976
15502
  });
14977
15503
  WorkspaceProjectParams = Schema112.Struct({ projectId: ProjectId });
14978
15504
  WorkspaceProjectIdParams = Schema112.Struct({
@@ -15419,10 +15945,14 @@ var init_dist = __esm({
15419
15945
  "use strict";
15420
15946
  init_compute();
15421
15947
  init_endpoint();
15948
+ init_admin_anomalies2();
15422
15949
  init_admin_audit2();
15950
+ init_admin_billing2();
15423
15951
  init_admin_bootstrap2();
15424
15952
  init_admin_branch_databases2();
15425
15953
  init_admin_builds2();
15954
+ init_admin_config2();
15955
+ init_admin_consent2();
15426
15956
  init_admin_env_services2();
15427
15957
  init_admin_envs_spec2();
15428
15958
  init_admin_invitations2();
@@ -15663,12 +16193,23 @@ __export(admin_exports, {
15663
16193
  acknowledgeQuotaAlert: () => acknowledgeQuotaAlert,
15664
16194
  createInvitation: () => createInvitation,
15665
16195
  deleteUser: () => deleteUser,
16196
+ getAnalyticsOverview: () => getAnalyticsOverview,
15666
16197
  getAuditActivity: () => getAuditActivity,
15667
16198
  getAuditLogs: () => getAuditLogs,
16199
+ getBillingStats: () => getBillingStats,
16200
+ getConsentOverview: () => getConsentOverview,
16201
+ getDashboardCharts: () => getDashboardCharts,
16202
+ getDashboardHealth: () => getDashboardHealth,
16203
+ getDashboardStats: () => getDashboardStats,
16204
+ getErrorsOverview: () => getErrorsOverview,
16205
+ getFlagsOverview: () => getFlagsOverview,
16206
+ getNotificationsOverview: () => getNotificationsOverview,
15668
16207
  getProjectQuotas: () => getProjectQuotas,
15669
16208
  getQuotaAlerts: () => getQuotaAlerts,
15670
16209
  getQuotaStats: () => getQuotaStats,
16210
+ getReferralsOverview: () => getReferralsOverview,
15671
16211
  getUser: () => getUser,
16212
+ getWebhooksOverview: () => getWebhooksOverview,
15672
16213
  listInvitations: () => listInvitations,
15673
16214
  listJwtKeys: () => listJwtKeys,
15674
16215
  listUsers: () => listUsers,
@@ -15683,12 +16224,56 @@ __export(admin_exports, {
15683
16224
  updateUserRole: () => updateUserRole,
15684
16225
  verifyUserEmail: () => verifyUserEmail
15685
16226
  });
15686
- var getProjectQuotas, getQuotaStats, getQuotaAlerts, updateProjectQuotas, acknowledgeQuotaAlert, getAuditLogs, getAuditActivity, listInvitations, createInvitation, revokeInvitation, resendInvitation, listJwtKeys, rotateJwtKeys, retireJwtKey, migrateProject, regenerateEnvironmentKey, listUsers, getUser, updateUserRole, verifyUserEmail, deleteUser, revokeUserSessions;
16227
+ var getDashboardStats, getDashboardCharts, getDashboardHealth, getFlagsOverview, getNotificationsOverview, getErrorsOverview, getAnalyticsOverview, getBillingStats, getConsentOverview, getReferralsOverview, getWebhooksOverview, getProjectQuotas, getQuotaStats, getQuotaAlerts, updateProjectQuotas, acknowledgeQuotaAlert, getAuditLogs, getAuditActivity, listInvitations, createInvitation, revokeInvitation, resendInvitation, listJwtKeys, rotateJwtKeys, retireJwtKey, migrateProject, regenerateEnvironmentKey, listUsers, getUser, updateUserRole, verifyUserEmail, deleteUser, revokeUserSessions;
15687
16228
  var init_admin = __esm({
15688
16229
  "../management/dist/admin.js"() {
15689
16230
  "use strict";
15690
16231
  init_dist();
15691
16232
  init_http();
16233
+ getDashboardStats = (client) => {
16234
+ const { method, path: path7 } = adminAuditEndpoints.dashboard;
16235
+ return request(client, method, path7);
16236
+ };
16237
+ getDashboardCharts = (client) => {
16238
+ const { method, path: path7 } = adminAuditEndpoints.charts;
16239
+ return request(client, method, path7);
16240
+ };
16241
+ getDashboardHealth = (client) => {
16242
+ const { method, path: path7 } = adminAuditEndpoints.health;
16243
+ return request(client, method, path7);
16244
+ };
16245
+ getFlagsOverview = (client) => {
16246
+ const { method, path: path7 } = adminConfigEndpoints.flagsOverview;
16247
+ return request(client, method, path7);
16248
+ };
16249
+ getNotificationsOverview = (client) => {
16250
+ const { method, path: path7 } = adminConfigEndpoints.notificationsOverview;
16251
+ return request(client, method, path7);
16252
+ };
16253
+ getErrorsOverview = (client) => {
16254
+ const { method, path: path7 } = adminAnomaliesEndpoints.errorsOverview;
16255
+ return request(client, method, path7);
16256
+ };
16257
+ getAnalyticsOverview = (client) => {
16258
+ const { method, path: path7 } = adminAuditEndpoints.analytics;
16259
+ return request(client, method, path7);
16260
+ };
16261
+ getBillingStats = (client) => {
16262
+ const { method, path: path7 } = adminBillingEndpoints.stats;
16263
+ return request(client, method, path7);
16264
+ };
16265
+ getConsentOverview = (client) => {
16266
+ const { method, path: path7 } = adminConsentEndpoints.platformOverview;
16267
+ return request(client, method, path7);
16268
+ };
16269
+ getReferralsOverview = (client) => {
16270
+ const { method, path: path7 } = adminConfigEndpoints.referralsOverview;
16271
+ return request(client, method, path7);
16272
+ };
16273
+ getWebhooksOverview = (client) => {
16274
+ const { method, path: path7 } = adminConfigEndpoints.webhooksOverview;
16275
+ return request(client, method, path7);
16276
+ };
15692
16277
  getProjectQuotas = (client, projectId) => {
15693
16278
  const { method, path: path7 } = adminQuotasEndpoints.getProjectQuotas;
15694
16279
  return request(client, method, interpolatePath(path7, { projectId }));
@@ -18355,7 +18940,13 @@ function renderManifestToml(manifest) {
18355
18940
  }
18356
18941
  if (manifest.database?.migrations) {
18357
18942
  parts.push("[database.migrations]");
18358
- parts.push(...kv(manifest.database.migrations));
18943
+ const { build, ...migrations } = manifest.database.migrations;
18944
+ parts.push(...kv(migrations));
18945
+ if (build) {
18946
+ parts.push("");
18947
+ parts.push("[database.migrations.build]");
18948
+ parts.push(...kv(build));
18949
+ }
18359
18950
  parts.push("");
18360
18951
  }
18361
18952
  if (manifest.services) {
@@ -18758,6 +19349,13 @@ function readLinkedProject(filePath) {
18758
19349
  ...orgSlug ? { orgSlug } : {}
18759
19350
  };
18760
19351
  }
19352
+ function readProjectManifestOrg(filePath) {
19353
+ const manifest = parseManifestFile(filePath);
19354
+ const project = getProjectSection(manifest, filePath);
19355
+ if (!project) return void 0;
19356
+ const org = readString("project", project, "org")?.trim();
19357
+ return org && org.length > 0 ? org : void 0;
19358
+ }
18761
19359
  function requireLinkMetadata(link, key) {
18762
19360
  const value = link[key];
18763
19361
  if (typeof value === "string" && value.length > 0) return value;
@@ -18924,6 +19522,10 @@ var init_config = __esm({
18924
19522
  const manifestPath = findManifestPath(dir ?? process.cwd());
18925
19523
  return manifestPath ? readLinkedProject(manifestPath) : void 0;
18926
19524
  },
19525
+ getProjectManifestOrg(dir) {
19526
+ const manifestPath = findManifestPath(dir ?? process.cwd());
19527
+ return manifestPath ? readProjectManifestOrg(manifestPath) : void 0;
19528
+ },
18927
19529
  linkProject(link, dir) {
18928
19530
  writeLinkedProject(link, dir ?? process.cwd());
18929
19531
  },
@@ -19358,6 +19960,8 @@ function resolvePreferredOrgId() {
19358
19960
  const value = process.env[key]?.trim();
19359
19961
  if (value) return value;
19360
19962
  }
19963
+ const linked = config.getLinkedProject();
19964
+ if (linked?.orgId) return linked.orgId;
19361
19965
  return config.getDefaultOrg();
19362
19966
  }
19363
19967
  function mapRefreshFailure(cause) {
@@ -19966,7 +20570,7 @@ var init_oidc4 = __esm({
19966
20570
 
19967
20571
  // src/main.ts
19968
20572
  init_package();
19969
- import { Command as Command71 } from "@effect/cli";
20573
+ import { Command as Command71, HelpDoc, ValidationError } from "@effect/cli";
19970
20574
  import { BunContext, BunRuntime } from "@effect/platform-bun";
19971
20575
  import { Console as Console71, Effect as Effect81, Layer as Layer5 } from "effect";
19972
20576
 
@@ -20747,6 +21351,7 @@ var ConfigServiceLive = Layer3.succeed(ConfigService, {
20747
21351
  getDefaultOrg: Effect8.sync(() => config.getDefaultOrg()),
20748
21352
  setDefaultOrg: (org) => Effect8.sync(() => config.setDefaultOrg(org)),
20749
21353
  getLinkedProject: (dir) => Effect8.sync(() => config.getLinkedProject(dir)),
21354
+ getProjectManifestOrg: (dir) => Effect8.sync(() => config.getProjectManifestOrg(dir)),
20750
21355
  linkProject: (link, dir) => Effect8.sync(() => config.linkProject(link, dir)),
20751
21356
  unlinkProject: (dir) => Effect8.sync(() => config.unlinkProject(dir)),
20752
21357
  getConfigPath: Effect8.sync(() => config.getConfigPath()),
@@ -26392,29 +26997,45 @@ async function fetchLatestVersion() {
26392
26997
  return void 0;
26393
26998
  }
26394
26999
  }
26395
- async function runUpdateCheck() {
26396
- if (!shouldRunUpdateCheckForInvocation()) return;
26397
- const now = Date.now();
26398
- const cache = readCache();
26399
- const hitRegistry = shouldHitRegistry(now, cache);
26400
- let latest = cache?.latestKnown ?? void 0;
27000
+ async function resolveLatestVersionForNotice(opts) {
27001
+ const fetchLatest = opts.fetchLatestVersion ?? fetchLatestVersion;
27002
+ const persistCache = opts.writeCache ?? writeCache;
27003
+ const hitRegistry = shouldHitRegistry(opts.now, opts.cache);
27004
+ let latest = opts.cache?.latestKnown ?? void 0;
26401
27005
  if (hitRegistry) {
26402
- const fetched = await fetchLatestVersion();
27006
+ const fetched = await fetchLatest();
27007
+ latest = fetched;
27008
+ persistCache({
27009
+ lastCheck: opts.now,
27010
+ latestKnown: fetched ?? null
27011
+ });
27012
+ } else if (latest && compareSemver(opts.current, latest) < 0) {
27013
+ const fetched = await fetchLatest();
26403
27014
  latest = fetched;
26404
- writeCache({
26405
- lastCheck: now,
27015
+ persistCache({
27016
+ lastCheck: opts.now,
26406
27017
  latestKnown: fetched ?? null
26407
27018
  });
26408
27019
  }
26409
- if (!latest) return;
27020
+ if (!latest) return void 0;
27021
+ return compareSemver(opts.current, latest) < 0 ? latest : void 0;
27022
+ }
27023
+ async function runUpdateCheck() {
27024
+ if (!shouldRunUpdateCheckForInvocation()) return;
27025
+ const now = Date.now();
27026
+ const cache = readCache();
26410
27027
  const current2 = currentCliVersion();
26411
- if (compareSemver(current2, latest) < 0) {
26412
- process.stderr.write(
26413
- `
27028
+ const latest = await resolveLatestVersionForNotice({
27029
+ current: current2,
27030
+ now,
27031
+ cache
27032
+ });
27033
+ if (!latest) return;
27034
+ process.stderr.write(
27035
+ `
26414
27036
  [sylphx] Update available: ${current2} \u2192 ${latest}. Run \`bun add -g @sylphx/cli@latest\` (or \`npm i -g @sylphx/cli\`) to upgrade. Set SYLPHX_NO_UPDATE_CHECK=1 to silence.
26415
27037
  `
26416
- );
26417
- }
27038
+ );
26418
27039
  }
26419
27040
 
26420
27041
  // src/programs/doctor.ts
@@ -31677,14 +32298,10 @@ var orgsShowEffect = orgsShowEffectWith("pretty");
31677
32298
  function orgsShowEffectWith(output) {
31678
32299
  return Effect48.gen(function* () {
31679
32300
  yield* requireAuthEffect;
31680
- const api2 = yield* ApiService;
31681
- const [org, me] = yield* withSpinner(
31682
- "Fetching org info...",
31683
- Effect48.all([api2.getCurrentOrg, api2.whoami])
31684
- );
32301
+ const { org, orgs } = yield* withSpinner("Fetching org info...", resolveOrgDisplayContext);
31685
32302
  const formatter = makeFormatter(output);
31686
32303
  yield* formatter.print(
31687
- { org, orgs: me.orgs },
32304
+ { org, orgs },
31688
32305
  () => Effect48.gen(function* () {
31689
32306
  yield* Console38.log("");
31690
32307
  yield* Console38.log(chalk_default.bold(" Organization"));
@@ -31693,9 +32310,9 @@ function orgsShowEffectWith(output) {
31693
32310
  yield* Console38.log(` ${chalk_default.bold("Slug")} ${chalk_default.cyan(org.slug)}`);
31694
32311
  yield* Console38.log(` ${chalk_default.bold("ID")} ${chalk_default.dim(org.id)}`);
31695
32312
  yield* Console38.log("");
31696
- if (me.orgs.length > 1) {
31697
- yield* Console38.log(chalk_default.dim(` You are a member of ${me.orgs.length} organizations:`));
31698
- for (const o of me.orgs) {
32313
+ if (orgs.length > 1) {
32314
+ yield* Console38.log(chalk_default.dim(` You are a member of ${orgs.length} organizations:`));
32315
+ for (const o of orgs) {
31699
32316
  const isCurrent = o.id === org.id;
31700
32317
  yield* Console38.log(
31701
32318
  ` ${isCurrent ? chalk_default.green("\u2192") : " "} ${chalk_default.bold(o.name)} ${chalk_default.dim(`(${o.slug})`)}`
@@ -31707,10 +32324,51 @@ function orgsShowEffectWith(output) {
31707
32324
  );
31708
32325
  });
31709
32326
  }
32327
+ var resolveOrgDisplayContext = Effect48.gen(function* () {
32328
+ const api2 = yield* ApiService;
32329
+ const cfg = yield* ConfigService;
32330
+ const linked = yield* cfg.getLinkedProject();
32331
+ if (linked) {
32332
+ const me2 = yield* api2.whoami;
32333
+ const org2 = findOrg3(me2.orgs, linked.orgId, linked.orgSlug);
32334
+ if (!org2) {
32335
+ return yield* Effect48.fail(
32336
+ new CliCommandError({
32337
+ command: "orgs",
32338
+ reason: "no-org",
32339
+ message: `Linked project organization '${linked.orgSlug ?? linked.orgId}' was not found for the current account.`
32340
+ })
32341
+ );
32342
+ }
32343
+ return { org: { ...org2, email: null }, orgs: me2.orgs };
32344
+ }
32345
+ const manifestOrg = cfg.getProjectManifestOrg ? yield* cfg.getProjectManifestOrg() : void 0;
32346
+ if (manifestOrg) {
32347
+ const me2 = yield* api2.whoami;
32348
+ const org2 = findOrg3(me2.orgs, manifestOrg);
32349
+ if (!org2) {
32350
+ return yield* Effect48.fail(
32351
+ new CliCommandError({
32352
+ command: "orgs",
32353
+ reason: "no-org",
32354
+ message: `Project manifest organization '${manifestOrg}' was not found for the current account.`
32355
+ })
32356
+ );
32357
+ }
32358
+ return { org: { ...org2, email: null }, orgs: me2.orgs };
32359
+ }
32360
+ const [org, me] = yield* Effect48.all([api2.getCurrentOrg, api2.whoami]);
32361
+ return { org, orgs: me.orgs };
32362
+ });
32363
+ var resolveActiveOrg = Effect48.map(resolveOrgDisplayContext, ({ org }) => org);
32364
+ function findOrg3(orgs, primaryRef, secondaryRef) {
32365
+ const refs = new Set([primaryRef, secondaryRef].filter((ref) => Boolean(ref)));
32366
+ return orgs.find((candidate) => refs.has(candidate.id) || refs.has(candidate.slug));
32367
+ }
31710
32368
  var membersListEffect = Effect48.gen(function* () {
31711
32369
  yield* requireAuthEffect;
31712
32370
  const api2 = yield* ApiService;
31713
- const org = yield* api2.getCurrentOrg;
32371
+ const org = yield* resolveActiveOrg;
31714
32372
  const members = yield* withSpinner("Fetching members...", api2.listOrgMembers(org.id));
31715
32373
  if (members.length === 0) {
31716
32374
  yield* Console38.log(chalk_default.dim("\n No members found.\n"));
@@ -31748,7 +32406,7 @@ function membersInviteEffect(input) {
31748
32406
  }
31749
32407
  yield* requireAuthEffect;
31750
32408
  const api2 = yield* ApiService;
31751
- const org = yield* api2.getCurrentOrg;
32409
+ const org = yield* resolveActiveOrg;
31752
32410
  yield* withSpinner(
31753
32411
  `Inviting ${input.email}...`,
31754
32412
  api2.inviteOrgMember(org.id, input.email, input.role)
@@ -31765,7 +32423,7 @@ function membersRemoveEffect(userId) {
31765
32423
  return Effect48.gen(function* () {
31766
32424
  yield* requireAuthEffect;
31767
32425
  const api2 = yield* ApiService;
31768
- const org = yield* api2.getCurrentOrg;
32426
+ const org = yield* resolveActiveOrg;
31769
32427
  yield* withSpinner(`Removing member ${userId}...`, api2.removeOrgMember(org.id, userId));
31770
32428
  yield* Console38.log(
31771
32429
  chalk_default.green(`\u2713 Removed member ${chalk_default.bold(userId)} from ${chalk_default.bold(org.name)}`)
@@ -31785,7 +32443,7 @@ function membersSetRoleEffect(input) {
31785
32443
  }
31786
32444
  yield* requireAuthEffect;
31787
32445
  const api2 = yield* ApiService;
31788
- const org = yield* api2.getCurrentOrg;
32446
+ const org = yield* resolveActiveOrg;
31789
32447
  const needsConfirm = !input.yes && (input.role === "super_admin" || input.role === "admin");
31790
32448
  if (needsConfirm) {
31791
32449
  const ok = yield* confirmEffect(
@@ -31851,7 +32509,7 @@ var orgsBillingEffect = Effect48.gen(function* () {
31851
32509
  const api2 = yield* ApiService;
31852
32510
  const [org, snap] = yield* withSpinner(
31853
32511
  "Fetching billing snapshot...",
31854
- Effect48.all([api2.getCurrentOrg, api2.getOrgBillingSnapshot])
32512
+ Effect48.all([resolveActiveOrg, api2.getOrgBillingSnapshot])
31855
32513
  );
31856
32514
  yield* Console38.log("");
31857
32515
  yield* Console38.log(chalk_default.bold(` Billing \u2014 ${org.name}`));
@@ -31927,7 +32585,7 @@ function teamEffect(input) {
31927
32585
  }
31928
32586
  yield* requireAuthEffect;
31929
32587
  const api2 = yield* ApiService;
31930
- const org = yield* api2.getCurrentOrg;
32588
+ const org = yield* resolveActiveOrg;
31931
32589
  const all = yield* withSpinner("Fetching team...", api2.listOrgMembers(org.id));
31932
32590
  const members = input.role ? all.filter((m) => m.role.toLowerCase() === input.role?.toLowerCase()) : all;
31933
32591
  if (members.length === 0) {
@@ -32047,6 +32705,14 @@ var orgsCommand = Command38.make(
32047
32705
  Command38.withDescription("Manage organizations"),
32048
32706
  Command38.withSubcommands([membersCmd, billingCmd, sessionsCmd, teamCmd, auditCmd2])
32049
32707
  );
32708
+ var orgCommand = Command38.make(
32709
+ "org",
32710
+ { output: outputOption },
32711
+ ({ output }) => orgsShowEffectWith(output)
32712
+ ).pipe(
32713
+ Command38.withDescription("Alias for `orgs`"),
32714
+ Command38.withSubcommands([membersCmd, billingCmd, sessionsCmd, teamCmd, auditCmd2])
32715
+ );
32050
32716
 
32051
32717
  // src/programs/plan.ts
32052
32718
  import { Args as Args25, Command as Command39, Options as Options40 } from "@effect/cli";
@@ -39256,7 +39922,7 @@ function buildErrorEnvelope(err) {
39256
39922
  };
39257
39923
  }
39258
39924
  function buildDefectEnvelope(cause) {
39259
- const message = cause instanceof Error ? cause.message : typeof cause === "string" ? cause : String(cause);
39925
+ const message = renderUnknownCause(cause);
39260
39926
  return {
39261
39927
  code: "INTERNAL_ERROR",
39262
39928
  message,
@@ -39265,6 +39931,28 @@ function buildDefectEnvelope(cause) {
39265
39931
  exitCode: ExitCode.GENERIC
39266
39932
  };
39267
39933
  }
39934
+ function renderUnknownCause(cause) {
39935
+ if (cause instanceof Error) return cause.message;
39936
+ if (typeof cause === "string") return cause;
39937
+ if (cause === null) return "null";
39938
+ if (cause === void 0) return "undefined";
39939
+ if (typeof cause === "object") {
39940
+ const record = cause;
39941
+ if (typeof record.message === "string" && record.message.trim().length > 0) {
39942
+ return record.message;
39943
+ }
39944
+ const json = safeJsonStringify(cause);
39945
+ if (json) return json;
39946
+ }
39947
+ return String(cause);
39948
+ }
39949
+ function safeJsonStringify(value) {
39950
+ try {
39951
+ return JSON.stringify(value);
39952
+ } catch {
39953
+ return void 0;
39954
+ }
39955
+ }
39268
39956
  function emitErrorEnvelope(envelope, format = resolveErrorOutputFormat()) {
39269
39957
  if (format === "json") {
39270
39958
  process.stderr.write(`${JSON.stringify({ error: envelope }, null, 2)}
@@ -39322,6 +40010,7 @@ var root = Command71.make(
39322
40010
  unlinkCommand,
39323
40011
  openCommand,
39324
40012
  projectsCommand,
40013
+ orgCommand,
39325
40014
  orgsCommand,
39326
40015
  // deployment
39327
40016
  deployCommand,
@@ -39399,12 +40088,55 @@ var cli = Command71.run(root, {
39399
40088
  name: "Sylphx Platform CLI",
39400
40089
  version: package_default.version
39401
40090
  });
40091
+ var ANSI_ESCAPE_PATTERN = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
40092
+ function renderValidationErrorMessage(err) {
40093
+ return HelpDoc.toAnsiText(err.error).replace(ANSI_ESCAPE_PATTERN, "").trimEnd();
40094
+ }
40095
+ function suppressEffectConsoleErrorsForMachineOutput(effect) {
40096
+ if (resolveErrorOutputFormat() === "pretty") return effect;
40097
+ return Console71.consoleWith(
40098
+ (current2) => effect.pipe(
40099
+ Console71.withConsole({
40100
+ ...current2,
40101
+ error: () => Effect81.void,
40102
+ unsafe: {
40103
+ ...current2.unsafe,
40104
+ error: () => void 0
40105
+ }
40106
+ })
40107
+ )
40108
+ );
40109
+ }
39402
40110
  cli(process.argv).pipe(
40111
+ suppressEffectConsoleErrorsForMachineOutput,
39403
40112
  Effect81.catchAll(
39404
40113
  (err) => Effect81.sync(() => {
39405
40114
  const format = resolveErrorOutputFormat();
39406
40115
  if (err instanceof CliCommandError) {
39407
40116
  process.exitCode = renderCliCommandError(err, format);
40117
+ } else if (err instanceof CliArgError) {
40118
+ process.exitCode = renderCliCommandError(
40119
+ new CliCommandError({
40120
+ command: err.command,
40121
+ reason: "invalid-input",
40122
+ message: err.message
40123
+ }),
40124
+ format
40125
+ );
40126
+ } else if (ValidationError.isValidationError(err)) {
40127
+ process.exitCode = ExitCode.USAGE;
40128
+ if (format !== "pretty") {
40129
+ emitErrorEnvelope(
40130
+ {
40131
+ code: "INVALID_INPUT",
40132
+ message: renderValidationErrorMessage(err),
40133
+ reason: "invalid-input",
40134
+ command: "cli",
40135
+ exitCode: ExitCode.USAGE
40136
+ },
40137
+ format
40138
+ );
40139
+ }
39408
40140
  } else {
39409
40141
  const envelope = buildDefectEnvelope(err);
39410
40142
  emitErrorEnvelope(envelope, format);