cycode 3.28.1.dev1__tar.gz → 3.28.1.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/PKG-INFO +2 -2
  2. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/README.md +1 -1
  3. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/__init__.py +1 -1
  4. cycode-3.28.1.dev3/cycode/cli/apps/ai_guardrails/ides/_transcript_utils.py +45 -0
  5. cycode-3.28.1.dev3/cycode/cli/apps/ai_guardrails/ides/_vscode_utils.py +21 -0
  6. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/claude_code.py +87 -38
  7. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/codex.py +130 -0
  8. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/copilot.py +12 -60
  9. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/cursor.py +85 -4
  10. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/prompt_images.py +57 -5
  11. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/text_printer.py +2 -2
  12. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/pyproject.toml +1 -1
  13. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/LICENCE +0 -0
  14. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/__main__.py +0 -0
  15. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/__init__.py +0 -0
  16. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/app.py +0 -0
  17. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/__init__.py +0 -0
  18. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/activation_manager.py +0 -0
  19. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/__init__.py +0 -0
  20. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/command_utils.py +0 -0
  21. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/consts.py +0 -0
  22. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/hooks_manager.py +0 -0
  23. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/__init__.py +0 -0
  24. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/_plugin_utils.py +0 -0
  25. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/_skill_utils.py +0 -0
  26. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/ides/base.py +0 -0
  27. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/install_command.py +0 -0
  28. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/__init__.py +0 -0
  29. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/consts.py +0 -0
  30. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/detach.py +0 -0
  31. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/guardrail_config.py +0 -0
  32. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/handlers.py +0 -0
  33. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/mcp_server_status.py +0 -0
  34. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/payload.py +0 -0
  35. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/policy.py +0 -0
  36. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/scan_command.py +0 -0
  37. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/types.py +0 -0
  38. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/scan/utils.py +0 -0
  39. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/session_start_command.py +0 -0
  40. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/status_command.py +0 -0
  41. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_guardrails/uninstall_command.py +0 -0
  42. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_remediation/__init__.py +0 -0
  43. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_remediation/ai_remediation_command.py +0 -0
  44. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_remediation/apply_fix.py +0 -0
  45. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ai_remediation/print_remediation.py +0 -0
  46. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/api/__init__.py +0 -0
  47. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/api/api_command.py +0 -0
  48. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/api/openapi_spec.py +0 -0
  49. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/auth/__init__.py +0 -0
  50. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/auth/auth_command.py +0 -0
  51. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/auth/auth_common.py +0 -0
  52. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/auth/auth_manager.py +0 -0
  53. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/auth/models.py +0 -0
  54. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/configure/__init__.py +0 -0
  55. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/configure/configure_command.py +0 -0
  56. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/configure/consts.py +0 -0
  57. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/configure/messages.py +0 -0
  58. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/configure/prompts.py +0 -0
  59. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ignore/__init__.py +0 -0
  60. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/ignore/ignore_command.py +0 -0
  61. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/mcp/__init__.py +0 -0
  62. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/mcp/mcp_command.py +0 -0
  63. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/__init__.py +0 -0
  64. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/report_command.py +0 -0
  65. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/__init__.py +0 -0
  66. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/common.py +0 -0
  67. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/path/__init__.py +0 -0
  68. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/path/path_command.py +0 -0
  69. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/repository_url/__init__.py +0 -0
  70. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/repository_url/repository_url_command.py +0 -0
  71. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/sbom_command.py +0 -0
  72. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report/sbom/sbom_report_file.py +0 -0
  73. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report_import/__init__.py +0 -0
  74. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report_import/report_import_command.py +0 -0
  75. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report_import/sbom/__init__.py +0 -0
  76. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/report_import/sbom/sbom_command.py +0 -0
  77. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/sca_options.py +0 -0
  78. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/__init__.py +0 -0
  79. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/aggregation_report.py +0 -0
  80. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/code_scanner.py +0 -0
  81. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/commit_history/__init__.py +0 -0
  82. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/commit_history/commit_history_command.py +0 -0
  83. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/commit_range_scanner.py +0 -0
  84. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/detection_excluder.py +0 -0
  85. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/path/__init__.py +0 -0
  86. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/path/path_command.py +0 -0
  87. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_commit/__init__.py +0 -0
  88. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_commit/pre_commit_command.py +0 -0
  89. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_push/__init__.py +0 -0
  90. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_push/pre_push_command.py +0 -0
  91. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_receive/__init__.py +0 -0
  92. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/pre_receive/pre_receive_command.py +0 -0
  93. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/remote_url_resolver.py +0 -0
  94. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/repository/__init__.py +0 -0
  95. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/repository/repository_command.py +0 -0
  96. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_ci/__init__.py +0 -0
  97. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_ci/ci_integrations.py +0 -0
  98. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_ci/scan_ci_command.py +0 -0
  99. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_command.py +0 -0
  100. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_parameters.py +0 -0
  101. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/scan/scan_result.py +0 -0
  102. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/status/__init__.py +0 -0
  103. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/status/get_cli_status.py +0 -0
  104. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/status/models.py +0 -0
  105. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/status/status_command.py +0 -0
  106. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/apps/status/version_command.py +0 -0
  107. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/cli_types.py +0 -0
  108. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/config.py +0 -0
  109. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/console.py +0 -0
  110. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/consts.py +0 -0
  111. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/__init__.py +0 -0
  112. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/custom_exceptions.py +0 -0
  113. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/handle_ai_remediation_errors.py +0 -0
  114. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/handle_auth_errors.py +0 -0
  115. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/handle_errors.py +0 -0
  116. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
  117. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
  118. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/__init__.py +0 -0
  119. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/commit_range_documents.py +0 -0
  120. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/documents_walk_ignore.py +0 -0
  121. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/file_excluder.py +0 -0
  122. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/iac/__init__.py +0 -0
  123. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
  124. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/models/__init__.py +0 -0
  125. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
  126. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/path_documents.py +0 -0
  127. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/repository_documents.py +0 -0
  128. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/__init__.py +0 -0
  129. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/base_restore_dependencies.py +0 -0
  130. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/go/__init__.py +0 -0
  131. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +0 -0
  132. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
  133. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
  134. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
  135. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
  136. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/restore_bun_dependencies.py +0 -0
  137. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/restore_deno_dependencies.py +0 -0
  138. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +0 -0
  139. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/restore_pnpm_dependencies.py +0 -0
  140. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/restore_yarn_dependencies.py +0 -0
  141. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/__init__.py +0 -0
  142. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/coverage.py +0 -0
  143. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/files.py +0 -0
  144. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/globs.py +0 -0
  145. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/names.py +0 -0
  146. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/npm/workspace/resolvers.py +0 -0
  147. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
  148. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -0
  149. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/php/__init__.py +0 -0
  150. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/php/restore_composer_dependencies.py +0 -0
  151. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/python/__init__.py +0 -0
  152. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/python/restore_pip_dependencies.py +0 -0
  153. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/python/restore_pipenv_dependencies.py +0 -0
  154. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/python/restore_poetry_dependencies.py +0 -0
  155. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/python/restore_uv_dependencies.py +0 -0
  156. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/ruby/__init__.py +0 -0
  157. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py +0 -0
  158. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
  159. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +0 -0
  160. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/sca/sca_file_collector.py +0 -0
  161. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/walk_ignore.py +0 -0
  162. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/files_collector/zip_documents.py +0 -0
  163. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/logger.py +0 -0
  164. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/main.py +0 -0
  165. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/models.py +0 -0
  166. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/__init__.py +0 -0
  167. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/console_printer.py +0 -0
  168. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/json_printer.py +0 -0
  169. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/printer_base.py +0 -0
  170. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/rich_printer.py +0 -0
  171. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/__init__.py +0 -0
  172. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
  173. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/table.py +0 -0
  174. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/table_models.py +0 -0
  175. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/table_printer.py +0 -0
  176. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/tables/table_printer_base.py +0 -0
  177. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/__init__.py +0 -0
  178. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/code_snippet_syntax.py +0 -0
  179. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/detection_data.py +0 -0
  180. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/detection_ordering/__init__.py +0 -0
  181. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/detection_ordering/common_ordering.py +0 -0
  182. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/detection_ordering/sca_ordering.py +0 -0
  183. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/rich_helpers.py +0 -0
  184. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/sca_ossf.py +0 -0
  185. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/printers/utils/sca_policy_details.py +0 -0
  186. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/__init__.py +0 -0
  187. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/base_file_manager.py +0 -0
  188. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/config_file_manager.py +0 -0
  189. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/configuration_manager.py +0 -0
  190. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/credentials_manager.py +0 -0
  191. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/user_settings/jwt_creator.py +0 -0
  192. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/__init__.py +0 -0
  193. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/binary_utils.py +0 -0
  194. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/enum_utils.py +0 -0
  195. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/get_api_client.py +0 -0
  196. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/git_proxy.py +0 -0
  197. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/host_info.py +0 -0
  198. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/ignore_utils.py +0 -0
  199. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/jwt_utils.py +0 -0
  200. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/path_utils.py +0 -0
  201. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/progress_bar.py +0 -0
  202. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/scan_batch.py +0 -0
  203. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/scan_utils.py +0 -0
  204. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/shell_executor.py +0 -0
  205. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/string_utils.py +0 -0
  206. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/task_timer.py +0 -0
  207. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/trust_store.py +0 -0
  208. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/url_utils.py +0 -0
  209. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/version_checker.py +0 -0
  210. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cli/utils/yaml_utils.py +0 -0
  211. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/config.py +0 -0
  212. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/__init__.py +0 -0
  213. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/ai_security_manager_client.py +0 -0
  214. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/ai_security_manager_service_config.py +0 -0
  215. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/auth_client.py +0 -0
  216. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/base_token_auth_client.py +0 -0
  217. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cli_activation_client.py +0 -0
  218. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/client_creator.py +0 -0
  219. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/config.py +0 -0
  220. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/config_dev.py +0 -0
  221. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cycode_client.py +0 -0
  222. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cycode_client_base.py +0 -0
  223. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cycode_dev_based_client.py +0 -0
  224. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cycode_oidc_based_client.py +0 -0
  225. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/cycode_token_based_client.py +0 -0
  226. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/headers.py +0 -0
  227. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/import_sbom_client.py +0 -0
  228. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/logger.py +0 -0
  229. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/models.py +0 -0
  230. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/report_client.py +0 -0
  231. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/scan_client.py +0 -0
  232. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/cyclient/scan_config_base.py +0 -0
  233. {cycode-3.28.1.dev1 → cycode-3.28.1.dev3}/cycode/logger.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.28.1.dev1
