flisk resource <existing> --framework express / -t frontend exits 0 and silently ignores the flag (resource stays hono/backend), while --port on the same call is applied

Aperta
#178 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
cli

Direzione di ricerca

Start at the flisk resource command implementation and read the existing resource registration path, then inspect nearby tests for flag handling and idempotent re-registration. Reproduce the four commands in the issue and trace how --framework, --type, --port, and --stack are handled. Done means conflicting flags receive the documented error or warning, no-flag re-registration still succeeds, and tests cover both cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: cli bug dx exit-code good first issue has-repro needs-test priority:medium silent-failure tdd

Summary

Re-running flisk resource <name> on a resource that already exists reports action: "registered" with exit 0, but --framework and -t/--type are dropped without a warning. --port is applied on the same path, and --stack fails with a hard error, so the handling of flags on an existing resource is inconsistent. A user or agent that passes --framework express gets exit 0 and no sign that nothing changed.

Related: #85 covers the same silent-ignore pattern for --type on a name that exists with a different type. This issue adds --framework, the --port vs --framework inconsistency, and the --stack rejection.

Reproduce

Flisk and tool versions: not investigated (not given in the evidence).

mkdir -p "/tmp/wf-cli-create-run/dir with space/p1" && cd "/tmp/wf-cli-create-run/dir with space/p1"
flisk project --yes --json >/dev/null 2>&1
flisk resource api1 --yes --json            # creates backend hono bun, port 4000
flisk resource api1 --framework express --yes --json; echo "exit=$?"
flisk resource api1 -t frontend --yes --json; echo "exit=$?"
flisk resource api1 --port 4999 --yes --json; echo "exit=$?"
flisk resource api1 --stack other --yes --json; echo "exit=$?"

Reproduced in 2 runs, with the same result each time.

Before

Observed behaviour on the existing resource api1 (created as backend, hono, bun, port 4000):

Flag passed to existing resource Exit Observed result Applied?
--framework express 0 {"action":"registered","type":"backend","framework":"hono","port":4000,...}; stderr only says "Existing resource detected - will update service.json only" No (silently ignored)
-t frontend 0 action: "registered", type: "backend" No (silently ignored)
--port 4999 0 port changes 4000 -> 4999 Yes
--stack other 1 A resource named "api1" already exists at services/main/api1. Rejected

Summary: of 4 flags passed to an existing resource, 1 was applied, 2 were silently ignored with exit 0, and 1 was rejected.

After

Expected:

  • A flag that conflicts with the existing resource (--framework, --type, --language) fails with a non-zero exit and a message such as api1 already exists as backend/hono; drop --framework or pick another name.
  • Or, at minimum, a warning is printed and the ignored flags are listed in the JSON envelope.
  • Handling of --port, --stack and --framework is consistent.

Acceptance criteria

  • flisk resource api1 --framework express --yes on an existing hono backend exits non-zero, or prints a warning and lists the ignored flag in the --json output. It must not exit 0 silently.
  • flisk resource api1 -t frontend --yes on an existing backend gets the same treatment as --framework.
  • --port, --stack and --framework on an existing resource follow one documented rule.
  • A test covers the conflicting-flag case on an existing resource and asserts the exit code and message. A test also covers the no-flag idempotent re-registration, which must still succeed.
  • The #85 --type case is covered by the same change, or it is explicitly linked and closed.

Notes

  • Related: #85 (flisk resource: --type is silently ignored when the name already exists with a different type (exit 0)), open at filing time. It has the same silent-ignore root symptom for --type.
  • Other open issues seen in the same search, not duplicates: #86, #109, #118.
  • Impact: flisk resource is an entry point for scripts and agents, so a silent exit 0 leaves callers believing a flag was applied.
Lingua principale
TypeScript
Stelle
1
Fork
2
Merge medio
11h 39m
PR unite (30g)
92

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flisk-sh/flisk-cli

Tutte le issue di flisk-sh/flisk-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.