simple-module-cli 0.0.43__tar.gz → 0.0.44__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/PKG-INFO +1 -1
  2. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/pyproject.toml +1 -1
  3. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/framework_repo.py +1 -0
  4. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/scaffolding.py +3 -0
  5. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/README.md +1 -0
  6. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-cli/SKILL.md +1 -1
  7. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-conventions/SKILL.md +7 -2
  8. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-creating/SKILL.md +26 -21
  9. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-inertia-pages/SKILL.md +2 -1
  10. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/SKILL.md +157 -0
  11. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/scripts/page_audit/__main__.py +245 -0
  12. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/scripts/page_audit/audit_browser.py +208 -0
  13. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/scripts/page_audit/audit_crawl.py +79 -0
  14. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/scripts/page_audit/audit_report.py +171 -0
  15. simple_module_cli-0.0.44/simple_module_cli/skills/simple-module-page-perf/scripts/page_audit/audit_server.py +175 -0
  16. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-registries/SKILL.md +1 -1
  17. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-testing/SKILL.md +9 -5
  18. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/dockerignore +1 -1
  19. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/_optional/background_tasks/run_worker.py +3 -3
  20. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/module-assets.ts +6 -4
  21. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/README.md.tpl +11 -0
  22. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/contracts/schemas.py.tpl +1 -1
  23. simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/core/__init__.py +1 -0
  24. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/core}/services.py.tpl +1 -1
  25. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/models.py.tpl +1 -1
  26. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/module.py.tpl +5 -5
  27. simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web/__init__.py +1 -0
  28. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web}/deps.py.tpl +1 -1
  29. simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web/endpoints/__init__.py +1 -0
  30. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web}/endpoints/api.py.tpl +8 -8
  31. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web}/endpoints/views.py.tpl +7 -7
  32. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/README.md.tpl +9 -1
  33. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/pyproject.toml.tpl +1 -0
  34. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/pyproject.toml.tpl +1 -0
  35. simple_module_cli-0.0.44/simple_module_cli/templates/module/tests/conftest.py +1 -0
  36. simple_module_cli-0.0.44/simple_module_cli/templates/module/tests/core/contracts/test___PACKAGE___schemas.py.tpl +26 -0
  37. simple_module_cli-0.0.44/simple_module_cli/templates/module/tests/core/module/test___PACKAGE___module.py.tpl +27 -0
  38. simple_module_cli-0.0.43/simple_module_cli/templates/module/tests/test___PACKAGE__.py.tpl → simple_module_cli-0.0.44/simple_module_cli/templates/module/tests/web/crud/test___PACKAGE___crud.py.tpl +3 -51
  39. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_docker_persistence_secrets.py +5 -1
  40. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new_regressions.py +1 -1
  41. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new_scaffold_layout.py +3 -0
  42. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_prepare_data_migrations.py +2 -2
  43. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_recipes.py +1 -1
  44. simple_module_cli-0.0.44/tests/test_cli_skill_page_audit.py +265 -0
  45. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_css_assets.py +1 -0
  46. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_css_build.py +1 -1
  47. simple_module_cli-0.0.44/tests/test_scaffolding_area_layout.py +64 -0
  48. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffolding_framework_repo.py +4 -3
  49. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffolding_host.py +1 -1
  50. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffolding_module.py +20 -9
  51. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffolding_module_js.py +2 -2
  52. simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__/endpoints/__init__.py +0 -0
  53. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/.gitignore +0 -0
  54. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/LICENSE +0 -0
  55. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/README.md +0 -0
  56. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/__init__.py +0 -0
  57. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_add_install.py +0 -0
  58. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_add_sources.py +0 -0
  59. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_app_project_manifests.py +0 -0
  60. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_env.py +0 -0
  61. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_local_env.py +0 -0
  62. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_module_build.py +0 -0
  63. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_module_host.py +0 -0
  64. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/_templating.py +0 -0
  65. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/add_cmd.py +0 -0
  66. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/app_project.py +0 -0
  67. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/case.py +0 -0
  68. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/catalog.py +0 -0
  69. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/cli.py +0 -0
  70. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/docker_assets.py +0 -0
  71. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/docker_cmd.py +0 -0
  72. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/git_source.py +0 -0
  73. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/git_versions.py +0 -0
  74. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/migration_recipes/mail_settings.py +0 -0
  75. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/migration_recipes/users_tokens.py +0 -0
  76. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/migrations_cmd.py +0 -0
  77. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/module_cmd.py +0 -0
  78. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/new.py +0 -0
  79. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/openapi_cmd.py +0 -0
  80. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/openapi_types.py +0 -0
  81. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/package_update.py +0 -0
  82. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/package_update_deps.py +0 -0
  83. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/package_update_npm.py +0 -0
  84. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/pins.py +0 -0
  85. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/plugins.py +0 -0
  86. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/pypi.py +0 -0
  87. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/pyproject_edit.py +0 -0
  88. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/recipes.py +0 -0
  89. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/requirements.py +0 -0
  90. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-database/SKILL.md +0 -0
  91. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-doctor/SKILL.md +0 -0
  92. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-locales/SKILL.md +0 -0
  93. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills/simple-module-migrations/SKILL.md +0 -0
  94. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/skills_cmd.py +0 -0
  95. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/Makefile.snippet +0 -0
  96. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/compose-base-postgres.yml.tpl +0 -0
  97. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/compose-base-sqlite.yml.tpl +0 -0
  98. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/compose-tasks-postgres.yml.tpl +0 -0
  99. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/compose-tasks-sqlite.yml.tpl +0 -0
  100. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/compose-worker.yml.tpl +0 -0
  101. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/host-flat.Dockerfile +0 -0
  102. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/host.Dockerfile +0 -0
  103. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/docker/worker.Dockerfile.tpl +0 -0
  104. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/.env.example +0 -0
  105. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/.gitignore +0 -0
  106. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/Makefile +0 -0
  107. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/README.md.tpl +0 -0
  108. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/_optional/background_tasks/Makefile.snippet +0 -0
  109. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/alembic.ini +0 -0
  110. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/app.tsx +0 -0
  111. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/main.tsx +0 -0
  112. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/package.json.tpl +0 -0
  113. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/pages/Error.tsx +0 -0
  114. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/pages/Landing.tsx +0 -0
  115. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/pages.ts +0 -0
  116. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/styles.css +0 -0
  117. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/tsconfig.json +0 -0
  118. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/vite.config.ts +0 -0
  119. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/client_app/vite.dev-url.ts +0 -0
  120. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/main.py +0 -0
  121. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/migrations/env.py +0 -0
  122. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/migrations/script.py.mako +0 -0
  123. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/migrations/versions/.gitkeep +0 -0
  124. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/pyproject.toml.tpl +0 -0
  125. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/routes.py +0 -0
  126. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/host/templates/index.html +0 -0
  127. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/.github/workflows/ci.yml +0 -0
  128. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/.github/workflows/publish.yml.tpl +0 -0
  129. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/.gitignore +0 -0
  130. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/__init__.py +0 -0
  131. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/contracts/__init__.py.tpl +0 -0
  132. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/core}/constants.py.tpl +0 -0
  133. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/core}/settings.py.tpl +0 -0
  134. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/locales/en.json.tpl +0 -0
  135. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/pages/Browse.tsx.tpl +0 -0
  136. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/pages/Create.tsx.tpl +0 -0
  137. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/pages/Edit.tsx.tpl +0 -0
  138. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/pages/api.generated.ts.tpl +0 -0
  139. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/pages/api.ts.tpl +0 -0
  140. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/__PACKAGE__/py.typed +0 -0
  141. {simple_module_cli-0.0.43/simple_module_cli/templates/module/__PACKAGE__ → simple_module_cli-0.0.44/simple_module_cli/templates/module/__PACKAGE__/web}/service.py.tpl +0 -0
  142. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/LICENSE +0 -0
  143. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/__PACKAGE__/pages/Browse.tsx.tpl +0 -0
  144. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/__PACKAGE__/pages/Create.tsx.tpl +0 -0
  145. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/framework_repo/__PACKAGE__/pages/Edit.tsx.tpl +0 -0
  146. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/standalone/package.json.tpl +0 -0
  147. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/_optional/standalone/tsconfig.json.tpl +0 -0
  148. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/package.json.tpl +0 -0
  149. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/module/tsconfig.json.tpl +0 -0
  150. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/.env.example +0 -0
  151. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/.gitignore +0 -0
  152. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/Makefile +0 -0
  153. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/README.md.tpl +0 -0
  154. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/package.json.tpl +0 -0
  155. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/templates/workspace/pyproject.toml.tpl +0 -0
  156. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/update_cmd.py +0 -0
  157. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/uv_workspace.py +0 -0
  158. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/simple_module_cli/wizard.py +0 -0
  159. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/conftest.py +0 -0
  160. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_build_packaging.py +0 -0
  161. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_case.py +0 -0
  162. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_add_cmd.py +0 -0
  163. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_add_spec_parse.py +0 -0
  164. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_add_workspace_member.py +0 -0
  165. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_asset_prerequisites.py +0 -0
  166. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_catalog.py +0 -0
  167. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_catalog_depends_on.py +0 -0
  168. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_docker_assets.py +0 -0
  169. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_docker_workers.py +0 -0
  170. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_gen_types_scaffold.py +0 -0
  171. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_git_scan.py +0 -0
  172. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new.py +0 -0
  173. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new_dest_tolerance.py +0 -0
  174. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new_git_module.py +0 -0
  175. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_new_migration_bootstrap.py +0 -0
  176. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_openapi_export.py +0 -0
  177. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_openapi_gen_types.py +0 -0
  178. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update.py +0 -0
  179. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update_groups.py +0 -0
  180. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update_npm.py +0 -0
  181. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update_pins.py +0 -0
  182. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update_release_order.py +0 -0
  183. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_package_update_workspace_excludes.py +0 -0
  184. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_prepare_data_postgres.py +0 -0
  185. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_pyproject_edit.py +0 -0
  186. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_update_release_policy.py +0 -0
  187. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_update_sources.py +0 -0
  188. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_vite_port_env.py +0 -0
  189. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_wizard.py +0 -0
  190. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_cli_wizard_git.py +0 -0
  191. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_create_module_ci_skip.py +0 -0
  192. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_env_helper.py +0 -0
  193. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_framework_repo_wiring.py +0 -0
  194. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_cmd_build.py +0 -0
  195. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_cmd_e2e.py +0 -0
  196. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_cmd_verify.py +0 -0
  197. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_css_subdir_sources.py +0 -0
  198. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_npm_aliases.py +0 -0
  199. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_module_pages_manifest.py +0 -0
  200. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_no_framework_deps.py +0 -0
  201. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_plugin_discovery.py +0 -0
  202. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffold_app_tsx_spa_links.py +0 -0
  203. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffold_rollback.py +0 -0
  204. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_scaffolded_host_setup_wizard.py +0 -0
  205. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_skills_cmd.py +0 -0
  206. {simple_module_cli-0.0.43 → simple_module_cli-0.0.44}/tests/test_template_requires_framework.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: simple_module_cli
