Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.36-pr.342.1919b84Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.36-pr.342.1919b84"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.36-pr.342.1919b84"
}
}
Preview published to npm registry — try new features instantly! |
| ```typescript | ||
| await runCommand(myAction, { requireAuth: true, interactive: true }, context); | ||
| ``` | ||
|
|
There was a problem hiding this comment.
maybe this is too mcuh
src/cli/commands/project/create.ts
Outdated
| fullBanner: true, | ||
| requireAuth: true, | ||
| requireAppConfig: false, | ||
| interactive: true, |
There was a problem hiding this comment.
this new "interactive: true" basically blocks --json
There was a problem hiding this comment.
maybe it's weird since we can pass flags to it? although why would we want --json for create? not sure
| } | ||
| await printUpgradeNotificationIfAvailable(); | ||
| const json = context.isJsonMode; | ||
| let savedStdoutWrite: typeof process.stdout.write | undefined; |
There was a problem hiding this comment.
this is our current trick to mute log.info message and such.. clack uses process.stdout.write, so we patch it..
a bit hacky solution, might want to think about a log layer
|
@claude review this pr, evaluate the code, compare it to the docs/. |
|
Claude finished @kfirstri's task in 3m 23s —— View job PR Review:
|
Note
Description
This PR introduces a global
--jsonflag that switches the CLI from human-readable output to structured JSON, enabling commands to be piped into tools likejq. When active,runCommandmutes all clack UI output (intro, outro, spinners,log.*) by patchingprocess.stdout.write, and writes only the serializedresult.dataobject to stdout. Errors are emitted to stderr as structured JSON objects.Related Issue
None
Type of Change
Changes Made
isJsonModefield toCLIContextand initialize it tofalseinrunCLI()--jsonoption andpreActionhook inprogram.tsthat setscontext.isJsonMode = truerunCommandto muteprocess.stdout.writein JSON mode, outputresult.data(or{ message: outroMessage }fallback) to stdout, and emit structured error objects to stderrdata?: Record<string, unknown>field toRunCommandResultfor commands to return structured outputlogscommand from its own--jsonoption to the global flag, returning{ logs: entries }asdatapreActionvalidation hooks tocreate,link,deploy,eject, andsite/deploycommands so they fail fast with clear error messages in JSON/non-interactive mode when required flags are missinglogscommand covering structured output, empty results, UI suppression, and the fallback message formatdocs/commands.mdwith a comprehensive JSON mode guide including usage examples, error format, and patterns for interactive commandsTesting
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
The stdout-muting approach means existing commands get JSON-mode silence for free — no per-command changes needed. Only commands that return machine-readable output need to add a
datafield. ThepreActionvalidation pattern ensures auth and API calls are never wasted when required flags are absent in non-interactive or JSON sessions.🤖 Generated by Claude | 2026-02-25 15:30 UTC