3
+ Version: 3.28.1.dev3
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  License-Expression: MIT
6
6
  License-File: LICENCE
@@ -800,7 +800,7 @@ prompts, files the agent reads, and MCP tool arguments are scanned for secrets b
800
800
 
801
801
  Scanning happens server-side, so the scanned content leaves the machine: the prompt text, the contents of
802
802
  files the agent reads, and MCP tool arguments are sent to your Cycode tenant to be checked for secrets.
803
- For GitHub Copilot, PNG and JPEG images attached to a prompt are sent along with its text.
803
+ For GitHub Copilot, Claude Code, Codex and Cursor, PNG and JPEG images attached to a prompt are sent along with its text.
804
804
 
805
805
  Each event is also reported with context about the developer and the machine, so a finding can be attributed
806
806
  to the device and user it came from. Some of this is personal data:
@@ -755,7 +755,7 @@ prompts, files the agent reads, and MCP tool arguments are scanned for secrets b
755
755
 
756
756
  Scanning happens server-side, so the scanned content leaves the machine: the prompt text, the contents of
757
757
  files the agent reads, and MCP tool arguments are sent to your Cycode tenant to be checked for secrets.
758
- For GitHub Copilot, PNG and JPEG images attached to a prompt are sent along with its text.
758
+ For GitHub Copilot, Claude Code, Codex and Cursor, PNG and JPEG images attached to a prompt are sent along with its text.
759
759
 
