R/holds core functions and S3 methods (for examplemodel_fit,compare_model_fit, andprint.*) across multiple model classes.man/is generated Rd documentation;man/figures/stores README assets like the hex logo.inst/templates/contains APA-styled Word templates used bysave_table().README.Rmdis the source ofREADME.md;NEWS.mdtracks user-facing changes;DESCRIPTIONandNAMESPACEdefine package metadata.
R CMD build .— build a source tarball.R CMD check <tarball>— run full package checks on the built tarball (preferred over checking the source tree).- If the tarball check returns Status: OK and there are no further instructions, remove the tarball and the
<pkg>.Rcheckdirectory; if the check does not end in OK, leave them for inspection. R -q -e "roxygen2::roxygenise()"— regenerateman/andNAMESPACEafter doc changes.R -q -e "rmarkdown::render('README.Rmd')"— refreshREADME.mdfrom the Rmd source.
- Use two-space indentation and
snake_casefor functions and variables. - Document exported functions with roxygen2 (
@param,@return,@export). - Do not hand-edit generated files (
NAMESPACE,man/*.Rd).
- Ensure all user-facing messages honor the function's
verboseflag when present. - For
compare_model_fit()messaging, prefer including the affected model name(s) for clarity.
- A
testthatsuite exists undertests/testthat; coverage is expanding but not exhaustive. - Use
R -q -e "devtools::test()"for quick feedback, and rely onR CMD checkplus runnable examples for release readiness. - The roadmap tracks continued test expansion and
R CMD checkcleanup; seeROADMAP.mdfor scope. - If adding tests, follow
testthatconventions (tests/testthat/test-*.R) and addtestthattoSuggests. - For tests/examples involving fit indices, avoid a 1-factor/3-item model (df = 0 gives identical indices). Use at least 1 factor with 4 items or 2 factors with 3 items each.
- Keep mandatory dependencies minimal; most integrations live in
Suggests(lavaan,ggplot2,flextable,officer). - For optional model classes, guard usage with
rlang::check_installed()and provide clear messages instead of hard dependencies. - Assume users already have the package that produced their model objects; avoid forcing installs for unrelated workflows.
ROADMAP.mdis the source of truth for milestones; GitHub issues linked there contain the detailed specs.- Near-term priorities include SEM support for
lavaan, new estimate helpers, invariance tooling, and expanding model-class support (mirt,psych).
- Table pipeline:
prepare_table()(internal) builds adata.framewithinsight::format_table();format_results()(public) returnstext/markdown/html/auto;print.*is console-only and accepts...for S3 consistency. - File structure (rule of thumb):
model_fit-<backend>.Rformodel_fit.<external_class>()and backend helpers;model_fit-methods.Rformodel_fitresult methods;compare_model_fit.Rfor the main function;compare_model_fit-methods.Rforcompare_model_fitresult methods;format_results.Randprepare_table.Rfor generics and shared helpers;helpers-formatting.Rfor internal formatting helpers. - Backend checklist: 1) create
R/model_fit-<backend>.R; 2) implementmodel_fit.<class>(); 3) ensure the return is compatible with result methods (print/format_results/prepare_table).
- Commit history uses short, imperative messages and common prefixes like
feat:,fix:,docs:,chore:. - PRs should include a brief summary, tests run (or note if not run), and updates to
NEWS.mdfor user-visible changes. - When asked to verify recent changes, use
git log --oneline --left-right --graph --decorate origin/master...gitbutler/workspaceand other non-destructive history/diff commands as needed. - This agent does not create commits or PRs (GitButler workflow). When requested or during release prep, assist with entries in
NEWS.md.
When writing complex features or significant refactors, use an ExecPlan (as described in .agent/PLANS.md) from design to implementation.