md-ddl 0.9.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- md_ddl/__init__.py +118 -0
- md_ddl/__main__.py +8 -0
- md_ddl/cli.py +342 -0
- md_ddl/docs/agents/CONVENTIONS.md +88 -0
- md_ddl/docs/agents/agent-architect/AGENT.md +337 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/SKILL.md +489 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/anti-patterns.md +35 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/data-autonomy.md +36 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/data-products.md +39 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/external-references.md +39 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/model-driven.md +31 -0
- md_ddl/docs/agents/agent-architect/skills/architecture/references/philosophy.md +42 -0
- md_ddl/docs/agents/agent-architect/skills/odps-alignment/SKILL.md +327 -0
- md_ddl/docs/agents/agent-architect/skills/odps-alignment/references/odps-v4.0.md +346 -0
- md_ddl/docs/agents/agent-architect/skills/product-design/SKILL.md +470 -0
- md_ddl/docs/agents/agent-architect/skills/product-design/platform-posture.md +41 -0
- md_ddl/docs/agents/agent-artifact/AGENT.md +223 -0
- md_ddl/docs/agents/agent-artifact/references/generation-semantics.md +125 -0
- md_ddl/docs/agents/agent-artifact/skills/dialects/databricks.md +224 -0
- md_ddl/docs/agents/agent-artifact/skills/dialects/postgresql.md +208 -0
- md_ddl/docs/agents/agent-artifact/skills/dialects/snowflake.md +178 -0
- md_ddl/docs/agents/agent-artifact/skills/dimensional/SKILL.md +279 -0
- md_ddl/docs/agents/agent-artifact/skills/faker/SKILL.md +609 -0
- md_ddl/docs/agents/agent-artifact/skills/faker/runtime/consistency_scenario.py +432 -0
- md_ddl/docs/agents/agent-artifact/skills/faker/runtime/enterprise_profile.py +387 -0
- md_ddl/docs/agents/agent-artifact/skills/faker/runtime/integrity_check.py +477 -0
- md_ddl/docs/agents/agent-artifact/skills/faker/runtime/test_template.py +264 -0
- md_ddl/docs/agents/agent-artifact/skills/knowledge-graph/SKILL.md +288 -0
- md_ddl/docs/agents/agent-artifact/skills/normalized/SKILL.md +326 -0
- md_ddl/docs/agents/agent-artifact/skills/reconciliation/SKILL.md +188 -0
- md_ddl/docs/agents/agent-artifact/skills/wide-column/SKILL.md +264 -0
- md_ddl/docs/agents/agent-governance/AGENT.md +324 -0
- md_ddl/docs/agents/agent-governance/skills/compliance-audit/SKILL.md +503 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/SKILL.md +214 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/apra.md +206 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/basel.md +112 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/ccpa.md +39 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/eba.md +36 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/fatf.md +44 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/fdic.md +42 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/federal-reserve.md +35 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/gdpr.md +47 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/hipaa.md +113 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/occ.md +36 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/rbnz.md +129 -0
- md_ddl/docs/agents/agent-governance/skills/regulatory-compliance/regulators/sox.md +40 -0
- md_ddl/docs/agents/agent-governance/skills/standards-conformance/SKILL.md +164 -0
- md_ddl/docs/agents/agent-guide/AGENT.md +270 -0
- md_ddl/docs/agents/agent-guide/skills/adoption-planning/SKILL.md +121 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/SKILL.md +663 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/dataproducts-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/domains-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/entities-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/enumerations-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/events-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/foundation-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/relationships-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/sources-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/concept-explorer/references/transformations-spec.md +7 -0
- md_ddl/docs/agents/agent-guide/skills/orientation/SKILL.md +152 -0
- md_ddl/docs/agents/agent-guide/skills/orientation/references/foundation-spec.md +9 -0
- md_ddl/docs/agents/agent-guide/skills/platform-setup/SKILL.md +269 -0
- md_ddl/docs/agents/agent-guide/skills/worked-examples/SKILL.md +259 -0
- md_ddl/docs/agents/agent-ontology/AGENT.md +257 -0
- md_ddl/docs/agents/agent-ontology/skills/baseline-capture/SKILL.md +125 -0
- md_ddl/docs/agents/agent-ontology/skills/domain-review/SKILL.md +304 -0
- md_ddl/docs/agents/agent-ontology/skills/domain-scoping/SKILL.md +402 -0
- md_ddl/docs/agents/agent-ontology/skills/domain-scoping/domain-boundaries.md +73 -0
- md_ddl/docs/agents/agent-ontology/skills/domain-scoping/references/domains-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/SKILL.md +246 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/conceptual-to-physical-realisation.md +148 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/guidance.md +516 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/inheritance-patterns.md +154 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/references/entities-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/entity-modelling/references/enumerations-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/lifecycle/SKILL.md +192 -0
- md_ddl/docs/agents/agent-ontology/skills/preflight/SKILL.md +127 -0
- md_ddl/docs/agents/agent-ontology/skills/relationship-events/SKILL.md +192 -0
- md_ddl/docs/agents/agent-ontology/skills/relationship-events/references/events-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/relationship-events/references/relationships-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/schema-import/SKILL.md +288 -0
- md_ddl/docs/agents/agent-ontology/skills/source-mapping/SKILL.md +397 -0
- md_ddl/docs/agents/agent-ontology/skills/source-mapping/references/sources-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/source-mapping/references/transformations-spec.md +9 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/SKILL.md +255 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/acord/README.md +239 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/README.md +106 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/bo-classes-detail.md +525 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/bo-classes.md +1535 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/enumerations.md +557 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/hierarchy.md +644 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/v13/README.md +17 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/bian/v14/README.md +17 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/fhir/README.md +97 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/fhir/resources-detail.md +1246 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/fhir/resources.md +158 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/fhir/terminology.md +2397 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/iso20022.md +138 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/tmforum/README.md +215 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/tmforum/sid-domains.md +875 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/tmforum/sid-entities-detail.md +1022 -0
- md_ddl/docs/agents/agent-ontology/skills/standards-alignment/standards/tmforum/sid-entities.md +790 -0
- md_ddl/docs/examples/Brownfield Retail/baselines/catalog/collibra_product.md +32 -0
- md_ddl/docs/examples/Brownfield Retail/baselines/dimensional/dim_product.md +51 -0
- md_ddl/docs/examples/Brownfield Retail/baselines/dimensional/dim_store.md +51 -0
- md_ddl/docs/examples/Brownfield Retail/baselines/dimensional/fact_sales.md +58 -0
- md_ddl/docs/examples/Brownfield Retail/baselines/etl/daily_sales_load.md +55 -0
- md_ddl/docs/examples/Brownfield Retail/domain.md +118 -0
- md_ddl/docs/examples/Brownfield Retail/entities/product.md +77 -0
- md_ddl/docs/examples/Brownfield Retail/entities/sale.md +103 -0
- md_ddl/docs/examples/Brownfield Retail/entities/store.md +91 -0
- md_ddl/docs/examples/Brownfield Retail/sources/pos-system/source.md +52 -0
- md_ddl/docs/examples/Financial Crime/LIFECYCLE.md +86 -0
- md_ddl/docs/examples/Financial Crime/consistency_example.py +228 -0
- md_ddl/docs/examples/Financial Crime/data_products/analytics.md +116 -0
- md_ddl/docs/examples/Financial Crime/data_products/canonical.md +135 -0
- md_ddl/docs/examples/Financial Crime/data_products/party-risk-report-legacy.md +31 -0
- md_ddl/docs/examples/Financial Crime/data_products/patient-fraud-detection.md +244 -0
- md_ddl/docs/examples/Financial Crime/data_products/source-feeds.md +29 -0
- md_ddl/docs/examples/Financial Crime/domain.md +240 -0
- md_ddl/docs/examples/Financial Crime/entities/account.md +152 -0
- md_ddl/docs/examples/Financial Crime/entities/address.md +126 -0
- md_ddl/docs/examples/Financial Crime/entities/agreement.md +81 -0
- md_ddl/docs/examples/Financial Crime/entities/branch.md +75 -0
- md_ddl/docs/examples/Financial Crime/entities/company.md +108 -0
- md_ddl/docs/examples/Financial Crime/entities/contact_address.md +167 -0
- md_ddl/docs/examples/Financial Crime/entities/currency.md +52 -0
- md_ddl/docs/examples/Financial Crime/entities/customer-preferences.md +59 -0
- md_ddl/docs/examples/Financial Crime/entities/customer.md +85 -0
- md_ddl/docs/examples/Financial Crime/entities/exchange-rate.md +76 -0
- md_ddl/docs/examples/Financial Crime/entities/loan-agreement.md +51 -0
- md_ddl/docs/examples/Financial Crime/entities/merchant.md +81 -0
- md_ddl/docs/examples/Financial Crime/entities/party.md +188 -0
- md_ddl/docs/examples/Financial Crime/entities/party_role.md +201 -0
- md_ddl/docs/examples/Financial Crime/entities/payee.md +47 -0
- md_ddl/docs/examples/Financial Crime/entities/payer.md +47 -0
- md_ddl/docs/examples/Financial Crime/entities/payment_initiator.md +47 -0
- md_ddl/docs/examples/Financial Crime/entities/person.md +115 -0
- md_ddl/docs/examples/Financial Crime/entities/product.md +64 -0
- md_ddl/docs/examples/Financial Crime/entities/teller.md +80 -0
- md_ddl/docs/examples/Financial Crime/entities/term-deposit-agreement.md +51 -0
- md_ddl/docs/examples/Financial Crime/entities/transaction.md +234 -0
- md_ddl/docs/examples/Financial Crime/enums.md +464 -0
- md_ddl/docs/examples/Financial Crime/events/account-status-changed.md +22 -0
- md_ddl/docs/examples/Financial Crime/events/agreement-activated.md +22 -0
- md_ddl/docs/examples/Financial Crime/events/customer-onboarded.md +22 -0
- md_ddl/docs/examples/Financial Crime/events/high-risk-transaction-detected.md +37 -0
- md_ddl/docs/examples/Financial Crime/events/kyc-status-updated.md +22 -0
- md_ddl/docs/examples/Financial Crime/events/party-role-assigned.md +22 -0
- md_ddl/docs/examples/Financial Crime/events/transaction-executed.md +37 -0
- md_ddl/docs/examples/Financial Crime/factories.py +524 -0
- md_ddl/docs/examples/Financial Crime/handoff-to-artifact.md +40 -0
- md_ddl/docs/examples/Financial Crime/sources/salesforce-crm/source.md +34 -0
- md_ddl/docs/examples/Financial Crime/sources/salesforce-crm/transforms/table_account.md +30 -0
- md_ddl/docs/examples/Financial Crime/sources/salesforce-crm/transforms/table_contact.md +26 -0
- md_ddl/docs/examples/Financial Crime/sources/salesforce-crm/transforms/table_contact_point.md +41 -0
- md_ddl/docs/examples/Financial Crime/sources/salesforce-crm/transforms/table_preference.md +24 -0
- md_ddl/docs/examples/Financial Crime/sources/sap-fraud-management/source.md +36 -0
- md_ddl/docs/examples/Financial Crime/sources/sap-fraud-management/transforms/table_alert_case.md +37 -0
- md_ddl/docs/examples/Financial Crime/sources/sap-fraud-management/transforms/table_customer_risk_profile.md +24 -0
- md_ddl/docs/examples/Financial Crime/sources/sap-fraud-management/transforms/table_sanctions_screening.md +24 -0
- md_ddl/docs/examples/Financial Crime/sources/temenos-payment/source.md +38 -0
- md_ddl/docs/examples/Financial Crime/sources/temenos-payment/transforms/table_account_ref.md +25 -0
- md_ddl/docs/examples/Financial Crime/sources/temenos-payment/transforms/table_initiation.md +25 -0
- md_ddl/docs/examples/Financial Crime/sources/temenos-payment/transforms/table_payment_event.md +28 -0
- md_ddl/docs/examples/Financial Crime/sources/temenos-payment/transforms/table_payment_parties.md +8 -0
- md_ddl/docs/examples/Healthcare/data_products/analytics.md +197 -0
- md_ddl/docs/examples/Healthcare/data_products/billing-fraud-detection.md +249 -0
- md_ddl/docs/examples/Healthcare/data_products/canonical.md +174 -0
- md_ddl/docs/examples/Healthcare/data_products/source-feeds.md +38 -0
- md_ddl/docs/examples/Healthcare/domain.md +161 -0
- md_ddl/docs/examples/Healthcare/entities/appointment.md +112 -0
- md_ddl/docs/examples/Healthcare/entities/care_plan.md +138 -0
- md_ddl/docs/examples/Healthcare/entities/condition.md +91 -0
- md_ddl/docs/examples/Healthcare/entities/encounter.md +150 -0
- md_ddl/docs/examples/Healthcare/entities/location.md +63 -0
- md_ddl/docs/examples/Healthcare/entities/medication_request.md +90 -0
- md_ddl/docs/examples/Healthcare/entities/observation.md +102 -0
- md_ddl/docs/examples/Healthcare/entities/organization.md +60 -0
- md_ddl/docs/examples/Healthcare/entities/patient.md +166 -0
- md_ddl/docs/examples/Healthcare/entities/practitioner.md +94 -0
- md_ddl/docs/examples/Healthcare/entities/practitioner_role.md +110 -0
- md_ddl/docs/examples/Healthcare/entities/procedure.md +72 -0
- md_ddl/docs/examples/Healthcare/enums.md +315 -0
- md_ddl/docs/examples/Healthcare/events/care-plan-updated.md +37 -0
- md_ddl/docs/examples/Healthcare/events/medication-prescribed.md +36 -0
- md_ddl/docs/examples/Healthcare/events/observation-recorded.md +38 -0
- md_ddl/docs/examples/Healthcare/events/patient-admitted.md +36 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/source.md +50 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_appointment.md +32 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_care_plan.md +31 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_diagnosis.md +32 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_encounter.md +51 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_location.md +44 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_medication_order.md +33 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_organization.md +28 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_patient_demographics.md +30 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_provider.md +11 -0
- md_ddl/docs/examples/Healthcare/sources/hospital-ehr/transforms/table_provider_role.md +13 -0
- md_ddl/docs/examples/Healthcare/sources/lab-information-system/source.md +35 -0
- md_ddl/docs/examples/Healthcare/sources/lab-information-system/transforms/table_lab_procedure.md +32 -0
- md_ddl/docs/examples/Healthcare/sources/lab-information-system/transforms/table_lab_result.md +35 -0
- md_ddl/docs/examples/README.md +119 -0
- md_ddl/docs/examples/Retail Sales/data_products/customer-360.md +208 -0
- md_ddl/docs/examples/Retail Sales/data_products/domain-aligned.md +98 -0
- md_ddl/docs/examples/Retail Sales/data_products/sales-funnel-legacy.md +33 -0
- md_ddl/docs/examples/Retail Sales/domain.md +102 -0
- md_ddl/docs/examples/Retail Sales/entities/customer.md +98 -0
- md_ddl/docs/examples/Retail Sales/entities/order.md +96 -0
- md_ddl/docs/examples/Retail Sales/entities/order_line.md +99 -0
- md_ddl/docs/examples/Retail Sales/entities/product.md +67 -0
- md_ddl/docs/examples/Retail Sales/enums.md +32 -0
- md_ddl/docs/examples/Retail Sales/events/order-placed.md +42 -0
- md_ddl/docs/examples/Retail Service/data_products/domain-aligned.md +102 -0
- md_ddl/docs/examples/Retail Service/domain.md +101 -0
- md_ddl/docs/examples/Retail Service/entities/customer.md +104 -0
- md_ddl/docs/examples/Retail Service/entities/knowledge_article.md +67 -0
- md_ddl/docs/examples/Retail Service/entities/service_case.md +104 -0
- md_ddl/docs/examples/Retail Service/entities/service_request.md +94 -0
- md_ddl/docs/examples/Retail Service/enums.md +45 -0
- md_ddl/docs/examples/Retail Service/events/service-request-received.md +36 -0
- md_ddl/docs/examples/Simple Customer/details.md +244 -0
- md_ddl/docs/examples/Simple Customer/domain.md +75 -0
- md_ddl/docs/examples/Telecom/data_products/analytics.md +222 -0
- md_ddl/docs/examples/Telecom/data_products/canonical.md +129 -0
- md_ddl/docs/examples/Telecom/data_products/cdr-feed.md +29 -0
- md_ddl/docs/examples/Telecom/data_products/fraud-intelligence.md +256 -0
- md_ddl/docs/examples/Telecom/data_products/subscriber-report-legacy.md +36 -0
- md_ddl/docs/examples/Telecom/domain.md +143 -0
- md_ddl/docs/examples/Telecom/entities/billing_account.md +123 -0
- md_ddl/docs/examples/Telecom/entities/customer.md +122 -0
- md_ddl/docs/examples/Telecom/entities/individual.md +88 -0
- md_ddl/docs/examples/Telecom/entities/organization.md +74 -0
- md_ddl/docs/examples/Telecom/entities/party.md +72 -0
- md_ddl/docs/examples/Telecom/entities/product_offering.md +123 -0
- md_ddl/docs/examples/Telecom/entities/service.md +101 -0
- md_ddl/docs/examples/Telecom/entities/service_order.md +100 -0
- md_ddl/docs/examples/Telecom/entities/subscription.md +128 -0
- md_ddl/docs/examples/Telecom/entities/usage_record.md +130 -0
- md_ddl/docs/examples/Telecom/enums.md +124 -0
- md_ddl/docs/examples/Telecom/events/service-provisioned.md +39 -0
- md_ddl/docs/examples/Telecom/events/subscription-activated.md +39 -0
- md_ddl/docs/examples/Telecom/events/usage-recorded.md +48 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/source.md +46 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_billing_account.md +32 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_business_account.md +27 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_cdr.md +39 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_customer.md +29 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_product_catalog.md +38 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_service.md +32 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_service_order.md +51 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_subscriber.md +29 -0
- md_ddl/docs/examples/Telecom/sources/bss-oss/transforms/table_subscription.md +32 -0
- md_ddl/docs/guides/adoption-playbook.md +283 -0
- md_ddl/docs/guides/diagram-style.md +344 -0
- md_ddl/docs/guides/lifecycle-versioning.md +186 -0
- md_ddl/docs/guides/validation-tooling.md +121 -0
- md_ddl/docs/md-ddl-specification/1-Foundation.md +132 -0
- md_ddl/docs/md-ddl-specification/10-Adoption.md +89 -0
- md_ddl/docs/md-ddl-specification/2-Domains.md +350 -0
- md_ddl/docs/md-ddl-specification/3-Entities.md +370 -0
- md_ddl/docs/md-ddl-specification/4-Enumerations.md +79 -0
- md_ddl/docs/md-ddl-specification/5-Relationships.md +135 -0
- md_ddl/docs/md-ddl-specification/6-Events.md +145 -0
- md_ddl/docs/md-ddl-specification/7-Sources.md +534 -0
- md_ddl/docs/md-ddl-specification/8-Transformations.md +495 -0
- md_ddl/docs/md-ddl-specification/9-Data-Products.md +502 -0
- md_ddl/docs/md-ddl-specification/MD-DDL-Complete.md +2786 -0
- md_ddl/docs/references/architecture/2018-12-20_vestigial_technology.md +77 -0
- md_ddl/docs/references/architecture/2019-02-17_data-autonomy-overview.md +131 -0
- md_ddl/docs/references/architecture/2020-07-18_data-autonomy-holistic-data-mesh.md +165 -0
- md_ddl/docs/references/architecture/2020-07-19_data-autonomy-resource-oriented-event-driven.md +64 -0
- md_ddl/docs/references/architecture/2020-07-30_data-autonomy-bi-analytics.md +39 -0
- md_ddl/docs/references/architecture/2020-08-05_data-autonomy-case-study.md +102 -0
- md_ddl/docs/references/architecture/2021-03-28_stop-versioning.md +91 -0
- md_ddl/docs/references/architecture/2021-04-05_automated-operational-analytics-transform.md +130 -0
- md_ddl/docs/references/architecture/2021-04-24_systems-record-bollocks.md +39 -0
- md_ddl/docs/references/architecture/2021-07-07_model-driven-generation.md +36 -0
- md_ddl/docs/references/architecture/2021-08-13_tikanga-data.md +69 -0
- md_ddl/docs/references/architecture/2021-08-22_data-convergence.md +59 -0
- md_ddl/docs/references/architecture/2021-09-23_poc-poc-poc-production.md +25 -0
- md_ddl/docs/references/architecture/2022-02-13_the-forgotten-question-mark.md +118 -0
- md_ddl/docs/references/architecture/2022-03-25_standards.md +31 -0
- md_ddl/docs/references/architecture/2024-03-23_enterprise_anarchism.md +57 -0
- md_ddl/docs/references/architecture/2024-07-11_data_products.md +88 -0
- md_ddl/docs/references/architecture/2024-08-07_architecting_data_autonomy.md +239 -0
- md_ddl/docs/references/architecture/BIAN Coreless Banking vs Data Autonomy.md +103 -0
- md_ddl/docs/references/architecture/bounded_context.md +41 -0
- md_ddl/docs/references/architecture/data_lake_to_data_mesh.md +136 -0
- md_ddl/docs/references/architecture/diagrams_converted/Bounded Context.md +47 -0
- md_ddl/docs/references/architecture/diagrams_converted/Canonical Data Model Pattern.md +48 -0
- md_ddl/docs/references/architecture/diagrams_converted/Data Products E2E.md +65 -0
- md_ddl/docs/references/architecture/diagrams_converted/Flatten.md +34 -0
- md_ddl/docs/references/architecture/diagrams_converted/Key Mapping.md +62 -0
- md_ddl/docs/references/architecture/diagrams_converted/OP2ANL.md +66 -0
- md_ddl/docs/references/architecture/diagrams_converted/SH Integration.md +26 -0
- md_ddl/includes.py +88 -0
- md_ddl/lint.py +1469 -0
- md_ddl/wrappers/claude/agent-architect.md +10 -0
- md_ddl/wrappers/claude/agent-artifact.md +10 -0
- md_ddl/wrappers/claude/agent-governance.md +11 -0
- md_ddl/wrappers/claude/agent-guide.md +10 -0
- md_ddl/wrappers/claude/agent-ontology.md +10 -0
- md_ddl/wrappers/copilot/agent-architect.agent.md +11 -0
- md_ddl/wrappers/copilot/agent-artifact.agent.md +11 -0
- md_ddl/wrappers/copilot/agent-governance.agent.md +11 -0
- md_ddl/wrappers/copilot/agent-guide.agent.md +11 -0
- md_ddl/wrappers/copilot/agent-ontology.agent.md +11 -0
- md_ddl/wrappers/copilot/review-md-ddl.agent.md +46 -0
- md_ddl-0.9.2.dist-info/METADATA +256 -0
- md_ddl-0.9.2.dist-info/RECORD +314 -0
- md_ddl-0.9.2.dist-info/WHEEL +4 -0
- md_ddl-0.9.2.dist-info/entry_points.txt +2 -0
- md_ddl-0.9.2.dist-info/licenses/LICENSE +395 -0
md_ddl/__init__.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""MD-DDL — the Markdown Data Definition Language standard, packaged for pip.
|
|
2
|
+
|
|
3
|
+
The distribution carries the standard itself as package data: the
|
|
4
|
+
specification, the agent prompts and skills, the companion guides, the
|
|
5
|
+
reference examples, and the architecture source material. `md-ddl init`
|
|
6
|
+
unpacks that payload into a project so the agents resolve exactly as they do
|
|
7
|
+
when MD-DDL is added as a git submodule.
|
|
8
|
+
|
|
9
|
+
Spec and repository: https://github.com/Semprini/md-ddl
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from importlib import resources
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
__version__ = "0.9.2"
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"DOCS_DIRNAME",
|
|
21
|
+
"DOCS_PAYLOAD",
|
|
22
|
+
"WRAPPER_PAYLOAD",
|
|
23
|
+
"__version__",
|
|
24
|
+
"docs_sources",
|
|
25
|
+
"wrapper_source",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
#: Directory an installed project keeps the standard in. The Copilot agent
|
|
29
|
+
#: wrappers include `../../.md-ddl/agents/...`, and `md-ddl init` rewrites the
|
|
30
|
+
#: Claude slash commands to match, so this name is part of the contract.
|
|
31
|
+
DOCS_DIRNAME = ".md-ddl"
|
|
32
|
+
|
|
33
|
+
#: Source-repository directory -> path inside `.md-ddl/` once installed.
|
|
34
|
+
#: `references/industry_standards/` is deliberately absent: the raw BIAN, FHIR
|
|
35
|
+
#: and TM Forum snapshots are 63 MB, and the distilled markdown the agents
|
|
36
|
+
#: actually load ships under `agents/*/skills/standards-alignment/standards/`.
|
|
37
|
+
DOCS_PAYLOAD = {
|
|
38
|
+
"agents": "agents",
|
|
39
|
+
"md-ddl-specification": "md-ddl-specification",
|
|
40
|
+
"guides": "guides",
|
|
41
|
+
"examples": "examples",
|
|
42
|
+
"references/architecture": "references/architecture",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#: Source-repository directory -> subdirectory of the packaged `wrappers/`.
|
|
46
|
+
WRAPPER_PAYLOAD = {
|
|
47
|
+
".github/agents": "copilot",
|
|
48
|
+
".claude/commands": "claude",
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _package_dir() -> Path:
|
|
53
|
+
"""Directory this package is installed in."""
|
|
54
|
+
return Path(str(resources.files(__name__)))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _repo_root() -> Path | None:
|
|
58
|
+
"""Repository root, when running from a source checkout rather than a wheel.
|
|
59
|
+
|
|
60
|
+
An editable install or a `python -m md_ddl` from a clone has no packaged
|
|
61
|
+
payload; the standard lives at the repository root instead. `src/md_ddl`
|
|
62
|
+
means the root is two levels up.
|
|
63
|
+
"""
|
|
64
|
+
root = _package_dir().parents[1]
|
|
65
|
+
return root if (root / "md-ddl-specification").is_dir() else None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def docs_sources() -> dict[str, Path]:
|
|
69
|
+
"""Map each `.md-ddl/` destination path to the directory supplying it.
|
|
70
|
+
|
|
71
|
+
Raises:
|
|
72
|
+
FileNotFoundError: if neither the packaged payload nor a source
|
|
73
|
+
checkout can be found.
|
|
74
|
+
"""
|
|
75
|
+
package_dir = _package_dir()
|
|
76
|
+
if (package_dir / "docs").is_dir():
|
|
77
|
+
return {
|
|
78
|
+
dest: package_dir / "docs" / dest
|
|
79
|
+
for dest in DOCS_PAYLOAD.values()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
repo_root = _repo_root()
|
|
83
|
+
if repo_root is not None:
|
|
84
|
+
return {
|
|
85
|
+
dest: repo_root / source
|
|
86
|
+
for source, dest in DOCS_PAYLOAD.items()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
raise FileNotFoundError(
|
|
90
|
+
f"no MD-DDL payload found in {package_dir} and no source checkout above it; "
|
|
91
|
+
"reinstall the package with `pip install --force-reinstall md-ddl`"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def wrapper_source(tool: str) -> Path:
|
|
96
|
+
"""Directory holding the agent wrappers for `tool` ('claude' or 'copilot').
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
KeyError: if `tool` is not a known AI tool.
|
|
100
|
+
FileNotFoundError: if the wrappers cannot be located.
|
|
101
|
+
"""
|
|
102
|
+
sources = {dest: source for source, dest in WRAPPER_PAYLOAD.items()}
|
|
103
|
+
if tool not in sources:
|
|
104
|
+
raise KeyError(tool)
|
|
105
|
+
|
|
106
|
+
package_dir = _package_dir()
|
|
107
|
+
packaged = package_dir / "wrappers" / tool
|
|
108
|
+
if packaged.is_dir():
|
|
109
|
+
return packaged
|
|
110
|
+
|
|
111
|
+
repo_root = _repo_root()
|
|
112
|
+
if repo_root is not None:
|
|
113
|
+
return repo_root / sources[tool]
|
|
114
|
+
|
|
115
|
+
raise FileNotFoundError(
|
|
116
|
+
f"no {tool} agent wrappers found in {package_dir}; "
|
|
117
|
+
"reinstall the package with `pip install --force-reinstall md-ddl`"
|
|
118
|
+
)
|
md_ddl/__main__.py
ADDED
md_ddl/cli.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"""Command-line interface for the packaged MD-DDL standard.
|
|
2
|
+
|
|
3
|
+
`md-ddl init` is the pip equivalent of adding this repository as a git
|
|
4
|
+
submodule: it unpacks the standard into `.md-ddl/` and installs the agent
|
|
5
|
+
wrappers for Claude Code and/or GitHub Copilot, rewriting their paths so the
|
|
6
|
+
agents resolve against the unpacked copy.
|
|
7
|
+
|
|
8
|
+
pip has no post-install hook for wheels, so this runs as an explicit command
|
|
9
|
+
after `pip install md-ddl` rather than during the install itself.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import argparse
|
|
15
|
+
import re
|
|
16
|
+
import shutil
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
from md_ddl import DOCS_DIRNAME, __version__, docs_sources, includes, wrapper_source
|
|
21
|
+
|
|
22
|
+
#: Wrappers that drive review of the standard itself. They belong to the source
|
|
23
|
+
#: repository and are not installed into a consuming project.
|
|
24
|
+
INTERNAL_WRAPPERS = frozenset({"review-md-ddl.agent.md", "review.md"})
|
|
25
|
+
|
|
26
|
+
#: Claude slash commands carry paths relative to the source repository root.
|
|
27
|
+
#: Retarget them at the unpacked standard, as the bootstrap scripts do.
|
|
28
|
+
CLAUDE_PATH_REWRITES = (
|
|
29
|
+
(re.compile(r"`agents/"), f"`{DOCS_DIRNAME}/agents/"),
|
|
30
|
+
(re.compile(r"`md-ddl-specification/"), f"`{DOCS_DIRNAME}/md-ddl-specification/"),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
TOOL_TARGETS = {
|
|
34
|
+
"claude": Path(".claude") / "commands",
|
|
35
|
+
"copilot": Path(".github") / "agents",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
AGENTS = (
|
|
39
|
+
("agent-guide", "Agent Guide",
|
|
40
|
+
"Learning, navigation, concept explanation. Start here."),
|
|
41
|
+
("agent-ontology", "Agent Ontology",
|
|
42
|
+
"Domain discovery, entity modelling, source mapping."),
|
|
43
|
+
("agent-artifact", "Agent Artifact",
|
|
44
|
+
"Physical schema generation (SQL DDL, JSON Schema, Parquet, Cypher)."),
|
|
45
|
+
("agent-architect", "Agent Architect",
|
|
46
|
+
"Data product design, architecture discussion, ODPS manifests."),
|
|
47
|
+
("agent-governance", "Agent Governance",
|
|
48
|
+
"Standards conformance, compliance auditing, governance assurance."),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _agent_table(tool: str) -> str:
|
|
53
|
+
"""Markdown table of the agents, addressed the way `tool` invokes them."""
|
|
54
|
+
if tool == "claude":
|
|
55
|
+
rows = [f"`/{name}` | {title} | {purpose}" for name, title, purpose in AGENTS]
|
|
56
|
+
header = ["Command | Agent | Purpose", "--- | --- | ---"]
|
|
57
|
+
else:
|
|
58
|
+
rows = [f"`{name}` | {purpose}" for name, _title, purpose in AGENTS]
|
|
59
|
+
header = ["Agent | Purpose", "--- | ---"]
|
|
60
|
+
return "\n".join(header + rows)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _layout_block(project: str, tool: str) -> str:
|
|
64
|
+
"""Aligned project-tree sketch for the instructions file."""
|
|
65
|
+
wrappers = (
|
|
66
|
+
(".claude/commands/", "Claude slash commands") if tool == "claude"
|
|
67
|
+
else (".github/agents/", "Copilot custom agent wrappers")
|
|
68
|
+
)
|
|
69
|
+
rows = [
|
|
70
|
+
(f"{DOCS_DIRNAME}/", "MD-DDL standard (installed — do not edit)"),
|
|
71
|
+
wrappers,
|
|
72
|
+
("domains/", "Domain files (one per business domain)"),
|
|
73
|
+
("entities/", "Entity detail files"),
|
|
74
|
+
]
|
|
75
|
+
width = max(len(path) for path, _ in rows)
|
|
76
|
+
return "\n".join(
|
|
77
|
+
[f"{project}/"] + [f" {path:<{width}} {note}" for path, note in rows]
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _instructions(project: str, tool: str) -> str:
|
|
82
|
+
"""Project-level agent instructions for `tool`."""
|
|
83
|
+
if tool == "claude":
|
|
84
|
+
invocation = "Invoke them with slash commands in Claude Code:"
|
|
85
|
+
else:
|
|
86
|
+
invocation = "Use the custom agents in `.github/agents/` via GitHub Copilot Chat:"
|
|
87
|
+
invocation = f"{invocation}\n\n{_agent_table(tool)}"
|
|
88
|
+
|
|
89
|
+
return f"""\
|
|
90
|
+
# {project}
|
|
91
|
+
|
|
92
|
+
This project uses the [MD-DDL standard](https://github.com/Semprini/md-ddl) for
|
|
93
|
+
data domain modelling. MD-DDL is installed from PyPI (`pip install md-ddl`) and
|
|
94
|
+
unpacked into `{DOCS_DIRNAME}/` by `md-ddl init`.
|
|
95
|
+
|
|
96
|
+
## Agents
|
|
97
|
+
|
|
98
|
+
MD-DDL provides AI agents for every stage of the modelling lifecycle.
|
|
99
|
+
{invocation}
|
|
100
|
+
|
|
101
|
+
## Validation
|
|
102
|
+
|
|
103
|
+
Run the mechanical pre-flight checks with `md-ddl lint <domain-folder>`.
|
|
104
|
+
Everything beyond syntax is agent-driven review — see
|
|
105
|
+
`{DOCS_DIRNAME}/guides/validation-tooling.md`.
|
|
106
|
+
|
|
107
|
+
## Key references
|
|
108
|
+
|
|
109
|
+
- MD-DDL specification: `{DOCS_DIRNAME}/md-ddl-specification/`
|
|
110
|
+
- Complete spec (single file): `{DOCS_DIRNAME}/md-ddl-specification/MD-DDL-Complete.md`
|
|
111
|
+
- Examples: `{DOCS_DIRNAME}/examples/`
|
|
112
|
+
|
|
113
|
+
## Project layout
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
{_layout_block(project, tool)}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Upgrade the standard with `pip install --upgrade md-ddl && md-ddl init`.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _guard_submodule(target: Path, force: bool) -> None:
|
|
124
|
+
"""Refuse to overwrite an existing MD-DDL git submodule."""
|
|
125
|
+
docs_root = target / DOCS_DIRNAME
|
|
126
|
+
if (docs_root / ".git").exists() and not force:
|
|
127
|
+
raise SystemExit(
|
|
128
|
+
f"error: {docs_root} looks like the MD-DDL git submodule.\n"
|
|
129
|
+
" Installing over it would discard it. Remove the submodule first\n"
|
|
130
|
+
" (git submodule deinit), or re-run with --force to overwrite."
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _install_docs(target: Path) -> list[str]:
|
|
135
|
+
"""Unpack the standard into `<target>/.md-ddl/`. Returns log lines."""
|
|
136
|
+
docs_root = target / DOCS_DIRNAME
|
|
137
|
+
log = []
|
|
138
|
+
docs_root.mkdir(parents=True, exist_ok=True)
|
|
139
|
+
for dest, source in docs_sources().items():
|
|
140
|
+
if not source.is_dir():
|
|
141
|
+
raise SystemExit(f"error: packaged payload is missing {source}")
|
|
142
|
+
destination = docs_root / dest
|
|
143
|
+
# Replace rather than merge, so an upgrade cannot leave files that the
|
|
144
|
+
# new version has deleted.
|
|
145
|
+
if destination.exists():
|
|
146
|
+
shutil.rmtree(destination)
|
|
147
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
148
|
+
shutil.copytree(source, destination)
|
|
149
|
+
log.append(f" {DOCS_DIRNAME}/{dest}")
|
|
150
|
+
return log
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _install_wrappers(target: Path, tool: str, force: bool) -> tuple[list[str], list[str]]:
|
|
154
|
+
"""Install the agent wrappers for `tool`. Returns (written, skipped)."""
|
|
155
|
+
source_dir = wrapper_source(tool)
|
|
156
|
+
dest_dir = target / TOOL_TARGETS[tool]
|
|
157
|
+
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
158
|
+
|
|
159
|
+
written: list[str] = []
|
|
160
|
+
skipped: list[str] = []
|
|
161
|
+
for source in sorted(source_dir.glob("*.md")):
|
|
162
|
+
if source.name in INTERNAL_WRAPPERS:
|
|
163
|
+
continue
|
|
164
|
+
destination = dest_dir / source.name
|
|
165
|
+
if destination.exists() and not force:
|
|
166
|
+
skipped.append(f" {TOOL_TARGETS[tool]}/{source.name}")
|
|
167
|
+
continue
|
|
168
|
+
|
|
169
|
+
content = source.read_text(encoding="utf-8")
|
|
170
|
+
if tool == "claude":
|
|
171
|
+
for pattern, replacement in CLAUDE_PATH_REWRITES:
|
|
172
|
+
content = pattern.sub(replacement, content)
|
|
173
|
+
destination.write_text(content, encoding="utf-8")
|
|
174
|
+
written.append(f" {TOOL_TARGETS[tool]}/{source.name}")
|
|
175
|
+
return written, skipped
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _include_roots(target: Path) -> list[Path]:
|
|
179
|
+
"""Everything in a project that may carry `{{INCLUDE}}` directives."""
|
|
180
|
+
return [target / DOCS_DIRNAME] + [target / path for path in TOOL_TARGETS.values()]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _verify_includes(target: Path) -> int:
|
|
184
|
+
"""Report whether every agent prompt can reach what it includes.
|
|
185
|
+
|
|
186
|
+
The wrappers and the unpacked standard use file-relative include paths so
|
|
187
|
+
they resolve from `.md-ddl/`. Checking after install catches a payload or a
|
|
188
|
+
wrapper that would otherwise load a silently truncated prompt.
|
|
189
|
+
"""
|
|
190
|
+
directives = includes.scan(_include_roots(target))
|
|
191
|
+
broken = [d for d in directives if not d.resolves()]
|
|
192
|
+
|
|
193
|
+
if not broken:
|
|
194
|
+
print(f"\nVerified {len(directives)} include directives resolve.")
|
|
195
|
+
return 0
|
|
196
|
+
|
|
197
|
+
print(f"\nwarning: {len(broken)} of {len(directives)} include directives do not resolve.")
|
|
198
|
+
print(" The agents referencing them will load an incomplete prompt.")
|
|
199
|
+
for directive in broken:
|
|
200
|
+
try:
|
|
201
|
+
location = directive.file.relative_to(target)
|
|
202
|
+
except ValueError:
|
|
203
|
+
location = directive.file
|
|
204
|
+
print(f" {location}:{directive.line} -> {directive.target}")
|
|
205
|
+
return 1
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def cmd_check(args: argparse.Namespace) -> int:
|
|
209
|
+
target = Path(args.target).resolve()
|
|
210
|
+
if not (target / DOCS_DIRNAME).is_dir():
|
|
211
|
+
raise SystemExit(
|
|
212
|
+
f"error: no {DOCS_DIRNAME}/ in {target}; run `md-ddl init` there first"
|
|
213
|
+
)
|
|
214
|
+
return _verify_includes(target)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def cmd_init(args: argparse.Namespace) -> int:
|
|
218
|
+
target = Path(args.target).resolve()
|
|
219
|
+
if target.exists() and not target.is_dir():
|
|
220
|
+
raise SystemExit(f"error: {target} is not a directory")
|
|
221
|
+
target.mkdir(parents=True, exist_ok=True)
|
|
222
|
+
|
|
223
|
+
_guard_submodule(target, args.force)
|
|
224
|
+
|
|
225
|
+
tools = ["claude", "copilot"] if args.ai == "both" else [args.ai]
|
|
226
|
+
project = args.name or target.name
|
|
227
|
+
|
|
228
|
+
print(f"Installing MD-DDL {__version__} into {target}")
|
|
229
|
+
|
|
230
|
+
print(f"\nStandard ({DOCS_DIRNAME}/):")
|
|
231
|
+
for line in _install_docs(target):
|
|
232
|
+
print(line)
|
|
233
|
+
|
|
234
|
+
if not args.track:
|
|
235
|
+
# A self-ignoring directory keeps the unpacked standard out of the
|
|
236
|
+
# project's history without editing the project's own .gitignore.
|
|
237
|
+
(target / DOCS_DIRNAME / ".gitignore").write_text(
|
|
238
|
+
"# Unpacked by `md-ddl init` from the md-ddl PyPI package.\n"
|
|
239
|
+
"# Re-create it with `md-ddl init` rather than committing it.\n"
|
|
240
|
+
"*\n",
|
|
241
|
+
encoding="utf-8",
|
|
242
|
+
)
|
|
243
|
+
print(f" {DOCS_DIRNAME}/.gitignore (pass --track to commit the standard instead)")
|
|
244
|
+
|
|
245
|
+
for tool in tools:
|
|
246
|
+
written, skipped = _install_wrappers(target, tool, args.force)
|
|
247
|
+
print(f"\nAgent wrappers ({tool}):")
|
|
248
|
+
for line in written:
|
|
249
|
+
print(line)
|
|
250
|
+
for line in skipped:
|
|
251
|
+
print(f"{line} (exists, skipped)")
|
|
252
|
+
|
|
253
|
+
if not args.no_instructions:
|
|
254
|
+
path = target / ("CLAUDE.md" if tool == "claude" else ".github/copilot-instructions.md")
|
|
255
|
+
if path.exists() and not args.force:
|
|
256
|
+
print(f" {path.relative_to(target)} (exists, skipped)")
|
|
257
|
+
else:
|
|
258
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
259
|
+
path.write_text(_instructions(project, tool), encoding="utf-8")
|
|
260
|
+
print(f" {path.relative_to(target)}")
|
|
261
|
+
|
|
262
|
+
status = _verify_includes(target)
|
|
263
|
+
|
|
264
|
+
print("\nDone. Next steps:")
|
|
265
|
+
if "claude" in tools:
|
|
266
|
+
print(" Claude Code: /agent-guide — start here")
|
|
267
|
+
if "copilot" in tools:
|
|
268
|
+
print(" Copilot Chat: @agent-guide — start here")
|
|
269
|
+
print(" Validate: md-ddl lint <domain-folder>")
|
|
270
|
+
return status
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def cmd_path(args: argparse.Namespace) -> int:
|
|
274
|
+
"""Print where the packaged standard lives, for scripts and CI."""
|
|
275
|
+
for dest, source in docs_sources().items():
|
|
276
|
+
print(f"{dest}\t{source}")
|
|
277
|
+
return 0
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def run_lint(argv: list[str]) -> int:
|
|
281
|
+
"""Hand the remaining arguments to the linter, untouched."""
|
|
282
|
+
from md_ddl.lint import main as lint_main
|
|
283
|
+
|
|
284
|
+
return lint_main(argv, prog="md-ddl lint")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
288
|
+
parser = argparse.ArgumentParser(
|
|
289
|
+
prog="md-ddl",
|
|
290
|
+
description="The MD-DDL standard: project setup and mechanical validation.",
|
|
291
|
+
)
|
|
292
|
+
parser.add_argument("--version", action="version", version=f"md-ddl {__version__}")
|
|
293
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
294
|
+
|
|
295
|
+
init = subparsers.add_parser(
|
|
296
|
+
"init",
|
|
297
|
+
help=f"unpack the standard into {DOCS_DIRNAME}/ and install the agent wrappers",
|
|
298
|
+
)
|
|
299
|
+
init.add_argument("target", nargs="?", default=".",
|
|
300
|
+
help="project directory to set up (default: current directory)")
|
|
301
|
+
init.add_argument("--ai", choices=["claude", "copilot", "both"], default="both",
|
|
302
|
+
help="which AI tool's agent wrappers to install (default: both)")
|
|
303
|
+
init.add_argument("--name", help="project name for the generated instructions "
|
|
304
|
+
"(default: the target directory name)")
|
|
305
|
+
init.add_argument("--force", action="store_true",
|
|
306
|
+
help="overwrite existing wrappers and instructions")
|
|
307
|
+
init.add_argument("--no-instructions", action="store_true",
|
|
308
|
+
help="do not write CLAUDE.md or copilot-instructions.md")
|
|
309
|
+
init.add_argument("--track", action="store_true",
|
|
310
|
+
help=f"commit {DOCS_DIRNAME}/ to the project instead of ignoring it")
|
|
311
|
+
init.set_defaults(func=cmd_init)
|
|
312
|
+
|
|
313
|
+
# Registered for `md-ddl --help` only; `main` routes `lint` before parsing so
|
|
314
|
+
# every linter flag, `--help` included, reaches the linter unchanged.
|
|
315
|
+
subparsers.add_parser(
|
|
316
|
+
"lint",
|
|
317
|
+
help="run the MD-DDL pre-flight checks (see `md-ddl lint --help`)",
|
|
318
|
+
add_help=False,
|
|
319
|
+
).add_argument("lint_args", nargs="*", help=argparse.SUPPRESS)
|
|
320
|
+
|
|
321
|
+
check = subparsers.add_parser(
|
|
322
|
+
"check", help="verify the installed agent prompts resolve what they include")
|
|
323
|
+
check.add_argument("target", nargs="?", default=".",
|
|
324
|
+
help="project directory to check (default: current directory)")
|
|
325
|
+
check.set_defaults(func=cmd_check)
|
|
326
|
+
|
|
327
|
+
path = subparsers.add_parser("path", help="print the location of the packaged standard")
|
|
328
|
+
path.set_defaults(func=cmd_path)
|
|
329
|
+
|
|
330
|
+
return parser
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def main(argv: list[str] | None = None) -> int:
|
|
334
|
+
argv = list(sys.argv[1:] if argv is None else argv)
|
|
335
|
+
if argv and argv[0] == "lint":
|
|
336
|
+
return run_lint(argv[1:])
|
|
337
|
+
args = build_parser().parse_args(argv)
|
|
338
|
+
return args.func(args)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
if __name__ == "__main__":
|
|
342
|
+
sys.exit(main())
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Agent Conventions
|
|
2
|
+
|
|
3
|
+
Shared conventions for MD-DDL agents. Individual agent behaviour is defined in each agent's `AGENT.md`; this file covers cross-agent protocols that all work-performing agents follow.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Handoff Artifact Files (V2)
|
|
8
|
+
|
|
9
|
+
### Purpose
|
|
10
|
+
|
|
11
|
+
When a user closes one agent session and opens a new session with a different agent, the inline handoff context block (V1) is lost with the conversation. Handoff artifact files provide **cross-session durability** — a persistent record of decisions, rejected alternatives, and task instructions that the receiving agent can read at startup.
|
|
12
|
+
|
|
13
|
+
### Relationship to Inline Handoff Blocks (V1)
|
|
14
|
+
|
|
15
|
+
V1 and V2 are complementary, not alternative:
|
|
16
|
+
|
|
17
|
+
- **V1 (inline block)** — Required for all handoffs. Produced at the moment of handoff, lives in the conversation. Solves same-session transitions.
|
|
18
|
+
- **V2 (file)** — Optional enhancement for cross-session durability. The sending agent writes the file when the user will switch to a new session. The receiving agent reads it at startup.
|
|
19
|
+
|
|
20
|
+
The file format mirrors the inline block format — the difference is persistence. An agent implementing V2 produces the inline block first, then writes it to file if cross-session durability is needed.
|
|
21
|
+
|
|
22
|
+
### File Location
|
|
23
|
+
|
|
24
|
+
Handoff files live in the domain folder alongside `domain.md`:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
examples/Financial Crime/
|
|
28
|
+
domain.md
|
|
29
|
+
entities/
|
|
30
|
+
handoff-to-artifact.md ← written by Agent Ontology
|
|
31
|
+
handoff-to-governance.md ← written by Agent Ontology or Agent Artifact
|
|
32
|
+
handoff-to-ontology.md ← written by Agent Artifact, Architect, or Governance
|
|
33
|
+
handoff-to-architect.md ← written by Agent Ontology
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### File Naming
|
|
37
|
+
|
|
38
|
+
`handoff-to-<agent-id>.md` — the file name encodes the destination. The receiving agent looks for its own handoff file on startup.
|
|
39
|
+
|
|
40
|
+
### Frontmatter Schema
|
|
41
|
+
|
|
42
|
+
Field | Type | Required | Description
|
|
43
|
+
--- | --- | --- | ---
|
|
44
|
+
`from` | string | Yes | Sending agent ID (e.g., `agent-ontology`)
|
|
45
|
+
`to` | string | Yes | Receiving agent ID (e.g., `agent-artifact`)
|
|
46
|
+
`domain` | string | Yes | Domain name
|
|
47
|
+
`domain_path` | string | Yes | Relative path to domain.md
|
|
48
|
+
`created` | date | Yes | Date the file was written
|
|
49
|
+
`status` | enum | Yes | `pending` · `consumed` · `archived`
|
|
50
|
+
|
|
51
|
+
### Content Block Template
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
## Handoff Context — [Sending Agent] → [Receiving Agent]
|
|
55
|
+
|
|
56
|
+
**Scope:** [entities, relationships, or aspects covered]
|
|
57
|
+
|
|
58
|
+
**Key decisions:**
|
|
59
|
+
- [decision and brief rationale — especially non-obvious choices]
|
|
60
|
+
|
|
61
|
+
**Rejected alternatives:**
|
|
62
|
+
- [what was considered but not chosen, and why]
|
|
63
|
+
|
|
64
|
+
**Do not re-open:**
|
|
65
|
+
- [questions already resolved that the next agent should accept as settled]
|
|
66
|
+
|
|
67
|
+
**Task for next agent:**
|
|
68
|
+
[Clear description of what needs to be done]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Lifecycle
|
|
72
|
+
|
|
73
|
+
1. **Sending agent writes** the file at handoff time, drawing on session context. Set `status: pending`.
|
|
74
|
+
2. **Receiving agent reads** the file at session start — before loading domain files. Accept decisions marked "Do not re-open" as settled.
|
|
75
|
+
3. **Receiving agent updates** `status: consumed` in the frontmatter after reading.
|
|
76
|
+
4. **User or agent archives** the file (`status: archived`) when the work it describes is complete. Archived files are informational history.
|
|
77
|
+
|
|
78
|
+
### Multiple Handoffs to the Same Agent
|
|
79
|
+
|
|
80
|
+
Status-driven: only one `pending` file per destination agent is allowed. The previous handoff file must be `archived` before a new one is written. The receiving agent looks for the file with `status: pending`.
|
|
81
|
+
|
|
82
|
+
### Cross-Domain Handoffs
|
|
83
|
+
|
|
84
|
+
A consumer-aligned data product may span multiple domains. The handoff file lives in the primary domain's folder. The Scope section explicitly names any cross-domain entities referenced.
|
|
85
|
+
|
|
86
|
+
### Version Control
|
|
87
|
+
|
|
88
|
+
Handoff files should be committed to version control. They are living documentation of modelling decisions. `archived` files are the audit trail; `consumed` files show what the receiving agent was told. `.gitignore` should not exclude them.
|