3
- Version: 0.0.43
3
+ Version: 0.0.44
4
4
  Summary: Standalone scaffolder for the SimpleModule framework — `smpy new`, `smpy create-module`, plugin host.
5
5
  Project-URL: Homepage, https://github.com/antosubash/simple_module_python
6
6
  Project-URL: Repository, https://github.com/antosubash/simple_module_python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "simple_module_cli"
3
- version = "0.0.43"
3
+ version = "0.0.44"
4
4
  description = "Standalone scaffolder for the SimpleModule framework — `smpy new`, `smpy create-module`, plugin host."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -70,6 +70,7 @@ def update_root_pyproject(root: Path, name: str) -> None:
70
70
  root_toml = root / "pyproject.toml"
71
71
  content = root_toml.read_text()
72
72
  src_path = f"modules/{name}"
73
+ # Pytest recursively collects area/feature tests from this one root.
73
74
  test_path = f"modules/{name}/tests"
74
75
 
75
76
  if f'"{src_path}",' in content and f'"{test_path}"' in content:
@@ -194,6 +194,9 @@ def create_module(
194
194
  ) -> Path:
195
195
  """Scaffold a module package at ``dest``.
196
196
 
197
+ Implementation lives in ``core/`` and ``web/``; nested tests mirror those
198
+ areas without test-package initializers. Root lookup paths stay stable.
199
+
197
200
  When ``framework_version`` is a concrete version, the template's
198
201
  forward-looking ``simple_module_*`` ranges are rewritten to an exact pin so
199
202
  the module resolves against that framework version (e.g. ``uv add`` into the
@@ -44,6 +44,7 @@ The CLI is [vercel-labs/skills](https://github.com/vercel-labs/skills); see its
44
44
  | [simple-module-database](./simple-module-database/SKILL.md) | Adding SQLModel tables, picking a mixin, or debugging session/transaction behavior |
45
45
  | [simple-module-migrations](./simple-module-migrations/SKILL.md) | Generating, applying, or reviewing Alembic migrations after installing or changing a module |
46
46
  | [simple-module-inertia-pages](./simple-module-inertia-pages/SKILL.md) | Adding or debugging an Inertia page in a module — render keys, shared props, common pitfalls |
47
+ | [simple-module-page-perf](./simple-module-page-perf/SKILL.md) | Auditing pages for speed and perceived speed — server time and SQL counts (`Server-Timing`), payloads, deferred props, navigation timing, layout shift, UX checks; ships `scripts/page_audit` |
47
48
  | [simple-module-locales](./simple-module-locales/SKILL.md) | Adding or debugging i18n in a module — `locale_dirs()`, namespaces, CLDR plurals, the Zod-in-hook rule |
48
49
  | [simple-module-registries](./simple-module-registries/SKILL.md) | Contributing menu items, permissions, feature flags, or events from a module |
49
50
  | [simple-module-testing](./simple-module-testing/SKILL.md) | Writing pytest tests — picking the right fixture (`db_session` / `app` / `authenticated_client`), single-test runs, e2e |
@@ -97,7 +97,7 @@ smpy create-module orders # writes ./simple_module_orders/
97
97
  smpy create-module orders --dest ./packages/orders
98
98
  ```
99
99
 
100
- The result is a complete package: `pyproject.toml` with the entry point declared, `module.py` with `ModuleBase`/`ModuleMeta` skeleton, `models.py`, `contracts/`, `endpoints/{api,views}.py`, `pages/`, `locales/en.json`, plus a tests directory wired up with `simple_module_test` fixtures.
100
+ The result is a complete package: `pyproject.toml` with the entry point declared, `module.py` with `ModuleBase`/`ModuleMeta` skeleton, `models.py`, `contracts/`, `web/endpoints/{api,views}.py`, `pages/`, `locales/en.json`, `core/{constants,settings,services}.py`, `web/{deps,service}.py`, plus nested `tests/<area>/<feature>/test_<module>_*.py` wired up with `simple_module_test` fixtures.
101
101
 
102
102
  `<name>` accepts any case — `orders`, `Orders`, `ORDERS`, `blog_posts` all work. The CLI lowercases it for the directory and PascalCases it for `ModuleMeta.name`.
103
103
 
@@ -36,6 +36,11 @@ Forbidden in module code: `pydantic.BaseModel` for DTOs, and SQLAlchemy `Declara
36
36
 
37
37
  Treat 300 lines as the design pressure on every `.py`, `.ts`, and `.tsx` file (the reference codebase enforces this in CI). When you approach it, **split by responsibility** — don't golf comments and blank lines to squeeze under.
38
38
 
39
+ New module settings and their app-state container live in `core/settings.py`
40
+ and `core/services.py`; HTTP dependencies and services live in `web/`. Keep
41
+ root lookup files in place and put non-page frontend code in `ui/`. See
42
+ [Module layout](../../docs/module-layout.md).
43
+
39
44
  ### 3. Per-module settings: `register_module_settings` → `app.state.<module>`
40
45
 
41
46
  ```python
@@ -44,8 +49,8 @@ from simple_module_core.module_settings import register_module_settings
44
49
 
45
50
  class UsersModule(ModuleBase):
46
51
  def register_settings(self, app: FastAPI) -> None:
47
- from users.settings import UsersSettings # a DbBackedSettings subclass
48
- from users.state import UsersState
52
+ from users.core.settings import UsersSettings # a DbBackedSettings subclass
53
+ from users.core.state import UsersState
49
54
 
50
55
  register_module_settings(app, "users", UsersSettings, lambda s: UsersState(settings=s))
51
56
  ```
@@ -25,7 +25,7 @@ make migrate
25
25
 
26
26
  `make new-module` (→ `scripts/new_module.py`) is the in-repo path. It calls the
27
27
  same `create_module` as `smpy create-module`, so both produce the same tree
28
- below (permissions, menu item with `label_key`, `constants.py`, CRUD sample,
28
+ below (permissions, menu item with `label_key`, `core/constants.py`, CRUD sample,
29
29
  `locales/en.json`); the in-repo variant adds workspace-sourced `pyproject.toml`
30
30
  metadata, `LICENSE`, and i18n-keyed pages. For a **standalone publishable
31
31
  package** (its own repo, with CI + PyPI `publish.yml`), use
@@ -35,26 +35,25 @@ host.
35
35
 
36
36
  ## What scaffolding produces
37
37
 
38
- ```
38
+ ```text
39
39
  modules/orders/
40
- ├── pyproject.toml # entry point declared here
41
- ├── package.json # per-module JS deps
42
- ├── tsconfig.json
43
- ├── tests/test_orders.py
44
- └── orders/
45
- ├── module.py # OrdersModule(ModuleBase) with ModuleMeta
46
- ├── constants.py # PERM_*, PAGE_*, MENU_* — no magic strings elsewhere
47
- ├── models.py # Base = create_module_base("orders")
48
- ├── contracts/schemas.py # SQLModel DTOs — public surface
49
- ├── service.py # business logic
50
- ├── services.py # app.state.orders state container (settings)
51
- ├── settings.py # DbBackedSettings subclass (DB-backed, no env)
52
- ├── deps.py # FastAPI dependencies
53
- ├── endpoints/{api,views}.py
54
- ├── pages/{Browse,Create,Edit}.tsx # *.tsx, auto-discovered by Vite
55
- ├── pages/api.ts # typed /api client: createApi<paths>()
56
- ├── pages/api.generated.ts # from `smpy openapi gen-types`; never edit
57
- └── locales/en.json
40
+ ├── pyproject.toml, package.json, tsconfig.json
41
+ ├── orders/
42
+ │ ├── __init__.py, py.typed, module.py
43
+ │ ├── models.py # or models/; discovered by name
44
+ │ ├── contracts/ # public SQLModel DTOs and extension contracts
45
+ │ ├── core/ # constants.py, settings.py, services.py, errors.py
46
+ │ ├── web/ # deps.py, service.py (or services/), private schemas
47
+ │ │ └── endpoints/ # api.py, views.py
48
+ │ ├── pages/ # Inertia pages, api.ts, api.generated.ts
49
+ │ ├── locales/ # <lang>.json
50
+ │ ├── ui/ # components/, hooks/, utils/ (when needed)
51
+ │ └── tasks.py, theme.css, styles.css # optional root lookup files
52
+ └── tests/
53
+ ├── conftest.py # module-wide fixtures
54
+ ├── core/module/test_orders_module.py
55
+ ├── core/contracts/test_orders_schemas.py
56
+ └── web/crud/test_orders_crud.py
58
57
  ```
59
58
 
60
59
  `make new-module` also edits `host/pyproject.toml` (adds the workspace dep), the
@@ -63,6 +62,12 @@ root `pyproject.toml` (type-check + test paths) and the `publish-pypi` matrix in
63
62
  test` without further wiring. Commit the `uv.lock`, `package-lock.json` and
64
63
  regenerated i18n key files it leaves behind.
65
64
 
65
+ Modules use this area layout.
66
+ Area initializers hold only a docstring. Private helpers stay in their area.
67
+ Tests have no `__init__.py`, keep `conftest.py` at their root and use globally
68
+ unique `test_orders_*.py` basenames; JS tests stay in `tests-js/`.
69
+ See [Module layout](../../docs/module-layout.md) for the lookup consumers and shim policy.
70
+
66
71
  ## The contract: pyproject.toml + module.py
67
72
 
68
73
  The host discovers modules via a single entry point. If this is wrong, the module silently does nothing in dev and **fails boot in production** (strict discovery).
@@ -130,7 +135,7 @@ The new module should appear in the registered-modules log line. If it has a vie
130
135
  - **Registered the module by hand in host code.** Don't — discovery is entry-point-only; host code never imports module code.
131
136
 
132
137
  Services raise domain exceptions derived from a per-module base in
133
- `exceptions.py` or `errors.py`, never `HTTPException`. Map them in endpoints or
138
+ `core/errors.py`, never `HTTPException`. Map them in endpoints or
134
139
  `register_exception_handlers(app)` (as in `file_storage`); translate at the
135
140
  request boundary. Preserve existing status codes, JSON bodies and headers.
136
141
  Endpoint-level `HTTPException` for pure request validation remains fine.
@@ -56,7 +56,7 @@ class AuthModule(ModuleBase):
56
56
  Use `InertiaDep` from `simple_module_hosting.inertia_deps` — it injects an `Inertia` instance with shared props already attached:
57
57
 
58
58
  ```python
59
- # orders/endpoints/views.py
59
+ # orders/web/endpoints/views.py
60
60
  from fastapi import APIRouter
61
61
  from simple_module_hosting.inertia_deps import InertiaDep
62
62
 
@@ -108,3 +108,4 @@ The typed client (#504):
108
108
 
109
109
  - **simple-module-creating** — where the PascalCase rule originates (matching `ModuleMeta.name`)
110
110
  - **simple-module-doctor** — full reference for `SM003` / `SM004` / `SM018` / `SM019`
111
+ - **simple-module-page-perf** — auditing a page's speed, N+1s, deferred props and loading UX
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: simple-module-page-perf
3
+ description: Use when checking or improving the speed and perceived speed of Inertia pages in a simple_module_python app — a page or navigation feels slow, a list may have an N+1, a payload looks large, content jumps while loading, or before shipping a new page. Triggers on "page is slow", "audit page performance", "Server-Timing", "N+1", "defer this prop", "layout shift", "skeleton", "LCP", or "perf check the pages".
4
+ ---
5
+
6
+ # simple_module_python: page performance audit
7
+
8
+ `scripts/page_audit` (next to this file) signs in to a running app, finds every
9
+ page, and measures each one three ways: the Inertia JSON a navigation fetches,
10
+ a real browser load and click-through, and a phone-width load. It prints a
11
+ Markdown table and a findings list, and exits 1 if any budget fails.
12
+
13
+ ## 1. Run it against a development server (server-side numbers)
14
+
15
+ A development host sends `Server-Timing: app;dur=…, db;dur=…;desc="N queries"`
16
+ on every response. The audit reads it to report server time and SQL
17
+ statements per page.
18
+
19
+ ```bash
20
+ uv run --with playwright playwright install chromium # once
21
+ uv run --with playwright python .claude/skills/simple-module-page-perf/scripts/page_audit \
22
+ --base-url http://localhost:8000 \
23
+ --email admin@example.com --password '<admin password>' \
24
+ --json perf-dev.json
25
+ ```
26
+
27
+ - Pages come from the `menus` shared prop, then two levels of links found in
28
+ each page's `<main>`, one sample per URL pattern (`/orders/<id>` is audited
29
+ once). Add pages with `--path /x/` (repeatable), audit only those with
30
+ `--no-discover --crawl-depth 0`.
31
+ - Logout, delete, export, download, `/api/` and `/setup` links are never
32
+ followed. Add your own with `--exclude <regex>`.
33
+ - Public pages: run without `--email` and pass them with `--path`
34
+ (`--path / --path /users/login`).
35
+ - No `Server-Timing` (older framework, or a non-development server): the
36
+ Server ms and SQL columns show `—`; everything else still works.
37
+ - Seed realistic volumes first. Ten rows hide the N+1 and the oversized prop
38
+ that ten thousand expose.
39
+
40
+ ## 2. Run it against a production build (what users download)
41
+
42
+ Dev-server bundles are unminified and served module by module, so LCP and JS
43
+ bytes only mean something on a build. The audit only applies those budgets
44
+ when the page is not served by Vite.
45
+
46
+ ```bash
47
+ make build # the client bundle
48
+ SM_ENVIRONMENT=staging SM_SECRET_KEY=<32+ chars> <the other secrets production needs> \
49
+ uv run uvicorn main:app --port 8001 # any environment but development/testing serves the build
50
+ uv run --with playwright python .claude/skills/simple-module-page-perf/scripts/page_audit \
51
+ --base-url http://localhost:8001 --email … --password … --json perf-prod.json
52
+ ```
53
+
54
+ Outside development and testing the session cookie is `Secure`. Browsers accept it on
55
+ `http://localhost`; over plain HTTP on any other host, set
56
+ `SM_SESSION_COOKIE_SECURE=false` for the audit run.
57
+
58
+ ## 3. Read the report
59
+
60
+ | Column / check | Budget (warn / fail) | What it means |
61
+ | --- | --- | --- |
62
+ | Server ms | 100 / 300 | warm median of `app` in Server-Timing |
63
+ | SQL | 12 / 25 | statements, cheapest warm round (auth adds a few now and then) |
64
+ | JSON KB | 100 / 300 | the Inertia response without the i18n catalog |
65
+ | `prop_kb` | 50 / 150 | the largest single page prop |
66
+ | Deferred | — | props the page loads after it paints |
67
+ | Nav ms | 300 / 1000 | click on a visible link → new page painted (`—`: no visible link to it) |
68
+ | `deferred_ms` | 1000 / 2500 | click → every deferred prop painted |
69
+ | LCP ms | 2500 / 4000 | production build only |
70
+ | `js_kb` | 350 / 600 | JS transferred on first load, production build only |
71
+ | CLS | 0.1 / 0.25 | layout shift on first load or navigation |
72
+ | DOM / `table_rows` | 1500 / 3000, 100 / 250 | rendered size after everything settled |
73
+ | `redirect` | warn | the GET redirected: link to the canonical URL |
74
+ | `console`, `failed_requests` | fail | runtime errors, 4xx/5xx requests while on the page |
75
+ | `overflow` | warn | page scrolls sideways at 390 px |
76
+ | `stuck_loaders` | warn | skeleton/spinner/`aria-busy` still visible after everything settled |
77
+ | `unnamed_controls`, `h1` | warn | icon buttons without a name; not exactly one `<h1>` |
78
+
79
+ Override a budget with `--budget queries=20,40`. Use `--no-fail` to report
80
+ without failing.
81
+
82
+ ## 4. Fix what it finds
83
+
84
+ | Finding | Usual cause | Fix |
85
+ | --- | --- | --- |
86
+ | High SQL count | a query per row (N+1) | `selectinload()`/`joinedload()`, `get_user_directory(app).get_many(ids)`, one `GROUP BY` for per-row counts |
87
+ | High server ms, few queries | a slow call: broker, HTTP API, big aggregate | `defer(load, group="…")` with a same-size placeholder, or cache with a TTL plus invalidation |
88
+ | Large JSON / prop | whole models, unpaginated lists | a DTO with only the rendered fields; `paginate()` 20–50 rows; detail data on the detail page |
89
+ | Partial reloads still slow | props passed as values, so computed every time | pass expensive props as callables (`"stats": lambda: svc.stats()`): only evaluated when included |
90
+ | `deferred_ms` warning | the deferred work itself is slow | fine if the placeholder says what is loading; split independent slow props into separate groups (parallel requests) |
91
+ | CLS | content appears without reserved space | `Skeleton` in the real layout's shape; same component with "checking…" copy; `aria-busy="true"` |
92
+ | `redirect` | a link without the trailing slash, or to an old URL | one constant for the index URL, with its slash |
93
+ | `js_kb` | heavy library in a shared component | `lazy(() => import('./Heavy'))` + `<Suspense fallback={<Skeleton …/>}>` where it is used |
94
+ | DOM / rows | long unpaginated list | paginate, or virtualize past a few hundred rows |
95
+ | `overflow` | wide table or fixed widths | `overflow-x-auto` around tables; no fixed pixel widths |
96
+
97
+ How deferred props behave on the client:
98
+
99
+ - A deferred prop is `undefined` until it loads, which is different from `null`
100
+ (loaded, nothing there). Type it optional (`stats?: Stats`) and branch on
101
+ `=== undefined`, or wrap the part in Inertia's
102
+ `<Deferred data="stats" fallback={…}>`.
103
+ - A component that copies the prop into state must adopt it when it arrives:
104
+ `useEffect(() => { if (initial) setValue(initial); }, [initial]);`.
105
+ - Test the server side with `InertiaPage` from `simple_module_test`:
106
+ `page.deferred("group", "prop").missing("prop")`, then
107
+ `await page.load_deferred(client, "group")`.
108
+
109
+ ## 5. Pin it
110
+
111
+ Keep a fixed page fixed with a statement-count test. The cheapest of three
112
+ requests excludes the auth layer's own periodic queries:
113
+
114
+ ```python
115
+ from simple_module_db.query_stats import install_query_stats, track_queries
116
+
117
+
118
+ async def _statements(app, client, url) -> int:
119
+ install_query_stats(app.state.sm.db.engine)
120
+ counts = []
121
+ for _ in range(3):
122
+ with track_queries() as stats:
123
+ assert (await client.get(url, headers={"X-Inertia": "true"})).status_code == 200
124
+ counts.append(stats.count)
125
+ return min(counts)
126
+
127
+
128
+ # Seed 2 rows, measure; seed 20 more, measure again; assert the counts are equal.
129
+ ```
130
+
131
+ ## UX checklist the numbers don't cover
132
+
133
+ Walk through these by hand on each page you touched:
134
+
135
+ - A visit under about 150 ms shows nothing; Inertia's progress bar covers longer
136
+ ones. Don't add page-level spinners.
137
+ - Loading, empty, filtered-empty and error states each say something different
138
+ and offer a next step.
139
+ - Submit buttons disable while `form.processing` is true; validation errors keep
140
+ what the user typed.
141
+ - Filters reload with `only`, `preserveState`, `preserveScroll` and
142
+ `replace: true`; text inputs are debounced (about 300 ms).
143
+ - Live data either polls modestly (`usePoll(5000+, { only })`) or shows
144
+ "last updated" next to a Refresh button.
145
+ - `<Link prefetch>` only where slightly stale data is fine; every hover is a request.
146
+ - Touch targets are at least 44 px tall on phones (`max-lg:min-h-11`).
147
+
148
+ ## Gotchas
149
+
150
+ - Run the audit against a server that nothing else is changing: a Vite HMR
151
+ reload in the middle of a run shows up as layout shift and console errors.
152
+ - `Nav ms` needs a visible link to the page from its parent, a sibling page in
153
+ the same area, or home. Pages only reachable from a dropdown show `—`.
154
+ - A `fail` on a crawled detail page with HTTP 404 or 422 is usually seed data
155
+ linking to rows that don't exist. Check the link before chasing it.
156
+ - The browser pass drives one tab; don't run two audits against one server
157
+ at the same time, or the timings measure each other.
@@ -0,0 +1,245 @@
1
+ """Audit every Inertia page of a running simple_module app for speed and UX.
2
+
3
+ uv run --with playwright python <skill>/scripts/page_audit \\
4
+ --base-url http://localhost:8000 --email admin@example.com --password '...'
5
+
6
+ Signs in, discovers pages from the ``menus`` shared prop (plus any ``--path``),
7
+ then for each page measures the Inertia JSON response (server time and SQL
8
+ statements from the development ``Server-Timing`` header, payload size, the
9
+ largest props, deferred props), a full document load (FCP, LCP, CLS, bytes), a
10
+ client-side navigation by clicking a link (click -> painted -> deferred
11
+ props painted) and UX checks (DOM size, table rows, stuck loaders, unnamed
12
+ icon buttons, headings, horizontal overflow on a phone). Prints a Markdown
13
+ report, optionally writes JSON, and exits 1 when any check fails.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import argparse
19
+ import os
20
+ import re
21
+ import sys
22
+ from pathlib import Path
23
+ from typing import Any
24
+
25
+ from audit_browser import (
26
+ INIT_SCRIPT,
27
+ BrowserResult,
28
+ client_navigation,
29
+ first_load,
30
+ mobile_overflow,
31
+ settle,
32
+ )
33
+ from audit_crawl import extra_pages, hubs_for
34
+ from audit_report import BUDGETS, Finding, evaluate, markdown, write_json
35
+ from audit_server import discover_paths, inertia_headers, probe
36
+ from playwright.sync_api import BrowserContext, Page, ViewportSize, sync_playwright
37
+
38
+ DESKTOP: ViewportSize = {"width": 1440, "height": 900}
39
+ PHONE: ViewportSize = {"width": 390, "height": 844}
40
+ DEFAULT_EXCLUDE = (
41
+ r"logout|log-out|sign-?out|switch|impersonat|delete|remove|revoke|"
42
+ r"/api/|/static/|/setup|download|export|\.(csv|json|pdf|zip)$"
43
+ )
44
+ _PAGE_OBJECT = """
45
+ () => {
46
+ const el = document.querySelector('script[data-page]');
47
+ if (el) return JSON.parse(el.textContent);
48
+ const app = document.getElementById('app');
49
+ return app && app.dataset.page ? JSON.parse(app.dataset.page) : null;
50
+ }
51
+ """
52
+
53
+
54
+ def _args(argv: list[str]) -> argparse.Namespace:
55
+ ap = argparse.ArgumentParser(prog="page_audit", description=__doc__.split("\n\n")[0])
56
+ ap.add_argument(
57
+ "--base-url", default=os.environ.get("PAGE_AUDIT_BASE_URL", "http://localhost:8000")
58
+ )
59
+ ap.add_argument("--email", default=os.environ.get("PAGE_AUDIT_EMAIL"))
60
+ ap.add_argument("--password", default=os.environ.get("PAGE_AUDIT_PASSWORD"))
61
+ ap.add_argument("--login-path", default="/users/login")
62
+ ap.add_argument("--storage-state", help="Playwright storage state of a signed-in session")
63
+ ap.add_argument("--path", action="append", default=[], help="page to audit (repeatable)")
64
+ ap.add_argument("--no-discover", action="store_true", help="only audit --path pages")
65
+ ap.add_argument("--crawl-depth", type=int, default=2, help="link levels to follow (0: none)")
66
+ ap.add_argument("--max-pages", type=int, default=80, help="cap including crawled pages")
67
+ ap.add_argument("--exclude", action="append", default=[DEFAULT_EXCLUDE], help="regex to skip")
68
+ ap.add_argument("--rounds", type=int, default=5, help="warm server samples per page")
69
+ ap.add_argument("--server-only", action="store_true", help="skip the browser checks")
70
+ ap.add_argument("--no-mobile", action="store_true", help="skip the phone-width pass")
71
+ ap.add_argument("--budget", action="append", default=[], help="override: queries=20,40")
72
+ ap.add_argument("--json", type=Path, help="also write the full results here")
73
+ ap.add_argument("--headed", action="store_true")
74
+ ap.add_argument("--no-fail", action="store_true", help="exit 0 even when checks fail")
75
+ args = ap.parse_args(argv)
76
+ if args.max_pages < 1:
77
+ ap.error("--max-pages must be at least 1")
78
+ return args
79
+
80
+
81
+ def _apply_budgets(overrides: list[str]) -> None:
82
+ for item in overrides:
83
+ key, _, values = item.partition("=")
84
+ warn, _, fail = values.partition(",")
85
+ if key not in BUDGETS or not fail:
86
+ raise SystemExit(f"bad --budget {item!r}; keys: {', '.join(BUDGETS)}")
87
+ BUDGETS[key] = (float(warn), float(fail))
88
+
89
+
90
+ def _sign_in(page: Page, args: argparse.Namespace) -> None:
91
+ if not (args.email and args.password):
92
+ return
93
+ page.goto(args.login_path)
94
+ page.locator('input[type="email"], input[name="email"], #email').first.fill(args.email)
95
+ page.locator('input[type="password"]').first.fill(args.password)
96
+ page.locator('button[type="submit"]').first.click()
97
+ page.wait_for_url(lambda url: args.login_path not in url, timeout=20_000)
98
+
99
+
100
+ def _paths(found: list[str], args: argparse.Namespace) -> list[str]:
101
+ excluded = [re.compile(p) for p in args.exclude]
102
+ candidates = [*args.path, *([] if args.no_discover else found)]
103
+ seen: list[str] = []
104
+ for path in candidates:
105
+ if path not in seen and not any(rx.search(path) for rx in excluded):
106
+ seen.append(path)
107
+ return seen[: args.max_pages]
108
+
109
+
110
+ def _watch(page: Page, holder: dict[str, BrowserResult]) -> None:
111
+ def on_console(msg: Any) -> None:
112
+ if msg.type == "error" and "current" in holder:
113
+ holder["current"].console_errors.append(msg.text)
114
+
115
+ def on_error(exc: Any) -> None:
116
+ if "current" in holder:
117
+ holder["current"].console_errors.append(str(exc))
118
+
119
+ def on_response(resp: Any) -> None:
120
+ if resp.status >= 400 and "current" in holder:
121
+ holder["current"].failed_requests.append(f"{resp.status} {resp.url}")
122
+
123
+ page.on("console", on_console)
124
+ page.on("pageerror", on_error)
125
+ page.on("response", on_response)
126
+
127
+
128
+ def _load_pass(
129
+ page: Page, paths: list[str], holder: dict[str, BrowserResult]
130
+ ) -> dict[str, BrowserResult]:
131
+ """Full document load of every path (paint timings, bytes, UX checks)."""
132
+ results = {p: BrowserResult(path=p) for p in paths}
133
+ for path in paths:
134
+ holder["current"] = results[path]
135
+ try:
136
+ first_load(page, path, results[path])
137
+ except Exception as exc:
138
+ results[path].error = f"first load: {exc}"[:300]
139
+ holder.pop("current", None)
140
+ return results
141
+
142
+
143
+ def _nav_pass(
144
+ page: Page,
145
+ results: dict[str, BrowserResult],
146
+ parents: dict[str, str],
147
+ holder: dict[str, BrowserResult],
148
+ ) -> None:
149
+ """Client-side navigation to every path from a page that links to it."""
150
+ known = list(results)
151
+ for path, result in results.items():
152
+ holder.pop("current", None)
153
+
154
+ def attribute(result: BrowserResult = result) -> None:
155
+ holder["current"] = result
156
+
157
+ try:
158
+ hubs = hubs_for(path, parents.get(path), known)
159
+ result.nav = client_navigation(page, path, hubs, attribute)
160
+ except Exception as exc:
161
+ result.error = result.error or f"navigation: {exc}"[:300]
162
+ holder.pop("current", None)
163
+
164
+
165
+ def _mobile_pass(
166
+ context: BrowserContext, base: str, paths: list[str], results: dict[str, BrowserResult]
167
+ ) -> None:
168
+ browser = context.browser
169
+ if browser is None:
170
+ return
171
+ phone = browser.new_context(
172
+ base_url=base, viewport=PHONE, storage_state=context.storage_state()
173
+ )
174
+ phone.add_init_script(INIT_SCRIPT)
175
+ page = phone.new_page()
176
+ for path in paths:
177
+ try:
178
+ results[path].mobile_overflow_x = mobile_overflow(page, path)
179
+ except Exception as exc:
180
+ results[path].error = results[path].error or f"phone load: {exc}"[:300]
181
+ phone.close()
182
+
183
+
184
+ def main(argv: list[str]) -> int:
185
+ args = _args(argv)
186
+ _apply_budgets(args.budget)
187
+ base = args.base_url.rstrip("/")
188
+ with sync_playwright() as pw:
189
+ browser = pw.chromium.launch(headless=not args.headed)
190
+ context = browser.new_context(
191
+ base_url=base, viewport=DESKTOP, storage_state=args.storage_state
192
+ )
193
+ context.add_init_script(INIT_SCRIPT)
194
+ page = context.new_page()
195
+ _sign_in(page, args)
196
+ page.goto("/")
197
+ settle(page)
198
+ page_object = page.evaluate(_PAGE_OBJECT) or {}
199
+ props = page_object.get("props") or {}
200
+ i18n = props.get("i18n") or {}
201
+ i18n_key = f"{i18n['locale']}:{i18n['audience']}" if i18n.get("audience") else None
202
+ headers = inertia_headers(page_object.get("version"), i18n_key)
203
+ paths = _paths(discover_paths(props), args)
204
+ if not paths:
205
+ print("No pages found: pass --path, or check the login (--email/--password).")
206
+ return 2
207
+ servers = [probe(context.request, base, p, headers, args.rounds) for p in paths]
208
+ browsers: dict[str, BrowserResult] = {}
209
+ parents: dict[str, str] = {}
210
+ if not args.server_only:
211
+ holder: dict[str, BrowserResult] = {}
212
+ _watch(page, holder)
213
+ browsers = _load_pass(page, [s.path for s in servers if not s.error], holder)
214
+ excluded = [re.compile(x) for x in args.exclude]
215
+ frontier = list(browsers)
216
+ for _ in range(args.crawl_depth):
217
+ links = {p: browsers[p].ux.get("links", []) for p in frontier}
218
+ room = max(0, args.max_pages - len(servers))
219
+ found = extra_pages([s.path for s in servers], links, excluded, room)
220
+ if not found:
221
+ break
222
+ parents |= found
223
+ extra = [probe(context.request, base, p, headers, args.rounds) for p in found]
224
+ servers += extra
225
+ loaded = _load_pass(page, [s.path for s in extra if not s.error], holder)
226
+ browsers |= loaded
227
+ frontier = list(loaded)
228
+ _nav_pass(page, browsers, parents, holder)
229
+ if not args.no_mobile:
230
+ _mobile_pass(context, base, list(browsers), browsers)
231
+ browser.close()
232
+
233
+ rows = [(s, browsers.get(s.path)) for s in servers]
234
+ findings: list[Finding] = [f for s, b in rows for f in evaluate(s, b)]
235
+ print(markdown(rows, findings))
236
+ if args.json:
237
+ dev = any(b.load.get("dev_build") for b in browsers.values())
238
+ write_json(args.json, rows, findings, {"base_url": base, "dev_build": dev})
239
+ print(f"\nJSON written to {args.json}")
240
+ failed = any(f.level == "fail" for f in findings)
241
+ return 0 if args.no_fail or not failed else 1
242
+
243
+
244
+ if __name__ == "__main__":
245
+ sys.exit(main(sys.argv[1:]))