@duct-sdk/sdk 0.5.13 → 0.6.0

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +385 -344
  2. package/README.md +418 -264
  3. package/TOKEN_SPEC.md +243 -243
  4. package/dist/cli/add.d.ts +7 -0
  5. package/dist/cli/add.js +152 -0
  6. package/dist/cli/agent-prompt.d.ts +3 -0
  7. package/dist/cli/agent-prompt.js +39 -0
  8. package/dist/cli/api-sources.d.ts +26 -0
  9. package/dist/cli/api-sources.js +222 -0
  10. package/dist/cli/cloud.d.ts +133 -0
  11. package/dist/cli/cloud.js +298 -0
  12. package/dist/cli/config-loader.d.ts +14 -0
  13. package/dist/cli/config-loader.js +56 -7
  14. package/dist/cli/device-login.d.ts +17 -0
  15. package/dist/cli/device-login.js +75 -0
  16. package/dist/cli/drift.js +6 -6
  17. package/dist/cli/generators/any-stack.d.ts +3 -0
  18. package/dist/cli/generators/any-stack.js +97 -0
  19. package/dist/cli/generators/config.js +3 -2
  20. package/dist/cli/generators/receiver.js +7 -7
  21. package/dist/cli/generators/shell.js +12 -12
  22. package/dist/cli/generators/token-route.js +245 -245
  23. package/dist/cli/index.js +396 -611
  24. package/dist/cli/mcp-core.d.ts +42 -0
  25. package/dist/cli/mcp-core.js +161 -0
  26. package/dist/cli/mcp-setup.d.ts +4 -0
  27. package/dist/cli/mcp-setup.js +360 -0
  28. package/dist/cli/mcp.d.ts +2 -0
  29. package/dist/cli/mcp.js +457 -0
  30. package/dist/cli/migrate-intershell.js +5 -5
  31. package/dist/cli/policy-defaults.d.ts +37 -0
  32. package/dist/cli/policy-defaults.js +127 -0
  33. package/dist/cli/processors/integration-audit.js +2 -2
  34. package/dist/cli/processors/openapi-parser.d.ts +5 -0
  35. package/dist/cli/processors/openapi-parser.js +8 -3
  36. package/dist/cli/project-loader.d.ts +58 -0
  37. package/dist/cli/project-loader.js +198 -0
  38. package/dist/cli/project-writer.d.ts +23 -0
  39. package/dist/cli/project-writer.js +171 -0
  40. package/dist/cli/push.d.ts +43 -0
  41. package/dist/cli/push.js +276 -0
  42. package/dist/cli/safety-checks.d.ts +9 -0
  43. package/dist/cli/safety-checks.js +29 -0
  44. package/dist/cli/setup.d.ts +20 -0
  45. package/dist/cli/setup.js +349 -0
  46. package/dist/cli/shell-name.d.ts +8 -0
  47. package/dist/cli/shell-name.js +29 -0
  48. package/dist/cli/shells.d.ts +22 -0
  49. package/dist/cli/shells.js +122 -0
  50. package/dist/cli/split.d.ts +7 -0
  51. package/dist/cli/split.js +71 -0
  52. package/dist/cli/sync.d.ts +25 -0
  53. package/dist/cli/sync.js +120 -0
  54. package/dist/cli/test-runner.d.ts +21 -0
  55. package/dist/cli/test-runner.js +281 -0
  56. package/dist/core/compile.d.ts +43 -0
  57. package/dist/core/compile.js +510 -0
  58. package/dist/core/config.d.ts +464 -1
  59. package/dist/core/config.js +14 -14
  60. package/dist/core/login-handoff.d.ts +1 -1
  61. package/dist/core/login-handoff.js +1 -1
  62. package/dist/core/project.d.ts +1798 -0
  63. package/dist/core/project.js +278 -0
  64. package/dist/core/readiness-checks.js +2 -2
  65. package/dist/core/types.d.ts +1 -1
  66. package/dist/index.d.ts +2 -0
  67. package/dist/index.js +1 -0
  68. package/dist/project.d.ts +4 -0
  69. package/dist/project.js +8 -0
  70. package/dist/server.d.ts +2 -0
  71. package/dist/server.js +1 -0
  72. package/package.json +94 -95
  73. package/dist/adapters/react/page-context-guard.test.d.ts +0 -1
  74. package/dist/adapters/react/page-context-guard.test.js +0 -15
  75. package/dist/cli/agents/api-agent.d.ts +0 -22
  76. package/dist/cli/agents/api-agent.js +0 -761
  77. package/dist/cli/agents/auth-agent.d.ts +0 -7
  78. package/dist/cli/agents/auth-agent.js +0 -212
  79. package/dist/cli/agents/deeplink-agent.d.ts +0 -6
  80. package/dist/cli/agents/deeplink-agent.js +0 -285
  81. package/dist/cli/agents/llm.d.ts +0 -33
  82. package/dist/cli/agents/llm.js +0 -309
  83. package/dist/cli/agents/pipeline.d.ts +0 -72
  84. package/dist/cli/agents/pipeline.js +0 -421
  85. package/dist/cli/agents/reviewer-agent.d.ts +0 -13
  86. package/dist/cli/agents/reviewer-agent.js +0 -450
  87. package/dist/cli/agents/route-agent.d.ts +0 -17
  88. package/dist/cli/agents/route-agent.js +0 -383
  89. package/dist/cli/config-loader.test.d.ts +0 -1
  90. package/dist/cli/config-loader.test.js +0 -63
  91. package/dist/cli/detectors/topology.d.ts +0 -46
  92. package/dist/cli/detectors/topology.js +0 -417
  93. package/dist/cli/generators/config.test.d.ts +0 -1
  94. package/dist/cli/generators/config.test.js +0 -222
  95. package/dist/cli/generators/shell.test.d.ts +0 -1
  96. package/dist/cli/generators/shell.test.js +0 -73
  97. package/dist/cli/generators/token-route.test.d.ts +0 -1
  98. package/dist/cli/generators/token-route.test.js +0 -53
  99. package/dist/cli/generators/wiring-snippets.test.d.ts +0 -1
  100. package/dist/cli/generators/wiring-snippets.test.js +0 -80
  101. package/dist/cli/init.d.ts +0 -32
  102. package/dist/cli/init.js +0 -1336
  103. package/dist/cli/manifest-diff.test.d.ts +0 -1
  104. package/dist/cli/manifest-diff.test.js +0 -144
  105. package/dist/cli/processors/curl-parser.test.d.ts +0 -1
  106. package/dist/cli/processors/curl-parser.test.js +0 -24
  107. package/dist/cli/processors/integration-audit.test.d.ts +0 -1
  108. package/dist/cli/processors/integration-audit.test.js +0 -154
  109. package/dist/cli/processors/postprocess.d.ts +0 -22
  110. package/dist/cli/processors/postprocess.js +0 -107
  111. package/dist/cli/processors/prisma-parser.d.ts +0 -35
  112. package/dist/cli/processors/prisma-parser.js +0 -117
  113. package/dist/cli/processors/verify-discovery.d.ts +0 -33
  114. package/dist/cli/processors/verify-discovery.js +0 -193
  115. package/dist/cli/processors/verify-discovery.test.d.ts +0 -1
  116. package/dist/cli/processors/verify-discovery.test.js +0 -153
  117. package/dist/cli/processors/zod-extractor.d.ts +0 -27
  118. package/dist/cli/processors/zod-extractor.js +0 -153
  119. package/dist/cli/prompts/review.d.ts +0 -61
  120. package/dist/cli/prompts/review.js +0 -410
  121. package/dist/cli/selectors/express.d.ts +0 -12
  122. package/dist/cli/selectors/express.js +0 -117
  123. package/dist/cli/selectors/fastapi.d.ts +0 -12
  124. package/dist/cli/selectors/fastapi.js +0 -122
  125. package/dist/cli/selectors/generic.d.ts +0 -10
  126. package/dist/cli/selectors/generic.js +0 -74
  127. package/dist/cli/selectors/index.d.ts +0 -37
  128. package/dist/cli/selectors/index.js +0 -315
  129. package/dist/cli/selectors/next.d.ts +0 -12
  130. package/dist/cli/selectors/next.js +0 -130
  131. package/dist/core/config-policy.test.d.ts +0 -1
  132. package/dist/core/config-policy.test.js +0 -101
  133. package/dist/core/config-roundtrip.test.d.ts +0 -1
  134. package/dist/core/config-roundtrip.test.js +0 -180
  135. package/dist/core/endpoint-guard.test.d.ts +0 -1
  136. package/dist/core/endpoint-guard.test.js +0 -57
  137. package/dist/core/env-diagnostics.test.d.ts +0 -1
  138. package/dist/core/env-diagnostics.test.js +0 -31
  139. package/dist/core/evidence-bundle.conformance.test.d.ts +0 -1
  140. package/dist/core/evidence-bundle.conformance.test.js +0 -110
  141. package/dist/core/evidence-bundle.test.d.ts +0 -1
  142. package/dist/core/evidence-bundle.test.js +0 -58
  143. package/dist/core/invariants.test.d.ts +0 -1
  144. package/dist/core/invariants.test.js +0 -217
  145. package/dist/core/login-handoff.test.d.ts +0 -1
  146. package/dist/core/login-handoff.test.js +0 -31
  147. package/dist/core/profile.test.d.ts +0 -1
  148. package/dist/core/profile.test.js +0 -95
  149. package/dist/core/readiness-checks.test.d.ts +0 -1
  150. package/dist/core/readiness-checks.test.js +0 -106
  151. package/dist/core/receipt.test.d.ts +0 -1
  152. package/dist/core/receipt.test.js +0 -75
  153. package/dist/core/sdk-entrypoint.test.d.ts +0 -1
  154. package/dist/core/sdk-entrypoint.test.js +0 -8
  155. package/dist/core/side-effects-review.test.d.ts +0 -1
  156. package/dist/core/side-effects-review.test.js +0 -28
  157. package/dist/core/token.conformance.test.d.ts +0 -1
  158. package/dist/core/token.conformance.test.js +0 -43
  159. package/dist/core/token.test.d.ts +0 -1
  160. package/dist/core/token.test.js +0 -66
@@ -235,7 +235,7 @@ export function generateManualTemplate(opts) {
235
235
  * Generated in manual mode — no AI agents were used.
236
236
  * Fill in the routes, actions, and deeplinks sections below, then run:
237
237
  *
238
- * npx duct push
238
+ * npx @duct-sdk/sdk push
239
239
  *
240
240
  * to sync this manifest with Duct cloud.
241
241
  *
@@ -438,7 +438,8 @@ export function generateConfigFile(config) {
438
438
  * It defines what routes exist, what actions agents can invoke,
439
439
  * and what deeplinks the shell can hand off to.
440
440
  *
441
- * Edit freely. Run \`npx duct init --update\` to regenerate from source.
441
+ * Edit freely, then \`npx @duct-sdk/sdk test\` → \`npx @duct-sdk/sdk push\`.
442
+ * Prefer the duct/ project layout: \`npx @duct-sdk/sdk split\`.
442
443
  * Docs: ${docsBase}/config
443
444
  */
444
445
 
@@ -16,7 +16,7 @@ const REPLAY_STORE_VERIFY_OPTIONS = `,
16
16
  function generateNextAppRouterReceiver(_config) {
17
17
  const docsBase = getDocsUrl();
18
18
  return `/**
19
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
19
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
20
20
  *
21
21
  * This route receives signed deeplinks from the Duct shell and navigates
22
22
  * the user to the correct page with pre-loaded state.
@@ -161,7 +161,7 @@ function buildRedirectPath(
161
161
  function generateNextPagesRouterReceiver(_config) {
162
162
  const docsBase = getDocsUrl();
163
163
  return `/**
164
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
164
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
165
165
  *
166
166
  * This route receives signed deeplinks from the Duct shell and navigates
167
167
  * the user to the correct page with pre-loaded state.
@@ -345,7 +345,7 @@ export function generateTokenRoute(config, framework, tokenOptions) {
345
345
  function generateRemixReceiver(_config) {
346
346
  const docsBase = getDocsUrl();
347
347
  return `/**
348
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
348
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
349
349
  *
350
350
  * This route receives signed deeplinks from the Duct shell and navigates
351
351
  * the user to the correct page with pre-loaded state.
@@ -428,7 +428,7 @@ export async function action({ request }: ActionFunctionArgs) {
428
428
  function generateExpressReceiver(_config) {
429
429
  const docsBase = getDocsUrl();
430
430
  return `/**
431
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
431
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
432
432
  *
433
433
  * This route receives signed deeplinks from the Duct shell and navigates
434
434
  * the user to the correct page with pre-loaded state.
@@ -508,7 +508,7 @@ export default router;
508
508
  function generateNuxtReceiver(_config) {
509
509
  const docsBase = getDocsUrl();
510
510
  return `/**
511
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
511
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
512
512
  *
513
513
  * Nitro server route. Do not remove the signature verification step.
514
514
  * Do not expose DUCT_SECRET_KEY client-side.
@@ -576,7 +576,7 @@ export default defineEventHandler(async (event) => {
576
576
  // ----------------------------------------------------------------
577
577
  function generateFastApiReceiver(_config) {
578
578
  const docsBase = getDocsUrl();
579
- return `# duct_receive.py — auto-generated by \`npx duct init\`
579
+ return `# duct_receive.py — generated by \`npx @duct-sdk/sdk add identity\`
580
580
  # FastAPI route that verifies signed Duct deeplinks (HS256 JWT).
581
581
  # Requires: pip install pyjwt
582
582
  #
@@ -651,7 +651,7 @@ async def duct_receive(request: Request):
651
651
  function generateSvelteKitReceiver(_config) {
652
652
  const docsBase = getDocsUrl();
653
653
  return `/**
654
- * Duct Deeplink Receiver — auto-generated by \`npx duct init\`
654
+ * Duct Deeplink Receiver — generated by \`npx @duct-sdk/sdk add identity\`
655
655
  *
656
656
  * This route receives signed deeplinks from the Duct shell and navigates
657
657
  * the user to the correct page with pre-loaded state.
@@ -27,14 +27,14 @@ function generateReactShellComponent(config) {
27
27
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
28
28
  : 'http://localhost:3005/docs';
29
29
  return `/**
30
- * Duct Shell Widget — auto-generated by \`npx duct init\`
30
+ * Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
31
31
  *
32
32
  * Mount this in your root layout. That's it.
33
33
  * The shell is hosted by Duct. This component is a thin bridge.
34
34
  * It renders the self-contained launcher, so do not add a second trigger.
35
35
  *
36
36
  * To customize: ${docsBase}/shell/customization
37
- * To update: npx duct init --update
37
+ * To regenerate: npx @duct-sdk/sdk add shell --force
38
38
  */
39
39
 
40
40
  "use client"; // Required for Next.js App Router
@@ -170,14 +170,14 @@ function generateRemixShellComponent(config) {
170
170
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
171
171
  : 'http://localhost:3005/docs';
172
172
  return `/**
173
- * Duct Shell Widget — auto-generated by \`npx duct init\`
173
+ * Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
174
174
  *
175
175
  * Mount this in your root layout. That's it.
176
176
  * The shell is hosted by Duct. This component is a thin bridge.
177
177
  * It renders the self-contained launcher, so do not add a second trigger.
178
178
  *
179
179
  * To customize: ${docsBase}/shell/customization
180
- * To update: npx duct init --update
180
+ * To regenerate: npx @duct-sdk/sdk add shell --force
181
181
  */
182
182
 
183
183
  import { DuctShell } from "@duct-sdk/sdk/react";
@@ -225,14 +225,14 @@ function generateViteShellComponent(config) {
225
225
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
226
226
  : 'http://localhost:3005/docs';
227
227
  return `/**
228
- * Duct Shell Widget — auto-generated by \`npx duct init\`
228
+ * Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
229
229
  *
230
230
  * Mount this in your root layout. That's it.
231
231
  * The shell is hosted by Duct. This component is a thin bridge.
232
232
  * It renders the self-contained launcher, so do not add a second trigger.
233
233
  *
234
234
  * To customize: ${docsBase}/shell/customization
235
- * To update: npx duct init --update
235
+ * To regenerate: npx @duct-sdk/sdk add shell --force
236
236
  */
237
237
 
238
238
  import { DuctShell } from "@duct-sdk/sdk/react";
@@ -345,13 +345,13 @@ function generateSvelteKitShellComponent(config) {
345
345
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
346
346
  : 'http://localhost:3005/docs';
347
347
  return `<!--
348
- Duct Shell Widget — auto-generated by \`npx duct init\`
348
+ Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
349
349
 
350
350
  Mount this in your root layout. That's it.
351
351
  The shell is hosted by Duct. This component is a thin bridge.
352
352
 
353
353
  To customize: ${docsBase}/shell/customization
354
- To update: npx duct init --update
354
+ To regenerate: npx @duct-sdk/sdk add shell --force
355
355
  -->
356
356
 
357
357
  <script lang="ts">
@@ -460,13 +460,13 @@ function generateVue3ShellComponent(config) {
460
460
  ? "bottom: 86px; left: 24px;"
461
461
  : "bottom: 86px; right: 24px;";
462
462
  return `<!--
463
- Duct Shell Widget — auto-generated by \`npx duct init\`
463
+ Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
464
464
 
465
465
  Mount this in your root App.vue (or a layout component).
466
466
  The shell is hosted by Duct. This is a thin postMessage bridge.
467
467
 
468
468
  To customize: ${docsBase}/shell/customization
469
- To update: npx duct init --update
469
+ To regenerate: npx @duct-sdk/sdk add shell --force
470
470
  -->
471
471
 
472
472
  <template>
@@ -599,13 +599,13 @@ function generateNuxtShellComponent(config) {
599
599
  ? "bottom: 86px; left: 24px;"
600
600
  : "bottom: 86px; right: 24px;";
601
601
  return `<!--
602
- Duct Shell Widget — auto-generated by \`npx duct init\`
602
+ Duct Shell Widget — generated by \`npx @duct-sdk/sdk add shell\`
603
603
 
604
604
  Mount this in your app.vue or a layouts file.
605
605
  The shell is hosted by Duct. This is a thin postMessage bridge.
606
606
 
607
607
  To customize: ${docsBase}/shell/customization
608
- To update: npx duct init --update
608
+ To regenerate: npx @duct-sdk/sdk add shell --force
609
609
  -->
610
610
 
611
611
  <template>