deco-reconcile sai com 0 sem fazer nada quando invocado via npx

Open Beginner friendly
#515 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
cli, tooling

Research direction

Start with packages/blocks-cli/scripts/reconcile.ts and inspect the bin entries in packages/blocks-cli/package.json, including any other scripts using the same guard pattern. Reproduce through the published-style npx invocation and verify that deco-reconcile runs main(), produces output, creates .reconcile/, and exits correctly when work exists.

Written by the indexing model from the issue text.

Description

Modo de falha

deco-reconcile invocado pelo bin publicado sai com código 0, não imprime nada e não cria .reconcile/. Para quem está rodando uma reconciliação, isso é indistinguível de "não havia nada a conciliar" — e nesse caso havia (1 arquivo).

Repro, com @decocms/blocks-cli@7.54.0:

npx -p @decocms/blocks-cli deco-reconcile \
  --source /path/to/site-fresh \
  --target /path/to/site-tanstack \
  --snapshot <sha> --target-snapshot <sha> --verbose
# (sem saída)
# EXIT=0

Causa

Última linha de packages/blocks-cli/scripts/reconcile.ts:

if (process.argv[1] && /reconcile\.ts$/.test(process.argv[1])) main();

O npm/npx expõe o bin como symlink node_modules/.bin/deco-reconcile. O shebang #!/usr/bin/env tsx executa com process.argv[1] = o caminho do symlink, que não casa /reconcile\.ts$/. main() nunca roda.

O guard só passa quando o arquivo é invocado pelo caminho literal — que é como os testes e o desenvolvimento local rodam, então passa despercebido.

Contorno

npx tsx packages/blocks-cli/scripts/reconcile.ts --source ... --target ...

Sugestão

Trocar o guard por uma comparação de realpath do módulo em vez de regex sobre o basename de argv[1], ou simplesmente chamar main() incondicionalmente (o arquivo não é reexportado por exports no package.json — só existe como bin).

Vale checar os outros bins de packages/blocks-cli/package.json que usem o mesmo padrão de guard.

Onde apareceu

Rodada de reconciliação deco-sites/zee-tanstack (origem Deno 429e20e..91b36b2) — https://github.com/deco-sites/zee-tanstack/pull/46

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
5
Forks
2
Avg merge
20h 12m
Merged PRs (30d)
36

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from decocms/blocks

All issues in decocms/blocks

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.