icdev 1.0.0__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 (1105) hide show
  1. icdev/__init__.py +18 -0
  2. icdev/_paths.py +85 -0
  3. icdev/_version.py +3 -0
  4. icdev/data/__init__.py +1 -0
  5. icdev/data/args/__init__.py +1 -0
  6. icdev/data/args/agent_authority.yaml +61 -0
  7. icdev/data/args/agent_config.yaml +355 -0
  8. icdev/data/args/agentic_fitness.yaml +31 -0
  9. icdev/data/args/ai_governance_config.yaml +137 -0
  10. icdev/data/args/atlas_critique_config.yaml +66 -0
  11. icdev/data/args/bedrock_models.yaml +63 -0
  12. icdev/data/args/cicd_config.yaml +82 -0
  13. icdev/data/args/classification_config.yaml +232 -0
  14. icdev/data/args/cli_config.yaml +154 -0
  15. icdev/data/args/cloud_config.yaml +63 -0
  16. icdev/data/args/code_pattern_config.yaml +151 -0
  17. icdev/data/args/code_quality_config.yaml +47 -0
  18. icdev/data/args/companion_registry.yaml +202 -0
  19. icdev/data/args/context_config.yaml +82 -0
  20. icdev/data/args/csp_monitor_config.yaml +268 -0
  21. icdev/data/args/cui_markings.yaml +35 -0
  22. icdev/data/args/db_config.yaml +40 -0
  23. icdev/data/args/deployment_profiles.yaml +248 -0
  24. icdev/data/args/dev_profile_config.yaml +144 -0
  25. icdev/data/args/devsecops_config.yaml +286 -0
  26. icdev/data/args/endpoint_security_config.yaml +137 -0
  27. icdev/data/args/extension_config.yaml +79 -0
  28. icdev/data/args/file_access_tiers.yaml +88 -0
  29. icdev/data/args/framework_registry.yaml +415 -0
  30. icdev/data/args/innovation_config.yaml +431 -0
  31. icdev/data/args/installation_manifest.yaml +1087 -0
  32. icdev/data/args/llm_config.yaml +495 -0
  33. icdev/data/args/maintenance_config.yaml +55 -0
  34. icdev/data/args/memory_config.yaml +83 -0
  35. icdev/data/args/monitoring_config.yaml +127 -0
  36. icdev/data/args/mosa_config.yaml +190 -0
  37. icdev/data/args/nlq_config.yaml +35 -0
  38. icdev/data/args/observability_config.yaml +39 -0
  39. icdev/data/args/observability_tracing_config.yaml +170 -0
  40. icdev/data/args/oscal_tools_config.yaml +43 -0
  41. icdev/data/args/owasp_agentic_config.yaml +171 -0
  42. icdev/data/args/phase_registry.yaml +618 -0
  43. icdev/data/args/project_defaults.yaml +235 -0
  44. icdev/data/args/prompt_chains.yaml +163 -0
  45. icdev/data/args/resilience_config.yaml +50 -0
  46. icdev/data/args/ricoas_config.yaml +191 -0
  47. icdev/data/args/role_personas.yaml +362 -0
  48. icdev/data/args/scaling_config.yaml +176 -0
  49. icdev/data/args/security_gates.yaml +685 -0
  50. icdev/data/args/skill_injection_config.yaml +322 -0
  51. icdev/data/args/spec_config.yaml +53 -0
  52. icdev/data/args/supply_chain_config.yaml +76 -0
  53. icdev/data/args/translation_config.yaml +228 -0
  54. icdev/data/args/workflow_templates/ato_acceleration.yaml +54 -0
  55. icdev/data/args/workflow_templates/build_deploy.yaml +63 -0
  56. icdev/data/args/workflow_templates/full_compliance.yaml +43 -0
  57. icdev/data/args/workflow_templates/security_hardening.yaml +55 -0
  58. icdev/data/args/worktree_config.yaml +34 -0
  59. icdev/data/args/zta_config.yaml +247 -0
  60. icdev/data/context/__init__.py +1 -0
  61. icdev/data/context/agent/__init__.py +1 -0
  62. icdev/data/context/agent/response_schemas/__init__.py +1 -0
  63. icdev/data/context/agent/response_schemas/debate_position.json +46 -0
  64. icdev/data/context/agent/response_schemas/fitness_scorecard.json +74 -0
  65. icdev/data/context/agent/response_schemas/review_decision.json +39 -0
  66. icdev/data/context/agent/response_schemas/task_decomposition.json +82 -0
  67. icdev/data/context/agent/response_schemas/veto_decision.json +40 -0
  68. icdev/data/context/agentic/__init__.py +1 -0
  69. icdev/data/context/agentic/architecture_patterns.md +269 -0
  70. icdev/data/context/agentic/capability_registry.yaml +202 -0
  71. icdev/data/context/agentic/csp_mcp_registry.yaml +280 -0
  72. icdev/data/context/agentic/fitness_rubric.md +56 -0
  73. icdev/data/context/agentic/governance_baseline.md +205 -0
  74. icdev/data/context/ci/__init__.py +1 -0
  75. icdev/data/context/ci/worktree_templates.json +44 -0
  76. icdev/data/context/cloud/__init__.py +1 -0
  77. icdev/data/context/cloud/csp_service_registry.json +739 -0
  78. icdev/data/context/compliance/__init__.py +1 -0
  79. icdev/data/context/compliance/atlas_mitigations.json +293 -0
  80. icdev/data/context/compliance/atlas_techniques.json +833 -0
  81. icdev/data/context/compliance/cisa_sbd_requirements.json +432 -0
  82. icdev/data/context/compliance/cjis_security_policy.json +522 -0
  83. icdev/data/context/compliance/cmmc_practices.json +2494 -0
  84. icdev/data/context/compliance/cmmc_report_template.md +142 -0
  85. icdev/data/context/compliance/cnssi_1253_overlay.json +109 -0
  86. icdev/data/context/compliance/control_crosswalk.json +1914 -0
  87. icdev/data/context/compliance/control_families/__init__.py +1 -0
  88. icdev/data/context/compliance/csp_certifications.json +251 -0
  89. icdev/data/context/compliance/cssp_report_template.md +193 -0
  90. icdev/data/context/compliance/cui_templates/__init__.py +1 -0
  91. icdev/data/context/compliance/cui_templates/banner_block.txt +4 -0
  92. icdev/data/context/compliance/cui_templates/code_header.txt +8 -0
  93. icdev/data/context/compliance/cui_templates/document_template.md +35 -0
  94. icdev/data/context/compliance/data_type_framework_map.json +321 -0
  95. icdev/data/context/compliance/data_type_registry.json +147 -0
  96. icdev/data/context/compliance/dod_cssp_8530.json +463 -0
  97. icdev/data/context/compliance/eu_ai_act_annex_iii.json +108 -0
  98. icdev/data/context/compliance/export_templates/__init__.py +1 -0
  99. icdev/data/context/compliance/export_templates/emass_controls.csv.j2 +4 -0
  100. icdev/data/context/compliance/export_templates/evidence_package.md.j2 +39 -0
  101. icdev/data/context/compliance/export_templates/executive_summary.md.j2 +55 -0
  102. icdev/data/context/compliance/export_templates/poam_tracking.csv.j2 +4 -0
  103. icdev/data/context/compliance/fedramp_20x_ksi_schemas.json +133 -0
  104. icdev/data/context/compliance/fedramp_high_baseline.json +4370 -0
  105. icdev/data/context/compliance/fedramp_moderate_baseline.json +2183 -0
  106. icdev/data/context/compliance/fedramp_report_template.md +181 -0
  107. icdev/data/context/compliance/fips_200_areas.json +362 -0
  108. icdev/data/context/compliance/gao_ai_accountability.json +262 -0
  109. icdev/data/context/compliance/hipaa_security_rule.json +720 -0
  110. icdev/data/context/compliance/hitrust_csf_v11.json +930 -0
  111. icdev/data/context/compliance/impact_level_profiles.json +251 -0
  112. icdev/data/context/compliance/incident_response_template.md +1110 -0
  113. icdev/data/context/compliance/iso27001_2022_controls.json +750 -0
  114. icdev/data/context/compliance/iso27001_nist_bridge.json +382 -0
  115. icdev/data/context/compliance/iso42001_controls.json +254 -0
  116. icdev/data/context/compliance/ivv_checklist_template.md +80 -0
  117. icdev/data/context/compliance/ivv_report_template.md +116 -0
  118. icdev/data/context/compliance/ivv_requirements.json +372 -0
  119. icdev/data/context/compliance/mosa_crosswalk.json +327 -0
  120. icdev/data/context/compliance/mosa_framework.json +250 -0
  121. icdev/data/context/compliance/narrative_templates/AC.md.j2 +101 -0
  122. icdev/data/context/compliance/narrative_templates/AU.md.j2 +106 -0
  123. icdev/data/context/compliance/narrative_templates/IA.md.j2 +104 -0
  124. icdev/data/context/compliance/narrative_templates/SC.md.j2 +102 -0
  125. icdev/data/context/compliance/narrative_templates/SI.md.j2 +111 -0
  126. icdev/data/context/compliance/narrative_templates/__init__.py +1 -0
  127. icdev/data/context/compliance/narrative_templates/default.md.j2 +50 -0
  128. icdev/data/context/compliance/narrative_templates/executive_summary.j2 +27 -0
  129. icdev/data/context/compliance/narrative_templates/poam_milestone.j2 +19 -0
  130. icdev/data/context/compliance/narrative_templates/ssp_section.j2 +11 -0
  131. icdev/data/context/compliance/nist_800_171_controls.json +1552 -0
  132. icdev/data/context/compliance/nist_800_207_crosswalk.json +399 -0
  133. icdev/data/context/compliance/nist_800_207_zta.json +258 -0
  134. icdev/data/context/compliance/nist_800_53.json +324 -0
  135. icdev/data/context/compliance/nist_ai_600_1_genai.json +326 -0
  136. icdev/data/context/compliance/nist_ai_rmf.json +206 -0
  137. icdev/data/context/compliance/nist_sp_800_60_types.json +1667 -0
  138. icdev/data/context/compliance/omb_m25_21_high_impact_ai.json +248 -0
  139. icdev/data/context/compliance/omb_m26_04_unbiased_ai.json +262 -0
  140. icdev/data/context/compliance/owasp_agentic_asi.json +133 -0
  141. icdev/data/context/compliance/owasp_agentic_threats.json +285 -0
  142. icdev/data/context/compliance/owasp_llm_top10.json +274 -0
  143. icdev/data/context/compliance/pci_dss_v4.json +510 -0
  144. icdev/data/context/compliance/poam_template.md +117 -0
  145. icdev/data/context/compliance/safeai_controls.json +512 -0
  146. icdev/data/context/compliance/sbd_report_template.md +77 -0
  147. icdev/data/context/compliance/siem_config_templates/__init__.py +1 -0
  148. icdev/data/context/compliance/siem_config_templates/filebeat.yml +213 -0
  149. icdev/data/context/compliance/siem_config_templates/log_sources.json +208 -0
  150. icdev/data/context/compliance/soc2_trust_criteria.json +661 -0
  151. icdev/data/context/compliance/ssp_template.md +432 -0
  152. icdev/data/context/compliance/stig_templates/__init__.py +1 -0
  153. icdev/data/context/compliance/stig_templates/webapp_stig.json +139 -0
  154. icdev/data/context/compliance/xai_requirements.json +108 -0
  155. icdev/data/context/dashboard/__init__.py +1 -0
  156. icdev/data/context/dashboard/nlq_examples.json +50 -0
  157. icdev/data/context/dashboard/schema_descriptions.json +23 -0
  158. icdev/data/context/integration/__init__.py +1 -0
  159. icdev/data/context/integration/approval_workflows.json +32 -0
  160. icdev/data/context/integration/gitlab_field_mappings.json +33 -0
  161. icdev/data/context/integration/jira_field_mappings.json +32 -0
  162. icdev/data/context/integration/reqif_export_schema.json +23 -0
  163. icdev/data/context/integration/servicenow_field_mappings.json +22 -0
  164. icdev/data/context/languages/__init__.py +1 -0
  165. icdev/data/context/languages/framework_patterns.json +205 -0
  166. icdev/data/context/languages/language_registry.json +279 -0
  167. icdev/data/context/llm/__init__.py +1 -0
  168. icdev/data/context/llm/example_provider.py +86 -0
  169. icdev/data/context/mbse/__init__.py +1 -0
  170. icdev/data/context/mbse/des_report_template.md +162 -0
  171. icdev/data/context/mbse/des_requirements.json +411 -0
  172. icdev/data/context/mbse/digital_thread_patterns.json +403 -0
  173. icdev/data/context/mbse/reqif_schema.json +280 -0
  174. icdev/data/context/mbse/sysml_element_types.json +432 -0
  175. icdev/data/context/modernization/__init__.py +1 -0
  176. icdev/data/context/modernization/db_type_mappings.json +148 -0
  177. icdev/data/context/modernization/decomposition_patterns.json +284 -0
  178. icdev/data/context/modernization/framework_migration_patterns.json +359 -0
  179. icdev/data/context/modernization/migration_report_template.md +168 -0
  180. icdev/data/context/modernization/seven_rs_catalog.json +369 -0
  181. icdev/data/context/modernization/version_upgrade_rules.json +279 -0
  182. icdev/data/context/oscal/NIST_SP-800-53_rev5_catalog.json +254987 -0
  183. icdev/data/context/oscal/README.md +43 -0
  184. icdev/data/context/patterns/__init__.py +1 -0
  185. icdev/data/context/profiles/__init__.py +1 -0
  186. icdev/data/context/profiles/dod_baseline_v1.yaml +145 -0
  187. icdev/data/context/profiles/fedramp_baseline_v1.yaml +143 -0
  188. icdev/data/context/profiles/financial_baseline_v1.yaml +142 -0
  189. icdev/data/context/profiles/healthcare_baseline_v1.yaml +135 -0
  190. icdev/data/context/profiles/law_enforcement_v1.yaml +129 -0
  191. icdev/data/context/profiles/startup_v1.yaml +134 -0
  192. icdev/data/context/requirements/__init__.py +1 -0
  193. icdev/data/context/requirements/ambiguity_patterns.json +97 -0
  194. icdev/data/context/requirements/boundary_impact_rules.json +123 -0
  195. icdev/data/context/requirements/default_constitutions.json +67 -0
  196. icdev/data/context/requirements/document_extraction_rules.json +58 -0
  197. icdev/data/context/requirements/gap_patterns.json +108 -0
  198. icdev/data/context/requirements/readiness_rubric.json +78 -0
  199. icdev/data/context/requirements/red_alternative_patterns.json +210 -0
  200. icdev/data/context/requirements/safe_templates.json +72 -0
  201. icdev/data/context/requirements/spec_quality_checklist.json +122 -0
  202. icdev/data/context/simulation/__init__.py +1 -0
  203. icdev/data/context/simulation/architecture_patterns.json +36 -0
  204. icdev/data/context/simulation/coa_templates.json +38 -0
  205. icdev/data/context/simulation/cost_models.json +23 -0
  206. icdev/data/context/simulation/risk_categories.json +46 -0
  207. icdev/data/context/supply_chain/__init__.py +1 -0
  208. icdev/data/context/supply_chain/isa_templates.json +129 -0
  209. icdev/data/context/supply_chain/nist_800_161_controls.json +247 -0
  210. icdev/data/context/supply_chain/scrm_risk_matrix.json +147 -0
  211. icdev/data/context/templates/__init__.py +1 -0
  212. icdev/data/context/templates/ansible/__init__.py +1 -0
  213. icdev/data/context/templates/ansible/playbooks/__init__.py +1 -0
  214. icdev/data/context/templates/ansible/roles/__init__.py +1 -0
  215. icdev/data/context/templates/gitlab_ci/__init__.py +1 -0
  216. icdev/data/context/templates/grafana/__init__.py +1 -0
  217. icdev/data/context/templates/kubernetes/__init__.py +1 -0
  218. icdev/data/context/templates/project/__init__.py +1 -0
  219. icdev/data/context/templates/project/api/__init__.py +1 -0
  220. icdev/data/context/templates/project/cli/__init__.py +1 -0
  221. icdev/data/context/templates/project/data_pipeline/__init__.py +1 -0
  222. icdev/data/context/templates/project/iac/__init__.py +1 -0
  223. icdev/data/context/templates/project/javascript_frontend/__init__.py +1 -0
  224. icdev/data/context/templates/project/javascript_frontend/src/__init__.py +1 -0
  225. icdev/data/context/templates/project/javascript_frontend/tests/__init__.py +1 -0
  226. icdev/data/context/templates/project/microservice/__init__.py +1 -0
  227. icdev/data/context/templates/project/python_backend/__init__.py +1 -0
  228. icdev/data/context/templates/project/python_backend/src/__init__.py +1 -0
  229. icdev/data/context/templates/project/python_backend/tests/__init__.py +1 -0
  230. icdev/data/context/templates/project/python_backend/tests/features/__init__.py +1 -0
  231. icdev/data/context/templates/project/python_backend/tests/steps/__init__.py +1 -0
  232. icdev/data/context/templates/terraform/__init__.py +1 -0
  233. icdev/data/context/templates/terraform/govcloud_base/__init__.py +1 -0
  234. icdev/data/context/templates/terraform/modules/__init__.py +1 -0
  235. icdev/data/context/tone/__init__.py +1 -0
  236. icdev/data/context/translation/dependency_mappings.json +186 -0
  237. icdev/data/context/translation/type_mappings.json +149 -0
  238. icdev/data/docs/README.md +187 -0
  239. icdev/data/docs/__init__.py +1 -0
  240. icdev/data/docs/admin/gateway-guide.md +338 -0
  241. icdev/data/docs/admin/marketplace-guide.md +396 -0
  242. icdev/data/docs/admin/monitoring-guide.md +509 -0
  243. icdev/data/docs/architecture/compliance-framework.md +764 -0
  244. icdev/data/docs/architecture/database-schema.md +689 -0
  245. icdev/data/docs/architecture/gotcha-framework.md +518 -0
  246. icdev/data/docs/architecture/multi-agent-system.md +603 -0
  247. icdev/data/docs/dx/README.md +106 -0
  248. icdev/data/docs/dx/__init__.py +1 -0
  249. icdev/data/docs/dx/ci-cd-integration.md +378 -0
  250. icdev/data/docs/dx/claude-code-guide.md +213 -0
  251. icdev/data/docs/dx/companion-guide.md +232 -0
  252. icdev/data/docs/dx/dev-profiles.md +309 -0
  253. icdev/data/docs/dx/icdev-yaml-spec.md +219 -0
  254. icdev/data/docs/dx/integration-tiers.md +279 -0
  255. icdev/data/docs/dx/llm-routing-guide.md +456 -0
  256. icdev/data/docs/dx/quickstart.md +192 -0
  257. icdev/data/docs/dx/sdk-reference.md +356 -0
  258. icdev/data/docs/dx/unified-mcp-setup.md +525 -0
  259. icdev/data/docs/features/__init__.py +1 -0
  260. icdev/data/docs/features/phase-01-gotcha-framework.md +249 -0
  261. icdev/data/docs/features/phase-02-atlas-build-workflow.md +223 -0
  262. icdev/data/docs/features/phase-03-tdd-bdd-testing.md +261 -0
  263. icdev/data/docs/features/phase-04-nist-compliance.md +255 -0
  264. icdev/data/docs/features/phase-05-security-scanning.md +229 -0
  265. icdev/data/docs/features/phase-06-infrastructure-deployment.md +288 -0
  266. icdev/data/docs/features/phase-07-code-review-gates.md +276 -0
  267. icdev/data/docs/features/phase-08-self-healing.md +223 -0
  268. icdev/data/docs/features/phase-09-monitoring-observability.md +230 -0
  269. icdev/data/docs/features/phase-10-dashboard-web-ui.md +218 -0
  270. icdev/data/docs/features/phase-11-multi-agent-architecture.md +272 -0
  271. icdev/data/docs/features/phase-12-integration-testing.md +228 -0
  272. icdev/data/docs/features/phase-13-cicd-integration.md +257 -0
  273. icdev/data/docs/features/phase-14-secure-by-design-ivv.md +240 -0
  274. icdev/data/docs/features/phase-15-maintenance-audit.md +192 -0
  275. icdev/data/docs/features/phase-16-ato-acceleration.md +228 -0
  276. icdev/data/docs/features/phase-17-multi-framework-compliance.md +223 -0
  277. icdev/data/docs/features/phase-18-mbse-integration.md +242 -0
  278. icdev/data/docs/features/phase-19-agentic-generation.md +202 -0
  279. icdev/data/docs/features/phase-20-fips-security-categorization.md +198 -0
  280. icdev/data/docs/features/phase-21-saas-multi-tenancy.md +273 -0
  281. icdev/data/docs/features/phase-22-federated-gotcha-marketplace.md +242 -0
  282. icdev/data/docs/features/phase-23-universal-compliance-platform.md +238 -0
  283. icdev/data/docs/features/phase-24-devsecops-pipeline-security.md +198 -0
  284. icdev/data/docs/features/phase-25-zero-trust-architecture.md +220 -0
  285. icdev/data/docs/features/phase-26-dod-mosa.md +205 -0
  286. icdev/data/docs/features/phase-27-cli-capabilities.md +222 -0
  287. icdev/data/docs/features/phase-28-remote-command-gateway.md +235 -0
  288. icdev/data/docs/features/phase-29-proactive-monitoring.md +212 -0
  289. icdev/data/docs/features/phase-30-dashboard-auth.md +215 -0
  290. icdev/data/docs/features/phase-31-dashboard-ux-low-impact.md +188 -0
  291. icdev/data/docs/features/phase-32-dashboard-ux-medium-impact.md +223 -0
  292. icdev/data/docs/features/phase-33-modular-installation.md +218 -0
  293. icdev/data/docs/features/phase-34-dev-profiles.md +239 -0
  294. icdev/data/docs/features/phase-35-innovation-engine.md +257 -0
  295. icdev/data/docs/features/phase-36-evolutionary-intelligence.md +351 -0
  296. icdev/data/docs/features/phase-37-mitre-atlas-integration.md +485 -0
  297. icdev/data/docs/features/phase-38-cloud-agnostic-architecture.md +1033 -0
  298. icdev/data/docs/features/phase-39-observability-operations.md +178 -0
  299. icdev/data/docs/features/phase-40-nlq-compliance-queries.md +176 -0
  300. icdev/data/docs/features/phase-41-parallel-cicd.md +169 -0
  301. icdev/data/docs/features/phase-42-framework-planning.md +177 -0
  302. icdev/data/docs/features/phase-43-cross-language-translation.md +225 -0
  303. icdev/data/docs/features/phase-44-innovation-adaptation.md +227 -0
  304. icdev/data/docs/features/phase-45-owasp-agentic-security.md +239 -0
  305. icdev/data/docs/features/phase-46-observability-traceability-xai.md +240 -0
  306. icdev/data/docs/features/phase-47-unified-mcp-gateway.md +257 -0
  307. icdev/data/docs/features/phase-48-ai-transparency.md +203 -0
  308. icdev/data/docs/features/phase-49-ai-accountability.md +243 -0
  309. icdev/data/docs/features/phase-50-ai-governance-intake-chat.md +195 -0
  310. icdev/data/docs/features/phase-51-unified-chat-dashboard.md +240 -0
  311. icdev/data/docs/features/phase-52-code-intelligence.md +244 -0
  312. icdev/data/docs/features/phase-53-fedramp-20x-owasp-asi.md +359 -0
  313. icdev/data/docs/features/phase-54-slsa-swft-orchestration.md +379 -0
  314. icdev/data/docs/features/phase-55-a2a-v03-mcp-oauth.md +322 -0
  315. icdev/data/docs/features/phase-56-evidence-lineage.md +352 -0
  316. icdev/data/docs/features/phase-57-eu-ai-act-iron-bank.md +319 -0
  317. icdev/data/docs/features/phase-58-creative-engine.md +370 -0
  318. icdev/data/docs/features/phase-59-govcon-intelligence.md +535 -0
  319. icdev/data/docs/features/phase-60-cpmp.md +528 -0
  320. icdev/data/docs/features/phase-61-orchestration-improvements.md +534 -0
  321. icdev/data/docs/operations/dashboard-guide.md +354 -0
  322. icdev/data/docs/operations/deployment-guide.md +556 -0
  323. icdev/data/docs/operations/saas-admin-guide.md +439 -0
  324. icdev/data/docs/operations/security-operations-guide.md +733 -0
  325. icdev/data/docs/runbooks/backup-restore.md +412 -0
  326. icdev/data/docs/runbooks/troubleshooting.md +499 -0
  327. icdev/data/features/__init__.py +1 -0
  328. icdev/data/features/cicd_integration.feature +41 -0
  329. icdev/data/features/compliance_gates.feature +46 -0
  330. icdev/data/features/dashboard.feature +72 -0
  331. icdev/data/features/environment.py +25 -0
  332. icdev/data/features/project_management.feature +32 -0
  333. icdev/data/features/requirements_intake.feature +42 -0
  334. icdev/data/features/saas_platform.feature +53 -0
  335. icdev/data/features/security_scanning.feature +36 -0
  336. icdev/data/features/steps/__init__.py +1 -0
  337. icdev/data/features/steps/cicd_steps.py +465 -0
  338. icdev/data/features/steps/compliance_steps.py +308 -0
  339. icdev/data/features/steps/dashboard_steps.py +88 -0
  340. icdev/data/features/steps/project_steps.py +126 -0
  341. icdev/data/features/steps/requirements_intake_steps.py +689 -0
  342. icdev/data/features/steps/saas_platform_steps.py +572 -0
  343. icdev/data/features/steps/security_steps.py +236 -0
  344. icdev/data/features/steps/testing_steps.py +226 -0
  345. icdev/data/features/testing_pipeline.feature +42 -0
  346. icdev/data/goals/__init__.py +1 -0
  347. icdev/data/goals/agent_management.md +144 -0
  348. icdev/data/goals/agentic_generation.md +345 -0
  349. icdev/data/goals/agentic_threat_model.md +309 -0
  350. icdev/data/goals/ai_accountability.md +90 -0
  351. icdev/data/goals/ai_governance_intake.md +132 -0
  352. icdev/data/goals/ai_transparency.md +76 -0
  353. icdev/data/goals/atlas_integration.md +405 -0
  354. icdev/data/goals/ato_acceleration.md +139 -0
  355. icdev/data/goals/boundary_supply_chain.md +206 -0
  356. icdev/data/goals/build_app.md +544 -0
  357. icdev/data/goals/cicd_integration.md +86 -0
  358. icdev/data/goals/claude_dir_maintenance.md +77 -0
  359. icdev/data/goals/cli_capabilities.md +340 -0
  360. icdev/data/goals/cloud_agnostic.md +312 -0
  361. icdev/data/goals/code_intelligence.md +197 -0
  362. icdev/data/goals/code_review.md +94 -0
  363. icdev/data/goals/compliance_workflow.md +858 -0
  364. icdev/data/goals/continuous_harmonization.md +140 -0
  365. icdev/data/goals/cross_language_translation.md +171 -0
  366. icdev/data/goals/dashboard.md +142 -0
  367. icdev/data/goals/deploy_workflow.md +390 -0
  368. icdev/data/goals/devsecops_workflow.md +408 -0
  369. icdev/data/goals/evolutionary_intelligence.md +305 -0
  370. icdev/data/goals/external_integration.md +113 -0
  371. icdev/data/goals/framework_planning.md +63 -0
  372. icdev/data/goals/init_project.md +235 -0
  373. icdev/data/goals/innovation_engine.md +199 -0
  374. icdev/data/goals/integration_testing.md +189 -0
  375. icdev/data/goals/maintenance_audit.md +196 -0
  376. icdev/data/goals/manifest.md +56 -0
  377. icdev/data/goals/mbse_integration.md +504 -0
  378. icdev/data/goals/modernization_workflow.md +618 -0
  379. icdev/data/goals/monitoring.md +126 -0
  380. icdev/data/goals/mosa_workflow.md +463 -0
  381. icdev/data/goals/multi_agent_orchestration.md +68 -0
  382. icdev/data/goals/nlq_compliance.md +63 -0
  383. icdev/data/goals/observability.md +64 -0
  384. icdev/data/goals/observability_traceability_xai.md +154 -0
  385. icdev/data/goals/owasp_agentic_security.md +395 -0
  386. icdev/data/goals/parallel_cicd.md +61 -0
  387. icdev/data/goals/requirements_intake.md +213 -0
  388. icdev/data/goals/sbd_ivv_workflow.md +195 -0
  389. icdev/data/goals/security_categorization.md +133 -0
  390. icdev/data/goals/security_scan.md +381 -0
  391. icdev/data/goals/self_healing.md +120 -0
  392. icdev/data/goals/simulation_engine.md +111 -0
  393. icdev/data/goals/tdd_workflow.md +403 -0
  394. icdev/data/goals/zero_trust_architecture.md +403 -0
  395. icdev/data/hardprompts/__init__.py +1 -0
  396. icdev/data/hardprompts/agent/__init__.py +1 -0
  397. icdev/data/hardprompts/agent/agentic_architect.md +100 -0
  398. icdev/data/hardprompts/agent/debate_prompt.md +32 -0
  399. icdev/data/hardprompts/agent/fitness_evaluation.md +48 -0
  400. icdev/data/hardprompts/agent/governance_review.md +214 -0
  401. icdev/data/hardprompts/agent/reviewer_prompt.md +34 -0
  402. icdev/data/hardprompts/agent/skill_design.md +172 -0
  403. icdev/data/hardprompts/agent/task_decomposition.md +275 -0
  404. icdev/data/hardprompts/agent/veto_check_prompt.md +33 -0
  405. icdev/data/hardprompts/architect/__init__.py +1 -0
  406. icdev/data/hardprompts/architect/api_design.md +283 -0
  407. icdev/data/hardprompts/architect/data_model.md +277 -0
  408. icdev/data/hardprompts/architect/system_design.md +180 -0
  409. icdev/data/hardprompts/builder/__init__.py +1 -0
  410. icdev/data/hardprompts/builder/code_generation.md +59 -0
  411. icdev/data/hardprompts/builder/refactor.md +58 -0
  412. icdev/data/hardprompts/builder/scaffold_project.md +69 -0
  413. icdev/data/hardprompts/builder/test_generation.md +87 -0
  414. icdev/data/hardprompts/ci/__init__.py +1 -0
  415. icdev/data/hardprompts/ci/worktree_setup.md +35 -0
  416. icdev/data/hardprompts/compliance/__init__.py +1 -0
  417. icdev/data/hardprompts/compliance/cmmc_assessment.md +63 -0
  418. icdev/data/hardprompts/compliance/cssp_assessment.md +75 -0
  419. icdev/data/hardprompts/compliance/cui_marking.md +86 -0
  420. icdev/data/hardprompts/compliance/fedramp_assessment.md +55 -0
  421. icdev/data/hardprompts/compliance/ivv_assessment.md +96 -0
  422. icdev/data/hardprompts/compliance/poam_generation.md +57 -0
  423. icdev/data/hardprompts/compliance/sbd_assessment.md +101 -0
  424. icdev/data/hardprompts/compliance/security_categorization.md +74 -0
  425. icdev/data/hardprompts/compliance/ssp_generation.md +56 -0
  426. icdev/data/hardprompts/compliance/stig_evaluation.md +63 -0
  427. icdev/data/hardprompts/dashboard/__init__.py +1 -0
  428. icdev/data/hardprompts/dashboard/nlq_system_prompt.md +26 -0
  429. icdev/data/hardprompts/infra/__init__.py +1 -0
  430. icdev/data/hardprompts/infra/k8s_manifests.md +118 -0
  431. icdev/data/hardprompts/infra/pipeline_generation.md +160 -0
  432. icdev/data/hardprompts/infra/terraform_generation.md +92 -0
  433. icdev/data/hardprompts/integration/__init__.py +1 -0
  434. icdev/data/hardprompts/integration/approval_review.md +17 -0
  435. icdev/data/hardprompts/integration/jira_mapping.md +25 -0
  436. icdev/data/hardprompts/integration/servicenow_mapping.md +14 -0
  437. icdev/data/hardprompts/knowledge/__init__.py +1 -0
  438. icdev/data/hardprompts/knowledge/pattern_detection.md +73 -0
  439. icdev/data/hardprompts/knowledge/recommendation_engine.md +90 -0
  440. icdev/data/hardprompts/knowledge/root_cause_analysis.md +91 -0
  441. icdev/data/hardprompts/maintenance/__init__.py +1 -0
  442. icdev/data/hardprompts/maintenance/maintenance_assessment.md +82 -0
  443. icdev/data/hardprompts/mbse/__init__.py +1 -0
  444. icdev/data/hardprompts/mbse/digital_thread.md +67 -0
  445. icdev/data/hardprompts/mbse/model_import.md +62 -0
  446. icdev/data/hardprompts/mbse/model_to_code.md +65 -0
  447. icdev/data/hardprompts/modernization/__init__.py +1 -0
  448. icdev/data/hardprompts/modernization/legacy_analysis.md +93 -0
  449. icdev/data/hardprompts/modernization/migration_planning.md +150 -0
  450. icdev/data/hardprompts/modernization/seven_r_assessment.md +107 -0
  451. icdev/data/hardprompts/requirements/__init__.py +1 -0
  452. icdev/data/hardprompts/requirements/bdd_generation.md +35 -0
  453. icdev/data/hardprompts/requirements/clarification_prioritization.md +29 -0
  454. icdev/data/hardprompts/requirements/decomposition.md +60 -0
  455. icdev/data/hardprompts/requirements/document_extraction.md +45 -0
  456. icdev/data/hardprompts/requirements/gap_detection.md +70 -0
  457. icdev/data/hardprompts/requirements/intake_conversation.md +101 -0
  458. icdev/data/hardprompts/requirements/readiness_assessment.md +39 -0
  459. icdev/data/hardprompts/requirements/spec_quality.md +33 -0
  460. icdev/data/hardprompts/requirements/traceability_analysis.md +23 -0
  461. icdev/data/hardprompts/security/__init__.py +1 -0
  462. icdev/data/hardprompts/security/endpoint_security.md +78 -0
  463. icdev/data/hardprompts/security/threat_model.md +70 -0
  464. icdev/data/hardprompts/security/vulnerability_assessment.md +81 -0
  465. icdev/data/hardprompts/simulation/__init__.py +1 -0
  466. icdev/data/hardprompts/simulation/architecture_impact.md +27 -0
  467. icdev/data/hardprompts/simulation/coa_alternative.md +27 -0
  468. icdev/data/hardprompts/simulation/coa_generation.md +25 -0
  469. icdev/data/hardprompts/simulation/compliance_impact.md +28 -0
  470. icdev/data/hardprompts/simulation/cost_estimation.md +33 -0
  471. icdev/data/hardprompts/simulation/risk_assessment.md +28 -0
  472. icdev/data/hardprompts/translation/code_translation.md +68 -0
  473. icdev/data/hardprompts/translation/dependency_suggestion.md +44 -0
  474. icdev/data/hardprompts/translation/test_translation.md +64 -0
  475. icdev/data/hardprompts/translation/translation_repair.md +59 -0
  476. icdev/py.typed +0 -0
  477. icdev/tools/__init__.py +1 -0
  478. icdev/tools/_gen_formatter.py +12 -0
  479. icdev/tools/a2a/__init__.py +1 -0
  480. icdev/tools/a2a/agent_cards/architect.json +43 -0
  481. icdev/tools/a2a/agent_cards/builder.json +50 -0
  482. icdev/tools/a2a/agent_cards/compliance.json +57 -0
  483. icdev/tools/a2a/agent_cards/devsecops.json +71 -0
  484. icdev/tools/a2a/agent_cards/infra.json +57 -0
  485. icdev/tools/a2a/agent_cards/integration.json +57 -0
  486. icdev/tools/a2a/agent_cards/knowledge.json +43 -0
  487. icdev/tools/a2a/agent_cards/mbse.json +57 -0
  488. icdev/tools/a2a/agent_cards/modernization.json +50 -0
  489. icdev/tools/a2a/agent_cards/monitor.json +43 -0
  490. icdev/tools/a2a/agent_cards/orchestrator.json +36 -0
  491. icdev/tools/a2a/agent_cards/requirements_analyst.json +64 -0
  492. icdev/tools/a2a/agent_cards/security.json +50 -0
  493. icdev/tools/a2a/agent_cards/simulation.json +57 -0
  494. icdev/tools/a2a/agent_cards/supply_chain.json +50 -0
  495. icdev/tools/a2a/agent_client.py +349 -0
  496. icdev/tools/a2a/agent_registry.py +412 -0
  497. icdev/tools/a2a/agent_server.py +579 -0
  498. icdev/tools/a2a/task.py +200 -0
  499. icdev/tools/agent/__init__.py +2 -0
  500. icdev/tools/agent/a2a_agent_card_generator.py +285 -0
  501. icdev/tools/agent/a2a_discovery_server.py +250 -0
  502. icdev/tools/agent/agent_executor.py +529 -0
  503. icdev/tools/agent/agent_memory.py +557 -0
  504. icdev/tools/agent/agent_models.py +51 -0
  505. icdev/tools/agent/atlas_critique.py +908 -0
  506. icdev/tools/agent/authority.py +443 -0
  507. icdev/tools/agent/bedrock_client.py +1075 -0
  508. icdev/tools/agent/collaboration.py +871 -0
  509. icdev/tools/agent/dispatcher_mode.py +665 -0
  510. icdev/tools/agent/mailbox.py +575 -0
  511. icdev/tools/agent/prompt_chain_executor.py +1064 -0
  512. icdev/tools/agent/session_purpose.py +350 -0
  513. icdev/tools/agent/skill_router.py +638 -0
  514. icdev/tools/agent/skill_selector.py +486 -0
  515. icdev/tools/agent/team_orchestrator.py +1108 -0
  516. icdev/tools/agent/token_tracker.py +290 -0
  517. icdev/tools/analysis/__init__.py +1 -0
  518. icdev/tools/analysis/code_analyzer.py +780 -0
  519. icdev/tools/analysis/runtime_feedback.py +389 -0
  520. icdev/tools/audit/__init__.py +1 -0
  521. icdev/tools/audit/audit_logger.py +196 -0
  522. icdev/tools/audit/audit_query.py +157 -0
  523. icdev/tools/audit/decision_recorder.py +72 -0
  524. icdev/tools/builder/__init__.py +1 -0
  525. icdev/tools/builder/agentic_fitness.py +534 -0
  526. icdev/tools/builder/agentic_test_templates/test_a2a_callback.py +117 -0
  527. icdev/tools/builder/agentic_test_templates/test_a2a_lifecycle.feature +52 -0
  528. icdev/tools/builder/agentic_test_templates/test_agent_card.feature +37 -0
  529. icdev/tools/builder/agentic_test_templates/test_agent_health.py +128 -0
  530. icdev/tools/builder/agentic_test_templates/test_memory_system.feature +50 -0
  531. icdev/tools/builder/agentic_test_templates/test_skill_execution.feature +40 -0
  532. icdev/tools/builder/app_blueprint.py +1583 -0
  533. icdev/tools/builder/child_app_generator.py +2852 -0
  534. icdev/tools/builder/claude_md_generator.py +1734 -0
  535. icdev/tools/builder/code_generator.py +3703 -0
  536. icdev/tools/builder/db_init_generator.py +1709 -0
  537. icdev/tools/builder/dev_profile_manager.py +954 -0
  538. icdev/tools/builder/formatter.py +768 -0
  539. icdev/tools/builder/goal_adapter.py +592 -0
  540. icdev/tools/builder/gotcha_validator.py +812 -0
  541. icdev/tools/builder/language_support.py +441 -0
  542. icdev/tools/builder/linter.py +976 -0
  543. icdev/tools/builder/profile_detector.py +657 -0
  544. icdev/tools/builder/profile_md_generator.py +723 -0
  545. icdev/tools/builder/scaffolder.py +1590 -0
  546. icdev/tools/builder/scaffolder_extended.py +1771 -0
  547. icdev/tools/builder/test_writer.py +950 -0
  548. icdev/tools/ci/__init__.py +2 -0
  549. icdev/tools/ci/connectors/__init__.py +2 -0
  550. icdev/tools/ci/connectors/base_connector.py +80 -0
  551. icdev/tools/ci/connectors/connector_registry.py +188 -0
  552. icdev/tools/ci/connectors/mattermost_connector.py +159 -0
  553. icdev/tools/ci/connectors/slack_connector.py +197 -0
  554. icdev/tools/ci/core/__init__.py +2 -0
  555. icdev/tools/ci/core/air_gap_detector.py +115 -0
  556. icdev/tools/ci/core/comment_handler.py +192 -0
  557. icdev/tools/ci/core/conversation_manager.py +479 -0
  558. icdev/tools/ci/core/event_envelope.py +500 -0
  559. icdev/tools/ci/core/event_router.py +443 -0
  560. icdev/tools/ci/core/failure_parser.py +397 -0
  561. icdev/tools/ci/core/recovery_engine.py +527 -0
  562. icdev/tools/ci/modules/__init__.py +2 -0
  563. icdev/tools/ci/modules/agent.py +271 -0
  564. icdev/tools/ci/modules/git_ops.py +175 -0
  565. icdev/tools/ci/modules/state.py +117 -0
  566. icdev/tools/ci/modules/vcs.py +303 -0
  567. icdev/tools/ci/modules/workflow_ops.py +295 -0
  568. icdev/tools/ci/modules/worktree.py +340 -0
  569. icdev/tools/ci/pipeline_config_generator.py +558 -0
  570. icdev/tools/ci/triggers/__init__.py +2 -0
  571. icdev/tools/ci/triggers/gitlab_task_monitor.py +330 -0
  572. icdev/tools/ci/triggers/poll_trigger.py +237 -0
  573. icdev/tools/ci/triggers/webhook_server.py +356 -0
  574. icdev/tools/ci/workflows/__init__.py +2 -0
  575. icdev/tools/ci/workflows/icdev_build.py +140 -0
  576. icdev/tools/ci/workflows/icdev_comply.py +284 -0
  577. icdev/tools/ci/workflows/icdev_document.py +152 -0
  578. icdev/tools/ci/workflows/icdev_e2e.py +188 -0
  579. icdev/tools/ci/workflows/icdev_patch.py +186 -0
  580. icdev/tools/ci/workflows/icdev_plan.py +202 -0
  581. icdev/tools/ci/workflows/icdev_plan_build.py +41 -0
  582. icdev/tools/ci/workflows/icdev_plan_build_test.py +46 -0
  583. icdev/tools/ci/workflows/icdev_plan_build_test_review.py +47 -0
  584. icdev/tools/ci/workflows/icdev_review.py +126 -0
  585. icdev/tools/ci/workflows/icdev_sdlc.py +261 -0
  586. icdev/tools/ci/workflows/icdev_test.py +240 -0
  587. icdev/tools/cli/__init__.py +1 -0
  588. icdev/tools/cli/output_formatter.py +756 -0
  589. icdev/tools/cli_formatter.py +42 -0
  590. icdev/tools/cloud/__init__.py +11 -0
  591. icdev/tools/cloud/cloud_mode_manager.py +364 -0
  592. icdev/tools/cloud/csp_changelog.py +383 -0
  593. icdev/tools/cloud/csp_health_checker.py +268 -0
  594. icdev/tools/cloud/csp_monitor.py +951 -0
  595. icdev/tools/cloud/iam_provider.py +593 -0
  596. icdev/tools/cloud/kms_provider.py +346 -0
  597. icdev/tools/cloud/monitoring_provider.py +628 -0
  598. icdev/tools/cloud/provider_factory.py +376 -0
  599. icdev/tools/cloud/region_validator.py +345 -0
  600. icdev/tools/cloud/registry_provider.py +563 -0
  601. icdev/tools/cloud/secrets_provider.py +486 -0
  602. icdev/tools/cloud/storage_provider.py +446 -0
  603. icdev/tools/compat/__init__.py +21 -0
  604. icdev/tools/compat/cli_harmonizer.py +251 -0
  605. icdev/tools/compat/datetime_utils.py +18 -0
  606. icdev/tools/compat/db_utils.py +160 -0
  607. icdev/tools/compat/platform_utils.py +123 -0
  608. icdev/tools/compliance/__init__.py +1 -0
  609. icdev/tools/compliance/accountability_manager.py +397 -0
  610. icdev/tools/compliance/ai_accountability_audit.py +294 -0
  611. icdev/tools/compliance/ai_impact_assessor.py +273 -0
  612. icdev/tools/compliance/ai_incident_response.py +301 -0
  613. icdev/tools/compliance/ai_inventory_manager.py +239 -0
  614. icdev/tools/compliance/ai_reassessment_scheduler.py +256 -0
  615. icdev/tools/compliance/ai_transparency_audit.py +248 -0
  616. icdev/tools/compliance/atlas_assessor.py +278 -0
  617. icdev/tools/compliance/atlas_report_generator.py +1211 -0
  618. icdev/tools/compliance/base_assessor.py +597 -0
  619. icdev/tools/compliance/cato_monitor.py +1385 -0
  620. icdev/tools/compliance/cato_scheduler.py +699 -0
  621. icdev/tools/compliance/cjis_assessor.py +76 -0
  622. icdev/tools/compliance/classification_manager.py +1353 -0
  623. icdev/tools/compliance/cmmc_assessor.py +1491 -0
  624. icdev/tools/compliance/cmmc_report_generator.py +1100 -0
  625. icdev/tools/compliance/compliance_detector.py +463 -0
  626. icdev/tools/compliance/compliance_exporter.py +427 -0
  627. icdev/tools/compliance/compliance_status.py +825 -0
  628. icdev/tools/compliance/control_mapper.py +505 -0
  629. icdev/tools/compliance/crosswalk_engine.py +1203 -0
  630. icdev/tools/compliance/cssp_assessor.py +1045 -0
  631. icdev/tools/compliance/cssp_evidence_collector.py +729 -0
  632. icdev/tools/compliance/cssp_report_generator.py +1116 -0
  633. icdev/tools/compliance/cui_marker.py +388 -0
  634. icdev/tools/compliance/diagram_validator.py +600 -0
  635. icdev/tools/compliance/emass/__init__.py +2 -0
  636. icdev/tools/compliance/emass/emass_client.py +840 -0
  637. icdev/tools/compliance/emass/emass_export.py +777 -0
  638. icdev/tools/compliance/emass/emass_sync.py +826 -0
  639. icdev/tools/compliance/eu_ai_act_classifier.py +194 -0
  640. icdev/tools/compliance/evidence_collector.py +468 -0
  641. icdev/tools/compliance/fairness_assessor.py +316 -0
  642. icdev/tools/compliance/fedramp_assessor.py +1808 -0
  643. icdev/tools/compliance/fedramp_authorization_packager.py +137 -0
  644. icdev/tools/compliance/fedramp_ksi_generator.py +355 -0
  645. icdev/tools/compliance/fedramp_report_generator.py +1128 -0
  646. icdev/tools/compliance/fips199_categorizer.py +881 -0
  647. icdev/tools/compliance/fips200_validator.py +315 -0
  648. icdev/tools/compliance/gao_ai_assessor.py +231 -0
  649. icdev/tools/compliance/gao_evidence_builder.py +308 -0
  650. icdev/tools/compliance/hipaa_assessor.py +78 -0
  651. icdev/tools/compliance/hitrust_assessor.py +49 -0
  652. icdev/tools/compliance/incident_response_plan.py +718 -0
  653. icdev/tools/compliance/iso27001_assessor.py +92 -0
  654. icdev/tools/compliance/iso42001_assessor.py +114 -0
  655. icdev/tools/compliance/ivv_assessor.py +2327 -0
  656. icdev/tools/compliance/ivv_report_generator.py +1662 -0
  657. icdev/tools/compliance/model_card_generator.py +297 -0
  658. icdev/tools/compliance/mosa_assessor.py +117 -0
  659. icdev/tools/compliance/multi_regime_assessor.py +451 -0
  660. icdev/tools/compliance/narrative_generator.py +1013 -0
  661. icdev/tools/compliance/nist_800_207_assessor.py +191 -0
  662. icdev/tools/compliance/nist_ai_600_1_assessor.py +188 -0
  663. icdev/tools/compliance/nist_ai_rmf_assessor.py +110 -0
  664. icdev/tools/compliance/nist_lookup.py +245 -0
  665. icdev/tools/compliance/omb_m25_21_assessor.py +228 -0
  666. icdev/tools/compliance/omb_m26_04_assessor.py +188 -0
  667. icdev/tools/compliance/oscal_catalog_adapter.py +395 -0
  668. icdev/tools/compliance/oscal_generator.py +2170 -0
  669. icdev/tools/compliance/oscal_tools.py +1182 -0
  670. icdev/tools/compliance/owasp_agentic_assessor.py +226 -0
  671. icdev/tools/compliance/owasp_asi_assessor.py +200 -0
  672. icdev/tools/compliance/owasp_llm_assessor.py +244 -0
  673. icdev/tools/compliance/pci_dss_assessor.py +80 -0
  674. icdev/tools/compliance/pi_compliance_tracker.py +1461 -0
  675. icdev/tools/compliance/poam_generator.py +405 -0
  676. icdev/tools/compliance/resolve_marking.py +283 -0
  677. icdev/tools/compliance/sbd_assessor.py +2068 -0
  678. icdev/tools/compliance/sbd_report_generator.py +1236 -0
  679. icdev/tools/compliance/sbom_generator.py +1008 -0
  680. icdev/tools/compliance/siem_config_generator.py +674 -0
  681. icdev/tools/compliance/slsa_attestation_generator.py +490 -0
  682. icdev/tools/compliance/soc2_assessor.py +77 -0
  683. icdev/tools/compliance/ssp_generator.py +573 -0
  684. icdev/tools/compliance/stig_checker.py +727 -0
  685. icdev/tools/compliance/swft_evidence_bundler.py +337 -0
  686. icdev/tools/compliance/system_card_generator.py +309 -0
  687. icdev/tools/compliance/traceability_matrix.py +1281 -0
  688. icdev/tools/compliance/universal_classification_manager.py +1172 -0
  689. icdev/tools/compliance/xacta/__init__.py +2 -0
  690. icdev/tools/compliance/xacta/xacta_client.py +449 -0
  691. icdev/tools/compliance/xacta/xacta_export.py +557 -0
  692. icdev/tools/compliance/xacta/xacta_sync.py +333 -0
  693. icdev/tools/compliance/xai_assessor.py +231 -0
  694. icdev/tools/dashboard/__init__.py +1 -0
  695. icdev/tools/dashboard/api/__init__.py +1 -0
  696. icdev/tools/dashboard/api/_pipeline_state.py +17 -0
  697. icdev/tools/dashboard/api/activity.py +206 -0
  698. icdev/tools/dashboard/api/admin.py +176 -0
  699. icdev/tools/dashboard/api/agents.py +53 -0
  700. icdev/tools/dashboard/api/ai_accountability.py +163 -0
  701. icdev/tools/dashboard/api/ai_transparency.py +198 -0
  702. icdev/tools/dashboard/api/audit.py +58 -0
  703. icdev/tools/dashboard/api/batch.py +666 -0
  704. icdev/tools/dashboard/api/chat.py +241 -0
  705. icdev/tools/dashboard/api/cicd.py +219 -0
  706. icdev/tools/dashboard/api/code_quality.py +223 -0
  707. icdev/tools/dashboard/api/compliance.py +171 -0
  708. icdev/tools/dashboard/api/cpmp.py +915 -0
  709. icdev/tools/dashboard/api/diagrams.py +65 -0
  710. icdev/tools/dashboard/api/events.py +250 -0
  711. icdev/tools/dashboard/api/evidence.py +99 -0
  712. icdev/tools/dashboard/api/fedramp_20x.py +77 -0
  713. icdev/tools/dashboard/api/govcon.py +1095 -0
  714. icdev/tools/dashboard/api/intake.py +1171 -0
  715. icdev/tools/dashboard/api/lineage.py +163 -0
  716. icdev/tools/dashboard/api/metrics.py +155 -0
  717. icdev/tools/dashboard/api/nlq.py +72 -0
  718. icdev/tools/dashboard/api/orchestration.py +472 -0
  719. icdev/tools/dashboard/api/oscal.py +183 -0
  720. icdev/tools/dashboard/api/prod_audit.py +183 -0
  721. icdev/tools/dashboard/api/projects.py +191 -0
  722. icdev/tools/dashboard/api/proposals.py +1084 -0
  723. icdev/tools/dashboard/api/traces.py +363 -0
  724. icdev/tools/dashboard/api/usage.py +234 -0
  725. icdev/tools/dashboard/app.py +1986 -0
  726. icdev/tools/dashboard/auth.py +500 -0
  727. icdev/tools/dashboard/byok.py +245 -0
  728. icdev/tools/dashboard/chat_manager.py +675 -0
  729. icdev/tools/dashboard/config.py +116 -0
  730. icdev/tools/dashboard/diagram_definitions.py +642 -0
  731. icdev/tools/dashboard/nlq_processor.py +323 -0
  732. icdev/tools/dashboard/phase_loader.py +136 -0
  733. icdev/tools/dashboard/sse_manager.py +89 -0
  734. icdev/tools/dashboard/state_tracker.py +267 -0
  735. icdev/tools/dashboard/static/css/style.css +706 -0
  736. icdev/tools/dashboard/static/css/ux.css +2047 -0
  737. icdev/tools/dashboard/static/js/activity.js +322 -0
  738. icdev/tools/dashboard/static/js/api.js +161 -0
  739. icdev/tools/dashboard/static/js/batch.js +814 -0
  740. icdev/tools/dashboard/static/js/charts.js +618 -0
  741. icdev/tools/dashboard/static/js/chat.js +1514 -0
  742. icdev/tools/dashboard/static/js/kanban.js +113 -0
  743. icdev/tools/dashboard/static/js/live.js +569 -0
  744. icdev/tools/dashboard/static/js/mermaid-icdev.js +332 -0
  745. icdev/tools/dashboard/static/js/proposals.js +588 -0
  746. icdev/tools/dashboard/static/js/shortcuts.js +544 -0
  747. icdev/tools/dashboard/static/js/tables.js +652 -0
  748. icdev/tools/dashboard/static/js/tour.js +524 -0
  749. icdev/tools/dashboard/static/js/ux.js +942 -0
  750. icdev/tools/dashboard/templates/404.html +10 -0
  751. icdev/tools/dashboard/templates/activity.html +80 -0
  752. icdev/tools/dashboard/templates/admin/users.html +144 -0
  753. icdev/tools/dashboard/templates/ai_accountability.html +235 -0
  754. icdev/tools/dashboard/templates/ai_transparency.html +263 -0
  755. icdev/tools/dashboard/templates/base.html +104 -0
  756. icdev/tools/dashboard/templates/batch.html +23 -0
  757. icdev/tools/dashboard/templates/chat.html +332 -0
  758. icdev/tools/dashboard/templates/children.html +149 -0
  759. icdev/tools/dashboard/templates/cicd.html +253 -0
  760. icdev/tools/dashboard/templates/code_quality.html +214 -0
  761. icdev/tools/dashboard/templates/cpmp/cor_detail.html +220 -0
  762. icdev/tools/dashboard/templates/cpmp/cor_portal.html +91 -0
  763. icdev/tools/dashboard/templates/cpmp/deliverable_detail.html +197 -0
  764. icdev/tools/dashboard/templates/cpmp/detail.html +578 -0
  765. icdev/tools/dashboard/templates/cpmp/portfolio.html +202 -0
  766. icdev/tools/dashboard/templates/dev_profiles.html +304 -0
  767. icdev/tools/dashboard/templates/diagrams.html +224 -0
  768. icdev/tools/dashboard/templates/events/timeline.html +232 -0
  769. icdev/tools/dashboard/templates/evidence.html +134 -0
  770. icdev/tools/dashboard/templates/fedramp_20x.html +207 -0
  771. icdev/tools/dashboard/templates/gateway.html +244 -0
  772. icdev/tools/dashboard/templates/govcon/capabilities.html +135 -0
  773. icdev/tools/dashboard/templates/govcon/pipeline.html +214 -0
  774. icdev/tools/dashboard/templates/govcon/requirements.html +120 -0
  775. icdev/tools/dashboard/templates/index.html +254 -0
  776. icdev/tools/dashboard/templates/lineage.html +141 -0
  777. icdev/tools/dashboard/templates/login.html +51 -0
  778. icdev/tools/dashboard/templates/monitoring/overview.html +193 -0
  779. icdev/tools/dashboard/templates/orchestration/dashboard.html +545 -0
  780. icdev/tools/dashboard/templates/oscal.html +263 -0
  781. icdev/tools/dashboard/templates/phases.html +150 -0
  782. icdev/tools/dashboard/templates/prod_audit.html +280 -0
  783. icdev/tools/dashboard/templates/profile.html +183 -0
  784. icdev/tools/dashboard/templates/projects/detail.html +583 -0
  785. icdev/tools/dashboard/templates/projects/list.html +47 -0
  786. icdev/tools/dashboard/templates/proposals/detail.html +1253 -0
  787. icdev/tools/dashboard/templates/proposals/list.html +179 -0
  788. icdev/tools/dashboard/templates/proposals/section_detail.html +193 -0
  789. icdev/tools/dashboard/templates/provenance.html +181 -0
  790. icdev/tools/dashboard/templates/query/nlq.html +234 -0
  791. icdev/tools/dashboard/templates/quick_paths.html +69 -0
  792. icdev/tools/dashboard/templates/traces.html +155 -0
  793. icdev/tools/dashboard/templates/translation_detail.html +199 -0
  794. icdev/tools/dashboard/templates/translations.html +162 -0
  795. icdev/tools/dashboard/templates/usage.html +225 -0
  796. icdev/tools/dashboard/templates/wizard.html +539 -0
  797. icdev/tools/dashboard/templates/xai.html +208 -0
  798. icdev/tools/dashboard/ux_helpers.py +962 -0
  799. icdev/tools/dashboard/websocket.py +81 -0
  800. icdev/tools/db/__init__.py +1 -0
  801. icdev/tools/db/backup.py +312 -0
  802. icdev/tools/db/backup_manager.py +832 -0
  803. icdev/tools/db/init_icdev_db.py +5900 -0
  804. icdev/tools/db/migrate.py +178 -0
  805. icdev/tools/db/migration_runner.py +549 -0
  806. icdev/tools/db/migrations/001_baseline/meta.json +9 -0
  807. icdev/tools/db/migrations/001_baseline/up.py +68 -0
  808. icdev/tools/db/migrations/002_memory_enhancements/down.sql +8 -0
  809. icdev/tools/db/migrations/002_memory_enhancements/meta.json +9 -0
  810. icdev/tools/db/migrations/002_memory_enhancements/up.py +118 -0
  811. icdev/tools/db/migrations/003_dev_profiles/meta.json +8 -0
  812. icdev/tools/db/migrations/003_dev_profiles/up.py +93 -0
  813. icdev/tools/db/migrations/004_innovation_engine/down.py +19 -0
  814. icdev/tools/db/migrations/004_innovation_engine/up.py +227 -0
  815. icdev/tools/db/migrations/005_phase_37_ai_security/down.py +19 -0
  816. icdev/tools/db/migrations/005_phase_37_ai_security/up.py +258 -0
  817. icdev/tools/db/migrations/006_phase_36_evolution/down.py +21 -0
  818. icdev/tools/db/migrations/006_phase_36_evolution/up.py +323 -0
  819. icdev/tools/db/migrations/007_phase_38_cloud/down.py +14 -0
  820. icdev/tools/db/migrations/007_phase_38_cloud/up.py +110 -0
  821. icdev/tools/db/migrations/008_phase36_37_integration/up.py +55 -0
  822. icdev/tools/db/migrations/__init__.py +2 -0
  823. icdev/tools/devsecops/__init__.py +2 -0
  824. icdev/tools/devsecops/attestation_manager.py +458 -0
  825. icdev/tools/devsecops/network_segmentation_generator.py +614 -0
  826. icdev/tools/devsecops/pdp_config_generator.py +1256 -0
  827. icdev/tools/devsecops/pipeline_security_generator.py +484 -0
  828. icdev/tools/devsecops/policy_generator.py +653 -0
  829. icdev/tools/devsecops/profile_manager.py +388 -0
  830. icdev/tools/devsecops/service_mesh_generator.py +1073 -0
  831. icdev/tools/devsecops/zta_maturity_scorer.py +368 -0
  832. icdev/tools/devsecops/zta_terraform_generator.py +1303 -0
  833. icdev/tools/dx/__init__.py +3 -0
  834. icdev/tools/dx/companion.py +266 -0
  835. icdev/tools/dx/instruction_generator.py +753 -0
  836. icdev/tools/dx/mcp_config_generator.py +282 -0
  837. icdev/tools/dx/skill_translator.py +425 -0
  838. icdev/tools/dx/tool_detector.py +144 -0
  839. icdev/tools/extensions/__init__.py +21 -0
  840. icdev/tools/extensions/builtins/010_ai_governance_chat.py +277 -0
  841. icdev/tools/extensions/builtins/__init__.py +2 -0
  842. icdev/tools/extensions/extension_manager.py +455 -0
  843. icdev/tools/infra/__init__.py +1 -0
  844. icdev/tools/infra/ansible_generator.py +869 -0
  845. icdev/tools/infra/dockerfile_generator.py +361 -0
  846. icdev/tools/infra/infra_status.py +393 -0
  847. icdev/tools/infra/ironbank_metadata_generator.py +411 -0
  848. icdev/tools/infra/k8s_generator.py +1002 -0
  849. icdev/tools/infra/pipeline_generator.py +832 -0
  850. icdev/tools/infra/rollback.py +400 -0
  851. icdev/tools/infra/terraform_generator.py +1142 -0
  852. icdev/tools/infra/terraform_generator_azure.py +1254 -0
  853. icdev/tools/infra/terraform_generator_gcp.py +953 -0
  854. icdev/tools/infra/terraform_generator_ibm.py +360 -0
  855. icdev/tools/infra/terraform_generator_oci.py +919 -0
  856. icdev/tools/infra/terraform_generator_onprem.py +319 -0
  857. icdev/tools/innovation/__init__.py +8 -0
  858. icdev/tools/innovation/competitive_intel.py +492 -0
  859. icdev/tools/innovation/innovation_manager.py +681 -0
  860. icdev/tools/innovation/introspective_analyzer.py +774 -0
  861. icdev/tools/innovation/register_external_patterns.py +440 -0
  862. icdev/tools/innovation/signal_ranker.py +1038 -0
  863. icdev/tools/innovation/solution_generator.py +697 -0
  864. icdev/tools/innovation/standards_monitor.py +466 -0
  865. icdev/tools/innovation/trend_detector.py +1046 -0
  866. icdev/tools/innovation/triage_engine.py +1149 -0
  867. icdev/tools/innovation/web_scanner.py +894 -0
  868. icdev/tools/installer/__init__.py +1 -0
  869. icdev/tools/installer/compliance_configurator.py +637 -0
  870. icdev/tools/installer/installer.py +1711 -0
  871. icdev/tools/installer/module_registry.py +805 -0
  872. icdev/tools/installer/platform_setup.py +961 -0
  873. icdev/tools/integration/__init__.py +2 -0
  874. icdev/tools/integration/approval_manager.py +561 -0
  875. icdev/tools/integration/doors_exporter.py +627 -0
  876. icdev/tools/integration/gitlab_connector.py +784 -0
  877. icdev/tools/integration/jira_connector.py +774 -0
  878. icdev/tools/integration/servicenow_connector.py +693 -0
  879. icdev/tools/knowledge/__init__.py +1 -0
  880. icdev/tools/knowledge/knowledge_ingest.py +293 -0
  881. icdev/tools/knowledge/pattern_detector.py +693 -0
  882. icdev/tools/knowledge/recommendation_engine.py +461 -0
  883. icdev/tools/knowledge/self_heal_analyzer.py +504 -0
  884. icdev/tools/llm/__init__.py +72 -0
  885. icdev/tools/llm/anthropic_provider.py +170 -0
  886. icdev/tools/llm/azure_openai_provider.py +338 -0
  887. icdev/tools/llm/bedrock_provider.py +315 -0
  888. icdev/tools/llm/embedding_provider.py +438 -0
  889. icdev/tools/llm/gemini_provider.py +381 -0
  890. icdev/tools/llm/ibm_watsonx_provider.py +232 -0
  891. icdev/tools/llm/oci_genai_provider.py +462 -0
  892. icdev/tools/llm/ollama_provider.py +340 -0
  893. icdev/tools/llm/openai_provider.py +225 -0
  894. icdev/tools/llm/provider.py +355 -0
  895. icdev/tools/llm/provider_sdk.py +175 -0
  896. icdev/tools/llm/router.py +780 -0
  897. icdev/tools/llm/vertex_ai_provider.py +374 -0
  898. icdev/tools/maintenance/__init__.py +2 -0
  899. icdev/tools/maintenance/dependency_scanner.py +1030 -0
  900. icdev/tools/maintenance/maintenance_auditor.py +815 -0
  901. icdev/tools/maintenance/remediation_engine.py +966 -0
  902. icdev/tools/maintenance/vulnerability_checker.py +987 -0
  903. icdev/tools/mbse/__init__.py +3 -0
  904. icdev/tools/mbse/des_assessor.py +1186 -0
  905. icdev/tools/mbse/des_report_generator.py +800 -0
  906. icdev/tools/mbse/diagram_extractor.py +811 -0
  907. icdev/tools/mbse/digital_thread.py +1665 -0
  908. icdev/tools/mbse/model_code_generator.py +1122 -0
  909. icdev/tools/mbse/model_control_mapper.py +420 -0
  910. icdev/tools/mbse/pi_model_tracker.py +1093 -0
  911. icdev/tools/mbse/reqif_parser.py +1483 -0
  912. icdev/tools/mbse/sync_engine.py +1805 -0
  913. icdev/tools/mbse/xmi_parser.py +1573 -0
  914. icdev/tools/mcp/__init__.py +1 -0
  915. icdev/tools/mcp/base_server.py +535 -0
  916. icdev/tools/mcp/builder_server.py +725 -0
  917. icdev/tools/mcp/compliance_server.py +1407 -0
  918. icdev/tools/mcp/context_indexer.py +199 -0
  919. icdev/tools/mcp/context_server.py +305 -0
  920. icdev/tools/mcp/core_server.py +679 -0
  921. icdev/tools/mcp/devsecops_server.py +432 -0
  922. icdev/tools/mcp/gap_handlers.py +1079 -0
  923. icdev/tools/mcp/gateway_server.py +339 -0
  924. icdev/tools/mcp/generate_registry.py +623 -0
  925. icdev/tools/mcp/infra_server.py +264 -0
  926. icdev/tools/mcp/innovation_server.py +316 -0
  927. icdev/tools/mcp/integration_server.py +527 -0
  928. icdev/tools/mcp/knowledge_server.py +429 -0
  929. icdev/tools/mcp/maintenance_server.py +248 -0
  930. icdev/tools/mcp/marketplace_server.py +499 -0
  931. icdev/tools/mcp/mbse_server.py +398 -0
  932. icdev/tools/mcp/modernization_server.py +496 -0
  933. icdev/tools/mcp/observability_server.py +354 -0
  934. icdev/tools/mcp/requirements_server.py +415 -0
  935. icdev/tools/mcp/simulation_server.py +468 -0
  936. icdev/tools/mcp/standalone/__init__.py +2 -0
  937. icdev/tools/mcp/standalone/builder.py +59 -0
  938. icdev/tools/mcp/standalone/compliance.py +59 -0
  939. icdev/tools/mcp/standalone/core.py +59 -0
  940. icdev/tools/mcp/standalone/knowledge.py +59 -0
  941. icdev/tools/mcp/standalone/maintenance.py +59 -0
  942. icdev/tools/mcp/supply_chain_server.py +476 -0
  943. icdev/tools/mcp/tool_registry.py +2008 -0
  944. icdev/tools/mcp/unified_server.py +158 -0
  945. icdev/tools/memory/__init__.py +2 -0
  946. icdev/tools/memory/auto_capture.py +347 -0
  947. icdev/tools/memory/embed_memory.py +158 -0
  948. icdev/tools/memory/history_compressor.py +334 -0
  949. icdev/tools/memory/hybrid_search.py +236 -0
  950. icdev/tools/memory/maintenance_cron.py +289 -0
  951. icdev/tools/memory/memory_consolidation.py +444 -0
  952. icdev/tools/memory/memory_db.py +133 -0
  953. icdev/tools/memory/memory_read.py +102 -0
  954. icdev/tools/memory/memory_write.py +222 -0
  955. icdev/tools/memory/semantic_search.py +139 -0
  956. icdev/tools/memory/time_decay.py +435 -0
  957. icdev/tools/modernization/__init__.py +3 -0
  958. icdev/tools/modernization/architecture_extractor.py +734 -0
  959. icdev/tools/modernization/compliance_bridge.py +1499 -0
  960. icdev/tools/modernization/db_migration_planner.py +1385 -0
  961. icdev/tools/modernization/doc_generator.py +1428 -0
  962. icdev/tools/modernization/framework_migrator.py +1525 -0
  963. icdev/tools/modernization/legacy_analyzer.py +1948 -0
  964. icdev/tools/modernization/migration_code_generator.py +1639 -0
  965. icdev/tools/modernization/migration_report_generator.py +1653 -0
  966. icdev/tools/modernization/migration_tracker.py +1726 -0
  967. icdev/tools/modernization/monolith_decomposer.py +1508 -0
  968. icdev/tools/modernization/seven_r_assessor.py +1658 -0
  969. icdev/tools/modernization/strangler_fig_manager.py +1705 -0
  970. icdev/tools/modernization/ui_analyzer.py +771 -0
  971. icdev/tools/modernization/version_migrator.py +1392 -0
  972. icdev/tools/monitor/__init__.py +1 -0
  973. icdev/tools/monitor/alert_correlator.py +495 -0
  974. icdev/tools/monitor/auto_resolver.py +612 -0
  975. icdev/tools/monitor/health_checker.py +509 -0
  976. icdev/tools/monitor/heartbeat_daemon.py +792 -0
  977. icdev/tools/monitor/log_analyzer.py +516 -0
  978. icdev/tools/monitor/metric_collector.py +496 -0
  979. icdev/tools/mosa/__init__.py +10 -0
  980. icdev/tools/mosa/icd_generator.py +370 -0
  981. icdev/tools/mosa/modular_design_analyzer.py +683 -0
  982. icdev/tools/mosa/mosa_code_enforcer.py +349 -0
  983. icdev/tools/mosa/tsp_generator.py +265 -0
  984. icdev/tools/observability/__init__.py +100 -0
  985. icdev/tools/observability/genai_attributes.py +88 -0
  986. icdev/tools/observability/instrumentation.py +140 -0
  987. icdev/tools/observability/mlflow_exporter.py +194 -0
  988. icdev/tools/observability/otel_tracer.py +168 -0
  989. icdev/tools/observability/provenance/__init__.py +3 -0
  990. icdev/tools/observability/provenance/prov_recorder.py +324 -0
  991. icdev/tools/observability/shap/__init__.py +3 -0
  992. icdev/tools/observability/shap/agent_shap.py +275 -0
  993. icdev/tools/observability/sqlite_tracer.py +361 -0
  994. icdev/tools/observability/trace_context.py +205 -0
  995. icdev/tools/observability/tracer.py +230 -0
  996. icdev/tools/orchestration/__init__.py +2 -0
  997. icdev/tools/orchestration/workflow_composer.py +361 -0
  998. icdev/tools/project/__init__.py +1 -0
  999. icdev/tools/project/manifest_loader.py +418 -0
  1000. icdev/tools/project/project_create.py +350 -0
  1001. icdev/tools/project/project_list.py +174 -0
  1002. icdev/tools/project/project_scaffold.py +1715 -0
  1003. icdev/tools/project/project_status.py +479 -0
  1004. icdev/tools/project/session_context_builder.py +757 -0
  1005. icdev/tools/project/validate_manifest.py +55 -0
  1006. icdev/tools/registry/__init__.py +10 -0
  1007. icdev/tools/registry/absorption_engine.py +832 -0
  1008. icdev/tools/registry/capability_evaluator.py +668 -0
  1009. icdev/tools/registry/child_registry.py +617 -0
  1010. icdev/tools/registry/cross_pollinator.py +1065 -0
  1011. icdev/tools/registry/genome_manager.py +671 -0
  1012. icdev/tools/registry/learning_collector.py +912 -0
  1013. icdev/tools/registry/propagation_manager.py +942 -0
  1014. icdev/tools/registry/staging_manager.py +742 -0
  1015. icdev/tools/registry/telemetry_collector.py +423 -0
  1016. icdev/tools/requirements/__init__.py +1 -0
  1017. icdev/tools/requirements/ai_governance_scorer.py +208 -0
  1018. icdev/tools/requirements/boundary_analyzer.py +1293 -0
  1019. icdev/tools/requirements/clarification_engine.py +618 -0
  1020. icdev/tools/requirements/complexity_scorer.py +387 -0
  1021. icdev/tools/requirements/consistency_analyzer.py +803 -0
  1022. icdev/tools/requirements/constitution_manager.py +605 -0
  1023. icdev/tools/requirements/decomposition_engine.py +778 -0
  1024. icdev/tools/requirements/document_extractor.py +1016 -0
  1025. icdev/tools/requirements/elicitation_techniques.py +519 -0
  1026. icdev/tools/requirements/gap_detector.py +271 -0
  1027. icdev/tools/requirements/intake_engine.py +2188 -0
  1028. icdev/tools/requirements/prd_generator.py +847 -0
  1029. icdev/tools/requirements/prd_validator.py +595 -0
  1030. icdev/tools/requirements/readiness_scorer.py +313 -0
  1031. icdev/tools/requirements/spec_organizer.py +1029 -0
  1032. icdev/tools/requirements/spec_quality_checker.py +1097 -0
  1033. icdev/tools/requirements/traceability_builder.py +579 -0
  1034. icdev/tools/resilience/__init__.py +34 -0
  1035. icdev/tools/resilience/circuit_breaker.py +340 -0
  1036. icdev/tools/resilience/correlation.py +150 -0
  1037. icdev/tools/resilience/errors.py +81 -0
  1038. icdev/tools/resilience/retry.py +95 -0
  1039. icdev/tools/schemas/__init__.py +27 -0
  1040. icdev/tools/schemas/chat.py +61 -0
  1041. icdev/tools/schemas/compliance.py +56 -0
  1042. icdev/tools/schemas/core.py +85 -0
  1043. icdev/tools/schemas/innovation.py +37 -0
  1044. icdev/tools/schemas/validation.py +109 -0
  1045. icdev/tools/sdk/__init__.py +3 -0
  1046. icdev/tools/sdk/icdev_client.py +218 -0
  1047. icdev/tools/security/__init__.py +1 -0
  1048. icdev/tools/security/agent_output_validator.py +330 -0
  1049. icdev/tools/security/agent_trust_scorer.py +466 -0
  1050. icdev/tools/security/ai_bom_generator.py +725 -0
  1051. icdev/tools/security/ai_telemetry_logger.py +469 -0
  1052. icdev/tools/security/atlas_red_team.py +543 -0
  1053. icdev/tools/security/code_pattern_scanner.py +378 -0
  1054. icdev/tools/security/confabulation_detector.py +271 -0
  1055. icdev/tools/security/container_scanner.py +491 -0
  1056. icdev/tools/security/dependency_auditor.py +944 -0
  1057. icdev/tools/security/endpoint_security_scanner.py +579 -0
  1058. icdev/tools/security/mcp_tool_authorizer.py +243 -0
  1059. icdev/tools/security/prompt_injection_detector.py +737 -0
  1060. icdev/tools/security/sast_runner.py +948 -0
  1061. icdev/tools/security/secret_detector.py +378 -0
  1062. icdev/tools/security/tool_chain_validator.py +357 -0
  1063. icdev/tools/security/vuln_scanner.py +539 -0
  1064. icdev/tools/simulation/__init__.py +2 -0
  1065. icdev/tools/simulation/coa_generator.py +1552 -0
  1066. icdev/tools/simulation/monte_carlo.py +758 -0
  1067. icdev/tools/simulation/scenario_manager.py +1073 -0
  1068. icdev/tools/simulation/simulation_engine.py +1104 -0
  1069. icdev/tools/supply_chain/__init__.py +2 -0
  1070. icdev/tools/supply_chain/cve_triager.py +705 -0
  1071. icdev/tools/supply_chain/dependency_graph.py +645 -0
  1072. icdev/tools/supply_chain/isa_manager.py +540 -0
  1073. icdev/tools/supply_chain/scrm_assessor.py +546 -0
  1074. icdev/tools/testing/__init__.py +2 -0
  1075. icdev/tools/testing/acceptance_validator.py +411 -0
  1076. icdev/tools/testing/claude_dir_validator.py +831 -0
  1077. icdev/tools/testing/data_types.py +199 -0
  1078. icdev/tools/testing/e2e_runner.py +715 -0
  1079. icdev/tools/testing/fuzz_cli.py +306 -0
  1080. icdev/tools/testing/health_check.py +483 -0
  1081. icdev/tools/testing/platform_check.py +143 -0
  1082. icdev/tools/testing/production_audit.py +1862 -0
  1083. icdev/tools/testing/production_remediate.py +804 -0
  1084. icdev/tools/testing/screenshot_validator.py +539 -0
  1085. icdev/tools/testing/smoke_test.py +283 -0
  1086. icdev/tools/testing/test_agent_models.py +117 -0
  1087. icdev/tools/testing/test_orchestrator.py +957 -0
  1088. icdev/tools/testing/utils.py +229 -0
  1089. icdev/tools/translation/__init__.py +17 -0
  1090. icdev/tools/translation/code_translator.py +550 -0
  1091. icdev/tools/translation/dependency_mapper.py +277 -0
  1092. icdev/tools/translation/feature_map.py +395 -0
  1093. icdev/tools/translation/project_assembler.py +439 -0
  1094. icdev/tools/translation/source_extractor.py +609 -0
  1095. icdev/tools/translation/test_translator.py +333 -0
  1096. icdev/tools/translation/translation_manager.py +582 -0
  1097. icdev/tools/translation/translation_validator.py +662 -0
  1098. icdev/tools/translation/type_checker.py +371 -0
  1099. icdev-1.0.0.dist-info/METADATA +868 -0
  1100. icdev-1.0.0.dist-info/RECORD +1105 -0
  1101. icdev-1.0.0.dist-info/WHEEL +5 -0
  1102. icdev-1.0.0.dist-info/entry_points.txt +9 -0
  1103. icdev-1.0.0.dist-info/licenses/LICENSE +254 -0
  1104. icdev-1.0.0.dist-info/licenses/NOTICE +268 -0
  1105. icdev-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1662 @@
