@01.software/cli 0.10.0 → 0.10.3

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.
@@ -74,7 +74,7 @@ function parseJsonWhere(where) {
74
74
  }
75
75
  }
76
76
 
77
- // ../../packages/auth-contracts/dist/index.js
77
+ // ../../packages/auth-contracts/src/index.ts
78
78
  var MCP_RESOURCE_AUDIENCE = "https://mcp.01.software/mcp";
79
79
  var MCP_OAUTH_ISSUER = "https://01.software";
80
80
  var MCP_PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource/mcp";
@@ -122,6 +122,77 @@ var tenantContextResponseSchema = z.object({
122
122
  webhookConfigured: z.boolean()
123
123
  }).strict().optional()
124
124
  }).strict();
125
+ var tenantFeatureProgressFeatureSchema = z.enum(["ecommerce"]);
126
+ var tenantFeatureProgressInputSchema = z.object({
127
+ feature: tenantFeatureProgressFeatureSchema.describe(
128
+ "Feature to inspect for tenant implementation readiness"
129
+ ),
130
+ includeEvidence: z.boolean().optional().default(false).describe("Include sanitized counts and static surface evidence")
131
+ }).strict();
132
+ var tenantFeatureProgressStatusSchema = z.enum([
133
+ "ready",
134
+ "attention",
135
+ "blocked"
136
+ ]);
137
+ var tenantFeatureProgressItemStateSchema = z.enum([
138
+ "complete",
139
+ "incomplete",
140
+ "blocked",
141
+ "attention",
142
+ "optional",
143
+ "unknown",
144
+ "manual",
145
+ "not-applicable"
146
+ ]);
147
+ var tenantFeatureProgressSeveritySchema = z.enum([
148
+ "required",
149
+ "recommended",
150
+ "optional"
151
+ ]);
152
+ var tenantFeatureProgressEvidenceValueSchema = z.union([
153
+ z.string(),
154
+ z.number(),
155
+ z.boolean(),
156
+ z.null()
157
+ ]);
158
+ var tenantFeatureProgressItemSchema = z.object({
159
+ id: z.string(),
160
+ title: z.string(),
161
+ state: tenantFeatureProgressItemStateSchema,
162
+ severity: tenantFeatureProgressSeveritySchema,
163
+ summary: z.string(),
164
+ evidence: z.record(z.string(), tenantFeatureProgressEvidenceValueSchema).optional()
165
+ }).strict();
166
+ var tenantFeatureProgressGroupSchema = z.object({
167
+ id: z.string(),
168
+ title: z.string(),
169
+ summary: z.string().optional(),
170
+ items: z.array(tenantFeatureProgressItemSchema)
171
+ }).strict();
172
+ var tenantFeatureProgressResponseSchema = z.object({
173
+ schemaVersion: z.literal(1),
174
+ feature: tenantFeatureProgressFeatureSchema,
175
+ status: tenantFeatureProgressStatusSchema,
176
+ generatedAt: z.string(),
177
+ tenant: z.object({
178
+ id: z.string(),
179
+ name: z.string(),
180
+ plan: z.string()
181
+ }).strict(),
182
+ capability: z.object({
183
+ effectiveFeatures: z.array(z.string()),
184
+ planBlocked: z.array(z.string()),
185
+ closureAdded: z.array(z.string())
186
+ }).strict(),
187
+ summary: z.object({
188
+ complete: z.number().int().nonnegative(),
189
+ total: z.number().int().nonnegative(),
190
+ blocking: z.number().int().nonnegative(),
191
+ manual: z.number().int().nonnegative(),
192
+ unknown: z.number().int().nonnegative()
193
+ }).strict(),
194
+ groups: z.array(tenantFeatureProgressGroupSchema)
195
+ }).strict();
125
196
  var COLLECTION_SCHEMA_CONTRACT_VERSION = 1;
