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.
- icdev/__init__.py +18 -0
- icdev/_paths.py +85 -0
- icdev/_version.py +3 -0
- icdev/data/__init__.py +1 -0
- icdev/data/args/__init__.py +1 -0
- icdev/data/args/agent_authority.yaml +61 -0
- icdev/data/args/agent_config.yaml +355 -0
- icdev/data/args/agentic_fitness.yaml +31 -0
- icdev/data/args/ai_governance_config.yaml +137 -0
- icdev/data/args/atlas_critique_config.yaml +66 -0
- icdev/data/args/bedrock_models.yaml +63 -0
- icdev/data/args/cicd_config.yaml +82 -0
- icdev/data/args/classification_config.yaml +232 -0
- icdev/data/args/cli_config.yaml +154 -0
- icdev/data/args/cloud_config.yaml +63 -0
- icdev/data/args/code_pattern_config.yaml +151 -0
- icdev/data/args/code_quality_config.yaml +47 -0
- icdev/data/args/companion_registry.yaml +202 -0
- icdev/data/args/context_config.yaml +82 -0
- icdev/data/args/csp_monitor_config.yaml +268 -0
- icdev/data/args/cui_markings.yaml +35 -0
- icdev/data/args/db_config.yaml +40 -0
- icdev/data/args/deployment_profiles.yaml +248 -0
- icdev/data/args/dev_profile_config.yaml +144 -0
- icdev/data/args/devsecops_config.yaml +286 -0
- icdev/data/args/endpoint_security_config.yaml +137 -0
- icdev/data/args/extension_config.yaml +79 -0
- icdev/data/args/file_access_tiers.yaml +88 -0
- icdev/data/args/framework_registry.yaml +415 -0
- icdev/data/args/innovation_config.yaml +431 -0
- icdev/data/args/installation_manifest.yaml +1087 -0
- icdev/data/args/llm_config.yaml +495 -0
- icdev/data/args/maintenance_config.yaml +55 -0
- icdev/data/args/memory_config.yaml +83 -0
- icdev/data/args/monitoring_config.yaml +127 -0
- icdev/data/args/mosa_config.yaml +190 -0
- icdev/data/args/nlq_config.yaml +35 -0
- icdev/data/args/observability_config.yaml +39 -0
- icdev/data/args/observability_tracing_config.yaml +170 -0
- icdev/data/args/oscal_tools_config.yaml +43 -0
- icdev/data/args/owasp_agentic_config.yaml +171 -0
- icdev/data/args/phase_registry.yaml +618 -0
- icdev/data/args/project_defaults.yaml +235 -0
- icdev/data/args/prompt_chains.yaml +163 -0
- icdev/data/args/resilience_config.yaml +50 -0
- icdev/data/args/ricoas_config.yaml +191 -0
- icdev/data/args/role_personas.yaml +362 -0
- icdev/data/args/scaling_config.yaml +176 -0
- icdev/data/args/security_gates.yaml +685 -0
- icdev/data/args/skill_injection_config.yaml +322 -0
- icdev/data/args/spec_config.yaml +53 -0
- icdev/data/args/supply_chain_config.yaml +76 -0
- icdev/data/args/translation_config.yaml +228 -0
- icdev/data/args/workflow_templates/ato_acceleration.yaml +54 -0
- icdev/data/args/workflow_templates/build_deploy.yaml +63 -0
- icdev/data/args/workflow_templates/full_compliance.yaml +43 -0
- icdev/data/args/workflow_templates/security_hardening.yaml +55 -0
- icdev/data/args/worktree_config.yaml +34 -0
- icdev/data/args/zta_config.yaml +247 -0
- icdev/data/context/__init__.py +1 -0
- icdev/data/context/agent/__init__.py +1 -0
- icdev/data/context/agent/response_schemas/__init__.py +1 -0
- icdev/data/context/agent/response_schemas/debate_position.json +46 -0
- icdev/data/context/agent/response_schemas/fitness_scorecard.json +74 -0
- icdev/data/context/agent/response_schemas/review_decision.json +39 -0
- icdev/data/context/agent/response_schemas/task_decomposition.json +82 -0
- icdev/data/context/agent/response_schemas/veto_decision.json +40 -0
- icdev/data/context/agentic/__init__.py +1 -0
- icdev/data/context/agentic/architecture_patterns.md +269 -0
- icdev/data/context/agentic/capability_registry.yaml +202 -0
- icdev/data/context/agentic/csp_mcp_registry.yaml +280 -0
- icdev/data/context/agentic/fitness_rubric.md +56 -0
- icdev/data/context/agentic/governance_baseline.md +205 -0
- icdev/data/context/ci/__init__.py +1 -0
- icdev/data/context/ci/worktree_templates.json +44 -0
- icdev/data/context/cloud/__init__.py +1 -0
- icdev/data/context/cloud/csp_service_registry.json +739 -0
- icdev/data/context/compliance/__init__.py +1 -0
- icdev/data/context/compliance/atlas_mitigations.json +293 -0
- icdev/data/context/compliance/atlas_techniques.json +833 -0
- icdev/data/context/compliance/cisa_sbd_requirements.json +432 -0
- icdev/data/context/compliance/cjis_security_policy.json +522 -0
- icdev/data/context/compliance/cmmc_practices.json +2494 -0
- icdev/data/context/compliance/cmmc_report_template.md +142 -0
- icdev/data/context/compliance/cnssi_1253_overlay.json +109 -0
- icdev/data/context/compliance/control_crosswalk.json +1914 -0
- icdev/data/context/compliance/control_families/__init__.py +1 -0
- icdev/data/context/compliance/csp_certifications.json +251 -0
- icdev/data/context/compliance/cssp_report_template.md +193 -0
- icdev/data/context/compliance/cui_templates/__init__.py +1 -0
- icdev/data/context/compliance/cui_templates/banner_block.txt +4 -0
- icdev/data/context/compliance/cui_templates/code_header.txt +8 -0
- icdev/data/context/compliance/cui_templates/document_template.md +35 -0
- icdev/data/context/compliance/data_type_framework_map.json +321 -0
- icdev/data/context/compliance/data_type_registry.json +147 -0
- icdev/data/context/compliance/dod_cssp_8530.json +463 -0
- icdev/data/context/compliance/eu_ai_act_annex_iii.json +108 -0
- icdev/data/context/compliance/export_templates/__init__.py +1 -0
- icdev/data/context/compliance/export_templates/emass_controls.csv.j2 +4 -0
- icdev/data/context/compliance/export_templates/evidence_package.md.j2 +39 -0
- icdev/data/context/compliance/export_templates/executive_summary.md.j2 +55 -0
- icdev/data/context/compliance/export_templates/poam_tracking.csv.j2 +4 -0
- icdev/data/context/compliance/fedramp_20x_ksi_schemas.json +133 -0
- icdev/data/context/compliance/fedramp_high_baseline.json +4370 -0
- icdev/data/context/compliance/fedramp_moderate_baseline.json +2183 -0
- icdev/data/context/compliance/fedramp_report_template.md +181 -0
- icdev/data/context/compliance/fips_200_areas.json +362 -0
- icdev/data/context/compliance/gao_ai_accountability.json +262 -0
- icdev/data/context/compliance/hipaa_security_rule.json +720 -0
- icdev/data/context/compliance/hitrust_csf_v11.json +930 -0
- icdev/data/context/compliance/impact_level_profiles.json +251 -0
- icdev/data/context/compliance/incident_response_template.md +1110 -0
- icdev/data/context/compliance/iso27001_2022_controls.json +750 -0
- icdev/data/context/compliance/iso27001_nist_bridge.json +382 -0
- icdev/data/context/compliance/iso42001_controls.json +254 -0
- icdev/data/context/compliance/ivv_checklist_template.md +80 -0
- icdev/data/context/compliance/ivv_report_template.md +116 -0
- icdev/data/context/compliance/ivv_requirements.json +372 -0
- icdev/data/context/compliance/mosa_crosswalk.json +327 -0
- icdev/data/context/compliance/mosa_framework.json +250 -0
- icdev/data/context/compliance/narrative_templates/AC.md.j2 +101 -0
- icdev/data/context/compliance/narrative_templates/AU.md.j2 +106 -0
- icdev/data/context/compliance/narrative_templates/IA.md.j2 +104 -0
- icdev/data/context/compliance/narrative_templates/SC.md.j2 +102 -0
- icdev/data/context/compliance/narrative_templates/SI.md.j2 +111 -0
- icdev/data/context/compliance/narrative_templates/__init__.py +1 -0
- icdev/data/context/compliance/narrative_templates/default.md.j2 +50 -0
- icdev/data/context/compliance/narrative_templates/executive_summary.j2 +27 -0
- icdev/data/context/compliance/narrative_templates/poam_milestone.j2 +19 -0
- icdev/data/context/compliance/narrative_templates/ssp_section.j2 +11 -0
- icdev/data/context/compliance/nist_800_171_controls.json +1552 -0
- icdev/data/context/compliance/nist_800_207_crosswalk.json +399 -0
- icdev/data/context/compliance/nist_800_207_zta.json +258 -0
- icdev/data/context/compliance/nist_800_53.json +324 -0
- icdev/data/context/compliance/nist_ai_600_1_genai.json +326 -0
- icdev/data/context/compliance/nist_ai_rmf.json +206 -0
- icdev/data/context/compliance/nist_sp_800_60_types.json +1667 -0
- icdev/data/context/compliance/omb_m25_21_high_impact_ai.json +248 -0
- icdev/data/context/compliance/omb_m26_04_unbiased_ai.json +262 -0
- icdev/data/context/compliance/owasp_agentic_asi.json +133 -0
- icdev/data/context/compliance/owasp_agentic_threats.json +285 -0
- icdev/data/context/compliance/owasp_llm_top10.json +274 -0
- icdev/data/context/compliance/pci_dss_v4.json +510 -0
- icdev/data/context/compliance/poam_template.md +117 -0
- icdev/data/context/compliance/safeai_controls.json +512 -0
- icdev/data/context/compliance/sbd_report_template.md +77 -0
- icdev/data/context/compliance/siem_config_templates/__init__.py +1 -0
- icdev/data/context/compliance/siem_config_templates/filebeat.yml +213 -0
- icdev/data/context/compliance/siem_config_templates/log_sources.json +208 -0
- icdev/data/context/compliance/soc2_trust_criteria.json +661 -0
- icdev/data/context/compliance/ssp_template.md +432 -0
- icdev/data/context/compliance/stig_templates/__init__.py +1 -0
- icdev/data/context/compliance/stig_templates/webapp_stig.json +139 -0
- icdev/data/context/compliance/xai_requirements.json +108 -0
- icdev/data/context/dashboard/__init__.py +1 -0
- icdev/data/context/dashboard/nlq_examples.json +50 -0
- icdev/data/context/dashboard/schema_descriptions.json +23 -0
- icdev/data/context/integration/__init__.py +1 -0
- icdev/data/context/integration/approval_workflows.json +32 -0
- icdev/data/context/integration/gitlab_field_mappings.json +33 -0
- icdev/data/context/integration/jira_field_mappings.json +32 -0
- icdev/data/context/integration/reqif_export_schema.json +23 -0
- icdev/data/context/integration/servicenow_field_mappings.json +22 -0
- icdev/data/context/languages/__init__.py +1 -0
- icdev/data/context/languages/framework_patterns.json +205 -0
- icdev/data/context/languages/language_registry.json +279 -0
- icdev/data/context/llm/__init__.py +1 -0
- icdev/data/context/llm/example_provider.py +86 -0
- icdev/data/context/mbse/__init__.py +1 -0
- icdev/data/context/mbse/des_report_template.md +162 -0
- icdev/data/context/mbse/des_requirements.json +411 -0
- icdev/data/context/mbse/digital_thread_patterns.json +403 -0
- icdev/data/context/mbse/reqif_schema.json +280 -0
- icdev/data/context/mbse/sysml_element_types.json +432 -0
- icdev/data/context/modernization/__init__.py +1 -0
- icdev/data/context/modernization/db_type_mappings.json +148 -0
- icdev/data/context/modernization/decomposition_patterns.json +284 -0
- icdev/data/context/modernization/framework_migration_patterns.json +359 -0
- icdev/data/context/modernization/migration_report_template.md +168 -0
- icdev/data/context/modernization/seven_rs_catalog.json +369 -0
- icdev/data/context/modernization/version_upgrade_rules.json +279 -0
- icdev/data/context/oscal/NIST_SP-800-53_rev5_catalog.json +254987 -0
- icdev/data/context/oscal/README.md +43 -0
- icdev/data/context/patterns/__init__.py +1 -0
- icdev/data/context/profiles/__init__.py +1 -0
- icdev/data/context/profiles/dod_baseline_v1.yaml +145 -0
- icdev/data/context/profiles/fedramp_baseline_v1.yaml +143 -0
- icdev/data/context/profiles/financial_baseline_v1.yaml +142 -0
- icdev/data/context/profiles/healthcare_baseline_v1.yaml +135 -0
- icdev/data/context/profiles/law_enforcement_v1.yaml +129 -0
- icdev/data/context/profiles/startup_v1.yaml +134 -0
- icdev/data/context/requirements/__init__.py +1 -0
- icdev/data/context/requirements/ambiguity_patterns.json +97 -0
- icdev/data/context/requirements/boundary_impact_rules.json +123 -0
- icdev/data/context/requirements/default_constitutions.json +67 -0
- icdev/data/context/requirements/document_extraction_rules.json +58 -0
- icdev/data/context/requirements/gap_patterns.json +108 -0
- icdev/data/context/requirements/readiness_rubric.json +78 -0
- icdev/data/context/requirements/red_alternative_patterns.json +210 -0
- icdev/data/context/requirements/safe_templates.json +72 -0
- icdev/data/context/requirements/spec_quality_checklist.json +122 -0
- icdev/data/context/simulation/__init__.py +1 -0
- icdev/data/context/simulation/architecture_patterns.json +36 -0
- icdev/data/context/simulation/coa_templates.json +38 -0
- icdev/data/context/simulation/cost_models.json +23 -0
- icdev/data/context/simulation/risk_categories.json +46 -0
- icdev/data/context/supply_chain/__init__.py +1 -0
- icdev/data/context/supply_chain/isa_templates.json +129 -0
- icdev/data/context/supply_chain/nist_800_161_controls.json +247 -0
- icdev/data/context/supply_chain/scrm_risk_matrix.json +147 -0
- icdev/data/context/templates/__init__.py +1 -0
- icdev/data/context/templates/ansible/__init__.py +1 -0
- icdev/data/context/templates/ansible/playbooks/__init__.py +1 -0
- icdev/data/context/templates/ansible/roles/__init__.py +1 -0
- icdev/data/context/templates/gitlab_ci/__init__.py +1 -0
- icdev/data/context/templates/grafana/__init__.py +1 -0
- icdev/data/context/templates/kubernetes/__init__.py +1 -0
- icdev/data/context/templates/project/__init__.py +1 -0
- icdev/data/context/templates/project/api/__init__.py +1 -0
- icdev/data/context/templates/project/cli/__init__.py +1 -0
- icdev/data/context/templates/project/data_pipeline/__init__.py +1 -0
- icdev/data/context/templates/project/iac/__init__.py +1 -0
- icdev/data/context/templates/project/javascript_frontend/__init__.py +1 -0
- icdev/data/context/templates/project/javascript_frontend/src/__init__.py +1 -0
- icdev/data/context/templates/project/javascript_frontend/tests/__init__.py +1 -0
- icdev/data/context/templates/project/microservice/__init__.py +1 -0
- icdev/data/context/templates/project/python_backend/__init__.py +1 -0
- icdev/data/context/templates/project/python_backend/src/__init__.py +1 -0
- icdev/data/context/templates/project/python_backend/tests/__init__.py +1 -0
- icdev/data/context/templates/project/python_backend/tests/features/__init__.py +1 -0
- icdev/data/context/templates/project/python_backend/tests/steps/__init__.py +1 -0
- icdev/data/context/templates/terraform/__init__.py +1 -0
- icdev/data/context/templates/terraform/govcloud_base/__init__.py +1 -0
- icdev/data/context/templates/terraform/modules/__init__.py +1 -0
- icdev/data/context/tone/__init__.py +1 -0
- icdev/data/context/translation/dependency_mappings.json +186 -0
- icdev/data/context/translation/type_mappings.json +149 -0
- icdev/data/docs/README.md +187 -0
- icdev/data/docs/__init__.py +1 -0
- icdev/data/docs/admin/gateway-guide.md +338 -0
- icdev/data/docs/admin/marketplace-guide.md +396 -0
- icdev/data/docs/admin/monitoring-guide.md +509 -0
- icdev/data/docs/architecture/compliance-framework.md +764 -0
- icdev/data/docs/architecture/database-schema.md +689 -0
- icdev/data/docs/architecture/gotcha-framework.md +518 -0
- icdev/data/docs/architecture/multi-agent-system.md +603 -0
- icdev/data/docs/dx/README.md +106 -0
- icdev/data/docs/dx/__init__.py +1 -0
- icdev/data/docs/dx/ci-cd-integration.md +378 -0
- icdev/data/docs/dx/claude-code-guide.md +213 -0
- icdev/data/docs/dx/companion-guide.md +232 -0
- icdev/data/docs/dx/dev-profiles.md +309 -0
- icdev/data/docs/dx/icdev-yaml-spec.md +219 -0
- icdev/data/docs/dx/integration-tiers.md +279 -0
- icdev/data/docs/dx/llm-routing-guide.md +456 -0
- icdev/data/docs/dx/quickstart.md +192 -0
- icdev/data/docs/dx/sdk-reference.md +356 -0
- icdev/data/docs/dx/unified-mcp-setup.md +525 -0
- icdev/data/docs/features/__init__.py +1 -0
- icdev/data/docs/features/phase-01-gotcha-framework.md +249 -0
- icdev/data/docs/features/phase-02-atlas-build-workflow.md +223 -0
- icdev/data/docs/features/phase-03-tdd-bdd-testing.md +261 -0
- icdev/data/docs/features/phase-04-nist-compliance.md +255 -0
- icdev/data/docs/features/phase-05-security-scanning.md +229 -0
- icdev/data/docs/features/phase-06-infrastructure-deployment.md +288 -0
- icdev/data/docs/features/phase-07-code-review-gates.md +276 -0
- icdev/data/docs/features/phase-08-self-healing.md +223 -0
- icdev/data/docs/features/phase-09-monitoring-observability.md +230 -0
- icdev/data/docs/features/phase-10-dashboard-web-ui.md +218 -0
- icdev/data/docs/features/phase-11-multi-agent-architecture.md +272 -0
- icdev/data/docs/features/phase-12-integration-testing.md +228 -0
- icdev/data/docs/features/phase-13-cicd-integration.md +257 -0
- icdev/data/docs/features/phase-14-secure-by-design-ivv.md +240 -0
- icdev/data/docs/features/phase-15-maintenance-audit.md +192 -0
- icdev/data/docs/features/phase-16-ato-acceleration.md +228 -0
- icdev/data/docs/features/phase-17-multi-framework-compliance.md +223 -0
- icdev/data/docs/features/phase-18-mbse-integration.md +242 -0
- icdev/data/docs/features/phase-19-agentic-generation.md +202 -0
- icdev/data/docs/features/phase-20-fips-security-categorization.md +198 -0
- icdev/data/docs/features/phase-21-saas-multi-tenancy.md +273 -0
- icdev/data/docs/features/phase-22-federated-gotcha-marketplace.md +242 -0
- icdev/data/docs/features/phase-23-universal-compliance-platform.md +238 -0
- icdev/data/docs/features/phase-24-devsecops-pipeline-security.md +198 -0
- icdev/data/docs/features/phase-25-zero-trust-architecture.md +220 -0
- icdev/data/docs/features/phase-26-dod-mosa.md +205 -0
- icdev/data/docs/features/phase-27-cli-capabilities.md +222 -0
- icdev/data/docs/features/phase-28-remote-command-gateway.md +235 -0
- icdev/data/docs/features/phase-29-proactive-monitoring.md +212 -0
- icdev/data/docs/features/phase-30-dashboard-auth.md +215 -0
- icdev/data/docs/features/phase-31-dashboard-ux-low-impact.md +188 -0
- icdev/data/docs/features/phase-32-dashboard-ux-medium-impact.md +223 -0
- icdev/data/docs/features/phase-33-modular-installation.md +218 -0
- icdev/data/docs/features/phase-34-dev-profiles.md +239 -0
- icdev/data/docs/features/phase-35-innovation-engine.md +257 -0
- icdev/data/docs/features/phase-36-evolutionary-intelligence.md +351 -0
- icdev/data/docs/features/phase-37-mitre-atlas-integration.md +485 -0
- icdev/data/docs/features/phase-38-cloud-agnostic-architecture.md +1033 -0
- icdev/data/docs/features/phase-39-observability-operations.md +178 -0
- icdev/data/docs/features/phase-40-nlq-compliance-queries.md +176 -0
- icdev/data/docs/features/phase-41-parallel-cicd.md +169 -0
- icdev/data/docs/features/phase-42-framework-planning.md +177 -0
- icdev/data/docs/features/phase-43-cross-language-translation.md +225 -0
- icdev/data/docs/features/phase-44-innovation-adaptation.md +227 -0
- icdev/data/docs/features/phase-45-owasp-agentic-security.md +239 -0
- icdev/data/docs/features/phase-46-observability-traceability-xai.md +240 -0
- icdev/data/docs/features/phase-47-unified-mcp-gateway.md +257 -0
- icdev/data/docs/features/phase-48-ai-transparency.md +203 -0
- icdev/data/docs/features/phase-49-ai-accountability.md +243 -0
- icdev/data/docs/features/phase-50-ai-governance-intake-chat.md +195 -0
- icdev/data/docs/features/phase-51-unified-chat-dashboard.md +240 -0
- icdev/data/docs/features/phase-52-code-intelligence.md +244 -0
- icdev/data/docs/features/phase-53-fedramp-20x-owasp-asi.md +359 -0
- icdev/data/docs/features/phase-54-slsa-swft-orchestration.md +379 -0
- icdev/data/docs/features/phase-55-a2a-v03-mcp-oauth.md +322 -0
- icdev/data/docs/features/phase-56-evidence-lineage.md +352 -0
- icdev/data/docs/features/phase-57-eu-ai-act-iron-bank.md +319 -0
- icdev/data/docs/features/phase-58-creative-engine.md +370 -0
- icdev/data/docs/features/phase-59-govcon-intelligence.md +535 -0
- icdev/data/docs/features/phase-60-cpmp.md +528 -0
- icdev/data/docs/features/phase-61-orchestration-improvements.md +534 -0
- icdev/data/docs/operations/dashboard-guide.md +354 -0
- icdev/data/docs/operations/deployment-guide.md +556 -0
- icdev/data/docs/operations/saas-admin-guide.md +439 -0
- icdev/data/docs/operations/security-operations-guide.md +733 -0
- icdev/data/docs/runbooks/backup-restore.md +412 -0
- icdev/data/docs/runbooks/troubleshooting.md +499 -0
- icdev/data/features/__init__.py +1 -0
- icdev/data/features/cicd_integration.feature +41 -0
- icdev/data/features/compliance_gates.feature +46 -0
- icdev/data/features/dashboard.feature +72 -0
- icdev/data/features/environment.py +25 -0
- icdev/data/features/project_management.feature +32 -0
- icdev/data/features/requirements_intake.feature +42 -0
- icdev/data/features/saas_platform.feature +53 -0
- icdev/data/features/security_scanning.feature +36 -0
- icdev/data/features/steps/__init__.py +1 -0
- icdev/data/features/steps/cicd_steps.py +465 -0
- icdev/data/features/steps/compliance_steps.py +308 -0
- icdev/data/features/steps/dashboard_steps.py +88 -0
- icdev/data/features/steps/project_steps.py +126 -0
- icdev/data/features/steps/requirements_intake_steps.py +689 -0
- icdev/data/features/steps/saas_platform_steps.py +572 -0
- icdev/data/features/steps/security_steps.py +236 -0
- icdev/data/features/steps/testing_steps.py +226 -0
- icdev/data/features/testing_pipeline.feature +42 -0
- icdev/data/goals/__init__.py +1 -0
- icdev/data/goals/agent_management.md +144 -0
- icdev/data/goals/agentic_generation.md +345 -0
- icdev/data/goals/agentic_threat_model.md +309 -0
- icdev/data/goals/ai_accountability.md +90 -0
- icdev/data/goals/ai_governance_intake.md +132 -0
- icdev/data/goals/ai_transparency.md +76 -0
- icdev/data/goals/atlas_integration.md +405 -0
- icdev/data/goals/ato_acceleration.md +139 -0
- icdev/data/goals/boundary_supply_chain.md +206 -0
- icdev/data/goals/build_app.md +544 -0
- icdev/data/goals/cicd_integration.md +86 -0
- icdev/data/goals/claude_dir_maintenance.md +77 -0
- icdev/data/goals/cli_capabilities.md +340 -0
- icdev/data/goals/cloud_agnostic.md +312 -0
- icdev/data/goals/code_intelligence.md +197 -0
- icdev/data/goals/code_review.md +94 -0
- icdev/data/goals/compliance_workflow.md +858 -0
- icdev/data/goals/continuous_harmonization.md +140 -0
- icdev/data/goals/cross_language_translation.md +171 -0
- icdev/data/goals/dashboard.md +142 -0
- icdev/data/goals/deploy_workflow.md +390 -0
- icdev/data/goals/devsecops_workflow.md +408 -0
- icdev/data/goals/evolutionary_intelligence.md +305 -0
- icdev/data/goals/external_integration.md +113 -0
- icdev/data/goals/framework_planning.md +63 -0
- icdev/data/goals/init_project.md +235 -0
- icdev/data/goals/innovation_engine.md +199 -0
- icdev/data/goals/integration_testing.md +189 -0
- icdev/data/goals/maintenance_audit.md +196 -0
- icdev/data/goals/manifest.md +56 -0
- icdev/data/goals/mbse_integration.md +504 -0
- icdev/data/goals/modernization_workflow.md +618 -0
- icdev/data/goals/monitoring.md +126 -0
- icdev/data/goals/mosa_workflow.md +463 -0
- icdev/data/goals/multi_agent_orchestration.md +68 -0
- icdev/data/goals/nlq_compliance.md +63 -0
- icdev/data/goals/observability.md +64 -0
- icdev/data/goals/observability_traceability_xai.md +154 -0
- icdev/data/goals/owasp_agentic_security.md +395 -0
- icdev/data/goals/parallel_cicd.md +61 -0
- icdev/data/goals/requirements_intake.md +213 -0
- icdev/data/goals/sbd_ivv_workflow.md +195 -0
- icdev/data/goals/security_categorization.md +133 -0
- icdev/data/goals/security_scan.md +381 -0
- icdev/data/goals/self_healing.md +120 -0
- icdev/data/goals/simulation_engine.md +111 -0
- icdev/data/goals/tdd_workflow.md +403 -0
- icdev/data/goals/zero_trust_architecture.md +403 -0
- icdev/data/hardprompts/__init__.py +1 -0
- icdev/data/hardprompts/agent/__init__.py +1 -0
- icdev/data/hardprompts/agent/agentic_architect.md +100 -0
- icdev/data/hardprompts/agent/debate_prompt.md +32 -0
- icdev/data/hardprompts/agent/fitness_evaluation.md +48 -0
- icdev/data/hardprompts/agent/governance_review.md +214 -0
- icdev/data/hardprompts/agent/reviewer_prompt.md +34 -0
- icdev/data/hardprompts/agent/skill_design.md +172 -0
- icdev/data/hardprompts/agent/task_decomposition.md +275 -0
- icdev/data/hardprompts/agent/veto_check_prompt.md +33 -0
- icdev/data/hardprompts/architect/__init__.py +1 -0
- icdev/data/hardprompts/architect/api_design.md +283 -0
- icdev/data/hardprompts/architect/data_model.md +277 -0
- icdev/data/hardprompts/architect/system_design.md +180 -0
- icdev/data/hardprompts/builder/__init__.py +1 -0
- icdev/data/hardprompts/builder/code_generation.md +59 -0
- icdev/data/hardprompts/builder/refactor.md +58 -0
- icdev/data/hardprompts/builder/scaffold_project.md +69 -0
- icdev/data/hardprompts/builder/test_generation.md +87 -0
- icdev/data/hardprompts/ci/__init__.py +1 -0
- icdev/data/hardprompts/ci/worktree_setup.md +35 -0
- icdev/data/hardprompts/compliance/__init__.py +1 -0
- icdev/data/hardprompts/compliance/cmmc_assessment.md +63 -0
- icdev/data/hardprompts/compliance/cssp_assessment.md +75 -0
- icdev/data/hardprompts/compliance/cui_marking.md +86 -0
- icdev/data/hardprompts/compliance/fedramp_assessment.md +55 -0
- icdev/data/hardprompts/compliance/ivv_assessment.md +96 -0
- icdev/data/hardprompts/compliance/poam_generation.md +57 -0
- icdev/data/hardprompts/compliance/sbd_assessment.md +101 -0
- icdev/data/hardprompts/compliance/security_categorization.md +74 -0
- icdev/data/hardprompts/compliance/ssp_generation.md +56 -0
- icdev/data/hardprompts/compliance/stig_evaluation.md +63 -0
- icdev/data/hardprompts/dashboard/__init__.py +1 -0
- icdev/data/hardprompts/dashboard/nlq_system_prompt.md +26 -0
- icdev/data/hardprompts/infra/__init__.py +1 -0
- icdev/data/hardprompts/infra/k8s_manifests.md +118 -0
- icdev/data/hardprompts/infra/pipeline_generation.md +160 -0
- icdev/data/hardprompts/infra/terraform_generation.md +92 -0
- icdev/data/hardprompts/integration/__init__.py +1 -0
- icdev/data/hardprompts/integration/approval_review.md +17 -0
- icdev/data/hardprompts/integration/jira_mapping.md +25 -0
- icdev/data/hardprompts/integration/servicenow_mapping.md +14 -0
- icdev/data/hardprompts/knowledge/__init__.py +1 -0
- icdev/data/hardprompts/knowledge/pattern_detection.md +73 -0
- icdev/data/hardprompts/knowledge/recommendation_engine.md +90 -0
- icdev/data/hardprompts/knowledge/root_cause_analysis.md +91 -0
- icdev/data/hardprompts/maintenance/__init__.py +1 -0
- icdev/data/hardprompts/maintenance/maintenance_assessment.md +82 -0
- icdev/data/hardprompts/mbse/__init__.py +1 -0
- icdev/data/hardprompts/mbse/digital_thread.md +67 -0
- icdev/data/hardprompts/mbse/model_import.md +62 -0
- icdev/data/hardprompts/mbse/model_to_code.md +65 -0
- icdev/data/hardprompts/modernization/__init__.py +1 -0
- icdev/data/hardprompts/modernization/legacy_analysis.md +93 -0
- icdev/data/hardprompts/modernization/migration_planning.md +150 -0
- icdev/data/hardprompts/modernization/seven_r_assessment.md +107 -0
- icdev/data/hardprompts/requirements/__init__.py +1 -0
- icdev/data/hardprompts/requirements/bdd_generation.md +35 -0
- icdev/data/hardprompts/requirements/clarification_prioritization.md +29 -0
- icdev/data/hardprompts/requirements/decomposition.md +60 -0
- icdev/data/hardprompts/requirements/document_extraction.md +45 -0
- icdev/data/hardprompts/requirements/gap_detection.md +70 -0
- icdev/data/hardprompts/requirements/intake_conversation.md +101 -0
- icdev/data/hardprompts/requirements/readiness_assessment.md +39 -0
- icdev/data/hardprompts/requirements/spec_quality.md +33 -0
- icdev/data/hardprompts/requirements/traceability_analysis.md +23 -0
- icdev/data/hardprompts/security/__init__.py +1 -0
- icdev/data/hardprompts/security/endpoint_security.md +78 -0
- icdev/data/hardprompts/security/threat_model.md +70 -0
- icdev/data/hardprompts/security/vulnerability_assessment.md +81 -0
- icdev/data/hardprompts/simulation/__init__.py +1 -0
- icdev/data/hardprompts/simulation/architecture_impact.md +27 -0
- icdev/data/hardprompts/simulation/coa_alternative.md +27 -0
- icdev/data/hardprompts/simulation/coa_generation.md +25 -0
- icdev/data/hardprompts/simulation/compliance_impact.md +28 -0
- icdev/data/hardprompts/simulation/cost_estimation.md +33 -0
- icdev/data/hardprompts/simulation/risk_assessment.md +28 -0
- icdev/data/hardprompts/translation/code_translation.md +68 -0
- icdev/data/hardprompts/translation/dependency_suggestion.md +44 -0
- icdev/data/hardprompts/translation/test_translation.md +64 -0
- icdev/data/hardprompts/translation/translation_repair.md +59 -0
- icdev/py.typed +0 -0
- icdev/tools/__init__.py +1 -0
- icdev/tools/_gen_formatter.py +12 -0
- icdev/tools/a2a/__init__.py +1 -0
- icdev/tools/a2a/agent_cards/architect.json +43 -0
- icdev/tools/a2a/agent_cards/builder.json +50 -0
- icdev/tools/a2a/agent_cards/compliance.json +57 -0
- icdev/tools/a2a/agent_cards/devsecops.json +71 -0
- icdev/tools/a2a/agent_cards/infra.json +57 -0
- icdev/tools/a2a/agent_cards/integration.json +57 -0
- icdev/tools/a2a/agent_cards/knowledge.json +43 -0
- icdev/tools/a2a/agent_cards/mbse.json +57 -0
- icdev/tools/a2a/agent_cards/modernization.json +50 -0
- icdev/tools/a2a/agent_cards/monitor.json +43 -0
- icdev/tools/a2a/agent_cards/orchestrator.json +36 -0
- icdev/tools/a2a/agent_cards/requirements_analyst.json +64 -0
- icdev/tools/a2a/agent_cards/security.json +50 -0
- icdev/tools/a2a/agent_cards/simulation.json +57 -0
- icdev/tools/a2a/agent_cards/supply_chain.json +50 -0
- icdev/tools/a2a/agent_client.py +349 -0
- icdev/tools/a2a/agent_registry.py +412 -0
- icdev/tools/a2a/agent_server.py +579 -0
- icdev/tools/a2a/task.py +200 -0
- icdev/tools/agent/__init__.py +2 -0
- icdev/tools/agent/a2a_agent_card_generator.py +285 -0
- icdev/tools/agent/a2a_discovery_server.py +250 -0
- icdev/tools/agent/agent_executor.py +529 -0
- icdev/tools/agent/agent_memory.py +557 -0
- icdev/tools/agent/agent_models.py +51 -0
- icdev/tools/agent/atlas_critique.py +908 -0
- icdev/tools/agent/authority.py +443 -0
- icdev/tools/agent/bedrock_client.py +1075 -0
- icdev/tools/agent/collaboration.py +871 -0
- icdev/tools/agent/dispatcher_mode.py +665 -0
- icdev/tools/agent/mailbox.py +575 -0
- icdev/tools/agent/prompt_chain_executor.py +1064 -0
- icdev/tools/agent/session_purpose.py +350 -0
- icdev/tools/agent/skill_router.py +638 -0
- icdev/tools/agent/skill_selector.py +486 -0
- icdev/tools/agent/team_orchestrator.py +1108 -0
- icdev/tools/agent/token_tracker.py +290 -0
- icdev/tools/analysis/__init__.py +1 -0
- icdev/tools/analysis/code_analyzer.py +780 -0
- icdev/tools/analysis/runtime_feedback.py +389 -0
- icdev/tools/audit/__init__.py +1 -0
- icdev/tools/audit/audit_logger.py +196 -0
- icdev/tools/audit/audit_query.py +157 -0
- icdev/tools/audit/decision_recorder.py +72 -0
- icdev/tools/builder/__init__.py +1 -0
- icdev/tools/builder/agentic_fitness.py +534 -0
- icdev/tools/builder/agentic_test_templates/test_a2a_callback.py +117 -0
- icdev/tools/builder/agentic_test_templates/test_a2a_lifecycle.feature +52 -0
- icdev/tools/builder/agentic_test_templates/test_agent_card.feature +37 -0
- icdev/tools/builder/agentic_test_templates/test_agent_health.py +128 -0
- icdev/tools/builder/agentic_test_templates/test_memory_system.feature +50 -0
- icdev/tools/builder/agentic_test_templates/test_skill_execution.feature +40 -0
- icdev/tools/builder/app_blueprint.py +1583 -0
- icdev/tools/builder/child_app_generator.py +2852 -0
- icdev/tools/builder/claude_md_generator.py +1734 -0
- icdev/tools/builder/code_generator.py +3703 -0
- icdev/tools/builder/db_init_generator.py +1709 -0
- icdev/tools/builder/dev_profile_manager.py +954 -0
- icdev/tools/builder/formatter.py +768 -0
- icdev/tools/builder/goal_adapter.py +592 -0
- icdev/tools/builder/gotcha_validator.py +812 -0
- icdev/tools/builder/language_support.py +441 -0
- icdev/tools/builder/linter.py +976 -0
- icdev/tools/builder/profile_detector.py +657 -0
- icdev/tools/builder/profile_md_generator.py +723 -0
- icdev/tools/builder/scaffolder.py +1590 -0
- icdev/tools/builder/scaffolder_extended.py +1771 -0
- icdev/tools/builder/test_writer.py +950 -0
- icdev/tools/ci/__init__.py +2 -0
- icdev/tools/ci/connectors/__init__.py +2 -0
- icdev/tools/ci/connectors/base_connector.py +80 -0
- icdev/tools/ci/connectors/connector_registry.py +188 -0
- icdev/tools/ci/connectors/mattermost_connector.py +159 -0
- icdev/tools/ci/connectors/slack_connector.py +197 -0
- icdev/tools/ci/core/__init__.py +2 -0
- icdev/tools/ci/core/air_gap_detector.py +115 -0
- icdev/tools/ci/core/comment_handler.py +192 -0
- icdev/tools/ci/core/conversation_manager.py +479 -0
- icdev/tools/ci/core/event_envelope.py +500 -0
- icdev/tools/ci/core/event_router.py +443 -0
- icdev/tools/ci/core/failure_parser.py +397 -0
- icdev/tools/ci/core/recovery_engine.py +527 -0
- icdev/tools/ci/modules/__init__.py +2 -0
- icdev/tools/ci/modules/agent.py +271 -0
- icdev/tools/ci/modules/git_ops.py +175 -0
- icdev/tools/ci/modules/state.py +117 -0
- icdev/tools/ci/modules/vcs.py +303 -0
- icdev/tools/ci/modules/workflow_ops.py +295 -0
- icdev/tools/ci/modules/worktree.py +340 -0
- icdev/tools/ci/pipeline_config_generator.py +558 -0
- icdev/tools/ci/triggers/__init__.py +2 -0
- icdev/tools/ci/triggers/gitlab_task_monitor.py +330 -0
- icdev/tools/ci/triggers/poll_trigger.py +237 -0
- icdev/tools/ci/triggers/webhook_server.py +356 -0
- icdev/tools/ci/workflows/__init__.py +2 -0
- icdev/tools/ci/workflows/icdev_build.py +140 -0
- icdev/tools/ci/workflows/icdev_comply.py +284 -0
- icdev/tools/ci/workflows/icdev_document.py +152 -0
- icdev/tools/ci/workflows/icdev_e2e.py +188 -0
- icdev/tools/ci/workflows/icdev_patch.py +186 -0
- icdev/tools/ci/workflows/icdev_plan.py +202 -0
- icdev/tools/ci/workflows/icdev_plan_build.py +41 -0
- icdev/tools/ci/workflows/icdev_plan_build_test.py +46 -0
- icdev/tools/ci/workflows/icdev_plan_build_test_review.py +47 -0
- icdev/tools/ci/workflows/icdev_review.py +126 -0
- icdev/tools/ci/workflows/icdev_sdlc.py +261 -0
- icdev/tools/ci/workflows/icdev_test.py +240 -0
- icdev/tools/cli/__init__.py +1 -0
- icdev/tools/cli/output_formatter.py +756 -0
- icdev/tools/cli_formatter.py +42 -0
- icdev/tools/cloud/__init__.py +11 -0
- icdev/tools/cloud/cloud_mode_manager.py +364 -0
- icdev/tools/cloud/csp_changelog.py +383 -0
- icdev/tools/cloud/csp_health_checker.py +268 -0
- icdev/tools/cloud/csp_monitor.py +951 -0
- icdev/tools/cloud/iam_provider.py +593 -0
- icdev/tools/cloud/kms_provider.py +346 -0
- icdev/tools/cloud/monitoring_provider.py +628 -0
- icdev/tools/cloud/provider_factory.py +376 -0
- icdev/tools/cloud/region_validator.py +345 -0
- icdev/tools/cloud/registry_provider.py +563 -0
- icdev/tools/cloud/secrets_provider.py +486 -0
- icdev/tools/cloud/storage_provider.py +446 -0
- icdev/tools/compat/__init__.py +21 -0
- icdev/tools/compat/cli_harmonizer.py +251 -0
- icdev/tools/compat/datetime_utils.py +18 -0
- icdev/tools/compat/db_utils.py +160 -0
- icdev/tools/compat/platform_utils.py +123 -0
- icdev/tools/compliance/__init__.py +1 -0
- icdev/tools/compliance/accountability_manager.py +397 -0
- icdev/tools/compliance/ai_accountability_audit.py +294 -0
- icdev/tools/compliance/ai_impact_assessor.py +273 -0
- icdev/tools/compliance/ai_incident_response.py +301 -0
- icdev/tools/compliance/ai_inventory_manager.py +239 -0
- icdev/tools/compliance/ai_reassessment_scheduler.py +256 -0
- icdev/tools/compliance/ai_transparency_audit.py +248 -0
- icdev/tools/compliance/atlas_assessor.py +278 -0
- icdev/tools/compliance/atlas_report_generator.py +1211 -0
- icdev/tools/compliance/base_assessor.py +597 -0
- icdev/tools/compliance/cato_monitor.py +1385 -0
- icdev/tools/compliance/cato_scheduler.py +699 -0
- icdev/tools/compliance/cjis_assessor.py +76 -0
- icdev/tools/compliance/classification_manager.py +1353 -0
- icdev/tools/compliance/cmmc_assessor.py +1491 -0
- icdev/tools/compliance/cmmc_report_generator.py +1100 -0
- icdev/tools/compliance/compliance_detector.py +463 -0
- icdev/tools/compliance/compliance_exporter.py +427 -0
- icdev/tools/compliance/compliance_status.py +825 -0
- icdev/tools/compliance/control_mapper.py +505 -0
- icdev/tools/compliance/crosswalk_engine.py +1203 -0
- icdev/tools/compliance/cssp_assessor.py +1045 -0
- icdev/tools/compliance/cssp_evidence_collector.py +729 -0
- icdev/tools/compliance/cssp_report_generator.py +1116 -0
- icdev/tools/compliance/cui_marker.py +388 -0
- icdev/tools/compliance/diagram_validator.py +600 -0
- icdev/tools/compliance/emass/__init__.py +2 -0
- icdev/tools/compliance/emass/emass_client.py +840 -0
- icdev/tools/compliance/emass/emass_export.py +777 -0
- icdev/tools/compliance/emass/emass_sync.py +826 -0
- icdev/tools/compliance/eu_ai_act_classifier.py +194 -0
- icdev/tools/compliance/evidence_collector.py +468 -0
- icdev/tools/compliance/fairness_assessor.py +316 -0
- icdev/tools/compliance/fedramp_assessor.py +1808 -0
- icdev/tools/compliance/fedramp_authorization_packager.py +137 -0
- icdev/tools/compliance/fedramp_ksi_generator.py +355 -0
- icdev/tools/compliance/fedramp_report_generator.py +1128 -0
- icdev/tools/compliance/fips199_categorizer.py +881 -0
- icdev/tools/compliance/fips200_validator.py +315 -0
- icdev/tools/compliance/gao_ai_assessor.py +231 -0
- icdev/tools/compliance/gao_evidence_builder.py +308 -0
- icdev/tools/compliance/hipaa_assessor.py +78 -0
- icdev/tools/compliance/hitrust_assessor.py +49 -0
- icdev/tools/compliance/incident_response_plan.py +718 -0
- icdev/tools/compliance/iso27001_assessor.py +92 -0
- icdev/tools/compliance/iso42001_assessor.py +114 -0
- icdev/tools/compliance/ivv_assessor.py +2327 -0
- icdev/tools/compliance/ivv_report_generator.py +1662 -0
- icdev/tools/compliance/model_card_generator.py +297 -0
- icdev/tools/compliance/mosa_assessor.py +117 -0
- icdev/tools/compliance/multi_regime_assessor.py +451 -0
- icdev/tools/compliance/narrative_generator.py +1013 -0
- icdev/tools/compliance/nist_800_207_assessor.py +191 -0
- icdev/tools/compliance/nist_ai_600_1_assessor.py +188 -0
- icdev/tools/compliance/nist_ai_rmf_assessor.py +110 -0
- icdev/tools/compliance/nist_lookup.py +245 -0
- icdev/tools/compliance/omb_m25_21_assessor.py +228 -0
- icdev/tools/compliance/omb_m26_04_assessor.py +188 -0
- icdev/tools/compliance/oscal_catalog_adapter.py +395 -0
- icdev/tools/compliance/oscal_generator.py +2170 -0
- icdev/tools/compliance/oscal_tools.py +1182 -0
- icdev/tools/compliance/owasp_agentic_assessor.py +226 -0
- icdev/tools/compliance/owasp_asi_assessor.py +200 -0
- icdev/tools/compliance/owasp_llm_assessor.py +244 -0
- icdev/tools/compliance/pci_dss_assessor.py +80 -0
- icdev/tools/compliance/pi_compliance_tracker.py +1461 -0
- icdev/tools/compliance/poam_generator.py +405 -0
- icdev/tools/compliance/resolve_marking.py +283 -0
- icdev/tools/compliance/sbd_assessor.py +2068 -0
- icdev/tools/compliance/sbd_report_generator.py +1236 -0
- icdev/tools/compliance/sbom_generator.py +1008 -0
- icdev/tools/compliance/siem_config_generator.py +674 -0
- icdev/tools/compliance/slsa_attestation_generator.py +490 -0
- icdev/tools/compliance/soc2_assessor.py +77 -0
- icdev/tools/compliance/ssp_generator.py +573 -0
- icdev/tools/compliance/stig_checker.py +727 -0
- icdev/tools/compliance/swft_evidence_bundler.py +337 -0
- icdev/tools/compliance/system_card_generator.py +309 -0
- icdev/tools/compliance/traceability_matrix.py +1281 -0
- icdev/tools/compliance/universal_classification_manager.py +1172 -0
- icdev/tools/compliance/xacta/__init__.py +2 -0
- icdev/tools/compliance/xacta/xacta_client.py +449 -0
- icdev/tools/compliance/xacta/xacta_export.py +557 -0
- icdev/tools/compliance/xacta/xacta_sync.py +333 -0
- icdev/tools/compliance/xai_assessor.py +231 -0
- icdev/tools/dashboard/__init__.py +1 -0
- icdev/tools/dashboard/api/__init__.py +1 -0
- icdev/tools/dashboard/api/_pipeline_state.py +17 -0
- icdev/tools/dashboard/api/activity.py +206 -0
- icdev/tools/dashboard/api/admin.py +176 -0
- icdev/tools/dashboard/api/agents.py +53 -0
- icdev/tools/dashboard/api/ai_accountability.py +163 -0
- icdev/tools/dashboard/api/ai_transparency.py +198 -0
- icdev/tools/dashboard/api/audit.py +58 -0
- icdev/tools/dashboard/api/batch.py +666 -0
- icdev/tools/dashboard/api/chat.py +241 -0
- icdev/tools/dashboard/api/cicd.py +219 -0
- icdev/tools/dashboard/api/code_quality.py +223 -0
- icdev/tools/dashboard/api/compliance.py +171 -0
- icdev/tools/dashboard/api/cpmp.py +915 -0
- icdev/tools/dashboard/api/diagrams.py +65 -0
- icdev/tools/dashboard/api/events.py +250 -0
- icdev/tools/dashboard/api/evidence.py +99 -0
- icdev/tools/dashboard/api/fedramp_20x.py +77 -0
- icdev/tools/dashboard/api/govcon.py +1095 -0
- icdev/tools/dashboard/api/intake.py +1171 -0
- icdev/tools/dashboard/api/lineage.py +163 -0
- icdev/tools/dashboard/api/metrics.py +155 -0
- icdev/tools/dashboard/api/nlq.py +72 -0
- icdev/tools/dashboard/api/orchestration.py +472 -0
- icdev/tools/dashboard/api/oscal.py +183 -0
- icdev/tools/dashboard/api/prod_audit.py +183 -0
- icdev/tools/dashboard/api/projects.py +191 -0
- icdev/tools/dashboard/api/proposals.py +1084 -0
- icdev/tools/dashboard/api/traces.py +363 -0
- icdev/tools/dashboard/api/usage.py +234 -0
- icdev/tools/dashboard/app.py +1986 -0
- icdev/tools/dashboard/auth.py +500 -0
- icdev/tools/dashboard/byok.py +245 -0
- icdev/tools/dashboard/chat_manager.py +675 -0
- icdev/tools/dashboard/config.py +116 -0
- icdev/tools/dashboard/diagram_definitions.py +642 -0
- icdev/tools/dashboard/nlq_processor.py +323 -0
- icdev/tools/dashboard/phase_loader.py +136 -0
- icdev/tools/dashboard/sse_manager.py +89 -0
- icdev/tools/dashboard/state_tracker.py +267 -0
- icdev/tools/dashboard/static/css/style.css +706 -0
- icdev/tools/dashboard/static/css/ux.css +2047 -0
- icdev/tools/dashboard/static/js/activity.js +322 -0
- icdev/tools/dashboard/static/js/api.js +161 -0
- icdev/tools/dashboard/static/js/batch.js +814 -0
- icdev/tools/dashboard/static/js/charts.js +618 -0
- icdev/tools/dashboard/static/js/chat.js +1514 -0
- icdev/tools/dashboard/static/js/kanban.js +113 -0
- icdev/tools/dashboard/static/js/live.js +569 -0
- icdev/tools/dashboard/static/js/mermaid-icdev.js +332 -0
- icdev/tools/dashboard/static/js/proposals.js +588 -0
- icdev/tools/dashboard/static/js/shortcuts.js +544 -0
- icdev/tools/dashboard/static/js/tables.js +652 -0
- icdev/tools/dashboard/static/js/tour.js +524 -0
- icdev/tools/dashboard/static/js/ux.js +942 -0
- icdev/tools/dashboard/templates/404.html +10 -0
- icdev/tools/dashboard/templates/activity.html +80 -0
- icdev/tools/dashboard/templates/admin/users.html +144 -0
- icdev/tools/dashboard/templates/ai_accountability.html +235 -0
- icdev/tools/dashboard/templates/ai_transparency.html +263 -0
- icdev/tools/dashboard/templates/base.html +104 -0
- icdev/tools/dashboard/templates/batch.html +23 -0
- icdev/tools/dashboard/templates/chat.html +332 -0
- icdev/tools/dashboard/templates/children.html +149 -0
- icdev/tools/dashboard/templates/cicd.html +253 -0
- icdev/tools/dashboard/templates/code_quality.html +214 -0
- icdev/tools/dashboard/templates/cpmp/cor_detail.html +220 -0
- icdev/tools/dashboard/templates/cpmp/cor_portal.html +91 -0
- icdev/tools/dashboard/templates/cpmp/deliverable_detail.html +197 -0
- icdev/tools/dashboard/templates/cpmp/detail.html +578 -0
- icdev/tools/dashboard/templates/cpmp/portfolio.html +202 -0
- icdev/tools/dashboard/templates/dev_profiles.html +304 -0
- icdev/tools/dashboard/templates/diagrams.html +224 -0
- icdev/tools/dashboard/templates/events/timeline.html +232 -0
- icdev/tools/dashboard/templates/evidence.html +134 -0
- icdev/tools/dashboard/templates/fedramp_20x.html +207 -0
- icdev/tools/dashboard/templates/gateway.html +244 -0
- icdev/tools/dashboard/templates/govcon/capabilities.html +135 -0
- icdev/tools/dashboard/templates/govcon/pipeline.html +214 -0
- icdev/tools/dashboard/templates/govcon/requirements.html +120 -0
- icdev/tools/dashboard/templates/index.html +254 -0
- icdev/tools/dashboard/templates/lineage.html +141 -0
- icdev/tools/dashboard/templates/login.html +51 -0
- icdev/tools/dashboard/templates/monitoring/overview.html +193 -0
- icdev/tools/dashboard/templates/orchestration/dashboard.html +545 -0
- icdev/tools/dashboard/templates/oscal.html +263 -0
- icdev/tools/dashboard/templates/phases.html +150 -0
- icdev/tools/dashboard/templates/prod_audit.html +280 -0
- icdev/tools/dashboard/templates/profile.html +183 -0
- icdev/tools/dashboard/templates/projects/detail.html +583 -0
- icdev/tools/dashboard/templates/projects/list.html +47 -0
- icdev/tools/dashboard/templates/proposals/detail.html +1253 -0
- icdev/tools/dashboard/templates/proposals/list.html +179 -0
- icdev/tools/dashboard/templates/proposals/section_detail.html +193 -0
- icdev/tools/dashboard/templates/provenance.html +181 -0
- icdev/tools/dashboard/templates/query/nlq.html +234 -0
- icdev/tools/dashboard/templates/quick_paths.html +69 -0
- icdev/tools/dashboard/templates/traces.html +155 -0
- icdev/tools/dashboard/templates/translation_detail.html +199 -0
- icdev/tools/dashboard/templates/translations.html +162 -0
- icdev/tools/dashboard/templates/usage.html +225 -0
- icdev/tools/dashboard/templates/wizard.html +539 -0
- icdev/tools/dashboard/templates/xai.html +208 -0
- icdev/tools/dashboard/ux_helpers.py +962 -0
- icdev/tools/dashboard/websocket.py +81 -0
- icdev/tools/db/__init__.py +1 -0
- icdev/tools/db/backup.py +312 -0
- icdev/tools/db/backup_manager.py +832 -0
- icdev/tools/db/init_icdev_db.py +5900 -0
- icdev/tools/db/migrate.py +178 -0
- icdev/tools/db/migration_runner.py +549 -0
- icdev/tools/db/migrations/001_baseline/meta.json +9 -0
- icdev/tools/db/migrations/001_baseline/up.py +68 -0
- icdev/tools/db/migrations/002_memory_enhancements/down.sql +8 -0
- icdev/tools/db/migrations/002_memory_enhancements/meta.json +9 -0
- icdev/tools/db/migrations/002_memory_enhancements/up.py +118 -0
- icdev/tools/db/migrations/003_dev_profiles/meta.json +8 -0
- icdev/tools/db/migrations/003_dev_profiles/up.py +93 -0
- icdev/tools/db/migrations/004_innovation_engine/down.py +19 -0
- icdev/tools/db/migrations/004_innovation_engine/up.py +227 -0
- icdev/tools/db/migrations/005_phase_37_ai_security/down.py +19 -0
- icdev/tools/db/migrations/005_phase_37_ai_security/up.py +258 -0
- icdev/tools/db/migrations/006_phase_36_evolution/down.py +21 -0
- icdev/tools/db/migrations/006_phase_36_evolution/up.py +323 -0
- icdev/tools/db/migrations/007_phase_38_cloud/down.py +14 -0
- icdev/tools/db/migrations/007_phase_38_cloud/up.py +110 -0
- icdev/tools/db/migrations/008_phase36_37_integration/up.py +55 -0
- icdev/tools/db/migrations/__init__.py +2 -0
- icdev/tools/devsecops/__init__.py +2 -0
- icdev/tools/devsecops/attestation_manager.py +458 -0
- icdev/tools/devsecops/network_segmentation_generator.py +614 -0
- icdev/tools/devsecops/pdp_config_generator.py +1256 -0
- icdev/tools/devsecops/pipeline_security_generator.py +484 -0
- icdev/tools/devsecops/policy_generator.py +653 -0
- icdev/tools/devsecops/profile_manager.py +388 -0
- icdev/tools/devsecops/service_mesh_generator.py +1073 -0
- icdev/tools/devsecops/zta_maturity_scorer.py +368 -0
- icdev/tools/devsecops/zta_terraform_generator.py +1303 -0
- icdev/tools/dx/__init__.py +3 -0
- icdev/tools/dx/companion.py +266 -0
- icdev/tools/dx/instruction_generator.py +753 -0
- icdev/tools/dx/mcp_config_generator.py +282 -0
- icdev/tools/dx/skill_translator.py +425 -0
- icdev/tools/dx/tool_detector.py +144 -0
- icdev/tools/extensions/__init__.py +21 -0
- icdev/tools/extensions/builtins/010_ai_governance_chat.py +277 -0
- icdev/tools/extensions/builtins/__init__.py +2 -0
- icdev/tools/extensions/extension_manager.py +455 -0
- icdev/tools/infra/__init__.py +1 -0
- icdev/tools/infra/ansible_generator.py +869 -0
- icdev/tools/infra/dockerfile_generator.py +361 -0
- icdev/tools/infra/infra_status.py +393 -0
- icdev/tools/infra/ironbank_metadata_generator.py +411 -0
- icdev/tools/infra/k8s_generator.py +1002 -0
- icdev/tools/infra/pipeline_generator.py +832 -0
- icdev/tools/infra/rollback.py +400 -0
- icdev/tools/infra/terraform_generator.py +1142 -0
- icdev/tools/infra/terraform_generator_azure.py +1254 -0
- icdev/tools/infra/terraform_generator_gcp.py +953 -0
- icdev/tools/infra/terraform_generator_ibm.py +360 -0
- icdev/tools/infra/terraform_generator_oci.py +919 -0
- icdev/tools/infra/terraform_generator_onprem.py +319 -0
- icdev/tools/innovation/__init__.py +8 -0
- icdev/tools/innovation/competitive_intel.py +492 -0
- icdev/tools/innovation/innovation_manager.py +681 -0
- icdev/tools/innovation/introspective_analyzer.py +774 -0
- icdev/tools/innovation/register_external_patterns.py +440 -0
- icdev/tools/innovation/signal_ranker.py +1038 -0
- icdev/tools/innovation/solution_generator.py +697 -0
- icdev/tools/innovation/standards_monitor.py +466 -0
- icdev/tools/innovation/trend_detector.py +1046 -0
- icdev/tools/innovation/triage_engine.py +1149 -0
- icdev/tools/innovation/web_scanner.py +894 -0
- icdev/tools/installer/__init__.py +1 -0
- icdev/tools/installer/compliance_configurator.py +637 -0
- icdev/tools/installer/installer.py +1711 -0
- icdev/tools/installer/module_registry.py +805 -0
- icdev/tools/installer/platform_setup.py +961 -0
- icdev/tools/integration/__init__.py +2 -0
- icdev/tools/integration/approval_manager.py +561 -0
- icdev/tools/integration/doors_exporter.py +627 -0
- icdev/tools/integration/gitlab_connector.py +784 -0
- icdev/tools/integration/jira_connector.py +774 -0
- icdev/tools/integration/servicenow_connector.py +693 -0
- icdev/tools/knowledge/__init__.py +1 -0
- icdev/tools/knowledge/knowledge_ingest.py +293 -0
- icdev/tools/knowledge/pattern_detector.py +693 -0
- icdev/tools/knowledge/recommendation_engine.py +461 -0
- icdev/tools/knowledge/self_heal_analyzer.py +504 -0
- icdev/tools/llm/__init__.py +72 -0
- icdev/tools/llm/anthropic_provider.py +170 -0
- icdev/tools/llm/azure_openai_provider.py +338 -0
- icdev/tools/llm/bedrock_provider.py +315 -0
- icdev/tools/llm/embedding_provider.py +438 -0
- icdev/tools/llm/gemini_provider.py +381 -0
- icdev/tools/llm/ibm_watsonx_provider.py +232 -0
- icdev/tools/llm/oci_genai_provider.py +462 -0
- icdev/tools/llm/ollama_provider.py +340 -0
- icdev/tools/llm/openai_provider.py +225 -0
- icdev/tools/llm/provider.py +355 -0
- icdev/tools/llm/provider_sdk.py +175 -0
- icdev/tools/llm/router.py +780 -0
- icdev/tools/llm/vertex_ai_provider.py +374 -0
- icdev/tools/maintenance/__init__.py +2 -0
- icdev/tools/maintenance/dependency_scanner.py +1030 -0
- icdev/tools/maintenance/maintenance_auditor.py +815 -0
- icdev/tools/maintenance/remediation_engine.py +966 -0
- icdev/tools/maintenance/vulnerability_checker.py +987 -0
- icdev/tools/mbse/__init__.py +3 -0
- icdev/tools/mbse/des_assessor.py +1186 -0
- icdev/tools/mbse/des_report_generator.py +800 -0
- icdev/tools/mbse/diagram_extractor.py +811 -0
- icdev/tools/mbse/digital_thread.py +1665 -0
- icdev/tools/mbse/model_code_generator.py +1122 -0
- icdev/tools/mbse/model_control_mapper.py +420 -0
- icdev/tools/mbse/pi_model_tracker.py +1093 -0
- icdev/tools/mbse/reqif_parser.py +1483 -0
- icdev/tools/mbse/sync_engine.py +1805 -0
- icdev/tools/mbse/xmi_parser.py +1573 -0
- icdev/tools/mcp/__init__.py +1 -0
- icdev/tools/mcp/base_server.py +535 -0
- icdev/tools/mcp/builder_server.py +725 -0
- icdev/tools/mcp/compliance_server.py +1407 -0
- icdev/tools/mcp/context_indexer.py +199 -0
- icdev/tools/mcp/context_server.py +305 -0
- icdev/tools/mcp/core_server.py +679 -0
- icdev/tools/mcp/devsecops_server.py +432 -0
- icdev/tools/mcp/gap_handlers.py +1079 -0
- icdev/tools/mcp/gateway_server.py +339 -0
- icdev/tools/mcp/generate_registry.py +623 -0
- icdev/tools/mcp/infra_server.py +264 -0
- icdev/tools/mcp/innovation_server.py +316 -0
- icdev/tools/mcp/integration_server.py +527 -0
- icdev/tools/mcp/knowledge_server.py +429 -0
- icdev/tools/mcp/maintenance_server.py +248 -0
- icdev/tools/mcp/marketplace_server.py +499 -0
- icdev/tools/mcp/mbse_server.py +398 -0
- icdev/tools/mcp/modernization_server.py +496 -0
- icdev/tools/mcp/observability_server.py +354 -0
- icdev/tools/mcp/requirements_server.py +415 -0
- icdev/tools/mcp/simulation_server.py +468 -0
- icdev/tools/mcp/standalone/__init__.py +2 -0
- icdev/tools/mcp/standalone/builder.py +59 -0
- icdev/tools/mcp/standalone/compliance.py +59 -0
- icdev/tools/mcp/standalone/core.py +59 -0
- icdev/tools/mcp/standalone/knowledge.py +59 -0
- icdev/tools/mcp/standalone/maintenance.py +59 -0
- icdev/tools/mcp/supply_chain_server.py +476 -0
- icdev/tools/mcp/tool_registry.py +2008 -0
- icdev/tools/mcp/unified_server.py +158 -0
- icdev/tools/memory/__init__.py +2 -0
- icdev/tools/memory/auto_capture.py +347 -0
- icdev/tools/memory/embed_memory.py +158 -0
- icdev/tools/memory/history_compressor.py +334 -0
- icdev/tools/memory/hybrid_search.py +236 -0
- icdev/tools/memory/maintenance_cron.py +289 -0
- icdev/tools/memory/memory_consolidation.py +444 -0
- icdev/tools/memory/memory_db.py +133 -0
- icdev/tools/memory/memory_read.py +102 -0
- icdev/tools/memory/memory_write.py +222 -0
- icdev/tools/memory/semantic_search.py +139 -0
- icdev/tools/memory/time_decay.py +435 -0
- icdev/tools/modernization/__init__.py +3 -0
- icdev/tools/modernization/architecture_extractor.py +734 -0
- icdev/tools/modernization/compliance_bridge.py +1499 -0
- icdev/tools/modernization/db_migration_planner.py +1385 -0
- icdev/tools/modernization/doc_generator.py +1428 -0
- icdev/tools/modernization/framework_migrator.py +1525 -0
- icdev/tools/modernization/legacy_analyzer.py +1948 -0
- icdev/tools/modernization/migration_code_generator.py +1639 -0
- icdev/tools/modernization/migration_report_generator.py +1653 -0
- icdev/tools/modernization/migration_tracker.py +1726 -0
- icdev/tools/modernization/monolith_decomposer.py +1508 -0
- icdev/tools/modernization/seven_r_assessor.py +1658 -0
- icdev/tools/modernization/strangler_fig_manager.py +1705 -0
- icdev/tools/modernization/ui_analyzer.py +771 -0
- icdev/tools/modernization/version_migrator.py +1392 -0
- icdev/tools/monitor/__init__.py +1 -0
- icdev/tools/monitor/alert_correlator.py +495 -0
- icdev/tools/monitor/auto_resolver.py +612 -0
- icdev/tools/monitor/health_checker.py +509 -0
- icdev/tools/monitor/heartbeat_daemon.py +792 -0
- icdev/tools/monitor/log_analyzer.py +516 -0
- icdev/tools/monitor/metric_collector.py +496 -0
- icdev/tools/mosa/__init__.py +10 -0
- icdev/tools/mosa/icd_generator.py +370 -0
- icdev/tools/mosa/modular_design_analyzer.py +683 -0
- icdev/tools/mosa/mosa_code_enforcer.py +349 -0
- icdev/tools/mosa/tsp_generator.py +265 -0
- icdev/tools/observability/__init__.py +100 -0
- icdev/tools/observability/genai_attributes.py +88 -0
- icdev/tools/observability/instrumentation.py +140 -0
- icdev/tools/observability/mlflow_exporter.py +194 -0
- icdev/tools/observability/otel_tracer.py +168 -0
- icdev/tools/observability/provenance/__init__.py +3 -0
- icdev/tools/observability/provenance/prov_recorder.py +324 -0
- icdev/tools/observability/shap/__init__.py +3 -0
- icdev/tools/observability/shap/agent_shap.py +275 -0
- icdev/tools/observability/sqlite_tracer.py +361 -0
- icdev/tools/observability/trace_context.py +205 -0
- icdev/tools/observability/tracer.py +230 -0
- icdev/tools/orchestration/__init__.py +2 -0
- icdev/tools/orchestration/workflow_composer.py +361 -0
- icdev/tools/project/__init__.py +1 -0
- icdev/tools/project/manifest_loader.py +418 -0
- icdev/tools/project/project_create.py +350 -0
- icdev/tools/project/project_list.py +174 -0
- icdev/tools/project/project_scaffold.py +1715 -0
- icdev/tools/project/project_status.py +479 -0
- icdev/tools/project/session_context_builder.py +757 -0
- icdev/tools/project/validate_manifest.py +55 -0
- icdev/tools/registry/__init__.py +10 -0
- icdev/tools/registry/absorption_engine.py +832 -0
- icdev/tools/registry/capability_evaluator.py +668 -0
- icdev/tools/registry/child_registry.py +617 -0
- icdev/tools/registry/cross_pollinator.py +1065 -0
- icdev/tools/registry/genome_manager.py +671 -0
- icdev/tools/registry/learning_collector.py +912 -0
- icdev/tools/registry/propagation_manager.py +942 -0
- icdev/tools/registry/staging_manager.py +742 -0
- icdev/tools/registry/telemetry_collector.py +423 -0
- icdev/tools/requirements/__init__.py +1 -0
- icdev/tools/requirements/ai_governance_scorer.py +208 -0
- icdev/tools/requirements/boundary_analyzer.py +1293 -0
- icdev/tools/requirements/clarification_engine.py +618 -0
- icdev/tools/requirements/complexity_scorer.py +387 -0
- icdev/tools/requirements/consistency_analyzer.py +803 -0
- icdev/tools/requirements/constitution_manager.py +605 -0
- icdev/tools/requirements/decomposition_engine.py +778 -0
- icdev/tools/requirements/document_extractor.py +1016 -0
- icdev/tools/requirements/elicitation_techniques.py +519 -0
- icdev/tools/requirements/gap_detector.py +271 -0
- icdev/tools/requirements/intake_engine.py +2188 -0
- icdev/tools/requirements/prd_generator.py +847 -0
- icdev/tools/requirements/prd_validator.py +595 -0
- icdev/tools/requirements/readiness_scorer.py +313 -0
- icdev/tools/requirements/spec_organizer.py +1029 -0
- icdev/tools/requirements/spec_quality_checker.py +1097 -0
- icdev/tools/requirements/traceability_builder.py +579 -0
- icdev/tools/resilience/__init__.py +34 -0
- icdev/tools/resilience/circuit_breaker.py +340 -0
- icdev/tools/resilience/correlation.py +150 -0
- icdev/tools/resilience/errors.py +81 -0
- icdev/tools/resilience/retry.py +95 -0
- icdev/tools/schemas/__init__.py +27 -0
- icdev/tools/schemas/chat.py +61 -0
- icdev/tools/schemas/compliance.py +56 -0
- icdev/tools/schemas/core.py +85 -0
- icdev/tools/schemas/innovation.py +37 -0
- icdev/tools/schemas/validation.py +109 -0
- icdev/tools/sdk/__init__.py +3 -0
- icdev/tools/sdk/icdev_client.py +218 -0
- icdev/tools/security/__init__.py +1 -0
- icdev/tools/security/agent_output_validator.py +330 -0
- icdev/tools/security/agent_trust_scorer.py +466 -0
- icdev/tools/security/ai_bom_generator.py +725 -0
- icdev/tools/security/ai_telemetry_logger.py +469 -0
- icdev/tools/security/atlas_red_team.py +543 -0
- icdev/tools/security/code_pattern_scanner.py +378 -0
- icdev/tools/security/confabulation_detector.py +271 -0
- icdev/tools/security/container_scanner.py +491 -0
- icdev/tools/security/dependency_auditor.py +944 -0
- icdev/tools/security/endpoint_security_scanner.py +579 -0
- icdev/tools/security/mcp_tool_authorizer.py +243 -0
- icdev/tools/security/prompt_injection_detector.py +737 -0
- icdev/tools/security/sast_runner.py +948 -0
- icdev/tools/security/secret_detector.py +378 -0
- icdev/tools/security/tool_chain_validator.py +357 -0
- icdev/tools/security/vuln_scanner.py +539 -0
- icdev/tools/simulation/__init__.py +2 -0
- icdev/tools/simulation/coa_generator.py +1552 -0
- icdev/tools/simulation/monte_carlo.py +758 -0
- icdev/tools/simulation/scenario_manager.py +1073 -0
- icdev/tools/simulation/simulation_engine.py +1104 -0
- icdev/tools/supply_chain/__init__.py +2 -0
- icdev/tools/supply_chain/cve_triager.py +705 -0
- icdev/tools/supply_chain/dependency_graph.py +645 -0
- icdev/tools/supply_chain/isa_manager.py +540 -0
- icdev/tools/supply_chain/scrm_assessor.py +546 -0
- icdev/tools/testing/__init__.py +2 -0
- icdev/tools/testing/acceptance_validator.py +411 -0
- icdev/tools/testing/claude_dir_validator.py +831 -0
- icdev/tools/testing/data_types.py +199 -0
- icdev/tools/testing/e2e_runner.py +715 -0
- icdev/tools/testing/fuzz_cli.py +306 -0
- icdev/tools/testing/health_check.py +483 -0
- icdev/tools/testing/platform_check.py +143 -0
- icdev/tools/testing/production_audit.py +1862 -0
- icdev/tools/testing/production_remediate.py +804 -0
- icdev/tools/testing/screenshot_validator.py +539 -0
- icdev/tools/testing/smoke_test.py +283 -0
- icdev/tools/testing/test_agent_models.py +117 -0
- icdev/tools/testing/test_orchestrator.py +957 -0
- icdev/tools/testing/utils.py +229 -0
- icdev/tools/translation/__init__.py +17 -0
- icdev/tools/translation/code_translator.py +550 -0
- icdev/tools/translation/dependency_mapper.py +277 -0
- icdev/tools/translation/feature_map.py +395 -0
- icdev/tools/translation/project_assembler.py +439 -0
- icdev/tools/translation/source_extractor.py +609 -0
- icdev/tools/translation/test_translator.py +333 -0
- icdev/tools/translation/translation_manager.py +582 -0
- icdev/tools/translation/translation_validator.py +662 -0
- icdev/tools/translation/type_checker.py +371 -0
- icdev-1.0.0.dist-info/METADATA +868 -0
- icdev-1.0.0.dist-info/RECORD +1105 -0
- icdev-1.0.0.dist-info/WHEEL +5 -0
- icdev-1.0.0.dist-info/entry_points.txt +9 -0
- icdev-1.0.0.dist-info/licenses/LICENSE +254 -0
- icdev-1.0.0.dist-info/licenses/NOTICE +268 -0
- icdev-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1392 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# CUI // SP-CTI
|
|
3
|
+
# Controlled by: Department of Defense
|
|
4
|
+
# CUI Category: CTI
|
|
5
|
+
# Distribution: D -- Authorized DoD Personnel Only
|
|
6
|
+
# POC: ICDEV System Administrator
|
|
7
|
+
"""
|
|
8
|
+
Version Migration Tool — ICDEV DoD Modernization System
|
|
9
|
+
|
|
10
|
+
Transforms legacy source code to newer language versions using AST-based
|
|
11
|
+
analysis and regex transformation rules. Supports Python 2->3, Java 8->17,
|
|
12
|
+
and .NET Framework 4.x -> .NET 8.
|
|
13
|
+
|
|
14
|
+
All transformations are non-destructive: source files are NEVER modified
|
|
15
|
+
in place. Output always goes to a separate output_path directory.
|
|
16
|
+
|
|
17
|
+
Rules are loaded from context/modernization/version_upgrade_rules.json.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import ast
|
|
22
|
+
import collections
|
|
23
|
+
import datetime
|
|
24
|
+
import difflib
|
|
25
|
+
import json
|
|
26
|
+
import os
|
|
27
|
+
import re
|
|
28
|
+
import shutil
|
|
29
|
+
import sys
|
|
30
|
+
import textwrap
|
|
31
|
+
from pathlib import Path
|
|
32
|
+
from icdev._paths import get_project_root
|
|
33
|
+
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
# Paths
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
BASE_DIR = get_project_root()
|
|
38
|
+
RULES_PATH = BASE_DIR / "context" / "modernization" / "version_upgrade_rules.json"
|
|
39
|
+
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Constants
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
CUI_BANNER = "CUI // SP-CTI"
|
|
44
|
+
SUPPORTED_LANGUAGES = {"python", "java", "csharp", "dotnet"}
|
|
45
|
+
|
|
46
|
+
# Map CLI language names to the keys used in the rules JSON
|
|
47
|
+
_LANG_ALIAS = {
|
|
48
|
+
"csharp": "dotnet",
|
|
49
|
+
"c#": "dotnet",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# ====================================================================
|
|
54
|
+
# 1. load_upgrade_rules
|
|
55
|
+
# ====================================================================
|
|
56
|
+
def load_upgrade_rules(language, from_version=None, to_version=None):
|
|
57
|
+
"""Load transformation rules from the context JSON file.
|
|
58
|
+
|
|
59
|
+
Filters rules to match the requested *language* and version range.
|
|
60
|
+
Returns a list of rule dicts. If the rules file is missing the
|
|
61
|
+
function returns an empty list so callers can fall back to the
|
|
62
|
+
hard-coded migration functions.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
language : str
|
|
67
|
+
One of 'python', 'java', 'dotnet', 'csharp'.
|
|
68
|
+
from_version : str | None
|
|
69
|
+
Source version filter (e.g. '2.x', '8', 'framework-4.x').
|
|
70
|
+
to_version : str | None
|
|
71
|
+
Target version filter (e.g. '3.x', '17', 'net-8').
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
list[dict]
|
|
76
|
+
Matching rule objects from the JSON.
|
|
77
|
+
"""
|
|
78
|
+
canonical = _LANG_ALIAS.get(language.lower(), language.lower())
|
|
79
|
+
|
|
80
|
+
if not RULES_PATH.exists():
|
|
81
|
+
return []
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
with open(RULES_PATH, "r", encoding="utf-8") as fh:
|
|
85
|
+
data = json.load(fh)
|
|
86
|
+
except (json.JSONDecodeError, OSError) as exc:
|
|
87
|
+
print(f"[WARN] Could not load rules: {exc}", file=sys.stderr)
|
|
88
|
+
return []
|
|
89
|
+
|
|
90
|
+
matched_rules = []
|
|
91
|
+
for entry in data.get("language_versions", []):
|
|
92
|
+
if entry.get("language", "").lower() != canonical:
|
|
93
|
+
continue
|
|
94
|
+
# If caller supplied version filters, honour them
|
|
95
|
+
if from_version and entry.get("source_version") != from_version:
|
|
96
|
+
continue
|
|
97
|
+
if to_version and entry.get("target_version") != to_version:
|
|
98
|
+
continue
|
|
99
|
+
matched_rules.extend(entry.get("rules", []))
|
|
100
|
+
|
|
101
|
+
return matched_rules
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# ====================================================================
|
|
105
|
+
# 5. _apply_transform_rules (numbered out of order for dependency)
|
|
106
|
+
# ====================================================================
|
|
107
|
+
def _apply_transform_rules(content, rules):
|
|
108
|
+
"""Apply an ordered list of regex substitution rules to *content*.
|
|
109
|
+
|
|
110
|
+
Each rule dict must contain at least ``pattern`` and ``replacement``.
|
|
111
|
+
An optional ``flags`` key may hold a string of Python regex flag
|
|
112
|
+
letters (e.g. ``"im"`` for IGNORECASE | MULTILINE).
|
|
113
|
+
|
|
114
|
+
Returns
|
|
115
|
+
-------
|
|
116
|
+
tuple[str, list[dict]]
|
|
117
|
+
(transformed_content, list_of_applied_rule_records)
|
|
118
|
+
"""
|
|
119
|
+
applied = []
|
|
120
|
+
|
|
121
|
+
for rule in rules:
|
|
122
|
+
pattern = rule.get("pattern")
|
|
123
|
+
replacement = rule.get("replacement", "")
|
|
124
|
+
if not pattern:
|
|
125
|
+
continue
|
|
126
|
+
|
|
127
|
+
# Build regex flags
|
|
128
|
+
flags = 0
|
|
129
|
+
flag_str = rule.get("flags", "")
|
|
130
|
+
if "i" in flag_str:
|
|
131
|
+
flags |= re.IGNORECASE
|
|
132
|
+
if "m" in flag_str:
|
|
133
|
+
flags |= re.MULTILINE
|
|
134
|
+
if "s" in flag_str:
|
|
135
|
+
flags |= re.DOTALL
|
|
136
|
+
|
|
137
|
+
# Convert $1, $2, … placeholders to Python \1, \2, …
|
|
138
|
+
py_replacement = re.sub(r"\$(\d+)", r"\\\1", replacement)
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
compiled = re.compile(pattern, flags)
|
|
142
|
+
except re.error as exc:
|
|
143
|
+
applied.append({
|
|
144
|
+
"rule_id": rule.get("id", "unknown"),
|
|
145
|
+
"error": f"Bad regex: {exc}",
|
|
146
|
+
})
|
|
147
|
+
continue
|
|
148
|
+
|
|
149
|
+
new_content, count = compiled.subn(py_replacement, content)
|
|
150
|
+
if count > 0:
|
|
151
|
+
applied.append({
|
|
152
|
+
"rule_id": rule.get("id", "unknown"),
|
|
153
|
+
"description": rule.get("description", ""),
|
|
154
|
+
"matches": count,
|
|
155
|
+
"requires_manual_review": rule.get("requires_manual_review", False),
|
|
156
|
+
})
|
|
157
|
+
content = new_content
|
|
158
|
+
|
|
159
|
+
return content, applied
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# ====================================================================
|
|
163
|
+
# 6. _validate_transforms
|
|
164
|
+
# ====================================================================
|
|
165
|
+
def _validate_transforms(original_path, transformed_path, language):
|
|
166
|
+
"""Run basic syntax validation on a transformed file.
|
|
167
|
+
|
|
168
|
+
* Python -- ``ast.parse()``
|
|
169
|
+
* Java -- brace balance and semicolons present
|
|
170
|
+
* C#/.NET -- brace balance and semicolons present
|
|
171
|
+
|
|
172
|
+
Returns
|
|
173
|
+
-------
|
|
174
|
+
dict
|
|
175
|
+
``{valid: bool, errors: [str]}``
|
|
176
|
+
"""
|
|
177
|
+
errors = []
|
|
178
|
+
canonical = _LANG_ALIAS.get(language.lower(), language.lower())
|
|
179
|
+
transformed_path = Path(transformed_path)
|
|
180
|
+
|
|
181
|
+
if not transformed_path.exists():
|
|
182
|
+
return {"valid": False, "errors": [f"File not found: {transformed_path}"]}
|
|
183
|
+
|
|
184
|
+
try:
|
|
185
|
+
with open(transformed_path, "r", encoding="utf-8") as fh:
|
|
186
|
+
content = fh.read()
|
|
187
|
+
except (OSError, UnicodeDecodeError) as exc:
|
|
188
|
+
return {"valid": False, "errors": [str(exc)]}
|
|
189
|
+
|
|
190
|
+
if canonical == "python":
|
|
191
|
+
try:
|
|
192
|
+
ast.parse(content, filename=str(transformed_path))
|
|
193
|
+
except SyntaxError as exc:
|
|
194
|
+
errors.append(
|
|
195
|
+
f"SyntaxError at line {exc.lineno}: {exc.msg}"
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
elif canonical in ("java", "dotnet"):
|
|
199
|
+
# Brace balance check
|
|
200
|
+
open_count = content.count("{")
|
|
201
|
+
close_count = content.count("}")
|
|
202
|
+
if open_count != close_count:
|
|
203
|
+
errors.append(
|
|
204
|
+
f"Brace mismatch: {open_count} opening vs "
|
|
205
|
+
f"{close_count} closing braces"
|
|
206
|
+
)
|
|
207
|
+
# Semicolon sanity — at least one semicolon expected in real code
|
|
208
|
+
if len(content.strip()) > 0 and ";" not in content:
|
|
209
|
+
errors.append("No semicolons found — possible incomplete migration")
|
|
210
|
+
|
|
211
|
+
return {"valid": len(errors) == 0, "errors": errors}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# ====================================================================
|
|
215
|
+
# Helper — copy tree
|
|
216
|
+
# ====================================================================
|
|
217
|
+
def _copy_source_tree(source_path, output_path):
|
|
218
|
+
"""Copy the full directory tree from *source_path* to *output_path*.
|
|
219
|
+
|
|
220
|
+
Creates *output_path* if it does not exist. Existing files inside
|
|
221
|
+
*output_path* will be overwritten.
|
|
222
|
+
"""
|
|
223
|
+
source_path = Path(source_path)
|
|
224
|
+
output_path = Path(output_path)
|
|
225
|
+
|
|
226
|
+
if output_path.exists():
|
|
227
|
+
shutil.rmtree(output_path)
|
|
228
|
+
|
|
229
|
+
shutil.copytree(str(source_path), str(output_path))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# ====================================================================
|
|
233
|
+
# Helper — collect files by extension
|
|
234
|
+
# ====================================================================
|
|
235
|
+
def _collect_files(directory, extensions):
|
|
236
|
+
"""Yield all files under *directory* whose suffix is in *extensions*."""
|
|
237
|
+
directory = Path(directory)
|
|
238
|
+
for root, _dirs, files in os.walk(directory):
|
|
239
|
+
for fname in files:
|
|
240
|
+
fpath = Path(root) / fname
|
|
241
|
+
if fpath.suffix.lower() in extensions:
|
|
242
|
+
yield fpath
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# ====================================================================
|
|
246
|
+
# 2. migrate_python2_to_3
|
|
247
|
+
# ====================================================================
|
|
248
|
+
def migrate_python2_to_3(source_path, output_path):
|
|
249
|
+
"""Migrate Python 2 source code to Python 3.
|
|
250
|
+
|
|
251
|
+
Uses a hybrid approach: regex transformations for syntactic patterns
|
|
252
|
+
plus special-case logic (e.g. injecting ``from functools import
|
|
253
|
+
reduce``).
|
|
254
|
+
|
|
255
|
+
The function first copies the entire *source_path* tree into
|
|
256
|
+
*output_path* then modifies the copies in-place. The original
|
|
257
|
+
source is NEVER touched.
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
dict
|
|
262
|
+
``{files_processed: int,
|
|
263
|
+
transformations_applied: [{file, line, rule, before, after}],
|
|
264
|
+
errors: [str]}``
|
|
265
|
+
"""
|
|
266
|
+
source_path = Path(source_path)
|
|
267
|
+
output_path = Path(output_path)
|
|
268
|
+
_copy_source_tree(source_path, output_path)
|
|
269
|
+
|
|
270
|
+
all_transforms = []
|
|
271
|
+
all_errors = []
|
|
272
|
+
files_processed = 0
|
|
273
|
+
|
|
274
|
+
# Ordered list of (rule_name, compiled_regex, replacement_func_or_str)
|
|
275
|
+
# Each entry is a tuple: (rule_id, pattern, replacement)
|
|
276
|
+
_PY_RULES = [
|
|
277
|
+
# (a) print >>sys.stderr, "text" must come BEFORE generic print
|
|
278
|
+
(
|
|
279
|
+
"py2to3-print-redirect",
|
|
280
|
+
re.compile(r'^(\s*)print\s*>>\s*(\S+)\s*,\s*(.+)$', re.MULTILINE),
|
|
281
|
+
r'\1print(\3, file=\2)',
|
|
282
|
+
),
|
|
283
|
+
# (a) print statement -> print function
|
|
284
|
+
(
|
|
285
|
+
"py2to3-print-stmt",
|
|
286
|
+
re.compile(r'^(\s*)print\s+(?![\(])(.+)$', re.MULTILINE),
|
|
287
|
+
r'\1print(\2)',
|
|
288
|
+
),
|
|
289
|
+
# (c) except Exception, e -> except Exception as e
|
|
290
|
+
(
|
|
291
|
+
"py2to3-except-comma",
|
|
292
|
+
re.compile(r'\bexcept\s+(\w+(?:\.\w+)*)\s*,\s*(\w+)\s*:'),
|
|
293
|
+
r'except \1 as \2:',
|
|
294
|
+
),
|
|
295
|
+
# (m) raise Exception, "msg" -> raise Exception("msg")
|
|
296
|
+
(
|
|
297
|
+
"py2to3-raise-comma",
|
|
298
|
+
re.compile(r'\braise\s+(\w+(?:\.\w+)*)\s*,\s*(.+)'),
|
|
299
|
+
r'raise \1(\2)',
|
|
300
|
+
),
|
|
301
|
+
# (n) exec-statement "code" -> exec-function("code")
|
|
302
|
+
(
|
|
303
|
+
"py2to3-exec-stmt",
|
|
304
|
+
re.compile(r'^(\s*)exec\s+(?![\(])(.+)$', re.MULTILINE),
|
|
305
|
+
r'\1exec(\2)',
|
|
306
|
+
),
|
|
307
|
+
# (d) unicode(x) -> str(x)
|
|
308
|
+
(
|
|
309
|
+
"py2to3-unicode-call",
|
|
310
|
+
re.compile(r'\bunicode\('),
|
|
311
|
+
'str(',
|
|
312
|
+
),
|
|
313
|
+
# (d) u"string" -> "string" (careful with ur"" raw strings)
|
|
314
|
+
(
|
|
315
|
+
"py2to3-unicode-prefix",
|
|
316
|
+
re.compile(r'\bu(["\'])'),
|
|
317
|
+
r'\1',
|
|
318
|
+
),
|
|
319
|
+
# (e) raw_input -> input
|
|
320
|
+
(
|
|
321
|
+
"py2to3-raw-input",
|
|
322
|
+
re.compile(r'\braw_input\('),
|
|
323
|
+
'input(',
|
|
324
|
+
),
|
|
325
|
+
# (f) xrange -> range
|
|
326
|
+
(
|
|
327
|
+
"py2to3-xrange",
|
|
328
|
+
re.compile(r'\bxrange\('),
|
|
329
|
+
'range(',
|
|
330
|
+
),
|
|
331
|
+
# (g) dict.has_key(k) -> k in dict
|
|
332
|
+
(
|
|
333
|
+
"py2to3-has-key",
|
|
334
|
+
re.compile(r'(\w+)\.has_key\(([^)]+)\)'),
|
|
335
|
+
r'\2 in \1',
|
|
336
|
+
),
|
|
337
|
+
# (h) .iteritems() -> .items()
|
|
338
|
+
(
|
|
339
|
+
"py2to3-iteritems",
|
|
340
|
+
re.compile(r'\.iteritems\(\)'),
|
|
341
|
+
'.items()',
|
|
342
|
+
),
|
|
343
|
+
# (h) .itervalues() -> .values()
|
|
344
|
+
(
|
|
345
|
+
"py2to3-itervalues",
|
|
346
|
+
re.compile(r'\.itervalues\(\)'),
|
|
347
|
+
'.values()',
|
|
348
|
+
),
|
|
349
|
+
# (h) .iterkeys() -> .keys()
|
|
350
|
+
(
|
|
351
|
+
"py2to3-iterkeys",
|
|
352
|
+
re.compile(r'\.iterkeys\(\)'),
|
|
353
|
+
'.keys()',
|
|
354
|
+
),
|
|
355
|
+
# (i) import ConfigParser -> import configparser
|
|
356
|
+
(
|
|
357
|
+
"py2to3-configparser-import",
|
|
358
|
+
re.compile(r'\bimport\s+ConfigParser\b'),
|
|
359
|
+
'import configparser',
|
|
360
|
+
),
|
|
361
|
+
# (i) from ConfigParser -> from configparser
|
|
362
|
+
(
|
|
363
|
+
"py2to3-configparser-from",
|
|
364
|
+
re.compile(r'\bfrom\s+ConfigParser\b'),
|
|
365
|
+
'from configparser',
|
|
366
|
+
),
|
|
367
|
+
# (i) ConfigParser. -> configparser. (usage)
|
|
368
|
+
(
|
|
369
|
+
"py2to3-configparser-usage",
|
|
370
|
+
re.compile(r'\bConfigParser\.'),
|
|
371
|
+
'configparser.',
|
|
372
|
+
),
|
|
373
|
+
# (j) import urllib2 -> import urllib.request
|
|
374
|
+
(
|
|
375
|
+
"py2to3-urllib2-import",
|
|
376
|
+
re.compile(r'\bimport\s+urllib2\b'),
|
|
377
|
+
'import urllib.request',
|
|
378
|
+
),
|
|
379
|
+
# (j) urllib2.urlopen -> urllib.request.urlopen
|
|
380
|
+
(
|
|
381
|
+
"py2to3-urllib2-usage",
|
|
382
|
+
re.compile(r'\burllib2\.urlopen\b'),
|
|
383
|
+
'urllib.request.urlopen',
|
|
384
|
+
),
|
|
385
|
+
# (j) urllib2. (other usages)
|
|
386
|
+
(
|
|
387
|
+
"py2to3-urllib2-other",
|
|
388
|
+
re.compile(r'\burllib2\.'),
|
|
389
|
+
'urllib.request.',
|
|
390
|
+
),
|
|
391
|
+
# (k) import urlparse -> from urllib.parse import urlparse
|
|
392
|
+
(
|
|
393
|
+
"py2to3-urlparse-import",
|
|
394
|
+
re.compile(r'^(\s*)import\s+urlparse\s*$', re.MULTILINE),
|
|
395
|
+
r'\1from urllib.parse import urlparse',
|
|
396
|
+
),
|
|
397
|
+
# (k) from urlparse import ... keep intact but fix module
|
|
398
|
+
(
|
|
399
|
+
"py2to3-urlparse-from",
|
|
400
|
+
re.compile(r'\bfrom\s+urlparse\s+import\b'),
|
|
401
|
+
'from urllib.parse import',
|
|
402
|
+
),
|
|
403
|
+
# (l) from StringIO import StringIO -> from io import StringIO
|
|
404
|
+
(
|
|
405
|
+
"py2to3-stringio",
|
|
406
|
+
re.compile(r'\bfrom\s+StringIO\s+import\s+StringIO\b'),
|
|
407
|
+
'from io import StringIO',
|
|
408
|
+
),
|
|
409
|
+
# (o) long(x) -> int(x)
|
|
410
|
+
(
|
|
411
|
+
"py2to3-long",
|
|
412
|
+
re.compile(r'\blong\('),
|
|
413
|
+
'int(',
|
|
414
|
+
),
|
|
415
|
+
# (p) basestring -> str
|
|
416
|
+
(
|
|
417
|
+
"py2to3-basestring",
|
|
418
|
+
re.compile(r'\bbasestring\b'),
|
|
419
|
+
'str',
|
|
420
|
+
),
|
|
421
|
+
# (q) reduce( -> functools.reduce( (we add import later)
|
|
422
|
+
(
|
|
423
|
+
"py2to3-reduce",
|
|
424
|
+
re.compile(r'(?<!\.)(?<!\w)reduce\('),
|
|
425
|
+
'functools.reduce(',
|
|
426
|
+
),
|
|
427
|
+
]
|
|
428
|
+
|
|
429
|
+
for py_file in _collect_files(output_path, {".py"}):
|
|
430
|
+
files_processed += 1
|
|
431
|
+
try:
|
|
432
|
+
with open(py_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
433
|
+
original_content = fh.read()
|
|
434
|
+
except OSError as exc:
|
|
435
|
+
all_errors.append(f"Read error {py_file}: {exc}")
|
|
436
|
+
continue
|
|
437
|
+
|
|
438
|
+
content = original_content
|
|
439
|
+
original_lines = original_content.splitlines(keepends=True)
|
|
440
|
+
file_transforms = []
|
|
441
|
+
|
|
442
|
+
# Apply each rule
|
|
443
|
+
for rule_id, pattern, replacement in _PY_RULES:
|
|
444
|
+
new_content = pattern.sub(replacement, content)
|
|
445
|
+
if new_content != content:
|
|
446
|
+
# Determine which lines changed
|
|
447
|
+
new_lines = new_content.splitlines(keepends=True)
|
|
448
|
+
for idx, (old_ln, new_ln) in enumerate(
|
|
449
|
+
zip(original_lines, new_lines)
|
|
450
|
+
):
|
|
451
|
+
if old_ln != new_ln:
|
|
452
|
+
file_transforms.append({
|
|
453
|
+
"file": str(py_file),
|
|
454
|
+
"line": idx + 1,
|
|
455
|
+
"rule": rule_id,
|
|
456
|
+
"before": old_ln.rstrip("\n\r"),
|
|
457
|
+
"after": new_ln.rstrip("\n\r"),
|
|
458
|
+
})
|
|
459
|
+
# Lines may have been added/removed; capture extras
|
|
460
|
+
if len(new_lines) > len(original_lines):
|
|
461
|
+
for idx in range(len(original_lines), len(new_lines)):
|
|
462
|
+
file_transforms.append({
|
|
463
|
+
"file": str(py_file),
|
|
464
|
+
"line": idx + 1,
|
|
465
|
+
"rule": rule_id,
|
|
466
|
+
"before": "",
|
|
467
|
+
"after": new_lines[idx].rstrip("\n\r"),
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
content = new_content
|
|
471
|
+
original_lines = new_content.splitlines(keepends=True)
|
|
472
|
+
|
|
473
|
+
# (q) inject 'from functools import reduce' if reduce was transformed
|
|
474
|
+
if "functools.reduce(" in content:
|
|
475
|
+
has_functools_import = bool(
|
|
476
|
+
re.search(
|
|
477
|
+
r'^\s*(import\s+functools|from\s+functools\s+import)',
|
|
478
|
+
content,
|
|
479
|
+
re.MULTILINE,
|
|
480
|
+
)
|
|
481
|
+
)
|
|
482
|
+
if not has_functools_import:
|
|
483
|
+
# Insert after the last top-level import or at the very top
|
|
484
|
+
import_line = "from functools import reduce\n"
|
|
485
|
+
insert_pos = _find_import_insert_position(content)
|
|
486
|
+
content = content[:insert_pos] + import_line + content[insert_pos:]
|
|
487
|
+
# Also replace functools.reduce back to reduce since we imported it
|
|
488
|
+
content = content.replace("functools.reduce(", "reduce(")
|
|
489
|
+
file_transforms.append({
|
|
490
|
+
"file": str(py_file),
|
|
491
|
+
"line": 0,
|
|
492
|
+
"rule": "py2to3-reduce-import-inject",
|
|
493
|
+
"before": "",
|
|
494
|
+
"after": import_line.rstrip(),
|
|
495
|
+
})
|
|
496
|
+
|
|
497
|
+
# Write back only if changed
|
|
498
|
+
if content != original_content:
|
|
499
|
+
try:
|
|
500
|
+
with open(py_file, "w", encoding="utf-8") as fh:
|
|
501
|
+
fh.write(content)
|
|
502
|
+
except OSError as exc:
|
|
503
|
+
all_errors.append(f"Write error {py_file}: {exc}")
|
|
504
|
+
continue
|
|
505
|
+
|
|
506
|
+
all_transforms.extend(file_transforms)
|
|
507
|
+
|
|
508
|
+
return {
|
|
509
|
+
"files_processed": files_processed,
|
|
510
|
+
"transformations_applied": all_transforms,
|
|
511
|
+
"errors": all_errors,
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
def _find_import_insert_position(content):
|
|
516
|
+
"""Find the byte offset just after the last top-level import line.
|
|
517
|
+
|
|
518
|
+
If there are no imports, returns 0 (beginning of file), respecting
|
|
519
|
+
shebangs and encoding cookies.
|
|
520
|
+
"""
|
|
521
|
+
lines = content.splitlines(keepends=True)
|
|
522
|
+
last_import_end = 0
|
|
523
|
+
offset = 0
|
|
524
|
+
for i, line in enumerate(lines):
|
|
525
|
+
stripped = line.strip()
|
|
526
|
+
# Skip shebangs / encoding / docstrings / comments at top
|
|
527
|
+
if stripped.startswith(("import ", "from ")) and not stripped.startswith(
|
|
528
|
+
"from __future__"
|
|
529
|
+
):
|
|
530
|
+
last_import_end = offset + len(line)
|
|
531
|
+
elif stripped.startswith("from __future__"):
|
|
532
|
+
last_import_end = offset + len(line)
|
|
533
|
+
offset += len(line)
|
|
534
|
+
|
|
535
|
+
if last_import_end == 0:
|
|
536
|
+
# No imports found — insert after shebang/encoding if present
|
|
537
|
+
offset = 0
|
|
538
|
+
for line in lines[:2]:
|
|
539
|
+
stripped = line.strip()
|
|
540
|
+
if stripped.startswith("#!") or stripped.startswith("# -*-"):
|
|
541
|
+
offset += len(line)
|
|
542
|
+
else:
|
|
543
|
+
break
|
|
544
|
+
return offset
|
|
545
|
+
|
|
546
|
+
return last_import_end
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
# ====================================================================
|
|
550
|
+
# 3. migrate_java_version
|
|
551
|
+
# ====================================================================
|
|
552
|
+
def migrate_java_version(source_path, output_path, from_ver="8", to_ver="17"):
|
|
553
|
+
"""Migrate Java source code from one version to another.
|
|
554
|
+
|
|
555
|
+
Applies regex-based transformations for Java 8 -> 11 -> 17 patterns
|
|
556
|
+
including Jakarta namespace migration, var inference suggestions, and
|
|
557
|
+
text block / lambda suggestions (as TODO comments).
|
|
558
|
+
|
|
559
|
+
Parameters
|
|
560
|
+
----------
|
|
561
|
+
source_path : str | Path
|
|
562
|
+
output_path : str | Path
|
|
563
|
+
from_ver : str
|
|
564
|
+
Source Java version (default ``'8'``).
|
|
565
|
+
to_ver : str
|
|
566
|
+
Target Java version (default ``'17'``).
|
|
567
|
+
|
|
568
|
+
Returns
|
|
569
|
+
-------
|
|
570
|
+
dict
|
|
571
|
+
Same structure as :func:`migrate_python2_to_3`.
|
|
572
|
+
"""
|
|
573
|
+
source_path = Path(source_path)
|
|
574
|
+
output_path = Path(output_path)
|
|
575
|
+
_copy_source_tree(source_path, output_path)
|
|
576
|
+
|
|
577
|
+
all_transforms = []
|
|
578
|
+
all_errors = []
|
|
579
|
+
files_processed = 0
|
|
580
|
+
|
|
581
|
+
# --- rule definitions ------------------------------------------------
|
|
582
|
+
_JAVAX_PACKAGES = [
|
|
583
|
+
"servlet",
|
|
584
|
+
"persistence",
|
|
585
|
+
"inject",
|
|
586
|
+
"ws.rs",
|
|
587
|
+
"annotation",
|
|
588
|
+
"validation",
|
|
589
|
+
"transaction",
|
|
590
|
+
"enterprise",
|
|
591
|
+
"faces",
|
|
592
|
+
"json",
|
|
593
|
+
"mail",
|
|
594
|
+
"security.auth",
|
|
595
|
+
"websocket",
|
|
596
|
+
"xml.bind",
|
|
597
|
+
]
|
|
598
|
+
javax_pattern = re.compile(
|
|
599
|
+
r'\bjavax\.(' + '|'.join(re.escape(p) for p in _JAVAX_PACKAGES) + r')\b'
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
# var suggestion: Type name = new Type(...) -> var name = new Type(...)
|
|
603
|
+
var_pattern = re.compile(
|
|
604
|
+
r'^(\s*)'
|
|
605
|
+
r'((?:(?:final|static)\s+)*)' # modifiers
|
|
606
|
+
r'(\w+(?:<[^>]+>)?)\s+' # Type<Generic>
|
|
607
|
+
r'(\w+)\s*=\s*new\s+(\w+(?:<[^>]*>)?)\s*\(', # name = new Type(
|
|
608
|
+
re.MULTILINE,
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
# Multiline string concatenation hint
|
|
612
|
+
multiline_concat_pattern = re.compile(
|
|
613
|
+
r'"[^"]*"\s*\+\s*\n\s*"[^"]*"'
|
|
614
|
+
)
|
|
615
|
+
|
|
616
|
+
# Anonymous inner class with single method -> lambda hint
|
|
617
|
+
anon_class_pattern = re.compile(
|
|
618
|
+
r'new\s+(\w+)\s*\(\s*\)\s*\{\s*\n'
|
|
619
|
+
r'\s*@?\s*Override\s*\n'
|
|
620
|
+
r'\s*public\s+\w+\s+\w+\s*\([^)]*\)\s*\{',
|
|
621
|
+
re.MULTILINE,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
# Diamond operator: new Type<X,Y>() where LHS already has generics
|
|
625
|
+
re.compile(
|
|
626
|
+
r'new\s+(\w+)<([^>]+)>\s*\(\)',
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
# .collect(Collectors.toList()) -> .toList() (Java 16+)
|
|
630
|
+
collectors_tolist_pattern = re.compile(
|
|
631
|
+
r'\.collect\(Collectors\.toList\(\)\)'
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
# .collect(Collectors.toUnmodifiableList()) -> .toList()
|
|
635
|
+
collectors_unmod_pattern = re.compile(
|
|
636
|
+
r'\.collect\(Collectors\.toUnmodifiableList\(\)\)'
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
for java_file in _collect_files(output_path, {".java"}):
|
|
640
|
+
files_processed += 1
|
|
641
|
+
try:
|
|
642
|
+
with open(java_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
643
|
+
original_content = fh.read()
|
|
644
|
+
except OSError as exc:
|
|
645
|
+
all_errors.append(f"Read error {java_file}: {exc}")
|
|
646
|
+
continue
|
|
647
|
+
|
|
648
|
+
content = original_content
|
|
649
|
+
file_transforms = []
|
|
650
|
+
|
|
651
|
+
# (a) javax -> jakarta
|
|
652
|
+
new_content = javax_pattern.sub(r'jakarta.\1', content)
|
|
653
|
+
if new_content != content:
|
|
654
|
+
_record_line_diffs(
|
|
655
|
+
content, new_content, java_file, "java-javax-to-jakarta",
|
|
656
|
+
file_transforms,
|
|
657
|
+
)
|
|
658
|
+
content = new_content
|
|
659
|
+
|
|
660
|
+
# (b) var suggestions — only when LHS type matches RHS constructor type
|
|
661
|
+
def _var_replace(m):
|
|
662
|
+
indent = m.group(1)
|
|
663
|
+
modifiers = m.group(2).strip()
|
|
664
|
+
lhs_type = m.group(3)
|
|
665
|
+
var_name = m.group(4)
|
|
666
|
+
rhs_type = m.group(5)
|
|
667
|
+
# Only suggest var when base types match and no 'final' or 'static'
|
|
668
|
+
base_lhs = lhs_type.split("<")[0]
|
|
669
|
+
base_rhs = rhs_type.split("<")[0]
|
|
670
|
+
if base_lhs == base_rhs and not modifiers:
|
|
671
|
+
return f"{indent}var {var_name} = new {rhs_type}("
|
|
672
|
+
return m.group(0)
|
|
673
|
+
|
|
674
|
+
new_content = var_pattern.sub(_var_replace, content)
|
|
675
|
+
if new_content != content:
|
|
676
|
+
_record_line_diffs(
|
|
677
|
+
content, new_content, java_file, "java-var-inference",
|
|
678
|
+
file_transforms,
|
|
679
|
+
)
|
|
680
|
+
content = new_content
|
|
681
|
+
|
|
682
|
+
# (c) Multiline string concat -> text block TODO comment
|
|
683
|
+
for m in multiline_concat_pattern.finditer(content):
|
|
684
|
+
line_no = content[:m.start()].count("\n") + 1
|
|
685
|
+
file_transforms.append({
|
|
686
|
+
"file": str(java_file),
|
|
687
|
+
"line": line_no,
|
|
688
|
+
"rule": "java-text-block-suggestion",
|
|
689
|
+
"before": m.group(0).strip()[:80],
|
|
690
|
+
"after": "// TODO: Consider converting to text block (Java 13+)",
|
|
691
|
+
})
|
|
692
|
+
# Insert TODO comments above each multiline concat
|
|
693
|
+
offset_adjust = 0
|
|
694
|
+
for m in multiline_concat_pattern.finditer(original_content):
|
|
695
|
+
pos = content.find(m.group(0), m.start() + offset_adjust)
|
|
696
|
+
if pos >= 0:
|
|
697
|
+
# Find beginning of this line
|
|
698
|
+
line_start = content.rfind("\n", 0, pos)
|
|
699
|
+
line_start = line_start + 1 if line_start >= 0 else 0
|
|
700
|
+
indent = ""
|
|
701
|
+
for ch in content[line_start:]:
|
|
702
|
+
if ch in (" ", "\t"):
|
|
703
|
+
indent += ch
|
|
704
|
+
else:
|
|
705
|
+
break
|
|
706
|
+
comment = f"{indent}// TODO: Consider converting to text block (Java 13+)\n"
|
|
707
|
+
content = content[:line_start] + comment + content[line_start:]
|
|
708
|
+
offset_adjust += len(comment)
|
|
709
|
+
|
|
710
|
+
# (d) Anonymous inner class -> lambda suggestion (comment only)
|
|
711
|
+
for m in anon_class_pattern.finditer(content):
|
|
712
|
+
line_no = content[:m.start()].count("\n") + 1
|
|
713
|
+
file_transforms.append({
|
|
714
|
+
"file": str(java_file),
|
|
715
|
+
"line": line_no,
|
|
716
|
+
"rule": "java-lambda-suggestion",
|
|
717
|
+
"before": m.group(0).strip()[:80],
|
|
718
|
+
"after": "// TODO: Consider replacing anonymous class with lambda",
|
|
719
|
+
})
|
|
720
|
+
|
|
721
|
+
# (e) Collectors.toList() -> .toList()
|
|
722
|
+
new_content = collectors_tolist_pattern.sub('.toList()', content)
|
|
723
|
+
if new_content != content:
|
|
724
|
+
_record_line_diffs(
|
|
725
|
+
content, new_content, java_file, "java-collectors-tolist",
|
|
726
|
+
file_transforms,
|
|
727
|
+
)
|
|
728
|
+
content = new_content
|
|
729
|
+
|
|
730
|
+
new_content = collectors_unmod_pattern.sub('.toList()', content)
|
|
731
|
+
if new_content != content:
|
|
732
|
+
_record_line_diffs(
|
|
733
|
+
content, new_content, java_file, "java-collectors-unmod-tolist",
|
|
734
|
+
file_transforms,
|
|
735
|
+
)
|
|
736
|
+
content = new_content
|
|
737
|
+
|
|
738
|
+
# Write if changed
|
|
739
|
+
if content != original_content:
|
|
740
|
+
try:
|
|
741
|
+
with open(java_file, "w", encoding="utf-8") as fh:
|
|
742
|
+
fh.write(content)
|
|
743
|
+
except OSError as exc:
|
|
744
|
+
all_errors.append(f"Write error {java_file}: {exc}")
|
|
745
|
+
continue
|
|
746
|
+
|
|
747
|
+
all_transforms.extend(file_transforms)
|
|
748
|
+
|
|
749
|
+
return {
|
|
750
|
+
"files_processed": files_processed,
|
|
751
|
+
"transformations_applied": all_transforms,
|
|
752
|
+
"errors": all_errors,
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
# ====================================================================
|
|
757
|
+
# 4. migrate_dotnet_framework
|
|
758
|
+
# ====================================================================
|
|
759
|
+
def migrate_dotnet_framework(source_path, output_path):
|
|
760
|
+
"""Migrate .NET Framework 4.x source to .NET 8.
|
|
761
|
+
|
|
762
|
+
Applies regex transformations on ``.cs`` files for namespace and API
|
|
763
|
+
changes, and generates skeleton ``appsettings.json`` / ``Program.cs``
|
|
764
|
+
files where ``web.config`` / ``Global.asax`` are detected.
|
|
765
|
+
|
|
766
|
+
Parameters
|
|
767
|
+
----------
|
|
768
|
+
source_path : str | Path
|
|
769
|
+
output_path : str | Path
|
|
770
|
+
|
|
771
|
+
Returns
|
|
772
|
+
-------
|
|
773
|
+
dict
|
|
774
|
+
Same structure as :func:`migrate_python2_to_3`.
|
|
775
|
+
"""
|
|
776
|
+
source_path = Path(source_path)
|
|
777
|
+
output_path = Path(output_path)
|
|
778
|
+
_copy_source_tree(source_path, output_path)
|
|
779
|
+
|
|
780
|
+
all_transforms = []
|
|
781
|
+
all_errors = []
|
|
782
|
+
files_processed = 0
|
|
783
|
+
|
|
784
|
+
# -- C# regex rules ---------------------------------------------------
|
|
785
|
+
_CS_RULES = [
|
|
786
|
+
# (a) System.Web -> Microsoft.AspNetCore.Http (general)
|
|
787
|
+
(
|
|
788
|
+
"dotnet-system-web",
|
|
789
|
+
re.compile(r'\busing\s+System\.Web\b(?!\.)', re.MULTILINE),
|
|
790
|
+
'using Microsoft.AspNetCore.Http',
|
|
791
|
+
),
|
|
792
|
+
# (b) System.Web.Mvc -> Microsoft.AspNetCore.Mvc
|
|
793
|
+
(
|
|
794
|
+
"dotnet-web-mvc",
|
|
795
|
+
re.compile(r'\busing\s+System\.Web\.Mvc\b'),
|
|
796
|
+
'using Microsoft.AspNetCore.Mvc',
|
|
797
|
+
),
|
|
798
|
+
# (c) System.Web.Http -> Microsoft.AspNetCore.Mvc
|
|
799
|
+
(
|
|
800
|
+
"dotnet-web-http",
|
|
801
|
+
re.compile(r'\busing\s+System\.Web\.Http\b'),
|
|
802
|
+
'using Microsoft.AspNetCore.Mvc',
|
|
803
|
+
),
|
|
804
|
+
# System.Web.Security -> Microsoft.AspNetCore.Authentication
|
|
805
|
+
(
|
|
806
|
+
"dotnet-web-security",
|
|
807
|
+
re.compile(r'\busing\s+System\.Web\.Security\b'),
|
|
808
|
+
'using Microsoft.AspNetCore.Authentication',
|
|
809
|
+
),
|
|
810
|
+
# (d) HttpContext.Current -> // TODO: Inject IHttpContextAccessor
|
|
811
|
+
(
|
|
812
|
+
"dotnet-httpcontext-current",
|
|
813
|
+
re.compile(r'\bHttpContext\.Current\b'),
|
|
814
|
+
'/* TODO: Inject IHttpContextAccessor */ _httpContextAccessor.HttpContext',
|
|
815
|
+
),
|
|
816
|
+
# (e) ConfigurationManager.AppSettings["key"]
|
|
817
|
+
(
|
|
818
|
+
"dotnet-configmanager",
|
|
819
|
+
re.compile(r'ConfigurationManager\.AppSettings\["([^"]+)"\]'),
|
|
820
|
+
r'_configuration["\1"] /* TODO: Use IConfiguration DI */',
|
|
821
|
+
),
|
|
822
|
+
# (f) System.Data.SqlClient -> Microsoft.Data.SqlClient
|
|
823
|
+
(
|
|
824
|
+
"dotnet-sqlclient",
|
|
825
|
+
re.compile(r'\busing\s+System\.Data\.SqlClient\b'),
|
|
826
|
+
'using Microsoft.Data.SqlClient',
|
|
827
|
+
),
|
|
828
|
+
# (g) WebClient -> TODO HttpClient
|
|
829
|
+
(
|
|
830
|
+
"dotnet-webclient",
|
|
831
|
+
re.compile(r'\bnew\s+WebClient\(\)'),
|
|
832
|
+
'/* TODO: Replace WebClient with HttpClient via IHttpClientFactory */ new HttpClient()',
|
|
833
|
+
),
|
|
834
|
+
# Thread.Abort() removal
|
|
835
|
+
(
|
|
836
|
+
"dotnet-thread-abort",
|
|
837
|
+
re.compile(r'\bThread\.Abort\(\)'),
|
|
838
|
+
'/* REMOVED: Thread.Abort() — use CancellationToken instead */',
|
|
839
|
+
),
|
|
840
|
+
# ActionResult -> IActionResult
|
|
841
|
+
(
|
|
842
|
+
"dotnet-iactionresult",
|
|
843
|
+
re.compile(r'(\[Http\w+\]\s*\n\s*public\s+)ActionResult\b'),
|
|
844
|
+
r'\1IActionResult',
|
|
845
|
+
),
|
|
846
|
+
]
|
|
847
|
+
|
|
848
|
+
# Process .cs files
|
|
849
|
+
for cs_file in _collect_files(output_path, {".cs"}):
|
|
850
|
+
files_processed += 1
|
|
851
|
+
try:
|
|
852
|
+
with open(cs_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
853
|
+
original_content = fh.read()
|
|
854
|
+
except OSError as exc:
|
|
855
|
+
all_errors.append(f"Read error {cs_file}: {exc}")
|
|
856
|
+
continue
|
|
857
|
+
|
|
858
|
+
content = original_content
|
|
859
|
+
|
|
860
|
+
for rule_id, pattern, replacement in _CS_RULES:
|
|
861
|
+
new_content = pattern.sub(replacement, content)
|
|
862
|
+
if new_content != content:
|
|
863
|
+
_record_line_diffs(
|
|
864
|
+
content, new_content, cs_file, rule_id,
|
|
865
|
+
all_transforms,
|
|
866
|
+
)
|
|
867
|
+
content = new_content
|
|
868
|
+
|
|
869
|
+
if content != original_content:
|
|
870
|
+
try:
|
|
871
|
+
with open(cs_file, "w", encoding="utf-8") as fh:
|
|
872
|
+
fh.write(content)
|
|
873
|
+
except OSError as exc:
|
|
874
|
+
all_errors.append(f"Write error {cs_file}: {exc}")
|
|
875
|
+
|
|
876
|
+
# -- web.config -> appsettings.json skeleton --------------------------
|
|
877
|
+
for config_file in _collect_files(output_path, {".config"}):
|
|
878
|
+
if config_file.name.lower() == "web.config":
|
|
879
|
+
files_processed += 1
|
|
880
|
+
_generate_appsettings_skeleton(config_file, all_transforms, all_errors)
|
|
881
|
+
|
|
882
|
+
# -- Global.asax -> Program.cs skeleton --------------------------------
|
|
883
|
+
for asax_file in _collect_files(output_path, {".asax"}):
|
|
884
|
+
if asax_file.name.lower() == "global.asax":
|
|
885
|
+
files_processed += 1
|
|
886
|
+
_generate_program_cs_skeleton(asax_file, all_transforms, all_errors)
|
|
887
|
+
|
|
888
|
+
return {
|
|
889
|
+
"files_processed": files_processed,
|
|
890
|
+
"transformations_applied": all_transforms,
|
|
891
|
+
"errors": all_errors,
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
def _generate_appsettings_skeleton(web_config_path, transforms_list, errors_list):
|
|
896
|
+
"""Parse web.config for <appSettings> and produce appsettings.json."""
|
|
897
|
+
web_config_path = Path(web_config_path)
|
|
898
|
+
try:
|
|
899
|
+
with open(web_config_path, "r", encoding="utf-8", errors="replace") as fh:
|
|
900
|
+
content = fh.read()
|
|
901
|
+
except OSError as exc:
|
|
902
|
+
errors_list.append(f"Read error {web_config_path}: {exc}")
|
|
903
|
+
return
|
|
904
|
+
|
|
905
|
+
# Extract key/value pairs from <add key="..." value="..." />
|
|
906
|
+
kv_pattern = re.compile(
|
|
907
|
+
r'<add\s+key="([^"]+)"\s+value="([^"]*)"',
|
|
908
|
+
re.IGNORECASE,
|
|
909
|
+
)
|
|
910
|
+
settings = {}
|
|
911
|
+
for m in kv_pattern.finditer(content):
|
|
912
|
+
settings[m.group(1)] = m.group(2)
|
|
913
|
+
|
|
914
|
+
# Extract connection strings
|
|
915
|
+
conn_pattern = re.compile(
|
|
916
|
+
r'<add\s+name="([^"]+)"\s+connectionString="([^"]*)"',
|
|
917
|
+
re.IGNORECASE,
|
|
918
|
+
)
|
|
919
|
+
conn_strings = {}
|
|
920
|
+
for m in conn_pattern.finditer(content):
|
|
921
|
+
conn_strings[m.group(1)] = m.group(2)
|
|
922
|
+
|
|
923
|
+
appsettings = {
|
|
924
|
+
"Logging": {
|
|
925
|
+
"LogLevel": {"Default": "Information", "Microsoft.AspNetCore": "Warning"}
|
|
926
|
+
},
|
|
927
|
+
"AllowedHosts": "*",
|
|
928
|
+
}
|
|
929
|
+
if settings:
|
|
930
|
+
appsettings["AppSettings"] = settings
|
|
931
|
+
if conn_strings:
|
|
932
|
+
appsettings["ConnectionStrings"] = conn_strings
|
|
933
|
+
|
|
934
|
+
output_json_path = web_config_path.parent / "appsettings.json"
|
|
935
|
+
try:
|
|
936
|
+
with open(output_json_path, "w", encoding="utf-8") as fh:
|
|
937
|
+
json.dump(appsettings, fh, indent=2)
|
|
938
|
+
fh.write("\n")
|
|
939
|
+
transforms_list.append({
|
|
940
|
+
"file": str(output_json_path),
|
|
941
|
+
"line": 0,
|
|
942
|
+
"rule": "dotnet-web-config-to-appsettings",
|
|
943
|
+
"before": f"web.config ({len(settings)} settings, {len(conn_strings)} connection strings)",
|
|
944
|
+
"after": "Generated appsettings.json skeleton",
|
|
945
|
+
})
|
|
946
|
+
except OSError as exc:
|
|
947
|
+
errors_list.append(f"Write error {output_json_path}: {exc}")
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
def _generate_program_cs_skeleton(global_asax_path, transforms_list, errors_list):
|
|
951
|
+
"""Generate a minimal Program.cs skeleton to replace Global.asax."""
|
|
952
|
+
global_asax_path = Path(global_asax_path)
|
|
953
|
+
program_cs_path = global_asax_path.parent / "Program.cs"
|
|
954
|
+
|
|
955
|
+
skeleton = textwrap.dedent("""\
|
|
956
|
+
// CUI // SP-CTI
|
|
957
|
+
// MIGRATION: Generated from Global.asax — review and customize
|
|
958
|
+
// Original: {original}
|
|
959
|
+
|
|
960
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
961
|
+
|
|
962
|
+
// Add services to the container.
|
|
963
|
+
builder.Services.AddControllersWithViews();
|
|
964
|
+
// TODO: Register additional services (DI) that were in Global.asax
|
|
965
|
+
|
|
966
|
+
var app = builder.Build();
|
|
967
|
+
|
|
968
|
+
// Configure the HTTP request pipeline.
|
|
969
|
+
if (!app.Environment.IsDevelopment())
|
|
970
|
+
{{
|
|
971
|
+
app.UseExceptionHandler("/Home/Error");
|
|
972
|
+
app.UseHsts();
|
|
973
|
+
}}
|
|
974
|
+
|
|
975
|
+
app.UseHttpsRedirection();
|
|
976
|
+
app.UseStaticFiles();
|
|
977
|
+
app.UseRouting();
|
|
978
|
+
app.UseAuthorization();
|
|
979
|
+
|
|
980
|
+
// TODO: Migrate route configuration from Global.asax Application_Start
|
|
981
|
+
app.MapControllerRoute(
|
|
982
|
+
name: "default",
|
|
983
|
+
pattern: "{{controller=Home}}/{{action=Index}}/{{id?}}");
|
|
984
|
+
|
|
985
|
+
app.Run();
|
|
986
|
+
""").format(original=global_asax_path.name)
|
|
987
|
+
|
|
988
|
+
try:
|
|
989
|
+
with open(program_cs_path, "w", encoding="utf-8") as fh:
|
|
990
|
+
fh.write(skeleton)
|
|
991
|
+
transforms_list.append({
|
|
992
|
+
"file": str(program_cs_path),
|
|
993
|
+
"line": 0,
|
|
994
|
+
"rule": "dotnet-global-asax-to-program-cs",
|
|
995
|
+
"before": f"Global.asax ({global_asax_path.name})",
|
|
996
|
+
"after": "Generated Program.cs skeleton (minimal pipeline)",
|
|
997
|
+
})
|
|
998
|
+
except OSError as exc:
|
|
999
|
+
errors_list.append(f"Write error {program_cs_path}: {exc}")
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
# ====================================================================
|
|
1003
|
+
# Helper — record line-level diffs
|
|
1004
|
+
# ====================================================================
|
|
1005
|
+
def _record_line_diffs(old_content, new_content, file_path, rule_id, transforms_list):
|
|
1006
|
+
"""Compare two content strings line-by-line and record changes."""
|
|
1007
|
+
old_lines = old_content.splitlines()
|
|
1008
|
+
new_lines = new_content.splitlines()
|
|
1009
|
+
|
|
1010
|
+
# Use difflib SequenceMatcher for accurate line mapping
|
|
1011
|
+
matcher = difflib.SequenceMatcher(None, old_lines, new_lines)
|
|
1012
|
+
for tag, i1, i2, j1, j2 in matcher.get_opcodes():
|
|
1013
|
+
if tag == "equal":
|
|
1014
|
+
continue
|
|
1015
|
+
if tag in ("replace", "delete", "insert"):
|
|
1016
|
+
old_chunk = old_lines[i1:i2]
|
|
1017
|
+
new_chunk = new_lines[j1:j2]
|
|
1018
|
+
max_len = max(len(old_chunk), len(new_chunk))
|
|
1019
|
+
for k in range(max_len):
|
|
1020
|
+
before = old_chunk[k] if k < len(old_chunk) else ""
|
|
1021
|
+
after = new_chunk[k] if k < len(new_chunk) else ""
|
|
1022
|
+
line_no = (i1 + k + 1) if k < len(old_chunk) else (j1 + k + 1)
|
|
1023
|
+
transforms_list.append({
|
|
1024
|
+
"file": str(file_path),
|
|
1025
|
+
"line": line_no,
|
|
1026
|
+
"rule": rule_id,
|
|
1027
|
+
"before": before,
|
|
1028
|
+
"after": after,
|
|
1029
|
+
})
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
# ====================================================================
|
|
1033
|
+
# 7. generate_migration_diff
|
|
1034
|
+
# ====================================================================
|
|
1035
|
+
def generate_migration_diff(original_path, transformed_path):
|
|
1036
|
+
"""Generate a unified diff between two files.
|
|
1037
|
+
|
|
1038
|
+
Parameters
|
|
1039
|
+
----------
|
|
1040
|
+
original_path : str | Path
|
|
1041
|
+
transformed_path : str | Path
|
|
1042
|
+
|
|
1043
|
+
Returns
|
|
1044
|
+
-------
|
|
1045
|
+
str
|
|
1046
|
+
Unified diff output. Empty string if files are identical.
|
|
1047
|
+
"""
|
|
1048
|
+
original_path = Path(original_path)
|
|
1049
|
+
transformed_path = Path(transformed_path)
|
|
1050
|
+
|
|
1051
|
+
try:
|
|
1052
|
+
with open(original_path, "r", encoding="utf-8", errors="replace") as fh:
|
|
1053
|
+
original_lines = fh.readlines()
|
|
1054
|
+
except OSError:
|
|
1055
|
+
original_lines = []
|
|
1056
|
+
|
|
1057
|
+
try:
|
|
1058
|
+
with open(transformed_path, "r", encoding="utf-8", errors="replace") as fh:
|
|
1059
|
+
transformed_lines = fh.readlines()
|
|
1060
|
+
except OSError:
|
|
1061
|
+
transformed_lines = []
|
|
1062
|
+
|
|
1063
|
+
diff = difflib.unified_diff(
|
|
1064
|
+
original_lines,
|
|
1065
|
+
transformed_lines,
|
|
1066
|
+
fromfile=str(original_path),
|
|
1067
|
+
tofile=str(transformed_path),
|
|
1068
|
+
lineterm="",
|
|
1069
|
+
)
|
|
1070
|
+
return "\n".join(diff)
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
# ====================================================================
|
|
1074
|
+
# 8. generate_migration_summary
|
|
1075
|
+
# ====================================================================
|
|
1076
|
+
def generate_migration_summary(source_path, output_path):
|
|
1077
|
+
"""Walk both source and output directories and produce a summary.
|
|
1078
|
+
|
|
1079
|
+
Returns
|
|
1080
|
+
-------
|
|
1081
|
+
dict
|
|
1082
|
+
``{total_files: int, files_changed: int, total_lines_changed: int,
|
|
1083
|
+
per_file: [{file: str, lines_added: int, lines_removed: int,
|
|
1084
|
+
lines_modified: int}], timestamp: str}``
|
|
1085
|
+
"""
|
|
1086
|
+
source_path = Path(source_path)
|
|
1087
|
+
output_path = Path(output_path)
|
|
1088
|
+
|
|
1089
|
+
per_file = []
|
|
1090
|
+
total_lines_changed = 0
|
|
1091
|
+
files_changed = 0
|
|
1092
|
+
total_files = 0
|
|
1093
|
+
|
|
1094
|
+
for root, _dirs, files in os.walk(output_path):
|
|
1095
|
+
for fname in files:
|
|
1096
|
+
out_file = Path(root) / fname
|
|
1097
|
+
rel = out_file.relative_to(output_path)
|
|
1098
|
+
src_file = source_path / rel
|
|
1099
|
+
total_files += 1
|
|
1100
|
+
|
|
1101
|
+
if not src_file.exists():
|
|
1102
|
+
# New file generated during migration
|
|
1103
|
+
try:
|
|
1104
|
+
with open(out_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
1105
|
+
new_line_count = len(fh.readlines())
|
|
1106
|
+
except OSError:
|
|
1107
|
+
new_line_count = 0
|
|
1108
|
+
per_file.append({
|
|
1109
|
+
"file": str(rel),
|
|
1110
|
+
"status": "new",
|
|
1111
|
+
"lines_added": new_line_count,
|
|
1112
|
+
"lines_removed": 0,
|
|
1113
|
+
"lines_modified": 0,
|
|
1114
|
+
})
|
|
1115
|
+
total_lines_changed += new_line_count
|
|
1116
|
+
files_changed += 1
|
|
1117
|
+
continue
|
|
1118
|
+
|
|
1119
|
+
try:
|
|
1120
|
+
with open(src_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
1121
|
+
src_lines = fh.readlines()
|
|
1122
|
+
with open(out_file, "r", encoding="utf-8", errors="replace") as fh:
|
|
1123
|
+
out_lines = fh.readlines()
|
|
1124
|
+
except OSError:
|
|
1125
|
+
continue
|
|
1126
|
+
|
|
1127
|
+
if src_lines == out_lines:
|
|
1128
|
+
continue
|
|
1129
|
+
|
|
1130
|
+
files_changed += 1
|
|
1131
|
+
added = 0
|
|
1132
|
+
removed = 0
|
|
1133
|
+
modified = 0
|
|
1134
|
+
|
|
1135
|
+
matcher = difflib.SequenceMatcher(None, src_lines, out_lines)
|
|
1136
|
+
for tag, i1, i2, j1, j2 in matcher.get_opcodes():
|
|
1137
|
+
if tag == "equal":
|
|
1138
|
+
continue
|
|
1139
|
+
elif tag == "replace":
|
|
1140
|
+
modified += max(i2 - i1, j2 - j1)
|
|
1141
|
+
elif tag == "insert":
|
|
1142
|
+
added += j2 - j1
|
|
1143
|
+
elif tag == "delete":
|
|
1144
|
+
removed += i2 - i1
|
|
1145
|
+
|
|
1146
|
+
file_total = added + removed + modified
|
|
1147
|
+
total_lines_changed += file_total
|
|
1148
|
+
per_file.append({
|
|
1149
|
+
"file": str(rel),
|
|
1150
|
+
"status": "modified",
|
|
1151
|
+
"lines_added": added,
|
|
1152
|
+
"lines_removed": removed,
|
|
1153
|
+
"lines_modified": modified,
|
|
1154
|
+
})
|
|
1155
|
+
|
|
1156
|
+
return {
|
|
1157
|
+
"total_files": total_files,
|
|
1158
|
+
"files_changed": files_changed,
|
|
1159
|
+
"total_lines_changed": total_lines_changed,
|
|
1160
|
+
"per_file": per_file,
|
|
1161
|
+
"timestamp": datetime.datetime.now(datetime.timezone.utc).isoformat() + "Z",
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
# ====================================================================
|
|
1166
|
+
# Dispatch helper
|
|
1167
|
+
# ====================================================================
|
|
1168
|
+
def _dispatch_migration(language, source_path, output_path, from_ver, to_ver):
|
|
1169
|
+
"""Route to the correct migration function based on *language*."""
|
|
1170
|
+
canonical = _LANG_ALIAS.get(language.lower(), language.lower())
|
|
1171
|
+
|
|
1172
|
+
if canonical == "python":
|
|
1173
|
+
return migrate_python2_to_3(source_path, output_path)
|
|
1174
|
+
elif canonical == "java":
|
|
1175
|
+
return migrate_java_version(source_path, output_path, from_ver, to_ver)
|
|
1176
|
+
elif canonical == "dotnet":
|
|
1177
|
+
return migrate_dotnet_framework(source_path, output_path)
|
|
1178
|
+
else:
|
|
1179
|
+
return {
|
|
1180
|
+
"files_processed": 0,
|
|
1181
|
+
"transformations_applied": [],
|
|
1182
|
+
"errors": [f"Unsupported language: {language}"],
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
# ====================================================================
|
|
1187
|
+
# 9. CLI main
|
|
1188
|
+
# ====================================================================
|
|
1189
|
+
def main():
|
|
1190
|
+
"""CLI entry-point for the version migration tool."""
|
|
1191
|
+
parser = argparse.ArgumentParser(
|
|
1192
|
+
description=(
|
|
1193
|
+
"ICDEV Version Migration Tool — transform legacy code to "
|
|
1194
|
+
"newer language versions (CUI // SP-CTI)"
|
|
1195
|
+
),
|
|
1196
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
1197
|
+
epilog=textwrap.dedent("""\
|
|
1198
|
+
examples:
|
|
1199
|
+
%(prog)s --source ./legacy --output ./migrated --language python --from 2.7 --to 3.11
|
|
1200
|
+
%(prog)s --source ./java8app --output ./java17app --language java --from 8 --to 17 --validate
|
|
1201
|
+
%(prog)s --source ./netfx --output ./net8 --language csharp --diff --json
|
|
1202
|
+
|
|
1203
|
+
CUI // SP-CTI
|
|
1204
|
+
"""),
|
|
1205
|
+
)
|
|
1206
|
+
parser.add_argument(
|
|
1207
|
+
"--source", required=True, type=str,
|
|
1208
|
+
help="Path to source directory containing legacy code",
|
|
1209
|
+
)
|
|
1210
|
+
parser.add_argument(
|
|
1211
|
+
"--output", required=True, type=str,
|
|
1212
|
+
help="Path to output directory (will be created; never overwrites source)",
|
|
1213
|
+
)
|
|
1214
|
+
parser.add_argument(
|
|
1215
|
+
"--language", required=True, type=str,
|
|
1216
|
+
choices=["python", "java", "csharp"],
|
|
1217
|
+
help="Source code language",
|
|
1218
|
+
)
|
|
1219
|
+
parser.add_argument(
|
|
1220
|
+
"--from", dest="from_ver", type=str, default=None,
|
|
1221
|
+
help="Source version (e.g. 2.7, 8, 4.8)",
|
|
1222
|
+
)
|
|
1223
|
+
parser.add_argument(
|
|
1224
|
+
"--to", dest="to_ver", type=str, default=None,
|
|
1225
|
+
help="Target version (e.g. 3.11, 17, 8.0)",
|
|
1226
|
+
)
|
|
1227
|
+
parser.add_argument(
|
|
1228
|
+
"--validate", action="store_true",
|
|
1229
|
+
help="Run syntax validation on migrated files",
|
|
1230
|
+
)
|
|
1231
|
+
parser.add_argument(
|
|
1232
|
+
"--diff", action="store_true",
|
|
1233
|
+
help="Print unified diffs for changed files",
|
|
1234
|
+
)
|
|
1235
|
+
parser.add_argument(
|
|
1236
|
+
"--json", dest="json_output", action="store_true",
|
|
1237
|
+
help="Output results as JSON",
|
|
1238
|
+
)
|
|
1239
|
+
|
|
1240
|
+
args = parser.parse_args()
|
|
1241
|
+
|
|
1242
|
+
source_path = Path(args.source).resolve()
|
|
1243
|
+
output_path = Path(args.output).resolve()
|
|
1244
|
+
|
|
1245
|
+
# Validate source
|
|
1246
|
+
if not source_path.is_dir():
|
|
1247
|
+
_error_exit(f"Source directory does not exist: {source_path}")
|
|
1248
|
+
|
|
1249
|
+
# Safety: output must not be same as source
|
|
1250
|
+
if source_path == output_path:
|
|
1251
|
+
_error_exit("Output directory must differ from source directory")
|
|
1252
|
+
|
|
1253
|
+
# Load external rules (informational; hard-coded rules always apply)
|
|
1254
|
+
ext_rules = load_upgrade_rules(
|
|
1255
|
+
args.language,
|
|
1256
|
+
from_version=args.from_ver,
|
|
1257
|
+
to_version=args.to_ver,
|
|
1258
|
+
)
|
|
1259
|
+
|
|
1260
|
+
if not args.json_output:
|
|
1261
|
+
print(f"{CUI_BANNER}")
|
|
1262
|
+
print("=" * 68)
|
|
1263
|
+
print("ICDEV Version Migration Tool")
|
|
1264
|
+
print(f" Language : {args.language}")
|
|
1265
|
+
print(f" From : {args.from_ver or 'auto'}")
|
|
1266
|
+
print(f" To : {args.to_ver or 'auto'}")
|
|
1267
|
+
print(f" Source : {source_path}")
|
|
1268
|
+
print(f" Output : {output_path}")
|
|
1269
|
+
print(f" Rules : {len(ext_rules)} external rules loaded")
|
|
1270
|
+
print("=" * 68)
|
|
1271
|
+
|
|
1272
|
+
# Run migration
|
|
1273
|
+
result = _dispatch_migration(
|
|
1274
|
+
args.language, source_path, output_path,
|
|
1275
|
+
args.from_ver, args.to_ver,
|
|
1276
|
+
)
|
|
1277
|
+
|
|
1278
|
+
# Validation pass
|
|
1279
|
+
validation_results = {}
|
|
1280
|
+
if args.validate:
|
|
1281
|
+
canonical = _LANG_ALIAS.get(args.language.lower(), args.language.lower())
|
|
1282
|
+
ext_map = {"python": {".py"}, "java": {".java"}, "dotnet": {".cs"}}
|
|
1283
|
+
exts = ext_map.get(canonical, set())
|
|
1284
|
+
for fpath in _collect_files(output_path, exts):
|
|
1285
|
+
rel = fpath.relative_to(output_path)
|
|
1286
|
+
src_equiv = source_path / rel
|
|
1287
|
+
vr = _validate_transforms(str(src_equiv), str(fpath), args.language)
|
|
1288
|
+
if not vr["valid"]:
|
|
1289
|
+
validation_results[str(rel)] = vr
|
|
1290
|
+
|
|
1291
|
+
result["validation"] = {
|
|
1292
|
+
"files_validated": sum(
|
|
1293
|
+
1 for _ in _collect_files(output_path, exts)
|
|
1294
|
+
),
|
|
1295
|
+
"files_with_errors": len(validation_results),
|
|
1296
|
+
"details": validation_results,
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
# Summary
|
|
1300
|
+
summary = generate_migration_summary(source_path, output_path)
|
|
1301
|
+
result["summary"] = summary
|
|
1302
|
+
|
|
1303
|
+
# Diffs
|
|
1304
|
+
if args.diff and not args.json_output:
|
|
1305
|
+
print("\n--- DIFFS ---")
|
|
1306
|
+
for entry in summary.get("per_file", []):
|
|
1307
|
+
if entry.get("status") in ("modified", "new"):
|
|
1308
|
+
rel = entry["file"]
|
|
1309
|
+
orig = source_path / rel
|
|
1310
|
+
transformed = output_path / rel
|
|
1311
|
+
if orig.exists():
|
|
1312
|
+
diff_text = generate_migration_diff(orig, transformed)
|
|
1313
|
+
if diff_text:
|
|
1314
|
+
print(diff_text)
|
|
1315
|
+
print()
|
|
1316
|
+
|
|
1317
|
+
# Output
|
|
1318
|
+
if args.json_output:
|
|
1319
|
+
# Ensure JSON-serializable
|
|
1320
|
+
print(json.dumps(result, indent=2, default=str))
|
|
1321
|
+
else:
|
|
1322
|
+
_print_human_report(result, args)
|
|
1323
|
+
|
|
1324
|
+
print(f"\n{CUI_BANNER}")
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
def _print_human_report(result, args):
|
|
1328
|
+
"""Print a human-readable migration report to stdout."""
|
|
1329
|
+
transforms = result.get("transformations_applied", [])
|
|
1330
|
+
errors = result.get("errors", [])
|
|
1331
|
+
summary = result.get("summary", {})
|
|
1332
|
+
|
|
1333
|
+
print("\nMigration complete.")
|
|
1334
|
+
print(f" Files processed : {result.get('files_processed', 0)}")
|
|
1335
|
+
print(f" Transformations : {len(transforms)}")
|
|
1336
|
+
print(f" Errors : {len(errors)}")
|
|
1337
|
+
|
|
1338
|
+
if summary:
|
|
1339
|
+
print("\nSummary:")
|
|
1340
|
+
print(f" Total files in output : {summary.get('total_files', 0)}")
|
|
1341
|
+
print(f" Files changed : {summary.get('files_changed', 0)}")
|
|
1342
|
+
print(f" Total lines changed : {summary.get('total_lines_changed', 0)}")
|
|
1343
|
+
|
|
1344
|
+
if summary.get("per_file"):
|
|
1345
|
+
print("\nPer-file breakdown:")
|
|
1346
|
+
for pf in summary["per_file"]:
|
|
1347
|
+
status = pf.get("status", "modified")
|
|
1348
|
+
added = pf.get("lines_added", 0)
|
|
1349
|
+
removed = pf.get("lines_removed", 0)
|
|
1350
|
+
modified = pf.get("lines_modified", 0)
|
|
1351
|
+
print(
|
|
1352
|
+
f" {pf['file']:50s} "
|
|
1353
|
+
f"[{status}] +{added} -{removed} ~{modified}"
|
|
1354
|
+
)
|
|
1355
|
+
|
|
1356
|
+
# Group transformations by rule
|
|
1357
|
+
if transforms:
|
|
1358
|
+
rule_counts = collections.Counter(t.get("rule", "unknown") for t in transforms)
|
|
1359
|
+
print("\nTransformations by rule:")
|
|
1360
|
+
for rule, count in rule_counts.most_common():
|
|
1361
|
+
print(f" {rule:45s} : {count}")
|
|
1362
|
+
|
|
1363
|
+
if errors:
|
|
1364
|
+
print("\nErrors:")
|
|
1365
|
+
for err in errors:
|
|
1366
|
+
print(f" [ERROR] {err}")
|
|
1367
|
+
|
|
1368
|
+
# Validation
|
|
1369
|
+
validation = result.get("validation")
|
|
1370
|
+
if validation:
|
|
1371
|
+
print("\nValidation:")
|
|
1372
|
+
print(f" Files validated : {validation.get('files_validated', 0)}")
|
|
1373
|
+
print(f" Files with errors : {validation.get('files_with_errors', 0)}")
|
|
1374
|
+
if validation.get("details"):
|
|
1375
|
+
for fpath, vr in validation["details"].items():
|
|
1376
|
+
for verr in vr.get("errors", []):
|
|
1377
|
+
print(f" [FAIL] {fpath}: {verr}")
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
def _error_exit(message):
|
|
1381
|
+
"""Print error and exit with status 1."""
|
|
1382
|
+
print(f"[ERROR] {message}", file=sys.stderr)
|
|
1383
|
+
sys.exit(1)
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
# ====================================================================
|
|
1387
|
+
# Entry point
|
|
1388
|
+
# ====================================================================
|
|
1389
|
+
if __name__ == "__main__":
|
|
1390
|
+
main()
|
|
1391
|
+
|
|
1392
|
+
# [TEMPLATE: CUI // SP-CTI]
|