760
760
  Each event is also reported with context about the developer and the machine, so a finding can be attributed
761
761
  to the device and user it came from. Some of this is personal data:
@@ -5,4 +5,4 @@ import time as _time
5
5
  # end-to-end scan duration from the moment the user actually triggered it.
6
6
  _BOOT_WALL: float = _time.time()
7
7
 
8
- __version__ = '3.28.1.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
8
+ __version__ = '3.28.1.dev3' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -0,0 +1,45 @@
1
+ """Shared transcript helpers for IDE integrations.
2
+
3
+ Agents keep a session's transcript as JSONL that grows with every turn, images included, so it is read from
4
+ the end.
5
+ """
6
+
7
+ from collections.abc import Iterator
8
+ from pathlib import Path
9
+
10
+
11
+ def reverse_readline(path: Path, buf_size: int = 8192) -> Iterator[str]:
12
+ """Yield lines of `path` from end to start without loading the file.
13
+
14
+ A transcript can be very large; reading from the tail keeps memory bounded
15
+ since only the most recent entries are wanted.
16
+ """
17
+ with path.open('rb') as f:
18
+ f.seek(0, 2)
19
+ file_size = f.tell()
20
+ if file_size == 0:
21
+ return
22
+
23
+ remaining = file_size
24
+ buffer = b''
25
+
26
+ while remaining > 0:
27
+ read_size = min(buf_size, remaining)
28
+ remaining -= read_size
29
+ f.seek(remaining)
30
+ chunk = f.read(read_size)
31
+ buffer = chunk + buffer
32
+
33
+ while b'\n' in buffer:
34
+ newline_pos = buffer.rfind(b'\n')
35
+ if newline_pos == len(buffer) - 1:
36
+ newline_pos = buffer.rfind(b'\n', 0, newline_pos)
37
+ if newline_pos == -1:
38
+ break
39
+ line = buffer[newline_pos + 1 :]
40
+ buffer = buffer[: newline_pos + 1]
41
+ if line.strip():
42
+ yield line.decode('utf-8', errors='replace')
43
+
44
+ if buffer.strip():
45
+ yield buffer.decode('utf-8', errors='replace')
@@ -0,0 +1,21 @@
1
+ """Shared helpers for VS Code and its forks, such as Cursor: where they keep their data, and reading their databases."""
2
+
3
+ import platform
4
+ import sqlite3
5
+ from contextlib import closing
6
+ from pathlib import Path
7
+
8
+
9
+ def vscode_user_data_dir(product_name: str = 'Code') -> Path:
10
+ """Per-platform user data directory of VS Code or a fork: 'Code', 'Code - Insiders' or 'Cursor'."""
11
+ if platform.system() == 'Darwin':
12
+ return Path.home() / 'Library' / 'Application Support' / product_name
13
+ if platform.system() == 'Windows':
14
+ return Path.home() / 'AppData' / 'Roaming' / product_name
15
+ return Path.home() / '.config' / product_name
16
+
17
+
18
+ def read_only_query(db_path: Path, sql: str, params: tuple = ()) -> list[tuple]:
19
+ """The rows of a query on an app's SQLite database, opened read-only: the app keeps writing to the file."""
20
+ with closing(sqlite3.connect(f'{db_path.resolve().as_uri()}?mode=ro', uri=True, timeout=1)) as connection:
21
+ return connection.execute(sql, params).fetchall()
@@ -1,7 +1,9 @@
1
1
  """Claude Code IDE integration for AI guardrails."""
2
2
 
3
3
  import json
4
+ import os
4
5
  import re
6
+ import tempfile
5
7
  from collections.abc import Iterator
6
8
  from copy import deepcopy
7
9
  from pathlib import Path
@@ -15,8 +17,16 @@ from cycode.cli.apps.ai_guardrails.ides._plugin_utils import (
15
17
  walk_enabled_plugins,
16
18
  )
17
19
  from cycode.cli.apps.ai_guardrails.ides._skill_utils import walk_plugin_skills, walk_skill_dirs
20
+ from cycode.cli.apps.ai_guardrails.ides._transcript_utils import reverse_readline
18
21
  from cycode.cli.apps.ai_guardrails.ides.base import IDE, DecisionAction, HookDecision
19
22
  from cycode.cli.apps.ai_guardrails.scan.payload import AIHookPayload
23
+ from cycode.cli.apps.ai_guardrails.scan.prompt_images import (
24
+ PromptImage,
25
+ collect_since_prompt_mark,
26
+ image_chips,
27
+ mentioned_files,
28
+ modified_between,
29
+ )
20
30
  from cycode.cli.apps.ai_guardrails.scan.types import AiHookEventType
21
31
  from cycode.logger import get_logger
22
32
 
@@ -39,45 +49,18 @@ _CLAUDE_SETTINGS_PATH = Path.home() / '.claude' / 'settings.json'
39
49
  _SCAN_COMMAND = f'{CYCODE_SCAN_PROMPT_COMMAND} --ide claude-code'
40
50
  _SESSION_START_COMMAND = f'{CYCODE_SESSION_START_COMMAND} --ide claude-code'
41
51
 
42
-
43
- # --- transcript JSONL parsing -------------------------------------------------
52
+ # Claude Code saves every image attached to a prompt (pasted, dragged in, or attached in VS Code or the desktop app)
53
+ # before the prompt's hook runs, as <number>.<ext> in the session's folder of its temp directory,
54
+ # <temp root>/claude-<uid>/<project>/<session_id>/images, the temp root being $CLAUDE_CODE_TMPDIR or /tmp. The number
55
+ # counts up across the session, and a pasted or dragged image shows in the prompt as its [Image #<number>] chip.
56
+ _TEMP_DIR_ENV_VAR = 'CLAUDE_CODE_TMPDIR'
57
+ _SESSION_IMAGES_DIR_NAME = 'images'
58
+ _SAVED_IMAGE_NAME_PATTERN = re.compile(r'(\d+)\.[A-Za-z]+')
59
+ # The session id names a folder; one that could leave it (or match others) is not looked up
60
+ _SESSION_ID_PATTERN = re.compile(r'[A-Za-z0-9_-]+')
44
61
 
45
62
 
46
- def _reverse_readline(path: Path, buf_size: int = 8192) -> Iterator[str]:
47
- """Yield lines of `path` from end to start without loading the file.
48
-
49
- The Claude Code transcript can be very large; reading from the tail keeps
50
- memory bounded since we only care about the most recent entries.
51
- """
52
- with path.open('rb') as f:
53
- f.seek(0, 2)
54
- file_size = f.tell()
55
- if file_size == 0:
56
- return
57
-
58
- remaining = file_size
59
- buffer = b''
60
-
61
- while remaining > 0:
62
- read_size = min(buf_size, remaining)
63
- remaining -= read_size
64
- f.seek(remaining)
65
- chunk = f.read(read_size)
66
- buffer = chunk + buffer
67
-
68
- while b'\n' in buffer:
69
- newline_pos = buffer.rfind(b'\n')
70
- if newline_pos == len(buffer) - 1:
71
- newline_pos = buffer.rfind(b'\n', 0, newline_pos)
72
- if newline_pos == -1:
73
- break
74
- line = buffer[newline_pos + 1 :]
75
- buffer = buffer[: newline_pos + 1]
76
- if line.strip():
77
- yield line.decode('utf-8', errors='replace')
78
-
79
- if buffer.strip():
80
- yield buffer.decode('utf-8', errors='replace')
63
+ # --- transcript JSONL parsing -------------------------------------------------
81
64
 
82
65
 
83
66
  def _extract_model(entry: dict) -> str | None:
@@ -112,7 +95,7 @@ def extract_from_claude_transcript(
112
95
  generation_id = None
113
96
 
114
97
  try:
115
- for line in _reverse_readline(path):
98
+ for line in reverse_readline(path):
116
99
  line = line.strip()
117
100
  if not line:
118
101
  continue
@@ -289,6 +272,60 @@ def _resolve_mcp_server_name(server: str, config: dict | None, cwd: str | None)
289
272
  return server
290
273
 
291
274
 
275
+ # --- prompt images ------------------------------------------------------------
276
+
277
+
278
+ def _user_id() -> int | None:
279
+ """The process's uid; None on Windows, which has none."""
280
+ return None if os.name == 'nt' else os.getuid()
281
+
282
+
283
+ def _session_image_dirs(session_id: str) -> list[Path]:
284
+ """The folders where Claude Code saved this session's images (normally one).
285
+
286
+ Without a uid (Windows) the folder is looked for under any claude* folder of the system temp directory.
287
+ """
288
+ if not _SESSION_ID_PATTERN.fullmatch(session_id):
289
+ return []
290
+ override = os.environ.get(_TEMP_DIR_ENV_VAR)
291
+ uid = _user_id()
292
+ if uid is not None:
293
+ root = Path(override or '/tmp') # noqa: S108 - Claude Code's own location, read only
294
+ user_dir_pattern = f'claude-{uid}'
295
+ else:
296
+ root = Path(override or tempfile.gettempdir())
297
+ user_dir_pattern = 'claude*'
298
+ pattern = f'{user_dir_pattern}/*/{session_id}/{_SESSION_IMAGES_DIR_NAME}'
299
+ return [path for path in root.glob(pattern) if path.is_dir()]
300
+
301
+
302
+ def _saved_session_images(session_id: str | None, prompt: str, since: float, until: float) -> list[Path]:
303
+ """This prompt's images among those Claude Code saved for the session.
304
+
305
+ Those its chips name, then those saved since the session's previous prompt: VS Code and the desktop app put no chip
306
+ in the prompt. Claude Code also saves an image again when its prompt is sent, so a prompt sent again after a block
307
+ finds it in that window too. The chips don't rely on that: they are the prompt's own reference to its files, so a
308
+ named image is found even if Claude Code didn't save it again.
309
+ """
310
+ if not isinstance(session_id, str) or not session_id:
311
+ return []
312
+ saved: dict[int, Path] = {}
313
+ for directory in _session_image_dirs(session_id):
314
+ try:
315
+ paths = list(directory.iterdir())
316
+ except OSError as e:
317
+ logger.debug('Failed to list a session images folder, %s', {'path': str(directory)}, exc_info=e)
318
+ continue
319
+ for path in paths:
320
+ match = _SAVED_IMAGE_NAME_PATTERN.fullmatch(path.name)
321
+ if match:
322
+ saved.setdefault(int(match.group(1)), path)
323
+
324
+ chips = dict.fromkeys(int(number) for number in image_chips(prompt))
325
+ named = [saved[number] for number in chips if number in saved]
326
+ return named + modified_between(saved.values(), since, until)
327
+
328
+
292
329
  # --- IDE integration ----------------------------------------------------------
293
330
 
294
331
 
@@ -393,6 +430,18 @@ class ClaudeCode(IDE):
393
430
  mcp_arguments=mcp_arguments,
394
431
  )
395
432
 
433
+ def collect_prompt_images(self, raw_payload: dict) -> list[PromptImage]:
434
+ """Images attached to a prompt: those Claude Code saved for it, and `@path` mentions."""
435
+ session_id = raw_payload.get('session_id')
436
+ prompt = raw_payload.get('prompt') or ''
437
+ return collect_since_prompt_mark(
438
+ session_id,
439
+ lambda since, until: [
440
+ *_saved_session_images(session_id, prompt, since, until),
441
+ *mentioned_files(prompt, raw_payload.get('cwd')),
442
+ ],
443
+ )
444
+
396
445
  def build_hook_response(self, decision: HookDecision) -> dict:
397
446
  if decision.event_type == AiHookEventType.PROMPT:
398
447
  if decision.action == DecisionAction.ALLOW:
@@ -4,7 +4,10 @@ import json
4
4
  import os
5
5
  import re
6
6
  import sys
7
+ import tempfile
8
+ import time
7
9
  from collections.abc import Iterator
10
+ from datetime import datetime
8
11
  from pathlib import Path
9
12
  from typing import ClassVar
10
13
 
@@ -23,8 +26,16 @@ from cycode.cli.apps.ai_guardrails.ides._plugin_utils import (
23
26
  walk_enabled_plugins,
24
27
  )
25
28
  from cycode.cli.apps.ai_guardrails.ides._skill_utils import walk_plugin_skills, walk_skill_dirs
29
+ from cycode.cli.apps.ai_guardrails.ides._transcript_utils import reverse_readline
26
30
  from cycode.cli.apps.ai_guardrails.ides.base import IDE, DecisionAction, HookDecision
27
31
  from cycode.cli.apps.ai_guardrails.scan.payload import AIHookPayload
32
+ from cycode.cli.apps.ai_guardrails.scan.prompt_images import (
33
+ PromptImage,
34
+ image_chips,
35
+ mentioned_files,
36
+ modified_between,
37
+ select_prompt_images,
38
+ )
28
39
  from cycode.cli.apps.ai_guardrails.scan.types import AiHookEventType
29
40
  from cycode.cli.utils.jwt_utils import decode_jwt_unverified
30
41
  from cycode.logger import get_logger
@@ -43,6 +54,17 @@ _CODEX_EVENT_NAMES = frozenset(e.split(':', 1)[0] for e in _HOOK_EVENTS)
43
54
  _SCAN_COMMAND = f'{CYCODE_SCAN_PROMPT_COMMAND} --ide codex'