126
197
  var collectionSchemaEndpointParamsSchema = z.object({
127
198
  collectionSlug: z.string().min(1, "collectionSlug is required")
@@ -187,6 +258,29 @@ var updateTransactionSchema = z2.object({
187
258
  amount: z2.number().int().positive().optional().describe("Provider-confirmed amount for verified paid confirmation")
188
259
  }).strict();
189
260
  var UpdateTransactionSchema = updateTransactionSchema;
261
+ var providerSlugSchema = z2.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/, "pgProvider must be lowercase slug");
262
+ var confirmPaymentSchema = z2.object({
263
+ orderNumber: z2.string().min(1).optional(),
264
+ pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("Provider payment identifier stored on the transaction"),
265
+ pgProvider: providerSlugSchema.describe(
266
+ "Payment provider slug, e.g. toss, portone, stripe"
267
+ ),
268
+ pgOrderId: z2.string().min(1).optional(),
269
+ amount: z2.number().int().nonnegative("amount must be non-negative").describe("Provider-confirmed amount in minor units"),
270
+ currency: z2.string().min(1).optional(),
271
+ paymentMethod: z2.string().optional(),
272
+ receiptUrl: z2.string().url().optional(),
273
+ approvedAt: z2.string().optional(),
274
+ providerStatus: z2.string().optional(),
275
+ providerEventId: z2.string().min(1).optional(),
276
+ confirmationSource: z2.enum([
277
+ "provider_webhook",
278
+ "provider_lookup",
279
+ "provider_api_confirm",
280
+ "manual_server"
281
+ ]).optional(),
282
+ metadata: z2.record(z2.string(), z2.unknown()).optional()
283
+ }).strict();
190
284
  var returnReasonSchema = z2.enum([
191
285
  "change_of_mind",
192
286
  "defective",
@@ -198,7 +292,8 @@ var restockActionSchema = z2.enum(["return_to_stock", "discard"]);
198
292
  var returnWithRefundItemSchema = z2.object({
199
293
  orderItem: z2.union([z2.string(), z2.number()]).transform(String),
200
294
  quantity: z2.number().int().positive("quantity must be a positive integer"),
201
- restockAction: restockActionSchema.default("return_to_stock")
295
+ restockAction: restockActionSchema.default("return_to_stock"),
296
+ restockingFee: z2.number().min(0, "restockingFee must be non-negative").optional().describe("Restocking fee charged for this line (ADR 0005 \xA7Gap 1)")
202
297
  }).strict();
203
298
  var returnWithRefundSchema = z2.object({
204
299
  orderNumber: z2.string().min(1, "orderNumber is required").describe("Order number (required)"),
@@ -206,6 +301,7 @@ var returnWithRefundSchema = z2.object({
206
301
  reasonDetail: z2.string().optional().describe("Detailed reason text (optional)"),
207
302
  returnItems: z2.array(returnWithRefundItemSchema).min(1, "At least one return item is required").max(100, "Too many return items").describe("Array of products to return (required)"),
208
303
  refundAmount: z2.number().min(0, "refundAmount must be non-negative").describe("Refund amount (required, min 0)"),
304
+ returnShippingFee: z2.number().min(0, "returnShippingFee must be non-negative").optional().describe("Return shipping fee charged to the customer (ADR 0005 \xA7Gap 1)"),
209
305
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID for refund (required)"),
210
306
  paymentKey: z2.string().min(1).optional().describe("Provider payment key for verified refund"),
211
307
  refundReceiptUrl: z2.string().optional().describe("Refund receipt URL (optional)")
@@ -234,6 +330,16 @@ var MCP_TOOL_CONTRACT = {
234
330
  oauthScope: "mcp:read",
235
331
  readOnly: true
236
332
  },
333
+ "product-detail": {
334
+ consoleRole: "tenant-viewer",
335
+ oauthScope: "mcp:read",
336
+ readOnly: true
337
+ },
338
+ "product-upsert": {
339
+ consoleRole: "tenant-admin",
340
+ oauthScope: "mcp:write",
341
+ readOnly: false
342
+ },
237
343
  "validate-discount": {
238
344
  consoleRole: "tenant-viewer",
239
345
  oauthScope: "mcp:read",
@@ -259,6 +365,11 @@ var MCP_TOOL_CONTRACT = {
259
365
  oauthScope: "mcp:read",
260
366
  readOnly: true
261
367
  },
368
+ "check-feature-progress": {
369
+ consoleRole: "tenant-viewer",
370
+ oauthScope: "mcp:read",
371
+ readOnly: true
372
+ },
262
373
  "add-cart-item": {
263
374
  consoleRole: "tenant-editor",
264
375
  oauthScope: "mcp:write",
@@ -360,9 +471,7 @@ var MCP_TOOL_CONTRACT = {
360
471
  readOnly: true
361
472
  }
362
473
  };
363
- var MCP_TOOL_NAMES = Object.keys(
364
- MCP_TOOL_CONTRACT
365
- );
474
+ var MCP_TOOL_NAMES = Object.keys(MCP_TOOL_CONTRACT);
366
475
  function isMcpToolName(toolName) {
367
476
  return Object.prototype.hasOwnProperty.call(MCP_TOOL_CONTRACT, toolName);
368
477
  }
@@ -430,6 +539,21 @@ var TOOL_POLICY_MANIFEST = {
430
539
  consoleSurface: "GET /api/products/{id}/stock",
431
540
  annotationPolicy: READ_ONLY_ANNOTATION
432
541
  },
542
+ "product-detail": {
543
+ category: "read-only-collection",
544
+ oauthScope: MCP_SCOPES.read,
545
+ consoleRole: "tenant-viewer",
546
+ consoleSurface: "GET /api/products/detail",
547
+ annotationPolicy: READ_ONLY_ANNOTATION
548
+ },
549
+ "product-upsert": {
550
+ category: "mutation-product",
551
+ oauthScope: MCP_SCOPES.write,
552
+ consoleRole: "tenant-admin",
553
+ consoleSurface: "POST /api/products/upsert",
554
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
555
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
556
+ },
433
557
  "validate-discount": {
434
558
  category: "read-only-collection",
435
559
  oauthScope: MCP_SCOPES.read,
@@ -466,6 +590,13 @@ var TOOL_POLICY_MANIFEST = {
466
590
  consoleSurface: "GET /api/tenants/context",
467
591
  annotationPolicy: READ_ONLY_ANNOTATION
468
592
  },
593
+ "check-feature-progress": {
594
+ category: "read-only-tenant",
595
+ oauthScope: MCP_SCOPES.read,
596
+ consoleRole: "tenant-viewer",
597
+ consoleSurface: "GET /api/tenants/feature-progress",
598
+ annotationPolicy: READ_ONLY_ANNOTATION
599
+ },
469
600
  // ── Cart mutations (mcp:write, tenant-editor) ──
470
601
  "add-cart-item": {
471
602
  category: "mutation-cart",
@@ -515,7 +646,7 @@ var TOOL_POLICY_MANIFEST = {
515
646
  exemptionReason: REASON_CART_EPHEMERAL
516
647
  },
517
648
  // ── Order mutations (mcp:write, tenant-admin) ──
518
- "checkout": {
649
+ checkout: {
519
650
  category: "mutation-order",
520
651
  oauthScope: MCP_SCOPES.write,
521
652
  consoleRole: "tenant-admin",
@@ -776,9 +907,12 @@ function signMcpServiceToken(context) {
776
907
  }
777
908
 
778
909
  // src/lib/console-api.ts
779
- var BASE_URL = process.env.SOFTWARE_API_URL || "http://localhost:3000";
910
+ var DEFAULT_API_URL = "https://api.01.software";
780
911
  var TIMEOUT_MS = 5e3;
781
912
  var MISSING_HTTP_AUTH_CONTEXT_ERROR = "MCP HTTP requests require a validated OAuth tenant context before tool execution.";
913
+ function resolveConsoleApiUrl() {
914
+ return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || DEFAULT_API_URL).replace(/\/$/, "");
915
+ }
782
916
  function resolveAuthHeaderContext() {
783
917
  const oauthContext = tenantAuthContext();
784
918
  if (oauthContext) {
@@ -828,7 +962,7 @@ async function consoleGet(path, apiKey) {
828
962
  const controller = new AbortController();
829
963
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
830
964
  try {
831
- const res = await fetch(`${BASE_URL}${path}`, {
965
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
832
966
  headers: authHeaders,
833
967
  signal: controller.signal
834
968
  });
@@ -847,7 +981,7 @@ async function consolePost(path, body, apiKey) {
847
981
  const controller = new AbortController();
848
982
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
849
983
  try {
850
- const res = await fetch(`${BASE_URL}${path}`, {
984
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
851
985
  method: "POST",
852
986
  headers: { ...authHeaders, "Content-Type": "application/json" },
853
987
  body: JSON.stringify(body),
@@ -868,7 +1002,7 @@ async function consolePostTelemetry(path, body, apiKey) {
868
1002
  const controller = new AbortController();
869
1003
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
870
1004
  try {
871
- const res = await fetch(`${BASE_URL}${path}`, {
1005
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
872
1006
  method: "POST",
873
1007
  headers: { ...authHeaders, "Content-Type": "application/json" },
874
1008
  body: JSON.stringify(body),
@@ -1766,6 +1900,118 @@ async function stockCheck({
1766
1900
  }
1767
1901
  }
1768
1902
 
1903
+ // src/tools/product-detail.ts
1904
+ import { z as z22 } from "zod";
1905
+ var schema22 = {
1906
+ slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1907
+ id: z22.string().optional().describe("Product id (one of slug or id required)")
1908
+ };
1909
+ var metadata22 = {
1910
+ name: "product-detail",
1911
+ description: "Fetch full product detail by slug or id. Returns one resolver-ready product with variants, option slugs, option value slugs/media, brand, categories, tags, images, videos, and listing rollup, or null if missing/unpublished/wrong tenant/feature disabled.",
1912
+ annotations: {
1913
+ title: "Get product detail",
1914
+ readOnlyHint: true,
1915
+ destructiveHint: false,
1916
+ idempotentHint: true
1917
+ }
1918
+ };
1919
+ async function productDetail({
1920
+ slug,
1921
+ id
1922
+ }) {
1923
+ try {
1924
+ if (Boolean(slug) === Boolean(id)) {
1925
+ return toolError(new Error("Provide exactly one of slug or id"));
1926
+ }
1927
+ const client = getClient();
1928
+ const params = slug ? { slug } : { id };
1929
+ const result = await client.commerce.product.detail(params);
1930
+ return toolSuccess({ data: result });
1931
+ } catch (error) {
1932
+ return toolError(error);
1933
+ }
1934
+ }
1935
+
1936
+ // src/tools/product-upsert.ts
1937
+ import { z as z23 } from "zod";
1938
+ var optionValueSchema = z23.object({
1939
+ id: z23.string().optional().describe("Existing option-value ID for updates"),
1940
+ value: z23.string().describe("Display label (e.g. Black, S)"),
1941
+ slug: z23.string().optional().describe("Canonical value token used in variant maps and URLs"),
1942
+ swatchColor: z23.string().nullable().optional(),
1943
+ thumbnail: z23.string().nullable().optional(),
1944
+ images: z23.array(z23.string()).optional(),
1945
+ metadata: z23.unknown().optional()
1946
+ });
1947
+ var optionSchema = z23.object({
1948
+ id: z23.string().optional().describe("Existing option ID for updates"),
1949
+ title: z23.string().describe("Option name (e.g. Color, Size)"),
1950
+ slug: z23.string().optional().describe("Canonical option token used in variant maps and URLs"),
1951
+ values: z23.array(optionValueSchema).describe("Allowed option values")
1952
+ });
1953
+ var variantOptionValueSchema = z23.object({
1954
+ valueSlug: z23.string().optional(),
1955
+ valueId: z23.string().optional(),
1956
+ value: z23.string().optional()
1957
+ });
1958
+ var variantSchema = z23.object({
1959
+ id: z23.string().optional().describe("Existing variant ID for updates"),
1960
+ optionValues: z23.union([
1961
+ z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1962
+ z23.array(z23.string())
1963
+ ]).optional().describe(
1964
+ "Option-value selection. Prefer canonical { optionSlug: valueSlug } maps. Object values may use { valueSlug, valueId, value }. Exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous. Arrays of option-value IDs are also accepted."
1965
+ ),
1966
+ sku: z23.string().nullable().optional(),
1967
+ title: z23.string().nullable().optional(),
1968
+ price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1969
+ compareAtPrice: z23.number().nonnegative().nullable().optional(),
1970
+ stock: z23.number().int().nonnegative().optional(),
1971
+ isUnlimited: z23.boolean().optional(),
1972
+ weight: z23.number().nonnegative().nullable().optional(),
1973
+ requiresShipping: z23.boolean().optional(),
1974
+ barcode: z23.string().nullable().optional(),
1975
+ externalId: z23.string().nullable().optional(),
1976
+ isActive: z23.boolean().optional(),
1977
+ thumbnail: z23.string().nullable().optional(),
1978
+ images: z23.array(z23.string()).optional(),
1979
+ metadata: z23.unknown().optional()
1980
+ });
1981
+ var schema23 = {
1982
+ product: z23.record(z23.string(), z23.unknown()).describe(
1983
+ "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1984
+ ),
1985
+ options: z23.array(optionSchema).optional().describe(
1986
+ "Option definitions. Prefer explicit option slug and value slugs. Omitted options on an existing product are deleted (with their values)."
1987
+ ),
1988
+ variants: z23.array(variantSchema).optional().describe(
1989
+ "Variant rows. Prefer canonical { optionSlug: valueSlug } optionValues maps. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1990
+ )
1991
+ };
1992
+ var metadata23 = {
1993
+ name: "product-upsert",
1994
+ description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1995
+ annotations: {
1996
+ title: "Upsert product (atomic)",
1997
+ readOnlyHint: false,
1998
+ destructiveHint: true,
1999
+ idempotentHint: true,
2000
+ openWorldHint: false
2001
+ }
2002
+ };
2003
+ async function productUpsert(params) {
2004
+ try {
2005
+ const client = getClient();
2006
+ const result = await client.commerce.product.upsert(
2007
+ params
2008
+ );
2009
+ return toolSuccess({ data: result });
2010
+ } catch (error) {
2011
+ return toolError(error);
2012
+ }
2013
+ }
2014
+
1769
2015
  // src/tools/get-collection-schema.ts
1770
2016
  import { SERVER_COLLECTIONS as SERVER_COLLECTIONS3 } from "@01.software/sdk";
1771
2017
 
@@ -1780,8 +2026,8 @@ async function getCollectionSchema(collection) {
1780
2026
  }
1781
2027
 
1782
2028
  // src/tools/get-collection-schema.ts
1783
- var schema22 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
1784
- var metadata22 = {
2029
+ var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2030
+ var metadata24 = {
1785
2031
  name: "get-collection-schema",
1786
2032
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
1787
2033
  annotations: {
@@ -1809,6 +2055,11 @@ async function getCollectionSchemaTool({
1809
2055
  function getTenantContextPath(includeCounts) {
1810
2056
  return includeCounts ? "/api/tenants/context?counts=true" : "/api/tenants/context";
1811
2057
  }
2058
+ function getTenantFeatureProgressPath(feature, includeEvidence) {
2059
+ const search = new URLSearchParams({ feature });
2060
+ if (includeEvidence) search.set("includeEvidence", "true");
2061
+ return `/api/tenants/feature-progress?${search.toString()}`;
2062
+ }
1812
2063
  async function getTenantContext(includeCounts = false) {
1813
2064
  const apiKey = resolveApiKey();
1814
2065
  const data = await consoleGet(
@@ -1817,10 +2068,18 @@ async function getTenantContext(includeCounts = false) {
1817
2068
  );
1818
2069
  return tenantContextResponseSchema.parse(data);
1819
2070
  }
2071
+ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2072
+ const apiKey = resolveApiKey();
2073
+ const data = await consoleGet(
2074
+ getTenantFeatureProgressPath(feature, includeEvidence),
2075
+ apiKey
2076
+ );
2077
+ return tenantFeatureProgressResponseSchema.parse(data);
2078
+ }
1820
2079
 
1821
2080
  // src/tools/get-tenant-context.ts
1822
- var schema23 = tenantContextToolInputSchema.shape;
1823
- var metadata23 = {
2081
+ var schema25 = tenantContextToolInputSchema.shape;
2082
+ var metadata25 = {
1824
2083
  name: "get-tenant-context",
1825
2084
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
1826
2085
  annotations: {
@@ -1896,8 +2155,32 @@ async function handler({
1896
2155
  }
1897
2156
  }
1898
2157
 
2158
+ // src/tools/check-feature-progress.ts
2159
+ var schema26 = tenantFeatureProgressInputSchema.shape;
2160
+ var metadata26 = {
2161
+ name: "check-feature-progress",
2162
+ description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2163
+ annotations: {
2164
+ title: "Check Feature Progress",
2165
+ readOnlyHint: true,
2166
+ destructiveHint: false,
2167
+ idempotentHint: true
2168
+ }
2169
+ };
2170
+ async function handler2({
2171
+ feature,
2172
+ includeEvidence
2173
+ }) {
2174
+ try {
2175
+ const progress = await getTenantFeatureProgress(feature, includeEvidence);
2176
+ return toolSuccess({ progress });
2177
+ } catch (error) {
2178
+ return toolError(error);
2179
+ }
2180
+ }
2181
+
1899
2182
  // src/tools/list-configurable-fields.ts
1900
- import { z as z22 } from "zod";
2183
+ import { z as z24 } from "zod";
1901
2184
 
1902
2185
  // src/lib/field-config.ts
1903
2186
  async function fetchFieldConfigs() {
@@ -1920,12 +2203,12 @@ function invalidateFieldConfigCache() {
1920
2203
  }
1921
2204
 
1922
2205
  // src/tools/list-configurable-fields.ts
1923
- var schema24 = {
1924
- collection: z22.string().optional().describe(
2206
+ var schema27 = {
2207
+ collection: z24.string().optional().describe(
1925
2208
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
1926
2209
  )
1927
2210
  };
1928
- var metadata24 = {
2211
+ var metadata27 = {
1929
2212
  name: "list-configurable-fields",
1930
2213
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
1931
2214
  annotations: {
@@ -1956,17 +2239,17 @@ async function listConfigurableFields(params) {
1956
2239
  }
1957
2240
 
1958
2241
  // src/tools/update-field-config.ts
1959
- import { z as z23 } from "zod";
1960
- var schema25 = {
1961
- collection: z23.string().min(1).describe("Collection slug (required)"),
1962
- hiddenFields: z23.array(z23.string().min(1).max(200)).max(300).describe(
2242
+ import { z as z25 } from "zod";
2243
+ var schema28 = {
2244
+ collection: z25.string().min(1).describe("Collection slug (required)"),
2245
+ hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
1963
2246
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
1964
2247
  ),
1965
- isHidden: z23.boolean().optional().describe(
2248
+ isHidden: z25.boolean().optional().describe(
1966
2249
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
1967
2250
  )
1968
2251
  };
1969
- var metadata25 = {
2252
+ var metadata28 = {
1970
2253
  name: "update-field-config",
1971
2254
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
1972
2255
  annotations: {
@@ -1994,7 +2277,7 @@ async function updateFieldConfig(params) {
1994
2277
  }
1995
2278
 
1996
2279
  // src/tools/sdk-get-recipe.ts
1997
- import { z as z24 } from "zod";
2280
+ import { z as z26 } from "zod";
1998
2281
 
1999
2282
  // src/lib/sdk-recipes.ts
2000
2283
  var recipes = {
@@ -2426,8 +2709,8 @@ function getRecipe(goal, runtime = "both") {
2426
2709
  }
2427
2710
 
2428
2711
  // src/tools/sdk-get-recipe.ts
2429
- var schema26 = {
2430
- goal: z24.enum([
2712
+ var schema29 = {
2713
+ goal: z26.enum([
2431
2714
  "fetch-list",
2432
2715
  "fetch-by-id",
2433
2716
  "create-item",
@@ -2439,11 +2722,11 @@ var schema26 = {
2439
2722
  "file-upload",
2440
2723
  "bulk-operations"
2441
2724
  ]).describe("What the user wants to accomplish"),
2442
- runtime: z24.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2443
- collection: z24.string().optional().describe("Specific collection name if applicable"),
2444
- includeExample: z24.boolean().default(true).describe("Whether to include a full code example")
2725
+ runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2726
+ collection: z26.string().optional().describe("Specific collection name if applicable"),
2727
+ includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2445
2728
  };
2446
- var metadata26 = {
2729
+ var metadata29 = {
2447
2730
  name: "sdk-get-recipe",
2448
2731
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2449
2732
  annotations: {
@@ -2453,7 +2736,7 @@ var metadata26 = {
2453
2736
  idempotentHint: true
2454
2737
  }
2455
2738
  };
2456
- function handler2({
2739
+ function handler3({
2457
2740
  goal,
2458
2741
  runtime,
2459
2742
  collection,
@@ -2486,7 +2769,7 @@ function handler2({
2486
2769
  }
2487
2770
 
2488
2771
  // src/tools/sdk-search-docs.ts
2489
- import { z as z25 } from "zod";
2772
+ import { z as z27 } from "zod";
2490
2773
 
2491
2774
  // src/lib/sdk-doc-index.ts
2492
2775
  var docIndex = [
@@ -2661,11 +2944,11 @@ function searchDocs(query, limit = 5) {
2661
2944
  }
2662
2945
 
2663
2946
  // src/tools/sdk-search-docs.ts
2664
- var schema27 = {
2665
- query: z25.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2666
- limit: z25.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2947
+ var schema30 = {
2948
+ query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2949
+ limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2667
2950
  };
2668
- var metadata27 = {
2951
+ var metadata30 = {
2669
2952
  name: "sdk-search-docs",
2670
2953
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2671
2954
  annotations: {
@@ -2675,7 +2958,7 @@ var metadata27 = {
2675
2958
  idempotentHint: true
2676
2959
  }
2677
2960
  };
2678
- function handler3({
2961
+ function handler4({
2679
2962
  query,
2680
2963
  limit
2681
2964
  }) {
@@ -2700,9 +2983,9 @@ function handler3({
2700
2983
  }
2701
2984
 
2702
2985
  // src/tools/sdk-get-auth-setup.ts
2703
- import { z as z26 } from "zod";
2704
- var schema28 = {
2705
- scenario: z26.enum([
2986
+ import { z as z28 } from "zod";
2987
+ var schema31 = {
2988
+ scenario: z28.enum([
2706
2989
  "browser-client",
2707
2990
  "server-client",
2708
2991
  "customer-auth",
@@ -2711,7 +2994,7 @@ var schema28 = {
2711
2994
  "webhook-verification"
2712
2995
  ]).describe("Authentication scenario")
2713
2996
  };
2714
- var metadata28 = {
2997
+ var metadata31 = {
2715
2998
  name: "sdk-get-auth-setup",
2716
2999
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
2717
3000
  annotations: {
@@ -2850,7 +3133,7 @@ export async function POST(request: Request) {
2850
3133
  ]
2851
3134
  }
2852
3135
  };
2853
- function handler4({
3136
+ function handler5({
2854
3137
  scenario
2855
3138
  }) {
2856
3139
  try {
@@ -2865,14 +3148,14 @@ function handler4({
2865
3148
  }
2866
3149
 
2867
3150
  // src/tools/sdk-get-collection-pattern.ts
2868
- import { z as z27 } from "zod";
3151
+ import { z as z29 } from "zod";
2869
3152
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
2870
- var schema29 = {
2871
- collection: z27.enum(SERVER_COLLECTIONS4).describe("Collection name"),
2872
- operation: z27.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
2873
- surface: z27.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3153
+ var schema32 = {
3154
+ collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3155
+ operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3156
+ surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
2874
3157
  };
2875
- var metadata29 = {
3158
+ var metadata32 = {
2876
3159
  name: "sdk-get-collection-pattern",
2877
3160
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
2878
3161
  annotations: {
@@ -3045,7 +3328,7 @@ function generatePattern(collection, operation, surface) {
3045
3328
  ].filter(Boolean)
3046
3329
  };
3047
3330
  }
3048
- function handler5({
3331
+ function handler6({
3049
3332
  collection,
3050
3333
  operation,
3051
3334
  surface
@@ -3073,14 +3356,14 @@ function handler5({
3073
3356
  }
3074
3357
 
3075
3358
  // src/prompts/sdk-usage-guide.ts
3076
- import { z as z28 } from "zod";
3077
- var schema30 = {
3078
- goal: z28.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3079
- runtime: z28.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3080
- surface: z28.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3081
- collection: z28.string().optional().describe("Specific collection if relevant")
3359
+ import { z as z30 } from "zod";
3360
+ var schema33 = {
3361
+ goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3362
+ runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3363
+ surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3364
+ collection: z30.string().optional().describe("Specific collection if relevant")
3082
3365
  };
3083
- var metadata30 = {
3366
+ var metadata33 = {
3084
3367
  name: "sdk-usage-guide",
3085
3368
  title: "SDK Usage Guide",
3086
3369
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3213,18 +3496,44 @@ const client = createServerClient({
3213
3496
  })
3214
3497
  \`\`\`
3215
3498
 
3216
- You can perform the "${goal}" task by following the patterns above.`;
3499
+ You can perform the "${goal}" task by following the patterns above.
3500
+
3501
+ ## Common recipes
3502
+
3503
+ ### Product detail page (slug-based)
3504
+
3505
+ \`\`\`typescript
3506
+ const product = await client.commerce.product.detail({ slug })
3507
+ if (!product) return notFound()
3508
+ // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3509
+ \`\`\`
3510
+
3511
+ For React: \`const { data } = client.query.useProductDetailBySlug(slug)\`.
3512
+
3513
+ ### Product listing (grouped)
3514
+
3515
+ \`\`\`typescript
3516
+ const { docs } = await client.commerce.product.listingGroups({ productIds })
3517
+ \`\`\`
3518
+
3519
+ ### Stock check before adding to cart
3520
+
3521
+ \`\`\`typescript
3522
+ const { allAvailable } = await client.commerce.product.stockCheck({
3523
+ items: [{ variantId, quantity }],
3524
+ })
3525
+ \`\`\``;
3217
3526
  }
3218
3527
 
3219
3528
  // src/prompts/collection-query-help.ts
3220
- import { z as z29 } from "zod";
3529
+ import { z as z31 } from "zod";
3221
3530
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3222
- var schema31 = {
3223
- collection: z29.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3224
- operation: z29.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3225
- filters: z29.string().optional().describe("Filter conditions (JSON string, optional)")
3531
+ var schema34 = {
3532
+ collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3533
+ operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3534
+ filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3226
3535
  };
3227
- var metadata31 = {
3536
+ var metadata34 = {
3228
3537
  name: "collection-query-help",
3229
3538
  title: "Collection Query Help",
3230
3539
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3316,16 +3625,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3316
3625
  }
3317
3626
 
3318
3627
  // src/prompts/order-flow-guide.ts
3319
- import { z as z30 } from "zod";
3320
- var schema32 = {
3321
- scenario: z30.enum([
3628
+ import { z as z32 } from "zod";
3629
+ var schema35 = {
3630
+ scenario: z32.enum([
3322
3631
  "simple-order",
3323
3632
  "cart-checkout",
3324
3633
  "return-refund",
3325
3634
  "fulfillment-tracking"
3326
3635
  ]).describe("Order flow scenario")
3327
3636
  };
3328
- var metadata32 = {
3637
+ var metadata35 = {
3329
3638
  name: "order-flow-guide",
3330
3639
  title: "Order Flow Guide",
3331
3640
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3510,9 +3819,9 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3510
3819
  }
3511
3820
 
3512
3821
  // src/prompts/feature-setup-guide.ts
3513
- import { z as z31 } from "zod";
3514
- var schema33 = {
3515
- feature: z31.enum([
3822
+ import { z as z33 } from "zod";
3823
+ var schema36 = {
3824
+ feature: z33.enum([
3516
3825
  "ecommerce",
3517
3826
  "customers",
3518
3827
  "articles",
@@ -3527,10 +3836,10 @@ var schema33 = {
3527
3836
  "community"
3528
3837
  ]).describe("Feature to get setup guide for")
3529
3838
  };
3530
- var metadata33 = {
3839
+ var metadata36 = {
3531
3840
  name: "feature-setup-guide",
3532
3841
  title: "Feature Setup Guide",
3533
- description: "Setup checklist and remediation guide for a tenant feature. Load before using get-tenant-context to diagnose setup gaps.",
3842
+ description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
3534
3843
  role: "assistant"
3535
3844
  };
3536
3845
  var FEATURES = {
@@ -3560,6 +3869,7 @@ product-options, product-option-values, product-categories, product-tags, produc
3560
3869
  ### Config
3561
3870
 
3562
3871
  - **Webhook URL** must be configured in tenant settings for payment gateway callbacks
3872
+ - Use \`check-feature-progress\` for the tenant-aware ecommerce progress check
3563
3873
  - Use \`get-tenant-context\` to check current webhook configuration`,
3564
3874
  customers: `## Customers Setup Guide
3565
3875
 
@@ -3726,18 +4036,19 @@ function featureSetupGuide({
3726
4036
  ${FEATURES[feature] || "Unknown feature."}
3727
4037
 
3728
4038
  ## Related MCP Tools
4039
+ - \`check-feature-progress\` \u2014 run the tenant-aware ecommerce implementation progress check
3729
4040
  - \`get-tenant-context\` \u2014 check current collection counts and feature status
3730
4041
  - \`query-collection\` \u2014 verify existing documents in a collection
3731
4042
  - \`get-collection-schema\` \u2014 inspect tenant-aware fields before creating data via SDK or Console UI`;
3732
4043
  }
3733
4044
 
3734
4045
  // src/resources/(config)/app.ts
3735
- var metadata34 = {
4046
+ var metadata37 = {
3736
4047
  name: "app-config",
3737
4048
  title: "Application Config",
3738
4049
  description: "01.software SDK and MCP server configuration information"
3739
4050
  };
3740
- function handler6() {
4051
+ function handler7() {
3741
4052
  return `# 01.software MCP Server Configuration
3742
4053
 
3743
4054
  ## Server Info
@@ -3755,15 +4066,16 @@ HTTP MCP uses OAuth discovery and Authorization Code + PKCE.
3755
4066
  url = "https://mcp.01.software/mcp"
3756
4067
  \`\`\`
3757
4068
 
3758
- ## Hosted HTTP OAuth Tools (8)
4069
+ ## Hosted HTTP OAuth Tools (9)
3759
4070
 
3760
4071
  The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these OAuth-safe tools:
3761
4072
 
3762
4073
  ### Schema (1)
3763
4074
  - \`get-collection-schema\` - Get authoritative tenant-aware collection schema
3764
4075
 
3765
- ### Tenant Context (1)
4076
+ ### Tenant Context (2)
3766
4077
  - \`get-tenant-context\` - Get tenant features, active collections, and field config
4078
+ - \`check-feature-progress\` - Check ecommerce implementation progress without mutating tenant data
3767
4079
 
3768
4080
  ### Field Config (2)
3769
4081
  - \`list-configurable-fields\` - List configurable fields and current hidden state
@@ -3775,7 +4087,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
3775
4087
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
3776
4088
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
3777
4089
 
3778
- ## Local CLI Stdio Surface (29)
4090
+ ## Local CLI Stdio Surface (30)
3779
4091
 
3780
4092
  For trusted local server-key workflows, start the stdio server:
3781
4093
 
@@ -3783,7 +4095,7 @@ For trusted local server-key workflows, start the stdio server:
3783
4095
  npx @01.software/cli mcp
3784
4096
  \`\`\`
3785
4097
 
3786
- Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4098
+ Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
3787
4099
 
3788
4100
  ## Rate Limits
3789
4101
 
@@ -3797,7 +4109,7 @@ Rate limits depend on your tenant plan:
3797
4109
 
3798
4110
  // src/resources/(collections)/schema.ts
3799
4111
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
3800
- var metadata35 = {
4112
+ var metadata38 = {
3801
4113
  name: "collections-schema",
3802
4114
  title: "Collection Schema Info",
3803
4115
  description: "Available collections and their schema information"
@@ -3821,7 +4133,12 @@ var COLLECTIONS_BY_CATEGORY = {
3821
4133
  "fulfillments",
3822
4134
  "fulfillment-items"
3823
4135
  ],
3824
- "Shipping & Returns": ["returns", "return-items", "shipping-policies"],
4136
+ "Shipping & Returns": [
4137
+ "returns",
4138
+ "return-items",
4139
+ "shipping-policies",
4140
+ "shipping-zones"
4141
+ ],
3825
4142
  Customers: [
3826
4143
  "customers",
3827
4144
  "customer-profiles",
@@ -3829,7 +4146,7 @@ var COLLECTIONS_BY_CATEGORY = {
3829
4146
  "customer-addresses"
3830
4147
  ],
3831
4148
  Carts: ["carts", "cart-items"],
3832
- "Discounts & Promotions": ["discounts", "promotions"],
4149
+ Discounts: ["discounts"],
3833
4150
  Documents: ["documents", "document-categories", "document-types"],
3834
4151
  Articles: [
3835
4152
  "articles",
@@ -3843,9 +4160,7 @@ var COLLECTIONS_BY_CATEGORY = {
3843
4160
  "reactions",
3844
4161
  "reaction-types",
3845
4162
  "bookmarks",
3846
- "post-categories",
3847
- "reports",
3848
- "community-bans"
4163
+ "post-categories"
3849
4164
  ],
3850
4165
  Playlists: [
3851
4166
  "playlists",
@@ -3883,7 +4198,7 @@ var COLLECTIONS_BY_CATEGORY = {
3883
4198
  "event-tags"
3884
4199
  ]
3885
4200
  };
3886
- function handler7() {
4201
+ function handler8() {
3887
4202
  const categoryDocs = Object.entries(COLLECTIONS_BY_CATEGORY).map(([category, collections]) => {
3888
4203
  const collectionList = collections.filter((c) => COLLECTIONS3.includes(c)).map((c) => `- **${c}**`).join("\n");
3889
4204
  return `## ${category}
@@ -3935,12 +4250,12 @@ Total available collections: ${COLLECTIONS3.length}`;
3935
4250
  }
3936
4251
 
3937
4252
  // src/resources/(docs)/getting-started.ts
3938
- var metadata36 = {
4253
+ var metadata39 = {
3939
4254
  name: "docs-getting-started",
3940
4255
  title: "Getting Started",
3941
4256
  description: "01.software SDK getting started guide"
3942
4257
  };
3943
- function handler8() {
4258
+ function handler9() {
3944
4259
  return `# Getting Started
3945
4260
 
3946
4261
  A guide to getting started with the 01.software SDK.
@@ -3974,18 +4289,18 @@ const result = await client.collections.from('products').find({
3974
4289
 
3975
4290
  ## Next Steps
3976
4291
 
3977
- - [Quick Start](/docs/getting-started/quick-start) - Get started in 5 minutes
3978
- - [Configuration](/docs/getting-started/configuration) - Detailed configuration options
3979
- - [API Reference](/docs/api) - Full API documentation`;
4292
+ - [SDK Guide](/developers/sdk) - Install and query workspace content
4293
+ - [Authentication & Keys](/developers/authentication) - Choose the right key for each surface
4294
+ - [API](/developers/api) - Use the HTTP API when SDKs are not a fit`;
3980
4295
  }
3981
4296
 
3982
4297
  // src/resources/(docs)/guides.ts
3983
- var metadata37 = {
4298
+ var metadata40 = {
3984
4299
  name: "docs-guides",
3985
4300
  title: "Guides",
3986
4301
  description: "01.software SDK usage guides"
3987
4302
  };
3988
- function handler9() {
4303
+ function handler10() {
3989
4304
  return `# Guides
3990
4305
 
3991
4306
  Comprehensive guides to master the 01.software SDK.
@@ -4187,16 +4502,16 @@ Payload query syntax operators:
4187
4502
 
4188
4503
  For ecommerce collections, \`products.listing.*\` is the browse/search projection. Authoritative sellable price and stock remain on \`product-variants\`.
4189
4504
 
4190
- For more detailed guides, see the [Guides page](/docs/guides).`;
4505
+ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4191
4506
  }
4192
4507
 
4193
4508
  // src/resources/(docs)/api.ts
4194
- var metadata38 = {
4509
+ var metadata41 = {
4195
4510
  name: "docs-api",
4196
4511
  title: "API Reference",
4197
4512
  description: "01.software SDK API reference documentation"
4198
4513
  };
4199
- function handler10() {
4514
+ function handler11() {
4200
4515
  return `# API Reference
4201
4516
 
4202
4517
  Comprehensive documentation for all methods and types in the 01.software SDK.
@@ -4473,16 +4788,16 @@ client.customer.isAuthenticated() // Check auth status
4473
4788
  client.customer.logout() // Clear token
4474
4789
  \`\`\`
4475
4790
 
4476
- For more details, see the [full API documentation](/docs/api).`;
4791
+ For more details, see the [API documentation](/developers/api).`;
4477
4792
  }
4478
4793
 
4479
4794
  // src/resources/(docs)/query-builder.ts
4480
- var metadata39 = {
4795
+ var metadata42 = {
4481
4796
  name: "docs-query-builder",
4482
4797
  title: "Query Builder",
4483
4798
  description: "01.software SDK Query Builder API reference (client.collections.from)"
4484
4799
  };
4485
- function handler11() {
4800
+ function handler12() {
4486
4801
  return `# Query Builder API
4487
4802
 
4488
4803
  The Query Builder provides a fluent interface for querying collections via \`client.collections.from(collection)\`.
@@ -4671,12 +4986,12 @@ console.log(result.hasNextPage) // true
4671
4986
  }
4672
4987
 
4673
4988
  // src/resources/(docs)/react-query.ts
4674
- var metadata40 = {
4989
+ var metadata43 = {
4675
4990
  name: "docs-react-query",
4676
4991
  title: "React Query Hooks",
4677
4992
  description: "01.software SDK React Query hooks reference (client.query)"
4678
4993
  };
4679
- function handler12() {
4994
+ function handler13() {
4680
4995
  return `# React Query Hooks
4681
4996
 
4682
4997
  React Query hooks are available on the browser-side \`Client\` via \`client.query\`. They provide automatic caching, background refetching, and cache invalidation.
@@ -4919,12 +5234,12 @@ export function ProductList() {
4919
5234
  }
4920
5235
 
4921
5236
  // src/resources/(docs)/server-api.ts
4922
- var metadata41 = {
5237
+ var metadata44 = {
4923
5238
  name: "docs-server-api",
4924
5239
  title: "Server-side API",
4925
5240
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
4926
5241
  };
4927
- function handler13() {
5242
+ function handler14() {
4928
5243
  return `# Server-side API
4929
5244
 
4930
5245
  Server-side operations are available via \`client.commerce\` on \`ServerClient\`. Use \`createServerClient\` with both \`publishableKey\` and \`secretKey\`.
@@ -5181,12 +5496,12 @@ const result = await client.commerce.shipping.calculate({
5181
5496
  }
5182
5497
 
5183
5498
  // src/resources/(docs)/customer-auth.ts
5184
- var metadata42 = {
5499
+ var metadata45 = {
5185
5500
  name: "docs-customer-auth",
5186
5501
  title: "Customer Auth API",
5187
5502
  description: "01.software SDK Customer Auth API reference (client.customer)"
5188
5503
  };
5189
- function handler14() {
5504
+ function handler15() {
5190
5505
  return `# Customer Auth API
5191
5506
 
5192
5507
  Customer authentication and profile management is available via \`client.customer\` on the browser-side \`Client\`.
@@ -5359,12 +5674,12 @@ async function loadProfile() {
5359
5674
  }
5360
5675
 
5361
5676
  // src/resources/(docs)/browser-vs-server.ts
5362
- var metadata43 = {
5677
+ var metadata46 = {
5363
5678
  name: "docs-browser-vs-server",
5364
5679
  title: "Client vs ServerClient",
5365
5680
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
5366
5681
  };
5367
- function handler15() {
5682
+ function handler16() {
5368
5683
  return `# Client vs ServerClient
5369
5684
 
5370
5685
  The SDK provides two client types for different execution environments.
@@ -5518,12 +5833,12 @@ export function ProductList() {
5518
5833
  }
5519
5834
 
5520
5835
  // src/resources/(docs)/file-upload.ts
5521
- var metadata44 = {
5836
+ var metadata47 = {
5522
5837
  name: "docs-file-upload",
5523
5838
  title: "File Upload",
5524
5839
  description: "01.software SDK file upload patterns using the images collection"
5525
5840
  };
5526
- function handler16() {
5841
+ function handler17() {
5527
5842
  return `# File Upload
5528
5843
 
5529
5844
  Upload files using the \`images\` collection (tenant-scoped, unified image store) or \`system-media\` (global, non-tenant).
@@ -5669,12 +5984,12 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
5669
5984
  }
5670
5985
 
5671
5986
  // src/resources/(docs)/webhook.ts
5672
- var metadata45 = {
5987
+ var metadata48 = {
5673
5988
  name: "docs-webhook",
5674
5989
  title: "Webhooks",
5675
5990
  description: "01.software SDK webhook verification and event handling"
5676
5991
  };
5677
- function handler17() {
5992
+ function handler18() {
5678
5993
  return `# Webhooks
5679
5994
 
5680
5995
  The platform dispatches HMAC-SHA256 signed webhook events to your registered URLs. Tenant developers own routing inside their webhook handler.
@@ -5782,9 +6097,91 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
5782
6097
  Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
5783
6098
  }
5784
6099
 
6100
+ // src/resources/(docs)/product-detail.ts
6101
+ var metadata49 = {
6102
+ name: "docs-product-detail",
6103
+ title: "Product Detail Helper",
6104
+ description: "01.software SDK commerce.product.detail helper guide"
6105
+ };
6106
+ function handler19() {
6107
+ return `# Product Detail Helper
6108
+
6109
+ ## When to use the helper vs the raw query builder
6110
+
6111
+ Use \`client.commerce.product.detail({ slug | id })\` when you need a full product detail page payload in one call. The helper folds the Payload query, access policy, and response shaping (variants, options, option value slugs/media, brand, categories, tags, images, videos, listing rollup) into a single call.
6112
+
6113
+ Use \`client.collections.from('products').find(...)\` (escape hatch) when you need bulk reads, custom filter combinations, or fields outside the helper response shape.
6114
+
6115
+ ## Single-call example
6116
+
6117
+ \`\`\`typescript
6118
+ import { createClient, resolveProductSelection } from '@01.software/sdk'
6119
+
6120
+ const client = createClient({
6121
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6122
+ })
6123
+
6124
+ const detail = await client.commerce.product.detail({ slug: 'my-product' })
6125
+ if (!detail) return notFound()
6126
+ const selection = resolveProductSelection(detail, {
6127
+ search: '?opt.color=black&opt.size=large',
6128
+ })
6129
+ // selection.selectedVariant, selection.price, selection.stock, selection.media
6130
+ \`\`\`
6131
+
6132
+ ## URL round-trip
6133
+
6134
+ Use the SDK codec for one canonical selection URL format: \`opt.<optionSlug>=<valueSlug>\`. Option and value slugs are the stable public tokens exposed by product detail.
6135
+
6136
+ \`\`\`typescript
6137
+ import { createProductSelectionCodec } from '@01.software/sdk'
6138
+
6139
+ const codec = createProductSelectionCodec(detail)
6140
+ const selection = codec.parse('?opt.color=black')
6141
+ const href = codec.stringify(selection)
6142
+ \`\`\`
6143
+
6144
+ Value-slug-only URLs such as \`?black\` or \`?color=black\` are rejected because option titles are not stable identifiers.
6145
+
6146
+ ## React Query hook variant
6147
+
6148
+ \`\`\`typescript
6149
+ const { data: detail, isLoading } = client.query.useProductDetailBySlug(slug)
6150
+ \`\`\`
6151
+
6152
+ Cache invalidates automatically when any of 10 detail-relevant collections is mutated through SDK mutation hooks.
6153
+
6154
+ ## SSG / Server Component snippet
6155
+
6156
+ \`\`\`tsx
6157
+ // app/products/[slug]/page.tsx
6158
+ import { createClient } from '@01.software/sdk'
6159
+ import { notFound } from 'next/navigation'
6160
+
6161
+ export const revalidate = 60
6162
+
6163
+ export default async function ProductPage({ params }: { params: { slug: string } }) {
6164
+ const client = createClient({
6165
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6166
+ })
6167
+ const detail = await client.commerce.product.detail({ slug: params.slug })
6168
+ if (!detail) return notFound()
6169
+ return <ProductView detail={detail} />
6170
+ }
6171
+ \`\`\`
6172
+
6173
+ ## The \`null\` return contract
6174
+
6175
+ The endpoint returns 404 for \`not_found\`, \`not_published\`, \`tenant_mismatch\`, or \`feature_disabled\`. The SDK collapses all 404s to \`null\` so consumer UIs render one "not available" path.
6176
+
6177
+ ## Backend correlation
6178
+
6179
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6180
+ }
6181
+
5785
6182
  // src/server.ts
5786
6183
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
5787
- function registerTool(server, schema34, meta, handler18) {
6184
+ function registerTool(server, schema37, meta, handler20) {
5788
6185
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
5789
6186
  if (!registered) {
5790
6187
  registered = /* @__PURE__ */ new Set();
@@ -5795,7 +6192,7 @@ function registerTool(server, schema34, meta, handler18) {
5795
6192
  meta.name,
5796
6193
  {
5797
6194
  description: meta.description,
5798
- inputSchema: schema34,
6195
+ inputSchema: schema37,
5799
6196
  annotations: meta.annotations
5800
6197
  },
5801
6198
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5824,7 +6221,7 @@ function registerTool(server, schema34, meta, handler18) {
5824
6221
  const summary = activeSummary ?? ownSummary;
5825
6222
  let result = null;
5826
6223
  try {
5827
- result = await handler18(params);
6224
+ result = await handler20(params);
5828
6225
  return { content: [{ type: "text", text: result }] };
5829
6226
  } finally {
5830
6227
  if (summary) {
@@ -5841,26 +6238,26 @@ function registerTool(server, schema34, meta, handler18) {
5841
6238
  }
5842
6239
  );
5843
6240
  }
5844
- function registerPrompt(server, schema34, meta, handler18) {
6241
+ function registerPrompt(server, schema37, meta, handler20) {
5845
6242
  server.registerPrompt(
5846
6243
  meta.name,
5847
6244
  {
5848
6245
  title: meta.title,
5849
6246
  description: meta.description,
5850
- argsSchema: schema34
6247
+ argsSchema: schema37
5851
6248
  },
5852
6249
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5853
6250
  (params) => ({
5854
6251
  messages: [
5855
6252
  {
5856
6253
  role: meta.role ?? "assistant",
5857
- content: { type: "text", text: handler18(params) }
6254
+ content: { type: "text", text: handler20(params) }
5858
6255
  }
5859
6256
  ]
5860
6257
  })
5861
6258
  );
5862
6259
  }
5863
- function registerStaticResource(server, uri, meta, handler18) {
6260
+ function registerStaticResource(server, uri, meta, handler20) {
5864
6261
  server.registerResource(
5865
6262
  meta.name,
5866
6263
  uri,
@@ -5870,7 +6267,7 @@ function registerStaticResource(server, uri, meta, handler18) {
5870
6267
  mimeType: meta.mimeType ?? "text/plain"
5871
6268
  },
5872
6269
  async (url) => ({
5873
- contents: [{ uri: url.href, text: handler18() }]
6270
+ contents: [{ uri: url.href, text: handler20() }]
5874
6271
  })
5875
6272
  );
5876
6273
  }
@@ -5881,52 +6278,251 @@ function createServer(options = {}) {
5881
6278
  version: "0.1.0"
5882
6279
  });
5883
6280
  if (toolSurface === "full") {
5884
- registerTool(server, schema, metadata, queryCollection);
5885
- registerTool(server, schema2, metadata2, getCollectionById);
6281
+ registerTool(
6282
+ server,
6283
+ schema,
6284
+ metadata,
6285
+ queryCollection
6286
+ );
6287
+ registerTool(
6288
+ server,
6289
+ schema2,
6290
+ metadata2,
6291
+ getCollectionById
6292
+ );
5886
6293
  registerTool(server, schema3, metadata3, getOrder);
5887
6294
  registerTool(server, schema4, metadata4, createOrder);
5888
6295
  registerTool(server, schema5, metadata5, updateOrder);
5889
6296
  registerTool(server, schema6, metadata6, checkout);
5890
- registerTool(server, schema7, metadata7, createFulfillment);
5891
- registerTool(server, schema8, metadata8, updateFulfillment);
5892
- registerTool(server, schema9, metadata9, updateTransaction);
5893
- registerTool(server, schema10, metadata10, createReturn);
5894
- registerTool(server, schema11, metadata11, updateReturn);
5895
- registerTool(server, schema12, metadata12, returnWithRefund);
6297
+ registerTool(
6298
+ server,
6299
+ schema7,
6300
+ metadata7,
6301
+ createFulfillment
6302
+ );
6303
+ registerTool(
6304
+ server,
6305
+ schema8,
6306
+ metadata8,
6307
+ updateFulfillment
6308
+ );
6309
+ registerTool(
6310
+ server,
6311
+ schema9,
6312
+ metadata9,
6313
+ updateTransaction
6314
+ );
6315
+ registerTool(
6316
+ server,
6317
+ schema10,
6318
+ metadata10,
6319
+ createReturn
6320
+ );
6321
+ registerTool(
6322
+ server,
6323
+ schema11,
6324
+ metadata11,
6325
+ updateReturn
6326
+ );
6327
+ registerTool(
6328
+ server,
6329
+ schema12,
6330
+ metadata12,
6331
+ returnWithRefund
6332
+ );
5896
6333
  registerTool(server, schema13, metadata13, addCartItem);
5897
- registerTool(server, schema14, metadata14, updateCartItem);
5898
- registerTool(server, schema15, metadata15, removeCartItem);
5899
- registerTool(server, schema16, metadata16, applyDiscount);
5900
- registerTool(server, schema17, metadata17, removeDiscount);
6334
+ registerTool(
6335
+ server,
6336
+ schema14,
6337
+ metadata14,
6338
+ updateCartItem
6339
+ );
6340
+ registerTool(
6341
+ server,
6342
+ schema15,
6343
+ metadata15,
6344
+ removeCartItem
6345
+ );
6346
+ registerTool(
6347
+ server,
6348
+ schema16,
6349
+ metadata16,
6350
+ applyDiscount
6351
+ );
6352
+ registerTool(
6353
+ server,
6354
+ schema17,
6355
+ metadata17,
6356
+ removeDiscount
6357
+ );
5901
6358
  registerTool(server, schema18, metadata18, clearCart);
5902
- registerTool(server, schema19, metadata19, validateDiscount);
5903
- registerTool(server, schema20, metadata20, calculateShipping);
6359
+ registerTool(
6360
+ server,
6361
+ schema19,
6362
+ metadata19,
6363
+ validateDiscount
6364
+ );
6365
+ registerTool(
6366
+ server,
6367
+ schema20,
6368
+ metadata20,
6369
+ calculateShipping
6370
+ );
5904
6371
  registerTool(server, schema21, metadata21, stockCheck);
6372
+ registerTool(server, schema22, metadata22, productDetail);
6373
+ registerTool(
6374
+ server,
6375
+ schema23,
6376
+ metadata23,
6377
+ productUpsert
6378
+ );
5905
6379
  }
5906
- registerTool(server, schema22, metadata22, getCollectionSchemaTool);
5907
- registerTool(server, schema23, metadata23, handler);
5908
- registerTool(server, schema24, metadata24, listConfigurableFields);
5909
- registerTool(server, schema25, metadata25, updateFieldConfig);
5910
- registerTool(server, schema26, metadata26, handler2);
5911
- registerTool(server, schema27, metadata27, handler3);
5912
- registerTool(server, schema28, metadata28, handler4);
5913
- registerTool(server, schema29, metadata29, handler5);
5914
- registerPrompt(server, schema30, metadata30, sdkUsageGuide);
5915
- registerPrompt(server, schema31, metadata31, collectionQueryHelp);
5916
- registerPrompt(server, schema32, metadata32, orderFlowGuide);
5917
- registerPrompt(server, schema33, metadata33, featureSetupGuide);
5918
- registerStaticResource(server, "config://app", metadata34, handler6);
5919
- registerStaticResource(server, "collections://schema", metadata35, handler7);
5920
- registerStaticResource(server, "docs://sdk/getting-started", metadata36, handler8);
5921
- registerStaticResource(server, "docs://sdk/guides", metadata37, handler9);
5922
- registerStaticResource(server, "docs://sdk/api", metadata38, handler10);
5923
- registerStaticResource(server, "docs://sdk/query-builder", metadata39, handler11);
5924
- registerStaticResource(server, "docs://sdk/react-query", metadata40, handler12);
5925
- registerStaticResource(server, "docs://sdk/server-api", metadata41, handler13);
5926
- registerStaticResource(server, "docs://sdk/customer-auth", metadata42, handler14);
5927
- registerStaticResource(server, "docs://sdk/browser-vs-server", metadata43, handler15);
5928
- registerStaticResource(server, "docs://sdk/file-upload", metadata44, handler16);
5929
- registerStaticResource(server, "docs://sdk/webhook", metadata45, handler17);
6380
+ registerTool(
6381
+ server,
6382
+ schema24,
6383
+ metadata24,
6384
+ getCollectionSchemaTool
6385
+ );
6386
+ registerTool(
6387
+ server,
6388
+ schema25,
6389
+ metadata25,
6390
+ handler
6391
+ );
6392
+ registerTool(
6393
+ server,
6394
+ schema26,
6395
+ metadata26,
6396
+ handler2
6397
+ );
6398
+ registerTool(
6399
+ server,
6400
+ schema27,
6401
+ metadata27,
6402
+ listConfigurableFields
6403
+ );
6404
+ registerTool(
6405
+ server,
6406
+ schema28,
6407
+ metadata28,
6408
+ updateFieldConfig
6409
+ );
6410
+ registerTool(
6411
+ server,
6412
+ schema29,
6413
+ metadata29,
6414
+ handler3
6415
+ );
6416
+ registerTool(
6417
+ server,
6418
+ schema30,
6419
+ metadata30,
6420
+ handler4
6421
+ );
6422
+ registerTool(
6423
+ server,
6424
+ schema31,
6425
+ metadata31,
6426
+ handler5
6427
+ );
6428
+ registerTool(
6429
+ server,
6430
+ schema32,
6431
+ metadata32,
6432
+ handler6
6433
+ );
6434
+ registerPrompt(
6435
+ server,
6436
+ schema33,
6437
+ metadata33,
6438
+ sdkUsageGuide
6439
+ );
6440
+ registerPrompt(
6441
+ server,
6442
+ schema34,
6443
+ metadata34,
6444
+ collectionQueryHelp
6445
+ );
6446
+ registerPrompt(
6447
+ server,
6448
+ schema35,
6449
+ metadata35,
6450
+ orderFlowGuide
6451
+ );
6452
+ registerPrompt(
6453
+ server,
6454
+ schema36,
6455
+ metadata36,
6456
+ featureSetupGuide
6457
+ );
6458
+ registerStaticResource(
6459
+ server,
6460
+ "config://app",
6461
+ metadata37,
6462
+ handler7
6463
+ );
6464
+ registerStaticResource(
6465
+ server,
6466
+ "collections://schema",
6467
+ metadata38,
6468
+ handler8
6469
+ );
6470
+ registerStaticResource(
6471
+ server,
6472
+ "docs://sdk/getting-started",
6473
+ metadata39,
6474
+ handler9
6475
+ );
6476
+ registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6477
+ registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6478
+ registerStaticResource(
6479
+ server,
6480
+ "docs://sdk/query-builder",
6481
+ metadata42,
6482
+ handler12
6483
+ );
6484
+ registerStaticResource(
6485
+ server,
6486
+ "docs://sdk/react-query",
6487
+ metadata43,
6488
+ handler13
6489
+ );
6490
+ registerStaticResource(
6491
+ server,
6492
+ "docs://sdk/server-api",
6493
+ metadata44,
6494
+ handler14
6495
+ );
6496
+ registerStaticResource(
6497
+ server,
6498
+ "docs://sdk/customer-auth",
6499
+ metadata45,
6500
+ handler15
6501
+ );
6502
+ registerStaticResource(
6503
+ server,
6504
+ "docs://sdk/browser-vs-server",
6505
+ metadata46,
6506
+ handler16
6507
+ );
6508
+ registerStaticResource(
6509
+ server,
6510
+ "docs://sdk/file-upload",
6511
+ metadata47,
6512
+ handler17
6513
+ );
6514
+ registerStaticResource(
6515
+ server,
6516
+ "docs://sdk/webhook",
6517
+ metadata48,
6518
+ handler18
6519
+ );
6520
+ registerStaticResource(
6521
+ server,
6522
+ "docs://sdk/product-detail",
6523
+ metadata49,
6524
+ handler19
6525
+ );
5930
6526
  return server;
5931
6527
  }
5932
6528
 
@@ -5944,4 +6540,4 @@ export {
5944
6540
  flushMcpTelemetrySummary,
5945
6541
  createServer
5946
6542
  };
5947
- //# sourceMappingURL=chunk-CADO6WG6.js.map
6543
+ //# sourceMappingURL=chunk-VSMPWKVX.js.map