streamtex 0.7.78__tar.gz → 0.7.79__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 (195) hide show
  1. {streamtex-0.7.78/streamtex.egg-info → streamtex-0.7.79}/PKG-INFO +1 -1
  2. {streamtex-0.7.78 → streamtex-0.7.79}/pyproject.toml +1 -1
  3. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/bib.py +38 -18
  4. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/claude_cmd.py +13 -0
  5. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/claude_project.py +8 -1
  6. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/commands.py +2 -0
  7. streamtex-0.7.79/streamtex/cli/styles_cmd.py +359 -0
  8. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/deploy/stx_auth.py +1 -1
  9. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/target.py +26 -6
  10. {streamtex-0.7.78 → streamtex-0.7.79/streamtex.egg-info}/PKG-INFO +1 -1
  11. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex.egg-info/SOURCES.txt +1 -0
  12. {streamtex-0.7.78 → streamtex-0.7.79}/LICENSE +0 -0
  13. {streamtex-0.7.78 → streamtex-0.7.79}/MANIFEST.in +0 -0
  14. {streamtex-0.7.78 → streamtex-0.7.79}/README.md +0 -0
  15. {streamtex-0.7.78 → streamtex-0.7.79}/setup.cfg +0 -0
  16. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/__init__.py +0 -0
  17. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/__main__.py +0 -0
  18. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/__init__.py +0 -0
  19. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/config.py +0 -0
  20. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/generate.py +0 -0
  21. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/history.py +0 -0
  22. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/metadata.py +0 -0
  23. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/__init__.py +0 -0
  24. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/base.py +0 -0
  25. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/fal.py +0 -0
  26. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/google.py +0 -0
  27. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/openai.py +0 -0
  28. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/ai/providers/registry.py +0 -0
  29. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/auth.py +0 -0
  30. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/banner.py +0 -0
  31. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/bib_preview.py +0 -0
  32. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/block_helpers.py +0 -0
  33. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/blocks.py +0 -0
  34. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/book.py +0 -0
  35. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/browser.py +0 -0
  36. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/__init__.py +0 -0
  37. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_claude_files.py +0 -0
  38. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_divergence.py +0 -0
  39. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_install_local_packs.py +0 -0
  40. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_shared.py +0 -0
  41. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_stx_toml.py +0 -0
  42. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/_toml_helpers.py +0 -0
  43. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/artifact_cmd.py +0 -0
  44. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/bib_cmd.py +0 -0
  45. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/build_check.py +0 -0
  46. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/cache_cmd.py +0 -0
  47. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/claude_global.py +0 -0
  48. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/component_cmd.py +0 -0
  49. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/console.py +0 -0
  50. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/coolify.py +0 -0
  51. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/deploy_auth_cmd.py +0 -0
  52. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/deploy_cmd.py +0 -0
  53. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/dev_cmd.py +0 -0
  54. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/dev_config.py +0 -0
  55. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/ds_cmd.py +0 -0
  56. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/export_cmd.py +0 -0
  57. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/install_cmd.py +0 -0
  58. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/kit_cmd.py +0 -0
  59. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/main.py +0 -0
  60. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/__init__.py +0 -0
  61. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/base.py +0 -0
  62. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/compat.py +0 -0
  63. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/registry.py +0 -0
  64. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/v0_4_0.py +0 -0
  65. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/migrations/v0_4_6.py +0 -0
  66. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/pack_cmd.py +0 -0
  67. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/project_cmd.py +0 -0
  68. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/project_rules.py +0 -0
  69. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/publish_cmd.py +0 -0
  70. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/published_check.py +0 -0
  71. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/release_cmd.py +0 -0
  72. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/run_cmd.py +0 -0
  73. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/run_set.py +0 -0
  74. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/screenshot_cmd.py +0 -0
  75. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/shortcuts.py +0 -0
  76. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/status_cmd.py +0 -0
  77. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/sync_cmd.py +0 -0
  78. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/upgrade_cmd.py +0 -0
  79. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/validate_cmd.py +0 -0
  80. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/cli/workspace_cmd.py +0 -0
  81. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/code.py +0 -0
  82. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/collection.py +0 -0
  83. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/constants.py +0 -0
  84. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/container.py +0 -0
  85. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/__init__.py +0 -0
  86. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/__init__.py +0 -0
  87. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/_frontmatter.py +0 -0
  88. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/agent.py +0 -0
  89. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/ai_prompt.py +0 -0
  90. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/archetype.py +0 -0
  91. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/asset.py +0 -0
  92. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/discovery.py +0 -0
  93. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/guideline.py +0 -0
  94. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/install.py +0 -0
  95. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/integration.py +0 -0
  96. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/loaders.py +0 -0
  97. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/palette.py +0 -0
  98. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/skill.py +0 -0
  99. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/spec.py +0 -0
  100. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/artifacts/validation.py +0 -0
  101. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/contracts.py +0 -0
  102. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/discovery.py +0 -0
  103. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/core/validation.py +0 -0
  104. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/countdown.py +0 -0
  105. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/deeplink.py +0 -0
  106. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/deploy/__init__.py +0 -0
  107. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/enums.py +0 -0
  108. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/export.py +0 -0
  109. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/export_enrich.py +0 -0
  110. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/export_paginate.py +0 -0
  111. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/export_widgets.py +0 -0
  112. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/facts.py +0 -0
  113. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/grid.py +0 -0
  114. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/gsheet.py +0 -0
  115. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/hover_tooltip.py +0 -0
  116. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/i18n.py +0 -0
  117. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/image.py +0 -0
  118. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/image_crop.py +0 -0
  119. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/image_editor.py +0 -0
  120. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/image_utils.py +0 -0
  121. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/inspector.py +0 -0
  122. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/kept.py +0 -0
  123. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/latex.py +0 -0
  124. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/latex_utils.py +0 -0
  125. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/link_config.py +0 -0
  126. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/link_preview.py +0 -0
  127. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/list.py +0 -0
  128. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/loading.py +0 -0
  129. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/markdown.py +0 -0
  130. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/marker.py +0 -0
  131. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/marker_runtime.py +0 -0
  132. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/media_overlay.py +0 -0
  133. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/mermaid.py +0 -0
  134. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/overlay.py +0 -0
  135. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/pagewalk.py +0 -0
  136. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/pdf_export.py +0 -0
  137. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/plantuml.py +0 -0
  138. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/presentation.py +0 -0
  139. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/presentation_profile.py +0 -0
  140. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/printing.py +0 -0
  141. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/__init__.py +0 -0
  142. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/build.py +0 -0
  143. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/config.py +0 -0
  144. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/coolify.py +0 -0
  145. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/levels.py +0 -0
  146. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/media.py +0 -0
  147. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/ops.py +0 -0
  148. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/passwords.py +0 -0
  149. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/state.py +0 -0
  150. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/live/Dockerfile +0 -0
  151. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/live/entrypoint.sh +0 -0
  152. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/live/nginx.conf +0 -0
  153. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/live/stx-http.conf +0 -0
  154. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/live/supervisord.conf +0 -0
  155. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/10-stx-init.sh +0 -0
  156. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/20-stx-auth.sh +0 -0
  157. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/Dockerfile +0 -0
  158. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/closed.html +0 -0
  159. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/nginx.conf +0 -0
  160. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/stx-http.conf +0 -0
  161. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/release/templates/static/stx_auth.py +0 -0
  162. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/runtime_flags.py +0 -0
  163. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/scripts/__init__.py +0 -0
  164. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/scripts/migrate_curves_to_relative.py +0 -0
  165. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/search.py +0 -0
  166. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/slide.py +0 -0
  167. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/slide_note.py +0 -0
  168. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/space.py +0 -0
  169. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/spacing.py +0 -0
  170. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/css/stx_global.css +0 -0
  171. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/default.css +0 -0
  172. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/js/stx_countdown.js +0 -0
  173. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/js/stx_marker_observer.js +0 -0
  174. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/js/stx_scroll_spy.js +0 -0
  175. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/js/stx_video.js +0 -0
  176. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/logo-stx-tiny.png +0 -0
  177. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/static/logo-stx.png +0 -0
  178. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/__init__.py +0 -0
  179. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/base.py +0 -0
  180. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/container.py +0 -0
  181. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/core.py +0 -0
  182. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/scale.py +0 -0
  183. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/scale_curves.toml +0 -0
  184. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/text.py +0 -0
  185. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/styles/visibility.py +0 -0
  186. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/tikz.py +0 -0
  187. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/toc.py +0 -0
  188. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/utils.py +0 -0
  189. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/watch.py +0 -0
  190. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/write.py +0 -0
  191. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex/zoom.py +0 -0
  192. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex.egg-info/dependency_links.txt +0 -0
  193. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex.egg-info/entry_points.txt +0 -0
  194. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex.egg-info/requires.txt +0 -0
  195. {streamtex-0.7.78 → streamtex-0.7.79}/streamtex.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamtex
3
- Version: 0.7.78
3
+ Version: 0.7.79
4
4
  Summary: AI-powered content framework for Streamlit — create presentations, courses, and web-books with Claude or Cursor, no coding required.
5
5
  Author-email: Nicolas Guelfi <nicolas.guelfi@laposte.net>
6
6
  License-Expression: BUSL-1.1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streamtex"
7
- version = "0.7.78"
7
+ version = "0.7.79"
8
8
  description = "AI-powered content framework for Streamlit — create presentations, courses, and web-books with Claude or Cursor, no coding required."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1065,7 +1065,9 @@ def st_bibliography(*, style=None, title: str = "References",
1065
1065
  toc_lvl: Optional[str] = None,
1066
1066
  only_cited: bool = True,
1067
1067
  format: Optional[BibFormat] = None,
1068
- label_style: Optional[CitationStyle] = None) -> None:
1068
+ label_style: Optional[CitationStyle] = None,
1069
+ chunk_size: Optional[int] = None,
1070
+ slide_break_config=None) -> None:
1069
1071
  """Render the full bibliography list.
1070
1072
 
1071
1073
  Args:
@@ -1082,9 +1084,16 @@ def st_bibliography(*, style=None, title: str = "References",
1082
1084
  shows inline: ``(Dart et al., 2013)`` in AUTHOR_YEAR, ``[3]`` in
1083
1085
  NUMERIC and SUPERSCRIPT. Pass ``CitationStyle.NUMERIC`` to keep
1084
1086
  ``[N]`` beside author-year citations.
1087
+ chunk_size: When set, at most this many entries per slide: a
1088
+ ``st_slide_break()`` separates the chunks, each repeats the title
1089
+ with its rank (``References (2/5)``) and the numbering goes on.
1090
+ The TOC gets the plain title once. ``None``: one list (#23).
1091
+ slide_break_config: The ``SlideBreakConfig`` of the breaks between
1092
+ chunks (default: the global one).
1085
1093
  """