1
+ #!/usr/bin/env python3
2
+ # CUI // SP-CTI
3
+ """IV&V certification report generator per IEEE 1012.
4
+
5
+ Loads ivv_report_template.md, queries ivv_assessments, ivv_findings, and
6
+ ivv_certifications tables, generates a comprehensive IV&V certification report
7
+ with verification/validation scores and certification recommendation."""
8
+
9
+ import argparse
10
+ import json
11
+ import re
12
+ import sqlite3
13
+ import sys
14
+ from datetime import datetime, timedelta, timezone
15
+ from pathlib import Path
16
+ from icdev._paths import get_project_root
17
+
18
+ BASE_DIR = get_project_root()
19
+ DB_PATH = BASE_DIR / "data" / "icdev.db"
20
+ IVV_TEMPLATE_PATH = BASE_DIR / "context" / "compliance" / "ivv_report_template.md"
21
+ IVV_REQUIREMENTS_PATH = BASE_DIR / "context" / "compliance" / "ivv_requirements.json"
22
+
23
+ # Process areas per IEEE 1012 as defined in ivv_requirements.json
24
+ PROCESS_AREAS = [
25
+ "Requirements Verification",
26
+ "Design Verification",
27
+ "Code Verification",
28
+ "Test Verification",
29
+ "Integration Verification",
30
+ "Traceability Analysis",
31
+ "Security Verification",
32
+ "Build/Deploy Verification",
33
+ "Process Compliance",
34
+ ]
35
+
36
+ # Which process areas contribute to the Verification score
37
+ VERIFICATION_AREAS = [
38
+ "Requirements Verification",
39
+ "Design Verification",
40
+ "Code Verification",
41
+ "Traceability Analysis",
42
+ "Security Verification",
43
+ "Build/Deploy Verification",
44
+ "Process Compliance",
45
+ ]
46
+
47
+ # Which process areas contribute to the Validation score
48
+ VALIDATION_AREAS = [
49
+ "Test Verification",
50
+ "Integration Verification",
51
+ ]
52
+
53
+ # Status weighting for score calculation
54
+ IVV_STATUS_WEIGHTS = {
55
+ "pass": 1.0,
56
+ "partial": 0.5,
57
+ "fail": 0.0,
58
+ "deferred": 0.0,
59
+ "not_assessed": 0.0,
60
+ }
61
+
62
+ # Severity ordering for consistent output
63
+ SEVERITY_ORDER = ["critical", "high", "moderate", "low"]
64
+
65
+ # Finding statuses for summary
66
+ FINDING_STATUSES = ["open", "in_progress", "resolved", "accepted_risk", "deferred"]
67
+
68
+
69
+ # ---------------------------------------------------------------------------
70
+ # Helper functions
71
+ # ---------------------------------------------------------------------------
72
+
73
+ def _get_connection(db_path=None):
74
+ """Get a database connection with Row factory."""
75
+ path = db_path or DB_PATH
76
+ if not path.exists():
77
+ raise FileNotFoundError(
78
+ f"Database not found: {path}\n"
79
+ "Run: python tools/db/init_icdev_db.py"
80
+ )
81
+ conn = sqlite3.connect(str(path))
82
+ conn.row_factory = sqlite3.Row
83
+ return conn
84
+
85
+
86
+ def _load_template(template_path=None):
87
+ """Load the IV&V report template markdown.
88
+
89
+ If the template file does not exist a minimal built-in template is
90
+ returned so the generator can still produce a useful report.
91
+ """
92
+ path = template_path or IVV_TEMPLATE_PATH
93
+ if path.exists():
94
+ with open(path, "r", encoding="utf-8") as f:
95
+ return f.read()
96
+
97
+ # Fallback minimal template when file is missing
98
+ return _builtin_template()
99
+
100
+
101
+ def _builtin_template():
102
+ """Return a minimal built-in IV&V report template."""
103
+ return (
104
+ "{{cui_banner_top}}\n\n"
105
+ "# Independent Verification & Validation (IV&V) Certification Report\n\n"
106
+ "**Project:** {{project_name}} \n"
107
+ "**Project ID:** {{project_id}} \n"
108
+ "**Classification:** {{classification}} \n"
109
+ "**Assessment Date:** {{assessment_date}} \n"
110
+ "**Report Version:** {{version}} \n"
111
+ "**IV&V Authority:** {{ivv_authority}} \n"
112
+ "**Framework:** IEEE 1012-2016, DoDI 5000.87 \n\n"
113
+ "---\n\n"
114
+ "## 1. Executive Summary\n\n"
115
+ "**Verification Score:** {{verification_score}}% \n"
116
+ "**Validation Score:** {{validation_score}}% \n"
117
+ "**Overall IV&V Score:** {{overall_score}}% \n"
118
+ "**Gate Result:** {{gate_result}} \n"
119
+ "**Certification Recommendation:** {{certification_recommendation}} \n\n"
120
+ "{{executive_summary}}\n\n"
121
+ "---\n\n"
122
+ "## 2. Independence Declaration\n\n"
123
+ "{{independence_declaration}}\n\n"
124
+ "---\n\n"
125
+ "## 3. Verification Results\n\n"
126
+ "### 3.1 Process Area Scores\n\n"
127
+ "{{process_area_scores_table}}\n\n"
128
+ "### 3.2 Process Area Details\n\n"
129
+ "{{process_area_details}}\n\n"
130
+ "---\n\n"
131
+ "## 4. Validation Results\n\n"
132
+ "### 4.1 Test Verification Results\n\n"
133
+ "{{test_verification_results}}\n\n"
134
+ "### 4.2 Integration Verification Results\n\n"
135
+ "{{integration_verification_results}}\n\n"
136
+ "---\n\n"
137
+ "## 5. Requirements Traceability Matrix Summary\n\n"
138
+ "{{rtm_summary}}\n\n"
139
+ "**RTM Coverage:** {{rtm_coverage}}% \n"
140
+ "**Requirements with Full Trace:** {{rtm_full_trace_count}} \n"
141
+ "**Requirements with Gaps:** {{rtm_gap_count}} \n"
142
+ "**Orphan Tests:** {{rtm_orphan_tests}} \n\n"
143
+ "---\n\n"
144
+ "## 6. IV&V Findings\n\n"
145
+ "### 6.1 Critical Findings\n\n"
146
+ "{{critical_findings}}\n\n"
147
+ "### 6.2 High Findings\n\n"
148
+ "{{high_findings}}\n\n"
149
+ "### 6.3 Moderate Findings\n\n"
150
+ "{{moderate_findings}}\n\n"
151
+ "### 6.4 Low Findings\n\n"
152
+ "{{low_findings}}\n\n"
153
+ "### 6.5 Findings Summary\n\n"
154
+ "| Severity | Open | Resolved | Accepted Risk | Deferred | Total |\n"
155
+ "|----------|------|----------|---------------|----------|-------|\n"
156
+ "{{findings_summary_table}}\n\n"
157
+ "---\n\n"
158
+ "## 7. Certification Recommendation\n\n"
159
+ "**Recommendation:** {{certification_recommendation}} \n\n"
160
+ "### Criteria Applied:\n"
161
+ "- **CERTIFY:** Overall score >= 80%, 0 critical findings, all process areas >= 60%\n"
162
+ "- **CONDITIONAL:** Overall score >= 60%, 0 critical findings, conditions listed\n"
163
+ "- **DENY:** Overall score < 60% OR critical findings unresolved\n\n"
164
+ "### Conditions (if applicable):\n\n"
165
+ "{{conditions}}\n\n"
166
+ "---\n\n"
167
+ "## 8. Evidence Index\n\n"
168
+ "{{evidence_index}}\n\n"
169
+ "---\n\n"
170
+ "## 9. Assessment Methodology\n\n"
171
+ "This assessment was conducted using the ICDEV IV&V Assessor tool against "
172
+ "the IEEE 1012 requirements catalog (30 requirements across 9 process areas).\n\n"
173
+ "**Scoring Formula:**\n"
174
+ "- Verification Score = average of process area pass rates\n"
175
+ "- Validation Score = average of Test + Integration area pass rates\n"
176
+ "- Overall Score = 0.6 x Verification + 0.4 x Validation\n\n"
177
+ "**Gate Logic:** PASS if 0 critical findings remain open\n\n"
178
+ "---\n\n"
179
+ "**Prepared by:** {{ivv_authority}} \n"
180
+ "**Date:** {{assessment_date}} \n"
181
+ "**Next Review:** {{next_review_date}} \n\n"
182
+ "{{cui_banner_bottom}}\n"
183
+ )
184
+
185
+
186
+ def _get_project_data(conn, project_id):
187
+ """Load project record from database."""
188
+ row = conn.execute(
189
+ "SELECT * FROM projects WHERE id = ?", (project_id,)
190
+ ).fetchone()
191
+ if not row:
192
+ raise ValueError(f"Project '{project_id}' not found in database.")
193
+ return dict(row)
194
+
195
+
196
+ def _load_cui_config():
197
+ """Load CUI marking configuration.
198
+
199
+ Attempts to import load_cui_config from the cui_marker module;
200
+ falls back to sensible defaults if unavailable.
201
+ """
202
+ try:
203
+ from icdev.tools.compliance.cui_marker import load_cui_config as _load
204
+ return _load()
205
+ except Exception:
206
+ pass
207
+
208
+ # Try relative import via file location
209
+ try:
210
+ cui_marker_path = Path(__file__).resolve().parent / "cui_marker.py"
211
+ if cui_marker_path.exists():
212
+ import importlib.util
213
+ spec = importlib.util.spec_from_file_location(
214
+ "cui_marker", cui_marker_path
215
+ )
216
+ mod = importlib.util.module_from_spec(spec)
217
+ spec.loader.exec_module(mod)
218
+ return mod.load_cui_config()
219
+ except Exception:
220
+ pass
221
+
222
+ return {
223
+ "banner_top": "CUI // SP-CTI",
224
+ "banner_bottom": "CUI // SP-CTI",
225
+ "document_header": (
226
+ "////////////////////////////////////////////////////////////////////\n"
227
+ "CONTROLLED UNCLASSIFIED INFORMATION (CUI) // SP-CTI\n"
228
+ "Distribution: Distribution D -- Authorized DoD Personnel Only\n"
229
+ "////////////////////////////////////////////////////////////////////"
230
+ ),
231
+ "document_footer": (
232
+ "////////////////////////////////////////////////////////////////////\n"
233
+ "CUI // SP-CTI | Department of Defense\n"
234
+ "////////////////////////////////////////////////////////////////////"
235
+ ),
236
+ }
237
+
238
+
239
+ def _load_ivv_requirements():
240
+ """Load IV&V requirements catalog from JSON.
241
+
242
+ Returns the full catalog dict with 'metadata' and 'requirements' keys.
243
+ Falls back to an empty catalog if the file is missing.
244
+ """
245
+ if not IVV_REQUIREMENTS_PATH.exists():
246
+ return {"metadata": {}, "requirements": []}
247
+
248
+ with open(IVV_REQUIREMENTS_PATH, "r", encoding="utf-8") as f:
249
+ data = json.load(f)
250
+ return data
251
+
252
+
253
+ # ---------------------------------------------------------------------------
254
+ # Data retrieval
255
+ # ---------------------------------------------------------------------------
256
+
257
+ def _get_ivv_assessments(conn, project_id):
258
+ """Retrieve all IV&V assessment results for a project."""
259
+ rows = conn.execute(
260
+ """SELECT * FROM ivv_assessments
261
+ WHERE project_id = ?
262
+ ORDER BY process_area, requirement_id""",
263
+ (project_id,),
264
+ ).fetchall()
265
+ return [dict(r) for r in rows]
266
+
267
+
268
+ def _get_ivv_findings(conn, project_id):
269
+ """Retrieve all IV&V findings for a project."""
270
+ rows = conn.execute(
271
+ """SELECT * FROM ivv_findings
272
+ WHERE project_id = ?
273
+ ORDER BY severity, finding_id""",
274
+ (project_id,),
275
+ ).fetchall()
276
+ return [dict(r) for r in rows]
277
+
278
+
279
+ def _get_ivv_certification(conn, project_id):
280
+ """Retrieve IV&V certification status for a project."""
281
+ row = conn.execute(
282
+ "SELECT * FROM ivv_certifications WHERE project_id = ?",
283
+ (project_id,),
284
+ ).fetchone()
285
+ return dict(row) if row else {}
286
+
287
+
288
+ # ---------------------------------------------------------------------------
289
+ # Score calculation
290
+ # ---------------------------------------------------------------------------
291
+
292
+ def _calculate_process_area_scores(assessments):
293
+ """Calculate a pass-rate score for each IV&V process area.
294
+
295
+ Score formula per area:
296
+ score = 100 * (pass_count + partial_count * 0.5) / total_scoreable
297
+
298
+ ``not_applicable`` assessments are excluded from the denominator.
299
+
300
+ Returns:
301
+ dict mapping process area name to a dict with ``score``, per-status
302
+ counts, and ``total`` / ``scoreable`` tallies.
303
+ """
304
+ area_data = {area: [] for area in PROCESS_AREAS}
305
+ for a in assessments:
306
+ pa = a.get("process_area")
307
+ if pa in area_data:
308
+ area_data[pa].append(a)
309
+
310
+ results = {}
311
+ for area in PROCESS_AREAS:
312
+ items = area_data[area]
313
+ total = len(items)
314
+
315
+ if total == 0:
316
+ results[area] = {
317
+ "score": 0.0,
318
+ "total": 0,
319
+ "scoreable": 0,
320
+ "pass": 0,
321
+ "partial": 0,
322
+ "fail": 0,
323
+ "deferred": 0,
324
+ "not_assessed": 0,
325
+ "not_applicable": 0,
326
+ }
327
+ continue
328
+
329
+ pass_count = sum(
330
+ 1 for i in items if i.get("status") == "pass"
331
+ )
332
+ partial_count = sum(
333
+ 1 for i in items if i.get("status") == "partial"
334
+ )
335
+ fail_count = sum(
336
+ 1 for i in items if i.get("status") == "fail"
337
+ )
338
+ deferred_count = sum(
339
+ 1 for i in items if i.get("status") == "deferred"
340
+ )
341
+ not_assessed_count = sum(
342
+ 1 for i in items if i.get("status") == "not_assessed"
343
+ )
344
+ not_applicable_count = sum(
345
+ 1 for i in items if i.get("status") == "not_applicable"
346
+ )
347
+
348
+ # Denominator excludes not_applicable
349
+ scoreable = total - not_applicable_count
350
+ if scoreable > 0:
351
+ score = 100.0 * (
352
+ pass_count * IVV_STATUS_WEIGHTS["pass"]
353
+ + partial_count * IVV_STATUS_WEIGHTS["partial"]
354
+ ) / scoreable
355
+ else:
356
+ # All items are N/A — treat as fully compliant
357
+ score = 100.0
358
+
359
+ results[area] = {
360
+ "score": round(score, 1),
361
+ "total": total,
362
+ "scoreable": scoreable,
363
+ "pass": pass_count,
364
+ "partial": partial_count,
365
+ "fail": fail_count,
366
+ "deferred": deferred_count,
367
+ "not_assessed": not_assessed_count,
368
+ "not_applicable": not_applicable_count,
369
+ }
370
+
371
+ return results
372
+
373
+
374
+ def _calculate_verification_score(area_scores):
375
+ """Calculate the aggregate Verification score.
376
+
377
+ Average of the scores for the 7 verification process areas. Areas with
378
+ zero scoreable items are excluded from the average.
379
+ """
380
+ scores = []
381
+ for area in VERIFICATION_AREAS:
382
+ info = area_scores.get(area, {})
383
+ if info.get("scoreable", 0) > 0 or info.get("total", 0) > 0:
384
+ scores.append(info.get("score", 0.0))
385
+
386
+ if not scores:
387
+ return 0.0
388
+ return round(sum(scores) / len(scores), 1)
389
+
390
+
391
+ def _calculate_validation_score(area_scores):
392
+ """Calculate the aggregate Validation score.
393
+
394
+ Average of the scores for Test Verification and Integration Verification.
395
+ Areas with zero scoreable items are excluded from the average.
396
+ """
397
+ scores = []
398
+ for area in VALIDATION_AREAS:
399
+ info = area_scores.get(area, {})
400
+ if info.get("scoreable", 0) > 0 or info.get("total", 0) > 0:
401
+ scores.append(info.get("score", 0.0))
402
+
403
+ if not scores:
404
+ return 0.0
405
+ return round(sum(scores) / len(scores), 1)
406
+
407
+
408
+ def _calculate_overall_score(verification_score, validation_score):
409
+ """Calculate the weighted overall IV&V score.
410
+
411
+ Overall = 0.6 * Verification + 0.4 * Validation
412
+ """
413
+ overall = 0.6 * verification_score + 0.4 * validation_score
414
+ return round(overall, 1)
415
+
416
+
417
+ def _determine_certification_recommendation(overall_score, area_scores, findings):
418
+ """Determine the IV&V certification recommendation.
419
+
420
+ Rules:
421
+ CERTIFY: overall >= 80, 0 critical open findings, all areas >= 60
422
+ CONDITIONAL: overall >= 60, 0 critical open findings
423
+ DENY: overall < 60 OR any critical findings are open
424
+
425
+ Returns:
426
+ tuple of (recommendation_str, reason_str)
427
+ """
428
+ # Count critical open findings
429
+ critical_open = sum(
430
+ 1 for f in findings
431
+ if f.get("severity") == "critical"
432
+ and f.get("status") in ("open", "in_progress")
433
+ )
434
+
435
+ # Check if all areas meet the 60% minimum
436
+ all_areas_above_60 = True
437
+ areas_below_60 = []
438
+ for area in PROCESS_AREAS:
439
+ info = area_scores.get(area, {})
440
+ # Only evaluate areas that have assessments
441
+ if info.get("total", 0) > 0 and info.get("score", 0.0) < 60.0:
442
+ all_areas_above_60 = False
443
+ areas_below_60.append(area)
444
+
445
+ # Decision logic
446
+ if critical_open > 0:
447
+ reason = (
448
+ f"DENY: {critical_open} critical finding(s) remain open. "
449
+ "All critical findings must be resolved before certification."
450
+ )
451
+ return "DENY", reason
452
+
453
+ if overall_score < 60.0:
454
+ reason = (
455
+ f"DENY: Overall score ({overall_score:.1f}%) is below the 60% "
456
+ "minimum threshold required for certification."
457
+ )
458
+ return "DENY", reason
459
+
460
+ if overall_score >= 80.0 and all_areas_above_60:
461
+ reason = (
462
+ f"CERTIFY: Overall score ({overall_score:.1f}%) meets the 80% "
463
+ "threshold, zero critical open findings, and all process areas "
464
+ "meet the 60% minimum."
465
+ )
466
+ return "CERTIFY", reason
467
+
468
+ # Conditional case: overall >= 60 but either < 80 or some areas below 60
469
+ condition_parts = []
470
+ if overall_score < 80.0:
471
+ condition_parts.append(
472
+ f"Overall score ({overall_score:.1f}%) is below the 80% full "
473
+ "certification threshold"
474
+ )
475
+ if not all_areas_above_60:
476
+ area_list = ", ".join(areas_below_60)
477
+ condition_parts.append(
478
+ f"The following process areas are below 60%: {area_list}"
479
+ )
480
+
481
+ reason = "CONDITIONAL: " + "; ".join(condition_parts) + "."
482
+ return "CONDITIONAL", reason
483
+
484
+
485
+ # ---------------------------------------------------------------------------
486
+ # Section builders
487
+ # ---------------------------------------------------------------------------
488
+
489
+ def _build_process_area_scores_table(area_scores):
490
+ """Build a markdown table summarizing per-area IV&V scores."""
491
+ lines = [
492
+ "| Process Area | Score | Total | Pass | Partial | Fail | Deferred | N/A | Not Assessed |",
493
+ "|--------------|------:|------:|-----:|--------:|-----:|---------:|----:|-------------:|",
494
+ ]
495
+ for area in PROCESS_AREAS:
496
+ s = area_scores.get(area, {})
497
+ lines.append(
498
+ f"| {area} "
499
+ f"| {s.get('score', 0.0):.1f}% "
500
+ f"| {s.get('total', 0)} "
501
+ f"| {s.get('pass', 0)} "
502
+ f"| {s.get('partial', 0)} "
503
+ f"| {s.get('fail', 0)} "
504
+ f"| {s.get('deferred', 0)} "
505
+ f"| {s.get('not_applicable', 0)} "
506
+ f"| {s.get('not_assessed', 0)} |"
507
+ )
508
+
509
+ # Totals row
510
+ totals = {
511
+ "total": sum(s.get("total", 0) for s in area_scores.values()),
512
+ "pass": sum(s.get("pass", 0) for s in area_scores.values()),
513
+ "partial": sum(s.get("partial", 0) for s in area_scores.values()),
514
+ "fail": sum(s.get("fail", 0) for s in area_scores.values()),
515
+ "deferred": sum(s.get("deferred", 0) for s in area_scores.values()),
516
+ "not_applicable": sum(
517
+ s.get("not_applicable", 0) for s in area_scores.values()
518
+ ),
519
+ "not_assessed": sum(
520
+ s.get("not_assessed", 0) for s in area_scores.values()
521
+ ),
522
+ }
523
+ lines.append(
524
+ f"| **Total** | -- "
525
+ f"| **{totals['total']}** "
526
+ f"| **{totals['pass']}** "
527
+ f"| **{totals['partial']}** "
528
+ f"| **{totals['fail']}** "
529
+ f"| **{totals['deferred']}** "
530
+ f"| **{totals['not_applicable']}** "
531
+ f"| **{totals['not_assessed']}** |"
532
+ )
533
+ return "\n".join(lines)
534
+
535
+
536
+ def _build_process_area_details(assessments, area_scores):
537
+ """Build markdown detail sections for each process area.
538
+
539
+ Each area gets a sub-heading and a table listing every requirement
540
+ with its status, evidence description, and notes.
541
+ """
542
+ area_data = {area: [] for area in PROCESS_AREAS}
543
+ for a in assessments:
544
+ pa = a.get("process_area")
545
+ if pa in area_data:
546
+ area_data[pa].append(a)
547
+
548
+ sections = []
549
+ for area in PROCESS_AREAS:
550
+ items = area_data[area]
551
+ s = area_scores.get(area, {})
552
+ score = s.get("score", 0.0)
553
+ v_type = "Verification" if area in VERIFICATION_AREAS else "Validation"
554
+
555
+ sections.append(f"#### {area} ({score:.1f}%) — {v_type}")
556
+ sections.append("")
557
+
558
+ if not items:
559
+ sections.append(
560
+ "*No assessments recorded for this process area.*"
561
+ )
562
+ sections.append("")
563
+ continue
564
+
565
+ sections.append(
566
+ "| Req ID | Title | Status | Evidence | Notes |"
567
+ )
568
+ sections.append(
569
+ "|--------|-------|--------|----------|-------|"
570
+ )
571
+ for item in sorted(items, key=lambda x: x.get("requirement_id", "")):
572
+ req_id = item.get("requirement_id", "N/A")
573
+ # Attempt to get the title from the automation_result field
574
+ # which may contain structured data
575
+ title = ""
576
+ auto_result = item.get("automation_result", "")
577
+ if auto_result:
578
+ try:
579
+ auto_data = json.loads(auto_result)
580
+ title = auto_data.get("title", "")
581
+ except (json.JSONDecodeError, TypeError):
582
+ title = ""
583
+ if not title:
584
+ title = req_id # Fallback to the requirement ID
585
+
586
+ status = item.get("status", "not_assessed")
587
+ evidence = (
588
+ (item.get("evidence_description") or "")
589
+ .replace("\n", " ")
590
+ .strip()
591
+ )
592
+ notes = (
593
+ (item.get("notes") or "").replace("\n", " ").strip()
594
+ )
595
+
596
+ # Truncate long fields for table readability
597
+ if len(title) > 50:
598
+ title = title[:47] + "..."
599
+ if len(evidence) > 60:
600
+ evidence = evidence[:57] + "..."
601
+ if len(notes) > 60:
602
+ notes = notes[:57] + "..."
603
+
604
+ # Status badge for readability
605
+ status_badge = _status_badge(status)
606
+
607
+ sections.append(
608
+ f"| {req_id} | {title} | {status_badge} "
609
+ f"| {evidence} | {notes} |"
610
+ )
611
+ sections.append("")
612
+
613
+ return "\n".join(sections)
614
+
615
+
616
+ def _status_badge(status):
617
+ """Return a markdown-friendly status indicator."""
618
+ badges = {
619
+ "pass": "PASS",
620
+ "partial": "PARTIAL",
621
+ "fail": "**FAIL**",
622
+ "deferred": "DEFERRED",
623
+ "not_assessed": "NOT ASSESSED",
624
+ "not_applicable": "N/A",
625
+ }
626
+ return badges.get(status, status.upper() if status else "UNKNOWN")
627
+
628
+
629
+ def _build_findings_by_severity(findings):
630
+ """Build per-severity sections of IV&V findings.
631
+
632
+ Returns a dict mapping severity to a markdown string.
633
+ """
634
+ grouped = {sev: [] for sev in SEVERITY_ORDER}
635
+ for f in findings:
636
+ sev = f.get("severity", "low")
637
+ if sev in grouped:
638
+ grouped[sev].append(f)
639
+
640
+ result = {}
641
+ for sev in SEVERITY_ORDER:
642
+ items = grouped[sev]
643
+ if not items:
644
+ result[sev] = f"*No {sev} findings.*"
645
+ continue
646
+
647
+ lines = [
648
+ "| Finding ID | Process Area | Title | Status | Recommendation |",
649
+ "|------------|-------------|-------|--------|----------------|",
650
+ ]
651
+ for f in sorted(items, key=lambda x: x.get("finding_id", "")):
652
+ fid = f.get("finding_id", "N/A")
653
+ pa = f.get("process_area", "N/A")
654
+ title = (f.get("title") or "").replace("\n", " ").strip()
655
+ status = f.get("status", "open")
656
+ rec = (
657
+ (f.get("recommendation") or "").replace("\n", " ").strip()
658
+ )
659
+
660
+ if len(title) > 50:
661
+ title = title[:47] + "..."
662
+ if len(rec) > 60:
663
+ rec = rec[:57] + "..."
664
+
665
+ lines.append(
666
+ f"| {fid} | {pa} | {title} | {status} | {rec} |"
667
+ )
668
+
669
+ result[sev] = "\n".join(lines)
670
+
671
+ return result
672
+
673
+
674
+ def _build_findings_summary_table(findings):
675
+ """Build a summary table of findings by severity and status.
676
+
677
+ Returns the markdown rows (without header — the template provides the
678
+ header already).
679
+ """
680
+ # Initialize counts grid
681
+ counts = {
682
+ sev: {st: 0 for st in FINDING_STATUSES}
683
+ for sev in SEVERITY_ORDER
684
+ }
685
+
686
+ for f in findings:
687
+ sev = f.get("severity", "low")
688
+ st = f.get("status", "open")
689
+ if sev in counts and st in counts[sev]:
690
+ counts[sev][st] += 1
691
+
692
+ lines = []
693
+ grand_total = 0
694
+ for sev in SEVERITY_ORDER:
695
+ c = counts[sev]
696
+ total = sum(c.values())
697
+ grand_total += total
698
+ lines.append(
699
+ f"| {sev.capitalize()} "
700
+ f"| {c.get('open', 0)} "
701
+ f"| {c.get('resolved', 0)} "
702
+ f"| {c.get('accepted_risk', 0)} "
703
+ f"| {c.get('deferred', 0)} "
704
+ f"| {total} |"
705
+ )
706
+
707
+ # Grand total row
708
+ total_open = sum(counts[s]["open"] for s in SEVERITY_ORDER)
709
+ total_resolved = sum(counts[s]["resolved"] for s in SEVERITY_ORDER)
710
+ total_accepted = sum(
711
+ counts[s]["accepted_risk"] for s in SEVERITY_ORDER
712
+ )
713
+ total_deferred = sum(counts[s]["deferred"] for s in SEVERITY_ORDER)
714
+ lines.append(
715
+ f"| **Total** "
716
+ f"| **{total_open}** "
717
+ f"| **{total_resolved}** "
718
+ f"| **{total_accepted}** "
719
+ f"| **{total_deferred}** "
720
+ f"| **{grand_total}** |"
721
+ )
722
+
723
+ return "\n".join(lines)
724
+
725
+
726
+ def _build_rtm_summary(conn, project_id):
727
+ """Build an RTM summary section by looking for RTM data.
728
+
729
+ Attempts to find RTM JSON output from a previous traceability_matrix.py
730
+ run. Falls back to a placeholder if no data is found.
731
+ """
732
+ # Try to find RTM JSON in the project directory
733
+ try:
734
+ project = _get_project_data(conn, project_id)
735
+ project_dir = project.get("directory_path", "")
736
+ if project_dir:
737
+ rtm_json_path = (
738
+ Path(project_dir) / "compliance" / "rtm" / "rtm-data.json"
739
+ )
740
+ if rtm_json_path.exists():
741
+ with open(rtm_json_path, "r", encoding="utf-8") as f:
742
+ rtm_data = json.load(f)
743
+
744
+ coverage = rtm_data.get("coverage", 0.0)
745
+ traced = rtm_data.get("traced", 0)
746
+ total = rtm_data.get("total_requirements", 0)
747
+ gaps = rtm_data.get("gaps", {})
748
+ gap_count = gaps.get("gap_count", 0)
749
+ orphan_count = len(gaps.get("orphan_tests", []))
750
+
751
+ lines = [
752
+ f"RTM data loaded from: `{rtm_json_path}`",
753
+ "",
754
+ f"- **Total Requirements:** {total}",
755
+ f"- **Fully Traced:** {traced}",
756
+ f"- **Coverage:** {coverage:.1f}%",
757
+ f"- **Gap Count:** {gap_count}",
758
+ f"- **Orphan Tests:** {orphan_count}",
759
+ ]
760
+ return (
761
+ "\n".join(lines),
762
+ coverage,
763
+ traced,
764
+ gap_count,
765
+ orphan_count,
766
+ )
767
+ except Exception:
768
+ pass
769
+
770
+ # Fallback — no RTM data found
771
+ placeholder = (
772
+ "*No Requirements Traceability Matrix data found. "
773
+ "Run `python tools/compliance/traceability_matrix.py "
774
+ f"--project-id {project_id}` to generate RTM.*"
775
+ )
776
+ return placeholder, 0.0, 0, 0, 0
777
+
778
+
779
+ def _build_independence_declaration():
780
+ """Return the standard IEEE 1012 independence statement.
781
+
782
+ This is the boilerplate independence declaration required by IEEE 1012
783
+ for any IV&V assessment to be considered independent.
784
+ """
785
+ return (
786
+ "This Independent Verification and Validation assessment was "
787
+ "conducted separately from the development team per IEEE 1012 and "
788
+ "DoD requirements. The IV&V engine operates with:\n\n"
789
+ "- **Organizational Independence:** Separate assessment authority "
790
+ "from development\n"
791
+ "- **Technical Independence:** Independent analysis tools and "
792
+ "criteria\n"
793
+ "- **Financial Independence:** Assessment budget separate from "
794
+ "development\n"
795
+ "- **Authority:** Gate authority to block releases based on findings\n"
796
+ "\n"
797
+ "The IV&V assessor has no reporting relationship to the development "
798
+ "organization and maintains independent access to all project "
799
+ "artifacts, source code, test results, and configuration data. "
800
+ "Assessment criteria are derived from IEEE 1012-2016, DoDI 5000.87, "
801
+ "and NIST 800-53 Rev 5 security controls."
802
+ )
803
+
804
+
805
+ def _build_conditions(recommendation, area_scores, findings):
806
+ """Build conditions text for CONDITIONAL recommendations.
807
+
808
+ Returns a markdown string describing what must be remediated for full
809
+ certification.
810
+ """
811
+ if recommendation == "CERTIFY":
812
+ return "*No conditions — full certification recommended.*"
813
+
814
+ if recommendation == "DENY":
815
+ # List the blocking issues
816
+ lines = ["**Blocking Issues (must be resolved before resubmission):**", ""]
817
+ critical_open = [
818
+ f for f in findings
819
+ if f.get("severity") == "critical"
820
+ and f.get("status") in ("open", "in_progress")
821
+ ]
822
+ if critical_open:
823
+ lines.append(
824
+ f"1. **{len(critical_open)} critical finding(s) "
825
+ "must be resolved:**"
826
+ )
827
+ for f in critical_open:
828
+ fid = f.get("finding_id", "N/A")
829
+ title = f.get("title", "N/A")
830
+ lines.append(f" - {fid}: {title}")
831
+ lines.append("")
832
+
833
+ areas_below_60 = [
834
+ area for area in PROCESS_AREAS
835
+ if area_scores.get(area, {}).get("total", 0) > 0
836
+ and area_scores.get(area, {}).get("score", 0.0) < 60.0
837
+ ]
838
+ if areas_below_60:
839
+ lines.append(
840
+ "2. **Process areas below 60% minimum:**"
841
+ )
842
+ for area in areas_below_60:
843
+ score = area_scores[area]["score"]
844
+ lines.append(f" - {area}: {score:.1f}%")
845
+ lines.append("")
846
+
847
+ return "\n".join(lines)
848
+
849
+ # CONDITIONAL — list what needs improvement
850
+ lines = [
851
+ "**Conditions for Full Certification:**",
852
+ "",
853
+ "The following conditions must be met within 90 days for the "
854
+ "conditional certification to be elevated to full certification:",
855
+ "",
856
+ ]
857
+
858
+ condition_num = 1
859
+
860
+ # Areas below 60%
861
+ areas_below_60 = [
862
+ area for area in PROCESS_AREAS
863
+ if area_scores.get(area, {}).get("total", 0) > 0
864
+ and area_scores.get(area, {}).get("score", 0.0) < 60.0
865
+ ]
866
+ if areas_below_60:
867
+ for area in areas_below_60:
868
+ score = area_scores[area]["score"]
869
+ lines.append(
870
+ f"{condition_num}. Raise **{area}** score from "
871
+ f"{score:.1f}% to at least 60%."
872
+ )
873
+ condition_num += 1
874
+
875
+ # Areas between 60% and 80% (advisory)
876
+ areas_below_80 = [
877
+ area for area in PROCESS_AREAS
878
+ if area_scores.get(area, {}).get("total", 0) > 0
879
+ and 60.0 <= area_scores.get(area, {}).get("score", 0.0) < 80.0
880
+ ]
881
+ if areas_below_80:
882
+ for area in areas_below_80:
883
+ score = area_scores[area]["score"]
884
+ lines.append(
885
+ f"{condition_num}. Improve **{area}** score from "
886
+ f"{score:.1f}% toward 80% target."
887
+ )
888
+ condition_num += 1
889
+
890
+ # Open high findings
891
+ high_open = [
892
+ f for f in findings
893
+ if f.get("severity") == "high"
894
+ and f.get("status") in ("open", "in_progress")
895
+ ]
896
+ if high_open:
897
+ lines.append(
898
+ f"{condition_num}. Resolve {len(high_open)} open high-severity "
899
+ "finding(s)."
900
+ )
901
+ condition_num += 1
902
+
903
+ # Open moderate findings (advisory)
904
+ moderate_open = [
905
+ f for f in findings
906
+ if f.get("severity") == "moderate"
907
+ and f.get("status") in ("open", "in_progress")
908
+ ]
909
+ if moderate_open:
910
+ lines.append(
911
+ f"{condition_num}. Address {len(moderate_open)} open "
912
+ "moderate-severity finding(s)."
913
+ )
914
+ condition_num += 1
915
+
916
+ if condition_num == 1:
917
+ lines.append(
918
+ "1. Raise overall IV&V score to 80% or above for full "
919
+ "certification."
920
+ )
921
+
922
+ lines.append("")
923
+ lines.append(
924
+ "**Review Date:** A follow-up review will be scheduled within "
925
+ "90 calendar days to verify condition completion."
926
+ )
927
+
928
+ return "\n".join(lines)
929
+
930
+
931
+ def _build_evidence_index(assessments):
932
+ """Build an evidence index table from assessment evidence paths.
933
+
934
+ Lists all assessments that have an evidence_path recorded.
935
+ """
936
+ with_evidence = [
937
+ a for a in assessments if a.get("evidence_path")
938
+ ]
939
+
940
+ if not with_evidence:
941
+ return "*No evidence artifacts recorded in assessments.*"
942
+
943
+ lines = [
944
+ "| Req ID | Process Area | Evidence Path |",
945
+ "|--------|-------------|---------------|",
946
+ ]
947
+ for a in sorted(with_evidence, key=lambda x: x.get("requirement_id", "")):
948
+ req_id = a.get("requirement_id", "N/A")
949
+ pa = a.get("process_area", "N/A")
950
+ path = a.get("evidence_path", "N/A")
951
+ lines.append(f"| {req_id} | {pa} | `{path}` |")
952
+
953
+ # Summary
954
+ total = len(assessments)
955
+ with_count = len(with_evidence)
956
+ without_count = total - with_count
957
+ coverage = (
958
+ f"{100.0 * with_count / total:.0f}%"
959
+ if total > 0
960
+ else "N/A"
961
+ )
962
+ lines.append("")
963
+ lines.append(
964
+ f"**Evidence Coverage:** {with_count}/{total} assessments "
965
+ f"have evidence artifacts ({coverage})"
966
+ )
967
+ if without_count > 0:
968
+ missing = [
969
+ a for a in assessments if not a.get("evidence_path")
970
+ ]
971
+ missing_ids = [
972
+ a.get("requirement_id", "?") for a in missing
973
+ ]
974
+ if len(missing_ids) <= 10:
975
+ lines.append(
976
+ f"**Missing Evidence:** {', '.join(missing_ids)}"
977
+ )
978
+ else:
979
+ lines.append(
980
+ f"**Missing Evidence:** {', '.join(missing_ids[:10])} "
981
+ f"(and {len(missing_ids) - 10} more)"
982
+ )
983
+
984
+ return "\n".join(lines)
985
+
986
+
987
+ def _build_executive_summary(
988
+ verification_score,
989
+ validation_score,
990
+ overall_score,
991
+ recommendation,
992
+ reason,
993
+ area_scores,
994
+ findings,
995
+ assessments,
996
+ ):
997
+ """Build the executive summary paragraph."""
998
+ total_assessments = len(assessments)
999
+ total_findings = len(findings)
1000
+ critical_open = sum(
1001
+ 1 for f in findings
1002
+ if f.get("severity") == "critical"
1003
+ and f.get("status") in ("open", "in_progress")
1004
+ )
1005
+ high_open = sum(
1006
+ 1 for f in findings
1007
+ if f.get("severity") == "high"
1008
+ and f.get("status") in ("open", "in_progress")
1009
+ )
1010
+
1011
+ # Count assessments by status
1012
+ sum(
1013
+ 1 for a in assessments if a.get("status") == "pass"
1014
+ )
1015
+ sum(
1016
+ 1 for a in assessments if a.get("status") == "fail"
1017
+ )
1018
+
1019
+ lines = []
1020
+ lines.append(
1021
+ f"This IV&V assessment evaluated {total_assessments} requirements "
1022
+ f"across {len(PROCESS_AREAS)} process areas per IEEE 1012-2016 and "
1023
+ f"DoDI 5000.87. The verification score is **{verification_score:.1f}%** "
1024
+ f"and the validation score is **{validation_score:.1f}%**, yielding an "
1025
+ f"overall weighted score of **{overall_score:.1f}%**."
1026
+ )
1027
+ lines.append("")
1028
+
1029
+ if total_findings > 0:
1030
+ lines.append(
1031
+ f"The assessment identified **{total_findings} finding(s)**: "
1032
+ f"{critical_open} critical open, {high_open} high open. "
1033
+ )
1034
+ else:
1035
+ lines.append("No findings were identified during this assessment.")
1036
+
1037
+ lines.append("")
1038
+ lines.append(
1039
+ f"**Certification Recommendation: {recommendation}** — {reason}"
1040
+ )
1041
+
1042
+ # Highlight strongest and weakest areas
1043
+ scored_areas = [
1044
+ (area, area_scores[area]["score"])
1045
+ for area in PROCESS_AREAS
1046
+ if area_scores.get(area, {}).get("total", 0) > 0
1047
+ ]
1048
+ if scored_areas:
1049
+ scored_areas.sort(key=lambda x: x[1], reverse=True)
1050
+ strongest = scored_areas[0]
1051
+ weakest = scored_areas[-1]
1052
+ if strongest[0] != weakest[0]:
1053
+ lines.append("")
1054
+ lines.append(
1055
+ f"**Strongest Area:** {strongest[0]} ({strongest[1]:.1f}%) \n"
1056
+ f"**Weakest Area:** {weakest[0]} ({weakest[1]:.1f}%)"
1057
+ )
1058
+
1059
+ return "\n".join(lines)
1060
+
1061
+
1062
+ def _build_area_subset_details(assessments, area_scores, area_list, label):
1063
+ """Build detail tables for a subset of process areas (used for
1064
+ validation area breakouts in sections 4.1 and 4.2)."""
1065
+ area_data = {area: [] for area in area_list}
1066
+ for a in assessments:
1067
+ pa = a.get("process_area")
1068
+ if pa in area_data:
1069
+ area_data[pa].append(a)
1070
+
1071
+ sections = []
1072
+ for area in area_list:
1073
+ items = area_data[area]
1074
+ s = area_scores.get(area, {})
1075
+ score = s.get("score", 0.0)
1076
+
1077
+ sections.append(f"**{area}** — Score: {score:.1f}%")
1078
+ sections.append("")
1079
+
1080
+ if not items:
1081
+ sections.append(
1082
+ "*No assessments recorded for this area.*"
1083
+ )
1084
+ sections.append("")
1085
+ continue
1086
+
1087
+ sections.append("| Req ID | Status | Evidence | Notes |")
1088
+ sections.append("|--------|--------|----------|-------|")
1089
+ for item in sorted(items, key=lambda x: x.get("requirement_id", "")):
1090
+ req_id = item.get("requirement_id", "N/A")
1091
+ status = _status_badge(item.get("status", "not_assessed"))
1092
+ evidence = (
1093
+ (item.get("evidence_description") or "")
1094
+ .replace("\n", " ")
1095
+ .strip()
1096
+ )
1097
+ notes = (
1098
+ (item.get("notes") or "").replace("\n", " ").strip()
1099
+ )
1100
+ if len(evidence) > 60:
1101
+ evidence = evidence[:57] + "..."
1102
+ if len(notes) > 60:
1103
+ notes = notes[:57] + "..."
1104
+ sections.append(
1105
+ f"| {req_id} | {status} | {evidence} | {notes} |"
1106
+ )
1107
+ sections.append("")
1108
+
1109
+ return "\n".join(sections)
1110
+
1111
+
1112
+ def _determine_gate_result(findings):
1113
+ """Determine the IV&V gate result.
1114
+
1115
+ PASS if zero critical findings are open; FAIL otherwise.
1116
+ """
1117
+ critical_open = sum(
1118
+ 1 for f in findings
1119
+ if f.get("severity") == "critical"
1120
+ and f.get("status") in ("open", "in_progress")
1121
+ )
1122
+ if critical_open > 0:
1123
+ return "FAIL", critical_open
1124
+ return "PASS", 0
1125
+
1126
+
1127
+ # ---------------------------------------------------------------------------
1128
+ # Variable substitution & CUI markings
1129
+ # ---------------------------------------------------------------------------
1130
+
1131
+ def _apply_cui_markings(content, cui_config):
1132
+ """Apply CUI header and footer banners to the report content."""
1133
+ header = cui_config.get("document_header", "").strip()
1134
+ footer = cui_config.get("document_footer", "").strip()
1135
+ banner_top = cui_config.get("banner_top", "CUI // SP-CTI")
1136
+
1137
+ # If the content already contains the banner, skip
1138
+ if banner_top in content:
1139
+ return content
1140
+
1141
+ return f"{header}\n\n{content.strip()}\n\n{footer}\n"
1142
+
1143
+
1144
+ def _substitute_variables(template, variables):
1145
+ """Replace {{variable_name}} placeholders in the template."""
1146
+ def replacer(match):
1147
+ key = match.group(1).strip()
1148
+ return str(variables.get(key, match.group(0)))
1149
+ return re.sub(r"\{\{(\w+)\}\}", replacer, template)
1150
+
1151
+
1152
+ # ---------------------------------------------------------------------------
1153
+ # Audit logging
1154
+ # ---------------------------------------------------------------------------
1155
+
1156
+ def _log_audit_event(conn, project_id, action, details, file_path):
1157
+ """Log an audit trail event for IV&V report generation.
1158
+
1159
+ Uses 'compliance_check' as the event_type since IV&V report generation
1160
+ falls under compliance verification activities.
1161
+ """
1162
+ try:
1163
+ conn.execute(
1164
+ """INSERT INTO audit_trail
1165
+ (project_id, event_type, actor, action, details,
1166
+ affected_files, classification)
1167
+ VALUES (?, ?, ?, ?, ?, ?, ?)""",
1168
+ (
1169
+ project_id,
1170
+ "compliance_check",
1171
+ "icdev-ivv-engine",
1172
+ action,
1173
+ json.dumps(details),
1174
+ json.dumps([str(file_path)]),
1175
+ "CUI",
1176
+ ),
1177
+ )
1178
+ conn.commit()
1179
+ except Exception as e:
1180
+ print(
1181
+ f"Warning: Could not log audit event: {e}", file=sys.stderr
1182
+ )
1183
+
1184
+
1185
+ # ---------------------------------------------------------------------------
1186
+ # Main generator
1187
+ # ---------------------------------------------------------------------------
1188
+
1189
+ def generate_ivv_report(project_id, output_path=None, db_path=None):
1190
+ """Generate an IV&V certification report for a project.
1191
+
1192
+ Workflow:
1193
+ 1. Connect, load project, template, requirements
1194
+ 2. Query all 3 IV&V tables
1195
+ 3. Calculate scores (verification, validation, overall)
1196
+ 4. Determine certification recommendation
1197
+ 5. Build all sections
1198
+ 6. Apply {{variable}} substitution
1199
+ 7. Apply CUI markings
1200
+ 8. Write to: {project_dir}/compliance/ivv-report-v{version}.md
1201
+ 9. Update ivv_certifications table with scores and recommendation
1202
+ 10. Audit: "compliance_check" (IV&V report generated)
1203
+ 11. Return result dict
1204
+
1205
+ Args:
1206
+ project_id: The project identifier.
1207
+ output_path: Override output directory or file path.
1208
+ db_path: Override database path.
1209
+
1210
+ Returns:
1211
+ dict with ``file_path`` and metadata about the generated report.
1212
+ """
1213
+ conn = _get_connection(db_path)
1214
+ try:
1215
+ # 1. Load project data
1216
+ project = _get_project_data(conn, project_id)
1217
+ project_name = project.get("name", project_id)
1218
+
1219
+ # 2. Load template
1220
+ template = _load_template()
1221
+
1222
+ # 3. Load IV&V requirements catalog
1223
+ ivv_catalog = _load_ivv_requirements()
1224
+ _requirements_list = ivv_catalog.get("requirements", [])
1225
+
1226
+ # 4. Query all IV&V tables
1227
+ assessments = _get_ivv_assessments(conn, project_id)
1228
+ findings = _get_ivv_findings(conn, project_id)
1229
+ certification = _get_ivv_certification(conn, project_id)
1230
+
1231
+ # 5. Calculate scores
1232
+ area_scores = _calculate_process_area_scores(assessments)
1233
+ verification_score = _calculate_verification_score(area_scores)
1234
+ validation_score = _calculate_validation_score(area_scores)
1235
+ overall_score = _calculate_overall_score(
1236
+ verification_score, validation_score
1237
+ )
1238
+
1239
+ # 6. Determine certification recommendation
1240
+ recommendation, reason = _determine_certification_recommendation(
1241
+ overall_score, area_scores, findings
1242
+ )
1243
+
1244
+ # 7. Determine gate result
1245
+ gate_result, critical_open_count = _determine_gate_result(findings)
1246
+
1247
+ # 8. Build all report sections
1248
+ process_area_scores_table = _build_process_area_scores_table(
1249
+ area_scores
1250
+ )
1251
+ process_area_details = _build_process_area_details(
1252
+ assessments, area_scores
1253
+ )
1254
+ findings_by_severity = _build_findings_by_severity(findings)
1255
+ findings_summary_table = _build_findings_summary_table(findings)
1256
+
1257
+ rtm_summary, rtm_coverage, rtm_traced, rtm_gaps, rtm_orphans = (
1258
+ _build_rtm_summary(conn, project_id)
1259
+ )
1260
+
1261
+ independence_declaration = _build_independence_declaration()
1262
+ conditions = _build_conditions(
1263
+ recommendation, area_scores, findings
1264
+ )
1265
+ evidence_index = _build_evidence_index(assessments)
1266
+
1267
+ # Build validation area breakouts for sections 4.1 and 4.2
1268
+ test_verification_results = _build_area_subset_details(
1269
+ assessments, area_scores, ["Test Verification"],
1270
+ "Test Verification"
1271
+ )
1272
+ integration_verification_results = _build_area_subset_details(
1273
+ assessments, area_scores, ["Integration Verification"],
1274
+ "Integration Verification"
1275
+ )
1276
+
1277
+ # Build executive summary
1278
+ executive_summary = _build_executive_summary(
1279
+ verification_score,
1280
+ validation_score,
1281
+ overall_score,
1282
+ recommendation,
1283
+ reason,
1284
+ area_scores,
1285
+ findings,
1286
+ assessments,
1287
+ )
1288
+
1289
+ # Load CUI config for banner variables
1290
+ cui_config = _load_cui_config()
1291
+
1292
+ # Determine version number from prior audit events
1293
+ report_count_row = conn.execute(
1294
+ """SELECT COUNT(*) as cnt FROM audit_trail
1295
+ WHERE project_id = ? AND event_type = 'compliance_check'
1296
+ AND action LIKE '%IV&V report%'""",
1297
+ (project_id,),
1298
+ ).fetchone()
1299
+ report_count = report_count_row["cnt"] if report_count_row else 0
1300
+ new_version = f"{report_count + 1}.0"
1301
+
1302
+ now = datetime.now(timezone.utc)
1303
+
1304
+ # 9. Build the complete variable substitution dict
1305
+ variables = {
1306
+ # Project info
1307
+ "project_name": project_name,
1308
+ "project_id": project_id,
1309
+ "classification": project.get("classification", "CUI"),
1310
+ "system_type": project.get("type", "webapp"),
1311
+
1312
+ # Report metadata
1313
+ "version": new_version,
1314
+ "report_version": new_version,
1315
+ "assessment_date": now.strftime("%Y-%m-%d"),
1316
+ "date_prepared": now.strftime("%Y-%m-%d"),
1317
+ "generation_timestamp": now.strftime("%Y-%m-%d %H:%M UTC"),
1318
+ "icdev_version": "1.0",
1319
+ "ivv_authority": certification.get(
1320
+ "ivv_authority", "ICDEV IV&V Engine"
1321
+ ),
1322
+
1323
+ # Scores
1324
+ "verification_score": f"{verification_score:.1f}",
1325
+ "validation_score": f"{validation_score:.1f}",
1326
+ "overall_score": f"{overall_score:.1f}",
1327
+
1328
+ # Gate result
1329
+ "gate_result": gate_result,
1330
+
1331
+ # Certification recommendation
1332
+ "certification_recommendation": recommendation,
1333
+ "certification_reason": reason,
1334
+
1335
+ # Executive summary
1336
+ "executive_summary": executive_summary,
1337
+
1338
+ # Independence declaration
1339
+ "independence_declaration": independence_declaration,
1340
+
1341
+ # Process area tables
1342
+ "process_area_scores_table": process_area_scores_table,
1343
+ "process_area_details": process_area_details,
1344
+
1345
+ # Validation breakouts
1346
+ "test_verification_results": test_verification_results,
1347
+ "integration_verification_results": (
1348
+ integration_verification_results
1349
+ ),
1350
+
1351
+ # RTM summary
1352
+ "rtm_summary": rtm_summary,
1353
+ "rtm_coverage": f"{rtm_coverage:.1f}" if rtm_coverage else "0.0",
1354
+ "rtm_full_trace_count": str(rtm_traced),
1355
+ "rtm_gap_count": str(rtm_gaps),
1356
+ "rtm_orphan_tests": str(rtm_orphans),
1357
+
1358
+ # Findings by severity
1359
+ "critical_findings": findings_by_severity.get(
1360
+ "critical", "*No critical findings.*"
1361
+ ),
1362
+ "high_findings": findings_by_severity.get(
1363
+ "high", "*No high findings.*"
1364
+ ),
1365
+ "moderate_findings": findings_by_severity.get(
1366
+ "moderate", "*No moderate findings.*"
1367
+ ),
1368
+ "low_findings": findings_by_severity.get(
1369
+ "low", "*No low findings.*"
1370
+ ),
1371
+ "findings_summary_table": findings_summary_table,
1372
+
1373
+ # Conditions
1374
+ "conditions": conditions,
1375
+
1376
+ # Evidence index
1377
+ "evidence_index": evidence_index,
1378
+
1379
+ # Next review date (90 days from now if not set)
1380
+ "next_review_date": certification.get(
1381
+ "next_review_date",
1382
+ (now + timedelta(days=90)).strftime("%Y-%m-%d"),
1383
+ ),
1384
+
1385
+ # Certification info from existing record
1386
+ "certification_status": certification.get(
1387
+ "status", "in_progress"
1388
+ ),
1389
+ "certified_date": certification.get("certified_date", "N/A"),
1390
+ "expiration_date": certification.get("expiration_date", "N/A"),
1391
+ "open_findings_count": str(
1392
+ sum(
1393
+ 1 for f in findings
1394
+ if f.get("status") in ("open", "in_progress")
1395
+ )
1396
+ ),
1397
+ "critical_findings_count": str(critical_open_count),
1398
+
1399
+ # Assessment totals
1400
+ "total_assessments": str(len(assessments)),
1401
+ "total_findings": str(len(findings)),
1402
+ "assessments_pass": str(
1403
+ sum(1 for a in assessments if a.get("status") == "pass")
1404
+ ),
1405
+ "assessments_fail": str(
1406
+ sum(1 for a in assessments if a.get("status") == "fail")
1407
+ ),
1408
+
1409
+ # CUI banners
1410
+ "cui_banner_top": cui_config.get(
1411
+ "document_header",
1412
+ cui_config.get("banner_top", "CUI // SP-CTI"),
1413
+ ),
1414
+ "cui_banner_bottom": cui_config.get(
1415
+ "document_footer",
1416
+ cui_config.get("banner_bottom", "CUI // SP-CTI"),
1417
+ ),
1418
+ }
1419
+
1420
+ # Per-area score variables (e.g., requirements_verification_score)
1421
+ for area in PROCESS_AREAS:
1422
+ key_prefix = area.lower().replace(" ", "_").replace("/", "_")
1423
+ s = area_scores.get(area, {})
1424
+ variables[f"{key_prefix}_score"] = f"{s.get('score', 0.0):.1f}"
1425
+ variables[f"{key_prefix}_total"] = str(s.get("total", 0))
1426
+ variables[f"{key_prefix}_pass"] = str(s.get("pass", 0))
1427
+ variables[f"{key_prefix}_fail"] = str(s.get("fail", 0))
1428
+
1429
+ # 10. Substitute variables in template
1430
+ report_content = _substitute_variables(template, variables)
1431
+
1432
+ # 11. Apply CUI markings
1433
+ report_content = _apply_cui_markings(report_content, cui_config)
1434
+
1435
+ # 12. Determine output file path
1436
+ if output_path:
1437
+ out_path = Path(output_path)
1438
+ if (
1439
+ out_path.is_dir()
1440
+ or str(output_path).endswith("/")
1441
+ or str(output_path).endswith("\\")
1442
+ ):
1443
+ out_dir = out_path
1444
+ out_file = out_dir / f"ivv-report-v{new_version}.md"
1445
+ else:
1446
+ out_file = out_path
1447
+ else:
1448
+ dir_path = project.get("directory_path", "")
1449
+ if dir_path:
1450
+ out_dir = Path(dir_path) / "compliance"
1451
+ else:
1452
+ out_dir = (
1453
+ BASE_DIR / "projects" / project_name / "compliance"
1454
+ )
1455
+ out_file = out_dir / f"ivv-report-v{new_version}.md"
1456
+
1457
+ out_file.parent.mkdir(parents=True, exist_ok=True)
1458
+
1459
+ with open(out_file, "w", encoding="utf-8") as f:
1460
+ f.write(report_content)
1461
+
1462
+ # 13. Update ivv_certifications table with scores and recommendation
1463
+ try:
1464
+ # Map recommendation to DB status
1465
+ status_map = {
1466
+ "CERTIFY": "certified",
1467
+ "CONDITIONAL": "conditional",
1468
+ "DENY": "denied",
1469
+ }
1470
+ cert_status = status_map.get(recommendation, "in_progress")
1471
+
1472
+ # Count open and critical findings
1473
+ open_count = sum(
1474
+ 1 for f in findings
1475
+ if f.get("status") in ("open", "in_progress")
1476
+ )
1477
+
1478
+ conn.execute(
1479
+ """INSERT OR REPLACE INTO ivv_certifications
1480
+ (project_id, certification_type, status,
1481
+ verification_score, validation_score, overall_score,
1482
+ ivv_authority, independence_declaration,
1483
+ conditions, open_findings_count,
1484
+ critical_findings_count, next_review_date,
1485
+ updated_at)
1486
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
1487
+ (
1488
+ project_id,
1489
+ "IV&V",
1490
+ cert_status,
1491
+ verification_score,
1492
+ validation_score,
1493
+ overall_score,
1494
+ certification.get(
1495
+ "ivv_authority", "ICDEV IV&V Engine"
1496
+ ),
1497
+ "IEEE 1012 Independent Assessment",
1498
+ conditions if recommendation == "CONDITIONAL" else None,
1499
+ open_count,
1500
+ critical_open_count,
1501
+ (now + timedelta(days=90)).strftime("%Y-%m-%d"),
1502
+ now.strftime("%Y-%m-%d %H:%M:%S"),
1503
+ ),
1504
+ )
1505
+ conn.commit()
1506
+ except Exception as e:
1507
+ print(
1508
+ f"Warning: Could not update ivv_certifications: {e}",
1509
+ file=sys.stderr,
1510
+ )
1511
+
1512
+ # 14. Log audit event
1513
+ audit_details = {
1514
+ "report_type": "IV&V Certification Report",
1515
+ "version": new_version,
1516
+ "verification_score": verification_score,
1517
+ "validation_score": validation_score,
1518
+ "overall_score": overall_score,
1519
+ "gate_result": gate_result,
1520
+ "recommendation": recommendation,
1521
+ "total_assessments": len(assessments),
1522
+ "total_findings": len(findings),
1523
+ "critical_open": critical_open_count,
1524
+ "output_file": str(out_file),
1525
+ }
1526
+ _log_audit_event(
1527
+ conn,
1528
+ project_id,
1529
+ f"IV&V report v{new_version} generated — {recommendation}",
1530
+ audit_details,
1531
+ out_file,
1532
+ )
1533
+
1534
+ # 15. Print summary
1535
+ print("IV&V certification report generated successfully:")
1536
+ print(f" File: {out_file}")
1537
+ print(f" Version: {new_version}")
1538
+ print(f" Project: {project_name}")
1539
+ print(f" Verification: {verification_score:.1f}%")
1540
+ print(f" Validation: {validation_score:.1f}%")
1541
+ print(f" Overall Score: {overall_score:.1f}%")
1542
+ print(f" Gate Result: {gate_result}")
1543
+ print(f" Recommendation: {recommendation}")
1544
+ print(f" Assessments: {len(assessments)}")
1545
+ print(f" Findings: {len(findings)}")
1546
+ print(f" Critical Open: {critical_open_count}")
1547
+
1548
+ # 16. Return result dict
1549
+ return {
1550
+ "file_path": str(out_file),
1551
+ "version": new_version,
1552
+ "project_id": project_id,
1553
+ "project_name": project_name,
1554
+ "verification_score": verification_score,
1555
+ "validation_score": validation_score,
1556
+ "overall_score": overall_score,
1557
+ "gate_result": gate_result,
1558
+ "recommendation": recommendation,
1559
+ "reason": reason,
1560
+ "process_area_scores": {
1561
+ area: area_scores[area]["score"]
1562
+ for area in PROCESS_AREAS
1563
+ },
1564
+ "total_assessments": len(assessments),
1565
+ "total_findings": len(findings),
1566
+ "critical_open_findings": critical_open_count,
1567
+ "rtm_coverage": rtm_coverage,
1568
+ "generated_at": now.isoformat(),
1569
+ }
1570
+
1571
+ finally:
1572
+ conn.close()
1573
+
1574
+
1575
+ # ---------------------------------------------------------------------------
1576
+ # CLI entry point
1577
+ # ---------------------------------------------------------------------------
1578
+
1579
+ def _format_json_output(result):
1580
+ """Format result as JSON for machine-readable output."""
1581
+ return json.dumps(result, indent=2, default=str)
1582
+
1583
+
1584
+ def _format_text_output(result):
1585
+ """Format result as human-readable text."""
1586
+ lines = [
1587
+ "=" * 60,
1588
+ "IV&V CERTIFICATION REPORT SUMMARY",
1589
+ "=" * 60,
1590
+ "",
1591
+ f" File: {result['file_path']}",
1592
+ f" Version: {result['version']}",
1593
+ f" Project: {result['project_name']} ({result['project_id']})",
1594
+ "",
1595
+ " SCORES:",
1596
+ f" Verification: {result['verification_score']:.1f}%",
1597
+ f" Validation: {result['validation_score']:.1f}%",
1598
+ f" Overall: {result['overall_score']:.1f}%",
1599
+ "",
1600
+ f" Gate Result: {result['gate_result']}",
1601
+ f" Recommendation: {result['recommendation']}",
1602
+ "",
1603
+ " PROCESS AREA SCORES:",
1604
+ ]
1605
+ for area, score in result.get("process_area_scores", {}).items():
1606
+ lines.append(f" {area:30s} {score:.1f}%")
1607
+ lines.extend([
1608
+ "",
1609
+ f" Total Assessments: {result['total_assessments']}",
1610
+ f" Total Findings: {result['total_findings']}",
1611
+ f" Critical Open: {result['critical_open_findings']}",
1612
+ f" RTM Coverage: {result['rtm_coverage']:.1f}%",
1613
+ f" Generated: {result['generated_at']}",
1614
+ "",
1615
+ "=" * 60,
1616
+ ])
1617
+ return "\n".join(lines)
1618
+
1619
+
1620
+ if __name__ == "__main__":
1621
+ parser = argparse.ArgumentParser(
1622
+ description="Generate IV&V certification report per IEEE 1012"
1623
+ )
1624
+ parser.add_argument(
1625
+ "--project-id",
1626
+ required=True,
1627
+ help="Project ID to generate IV&V report for",
1628
+ )
1629
+ parser.add_argument(
1630
+ "--output-dir",
1631
+ help="Output directory (default: {project_dir}/compliance/)",
1632
+ )
1633
+ parser.add_argument(
1634
+ "--db-path",
1635
+ type=Path,
1636
+ default=DB_PATH,
1637
+ help="Database path (default: data/icdev.db)",
1638
+ )
1639
+ parser.add_argument(
1640
+ "--format",
1641
+ choices=["text", "json"],
1642
+ default="text",
1643
+ help="Output format for CLI summary (default: text)",
1644
+ )
1645
+
1646
+ parser.add_argument("--json", action="store_true", dest="json_output", help="JSON output")
1647
+ args = parser.parse_args()
1648
+
1649
+ try:
1650
+ result = generate_ivv_report(
1651
+ args.project_id, args.output_dir, args.db_path
1652
+ )
1653
+ if args.format == "json":
1654
+ print(_format_json_output(result))
1655
+ else:
1656
+ print(_format_text_output(result))
1657
+ except FileNotFoundError as e:
1658
+ print(f"ERROR: {e}", file=sys.stderr)
1659
+ sys.exit(1)
1660
+ except ValueError as e:
1661
+ print(f"ERROR: {e}", file=sys.stderr)
1662
+ sys.exit(1)