feat(cli): prepare and validate workspace documents offline

Reuse the runtime catalog and workspace parsers in a standalone helper paired with tht. Add document templates, safe diagnostics, local Evidence checks, native bundle builds, shared CLI fixtures and IT/EN preparation guides. Record the approved document-first specification and ticket breakdown. Refs #43.
This commit is contained in:
Codex
2026-09-28 15:35:25 +02:00
parent 67ee52624c
commit 64e6b9664a
20 changed files with 2195 additions and 4 deletions
+41
View File
@@ -1,5 +1,46 @@
# Native installation CLI
## Offline workspace documents (issue #43)
`tht workspace prepare --directory NEW_PATH --id ID --name NAME [--language en|it]`
creates an ad hoc workspace repository template. `tht workspace validate --directory
PATH [--json]` checks the working documents without an installation descriptor or
services. Both commands invoke the packaged sibling `tht-workspace-documents`, which
compiles the canonical backend YAML/Zod parsers with its runtime. Neither Node nor
Bun is required on the user's computer. Validation never writes documents or Git
configuration. See the [IT](../../docs/install/standalone-manual-it.md) and
[EN](../../docs/install/standalone-manual-en.md) guides for the correction loop and
explicit runtime checks that local validation cannot satisfy.
Maintainer build (Go from `go.mod`, Node/npm for build only):
```sh
cd backend
npm ci
npm run build:workspace-tools
# Cross-compile the complete platform pairs:
npm run build:workspace-tools -- --all
```
The output is `dist/workspace-tools/<os>-<arch>/` containing `tht[.exe]`,
`tht-workspace-documents[.exe]`, `SHA256SUMS` and `build.json`. Individual targets:
`windows-amd64`, `linux-amd64`, `linux-arm64`, `darwin-amd64`, `darwin-arm64`.
Bun is pinned in `backend/package-lock.json`; compilation embeds the runtime, and
cross-compilation may download the selected Bun target. Deliver the complete pair
from one build, verify checksums and keep the executables together. The previous
`build-tht.sh` / `install-tht.sh` single-binary path remains for existing operator
commands; it does not package this helper. Release publication is tracked separately
in issue #46; building a Windows/Linux artifact does not establish acceptance there.
Run the same public CLI fixture corpus against the native pair, with subprocess
`PATH` deliberately empty:
```sh
cd backend
THT_WORKSPACE_TEST_CLI=/absolute/path/dist/workspace-tools/darwin-arm64/tht \
npx vitest run test/workspace-documents-cli.test.ts
```
## Shell configuration
The schema-v2 `thothii-installation.yaml` accepts this optional section: