feat(cli): Accept "formula" alias for putf batch ops + add --dry-run flag#224
feat(cli): Accept "formula" alias for putf batch ops + add --dry-run flag#224
Conversation
…flag
- Accept "formula" as alias for "value" in putf batch JSON ops, so
{"op":"putf","ref":"A1","formula":"=SUM(B1:B5)"} works alongside
the existing "value" field
- Add --dry-run flag for batch command that validates JSON and shows
operation summary without reading/writing any files
- Extract formatSummary into BatchParser for reuse across paths
- Update SKILL.md and CLAUDE.md docs with new features
https://claude.ai/code/session_01JeW4MZBQx2Bktmg9HamTK3
|
PR Review: feat(cli) formula alias and dry-run Overall this is a clean, useful addition. The formatSummary extraction is a nice refactor, and test coverage for the alias feature is solid. A few issues worth addressing. Bug / Architecture: Duplicate batch subcommand The PR registers two Opts.subcommand(batch) entries -- batchDryRunOpts and the existing batchCmd inside sheetWriteOpts -- combined via orElse. This is fragile: correctness depends on orElse ordering, and Decline may behave unexpectedly with duplicate subcommand names. A simpler approach: batchCmd already parses dryRunOpt (you added it). The dryRun field should be checked in the existing dispatch logic -- when dryRun=true and no --file is provided, run the dry-run path. This removes the duplicate subcommand entirely. Side Effect Inside IO.map In batchDryRun: result.warnings.foreach(System.err.println) inside .map is a raw side effect violating the IO effect model. Use IO.delay or flatMap instead. Code Smell: @unchecked Pattern Match In runBatchDryRun: val CliCommand.Batch(source, _) = cmd: @unchecked crashes at runtime if cmd is not a Batch. Prefer explicit pattern matching with IO.raiseError fallback. Minor: Inconsistent dryRunOpt usage batchDryRunOpts re-declares Opts.flag(dry-run) inline instead of reusing the already-extracted dryRunOpt val defined a few lines later. Missing Test Coverage
What Is Good
|
Break chain method calls onto separate lines to satisfy breakChainOnFirstMethodDot=true scalafmt config. https://claude.ai/code/session_01JeW4MZBQx2Bktmg9HamTK3
PR Review:
|
{"op":"putf","ref":"A1","formula":"=SUM(B1:B5)"} works alongside
the existing "value" field
operation summary without reading/writing any files
https://claude.ai/code/session_01JeW4MZBQx2Bktmg9HamTK3