44
55
  _SESSION_START_COMMAND = f'{CYCODE_SESSION_START_COMMAND} --ide codex'
45
56
 
57
+ # The prompt names each attached image only by an [Image #N] chip. Codex's terminal UI saves an image pasted from the
58
+ # clipboard as codex-clipboard-<random>.png in the temp directory and keeps it; an image dragged in, picked from the
59
+ # @ popup or passed with --image is attached from where it is, and nothing names it.
60
+ _CLIPBOARD_IMAGE_GLOB = 'codex-clipboard-*.png'
61
+ # How long after its paste a prompt may still be sent with the image
62
+ _CLIPBOARD_IMAGE_MAX_AGE_SECONDS = 60 * 60
63
+ # How long before a session's first prompt its pastes may have been made: Codex starts the transcript at that prompt
64
+ _FIRST_PROMPT_PASTE_LOOKBACK_SECONDS = 10 * 60
65
+ # Transcript lines worth parsing: the session's start, a turn's start, and user messages
66
+ _TRANSCRIPT_LINE_MARKERS = ('session_meta', 'turn_context', '"user"')
67
+
46
68
 
47
69
  def _codex_home() -> Path:
48
70
  """Resolve Codex's user-scope home directory.
@@ -229,6 +251,99 @@ def _enable_codex_hooks_feature(scope: str, repo_path: Path | None = None) -> tu
229
251
  return False, f'Failed to write Codex config at {config_path}'
230
252
 
231
253
 
254
+ # --- prompt images ------------------------------------------------------------
255
+
256
+
257
+ def _transcript_time(item: dict) -> float | None:
258
+ """When a transcript line was written, from its timestamp such as 2026-11-17T16:27:50.595Z."""
259
+ timestamp = item.get('timestamp')
260
+ if not isinstance(timestamp, str):
261
+ return None
262
+ try:
263
+ return datetime.fromisoformat(timestamp.replace('Z', '+00:00')).timestamp()
264
+ except ValueError:
265
+ return None
266
+
267
+
268
+ def _is_user_message(item: dict) -> bool:
269
+ payload = item.get('payload')
270
+ return item.get('type') == 'response_item' and isinstance(payload, dict) and payload.get('role') == 'user'
271
+
272
+
273
+ def _transcript_items_newest_first(transcript_path: str) -> Iterator[dict]:
274
+ """The transcript's lines that may be a session's start, a turn's start or a user message, newest first."""
275
+ for line in reverse_readline(Path(transcript_path)):
276
+ if not any(marker in line for marker in _TRANSCRIPT_LINE_MARKERS):
277
+ continue
278
+ try:
279
+ item = json.loads(line)
280
+ except ValueError:
281
+ continue
282
+ if isinstance(item, dict):
283
+ yield item
284
+
285
+
286
+ def _last_prompt_time(transcript_path: str) -> float | None:
287
+ """When the session's last prompt that its hook let through was sent, or None if none was.
288
+
289
+ Codex writes a prompt into the transcript as a user message only once its hook lets it through; a blocked prompt
290
+ leaves only turn bookkeeping. Read from the end, which the last prompt is usually near. A user message is that
291
+ prompt once a turn's start shows up before it. If a session's start shows up first, the message came before the
292
+ session's first turn: it is the session's context, not a prompt, and the read goes on to the session before it.
293
+ """
294
+ newest_message = None
295
+ for item in _transcript_items_newest_first(transcript_path):
296
+ kind = item.get('type')
297
+ if kind == 'turn_context' and newest_message is not None:
298
+ return newest_message
299
+ if kind == 'session_meta':
300
+ newest_message = None
301
+ elif newest_message is None and _is_user_message(item):
302
+ newest_message = _transcript_time(item)
303
+ return None
304
+
305
+
306
+ def _session_start_time(transcript_path: str) -> float | None:
307
+ """When the session (re)started: its latest session_meta, which Codex writes when its first prompt is submitted."""
308
+ for item in _transcript_items_newest_first(transcript_path):
309
+ if item.get('type') == 'session_meta':
310
+ return _transcript_time(item)
311
+ return None
312
+
313
+
314
+ def _paste_window_start(transcript_path: str, now: float) -> float:
315
+ """Where the pastes this prompt may carry begin: at the session's last prompt that its hook let through.
316
+
317
+ A blocked prompt isn't one, so its pastes are found again when it is sent again. Until a prompt goes through, the
318
+ window reaches back from the session's start.
319
+ """
320
+ try:
321
+ last_prompt = _last_prompt_time(transcript_path)
322
+ if last_prompt is not None:
323
+ return last_prompt
324
+ session_start = _session_start_time(transcript_path)
325
+ except OSError as e:
326
+ logger.debug('Failed to read the Codex transcript, %s', {'path': transcript_path}, exc_info=e)
327
+ session_start = None
328
+ return (session_start if session_start is not None else now) - _FIRST_PROMPT_PASTE_LOOKBACK_SECONDS
329
+
330
+
331
+ def _pasted_clipboard_images(prompt: str, transcript_path: object, now: float) -> list[Path]:
332
+ """The newest clipboard pastes made since the session's last prompt that went through, one per [Image #N] chip.
333
+
334
+ A chip doesn't say whether its image was pasted, dragged in or picked from the @ popup, so a dragged or picked
335
+ image takes in its place a paste made since then that a blocked prompt, or another session, left behind. Without
336
+ a transcript there is no session to go by, so none is taken: the prompt Codex sends to title a new thread has
337
+ none and quotes the user's prompt, chips included.
338
+ """
339
+ chips_count = len(set(image_chips(prompt)))
340
+ if not chips_count or not isinstance(transcript_path, str) or not transcript_path:
341
+ return []
342
+ since = max(_paste_window_start(transcript_path, now), now - _CLIPBOARD_IMAGE_MAX_AGE_SECONDS)
343
+ pastes = list(Path(tempfile.gettempdir()).glob(_CLIPBOARD_IMAGE_GLOB))
344
+ return modified_between(pastes, since, now)[-chips_count:]
345
+
346
+
232
347
  class Codex(IDE):
