Skip to content

Add npx claude-translator init - #3

Merged
alexburan merged 1 commit into
mainfrom
feat/cli-installer
Aug 25, 2026
Merged

Add npx claude-translator init#3
alexburan merged 1 commit into
mainfrom
feat/cli-installer

Conversation

@alexburan

Copy link
Copy Markdown
Contributor

Why

Installing was four manual steps: clone, copy scripts, npm i parse5, copy config. Now it is one command — and the four steps still work for anyone who prefers them.

What init does

Copies the pipeline into scripts/i18n/ (or --dir), writes i18n.config.json, declares parse5, and appends the derived i18n/ paths to .gitignore — deliberately not i18n/tm/{lang}.json, because the translation memory is the asset and ignoring it is how people end up paying twice.

Two rules it does not break: it never overwrites without --force, and it prints every path it touched. Both are covered by tests rather than by intent — a scaffolder that quietly clobbers a config someone has edited is worse than no scaffolder.

The scripts are copied rather than run from node_modules on purpose: they resolve parse5 and every relative path from the project they live in, they are short enough to read, and this is AGPL software whose point is that you can change them.

Packaging

  • "files" allowlist — the tarball carries bin, scripts, references, SKILL.md and the example config. 27 files, nothing stray.
  • parse5 moved to devDependencies. Nothing in the published package needs it at runtime (the CLI only copies files), so npx no longer downloads it. A clone plus npm install is unaffected.

Verification

Tested through the real package path, not by running the source: npm pack → install the tarball into a clean project → init → drive extract → translate → build-locales → verify to ALL GATES PASSED with a local stand-in provider.

CI now does the same on every PR, so a broken published package fails the build instead of a user's first command.

12 CLI contract tests cover:

  • refusing to install outside a Node project, and leaving nothing behind when it refuses
  • idempotency — a second init overwrites nothing and says so
  • --force being the only way to replace an edited file
  • --dir (including that the printed next-steps reference the chosen directory)
  • appending to an existing .gitignore rather than replacing it
  • package.json "files" actually shipping what init copies

⚠️ Not published yet

There are no npm credentials on the machine this was built on, so npx claude-translator init will not resolve until someone runs npm login && npm publish. The README documents running the scaffolder from a clone as the alternative in the meantime.

Installing was four manual steps: clone, copy scripts, npm i parse5, copy
config. Now it is one command, and the four steps still work for anyone who
prefers them.

bin/claude-translator.mjs copies the pipeline into scripts/i18n/ (or --dir),
writes i18n.config.json, declares parse5, and appends the derived i18n/ paths
to .gitignore — deliberately NOT i18n/tm/{lang}.json, because the memory is
the asset and ignoring it is how people pay twice.

Two rules it does not break: it never overwrites without --force, and it
prints every path it touched. A scaffolder that quietly clobbers a config
someone has edited is worse than no scaffolder, so both are covered by tests
rather than by intent.

The scripts are copied rather than run from node_modules on purpose. They
resolve parse5 and every relative path from the project they live in, they
are short enough to read, and this is AGPL software whose point is that you
can change them.

Packaging
- "files" allowlist so the tarball carries bin, scripts, references, SKILL.md
  and the example config, and nothing else — 27 files
- parse5 moved to devDependencies. Nothing in the published package needs it
  at runtime, so npx no longer downloads it; a clone plus npm install is
  unaffected

Verified through the real package path rather than by running the source:
npm pack, install the tarball into a clean project, run init, then drive
extract -> translate -> build-locales -> verify to ALL GATES PASSED using a
local stand-in provider. CI now does the same on every PR, so a broken
published package fails the build instead of a user's first command.

12 CLI contract tests cover the refusal to install outside a Node project
(and that it leaves nothing behind), idempotency, --force, --dir, appending
to an existing .gitignore rather than replacing it, and that package.json
"files" actually ships what init copies.

Not yet published to npm — no credentials on this machine. Until it is,
`npx claude-translator init` will not resolve; the README documents running
the scaffolder from a clone as the alternative.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alexburan
alexburan merged commit bb022e8 into main Aug 25, 2026
1 check passed
@alexburan
alexburan deleted the feat/cli-installer branch August 25, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant