@01.software/init 0.9.2 → 0.10.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 (116) hide show
  1. package/dist/ai-docs.d.ts +13 -0
  2. package/dist/ai-docs.js +0 -0
  3. package/dist/browser-auth-CJDrpp5T.d.ts +11 -0
  4. package/dist/{chunk-UA7WNT2F.js → chunk-4LHYICUL.js} +1 -1
  5. package/dist/chunk-4LHYICUL.js.map +1 -0
  6. package/dist/{chunk-R4GGO33X.js → chunk-NJ4X7VNK.js} +1 -1
  7. package/dist/{chunk-R4GGO33X.js.map → chunk-NJ4X7VNK.js.map} +1 -1
  8. package/dist/chunk-Q6MSORYN.js +0 -0
  9. package/dist/chunk-STM4DKVZ.js +183 -0
  10. package/dist/chunk-STM4DKVZ.js.map +1 -0
  11. package/dist/{chunk-ENQSB4OF.js → chunk-WDWJ73KP.js} +40 -214
  12. package/dist/chunk-WDWJ73KP.js.map +1 -0
  13. package/dist/create-app-templates/ecommerce/AGENTS.md +88 -0
  14. package/dist/create-app-templates/ecommerce/CHANGELOG.md +30 -0
  15. package/dist/create-app-templates/ecommerce/CLAUDE.md +1 -0
  16. package/dist/create-app-templates/ecommerce/README.md +139 -0
  17. package/dist/create-app-templates/ecommerce/app/api/auth/login/route.ts +30 -0
  18. package/dist/create-app-templates/ecommerce/app/api/auth/logout/route.ts +18 -0
  19. package/dist/create-app-templates/ecommerce/app/api/auth/register/route.ts +41 -0
  20. package/dist/create-app-templates/ecommerce/app/api/cart/clear/route.ts +12 -0
  21. package/dist/create-app-templates/ecommerce/app/api/cart/items/route.ts +45 -0
  22. package/dist/create-app-templates/ecommerce/app/api/cart/route.ts +14 -0
  23. package/dist/create-app-templates/ecommerce/app/api/checkout/payment-return/route.ts +86 -0
  24. package/dist/create-app-templates/ecommerce/app/api/checkout/reconcile/route.ts +50 -0
  25. package/dist/create-app-templates/ecommerce/app/api/checkout/route.ts +41 -0
  26. package/dist/create-app-templates/ecommerce/app/cart/page.tsx +10 -0
  27. package/dist/create-app-templates/ecommerce/app/checkout/page.tsx +10 -0
  28. package/dist/create-app-templates/ecommerce/app/checkout/success/page.tsx +34 -0
  29. package/dist/create-app-templates/ecommerce/app/favicon.ico +0 -0
  30. package/dist/create-app-templates/ecommerce/app/globals.css +67 -0
  31. package/dist/create-app-templates/ecommerce/app/layout.tsx +23 -0
  32. package/dist/create-app-templates/ecommerce/app/login/page.tsx +11 -0
  33. package/dist/create-app-templates/ecommerce/app/page.tsx +5 -0
  34. package/dist/create-app-templates/ecommerce/app/products/[slug]/page.tsx +46 -0
  35. package/dist/create-app-templates/ecommerce/app/products/page.tsx +45 -0
  36. package/dist/create-app-templates/ecommerce/app/register/page.tsx +11 -0
  37. package/dist/create-app-templates/ecommerce/app/webhook/payment/route.ts +20 -0
  38. package/dist/create-app-templates/ecommerce/app-config.ts +54 -0
  39. package/dist/create-app-templates/ecommerce/components/auth/auth-form.tsx +109 -0
  40. package/dist/create-app-templates/ecommerce/components/cart/cart-content.tsx +119 -0
  41. package/dist/create-app-templates/ecommerce/components/checkout/checkout-form.tsx +267 -0
  42. package/dist/create-app-templates/ecommerce/components/checkout/checkout-reconcile.tsx +78 -0
  43. package/dist/create-app-templates/ecommerce/components/layout/account-nav.tsx +48 -0
  44. package/dist/create-app-templates/ecommerce/components/layout/account-slot.tsx +12 -0
  45. package/dist/create-app-templates/ecommerce/components/layout/cart-link.tsx +13 -0
  46. package/dist/create-app-templates/ecommerce/components/layout/page-shell.tsx +11 -0
  47. package/dist/create-app-templates/ecommerce/components/layout/site-header.tsx +22 -0
  48. package/dist/create-app-templates/ecommerce/components/product/add-to-cart.tsx +116 -0
  49. package/dist/create-app-templates/ecommerce/components/product/product-card.tsx +50 -0
  50. package/dist/create-app-templates/ecommerce/components/product/product-gallery.tsx +39 -0
  51. package/dist/create-app-templates/ecommerce/data/mock-catalog.json +173 -0
  52. package/dist/create-app-templates/ecommerce/eslint.config.mjs +18 -0
  53. package/dist/create-app-templates/ecommerce/lib/cart/cookie.ts +40 -0
  54. package/dist/create-app-templates/ecommerce/lib/cart/normalize.ts +32 -0
  55. package/dist/create-app-templates/ecommerce/lib/cart/parse-cart-request.ts +56 -0
  56. package/dist/create-app-templates/ecommerce/lib/cart/route-helpers.ts +17 -0
  57. package/dist/create-app-templates/ecommerce/lib/cart/select-provider.ts +44 -0
  58. package/dist/create-app-templates/ecommerce/lib/cart/server-cart.ts +96 -0
  59. package/dist/create-app-templates/ecommerce/lib/cart/sync-on-login.server.ts +34 -0
  60. package/dist/create-app-templates/ecommerce/lib/cart/use-cart.tsx +151 -0
  61. package/dist/create-app-templates/ecommerce/lib/checkout/checkout-errors.ts +22 -0
  62. package/dist/create-app-templates/ecommerce/lib/checkout/checkout-provider.ts +28 -0
  63. package/dist/create-app-templates/ecommerce/lib/checkout/parse-checkout-payload.ts +76 -0
  64. package/dist/create-app-templates/ecommerce/lib/checkout/start-checkout.ts +63 -0
  65. package/dist/create-app-templates/ecommerce/lib/checkout/types.ts +3 -0
  66. package/dist/create-app-templates/ecommerce/lib/commerce/adapters/mock.ts +336 -0
  67. package/dist/create-app-templates/ecommerce/lib/commerce/adapters/software-mappers.ts +312 -0
  68. package/dist/create-app-templates/ecommerce/lib/commerce/adapters/software.ts +913 -0
  69. package/dist/create-app-templates/ecommerce/lib/commerce/product-summary.ts +37 -0
  70. package/dist/create-app-templates/ecommerce/lib/commerce/provider.server.ts +60 -0
  71. package/dist/create-app-templates/ecommerce/lib/commerce/provider.ts +96 -0
  72. package/dist/create-app-templates/ecommerce/lib/commerce/stock.ts +37 -0
  73. package/dist/create-app-templates/ecommerce/lib/commerce/types.ts +206 -0
  74. package/dist/create-app-templates/ecommerce/lib/commerce/variant-selection.ts +23 -0
  75. package/dist/create-app-templates/ecommerce/lib/customer/auth-actions.ts +131 -0
  76. package/dist/create-app-templates/ecommerce/lib/customer/cart-sync.ts +44 -0
  77. package/dist/create-app-templates/ecommerce/lib/customer/client.server.ts +109 -0
  78. package/dist/create-app-templates/ecommerce/lib/customer/current-customer.ts +15 -0
  79. package/dist/create-app-templates/ecommerce/lib/customer/route-guard.ts +58 -0
  80. package/dist/create-app-templates/ecommerce/lib/customer/route-helpers.ts +75 -0
  81. package/dist/create-app-templates/ecommerce/lib/customer/session.ts +108 -0
  82. package/dist/create-app-templates/ecommerce/lib/format.ts +7 -0
  83. package/dist/create-app-templates/ecommerce/lib/payment/adapters/mock.ts +84 -0
  84. package/dist/create-app-templates/ecommerce/lib/payment/adapters/portone.ts +254 -0
  85. package/dist/create-app-templates/ecommerce/lib/payment/adapters/tosspayments.ts +287 -0
  86. package/dist/create-app-templates/ecommerce/lib/payment/amount-gate.ts +86 -0
  87. package/dist/create-app-templates/ecommerce/lib/payment/provider.server.ts +51 -0
  88. package/dist/create-app-templates/ecommerce/lib/payment/provider.ts +18 -0
  89. package/dist/create-app-templates/ecommerce/lib/payment/sync-order-payment.ts +96 -0
  90. package/dist/create-app-templates/ecommerce/lib/payment/types.ts +71 -0
  91. package/dist/create-app-templates/ecommerce/lib/server-only-guard.ts +20 -0
  92. package/dist/create-app-templates/ecommerce/next-env.d.ts +6 -0
  93. package/dist/create-app-templates/ecommerce/next.config.ts +16 -0
  94. package/dist/create-app-templates/ecommerce/package.json +33 -0
  95. package/dist/create-app-templates/ecommerce/postcss.config.mjs +7 -0
  96. package/dist/create-app-templates/ecommerce/tests/customer-auth.test.ts +263 -0
  97. package/dist/create-app-templates/ecommerce/tests/customer-cart.test.ts +392 -0
  98. package/dist/create-app-templates/ecommerce/tests/domain.test.ts +1537 -0
  99. package/dist/create-app-templates/ecommerce/tsconfig.json +35 -0
  100. package/dist/create-app-templates/registry.json +66 -0
  101. package/dist/create-app.d.ts +40 -0
  102. package/dist/create-app.js +652 -0
  103. package/dist/create-app.js.map +1 -0
  104. package/dist/detect-Bjxp9wcS.d.ts +13 -0
  105. package/dist/file-ops.d.ts +21 -0
  106. package/dist/file-ops.js +1 -1
  107. package/dist/index.d.ts +2 -0
  108. package/dist/index.js +4 -3
  109. package/dist/index.js.map +1 -1
  110. package/dist/init.d.ts +40 -0
  111. package/dist/init.js +4 -3
  112. package/dist/templates.d.ts +27 -0
  113. package/dist/templates.js +1 -1
  114. package/package.json +31 -15
  115. package/dist/chunk-ENQSB4OF.js.map +0 -1
  116. package/dist/chunk-UA7WNT2F.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/file-ops.ts"],"sourcesContent":["// Helpers for `.env*` / Codex TOML / secret-bearing global config writes.\n// The pure string utilities (`readEnvValue`, `setEnvValue`,\n// `replaceTomlMcpSection`) are unit-tested without filesystem access; the\n// secret-write helpers (`writeEnvFile`, `chmodSecretFile`,\n// `writeSecretGlobalConfig`) are tested against an isolated tmpdir.\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { randomBytes } from 'node:crypto'\n\n// ── Secret-bearing writes ────────────────────────────────────────────\n\n/** POSIX file mode for secret-bearing files (`.env*`, global auth config). */\nexport const SECRET_FILE_MODE = 0o600\n/** POSIX directory mode for parents of global auth-bearing config. */\nexport const SECRET_DIR_MODE = 0o700\n\nconst isWin32 = process.platform === 'win32'\n\nfunction writeFileWithSecretMode(target: string, content: string): void {\n fs.writeFileSync(target, content, isWin32 ? undefined : { mode: SECRET_FILE_MODE })\n}\n\nfunction mkdirWithSecretMode(dir: string): void {\n fs.mkdirSync(\n dir,\n isWin32 ? { recursive: true } : { recursive: true, mode: SECRET_DIR_MODE },\n )\n}\n\n/** Write a `.env*` file with mode `0o600` on POSIX. Skips mode on Windows\n * per spec §\"Secret Handling Rules\". */\nexport function writeEnvFile(target: string, content: string): void {\n writeFileWithSecretMode(target, content)\n}\n\n/** Apply secret-file mode to an existing file (no-op on Windows). Useful\n * after merging an `.env*` file that already existed. */\nexport function chmodSecretFile(target: string): void {\n if (isWin32) return\n try {\n fs.chmodSync(target, SECRET_FILE_MODE)\n } catch {\n // Mode tightening is best-effort; the spec waives the requirement on\n // platforms that reject the chmod.\n }\n}\n\n/** Write a global auth-bearing config (e.g. `~/.codex/config.toml`) using\n * symlink-safe atomic rename. Throws when the existing target is a symlink,\n * has multiple hard links, or is not a regular file. */\nexport function writeSecretGlobalConfig(target: string, content: string): void {\n mkdirWithSecretMode(path.dirname(target))\n\n // Reject symlinks / non-regular files / multi-hardlink targets before any write.\n if (fs.existsSync(target)) {\n const stat = fs.lstatSync(target)\n if (stat.isSymbolicLink()) {\n throw new Error(\n `Refusing to write secret-bearing config through a symlink: ${target}. ` +\n `Remove the symlink and re-run init.`,\n )\n }\n if (!stat.isFile()) {\n throw new Error(\n `Refusing to write secret-bearing config to non-regular file: ${target}.`,\n )\n }\n if (!isWin32 && stat.nlink > 1) {\n throw new Error(\n `Refusing to write secret-bearing config to file with multiple hard links: ${target}.`,\n )\n }\n }\n\n // Atomic temp-file replacement: write tmp with 0o600, then rename to target.\n const tmp = `${target}.${randomBytes(6).toString('hex')}.tmp`\n writeFileWithSecretMode(tmp, content)\n try {\n fs.renameSync(tmp, target)\n } catch (err) {\n // Best-effort cleanup of the tmp file if rename failed (e.g. EXDEV).\n try {\n fs.unlinkSync(tmp)\n } catch {\n // ignore\n }\n throw err\n }\n}\n\n// ── .env merge ───────────────────────────────────────────────────────\n\nconst envLineRegexCache = new Map<string, RegExp>()\n\nfunction envLineRegex(name: string): RegExp {\n let re = envLineRegexCache.get(name)\n if (!re) {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n re = new RegExp(`^${escaped}=(.*)$`, 'm')\n envLineRegexCache.set(name, re)\n }\n return re\n}\n\nexport function readEnvValue(content: string, name: string): string | null {\n const m = content.match(envLineRegex(name))\n return m ? m[1] : null\n}\n\nexport function setEnvValue(content: string, name: string, value: string): string {\n const re = envLineRegex(name)\n if (re.test(content)) return content.replace(re, `${name}=${value}`)\n const sep = content.length === 0 || content.endsWith('\\n') ? '' : '\\n'\n return content + sep + `${name}=${value}\\n`\n}\n\n// ── Codex TOML manipulation ──────────────────────────────────────────\n\nconst OWNED_MCP_TOML_SECTION = 'mcp_servers.01software'\n\nfunction tomlSectionName(line: string): string | null {\n const match = line.trim().match(/^\\[([^\\]]+)\\]$/)\n return match ? match[1] : null\n}\n\nfunction isOwnedMcpTomlSection(sectionName: string): boolean {\n return (\n sectionName === OWNED_MCP_TOML_SECTION ||\n sectionName.startsWith(`${OWNED_MCP_TOML_SECTION}.`)\n )\n}\n\n/** Removes the existing `[mcp_servers.01software]` block and sub-blocks from a\n * TOML document, then appends the provided section. */\nexport function replaceTomlMcpSection(content: string, newSection: string): string {\n const lines = content.split('\\n')\n const kept: string[] = []\n let inOurSection = false\n for (const line of lines) {\n const sectionName = tomlSectionName(line)\n if (sectionName) {\n inOurSection = isOwnedMcpTomlSection(sectionName)\n if (inOurSection) continue\n }\n if (!inOurSection) kept.push(line)\n }\n let result = kept.join('\\n').replace(/\\n+$/, '')\n if (result.length > 0) result += '\\n'\n // newSection already starts with a blank line; keep it that way\n result += newSection.startsWith('\\n') ? newSection : '\\n' + newSection\n return result\n}\n"],"mappings":";;;AAMA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAKrB,IAAM,mBAAmB;AAEzB,IAAM,kBAAkB;AAE/B,IAAM,UAAU,QAAQ,aAAa;AAErC,SAAS,wBAAwB,QAAgB,SAAuB;AACtE,KAAG,cAAc,QAAQ,SAAS,UAAU,SAAY,EAAE,MAAM,iBAAiB,CAAC;AACpF;AAEA,SAAS,oBAAoB,KAAmB;AAC9C,KAAG;AAAA,IACD;AAAA,IACA,UAAU,EAAE,WAAW,KAAK,IAAI,EAAE,WAAW,MAAM,MAAM,gBAAgB;AAAA,EAC3E;AACF;AAIO,SAAS,aAAa,QAAgB,SAAuB;AAClE,0BAAwB,QAAQ,OAAO;AACzC;AAIO,SAAS,gBAAgB,QAAsB;AACpD,MAAI,QAAS;AACb,MAAI;AACF,OAAG,UAAU,QAAQ,gBAAgB;AAAA,EACvC,QAAQ;AAAA,EAGR;AACF;AAKO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