233
348
  name: ClassVar[str] = 'codex'
234
349
  display_name: ClassVar[str] = 'Codex'
@@ -302,6 +417,21 @@ class Codex(IDE):
302
417
  mcp_arguments=mcp_arguments,
303
418
  )
304
419
 
420
+ def collect_prompt_images(self, raw_payload: dict) -> list[PromptImage]:
421
+ """Images attached to a prompt: clipboard pastes, one per chip, and `@path` mentions.
422
+
423
+ The payload names no image, and the transcript records a prompt only after its hook.
424
+ """
425
+ prompt = raw_payload.get('prompt') or ''
426
+ images = select_prompt_images(
427
+ [
428
+ *_pasted_clipboard_images(prompt, raw_payload.get('transcript_path'), time.time()),
429
+ *mentioned_files(prompt, raw_payload.get('cwd')),
430
+ ]
431
+ )
432
+ logger.debug('Collected prompt images, %s', {'images_count': len(images)})
433
+ return images
434
+
305
435
  def build_hook_response(self, decision: HookDecision) -> dict:
306
436
  # Codex hook response shapes:
307
437
  # - allow: empty (no objection). Older Codex runtimes reject an explicit
@@ -27,13 +27,10 @@ but by the time the hook runs Copilot has saved every attached image to disk; se
27
27
 
28
28
  import json
29
29
  import os
30
- import platform
31
30
  import re
32
31
  import sqlite3
33
32
  import tempfile
34
- import time
35
33
  from collections.abc import Iterable
36
- from contextlib import closing
37
34
  from pathlib import Path
38
35
  from typing import ClassVar
39
36
  from urllib.parse import urlparse
@@ -46,14 +43,14 @@ from cycode.cli.apps.ai_guardrails.ides._plugin_utils import (
46
43
  walk_enabled_plugins,
47
44
  )
48
45
  from cycode.cli.apps.ai_guardrails.ides._skill_utils import walk_plugin_skills, walk_skill_dirs
46
+ from cycode.cli.apps.ai_guardrails.ides._vscode_utils import read_only_query, vscode_user_data_dir
49
47
  from cycode.cli.apps.ai_guardrails.ides.base import IDE, DecisionAction, HookDecision
50
48
  from cycode.cli.apps.ai_guardrails.scan.payload import AIHookPayload
51
49
  from cycode.cli.apps.ai_guardrails.scan.prompt_images import (
52
50
  PromptImage,
53
- get_prompt_mark,
51
+ collect_since_prompt_mark,
52
+ mentioned_files,
54
53
  modified_between,
55
- save_prompt_mark,
56
- select_prompt_images,
57
54
  )
58
55
  from cycode.cli.apps.ai_guardrails.scan.types import AiHookEventType
59
56
  from cycode.logger import get_logger
