The three built-in steps are currently wrapped by an adapter that sets sys.argv and calls the script's own main(). It works and is honest about being interim, but it means:
- tuning still comes from module-level constants rather than
ctx.params(), so it cannot vary per study without editing the source;
- the step chdirs into the project directory, because the scripts resolve paths relative to the working directory;
--window / --step cannot be passed through.
Where
packages/dims-analysis/dims_analysis/steps/{rqa,crqa,crosswavelet}.py — the block marked Step contract adapter
- Contract:
docs/contracts/step.md
What to do
Give run(config, ctx) the real work: move the body of main() into it, take paths from ctx, take tuning from ctx.params(), and delete the argparse block and the adapter. Do one step at a time.
This pairs naturally with #5 (deduplicating the helpers), since both touch the same three files.
Acceptance
dims-analysis run produces byte-identical output to today for the same input.
- No step calls
os.chdir or reads sys.argv.
{"analysis": {"rqa": {"window": 5.0}}} in config.json changes the window.
🤖 Generated with Claude Code
The three built-in steps are currently wrapped by an adapter that sets
sys.argvand calls the script's ownmain(). It works and is honest about being interim, but it means:ctx.params(), so it cannot vary per study without editing the source;--window/--stepcannot be passed through.Where
packages/dims-analysis/dims_analysis/steps/{rqa,crqa,crosswavelet}.py— the block markedStep contract adapterdocs/contracts/step.mdWhat to do
Give
run(config, ctx)the real work: move the body ofmain()into it, take paths fromctx, take tuning fromctx.params(), and delete the argparse block and the adapter. Do one step at a time.This pairs naturally with #5 (deduplicating the helpers), since both touch the same three files.
Acceptance
dims-analysis runproduces byte-identical output to today for the same input.os.chdiror readssys.argv.{"analysis": {"rqa": {"window": 5.0}}}in config.json changes the window.🤖 Generated with Claude Code