@01.software/cli 0.10.0 → 0.10.1

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/index.js CHANGED
@@ -1552,6 +1552,214 @@ function registerSchemaCommands(program2, getClient2, getFormat2) {
1552
1552
  });
1553
1553
  }
1554
1554
 
1555
+ // ../contracts/src/tenant/index.ts
1556
+ import { z as z3 } from "zod";
1557
+ var tenantFieldConfigStateSchema = z3.object({
1558
+ hiddenFields: z3.array(z3.string()),
1559
+ isHidden: z3.boolean()
1560
+ }).strict();
1561
+ var tenantContextQuerySchema = z3.object({
1562
+ counts: z3.literal("true").optional()
1563
+ }).strict();
1564
+ var tenantContextToolInputSchema = z3.object({
1565
+ includeCounts: z3.boolean().optional().default(false).describe(
1566
+ "Include per-collection document counts and config status (bypasses cache, slower)"
1567
+ )
1568
+ }).strict();
1569
+ var tenantContextResponseSchema = z3.object({
1570
+ tenant: z3.object({
1571
+ id: z3.string(),
1572
+ name: z3.string(),
1573
+ plan: z3.string(),
1574
+ planSource: z3.string().optional(),
1575
+ authoritative: z3.boolean().optional(),
1576
+ capabilityVersion: z3.string().optional()
1577
+ }).strict(),
1578
+ features: z3.array(z3.string()),
1579
+ collections: z3.object({
1580
+ active: z3.array(z3.string()),
1581
+ inactive: z3.array(z3.string())
1582
+ }).strict(),
1583
+ fieldConfigs: z3.record(z3.string(), tenantFieldConfigStateSchema),
1584
+ counts: z3.record(z3.string(), z3.number()).optional(),
1585
+ config: z3.object({
1586
+ webhookConfigured: z3.boolean()
1587
+ }).strict().optional()
1588
+ }).strict();
1589
+ var tenantFeatureProgressFeatureSchema = z3.enum(["ecommerce"]);
1590
+ var tenantFeatureProgressInputSchema = z3.object({
1591
+ feature: tenantFeatureProgressFeatureSchema.describe(
1592
+ "Feature to inspect for tenant implementation readiness"
1593
+ ),
1594
+ includeEvidence: z3.boolean().optional().default(false).describe("Include sanitized counts and static surface evidence")
1595
+ }).strict();
1596
+ var tenantFeatureProgressStatusSchema = z3.enum([
1597
+ "ready",
1598
+ "attention",
1599
+ "blocked"
1600
+ ]);
1601
+ var tenantFeatureProgressItemStateSchema = z3.enum([
1602
+ "complete",
1603
+ "incomplete",
1604
+ "blocked",
1605
+ "attention",
1606
+ "optional",
1607
+ "unknown",
1608
+ "manual",
1609
+ "not-applicable"
1610
+ ]);
1611
+ var tenantFeatureProgressSeveritySchema = z3.enum([
1612
+ "required",
1613
+ "recommended",
1614
+ "optional"
1615
+ ]);
1616
+ var tenantFeatureProgressEvidenceValueSchema = z3.union([
1617
+ z3.string(),
1618
+ z3.number(),
1619
+ z3.boolean(),
1620
+ z3.null()
1621
+ ]);
1622
+ var tenantFeatureProgressItemSchema = z3.object({
1623
+ id: z3.string(),
1624
+ title: z3.string(),
1625
+ state: tenantFeatureProgressItemStateSchema,
1626
+ severity: tenantFeatureProgressSeveritySchema,
1627
+ summary: z3.string(),
1628
+ evidence: z3.record(z3.string(), tenantFeatureProgressEvidenceValueSchema).optional()
1629
+ }).strict();
1630
+ var tenantFeatureProgressGroupSchema = z3.object({
1631
+ id: z3.string(),
1632
+ title: z3.string(),
1633
+ summary: z3.string().optional(),
1634
+ items: z3.array(tenantFeatureProgressItemSchema)
1635
+ }).strict();
1636
+ var tenantFeatureProgressResponseSchema = z3.object({
1637
+ schemaVersion: z3.literal(1),
1638
+ feature: tenantFeatureProgressFeatureSchema,
1639
+ status: tenantFeatureProgressStatusSchema,
1640
+ generatedAt: z3.string(),
1641
+ tenant: z3.object({
1642
+ id: z3.string(),
1643
+ name: z3.string(),
1644
+ plan: z3.string()
1645
+ }).strict(),
1646
+ capability: z3.object({
1647
+ effectiveFeatures: z3.array(z3.string()),
1648
+ planBlocked: z3.array(z3.string()),
1649
+ closureAdded: z3.array(z3.string())
1650
+ }).strict(),
1651
+ summary: z3.object({
1652
+ complete: z3.number().int().nonnegative(),
1653
+ total: z3.number().int().nonnegative(),
1654
+ blocking: z3.number().int().nonnegative(),
1655
+ manual: z3.number().int().nonnegative(),
1656
+ unknown: z3.number().int().nonnegative()
1657
+ }).strict(),
1658
+ groups: z3.array(tenantFeatureProgressGroupSchema)
1659
+ }).strict();
1660
+ var COLLECTION_SCHEMA_CONTRACT_VERSION = 1;
1661
+ var collectionSchemaEndpointParamsSchema = z3.object({
1662
+ collectionSlug: z3.string().min(1, "collectionSlug is required")
1663
+ }).strict();
1664
+ var collectionFieldOptionSchema = z3.object({
1665
+ label: z3.string(),
1666
+ value: z3.string()
1667
+ }).strict();
1668
+ var collectionFieldSchema = z3.lazy(
1669
+ () => z3.object({
1670
+ name: z3.string(),
1671
+ path: z3.string(),
1672
+ type: z3.string(),
1673
+ required: z3.literal(true).optional(),
1674
+ unique: z3.literal(true).optional(),
1675
+ hasMany: z3.literal(true).optional(),
1676
+ relationTo: z3.union([z3.string(), z3.array(z3.string())]).optional(),
1677
+ options: z3.array(collectionFieldOptionSchema).optional(),
1678
+ hidden: z3.literal(true).optional(),
1679
+ systemManaged: z3.literal(true).optional(),
1680
+ writable: z3.boolean().optional(),
1681
+ fields: z3.array(collectionFieldSchema).optional()
1682
+ }).strict()
1683
+ );
1684
+ var collectionSchemaResponseSchema = z3.object({
1685
+ contractVersion: z3.literal(COLLECTION_SCHEMA_CONTRACT_VERSION),
1686
+ mode: z3.literal("effective"),
1687
+ collection: z3.object({
1688
+ slug: z3.string(),
1689
+ timestamps: z3.boolean(),
1690
+ alwaysActive: z3.boolean(),
1691
+ feature: z3.string().nullable(),
1692
+ systemFields: z3.array(z3.string()),
1693
+ visibility: z3.object({
1694
+ collectionHidden: z3.boolean(),
1695
+ hiddenFields: z3.array(z3.string())
1696
+ }).strict(),
1697
+ fields: z3.array(collectionFieldSchema)
1698
+ }).strict()
1699
+ }).strict();
1700
+
1701
+ // src/commands/feature.ts
1702
+ function getApiUrl2() {
1703
+ return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || "https://api.01.software").replace(/\/$/, "");
1704
+ }
1705
+ function flattenProgress(progress) {
1706
+ return progress.groups.flatMap(
1707
+ (group) => group.items.map((item) => ({
1708
+ group: group.title,
1709
+ item: item.title,
1710
+ state: item.state,
1711
+ severity: item.severity,
1712
+ summary: item.summary
1713
+ }))
1714
+ );
1715
+ }
1716
+ function registerFeatureCommands(program2, getClient2, getFormat2) {
1717
+ const feature = program2.command("feature").description("Feature implementation progress checks");
1718
+ feature.command("check <feature>").description("Check tenant implementation progress for a feature").option("--evidence", "Include sanitized evidence counts and surface flags").action(async (featureName, options) => {
1719
+ try {
1720
+ const input = parseWithSchema(
1721
+ {
1722
+ feature: featureName,
1723
+ includeEvidence: Boolean(options.evidence)
1724
+ },
1725
+ "feature",
1726
+ tenantFeatureProgressInputSchema
1727
+ );
1728
+ const client = getClient2();
1729
+ const baseUrl = getApiUrl2();
1730
+ const search = new URLSearchParams({ feature: input.feature });
1731
+ if (input.includeEvidence) search.set("includeEvidence", "true");
1732
+ const response = await fetch(
1733
+ `${baseUrl}/api/tenants/feature-progress?${search.toString()}`,
1734
+ {
1735
+ headers: {
1736
+ "X-Publishable-Key": client.publishableKey,
1737
+ Authorization: `Bearer ${client.secretKey}`
1738
+ }
1739
+ }
1740
+ );
1741
+ if (!response.ok) {
1742
+ const body = await response.json().catch(() => ({ error: response.statusText }));
1743
+ const err = new Error(
1744
+ body.error || `HTTP ${response.status}`
1745
+ );
1746
+ Object.assign(err, { status: response.status });
1747
+ throw err;
1748
+ }
1749
+ const result = tenantFeatureProgressResponseSchema.parse(
1750
+ await response.json()
1751
+ );
1752
+ const format = getFormat2();
1753
+ printResult(
1754
+ format === "table" ? flattenProgress(result) : result,
1755
+ format
1756
+ );
1757
+ } catch (error) {
1758
+ exitWithError(error);
1759
+ }
1760
+ });
1761
+ }
1762
+
1555
1763
  // src/commands/mcp.ts
1556
1764
  import { resolve, dirname } from "path";
1557
1765
  import { existsSync as existsSync2 } from "fs";
@@ -1664,6 +1872,7 @@ registerCartCommands(program, getClient, getFormat);
1664
1872
  registerStockCommands(program, getClient, getFormat);
1665
1873
  registerTransactionCommands(program, getClient, getFormat);
1666
1874
  registerSchemaCommands(program, getClient, getFormat);
1875
+ registerFeatureCommands(program, getClient, getFormat);
1667
1876
  registerMcpCommands(program);
1668
1877
  registerAuthCommands(program);
1669
1878
  program.parse();