@@ -112,13 +109,6 @@ _PLUGIN_MANIFEST_LOCATIONS = (
112
109
  _SCAN_COMMAND = f'{CYCODE_SCAN_PROMPT_COMMAND} --ide copilot'
113
110
  _SESSION_START_COMMAND = f'{CYCODE_SESSION_START_COMMAND} --ide copilot'
114
111
 
115
- # Copilot CLI leaves an `@path` mention in the prompt as typed: quoted, with
116
- # backslash-escaped spaces (a file dragged into a terminal), or plain up to the next
117
- # whitespace. Never mid-word, so an email address is not a mention. A lookahead, so
118
- # every `@` is read on its own: a quote left open must not swallow the mentions after
119
- # it, and a quoted path never spans lines.
120
- _MENTION_PATTERN = re.compile(r'(?<!\S)@(?=("[^"\n]+"|\'[^\'\n]+\'|(?:\\ |\S)+))')
121
- _MENTION_TRAILING_PUNCTUATION = '.,;:!?)]}'
122
112
  # Copilot CLI replaces a pasted image with this placeholder, naming the file it saved
123
113
  # in the temp directory.
124
114
  _PASTED_IMAGE_PATTERN = re.compile(r'\[image:\s*([^\]\r\n]+?)\s*\]')
@@ -153,18 +143,9 @@ def _vscode_agent_plugins_dir() -> Path:
153
143
  return Path.home() / '.vscode' / 'agent-plugins'
154
144
 
155
145
 
156
- def _vscode_user_data_dir(product_name: str = 'Code') -> Path:
157
- """Per-platform VS Code user data directory; ``product_name`` is 'Code' or 'Code - Insiders'."""
158
- if platform.system() == 'Darwin':
159
- return Path.home() / 'Library' / 'Application Support' / product_name
160
- if platform.system() == 'Windows':
161
- return Path.home() / 'AppData' / 'Roaming' / product_name
162
- return Path.home() / '.config' / product_name
163
-
164
-
165
146
  def _vscode_user_dir() -> Path:
166
147
  """Per-platform VS Code user settings directory."""
167
- return _vscode_user_data_dir() / 'User'
148
+ return vscode_user_data_dir() / 'User'
168
149
 
169
150
 
170
151
  def _vscode_mcp_config_path() -> Path:
@@ -423,27 +404,6 @@ def split_mcp_tool_name(tool_name: str, server_names: Iterable[str]) -> tuple[st
423
404
  # --- prompt images ------------------------------------------------------------------
424
405
 
425
406
 
426
- def _mentioned_files(prompt: str, cwd: str | None) -> list[Path]:
427
- """Existing files named by `@` mentions, resolved against the hook's cwd."""
428
- base = Path(cwd) if cwd else Path()
429
- files = []
430
- for match in _MENTION_PATTERN.finditer(prompt):
431
- token = match.group(1)
432
- if len(token) > 1 and token[0] == token[-1] and token[0] in '"\'':
433
- spellings = [token[1:-1]]
434
- else:
435
- if os.sep == '/':
436
- token = token.replace('\\ ', ' ')
437
- # The mention may end a sentence ("look at @shot.png.")
438
- spellings = [token, token.rstrip(_MENTION_TRAILING_PUNCTUATION)]
439
- for spelling in spellings:
440
- path = base / os.path.expanduser(spelling)
441
- if os.path.isfile(path):
442
- files.append(path)
443
- break
444
- return files
445
-
446
-
447
407
  def _pasted_cli_images(prompt: str) -> list[Path]:
448
408
  """Images pasted into Copilot CLI, saved in the temp directory its placeholder names."""
449
409
  temp_dir = Path(tempfile.gettempdir())
@@ -459,9 +419,7 @@ def _vscode_chat_session_id(chat_dir: Path) -> str | None:
459
419
  placeholders = ', '.join('?' * len(_VSCODE_CHAT_SESSION_KEYS))
460
420
  query = f'SELECT value FROM session_metadata WHERE key IN ({placeholders})' # noqa: S608
461
421
  try:
462
- # Read-only: VS Code keeps writing to the file while the chat is open
463
- with closing(sqlite3.connect(f'{db_path.resolve().as_uri()}?mode=ro', uri=True, timeout=1)) as connection:
464
- values = [value for (value,) in connection.execute(query, _VSCODE_CHAT_SESSION_KEYS)]
422
+ values = [value for (value,) in read_only_query(db_path, query, _VSCODE_CHAT_SESSION_KEYS)]
465
423
  except sqlite3.Error as e:
466
424
  logger.debug('Failed to read a VS Code chat session database, %s', {'path': str(db_path)}, exc_info=e)
467
425
  return None
@@ -485,7 +443,7 @@ def _vscode_saved_attachments(session_id: str | None, since: float, until: float
485
443
  return []
486
444
  copies: list[Path] = []
487
445
  for product_name in _VSCODE_PRODUCT_NAMES:
488
- copies.extend(_vscode_user_data_dir(product_name).glob(_VSCODE_ATTACHMENT_COPIES_GLOB))
446
+ copies.extend(vscode_user_data_dir(product_name).glob(_VSCODE_ATTACHMENT_COPIES_GLOB))
489
447
  recent = modified_between(copies, since, until)
490
448
  # <chat id>/attachments/<attachment id>/<file>
491
449
  chats_of_this_session = {
@@ -574,20 +532,14 @@ class Copilot(IDE):
574
532
  """
575
533
  session_id = raw_payload.get('session_id')
576
534
  prompt = raw_payload.get('prompt') or ''
577
- now = time.time()
578
- since = get_prompt_mark(session_id, now)
579
-
580
- images = select_prompt_images(
581
- [
582
- *_mentioned_files(prompt, raw_payload.get('cwd')),
535
+ return collect_since_prompt_mark(
536
+ session_id,
537
+ lambda since, until: [
538
+ *mentioned_files(prompt, raw_payload.get('cwd')),
583
539
  *_pasted_cli_images(prompt),
584
- *_vscode_saved_attachments(session_id, since, now),
585
- ]
540
+ *_vscode_saved_attachments(session_id, since, until),
541
+ ],
586
542
  )
587
- save_prompt_mark(session_id, now)
588
-
589
- logger.debug('Collected prompt images, %s', {'images_count': len(images), 'since': since})
590
- return images
591
543
 
592
544
  def build_hook_response(self, decision: HookDecision) -> dict:
593
545
  if decision.action == DecisionAction.ALLOW: