@takuhon/cli 0.8.2 → 0.9.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.
- package/dist/index.d.ts +3 -3
- package/dist/index.js +276 -13
- package/dist/index.js.map +1 -1
- package/dist/init.js +19 -30
- package/dist/init.js.map +1 -1
- package/package.json +2 -2
package/dist/init.js
CHANGED
|
@@ -170,9 +170,9 @@ function buildPackageJson(opts) {
|
|
|
170
170
|
deploy: "wrangler deploy"
|
|
171
171
|
},
|
|
172
172
|
dependencies: {
|
|
173
|
-
"@takuhon/api": "^0.
|
|
174
|
-
"@takuhon/cloudflare": "^0.
|
|
175
|
-
"@takuhon/core": "^0.
|
|
173
|
+
"@takuhon/api": "^0.9.0",
|
|
174
|
+
"@takuhon/cloudflare": "^0.9.0",
|
|
175
|
+
"@takuhon/core": "^0.9.0",
|
|
176
176
|
hono: "^4.0.0"
|
|
177
177
|
},
|
|
178
178
|
devDependencies: {
|
|
@@ -207,32 +207,31 @@ A [Takuhon](https://github.com/takuhon-dev/takuhon) profile deployment, running
|
|
|
207
207
|
|
|
208
208
|
> **Status**: pre-deploy. Edit \`takuhon.json\`, provision Cloudflare KV, then \`pnpm deploy\`.
|
|
209
209
|
|
|
210
|
-
> **Heads-up \u2014 Takuhon is in a pre-publish phase.**
|
|
211
|
-
>
|
|
212
|
-
> The \`@takuhon/api\`, \`@takuhon/core\`, and \`@takuhon/cloudflare\` packages
|
|
213
|
-
> referenced in \`package.json\` are not yet on the npm registry.
|
|
214
|
-
> \`pnpm install\` will fail in this directory until they ship. See *Develop*
|
|
215
|
-
> below for the workspace-link recipe in the meantime.
|
|
216
|
-
|
|
217
210
|
## What is Takuhon?
|
|
218
211
|
|
|
219
212
|
Takuhon lets you own your profile as a portable JSON document and publish it as a mobile-first profile page plus a public API (JSON-LD for AI agents and search engines included).
|
|
220
213
|
|
|
221
214
|
## Setup
|
|
222
215
|
|
|
223
|
-
1. **
|
|
216
|
+
1. **Install dependencies.**
|
|
217
|
+
|
|
218
|
+
\`\`\`sh
|
|
219
|
+
pnpm install
|
|
220
|
+
\`\`\`
|
|
221
|
+
|
|
222
|
+
2. **Edit your profile.** Open \`takuhon.json\` and replace the sample fields (\`profile.displayName\`, \`links\`, \`careers\`, \`projects\`, \`skills\`) with your own.
|
|
224
223
|
|
|
225
|
-
|
|
224
|
+
3. **Create the Cloudflare KV namespaces** and copy the returned ids into \`wrangler.toml\`:
|
|
226
225
|
|
|
227
226
|
\`\`\`sh
|
|
228
|
-
wrangler kv namespace create TAKUHON_KV
|
|
229
|
-
wrangler kv namespace create TAKUHON_KV --preview
|
|
227
|
+
npx wrangler kv namespace create TAKUHON_KV
|
|
228
|
+
npx wrangler kv namespace create TAKUHON_KV --preview
|
|
230
229
|
\`\`\`
|
|
231
230
|
|
|
232
|
-
|
|
231
|
+
4. **Provision the admin token** as a Wrangler secret (used by \`/api/admin/*\`):
|
|
233
232
|
|
|
234
233
|
\`\`\`sh
|
|
235
|
-
openssl rand -base64 32 | wrangler secret put TAKUHON_ADMIN_TOKEN
|
|
234
|
+
openssl rand -base64 32 | npx wrangler secret put TAKUHON_ADMIN_TOKEN
|
|
236
235
|
\`\`\`
|
|
237
236
|
|
|
238
237
|
Leaving the secret unset disables admin writes entirely (every \`PUT\` / \`DELETE\` returns 401).
|
|
@@ -241,17 +240,7 @@ Takuhon lets you own your profile as a portable JSON document and publish it as
|
|
|
241
240
|
|
|
242
241
|
The Worker entry at \`src/index.ts\` composes the takuhon adapter via
|
|
243
242
|
\`createTakuhonWorker\` and serves your \`takuhon.json\` as the fallback when
|
|
244
|
-
KV has no stored profile yet.
|
|
245
|
-
clone the upstream repo and link them into this directory (substitute
|
|
246
|
-
your own absolute path for \`<takuhon-repo-path>\`):
|
|
247
|
-
|
|
248
|
-
\`\`\`sh
|
|
249
|
-
git clone https://github.com/takuhon-dev/takuhon <takuhon-repo-path>
|
|
250
|
-
( cd <takuhon-repo-path> && pnpm install && pnpm build )
|
|
251
|
-
pnpm link <takuhon-repo-path>/packages/api <takuhon-repo-path>/packages/core <takuhon-repo-path>/adapters/cloudflare
|
|
252
|
-
\`\`\`
|
|
253
|
-
|
|
254
|
-
Then:
|
|
243
|
+
KV has no stored profile yet.
|
|
255
244
|
|
|
256
245
|
\`\`\`sh
|
|
257
246
|
pnpm dev # runs \`wrangler dev\` locally
|
|
@@ -567,10 +556,10 @@ Names must be lowercase, start and end with a letter or digit, and contain only
|
|
|
567
556
|
|
|
568
557
|
Next steps:
|
|
569
558
|
cd ${parsed.targetArg}
|
|
570
|
-
# 1. Edit takuhon.json with your profile data
|
|
571
|
-
# 2. Provision Cloudflare KV: wrangler kv namespace create TAKUHON_KV
|
|
572
|
-
# 3. Set admin token: openssl rand -base64 32 | wrangler secret put TAKUHON_ADMIN_TOKEN
|
|
573
559
|
pnpm install
|
|
560
|
+
# 1. Edit takuhon.json with your profile data
|
|
561
|
+
# 2. Provision Cloudflare KV: npx wrangler kv namespace create TAKUHON_KV
|
|
562
|
+
# 3. Set admin token: openssl rand -base64 32 | npx wrangler secret put TAKUHON_ADMIN_TOKEN
|
|
574
563
|
pnpm dev`
|
|
575
564
|
);
|
|
576
565
|
return 0;
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init.ts","../src/licenses.ts","../src/prompts.ts","../src/scaffold/index.ts","../src/scaffold/env-example.ts","../src/scaffold/gitignore.ts","../src/scaffold/package-json.ts","../src/scaffold/readme.ts","../src/scaffold/takuhon-json.ts","../src/scaffold/tsconfig-json.ts","../src/scaffold/worker-index-ts.ts","../src/scaffold/wrangler-toml.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Entry point for `npx create-takuhon` (and `pnpm create takuhon`).\n *\n * Usage:\n * create-takuhon <target-dir> [--license <spdxId>]\n *\n * The positional target directory is required; it must not already exist (we\n * refuse to overwrite). `--license` skips the interactive picker for CI /\n * automation use.\n */\n\nimport { realpathSync } from 'node:fs';\nimport { basename, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { parseArgs } from 'node:util';\n\nimport { cancel, intro, outro } from '@clack/prompts';\n\nimport { buildContentLicense, isValidSpdxInput } from './licenses.js';\nimport { promptLicense } from './prompts.js';\nimport { TargetDirectoryExistsError, writeProject } from './scaffold/index.js';\nimport { isValidWorkerName } from './scaffold/wrangler-toml.js';\n\ninterface CliArgs {\n readonly targetArg: string | undefined;\n readonly extraPositionals: readonly string[];\n readonly license: string | undefined;\n readonly help: boolean;\n}\n\nfunction parseCliArgs(argv: readonly string[]): CliArgs {\n const { values, positionals } = parseArgs({\n args: [...argv],\n allowPositionals: true,\n strict: true,\n options: {\n license: { type: 'string' },\n help: { type: 'boolean', short: 'h' },\n },\n });\n return {\n targetArg: positionals[0],\n extraPositionals: positionals.slice(1),\n license: values.license,\n help: values.help === true,\n };\n}\n\nfunction printHelp(): void {\n process.stdout.write(\n `Usage: create-takuhon <target-dir> [--license <spdxId>]\\n` +\n `\\n` +\n `Scaffolds a Takuhon profile deployment in <target-dir>.\\n` +\n `\\n` +\n `Options:\\n` +\n ` --license <spdxId> Skip the interactive license prompt and use the\\n` +\n ` given SPDX identifier (e.g. CC-BY-4.0, MIT,\\n` +\n ` Proprietary). Useful for CI / automation.\\n` +\n ` -h, --help Show this help.\\n`,\n );\n}\n\nasync function main(argv: readonly string[]): Promise<number> {\n let parsed: CliArgs;\n try {\n parsed = parseCliArgs(argv);\n } catch (err) {\n process.stderr.write(`${(err as Error).message}\\n\\n`);\n printHelp();\n return 2;\n }\n\n if (parsed.help) {\n printHelp();\n return 0;\n }\n\n if (parsed.targetArg === undefined) {\n process.stderr.write(`Error: missing target directory argument.\\n\\n`);\n printHelp();\n return 2;\n }\n\n if (parsed.extraPositionals.length > 0) {\n process.stderr.write(\n `Error: unexpected extra arguments: ${parsed.extraPositionals.join(' ')}\\n\\n`,\n );\n printHelp();\n return 2;\n }\n\n const targetDir = resolve(process.cwd(), parsed.targetArg);\n const projectName = basename(targetDir);\n\n if (!isValidWorkerName(projectName)) {\n process.stderr.write(\n `Error: target directory basename \"${projectName}\" is not a valid Cloudflare Worker name.\\n` +\n `Names must be lowercase, start and end with a letter or digit, and contain only ` +\n `letters, digits, and hyphens (max 63 chars).\\n`,\n );\n return 2;\n }\n\n intro('create-takuhon');\n\n let spdxId: string;\n if (parsed.license !== undefined) {\n const raw = parsed.license.trim();\n if (!isValidSpdxInput(raw)) {\n cancel(`Invalid --license value: \"${parsed.license}\"`);\n return 2;\n }\n spdxId = raw;\n } else {\n const result = await promptLicense();\n if ('cancelled' in result) {\n return 130;\n }\n spdxId = result.spdxId;\n }\n\n const license = buildContentLicense(spdxId);\n\n try {\n await writeProject({ targetDir, projectName, license });\n } catch (err) {\n if (err instanceof TargetDirectoryExistsError) {\n cancel(`Target directory already exists: ${parsed.targetArg}`);\n return 1;\n }\n throw err;\n }\n\n outro(\n `Created ${projectName} (license: ${spdxId}).\\n` +\n `\\n` +\n `Next steps:\\n` +\n ` cd ${parsed.targetArg}\\n` +\n ` # 1. Edit takuhon.json with your profile data\\n` +\n ` # 2. Provision Cloudflare KV: wrangler kv namespace create TAKUHON_KV\\n` +\n ` # 3. Set admin token: openssl rand -base64 32 | wrangler secret put TAKUHON_ADMIN_TOKEN\\n` +\n ` pnpm install\\n` +\n ` pnpm dev`,\n );\n\n return 0;\n}\n\n/**\n * Process entry point: run {@link main} and exit with its code. This is the\n * only function that calls `process.exit`, mirroring the `takuhon` entry in\n * `index.ts`. Exported so the `create-takuhon` redirect package can invoke it\n * after importing this module (`import { run } from '@takuhon/cli/init'`).\n */\nexport async function run(argv: readonly string[] = process.argv.slice(2)): Promise<void> {\n try {\n process.exit(await main(argv));\n } catch (err) {\n // Render only the message — full stack traces can leak host-machine\n // absolute paths and monorepo-internal layout into a published\n // binary's stderr output.\n process.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n process.exit(1);\n }\n}\n\n/** True when this module was started directly (`node …/init.js`). */\nfunction isEntrypoint(): boolean {\n const entry = process.argv[1];\n if (entry === undefined) return false;\n try {\n return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));\n } catch {\n return false;\n }\n}\n\nif (isEntrypoint()) {\n void run();\n}\n","/**\n * Content-license metadata and helpers for the `create-takuhon` scaffolding\n * flow.\n *\n * The four entries in `LICENSE_OPTIONS` are the curated choices the\n * interactive picker offers. \"Custom\" is handled separately by the prompt\n * flow as a free-form SPDX text input. `buildContentLicense` shapes the\n * chosen identifier into the `meta.contentLicense` fragment that lands in\n * the generated `takuhon.json`. The Takuhon profile JSON Schema accepts any\n * SPDX expression in `meta.contentLicense.spdxId`; unknown identifiers fall\n * through with `spdxId` only, and downstream UI rendering is best-effort.\n */\n\n/** A single row in the interactive license selector. */\nexport interface LicenseOption {\n /** Short label shown as the selectable label in the prompt. */\n readonly label: string;\n /** Longer hint shown alongside the label in the prompt UI. */\n readonly hint: string;\n /** SPDX identifier written to `takuhon.json` `meta.contentLicense.spdxId`. */\n readonly spdxId: string;\n /** Canonical license URL. Omitted for `Proprietary`. */\n readonly url?: string;\n}\n\n/**\n * The four curated license choices shown by the interactive picker. \"Custom\"\n * is not in this list because it triggers a free-form text prompt rather than\n * mapping to a fixed SPDX identifier here.\n */\nexport const LICENSE_OPTIONS: readonly LicenseOption[] = [\n {\n label: 'CC BY 4.0',\n hint: 'Allow reuse with attribution',\n spdxId: 'CC-BY-4.0',\n url: 'https://creativecommons.org/licenses/by/4.0/',\n },\n {\n label: 'CC BY-NC 4.0',\n hint: 'Non-commercial reuse with attribution',\n spdxId: 'CC-BY-NC-4.0',\n url: 'https://creativecommons.org/licenses/by-nc/4.0/',\n },\n {\n label: 'CC0',\n hint: 'Public domain',\n spdxId: 'CC0-1.0',\n url: 'https://creativecommons.org/publicdomain/zero/1.0/',\n },\n {\n label: 'Proprietary',\n hint: 'All rights reserved',\n spdxId: 'Proprietary',\n },\n];\n\n/**\n * Canonical URL lookup for SPDX identifiers we recognise but don't list in\n * the interactive picker. Used by `buildContentLicense` so that a user who\n * passes `--license CC-BY-SA-4.0` (or selects it via `Custom`) still gets a\n * usable `url` field in the generated `takuhon.json`.\n *\n * URLs for non-CC SPDX identifiers point at the canonical SPDX license page\n * (`spdx.org/licenses/<id>.html`). Creative Commons identifiers use the\n * `creativecommons.org` deed URL because that is the page humans expect to\n * land on (the SPDX page is metadata-only).\n */\nconst KNOWN_URL_BY_SPDX: Readonly<Record<string, string>> = {\n 'CC0-1.0': 'https://creativecommons.org/publicdomain/zero/1.0/',\n 'CC-BY-4.0': 'https://creativecommons.org/licenses/by/4.0/',\n 'CC-BY-SA-4.0': 'https://creativecommons.org/licenses/by-sa/4.0/',\n 'CC-BY-ND-4.0': 'https://creativecommons.org/licenses/by-nd/4.0/',\n 'CC-BY-NC-4.0': 'https://creativecommons.org/licenses/by-nc/4.0/',\n 'CC-BY-NC-SA-4.0': 'https://creativecommons.org/licenses/by-nc-sa/4.0/',\n 'CC-BY-NC-ND-4.0': 'https://creativecommons.org/licenses/by-nc-nd/4.0/',\n MIT: 'https://spdx.org/licenses/MIT.html',\n};\n\n/** Shape written to `takuhon.json` under `meta.contentLicense`. */\nexport interface ContentLicenseFragment {\n readonly spdxId: string;\n readonly url?: string;\n readonly rights?: string;\n}\n\n/**\n * Translate a chosen SPDX identifier into the `meta.contentLicense` fragment\n * for `takuhon.json`.\n *\n * - `Proprietary` is given a `rights` sentinel and no `url`.\n * - Known SPDX identifiers get a canonical `url`.\n * - Anything else is written as `{ spdxId }` only — the schema accepts\n * arbitrary SPDX expressions, and UI rendering is best-effort.\n */\nexport function buildContentLicense(spdxId: string): ContentLicenseFragment {\n if (spdxId === 'Proprietary') {\n return {\n spdxId: 'Proprietary',\n rights: 'All rights reserved. Contact owner for usage permission.',\n };\n }\n const url = KNOWN_URL_BY_SPDX[spdxId];\n if (url !== undefined) {\n return { spdxId, url };\n }\n return { spdxId };\n}\n\n/**\n * Light syntactic validation for a user-entered SPDX expression (the\n * `Custom` prompt branch and the `--license` flag).\n *\n * We accept any non-empty string composed of the characters that appear in\n * canonical SPDX identifiers and boolean expressions (alphanumerics, `.`,\n * `-`, `+`, parentheses, and literal spaces). Tabs and newlines are rejected\n * because real SPDX expressions never contain them. Full SPDX expression\n * parsing (`MIT OR (Apache-2.0 AND CC-BY-4.0)`) is intentionally out of\n * scope — we trust the user and let the JSON Schema's downstream validation\n * flag obvious problems.\n */\nexport function isValidSpdxInput(input: string): boolean {\n const trimmed = input.trim();\n if (trimmed === '') return false;\n return /^[A-Za-z0-9.\\-+() ]+$/.test(trimmed);\n}\n","/**\n * Interactive prompt flow for `create-takuhon`, built on `@clack/prompts`.\n *\n * A single-choice picker offers the curated `LICENSE_OPTIONS` plus a\n * `Custom` row that opens a free-form SPDX text input. Cancellation\n * (Ctrl+C or pressing Esc on a clack prompt) returns a sentinel result\n * instead of throwing so the caller can exit cleanly with a specific status\n * code.\n */\n\nimport { cancel, isCancel, select, text } from '@clack/prompts';\n\nimport { LICENSE_OPTIONS, isValidSpdxInput } from './licenses.js';\n\n/** Returned by {@link promptLicense} on successful completion. */\nexport interface PromptLicenseResult {\n /** SPDX identifier to write into `meta.contentLicense.spdxId`. */\n readonly spdxId: string;\n}\n\n/** Returned when the user cancels (Ctrl+C / Esc) instead of completing. */\nexport interface PromptCancelled {\n readonly cancelled: true;\n}\n\nconst CUSTOM_SENTINEL = '__custom__';\n\n/**\n * Run the license picker. Resolves to either the selected SPDX identifier or\n * a cancellation sentinel; never throws on user cancel.\n */\nexport async function promptLicense(): Promise<PromptLicenseResult | PromptCancelled> {\n const choice = await select<string>({\n message: 'Choose a license for your profile content:',\n options: [\n ...LICENSE_OPTIONS.map((opt) => ({\n value: opt.spdxId,\n label: opt.label,\n hint: opt.hint,\n })),\n { value: CUSTOM_SENTINEL, label: 'Custom', hint: 'enter SPDX identifier' },\n ],\n });\n\n if (isCancel(choice)) {\n cancel('Aborted.');\n return { cancelled: true };\n }\n\n if (choice !== CUSTOM_SENTINEL) {\n return { spdxId: choice };\n }\n\n const customRaw = await text({\n message: 'Enter the SPDX identifier:',\n placeholder: 'e.g. MIT, Apache-2.0, CC-BY-SA-4.0',\n validate(value): string | undefined {\n if (!isValidSpdxInput(value)) {\n return 'Must be a non-empty SPDX-like expression (alphanumerics, ., -, +, parentheses, spaces).';\n }\n return undefined;\n },\n });\n\n if (isCancel(customRaw)) {\n cancel('Aborted.');\n return { cancelled: true };\n }\n\n return { spdxId: customRaw.trim() };\n}\n","/**\n * Top-level scaffolding orchestrator for `create-takuhon`.\n *\n * `writeProject` is the single entry point used by `init.ts`. It creates the\n * target directory (must not already exist), then writes the eight files\n * that make up the scaffold: `takuhon.json`, `wrangler.toml`, `package.json`,\n * `README.md`, `.gitignore`, `.env.example`, `tsconfig.json`, and\n * `src/index.ts` (the Cloudflare Worker entry composed via\n * `createTakuhonWorker` from `@takuhon/cloudflare`).\n */\n\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\nimport { renderEnvExample } from './env-example.js';\nimport { renderGitignore } from './gitignore.js';\nimport { renderPackageJson } from './package-json.js';\nimport { renderReadme } from './readme.js';\nimport { renderTakuhonJson } from './takuhon-json.js';\nimport { renderTsconfigJson } from './tsconfig-json.js';\nimport { renderWorkerIndexTs } from './worker-index-ts.js';\nimport { renderWranglerToml } from './wrangler-toml.js';\n\nexport interface WriteProjectOptions {\n /** Absolute path of the directory to create. Must not exist. */\n readonly targetDir: string;\n /** Used for the npm `name`, Worker name, and README header. */\n readonly projectName: string;\n /** Chosen content license (already mapped via `buildContentLicense`). */\n readonly license: ContentLicenseFragment;\n}\n\nexport interface WriteProjectResult {\n /** Relative paths of files that were written (in the order written). */\n readonly files: readonly string[];\n}\n\n/**\n * Error thrown when the target directory already exists. The caller is\n * expected to render a friendly message that references the user-supplied\n * path; the `code` is stable for tests. The absolute `targetDir` is exposed\n * as a field rather than embedded in the message so that bubbling the error\n * up through generic logging does not leak filesystem layout.\n */\nexport class TargetDirectoryExistsError extends Error {\n override readonly name = 'TargetDirectoryExistsError';\n readonly code = 'TARGET_EXISTS' as const;\n constructor(readonly targetDir: string) {\n super('Target directory already exists.');\n }\n}\n\n/**\n * Create the project directory and write the scaffolded files. Order is\n * deterministic so callers (and tests) can rely on it.\n */\nexport async function writeProject(opts: WriteProjectOptions): Promise<WriteProjectResult> {\n const { targetDir, projectName, license } = opts;\n\n // mkdir with recursive: false fails if the directory exists; we surface a\n // typed error so the CLI entry can render a friendly message.\n try {\n await mkdir(targetDir, { recursive: false });\n } catch (err) {\n if (isNodeErrnoException(err) && err.code === 'EEXIST') {\n throw new TargetDirectoryExistsError(targetDir);\n }\n throw err;\n }\n\n const files: { readonly path: string; readonly content: string }[] = [\n { path: 'takuhon.json', content: renderTakuhonJson(license) },\n { path: 'wrangler.toml', content: renderWranglerToml(projectName) },\n { path: 'package.json', content: renderPackageJson({ projectName }) },\n { path: 'README.md', content: renderReadme({ projectName, license }) },\n { path: '.gitignore', content: renderGitignore() },\n { path: '.env.example', content: renderEnvExample() },\n { path: 'tsconfig.json', content: renderTsconfigJson() },\n { path: 'src/index.ts', content: renderWorkerIndexTs() },\n ];\n\n for (const { path, content } of files) {\n const fullPath = join(targetDir, path);\n const parent = dirname(fullPath);\n if (parent !== targetDir) {\n await mkdir(parent, { recursive: true });\n }\n await writeFile(fullPath, content, 'utf8');\n }\n\n return { files: files.map((f) => f.path) };\n}\n\nfunction isNodeErrnoException(err: unknown): err is NodeJS.ErrnoException {\n return err instanceof Error && typeof (err as NodeJS.ErrnoException).code === 'string';\n}\n","/**\n * Generator for the `.env.example` file in a freshly scaffolded project.\n *\n * The Wrangler-managed secrets (admin bearer token) are *not* read from `.env`\n * at deploy time — `wrangler secret put` is the source of truth. The\n * `.env.example` is therefore documentation: it lists the variables a developer\n * may want locally (e.g. for scripting or for the wrangler CLI itself) and\n * links each to its production provisioning path.\n */\n\nexport function renderEnvExample(): string {\n return `# ----------------------------------------------------------------\n# Local development variables for this Takuhon deployment.\n#\n# Production secrets (admin token) are provisioned via:\n# wrangler secret put TAKUHON_ADMIN_TOKEN\n# This file is a hint for local tooling, not a runtime source.\n# ----------------------------------------------------------------\n\n# Admin bearer token for /api/admin/* endpoints.\n# Generate with: openssl rand -base64 32\n# Then provision with:\n# echo \"$TAKUHON_ADMIN_TOKEN\" | wrangler secret put TAKUHON_ADMIN_TOKEN\nTAKUHON_ADMIN_TOKEN=\n\n# Comma-separated Origin allowlist for browser-originating admin requests.\n# Set in wrangler.toml [vars] for production. Local example:\n# TAKUHON_ADMIN_ORIGIN=https://admin.example.com,https://localhost:8787\nTAKUHON_ADMIN_ORIGIN=\n\n# Cloudflare account id (look up via \\`wrangler whoami\\`). Only needed if you\n# script Cloudflare API calls outside Wrangler itself.\nCLOUDFLARE_ACCOUNT_ID=\n`;\n}\n","/**\n * Generator for the scaffolded project's `.gitignore`.\n *\n * Covers Node, Wrangler local cache, and environment files. Kept conservative\n * — no opinions about lockfile preferences (the user picks their package\n * manager) or editor folders (per-editor patterns belong in a global ignore).\n */\n\nexport function renderGitignore(): string {\n return `# Dependencies\nnode_modules/\n\n# Wrangler local cache (do not commit; contains bundled output and tmp files)\n.wrangler/\n\n# Environment variables (commit \\`.env.example\\` instead)\n.env\n.env.local\n.env.*.local\n\n# Logs\n*.log\nnpm-debug.log*\npnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# macOS\n.DS_Store\n`;\n}\n","/**\n * Generator for the scaffolded project's `package.json`.\n *\n * Pinned dependency versions are caret ranges matched to the current\n * minor of the published `@takuhon/*` packages. Under 0.x semver, a caret\n * does not span minor versions, so the range must move forward with each\n * `@takuhon/core` minor release to keep scaffolded projects on the\n * matching schema generation. A guard test (`scaffold.test.ts`) asserts these\n * pins track the published minor, so a missed bump fails CI rather than\n * silently shipping a stale range. `hono` is included as a direct dependency for\n * projects that extend the Worker with their own Hono routes; the generated\n * `src/index.ts` reaches Takuhon's handlers through `@takuhon/cloudflare`\n * rather than importing `hono` directly. `wrangler` is a devDependency since\n * it's the deploy / dev-server tool.\n */\n\nexport interface PackageJsonOptions {\n /** Used for the npm `name` field. */\n readonly projectName: string;\n}\n\nexport function buildPackageJson(opts: PackageJsonOptions): Record<string, unknown> {\n return {\n name: opts.projectName,\n version: '0.0.0',\n private: true,\n type: 'module',\n description: 'Takuhon profile deployment.',\n scripts: {\n dev: 'wrangler dev',\n deploy: 'wrangler deploy',\n },\n dependencies: {\n '@takuhon/api': '^0.8.0',\n '@takuhon/cloudflare': '^0.8.0',\n '@takuhon/core': '^0.8.0',\n hono: '^4.0.0',\n },\n devDependencies: {\n wrangler: '^4.0.0',\n },\n engines: {\n node: '>=22.0.0',\n },\n };\n}\n\nexport function renderPackageJson(opts: PackageJsonOptions): string {\n return `${JSON.stringify(buildPackageJson(opts), null, 2)}\\n`;\n}\n","/**\n * Generator for the README.md placed in a freshly scaffolded project.\n *\n * Aims to give a first-time user enough to (1) fill in their profile data,\n * (2) provision Cloudflare KV + admin secret, and (3) `pnpm dev` / `pnpm\n * deploy` once the upstream `@takuhon/*` packages are reachable. Cross-\n * references the published `@takuhon/cloudflare` adapter README as the\n * next-step reference for the route map.\n */\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\nexport interface ReadmeOptions {\n readonly projectName: string;\n readonly license: ContentLicenseFragment;\n}\n\n/**\n * Human-readable license attribution line for the README footer. Uses the\n * canonical URL when available; falls back to plain SPDX (or\n * \"All rights reserved\" for Proprietary).\n */\nfunction formatLicenseLine(license: ContentLicenseFragment): string {\n if (license.spdxId === 'Proprietary') {\n return '**Proprietary** — all rights reserved.';\n }\n if (license.url !== undefined) {\n return `[\\`${license.spdxId}\\`](${license.url})`;\n }\n return `\\`${license.spdxId}\\``;\n}\n\nexport function renderReadme(opts: ReadmeOptions): string {\n const { projectName, license } = opts;\n const licenseLine = formatLicenseLine(license);\n return `# ${projectName}\n\nA [Takuhon](https://github.com/takuhon-dev/takuhon) profile deployment, running on Cloudflare Workers.\n\n> **Status**: pre-deploy. Edit \\`takuhon.json\\`, provision Cloudflare KV, then \\`pnpm deploy\\`.\n\n> **Heads-up — Takuhon is in a pre-publish phase.**\n>\n> The \\`@takuhon/api\\`, \\`@takuhon/core\\`, and \\`@takuhon/cloudflare\\` packages\n> referenced in \\`package.json\\` are not yet on the npm registry.\n> \\`pnpm install\\` will fail in this directory until they ship. See *Develop*\n> below for the workspace-link recipe in the meantime.\n\n## What is Takuhon?\n\nTakuhon lets you own your profile as a portable JSON document and publish it as a mobile-first profile page plus a public API (JSON-LD for AI agents and search engines included).\n\n## Setup\n\n1. **Edit your profile.** Open \\`takuhon.json\\` and replace the sample fields (\\`profile.displayName\\`, \\`links\\`, \\`careers\\`, \\`projects\\`, \\`skills\\`) with your own.\n\n2. **Create the Cloudflare KV namespaces** and copy the returned ids into \\`wrangler.toml\\`:\n\n \\`\\`\\`sh\n wrangler kv namespace create TAKUHON_KV\n wrangler kv namespace create TAKUHON_KV --preview\n \\`\\`\\`\n\n3. **Provision the admin token** as a Wrangler secret (used by \\`/api/admin/*\\`):\n\n \\`\\`\\`sh\n openssl rand -base64 32 | wrangler secret put TAKUHON_ADMIN_TOKEN\n \\`\\`\\`\n\n Leaving the secret unset disables admin writes entirely (every \\`PUT\\` / \\`DELETE\\` returns 401).\n\n## Develop\n\nThe Worker entry at \\`src/index.ts\\` composes the takuhon adapter via\n\\`createTakuhonWorker\\` and serves your \\`takuhon.json\\` as the fallback when\nKV has no stored profile yet. Until the \\`@takuhon/*\\` packages are on npm,\nclone the upstream repo and link them into this directory (substitute\nyour own absolute path for \\`<takuhon-repo-path>\\`):\n\n\\`\\`\\`sh\ngit clone https://github.com/takuhon-dev/takuhon <takuhon-repo-path>\n( cd <takuhon-repo-path> && pnpm install && pnpm build )\npnpm link <takuhon-repo-path>/packages/api <takuhon-repo-path>/packages/core <takuhon-repo-path>/adapters/cloudflare\n\\`\\`\\`\n\nThen:\n\n\\`\\`\\`sh\npnpm dev # runs \\`wrangler dev\\` locally\n\\`\\`\\`\n\nThe full route map (public + admin) is documented in the [\\`@takuhon/cloudflare\\` README](https://github.com/takuhon-dev/takuhon/tree/main/adapters/cloudflare#readme).\n\n## Deploy\n\n\\`\\`\\`sh\npnpm deploy # runs \\`wrangler deploy\\`\n\\`\\`\\`\n\n## License\n\nProfile content (\\`takuhon.json\\`) is licensed under ${licenseLine}\n\nThe deployment code is your own; pick a license appropriate for it.\n`;\n}\n","/**\n * Generator for the `takuhon.json` file written into a freshly scaffolded\n * project.\n *\n * The template is a copy of `examples/minimal-profile/takuhon.json` from the\n * monorepo. It is inlined here as a TypeScript constant rather than imported\n * from `examples/` so the published `@takuhon/cli` npm package does not need\n * to ship the examples directory.\n *\n * Only `meta.contentLicense` is rewritten per the user's choice; everything\n * else is the canonical minimal profile (one career, one project, three\n * skills, `en` locale only) that downstream `@takuhon/core` validation\n * already accepts (see `packages/core/src/__tests__/examples-fixtures.test.ts`).\n */\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\n/**\n * Build the `takuhon.json` payload as a deterministic, schema-valid object.\n * `meta.contentLicense` is filled from the supplied fragment so each\n * generated project carries the user's chosen SPDX identifier (and `url` /\n * `rights` where applicable).\n */\nexport function buildTakuhonJson(license: ContentLicenseFragment): unknown {\n return {\n schemaVersion: '0.4.0',\n profile: {\n displayName: {\n en: 'Sam Lee',\n },\n },\n links: [\n {\n id: 'github',\n type: 'github',\n url: 'https://example.com/github/sam-lee',\n featured: true,\n },\n ],\n careers: [\n {\n id: 'first-job',\n organization: {\n en: 'Example Co.',\n },\n role: {\n en: 'Junior Software Engineer',\n },\n startDate: '2026-04',\n endDate: null,\n isCurrent: true,\n },\n ],\n projects: [\n {\n id: 'personal-homepage',\n title: {\n en: 'Personal homepage',\n },\n },\n ],\n skills: [\n { id: 'html', label: 'HTML' },\n { id: 'css', label: 'CSS' },\n { id: 'javascript', label: 'JavaScript' },\n ],\n contact: {},\n settings: {\n defaultLocale: 'en',\n availableLocales: ['en'],\n },\n meta: {\n contentLicense: { ...license },\n },\n };\n}\n\n/** Serialise to a UTF-8 string with trailing newline (POSIX-friendly). */\nexport function renderTakuhonJson(license: ContentLicenseFragment): string {\n return `${JSON.stringify(buildTakuhonJson(license), null, 2)}\\n`;\n}\n","/**\n * Generator for the scaffolded project's `tsconfig.json`.\n *\n * Minimal configuration that makes the generated `src/index.ts` typecheck\n * with `tsc --noEmit` in a freshly scaffolded directory. The settings\n * mirror the upstream takuhon monorepo defaults (ES2022 target, ESNext\n * modules, strict mode, `noUncheckedIndexedAccess`) and explicitly enable\n * the two flags the Worker entry depends on:\n *\n * - `resolveJsonModule` — so `import takuhonJson from '../takuhon.json'`\n * resolves at type-check time.\n * - `moduleResolution: \"Bundler\"` — so the Wrangler / esbuild-style\n * resolution (no need for explicit file extensions) is the source of\n * truth that matches what `wrangler dev` actually runs.\n *\n * `noEmit: true` keeps `tsc` purely a type-checker; Wrangler's bundler\n * produces the deployable artifact.\n */\n\nexport function renderTsconfigJson(): string {\n const config = {\n compilerOptions: {\n target: 'ES2022',\n lib: ['ES2022'],\n module: 'ESNext',\n moduleResolution: 'Bundler',\n esModuleInterop: true,\n resolveJsonModule: true,\n isolatedModules: true,\n verbatimModuleSyntax: true,\n strict: true,\n noUncheckedIndexedAccess: true,\n noImplicitOverride: true,\n noFallthroughCasesInSwitch: true,\n skipLibCheck: true,\n noEmit: true,\n },\n include: ['src/**/*'],\n exclude: ['node_modules'],\n };\n return `${JSON.stringify(config, null, 2)}\\n`;\n}\n","/**\n * Generator for `src/index.ts` — the Cloudflare Worker entry file written\n * into a freshly scaffolded project.\n *\n * The generated file uses `createTakuhonWorker()` from `@takuhon/cloudflare`\n * so the scaffolded project does not need to know the internal wiring\n * (Hono router, KV-backed storage, edge cache purger, console audit logger).\n * The user's own `takuhon.json` is loaded via an ES module JSON import,\n * validated once at module load, and the resulting `Takuhon` value is\n * served as the fallback when KV has no stored profile yet.\n *\n * `wrangler.toml`'s `main` field already points at `src/index.ts`, and\n * `nodejs_compat` is enabled, so the file works under `wrangler dev` /\n * `wrangler deploy` without further configuration.\n */\n\nexport function renderWorkerIndexTs(): string {\n return `import { createTakuhonWorker } from '@takuhon/cloudflare';\nimport { validate } from '@takuhon/core';\n\n// Use the project's own takuhon.json as the fallback served when KV has no\n// stored profile yet. Validated once at module load so a malformed profile\n// fails fast rather than at first request.\nimport takuhonJson from '../takuhon.json' with { type: 'json' };\n\nconst fallback = validate(takuhonJson);\nif (!fallback.ok) {\n throw new Error(\n 'Project takuhon.json failed validation: ' +\n fallback.errors.map((e) => \\`\\${e.pointer}: \\${e.message}\\`).join('; '),\n );\n}\n\nconst fallbackTakuhon = fallback.data;\n\nexport default createTakuhonWorker({\n fallback: () => fallbackTakuhon,\n});\n`;\n}\n","/**\n * Generator for `wrangler.toml` in a freshly scaffolded project.\n *\n * The layout mirrors the reference Cloudflare adapter shipped in this\n * monorepo: a single KV namespace `TAKUHON_KV`, placeholder ids the user\n * fills in after running `wrangler kv namespace create`, and the\n * `TAKUHON_ADMIN_ORIGIN` var defaulting to \"\" (disabled). The admin bearer\n * token is provisioned as a Wrangler secret and is therefore not in this file.\n */\n\n/**\n * Validate a Cloudflare Worker name.\n *\n * Cloudflare itself accepts mixed-case DNS labels (1–63 chars, must not\n * start or end with a hyphen). This validator additionally enforces a\n * lowercase convention chosen for the scaffolder so that the resulting\n * `workers.dev` subdomain is predictable and matches the npm `name` field.\n */\nexport function isValidWorkerName(name: string): boolean {\n return /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(name);\n}\n\n/**\n * Render `wrangler.toml` for the given project name.\n *\n * Throws if `projectName` is not a valid Cloudflare Worker name. Callers are\n * responsible for sanitising/validating earlier in the prompt flow.\n */\nexport function renderWranglerToml(projectName: string): string {\n if (!isValidWorkerName(projectName)) {\n throw new Error(\n `Invalid Cloudflare Worker name: \"${projectName}\". Names must be lowercase, ` +\n `start with a letter or digit, and contain only letters, digits, and hyphens (max 63 chars).`,\n );\n }\n return `name = \"${projectName}\"\nmain = \"src/index.ts\"\ncompatibility_date = \"2026-05-01\"\ncompatibility_flags = [\"nodejs_compat\"]\n\n# Replace the placeholder ids after running:\n# wrangler kv namespace create TAKUHON_KV\n# wrangler kv namespace create TAKUHON_KV --preview\n[[kv_namespaces]]\nbinding = \"TAKUHON_KV\"\nid = \"REPLACE_WITH_PRODUCTION_NAMESPACE_ID\"\npreview_id = \"REPLACE_WITH_PREVIEW_NAMESPACE_ID\"\n\n# Admin Origin allowlist (comma-separated). Empty value disables the check.\n# Example for production: TAKUHON_ADMIN_ORIGIN = \"https://admin.example.com\"\n#\n# The admin bearer token MUST be provisioned as a Wrangler secret, never in\n# this file:\n# wrangler secret put TAKUHON_ADMIN_TOKEN\n# Use 32+ bytes of entropy, e.g. \\`openssl rand -base64 32\\`.\n[vars]\nTAKUHON_ADMIN_ORIGIN = \"\"\n`;\n}\n"],"mappings":";;;AAaA,SAAS,oBAAoB;AAC7B,SAAS,UAAU,eAAe;AAClC,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,SAAS,UAAAA,SAAQ,OAAO,aAAa;;;ACY9B,IAAM,kBAA4C;AAAA,EACvD;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AACF;AAaA,IAAM,oBAAsD;AAAA,EAC1D,WAAW;AAAA,EACX,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,KAAK;AACP;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AwB;AAC/B,QAAM,QAAQ,QAAQ,KAAK,CAAC;AAC5B,MAAI,UAAU,OAAW,QAAO;AAChC,MAAI;AACF,WAAO,aAAa,KAAK,MAAM,aAAa,cAAc,YAAY,GAAG,CAAC;AAAA,EAC5E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAI,aAAa,GAAG;AAClB,OAAK,IAAI;AACX;","names":["cancel","cancel"]}
|
|
1
|
+
{"version":3,"sources":["../src/init.ts","../src/licenses.ts","../src/prompts.ts","../src/scaffold/index.ts","../src/scaffold/env-example.ts","../src/scaffold/gitignore.ts","../src/scaffold/package-json.ts","../src/scaffold/readme.ts","../src/scaffold/takuhon-json.ts","../src/scaffold/tsconfig-json.ts","../src/scaffold/worker-index-ts.ts","../src/scaffold/wrangler-toml.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Entry point for `npx create-takuhon` (and `pnpm create takuhon`).\n *\n * Usage:\n * create-takuhon <target-dir> [--license <spdxId>]\n *\n * The positional target directory is required; it must not already exist (we\n * refuse to overwrite). `--license` skips the interactive picker for CI /\n * automation use.\n */\n\nimport { realpathSync } from 'node:fs';\nimport { basename, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { parseArgs } from 'node:util';\n\nimport { cancel, intro, outro } from '@clack/prompts';\n\nimport { buildContentLicense, isValidSpdxInput } from './licenses.js';\nimport { promptLicense } from './prompts.js';\nimport { TargetDirectoryExistsError, writeProject } from './scaffold/index.js';\nimport { isValidWorkerName } from './scaffold/wrangler-toml.js';\n\ninterface CliArgs {\n readonly targetArg: string | undefined;\n readonly extraPositionals: readonly string[];\n readonly license: string | undefined;\n readonly help: boolean;\n}\n\nfunction parseCliArgs(argv: readonly string[]): CliArgs {\n const { values, positionals } = parseArgs({\n args: [...argv],\n allowPositionals: true,\n strict: true,\n options: {\n license: { type: 'string' },\n help: { type: 'boolean', short: 'h' },\n },\n });\n return {\n targetArg: positionals[0],\n extraPositionals: positionals.slice(1),\n license: values.license,\n help: values.help === true,\n };\n}\n\nfunction printHelp(): void {\n process.stdout.write(\n `Usage: create-takuhon <target-dir> [--license <spdxId>]\\n` +\n `\\n` +\n `Scaffolds a Takuhon profile deployment in <target-dir>.\\n` +\n `\\n` +\n `Options:\\n` +\n ` --license <spdxId> Skip the interactive license prompt and use the\\n` +\n ` given SPDX identifier (e.g. CC-BY-4.0, MIT,\\n` +\n ` Proprietary). Useful for CI / automation.\\n` +\n ` -h, --help Show this help.\\n`,\n );\n}\n\nasync function main(argv: readonly string[]): Promise<number> {\n let parsed: CliArgs;\n try {\n parsed = parseCliArgs(argv);\n } catch (err) {\n process.stderr.write(`${(err as Error).message}\\n\\n`);\n printHelp();\n return 2;\n }\n\n if (parsed.help) {\n printHelp();\n return 0;\n }\n\n if (parsed.targetArg === undefined) {\n process.stderr.write(`Error: missing target directory argument.\\n\\n`);\n printHelp();\n return 2;\n }\n\n if (parsed.extraPositionals.length > 0) {\n process.stderr.write(\n `Error: unexpected extra arguments: ${parsed.extraPositionals.join(' ')}\\n\\n`,\n );\n printHelp();\n return 2;\n }\n\n const targetDir = resolve(process.cwd(), parsed.targetArg);\n const projectName = basename(targetDir);\n\n if (!isValidWorkerName(projectName)) {\n process.stderr.write(\n `Error: target directory basename \"${projectName}\" is not a valid Cloudflare Worker name.\\n` +\n `Names must be lowercase, start and end with a letter or digit, and contain only ` +\n `letters, digits, and hyphens (max 63 chars).\\n`,\n );\n return 2;\n }\n\n intro('create-takuhon');\n\n let spdxId: string;\n if (parsed.license !== undefined) {\n const raw = parsed.license.trim();\n if (!isValidSpdxInput(raw)) {\n cancel(`Invalid --license value: \"${parsed.license}\"`);\n return 2;\n }\n spdxId = raw;\n } else {\n const result = await promptLicense();\n if ('cancelled' in result) {\n return 130;\n }\n spdxId = result.spdxId;\n }\n\n const license = buildContentLicense(spdxId);\n\n try {\n await writeProject({ targetDir, projectName, license });\n } catch (err) {\n if (err instanceof TargetDirectoryExistsError) {\n cancel(`Target directory already exists: ${parsed.targetArg}`);\n return 1;\n }\n throw err;\n }\n\n outro(\n `Created ${projectName} (license: ${spdxId}).\\n` +\n `\\n` +\n `Next steps:\\n` +\n ` cd ${parsed.targetArg}\\n` +\n ` pnpm install\\n` +\n ` # 1. Edit takuhon.json with your profile data\\n` +\n ` # 2. Provision Cloudflare KV: npx wrangler kv namespace create TAKUHON_KV\\n` +\n ` # 3. Set admin token: openssl rand -base64 32 | npx wrangler secret put TAKUHON_ADMIN_TOKEN\\n` +\n ` pnpm dev`,\n );\n\n return 0;\n}\n\n/**\n * Process entry point: run {@link main} and exit with its code. This is the\n * only function that calls `process.exit`, mirroring the `takuhon` entry in\n * `index.ts`. Exported so the `create-takuhon` redirect package can invoke it\n * after importing this module (`import { run } from '@takuhon/cli/init'`).\n */\nexport async function run(argv: readonly string[] = process.argv.slice(2)): Promise<void> {\n try {\n process.exit(await main(argv));\n } catch (err) {\n // Render only the message — full stack traces can leak host-machine\n // absolute paths and monorepo-internal layout into a published\n // binary's stderr output.\n process.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n process.exit(1);\n }\n}\n\n/** True when this module was started directly (`node …/init.js`). */\nfunction isEntrypoint(): boolean {\n const entry = process.argv[1];\n if (entry === undefined) return false;\n try {\n return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));\n } catch {\n return false;\n }\n}\n\nif (isEntrypoint()) {\n void run();\n}\n","/**\n * Content-license metadata and helpers for the `create-takuhon` scaffolding\n * flow.\n *\n * The four entries in `LICENSE_OPTIONS` are the curated choices the\n * interactive picker offers. \"Custom\" is handled separately by the prompt\n * flow as a free-form SPDX text input. `buildContentLicense` shapes the\n * chosen identifier into the `meta.contentLicense` fragment that lands in\n * the generated `takuhon.json`. The Takuhon profile JSON Schema accepts any\n * SPDX expression in `meta.contentLicense.spdxId`; unknown identifiers fall\n * through with `spdxId` only, and downstream UI rendering is best-effort.\n */\n\n/** A single row in the interactive license selector. */\nexport interface LicenseOption {\n /** Short label shown as the selectable label in the prompt. */\n readonly label: string;\n /** Longer hint shown alongside the label in the prompt UI. */\n readonly hint: string;\n /** SPDX identifier written to `takuhon.json` `meta.contentLicense.spdxId`. */\n readonly spdxId: string;\n /** Canonical license URL. Omitted for `Proprietary`. */\n readonly url?: string;\n}\n\n/**\n * The four curated license choices shown by the interactive picker. \"Custom\"\n * is not in this list because it triggers a free-form text prompt rather than\n * mapping to a fixed SPDX identifier here.\n */\nexport const LICENSE_OPTIONS: readonly LicenseOption[] = [\n {\n label: 'CC BY 4.0',\n hint: 'Allow reuse with attribution',\n spdxId: 'CC-BY-4.0',\n url: 'https://creativecommons.org/licenses/by/4.0/',\n },\n {\n label: 'CC BY-NC 4.0',\n hint: 'Non-commercial reuse with attribution',\n spdxId: 'CC-BY-NC-4.0',\n url: 'https://creativecommons.org/licenses/by-nc/4.0/',\n },\n {\n label: 'CC0',\n hint: 'Public domain',\n spdxId: 'CC0-1.0',\n url: 'https://creativecommons.org/publicdomain/zero/1.0/',\n },\n {\n label: 'Proprietary',\n hint: 'All rights reserved',\n spdxId: 'Proprietary',\n },\n];\n\n/**\n * Canonical URL lookup for SPDX identifiers we recognise but don't list in\n * the interactive picker. Used by `buildContentLicense` so that a user who\n * passes `--license CC-BY-SA-4.0` (or selects it via `Custom`) still gets a\n * usable `url` field in the generated `takuhon.json`.\n *\n * URLs for non-CC SPDX identifiers point at the canonical SPDX license page\n * (`spdx.org/licenses/<id>.html`). Creative Commons identifiers use the\n * `creativecommons.org` deed URL because that is the page humans expect to\n * land on (the SPDX page is metadata-only).\n */\nconst KNOWN_URL_BY_SPDX: Readonly<Record<string, string>> = {\n 'CC0-1.0': 'https://creativecommons.org/publicdomain/zero/1.0/',\n 'CC-BY-4.0': 'https://creativecommons.org/licenses/by/4.0/',\n 'CC-BY-SA-4.0': 'https://creativecommons.org/licenses/by-sa/4.0/',\n 'CC-BY-ND-4.0': 'https://creativecommons.org/licenses/by-nd/4.0/',\n 'CC-BY-NC-4.0': 'https://creativecommons.org/licenses/by-nc/4.0/',\n 'CC-BY-NC-SA-4.0': 'https://creativecommons.org/licenses/by-nc-sa/4.0/',\n 'CC-BY-NC-ND-4.0': 'https://creativecommons.org/licenses/by-nc-nd/4.0/',\n MIT: 'https://spdx.org/licenses/MIT.html',\n};\n\n/** Shape written to `takuhon.json` under `meta.contentLicense`. */\nexport interface ContentLicenseFragment {\n readonly spdxId: string;\n readonly url?: string;\n readonly rights?: string;\n}\n\n/**\n * Translate a chosen SPDX identifier into the `meta.contentLicense` fragment\n * for `takuhon.json`.\n *\n * - `Proprietary` is given a `rights` sentinel and no `url`.\n * - Known SPDX identifiers get a canonical `url`.\n * - Anything else is written as `{ spdxId }` only — the schema accepts\n * arbitrary SPDX expressions, and UI rendering is best-effort.\n */\nexport function buildContentLicense(spdxId: string): ContentLicenseFragment {\n if (spdxId === 'Proprietary') {\n return {\n spdxId: 'Proprietary',\n rights: 'All rights reserved. Contact owner for usage permission.',\n };\n }\n const url = KNOWN_URL_BY_SPDX[spdxId];\n if (url !== undefined) {\n return { spdxId, url };\n }\n return { spdxId };\n}\n\n/**\n * Light syntactic validation for a user-entered SPDX expression (the\n * `Custom` prompt branch and the `--license` flag).\n *\n * We accept any non-empty string composed of the characters that appear in\n * canonical SPDX identifiers and boolean expressions (alphanumerics, `.`,\n * `-`, `+`, parentheses, and literal spaces). Tabs and newlines are rejected\n * because real SPDX expressions never contain them. Full SPDX expression\n * parsing (`MIT OR (Apache-2.0 AND CC-BY-4.0)`) is intentionally out of\n * scope — we trust the user and let the JSON Schema's downstream validation\n * flag obvious problems.\n */\nexport function isValidSpdxInput(input: string): boolean {\n const trimmed = input.trim();\n if (trimmed === '') return false;\n return /^[A-Za-z0-9.\\-+() ]+$/.test(trimmed);\n}\n","/**\n * Interactive prompt flow for `create-takuhon`, built on `@clack/prompts`.\n *\n * A single-choice picker offers the curated `LICENSE_OPTIONS` plus a\n * `Custom` row that opens a free-form SPDX text input. Cancellation\n * (Ctrl+C or pressing Esc on a clack prompt) returns a sentinel result\n * instead of throwing so the caller can exit cleanly with a specific status\n * code.\n */\n\nimport { cancel, isCancel, select, text } from '@clack/prompts';\n\nimport { LICENSE_OPTIONS, isValidSpdxInput } from './licenses.js';\n\n/** Returned by {@link promptLicense} on successful completion. */\nexport interface PromptLicenseResult {\n /** SPDX identifier to write into `meta.contentLicense.spdxId`. */\n readonly spdxId: string;\n}\n\n/** Returned when the user cancels (Ctrl+C / Esc) instead of completing. */\nexport interface PromptCancelled {\n readonly cancelled: true;\n}\n\nconst CUSTOM_SENTINEL = '__custom__';\n\n/**\n * Run the license picker. Resolves to either the selected SPDX identifier or\n * a cancellation sentinel; never throws on user cancel.\n */\nexport async function promptLicense(): Promise<PromptLicenseResult | PromptCancelled> {\n const choice = await select<string>({\n message: 'Choose a license for your profile content:',\n options: [\n ...LICENSE_OPTIONS.map((opt) => ({\n value: opt.spdxId,\n label: opt.label,\n hint: opt.hint,\n })),\n { value: CUSTOM_SENTINEL, label: 'Custom', hint: 'enter SPDX identifier' },\n ],\n });\n\n if (isCancel(choice)) {\n cancel('Aborted.');\n return { cancelled: true };\n }\n\n if (choice !== CUSTOM_SENTINEL) {\n return { spdxId: choice };\n }\n\n const customRaw = await text({\n message: 'Enter the SPDX identifier:',\n placeholder: 'e.g. MIT, Apache-2.0, CC-BY-SA-4.0',\n validate(value): string | undefined {\n if (!isValidSpdxInput(value)) {\n return 'Must be a non-empty SPDX-like expression (alphanumerics, ., -, +, parentheses, spaces).';\n }\n return undefined;\n },\n });\n\n if (isCancel(customRaw)) {\n cancel('Aborted.');\n return { cancelled: true };\n }\n\n return { spdxId: customRaw.trim() };\n}\n","/**\n * Top-level scaffolding orchestrator for `create-takuhon`.\n *\n * `writeProject` is the single entry point used by `init.ts`. It creates the\n * target directory (must not already exist), then writes the eight files\n * that make up the scaffold: `takuhon.json`, `wrangler.toml`, `package.json`,\n * `README.md`, `.gitignore`, `.env.example`, `tsconfig.json`, and\n * `src/index.ts` (the Cloudflare Worker entry composed via\n * `createTakuhonWorker` from `@takuhon/cloudflare`).\n */\n\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\nimport { renderEnvExample } from './env-example.js';\nimport { renderGitignore } from './gitignore.js';\nimport { renderPackageJson } from './package-json.js';\nimport { renderReadme } from './readme.js';\nimport { renderTakuhonJson } from './takuhon-json.js';\nimport { renderTsconfigJson } from './tsconfig-json.js';\nimport { renderWorkerIndexTs } from './worker-index-ts.js';\nimport { renderWranglerToml } from './wrangler-toml.js';\n\nexport interface WriteProjectOptions {\n /** Absolute path of the directory to create. Must not exist. */\n readonly targetDir: string;\n /** Used for the npm `name`, Worker name, and README header. */\n readonly projectName: string;\n /** Chosen content license (already mapped via `buildContentLicense`). */\n readonly license: ContentLicenseFragment;\n}\n\nexport interface WriteProjectResult {\n /** Relative paths of files that were written (in the order written). */\n readonly files: readonly string[];\n}\n\n/**\n * Error thrown when the target directory already exists. The caller is\n * expected to render a friendly message that references the user-supplied\n * path; the `code` is stable for tests. The absolute `targetDir` is exposed\n * as a field rather than embedded in the message so that bubbling the error\n * up through generic logging does not leak filesystem layout.\n */\nexport class TargetDirectoryExistsError extends Error {\n override readonly name = 'TargetDirectoryExistsError';\n readonly code = 'TARGET_EXISTS' as const;\n constructor(readonly targetDir: string) {\n super('Target directory already exists.');\n }\n}\n\n/**\n * Create the project directory and write the scaffolded files. Order is\n * deterministic so callers (and tests) can rely on it.\n */\nexport async function writeProject(opts: WriteProjectOptions): Promise<WriteProjectResult> {\n const { targetDir, projectName, license } = opts;\n\n // mkdir with recursive: false fails if the directory exists; we surface a\n // typed error so the CLI entry can render a friendly message.\n try {\n await mkdir(targetDir, { recursive: false });\n } catch (err) {\n if (isNodeErrnoException(err) && err.code === 'EEXIST') {\n throw new TargetDirectoryExistsError(targetDir);\n }\n throw err;\n }\n\n const files: { readonly path: string; readonly content: string }[] = [\n { path: 'takuhon.json', content: renderTakuhonJson(license) },\n { path: 'wrangler.toml', content: renderWranglerToml(projectName) },\n { path: 'package.json', content: renderPackageJson({ projectName }) },\n { path: 'README.md', content: renderReadme({ projectName, license }) },\n { path: '.gitignore', content: renderGitignore() },\n { path: '.env.example', content: renderEnvExample() },\n { path: 'tsconfig.json', content: renderTsconfigJson() },\n { path: 'src/index.ts', content: renderWorkerIndexTs() },\n ];\n\n for (const { path, content } of files) {\n const fullPath = join(targetDir, path);\n const parent = dirname(fullPath);\n if (parent !== targetDir) {\n await mkdir(parent, { recursive: true });\n }\n await writeFile(fullPath, content, 'utf8');\n }\n\n return { files: files.map((f) => f.path) };\n}\n\nfunction isNodeErrnoException(err: unknown): err is NodeJS.ErrnoException {\n return err instanceof Error && typeof (err as NodeJS.ErrnoException).code === 'string';\n}\n","/**\n * Generator for the `.env.example` file in a freshly scaffolded project.\n *\n * The Wrangler-managed secrets (admin bearer token) are *not* read from `.env`\n * at deploy time — `wrangler secret put` is the source of truth. The\n * `.env.example` is therefore documentation: it lists the variables a developer\n * may want locally (e.g. for scripting or for the wrangler CLI itself) and\n * links each to its production provisioning path.\n */\n\nexport function renderEnvExample(): string {\n return `# ----------------------------------------------------------------\n# Local development variables for this Takuhon deployment.\n#\n# Production secrets (admin token) are provisioned via:\n# wrangler secret put TAKUHON_ADMIN_TOKEN\n# This file is a hint for local tooling, not a runtime source.\n# ----------------------------------------------------------------\n\n# Admin bearer token for /api/admin/* endpoints.\n# Generate with: openssl rand -base64 32\n# Then provision with:\n# echo \"$TAKUHON_ADMIN_TOKEN\" | wrangler secret put TAKUHON_ADMIN_TOKEN\nTAKUHON_ADMIN_TOKEN=\n\n# Comma-separated Origin allowlist for browser-originating admin requests.\n# Set in wrangler.toml [vars] for production. Local example:\n# TAKUHON_ADMIN_ORIGIN=https://admin.example.com,https://localhost:8787\nTAKUHON_ADMIN_ORIGIN=\n\n# Cloudflare account id (look up via \\`wrangler whoami\\`). Only needed if you\n# script Cloudflare API calls outside Wrangler itself.\nCLOUDFLARE_ACCOUNT_ID=\n`;\n}\n","/**\n * Generator for the scaffolded project's `.gitignore`.\n *\n * Covers Node, Wrangler local cache, and environment files. Kept conservative\n * — no opinions about lockfile preferences (the user picks their package\n * manager) or editor folders (per-editor patterns belong in a global ignore).\n */\n\nexport function renderGitignore(): string {\n return `# Dependencies\nnode_modules/\n\n# Wrangler local cache (do not commit; contains bundled output and tmp files)\n.wrangler/\n\n# Environment variables (commit \\`.env.example\\` instead)\n.env\n.env.local\n.env.*.local\n\n# Logs\n*.log\nnpm-debug.log*\npnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# macOS\n.DS_Store\n`;\n}\n","/**\n * Generator for the scaffolded project's `package.json`.\n *\n * Pinned dependency versions are caret ranges matched to the current\n * minor of the published `@takuhon/*` packages. Under 0.x semver, a caret\n * does not span minor versions, so the range must move forward with each\n * `@takuhon/core` minor release to keep scaffolded projects on the\n * matching schema generation. A guard test (`scaffold.test.ts`) asserts these\n * pins track the published minor, so a missed bump fails CI rather than\n * silently shipping a stale range. `hono` is included as a direct dependency for\n * projects that extend the Worker with their own Hono routes; the generated\n * `src/index.ts` reaches Takuhon's handlers through `@takuhon/cloudflare`\n * rather than importing `hono` directly. `wrangler` is a devDependency since\n * it's the deploy / dev-server tool.\n */\n\nexport interface PackageJsonOptions {\n /** Used for the npm `name` field. */\n readonly projectName: string;\n}\n\nexport function buildPackageJson(opts: PackageJsonOptions): Record<string, unknown> {\n return {\n name: opts.projectName,\n version: '0.0.0',\n private: true,\n type: 'module',\n description: 'Takuhon profile deployment.',\n scripts: {\n dev: 'wrangler dev',\n deploy: 'wrangler deploy',\n },\n dependencies: {\n '@takuhon/api': '^0.9.0',\n '@takuhon/cloudflare': '^0.9.0',\n '@takuhon/core': '^0.9.0',\n hono: '^4.0.0',\n },\n devDependencies: {\n wrangler: '^4.0.0',\n },\n engines: {\n node: '>=22.0.0',\n },\n };\n}\n\nexport function renderPackageJson(opts: PackageJsonOptions): string {\n return `${JSON.stringify(buildPackageJson(opts), null, 2)}\\n`;\n}\n","/**\n * Generator for the README.md placed in a freshly scaffolded project.\n *\n * Aims to give a first-time user enough to (1) install dependencies,\n * (2) fill in their profile data, (3) provision Cloudflare KV + admin\n * secret, and (4) `pnpm dev` / `pnpm deploy`. Cross-references the published\n * `@takuhon/cloudflare` adapter README as the next-step reference for the\n * route map.\n */\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\nexport interface ReadmeOptions {\n readonly projectName: string;\n readonly license: ContentLicenseFragment;\n}\n\n/**\n * Human-readable license attribution line for the README footer. Uses the\n * canonical URL when available; falls back to plain SPDX (or\n * \"All rights reserved\" for Proprietary).\n */\nfunction formatLicenseLine(license: ContentLicenseFragment): string {\n if (license.spdxId === 'Proprietary') {\n return '**Proprietary** — all rights reserved.';\n }\n if (license.url !== undefined) {\n return `[\\`${license.spdxId}\\`](${license.url})`;\n }\n return `\\`${license.spdxId}\\``;\n}\n\nexport function renderReadme(opts: ReadmeOptions): string {\n const { projectName, license } = opts;\n const licenseLine = formatLicenseLine(license);\n return `# ${projectName}\n\nA [Takuhon](https://github.com/takuhon-dev/takuhon) profile deployment, running on Cloudflare Workers.\n\n> **Status**: pre-deploy. Edit \\`takuhon.json\\`, provision Cloudflare KV, then \\`pnpm deploy\\`.\n\n## What is Takuhon?\n\nTakuhon lets you own your profile as a portable JSON document and publish it as a mobile-first profile page plus a public API (JSON-LD for AI agents and search engines included).\n\n## Setup\n\n1. **Install dependencies.**\n\n \\`\\`\\`sh\n pnpm install\n \\`\\`\\`\n\n2. **Edit your profile.** Open \\`takuhon.json\\` and replace the sample fields (\\`profile.displayName\\`, \\`links\\`, \\`careers\\`, \\`projects\\`, \\`skills\\`) with your own.\n\n3. **Create the Cloudflare KV namespaces** and copy the returned ids into \\`wrangler.toml\\`:\n\n \\`\\`\\`sh\n npx wrangler kv namespace create TAKUHON_KV\n npx wrangler kv namespace create TAKUHON_KV --preview\n \\`\\`\\`\n\n4. **Provision the admin token** as a Wrangler secret (used by \\`/api/admin/*\\`):\n\n \\`\\`\\`sh\n openssl rand -base64 32 | npx wrangler secret put TAKUHON_ADMIN_TOKEN\n \\`\\`\\`\n\n Leaving the secret unset disables admin writes entirely (every \\`PUT\\` / \\`DELETE\\` returns 401).\n\n## Develop\n\nThe Worker entry at \\`src/index.ts\\` composes the takuhon adapter via\n\\`createTakuhonWorker\\` and serves your \\`takuhon.json\\` as the fallback when\nKV has no stored profile yet.\n\n\\`\\`\\`sh\npnpm dev # runs \\`wrangler dev\\` locally\n\\`\\`\\`\n\nThe full route map (public + admin) is documented in the [\\`@takuhon/cloudflare\\` README](https://github.com/takuhon-dev/takuhon/tree/main/adapters/cloudflare#readme).\n\n## Deploy\n\n\\`\\`\\`sh\npnpm deploy # runs \\`wrangler deploy\\`\n\\`\\`\\`\n\n## License\n\nProfile content (\\`takuhon.json\\`) is licensed under ${licenseLine}\n\nThe deployment code is your own; pick a license appropriate for it.\n`;\n}\n","/**\n * Generator for the `takuhon.json` file written into a freshly scaffolded\n * project.\n *\n * The template is a copy of `examples/minimal-profile/takuhon.json` from the\n * monorepo. It is inlined here as a TypeScript constant rather than imported\n * from `examples/` so the published `@takuhon/cli` npm package does not need\n * to ship the examples directory.\n *\n * Only `meta.contentLicense` is rewritten per the user's choice; everything\n * else is the canonical minimal profile (one career, one project, three\n * skills, `en` locale only) that downstream `@takuhon/core` validation\n * already accepts (see `packages/core/src/__tests__/examples-fixtures.test.ts`).\n */\n\nimport type { ContentLicenseFragment } from '../licenses.js';\n\n/**\n * Build the `takuhon.json` payload as a deterministic, schema-valid object.\n * `meta.contentLicense` is filled from the supplied fragment so each\n * generated project carries the user's chosen SPDX identifier (and `url` /\n * `rights` where applicable).\n */\nexport function buildTakuhonJson(license: ContentLicenseFragment): unknown {\n return {\n schemaVersion: '0.4.0',\n profile: {\n displayName: {\n en: 'Sam Lee',\n },\n },\n links: [\n {\n id: 'github',\n type: 'github',\n url: 'https://example.com/github/sam-lee',\n featured: true,\n },\n ],\n careers: [\n {\n id: 'first-job',\n organization: {\n en: 'Example Co.',\n },\n role: {\n en: 'Junior Software Engineer',\n },\n startDate: '2026-04',\n endDate: null,\n isCurrent: true,\n },\n ],\n projects: [\n {\n id: 'personal-homepage',\n title: {\n en: 'Personal homepage',\n },\n },\n ],\n skills: [\n { id: 'html', label: 'HTML' },\n { id: 'css', label: 'CSS' },\n { id: 'javascript', label: 'JavaScript' },\n ],\n contact: {},\n settings: {\n defaultLocale: 'en',\n availableLocales: ['en'],\n },\n meta: {\n contentLicense: { ...license },\n },\n };\n}\n\n/** Serialise to a UTF-8 string with trailing newline (POSIX-friendly). */\nexport function renderTakuhonJson(license: ContentLicenseFragment): string {\n return `${JSON.stringify(buildTakuhonJson(license), null, 2)}\\n`;\n}\n","/**\n * Generator for the scaffolded project's `tsconfig.json`.\n *\n * Minimal configuration that makes the generated `src/index.ts` typecheck\n * with `tsc --noEmit` in a freshly scaffolded directory. The settings\n * mirror the upstream takuhon monorepo defaults (ES2022 target, ESNext\n * modules, strict mode, `noUncheckedIndexedAccess`) and explicitly enable\n * the two flags the Worker entry depends on:\n *\n * - `resolveJsonModule` — so `import takuhonJson from '../takuhon.json'`\n * resolves at type-check time.\n * - `moduleResolution: \"Bundler\"` — so the Wrangler / esbuild-style\n * resolution (no need for explicit file extensions) is the source of\n * truth that matches what `wrangler dev` actually runs.\n *\n * `noEmit: true` keeps `tsc` purely a type-checker; Wrangler's bundler\n * produces the deployable artifact.\n */\n\nexport function renderTsconfigJson(): string {\n const config = {\n compilerOptions: {\n target: 'ES2022',\n lib: ['ES2022'],\n module: 'ESNext',\n moduleResolution: 'Bundler',\n esModuleInterop: true,\n resolveJsonModule: true,\n isolatedModules: true,\n verbatimModuleSyntax: true,\n strict: true,\n noUncheckedIndexedAccess: true,\n noImplicitOverride: true,\n noFallthroughCasesInSwitch: true,\n skipLibCheck: true,\n noEmit: true,\n },\n include: ['src/**/*'],\n exclude: ['node_modules'],\n };\n return `${JSON.stringify(config, null, 2)}\\n`;\n}\n","/**\n * Generator for `src/index.ts` — the Cloudflare Worker entry file written\n * into a freshly scaffolded project.\n *\n * The generated file uses `createTakuhonWorker()` from `@takuhon/cloudflare`\n * so the scaffolded project does not need to know the internal wiring\n * (Hono router, KV-backed storage, edge cache purger, console audit logger).\n * The user's own `takuhon.json` is loaded via an ES module JSON import,\n * validated once at module load, and the resulting `Takuhon` value is\n * served as the fallback when KV has no stored profile yet.\n *\n * `wrangler.toml`'s `main` field already points at `src/index.ts`, and\n * `nodejs_compat` is enabled, so the file works under `wrangler dev` /\n * `wrangler deploy` without further configuration.\n */\n\nexport function renderWorkerIndexTs(): string {\n return `import { createTakuhonWorker } from '@takuhon/cloudflare';\nimport { validate } from '@takuhon/core';\n\n// Use the project's own takuhon.json as the fallback served when KV has no\n// stored profile yet. Validated once at module load so a malformed profile\n// fails fast rather than at first request.\nimport takuhonJson from '../takuhon.json' with { type: 'json' };\n\nconst fallback = validate(takuhonJson);\nif (!fallback.ok) {\n throw new Error(\n 'Project takuhon.json failed validation: ' +\n fallback.errors.map((e) => \\`\\${e.pointer}: \\${e.message}\\`).join('; '),\n );\n}\n\nconst fallbackTakuhon = fallback.data;\n\nexport default createTakuhonWorker({\n fallback: () => fallbackTakuhon,\n});\n`;\n}\n","/**\n * Generator for `wrangler.toml` in a freshly scaffolded project.\n *\n * The layout mirrors the reference Cloudflare adapter shipped in this\n * monorepo: a single KV namespace `TAKUHON_KV`, placeholder ids the user\n * fills in after running `wrangler kv namespace create`, and the\n * `TAKUHON_ADMIN_ORIGIN` var defaulting to \"\" (disabled). The admin bearer\n * token is provisioned as a Wrangler secret and is therefore not in this file.\n */\n\n/**\n * Validate a Cloudflare Worker name.\n *\n * Cloudflare itself accepts mixed-case DNS labels (1–63 chars, must not\n * start or end with a hyphen). This validator additionally enforces a\n * lowercase convention chosen for the scaffolder so that the resulting\n * `workers.dev` subdomain is predictable and matches the npm `name` field.\n */\nexport function isValidWorkerName(name: string): boolean {\n return /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(name);\n}\n\n/**\n * Render `wrangler.toml` for the given project name.\n *\n * Throws if `projectName` is not a valid Cloudflare Worker name. Callers are\n * responsible for sanitising/validating earlier in the prompt flow.\n */\nexport function renderWranglerToml(projectName: string): string {\n if (!isValidWorkerName(projectName)) {\n throw new Error(\n `Invalid Cloudflare Worker name: \"${projectName}\". Names must be lowercase, ` +\n `start with a letter or digit, and contain only letters, digits, and hyphens (max 63 chars).`,\n );\n }\n return `name = \"${projectName}\"\nmain = \"src/index.ts\"\ncompatibility_date = \"2026-05-01\"\ncompatibility_flags = [\"nodejs_compat\"]\n\n# Replace the placeholder ids after running:\n# wrangler kv namespace create TAKUHON_KV\n# wrangler kv namespace create TAKUHON_KV --preview\n[[kv_namespaces]]\nbinding = \"TAKUHON_KV\"\nid = \"REPLACE_WITH_PRODUCTION_NAMESPACE_ID\"\npreview_id = \"REPLACE_WITH_PREVIEW_NAMESPACE_ID\"\n\n# Admin Origin allowlist (comma-separated). Empty value disables the check.\n# Example for production: TAKUHON_ADMIN_ORIGIN = \"https://admin.example.com\"\n#\n# The admin bearer token MUST be provisioned as a Wrangler secret, never in\n# this file:\n# wrangler secret put TAKUHON_ADMIN_TOKEN\n# Use 32+ bytes of entropy, e.g. \\`openssl rand -base64 32\\`.\n[vars]\nTAKUHON_ADMIN_ORIGIN = \"\"\n`;\n}\n"],"mappings":";;;AAaA,SAAS,oBAAoB;AAC7B,SAAS,UAAU,eAAe;AAClC,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,SAAS,UAAAA,SAAQ,OAAO,aAAa;;;ACY9B,IAAM,kBAA4C;AAAA,EACvD;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,IACN,Q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B;AACxF,MAAI;AACF,YAAQ,KAAK,MAAM,KAAK,IAAI,CAAC;AAAA,EAC/B,SAAS,KAAK;AAIZ,YAAQ,OAAO,MAAM,GAAG,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AAC5E,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAGA,SAAS,eAAwB;AAC/B,QAAM,QAAQ,QAAQ,KAAK,CAAC;AAC5B,MAAI,UAAU,OAAW,QAAO;AAChC,MAAI;AACF,WAAO,aAAa,KAAK,MAAM,aAAa,cAAc,YAAY,GAAG,CAAC;AAAA,EAC5E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAI,aAAa,GAAG;AAClB,OAAK,IAAI;AACX;","names":["cancel","cancel"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takuhon/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "create-takuhon scaffolding plus dev/validate/sync/export/migrate/restore commands",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Takuhon contributors",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@clack/prompts": "^0.11.0",
|
|
55
|
-
"@takuhon/core": "0.
|
|
55
|
+
"@takuhon/core": "0.9.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"typecheck": "tsc",
|