1086
1094
  from .container import st_block
1087
1095
  from .export import _render
1096
+ from .slide import st_slide_break
1088
1097
  from .space import st_space
1089
1098
  from .styles import StxStyles
1090
1099
  from .write import st_write
@@ -1099,28 +1108,39 @@ def st_bibliography(*, style=None, title: str = "References",
1099
1108
  # Sort
1100
1109
  entries = _sort_entries(entries, cfg.sort_by)
1101
1110
 
1102
- # Title
1103
- ts = title_style or (StxStyles.big + StxStyles.bold)
1104
- if title:
1105
- st_write(ts, title, toc_lvl=toc_lvl)
1106
- st_space("v", 2)
1111
+ if chunk_size is not None and chunk_size < 1:
1112
+ raise ValueError(f"st_bibliography: chunk_size must be at least 1, not {chunk_size}")
1113
+ size = chunk_size or len(entries)
1114
+ chunks = [entries[i:i + size] for i in range(0, len(entries), size)]
1107
1115
 
1108
- # Build inline CSS from Style objects
1116
+ ts = title_style or (StxStyles.big + StxStyles.bold)
1109
1117
  entry_css = entry_style.css if entry_style else ""
1110
1118
  number_css = number_style.css if number_style else "font-weight:bold;"
1111
1119
  labels = label_style or cfg.citation_style
1112
1120
 
1113
- # Entries
1114
- with st_block(style):
1115
- for i, entry in enumerate(entries):
1116
- formatted = format_entry(entry, fmt, number=0)
1117
- num_html = f'<span style="{number_css}">{_entry_label(entry, i + 1, labels)}</span> '
1118
- anchor_id = f"bib-{entry.key}"
1119
- _render(
1120
- f'<p id="{anchor_id}" style="margin-bottom:10px;text-indent:-2.5em;'
1121
- f'padding-left:2.5em;line-height:1.6;overflow-wrap:anywhere;{entry_css}">'
1122
- f'{num_html}{formatted}</p>'
1123
- )
1121
+ first = 1
1122
+ for k, chunk in enumerate(chunks, 1):
1123
+ if k > 1:
1124
+ st_slide_break(marker_label=f"{title or 'References'} {k}/{len(chunks)}",
1125
+ config=slide_break_config)
1126
+ if title:
1127
+ rank = f" ({k}/{len(chunks)})" if len(chunks) > 1 else ""
1128
+ if k == 1:
1129
+ st_write(ts, title + rank, toc_lvl=toc_lvl, label=title if toc_lvl else "")
1130
+ else:
1131
+ st_write(ts, title + rank)
1132
+ st_space("v", 2)
1133
+ with st_block(style):
1134
+ for i, entry in enumerate(chunk, first):
1135
+ formatted = format_entry(entry, fmt, number=0)
1136
+ num_html = f'<span style="{number_css}">{_entry_label(entry, i, labels)}</span> '
1137
+ anchor_id = f"bib-{entry.key}"
1138
+ _render(
1139
+ f'<p id="{anchor_id}" style="margin-bottom:10px;text-indent:-2.5em;'
1140
+ f'padding-left:2.5em;line-height:1.6;overflow-wrap:anywhere;{entry_css}">'
1141
+ f'{num_html}{formatted}</p>'
1142
+ )
1143
+ first += len(chunk)
1124
1144
 
1125
1145
 
1126
1146
  def _entry_label(entry: BibEntry, number: int, style: CitationStyle) -> str:
@@ -286,6 +286,12 @@ def install_profile(claude_repo: str, profile: str, target: str) -> list[str]:
286
286
  if rendered and rendered not in installed:
287
287
  installed.append(rendered)
288
288
 
289
+ # The styles reference, generated from the code after the read-only copies (#6)
290
+ from .styles_cmd import refresh_reference
291
+ styles_ref = refresh_reference(target)
292
+ if styles_ref:
293
+ installed.append(styles_ref)
294
+
289
295
  return sorted(installed)
290
296
 
291
297
 
@@ -294,6 +300,7 @@ _GENERATED_PATHS = frozenset({
294
300
  os.path.join(".claude", ".stx-profile"),
295
301
  os.path.join(".claude", "CLAUDE.md"), # profile text when the root CLAUDE.md is the user's
296
302
  os.path.join(".claude", "stx.lock"), # project mode lock file
303
+ os.path.join(".claude", "references", "streamtex_styles_api.md"), # stx styles dump (#6)
297
304
  })
298
305
 
299
306
 
@@ -1209,6 +1216,12 @@ def _update_single_target(
1209
1216
  "Claude Code reads both files.[/dim]"
1210
1217
  )
1211
1218
 
1219
+ # The styles reference, regenerated when the version or its inputs changed (#6)
1220
+ from .styles_cmd import refresh_reference
1221
+ styles_ref = refresh_reference(target)
1222
+ if styles_ref:
1223
+ updated.append(styles_ref)
1224
+
1212
1225
  if updated:
1213
1226
  console.print(f"\n[green]Updated {len(updated)} file(s).[/green]")
1214
1227
  for f in updated:
@@ -391,10 +391,13 @@ def sync_project(
391
391
 
392
392
  claude_dir = os.path.join(target, ".claude")
393
393
  if remove:
394
- for rel in (os.path.join(".claude", ".stx-profile"), LOCK_PATH):
394
+ from .styles_cmd import REFERENCE
395
+ for rel in (os.path.join(".claude", ".stx-profile"), LOCK_PATH, REFERENCE):
395
396
  p = os.path.join(target, rel)
396
397
  if os.path.isfile(p):
398
+ os.chmod(p, 0o644)
397
399
  os.remove(p)
400
+ _remove_empty_dirs(target, [REFERENCE])
398
401
  if lock and lock.claude_md and lock.claude_md_sha:
399
402
  p = os.path.join(target, lock.claude_md)
400
403
  if os.path.isfile(p) and sha256_file(p) == lock.claude_md_sha:
@@ -439,6 +442,10 @@ def sync_project(
439
442
  claude_md=claude_md, claude_md_sha=claude_md_sha, files=new_files,
440
443
  ))
441
444
  _ensure_gitignore(target, console)
445
+ # The styles reference, generated from the code (#6): never in the lock, never pruned
446
+ from .styles_cmd import refresh_reference
447
+ if refresh_reference(target):
448
+ console.print(" [green]✓[/green] .claude/references/streamtex_styles_api.md (generated)")
442
449
  return plan
443
450
 
444
451
 
@@ -64,6 +64,7 @@ from .run_cmd import run as stx_run
64
64
  from .screenshot_cmd import screenshot as stx_screenshot
65
65
  from .shortcuts import run_lint, run_test
66
66
  from .status_cmd import status as workspace_status
67
+ from .styles_cmd import styles as styles_group
67
68
  from .sync_cmd import sync as stx_sync
68
69
  from .upgrade_cmd import upgrade as project_upgrade
69
70
  from .validate_cmd import validate as stx_validate
@@ -217,6 +218,7 @@ cli.add_command(ds_group, name="ds")
217
218
  cli.add_command(kit_group, name="kit")
218
219
  cli.add_command(artifact_group, name="artifact")
219
220
  cli.add_command(stx_validate, name="validate")
221
+ cli.add_command(styles_group, name="styles")
220
222
 
221
223
 
222
224
  # --- Dev subgroup ----------------------------------------------------------
@@ -0,0 +1,359 @@
1
+ """stx styles dump — the styles reference, generated from the code (#6).
2
+
3
+ Claude writes blocks from references written by hand; they drift from the style code and never listed
4
+ the pt scale or the project's styles. This command walks ``StxStyles`` (and the project's ``Styles``),
5
+ resolves every ``var(--stx-X, fallback)`` against ``default.css`` (desktop, tablet, mobile), takes the
6
+ indexed scale from ``compute_scale()`` and writes ``.claude/references/streamtex_styles_api.md``.
7
+ ``stx claude install`` and ``update`` regenerate it when the version or its inputs change.
8
+
9
+ ``--check`` reports the drifts instead: a fallback that differs from ``default.css``, a shortcut whose
10
+ docstring says another size, an indexed scale in ``default.css`` that differs from ``compute_scale()``,
11
+ and every ``s.xxx`` cited in ``.claude/`` that resolves nowhere (a name the same file defines with
12
+ ``Style(...)``, ``s.text_*`` and a line saying the name "does not exist" are left out).
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import ast
18
+ import hashlib
19
+ import importlib
20
+ import inspect
21
+ import os
22
+ import re
23
+ import sys
24
+ from pathlib import Path
25
+
26
+ import click
27
+
28
+ REFERENCE = os.path.join(".claude", "references", "streamtex_styles_api.md")
29
+ _PROJECT_STYLES = os.path.join("custom", "styles.py")
30
+ _VAR_RE = re.compile(r"var\((--stx-[\w-]+),\s*([^)]+)\)")
31
+ _CITE_RE = re.compile(r"(?<![\w.])s\.([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)")
32
+ _HASH_RE = re.compile(r"inputs ([0-9a-f]{12})")
33
+ _DEFINED_RE = re.compile(r"^\s*(\w+)\s*=\s*(?:Style|ns)\(", flags=re.M)
34
+ _DENIED_RE = re.compile(r"does (?:\*\*)?not(?:\*\*)? exist")
35
+
36
+
37
+ def _styles_root():
38
+ from streamtex.styles import StxStyles
39
+ return StxStyles
40
+
41
+
42
+ def css_vars(text: str) -> dict[str, dict[str, str]]:
43
+ """The ``--stx-*`` values of ``:root`` in default.css, per screen: desktop, tablet (≤1024px), mobile (≤480px)."""
44
+ text = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
45
+ out: dict[str, dict[str, str]] = {"desktop": {}, "tablet": {}, "mobile": {}}
46
+ stack: list[str] = []
47
+ buf = ""
48
+
49
+ def decl(s: str) -> None:
50
+ m = re.fullmatch(r"\s*(--stx-[\w-]+)\s*:\s*(.+?)\s*", s, flags=re.S)
51
+ if not m or not stack or ":root" not in stack[-1]:
52
+ return
53
+ ctx = " ".join(stack)
54
+ if "prefers-color-scheme" in ctx:
55
+ return
56
+ screen = "mobile" if "480px" in ctx else "tablet" if "1024px" in ctx else "desktop"
57
+ out[screen].setdefault(m.group(1), m.group(2))
58
+
59
+ for ch in text:
60
+ if ch == "{":
61
+ stack.append(buf.strip())
62
+ buf = ""
63
+ elif ch in ";}":
64
+ decl(buf)
65
+ buf = ""
66
+ if ch == "}" and stack:
67
+ stack.pop()
68
+ else:
69
+ buf += ch
70
+ return out
71
+
72
+
73
+ def walk(cls, prefix: str, seen: dict[int, str], out: list, visited: set[int] | None = None) -> None:
74
+ """Every Style under *cls*, in definition order, once (the first path wins)."""
75
+ from streamtex.styles.core import Style
76
+ visited = set() if visited is None else visited
77
+ if id(cls) in visited:
78
+ return
79
+ visited.add(id(cls))
80
+ for name, value in vars(cls).items():
81
+ if name.startswith("_"):
82
+ continue
83
+ if isinstance(value, Style):
84
+ if id(value) not in seen:
85
+ seen[id(value)] = f"{prefix}.{name}"
86
+ out.append((f"{prefix}.{name}", value))
87
+ elif isinstance(value, type):
88
+ walk(value, f"{prefix}.{name}", seen, out, visited)
89
+
90
+
91
+ def collect(styles=None) -> tuple[list, list, list]:
92
+ """(library styles, shortcuts, project styles): lists of (path, Style); a shortcut's path is ``s.x``."""
93
+ from streamtex.styles.core import Style
94
+ root = _styles_root()
95
+ seen: dict[int, str] = {}
96
+ library: list = []
97
+ for cat in ("text", "container", "visibility"):
98
+ walk(getattr(root, cat), f"s.{cat}", seen, library)
99
+ shortcuts = [(f"s.{k}", v) for k, v in vars(root).items() if isinstance(v, Style) and not k.startswith("_")]
100
+ project: list = []
101
+ if styles is not None and styles is not root:
102
+ for k, v in vars(styles).items():
103
+ if k.startswith("_") or k in vars(root):
104
+ continue
105
+ if isinstance(v, Style):
106
+ project.append((f"s.{k}", v))
107
+ elif isinstance(v, type):
108
+ walk(v, f"s.{k}", seen, project)
109
+ return library, shortcuts, project
110
+
111
+
112
+ def _docstring_sizes() -> dict[str, str]:
113
+ """``s.Large`` → ``48pt``, read from the attribute docstrings of StxStyles (``\"\"\"48pt on desktop\"\"\"``)."""
114
+ tree = ast.parse(inspect.getsource(_styles_root()))
115
+ body = tree.body[0].body
116
+ out = {}
117
+ for a, b in zip(body, body[1:]):
118
+ if isinstance(a, ast.Assign) and isinstance(b, ast.Expr) and isinstance(b.value, ast.Constant) \
119
+ and isinstance(b.value.value, str) and len(a.targets) == 1 and isinstance(a.targets[0], ast.Name):
120
+ m = re.match(r"\s*(\d+pt) on desktop", b.value.value)
121
+ if m:
122
+ out[f"s.{a.targets[0].id}"] = m.group(1)
123
+ return out
124
+
125
+
126
+ def declared_module(project: Path) -> str:
127
+ """``[claude] styles = "shared.styles"`` in the project's stx.toml: where its ``Styles`` class lives when it
128
+ is not ``custom/styles.py``."""
129
+ import tomllib
130
+ try:
131
+ with open(project / "stx.toml", "rb") as f:
132
+ value = tomllib.load(f).get("claude", {}).get("styles", "")
133
+ except (OSError, tomllib.TOMLDecodeError, AttributeError):
134
+ return ""
135
+ return value if isinstance(value, str) else ""
136
+
137
+
138
+ def load_project_styles(project: Path, module: str = ""):
139
+ """The project's ``Styles`` class: *module* (dotted, e.g. ``shared.styles``), the one stx.toml declares,
140
+ or ``custom/styles.py``. Returns ``(Styles or None, the file read or None, a warning or "")``."""
141
+ module = module or declared_module(project)
142
+ if not module:
143
+ if not (project / _PROJECT_STYLES).is_file():
144
+ return None, None, ""
145
+ module = "custom.styles"
146
+ path = project.joinpath(*module.split(".")).with_suffix(".py")
147
+ top = module.split(".")[0]
148
+
149
+ def forget() -> None: # `stx claude update --all`: each project imports its own custom.styles
150
+ for name in [n for n in sys.modules if n == top or n.startswith(top + ".")]:
151
+ del sys.modules[name]
152
+ forget()
153
+ sys.path.insert(0, str(project))
154
+ try:
155
+ mod = importlib.import_module(module)
156
+ return getattr(mod, "Styles", None), path if path.is_file() else None, ""
157
+ except Exception as exc: # noqa: BLE001 — a broken project file must not stop the library reference
158
+ return None, None, f"the project styles ({module}) could not be imported: {exc}"
159
+ finally:
160
+ sys.path.remove(str(project))
161
+ forget()
162
+
163
+
164
+ def _inputs_hash(fmt: str, project_file: Path | None) -> str:
165
+ import streamtex
166
+ lib = Path(streamtex.__file__).parent
167
+ h = hashlib.sha256(fmt.encode())
168
+ for p in [lib / "static" / "default.css", *sorted((lib / "styles").glob("*.py")),
169
+ *sorted((lib / "styles").glob("*.toml")), *([project_file] if project_file else [])]:
170
+ h.update(p.read_bytes())
171
+ return h.hexdigest()[:12]
172
+
173
+
174
+ def _version() -> str:
175
+ try:
176
+ from importlib.metadata import version
177
+ return version("streamtex")
178
+ except Exception: # noqa: BLE001
179
+ return "?"
180
+
181
+
182
+ def _css_of(style, screens: dict) -> tuple[str, str, str]:
183
+ m = _VAR_RE.search(style.css)
184
+ if not m:
185
+ return ("", "", "")
186
+ var, fb = m.group(1), m.group(2).strip()
187
+ d = screens["desktop"].get(var, fb)
188
+ return (d, screens["tablet"].get(var, d), screens["mobile"].get(var, d))
189
+
190
+
191
+ def render(fmt: str = "compact", styles=None, project_file: Path | None = None) -> str:
192
+ """The reference, in Markdown."""
193
+ import streamtex
194
+ from streamtex.styles.scale import ScaleConfig, compute_scale
195
+ screens = css_vars((Path(streamtex.__file__).parent / "static" / "default.css").read_text(encoding="utf-8"))
196
+ library, shortcuts, project = collect(styles)
197
+ canonical = {id(s): p for p, s in library + project}
198
+ sizes = [(p, s) for p, s in library if p.startswith("s.text.sizes.")]
199
+ named = [(p, s) for p, s in sizes if re.search(r"var\(--stx-[A-Za-z]+-size", s.css)]
200
+ pts = [(p, s) for p, s in sizes if re.fullmatch(r"s\.text\.sizes\.pt\d+", p)]
201
+ L = [
202
+ "# StreamTeX styles API",
203
+ "",
204
+ f"> Generated by `stx styles dump` from the code — streamtex {_version()} · inputs "
205
+ f"{_inputs_hash(fmt, project_file)}. Do not edit: `stx claude update` regenerates it.",
206
+ "> Use these names instead of raw CSS (`s.text.sizes.pt36`, never `ns(\"font-size: 36pt;\")`).",
207
+ "",
208
+ "## Shortcuts (`s.*`)",
209
+ "",
210
+ "| Shortcut | Same as | CSS |",
211
+ "|---|---|---|",
212
+ ]
213
+ for p, s in shortcuts:
214
+ L.append(f"| `{p}` | `{canonical.get(id(s), '—')}` | `{s.css.strip()}` |")
215
+ L += ["", "## Named sizes (responsive, from default.css)", "",
216
+ "| Style | Desktop | Tablet (≤1024px) | Mobile (≤480px) |", "|---|---|---|---|"]
217
+ for p, s in named:
218
+ d, t, m = _css_of(s, screens)
219
+ L.append(f"| `{p}` | {d} | {t} | {m} |")
220
+ L += ["", "## pt scale (fixed, same on every screen)", "",
221
+ "`s.text.sizes.ptN` sets `font-size: Npt`: " + ", ".join(p.rsplit(".", 1)[1] for p, _ in pts) + ".", ""]
222
+ desktop, tablet, mobile = compute_scale(ScaleConfig(count=29))
223
+ L += ["## Indexed scale (`s.scale[i]` = `s.text.sizes.idx_i`)", "",
224
+ "Computed by `compute_scale()` (default curve; `st_book(scale=ScaleConfig(...))` changes it).", "",
225
+ "| i | Desktop | Tablet | Mobile |", "|---|---|---|---|"]
226
+ L += [f"| {i} | {d}pt | {t}pt | {m}pt |" for i, (d, t, m) in enumerate(zip(desktop, tablet, mobile))]
227
+ done = {p for p, _ in named + pts} | {p for p, _ in sizes if re.fullmatch(r"s\.text\.sizes\.idx_\d+", p)}
228
+ for title, items in (("Other styles", [(p, s) for p, s in library if p not in done]), ("Project styles", project)):
229
+ if not items:
230
+ continue
231
+ L += ["", f"## {title}", ""]
232
+ groups: dict[str, list] = {}
233
+ for p, s in items:
234
+ groups.setdefault(p.rsplit(".", 1)[0], []).append((p.rsplit(".", 1)[1], s))
235
+ for g, members in groups.items():
236
+ if fmt == "full":
237
+ L += [f"### `{g}`", "", "| Name | CSS |", "|---|---|"]
238
+ L += [f"| `{n}` | `{s.css.strip()}` |" for n, s in members] + [""]
239
+ else:
240
+ L.append(f"- `{g}`: " + ", ".join(n for n, _ in members))
241
+ return "\n".join(L).rstrip() + "\n"
242
+
243
+
244
+ def resolves(path: str, root) -> bool:
245
+ obj = root
246
+ for part in path.split("."):
247
+ if not hasattr(obj, part):
248
+ return False
249
+ obj = getattr(obj, part)
250
+ return True
251
+
252
+
253
+ def drifts(project: Path, styles=None) -> list[str]:
254
+ """The drifts, one line each; empty when the code, default.css and the references agree."""
255
+ import streamtex
256
+ from streamtex.styles.scale import ScaleConfig, compute_scale
257
+ css = (Path(streamtex.__file__).parent / "static" / "default.css").read_text(encoding="utf-8")
258
+ screens = css_vars(css)
259
+ library, shortcuts, project_styles = collect(styles)
260
+ problems = []
261
+ for p, s in library + project_styles:
262
+ m = _VAR_RE.search(s.css)
263
+ if not m or re.fullmatch(r"--stx-scale-\d+", m.group(1)):
264
+ continue
265
+ var, fb = m.group(1), m.group(2).strip()
266
+ if var not in screens["desktop"]:
267
+ problems.append(f"{p}: {var} has no value in default.css (fallback {fb})")
268
+ elif screens["desktop"][var] != fb:
269
+ problems.append(f"{p}: fallback {fb}, default.css says {screens['desktop'][var]}")
270
+ by_name = dict(shortcuts)
271
+ for p, said in _docstring_sizes().items():
272
+ d = _css_of(by_name[p], screens)[0] if p in by_name else ""
273
+ if d and d != said:
274
+ problems.append(f"{p}: its docstring says {said}, default.css says {d}")
275
+ for screen, values in zip(("desktop", "tablet", "mobile"), compute_scale(ScaleConfig(count=29))):
276
+ for i, v in enumerate(values):
277
+ got = screens[screen].get(f"--stx-scale-{i}")
278
+ if got is not None and got != f"{v}pt":
279
+ problems.append(f"default.css --stx-scale-{i} ({screen}): {got}, compute_scale() gives {v}pt")
280
+ root = styles or _styles_root()
281
+ claude = project / ".claude"
282
+ for f in sorted([*claude.glob("references/**/*.md"), *claude.glob("commands/**/*.md")]):
283
+ if f.name == os.path.basename(REFERENCE):
284
+ continue
285
+ text = f.read_text(encoding="utf-8", errors="ignore")
286
+ defined = set(_DEFINED_RE.findall(text)) # an example's own `heading = Style(...)`
287
+ for n, line in enumerate(text.splitlines(), 1):
288
+ if _DENIED_RE.search(line):
289
+ continue # "`s.idx_6` does not exist"
290
+ for m in _CITE_RE.finditer(line):
291
+ cited = m.group(1)
292
+ if line[m.end():m.end() + 1] == "*" or cited == "project" or cited.split(".")[0] in defined \
293
+ or (cited.startswith("project.") and styles is None):
294
+ continue # s.text_* , the s.project namespace
295
+ if not resolves(cited, root):
296
+ problems.append(f"{f.relative_to(project)}:{n}: s.{cited} does not exist")
297
+ return problems
298
+
299
+
300
+ def _write(path: Path, content: str) -> None:
301
+ path.parent.mkdir(parents=True, exist_ok=True)
302
+ if path.exists():
303
+ os.chmod(path, 0o644)
304
+ path.write_text(content, encoding="utf-8")
305
+ os.chmod(path, 0o444)
306
+
307
+
308
+ def refresh_reference(target: str) -> str | None:
309
+ """For ``stx claude``: write the reference into *target* when it is missing or its inputs changed.
310
+ Returns its relative path when written, None otherwise (a warning goes to stderr on failure)."""
311
+ project = Path(target)
312
+ styles, pfile, warn = load_project_styles(project)
313
+ if warn:
314
+ click.echo(f" ⚠ styles reference: {warn}", err=True)
315
+ out = project / REFERENCE
316
+ old = out.read_text(encoding="utf-8") if out.is_file() else ""
317
+ m = _HASH_RE.search(old)
318
+ if m and m.group(1) == _inputs_hash("compact", pfile) and f"streamtex {_version()} " in old:
319
+ return None
320
+ try:
321
+ _write(out, render("compact", styles, pfile))
322
+ except OSError as exc:
323
+ click.echo(f" ⚠ styles reference not written: {exc}", err=True)
324
+ return None
325
+ return REFERENCE
326
+
327
+
328
+ @click.group()
329
+ def styles():
330
+ """The styles reference, generated from the code."""
331
+
332
+
333
+ @styles.command("dump")
334
+ @click.argument("path", default=".", type=click.Path(exists=True, file_okay=False))
335
+ @click.option("-o", "--output", default="", help=f"Where to write (default: PATH/{REFERENCE}; '-' prints).")
336
+ @click.option("--format", "fmt", type=click.Choice(["compact", "full"]), default="compact", show_default=True,
337
+ help="compact lists the names of the other styles; full gives each one's CSS.")
338
+ @click.option("--check", is_flag=True, help="Report the drifts (code, default.css, .claude references) and exit 1.")
339
+ @click.option("--styles", "module", default="",
340
+ help="The project's styles module (default: [claude] styles in stx.toml, else custom/styles.py).")
341
+ def dump_cmd(path, output, fmt, check, module):
342
+ """Write the styles reference of the library and the project (#6)."""
343
+ project = Path(path).resolve()
344
+ styles_cls, pfile, warn = load_project_styles(project, module)
345
+ if warn:
346
+ click.echo(f"⚠ {warn}", err=True)
347
+ if check:
348
+ problems = drifts(project, styles_cls)
349
+ for p in problems:
350
+ click.echo(f"✗ {p}")
351
+ click.echo(f"{len(problems)} drift(s)" if problems else "✓ no drift")
352
+ sys.exit(1 if problems else 0)
353
+ content = render(fmt, styles_cls, pfile)
354
+ if output == "-":
355
+ click.echo(content, nl=False)
356
+ return
357
+ dest = Path(output) if output else project / REFERENCE
358
+ _write(dest, content)
359
+ click.echo(f"✓ {dest} ({content.count(chr(10))} lines)")
@@ -107,7 +107,7 @@ from pathlib import Path
107
107
  from urllib.parse import parse_qs, urlsplit
108
108
 
109
109
  #: The library release this file ships with, and its interface number (#135).
110
- STX_VERSION = "0.7.78"
110
+ STX_VERSION = "0.7.79"
111
111
  AUTH_INTERFACE = 3
112
112
 
113
113
  DEFAULT_ROOT = "/var/lib/stx-auth"
@@ -12,6 +12,7 @@ import re
12
12
  import shlex
13
13
  import subprocess
14
14
  import sys
15
+ import time
15
16
  import urllib.error
16
17
  import urllib.parse
17
18
  import urllib.request
@@ -38,6 +39,23 @@ STATIC_ROOT = "/srv/static"
38
39
  #: path limit).
39
40
  CONTROL_PATH = "~/.ssh/stx-cm-%C"
40
41
 
42
+ #: A connection cut while it opens, before any command ran (#152): measured on 2026-10-29, a network device
43
+ #: between the machine and the server cuts the 20th connection opened within a few seconds, and every next
44
+ #: one for about a minute (once 50 s were not enough). Such a failure is retried after these waits (seconds).
45
+ RETRY_WAITS = (5, 15, 30, 60)
46
+ _CUT_AT_OPEN = re.compile(r"kex_exchange_identification|Connection (?:reset|closed) by \S+ port \d+")
47
+
48
+
49
+ def _run(argv: list[str], input: str | None = None) -> subprocess.CompletedProcess:
50
+ """Run an ssh (or rsync over ssh) command; retry it when the connection was cut while opening."""
51
+ for wait in (*RETRY_WAITS, None):
52
+ r = subprocess.run(argv, input=input, text=True, capture_output=True)
53
+ if not r.returncode or wait is None or not _CUT_AT_OPEN.search(r.stderr or ""):
54
+ return r
55
+ print(f" the SSH connection was cut while opening; new try in {wait} s", file=sys.stderr, flush=True)
56
+ time.sleep(wait)
57
+ return r
58
+
41
59
 
42
60
  @functools.cache
43
61
  def _openrsync() -> bool:
@@ -65,16 +83,18 @@ class Target:
65
83
 
66
84
  # -- commands -----------------------------------------------------------------------
67
85
  def ssh_argv(self) -> list[str]:
68
- """One shared connection for every command and copy (ControlMaster): the server resets new
69
- connections beyond about 18 in a burst (seen by all-trainings, 2026-10-26)."""
86
+ """One shared connection for every command and copy (ControlMaster): new connections beyond about
87
+ 18 in a burst are cut (seen by all-trainings, 2026-10-26; by a network device on the way, #152)."""
70
88
  key = os.path.expanduser(self.cfg.get("ssh_key", ""))
71
89
  return ["ssh", *(["-i", key] if key else []), "-o", "BatchMode=yes",
72
90
  "-o", "ControlMaster=auto", "-o", f"ControlPath={CONTROL_PATH}", "-o", "ControlPersist=120",
73
91
  self.cfg["host"]]
74
92
 
75
93
  def sh(self, cmd: str, check: bool = True, input: str | None = None) -> subprocess.CompletedProcess:
76
- argv = ["sh", "-c", cmd] if self.kind == "local" else [*self.ssh_argv(), cmd]
77
- r = subprocess.run(argv, input=input, text=True, capture_output=True)
94
+ if self.kind == "local":
95
+ r = subprocess.run(["sh", "-c", cmd], input=input, text=True, capture_output=True)
96
+ else:
97
+ r = _run([*self.ssh_argv(), cmd], input=input)
78
98
  if check and r.returncode:
79
99
  raise ReleaseError(f"{self.name}: `{cmd[:120]}` failed: {(r.stderr or r.stdout)[-600:]}")
80
100
  return r
@@ -94,7 +114,7 @@ class Target:
94
114
  else:
95
115
  ssh = " ".join(shlex.quote(x) for x in self.ssh_argv()[:-1])
96
116
  argv = ["rsync", "-a", "-e", ssh, *opts, src, f"{self.cfg['host']}:{dest}"]
97
- r = subprocess.run(argv, text=True, capture_output=True)
117
+ r = subprocess.run(argv, text=True, capture_output=True) if self.kind == "local" else _run(argv)
98
118
  if r.returncode:
99
119
  raise ReleaseError(f"{self.name}: rsync to {dest} failed: {r.stderr[-600:]}")
100
120
 
@@ -115,7 +135,7 @@ class Target:
115
135
  cmd = f"mkdir -p {shlex.quote(os.path.dirname(dest))} && cat > {shlex.quote(dest)}"
116
136
  if mode is not None:
117
137
  cmd += f" && chmod {mode:o} {shlex.quote(dest)}"
118
- r = subprocess.run([*self.ssh_argv(), cmd], input=content, text=True, capture_output=True)
138
+ r = _run([*self.ssh_argv(), cmd], input=content)
119
139
  if r.returncode:
120
140
  raise ReleaseError(f"{self.name}: writing {dest} failed: {r.stderr[-400:]}")
121
141
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamtex
3
- Version: 0.7.78
3
+ Version: 0.7.79
4
4
  Summary: AI-powered content framework for Streamlit — create presentations, courses, and web-books with Claude or Cursor, no coding required.
5
5
  Author-email: Nicolas Guelfi <nicolas.guelfi@laposte.net>
6
6
  License-Expression: BUSL-1.1
@@ -119,6 +119,7 @@ streamtex/cli/run_set.py
119
119
  streamtex/cli/screenshot_cmd.py
120
120
  streamtex/cli/shortcuts.py
121
121
  streamtex/cli/status_cmd.py
122
+ streamtex/cli/styles_cmd.py
122
123
  streamtex/cli/sync_cmd.py
123
124
  streamtex/cli/upgrade_cmd.py
124
125
  streamtex/cli/validate_cmd.py
File without changes
File without changes
File without changes
File without changes