feat(agent): generate parseCommandArgs and substituteArgs via fluessig#324
feat(agent): generate parseCommandArgs and substituteArgs via fluessig#324zmaril wants to merge 1 commit into
Conversation
Swap the hand-written `#[napi]` prompt-template helpers (agent harness/prompt-templates.ts: `parseCommandArgs`, `substituteArgs`) to the fluessig-generated path: author the two ops in schema/api.json, add the two `core_impl` delegations to core_impl.rs, regenerate src/generated.rs, and delete the hand-written exports from src/agent.rs. This is the first swap in the `agent` package. Both ops are proven primitive shapes: `parseCommandArgs(argsString: string) -> Array<string>` (string -> list) and `substituteArgs(content: string, args: Array<string>) -> string`, where `args` is the first `Vec<String>` PARAM in the schema — fluessig lowers the `list` param to `args: Vec<String>` with no gap. The `core_impl` methods reach the SAME `pidgin_agent::harness::prompt_templates` functions the hand-written exports called (`parse_command_args` and `substitute_args`, the latter borrowing the args as `&[&str]`), so JS-visible behavior is byte-for-byte unchanged. Verified: each swapped symbol's generated `.d.ts` JSDoc+signature block, its `.js` `module.exports` line, and its nativeBinding destructure entry are byte-identical to a pre-swap build of the base (only file position moves into the generated cluster). cargo build/fmt/clippy clean; codespell 0; straitjacket 0 errors; the prompt-templates oracle slice (agent/test/harness/prompt-templates.test.ts, 5 tests) passes 5/5 against the locally-built generated addon. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xL2W7dkhPsTSRuXQNCDeY
Conformance smoke: agent + ai + tui
Headline is rust-backed: passing cases in files whose module-under-test is a native (Rust addon) module. Raw all-pass is shown secondary — it is inflated by unflipped TypeScript that passes without touching any Rust.
agent: 55/180 (30.6%) · ai: 74/1293 (5.7%) · tui: 375/678 (55.3%) rust-backed = passing / total tests run, per the manifest's per-native-row AttributionA pi test file is rust-backed iff the module it primarily exercises — its module-under-test — is Per-file decisions (from each native manifest row's
CLI conformance (black-box, against the pidgin binary)
The four repointed coding-agent CLI test files spawn the compiled pidgin binary via |
Swap the hand-written
#[napi]prompt-template helpers (agentharness/prompt-templates.ts) to the fluessig-generated path.Module 13 of the pidgin-napi → fluessig campaign (module 3 of this stacked batch of 3, and the first swap in the
agentpackage). Stacked onnapi-fluessig/session-cwd(#323).What changed
parseCommandArgs+substituteArgsops inschema/api.json.core_impldelegations reaching the samepidgin_agent::harness::prompt_templatesfunctions the hand-written exports called.src/generated.rs; delete the hand-written exports fromsrc/agent.rs.Signatures
parseCommandArgs(argsString: string) -> Array<string>(string → list).substituteArgs(content: string, args: Array<string>) -> string—argsis the firstVec<String>param in the schema; fluessig lowers thelistparam toargs: Vec<String>with no gap.Gates
.d.tsJSDoc+signature block,.jsmodule.exportsline, and nativeBinding destructure entry are byte-identical (only file position moves into the generated cluster).cargo build -p pidgin-napi,cargo fmt --all --check,cargo clippy -p pidgin-napi --all-targets -- -D warningsclean; codespell 0.agent/test/harness/prompt-templates.test.ts: 5/5 pass against the locally-built generated addon.🤖 Generated with Claude Code
https://claude.ai/code/session_017xL2W7dkhPsTSRuXQNCDeY
Generated by Claude Code