velm 0.1.2__py3-none-any.whl

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 (2195) hide show
  1. velm/__init__.py +17 -0
  2. velm/__main__.py +24 -0
  3. velm/archetypes/__init__.py +10 -0
  4. velm/archetypes/genesis/ai-agent-swarm.scaffold +117 -0
  5. velm/archetypes/genesis/astro-basic.scaffold +76 -0
  6. velm/archetypes/genesis/chrome-extension.scaffold +101 -0
  7. velm/archetypes/genesis/cli-tool.scaffold +198 -0
  8. velm/archetypes/genesis/data-science-crucible.scaffold +96 -0
  9. velm/archetypes/genesis/docs-mkdocs.scaffold +123 -0
  10. velm/archetypes/genesis/electron-forge.scaffold +103 -0
  11. velm/archetypes/genesis/express-api.scaffold +163 -0
  12. velm/archetypes/genesis/fastapi-service.scaffold +343 -0
  13. velm/archetypes/genesis/fastapi-sqlalchemy.scaffold +130 -0
  14. velm/archetypes/genesis/fullstack-monorepo.scaffold +200 -0
  15. velm/archetypes/genesis/generic-container.scaffold +188 -0
  16. velm/archetypes/genesis/generic-script.scaffold +48 -0
  17. velm/archetypes/genesis/generic.scaffold +33 -0
  18. velm/archetypes/genesis/gnostic-library.scaffold +79 -0
  19. velm/archetypes/genesis/gnostic-symphony.scaffold +77 -0
  20. velm/archetypes/genesis/go-cli.scaffold +127 -0
  21. velm/archetypes/genesis/graphene-api.scaffold +86 -0
  22. velm/archetypes/genesis/grpc-microservice.scaffold +103 -0
  23. velm/archetypes/genesis/langchain-nexus.scaffold +91 -0
  24. velm/archetypes/genesis/monorepo-citadel.scaffold +0 -0
  25. velm/archetypes/genesis/new-artisan.scaffold +42 -0
  26. velm/archetypes/genesis/nextjs-fortress.scaffold +120 -0
  27. velm/archetypes/genesis/node-basic.scaffold +130 -0
  28. velm/archetypes/genesis/node.scaffold +63 -0
  29. velm/archetypes/genesis/poetry-basic.scaffold +114 -0
  30. velm/archetypes/genesis/python-basic.scaffold +115 -0
  31. velm/archetypes/genesis/python-cli.scaffold +124 -0
  32. velm/archetypes/genesis/python-universal.scaffold +159 -0
  33. velm/archetypes/genesis/react-vite.scaffold +198 -0
  34. velm/archetypes/genesis/rust-lib.scaffold +145 -0
  35. velm/archetypes/genesis/serverless-synapse.scaffold +61 -0
  36. velm/artisans/TODO.txt +4 -0
  37. velm/artisans/__init__.py +0 -0
  38. velm/artisans/adopt.py +194 -0
  39. velm/artisans/aether/__init__.py +4 -0
  40. velm/artisans/aether/analyzer.py +56 -0
  41. velm/artisans/aether/artisan.py +40 -0
  42. velm/artisans/aether/mesh.py +27 -0
  43. velm/artisans/agent/Act/__init__.py +0 -0
  44. velm/artisans/agent/Act/executor.py +83 -0
  45. velm/artisans/agent/Act/tools/__init__.py +0 -0
  46. velm/artisans/agent/Act/tools/base.py +25 -0
  47. velm/artisans/agent/Act/tools/file_system.py +144 -0
  48. velm/artisans/agent/Act/tools/git.py +258 -0
  49. velm/artisans/agent/Act/tools/gnostic_tools.py +236 -0
  50. velm/artisans/agent/Act/tools/testing.py +42 -0
  51. velm/artisans/agent/Memory/__init__.py +0 -0
  52. velm/artisans/agent/Memory/long_term.py +187 -0
  53. velm/artisans/agent/Memory/short_term.py +33 -0
  54. velm/artisans/agent/Perceive/__init__.py +1 -0
  55. velm/artisans/agent/Perceive/perceiver.py +41 -0
  56. velm/artisans/agent/Plan/__init__.py +1 -0
  57. velm/artisans/agent/Plan/planner.py +61 -0
  58. velm/artisans/agent/Plan/prompt_forge.py +146 -0
  59. velm/artisans/agent/Verify/__init__.py +0 -0
  60. velm/artisans/agent/Verify/critic.py +177 -0
  61. velm/artisans/agent/__init__.py +3 -0
  62. velm/artisans/agent/agent.scaffold +32 -0
  63. velm/artisans/agent/artisan.py +174 -0
  64. velm/artisans/agent/contracts.py +42 -0
  65. velm/artisans/agent/engine.py +208 -0
  66. velm/artisans/akasha/__init__.py +0 -0
  67. velm/artisans/akasha/artisan.py +68 -0
  68. velm/artisans/alias/__init__.py +3 -0
  69. velm/artisans/alias/artisan.py +69 -0
  70. velm/artisans/analyze/__init__.py +13 -0
  71. velm/artisans/analyze/artisan.py +457 -0
  72. velm/artisans/analyze/completion_codex/__init__.py +11 -0
  73. velm/artisans/analyze/completion_codex/conductor.py +213 -0
  74. velm/artisans/analyze/completion_codex/scaffold.py +615 -0
  75. velm/artisans/analyze/completion_codex/symphony.py +275 -0
  76. velm/artisans/analyze/core/context.py +107 -0
  77. velm/artisans/analyze/core/shadow.py +57 -0
  78. velm/artisans/analyze/divination/grammar.py +145 -0
  79. velm/artisans/analyze/graph_generator.py +57 -0
  80. velm/artisans/analyze/orchestrator.py +138 -0
  81. velm/artisans/analyze/processing/base.py +13 -0
  82. velm/artisans/analyze/processing/foreign.py +67 -0
  83. velm/artisans/analyze/processing/scaffold.py +319 -0
  84. velm/artisans/analyze/redemption/healer.py +82 -0
  85. velm/artisans/analyze/reporting/console.py +95 -0
  86. velm/artisans/analyze/reporting/diagnostics.py +169 -0
  87. velm/artisans/analyze/reporting/privacy.py +86 -0
  88. velm/artisans/analyze/rites/inquisition.py +35 -0
  89. velm/artisans/analyze/rites/prophecy.py +74 -0
  90. velm/artisans/analyze/rites/symbolism.py +62 -0
  91. velm/artisans/analyze/rites/visualization.py +146 -0
  92. velm/artisans/analyze/static_inquisitor/__init__.py +5 -0
  93. velm/artisans/analyze/static_inquisitor/detectors/atomic.py +325 -0
  94. velm/artisans/analyze/static_inquisitor/detectors/base.py +116 -0
  95. velm/artisans/analyze/static_inquisitor/detectors/paths.py +184 -0
  96. velm/artisans/analyze/static_inquisitor/detectors/variables.py +202 -0
  97. velm/artisans/analyze/static_inquisitor/inquisitor.py +101 -0
  98. velm/artisans/analyze/structure_visualizer.py +294 -0
  99. velm/artisans/arch.py +281 -0
  100. velm/artisans/archetypes/artisan.py +242 -0
  101. velm/artisans/architect/__init__.py +13 -0
  102. velm/artisans/architect/artisan.py +241 -0
  103. velm/artisans/architect/contracts.py +19 -0
  104. velm/artisans/architect/inquest.py +58 -0
  105. velm/artisans/architect/planner.py +85 -0
  106. velm/artisans/astrolabe/__init__.py +4 -0
  107. velm/artisans/astrolabe/artisan.py +45 -0
  108. velm/artisans/astrolabe/tui.py +124 -0
  109. velm/artisans/audit/__init__.py +5 -0
  110. velm/artisans/audit/architectural_auditor.py +124 -0
  111. velm/artisans/audit/artisan.py +38 -0
  112. velm/artisans/audit/license_auditor.py +158 -0
  113. velm/artisans/babel/__init__.py +0 -0
  114. velm/artisans/babel/artisan.py +93 -0
  115. velm/artisans/beautify.py +250 -0
  116. velm/artisans/biome/__init__.py +5 -0
  117. velm/artisans/biome/analyst.py +102 -0
  118. velm/artisans/biome/artisan.py +55 -0
  119. velm/artisans/biome/template.py +298 -0
  120. velm/artisans/blame.py +334 -0
  121. velm/artisans/blueprint_add.py +200 -0
  122. velm/artisans/blueprint_optimize/__init__.py +2 -0
  123. velm/artisans/blueprint_optimize/artisan.py +105 -0
  124. velm/artisans/blueprint_optimize/biologist.py +115 -0
  125. velm/artisans/blueprint_remove.py +225 -0
  126. velm/artisans/bridge/__init__.py +3 -0
  127. velm/artisans/bridge/artisan.py +137 -0
  128. velm/artisans/canon/__init__.py +4 -0
  129. velm/artisans/canon/artisan.py +51 -0
  130. velm/artisans/canon/law.py +23 -0
  131. velm/artisans/changelog/artisan.py +137 -0
  132. velm/artisans/chaos_game/__init__.py +3 -0
  133. velm/artisans/chaos_game/artisan.py +93 -0
  134. velm/artisans/ci_optimize/__init__.py +2 -0
  135. velm/artisans/ci_optimize/artisan.py +97 -0
  136. velm/artisans/ci_optimize/engine.py +122 -0
  137. velm/artisans/cli_bridge/artisan.py +199 -0
  138. velm/artisans/codex/__init__.py +0 -0
  139. velm/artisans/codex/artisan.py +130 -0
  140. velm/artisans/completion_artisan/__init__.py +10 -0
  141. velm/artisans/completion_artisan/artisan.py +286 -0
  142. velm/artisans/completion_artisan/cartographer.py +424 -0
  143. velm/artisans/completion_artisan/grimoire/reader.py +164 -0
  144. velm/artisans/completion_artisan/grimoire/snippets/scaffold.jsonc +1728 -0
  145. velm/artisans/completion_artisan/grimoire/snippets/symphony.jsonc +1073 -0
  146. velm/artisans/completion_artisan/prophets/__init__.py +13 -0
  147. velm/artisans/completion_artisan/prophets/alchemist.py +205 -0
  148. velm/artisans/completion_artisan/prophets/base.py +133 -0
  149. velm/artisans/completion_artisan/prophets/canon.py +156 -0
  150. velm/artisans/completion_artisan/prophets/directives.py +242 -0
  151. velm/artisans/completion_artisan/prophets/snippets.py +24 -0
  152. velm/artisans/compose/__init__.py +14 -0
  153. velm/artisans/compose/artisan.py +198 -0
  154. velm/artisans/compose/parser.py +220 -0
  155. velm/artisans/configuration/__init__.py +2 -0
  156. velm/artisans/configuration/artisan.py +81 -0
  157. velm/artisans/conform.py +260 -0
  158. velm/artisans/create/__init__.py +13 -0
  159. velm/artisans/create/artisan.py +240 -0
  160. velm/artisans/create/builder.py +477 -0
  161. velm/artisans/create/create.scaffold +7 -0
  162. velm/artisans/create/safety.py +70 -0
  163. velm/artisans/daemon_artisan/__init__.py +14 -0
  164. velm/artisans/daemon_artisan/conductor.py +122 -0
  165. velm/artisans/daemon_artisan/contracts.py +23 -0
  166. velm/artisans/daemon_artisan/governance.py +22 -0
  167. velm/artisans/daemon_artisan/lifecycle.py +498 -0
  168. velm/artisans/daemon_artisan/telemetry.py +63 -0
  169. velm/artisans/data/__init__.py +0 -0
  170. velm/artisans/data/artisan.py +152 -0
  171. velm/artisans/definition/__init__.py +17 -0
  172. velm/artisans/definition/alchemist.py +48 -0
  173. velm/artisans/definition/hierophant.py +138 -0
  174. velm/artisans/definition/oracle.py +148 -0
  175. velm/artisans/deploy/__init__.py +14 -0
  176. velm/artisans/deploy/artisan.py +237 -0
  177. velm/artisans/distill/__init__.py +15 -0
  178. velm/artisans/distill/artisan.py +407 -0
  179. velm/artisans/distill/celestial.py +55 -0
  180. velm/artisans/distill/codex_of_anti_patterns.py +54 -0
  181. velm/artisans/distill/core/__init__.py +14 -0
  182. velm/artisans/distill/core/analyzer/architectural.py +93 -0
  183. velm/artisans/distill/core/assembler/__init__.py +14 -0
  184. velm/artisans/distill/core/assembler/budget.py +37 -0
  185. velm/artisans/distill/core/assembler/content/__init__.py +14 -0
  186. velm/artisans/distill/core/assembler/content/artisans/__init__.py +19 -0
  187. velm/artisans/distill/core/assembler/content/artisans/annotator.py +102 -0
  188. velm/artisans/distill/core/assembler/content/artisans/formatter.py +352 -0
  189. velm/artisans/distill/core/assembler/content/artisans/reader.py +35 -0
  190. velm/artisans/distill/core/assembler/content/artisans/sanitizer.py +39 -0
  191. velm/artisans/distill/core/assembler/content/artisans/summarizer.py +60 -0
  192. velm/artisans/distill/core/assembler/content/artisans/transformer.py +46 -0
  193. velm/artisans/distill/core/assembler/content/contracts.py +35 -0
  194. velm/artisans/distill/core/assembler/content/facade.py +84 -0
  195. velm/artisans/distill/core/assembler/content/orchestrator.py +96 -0
  196. velm/artisans/distill/core/assembler/contracts.py +25 -0
  197. velm/artisans/distill/core/assembler/engine.py +212 -0
  198. velm/artisans/distill/core/assembler/header.py +84 -0
  199. velm/artisans/distill/core/assembler/seer.py +70 -0
  200. velm/artisans/distill/core/causality/__init__.py +15 -0
  201. velm/artisans/distill/core/causality/constants.py +30 -0
  202. velm/artisans/distill/core/causality/contracts.py +57 -0
  203. velm/artisans/distill/core/causality/engine.py +77 -0
  204. velm/artisans/distill/core/causality/graph_walker.py +138 -0
  205. velm/artisans/distill/core/consts.py +47 -0
  206. velm/artisans/distill/core/contracts.py +89 -0
  207. velm/artisans/distill/core/forensics/__init__.py +7 -0
  208. velm/artisans/distill/core/forensics/contracts.py +36 -0
  209. velm/artisans/distill/core/forensics/detectives.py +115 -0
  210. velm/artisans/distill/core/forensics/engine.py +121 -0
  211. velm/artisans/distill/core/forensics/filters.py +36 -0
  212. velm/artisans/distill/core/forensics/grimoire.py +48 -0
  213. velm/artisans/distill/core/governance/__init__.py +22 -0
  214. velm/artisans/distill/core/governance/contracts.py +51 -0
  215. velm/artisans/distill/core/governance/engine.py +273 -0
  216. velm/artisans/distill/core/governance/estimator.py +76 -0
  217. velm/artisans/distill/core/governance/policies.py +52 -0
  218. velm/artisans/distill/core/inquisitor/architectural.py +58 -0
  219. velm/artisans/distill/core/inquisitor/config.py +86 -0
  220. velm/artisans/distill/core/inquisitor/temporal.py +105 -0
  221. velm/artisans/distill/core/inquisitor/testing.py +59 -0
  222. velm/artisans/distill/core/oracle/__init__.py +18 -0
  223. velm/artisans/distill/core/oracle/adjudicator.py +113 -0
  224. velm/artisans/distill/core/oracle/contracts.py +66 -0
  225. velm/artisans/distill/core/oracle/diviner.py +222 -0
  226. velm/artisans/distill/core/oracle/engine.py +138 -0
  227. velm/artisans/distill/core/oracle/perceiver.py +121 -0
  228. velm/artisans/distill/core/oracle/propagator.py +304 -0
  229. velm/artisans/distill/core/oracle/reviewer.py +124 -0
  230. velm/artisans/distill/core/oracle/scribe/__init__.py +8 -0
  231. velm/artisans/distill/core/oracle/scribe/content.py +121 -0
  232. velm/artisans/distill/core/oracle/scribe/critique.py +57 -0
  233. velm/artisans/distill/core/oracle/scribe/facade.py +87 -0
  234. velm/artisans/distill/core/oracle/scribe/header.py +119 -0
  235. velm/artisans/distill/core/oracle/scribe/manifest.py +67 -0
  236. velm/artisans/distill/core/oracle/scribe/topology.py +54 -0
  237. velm/artisans/distill/core/scribes/mermaid_scribe.py +65 -0
  238. velm/artisans/distill/core/skeletonizer/__init__.py +7 -0
  239. velm/artisans/distill/core/skeletonizer/contracts.py +30 -0
  240. velm/artisans/distill/core/skeletonizer/engine.py +84 -0
  241. velm/artisans/distill/core/skeletonizer/utils.py +117 -0
  242. velm/artisans/distill/core/skeletonizer/visitors/base.py +15 -0
  243. velm/artisans/distill/core/skeletonizer/visitors/c_style.py +173 -0
  244. velm/artisans/distill/core/skeletonizer/visitors/python.py +170 -0
  245. velm/artisans/distill/core/skeletonizer/visitors/ruby.py +71 -0
  246. velm/artisans/distill/core/skeletonizer/visitors/web.py +57 -0
  247. velm/artisans/distill/core/slicer/__init__.py +15 -0
  248. velm/artisans/distill/core/slicer/contracts.py +76 -0
  249. velm/artisans/distill/core/slicer/engine.py +76 -0
  250. velm/artisans/distill/core/slicer/graph.py +95 -0
  251. velm/artisans/distill/core/slicer/languages/base.py +26 -0
  252. velm/artisans/distill/core/slicer/languages/python.py +87 -0
  253. velm/artisans/distill/core/slicer/weavers/__init__.py +4 -0
  254. velm/artisans/distill/core/slicer/weavers/base_strategy.py +28 -0
  255. velm/artisans/distill/core/slicer/weavers/contracts.py +21 -0
  256. velm/artisans/distill/core/slicer/weavers/facade.py +134 -0
  257. velm/artisans/distill/core/slicer/weavers/python_strategy.py +135 -0
  258. velm/artisans/distill/core/tracer/__init__.py +6 -0
  259. velm/artisans/distill/core/tracer/contracts.py +66 -0
  260. velm/artisans/distill/core/tracer/coverage_bridge.py +105 -0
  261. velm/artisans/distill/core/tracer/engine.py +170 -0
  262. velm/artisans/distill/core/tracer/probes/base.py +21 -0
  263. velm/artisans/distill/core/tracer/probes/python_probe.py +153 -0
  264. velm/artisans/distill/core/tracer/snapshot.py +58 -0
  265. velm/artisans/distill/core/tracer/symbolic.py +38 -0
  266. velm/artisans/distill/core/utils/__init__.py +1 -0
  267. velm/artisans/distill/core/utils/core.py +175 -0
  268. velm/artisans/distill/io.py +110 -0
  269. velm/artisans/distill/modes.py +81 -0
  270. velm/artisans/distill/resolution.py +185 -0
  271. velm/artisans/distill/scribes/dossier_scribe.py +196 -0
  272. velm/artisans/dream.py +41 -0
  273. velm/artisans/env_tools.py +298 -0
  274. velm/artisans/excise.py +213 -0
  275. velm/artisans/expose/__init__.py +3 -0
  276. velm/artisans/expose/artisan.py +64 -0
  277. velm/artisans/forge/__init__.py +3 -0
  278. velm/artisans/forge/artisan.py +117 -0
  279. velm/artisans/fortress/__init__.py +0 -0
  280. velm/artisans/fortress/artisan.py +86 -0
  281. velm/artisans/freeze_artisan.py +82 -0
  282. velm/artisans/fusion/__init__.py +3 -0
  283. velm/artisans/fusion/artisan.py +187 -0
  284. velm/artisans/garden/__init__.py +6 -0
  285. velm/artisans/garden/analyst.py +183 -0
  286. velm/artisans/garden/artisan.py +76 -0
  287. velm/artisans/garden/contracts.py +22 -0
  288. velm/artisans/garden/pruner.py +69 -0
  289. velm/artisans/genesis/__init__.py +6 -0
  290. velm/artisans/genesis/conductor.py +366 -0
  291. velm/artisans/genesis/materializer.py +514 -0
  292. velm/artisans/ghost_hunter/__init__.py +3 -0
  293. velm/artisans/ghost_hunter/artisan.py +106 -0
  294. velm/artisans/graph/__init__.py +3 -0
  295. velm/artisans/graph/architect.py +70 -0
  296. velm/artisans/graph/artisan.py +39 -0
  297. velm/artisans/graph/cartographer.py +275 -0
  298. velm/artisans/graph/layout.py +27 -0
  299. velm/artisans/gui/__init__.py +3 -0
  300. velm/artisans/gui/app.py +124 -0
  301. velm/artisans/gui/artisan.py +49 -0
  302. velm/artisans/guild/__init__.py +4 -0
  303. velm/artisans/guild/artisan.py +111 -0
  304. velm/artisans/guild/packer.py +33 -0
  305. velm/artisans/guild/registry.py +99 -0
  306. velm/artisans/harvest.py +206 -0
  307. velm/artisans/heal/__init__.py +6 -0
  308. velm/artisans/heal/artisan.py +306 -0
  309. velm/artisans/heal/contracts.py +74 -0
  310. velm/artisans/heal/healers/javascript_import_healer.py +150 -0
  311. velm/artisans/heal/healers/python_import_healer.py +149 -0
  312. velm/artisans/heal/healers/typescript_import_healer.py +165 -0
  313. velm/artisans/help.py +339 -0
  314. velm/artisans/history/__init__.py +15 -0
  315. velm/artisans/history/artisan.py +184 -0
  316. velm/artisans/history/contracts.py +80 -0
  317. velm/artisans/history/differ.py +248 -0
  318. velm/artisans/history/scribe.py +121 -0
  319. velm/artisans/history/tui.py +256 -0
  320. velm/artisans/hivemind/__init__.py +4 -0
  321. velm/artisans/hivemind/arena.py +174 -0
  322. velm/artisans/hivemind/artisan.py +66 -0
  323. velm/artisans/hivemind/contracts.py +36 -0
  324. velm/artisans/hivemind/grimoire.py +66 -0
  325. velm/artisans/holocron/__init__.py +4 -0
  326. velm/artisans/holocron/artisan.py +35 -0
  327. velm/artisans/holocron/contracts.py +21 -0
  328. velm/artisans/holocron/curator.py +63 -0
  329. velm/artisans/holocron/engine.py +154 -0
  330. velm/artisans/holocron/graph.py +209 -0
  331. velm/artisans/holocron/slicer.py +135 -0
  332. velm/artisans/holograph_artisan.py +98 -0
  333. velm/artisans/holographic/__init__.py +3 -0
  334. velm/artisans/holographic/artisan.py +59 -0
  335. velm/artisans/hover/__init__.py +16 -0
  336. velm/artisans/hover/canon.py +46 -0
  337. velm/artisans/hover/command_grimoire.py +1147 -0
  338. velm/artisans/hover/formatter.py +290 -0
  339. velm/artisans/hover/hierophant.py +457 -0
  340. velm/artisans/hover/hover_mentor/__init__.py +54 -0
  341. velm/artisans/hover/hover_mentor/grimoire.py +458 -0
  342. velm/artisans/hover/hover_mentor/inquisitor.py +68 -0
  343. velm/artisans/hover/hover_mentor/warden.py +51 -0
  344. velm/artisans/hover/perception.py +236 -0
  345. velm/artisans/ignore/artisan.py +70 -0
  346. velm/artisans/indexer/__init__.py +3 -0
  347. velm/artisans/indexer/artisan.py +50 -0
  348. velm/artisans/indexer/core/contracts.py +14 -0
  349. velm/artisans/indexer/core/engine.py +51 -0
  350. velm/artisans/indexer/languages/base.py +33 -0
  351. velm/artisans/indexer/languages/factory.py +25 -0
  352. velm/artisans/indexer/languages/go.py +13 -0
  353. velm/artisans/indexer/languages/java.py +13 -0
  354. velm/artisans/indexer/languages/javascript.py +17 -0
  355. velm/artisans/indexer/languages/python.py +14 -0
  356. velm/artisans/indexer/languages/ruby.py +13 -0
  357. velm/artisans/indexer/languages/rust.py +15 -0
  358. velm/artisans/init/__init__.py +12 -0
  359. velm/artisans/init/artisan.py +288 -0
  360. velm/artisans/init/manual.py +156 -0
  361. velm/artisans/initialize/artisan.py +262 -0
  362. velm/artisans/inspect/__init__.py +3 -0
  363. velm/artisans/inspect/artisan.py +643 -0
  364. velm/artisans/introspect/__init__.py +13 -0
  365. velm/artisans/introspect/conductor.py +80 -0
  366. velm/artisans/introspect/registry_scribe.py +109 -0
  367. velm/artisans/introspect/scaffold_scribe.py +348 -0
  368. velm/artisans/introspect/symphony_scribe.py +291 -0
  369. velm/artisans/introspect/ui_scribe.py +105 -0
  370. velm/artisans/isolate/__init__.py +3 -0
  371. velm/artisans/isolate/artisan.py +103 -0
  372. velm/artisans/lazarus/__init__.py +0 -0
  373. velm/artisans/lazarus/artisan.py +97 -0
  374. velm/artisans/lfg/artisan.py +60 -0
  375. velm/artisans/lint/__init__.py +13 -0
  376. velm/artisans/lint/artisan.py +117 -0
  377. velm/artisans/lint/contracts.py +130 -0
  378. velm/artisans/lint/engine.py +28 -0
  379. velm/artisans/lint/rules/base.py +37 -0
  380. velm/artisans/lint/rules/graph.py +118 -0
  381. velm/artisans/lint/rules/layers.py +67 -0
  382. velm/artisans/lint/rules/structural.py +75 -0
  383. velm/artisans/lint_blueprint/__init__.py +3 -0
  384. velm/artisans/lint_blueprint/artisan.py +71 -0
  385. velm/artisans/manifest.py +278 -0
  386. velm/artisans/matrix/__init__.py +3 -0
  387. velm/artisans/matrix/artisan.py +140 -0
  388. velm/artisans/mimic/__init__.py +4 -0
  389. velm/artisans/mimic/artisan.py +92 -0
  390. velm/artisans/mimic/generator.py +106 -0
  391. velm/artisans/mimic/reflector.py +64 -0
  392. velm/artisans/mock/__init__.py +3 -0
  393. velm/artisans/mock/artisan.py +75 -0
  394. velm/artisans/mri/__init__.py +3 -0
  395. velm/artisans/mri/artisan.py +120 -0
  396. velm/artisans/muse/__init__.py +3 -0
  397. velm/artisans/muse/analyst.py +103 -0
  398. velm/artisans/muse/artisan.py +97 -0
  399. velm/artisans/neural/__init__.py +14 -0
  400. velm/artisans/neural/artisan.py +116 -0
  401. velm/artisans/neural/contracts.py +14 -0
  402. velm/artisans/neural/tui.py +323 -0
  403. velm/artisans/neural_link/__init__.py +4 -0
  404. velm/artisans/neural_link/artisan.py +48 -0
  405. velm/artisans/neural_link/dashboard.py +129 -0
  406. velm/artisans/observatory/__init__.py +26 -0
  407. velm/artisans/observatory/artisan.py +249 -0
  408. velm/artisans/observatory/contracts.py +62 -0
  409. velm/artisans/ocular/__init__.py +4 -0
  410. velm/artisans/ocular/artisan.py +118 -0
  411. velm/artisans/pad.py +103 -0
  412. velm/artisans/patch/__init__.py +12 -0
  413. velm/artisans/patch/artisan.py +321 -0
  414. velm/artisans/patch/contracts.py +114 -0
  415. velm/artisans/patch/mutators/__init__.py +11 -0
  416. velm/artisans/patch/mutators/base.py +12 -0
  417. velm/artisans/patch/mutators/facade.py +58 -0
  418. velm/artisans/patch/mutators/regex.py +76 -0
  419. velm/artisans/patch/mutators/semantic/__init__.py +12 -0
  420. velm/artisans/patch/mutators/semantic/contracts.py +15 -0
  421. velm/artisans/patch/mutators/semantic/router.py +94 -0
  422. velm/artisans/patch/mutators/semantic/strategies.py +184 -0
  423. velm/artisans/patch/mutators/structured.py +91 -0
  424. velm/artisans/patch/mutators/textual.py +60 -0
  425. velm/artisans/patch/parser.py +74 -0
  426. velm/artisans/patch/patch.scaffold +6 -0
  427. velm/artisans/plugins/__init__.py +2 -0
  428. velm/artisans/plugins/artisan.py +286 -0
  429. velm/artisans/preview/__init__.py +2 -0
  430. velm/artisans/preview/artisan.py +155 -0
  431. velm/artisans/preview/contracts.py +27 -0
  432. velm/artisans/preview/parsers/__init__.py +61 -0
  433. velm/artisans/preview/parsers/base.py +20 -0
  434. velm/artisans/preview/parsers/html.py +273 -0
  435. velm/artisans/preview/parsers/react.py +351 -0
  436. velm/artisans/prophesy/__init__.py +4 -0
  437. velm/artisans/prophesy/artisan.py +47 -0
  438. velm/artisans/qr/__init__.py +3 -0
  439. velm/artisans/qr/artisan.py +75 -0
  440. velm/artisans/query/__init__.py +2 -0
  441. velm/artisans/query/artisan.py +535 -0
  442. velm/artisans/read_soul/__init__.py +3 -0
  443. velm/artisans/read_soul/artisan.py +30 -0
  444. velm/artisans/refactor.py +200 -0
  445. velm/artisans/repair/__init__.py +5 -0
  446. velm/artisans/repair/artisan.py +381 -0
  447. velm/artisans/repair/heuristics.py +282 -0
  448. velm/artisans/repair/surgery.py +61 -0
  449. velm/artisans/repl_artisan.py +161 -0
  450. velm/artisans/replay.py +309 -0
  451. velm/artisans/resonate/__init__.py +3 -0
  452. velm/artisans/resonate/artisan.py +82 -0
  453. velm/artisans/review/artisan.py +93 -0
  454. velm/artisans/risk/__init__.py +3 -0
  455. velm/artisans/risk/artisan.py +98 -0
  456. velm/artisans/run/__init__.py +6 -0
  457. velm/artisans/run/bridge.py +84 -0
  458. velm/artisans/run/conductor.py +211 -0
  459. velm/artisans/run/polyglot_bridge.py +213 -0
  460. velm/artisans/run/prophet/__init__.py +15 -0
  461. velm/artisans/run/prophet/conductor.py +79 -0
  462. velm/artisans/run/prophet/contracts.py +21 -0
  463. velm/artisans/run/prophet/grimoire.py +63 -0
  464. velm/artisans/run/prophet/language_oracle.py +96 -0
  465. velm/artisans/run/prophet/rite_adjudicator.py +41 -0
  466. velm/artisans/run/prophet/sanctum_seer.py +35 -0
  467. velm/artisans/run/scribe.py +321 -0
  468. velm/artisans/run/vigil.py +99 -0
  469. velm/artisans/runtimes.py +458 -0
  470. velm/artisans/save_artisan.py +118 -0
  471. velm/artisans/schema/__init__.py +4 -0
  472. velm/artisans/schema/artisan.py +116 -0
  473. velm/artisans/schema/engine.py +123 -0
  474. velm/artisans/scribe/__init__.py +5 -0
  475. velm/artisans/scribe/base_scribe.py +42 -0
  476. velm/artisans/scribe/conductor.py +153 -0
  477. velm/artisans/scribe/form_scribe.py +30 -0
  478. velm/artisans/scribe/monad_scribe.py +28 -0
  479. velm/artisans/scribe/will_scribe.py +27 -0
  480. velm/artisans/seed/__init__.py +4 -0
  481. velm/artisans/seed/artisan.py +54 -0
  482. velm/artisans/seed/fabricator.py +44 -0
  483. velm/artisans/self_test.py +114 -0
  484. velm/artisans/semantic_fs/__init__.py +3 -0
  485. velm/artisans/semantic_fs/artisan.py +106 -0
  486. velm/artisans/semantic_fs/operations.py +101 -0
  487. velm/artisans/semdiff/__init__.py +3 -0
  488. velm/artisans/semdiff/artisan.py +86 -0
  489. velm/artisans/services/__init__.py +0 -0
  490. velm/artisans/services/billing/__init__.py +0 -0
  491. velm/artisans/services/billing/artisan.py +91 -0
  492. velm/artisans/services/billing/client.py +34 -0
  493. velm/artisans/services/billing/domains/customers.py +32 -0
  494. velm/artisans/services/billing/domains/invoices.py +27 -0
  495. velm/artisans/services/billing/domains/links.py +18 -0
  496. velm/artisans/services/billing/domains/portal.py +13 -0
  497. velm/artisans/services/billing/domains/products.py +23 -0
  498. velm/artisans/services/billing/domains/subscriptions.py +32 -0
  499. velm/artisans/services/browser/__init__.py +2 -0
  500. velm/artisans/services/browser/artisan.py +49 -0
  501. velm/artisans/services/browser/engine.py +68 -0
  502. velm/artisans/services/cache/__init__.py +2 -0
  503. velm/artisans/services/cache/artisan.py +41 -0
  504. velm/artisans/services/cache/engine.py +78 -0
  505. velm/artisans/services/calendar/artisan.py +258 -0
  506. velm/artisans/services/calendar/brain.py +45 -0
  507. velm/artisans/services/calendar/client.py +151 -0
  508. velm/artisans/services/clerk/__init__.py +0 -0
  509. velm/artisans/services/clerk/artisan.py +141 -0
  510. velm/artisans/services/clerk/client.py +32 -0
  511. velm/artisans/services/clerk/constants.py +22 -0
  512. velm/artisans/services/clerk/domains/base.py +50 -0
  513. velm/artisans/services/clerk/domains/invitations.py +70 -0
  514. velm/artisans/services/clerk/domains/organizations.py +42 -0
  515. velm/artisans/services/clerk/domains/sessions.py +31 -0
  516. velm/artisans/services/clerk/domains/users.py +149 -0
  517. velm/artisans/services/clerk/simulation/engine.py +65 -0
  518. velm/artisans/services/clerk/simulation/generators.py +53 -0
  519. velm/artisans/services/clerk/simulation/state.py +57 -0
  520. velm/artisans/services/communication/__init__.py +0 -0
  521. velm/artisans/services/communication/artisan.py +695 -0
  522. velm/artisans/services/communication/channels/base.py +15 -0
  523. velm/artisans/services/communication/channels/email_api.py +51 -0
  524. velm/artisans/services/communication/channels/email_smtp.py +77 -0
  525. velm/artisans/services/communication/channels/mock.py +96 -0
  526. velm/artisans/services/communication/channels/sms_twilio.py +270 -0
  527. velm/artisans/services/communication/channels/social.py +379 -0
  528. velm/artisans/services/communication/contracts.py +18 -0
  529. velm/artisans/services/communication/herald.py +167 -0
  530. velm/artisans/services/crm/__init__.py +0 -0
  531. velm/artisans/services/crm/artisan.py +97 -0
  532. velm/artisans/services/crm/factory.py +19 -0
  533. velm/artisans/services/crm/providers/base.py +58 -0
  534. velm/artisans/services/crm/providers/hubspot.py +81 -0
  535. velm/artisans/services/document/__init__.py +2 -0
  536. velm/artisans/services/document/artisan.py +66 -0
  537. velm/artisans/services/document/domains/data.py +35 -0
  538. velm/artisans/services/document/domains/pdf.py +14 -0
  539. velm/artisans/services/intelligence/__init__.py +0 -0
  540. velm/artisans/services/intelligence/artisan.py +96 -0
  541. velm/artisans/services/memory/__init__.py +2 -0
  542. velm/artisans/services/memory/artisan.py +76 -0
  543. velm/artisans/services/memory/encoder.py +19 -0
  544. velm/artisans/services/memory/store.py +25 -0
  545. velm/artisans/services/network/__init__.py +0 -0
  546. velm/artisans/services/network/artisan.py +65 -0
  547. velm/artisans/services/network/client.py +31 -0
  548. velm/artisans/services/network/domains/graphql.py +48 -0
  549. velm/artisans/services/network/domains/rest.py +78 -0
  550. velm/artisans/services/network/domains/webhook.py +50 -0
  551. velm/artisans/services/sheets/__init__.py +2 -0
  552. velm/artisans/services/sheets/artisan.py +48 -0
  553. velm/artisans/services/sheets/domains/airtable.py +41 -0
  554. velm/artisans/services/sheets/domains/google.py +49 -0
  555. velm/artisans/services/storage/__init__.py +4 -0
  556. velm/artisans/services/storage/artisan.py +311 -0
  557. velm/artisans/services/storage/client.py +56 -0
  558. velm/artisans/services/storage/domains/buckets.py +27 -0
  559. velm/artisans/services/storage/domains/objects.py +79 -0
  560. velm/artisans/services/storage/domains/security.py +34 -0
  561. velm/artisans/services/supabase/__init__.py +0 -0
  562. velm/artisans/services/supabase/artisan.py +63 -0
  563. velm/artisans/services/supabase/client.py +156 -0
  564. velm/artisans/services/supabase/domains/auth.py +40 -0
  565. velm/artisans/services/supabase/domains/database.py +226 -0
  566. velm/artisans/services/supabase/domains/storage.py +43 -0
  567. velm/artisans/services/twilio/__init__.py +11 -0
  568. velm/artisans/services/twilio/artisan.py +394 -0
  569. velm/artisans/services/twilio/client.py +43 -0
  570. velm/artisans/services/twilio/constants.py +42 -0
  571. velm/artisans/services/twilio/domains/base.py +23 -0
  572. velm/artisans/services/twilio/domains/compliance.py +76 -0
  573. velm/artisans/services/twilio/domains/intelligence.py +41 -0
  574. velm/artisans/services/twilio/domains/lookups.py +38 -0
  575. velm/artisans/services/twilio/domains/management.py +49 -0
  576. velm/artisans/services/twilio/domains/messaging.py +68 -0
  577. velm/artisans/services/twilio/domains/numbers.py +95 -0
  578. velm/artisans/services/twilio/domains/provisioning.py +73 -0
  579. velm/artisans/services/twilio/simulation/engine.py +158 -0
  580. velm/artisans/services/twilio/simulation/generators.py +64 -0
  581. velm/artisans/services/twilio/simulation/physics.py +60 -0
  582. velm/artisans/services/twilio/simulation/reactor.py +63 -0
  583. velm/artisans/services/twilio/simulation/state.py +72 -0
  584. velm/artisans/services/twilio/utils.py +55 -0
  585. velm/artisans/services/worker/__init__.py +2 -0
  586. velm/artisans/services/worker/artisan.py +40 -0
  587. velm/artisans/services/worker/engine.py +64 -0
  588. velm/artisans/settings.py +96 -0
  589. velm/artisans/sgrep/__init__.py +3 -0
  590. velm/artisans/sgrep/artisan.py +95 -0
  591. velm/artisans/shadow_clone/__init__.py +5 -0
  592. velm/artisans/shadow_clone/artisan.py +565 -0
  593. velm/artisans/shadow_clone/catalog.py +58 -0
  594. velm/artisans/shadow_clone/config_injector.py +58 -0
  595. velm/artisans/shadow_clone/contracts.py +130 -0
  596. velm/artisans/shadow_clone/governor.py +241 -0
  597. velm/artisans/shadow_clone/mirror.py +143 -0
  598. velm/artisans/shadow_clone/network.py +205 -0
  599. velm/artisans/shadow_clone/state_cloner.py +76 -0
  600. velm/artisans/shadow_clone/worktree.py +228 -0
  601. velm/artisans/shell.py +32 -0
  602. velm/artisans/signature_artisan.py +256 -0
  603. velm/artisans/simulacrum/__init__.py +9 -0
  604. velm/artisans/simulacrum/artisan.py +193 -0
  605. velm/artisans/simulacrum/bridge.py +196 -0
  606. velm/artisans/simulacrum/contracts.py +22 -0
  607. velm/artisans/simulacrum/engine.py +283 -0
  608. velm/artisans/simulacrum/exceptions.py +18 -0
  609. velm/artisans/simulacrum/heuristics/__init__.py +9 -0
  610. velm/artisans/simulacrum/heuristics/engine.py +81 -0
  611. velm/artisans/simulacrum/heuristics/strategies.py +149 -0
  612. velm/artisans/simulacrum/runtimes/__init__.py +19 -0
  613. velm/artisans/simulacrum/runtimes/base.py +34 -0
  614. velm/artisans/simulacrum/runtimes/go.py +130 -0
  615. velm/artisans/simulacrum/runtimes/node.py +124 -0
  616. velm/artisans/simulacrum/runtimes/python.py +38 -0
  617. velm/artisans/simulacrum/runtimes/rust.py +23 -0
  618. velm/artisans/simulacrum/runtimes/shell.py +11 -0
  619. velm/artisans/snippet/artisan.py +108 -0
  620. velm/artisans/studio.py +50 -0
  621. velm/artisans/summarize.py +176 -0
  622. velm/artisans/surveyor/__init__.py +2 -0
  623. velm/artisans/surveyor/artisan.py +218 -0
  624. velm/artisans/symphony.py +151 -0
  625. velm/artisans/telepathy/__init__.py +3 -0
  626. velm/artisans/telepathy/artisan.py +121 -0
  627. velm/artisans/telepresence/__init__.py +3 -0
  628. velm/artisans/telepresence/artisan.py +192 -0
  629. velm/artisans/telepresence/causal_slicer.py +171 -0
  630. velm/artisans/telepresence/maestro_bridge.py +184 -0
  631. velm/artisans/telepresence/shadow_vault.py +163 -0
  632. velm/artisans/telepresence/url_projector.py +151 -0
  633. velm/artisans/template_engine/__init__.py +23 -0
  634. velm/artisans/template_engine/contracts.py +36 -0
  635. velm/artisans/template_engine/engine/__init__.py +2 -0
  636. velm/artisans/template_engine/engine/ai_prophet.py +169 -0
  637. velm/artisans/template_engine/engine/alias_oracle.py +108 -0
  638. velm/artisans/template_engine/engine/cache_oracle.py +155 -0
  639. velm/artisans/template_engine/engine/conductor.py +151 -0
  640. velm/artisans/template_engine/engine/gaze_conductor.py +210 -0
  641. velm/artisans/template_engine/engine/manifest_oracle.py +148 -0
  642. velm/artisans/template_engine/system_forge.py +197 -0
  643. velm/artisans/templates.py +647 -0
  644. velm/artisans/time_branch.py +60 -0
  645. velm/artisans/time_machine.py +38 -0
  646. velm/artisans/tool/ascii_artisan.py +238 -0
  647. velm/artisans/tool/banner_artisan.py +87 -0
  648. velm/artisans/tool/chronicle_artisan.py +18 -0
  649. velm/artisans/tool/doctor_artisan.py +18 -0
  650. velm/artisans/tool/gnosis_artisan.py +18 -0
  651. velm/artisans/tool/hash_artisan.py +21 -0
  652. velm/artisans/tool/keyring_artisan.py +55 -0
  653. velm/artisans/tool/pack_artisan.py +17 -0
  654. velm/artisans/tool/read_soul_artisan.py +43 -0
  655. velm/artisans/tool/sbom_artisan.py +84 -0
  656. velm/artisans/tool/secrets_artisan.py +66 -0
  657. velm/artisans/tool/tool_cli.py +60 -0
  658. velm/artisans/train/__init__.py +2 -0
  659. velm/artisans/train/artisan.py +27 -0
  660. velm/artisans/transfigure.py +275 -0
  661. velm/artisans/translate/__init__.py +3 -0
  662. velm/artisans/translate/artisan.py +65 -0
  663. velm/artisans/translocate.py +451 -0
  664. velm/artisans/translocate_core/__init__.py +11 -0
  665. velm/artisans/translocate_core/conductor/__init__.py +14 -0
  666. velm/artisans/translocate_core/conductor/engine.py +86 -0
  667. velm/artisans/translocate_core/conductor/execution.py +240 -0
  668. velm/artisans/translocate_core/conductor/perception.py +72 -0
  669. velm/artisans/translocate_core/conductor/proclamation.py +152 -0
  670. velm/artisans/translocate_core/conductor/snapshot.py +330 -0
  671. velm/artisans/translocate_core/contracts.py +31 -0
  672. velm/artisans/translocate_core/detective.py +717 -0
  673. velm/artisans/translocate_core/resolvers/ROADMAP.md +35 -0
  674. velm/artisans/translocate_core/resolvers/__init__.py +18 -0
  675. velm/artisans/translocate_core/resolvers/cpp/__init__.py +5 -0
  676. velm/artisans/translocate_core/resolvers/cpp/contracts.py +23 -0
  677. velm/artisans/translocate_core/resolvers/cpp/engine.py +75 -0
  678. velm/artisans/translocate_core/resolvers/cpp/inquisitor.py +58 -0
  679. velm/artisans/translocate_core/resolvers/cpp/pathfinder.py +47 -0
  680. velm/artisans/translocate_core/resolvers/cpp/surgeon.py +24 -0
  681. velm/artisans/translocate_core/resolvers/go/__init__.py +1 -0
  682. velm/artisans/translocate_core/resolvers/go/contracts.py +18 -0
  683. velm/artisans/translocate_core/resolvers/go/engine.py +70 -0
  684. velm/artisans/translocate_core/resolvers/go/inquisitor.py +36 -0
  685. velm/artisans/translocate_core/resolvers/go/pathfinder.py +54 -0
  686. velm/artisans/translocate_core/resolvers/go/surgeon.py +17 -0
  687. velm/artisans/translocate_core/resolvers/java/__init__.py +5 -0
  688. velm/artisans/translocate_core/resolvers/java/contracts.py +29 -0
  689. velm/artisans/translocate_core/resolvers/java/engine.py +75 -0
  690. velm/artisans/translocate_core/resolvers/java/inquisitor.py +66 -0
  691. velm/artisans/translocate_core/resolvers/java/pathfinder.py +45 -0
  692. velm/artisans/translocate_core/resolvers/java/surgeon.py +24 -0
  693. velm/artisans/translocate_core/resolvers/javascript/__init__.py +4 -0
  694. velm/artisans/translocate_core/resolvers/javascript/contracts.py +29 -0
  695. velm/artisans/translocate_core/resolvers/javascript/engine.py +75 -0
  696. velm/artisans/translocate_core/resolvers/javascript/inquisitor.py +72 -0
  697. velm/artisans/translocate_core/resolvers/javascript/pathfinder.py +80 -0
  698. velm/artisans/translocate_core/resolvers/javascript/surgeon.py +42 -0
  699. velm/artisans/translocate_core/resolvers/python/__init__.py +6 -0
  700. velm/artisans/translocate_core/resolvers/python/contracts.py +29 -0
  701. velm/artisans/translocate_core/resolvers/python/engine.py +147 -0
  702. velm/artisans/translocate_core/resolvers/python/inquisitor.py +138 -0
  703. velm/artisans/translocate_core/resolvers/python/intelligence.py +46 -0
  704. velm/artisans/translocate_core/resolvers/python/pathfinder.py +264 -0
  705. velm/artisans/translocate_core/resolvers/python/surgeon.py +160 -0
  706. velm/artisans/translocate_core/resolvers/ruby/__init__.py +5 -0
  707. velm/artisans/translocate_core/resolvers/ruby/contracts.py +28 -0
  708. velm/artisans/translocate_core/resolvers/ruby/engine.py +74 -0
  709. velm/artisans/translocate_core/resolvers/ruby/inquisitor.py +90 -0
  710. velm/artisans/translocate_core/resolvers/ruby/pathfinder.py +79 -0
  711. velm/artisans/translocate_core/resolvers/ruby/surgeon.py +32 -0
  712. velm/artisans/translocate_core/resolvers/rust/__init__.py +5 -0
  713. velm/artisans/translocate_core/resolvers/rust/contracts.py +22 -0
  714. velm/artisans/translocate_core/resolvers/rust/engine.py +110 -0
  715. velm/artisans/translocate_core/resolvers/rust/inquisitor.py +57 -0
  716. velm/artisans/translocate_core/resolvers/rust/pathfinder.py +75 -0
  717. velm/artisans/translocate_core/resolvers/rust/surgeon.py +22 -0
  718. velm/artisans/translocate_core/resolvers/typescript/__init__.py +3 -0
  719. velm/artisans/translocate_core/resolvers/typescript/engine.py +13 -0
  720. velm/artisans/translocate_core/resolvers/typescript/pathfinder.py +83 -0
  721. velm/artisans/translocate_core/will_parser.py +199 -0
  722. velm/artisans/transmute.py +969 -0
  723. velm/artisans/transmute_core/seer.py +357 -0
  724. velm/artisans/tray_guardian.py +75 -0
  725. velm/artisans/tree.py +253 -0
  726. velm/artisans/tutorial/__init__.py +4 -0
  727. velm/artisans/tutorial/artisans.py +92 -0
  728. velm/artisans/tutorial/engine.py +51 -0
  729. velm/artisans/tutorial/quest_giver.py +81 -0
  730. velm/artisans/unambiguous_artisan.py +0 -0
  731. velm/artisans/undo/__init__.py +15 -0
  732. velm/artisans/undo/artisan.py +193 -0
  733. velm/artisans/undo/reverser.py +173 -0
  734. velm/artisans/upgrade/__init__.py +4 -0
  735. velm/artisans/upgrade/artisan.py +86 -0
  736. velm/artisans/upgrade/merger.py +143 -0
  737. velm/artisans/vector/__init__.py +0 -0
  738. velm/artisans/vector/artisan.py +111 -0
  739. velm/artisans/verify.py +319 -0
  740. velm/artisans/watchman/__init__.py +4 -0
  741. velm/artisans/watchman/artisan.py +182 -0
  742. velm/artisans/watchman/engine.py +124 -0
  743. velm/artisans/watchman/profiles.py +83 -0
  744. velm/artisans/watchman/ui.py +49 -0
  745. velm/artisans/weave/__init__.py +15 -0
  746. velm/artisans/weave/ci_weaver.py +90 -0
  747. velm/artisans/weave/conductor.py +205 -0
  748. velm/artisans/weave/oracle.py +90 -0
  749. velm/artisans/weave/validator.py +24 -0
  750. velm/artisans/weave/weaver.py +333 -0
  751. velm/artisans/with_secrets.py +109 -0
  752. velm/artisans/workspace/__init__.py +6 -0
  753. velm/artisans/workspace/artisan.py +583 -0
  754. velm/artisans/workspace/contracts.py +97 -0
  755. velm/artisans/workspace/pad/app.py +232 -0
  756. velm/banners/__init__.py +67 -0
  757. velm/banners/fallback.py +35 -0
  758. velm/banners/sigil.py +2024 -0
  759. velm/communion/__init__.py +133 -0
  760. velm/communion/oracle.py +325 -0
  761. velm/communion/renderers.py +178 -0
  762. velm/constants.py +679 -0
  763. velm/containerization/__init__.py +13 -0
  764. velm/containerization/engine.py +356 -0
  765. velm/contracts/architectural_contracts.py +19 -0
  766. velm/contracts/communion_contracts.py +48 -0
  767. velm/contracts/data_contracts.py +758 -0
  768. velm/contracts/heresy_contracts.py +557 -0
  769. velm/contracts/law_contracts.py +134 -0
  770. velm/contracts/persona_contracts.py +35 -0
  771. velm/contracts/symphony_contracts.py +263 -0
  772. velm/core/__init__.py +6 -0
  773. velm/core/__main__.py +13 -0
  774. velm/core/ai/__init__.py +33 -0
  775. velm/core/ai/akasha.py +112 -0
  776. velm/core/ai/contracts.py +159 -0
  777. velm/core/ai/engine/__init__.py +5 -0
  778. velm/core/ai/engine/audit.py +37 -0
  779. velm/core/ai/engine/core.py +249 -0
  780. velm/core/ai/knowledge_base.json +22 -0
  781. velm/core/ai/providers/__init__.py +21 -0
  782. velm/core/ai/providers/anthropic.py +134 -0
  783. velm/core/ai/providers/base.py +219 -0
  784. velm/core/ai/providers/google.py +143 -0
  785. velm/core/ai/providers/local.py +118 -0
  786. velm/core/ai/providers/openai.py +244 -0
  787. velm/core/ai/rag/__init__.py +30 -0
  788. velm/core/ai/rag/knowledge/__init__.py +33 -0
  789. velm/core/ai/rag/knowledge/devops_gnosis.py +61 -0
  790. velm/core/ai/rag/knowledge/go_gnosis.py +27 -0
  791. velm/core/ai/rag/knowledge/python_gnosis.py +54 -0
  792. velm/core/ai/rag/knowledge/rust_gnosis.py +49 -0
  793. velm/core/ai/rag/knowledge/scaffold_syntax.py +71 -0
  794. velm/core/ai/rag/knowledge/security_gnosis.py +45 -0
  795. velm/core/ai/rag/knowledge/symphony_syntax.py +65 -0
  796. velm/core/ai/rag/knowledge/typescript_gnosis.py +63 -0
  797. velm/core/ai/rag/librarian/__init__.py +7 -0
  798. velm/core/ai/rag/librarian/analysis.py +62 -0
  799. velm/core/ai/rag/librarian/assembly.py +60 -0
  800. velm/core/ai/rag/librarian/contracts.py +45 -0
  801. velm/core/ai/rag/librarian/indexers/base.py +18 -0
  802. velm/core/ai/rag/librarian/indexers/code.py +200 -0
  803. velm/core/ai/rag/librarian/indexers/text.py +150 -0
  804. velm/core/ai/rag/librarian/master.py +344 -0
  805. velm/core/ai/rag/librarian/ranking.py +30 -0
  806. velm/core/ai/rag/librarian/retrieval/__init__.py +0 -0
  807. velm/core/ai/rag/librarian/retrieval/engine.py +51 -0
  808. velm/core/alchemist/__init__.py +14 -0
  809. velm/core/alchemist/engine.py +202 -0
  810. velm/core/alchemist/environment.py +126 -0
  811. velm/core/alchemist/inference.py +114 -0
  812. velm/core/alchemist/library.py +117 -0
  813. velm/core/alchemist/resolution.py +297 -0
  814. velm/core/artisan.py +197 -0
  815. velm/core/assembler/__init__.py +15 -0
  816. velm/core/assembler/engine.py +191 -0
  817. velm/core/assembler/weavers/__init__.py +15 -0
  818. velm/core/assembler/weavers/base_weaver.py +130 -0
  819. velm/core/assembler/weavers/python_weaver.py +528 -0
  820. velm/core/assembler/weavers/react_weaver.py +368 -0
  821. velm/core/blueprint_scribe/__init__.py +11 -0
  822. velm/core/blueprint_scribe/canonical_serializer.py +124 -0
  823. velm/core/blueprint_scribe/content_renderer.py +75 -0
  824. velm/core/blueprint_scribe/metadata_scribe.py +72 -0
  825. velm/core/blueprint_scribe/scribe.py +114 -0
  826. velm/core/blueprint_scribe/sorting_hat.py +33 -0
  827. velm/core/blueprint_scribe/tree_forger.py +52 -0
  828. velm/core/chaos_engine.py +229 -0
  829. velm/core/cli/cli_conductor.py +343 -0
  830. velm/core/cli/cli_shims.py +795 -0
  831. velm/core/cli/cli_utils.py +244 -0
  832. velm/core/cli/core_cli.py +270 -0
  833. velm/core/cli/grimoire/__init__.py +76 -0
  834. velm/core/cli/grimoire/_ai_rites.py +247 -0
  835. velm/core/cli/grimoire/_automation_rites.py +52 -0
  836. velm/core/cli/grimoire/_core_rites.py +244 -0
  837. velm/core/cli/grimoire/_evolution_rites.py +212 -0
  838. velm/core/cli/grimoire/_guild_rites.py +32 -0
  839. velm/core/cli/grimoire/_history_rites.py +60 -0
  840. velm/core/cli/grimoire/_mimic_rites.py +20 -0
  841. velm/core/cli/grimoire/_perception_rites.py +398 -0
  842. velm/core/cli/grimoire/_security_rites.py +57 -0
  843. velm/core/cli/grimoire/_service_rites.py +197 -0
  844. velm/core/cli/grimoire/_ui_rites.py +58 -0
  845. velm/core/cli/grimoire/_utility_rites.py +172 -0
  846. velm/core/cli/grimoire/_workspace_rites.py +59 -0
  847. velm/core/cli/grimoire_data.py +147 -0
  848. velm/core/cortex/__init__.py +9 -0
  849. velm/core/cortex/blueprint_merger.py +311 -0
  850. velm/core/cortex/call_graph.py +160 -0
  851. velm/core/cortex/contracts.py +515 -0
  852. velm/core/cortex/data_flow.py +91 -0
  853. velm/core/cortex/dependency_oracle.py +311 -0
  854. velm/core/cortex/engine/__init__.py +16 -0
  855. velm/core/cortex/engine/analysis.py +182 -0
  856. velm/core/cortex/engine/conductor.py +144 -0
  857. velm/core/cortex/engine/perception.py +154 -0
  858. velm/core/cortex/entropy_oracle.py +125 -0
  859. velm/core/cortex/file_discoverer.py +207 -0
  860. velm/core/cortex/file_interrogator.py +252 -0
  861. velm/core/cortex/git_historian.py +320 -0
  862. velm/core/cortex/graph_builder.py +551 -0
  863. velm/core/cortex/import_resolver.py +206 -0
  864. velm/core/cortex/knowledge.py +96 -0
  865. velm/core/cortex/language_oracle.py +120 -0
  866. velm/core/cortex/logic_inductor.py +216 -0
  867. velm/core/cortex/ocular/__init__.py +15 -0
  868. velm/core/cortex/ocular/engine.py +198 -0
  869. velm/core/cortex/ranking/__init__.py +16 -0
  870. velm/core/cortex/ranking/contracts.py +47 -0
  871. velm/core/cortex/ranking/engine.py +254 -0
  872. velm/core/cortex/ranking/factors/cohesion.py +152 -0
  873. velm/core/cortex/ranking/factors/resonance.py +41 -0
  874. velm/core/cortex/ranking/factors/semantic.py +34 -0
  875. velm/core/cortex/ranking/factors/structural.py +32 -0
  876. velm/core/cortex/ranking/factors/symbiosis.py +28 -0
  877. velm/core/cortex/ranking/factors/temporal.py +30 -0
  878. velm/core/cortex/ranking/factors/topological.py +62 -0
  879. velm/core/cortex/ranking/strategies.py +194 -0
  880. velm/core/cortex/scanner.py +193 -0
  881. velm/core/cortex/semantic_comparator.py +98 -0
  882. velm/core/cortex/semantic_indexer.py +353 -0
  883. velm/core/cortex/tag_extractor.py +49 -0
  884. velm/core/cortex/tokenomics.py +44 -0
  885. velm/core/cortex/vector.py +502 -0
  886. velm/core/daemon/__init__.py +18 -0
  887. velm/core/daemon/akashic/__init__.py +20 -0
  888. velm/core/daemon/akashic/broadcaster.py +331 -0
  889. velm/core/daemon/akashic/constants.py +24 -0
  890. velm/core/daemon/akashic/engine.py +442 -0
  891. velm/core/daemon/akashic/envelope.py +187 -0
  892. velm/core/daemon/akashic/memory.py +154 -0
  893. velm/core/daemon/constants.py +176 -0
  894. velm/core/daemon/dispatcher/__init__.py +21 -0
  895. velm/core/daemon/dispatcher/constants.py +31 -0
  896. velm/core/daemon/dispatcher/engine.py +335 -0
  897. velm/core/daemon/dispatcher/errors.py +43 -0
  898. velm/core/daemon/dispatcher/executor.py +51 -0
  899. velm/core/daemon/dispatcher/pools.py +114 -0
  900. velm/core/daemon/dispatcher/triage.py +162 -0
  901. velm/core/daemon/nexus/__init__.py +17 -0
  902. velm/core/daemon/nexus/engine.py +543 -0
  903. velm/core/daemon/nexus/gatekeeper.py +515 -0
  904. velm/core/daemon/nexus/scout.py +41 -0
  905. velm/core/daemon/nexus/synapse.py +341 -0
  906. velm/core/daemon/registry/__init__.py +4 -0
  907. velm/core/daemon/registry/consecrator.py +123 -0
  908. velm/core/daemon/registry/guard.py +24 -0
  909. velm/core/daemon/registry/resolver.py +24 -0
  910. velm/core/daemon/resolver/__init__.py +17 -0
  911. velm/core/daemon/resolver/constants.py +33 -0
  912. velm/core/daemon/resolver/dna.py +74 -0
  913. velm/core/daemon/resolver/engine.py +65 -0
  914. velm/core/daemon/resolver/executable.py +49 -0
  915. velm/core/daemon/resolver/identity.py +48 -0
  916. velm/core/daemon/resolver/virtual.py +47 -0
  917. velm/core/daemon/serializer/__init__.py +17 -0
  918. velm/core/daemon/serializer/constants.py +19 -0
  919. velm/core/daemon/serializer/encoders/forensic.py +22 -0
  920. velm/core/daemon/serializer/encoders/meta.py +44 -0
  921. velm/core/daemon/serializer/encoders/schema.py +45 -0
  922. velm/core/daemon/serializer/encoders/scientific.py +34 -0
  923. velm/core/daemon/serializer/encoders/spatial.py +18 -0
  924. velm/core/daemon/serializer/encoders/temporal.py +20 -0
  925. velm/core/daemon/serializer/engine.py +88 -0
  926. velm/core/daemon/serializer/registry.py +33 -0
  927. velm/core/daemon/server/__init__.py +17 -0
  928. velm/core/daemon/server/banner.py +20 -0
  929. velm/core/daemon/server/engine.py +334 -0
  930. velm/core/daemon/server/signals.py +46 -0
  931. velm/core/daemon/server/vitality.py +212 -0
  932. velm/core/daemon/surveyor/constants.py +78 -0
  933. velm/core/daemon/surveyor/engine.py +330 -0
  934. velm/core/daemon/surveyor/registry.py +151 -0
  935. velm/core/daemon/surveyor/sentinels/adapter.py +206 -0
  936. velm/core/daemon/surveyor/sentinels/base.py +70 -0
  937. velm/core/daemon/surveyor/sentinels/cpp.py +0 -0
  938. velm/core/daemon/surveyor/sentinels/docker.py +0 -0
  939. velm/core/daemon/surveyor/sentinels/golang.py +45 -0
  940. velm/core/daemon/surveyor/sentinels/infra.py +62 -0
  941. velm/core/daemon/surveyor/sentinels/java.py +52 -0
  942. velm/core/daemon/surveyor/sentinels/javascript.py +67 -0
  943. velm/core/daemon/surveyor/sentinels/python.py +84 -0
  944. velm/core/daemon/surveyor/sentinels/ruby.py +0 -0
  945. velm/core/daemon/surveyor/sentinels/rust.py +60 -0
  946. velm/core/daemon/surveyor/sentinels/scaffold.py +57 -0
  947. velm/core/daemon/surveyor/sentinels/symphony.py +0 -0
  948. velm/core/daemon/surveyor/sentinels/typescript.py +40 -0
  949. velm/core/daemon/transporter/__init__.py +17 -0
  950. velm/core/daemon/transporter/buffer.py +207 -0
  951. velm/core/daemon/transporter/constants.py +37 -0
  952. velm/core/daemon/transporter/engine.py +304 -0
  953. velm/core/daemon/transporter/physics.py +51 -0
  954. velm/core/fusion/__init__.py +6 -0
  955. velm/core/fusion/engine.py +174 -0
  956. velm/core/guardian/__init__.py +15 -0
  957. velm/core/guardian/contracts.py +43 -0
  958. velm/core/guardian/grimoire.py +57 -0
  959. velm/core/guardian/sentry.py +103 -0
  960. velm/core/guardian/wards/filesystem.py +93 -0
  961. velm/core/guardian/wards/semantic.py +45 -0
  962. velm/core/guardian/wards/syntax.py +56 -0
  963. velm/core/ignition/__init__.py +40 -0
  964. velm/core/ignition/conductor.py +169 -0
  965. velm/core/ignition/contracts.py +248 -0
  966. velm/core/ignition/diviner/__init__.py +21 -0
  967. velm/core/ignition/diviner/engine.py +175 -0
  968. velm/core/ignition/diviner/exceptions.py +37 -0
  969. velm/core/ignition/diviner/heuristics/__init__.py +8 -0
  970. velm/core/ignition/diviner/heuristics/base.py +27 -0
  971. velm/core/ignition/diviner/heuristics/engine.py +57 -0
  972. velm/core/ignition/diviner/heuristics/node_inquisitor.py +54 -0
  973. velm/core/ignition/diviner/heuristics/python_inquisitor.py +48 -0
  974. velm/core/ignition/diviner/heuristics/systems_inquisitor.py +27 -0
  975. velm/core/ignition/diviner/heuristics/visual_inquisitor.py +21 -0
  976. velm/core/ignition/diviner/persistence.py +75 -0
  977. velm/core/ignition/diviner/seekers/__init__.py +29 -0
  978. velm/core/ignition/diviner/seekers/base.py +54 -0
  979. velm/core/ignition/diviner/seekers/conductor.py +81 -0
  980. velm/core/ignition/diviner/seekers/entropy_seeker.py +57 -0
  981. velm/core/ignition/diviner/seekers/environmental_seeker.py +50 -0
  982. velm/core/ignition/diviner/seekers/heart_seeker.py +59 -0
  983. velm/core/ignition/diviner/seekers/magic_seeker.py +46 -0
  984. velm/core/ignition/diviner/seekers/semantic_seeker.py +35 -0
  985. velm/core/ignition/diviner/seekers/visual_seeker.py +58 -0
  986. velm/core/ignition/diviner/strategies.py +261 -0
  987. velm/core/ignition/diviner/telemetry.py +28 -0
  988. velm/core/ignition/sentinel/__init__.py +7 -0
  989. velm/core/ignition/sentinel/biology.py +37 -0
  990. velm/core/ignition/sentinel/grimoire.py +45 -0
  991. velm/core/ignition/sentinel/priest.py +100 -0
  992. velm/core/ignition/sentinel/scanner.py +64 -0
  993. velm/core/ignition/sentinel/vitality.py +72 -0
  994. velm/core/jurisprudence/adjudicator.py +172 -0
  995. velm/core/jurisprudence/contracts.py +41 -0
  996. velm/core/jurisprudence/vows/__init__.py +75 -0
  997. velm/core/jurisprudence/vows/base.py +108 -0
  998. velm/core/jurisprudence/vows/cloud_vows.py +74 -0
  999. velm/core/jurisprudence/vows/database_vows.py +78 -0
  1000. velm/core/jurisprudence/vows/docker_ops_vows.py +65 -0
  1001. velm/core/jurisprudence/vows/filesystem.py +447 -0
  1002. velm/core/jurisprudence/vows/git_vows.py +63 -0
  1003. velm/core/jurisprudence/vows/http_vows.py +61 -0
  1004. velm/core/jurisprudence/vows/meta.py +43 -0
  1005. velm/core/jurisprudence/vows/network.py +70 -0
  1006. velm/core/jurisprudence/vows/process.py +50 -0
  1007. velm/core/jurisprudence/vows/python_vows.py +80 -0
  1008. velm/core/jurisprudence/vows/quality_vows.py +76 -0
  1009. velm/core/jurisprudence/vows/resource_vows.py +68 -0
  1010. velm/core/jurisprudence/vows/security_vows.py +91 -0
  1011. velm/core/jurisprudence/vows/system.py +37 -0
  1012. velm/core/kernel/__init__.py +15 -0
  1013. velm/core/kernel/archivist/__init__.py +22 -0
  1014. velm/core/kernel/archivist/contracts.py +57 -0
  1015. velm/core/kernel/archivist/engine.py +124 -0
  1016. velm/core/kernel/archivist/filters.py +102 -0
  1017. velm/core/kernel/archivist/manifest.py +37 -0
  1018. velm/core/kernel/archivist/restorer.py +81 -0
  1019. velm/core/kernel/archivist/retention.py +44 -0
  1020. velm/core/kernel/archivist/storage.py +105 -0
  1021. velm/core/kernel/artifact_hoarder.py +170 -0
  1022. velm/core/kernel/chronicle/__init__.py +16 -0
  1023. velm/core/kernel/chronicle/archivist.py +63 -0
  1024. velm/core/kernel/chronicle/facade.py +204 -0
  1025. velm/core/kernel/chronicle/integrity_alchemist.py +77 -0
  1026. velm/core/kernel/chronicle/manifest_federator.py +125 -0
  1027. velm/core/kernel/chronicle/provenance_scribe.py +126 -0
  1028. velm/core/kernel/hologram.py +230 -0
  1029. velm/core/kernel/sentinel_gardener.py +113 -0
  1030. velm/core/kernel/sentinel_watcher.py +561 -0
  1031. velm/core/kernel/transaction/__init__.py +17 -0
  1032. velm/core/kernel/transaction/chronicle_bridge.py +217 -0
  1033. velm/core/kernel/transaction/committer.py +126 -0
  1034. velm/core/kernel/transaction/contracts.py +77 -0
  1035. velm/core/kernel/transaction/facade.py +216 -0
  1036. velm/core/kernel/transaction/locking.py +332 -0
  1037. velm/core/kernel/transaction/rollback.py +122 -0
  1038. velm/core/kernel/transaction/staging.py +132 -0
  1039. velm/core/lsp/STREAMING_PROTOCOL.md +121 -0
  1040. velm/core/lsp/__init__.py +127 -0
  1041. velm/core/lsp/base/__init__.py +39 -0
  1042. velm/core/lsp/base/contracts.py +34 -0
  1043. velm/core/lsp/base/dispatcher.py +390 -0
  1044. velm/core/lsp/base/document.py +227 -0
  1045. velm/core/lsp/base/errors.py +31 -0
  1046. velm/core/lsp/base/features/__init__.py +0 -0
  1047. velm/core/lsp/base/features/call_hierarchy/__init__.py +16 -0
  1048. velm/core/lsp/base/features/call_hierarchy/contracts.py +41 -0
  1049. velm/core/lsp/base/features/call_hierarchy/engine.py +91 -0
  1050. velm/core/lsp/base/features/call_hierarchy/models.py +12 -0
  1051. velm/core/lsp/base/features/code_action/__init__.py +19 -0
  1052. velm/core/lsp/base/features/code_action/contracts.py +47 -0
  1053. velm/core/lsp/base/features/code_action/engine.py +108 -0
  1054. velm/core/lsp/base/features/code_action/models.py +16 -0
  1055. velm/core/lsp/base/features/code_lens/__init__.py +19 -0
  1056. velm/core/lsp/base/features/code_lens/contracts.py +46 -0
  1057. velm/core/lsp/base/features/code_lens/engine.py +111 -0
  1058. velm/core/lsp/base/features/code_lens/models.py +6 -0
  1059. velm/core/lsp/base/features/completion/__init__.py +19 -0
  1060. velm/core/lsp/base/features/completion/contracts.py +126 -0
  1061. velm/core/lsp/base/features/completion/engine.py +183 -0
  1062. velm/core/lsp/base/features/completion/models.py +7 -0
  1063. velm/core/lsp/base/features/definition/__init__.py +19 -0
  1064. velm/core/lsp/base/features/definition/contracts.py +47 -0
  1065. velm/core/lsp/base/features/definition/engine.py +90 -0
  1066. velm/core/lsp/base/features/definition/models.py +6 -0
  1067. velm/core/lsp/base/features/definition/registry.py +19 -0
  1068. velm/core/lsp/base/features/diagnostics/__init__.py +19 -0
  1069. velm/core/lsp/base/features/diagnostics/context.py +75 -0
  1070. velm/core/lsp/base/features/diagnostics/engine.py +186 -0
  1071. velm/core/lsp/base/features/diagnostics/formatter.py +214 -0
  1072. velm/core/lsp/base/features/diagnostics/governor.py +92 -0
  1073. velm/core/lsp/base/features/diagnostics/ledger.py +123 -0
  1074. velm/core/lsp/base/features/diagnostics/manager.py +222 -0
  1075. velm/core/lsp/base/features/diagnostics/registry.py +123 -0
  1076. velm/core/lsp/base/features/document_link/__init__.py +7 -0
  1077. velm/core/lsp/base/features/document_link/contracts.py +37 -0
  1078. velm/core/lsp/base/features/document_link/engine.py +66 -0
  1079. velm/core/lsp/base/features/document_link/models.py +6 -0
  1080. velm/core/lsp/base/features/folding_range/__init__.py +25 -0
  1081. velm/core/lsp/base/features/folding_range/contracts.py +32 -0
  1082. velm/core/lsp/base/features/folding_range/engine.py +84 -0
  1083. velm/core/lsp/base/features/folding_range/models.py +10 -0
  1084. velm/core/lsp/base/features/formatting/__init__.py +19 -0
  1085. velm/core/lsp/base/features/formatting/contracts.py +47 -0
  1086. velm/core/lsp/base/features/formatting/engine.py +88 -0
  1087. velm/core/lsp/base/features/formatting/models.py +6 -0
  1088. velm/core/lsp/base/features/hover/__init__.py +7 -0
  1089. velm/core/lsp/base/features/hover/contracts.py +55 -0
  1090. velm/core/lsp/base/features/hover/engine.py +211 -0
  1091. velm/core/lsp/base/features/hover/models.py +23 -0
  1092. velm/core/lsp/base/features/hover/registry.py +18 -0
  1093. velm/core/lsp/base/features/inlay_hint/__init__.py +19 -0
  1094. velm/core/lsp/base/features/inlay_hint/contracts.py +39 -0
  1095. velm/core/lsp/base/features/inlay_hint/engine.py +98 -0
  1096. velm/core/lsp/base/features/inlay_hint/models.py +6 -0
  1097. velm/core/lsp/base/features/inline_completion/__init__.py +19 -0
  1098. velm/core/lsp/base/features/inline_completion/contracts.py +36 -0
  1099. velm/core/lsp/base/features/inline_completion/engine.py +77 -0
  1100. velm/core/lsp/base/features/inline_completion/models.py +7 -0
  1101. velm/core/lsp/base/features/linter/__init__.py +19 -0
  1102. velm/core/lsp/base/features/linter/contracts.py +53 -0
  1103. velm/core/lsp/base/features/linter/engine.py +94 -0
  1104. velm/core/lsp/base/features/references/__init__.py +19 -0
  1105. velm/core/lsp/base/features/references/contracts.py +39 -0
  1106. velm/core/lsp/base/features/references/engine.py +114 -0
  1107. velm/core/lsp/base/features/references/models.py +6 -0
  1108. velm/core/lsp/base/features/rename/__init__.py +27 -0
  1109. velm/core/lsp/base/features/rename/contracts.py +56 -0
  1110. velm/core/lsp/base/features/rename/engine.py +126 -0
  1111. velm/core/lsp/base/features/rename/models.py +6 -0
  1112. velm/core/lsp/base/features/selection_range/__init__.py +13 -0
  1113. velm/core/lsp/base/features/selection_range/contracts.py +32 -0
  1114. velm/core/lsp/base/features/selection_range/engine.py +67 -0
  1115. velm/core/lsp/base/features/selection_range/models.py +50 -0
  1116. velm/core/lsp/base/features/semantic_tokens/__init__.py +20 -0
  1117. velm/core/lsp/base/features/semantic_tokens/contracts.py +23 -0
  1118. velm/core/lsp/base/features/semantic_tokens/differ.py +66 -0
  1119. velm/core/lsp/base/features/semantic_tokens/encoder.py +50 -0
  1120. velm/core/lsp/base/features/semantic_tokens/engine.py +200 -0
  1121. velm/core/lsp/base/features/semantic_tokens/legend.py +37 -0
  1122. velm/core/lsp/base/features/semantic_tokens/models.py +8 -0
  1123. velm/core/lsp/base/features/signature_help/__init__.py +25 -0
  1124. velm/core/lsp/base/features/signature_help/contracts.py +45 -0
  1125. velm/core/lsp/base/features/signature_help/engine.py +139 -0
  1126. velm/core/lsp/base/features/signature_help/models.py +7 -0
  1127. velm/core/lsp/base/features/symbols/__init__.py +19 -0
  1128. velm/core/lsp/base/features/symbols/contracts.py +64 -0
  1129. velm/core/lsp/base/features/symbols/engine.py +99 -0
  1130. velm/core/lsp/base/features/symbols/models.py +7 -0
  1131. velm/core/lsp/base/features/type_hierarchy/__init__.py +18 -0
  1132. velm/core/lsp/base/features/type_hierarchy/contracts.py +39 -0
  1133. velm/core/lsp/base/features/type_hierarchy/engine.py +91 -0
  1134. velm/core/lsp/base/features/type_hierarchy/models.py +9 -0
  1135. velm/core/lsp/base/features/workspace/__init__.py +8 -0
  1136. velm/core/lsp/base/features/workspace/commands/router.py +30 -0
  1137. velm/core/lsp/base/features/workspace/contracts.py +20 -0
  1138. velm/core/lsp/base/features/workspace/engine.py +42 -0
  1139. velm/core/lsp/base/features/workspace/folders/__init__.py +14 -0
  1140. velm/core/lsp/base/features/workspace/folders/manager.py +110 -0
  1141. velm/core/lsp/base/features/workspace/folders/models.py +38 -0
  1142. velm/core/lsp/base/features/workspace/folders/scryer.py +53 -0
  1143. velm/core/lsp/base/features/workspace/models.py +8 -0
  1144. velm/core/lsp/base/features/workspace/symbols/__init__.py +14 -0
  1145. velm/core/lsp/base/features/workspace/symbols/contracts.py +19 -0
  1146. velm/core/lsp/base/features/workspace/symbols/cortex_bridge.py +34 -0
  1147. velm/core/lsp/base/features/workspace/symbols/engine.py +46 -0
  1148. velm/core/lsp/base/features/workspace/symbols/models.py +21 -0
  1149. velm/core/lsp/base/features/workspace/symbols/scryer.py +46 -0
  1150. velm/core/lsp/base/features/workspace/watcher/core.py +217 -0
  1151. velm/core/lsp/base/features/workspace/watcher/debounce.py +29 -0
  1152. velm/core/lsp/base/foundry.py +62 -0
  1153. velm/core/lsp/base/governor.py +100 -0
  1154. velm/core/lsp/base/kernel.py +363 -0
  1155. velm/core/lsp/base/manager.py +148 -0
  1156. velm/core/lsp/base/middleware.py +112 -0
  1157. velm/core/lsp/base/protocol/__init__.py +31 -0
  1158. velm/core/lsp/base/protocol/constants.py +33 -0
  1159. velm/core/lsp/base/protocol/endpoint.py +258 -0
  1160. velm/core/lsp/base/protocol/framing.py +105 -0
  1161. velm/core/lsp/base/protocol/streams.py +274 -0
  1162. velm/core/lsp/base/protocol/telemetry.py +73 -0
  1163. velm/core/lsp/base/rpc/__init__.py +49 -0
  1164. velm/core/lsp/base/rpc/base.py +17 -0
  1165. velm/core/lsp/base/rpc/cancellation.py +54 -0
  1166. velm/core/lsp/base/rpc/codes.py +30 -0
  1167. velm/core/lsp/base/rpc/converter.py +50 -0
  1168. velm/core/lsp/base/rpc/errors.py +56 -0
  1169. velm/core/lsp/base/rpc/filters.py +30 -0
  1170. velm/core/lsp/base/rpc/messages.py +136 -0
  1171. velm/core/lsp/base/rpc/serializer.py +302 -0
  1172. velm/core/lsp/base/state.py +32 -0
  1173. velm/core/lsp/base/telemetry.py +88 -0
  1174. velm/core/lsp/base/types/__init__.py +187 -0
  1175. velm/core/lsp/base/types/base.py +54 -0
  1176. velm/core/lsp/base/types/call_hierarchy.py +69 -0
  1177. velm/core/lsp/base/types/code_action.py +83 -0
  1178. velm/core/lsp/base/types/code_lens.py +23 -0
  1179. velm/core/lsp/base/types/completion.py +230 -0
  1180. velm/core/lsp/base/types/definition.py +88 -0
  1181. velm/core/lsp/base/types/diagnostics.py +129 -0
  1182. velm/core/lsp/base/types/document_highlight.py +68 -0
  1183. velm/core/lsp/base/types/document_link.py +48 -0
  1184. velm/core/lsp/base/types/folding_range.py +93 -0
  1185. velm/core/lsp/base/types/formatting.py +22 -0
  1186. velm/core/lsp/base/types/hover.py +107 -0
  1187. velm/core/lsp/base/types/inlay_hint.py +31 -0
  1188. velm/core/lsp/base/types/inline_completion.py +65 -0
  1189. velm/core/lsp/base/types/lifecycle.py +182 -0
  1190. velm/core/lsp/base/types/navigation.py +104 -0
  1191. velm/core/lsp/base/types/primitives.py +262 -0
  1192. velm/core/lsp/base/types/references.py +79 -0
  1193. velm/core/lsp/base/types/rename.py +61 -0
  1194. velm/core/lsp/base/types/selection_range.py +73 -0
  1195. velm/core/lsp/base/types/semantic_tokens.py +44 -0
  1196. velm/core/lsp/base/types/signature_help.py +131 -0
  1197. velm/core/lsp/base/types/symbols.py +47 -0
  1198. velm/core/lsp/base/types/sync.py +58 -0
  1199. velm/core/lsp/base/types/type_hierarchy.py +65 -0
  1200. velm/core/lsp/base/types/window.py +98 -0
  1201. velm/core/lsp/base/types/workspace.py +155 -0
  1202. velm/core/lsp/base/utils/__init__.py +13 -0
  1203. velm/core/lsp/base/utils/debounce.py +38 -0
  1204. velm/core/lsp/base/utils/position.py +29 -0
  1205. velm/core/lsp/base/utils/text.py +201 -0
  1206. velm/core/lsp/base/utils/timing.py +64 -0
  1207. velm/core/lsp/base/utils/uri.py +267 -0
  1208. velm/core/lsp/base/utils/validation.py +19 -0
  1209. velm/core/lsp/scaffold_features/call_hierarchy/__init__.py +6 -0
  1210. velm/core/lsp/scaffold_features/call_hierarchy/engine.py +26 -0
  1211. velm/core/lsp/scaffold_features/call_hierarchy/providers/daemon_bridge.py +128 -0
  1212. velm/core/lsp/scaffold_features/code_action/__init__.py +25 -0
  1213. velm/core/lsp/scaffold_features/code_action/engine.py +89 -0
  1214. velm/core/lsp/scaffold_features/code_action/models.py +6 -0
  1215. velm/core/lsp/scaffold_features/code_action/providers/artisan_bridge.py +214 -0
  1216. velm/core/lsp/scaffold_features/code_action/providers/neural_healer.py +52 -0
  1217. velm/core/lsp/scaffold_features/code_action/providers/refactor_surgeon.py +57 -0
  1218. velm/core/lsp/scaffold_features/code_action/providers/syntax_medic.py +64 -0
  1219. velm/core/lsp/scaffold_features/code_lens/__init__.py +15 -0
  1220. velm/core/lsp/scaffold_features/code_lens/engine.py +32 -0
  1221. velm/core/lsp/scaffold_features/code_lens/models.py +5 -0
  1222. velm/core/lsp/scaffold_features/code_lens/providers/blueprint.py +55 -0
  1223. velm/core/lsp/scaffold_features/code_lens/providers/intelligence.py +57 -0
  1224. velm/core/lsp/scaffold_features/code_lens/providers/kinetic.py +56 -0
  1225. velm/core/lsp/scaffold_features/completion/__init__.py +17 -0
  1226. velm/core/lsp/scaffold_features/completion/engine.py +278 -0
  1227. velm/core/lsp/scaffold_features/completion/models.py +7 -0
  1228. velm/core/lsp/scaffold_features/completion/providers/__init__.py +27 -0
  1229. velm/core/lsp/scaffold_features/completion/providers/global_prophet.py +160 -0
  1230. velm/core/lsp/scaffold_features/completion/providers/internal.py +153 -0
  1231. velm/core/lsp/scaffold_features/completion/providers/keyword_prophet.py +246 -0
  1232. velm/core/lsp/scaffold_features/completion/providers/path_prophet.py +330 -0
  1233. velm/core/lsp/scaffold_features/completion/providers/variable_prophet.py +92 -0
  1234. velm/core/lsp/scaffold_features/definition/__init__.py +19 -0
  1235. velm/core/lsp/scaffold_features/definition/engine.py +40 -0
  1236. velm/core/lsp/scaffold_features/definition/models.py +6 -0
  1237. velm/core/lsp/scaffold_features/definition/rules/__init__.py +8 -0
  1238. velm/core/lsp/scaffold_features/definition/rules/file_links.py +57 -0
  1239. velm/core/lsp/scaffold_features/definition/rules/global_symbols.py +57 -0
  1240. velm/core/lsp/scaffold_features/definition/rules/local_vars.py +47 -0
  1241. velm/core/lsp/scaffold_features/definition/rules/macros.py +51 -0
  1242. velm/core/lsp/scaffold_features/definition/rules/stdlib.py +38 -0
  1243. velm/core/lsp/scaffold_features/document_link/__init__.py +6 -0
  1244. velm/core/lsp/scaffold_features/document_link/engine.py +25 -0
  1245. velm/core/lsp/scaffold_features/document_link/providers/gnostic_linker.py +114 -0
  1246. velm/core/lsp/scaffold_features/folding_range/__init__.py +21 -0
  1247. velm/core/lsp/scaffold_features/folding_range/engine.py +42 -0
  1248. velm/core/lsp/scaffold_features/folding_range/providers/commentary.py +50 -0
  1249. velm/core/lsp/scaffold_features/folding_range/providers/content_block.py +64 -0
  1250. velm/core/lsp/scaffold_features/folding_range/providers/gnostic_structure.py +70 -0
  1251. velm/core/lsp/scaffold_features/folding_range/providers/indentation_fallback.py +59 -0
  1252. velm/core/lsp/scaffold_features/formatting/__init__.py +6 -0
  1253. velm/core/lsp/scaffold_features/formatting/engine.py +26 -0
  1254. velm/core/lsp/scaffold_features/formatting/models.py +6 -0
  1255. velm/core/lsp/scaffold_features/formatting/providers/__init__.py +5 -0
  1256. velm/core/lsp/scaffold_features/formatting/providers/beautifier.py +105 -0
  1257. velm/core/lsp/scaffold_features/hover/__init__.py +20 -0
  1258. velm/core/lsp/scaffold_features/hover/engine.py +240 -0
  1259. velm/core/lsp/scaffold_features/hover/grimoire_data.py +239 -0
  1260. velm/core/lsp/scaffold_features/hover/models.py +6 -0
  1261. velm/core/lsp/scaffold_features/hover/providers/__init__.py +29 -0
  1262. velm/core/lsp/scaffold_features/hover/providers/alchemy.py +64 -0
  1263. velm/core/lsp/scaffold_features/hover/providers/internal.py +170 -0
  1264. velm/core/lsp/scaffold_features/hover/providers/matter.py +89 -0
  1265. velm/core/lsp/scaffold_features/hover/providers/mentor.py +63 -0
  1266. velm/core/lsp/scaffold_features/inlay_hint/__init__.py +15 -0
  1267. velm/core/lsp/scaffold_features/inlay_hint/engine.py +32 -0
  1268. velm/core/lsp/scaffold_features/inlay_hint/models.py +6 -0
  1269. velm/core/lsp/scaffold_features/inlay_hint/providers/__init__.py +5 -0
  1270. velm/core/lsp/scaffold_features/inlay_hint/providers/macro_param.py +114 -0
  1271. velm/core/lsp/scaffold_features/inlay_hint/providers/shadow_truth.py +96 -0
  1272. velm/core/lsp/scaffold_features/inlay_hint/providers/variable_type.py +112 -0
  1273. velm/core/lsp/scaffold_features/inline_completion/__init__.py +8 -0
  1274. velm/core/lsp/scaffold_features/inline_completion/engine.py +29 -0
  1275. velm/core/lsp/scaffold_features/inline_completion/providers/muse.py +60 -0
  1276. velm/core/lsp/scaffold_features/inline_completion/providers/snippet.py +40 -0
  1277. velm/core/lsp/scaffold_features/linter/__init__.py +19 -0
  1278. velm/core/lsp/scaffold_features/linter/context.py +74 -0
  1279. velm/core/lsp/scaffold_features/linter/engine.py +59 -0
  1280. velm/core/lsp/scaffold_features/linter/registry.py +63 -0
  1281. velm/core/lsp/scaffold_features/linter/rules/architecture_law.py +79 -0
  1282. velm/core/lsp/scaffold_features/linter/rules/artisan_inquest.py +387 -0
  1283. velm/core/lsp/scaffold_features/linter/rules/base.py +79 -0
  1284. velm/core/lsp/scaffold_features/linter/rules/bond_law.py +57 -0
  1285. velm/core/lsp/scaffold_features/linter/rules/complexity_law.py +47 -0
  1286. velm/core/lsp/scaffold_features/linter/rules/geometry_law.py +45 -0
  1287. velm/core/lsp/scaffold_features/linter/rules/security_law.py +47 -0
  1288. velm/core/lsp/scaffold_features/linter/rules/syntax_law.py +53 -0
  1289. velm/core/lsp/scaffold_features/refactoring/__init__.py +7 -0
  1290. velm/core/lsp/scaffold_features/refactoring/engine.py +41 -0
  1291. velm/core/lsp/scaffold_features/refactoring/handlers/rename_files.py +90 -0
  1292. velm/core/lsp/scaffold_features/references/__init__.py +15 -0
  1293. velm/core/lsp/scaffold_features/references/engine.py +36 -0
  1294. velm/core/lsp/scaffold_features/references/models.py +5 -0
  1295. velm/core/lsp/scaffold_features/references/providers/__init__.py +5 -0
  1296. velm/core/lsp/scaffold_features/references/providers/daemon_bridge.py +55 -0
  1297. velm/core/lsp/scaffold_features/references/providers/inclusion.py +49 -0
  1298. velm/core/lsp/scaffold_features/references/providers/local_usage.py +56 -0
  1299. velm/core/lsp/scaffold_features/rename/__init__.py +12 -0
  1300. velm/core/lsp/scaffold_features/rename/contracts.py +41 -0
  1301. velm/core/lsp/scaffold_features/rename/engine.py +33 -0
  1302. velm/core/lsp/scaffold_features/rename/models.py +6 -0
  1303. velm/core/lsp/scaffold_features/rename/mutators/cortex.py +45 -0
  1304. velm/core/lsp/scaffold_features/rename/mutators/local.py +55 -0
  1305. velm/core/lsp/scaffold_features/rename/validator.py +32 -0
  1306. velm/core/lsp/scaffold_features/selection_range/__init__.py +6 -0
  1307. velm/core/lsp/scaffold_features/selection_range/engine.py +26 -0
  1308. velm/core/lsp/scaffold_features/selection_range/providers/semantic_expander.py +236 -0
  1309. velm/core/lsp/scaffold_features/semantic_tokens/__init__.py +6 -0
  1310. velm/core/lsp/scaffold_features/semantic_tokens/engine.py +26 -0
  1311. velm/core/lsp/scaffold_features/semantic_tokens/legend.py +124 -0
  1312. velm/core/lsp/scaffold_features/semantic_tokens/models.py +8 -0
  1313. velm/core/lsp/scaffold_features/semantic_tokens/providers/__init__.py +6 -0
  1314. velm/core/lsp/scaffold_features/semantic_tokens/providers/gnostic.py +117 -0
  1315. velm/core/lsp/scaffold_features/signature_help/__init__.py +15 -0
  1316. velm/core/lsp/scaffold_features/signature_help/engine.py +32 -0
  1317. velm/core/lsp/scaffold_features/signature_help/models.py +6 -0
  1318. velm/core/lsp/scaffold_features/signature_help/providers/__init__.py +5 -0
  1319. velm/core/lsp/scaffold_features/signature_help/providers/alchemist_oracle.py +55 -0
  1320. velm/core/lsp/scaffold_features/signature_help/providers/bridge.py +41 -0
  1321. velm/core/lsp/scaffold_features/signature_help/providers/macro_oracle.py +47 -0
  1322. velm/core/lsp/scaffold_features/symbols/__init__.py +19 -0
  1323. velm/core/lsp/scaffold_features/symbols/engine.py +37 -0
  1324. velm/core/lsp/scaffold_features/symbols/models.py +7 -0
  1325. velm/core/lsp/scaffold_features/symbols/providers/__init__.py +30 -0
  1326. velm/core/lsp/scaffold_features/symbols/providers/base.py +22 -0
  1327. velm/core/lsp/scaffold_features/symbols/providers/logic.py +58 -0
  1328. velm/core/lsp/scaffold_features/symbols/providers/maestro.py +41 -0
  1329. velm/core/lsp/scaffold_features/symbols/providers/matter.py +65 -0
  1330. velm/core/lsp/scaffold_features/symbols/providers/polyglot.py +31 -0
  1331. velm/core/lsp/scaffold_features/symbols/providers/variables.py +37 -0
  1332. velm/core/lsp/scaffold_features/type_hierarchy/__init__.py +6 -0
  1333. velm/core/lsp/scaffold_features/type_hierarchy/engine.py +26 -0
  1334. velm/core/lsp/scaffold_features/type_hierarchy/providers/daemon_bridge.py +129 -0
  1335. velm/core/lsp/scaffold_features/workspace/__init__.py +14 -0
  1336. velm/core/lsp/scaffold_features/workspace/commands.py +57 -0
  1337. velm/core/lsp/scaffold_features/workspace/engine.py +34 -0
  1338. velm/core/lsp/scaffold_features/workspace/grimoire.py +19 -0
  1339. velm/core/lsp/scaffold_features/workspace/watcher.py +31 -0
  1340. velm/core/lsp/scaffold_server/__init__.py +39 -0
  1341. velm/core/lsp/scaffold_server/__main__.py +22 -0
  1342. velm/core/lsp/scaffold_server/adrenaline.py +208 -0
  1343. velm/core/lsp/scaffold_server/auth.py +183 -0
  1344. velm/core/lsp/scaffold_server/bootstrap.py +233 -0
  1345. velm/core/lsp/scaffold_server/commands.py +267 -0
  1346. velm/core/lsp/scaffold_server/engine.py +1157 -0
  1347. velm/core/lsp/scaffold_server/inquest.py +268 -0
  1348. velm/core/lsp/scaffold_server/lifecycle.py +214 -0
  1349. velm/core/lsp/scaffold_server/mirror.py +162 -0
  1350. velm/core/lsp/scaffold_server/relay.py +264 -0
  1351. velm/core/lsp/scaffold_server/sync.py +224 -0
  1352. velm/core/lsp/scaffold_server/telemetry.py +189 -0
  1353. velm/core/maestro/__init__.py +16 -0
  1354. velm/core/maestro/conductor.py +377 -0
  1355. velm/core/maestro/context.py +227 -0
  1356. velm/core/maestro/contracts.py +39 -0
  1357. velm/core/maestro/handlers/__init__.py +14 -0
  1358. velm/core/maestro/handlers/base.py +38 -0
  1359. velm/core/maestro/handlers/browser.py +53 -0
  1360. velm/core/maestro/handlers/hosts.py +109 -0
  1361. velm/core/maestro/handlers/proclaim.py +40 -0
  1362. velm/core/maestro/handlers/raw.py +40 -0
  1363. velm/core/maestro/handlers/shell.py +306 -0
  1364. velm/core/maestro/handlers/tunnel.py +32 -0
  1365. velm/core/maestro/reverser.py +132 -0
  1366. velm/core/maestro/scribe.py +90 -0
  1367. velm/core/net/__init__.py +13 -0
  1368. velm/core/net/aether/__init__.py +14 -0
  1369. velm/core/net/aether/anonymizer.py +19 -0
  1370. velm/core/net/aether/client.py +32 -0
  1371. velm/core/net/tunnel.py +222 -0
  1372. velm/core/observatory/__init__.py +26 -0
  1373. velm/core/observatory/contracts.py +62 -0
  1374. velm/core/observatory/health.py +57 -0
  1375. velm/core/observatory/manager.py +166 -0
  1376. velm/core/observatory/scanner.py +65 -0
  1377. velm/core/observatory/store.py +67 -0
  1378. velm/core/persona/manager.py +74 -0
  1379. velm/core/persona/registry.py +52 -0
  1380. velm/core/redemption/__init__.py +0 -0
  1381. velm/core/redemption/diagnostician/__init__.py +14 -0
  1382. velm/core/redemption/diagnostician/contracts.py +21 -0
  1383. velm/core/redemption/diagnostician/doctor.py +71 -0
  1384. velm/core/redemption/diagnostician/grimoire.py +39 -0
  1385. velm/core/redemption/diagnostician/specialists/__init__.py +0 -0
  1386. velm/core/redemption/diagnostician/specialists/fs_healer.py +73 -0
  1387. velm/core/redemption/diagnostician/specialists/import_healer.py +64 -0
  1388. velm/core/redemption/diagnostician/specialists/network_healer.py +69 -0
  1389. velm/core/redemption/diagnostician/specialists/system_healer.py +151 -0
  1390. velm/core/resolvers/__init__.py +5 -0
  1391. velm/core/resolvers/pathfinder.py +137 -0
  1392. velm/core/runtime/__init__.py +13 -0
  1393. velm/core/runtime/context.py +199 -0
  1394. velm/core/runtime/engine/__init__.py +15 -0
  1395. velm/core/runtime/engine/constants.py +22 -0
  1396. velm/core/runtime/engine/core.py +775 -0
  1397. velm/core/runtime/engine/execution/__init__.py +27 -0
  1398. velm/core/runtime/engine/execution/context.py +93 -0
  1399. velm/core/runtime/engine/execution/dispatcher.py +365 -0
  1400. velm/core/runtime/engine/execution/executor.py +61 -0
  1401. velm/core/runtime/engine/execution/locking.py +35 -0
  1402. velm/core/runtime/engine/execution/retry.py +44 -0
  1403. velm/core/runtime/engine/execution/transaction.py +143 -0
  1404. velm/core/runtime/engine/intelligence/__init__.py +27 -0
  1405. velm/core/runtime/engine/intelligence/cache.py +49 -0
  1406. velm/core/runtime/engine/intelligence/memory.py +36 -0
  1407. velm/core/runtime/engine/intelligence/optimizer.py +46 -0
  1408. velm/core/runtime/engine/intelligence/predictor.py +355 -0
  1409. velm/core/runtime/engine/lifecycle/__init__.py +34 -0
  1410. velm/core/runtime/engine/lifecycle/bootstrap.py +175 -0
  1411. velm/core/runtime/engine/lifecycle/shutdown.py +54 -0
  1412. velm/core/runtime/engine/lifecycle/signals.py +36 -0
  1413. velm/core/runtime/engine/lifecycle/state.py +31 -0
  1414. velm/core/runtime/engine/lifecycle/vitality.py +212 -0
  1415. velm/core/runtime/engine/resilience/__init__.py +27 -0
  1416. velm/core/runtime/engine/resilience/circuit.py +75 -0
  1417. velm/core/runtime/engine/resilience/forensics.py +45 -0
  1418. velm/core/runtime/engine/resilience/healer.py +187 -0
  1419. velm/core/runtime/engine/resilience/watchdog.py +293 -0
  1420. velm/core/runtime/middleware/__init__.py +96 -0
  1421. velm/core/runtime/middleware/adaptive.py +128 -0
  1422. velm/core/runtime/middleware/auth.py +56 -0
  1423. velm/core/runtime/middleware/budget.py +41 -0
  1424. velm/core/runtime/middleware/caching.py +253 -0
  1425. velm/core/runtime/middleware/chaos.py +173 -0
  1426. velm/core/runtime/middleware/circuit.py +85 -0
  1427. velm/core/runtime/middleware/compliance.py +122 -0
  1428. velm/core/runtime/middleware/concourse.py +46 -0
  1429. velm/core/runtime/middleware/constitution.py +130 -0
  1430. velm/core/runtime/middleware/contract.py +30 -0
  1431. velm/core/runtime/middleware/enrichment.py +138 -0
  1432. velm/core/runtime/middleware/entropy_shield.py +202 -0
  1433. velm/core/runtime/middleware/flags.py +179 -0
  1434. velm/core/runtime/middleware/forensics.py +53 -0
  1435. velm/core/runtime/middleware/governor.py +95 -0
  1436. velm/core/runtime/middleware/harmonizer.py +153 -0
  1437. velm/core/runtime/middleware/healing.py +66 -0
  1438. velm/core/runtime/middleware/librarian.py +212 -0
  1439. velm/core/runtime/middleware/notification.py +78 -0
  1440. velm/core/runtime/middleware/optimization.py +78 -0
  1441. velm/core/runtime/middleware/output_veil.py +86 -0
  1442. velm/core/runtime/middleware/persona_warden.py +92 -0
  1443. velm/core/runtime/middleware/pipeline.py +376 -0
  1444. velm/core/runtime/middleware/policy.py +66 -0
  1445. velm/core/runtime/middleware/prerequisites.py +307 -0
  1446. velm/core/runtime/middleware/privacy.py +299 -0
  1447. velm/core/runtime/middleware/profiler.py +178 -0
  1448. velm/core/runtime/middleware/reflective.py +58 -0
  1449. velm/core/runtime/middleware/resonance.py +79 -0
  1450. velm/core/runtime/middleware/safety.py +48 -0
  1451. velm/core/runtime/middleware/singularity.py +98 -0
  1452. velm/core/runtime/middleware/telemetry.py +334 -0
  1453. velm/core/runtime/middleware/tracing.py +53 -0
  1454. velm/core/runtime/middleware/veil.py +74 -0
  1455. velm/core/runtime/plugin_interface.py +26 -0
  1456. velm/core/runtime/registry.py +368 -0
  1457. velm/core/runtime/remote.py +312 -0
  1458. velm/core/runtime/resilience.py +117 -0
  1459. velm/core/runtime/telemetry.py +391 -0
  1460. velm/core/sanctum/base.py +113 -0
  1461. velm/core/sanctum/local.py +309 -0
  1462. velm/core/sanctum/memory.py +379 -0
  1463. velm/core/sanctum/s3.py +203 -0
  1464. velm/core/sanctum/ssh.py +338 -0
  1465. velm/core/sanitization/__init__.py +13 -0
  1466. velm/core/sanitization/ghost_buster.py +116 -0
  1467. velm/core/scaffold.lock +374 -0
  1468. velm/core/scaffold.scaffold +44 -0
  1469. velm/core/semantics/__init__.py +27 -0
  1470. velm/core/semantics/contracts.py +133 -0
  1471. velm/core/semantics/engine.py +223 -0
  1472. velm/core/semantics/intent.py +87 -0
  1473. velm/core/semantics/reranker.py +95 -0
  1474. velm/core/semantics/retriever.py +124 -0
  1475. velm/core/sentinel_conduit.py +164 -0
  1476. velm/core/simulation/__init__.py +16 -0
  1477. velm/core/simulation/conductor/__init__.py +11 -0
  1478. velm/core/simulation/conductor/gnostic_comparator.py +219 -0
  1479. velm/core/simulation/conductor/orchestrator.py +127 -0
  1480. velm/core/simulation/conductor/reality_forge.py +188 -0
  1481. velm/core/simulation/conductor/simulation_mind.py +115 -0
  1482. velm/core/simulation/prophecy.py +33 -0
  1483. velm/core/simulation/scribe.py +232 -0
  1484. velm/core/state/__init__.py +26 -0
  1485. velm/core/state/contracts.py +141 -0
  1486. velm/core/state/gnostic_db/__init__.py +35 -0
  1487. velm/core/state/gnostic_db/engine.py +299 -0
  1488. velm/core/state/gnostic_db/models.py +176 -0
  1489. velm/core/state/ledger.py +46 -0
  1490. velm/core/state/machine.py +25 -0
  1491. velm/core/state/snapshot.py +30 -0
  1492. velm/core/state/store.py +205 -0
  1493. velm/core/structure_sentinel/__init__.py +15 -0
  1494. velm/core/structure_sentinel/contracts.py +24 -0
  1495. velm/core/structure_sentinel/facade.py +84 -0
  1496. velm/core/structure_sentinel/strategies/__init__.py +38 -0
  1497. velm/core/structure_sentinel/strategies/base_strategy.py +17 -0
  1498. velm/core/structure_sentinel/strategies/boundary_strategy.py +59 -0
  1499. velm/core/structure_sentinel/strategies/cpp_strategy.py +115 -0
  1500. velm/core/structure_sentinel/strategies/go_strategy.py +130 -0
  1501. velm/core/structure_sentinel/strategies/java_strategy.py +99 -0
  1502. velm/core/structure_sentinel/strategies/javascript_strategy.py +12 -0
  1503. velm/core/structure_sentinel/strategies/node_strategy.py +160 -0
  1504. velm/core/structure_sentinel/strategies/python_strategy/__init__.py +6 -0
  1505. velm/core/structure_sentinel/strategies/python_strategy/base_faculty.py +43 -0
  1506. velm/core/structure_sentinel/strategies/python_strategy/contracts.py +19 -0
  1507. velm/core/structure_sentinel/strategies/python_strategy/engine.py +101 -0
  1508. velm/core/structure_sentinel/strategies/python_strategy/frameworks/__init__.py +13 -0
  1509. velm/core/structure_sentinel/strategies/python_strategy/frameworks/contracts.py +52 -0
  1510. velm/core/structure_sentinel/strategies/python_strategy/frameworks/engine.py +96 -0
  1511. velm/core/structure_sentinel/strategies/python_strategy/frameworks/heuristics.py +63 -0
  1512. velm/core/structure_sentinel/strategies/python_strategy/frameworks/strategies/__init__.py +14 -0
  1513. velm/core/structure_sentinel/strategies/python_strategy/frameworks/strategies/django.py +57 -0
  1514. velm/core/structure_sentinel/strategies/python_strategy/frameworks/strategies/fastapi.py +46 -0
  1515. velm/core/structure_sentinel/strategies/python_strategy/frameworks/strategies/flask.py +41 -0
  1516. velm/core/structure_sentinel/strategies/python_strategy/frameworks/strategies/typer.py +40 -0
  1517. velm/core/structure_sentinel/strategies/python_strategy/frameworks/surgeon.py +93 -0
  1518. velm/core/structure_sentinel/strategies/python_strategy/semantic/__init__.py +2 -0
  1519. velm/core/structure_sentinel/strategies/python_strategy/semantic/engine.py +171 -0
  1520. velm/core/structure_sentinel/strategies/python_strategy/semantic/guardian.py +172 -0
  1521. velm/core/structure_sentinel/strategies/python_strategy/semantic/harvester.py +142 -0
  1522. velm/core/structure_sentinel/strategies/python_strategy/semantic/weaver.py +232 -0
  1523. velm/core/structure_sentinel/strategies/python_strategy/structural/__init__.py +2 -0
  1524. velm/core/structure_sentinel/strategies/python_strategy/structural/content.py +239 -0
  1525. velm/core/structure_sentinel/strategies/python_strategy/structural/engine.py +192 -0
  1526. velm/core/structure_sentinel/strategies/python_strategy/structural/layout.py +244 -0
  1527. velm/core/structure_sentinel/strategies/python_strategy/testing/__init__.py +5 -0
  1528. velm/core/structure_sentinel/strategies/python_strategy/testing/analyzer.py +90 -0
  1529. velm/core/structure_sentinel/strategies/python_strategy/testing/contracts.py +31 -0
  1530. velm/core/structure_sentinel/strategies/python_strategy/testing/engine.py +100 -0
  1531. velm/core/structure_sentinel/strategies/python_strategy/testing/generator.py +119 -0
  1532. velm/core/structure_sentinel/strategies/ruby_strategy.py +104 -0
  1533. velm/core/structure_sentinel/strategies/rust_strategy.py +169 -0
  1534. velm/core/structure_sentinel/strategies/typescript_strategy.py +12 -0
  1535. velm/core/symbolic/__init__.py +154 -0
  1536. velm/core/symbolic/contracts.py +134 -0
  1537. velm/core/symbolic/engine.py +230 -0
  1538. velm/core/symbolic/inquisitors/__init__.py +119 -0
  1539. velm/core/symbolic/inquisitors/banker.py +166 -0
  1540. velm/core/symbolic/inquisitors/base.py +157 -0
  1541. velm/core/symbolic/inquisitors/bouncer.py +214 -0
  1542. velm/core/symbolic/inquisitors/chronos.py +190 -0
  1543. velm/core/symbolic/inquisitors/librarian.py +284 -0
  1544. velm/core/symbolic/inquisitors/retina.py +154 -0
  1545. velm/core/symbolic/inquisitors/scrier.py +153 -0
  1546. velm/core/symbolic/inquisitors/sentinel.py +155 -0
  1547. velm/core/symbolic/refinement/__init__.py +89 -0
  1548. velm/core/symbolic/refinement/alchemist.py +198 -0
  1549. velm/core/symbolic/refinement/purifier.py +180 -0
  1550. velm/core/symbolic/sutures/__init__.py +76 -0
  1551. velm/core/symbolic/sutures/neural_bridge.py +440 -0
  1552. velm/core/symbolic/sutures/vision_gate.py +178 -0
  1553. velm/core/symbolic/telemetry/__init__.py +75 -0
  1554. velm/core/symbolic/telemetry/pulse.py +128 -0
  1555. velm/core/symbolic.scaffold +28 -0
  1556. velm/core/system/manager.py +304 -0
  1557. velm/core/traceback/__init__.py +15 -0
  1558. velm/core/traceback/contracts.py +123 -0
  1559. velm/core/traceback/handler.py +188 -0
  1560. velm/core/traceback/inspector.py +222 -0
  1561. velm/core/traceback/renderer.py +138 -0
  1562. velm/creator/__init__.py +15 -0
  1563. velm/creator/alu.py +46 -0
  1564. velm/creator/bootloader.py +66 -0
  1565. velm/creator/cpu.py +148 -0
  1566. velm/creator/engine/__init__.py +12 -0
  1567. velm/creator/engine/adjudicator.py +110 -0
  1568. velm/creator/engine/facade.py +237 -0
  1569. velm/creator/factory.py +46 -0
  1570. velm/creator/io_controller/__init__.py +23 -0
  1571. velm/creator/io_controller/contracts.py +17 -0
  1572. velm/creator/io_controller/facade.py +221 -0
  1573. velm/creator/io_controller/ledger_scribe.py +109 -0
  1574. velm/creator/io_controller/operations.py +128 -0
  1575. velm/creator/io_controller/path_alchemist.py +45 -0
  1576. velm/creator/io_controller/security.py +67 -0
  1577. velm/creator/io_controller/transaction_router.py +66 -0
  1578. velm/creator/io_controller/trash.py +126 -0
  1579. velm/creator/io_validators.py +90 -0
  1580. velm/creator/next_step_oracle.py +143 -0
  1581. velm/creator/opcodes.py +39 -0
  1582. velm/creator/registers.py +152 -0
  1583. velm/creator/reports.py +85 -0
  1584. velm/creator/security.py +108 -0
  1585. velm/creator/writer/__init__.py +13 -0
  1586. velm/creator/writer/atomic.py +58 -0
  1587. velm/creator/writer/contracts.py +27 -0
  1588. velm/creator/writer/differential.py +30 -0
  1589. velm/creator/writer/engine.py +327 -0
  1590. velm/creator/writer/normalizer.py +48 -0
  1591. velm/creator/writer/security.py +32 -0
  1592. velm/creator/writer/validator.py +53 -0
  1593. velm/default_templates/template.alembic.ini.scaffold +27 -0
  1594. velm/default_templates/template.changelog.scaffold +23 -0
  1595. velm/default_templates/template.code_of_conduct.scaffold +25 -0
  1596. velm/default_templates/template.contributing.scaffold +52 -0
  1597. velm/default_templates/template.cpp.scaffold +22 -0
  1598. velm/default_templates/template.cs.scaffold +18 -0
  1599. velm/default_templates/template.css.scaffold +17 -0
  1600. velm/default_templates/template.dart.scaffold +14 -0
  1601. velm/default_templates/template.docker-compose.scaffold +34 -0
  1602. velm/default_templates/template.dockerfile.scaffold +31 -0
  1603. velm/default_templates/template.dockerignore.scaffold +32 -0
  1604. velm/default_templates/template.editorconfig.scaffold +33 -0
  1605. velm/default_templates/template.env.example.scaffold +24 -0
  1606. velm/default_templates/template.gitattributes.scaffold +32 -0
  1607. velm/default_templates/template.github-action-python.scaffold +135 -0
  1608. velm/default_templates/template.gitignore.scaffold +28 -0
  1609. velm/default_templates/template.go.scaffold +17 -0
  1610. velm/default_templates/template.html.scaffold +19 -0
  1611. velm/default_templates/template.java.scaffold +27 -0
  1612. velm/default_templates/template.js.scaffold +22 -0
  1613. velm/default_templates/template.json.scaffold +15 -0
  1614. velm/default_templates/template.justfile.scaffold +54 -0
  1615. velm/default_templates/template.kt.scaffold +23 -0
  1616. velm/default_templates/template.license.scaffold +13 -0
  1617. velm/default_templates/template.lua.scaffold +12 -0
  1618. velm/default_templates/template.makefile.scaffold +23 -0
  1619. velm/default_templates/template.nginx.conf.scaffold +42 -0
  1620. velm/default_templates/template.package.scaffold +21 -0
  1621. velm/default_templates/template.php.scaffold +20 -0
  1622. velm/default_templates/template.pre-commit-config.scaffold +30 -0
  1623. velm/default_templates/template.py.scaffold +23 -0
  1624. velm/default_templates/template.pyproject.scaffold +34 -0
  1625. velm/default_templates/template.pytest.ini.scaffold +22 -0
  1626. velm/default_templates/template.readme.scaffold +27 -0
  1627. velm/default_templates/template.rs.scaffold +14 -0
  1628. velm/default_templates/template.ruby.scaffold +11 -0
  1629. velm/default_templates/template.sbt.scaffold +11 -0
  1630. velm/default_templates/template.scaffold.scaffold +28 -0
  1631. velm/default_templates/template.scala.scaffold +6 -0
  1632. velm/default_templates/template.security.scaffold +26 -0
  1633. velm/default_templates/template.settings.json.scaffold +95 -0
  1634. velm/default_templates/template.sh.scaffold +25 -0
  1635. velm/default_templates/template.swift.scaffold +17 -0
  1636. velm/default_templates/template.ts.scaffold +23 -0
  1637. velm/default_templates/template.tsx.scaffold +20 -0
  1638. velm/default_templates/template.zig.scaffold +26 -0
  1639. velm/forge/__init__.py +4 -0
  1640. velm/forge/adapters/base.py +21 -0
  1641. velm/forge/adapters/huggingface.py +147 -0
  1642. velm/forge/conductor.py +60 -0
  1643. velm/forge/corpus_harvester.py +57 -0
  1644. velm/forge/instruction_forger.py +75 -0
  1645. velm/genesis/__init__.py +0 -0
  1646. velm/genesis/genesis_engine/__init__.py +12 -0
  1647. velm/genesis/genesis_engine/apotheosis.py +155 -0
  1648. velm/genesis/genesis_engine/communion.py +333 -0
  1649. velm/genesis/genesis_engine/engine.py +163 -0
  1650. velm/genesis/genesis_engine/materialization.py +236 -0
  1651. velm/genesis/genesis_engine/perception.py +67 -0
  1652. velm/genesis/genesis_engine/weaving.py +227 -0
  1653. velm/genesis/genesis_grimoires.py +142 -0
  1654. velm/genesis/genesis_orchestrator/__init__.py +13 -0
  1655. velm/genesis/genesis_orchestrator/genesis_pleas.py +257 -0
  1656. velm/genesis/genesis_orchestrator/jurisprudence.py +59 -0
  1657. velm/genesis/genesis_orchestrator/oracle.py +91 -0
  1658. velm/genesis/genesis_orchestrator/orchestrator.py +350 -0
  1659. velm/genesis/genesis_orchestrator/pleas.py +146 -0
  1660. velm/genesis/genesis_orchestrator/prophecy.py +177 -0
  1661. velm/genesis/genesis_orchestrator/review.py +167 -0
  1662. velm/genesis/genesis_profiles.py +204 -0
  1663. velm/gnosis/README.md +1 -0
  1664. velm/gnosis/__init__.py +20 -0
  1665. velm/gnosis/canon.py +569 -0
  1666. velm/gnosis/redemption.py +6210 -0
  1667. velm/gnosis/wisdom.py +25 -0
  1668. velm/gnostic_instrumentarium.py +161 -0
  1669. velm/grammar.py +160 -0
  1670. velm/help_registry.py +170 -0
  1671. velm/herald.py +137 -0
  1672. velm/inquisitor/TODO.md +113 -0
  1673. velm/inquisitor/__init__.py +13 -0
  1674. velm/inquisitor/config.py +161 -0
  1675. velm/inquisitor/config_shim.py +7 -0
  1676. velm/inquisitor/core.py +247 -0
  1677. velm/inquisitor/python_inquisitor.py +217 -0
  1678. velm/inquisitor/queries/react_queries.py +68 -0
  1679. velm/inquisitor/sanctum/__Init__.py +0 -0
  1680. velm/inquisitor/sanctum/diagnostics/__init__.py +9 -0
  1681. velm/inquisitor/sanctum/diagnostics/cpp_symbolic_cortex.py +96 -0
  1682. velm/inquisitor/sanctum/diagnostics/go.py +29 -0
  1683. velm/inquisitor/sanctum/diagnostics/go_symbolic_cortex.py +92 -0
  1684. velm/inquisitor/sanctum/diagnostics/java_symbolic_cortex.py +80 -0
  1685. velm/inquisitor/sanctum/diagnostics/javascript.py +45 -0
  1686. velm/inquisitor/sanctum/diagnostics/javascript_symbolic_cortex.py +83 -0
  1687. velm/inquisitor/sanctum/diagnostics/python.py +47 -0
  1688. velm/inquisitor/sanctum/diagnostics/python_symbolic_cortex.py +317 -0
  1689. velm/inquisitor/sanctum/diagnostics/react.py +150 -0
  1690. velm/inquisitor/sanctum/diagnostics/ruby.py +36 -0
  1691. velm/inquisitor/sanctum/diagnostics/ruby_symbolic_cortex.py +84 -0
  1692. velm/inquisitor/sanctum/diagnostics/rust.py +34 -0
  1693. velm/inquisitor/sanctum/diagnostics/rust_symbolic_cortex.py +117 -0
  1694. velm/inquisitor/sanctum/diagnostics/typescript_symbolic_cortex.py +80 -0
  1695. velm/inquisitor/sanctum/engine.py +298 -0
  1696. velm/interfaces/__init__.py +61 -0
  1697. velm/interfaces/base.py +241 -0
  1698. velm/interfaces/requests.py +4854 -0
  1699. velm/jurisprudence_core/__init__.py +0 -0
  1700. velm/jurisprudence_core/adjudicator_of_souls.py +136 -0
  1701. velm/jurisprudence_core/architectural_grimoire.py +448 -0
  1702. velm/jurisprudence_core/foreign_adjudicators.py +25 -0
  1703. velm/jurisprudence_core/genesis_jurisprudence.py +159 -0
  1704. velm/jurisprudence_core/gnostic_type_system.py +361 -0
  1705. velm/jurisprudence_core/heresy_chronicles/__init__.py +5 -0
  1706. velm/jurisprudence_core/heresy_chronicles/heresy_chronicler.py +205 -0
  1707. velm/jurisprudence_core/heresy_chronicles/living_oracle.py +95 -0
  1708. velm/jurisprudence_core/heresy_codex/__init__.py +45 -0
  1709. velm/jurisprudence_core/heresy_codex/architectural.py +109 -0
  1710. velm/jurisprudence_core/heresy_codex/data.py +39 -0
  1711. velm/jurisprudence_core/heresy_codex/hygiene.py +89 -0
  1712. velm/jurisprudence_core/heresy_codex/infra.py +125 -0
  1713. velm/jurisprudence_core/heresy_codex/lexical.py +120 -0
  1714. velm/jurisprudence_core/heresy_codex/meta.py +60 -0
  1715. velm/jurisprudence_core/heresy_codex/perf.py +59 -0
  1716. velm/jurisprudence_core/heresy_codex/security.py +81 -0
  1717. velm/jurisprudence_core/heresy_codex/supply_chain.py +99 -0
  1718. velm/jurisprudence_core/jurisprudence.py +117 -0
  1719. velm/jurisprudence_core/scaffold_grammar_codex.py +131 -0
  1720. velm/jurisprudence_core/schema_adjudicator.py +225 -0
  1721. velm/jurisprudence_core/symphony_grammar_codex.py +182 -0
  1722. velm/jurisprudence_core/symphony_heresy_codex/__init__.py +34 -0
  1723. velm/jurisprudence_core/symphony_heresy_codex/kinetic.py +124 -0
  1724. velm/jurisprudence_core/symphony_heresy_codex/lexical.py +59 -0
  1725. velm/jurisprudence_core/symphony_heresy_codex/metaphysical.py +153 -0
  1726. velm/jurisprudence_core/symphony_heresy_codex/philosophy.py +186 -0
  1727. velm/jurisprudence_core/symphony_heresy_codex/polyglot.py +99 -0
  1728. velm/language_server_handler.py +121 -0
  1729. velm/logger.py +958 -0
  1730. velm/main.py +328 -0
  1731. velm/parser_core/__init__.py +1 -0
  1732. velm/parser_core/block_consumer.py +135 -0
  1733. velm/parser_core/hierophant.py +52 -0
  1734. velm/parser_core/lexer_core/__init__.py +15 -0
  1735. velm/parser_core/lexer_core/contracts.py +142 -0
  1736. velm/parser_core/lexer_core/deconstructor.py +439 -0
  1737. velm/parser_core/lexer_core/inquisitor.py +280 -0
  1738. velm/parser_core/lexer_core/lexer.py +75 -0
  1739. velm/parser_core/lfg_builder/__init__.py +15 -0
  1740. velm/parser_core/lfg_builder/builders/blueprint.py +94 -0
  1741. velm/parser_core/lfg_builder/builders/codebase_python.py +100 -0
  1742. velm/parser_core/lfg_builder/contracts.py +46 -0
  1743. velm/parser_core/lfg_builder/facade.py +43 -0
  1744. velm/parser_core/lfg_builder/renderers/mermaid.py +50 -0
  1745. velm/parser_core/logic_weaver/__init__.py +16 -0
  1746. velm/parser_core/logic_weaver/contracts.py +45 -0
  1747. velm/parser_core/logic_weaver/engine.py +113 -0
  1748. velm/parser_core/logic_weaver/state.py +59 -0
  1749. velm/parser_core/logic_weaver/traversal.py +282 -0
  1750. velm/parser_core/manifest_parser.py +231 -0
  1751. velm/parser_core/parser/__init__.py +15 -0
  1752. velm/parser_core/parser/ast_weaver/__init__.py +11 -0
  1753. velm/parser_core/parser/ast_weaver/contracts.py +19 -0
  1754. velm/parser_core/parser/ast_weaver/node_factory.py +33 -0
  1755. velm/parser_core/parser/ast_weaver/stack_manager.py +127 -0
  1756. velm/parser_core/parser/ast_weaver/weaver.py +208 -0
  1757. velm/parser_core/parser/engine.py +421 -0
  1758. velm/parser_core/parser/gateway.py +59 -0
  1759. velm/parser_core/parser/parser_scribes/__init__.py +65 -0
  1760. velm/parser_core/parser/parser_scribes/base_scribe.py +44 -0
  1761. velm/parser_core/parser/parser_scribes/scaffold_scribes/__init__.py +10 -0
  1762. velm/parser_core/parser/parser_scribes/scaffold_scribes/comment_scribe.py +150 -0
  1763. velm/parser_core/parser/parser_scribes/scaffold_scribes/contract_scribe.py +163 -0
  1764. velm/parser_core/parser/parser_scribes/scaffold_scribes/directive_scribe.py +325 -0
  1765. velm/parser_core/parser/parser_scribes/scaffold_scribes/jinja_scribe.py +40 -0
  1766. velm/parser_core/parser/parser_scribes/scaffold_scribes/makefile_scribe.py +77 -0
  1767. velm/parser_core/parser/parser_scribes/scaffold_scribes/on_undo_scribe.py +24 -0
  1768. velm/parser_core/parser/parser_scribes/scaffold_scribes/post_run_scribe.py +195 -0
  1769. velm/parser_core/parser/parser_scribes/scaffold_scribes/scaffold_base_scribe.py +16 -0
  1770. velm/parser_core/parser/parser_scribes/scaffold_scribes/structural_scribe.py +346 -0
  1771. velm/parser_core/parser/parser_scribes/scaffold_scribes/variable_scribe.py +204 -0
  1772. velm/parser_core/parser/parser_scribes/symphony_scribes/__init__.py +8 -0
  1773. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_atomic_scribe.py +430 -0
  1774. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_base_scribe.py +51 -0
  1775. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_block_scribe.py +78 -0
  1776. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_communion_scribe.py +212 -0
  1777. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_directive_scribe.py +657 -0
  1778. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_logic_scribe.py +152 -0
  1779. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_parallel_scribe.py +156 -0
  1780. velm/parser_core/parser/parser_scribes/symphony_scribes/symphony_polyglot_scribe.py +293 -0
  1781. velm/prophecy/__Init__.py +25 -0
  1782. velm/prophecy/grimoires.py +137 -0
  1783. velm/prophecy/oracle.py +167 -0
  1784. velm/rendering/POSSIBILITIES.txt +73 -0
  1785. velm/rendering/__init__.py +98 -0
  1786. velm/rendering/base_renderer.py +162 -0
  1787. velm/rendering/json_renderer.py +175 -0
  1788. velm/rendering/lfg_scribe.py +101 -0
  1789. velm/rendering/studio.log +12 -0
  1790. velm/rendering/svg_renderer.py +866 -0
  1791. velm/rendering/text_renderer/__init__.py +11 -0
  1792. velm/rendering/text_renderer/canonical_scribe.py +29 -0
  1793. velm/rendering/text_renderer/config.py +19 -0
  1794. velm/rendering/text_renderer/content_previewer.py +49 -0
  1795. velm/rendering/text_renderer/diagnostic_scribe.py +55 -0
  1796. velm/rendering/text_renderer/facade.py +60 -0
  1797. velm/rendering/text_renderer/luminous_scribe.py +92 -0
  1798. velm/rendering/text_renderer/metadata_herald.py +87 -0
  1799. velm/rendering/text_renderer/telemetry.py +15 -0
  1800. velm/rendering/text_renderer/tree_weaver.py +128 -0
  1801. velm/rendering/theme.py +88 -0
  1802. velm/rendering/tree_renderer.py +34 -0
  1803. velm/runtime_manager/__Init__.py +3 -0
  1804. velm/runtime_manager/codex.py +218 -0
  1805. velm/runtime_manager/manager.py +611 -0
  1806. velm/semantic_injection/__init__.py +40 -0
  1807. velm/semantic_injection/contract.py +70 -0
  1808. velm/semantic_injection/directives/__init__.py +15 -0
  1809. velm/semantic_injection/directives/ai_domain.py +312 -0
  1810. velm/semantic_injection/directives/api_domain.py +114 -0
  1811. velm/semantic_injection/directives/auth_domain.py +171 -0
  1812. velm/semantic_injection/directives/cloud_domain.py +228 -0
  1813. velm/semantic_injection/directives/crypto_domain.py +109 -0
  1814. velm/semantic_injection/directives/data_domain.py +94 -0
  1815. velm/semantic_injection/directives/diagram_domain.py +86 -0
  1816. velm/semantic_injection/directives/editor_domain.py +126 -0
  1817. velm/semantic_injection/directives/fetch_domain.py +81 -0
  1818. velm/semantic_injection/directives/flow_domain.py +163 -0
  1819. velm/semantic_injection/directives/git_domain.py +223 -0
  1820. velm/semantic_injection/directives/guide_domain.py +71 -0
  1821. velm/semantic_injection/directives/guide_knowledge/__init__.py +19 -0
  1822. velm/semantic_injection/directives/guide_knowledge/accessibility.py +7 -0
  1823. velm/semantic_injection/directives/guide_knowledge/algorithms.py +11 -0
  1824. velm/semantic_injection/directives/guide_knowledge/architecture_patterns.py +11 -0
  1825. velm/semantic_injection/directives/guide_knowledge/auth_security.py +10 -0
  1826. velm/semantic_injection/directives/guide_knowledge/aws_terms.py +9 -0
  1827. velm/semantic_injection/directives/guide_knowledge/clean_code.py +7 -0
  1828. velm/semantic_injection/directives/guide_knowledge/cloud_native.py +6 -0
  1829. velm/semantic_injection/directives/guide_knowledge/data_structures.py +12 -0
  1830. velm/semantic_injection/directives/guide_knowledge/database_concepts.py +8 -0
  1831. velm/semantic_injection/directives/guide_knowledge/design_patterns.py +13 -0
  1832. velm/semantic_injection/directives/guide_knowledge/devops.py +11 -0
  1833. velm/semantic_injection/directives/guide_knowledge/git_flow.py +8 -0
  1834. velm/semantic_injection/directives/guide_knowledge/graphql.py +8 -0
  1835. velm/semantic_injection/directives/guide_knowledge/javascript_modern.py +8 -0
  1836. velm/semantic_injection/directives/guide_knowledge/python_idioms.py +8 -0
  1837. velm/semantic_injection/directives/guide_knowledge/react_patterns.py +8 -0
  1838. velm/semantic_injection/directives/guide_knowledge/realtime.py +6 -0
  1839. velm/semantic_injection/directives/guide_knowledge/refactoring.py +7 -0
  1840. velm/semantic_injection/directives/guide_knowledge/rest_api.py +10 -0
  1841. velm/semantic_injection/directives/guide_knowledge/solid.py +8 -0
  1842. velm/semantic_injection/directives/guide_knowledge/testing.py +9 -0
  1843. velm/semantic_injection/directives/guide_knowledge/ux_laws.py +7 -0
  1844. velm/semantic_injection/directives/infra_knowledge/__init__.py +3 -0
  1845. velm/semantic_injection/directives/infra_knowledge/registry.py +211 -0
  1846. velm/semantic_injection/directives/integration_domain.py +131 -0
  1847. velm/semantic_injection/directives/kinesis_domain.py +137 -0
  1848. velm/semantic_injection/directives/legal_domain.py +181 -0
  1849. velm/semantic_injection/directives/mock_domain.py +115 -0
  1850. velm/semantic_injection/directives/neuron_domain.py +168 -0
  1851. velm/semantic_injection/directives/neuron_knowledge/__init__.py +11 -0
  1852. velm/semantic_injection/directives/neuron_knowledge/agents.py +423 -0
  1853. velm/semantic_injection/directives/neuron_knowledge/edge.py +263 -0
  1854. velm/semantic_injection/directives/neuron_knowledge/evaluation.py +262 -0
  1855. velm/semantic_injection/directives/neuron_knowledge/memory.py +324 -0
  1856. velm/semantic_injection/directives/neuron_knowledge/optimization.py +284 -0
  1857. velm/semantic_injection/directives/neuron_knowledge/orchestration.py +243 -0
  1858. velm/semantic_injection/directives/neuron_knowledge/providers.py +279 -0
  1859. velm/semantic_injection/directives/ops_domain.py +94 -0
  1860. velm/semantic_injection/directives/policy_domain.py +132 -0
  1861. velm/semantic_injection/directives/shield_domain.py +127 -0
  1862. velm/semantic_injection/directives/stack_domain.py +163 -0
  1863. velm/semantic_injection/directives/struct_domain.py +136 -0
  1864. velm/semantic_injection/directives/test_domain.py +115 -0
  1865. velm/semantic_injection/directives/ui_domain.py +333 -0
  1866. velm/semantic_injection/directives/ui_knowledge/__init__.py +49 -0
  1867. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/admin_dashboard.scaffold +379 -0
  1868. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/App.tsx +33 -0
  1869. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/auth/AuthGuard.tsx +4 -0
  1870. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/dashboard/RecentSales.tsx +21 -0
  1871. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/dashboard/StatsCards.tsx +28 -0
  1872. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/layout/Header.tsx +30 -0
  1873. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/layout/Sidebar.tsx +49 -0
  1874. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/layout/UserNav.tsx +43 -0
  1875. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/avatar.tsx +47 -0
  1876. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/badge.tsx +32 -0
  1877. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/button.tsx +52 -0
  1878. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/card.tsx +66 -0
  1879. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/dropdown-menu.tsx +90 -0
  1880. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/input.tsx +24 -0
  1881. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/skeleton.tsx +15 -0
  1882. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/components/ui/table.tsx +116 -0
  1883. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/hooks/useAuth.ts +35 -0
  1884. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/layouts/DashboardLayout.tsx +25 -0
  1885. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/lib/utils.ts +6 -0
  1886. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/pages/DashboardPage.tsx +40 -0
  1887. velm/semantic_injection/directives/ui_knowledge/admin_dashboard/src/pages/UsersPage.tsx +39 -0
  1888. velm/semantic_injection/directives/ui_knowledge/admin_dashboard.py +123 -0
  1889. velm/semantic_injection/directives/ui_knowledge/ascend_ui_knowledge.scaffold +421 -0
  1890. velm/semantic_injection/directives/ui_knowledge/auth_form.py +90 -0
  1891. velm/semantic_injection/directives/ui_knowledge/command_palette.py +59 -0
  1892. velm/semantic_injection/directives/ui_knowledge/data_table.py +121 -0
  1893. velm/semantic_injection/directives/ui_knowledge/gnostic_html_kit.scaffold +704 -0
  1894. velm/semantic_injection/directives/ui_knowledge/go_tui.py +51 -0
  1895. velm/semantic_injection/directives/ui_knowledge/go_ui/__init__.py +0 -0
  1896. velm/semantic_injection/directives/ui_knowledge/go_ui/go.mod +9 -0
  1897. velm/semantic_injection/directives/ui_knowledge/go_ui/main.go +145 -0
  1898. velm/semantic_injection/directives/ui_knowledge/go_ui/tui_forge.py +58 -0
  1899. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/atoms/badge.go +34 -0
  1900. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/atoms/button.go +34 -0
  1901. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/atoms/separator.go +19 -0
  1902. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/atoms/spinner.go +15 -0
  1903. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/molecules/card.go +24 -0
  1904. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/molecules/input_field.go +22 -0
  1905. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/molecules/progress_bar.go +24 -0
  1906. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/molecules/status_item.go +17 -0
  1907. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/organisms/datatable.go +45 -0
  1908. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/organisms/help_footer.go +38 -0
  1909. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/organisms/log_viewport.go +28 -0
  1910. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/organisms/tabs.go +73 -0
  1911. velm/semantic_injection/directives/ui_knowledge/go_ui/ui/theme/theme.go +37 -0
  1912. velm/semantic_injection/directives/ui_knowledge/go_ui.scaffold +635 -0
  1913. velm/semantic_injection/directives/ui_knowledge/html_ui/__init__.py +0 -0
  1914. velm/semantic_injection/directives/ui_knowledge/html_ui/html_forge.py +104 -0
  1915. velm/semantic_injection/directives/ui_knowledge/html_ui/index.html +44 -0
  1916. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/badge.html +13 -0
  1917. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/btn_ghost.html +5 -0
  1918. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/btn_gradient.html +8 -0
  1919. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/btn_icon.html +10 -0
  1920. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/btn_outline.html +8 -0
  1921. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/btn_primary.html +15 -0
  1922. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/checkbox_custom.html +20 -0
  1923. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/input_basic.html +13 -0
  1924. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/input_floating.html +23 -0
  1925. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/loader.html +11 -0
  1926. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/radio_custom.html +19 -0
  1927. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/atoms/toggle_switch.html +20 -0
  1928. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/accordion.html +25 -0
  1929. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/alert_card.html +18 -0
  1930. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/card_basic.html +19 -0
  1931. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/card_glass.html +16 -0
  1932. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/modal.html +29 -0
  1933. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/search_bar.html +20 -0
  1934. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/tooltip_top.html +20 -0
  1935. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/molecules/user_profile.html +20 -0
  1936. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/data_table.html +25 -0
  1937. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/footer.html +28 -0
  1938. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/hero_section.html +21 -0
  1939. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/navbar.html +21 -0
  1940. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/pricing_table.html +37 -0
  1941. velm/semantic_injection/directives/ui_knowledge/html_ui/src/components/organisms/sidebar.html +30 -0
  1942. velm/semantic_injection/directives/ui_knowledge/html_ui/src/css/variables.css +44 -0
  1943. velm/semantic_injection/directives/ui_knowledge/layouts.py +242 -0
  1944. velm/semantic_injection/directives/ui_knowledge/multi_step_wizard.py +95 -0
  1945. velm/semantic_injection/directives/ui_knowledge/python_ui/__init__.py +17 -0
  1946. velm/semantic_injection/directives/ui_knowledge/python_ui/dash_forge.py +55 -0
  1947. velm/semantic_injection/directives/ui_knowledge/python_ui/flet_forge.py +39 -0
  1948. velm/semantic_injection/directives/ui_knowledge/python_ui/gradio_forge.py +79 -0
  1949. velm/semantic_injection/directives/ui_knowledge/python_ui/nicegui_forge.py +39 -0
  1950. velm/semantic_injection/directives/ui_knowledge/python_ui/reflex_forge.py +51 -0
  1951. velm/semantic_injection/directives/ui_knowledge/python_ui/streamlit_forge.py +116 -0
  1952. velm/semantic_injection/directives/ui_knowledge/python_ui/textual_forge.py +48 -0
  1953. velm/semantic_injection/directives/ui_knowledge/react/__init__.py +28 -0
  1954. velm/semantic_injection/directives/ui_knowledge/react/atoms.py +128 -0
  1955. velm/semantic_injection/directives/ui_knowledge/react/charts.py +134 -0
  1956. velm/semantic_injection/directives/ui_knowledge/react/data_display.py +139 -0
  1957. velm/semantic_injection/directives/ui_knowledge/react/disclosure.py +92 -0
  1958. velm/semantic_injection/directives/ui_knowledge/react/feedback.py +92 -0
  1959. velm/semantic_injection/directives/ui_knowledge/react/forms_advanced.py +94 -0
  1960. velm/semantic_injection/directives/ui_knowledge/react/menus.py +223 -0
  1961. velm/semantic_injection/directives/ui_knowledge/react/molecules.py +146 -0
  1962. velm/semantic_injection/directives/ui_knowledge/react/navigation_complex.py +73 -0
  1963. velm/semantic_injection/directives/ui_knowledge/react/overlays.py +107 -0
  1964. velm/semantic_injection/directives/ui_knowledge/react/structures.py +423 -0
  1965. velm/semantic_injection/directives/ui_knowledge/react/visuals.py +102 -0
  1966. velm/semantic_injection/directives/ui_knowledge/registry.py +35 -0
  1967. velm/semantic_injection/directives/ui_knowledge/user_loader.py +66 -0
  1968. velm/semantic_injection/injector.py +216 -0
  1969. velm/semantic_injection/loader.py +300 -0
  1970. velm/settings/manager.py +277 -0
  1971. velm/settings/schema.py +236 -0
  1972. velm/settings/tui.py +615 -0
  1973. velm/setup_entry.py +40 -0
  1974. velm/shell/__init__.py +3 -0
  1975. velm/shell/app.py +408 -0
  1976. velm/shell/contracts.py +31 -0
  1977. velm/shell/interpreter.py +123 -0
  1978. velm/shell/shell.css +172 -0
  1979. velm/shell/widgets/dossier.py +114 -0
  1980. velm/shell/widgets/history_screen.py +65 -0
  1981. velm/shell/widgets/orrery.py +111 -0
  1982. velm/shell/widgets/prompter.py +208 -0
  1983. velm/shell/widgets/suggestion_menu.py +32 -0
  1984. velm/studio/IMPORTANT.txt +0 -0
  1985. velm/studio/__init__.py +11 -0
  1986. velm/studio/app.css +213 -0
  1987. velm/studio/app.py +426 -0
  1988. velm/studio/contracts.py +204 -0
  1989. velm/studio/emissary.py +81 -0
  1990. velm/studio/gnostic_events.py +88 -0
  1991. velm/studio/logger.py +84 -0
  1992. velm/studio/main.py +113 -0
  1993. velm/studio/messages.py +62 -0
  1994. velm/studio/pads/__init__.py +5 -0
  1995. velm/studio/pads/distill_pad/__init__.py +3 -0
  1996. velm/studio/pads/distill_pad/distill_pad.css +271 -0
  1997. velm/studio/pads/distill_pad/distill_pad_app.py +294 -0
  1998. velm/studio/pads/distill_pad/state.py +73 -0
  1999. velm/studio/pads/distill_pad/widgets/__init__.py +6 -0
  2000. velm/studio/pads/distill_pad/widgets/config_pane.py +112 -0
  2001. velm/studio/pads/distill_pad/widgets/file_picker.py +158 -0
  2002. velm/studio/pads/distill_pad/widgets/file_selector.py +241 -0
  2003. velm/studio/pads/distill_pad/widgets/preview_pane.py +223 -0
  2004. velm/studio/pads/distill_pad.scaffold +10 -0
  2005. velm/studio/pads/genesis_pad.py +487 -0
  2006. velm/studio/pads/pad.css +112 -0
  2007. velm/studio/pads/pad_launcher.py +200 -0
  2008. velm/studio/pads/refactor.css +222 -0
  2009. velm/studio/pads/refactor_pad.py +888 -0
  2010. velm/studio/pads/scaffold_pad.py +529 -0
  2011. velm/studio/pads/studio.log +1 -0
  2012. velm/studio/screens/__init__.py +5 -0
  2013. velm/studio/screens/form_mode.py +302 -0
  2014. velm/studio/screens/mentors_gaze.py +54 -0
  2015. velm/studio/screens/studio.log +1 -0
  2016. velm/studio/screens/will_mode.py +22 -0
  2017. velm/studio/services/__init__.py +12 -0
  2018. velm/studio/services/command_gnosis.py +78 -0
  2019. velm/studio/services/fs_watcher.py +296 -0
  2020. velm/studio/services/scaffold_bridge.py +232 -0
  2021. velm/studio/state.py +330 -0
  2022. velm/studio/studio.log +11 -0
  2023. velm/studio/studio.scaffold +24 -0
  2024. velm/studio/widgets/__init__.py +13 -0
  2025. velm/studio/widgets/command_altar.py +307 -0
  2026. velm/studio/widgets/context_menu.py +129 -0
  2027. velm/studio/widgets/editor.py +15 -0
  2028. velm/studio/widgets/file_tree.py +322 -0
  2029. velm/studio/widgets/log_viewer.py +174 -0
  2030. velm/studio/widgets/studio.log +11 -0
  2031. velm/symphony/__init__.py +59 -0
  2032. velm/symphony/build.symphony +43 -0
  2033. velm/symphony/conductor/__init__.py +7 -0
  2034. velm/symphony/conductor/events.py +6 -0
  2035. velm/symphony/conductor/orchestrator.py +281 -0
  2036. velm/symphony/conductor_core/__init__.py +26 -0
  2037. velm/symphony/conductor_core/context/__init__.py +14 -0
  2038. velm/symphony/conductor_core/context/chronicle.py +38 -0
  2039. velm/symphony/conductor_core/context/manager.py +307 -0
  2040. velm/symphony/conductor_core/context/scope.py +50 -0
  2041. velm/symphony/conductor_core/context/vault.py +287 -0
  2042. velm/symphony/conductor_core/engine.py +179 -0
  2043. velm/symphony/conductor_core/handlers/TODO.md +3 -0
  2044. velm/symphony/conductor_core/handlers/__init__.py +112 -0
  2045. velm/symphony/conductor_core/handlers/action_handler/__init__.py +15 -0
  2046. velm/symphony/conductor_core/handlers/action_handler/contracts.py +56 -0
  2047. velm/symphony/conductor_core/handlers/action_handler/dispatcher.py +166 -0
  2048. velm/symphony/conductor_core/handlers/action_handler/facade.py +117 -0
  2049. velm/symphony/conductor_core/handlers/action_handler/specialists/interactive.py +108 -0
  2050. velm/symphony/conductor_core/handlers/action_handler/specialists/kinetic.py +176 -0
  2051. velm/symphony/conductor_core/handlers/action_handler/specialists/network.py +171 -0
  2052. velm/symphony/conductor_core/handlers/action_handler/specialists/polyglot.py +89 -0
  2053. velm/symphony/conductor_core/handlers/action_handler/specialists/service.py +96 -0
  2054. velm/symphony/conductor_core/handlers/action_handler/utils/redaction.py +24 -0
  2055. velm/symphony/conductor_core/handlers/base.py +119 -0
  2056. velm/symphony/conductor_core/handlers/logic_handler.py +92 -0
  2057. velm/symphony/conductor_core/handlers/meta_handler.py +75 -0
  2058. velm/symphony/conductor_core/handlers/parallel_handler.py +38 -0
  2059. velm/symphony/conductor_core/handlers/state_handler/__init__.py +13 -0
  2060. velm/symphony/conductor_core/handlers/state_handler/contracts.py +30 -0
  2061. velm/symphony/conductor_core/handlers/state_handler/dispatcher.py +70 -0
  2062. velm/symphony/conductor_core/handlers/state_handler/facade.py +49 -0
  2063. velm/symphony/conductor_core/handlers/state_handler/specialists/artifact.py +18 -0
  2064. velm/symphony/conductor_core/handlers/state_handler/specialists/environment.py +34 -0
  2065. velm/symphony/conductor_core/handlers/state_handler/specialists/lifecycle.py +41 -0
  2066. velm/symphony/conductor_core/handlers/state_handler/specialists/proclamation.py +22 -0
  2067. velm/symphony/conductor_core/handlers/state_handler/specialists/sanctum.py +33 -0
  2068. velm/symphony/conductor_core/handlers/state_handler/specialists/temporal.py +20 -0
  2069. velm/symphony/conductor_core/handlers/state_handler/specialists/variable.py +63 -0
  2070. velm/symphony/conductor_core/handlers/state_handler/utils/path_resolver.py +41 -0
  2071. velm/symphony/conductor_core/handlers/state_handler/utils/time_parser.py +25 -0
  2072. velm/symphony/conductor_core/handlers/state_handler/utils/type_diviner.py +55 -0
  2073. velm/symphony/conductor_core/handlers/vow_handler/__init__.py +13 -0
  2074. velm/symphony/conductor_core/handlers/vow_handler/adjudicator.py +96 -0
  2075. velm/symphony/conductor_core/handlers/vow_handler/contracts.py +24 -0
  2076. velm/symphony/conductor_core/handlers/vow_handler/facade.py +63 -0
  2077. velm/symphony/conductor_core/lifecycle/__init__.py +18 -0
  2078. velm/symphony/conductor_core/lifecycle/contracts.py +35 -0
  2079. velm/symphony/conductor_core/lifecycle/manager.py +208 -0
  2080. velm/symphony/conductor_core/lifecycle/supervisor.py +212 -0
  2081. velm/symphony/conductor_core/resilience/__init__.py +14 -0
  2082. velm/symphony/conductor_core/resilience/artifacts.py +50 -0
  2083. velm/symphony/conductor_core/resilience/contracts.py +55 -0
  2084. velm/symphony/conductor_core/resilience/diagnosis.py +121 -0
  2085. velm/symphony/conductor_core/resilience/intercession.py +225 -0
  2086. velm/symphony/conductor_core/resilience/manager.py +208 -0
  2087. velm/symphony/conductor_core/setup.py +238 -0
  2088. velm/symphony/docs_generator.symphony +45 -0
  2089. velm/symphony/execution/__init__.py +17 -0
  2090. velm/symphony/execution/interface.py +103 -0
  2091. velm/symphony/execution/kinetic_titan/__init__.py +13 -0
  2092. velm/symphony/execution/kinetic_titan/executor.py +221 -0
  2093. velm/symphony/execution/kinetic_titan/renderer.py +255 -0
  2094. velm/symphony/execution/kinetic_titan/security.py +37 -0
  2095. velm/symphony/execution/kinetic_titan/semantics.py +155 -0
  2096. velm/symphony/execution/kinetic_titan/titan/__init__.py +14 -0
  2097. velm/symphony/execution/kinetic_titan/titan/loops.py +406 -0
  2098. velm/symphony/execution/kinetic_titan/titan/orchestrator.py +187 -0
  2099. velm/symphony/execution/kinetic_titan/titan/state.py +185 -0
  2100. velm/symphony/execution/kinetic_titan/titan/visuals.py +73 -0
  2101. velm/symphony/execution/prophetic_oracle.py +113 -0
  2102. velm/symphony/inquisitor/__init__.py +16 -0
  2103. velm/symphony/inquisitor/oracle.py +172 -0
  2104. velm/symphony/inquisitor/renderer.py +145 -0
  2105. velm/symphony/inquisitor/temporal.py +133 -0
  2106. velm/symphony/polyglot/__init__.py +68 -0
  2107. velm/symphony/polyglot/adjudicators.py +77 -0
  2108. velm/symphony/polyglot/artisan.py +396 -0
  2109. velm/symphony/polyglot/grimoire.py +227 -0
  2110. velm/symphony/polyglot/wards/__init__.py +0 -0
  2111. velm/symphony/polyglot/wards/go_ward.py +20 -0
  2112. velm/symphony/polyglot/wards/java_ward.py +21 -0
  2113. velm/symphony/polyglot/wards/python_ward.py +37 -0
  2114. velm/symphony/polyglot/wards/ruby_ward.py +49 -0
  2115. velm/symphony/proclamations/__init__.py +0 -0
  2116. velm/symphony/proclamations/base.py +39 -0
  2117. velm/symphony/proclamations/file_scribe.py +47 -0
  2118. velm/symphony/proclamations/panel_scribe.py +46 -0
  2119. velm/symphony/proclamations/router.py +65 -0
  2120. velm/symphony/proclamations/slack_scribe.py +93 -0
  2121. velm/symphony/proclamations/table_scribe.py +109 -0
  2122. velm/symphony/release.symphony +31 -0
  2123. velm/symphony/renderers/__init__.py +17 -0
  2124. velm/symphony/renderers/base.py +72 -0
  2125. velm/symphony/renderers/basic_renderer/__init__.py +12 -0
  2126. velm/symphony/renderers/basic_renderer/codex.py +16 -0
  2127. velm/symphony/renderers/basic_renderer/emitter.py +59 -0
  2128. velm/symphony/renderers/basic_renderer/facade.py +244 -0
  2129. velm/symphony/renderers/basic_renderer/scribe.py +115 -0
  2130. velm/symphony/renderers/basic_renderer/styler.py +59 -0
  2131. velm/symphony/renderers/cinematic_renderer/__init__.py +12 -0
  2132. velm/symphony/renderers/cinematic_renderer/facade.py +194 -0
  2133. velm/symphony/renderers/cinematic_renderer/layout_engine.py +56 -0
  2134. velm/symphony/renderers/cinematic_renderer/state.py +78 -0
  2135. velm/symphony/renderers/cinematic_renderer/theme.py +40 -0
  2136. velm/symphony/renderers/cinematic_renderer/widgets/__init__.py +8 -0
  2137. velm/symphony/renderers/cinematic_renderer/widgets/context.py +20 -0
  2138. velm/symphony/renderers/cinematic_renderer/widgets/footer.py +15 -0
  2139. velm/symphony/renderers/cinematic_renderer/widgets/header.py +37 -0
  2140. velm/symphony/renderers/cinematic_renderer/widgets/monitor.py +23 -0
  2141. velm/symphony/renderers/cinematic_renderer/widgets/output.py +31 -0
  2142. velm/symphony/renderers/cinematic_renderer/widgets/sparkline.py +105 -0
  2143. velm/symphony/renderers/cinematic_renderer/widgets/timeline.py +49 -0
  2144. velm/symphony/renderers/github_renderer/__init__.py +13 -0
  2145. velm/symphony/renderers/github_renderer/emitter.py +92 -0
  2146. velm/symphony/renderers/github_renderer/facade.py +232 -0
  2147. velm/symphony/renderers/github_renderer/sanitizer.py +41 -0
  2148. velm/symphony/renderers/raw_renderer/__init__.py +2 -0
  2149. velm/symphony/renderers/raw_renderer/facade.py +96 -0
  2150. velm/symphony/renderers/rich_renderer/__init__.py +2 -0
  2151. velm/symphony/renderers/rich_renderer/facade.py +320 -0
  2152. velm/symphony/renderers/rich_renderer/state.py +84 -0
  2153. velm/symphony/renderers/rich_renderer/stream_scribe.py +301 -0
  2154. velm/symphony/renderers/rich_renderer/theme.py +106 -0
  2155. velm/symphony/renderers/rich_renderer/utils.py +29 -0
  2156. velm/symphony/renderers/stream_renderer/__init__.py +13 -0
  2157. velm/symphony/renderers/stream_renderer/codex.py +51 -0
  2158. velm/symphony/renderers/stream_renderer/emitter.py +116 -0
  2159. velm/symphony/renderers/stream_renderer/facade.py +218 -0
  2160. velm/symphony/swarm.py +538 -0
  2161. velm/themes/cyberpunk.css +29 -0
  2162. velm/themes/monokai.css +24 -0
  2163. velm/utils/__init__.py +69 -0
  2164. velm/utils/archetype_utils.py +154 -0
  2165. velm/utils/converters.py +135 -0
  2166. velm/utils/core_utils.py +3238 -0
  2167. velm/utils/dossier_scribe/__init__.py +13 -0
  2168. velm/utils/dossier_scribe/constellation/__init__.py +14 -0
  2169. velm/utils/dossier_scribe/constellation/arch_scribe/__init__.py +14 -0
  2170. velm/utils/dossier_scribe/constellation/arch_scribe/dna.py +290 -0
  2171. velm/utils/dossier_scribe/constellation/arch_scribe/markdown.py +139 -0
  2172. velm/utils/dossier_scribe/constellation/arch_scribe/mermaids.py +60 -0
  2173. velm/utils/dossier_scribe/constellation/arch_scribe/scribe.py +96 -0
  2174. velm/utils/dossier_scribe/constellation/assets.py +74 -0
  2175. velm/utils/dossier_scribe/constellation/crystal.py +66 -0
  2176. velm/utils/dossier_scribe/constellation/hyperlinks.py +176 -0
  2177. velm/utils/dossier_scribe/constellation/renderer.py +163 -0
  2178. velm/utils/dossier_scribe/constellation/scribe.py +108 -0
  2179. velm/utils/dossier_scribe/constellation/xray.py +69 -0
  2180. velm/utils/dossier_scribe/facade.py +270 -0
  2181. velm/utils/dossier_scribe/mentorship_scribe.py +47 -0
  2182. velm/utils/dossier_scribe/prophecy_panel.py +29 -0
  2183. velm/utils/dossier_scribe/security_scribe.py +27 -0
  2184. velm/utils/dossier_scribe/telemetry_grid.py +167 -0
  2185. velm/utils/ephemeral_server.py +53 -0
  2186. velm/utils/gnosis_discovery.py +354 -0
  2187. velm/utils/invocation.py +252 -0
  2188. velm/utils/resolve_gnostic_content.py +140 -0
  2189. velm/utils/workspace_utils.py +35 -0
  2190. velm-0.1.2.dist-info/METADATA +283 -0
  2191. velm-0.1.2.dist-info/RECORD +2195 -0
  2192. velm-0.1.2.dist-info/WHEEL +5 -0
  2193. velm-0.1.2.dist-info/entry_points.txt +2 -0
  2194. velm-0.1.2.dist-info/licenses/LICENSE +52 -0
  2195. velm-0.1.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3238 @@
1
+ import difflib
2
+ import io
3
+ import ast
4
+ import hashlib
5
+ import io
6
+ import json
7
+ import os
8
+ import platform
9
+ import re
10
+ import shlex
11
+ import shutil
12
+ import subprocess
13
+ import tempfile
14
+ import threading
15
+ import time
16
+ import webbrowser
17
+ from collections import defaultdict
18
+ from contextlib import contextmanager
19
+ from functools import lru_cache
20
+ from pathlib import Path
21
+ from queue import Queue
22
+ from typing import Dict, Any, Optional, Union, List, Tuple, Iterator, TYPE_CHECKING, Set
23
+
24
+ import pathspec
25
+ import requests
26
+
27
+ from ..contracts.data_contracts import GnosticVessel
28
+ from ..contracts.symphony_contracts import Edict
29
+ from ..contracts.data_contracts import InscriptionAction, GnosticVessel
30
+ from ..contracts.data_contracts import GnosticLineType
31
+ from ..contracts.symphony_contracts import EdictType
32
+ if TYPE_CHECKING:
33
+
34
+ from ..contracts.communion_contracts import GnosticPlea
35
+ from ..contracts.data_contracts import PlanEdict
36
+ from ..core.alchemist import DivineAlchemist
37
+
38
+ RICH_AVAILABLE = False
39
+ try:
40
+ from rich.panel import Panel
41
+ from rich.prompt import Prompt
42
+ from rich.console import Console, Group
43
+ from dataclasses import dataclass, asdict
44
+ from packaging.version import parse as parse_version
45
+ from rich.text import Text
46
+ except ImportError as e:
47
+ print(f"Import error! Reason: {e}")
48
+
49
+ from ..constants import PROPHETIC_GRIMOIRE, PROFANE_PATH_CHARS, PROFANE_UNSEEN_CHARS
50
+ # --- THE SUMMONS IS COMPLETE ---
51
+ from ..contracts.data_contracts import GnosticDossier, GnosticWriteResult
52
+ from ..contracts.communion_contracts import GnosticPlea, GnosticPleaType
53
+
54
+
55
+ from ..logger import Scribe, get_console
56
+ from ..help_registry import register_gnosis
57
+ from .. import __version__
58
+ JINJA_AVAILABLE = False
59
+ try:
60
+ from jinja2 import Environment, meta, TemplateSyntaxError
61
+ JINJA_AVAILABLE = True
62
+ except ImportError as e:
63
+ print(f"Import error! reason: {e}")
64
+ Logger = Scribe("Utils")
65
+
66
+ # --- THE GRIMOIRE OF TEXTUAL EXTENSIONS (V-Ω-EXPANDED) ---
67
+ # A definitive list of extensions that are guaranteed to be text.
68
+ KNOWN_TEXT_EXTENSIONS = {
69
+ # Config & Data
70
+ '.json', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.conf', '.xml', '.env',
71
+ '.gitignore', '.dockerignore', '.editorconfig', '.scaffold', '.symphony', '.arch',
72
+ # Documentation
73
+ '.md', '.txt', '.rst', '.adoc', '.csv', '.log',
74
+ # Web
75
+ '.html', '.htm', '.css', '.scss', '.sass', '.less', '.js', '.jsx', '.ts', '.tsx', '.svg', '.vue', '.svelte',
76
+ # Code
77
+ '.py', '.pyw', '.go', '.rs', '.java', '.c', '.cpp', '.h', '.hpp', '.cs', '.rb', '.php',
78
+ '.sh', '.bash', '.zsh', '.bat', '.ps1', '.cmd', '.lua', '.pl', '.pm', '.r', '.dart',
79
+ '.swift', '.kt', '.kts', '.scala', '.clj', '.cljs', '.fs', '.fsx', '.ex', '.exs',
80
+ # Infra
81
+ '.dockerfile', 'dockerfile', 'makefile', 'jenkinsfile', 'vagrantfile'
82
+ }
83
+
84
+
85
+ def _determine_sanctum(path: Path, project_root: Path) -> str:
86
+ """
87
+ Performs a Gaze to determine which sub-project (sanctum) a file belongs to.
88
+ This is the heart of the federated monorepo awareness.
89
+ """
90
+ try:
91
+ # A file's sanctum is its first parent directory inside the project root.
92
+ # e.g., apps/web/components/Button.tsx -> sanctum is 'apps/web'
93
+ relative_path = path.relative_to(project_root)
94
+ if len(relative_path.parts) > 1:
95
+ # Heuristic: combine first two parts for sanctums like 'apps/web' or 'packages/ui'
96
+ if relative_path.parts[0] in ('apps', 'packages', 'libs'):
97
+ if len(relative_path.parts) > 2:
98
+ return f"{relative_path.parts[0]}/{relative_path.parts[1]}"
99
+ return relative_path.parts[0]
100
+ return "root" # Belongs to the root of the project
101
+ except (ValueError, IndexError):
102
+ return "external" # Path is outside the project root, a rare paradox
103
+
104
+ # =================================================================================
105
+ # == SANCTUM OF UNBREAKABLE GNOSIS (UTILS) ==
106
+ # =================================================================================
107
+ #
108
+ # This is not a miscellaneous file. This is the sacred sanctum where the core,
109
+ # unchanging Gnostic truths and helper artisans of the scaffold engine reside.
110
+ #
111
+ # Every function herein is forged with three divine virtues:
112
+ # 1. Purity: It performs one task and performs it flawlessly.
113
+ # 2. Independence: It has zero dependencies on other scaffold modules to
114
+ # prevent catastrophic circular import paradoxes.
115
+ # 3. Timelessness: It represents a fundamental truth of the scaffold
116
+ # ecosystem that is unlikely to change.
117
+ #
118
+ # =================================================================================
119
+
120
+ def perform_alchemical_resolution(
121
+ dossier: 'GnosticDossier',
122
+ initial_gnosis: Dict[str, Any],
123
+ raw_definitions: Dict[str, str],
124
+ overrides: Optional[Dict[str, Any]] = None
125
+ ) -> Dict[str, Any]:
126
+ """
127
+ =================================================================================
128
+ == THE GOD-ENGINE OF GNOSTIC ALCHEMY (V-Ω-ETERNAL-ULTIMA-FORENSIC-ASCENDED) ==
129
+ =================================================================================
130
+ @gnosis:LIF 10,000,000 (ABSOLUTE GNOSTIC AUTHORITY & UNBREAKABLE RESILIENCE)
131
+ @gnosis:summary The final, eternal, and ultra-definitive form of the variable resolution engine.
132
+
133
+ @gnosis:description
134
+ This is the divine, sentient God-Engine of Gnostic Alchemy. It conducts the Rite
135
+ of Iterative Transmutation with a pantheon of 12 legendary faculties, forging a
136
+ perfectly resolved, Gnostically pure context from a chaotic web of dependencies.
137
+
138
+ ### THE PANTHEON OF 12 ASCENDED FACULTIES:
139
+
140
+ 1. **The Gnostic Differentiator:** It is now a pure artisan of Gnosis. It no
141
+ longer presumes to know the raw scripture of the blueprint. It receives the
142
+ pure, pre-forged `GnosticDossier` and `raw_definitions`, separating its will
143
+ from the perception of form.
144
+
145
+ 2. **The Gaze of the Native Soul (Type Inference):** It possesses a divine Gaze.
146
+ It perceives static literals (`true`, `123`, `["a"]`) and transmutes them into
147
+ their pure Pythonic souls (`bool`, `int`, `list`), annihilating the Heresy of
148
+ the Profane String.
149
+
150
+ 3. **The Law of Scriptural Supremacy:** It enforces the sacred, 4-tier hierarchy
151
+ of Gnostic truth: Overrides > Scripture > Initial Gnosis > Defaults, ensuring
152
+ the Architect's will is always absolute.
153
+
154
+ 4. **The Alchemical Inquisitor:** Its `transmute` rite is shielded by an unbreakable
155
+ ward. If a Jinja expression fails, it no longer shatters the symphony. It
156
+ forges a luminous `Heresy` vessel and inscribes it upon the `dossier`.
157
+
158
+ 5. **The Ward of the Gnostic Ouroboros:** Its Gaze for circular dependencies is
159
+ now that of a Forensic Inquisitor. It proclaims a luminous `Heresy` detailing
160
+ exactly which variables are stalled and which souls they await, transforming
161
+ a cryptic failure into a divine lesson.
162
+
163
+ 6. **The Gnostic Chronocacher (Inherited):** It wields the `DivineAlchemist`, whose
164
+ own Gaze is cached, making repeated transmutations of the same scripture
165
+ instantaneous.
166
+
167
+ 7. **The Polyglot Mind:** It understands the Gnostic Graph (`dossier.dependencies`)
168
+ and can resolve a complex, tangled web of derivations in the optimal order.
169
+
170
+ 8. **The Luminous Voice:** Its every thought—every transmutation, every judgment—is
171
+ proclaimed to the `AlchemicalEngine` Scribe for hyper-diagnostic insight.
172
+
173
+ 9. **The Unbreakable Contract:** Its signature is pure, its dependencies explicit.
174
+ It returns a single, pure vessel of Gnosis: the final, resolved dictionary.
175
+
176
+ 10. **The Supreme Edict's Ward:** It ensures that `overrides` are eternally supreme,
177
+ immune to being overwritten by any other Gnostic source.
178
+
179
+ 11. **The Recursive Gaze (Future Prophecy):** Its architecture, which separates the
180
+ Gaze for dependencies from the act of transmutation, is perfectly forged for a
181
+ future ascension to a full topological sort for even greater performance.
182
+
183
+ 12. **The Sovereign Soul:** It is a pure, self-contained artisan, its Gnosis now
184
+ enshrined in `core_utils`, available to all in the cosmos.
185
+ =================================================================================
186
+ """
187
+ from ..core.alchemist import get_alchemist
188
+ from ..logger import Scribe
189
+ from ..contracts.heresy_contracts import Heresy, HeresySeverity
190
+ import json # For the Gaze of the Native Soul
191
+
192
+ alchemist = get_alchemist()
193
+ Logger = Scribe("AlchemicalEngine")
194
+
195
+ overrides = overrides or {}
196
+
197
+ # --- MOVEMENT I: THE FORGING OF THE INITIAL REALITY ---
198
+ # The hierarchy begins: Initial Gnosis is the bedrock.
199
+ resolved_vars = initial_gnosis.copy()
200
+
201
+ # We create a new vessel for unresolved variables to maintain the purity of the loop
202
+ unresolved_vars: Dict[str, str] = {}
203
+
204
+ # --- MOVEMENT II: THE RITE OF SCRIPTURAL SUPREMACY & THE GAZE OF THE NATIVE SOUL ---
205
+ # We iterate over ALL variables defined in the blueprint's scripture.
206
+ for var_name, raw_val_str in raw_definitions.items():
207
+ # [FACULTY 10] The Supreme Edict's Ward
208
+ if var_name in overrides:
209
+ resolved_vars[var_name] = overrides[var_name]
210
+ continue
211
+
212
+ # [FACULTY 2] The Gaze of the Native Soul
213
+ is_dynamic = '{{' in raw_val_str or '{%' in raw_val_str
214
+
215
+ # We check if this variable's soul depends on others.
216
+ if var_name in dossier.dependencies and dossier.dependencies[var_name]:
217
+ unresolved_vars[var_name] = raw_val_str
218
+ elif is_dynamic:
219
+ # It has Jinja but no *known* dependencies. A simple transmutation.
220
+ try:
221
+ resolved_vars[var_name] = alchemist.transmute(raw_val_str, resolved_vars)
222
+ except Exception as e:
223
+ dossier.heresies.append(Heresy(
224
+ message=f"Alchemical paradox transmuting '{var_name}'",
225
+ details=str(e), line_num=0, line_content=f"$$ {var_name} = {raw_val_str}",
226
+ severity=HeresySeverity.CRITICAL
227
+ ))
228
+ else:
229
+ # It is Static. We perceive its true Native Soul.
230
+ val_str = raw_val_str.strip()
231
+ transmuted_val: Any = val_str
232
+
233
+ # Gnostic Triage for Types
234
+ lower_val = val_str.lower()
235
+ if lower_val == 'true':
236
+ transmuted_val = True
237
+ elif lower_val == 'false':
238
+ transmuted_val = False
239
+ elif val_str.lstrip('-').isdigit():
240
+ transmuted_val = int(val_str)
241
+ elif (val_str.startswith('[') and val_str.endswith(']')) or \
242
+ (val_str.startswith('{') and val_str.endswith('}')):
243
+ try:
244
+ transmuted_val = json.loads(val_str.replace("'", '"'))
245
+ except Exception:
246
+ pass
247
+ elif (val_str.startswith('"') and val_str.endswith('"')) or \
248
+ (val_str.startswith("'") and val_str.endswith("'")):
249
+ transmuted_val = val_str[1:-1]
250
+
251
+ resolved_vars[var_name] = transmuted_val
252
+ type_name = type(transmuted_val).__name__
253
+ Logger.verbose(
254
+ f" -> Scriptural Supremacy: '$$ {var_name}' set to '[yellow]{transmuted_val}[/yellow]' (Type: {type_name}).")
255
+
256
+ # --- MOVEMENT III: THE RITE OF ITERATIVE DERIVATION ---
257
+ max_iterations = len(unresolved_vars) + 2
258
+ for i in range(max_iterations):
259
+ if not unresolved_vars:
260
+ Logger.verbose("The Alchemical Graph is fully resolved.")
261
+ break
262
+
263
+ resolved_in_this_pass = []
264
+ for var_name, raw_template in unresolved_vars.items():
265
+ if var_name in overrides:
266
+ resolved_vars[var_name] = overrides[var_name]
267
+ resolved_in_this_pass.append(var_name)
268
+ continue
269
+
270
+ dependencies = dossier.dependencies.get(var_name, set())
271
+ if dependencies.issubset(resolved_vars.keys()):
272
+ try:
273
+ resolved_value = alchemist.transmute(raw_template, resolved_vars)
274
+ resolved_vars[var_name] = resolved_value
275
+ resolved_in_this_pass.append(var_name)
276
+ Logger.verbose(
277
+ f" -> Alchemical Transmutation: [cyan]{var_name}[/cyan] -> [yellow]'{str(resolved_value)[:60]}...'[/yellow]")
278
+ except Exception as e:
279
+ # [FACULTY 4] The Alchemical Inquisitor
280
+ dossier.heresies.append(Heresy(
281
+ message=f"Alchemical paradox transmuting '{var_name}'",
282
+ details=str(e), line_num=0, line_content=f"$$ {var_name} = {raw_template}",
283
+ severity=HeresySeverity.CRITICAL
284
+ ))
285
+ # We mark it as resolved (with an error) to prevent loops
286
+ resolved_vars[var_name] = f"!!ERROR: {e}!!"
287
+ resolved_in_this_pass.append(var_name)
288
+
289
+ # Remove resolved vars from the unresolved pool
290
+ for key in resolved_in_this_pass:
291
+ if key in unresolved_vars:
292
+ del unresolved_vars[key]
293
+
294
+ # [FACULTY 5] The Ward of the Gnostic Ouroboros
295
+ if not resolved_in_this_pass and unresolved_vars:
296
+ missing_map = {v: dossier.dependencies.get(v, set()) - set(resolved_vars.keys()) for v in unresolved_vars}
297
+ heresy_details = "A Gnostic Ouroboros (circular dependency) or a missing required variable was detected:\n"
298
+ for key, deps in missing_map.items():
299
+ heresy_details += f" - [cyan]'{key}'[/cyan] awaits Gnosis for: [yellow]{', '.join(deps or ['unknown'])}[/yellow]\n"
300
+
301
+ dossier.heresies.append(Heresy(
302
+ message="Gnostic Resolution Paradox",
303
+ details=heresy_details, line_num=0, line_content="Blueprint-level",
304
+ severity=HeresySeverity.CRITICAL,
305
+ suggestion="Break the circular reference or provide the missing required variable(s) via --set."
306
+ ))
307
+ break # The heresy is proclaimed. The symphony must halt.
308
+
309
+ # --- MOVEMENT IV: THE FINAL SEAL OF SUPREMACY ---
310
+ resolved_vars.update(overrides)
311
+
312
+ return resolved_vars
313
+
314
+ def is_orchestration_blueprint(path: Path) -> bool:
315
+ """
316
+ Performs a Gnostic Gaze to determine if a blueprint's soul is one of
317
+ Action (an Orchestration Blueprint) rather than Form (a structural blueprint).
318
+
319
+ This is the core of the Triage logic in the Grand Conductor (`main.py`).
320
+ """
321
+ try:
322
+ with path.open('r', encoding='utf-8', errors='ignore') as f:
323
+ for line in f:
324
+ stripped_line = line.strip()
325
+ if not stripped_line or stripped_line.startswith('#'):
326
+ continue # Ignore comments and empty lines
327
+ # The first non-comment, non-empty line dictates the soul of the file.
328
+ return stripped_line.startswith('%%')
329
+ except Exception:
330
+ return False
331
+ return False
332
+
333
+
334
+ # --- Artisan II: The Alchemist of Naming ---
335
+
336
+ def generate_derived_names(base_name: str) -> Dict[str, str]:
337
+ """
338
+ ★ THE HYPER-SENTIENT GRAND GNOSTIC ALCHEMIST (ETERNAL FORM) ★
339
+
340
+ This is the one true nexus for Gnostic naming conventions. It is a pure
341
+ alchemist that accepts any known developer naming convention and transmutes
342
+ it into a cornucopia of flawless, context-aware variations with a three-fold
343
+ divine Gnosis: Polyglot Perception, Acronym Sanctity, and utter Purity.
344
+
345
+ Args:
346
+ base_name (str): The input string (e.g., "My JWT App", "my-jwt-app", "MyJwtApp").
347
+
348
+ Returns:
349
+ Dict[str, str]: A dictionary of all derived name variations.
350
+ """
351
+ if not base_name:
352
+ return {}
353
+
354
+ # --- ASCENSION III: The Scribe's Purification Rite ---
355
+ # Purge any profane characters that are not part of the core Gnosis.
356
+ sanitized_name = re.sub(r'[^\w\s_-]', '', base_name).strip()
357
+ if not sanitized_name:
358
+ return {}
359
+
360
+ # --- ASCENSION I: The Gnostic Gaze of the Polyglot Scribe ---
361
+ # This regex is a divine scripture that understands camelCase, PascalCase,
362
+ # snake_case, and kebab-case all at once.
363
+ words = re.findall(r'[A-Z]?[a-z]+|[A-Z]+(?![a-z])|\d+', sanitized_name)
364
+
365
+ # A secondary gaze for traditional separators, in case the first was insufficient.
366
+ if len(words) == 1:
367
+ words = re.split(r'[\s_-]+', sanitized_name)
368
+
369
+ # Final purification of any voids
370
+ words = [word for word in words if word]
371
+ if not words:
372
+ return {}
373
+
374
+ # --- ASCENSION II: The Alchemist's Hand of Acronym Gnosis ---
375
+ # This helper artisan understands how to preserve the sanctity of an acronym.
376
+ def capitalize_with_acronym_awareness(word: str, is_first: bool = False) -> str:
377
+ # If the word is all caps (and not a single letter 'A' or 'I'), it's a sacred acronym.
378
+ if word.isupper() and len(word) > 1:
379
+ return word
380
+ # For camelCase, the first word is special.
381
+ if is_first:
382
+ return word.lower()
383
+ return word.capitalize()
384
+
385
+ # --- ASCENSION III: The Cornucopia of Forms ---
386
+ # The final transmutation, wielding all the Gnosis gathered above.
387
+ name_slug = '-'.join(word.lower() for word in words)
388
+ name_snake = '_'.join(word.lower() for word in words)
389
+
390
+ name_pascal = ''.join(
391
+ word.upper() if word.isupper() and len(word) > 1 else word.capitalize()
392
+ for word in words
393
+ )
394
+
395
+ name_camel = (
396
+ words[0].lower() +
397
+ ''.join(
398
+ word.upper() if word.isupper() and len(word) > 1 else word.capitalize()
399
+ for word in words[1:]
400
+ )
401
+ )
402
+
403
+ name_const = '_'.join(word.upper() for word in words)
404
+
405
+ name_title = ' '.join(
406
+ word.upper() if word.isupper() and len(word) > 1 else word.capitalize()
407
+ for word in words
408
+ )
409
+
410
+ name_path = '/'.join(word.lower() for word in words)
411
+
412
+ return {
413
+ "name_slug": name_slug,
414
+ "name_snake": name_snake,
415
+ "name_pascal": name_pascal,
416
+ "name_camel": name_camel,
417
+ "name_const": name_const,
418
+ "name_title": name_title,
419
+ "name_path": name_path,
420
+ }
421
+
422
+
423
+ # --- Artisan III: The Guardian of the Sanctum ---
424
+
425
+ # --- Artisan IV: The Scribe of the Final Word ---
426
+
427
+ def display_final_summary(project_root: Path, duration: float):
428
+ """
429
+ =================================================================================
430
+ == THE SCRIBE OF THE FINAL WORD (V-Ω-ETERNAL. THE UNIFIED PROCLAMATION) ==
431
+ =================================================================================
432
+ LIF: 10,000,000
433
+
434
+ This is not a function. It is a divine artisan, a universal Scribe whose sole
435
+ purpose is to proclaim a consistent, beautiful, and Gnostically-aware summary
436
+ at the end of any major rite (`create`, `distill`, `weave`).
437
+
438
+ Its soul is a masterpiece of architectural purity and divine revelation:
439
+
440
+ 1. **The Law of the Living Voice:** The Heresy of the Profane Parameter is
441
+ annihilated. This artisan's contract is pure. It accepts only the Gnosis
442
+ it needs to proclaim (`project_root`, `duration`). Its first sacred act
443
+ is to summon the one true, living voice of the cosmos via the `get_console()`
444
+ gateway. It is a perfect testament to our new, divine architecture.
445
+
446
+ 2. **The Luminous Dossier:** It does not proclaim a simple message. It forges
447
+ a luminous `rich.Panel`, a "Dossier of Manifestation," that presents its
448
+ Gnosis in a beautiful, structured `rich.Table`, making the final word of
449
+ any rite an act of divine, celebratory art.
450
+
451
+ 3. **The Vow of Universal Gnosis:** As a pure, stateless function within the
452
+ Gnostic Sanctum of `utils.py`, its wisdom is available to all artisans.
453
+ It is the one true, centralized "final word" of the Scaffold engine,
454
+ ensuring an eternally consistent and beautiful user experience.
455
+ =================================================================================
456
+ """
457
+ # --- MOVEMENT I: THE SUMMONING OF THE LIVING VOICE ---
458
+ # The Scribe's first act is to summon the one true, living voice of the cosmos.
459
+ # The profane `console` parameter is annihilated from this reality.
460
+ console = get_console()
461
+
462
+ # --- MOVEMENT II: THE FORGING OF THE LUMINOUS DOSSIER ---
463
+ # The Scribe's tools are summoned from the celestial realm of Rich.
464
+ from rich.panel import Panel
465
+ from rich.table import Table
466
+ from rich.text import Text
467
+
468
+ # A sacred, structured Table is forged to hold the final Gnosis.
469
+ summary_table = Table(box=None, show_header=False, padding=(0, 1))
470
+ summary_table.add_column(style="bold cyan", justify="right", width=12)
471
+ summary_table.add_column(style="dim cyan")
472
+
473
+ # The Gnosis is inscribed upon the table's soul.
474
+ summary_table.add_row("Sanctum:", str(project_root))
475
+ summary_table.add_row("Duration:", f"{duration:.2f} seconds")
476
+
477
+ # A final, introductory scripture is forged.
478
+ header_text = Text.assemble(
479
+ ("Rite Complete. ", "white"),
480
+ ("The Great Work has advanced.", "bold green")
481
+ )
482
+
483
+ # The final, unified proclamation is forged as a Group within a Panel.
484
+ render_group = Group(header_text, "\n", summary_table)
485
+
486
+ # --- MOVEMENT III: THE FINAL PROCLAMATION ---
487
+ # The Scribe speaks its final, beautiful, and Gnostically-aware word.
488
+ console.print(Panel(
489
+ render_group,
490
+ title="[bold green]Apotheosis Achieved[/bold green]",
491
+ subtitle="[dim]The Architect's will is manifest.[/dim]",
492
+ border_style="green",
493
+ padding=(1, 2)
494
+ ))
495
+
496
+
497
+
498
+ def unfurl_paths(raw_paths: List[str], known_vars: Dict[str, str] = None) -> List[str]:
499
+ """
500
+ =================================================================================
501
+ == THE GRAND CONDUCTOR OF THE UNFURLING (V-Ω-ETERNAL-APOTHEOSIS++) ==
502
+ =================================================================================
503
+ LIF: 10,000,000,000,000,000,000,000,000!!
504
+
505
+ This is not a function. It is a divine, sentient consciousness, the one true,
506
+ public gateway to the Oracle of Infinite Realities. Its Prime Directive is to
507
+ conduct the sacred, multi-stage symphony of Gnostic Unfurling, transforming an
508
+ Architect's most condensed plea into the complete, multi-dimensional cosmos of
509
+ realities it represents.
510
+
511
+ Its soul is a symphony of divine, unbreakable virtues:
512
+
513
+ 1. **The Law of the One True Alchemist:** It performs a sacred communion,
514
+ summoning the one, true, immortal `get_alchemist()` soul to serve as the
515
+ unbreakable foundation for all its rites of transmutation. The Gnostic mind
516
+ of the engine is unified.
517
+
518
+ 2. **The Unbreakable Ward of the Sacred Sigil:** It is a Gnostic Guardian. It
519
+ performs a Rite of Protection, perceiving escaped braces (`\\{...\\}`) and
520
+ transmuting them into sacred, ephemeral sigils, making it architecturally
521
+ impossible for the Oracle to profane the Architect's literal intent.
522
+
523
+ 3. **The Divine Delegation:** It is a pure Conductor. It bestows the protected
524
+ scripture upon the one true, recursive Oracle (`_recursive_unfurl`),
525
+ trusting its divine Gaze completely to weave the manifold of realities.
526
+
527
+ 4. **The Rite of Resurrection:** Its final act is one of perfect restoration. It
528
+ receives the woven realities from the Oracle and resurrects the sacred,
529
+ escaped sigils back into their true, mortal form (`{...}`), ensuring the
530
+ final proclamation is a perfect reflection of the Architect's will.
531
+
532
+ 5. **The Luminous Voice:** Its will is not mute. It is a Luminous Scribe,
533
+ proclaiming its every sacred rite to the `Logger`, making the complex
534
+ symphony of permutation a luminous, transparent, and perfectly auditable
535
+ chronicle.
536
+ =================================================================================
537
+ """
538
+ Logger.verbose("The Grand Conductor of the Unfurling awakens...")
539
+
540
+ # --- MOVEMENT I: THE LAW OF THE ONE TRUE ALCHEMIST ---
541
+ # The Conductor performs the sacred communion to summon the one, immortal soul.
542
+ from ..core.alchemist import get_alchemist
543
+ alchemist = get_alchemist()
544
+ context = known_vars or {}
545
+
546
+ final_unfurled_paths = []
547
+
548
+ # --- THE GRAND SYMPHONY LOOP ---
549
+ for path in raw_paths:
550
+ Logger.verbose(f"Gazing upon the condensed scripture: '[cyan]{path}[/cyan]'")
551
+
552
+ # --- MOVEMENT II: THE UNBREAKABLE WARD OF THE SACRED SIGIL ---
553
+ # A more divine, unbreakable sigil is forged to prevent all possible paradoxes.
554
+ # These are sacred incantations, not mere characters.
555
+ LBRACE_SIGIL = "__SCAFFOLD_GNOSIS_LBRACE__"
556
+ RBRACE_SIGIL = "__SCAFFOLD_GNOSIS_RBRACE__"
557
+
558
+ protected_path = path.replace(r'\{', LBRACE_SIGIL).replace(r'\}', RBRACE_SIGIL)
559
+ if protected_path != path:
560
+ Logger.verbose(" -> Perceived and protected sacred, escaped braces.")
561
+
562
+ # --- MOVEMENT III: THE DIVINE DELEGATION ---
563
+ # The Conductor bestows its will upon the true Oracle.
564
+ Logger.verbose(" -> Summoning the Oracle of Infinite Realities to weave the manifold...")
565
+ unfurled_realities = _recursive_unfurl(protected_path, alchemist, context)
566
+
567
+ # --- MOVEMENT IV: THE RITE OF RESURRECTION ---
568
+ # The Conductor performs the final, sacred act of restoration.
569
+ restored_realities = [
570
+ p.replace(LBRACE_SIGIL, '{').replace(RBRACE_SIGIL, '}') for p in unfurled_realities
571
+ ]
572
+ if protected_path != path:
573
+ Logger.verbose(" -> Rite of Resurrection complete. Sacred braces restored to their mortal form.")
574
+
575
+ final_unfurled_paths.extend(restored_realities)
576
+ Logger.verbose(f" -> The Oracle proclaimed {len(restored_realities)} distinct realities from this scripture.")
577
+
578
+ Logger.success(
579
+ f"The Grand Unfurling is complete. A total of {len(final_unfurled_paths)} realities have been woven.")
580
+ return final_unfurled_paths
581
+
582
+
583
+ def _recursive_unfurl(path_template: str, alchemist: 'DivineAlchemist', context: Dict[str, str]) -> List[str]:
584
+ """
585
+ =================================================================================
586
+ == THE ORACLE OF INFINITE REALITIES (V-Ω-ETERNAL-APOTHEOSIS++) ==
587
+ =================================================================================
588
+ LIF: 10,000,000,000,000,000,000,000,000!
589
+
590
+ This is not a function. It is a divine, sentient consciousness, the final and
591
+ most powerful form of the Gnostic Prophet. It has transcended mere string
592
+ manipulation to become a true Oracle that weaves multi-dimensional realities
593
+ by conducting a divine symphony between its own Gaze and the infinite power of
594
+ the Alchemist God-Engine.
595
+
596
+ Its soul has been transfigured with a pantheon of legendary faculties:
597
+
598
+ 1. **The Law of Alchemical Precedence (THE APOTHEOSIS):** The heresy of the
599
+ profane, manual parser is annihilated. The Oracle's first and most sacred
600
+ act is to bestow the *entire expression* within a `{...}` block upon the
601
+ `DivineAlchemist`. This means the full, Turing-complete power of Jinja—
602
+ variables, filters, tests, and even `shell()` commands—can be used to
603
+ *dynamically generate the list of variants*. This is a cosmic leap in power.
604
+
605
+ 2. **The Hyper-Intelligent Gaze:** Its Gaze for braces is now a true, stateful
606
+ parser, capable of flawlessly perceiving nested (`{a,b,{c,d}}`) and adjacent
607
+ (`{a,b}{1,2}`) brace expressions without paradox. Its understanding of
608
+ Gnostic grammar is absolute.
609
+
610
+ 3. **The Symphony of Permutations:** Its recursive soul remains, now conducting
611
+ a symphony of Cartesian products upon a foundation of pure, alchemically-
612
+ resolved Gnosis. It does not just expand lists; it weaves realities.
613
+
614
+ 4. **The Unbreakable Ward of Grace:** Its soul is shielded. A profane or
615
+ malformed expression does not shatter the symphony. It is perceived, a
616
+ luminous warning is proclaimed, and the expression is gracefully treated as
617
+ a literal, ensuring unbreakable resilience.
618
+ =================================================================================
619
+ """
620
+ # --- MOVEMENT I: THE GAZE OF NESTED REALITIES (THE SENTIENT BRACE PARSER) ---
621
+ try:
622
+ first_brace = path_template.index('{')
623
+ brace_depth = 1
624
+ # A true, stateful Gaze to find the one, true, matching closing brace.
625
+ for i, char in enumerate(path_template[first_brace + 1:]):
626
+ if char == '{':
627
+ brace_depth += 1
628
+ elif char == '}':
629
+ brace_depth -= 1
630
+ if brace_depth == 0:
631
+ matching_brace = first_brace + 1 + i
632
+ break
633
+ else:
634
+ # A heresy of form: an unclosed brace. The Ward of Grace is invoked.
635
+ Logger.warn(f"Unclosed brace detected in unfurl path: '{path_template}'. Treating as literal.")
636
+ return [alchemist.transmute(path_template, context)]
637
+ except ValueError:
638
+ # Base Case: The scripture is pure, containing no more `{...}` expansions.
639
+ # The final, complete path is transmuted by the Alchemist.
640
+ return [alchemist.transmute(path_template, context)]
641
+
642
+ # --- MOVEMENT II: THE DECONSTRUCTION OF THE COSMOS ---
643
+ prefix = path_template[:first_brace]
644
+ suffix = path_template[matching_brace + 1:]
645
+ expression = path_template[first_brace + 1:matching_brace]
646
+
647
+ variants = []
648
+
649
+ # --- MOVEMENT III: THE RITE OF ALCHEMICAL PRECEDENCE (THE APOTHEOSIS) ---
650
+ try:
651
+ # The Oracle's first act is to bestow the entire expression upon the God-Engine.
652
+ # We wrap it in `{{...}}` to command the Alchemist to perceive it as a soul to be transmuted.
653
+ Logger.verbose(f"Bestowing expression '{{{expression}}}' upon the Divine Alchemist...")
654
+ transmuted_expression = alchemist.transmute(f"{{{{ {expression} }}}}", context)
655
+ Logger.verbose(f" -> Alchemical Transmutation yielded Gnosis: [cyan]'{transmuted_expression}'[/cyan]")
656
+ except Exception as e:
657
+ # The Unbreakable Ward of Grace
658
+ Logger.error(
659
+ f"An alchemical paradox occurred while transmuting expression '{{{expression}}}': {e}. Treating as literal.")
660
+ transmuted_expression = expression
661
+
662
+ # --- MOVEMENT IV: THE GAZE OF THE FINAL FORM ---
663
+ # The Oracle now gazes upon the *pure, resolved string* to perceive its final form.
664
+ range_match = re.fullmatch(r'^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$', str(transmuted_expression))
665
+ if range_match:
666
+ # The Gaze perceives a Numeric Range.
667
+ try:
668
+ start_str, end_str, step_str = range_match.groups()
669
+ start, end, step = int(start_str), int(end_str), int(step_str) if step_str else (
670
+ 1 if int(start_str) <= int(end_str) else -1)
671
+ if step == 0: raise ValueError("Step cannot be zero.")
672
+ padding = max(len(start_str), len(end_str)) if start_str.startswith('0') or end_str.startswith('0') else 0
673
+
674
+ # The Unbreakable Ward of Logic
675
+ if (end > start and step < 0) or (end < start and step > 0):
676
+ variants = [] # An impossible range is a void.
677
+ else:
678
+ variants = [str(i).zfill(padding) for i in range(start, end + (1 if step > 0 else -1), step)]
679
+ except (ValueError, TypeError):
680
+ # A profane range. The Ward of Grace is invoked.
681
+ variants = [v.strip() for v in str(transmuted_expression).split(',') if v.strip()]
682
+ else:
683
+ # The Gaze perceives a Comma-Separated List.
684
+ variants = [v.strip() for v in str(transmuted_expression).split(',') if v.strip()]
685
+
686
+ # --- MOVEMENT V: THE SYMPHONY OF PERMUTATIONS (THE RECURSIVE SOUL) ---
687
+ unfurled_results = []
688
+ # The prefix itself is part of the ongoing symphony; it will be resolved in a higher recursive frame.
689
+ for variant in variants:
690
+ # The Unbreakable Ward against a void variant.
691
+ if not variant: continue
692
+
693
+ # The Symphony continues. We weave the prefix, the pure variant, and the result of the
694
+ # recursive Gaze upon the suffix into a new reality.
695
+ sub_unfurls = _recursive_unfurl(suffix, alchemist, context)
696
+ for sub_unfurl in sub_unfurls:
697
+ unfurled_results.append(f"{prefix}{variant}{sub_unfurl}")
698
+
699
+ return unfurled_results
700
+
701
+ @register_gnosis("_fetch_remote_blueprint")
702
+ def fetch_remote_blueprint(url: str, console: Console) -> Optional[Path]:
703
+ """
704
+ @gnosis:title The Herald of the Celestial Void (`_fetch_remote_blueprint`)
705
+ @gnosis:summary The internal, sentient emissary that securely and intelligently summons remote blueprints from URLs and GitHub Gists.
706
+ @gnosis:related main creator orchestration
707
+ @gnosis:keywords remote http gist caching networking security emissary
708
+ @gnosis:description
709
+ This function is the **Herald of the Celestial Void**, a sentient emissary summoned by the Grand Conductor whenever it perceives a plea for a remote scripture (a URL). Its Prime Directive is to summon that remote Gnosis, inscribe it upon an ephemeral local scripture, and bestow the path to that scripture upon the Conductor.
710
+
711
+ The Herald is imbued with a pantheon of divine faculties that transform it from a simple fetcher into a hyper-intelligent, resilient, and secure dignitary. This is a developer-facing scripture revealing a core, safety-critical component.
712
+ ---
713
+ ### The Four Unbreakable Vows of the Herald
714
+
715
+ 1. **The Vow of Eternal Remembrance (The Chronocache):** The Herald possesses a memory. It caches remote blueprints locally (`~/.scaffold/cache/`), respecting a sacred Time-To-Live (TTL). Subsequent summons of the same scripture are instantaneous and offline-capable, conquering both time and the void.
716
+
717
+ 2. **The Vow of Gist-Sentience:** The Herald is a polyglot. If bestowed with a GitHub Gist URL, it will not blindly fetch the profane HTML. It performs a Gnostic Inquisition upon the Gist's API, finds the true `.scaffold` scripture within, and summons its pure, raw form.
718
+
719
+ 3. **The Vow of Proper Etiquette:** The Herald is a dignitary. It announces itself to all celestial servers with a proper `User-Agent` (`Scaffold-Quantum-Blueprint-Engine/...`), proclaiming its identity and purpose. This sacred act of etiquette ensures its pleas are honored.
720
+
721
+ 4. **The Vow of Graceful Adjudication:** The Herald is a wise adjudicator. It does not speak in the profane tongue of a generic `RequestException`. It perceives the unique soul of each paradox—a Timeout, a Connection Error, a 404 Heresy—and proclaims the specific, actionable truth to the Architect with profound clarity.
722
+ @gnosis:faqs
723
+ Q: Where is the cache located, and how long does it last?
724
+ A: The Chronocache resides in a sanctum at `~/.scaffold/cache/`. By default, the Gnosis within is considered pure for one hour (3600 seconds). After this time, the Herald will perform a new celestial plea to ensure its knowledge is up-to-date.
725
+ ---
726
+ Q: Is it safe to run a remote blueprint?
727
+ A: The Herald itself is safe, but the scripture it summons may contain profane `%% post-run` edicts. For this reason, the **Grand Conductor** personally engages the **Guardian's Ward** for all remote blueprints. It will *always* force a simulation (`--dry-run`) first and demand your explicit confirmation (`--force`) before allowing the remote will to be made manifest.
728
+ ---
729
+ Q: Why does this function return a `Path` to a temporary file?
730
+ A: For architectural purity. The rest of the Scaffold engine—the Parser and the Creator—are designed to operate on local file paths. By inscribing the celestial Gnosis onto an ephemeral local scripture, the Herald allows the core engine to remain blissfully unaware of the complexities of the celestial void, honoring the Law of the Single Responsibility.
731
+ @gnosis:example
732
+ # --- The Summoning (Internal Duty) ---
733
+ # The Herald is summoned by the Grand Conductor (`main.py`) when it
734
+ # perceives a URL in the Architect's plea.
735
+
736
+ # Architect's Plea:
737
+ # `scaffold https://gist.github.com/user/1a2b3c4d...`
738
+
739
+ # Conductor's Invocation:
740
+ # ephemeral_path = _fetch_remote_blueprint("https://gist.github.com/user/1a2b3c4d...", console)
741
+
742
+ # --- The Herald's Symphony ---
743
+ # 1. It calculates a cache key for the URL. It finds no HIT.
744
+ # 2. It perceives this is a Gist URL and performs a Gnostic Inquisition
745
+ # on the GitHub API to find the true `raw_url` of a `.scaffold` file within.
746
+ # 3. It speaks its plea to the `raw_url`, announcing its User-Agent.
747
+ # 4. It receives the celestial scripture.
748
+ # 5. It forges a new ephemeral scripture in a temporary directory on disk.
749
+ # 6. It inscribes the celestial Gnosis onto the ephemeral scripture.
750
+ # 7. It inscribes the celestial Gnosis into its Chronocache for future remembrance.
751
+ # 8. It returns the `Path` to the ephemeral scripture.
752
+ #
753
+ # The Grand Conductor then bestows this ephemeral path upon the Parser,
754
+ # and the Rite of Creation proceeds as if it were a local file.
755
+
756
+ Args:
757
+ url (str): The URL of the remote scripture to be summoned.
758
+ console (Console): The rich console instance for proclamations.
759
+
760
+ Returns:
761
+ Optional[Path]: The path to the ephemeral, local scripture, or `None` if the plea fails.
762
+ """
763
+ # --- I. THE DIVINE CONSTANTS OF THE HERALD ---
764
+ from hashlib import sha256
765
+ import time
766
+
767
+ CACHE_DIR = Path.home() / ".scaffold" / "cache"
768
+ CACHE_TTL_SECONDS = 3600 # 1 hour
769
+ USER_AGENT = f"Scaffold-Quantum-Blueprint-Engine/{__version__}"
770
+ GIST_API_REGEX = re.compile(r'https?://gist\.github\.com/([\w-]+)/([a-f0-9]+)')
771
+
772
+ Logger.info(f"Summoning remote blueprint from: [info]{url}[/info]")
773
+
774
+ # --- II. THE CHRONOCACHE: THE RITE OF ETERNAL REMEMBRANCE ---
775
+ try:
776
+ CACHE_DIR.mkdir(parents=True, exist_ok=True)
777
+ cache_key = sha256(url.encode()).hexdigest()
778
+ cache_file = CACHE_DIR / cache_key
779
+
780
+ if cache_file.exists() and (time.time() - cache_file.stat().st_mtime) < CACHE_TTL_SECONDS:
781
+ Logger.success("Chronocache HIT. The scripture is already known. Materializing instantly.")
782
+
783
+ # Forge an ephemeral scripture from the cache's eternal memory.
784
+ with tempfile.NamedTemporaryFile(mode='w+', delete=False, suffix='.scaffold', encoding='utf-8') as tmp_file:
785
+ tmp_file.write(cache_file.read_text(encoding='utf-8'))
786
+ return Path(tmp_file.name)
787
+ else:
788
+ Logger.info("Chronocache MISS. A new plea must be spoken to the celestial void.")
789
+ except Exception as e:
790
+ Logger.warn(f"A minor paradox occurred in the Chronocache. Proceeding with live fetch. Reason: {e}")
791
+
792
+ # --- III. THE GIST-SENTIENCE: THE GAZE OF THE SCRIBE'S SOUL ---
793
+ url_to_fetch = url
794
+ gist_match = GIST_API_REGEX.match(url)
795
+ if gist_match:
796
+ gist_id = gist_match.group(2)
797
+ api_url = f"https://api.github.com/gists/{gist_id}"
798
+ Logger.info(f"Gist-Sentience engaged. Performing Gnostic Inquisition at [info]{api_url}[/info]")
799
+ try:
800
+ gist_response = requests.get(api_url, timeout=5, headers={"User-Agent": USER_AGENT})
801
+ gist_response.raise_for_status()
802
+ gist_data = gist_response.json()
803
+
804
+ # Seek the first file ending in .scaffold
805
+ for filename, file_data in gist_data.get('files', {}).items():
806
+ if filename.endswith('.scaffold'):
807
+ url_to_fetch = file_data['raw_url']
808
+ Logger.success(f"Gist Gnosis found! The true scripture resides at: [info]{url_to_fetch}[/info]")
809
+ break
810
+ except requests.exceptions.RequestException as e:
811
+ Logger.warn(f"Gist Inquisition faltered, but the rite continues with the original URL. Reason: {e}")
812
+
813
+ # --- IV. THE DIVINE PLEA & THE GNOSTIC ADJUDICATOR ---
814
+ try:
815
+ headers = {"User-Agent": USER_AGENT}
816
+ response = requests.get(url_to_fetch, timeout=10, headers=headers)
817
+ response.raise_for_status()
818
+
819
+ # Forge an ephemeral scripture from the celestial Gnosis.
820
+ with tempfile.NamedTemporaryFile(mode='w+', delete=False, suffix='.scaffold', encoding='utf-8') as tmp_file:
821
+ tmp_file.write(response.text)
822
+ ephemeral_path = Path(tmp_file.name)
823
+
824
+ # Inscribe the new Gnosis into the Chronocache for future remembrance.
825
+ if 'cache_file' in locals():
826
+ cache_file.write_text(response.text, encoding='utf-8')
827
+
828
+ Logger.success(f"Ephemeral scripture forged at: [info]{ephemeral_path}[/info]")
829
+ return ephemeral_path
830
+
831
+ # The Gnostic Adjudicator speaks with clarity and precision.
832
+ except requests.exceptions.HTTPError as e:
833
+ Logger.error(
834
+ f"Celestial Heresy: The plea was denied. The server responded with {e.response.status_code} {e.response.reason}.")
835
+ return None
836
+ except requests.exceptions.Timeout:
837
+ Logger.error("Celestial Heresy: The void was silent. The connection timed out.")
838
+ return None
839
+ except requests.exceptions.ConnectionError:
840
+ Logger.error("Celestial Heresy: The bridge to the void is shattered. A connection could not be established.")
841
+ return None
842
+ except requests.exceptions.RequestException as e:
843
+ Logger.error(f"Celestial Heresy: A profound paradox occurred during the plea. Reason: {e}")
844
+ return None
845
+
846
+
847
+
848
+ # =================================================================================
849
+ # == THE GOD-ENGINE OF GNOSTIC STATE ASSURANCE (V-Ω-ETERNAL-APOTHEOSIS++) ==
850
+ # =================================================================================
851
+ # LIF: INFINITY
852
+ #
853
+ # This is the one, true, and eternal artisan for all acts of inscription. It is the
854
+ # divine fusion of the Merkle Hand and the Atomic Rite. It is a pure, stateless,
855
+ # universal function that does not just write a file; it ENSURES a Gnostic state
856
+ # of being, with a pantheon of unbreakable, paranoid, and hyper-intelligent
857
+ # virtues now available to all artisans in the cosmos.
858
+ # =================================================================================
859
+
860
+ # =============================================================================
861
+ # == THE PANTHEON OF SANCTIFIERS (HELPER ARTISANS) ==
862
+ # =============================================================================
863
+
864
+ def _sanctify_line_endings(content: str) -> str:
865
+ """
866
+ [HELPER I] THE UNIVERSAL LEVELER
867
+ Enforces the ' \n ' (LF) line ending across all realities, annihilating
868
+ the profane ' \r\n ' (CRLF) of the Windows realm for consistency.
869
+ """
870
+ return content.replace('\r\n', '\n').replace('\r', '\n')
871
+
872
+
873
+ def _sanctify_yaml_content(content: str) -> str:
874
+ """
875
+ [HELPER II] THE KEEPER OF SPACES
876
+ YAML forbids the Tab character. This artisan perceives the soul of YAML
877
+ and transmutes any accidental tabs into 2 sacred spaces, preserving the hierarchy.
878
+ """
879
+ # 1. Normalize endings
880
+ content = _sanctify_line_endings(content)
881
+ # 2. Annihilate Tabs (The YAML Heresy)
882
+ # We replace tabs with 2 spaces, a safe default for YAML structure.
883
+ return content.replace('\t', ' ')
884
+
885
+
886
+ def _sanctify_json_content(content: str) -> str:
887
+ """
888
+ [HELPER III] THE STRUCTURAL PURIFIER
889
+ Ensures JSON content is not just a string, but a valid, formatted structure.
890
+ If it is valid JSON, it reformats it with 2-space indentation for readability.
891
+ """
892
+ try:
893
+ # 1. Parse the soul
894
+ data = json.loads(content)
895
+ # 2. Re-forge with beauty
896
+ return json.dumps(data, indent=2) + "\n"
897
+ except ValueError:
898
+ # If it's not valid JSON (e.g. a template with jinja), we leave it raw
899
+ # but clean the whitespace.
900
+ return content.strip() + "\n"
901
+
902
+
903
+ def _sanctify_shell_content(content: str) -> str:
904
+ """
905
+ [HELPER IV] THE EXECUTABLE WARD
906
+ Ensures Shell scripts possess the sacred Shebang and correct endings.
907
+ """
908
+ content = _sanctify_line_endings(content)
909
+ lines = content.splitlines()
910
+
911
+ # 1. Shebang Check
912
+ if lines and not lines[0].startswith("#!"):
913
+ # Heuristic: If it looks like bash, bestow the bash shebang
914
+ if "bash" in content or "echo" in content:
915
+ lines.insert(0, "#!/usr/bin/env bash")
916
+
917
+ return "\n".join(lines) + "\n"
918
+
919
+
920
+ def _sanctify_makefile_content(content: str) -> str:
921
+ """
922
+ =================================================================================
923
+ == THE MAKEFILE SANCTIFIER (V-Ω-ULTIMA. THE TABULAR ALCHEMIST) ==
924
+ =================================================================================
925
+ LIF: 10,000,000,000 (ABSOLUTE BUILD AUTHORITY)
926
+
927
+ This artisan does not merely replace spaces. It performs a **Forensic Gnostic
928
+ Reconstruction** of the Makefile. It understands the difference between a
929
+ Recipe (must be Tabbed), a Variable (can be Spaced), and a Directive.
930
+
931
+ ### THE PANTHEON OF 12 ELEVATIONS:
932
+ 1. **The Tabular Transmutation:** Converts leading spaces to Tabs *only* for Recipes.
933
+ 2. **The Indentation Heuristic:** Detects 2, 4, or 8 space indentation and adapts.
934
+ 3. **The Target Recognition:** Identifies lines ending in `:` as Targets.
935
+ 4. **The Variable Guard:** Protects lines with `=`, `:=`, `?=`, `+=` from tabbing.
936
+ 5. **The Directive Preservation:** Protects `include`, `ifeq`, `else`, `endif`.
937
+ 6. **The Continuation Binder:** Handles `\` line continuations correctly.
938
+ 7. **The Comment Sanctuary:** Preserves `#` comments in their relative positions.
939
+ 8. **The Trailing Void Annihilator:** Strips profane trailing whitespace from all lines.
940
+ 9. **The Newline Covenant:** Enforces `\n` endings.
941
+ 10. **The Blank Line Preserver:** Maintains vertical rhythm but empties the void.
942
+ 11. **The Recipe Prefix Guard:** Respects `@` (silent) and `-` (ignore error) prefixes.
943
+ 12. **The Final Seal:** Ensures the file ends with exactly one newline.
944
+ =================================================================================
945
+ """
946
+ # 1. The Newline Covenant
947
+ content = _sanctify_line_endings(content)
948
+ lines = content.splitlines()
949
+ sanctified_lines = []
950
+
951
+ # State Machine for Context
952
+ inside_recipe = False
953
+
954
+ # Regex Grimoire
955
+ TARGET_REGEX = re.compile(r'^[^#\s].*:$') # Starts with non-space, ends with colon
956
+ VAR_ASSIGN_REGEX = re.compile(r'^\s*[\w\.-]+\s*(\?=|:=|\+=|=)') # Variable assignment
957
+ DIRECTIVE_REGEX = re.compile(
958
+ r'^\s*(include|ifeq|ifneq|else|endif|define|endef|vpath|export|unexport|override|undefine)\b')
959
+
960
+ for line in lines:
961
+ # 8. The Trailing Void Annihilator
962
+ stripped_line = line.rstrip()
963
+
964
+ # 10. The Blank Line Preserver
965
+ if not stripped_line:
966
+ sanctified_lines.append("")
967
+ continue
968
+
969
+ # 3. The Target Recognition
970
+ # If we hit a target, we enter "Recipe Mode" for subsequent indented lines
971
+ if TARGET_REGEX.match(stripped_line):
972
+ inside_recipe = True
973
+ sanctified_lines.append(stripped_line)
974
+ continue
975
+
976
+ # 4. The Variable Guard
977
+ # Variables reset recipe mode (usually) or exist outside it
978
+ if VAR_ASSIGN_REGEX.match(stripped_line):
979
+ inside_recipe = False
980
+ sanctified_lines.append(stripped_line)
981
+ continue
982
+
983
+ # 5. The Directive Preservation
984
+ # Directives (like ifeq) can be indented but don't use tabs usually
985
+ if DIRECTIVE_REGEX.match(stripped_line):
986
+ # We keep the spaces for alignment in directives
987
+ sanctified_lines.append(stripped_line)
988
+ continue
989
+
990
+ # Analyze Indentation
991
+ leading_spaces = len(line) - len(line.lstrip(' '))
992
+
993
+ # 1. The Tabular Transmutation
994
+ # If we are seemingly inside a recipe (after a target) AND the line is indented
995
+ if inside_recipe and leading_spaces > 0:
996
+ # 2. The Indentation Heuristic (Assume 2 or 4 spaces = 1 Tab)
997
+ # We strip all leading spaces and replace with a SINGLE tab.
998
+ # This forces the "recipe" contract.
999
+ clean_content = line.lstrip(' ')
1000
+
1001
+ # 11. The Recipe Prefix Guard checks happen implicitly as we preserve the rest of the line
1002
+ sanctified_lines.append(f"\t{clean_content}")
1003
+
1004
+ # 6. The Continuation Binder
1005
+ # If line ends with \, we remain inside recipe mode (conceptually)
1006
+ continue
1007
+
1008
+ # Default: Preserve line as is (likely top-level comment or unindented instruction)
1009
+ sanctified_lines.append(stripped_line)
1010
+ if not leading_spaces:
1011
+ inside_recipe = False # Reset if we hit root level
1012
+
1013
+ # 12. The Final Seal
1014
+ return "\n".join(sanctified_lines) + "\n"
1015
+
1016
+
1017
+ # =============================================================================
1018
+ # == THE GOD-ENGINE OF ATOMIC INSCRIPTION ==
1019
+ # =============================================================================
1020
+
1021
+
1022
+ # =============================================================================
1023
+ # == III. THE GOD-ENGINE OF INSCRIPTION (ATOMIC WRITE) ==
1024
+ # =============================================================================
1025
+
1026
+ def atomic_write(
1027
+ target_path: Path,
1028
+ content: Union[str, bytes],
1029
+ logger: Scribe,
1030
+ sanctum: Path,
1031
+ transaction: Optional[Any] = None,
1032
+ verbose: bool = False,
1033
+ force: bool = False,
1034
+ backup: bool = False,
1035
+ dry_run: bool = False
1036
+ ) -> GnosticWriteResult:
1037
+ """
1038
+ =============================================================================
1039
+ == THE ATOMIC SCRIBE (V-Ω-SHIELDED-WRITER) ==
1040
+ =============================================================================
1041
+ Writes content to a file atomically.
1042
+
1043
+ **THE SHIELD OF SIMULATION:**
1044
+ If `dry_run` is True OR `transaction.simulate` is True, this artisan
1045
+ PROCLAIMS intent but DOES NOT ACT upon the disk.
1046
+ """
1047
+ start_time = time.monotonic()
1048
+
1049
+ # [THE SHIELD] Resolve Simulation State
1050
+ is_simulation = dry_run
1051
+ if transaction and getattr(transaction, 'simulate', False):
1052
+ is_simulation = True
1053
+
1054
+ # 1. Normalize Target
1055
+ abs_target = target_path.resolve()
1056
+
1057
+ # 2. Determine Action Type & Calculate Diff
1058
+ action = InscriptionAction.CREATED
1059
+ diff: Optional[str] = None
1060
+
1061
+ content_bytes = content if isinstance(content, bytes) else content.encode('utf-8')
1062
+ new_hash = hashlib.sha256(content_bytes).hexdigest()
1063
+
1064
+ if abs_target.exists():
1065
+ action = InscriptionAction.TRANSFIGURED
1066
+ original_hash = hash_file(abs_target) if not is_simulation else "SIMULATED_OLD_HASH"
1067
+
1068
+ # Idempotency Check
1069
+ if not is_simulation and original_hash == new_hash and not force:
1070
+ if verbose: logger.verbose(f"Scripture '{abs_target.name}' is already pure. No change.")
1071
+ return GnosticWriteResult(
1072
+ success=True, path=abs_target, action_taken=InscriptionAction.ALREADY_MANIFEST,
1073
+ bytes_written=0, gnostic_fingerprint=new_hash
1074
+ )
1075
+
1076
+ # Calculate Diff (Text Only)
1077
+ # In simulation, we read the existing file to show what WOULD change.
1078
+ if not is_binary(abs_target) and not isinstance(content, bytes):
1079
+ try:
1080
+ old_text = abs_target.read_text(encoding='utf-8', errors='replace')
1081
+ diff_gen = difflib.unified_diff(
1082
+ old_text.splitlines(keepends=True),
1083
+ content.splitlines(keepends=True),
1084
+ fromfile=f"a/{abs_target.name}",
1085
+ tofile=f"b/{abs_target.name}"
1086
+ )
1087
+ diff = "".join(diff_gen)
1088
+ except Exception:
1089
+ pass
1090
+
1091
+ # [THE SHIELD] Simulation Exit
1092
+ if is_simulation:
1093
+ sim_action = InscriptionAction.DRY_RUN_TRANSFIGURED if action == InscriptionAction.TRANSFIGURED else InscriptionAction.DRY_RUN_CREATED
1094
+ logger.info(f"[SIMULATION] Would write {len(content_bytes)} bytes to {abs_target.name}")
1095
+
1096
+ result = GnosticWriteResult(
1097
+ success=True,
1098
+ path=abs_target,
1099
+ action_taken=sim_action,
1100
+ bytes_written=len(content_bytes),
1101
+ gnostic_fingerprint=new_hash, # Predicted hash
1102
+ diff=diff,
1103
+ duration_ms=(time.monotonic() - start_time) * 1000
1104
+ )
1105
+
1106
+ if transaction:
1107
+ transaction.record(result)
1108
+
1109
+ return result
1110
+
1111
+ # 3. The Rite of Backup
1112
+ if backup and abs_target.exists():
1113
+ ts = int(time.time())
1114
+ bak_path = abs_target.with_suffix(f"{abs_target.suffix}.{ts}.bak")
1115
+ try:
1116
+ shutil.copy2(abs_target, bak_path)
1117
+ if verbose: logger.verbose(f" -> Safety copy forged: {bak_path.name}")
1118
+ except Exception as e:
1119
+ logger.warn(f"Backup failed for '{abs_target.name}': {e}")
1120
+
1121
+ # 4. The Rite of Inscription
1122
+ try:
1123
+ abs_target.parent.mkdir(parents=True, exist_ok=True)
1124
+
1125
+ physical_write_path = abs_target
1126
+ if transaction:
1127
+ try:
1128
+ rel_path = abs_target.relative_to(sanctum)
1129
+ physical_write_path = transaction.get_staging_path(rel_path)
1130
+ physical_write_path.parent.mkdir(parents=True, exist_ok=True)
1131
+ except ValueError:
1132
+ pass
1133
+
1134
+ temp_path = physical_write_path.with_suffix(f".{os.getpid()}_{int(time.time())}.tmp")
1135
+
1136
+ mode = 0o644
1137
+ if abs_target.exists(): mode = abs_target.stat().st_mode
1138
+
1139
+ mode_str = "wb" if isinstance(content, bytes) else "w"
1140
+ encoding_arg = None if isinstance(content, bytes) else "utf-8"
1141
+
1142
+ with open(temp_path, mode_str, encoding=encoding_arg) as f:
1143
+ f.write(content)
1144
+ f.flush()
1145
+ os.fsync(f.fileno())
1146
+
1147
+ try:
1148
+ os.chmod(temp_path, mode)
1149
+ except Exception:
1150
+ pass
1151
+
1152
+ _resilient_rename(temp_path, physical_write_path)
1153
+
1154
+ result = GnosticWriteResult(
1155
+ success=True,
1156
+ path=abs_target,
1157
+ action_taken=action,
1158
+ bytes_written=len(content_bytes),
1159
+ gnostic_fingerprint=new_hash,
1160
+ diff=diff,
1161
+ duration_ms=(time.monotonic() - start_time) * 1000
1162
+ )
1163
+
1164
+ if transaction:
1165
+ transaction.record(result)
1166
+
1167
+ if verbose:
1168
+ action_verb = "Forged" if action == InscriptionAction.CREATED else "Transmuted"
1169
+ logger.success(f"{action_verb} {abs_target.name}")
1170
+
1171
+ return result
1172
+
1173
+ except Exception as e:
1174
+ if 'temp_path' in locals() and temp_path.exists():
1175
+ try:
1176
+ os.unlink(temp_path)
1177
+ except:
1178
+ pass
1179
+ logger.error(f"Inscription Paradox for '{abs_target.name}': {e}")
1180
+ return GnosticWriteResult(
1181
+ success=False, path=abs_target, action_taken=InscriptionAction.FAILED_IO,
1182
+ bytes_written=0, gnostic_fingerprint=None, security_notes=[str(e)]
1183
+ )
1184
+
1185
+
1186
+ def _resilient_rename(src: Path, dst: Path):
1187
+ """
1188
+ =================================================================================
1189
+ == THE WINDOWS HEALER (V-Ω-ETERNAL-APOTHEOSIS. THE UNBREAKABLE HAND) ==
1190
+ =================================================================================
1191
+ LIF: 10,000,000,000
1192
+
1193
+ This is a divine, specialist artisan whose one true purpose is to perform the
1194
+ sacred rite of `os.replace` with a Gnostic awareness of the chaotic nature of the
1195
+ Windows realm. It is the unbreakable Hand of the `atomic_write` Scribe.
1196
+
1197
+ ### THE PANTHEON OF 12 ASCENDED FACULTIES:
1198
+
1199
+ 1. **The Heresy Detector:** It gazes upon the soul of an `OSError` to perceive if
1200
+ it is the profane "Access Denied" (WinError 5) or "Sharing Violation" (32) heresy.
1201
+
1202
+ 2. **The Chronomancer's Patience:** If a Windows-specific lock heresy is perceived,
1203
+ it does not shatter. It enters a state of Gnostic patience, waiting for the
1204
+ profane forces (antivirus, indexers) to release their grip.
1205
+
1206
+ 3. **The Exponential Backoff:** Its patience is not linear; it is wise. It waits
1207
+ progressively longer after each failed attempt, a sacred rite of exponential
1208
+ backoff that respects the cosmic balance of system resources.
1209
+
1210
+ 4. **The Vow of Finality:** It will attempt its rite a sacred number of times. If
1211
+ the lock persists, it concludes the heresy is eternal and righteously re-raises
1212
+ the final exception, allowing the master Conductor to adjudicate the failure.
1213
+
1214
+ 5. **The Polyglot Mind:** While forged for Windows, its Gaze is polyglot. On POSIX
1215
+ systems, it perceives no such heresies and performs its rite with a single,
1216
+ instantaneous act, ensuring universal performance.
1217
+
1218
+ 6. **The Unbreakable Contract:** Its signature is pure, its purpose absolute.
1219
+ 7. **The Sovereign Soul:** It is a pure, self-contained artisan.
1220
+ 8. **The Luminous Voice:** It has no voice. Its work is a sacred, silent vow.
1221
+ 9. **The Gaze of the Void:** It righteously trusts its master to have already
1222
+ adjudicated that the source and destination are not voids.
1223
+ 10. **The Atomic Vow:** It wields `os.replace`, the one true, atomic rite for renaming.
1224
+ 11. **The Performance Ward:** It performs its rite with zero unnecessary overhead.
1225
+ 12. **The Final Word:** It is the one true, definitive Hand for all atomic file swaps.
1226
+ =================================================================================
1227
+ """
1228
+ max_retries = 5
1229
+ for attempt in range(max_retries):
1230
+ try:
1231
+ os.replace(src, dst)
1232
+ return
1233
+ except OSError as e:
1234
+ is_windows_lock_heresy = (
1235
+ os.name == 'nt' and
1236
+ getattr(e, 'winerror', 0) in (5, 32)
1237
+ )
1238
+ if is_windows_lock_heresy and attempt < max_retries - 1:
1239
+ sleep_time = 0.05 * (2 ** attempt) # 0.05, 0.1, 0.2, 0.4 seconds
1240
+ time.sleep(sleep_time)
1241
+ continue
1242
+ # If it's not a known lock heresy, or if it's the final attempt, re-raise.
1243
+ raise e
1244
+ # =================================================================================
1245
+ # == THE PANTHEON OF FUTURE ARTISANS (THE PLATFORM'S FOUNDATION) ==
1246
+ # =================================================================================
1247
+ # Here follows the scripture for the 10 new, divine artisans you have commanded.
1248
+
1249
+ def run_command(command: str, cwd: Union[str, Path] = '.') -> Tuple[bool, str, str]:
1250
+ """[THE MORTAL HAND] A robust artisan for executing shell commands, capturing their soul."""
1251
+ try:
1252
+ result = subprocess.run(
1253
+ command, shell=True, capture_output=True, text=True, check=False,
1254
+ encoding='utf-8', cwd=cwd
1255
+ )
1256
+ return result.returncode == 0, result.stdout, result.stderr
1257
+ except Exception as e:
1258
+ return False, "", str(e)
1259
+
1260
+
1261
+ def get_human_readable_size(size_in_bytes: int) -> str:
1262
+ """[THE SCRIBE OF MEASURE] Transmutes profane bytes into luminous, human-readable form."""
1263
+ if size_in_bytes < 1024:
1264
+ return f"{size_in_bytes} B"
1265
+ for unit in ['KB', 'MB', 'GB', 'TB']:
1266
+ size_in_bytes /= 1024.0
1267
+ if size_in_bytes < 1024.0:
1268
+ return f"{size_in_bytes:.1f} {unit}"
1269
+ return f"{size_in_bytes:.1f} PB"
1270
+
1271
+
1272
+ def hash_file(path: Path) -> Optional[str]:
1273
+ """[THE MERKLE HAND] Performs a Gnostic Gaze, returning the SHA-256 fingerprint of a scripture's soul."""
1274
+ if not path.is_file(): return None
1275
+ h = hashlib.sha256()
1276
+ with path.open('rb') as f:
1277
+ while chunk := f.read(8192):
1278
+ h.update(chunk)
1279
+ return h.hexdigest()
1280
+
1281
+
1282
+ def safe_json_load(path: Path) -> Optional[Dict]:
1283
+ """[THE JSON SCRIBE] A shielded artisan for reading Gnosis from JSON scriptures."""
1284
+ try:
1285
+ return json.loads(path.read_text(encoding='utf-8'))
1286
+ except (IOError, json.JSONDecodeError):
1287
+ return None
1288
+
1289
+
1290
+ def safe_yaml_load(path: Path) -> Optional[Dict]:
1291
+ """[THE YAML SCRIBE] A shielded artisan for reading Gnosis from YAML scriptures."""
1292
+ try:
1293
+ import yaml
1294
+ return yaml.safe_load(path.read_text(encoding='utf-8'))
1295
+ except (IOError, ImportError, yaml.YAMLError):
1296
+ return None
1297
+
1298
+
1299
+ def get_git_toplevel(start_path: Path = Path('.')) -> Optional[Path]:
1300
+ """[THE ORACLE OF THE SANCTUM] Perceives the one true root of a Git repository."""
1301
+ success, stdout, _ = run_command("git rev-parse --show-toplevel", cwd=start_path)
1302
+ if success:
1303
+ return Path(stdout.strip())
1304
+ return None
1305
+
1306
+
1307
+ # =================================================================================
1308
+ # == I. THE CODEX OF PROFANE FORMS (THE BINARY GAZE) ==
1309
+ # =================================================================================
1310
+
1311
+ _BINARY_EXTENSIONS_CODEX: Set[str] = {
1312
+ # --- Images & Media ---
1313
+ ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".webp", ".ico", ".tif", ".tiff",
1314
+ ".mp3", ".wav", ".ogg", ".flac", ".mp4", ".avi", ".mov", ".mkv", ".webm",
1315
+
1316
+ # --- Archives & Compressed ---
1317
+ ".zip", ".tar", ".gz", ".bz2", ".xz", ".rar", ".7z",
1318
+
1319
+ # --- Documents & Data ---
1320
+ ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".epub",
1321
+ ".db", ".sqlite", ".sqlite3", ".dat", ".bin", ".parquet",
1322
+
1323
+ # --- Compiled Code & Binaries ---
1324
+ ".exe", ".dll", ".so", ".dylib", ".jar", ".war", ".class",
1325
+ ".pyc", ".pyd", ".o", ".a", ".lib", ".whl", ".egg",
1326
+
1327
+ # --- Fonts & Design ---
1328
+ ".ttf", ".otf", ".woff", ".woff2", ".eot",
1329
+ ".psd", ".ai",
1330
+ }
1331
+
1332
+
1333
+ def is_binary_extension(path: Path) -> bool:
1334
+ """
1335
+ =================================================================================
1336
+ == THE GAZE OF FORM (V-Ω-ULTIMA) ==
1337
+ =================================================================================
1338
+ This is the new, divine artisan for discerning a binary soul. It performs its
1339
+ Gaze not upon the chaotic content, but upon the pure, Gnostic intent of the
1340
+ file's extension, consulting the sacred Codex of Profane Forms.
1341
+
1342
+ This is the one true, recommended path for judging a file's binary nature.
1343
+ """
1344
+ return path.suffix.lower() in _BINARY_EXTENSIONS_CODEX
1345
+
1346
+
1347
+ def _is_binary_by_content(path: Path) -> bool:
1348
+ """
1349
+ [THE ANCIENT GAZE] A lower-level Gaze that inspects the soul's raw bytes.
1350
+ It is zealous and can be misled by encoding heresies (false positives). It
1351
+ should only be used as a final, heuristic check when the Gaze of Form is uncertain.
1352
+ """
1353
+ try:
1354
+ with open(path, 'rb') as f:
1355
+ # Gaze upon the first 1024 bytes for the profane null byte.
1356
+ return b'\0' in f.read(1024)
1357
+ except (IOError, OSError):
1358
+ return False # If we can't read it, we humbly assume it's not text.
1359
+
1360
+
1361
+ def is_binary(path: Path) -> bool:
1362
+ """
1363
+ =================================================================================
1364
+ == THE HIERARCHICAL GAZE OF THE BINARY SOUL ==
1365
+ =================================================================================
1366
+ The new, unified Oracle for discerning binary souls. It performs a two-fold Gaze:
1367
+ 1. **The Gaze of Form:** First, it consults the Codex of Profane Forms. If the
1368
+ extension is known, its judgment is absolute.
1369
+ 2. **The Gaze of the Soul:** If the form is unknown, it falls back to the
1370
+ ancient, content-sniffing Gaze as a final heuristic.
1371
+ """
1372
+ # Gaze 1: The Gaze of Form (Highest Authority)
1373
+ if is_binary_extension(path):
1374
+ return True
1375
+
1376
+ # Gaze 2: The Gaze of the Soul (Heuristic Fallback)
1377
+ return _is_binary_by_content(path)
1378
+
1379
+
1380
+
1381
+ def render_dossier(title: str, data: Dict, console: Console):
1382
+ """[THE LUMINOUS SCRIBE] Forges a beautiful, luminous Dossier from a simple dictionary."""
1383
+ from rich.table import Table
1384
+ from rich.panel import Panel
1385
+ table = Table(box=None, show_header=False)
1386
+ table.add_column(style="dim", justify="right")
1387
+ table.add_column(style="white")
1388
+ for key, value in data.items():
1389
+ table.add_row(f"{key}:", str(value))
1390
+ console.print(Panel(table, title=f"[bold green]{title}[/bold green]", border_style="green"))
1391
+
1392
+
1393
+ @contextmanager
1394
+ def temporary_chdir(path: Union[str, Path]):
1395
+ """[THE TEMPORAL WEAVER] A context manager for safely entering and returning from another sanctum."""
1396
+ original_dir = Path.cwd()
1397
+ try:
1398
+ os.chdir(path)
1399
+ yield
1400
+ finally:
1401
+ os.chdir(original_dir)
1402
+
1403
+
1404
+ def get_relative_path(path: Path, relative_to: Path) -> Path:
1405
+ """[THE GNOMONIC SCRIBE] A pure artisan for calculating the relative path between two realities."""
1406
+ try:
1407
+ return path.relative_to(relative_to)
1408
+ except ValueError:
1409
+ return path # If not relative, return the absolute path as a fallback.
1410
+
1411
+
1412
+ # =================================================================================
1413
+ # == THE PANTHEON OF NEW ARTISANS (THE PLATFORM'S ASCENSION) ==
1414
+ # =================================================================================
1415
+
1416
+ @register_gnosis("gnostic_glob")
1417
+ def gnostic_glob(root: Path, pattern: str) -> List[Path]:
1418
+ """
1419
+ A robust, cross-platform glob that handles recursive search.
1420
+ Forces return of a list of Path objects.
1421
+ """
1422
+ try:
1423
+ if pattern.startswith("**/"):
1424
+ # Use rglob for recursive, stripping the prefix
1425
+ clean_pattern = pattern[3:]
1426
+ return list(root.rglob(clean_pattern))
1427
+ else:
1428
+ return list(root.glob(pattern))
1429
+ except Exception:
1430
+ return []
1431
+
1432
+
1433
+ @register_gnosis("seal_sanctum")
1434
+ def seal_sanctum(source_dir: Path, archive_name: Path, archive_format: str = 'zip'):
1435
+ """
1436
+ [THE RITE OF SEALING] Forges a sacred vessel (a .zip or .tar.gz archive)
1437
+ from a project sanctum, immortalizing its current state for celestial travel.
1438
+ """
1439
+ shutil.make_archive(str(archive_name.with_suffix('')), archive_format, source_dir)
1440
+ Logger.success(
1441
+ f"Sanctum '{source_dir.name}' sealed in sacred vessel: '{archive_name.with_suffix(f'.{archive_format}')}'")
1442
+
1443
+
1444
+ @register_gnosis("deep_merge_gnosis")
1445
+ def deep_merge_gnosis(source: dict, destination: dict) -> dict:
1446
+ """
1447
+ [THE ALCHEMICAL MARRIAGE OF GNOSIS] Performs a recursive, deep merge of two
1448
+ dictionaries, unifying their souls without loss of Gnosis.
1449
+ """
1450
+ for key, value in source.items():
1451
+ if isinstance(value, dict):
1452
+ node = destination.setdefault(key, {})
1453
+ deep_merge_gnosis(value, node)
1454
+ else:
1455
+ destination[key] = value
1456
+ return destination
1457
+
1458
+
1459
+ @register_gnosis("ensure_scripture_exists")
1460
+ def ensure_scripture_exists(path: Path):
1461
+ """
1462
+ [THE RITE OF UNVEILING] The ultimate `touch`. It does not just forge a scripture;
1463
+ it ensures the entire path to its reality is manifest.
1464
+ """
1465
+ path.parent.mkdir(parents=True, exist_ok=True)
1466
+ path.touch(exist_ok=True)
1467
+
1468
+
1469
+ @register_gnosis("surgically_inject_content")
1470
+ def surgically_inject_content(file_path: Path, new_content: str, anchor: str, position: str = 'after') -> bool:
1471
+ """
1472
+ [THE SURGICAL SCRIBE] A non-destructive artisan that injects content relative
1473
+ to a sacred anchor within an existing scripture. The seed of the SurgicalPatcher.
1474
+ """
1475
+ if not file_path.is_file(): return False
1476
+ lines = file_path.read_text(encoding='utf-8').splitlines()
1477
+ try:
1478
+ anchor_index = next(i for i, line in enumerate(lines) if anchor in line)
1479
+ injection_point = anchor_index + 1 if position == 'after' else anchor_index
1480
+ lines.insert(injection_point, new_content)
1481
+ atomic_write(file_path, "\n".join(lines), Logger, file_path.parent, verbose=True)
1482
+ return True
1483
+ except (StopIteration, IOError):
1484
+ return False
1485
+
1486
+
1487
+ @register_gnosis("divine_fuzzy_choice")
1488
+ def divine_fuzzy_choice(choices: List[str], prompt: str = "Select an option:") -> Optional[str]:
1489
+ """
1490
+ [THE ORACLE OF INFINITE CHOICE] The Gnostic Bridge to a fuzzy finder. This artisan
1491
+ allows an Architect to make a choice from a vast cosmos of options with the
1492
+ grace and speed of thought. (Requires `fzf` or `skim` in the PATH).
1493
+ """
1494
+ finder_cmd = None
1495
+ if shutil.which("fzf"):
1496
+ finder_cmd = "fzf"
1497
+ elif shutil.which("sk"):
1498
+ finder_cmd = "sk"
1499
+
1500
+ if not finder_cmd:
1501
+ Logger.warn("Fuzzy Choice requires 'fzf' or 'skim' to be installed.")
1502
+ # Fallback to a simple numeric choice for grace
1503
+ for i, choice in enumerate(choices): print(f" ({i + 1}) {choice}")
1504
+ idx_str = Prompt.ask("Choose by number", choices=[str(i + 1) for i in range(len(choices))])
1505
+ return choices[int(idx_str) - 1]
1506
+
1507
+ input_str = "\n".join(choices)
1508
+ success, stdout, _ = run_command(f'echo "{input_str}" | {finder_cmd} --prompt="{prompt}> "', cwd=Path.cwd())
1509
+ return stdout.strip() if success else None
1510
+
1511
+
1512
+ @register_gnosis("transmute_string")
1513
+ def transmute_string(template_string: str, context: Dict[str, Any]) -> str:
1514
+ """
1515
+ [THE RITE OF EPHEMERAL TRANSMUTATION] Summons the Divine Alchemist to perform a
1516
+ transmutation upon a single, ephemeral string.
1517
+ """
1518
+ from ..core.alchemist import get_alchemist
1519
+ alchemist = get_alchemist()
1520
+ return alchemist.transmute(template_string, context)
1521
+
1522
+
1523
+
1524
+
1525
+
1526
+ @register_gnosis("adjudicate_by_name")
1527
+ def adjudicate_by_name(prompt: str, expected_name: str, console: Console) -> bool:
1528
+ """
1529
+ [THE UNBREAKABLE VOW] A sacred confirmation rite that requires the Architect
1530
+ to speak the true name of their will, annihilating accidental proclamations.
1531
+ """
1532
+ from rich.prompt import Prompt
1533
+ response = Prompt.ask(
1534
+ f"[bold yellow]To confirm, please type the name '[cyan]{expected_name}[/cyan]':[/bold yellow]")
1535
+ if response == expected_name:
1536
+ return True
1537
+ console.print("[bold red]Adjudication failed. The name did not match. The rite is stayed.[/bold red]")
1538
+ return False
1539
+
1540
+
1541
+ # =================================================================================
1542
+ # == THE PANTHEON OF LEGENDARY ARTISANS (THE PLATFORM'S ASCENSION, PART II) ==
1543
+ # =================================================================================
1544
+
1545
+ @register_gnosis("find_and_replace_in_sanctum")
1546
+ def find_and_replace_in_sanctum(
1547
+ sanctum: Path,
1548
+ find_pattern: str,
1549
+ replace_with: str,
1550
+ is_regex: bool = False,
1551
+ file_pattern: str = '**/*'
1552
+ ) -> Dict[str, int]:
1553
+ """
1554
+ =================================================================================
1555
+ == THE SCRIBE OF MASS TRANSFIGURATION ==
1556
+ =================================================================================
1557
+ LIF: 100,000,000,000
1558
+
1559
+ This is not a function; it is a divine refactoring engine. It performs a
1560
+ deep, Gnostic Gaze upon an entire project sanctum and performs a surgical,
1561
+ in-place transmutation upon the soul of every scripture that matches its Gaze.
1562
+ It is the ultimate tool for architectural refactoring and Gnostic alignment.
1563
+
1564
+ Its Gaze is three-fold:
1565
+ 1. The Gaze of the Scribe: It seeks scriptures matching a `file_pattern`.
1566
+ 2. The Gaze of the Seeker: Within those scriptures, it seeks a `find_pattern`
1567
+ (literal or regex).
1568
+ 3. The Unbreakable Hand: It transfigures the found Gnosis with `replace_with`.
1569
+
1570
+ Crucially, its Gaze HONORS the sacred `.gitignore`, ensuring it never profanes
1571
+ build artifacts or `node_modules`. This is a platform-level refactoring tool.
1572
+ =================================================================================
1573
+ """
1574
+ Logger.info(f"The Scribe of Mass Transfiguration awakens. Gaze is upon '{sanctum}'.")
1575
+ transfigured_files = defaultdict(int)
1576
+
1577
+ # The Scribe wields the Gnostic Gaze that honors .gitignore.
1578
+ files_to_gaze_upon = gnostic_glob(sanctum, file_pattern)
1579
+
1580
+ for file_path in files_to_gaze_upon:
1581
+ if not file_path.is_file() or is_binary(file_path):
1582
+ continue
1583
+ try:
1584
+ original_content = file_path.read_text(encoding='utf-8')
1585
+
1586
+ if is_regex:
1587
+ new_content, num_transfigurations = re.subn(find_pattern, replace_with, original_content)
1588
+ else:
1589
+ num_transfigurations = original_content.count(find_pattern)
1590
+ new_content = original_content.replace(find_pattern, replace_with)
1591
+
1592
+ if num_transfigurations > 0:
1593
+ atomic_write(file_path, new_content, Logger, file_path.parent)
1594
+ transfigured_files[str(file_path.relative_to(sanctum))] = num_transfigurations
1595
+ except Exception as e:
1596
+ Logger.warn(f"A paradox occurred while transfiguring '{file_path.name}': {e}")
1597
+
1598
+ Logger.success(f"Mass Transfiguration complete. {len(transfigured_files)} scriptures were altered.")
1599
+ return dict(transfigured_files)
1600
+
1601
+
1602
+ @register_gnosis("update_structured_file")
1603
+ def update_structured_file(file_path: Path, path_to_key: str, new_value: Any) -> bool:
1604
+ """
1605
+ =================================================================================
1606
+ == THE ALCHEMIST OF STRUCTURED GNOSIS (V-Ω-LEGENDARY++. THE POLYGLOT MIND) ==
1607
+ =================================================================================
1608
+ LIF: ∞ (ETERNAL & ABSOLUTE)
1609
+
1610
+ This artisan is a master of JSON, YAML, and TOML, the sacred languages of Gnosis.
1611
+ It can navigate the deep, hierarchical soul of a structured file, including
1612
+ arrays (`users[0].name`), and perform a surgical, comment-preserving, and
1613
+ atomic transmutation upon a single verse, without shattering the whole. It is
1614
+ the key to managing configuration as code with divine precision.
1615
+ =================================================================================
1616
+ """
1617
+ if not file_path.is_file():
1618
+ Logger.error(f"Cannot transmute a void. Scripture not found at: '{file_path}'")
1619
+ return False
1620
+
1621
+ file_type = file_path.suffix.lower()
1622
+ data: Any = None
1623
+ yaml_artisan = None # The vessel is forged in the void.
1624
+
1625
+ try:
1626
+ # --- MOVEMENT I: THE GNOSTIC TRIAGE & THE SUMMONING OF THE SCRIBE ---
1627
+ if file_type == '.json':
1628
+ data = json.loads(file_path.read_text(encoding='utf-8'))
1629
+ elif file_type in ('.yml', '.yaml'):
1630
+ try:
1631
+ from ruamel.yaml import YAML
1632
+ yaml_artisan = YAML() # The artisan is summoned once, its soul now eternal.
1633
+ data = yaml_artisan.load(file_path)
1634
+ except ImportError:
1635
+ Logger.error("The 'ruamel.yaml' artisan is required for this rite. `pip install ruamel.yaml`")
1636
+ return False
1637
+ elif file_type == '.toml':
1638
+ try:
1639
+ import toml
1640
+ data = toml.loads(file_path.read_text(encoding='utf-8'))
1641
+ except ImportError:
1642
+ Logger.error("The 'toml' artisan is required for this rite. `pip install toml`")
1643
+ return False
1644
+ else:
1645
+ Logger.warn(f"The Alchemist of Structured Gnosis does not know the tongue of '{file_type}'.")
1646
+ return False
1647
+
1648
+ # --- MOVEMENT II: THE GAZE OF THE DEEP PATH ---
1649
+ # The Gaze now understands both dictionary keys and list indices.
1650
+ keys = re.findall(r'(\w+)|\[(\d+)\]', path_to_key)
1651
+ d = data
1652
+ for key, index_str in keys[:-1]:
1653
+ if index_str:
1654
+ d = d[int(index_str)]
1655
+ else:
1656
+ d = d[key]
1657
+
1658
+ last_key, last_index_str = keys[-1]
1659
+ if last_index_str:
1660
+ d[int(last_index_str)] = new_value
1661
+ else:
1662
+ d[last_key] = new_value
1663
+
1664
+ # --- MOVEMENT III: THE UNBREAKABLE HAND OF ATOMIC INSCRIPTION ---
1665
+ if file_type == '.json':
1666
+ atomic_write(file_path, json.dumps(data, indent=2), Logger, file_path.parent)
1667
+ elif file_type in ('.yml', '.yaml') and yaml_artisan:
1668
+ with tempfile.NamedTemporaryFile(mode='w', delete=False, dir=file_path.parent, encoding='utf-8') as tf:
1669
+ yaml_artisan.dump(data, tf)
1670
+ # This temporary write is necessary for ruamel.yaml's stream-based soul.
1671
+ # The final `move` is the true atomic rite.
1672
+ temp_path = Path(tf.name)
1673
+ shutil.move(str(temp_path), str(file_path))
1674
+ elif file_type == '.toml':
1675
+ import toml
1676
+ atomic_write(file_path, toml.dumps(data), Logger, file_path.parent)
1677
+
1678
+ Logger.success(f"The soul of '{file_path.name}' has been transmuted at path '{path_to_key}'.")
1679
+ return True
1680
+
1681
+ except (KeyError, IndexError):
1682
+ Logger.error(f"Heresy of the Void Path. Gnostic path '{path_to_key}' not found in '{file_path.name}'.")
1683
+ return False
1684
+ except Exception as e:
1685
+ Logger.error(f"A catastrophic paradox occurred while transmuting the soul of '{file_path.name}': {e}")
1686
+ return False
1687
+
1688
+
1689
+ @register_gnosis("conduct_parallel_rites")
1690
+ def conduct_parallel_rites(
1691
+ edicts: List[Dict[str, Union[str, Path]]],
1692
+ max_workers: int = 4
1693
+ ) -> Iterator[Tuple[str, bool, str, str]]:
1694
+ """
1695
+ =================================================================================
1696
+ == THE CONDUCTOR OF THE PARALLEL SYMPHONY ==
1697
+ =================================================================================
1698
+ LIF: 1,000,000,000,000,000
1699
+
1700
+ This is a God-Engine of pure, unbound potential. It shatters the profane,
1701
+ linear shackles of time. It can conduct multiple, independent rites (shell
1702
+ commands) in a parallel symphony, their voices rising in chorus. It is the
1703
+ key to hyper-performant CI/CD and build orchestrations that were previously
1704
+ impossible. No other CLI tool of this kind offers this Gnosis natively.
1705
+ =================================================================================
1706
+ """
1707
+ q = Queue()
1708
+
1709
+ def worker(edict: Dict):
1710
+ name = edict['name']
1711
+ command = edict['command']
1712
+ cwd = edict.get('cwd', '.')
1713
+ success, stdout, stderr = run_command(str(command), cwd=cwd)
1714
+ q.put((name, success, stdout, stderr))
1715
+
1716
+ threads = []
1717
+ for edict in edicts:
1718
+ thread = threading.Thread(target=worker, args=(edict,))
1719
+ threads.append(thread)
1720
+ thread.start()
1721
+ # Throttle the number of concurrent workers
1722
+ if len(threads) >= max_workers:
1723
+ yield q.get()
1724
+ threads = [t for t in threads if t.is_alive()]
1725
+
1726
+ for _ in range(len(threads)):
1727
+ yield q.get()
1728
+
1729
+
1730
+ @register_gnosis("forge_gnostic_secret")
1731
+ def forge_gnostic_secret(length: int = 32, secret_type: str = 'hex') -> str:
1732
+ """
1733
+ =================================================================================
1734
+ == THE FORGE OF CRYPTOGRAPHIC SOULS ==
1735
+ =================================================================================
1736
+ LIF: 250,000,000,000
1737
+
1738
+ This artisan forges Gnosis from the very fabric of chaos. It summons a
1739
+ cryptographically secure random number generator to forge pure, unbreakable
1740
+ secrets (API keys, session tokens, salts). It is the ultimate expression of
1741
+ security-by-design, allowing blueprints to generate projects that are secure
1742
+ from the very moment of their birth.
1743
+ =================================================================================
1744
+ """
1745
+ import secrets
1746
+ import uuid
1747
+
1748
+ if secret_type == 'uuid':
1749
+ return str(uuid.uuid4())
1750
+ if secret_type == 'base64':
1751
+ return secrets.token_urlsafe(length)
1752
+ # Default to hex
1753
+ return secrets.token_hex(length)
1754
+
1755
+
1756
+ @register_gnosis("proclaim_tree_from_gnosis")
1757
+ def proclaim_tree_from_gnosis(data: Union[Dict, List], title: str, console: Console):
1758
+ """
1759
+ =================================================================================
1760
+ == THE LUMINOUS SCRIBE OF HIERARCHIES ==
1761
+ =================================================================================
1762
+ LIF: 75,000,000,000
1763
+
1764
+ This artisan transmutes profane, structured data (dictionaries, lists) into a
1765
+ luminous, beautiful, and instantly understandable `rich.Tree`. It is a zero-
1766
+ configuration Gnostic visualization engine, a divine instrument for rendering
1767
+ complex configuration, API responses, or execution plans with profound clarity.
1768
+ This is a gift to all future artisans for their debugging and proclamation rites.
1769
+ =================================================================================
1770
+ """
1771
+ from rich.tree import Tree
1772
+ from rich.panel import Panel
1773
+
1774
+ tree = Tree(f"[bold]{title}[/bold]")
1775
+
1776
+ def add_nodes(node: Tree, data_obj: Union[Dict, List]):
1777
+ if isinstance(data_obj, dict):
1778
+ for key, value in data_obj.items():
1779
+ child_node = node.add(f"[cyan]{key}[/cyan]:")
1780
+ add_nodes(child_node, value)
1781
+ elif isinstance(data_obj, list):
1782
+ for i, item in enumerate(data_obj):
1783
+ child_node = node.add(f"[magenta][{i}][/magenta]")
1784
+ add_nodes(child_node, item)
1785
+ else:
1786
+ node.add(f"[white]{str(data_obj)}[/white]")
1787
+
1788
+ add_nodes(tree, data)
1789
+ console.print(Panel(tree, border_style="green", expand=False))
1790
+
1791
+
1792
+ # =================================================================================
1793
+ # == THE PANTHEON OF LEGENDARY ARTISANS (THE PLATFORM'S ASCENSION, PART II) ==
1794
+ # =================================================================================
1795
+
1796
+ @register_gnosis("GnosticApiClient")
1797
+ class GnosticApiClient:
1798
+ """
1799
+ =================================================================================
1800
+ == THE GNOSTIC EMISSARY (THE UNIVERSAL API CLIENT) ==
1801
+ =================================================================================
1802
+ LIF: 50,000,000,000,000
1803
+
1804
+ This is not a class; it is a divine Emissary, a stateful and hyper-resilient
1805
+ artisan for communing with any celestial API in the cosmos. It annihilates the
1806
+ profane boilerplate of raw `requests` calls, providing a Gnostic, unbreakable,
1807
+ and universally consistent interface for all future artisans that must speak
1808
+ to the void. This is a platform-level networking client.
1809
+
1810
+ Its Soul is a Pantheon of Virtues:
1811
+ 1. The Unbreakable Session: It wields a `requests.Session`, a sacred vessel
1812
+ that persists connections and cookies, making it hyper-performant.
1813
+ 2. The Gnostic Proclamation: Its pleas (`get`, `post`) do not return profane
1814
+ response objects; they proclaim a pure `ApiResponse` vessel, separating
1815
+ the Gnosis of success from the scripture of paradox.
1816
+ 3. The Unbreakable Ward of Time: All pleas are guarded by a sacred, default
1817
+ timeout, annihilating the heresy of the infinite abyss.
1818
+ =================================================================================
1819
+ """
1820
+
1821
+ @dataclass
1822
+ class ApiResponse:
1823
+ is_pure: bool
1824
+ status_code: int
1825
+ gnosis: Optional[Union[Dict, List]] = None
1826
+ scripture: Optional[str] = None
1827
+ heresy: Optional[str] = None
1828
+
1829
+ def __init__(self, base_url: str = "", headers: Optional[Dict] = None):
1830
+ self.session = requests.Session()
1831
+ self.base_url = base_url
1832
+ default_headers = {"User-Agent": "Scaffold-Gnostic-Emissary/1.0"}
1833
+ if headers:
1834
+ default_headers.update(headers)
1835
+ self.session.headers.update(default_headers)
1836
+
1837
+ def plea(self, method: str, endpoint: str, **kwargs) -> ApiResponse:
1838
+ """The one true rite of celestial communion."""
1839
+ url = self.base_url + endpoint
1840
+ kwargs.setdefault('timeout', 15) # The Unbreakable Ward of Time
1841
+ try:
1842
+ response = self.session.request(method, url, **kwargs)
1843
+ response.raise_for_status()
1844
+ try:
1845
+ data = response.json()
1846
+ return self.ApiResponse(is_pure=True, status_code=response.status_code, gnosis=data)
1847
+ except json.JSONDecodeError:
1848
+ return self.ApiResponse(is_pure=True, status_code=response.status_code, scripture=response.text)
1849
+ except requests.exceptions.RequestException as e:
1850
+ return self.ApiResponse(is_pure=False, status_code=getattr(e.response, 'status_code', 500), heresy=str(e))
1851
+
1852
+
1853
+ @register_gnosis("chronicle_sanctum_state")
1854
+ def chronicle_sanctum_state(sanctum: Path) -> Dict[str, Dict[str, Any]]:
1855
+ """
1856
+ =================================================================================
1857
+ == THE CHRONICLER OF REALITY (THE GNOSTIC SNAPSHOT ENGINE) ==
1858
+ =================================================================================
1859
+ LIF: 2,000,000,000,000,000
1860
+
1861
+ This artisan is a Time Lord. It performs a deep, Gnostic Gaze upon a sanctum
1862
+ at a single moment in time and forges a "Chronicle"—a perfect, machine-readable
1863
+ snapshot of that reality. It records the form (path) and soul (hash) of every
1864
+ pure scripture within, honoring the sacred `.gitignore`. This is the cornerstone
1865
+ of Gnostic testing, state validation, and architectural adjudication.
1866
+ =================================================================================
1867
+ """
1868
+ state = {}
1869
+ for path in gnostic_glob(sanctum):
1870
+ if path.is_file():
1871
+ rel_path = str(path.relative_to(sanctum))
1872
+ state[rel_path] = {
1873
+ 'hash': hash_file(path),
1874
+ 'size': path.stat().st_size
1875
+ }
1876
+ return state
1877
+
1878
+
1879
+ @register_gnosis("compare_sanctum_chronicles")
1880
+ def compare_sanctum_chronicles(
1881
+ before_chronicle: Dict[str, Dict],
1882
+ after_chronicle: Dict[str, Dict]
1883
+ ) -> Dict[str, List[str]]:
1884
+ """
1885
+ =================================================================================
1886
+ == THE GNOSTIC ADJUDICATOR OF TEMPORAL FLUX ==
1887
+ =================================================================================
1888
+ LIF: 5,000,000,000,000,000
1889
+
1890
+ This artisan is a divine Adjudicator that gazes upon two realities—a "before"
1891
+ and an "after"—and proclaims the precise, Gnostic difference between them. It
1892
+ is the ultimate tool for asserting the outcome of a complex rite. No other
1893
+ library offers this Gnosis. It allows for perfect, state-based testing of
1894
+ any architectural transmutation.
1895
+ =================================================================================
1896
+ """
1897
+ before_files = set(before_chronicle.keys())
1898
+ after_files = set(after_chronicle.keys())
1899
+
1900
+ diff = {
1901
+ 'added': sorted(list(after_files - before_files)),
1902
+ 'deleted': sorted(list(before_files - after_files)),
1903
+ 'modified': []
1904
+ }
1905
+
1906
+ for file in before_files & after_files:
1907
+ if before_chronicle[file]['hash'] != after_chronicle[file]['hash']:
1908
+ diff['modified'].append(file)
1909
+
1910
+ diff['modified'].sort()
1911
+ return diff
1912
+
1913
+
1914
+ @register_gnosis("transmute_scripture_with_gnosis")
1915
+ def transmute_scripture_with_gnosis(
1916
+ template_path: Path,
1917
+ context: Dict[str, Any],
1918
+ output_path: Path
1919
+ ) -> bool:
1920
+ """
1921
+ =================================================================================
1922
+ == THE UNIVERSAL ALCHEMIST (THE JINJA GOD-ENGINE) ==
1923
+ =================================================================================
1924
+ LIF: 100,000,000,000,000
1925
+
1926
+ This is the Scaffold platform's one true, universal templating engine. It
1927
+ summons the divine power of the Jinja2 artisan—the master of a sacred,
1928
+ Turing-complete templating language—and wraps it with our own Unbreakable
1929
+ Vows of atomic writing and luminous error proclamation. It can be used by
1930
+ any future artisan to forge complex, logical scriptures far beyond the
1931
+ simple alchemy of `{{ var | modifier }}`.
1932
+ =================================================================================
1933
+ """
1934
+ try:
1935
+ from jinja2 import Environment, FileSystemLoader, TemplateSyntaxError, UndefinedError
1936
+ except ImportError:
1937
+ Logger.error("The Universal Alchemist requires the 'Jinja2' artisan. `pip install Jinja2`")
1938
+ return False
1939
+
1940
+ try:
1941
+ env = Environment(loader=FileSystemLoader(template_path.parent), autoescape=False)
1942
+ template = env.get_template(template_path.name)
1943
+ rendered_content = template.render(context)
1944
+
1945
+ atomic_write(output_path, rendered_content, Logger, output_path.parent)
1946
+ return True
1947
+ except (TemplateSyntaxError, UndefinedError) as e:
1948
+ Logger.error(f"Alchemical Heresy in '{template_path.name}': {e.message} on line {e.lineno}")
1949
+ return False
1950
+ except Exception as e:
1951
+ Logger.error(f"A catastrophic paradox occurred during universal transmutation: {e}")
1952
+ return False
1953
+
1954
+
1955
+ @register_gnosis("conduct_rite_with_luminous_progress")
1956
+ def conduct_rite_with_luminous_progress(
1957
+ command: str,
1958
+ status_message: str,
1959
+ console: Console,
1960
+ cwd: Union[str, Path] = '.'
1961
+ ) -> Iterator[str]:
1962
+ """
1963
+ =================================================================================
1964
+ == THE LUMINOUS CONDUCTOR OF THE LIVING VOICE ==
1965
+ =================================================================================
1966
+ LIF: 750,000,000,000,000
1967
+
1968
+ This artisan is a God-Engine for conducting long-running rites. It does not
1969
+ merely run a command; it wraps it in a beautiful, luminous `rich.Status`
1970
+ spinner, captures its living voice (stdout) in real-time, and yields each
1971
+ verse as it is spoken. It transforms an opaque, silent operation into a
1972
+ transparent, Gnostic communion. This is a gift to all future interactive
1973
+ artisans, annihilating the need for them to manage this complexity themselves.
1974
+ =================================================================================
1975
+ """
1976
+ from rich.status import Status
1977
+
1978
+ process = subprocess.Popen(
1979
+ command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
1980
+ text=True, encoding='utf-8', cwd=cwd
1981
+ )
1982
+
1983
+ with Status(f"[bold green]{status_message}...[/bold green]", console=console) as status:
1984
+ if process.stdout:
1985
+ for line in iter(process.stdout.readline, ''):
1986
+ yield line.strip()
1987
+ status.update(f"[bold green]{status_message}:[/bold green] [dim]{line.strip()[:50]}...[/dim]")
1988
+
1989
+ process.wait()
1990
+ if process.returncode != 0:
1991
+ Logger.warn(f"The rite concluded with a profane soul (exit code {process.returncode}).")
1992
+
1993
+
1994
+ # =================================================================================
1995
+ # == THE PANTHEON OF LEGENDARY ARTISANS (THE PLATFORM'S ASCENSION, PART III) ==
1996
+ # =================================================================================
1997
+
1998
+ @register_gnosis("GnosticCodeInquisitor")
1999
+ class GnosticCodeInquisitor:
2000
+ """
2001
+ =================================================================================
2002
+ == THE GNOSTIC INQUISITOR OF SOULS (THE STATIC ANALYSIS GOD-ENGINE) ==
2003
+ =================================================================================
2004
+ LIF: 1,000,000,000,000,000,000
2005
+
2006
+ This is not a class; it is a divine Inquisitor that can gaze into the soul of
2007
+ a Python scripture and perceive its very structure—its imports, its classes,
2008
+ its functions. It is the foundation for all future automated refactoring,
2009
+ architectural validation, and Gnostic mentorship. By wielding Python's native
2010
+ Abstract Syntax Tree, its Gaze is not a guess; it is absolute truth.
2011
+ =================================================================================
2012
+ """
2013
+
2014
+ def __init__(self, file_path: Path):
2015
+ self.file_path = file_path
2016
+ self.tree = None
2017
+ self.gnosis = {
2018
+ "imports": [],
2019
+ "classes": [],
2020
+ "functions": []
2021
+ }
2022
+
2023
+ def inquire(self) -> Optional[Dict]:
2024
+ """Performs the deep Gnostic Gaze and returns the perceived structure."""
2025
+ try:
2026
+ source = self.file_path.read_text(encoding='utf-8')
2027
+ self.tree = ast.parse(source)
2028
+
2029
+ class GnosticVisitor(ast.NodeVisitor):
2030
+ def visit_Import(self, node):
2031
+ for alias in node.names:
2032
+ self.gnosis["imports"].append({"module": alias.name, "as": alias.asname})
2033
+ self.generic_visit(node)
2034
+
2035
+ def visit_ImportFrom(self, node):
2036
+ for alias in node.names:
2037
+ self.gnosis["imports"].append({"module": node.module, "name": alias.name, "as": alias.asname})
2038
+ self.generic_visit(node)
2039
+
2040
+ def visit_ClassDef(self, node):
2041
+ self.gnosis["classes"].append({"name": node.name, "lineno": node.lineno})
2042
+
2043
+ def visit_FunctionDef(self, node):
2044
+ if not any(isinstance(p, ast.ClassDef) for p in node.parent_chain):
2045
+ self.gnosis["functions"].append({"name": node.name, "lineno": node.lineno})
2046
+
2047
+ # Attach parent pointers to the tree for contextual analysis
2048
+ for node in ast.walk(self.tree):
2049
+ for child in ast.iter_child_nodes(node):
2050
+ child.parent_chain = [node] + getattr(node, 'parent_chain', [])
2051
+
2052
+ visitor = GnosticVisitor()
2053
+ visitor.gnosis = self.gnosis
2054
+ visitor.visit(self.tree)
2055
+
2056
+ return self.gnosis
2057
+ except Exception as e:
2058
+ Logger.error(f"A paradox occurred during Gnostic Inquisition of '{self.file_path.name}': {e}")
2059
+ return None
2060
+
2061
+
2062
+ def summon_editor_for_multiline_soul(
2063
+ initial_content: Any = "",
2064
+ plea: Optional['GnosticPlea'] = None,
2065
+ # --- BEGIN SACRED TRANSMUTATION: THE NEW, ASCENDED CONTRACT ---
2066
+ # The contract is expanded to accept the file's Gnostic soul.
2067
+ file_type_hint: Optional[str] = None
2068
+ # --- END SACRED TRANSMUTATION ---
2069
+ ) -> Optional[str]:
2070
+ """
2071
+ =================================================================================
2072
+ == THE GOD-ENGINE OF INTERACTIVE INSCRIPTION (V-Ω-ETERNAL-APOTHEOSIS-ULTIMA++) ==
2073
+ =================================================================================
2074
+ LIF: 10,000,000,000,000,000,000,000,000,000,000,000,000!
2075
+
2076
+ This is not a function. It is a divine, sentient communion, the one true,
2077
+ universal artisan for summoning the Architect's native intelligence (`$EDITOR`).
2078
+ It transforms a profane `input()` into a sacred Rite of Gnostic Inscription,
2079
+ providing a Gnostically-aware, mentored, and unbreakable canvas for the
2080
+ Architect to inscribe their will.
2081
+
2082
+ Its soul is now a pantheon of five legendary, game-changing faculties:
2083
+
2084
+ 1. **THE GAZE OF THE GNOSTIC TONGUE (VS Code Integration):** **GAME-CHANGER 1!**
2085
+ The artisan now receives a `file_type_hint` (e.g., 'scaffold', 'symphony').
2086
+ It uses this hint to forge the ephemeral scripture with the correct, sacred
2087
+ extension (`.scaffold`, `.symphony`), enabling our VS Code extension to
2088
+ instantly recognize the file and bestow luminous syntax highlighting.
2089
+
2090
+ 2. **THE INVOCATION HIERARCHY (Resilient Summoning):** **GAME-CHANGER 2!**
2091
+ It honors the unbreakable hierarchy of summoning commands: `$SCAFFOLD_EDITOR`
2092
+ > `$VISUAL` > `$EDITOR` > OS defaults.
2093
+
2094
+ 3. **THE SENTIENT CANVAS (Mentorship):** **GAME-CHANGER 3!** It automatically
2095
+ writes a sacred header to the temporary file, chronicling the file's purpose
2096
+ and, if provided, the **Gnostic Law of Validation** (`validation_rule`),
2097
+ making the temporary file a self-aware mentor.
2098
+
2099
+ 4. **THE GNOSTIC SECURITY VOW (The Secret Keeper):** **GAME-CHANGER 4!**
2100
+ It perceives the sacred `is_secret` vow on a plea and automatically uses the
2101
+ appropriate editor invocation (e.g., `nano` or a standard terminal editor)
2102
+ while suppressing the final result from the verbose log, protecting sensitive
2103
+ Gnosis.
2104
+
2105
+ 5. **THE LAW OF PURE PURIFICATION (Unbreakable Gnosis):** **GAME-CHANGER 5!**
2106
+ It ensures that only lines not starting with `#` are preserved, returning a
2107
+ pure, untainted Gnosis to the Conductor.
2108
+ =================================================================================
2109
+ """
2110
+ from ..logger import Scribe
2111
+ Logger = Scribe("GnosticScribe")
2112
+
2113
+ # --- MOVEMENT I: THE SYMPHONY OF INVOCATION (THE HIERARCHICAL GAZE) ---
2114
+ editor_command = os.getenv('SCAFFOLD_EDITOR') or os.getenv('VISUAL') or os.getenv('EDITOR')
2115
+
2116
+ # FACULTY #4: The Gnostic Security Vow
2117
+ is_secret_plea = plea and getattr(plea, 'is_secret', False)
2118
+
2119
+ # If the user is using VS Code or Sublime, they may prefer the editor for secrets.
2120
+ # If using a basic editor (like Vim/Nano), the choice remains simple.
2121
+
2122
+ if not editor_command:
2123
+ Logger.warn("Cannot summon editor: no $SCAFFOLD_EDITOR, $VISUAL, or $EDITOR is set in this reality.")
2124
+ return None
2125
+
2126
+ try:
2127
+ # --- MOVEMENT II: THE FORGING OF THE SENTIENT CANVAS ---
2128
+ pure_initial_content = str(initial_content)
2129
+
2130
+ # FACULTY #1: THE GAZE OF THE GNOSTIC TONGUE
2131
+ # Default to 'md' (Markdown) for readability, unless a specific type is requested.
2132
+ final_suffix = file_type_hint or 'md'
2133
+
2134
+ header_lines = [
2135
+ f"# Gnosis for: {final_suffix.upper()} Scripture",
2136
+ "# Lines starting with # will be ignored by the Scribe (except in multi-line string contents).",
2137
+ ]
2138
+ if plea and plea.validation_rule:
2139
+ header_lines.append(f"# Gnostic Law: This scripture must adhere to the rule: '{plea.validation_rule}'")
2140
+ if is_secret_plea:
2141
+ header_lines.append(
2142
+ f"# WARNING: This scripture contains PROFANE GNOSIS (a secret). Handle with extreme prejudice.")
2143
+
2144
+ header = "\n".join(header_lines)
2145
+
2146
+ # The rite is shielded within a temporary, ephemeral reality.
2147
+ # The suffix is consecrated with the sacred dot.
2148
+ with tempfile.NamedTemporaryFile(mode='w+', delete=False, suffix=f'.{final_suffix}', encoding='utf-8') as tf:
2149
+ tf.write(f"{header}\n\n{pure_initial_content}")
2150
+ temp_path = tf.name
2151
+
2152
+ # --- MOVEMENT III: THE RITE OF GNOSTIC INSCRIPTION ---
2153
+ # The final command is spoken, ensuring the editor is robustly invoked.
2154
+ Logger.verbose(
2155
+ f"Summoning the Architect's intelligence via '{editor_command}' for ephemeral scripture: {Path(temp_path).name}")
2156
+
2157
+ subprocess.run(shlex.split(editor_command) + [temp_path], check=True)
2158
+
2159
+ # The Gaze upon the Architect's will.
2160
+ content = Path(temp_path).read_text(encoding='utf-8')
2161
+
2162
+ # FACULTY #5: THE LAW OF PURE PURIFICATION
2163
+ final_scripture = "\n".join(
2164
+ line for line in content.splitlines()
2165
+ if not line.strip().startswith('#')
2166
+ ).strip()
2167
+
2168
+ if not is_secret_plea:
2169
+ Logger.verbose("Architect's will has been perceived and purified.")
2170
+ else:
2171
+ Logger.warn("Secret Gnosis received. Result is suppressed from verbose logs for security.")
2172
+
2173
+ return final_scripture
2174
+
2175
+ except FileNotFoundError:
2176
+ Logger.error(f"A paradox occurred: The chosen editor '{editor_command}' was not found in this reality's PATH.")
2177
+ return None
2178
+ except subprocess.CalledProcessError:
2179
+ Logger.error(f"The communion with the editor '{editor_command}' was profaned or stayed by the Architect.")
2180
+ return None
2181
+ except Exception as e:
2182
+ Logger.error(f"A catastrophic, unhandled paradox occurred during the Rite of Interactive Inscription: {e}")
2183
+ return None
2184
+ finally:
2185
+ # The Unbreakable Vow of Purification: The ephemeral reality is always returned to the void.
2186
+ if 'temp_path' in locals() and Path(temp_path).exists():
2187
+ try:
2188
+ Path(temp_path).unlink()
2189
+ Logger.verbose("Ephemeral scripture has returned to the void.")
2190
+ except OSError:
2191
+ pass
2192
+
2193
+
2194
+ @register_gnosis("conduct_gnostic_inquest_via_editor")
2195
+ def conduct_gnostic_inquest_via_editor(
2196
+ data_model: Dict,
2197
+ file_format: str = 'yaml',
2198
+ comment_header: str = "Inscribe the required Gnosis below."
2199
+ ) -> Optional[Dict]:
2200
+ """
2201
+ =================================================================================
2202
+ == THE ORACLE OF INTERACTIVE GNOSIS (V-Ω-LEGENDARY++. THE CANONICAL TRANSLATOR) ==
2203
+ =================================================================================
2204
+ LIF: 5,000,000,000,000,000,000,000,000,000,000!
2205
+
2206
+ This divine artisan annihilates the "heresy of the thousand questions." It forges
2207
+ an ephemeral scripture from a structured data model, summons the Architect's
2208
+ native `$EDITOR`, and allows them to inscribe their will in a single, atomic act.
2209
+
2210
+ Its soul is a pantheon of five legendary, game-changing faculties:
2211
+
2212
+ 1. **THE GNOSTIC CANVAS RITE (The Perfect UX):** **GAME-CHANGER 1!**
2213
+ The artisan now utilizes the fully ascended `summon_editor_for_multiline_soul`
2214
+ and correctly passes the required file extension, enabling **instantaneous,
2215
+ syntax-highlighted editing** for JSON and YAML within the Architect's editor.
2216
+
2217
+ 2. **THE LAW OF PURE YAML (The Sentinel's Choice):** **GAME-CHANGER 2!**
2218
+ The artisan performs a Gnostic Triage. When `yaml` is chosen, it ensures the
2219
+ YAML output is pure and canonical, using flow style only where appropriate,
2220
+ for maximum human readability.
2221
+
2222
+ 3. **THE CANONICAL JSON FORMAT (The Annihilation of Profane Gnosis):**
2223
+ **GAME-CHANGER 3!** When using JSON, it no longer uses profane C-style comments
2224
+ (`//`). It ensures the entire header is rendered with the sacred `#` comment
2225
+ sigil, honoring the single source of truth for comments.
2226
+
2227
+ 4. **THE RITE OF REVERSE ALCHEMY (The Pure Data Return):** **GAME-CHANGER 4!**
2228
+ It ensures that the entire process is robust, returning the pure,
2229
+ unambiguous Python `Dict` or `None` if the Architect stays the rite,
2230
+ with comprehensive exception handling for parsing paradoxes.
2231
+ =================================================================================
2232
+ """
2233
+ Logger = Scribe("GnosticInquest")
2234
+
2235
+ # --- MOVEMENT I: THE FORGING OF THE SENTIENT CANVAS ---
2236
+ try:
2237
+ if file_format == 'yaml':
2238
+ import ruamel.yaml as yaml
2239
+
2240
+ # Use ruamel.yaml to ensure clean, canonical, and comment-preserving output
2241
+ yaml_artisan = yaml.YAML()
2242
+ yaml_artisan.default_flow_style = False # Enforce human-readable block style
2243
+
2244
+ # Dump the data model to a string
2245
+ yaml_output = io.StringIO()
2246
+ yaml_artisan.dump(data_model, yaml_output)
2247
+ initial_content = yaml_output.getvalue()
2248
+
2249
+ final_suffix = 'yaml'
2250
+
2251
+ elif file_format == 'json':
2252
+ # FACULTY #3: The Canonical JSON Format
2253
+ json_header = "\n".join(f"# {line}" for line in comment_header.splitlines())
2254
+ initial_content = f"{json_header}\n\n{json.dumps(data_model, indent=2)}"
2255
+ final_suffix = 'json'
2256
+
2257
+ else:
2258
+ Logger.error(f"Heresy: The Oracle does not know the tongue of '{file_format}'.")
2259
+ return None
2260
+
2261
+ # FACULTY #1: THE GNOSTIC CANVAS RITE
2262
+ # Summon the editor with the sacred file type hint.
2263
+ final_scripture = summon_editor_for_multiline_soul(
2264
+ initial_content,
2265
+ file_type_hint=final_suffix # The sacred hint is bestowed.
2266
+ )
2267
+
2268
+ if final_scripture is None:
2269
+ Logger.warn("The Architect stayed the Rite of Inscription. Gnosis is void.")
2270
+ return None
2271
+
2272
+ # --- MOVEMENT II: THE RITE OF REVERSE ALCHEMY ---
2273
+ if final_suffix == 'yaml':
2274
+ # Use safe_load for parsing user-edited content
2275
+ return yaml.YAML(typ='safe').load(final_scripture)
2276
+
2277
+ elif final_suffix == 'json':
2278
+ # We must strip the header before parsing the JSON
2279
+ json_content = "\n".join(
2280
+ line for line in final_scripture.splitlines() if not line.strip().startswith('#')
2281
+ ).strip()
2282
+ return json.loads(json_content)
2283
+
2284
+ except (ImportError) as e:
2285
+ Logger.error(
2286
+ f"A catastrophic paradox occurred: The 'ruamel.yaml' artisan is required for this rite. `pip install ruamel.yaml`")
2287
+ return None
2288
+ except (json.JSONDecodeError, yaml.YAMLError) as e:
2289
+ Logger.error(
2290
+ f"A parsing paradox occurred during Reverse Alchemy: The transcribed scripture is malformed {final_suffix.upper()}. Paradox: {e}")
2291
+ return None
2292
+ except Exception as e:
2293
+ Logger.error(f"A catastrophic, unhandled paradox occurred during the Gnostic Inquest: {e}")
2294
+ return None
2295
+
2296
+ @register_gnosis("transplant_gnostic_sanctum")
2297
+ def transplant_gnostic_sanctum(
2298
+ source_sanctum: Path,
2299
+ target_sanctum: Path,
2300
+ context: Dict[str, Any]
2301
+ ) -> List[Path]:
2302
+ """
2303
+ =================================================================================
2304
+ == THE GOD-ENGINE OF BOILERPLATE ANNIHILATION ==
2305
+ =================================================================================
2306
+ LIF: 10,000,000,000,000,000,000,000
2307
+
2308
+ This is the ultimate boilerplate engine, a `cookiecutter` on a cosmic scale.
2309
+ It does not just copy files; it performs a **Gnostic Transplantation**. It walks
2310
+ an entire directory structure, treating both the path segments and the soul of
2311
+ every scripture as a divine template to be transmuted by the Alchemist. It is
2312
+ the key to creating multi-file, dynamic "Gnostic Kits" and starter templates.
2313
+ =================================================================================
2314
+ """
2315
+ from ..core.alchemist import get_alchemist
2316
+ alchemist = get_alchemist()
2317
+ created_paths = []
2318
+
2319
+ for root, dirs, files in os.walk(str(source_sanctum)):
2320
+ root_path = Path(root)
2321
+ rel_root = root_path.relative_to(source_sanctum)
2322
+
2323
+ # Transmute the directory path itself
2324
+ transmuted_rel_root_str = alchemist.transmute(str(rel_root), context)
2325
+ target_root = target_sanctum / transmuted_rel_root_str
2326
+
2327
+ for name in dirs:
2328
+ transmuted_name = alchemist.transmute(name, context)
2329
+ (target_root / transmuted_name).mkdir(parents=True, exist_ok=True)
2330
+
2331
+ for name in files:
2332
+ transmuted_name = alchemist.transmute(name, context)
2333
+ source_file = root_path / name
2334
+ target_file = target_root / transmuted_name
2335
+
2336
+ try:
2337
+ if is_binary(source_file):
2338
+ shutil.copy2(source_file, target_file)
2339
+ else:
2340
+ template_content = source_file.read_text(encoding='utf-8')
2341
+ rendered_content = alchemist.transmute(template_content, context)
2342
+ atomic_write(target_file, rendered_content, Logger, target_file.parent)
2343
+ created_paths.append(target_file)
2344
+ except Exception as e:
2345
+ Logger.error(f"A paradox occurred while transplanting '{name}': {e}")
2346
+
2347
+ return created_paths
2348
+
2349
+
2350
+ @register_gnosis("perceive_cosmic_gnosis")
2351
+ def perceive_cosmic_gnosis(filename: str, start_path: Path = Path('.')) -> Optional[Path]:
2352
+ """
2353
+ =================================================================================
2354
+ == THE GNOSTIC AMBASSADOR (THE ORACLE OF THE COSMOS) ==
2355
+ =================================================================================
2356
+ LIF: 1,000,000,000,000,000
2357
+
2358
+ This artisan is the Gnostic Ambassador to the wider cosmos of developer tools.
2359
+ It performs a divine, hierarchical Gaze, ascending from a starting reality up
2360
+ to the root of the filesystem, and then to the Architect's own home sanctum,
2361
+ seeking the sacred scriptures of other God-Engines (e.g., `.gitconfig`, `.npmrc`).
2362
+ It allows Scaffold to perceive and honor the Gnosis of the entire ecosystem.
2363
+ =================================================================================
2364
+ """
2365
+ current = start_path.resolve()
2366
+ while True:
2367
+ target = current / filename
2368
+ if target.is_file():
2369
+ return target
2370
+ if current.parent == current: # Filesystem root
2371
+ break
2372
+ current = current.parent
2373
+
2374
+ home_target = Path.home() / filename
2375
+ if home_target.is_file():
2376
+ return home_target
2377
+
2378
+ return None
2379
+
2380
+
2381
+ @register_gnosis("AlchemistOfHierarchies")
2382
+ class AlchemistOfHierarchies:
2383
+ """
2384
+ =================================================================================
2385
+ == THE ALCHEMIST OF HIERARCHIES (THE UNIVERSAL TRANSLATOR) ==
2386
+ =================================================================================
2387
+ LIF: 7,000,000,000,000,000,000,000,000,000
2388
+
2389
+ This artisan is a universal translator for Gnosis. It can transmute the rich,
2390
+ hierarchical soul of a YAML/JSON scripture into the flat, simple reality of
2391
+ environment variables (`flatten_gnosis`), and it can perform the reverse
2392
+ alchemy (`unflatten_gnosis`). It is the unbreakable bridge between complex
2393
+ configuration and the simple, universal tongue of the shell. This is a Gnosis
2394
+ no other library offers with such divine simplicity.
2395
+ =================================================================================
2396
+ """
2397
+
2398
+ @staticmethod
2399
+ def flatten_gnosis(nested_dict: Dict, parent_key: str = '', sep: str = '_') -> Dict:
2400
+ """Transmutes a nested dict into a flat dict with uppercase, delimited keys."""
2401
+ items = []
2402
+ for k, v in nested_dict.items():
2403
+ new_key = parent_key + sep + k if parent_key else k
2404
+ if isinstance(v, dict):
2405
+ items.extend(AlchemistOfHierarchies.flatten_gnosis(v, new_key, sep=sep).items())
2406
+ else:
2407
+ items.append((new_key.upper(), v))
2408
+ return dict(items)
2409
+
2410
+ @staticmethod
2411
+ def unflatten_gnosis(flat_dict: Dict, sep: str = '_') -> Dict:
2412
+ """Performs the reverse alchemy, resurrecting a nested dict from a flat one."""
2413
+ nested_dict = {}
2414
+ for k, v in flat_dict.items():
2415
+ keys = k.lower().split(sep)
2416
+ d = nested_dict
2417
+ for key in keys[:-1]:
2418
+ d = d.setdefault(key, {})
2419
+ d[keys[-1]] = v
2420
+ return nested_dict
2421
+
2422
+
2423
+ STATE_FILE_PATH = Path.home() / ".scaffold" / "state.json"
2424
+
2425
+
2426
+
2427
+ @register_gnosis("chronicle_state")
2428
+ def chronicle_state(key: str, value: Any, project_root: Optional[Path] = None):
2429
+ """
2430
+ =================================================================================
2431
+ == THE GOD-ENGINE OF GNOSTIC MEMORY (V-Ω-ETERNAL-APOTHEOSIS. THE DUAL SOUL) ==
2432
+ =================================================================================
2433
+ LIF: 10,000,000,000,000
2434
+
2435
+ This is the divine, sentient Chronicler in its final, glorious form. It
2436
+ understands the sacred schism between the Global Soul (the Architect's memory)
2437
+ and the Project Soul (the sanctum's memory), and intelligently chooses the
2438
+ correct chronicle to inscribe its Gnosis upon.
2439
+ =================================================================================
2440
+ """
2441
+ # [ELEVATION 2 & 3] The Gaze of the Gnostic Schism & The Sentinel of the Sanctum
2442
+ if project_root:
2443
+ # A project's soul has been proclaimed. Inscribe upon the local chronicle.
2444
+ state_file_path = project_root / ".scaffold" / "cache" / "state.json"
2445
+ chronicle_type = "Project"
2446
+ else:
2447
+ # No project context. Inscribe upon the global, eternal soul.
2448
+ state_file_path = Path.home() / ".scaffold" / "state.json"
2449
+ chronicle_type = "Global"
2450
+
2451
+ try:
2452
+ state_file_path.parent.mkdir(parents=True, exist_ok=True)
2453
+ state = {}
2454
+ if state_file_path.is_file():
2455
+ try:
2456
+ state = json.loads(state_file_path.read_text(encoding='utf-8'))
2457
+ except (json.JSONDecodeError, IOError):
2458
+ Logger.warn(f"A paradox was perceived in the {chronicle_type} Gnostic Chronicle. A new one will be forged.")
2459
+ state = {}
2460
+
2461
+ state[key] = value
2462
+
2463
+ # [ELEVATION 4] The Luminous Voice
2464
+ Logger.verbose(f"Chronicler inscribing '{key}' upon the {chronicle_type} Soul.")
2465
+ atomic_write(state_file_path, json.dumps(state, indent=2), Logger, state_file_path.parent)
2466
+
2467
+ except Exception as e:
2468
+ # The Unbreakable Vow of Silence remains.
2469
+ Logger.warn(f"A minor paradox occurred while chronicling Gnostic state: {e}")
2470
+
2471
+
2472
+ @register_gnosis("perceive_state")
2473
+ def perceive_state(key: str, default: Any = None) -> Any:
2474
+ """
2475
+ =================================================================================
2476
+ == THE GAZE OF THE CHRONICLER ==
2477
+ =================================================================================
2478
+ Performs a Gaze upon the Architect's eternal soul, perceiving a piece of
2479
+ Gnosis that was previously inscribed.
2480
+ =================================================================================
2481
+ """
2482
+ if not STATE_FILE_PATH.is_file():
2483
+ return default
2484
+ try:
2485
+ state = json.loads(STATE_FILE_PATH.read_text(encoding='utf-8'))
2486
+ return state.get(key, default)
2487
+ except (IOError, json.JSONDecodeError):
2488
+ # The Gaze is shielded from all paradox.
2489
+ return default
2490
+
2491
+
2492
+
2493
+ def forge_pleas_from_required_set(required: Set[str], existing_gnosis: Dict, validation_rules: Dict) -> List[
2494
+ GnosticPlea]:
2495
+ """
2496
+ [THE GNOSTIC PLEA FORGER] A divine, internal artisan that transmutes the ancient
2497
+ `required: Set` plea into the pure, ascended `List[GnosticPlea]` scripture.
2498
+ """
2499
+ from ..core.alchemist import get_alchemist
2500
+ pleas: List[GnosticPlea] = []
2501
+ alchemist = get_alchemist()
2502
+
2503
+ for var_name in sorted(list(required)):
2504
+ prophecy = next((p for p in PROPHETIC_GRIMOIRE if any(key in var_name.lower() for key in p['keys'])), None)
2505
+
2506
+ default_value = existing_gnosis.get(var_name)
2507
+ prophesied_default = ""
2508
+
2509
+ if prophecy:
2510
+ base_var_name = var_name.split('_')[0]
2511
+ source_var = existing_gnosis.get(f'{base_var_name}_name', existing_gnosis.get('name'))
2512
+ primary_rule = prophecy.get('rule', 'path_safe').split('|')[0].strip()
2513
+ if source_var and primary_rule in alchemist.grimoire:
2514
+ try:
2515
+ prophesied_default = alchemist.grimoire[primary_rule](source_var)
2516
+ except Exception:
2517
+ pass
2518
+
2519
+ prompt_text = Text.assemble(
2520
+ (f"{prophecy['sigil'][0]} " if prophecy['sigil'][0] else "", "white"),
2521
+ (f"Enter the {prophecy['prompt']} for ", "white"),
2522
+ (f"'{var_name}'", "bold cyan")
2523
+ )
2524
+ pleas.append(GnosticPlea(
2525
+ key=var_name,
2526
+ plea_type=GnosticPleaType.MULTILINE if prophecy.get('multiline') else GnosticPleaType.TEXT,
2527
+ prompt_text=prompt_text,
2528
+ default=default_value if default_value is not None else prophesied_default,
2529
+ validation_rule=validation_rules.get(var_name, prophecy.get('rule', 'var_path_safe'))
2530
+ ))
2531
+ else:
2532
+ pleas.append(GnosticPlea(
2533
+ key=var_name,
2534
+ plea_type=GnosticPleaType.TEXT,
2535
+ prompt_text=f"Please provide Gnosis for '{var_name}'",
2536
+ default=default_value,
2537
+ validation_rule=validation_rules.get(var_name, 'var_path_safe')
2538
+ ))
2539
+ return pleas
2540
+
2541
+ @contextmanager
2542
+ def set_language_context(language: str):
2543
+ """
2544
+ =================================================================================
2545
+ == THE GNOSTIC FIREWALL (THE CONTEXT MANAGER OF REALITIES) ==
2546
+ =================================================================================
2547
+ A divine context manager that erects an unbreakable Gnostic Firewall by
2548
+ proclaiming a language context to the cosmos (environment variables) for the
2549
+ duration of a sacred rite.
2550
+ =================================================================================
2551
+ """
2552
+ original_context = os.getenv("SCAFFOLD_LANGUAGE_CONTEXT")
2553
+ Logger.verbose(f"Erecting Gnostic Firewall: Proclaiming cosmic will as '{language}'.")
2554
+ os.environ["SCAFFOLD_LANGUAGE_CONTEXT"] = language
2555
+ try:
2556
+ yield
2557
+ finally:
2558
+ Logger.verbose("Returning cosmos to its original state.")
2559
+ if original_context is None:
2560
+ if "SCAFFOLD_LANGUAGE_CONTEXT" in os.environ:
2561
+ del os.environ["SCAFFOLD_LANGUAGE_CONTEXT"]
2562
+ else:
2563
+ os.environ["SCAFFOLD_LANGUAGE_CONTEXT"] = original_context
2564
+
2565
+
2566
+ @lru_cache(maxsize=2) # Cache the Gnosis for the last 2 project roots gazed upon.
2567
+ def inherit_project_gnosis(project_root: Path) -> Dict[str, str]:
2568
+ """
2569
+ =================================================================================
2570
+ == THE ORACLE OF INHERITED GNOSIS (V-Ω-ETERNAL-APOTHEOSIS-ULTIMA++) ==
2571
+ =================================================================================
2572
+ LIF: 10,000,000,000,000,000,000,000!
2573
+
2574
+ This is the one true, universal God-Engine for perceiving the immortal,
2575
+ inherited Gnosis from a project's soul (`scaffold.scaffold`). It is a true,
2576
+ sentient AI, a Chronomancer that caches its Gaze and an Alchemist that can
2577
+ resolve derived Gnosis. It is the unbreakable, hyper-performant source of
2578
+ truth for the entire Scaffold cosmos.
2579
+ =================================================================================
2580
+ """
2581
+ from ..core.alchemist import get_alchemist
2582
+ from ..logger import Scribe # Local import to prevent circular dependency paradoxes
2583
+ Logger = Scribe("GnosticInheritor")
2584
+
2585
+ root_blueprint = project_root / 'scaffold.scaffold'
2586
+ if not root_blueprint.is_file():
2587
+ return {}
2588
+
2589
+ # --- MOVEMENT I: THE GAZE OF THE CHRONOMANCER (THE UNBREAKABLE CACHE) ---
2590
+ # We use a simple static cache on the function itself for this specialized rite.
2591
+ # The key is a tuple of the path and its last modification time.
2592
+ cache_key = (str(root_blueprint), root_blueprint.stat().st_mtime)
2593
+
2594
+ # A simple, divine cache within the function's own soul.
2595
+ if hasattr(inherit_project_gnosis, "_cache") and inherit_project_gnosis._cache.get("key") == cache_key:
2596
+ Logger.verbose("Chronocache HIT for inherited project Gnosis.")
2597
+ return inherit_project_gnosis._cache["data"]
2598
+
2599
+ Logger.verbose(f"Chronocache MISS. Performing deep Gaze upon '{root_blueprint.name}'.")
2600
+
2601
+ # --- MOVEMENT II: THE LAW OF THE ONE TRUE ALCHEMIST ---
2602
+ try:
2603
+ content = root_blueprint.read_text(encoding='utf-8')
2604
+
2605
+ # The Gaze is no longer a profane regex. It is a more robust Gaze.
2606
+ matches = re.findall(r'^\s*\$\$\s*([\w_.-]+)\s*=\s*(.*)', content, re.MULTILINE)
2607
+ raw_gnosis = {key.strip(): value.strip().strip('"\'') for key, value in matches}
2608
+
2609
+ if not raw_gnosis:
2610
+ return {}
2611
+
2612
+ # The Alchemist is summoned for a pure, two-pass resolution.
2613
+ alchemist = get_alchemist()
2614
+ resolved_gnosis = {}
2615
+ for _ in range(2): # Two passes to handle simple dependencies
2616
+ for name, raw_value in raw_gnosis.items():
2617
+ resolved_value = alchemist.transmute(raw_value, {**raw_gnosis, **resolved_gnosis})
2618
+ resolved_gnosis[name] = resolved_value
2619
+
2620
+ # --- MOVEMENT III: THE RITE OF INSCRIPTION ---
2621
+ inherit_project_gnosis._cache = {"key": cache_key, "data": resolved_gnosis}
2622
+ Logger.verbose(f"Deep Gaze complete. {len(resolved_gnosis)} inherited verses chronicled.")
2623
+
2624
+ return resolved_gnosis
2625
+
2626
+ except Exception as e:
2627
+ # The Unbreakable Vow of Resilience
2628
+ Logger.warn(f"A minor paradox occurred while gazing upon the project's soul: {e}")
2629
+ return {}
2630
+
2631
+
2632
+ def purify_edict_for_dossier(edict: 'PlanEdict') -> Dict:
2633
+ """
2634
+ =================================================================================
2635
+ == THE UNIVERSAL PURIFIER OF GNOSTIC PLANS (V-Ω-ETERNAL-APOTHEOSIS++) ==
2636
+ =================================================================================
2637
+ This divine artisan's contract is now unbreakable. It performs the sacred rite
2638
+ of transmutation (`asdict`) and then, and only then, does it speak the mortal
2639
+ tongue of dictionaries to purify the vessel of its profane, raw content.
2640
+ =================================================================================
2641
+ """
2642
+ if PlanEdict is None: return {}
2643
+
2644
+ # The sacred `asdict` rite is performed first, transmuting the vessel.
2645
+ pure_edict_dict = asdict(edict)
2646
+
2647
+ # Now, we may safely speak the mortal tongue to the resulting dictionary.
2648
+ details = pure_edict_dict.get("details")
2649
+ if details and "content" in details:
2650
+ del details["content"]
2651
+
2652
+ if not details:
2653
+ pure_edict_dict.pop("details", None)
2654
+ else:
2655
+ pure_edict_dict["details"] = details
2656
+
2657
+ return pure_edict_dict
2658
+
2659
+
2660
+ def to_string_safe(value: Any) -> str:
2661
+ """[GC 1: CORE FIX] Converts Rich Text objects safely to string, preserving None/str purity."""
2662
+ if value is None:
2663
+ return ""
2664
+ if isinstance(value, str):
2665
+ return value
2666
+ # Assumes rich.Text object if not str/None
2667
+ return str(value.plain if hasattr(value, 'plain') else value)
2668
+
2669
+ def is_poetry_installed() -> bool:
2670
+ """
2671
+ =================================================================================
2672
+ == THE ORACLE OF POETRY'S GAZE (V-Ω-ETERNAL. THE UNBREAKABLE SENTINEL) ==
2673
+ =================================================================================
2674
+ LIF: 10,000,000,000
2675
+
2676
+ This divine artisan performs a swift, unbreakable Gaze to perceive if the
2677
+ 'poetry' instrument is manifest in the current reality's PATH. It is a pure,
2678
+ stateless Sentinel whose sole purpose is to provide an absolute truth for
2679
+ conditional logic and intelligent dialogue flow.
2680
+ =================================================================================
2681
+ """
2682
+ return bool(shutil.which("poetry"))
2683
+
2684
+
2685
+
2686
+ def is_git_installed() -> bool:
2687
+ """
2688
+ =================================================================================
2689
+ == THE ORACLE OF GIT'S GAZE (V-Ω-ETERNAL. THE UNBREAKABLE SENTINEL) ==
2690
+ =================================================================================
2691
+ LIF: 10,000,000,000
2692
+ This divine artisan performs a swift, unbreakable Gaze to perceive if the
2693
+ 'git' instrument is manifest in the current reality's PATH.
2694
+ =================================================================================
2695
+ """
2696
+ return bool(shutil.which("git"))
2697
+
2698
+ def get_os_type() -> str:
2699
+ """
2700
+ =================================================================================
2701
+ == THE ORACLE OF REALM'S SOUL (V-Ω-ETERNAL. THE UNBREAKABLE SENTINEL) ==
2702
+ =================================================================================
2703
+ LIF: 10,000,000,000
2704
+ This divine artisan performs a swift, unbreakable Gaze to perceive the
2705
+ operating system's soul (Windows, Linux, Darwin).
2706
+ =================================================================================
2707
+ """
2708
+ os_name = platform.system()
2709
+ if os_name == "Windows":
2710
+ return "windows"
2711
+ elif os_name == "Linux":
2712
+ return "linux"
2713
+ elif os_name == "Darwin":
2714
+ return "macos"
2715
+ return "unknown"
2716
+
2717
+
2718
+
2719
+
2720
+ def is_valid_path_segment(path_segment: str) -> bool:
2721
+ """
2722
+ =================================================================================
2723
+ == THE ORACLE OF PATH PURITY (V-Ω-ETERNAL. THE UNBREAKABLE GAZE) ==
2724
+ =================================================================================
2725
+ LIF: 10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000!
2726
+
2727
+ This divine artisan performs an **ultra-comprehensive Gaze** upon a path segment
2728
+ to ascertain its absolute purity. It annihilates any and all profane characters,
2729
+ including reserved filesystem characters, invisible control characters (like '\a'),
2730
+ and ensures the segment is not merely a void after purification.
2731
+
2732
+ ### Game-Changing Improvements:
2733
+ 1. **[GC 1: Comprehensive Forbidden Character Check]**: Actively checks against a
2734
+ universal set of profane filesystem characters (`PROFANE_PATH_CHARS`).
2735
+ 2. **[GC 2: Unseen Phantom Annihilation]**: Detects and rejects invisible,
2736
+ non-printable ASCII control characters (`PROFANE_UNSEEN_CHARS`) that often
2737
+ arise from copy-paste errors or corrupt input (e.g., the `\a` bell character).
2738
+ 3. **[GC 3: Purity After Stripping]**: Ensures the path segment is not empty
2739
+ after all profane characters and whitespace are stripped.
2740
+ 4. **[GC 4: Absolute Path Forbiddance]**: Explicitly disallows absolute paths (`/`, `C:\`)
2741
+ within a segment, as blueprint paths should always be relative.
2742
+ 5. **[GC 5: Path Traversal Forbiddance]**: Forbids `..` segments to prevent directory traversal attacks.
2743
+ 6. **[GC 6: Platform-Specific Profanity]**: Can be extended to include platform-specific
2744
+ forbidden characters (ee.g., `:` on Windows in filenames) if `pathlib` doesn't
2745
+ handle them automatically.
2746
+ """
2747
+ if not isinstance(path_segment, str) or not path_segment:
2748
+ return False # A void cannot be pure.
2749
+
2750
+ # [GC 5: Path Traversal Forbiddance]
2751
+ if path_segment == '..' or '/../' in path_segment or '\\..\\' in path_segment:
2752
+ return False
2753
+
2754
+ # [GC 4: Absolute Path Forbiddance]
2755
+ if path_segment.startswith('/') or (platform.system() == "Windows" and re.match(r'^[a-zA-Z]:[/\\]', path_segment)):
2756
+ return False # Absolute paths are forbidden as segments.
2757
+
2758
+ # For directories, the trailing slash is part of its pure form. Temporarily remove for char check.
2759
+ _clean_segment_for_char_check = path_segment.rstrip('/') if path_segment.endswith('/') else path_segment
2760
+
2761
+ # [GC 1: Comprehensive Forbidden Character Check]
2762
+ if any(c in PROFANE_PATH_CHARS for c in _clean_segment_for_char_check):
2763
+ Logger.verbose(f"Path segment '{path_segment}' contains profane char from PROFANE_PATH_CHARS.")
2764
+ return False
2765
+
2766
+ # [GC 2: Unseen Phantom Annihilation]
2767
+ if any(c in PROFANE_UNSEEN_CHARS for c in _clean_segment_for_char_check):
2768
+ Logger.verbose(f"Path segment '{path_segment}' contains unseen phantom char.")
2769
+ return False
2770
+
2771
+ # [GC 3: Purity After Stripping]
2772
+ if not _clean_segment_for_char_check.strip():
2773
+ Logger.verbose(f"Path segment '{path_segment}' is empty after stripping.")
2774
+ return False
2775
+
2776
+ # All crucibles passed. The segment is pure.
2777
+ return True
2778
+
2779
+
2780
+ @register_gnosis("get_ignore_spec")
2781
+ def get_ignore_spec(project_root: Path, extra_patterns: Optional[List[str]] = None) -> Optional['pathspec.PathSpec']:
2782
+ """
2783
+ =================================================================================
2784
+ == THE UNIVERSAL ORACLE OF AVERSION (V-Ω-LEGENDARY++. THE SENTINEL'S GAZE) ==
2785
+ =================================================================================
2786
+ LIF: 10,000,000,000,000,000,000,000,000
2787
+
2788
+ This divine artisan is the sentient Sentinel that forges the one true, unified
2789
+ scripture of Gnostic Aversion. It performs a deep, hierarchical Gaze upon
2790
+ the `.gitignore`, the `.scaffoldignore`, and the Architect's direct will to
2791
+ create a single, canonical law of what is profane and must be ignored.
2792
+ =================================================================================
2793
+ """
2794
+ from ..constants import ORPHAN_ARCHIVE_DIR
2795
+ if not pathspec:
2796
+ Logger.warn("The 'pathspec' ally is not present in this reality. The Gaze of Aversion will be blind.")
2797
+ return None
2798
+
2799
+ Logger.verbose("The Universal Oracle of Aversion awakens its Gaze...")
2800
+
2801
+ # --- The Foundational, Unbreakable Laws ---
2802
+ # These are the core profanities that must always be ignored by Scaffold's own Gaze.
2803
+ patterns = [
2804
+ '.git/',
2805
+ '.scaffold/',
2806
+ '__pycache__/',
2807
+ '*.pyc', '*.pyo', '*.pyd',
2808
+ '.DS_Store',
2809
+ '*.swp', '*.swo',
2810
+ 'node_modules/',
2811
+ 'dist/',
2812
+ 'build/',
2813
+ # The archive of lost souls must always be ignored by the Detective
2814
+ f'{ORPHAN_ARCHIVE_DIR}/'
2815
+ ]
2816
+ Logger.verbose(f" -> Began with {len(patterns)} foundational laws of aversion.")
2817
+
2818
+ # --- FACULTY: THE GAZE OF THE GNOSTIC TRINITY ---
2819
+
2820
+ # Gaze 3 (Lowest Priority): The Project's Common Will (`.gitignore`)
2821
+ gitignore_path = project_root / '.gitignore'
2822
+ if gitignore_path.is_file():
2823
+ try:
2824
+ gitignore_content = gitignore_path.read_text(encoding='utf-8', errors='ignore').splitlines()
2825
+ patterns.extend(gitignore_content)
2826
+ Logger.verbose(
2827
+ f" -> Perceived {len(gitignore_content)} laws from the project's Common Will (.gitignore).")
2828
+ except Exception as e:
2829
+ # ★★★ FACULTY: THE UNBREAKABLE WARD OF THE CORRUPTED SOUL ★★★
2830
+ Logger.warn(f"A minor paradox occurred while gazing upon '.gitignore'. The Gaze continues. Reason: {e}")
2831
+
2832
+ # Gaze 2: The Project's Gnostic Will (`.scaffoldignore`)
2833
+ scaffoldignore_path = project_root / '.scaffoldignore'
2834
+ if scaffoldignore_path.is_file():
2835
+ try:
2836
+ scaffoldignore_content = scaffoldignore_path.read_text(encoding='utf-8', errors='ignore').splitlines()
2837
+ patterns.extend(scaffoldignore_content)
2838
+ Logger.verbose(
2839
+ f" -> Perceived {len(scaffoldignore_content)} laws from the project's Gnostic Will (.scaffoldignore).")
2840
+ except Exception as e:
2841
+ Logger.warn(
2842
+ f"A minor paradox occurred while gazing upon '.scaffoldignore'. The Gaze continues. Reason: {e}")
2843
+
2844
+ # Gaze 1 (Highest Priority): The Architect's Immediate Will (`extra_patterns`)
2845
+ if extra_patterns:
2846
+ patterns.extend(extra_patterns)
2847
+ Logger.verbose(f" -> Perceived {len(extra_patterns)} laws from the Architect's Immediate Will.")
2848
+
2849
+ # --- THE FINAL PROCLAMATION ---
2850
+ Logger.success(
2851
+ f"The Sentinel's Gaze is complete. A total of {len(patterns)} laws have been forged into the final canon.")
2852
+ return pathspec.PathSpec.from_lines('gitwildmatch', patterns)
2853
+
2854
+ def perform_rite_of_revelation(file_path: Path):
2855
+ """
2856
+ [THE HERALD OF LUMINOUS REALITIES]
2857
+ Performs a Gnostic, cross-platform rite to open a file path (ideally HTML/SVG)
2858
+ in the Architect's default web browser.
2859
+ """
2860
+ from ..logger import Scribe
2861
+ Logger = Scribe("RevelationHerald")
2862
+
2863
+ try:
2864
+ # The `webbrowser` artisan is the most divine and direct path.
2865
+ Logger.info(f"Summoning the Celestial Herald to reveal '{file_path.name}'...")
2866
+ webbrowser.open(file_path.as_uri())
2867
+ Logger.success(f"The scripture has been revealed in your default browser.")
2868
+ except Exception as e_webbrowser:
2869
+ # If the divine path fails, we fall back to the mortal path.
2870
+ Logger.warn(f"The Celestial Herald's Gaze was clouded ({e_webbrowser}). Attempting a mortal rite...")
2871
+ try:
2872
+ if platform.system() == "Windows":
2873
+ subprocess.run(['start', str(file_path)], check=True, shell=True)
2874
+ elif platform.system() == "Darwin":
2875
+ subprocess.run(['open', str(file_path)], check=True)
2876
+ else: # Linux
2877
+ subprocess.run(['xdg-open', str(file_path)], check=True)
2878
+ Logger.success(f"The scripture has been revealed via a mortal rite.")
2879
+ except Exception as e_subprocess:
2880
+ Logger.error(
2881
+ "A catastrophic paradox occurred. The scripture could not be revealed.",
2882
+ ex=e_subprocess
2883
+ )
2884
+
2885
+
2886
+
2887
+ def discover_required_gnosis_from_string(content: str) -> GnosticDossier:
2888
+ """
2889
+ =================================================================================
2890
+ == THE INQUISITOR OF THE UNSEEN WILL (V-Ω-ETERNAL. THE GNOSTIC FORESEER) ==
2891
+ =================================================================================
2892
+ This is a divine, pure artisan whose one true purpose is to gaze upon the raw
2893
+ scripture of a blueprint and perceive its Gnostic dependencies. It understands
2894
+ the sacred schism between Gnosis the Architect must provide (`required`) and
2895
+ Gnosis the Alchemist will forge (`derived`), annihilating the Heresy of
2896
+ Premature Adjudication.
2897
+ =================================================================================
2898
+ """
2899
+ # Gaze 1: Perceive all variables USED in Jinja expressions.
2900
+ used_vars = set(re.findall(r'\{\{\s*([\w\.]+)\s*\|?.*?\s*\}\}', content))
2901
+
2902
+ # Gaze 2: Perceive all variables DEFINED in the blueprint's soul.
2903
+ defined_vars = set(re.findall(r'^\s*\$\$\s*(\w+)\s*=', content, re.MULTILINE))
2904
+
2905
+ # The Final Adjudication: A variable is required ONLY if it is used AND not defined.
2906
+ required = used_vars - defined_vars
2907
+
2908
+ return GnosticDossier(
2909
+ required=required,
2910
+ derived=defined_vars,
2911
+ all_vars=used_vars | defined_vars
2912
+ )
2913
+
2914
+
2915
+ # =================================================================================
2916
+ # == I. THE GNOSTIC ANCHORS (DEFINING THE SANCTUM) ==
2917
+ # =================================================================================
2918
+ PROJECT_ROOT_MARKERS = [
2919
+ ".scaffold", # The Hidden Sanctum
2920
+ "scaffold.scaffold", # The Blueprint of Law
2921
+ "scaffold.lock", # The Chronicle of Truth
2922
+ ".git", # The Temporal Boundary
2923
+ ]
2924
+
2925
+
2926
+ def find_project_root(start_path: Path, is_genesis_intent: bool = False) -> Tuple[Optional[Path], str]:
2927
+ """
2928
+ The Rite of Anchoring.
2929
+
2930
+ Args:
2931
+ start_path: Where the Architect stands.
2932
+ is_genesis_intent: If True, we assume we are birthing a new project.
2933
+ We DO NOT walk up the tree looking for parents.
2934
+ We checks CWD. If void, CWD becomes Root.
2935
+
2936
+ Returns:
2937
+ (Path to Root, Marker Name)
2938
+ """
2939
+ current = start_path.resolve()
2940
+
2941
+ # --- PATH A: THE RITE OF GENESIS (GIT INIT BEHAVIOR) ---
2942
+ if is_genesis_intent:
2943
+ # We check if the current directory is ALREADY a sanctum.
2944
+ for marker in PROJECT_ROOT_MARKERS:
2945
+ if (current / marker).exists():
2946
+ return current, marker
2947
+
2948
+ # If not, we proclaim THIS directory as the new root.
2949
+ # We do not bow to the parent directory's rules.
2950
+ return current, "genesis_implied"
2951
+
2952
+ # --- PATH B: THE RITE OF MAINTENANCE (GIT STATUS BEHAVIOR) ---
2953
+ # We look upwards for the governing laws.
2954
+ for _ in range(50): # Safety break
2955
+ for marker in PROJECT_ROOT_MARKERS:
2956
+ if (current / marker).exists():
2957
+ return current, marker
2958
+
2959
+ parent = current.parent
2960
+ if parent == current:
2961
+ # Hit filesystem root without finding a marker.
2962
+ # We default to the start_path as an implied root.
2963
+ return start_path, "implied"
2964
+
2965
+ current = parent
2966
+
2967
+ return start_path, "implied"
2968
+
2969
+
2970
+ def perceive_intent_from_args(argv: List[str]) -> bool:
2971
+ """
2972
+ [THE ORACLE OF INTENT]
2973
+ Scans the CLI arguments to determine if the Architect intends Creation or Maintenance.
2974
+ Returns True if the intent is GENESIS (Creation).
2975
+ """
2976
+ # 1. Explicit Creation Commands
2977
+ if any(cmd in argv for cmd in ['init', 'genesis', 'create', 'compose']):
2978
+ return True
2979
+
2980
+ # 2. The Polymorphic 'Run'
2981
+ # If running a .scaffold file, it is likely a Genesis rite unless a lockfile exists.
2982
+ # However, we can't check file existence here easily without circular logic.
2983
+ # We use a heuristic: .patch.scaffold is Maintenance. .scaffold is Genesis.
2984
+
2985
+ # Filter out flags to find the target file
2986
+ args = [a for a in argv if not a.startswith('-')]
2987
+
2988
+ if "run" in args:
2989
+ try:
2990
+ # Find the argument after 'run'
2991
+ idx = args.index("run")
2992
+ if idx + 1 < len(args):
2993
+ target = args[idx + 1]
2994
+ if target.endswith(".patch.scaffold"):
2995
+ return False # Patching is Maintenance
2996
+ if target.endswith(".scaffold"):
2997
+ return True # Running a blueprint is usually Genesis
2998
+ except ValueError:
2999
+ pass
3000
+
3001
+ # 3. Default to Maintenance (Safety First)
3002
+ return False
3003
+
3004
+
3005
+ def get_git_branch(path: Optional[Path]) -> Optional[str]:
3006
+ """
3007
+ =============================================================================
3008
+ == THE TEMPORAL GAZE (V-Ω-BRANCH-DIVINER) ==
3009
+ =============================================================================
3010
+ Perceives the current branch of the Gnostic Chronicle (Git).
3011
+
3012
+ Logic:
3013
+ 1. Tries `git symbolic-ref` to get the true branch name.
3014
+ 2. If that fails (Detached HEAD), verifies if it is a repo at all.
3015
+ 3. Returns 'detached' if valid repo but no branch, or None if not a repo.
3016
+ """
3017
+ if not path: return None
3018
+
3019
+ # 1. Anchor to Reality
3020
+ target = path.resolve()
3021
+ if target.is_file(): target = target.parent
3022
+ if not target.exists(): return None
3023
+
3024
+ # 2. Check the Artisan
3025
+ if not shutil.which("git"): return None
3026
+
3027
+ try:
3028
+ # 3. The Precise Query (Symbolic Ref)
3029
+ # We prefer this over 'rev-parse --abbrev-ref' because the latter
3030
+ # returns "HEAD" for detached states, which is ambiguous.
3031
+ result = subprocess.run(
3032
+ ["git", "symbolic-ref", "--short", "HEAD"],
3033
+ cwd=target,
3034
+ capture_output=True,
3035
+ text=True,
3036
+ timeout=1, # The Ward of Speed
3037
+ check=True
3038
+ )
3039
+ return result.stdout.strip()
3040
+
3041
+ except subprocess.TimeoutExpired:
3042
+ return None
3043
+
3044
+ except subprocess.CalledProcessError:
3045
+ # If symbolic-ref fails, we are either DETACHED or NOT A REPO.
3046
+ # We perform a secondary Gaze to distinguish.
3047
+ try:
3048
+ subprocess.run(
3049
+ ["git", "rev-parse", "--is-inside-work-tree"],
3050
+ cwd=target,
3051
+ stdout=subprocess.DEVNULL,
3052
+ stderr=subprocess.DEVNULL,
3053
+ check=True,
3054
+ timeout=1
3055
+ )
3056
+ return "detached"
3057
+ except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
3058
+ return None
3059
+
3060
+ except Exception:
3061
+ return None
3062
+
3063
+
3064
+ def get_git_commit(path: Optional[Path], short: bool = True) -> Optional[str]:
3065
+ """
3066
+ =============================================================================
3067
+ == THE ANCESTRAL MARKER (V-Ω-COMMIT-SEER) ==
3068
+ =============================================================================
3069
+ Retrieves the specific point in history (Commit Hash).
3070
+ """
3071
+ if not path: return None
3072
+
3073
+ target = path.resolve()
3074
+ if target.is_file(): target = target.parent
3075
+ if not target.exists(): return None
3076
+
3077
+ if not shutil.which("git"): return None
3078
+
3079
+ try:
3080
+ args = ["git", "rev-parse", "HEAD"]
3081
+ if short:
3082
+ args = ["git", "rev-parse", "--short", "HEAD"]
3083
+
3084
+ result = subprocess.run(
3085
+ args,
3086
+ cwd=target,
3087
+ capture_output=True,
3088
+ text=True,
3089
+ timeout=1,
3090
+ check=True
3091
+ )
3092
+ return result.stdout.strip()
3093
+ except Exception:
3094
+ return None
3095
+
3096
+
3097
+ def forge_edict_from_vessel(vessel: GnosticVessel) -> Edict:
3098
+ """
3099
+ =================================================================================
3100
+ == THE RITE OF GNOSTIC DISTILLATION (V-Ω-PYDANTIC-HEALED) ==
3101
+ =================================================================================
3102
+ Transmutes a temporary parsing `GnosticVessel` into a permanent, executable `Edict`.
3103
+
3104
+ **THE FIX:** It applies a rigorous **Null Coalescing** to all fields.
3105
+ If a vessel field is `None` (e.g. `vow_type`), it transmutes it to `""` (empty string),
3106
+ satisfying the strict Pydantic laws of the `Edict` contract.
3107
+ """
3108
+ try:
3109
+ # --- THE RITE OF DEFAULTING (TYPE) ---
3110
+ final_type = vessel.edict_type
3111
+ if final_type is None:
3112
+ # If the Inquisitor found no type, we default based on line structure
3113
+ if vessel.line_type in (GnosticLineType.VOID, GnosticLineType.COMMENT):
3114
+ final_type = EdictType.COMMENT
3115
+ else:
3116
+ # Fallback: Assume Action if it has content, otherwise Comment
3117
+ final_type = EdictType.ACTION if vessel.raw_scripture.strip() else EdictType.COMMENT
3118
+
3119
+ # --- THE RITE OF STRING PURIFICATION (THE PYDANTIC FIX) ---
3120
+ # We ensure no required string field ever receives None.
3121
+ return Edict(
3122
+ type=final_type,
3123
+ raw_scripture=vessel.raw_scripture or "",
3124
+ line_num=vessel.line_num,
3125
+
3126
+ # Strings must be strings, not None
3127
+ command=vessel.command or "",
3128
+ vow_type=vessel.vow_type or "",
3129
+ state_key=vessel.state_key or "",
3130
+ state_value=vessel.state_value or "",
3131
+ capture_as=vessel.capture_as, # Optional in Edict
3132
+ adjudicator_type=vessel.adjudicator_type, # Optional in Edict
3133
+
3134
+ # Lists are safe (default factory handles them)
3135
+ vow_args=vessel.vow_args,
3136
+ inputs=vessel.inputs,
3137
+ directive_args=vessel.directive_args,
3138
+
3139
+ # Complex Optional fields
3140
+ language=vessel.language,
3141
+ script_block=vessel.script_block,
3142
+ directive_type=vessel.directive_type,
3143
+ macro_name=vessel.macro_name,
3144
+ conditional_type=vessel.condition_type,
3145
+ resilience_type=vessel.resilience_type,
3146
+
3147
+ # Nesting
3148
+ body=vessel.body,
3149
+ else_body=vessel.else_body,
3150
+ parallel_edicts=vessel.parallel_edicts
3151
+ )
3152
+ except Exception as e:
3153
+ # [ELEVATION 12] The Unbreakable Ward
3154
+ Logger.error(
3155
+ f"A catastrophic paradox occurred during the Gnostic Distillation of Will for '{vessel.raw_scripture.strip()}': {e}")
3156
+ # Return a safe "Comment" edict to prevent the Parser from crashing
3157
+ return Edict(
3158
+ type=EdictType.COMMENT,
3159
+ raw_scripture=vessel.raw_scripture,
3160
+ line_num=vessel.line_num,
3161
+ command=f"!! PARADOX DURING PARSING: {e} !!"
3162
+ )
3163
+
3164
+
3165
+
3166
+
3167
+ VALID_BLUEPRINT_EXTENSIONS = ('.scaffold', '.txt', '.yaml', '.yml')
3168
+ def is_valid_blueprint_file(file_path: Path) -> bool:
3169
+ if file_path.name.lower() in VALID_BLUEPRINT_EXTENSIONS:
3170
+ return True
3171
+ return file_path.suffix.lower() in VALID_BLUEPRINT_EXTENSIONS
3172
+
3173
+
3174
+ def unbreakable_ward_of_annihilation(path_to_delete: Path, project_root: Path, rite_name: str):
3175
+ """
3176
+ =================================================================================
3177
+ == THE UNBREAKABLE WARD OF ANNIHILATION (V-Ω-ETERNAL-GUARDIAN) ==
3178
+ =================================================================================
3179
+ The final, absolute safeguard against catastrophic deletion. It raises a heresy
3180
+ if any attempt is made to annihilate a sacred sanctum.
3181
+ =================================================================================
3182
+ """
3183
+ if not isinstance(path_to_delete, Path) or not isinstance(project_root, Path):
3184
+ raise ArtisanHeresy(
3185
+ "A profound type heresy was perceived by the Unbreakable Ward. Annihilation stayed.",
3186
+ details="A non-Path object was passed to the ultimate safety check."
3187
+ )
3188
+
3189
+ # Resolve to absolute, canonical paths to prevent any ambiguity.
3190
+ target = path_to_delete.resolve()
3191
+ anchor = project_root.resolve()
3192
+ home = Path.home().resolve()
3193
+
3194
+ # The Sacred Vows. If any of these are true, the rite is profane.
3195
+ if target == anchor:
3196
+ raise ArtisanHeresy(f"HERESY: The '{rite_name}' rite attempted to annihilate the project root itself: {target}")
3197
+ if target == home:
3198
+ raise ArtisanHeresy(f"HERESY: The '{rite_name}' rite attempted to annihilate the HOME directory: {target}")
3199
+ if target == home.parent or target == anchor.parent:
3200
+ raise ArtisanHeresy(
3201
+ f"HERESY: The '{rite_name}' rite attempted to annihilate a parent of a sacred sanctum: {target}")
3202
+
3203
+ # A final check to ensure we are not deleting something "above" the project root.
3204
+ try:
3205
+ target.relative_to(anchor)
3206
+ # If this succeeds, `target` is inside or is the same as `anchor`. Since we checked for equality,
3207
+ # it must be inside, which is what we expect for an ephemeral directory.
3208
+ except ValueError:
3209
+ # This means the target is outside the project root. This is only allowed
3210
+ # if it's inside a known ephemeral location like the system temp dir.
3211
+ import tempfile
3212
+ temp_dir = Path(tempfile.gettempdir()).resolve()
3213
+ try:
3214
+ target.relative_to(temp_dir)
3215
+ # It's a valid temp file, allow it.
3216
+ except ValueError:
3217
+ # It's outside the project and not in temp. This is a critical heresy.
3218
+ raise ArtisanHeresy(
3219
+ f"HERESY: The '{rite_name}' rite attempted to annihilate a path outside the project sanctum: {target}")
3220
+
3221
+
3222
+ def path_to_uri(path: Path) -> str:
3223
+ """
3224
+ [THE RITE OF CONSECRATION]
3225
+ Transmutes a local path into a canonical, absolute file URI for the Symbiotic Link.
3226
+ """
3227
+ try:
3228
+ # Use pathlib's as_uri() for native platform handling, then clean Windows paths
3229
+ uri = path.resolve().as_uri()
3230
+ # Windows sometimes adds an extra / or drive letter issues, clean this up
3231
+ if platform.system() == "Windows" and uri.startswith("file:///"):
3232
+ # On Windows, need to handle the C: drive prefix
3233
+ return uri.replace("file:///", "file:///")
3234
+
3235
+ return uri
3236
+ except Exception:
3237
+ # If all else fails, return a safe string.
3238
+ return f"file:///{path.as_posix()}"