@takuhon/cli 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @takuhon/cli
2
2
 
3
- The Takuhon CLI, including `create-takuhon` scaffolding and the `takuhon` command (dev/validate/sync/export/migrate/restore).
3
+ The Takuhon command-line interface: `create-takuhon` project scaffolding and the `takuhon` command for working with a local `takuhon.json` — validate, migrate, restore, export, import, build, and a local preview server.
4
4
 
5
- > Phase 1 skeleton. Implementations land in subsequent commits.
5
+ ## Installation
6
+
7
+ Run without installing, via `npx`:
8
+
9
+ ```sh
10
+ npx create-takuhon my-profile # scaffold a new project
11
+ npx takuhon validate # run a command in an existing project
12
+ ```
13
+
14
+ Or install the `takuhon` command globally / as a dev dependency:
15
+
16
+ ```sh
17
+ npm install -g takuhon
18
+ # or, inside a project:
19
+ pnpm add -D @takuhon/cli
20
+ ```
21
+
22
+ The bare-name `takuhon` package is a thin redirect to `@takuhon/cli`, so `npx takuhon …` and a global install expose the same `takuhon` command. ESM-only; targets Node.js 22+.
23
+
24
+ ## Scaffolding a new project
25
+
26
+ ```sh
27
+ npx create-takuhon my-profile
28
+ npx create-takuhon my-profile --license CC-BY-4.0 # non-interactive license
29
+ ```
30
+
31
+ `create-takuhon` writes a Cloudflare Worker deployment — a `wrangler.toml`, a starter `takuhon.json`, a `tsconfig.json`, and a Worker entry that composes Takuhon via `@takuhon/cloudflare`. Run `create-takuhon --help` for options.
32
+
33
+ ## Commands
34
+
35
+ Each command operates on a local `takuhon.json` (default `./takuhon.json`) and reuses `@takuhon/core`. Pure-data commands return an exit code (`0` success, `1` invalid profile, `2` operational error).
36
+
37
+ | Command | Description |
38
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `takuhon validate [path]` | Validate a `takuhon.json` against the schema, reporting each failure as a JSON Pointer. |
40
+ | `takuhon migrate [path] [--to <v>]` | Forward-migrate to a newer schema version (default: latest). Backs up first; supports `--out`, `--dry-run`. |
41
+ | `takuhon restore --from <backup>` | Restore a profile from a backup (prompts before overwriting; pass `--yes` to skip). |
42
+ | `takuhon export [path] [--output <f>]` | Serialise a `takuhon.json` to stdout (or to `--output`). |
43
+ | `takuhon import <file> [path]` | Import an exported profile, migrating it to the current schema version. Backs up first. |
44
+ | `takuhon build [path] [--output <d>]` | Render the profile into a static site — one HTML page per locale with build-time JSON-LD. `--base-url` adds absolute canonical/hreflang links. |
45
+ | `takuhon dev [path] [--port <n>]` | Serve the profile as a local static preview, re-rendered on each request (default port `4321`, loopback only). `--base-url` adds canonical/hreflang links. |
46
+
47
+ Run `takuhon --help`, or `takuhon <command> --help` for a command's full usage. The `sync` subcommand (mirror a local `takuhon.json` to a remote instance) is planned for a future release.
48
+
49
+ ## License
50
+
51
+ Apache-2.0. See `LICENSE` and `NOTICE` at the repository root.
package/dist/index.d.ts CHANGED
@@ -1 +1,23 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * `@takuhon/cli` entry point — the `takuhon` command.
4
+ *
5
+ * Exposes `--version` / `--help`, the local profile commands (`validate`,
6
+ * `migrate`, `restore`, `export`, `import`, `build`, `dev`), and a pointer to
7
+ * `create-takuhon` for scaffolding. The `sync` subcommand lands in a subsequent
8
+ * release.
9
+ *
10
+ * `main` is pure (returns an exit code, never calls `process.exit`); the only
11
+ * place that exits the process is {@link run}, invoked either when this module
12
+ * is the entry script or by the bare-name `takuhon` package's `bin.mjs`, which
13
+ * imports and calls `run()`. Keeping `process.exit` at that single boundary
14
+ * lets tests import this module without terminating the test runner.
15
+ */
16
+ /**
17
+ * Process entry point: run {@link main} and exit with its code. This is the
18
+ * only function that calls `process.exit`. Exported so the bare-name
19
+ * `takuhon` package can invoke it after importing this module.
20
+ */
21
+ declare function run(argv?: readonly string[]): Promise<void>;
22
+
23
+ export { run };