contractforge-ai 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- contractforge_ai-0.2.8/PKG-INFO +697 -0
- contractforge_ai-0.2.8/README.md +656 -0
- contractforge_ai-0.2.8/pyproject.toml +66 -0
- contractforge_ai-0.2.8/setup.cfg +4 -0
- contractforge_ai-0.2.8/src/contractforge_ai/__init__.py +239 -0
- contractforge_ai-0.2.8/src/contractforge_ai/adapter_validation/__init__.py +14 -0
- contractforge_ai-0.2.8/src/contractforge_ai/adapter_validation/models.py +36 -0
- contractforge_ai-0.2.8/src/contractforge_ai/adapter_validation/registry.py +45 -0
- contractforge_ai-0.2.8/src/contractforge_ai/adapter_validation/validation.py +359 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/__init__.py +41 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/context.py +84 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/generate.py +1746 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/governance.py +331 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/intent.py +316 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/models.py +233 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/planning.py +62 -0
- contractforge_ai-0.2.8/src/contractforge_ai/agentic/transform.py +348 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli.py +43 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_context_commands.py +83 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_generation_helpers.py +83 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_io.py +68 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_onboarding_commands.py +135 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_output.py +516 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_parser.py +498 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_payload.py +9 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_project_generation.py +224 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_prompt_evaluation.py +32 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_validation_commands.py +236 -0
- contractforge_ai-0.2.8/src/contractforge_ai/cli_workflows.py +153 -0
- contractforge_ai-0.2.8/src/contractforge_ai/connectors.py +312 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/__init__.py +35 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/databricks.py +159 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/knowledge.py +309 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/loaders.py +30 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/project.py +294 -0
- contractforge_ai-0.2.8/src/contractforge_ai/context/redaction.py +44 -0
- contractforge_ai-0.2.8/src/contractforge_ai/enrichment/__init__.py +23 -0
- contractforge_ai-0.2.8/src/contractforge_ai/enrichment/core.py +395 -0
- contractforge_ai-0.2.8/src/contractforge_ai/evaluation/__init__.py +53 -0
- contractforge_ai-0.2.8/src/contractforge_ai/evaluation/enrichment_quality.py +354 -0
- contractforge_ai-0.2.8/src/contractforge_ai/evaluation/prompts.py +573 -0
- contractforge_ai-0.2.8/src/contractforge_ai/evaluation/provider_live.py +392 -0
- contractforge_ai-0.2.8/src/contractforge_ai/evaluation/structured.py +209 -0
- contractforge_ai-0.2.8/src/contractforge_ai/explainers/__init__.py +6 -0
- contractforge_ai-0.2.8/src/contractforge_ai/explainers/failure.py +267 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/__init__.py +30 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/contract.py +230 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/environments.py +62 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/metadata.py +343 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/project.py +2314 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/shape.py +179 -0
- contractforge_ai-0.2.8/src/contractforge_ai/generators/targets.py +39 -0
- contractforge_ai-0.2.8/src/contractforge_ai/integrations/__init__.py +1 -0
- contractforge_ai-0.2.8/src/contractforge_ai/integrations/contractforge_naming.py +34 -0
- contractforge_ai-0.2.8/src/contractforge_ai/intelligence/__init__.py +19 -0
- contractforge_ai-0.2.8/src/contractforge_ai/intelligence/critique.py +283 -0
- contractforge_ai-0.2.8/src/contractforge_ai/intelligence/routing.py +282 -0
- contractforge_ai-0.2.8/src/contractforge_ai/models.py +318 -0
- contractforge_ai-0.2.8/src/contractforge_ai/observability/__init__.py +17 -0
- contractforge_ai-0.2.8/src/contractforge_ai/observability/control_tables.py +783 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/__init__.py +26 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/agent_assets.py +274 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/discovery.py +185 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/init.py +234 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/profiles.py +157 -0
- contractforge_ai-0.2.8/src/contractforge_ai/onboarding/provider_credentials.py +36 -0
- contractforge_ai-0.2.8/src/contractforge_ai/parity/__init__.py +11 -0
- contractforge_ai-0.2.8/src/contractforge_ai/parity/models.py +160 -0
- contractforge_ai-0.2.8/src/contractforge_ai/parity/platforms.py +135 -0
- contractforge_ai-0.2.8/src/contractforge_ai/planning/__init__.py +21 -0
- contractforge_ai-0.2.8/src/contractforge_ai/planning/platforms.py +24 -0
- contractforge_ai-0.2.8/src/contractforge_ai/planning/project.py +1018 -0
- contractforge_ai-0.2.8/src/contractforge_ai/planning/spec.py +519 -0
- contractforge_ai-0.2.8/src/contractforge_ai/project_structure/__init__.py +5 -0
- contractforge_ai-0.2.8/src/contractforge_ai/project_structure/findings.py +40 -0
- contractforge_ai-0.2.8/src/contractforge_ai/project_structure/io.py +44 -0
- contractforge_ai-0.2.8/src/contractforge_ai/project_structure/models.py +64 -0
- contractforge_ai-0.2.8/src/contractforge_ai/project_structure/validation.py +585 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/__init__.py +21 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/artifact_policy.py +60 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/guided.py +793 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/loaders.py +21 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/models.py +202 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/patching.py +175 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/siblings.py +138 -0
- contractforge_ai-0.2.8/src/contractforge_ai/projects/writer.py +82 -0
- contractforge_ai-0.2.8/src/contractforge_ai/prompts/contract_reviewer.md +12 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/__init__.py +71 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/anthropic.py +141 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/base.py +76 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/bedrock.py +164 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/capabilities.py +257 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/databricks.py +153 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/deepseek.py +129 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/env.py +146 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/factory.py +44 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/gemini.py +174 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/offline.py +21 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/openai.py +200 -0
- contractforge_ai-0.2.8/src/contractforge_ai/providers/routing.py +399 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reports.py +1982 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reports_translation.py +278 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reviewers/__init__.py +6 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reviewers/architecture.py +126 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reviewers/contract.py +413 -0
- contractforge_ai-0.2.8/src/contractforge_ai/reviewers/output.py +59 -0
- contractforge_ai-0.2.8/src/contractforge_ai/validation/__init__.py +25 -0
- contractforge_ai-0.2.8/src/contractforge_ai/validation/contractforge.py +176 -0
- contractforge_ai-0.2.8/src/contractforge_ai/validation/generated.py +307 -0
- contractforge_ai-0.2.8/src/contractforge_ai/validation/loop.py +522 -0
- contractforge_ai-0.2.8/src/contractforge_ai/write_modes.py +24 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/PKG-INFO +697 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/SOURCES.txt +164 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/dependency_links.txt +1 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/entry_points.txt +2 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/requires.txt +25 -0
- contractforge_ai-0.2.8/src/contractforge_ai.egg-info/top_level.txt +1 -0
- contractforge_ai-0.2.8/tests/test_agent_assets.py +59 -0
- contractforge_ai-0.2.8/tests/test_agentic_generation.py +682 -0
- contractforge_ai-0.2.8/tests/test_agentic_generation_fixtures.py +86 -0
- contractforge_ai-0.2.8/tests/test_agentic_transform.py +137 -0
- contractforge_ai-0.2.8/tests/test_architecture_boundaries.py +40 -0
- contractforge_ai-0.2.8/tests/test_architecture_review.py +31 -0
- contractforge_ai-0.2.8/tests/test_cli.py +1488 -0
- contractforge_ai-0.2.8/tests/test_connector_catalog_awareness.py +98 -0
- contractforge_ai-0.2.8/tests/test_contract_generator.py +165 -0
- contractforge_ai-0.2.8/tests/test_contractforge_project_generator.py +611 -0
- contractforge_ai-0.2.8/tests/test_contractforge_validation_adapter.py +82 -0
- contractforge_ai-0.2.8/tests/test_databricks_collector.py +92 -0
- contractforge_ai-0.2.8/tests/test_databricks_generation_smoke_notebook.py +13 -0
- contractforge_ai-0.2.8/tests/test_enriched_project_spec.py +367 -0
- contractforge_ai-0.2.8/tests/test_enrichment.py +371 -0
- contractforge_ai-0.2.8/tests/test_enrichment_quality.py +163 -0
- contractforge_ai-0.2.8/tests/test_failure_explainer.py +141 -0
- contractforge_ai-0.2.8/tests/test_generated_validation.py +44 -0
- contractforge_ai-0.2.8/tests/test_golden_fixtures.py +122 -0
- contractforge_ai-0.2.8/tests/test_guided_project_intelligence.py +504 -0
- contractforge_ai-0.2.8/tests/test_intelligence_critique.py +87 -0
- contractforge_ai-0.2.8/tests/test_intelligence_routing.py +82 -0
- contractforge_ai-0.2.8/tests/test_intelligence_workflow_fixtures.py +61 -0
- contractforge_ai-0.2.8/tests/test_knowledge_index.py +67 -0
- contractforge_ai-0.2.8/tests/test_metadata_generator.py +105 -0
- contractforge_ai-0.2.8/tests/test_observability_control_tables.py +265 -0
- contractforge_ai-0.2.8/tests/test_onboarding_discovery.py +61 -0
- contractforge_ai-0.2.8/tests/test_onboarding_init.py +68 -0
- contractforge_ai-0.2.8/tests/test_onboarding_profiles.py +43 -0
- contractforge_ai-0.2.8/tests/test_platform_parity.py +182 -0
- contractforge_ai-0.2.8/tests/test_project_artifacts.py +166 -0
- contractforge_ai-0.2.8/tests/test_project_context.py +65 -0
- contractforge_ai-0.2.8/tests/test_project_patching.py +150 -0
- contractforge_ai-0.2.8/tests/test_project_planner.py +265 -0
- contractforge_ai-0.2.8/tests/test_project_structure_validation.py +360 -0
- contractforge_ai-0.2.8/tests/test_prompt_evaluation.py +129 -0
- contractforge_ai-0.2.8/tests/test_provider_capabilities.py +116 -0
- contractforge_ai-0.2.8/tests/test_provider_live_evaluation.py +85 -0
- contractforge_ai-0.2.8/tests/test_provider_routing.py +116 -0
- contractforge_ai-0.2.8/tests/test_providers.py +608 -0
- contractforge_ai-0.2.8/tests/test_redaction.py +53 -0
- contractforge_ai-0.2.8/tests/test_reports.py +121 -0
- contractforge_ai-0.2.8/tests/test_review_contract.py +184 -0
- contractforge_ai-0.2.8/tests/test_review_output.py +45 -0
- contractforge_ai-0.2.8/tests/test_shape_generator.py +101 -0
- contractforge_ai-0.2.8/tests/test_structured_output_validation.py +78 -0
- contractforge_ai-0.2.8/tests/test_traceability_models.py +58 -0
- contractforge_ai-0.2.8/tests/test_user_simulated_ai_workflows.py +345 -0
- contractforge_ai-0.2.8/tests/test_validation_loop.py +263 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contractforge-ai
|
|
3
|
+
Version: 0.2.8
|
|
4
|
+
Summary: AI-assisted review, diagnostics and contract generation tools for ContractForge.
|
|
5
|
+
Author: ContractForge contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/marquesantero/contractforge-core/tree/main/ai
|
|
8
|
+
Project-URL: Documentation, https://marquesantero.github.io/contractforge-core/
|
|
9
|
+
Project-URL: Repository, https://github.com/marquesantero/contractforge-core
|
|
10
|
+
Project-URL: Issues, https://github.com/marquesantero/contractforge-core/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/marquesantero/contractforge-core/blob/main/ai/CHANGELOG.md
|
|
12
|
+
Keywords: contractforge,databricks,lakehouse,data-contracts,ai,llm
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: contractforge-core>=0.1.0
|
|
25
|
+
Requires-Dist: PyYAML>=6.0
|
|
26
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
27
|
+
Provides-Extra: openai
|
|
28
|
+
Requires-Dist: openai>=1.0; extra == "openai"
|
|
29
|
+
Provides-Extra: aws
|
|
30
|
+
Requires-Dist: boto3>=1.34; extra == "aws"
|
|
31
|
+
Provides-Extra: databricks
|
|
32
|
+
Requires-Dist: contractforge-databricks>=0.1.0; extra == "databricks"
|
|
33
|
+
Provides-Extra: aws-adapter
|
|
34
|
+
Requires-Dist: contractforge-aws>=0.1.0; extra == "aws-adapter"
|
|
35
|
+
Provides-Extra: snowflake-adapter
|
|
36
|
+
Requires-Dist: contractforge-snowflake>=0.1.0; extra == "snowflake-adapter"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
40
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
41
|
+
|
|
42
|
+
# ContractForge AI
|
|
43
|
+
|
|
44
|
+
ContractForge AI is the AI-assisted companion package for [ContractForge](https://github.com/marquesantero/contractforge-core). It provides contract review, diagnostics, annotation suggestions and project-generation guidance without coupling deterministic ingestion to a specific model provider.
|
|
45
|
+
|
|
46
|
+
The ingestion engine remains deterministic. ContractForge AI reads contracts, control-table evidence and selected samples, then produces structured recommendations for humans and CI workflows.
|
|
47
|
+
|
|
48
|
+
ContractForge AI is distributed as its own wheel in the ContractForge monorepo. It requires `contractforge-core` for contract validation, naming policy and semantic normalization. Runtime adapters such as `contractforge-databricks` and `contractforge-aws` remain optional and are used only when an AI workflow needs platform-specific execution or deployment guidance.
|
|
49
|
+
|
|
50
|
+
## Initial Capabilities
|
|
51
|
+
|
|
52
|
+
- Deterministic contract review with risk findings before invoking any model.
|
|
53
|
+
- Deterministic failure explanation from ContractForge run/error evidence.
|
|
54
|
+
- Deterministic annotation and quality-rule suggestions from schema/profile metadata.
|
|
55
|
+
- Project scaffold generation for ContractForge YAML, thin Python wrappers, Databricks Asset Bundles, dbt and classic PySpark migration projects.
|
|
56
|
+
- Integration profiles and redacted environment discovery for local, CI, Databricks and agent onboarding.
|
|
57
|
+
- Repository instruction asset generation for coding assistants and IDE agents.
|
|
58
|
+
- Local knowledge indexing for contract repositories, documentation, sample context and reviewed examples.
|
|
59
|
+
- Shared evidence, confidence, assumptions and review-required output model.
|
|
60
|
+
- Provider abstraction for future LLM integrations.
|
|
61
|
+
- OpenAI and Azure OpenAI provider configuration with optional SDK dependency.
|
|
62
|
+
- Provider capability registry for structured-output strategy, transport and Databricks runtime dependency decisions.
|
|
63
|
+
- Secret redaction utilities for safe context assembly.
|
|
64
|
+
- CLI entry point for local and CI usage.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install contractforge-ai
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This installs `contractforge-core` as the deterministic validation dependency. Install provider and adapter extras only when a workflow needs live model enrichment or platform-specific project execution.
|
|
73
|
+
|
|
74
|
+
Adapter-aware examples:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install "contractforge-ai[databricks]"
|
|
78
|
+
pip install "contractforge-ai[aws-adapter]"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
For local development:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install -e ".[dev]"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
The package can run useful checks without configuring a model provider.
|
|
90
|
+
|
|
91
|
+
Inspect the local setup:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
contractforge-ai environment-report
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The report separates package availability into `contractforge` (`contractforge_core`, `contractforge_ai`), optional `adapters` (`contractforge_databricks`, `contractforge_aws`), parser dependencies, provider clients and platform SDKs. Missing adapters are informational unless the workflow asks for adapter-aware validation or platform execution guidance.
|
|
98
|
+
|
|
99
|
+
ContractForge AI does not import adapter packages or platform SDKs at package import time. Adapter planning is reached through the optional adapter public APIs, and provider/runtime SDKs are imported only inside the specific workflow that needs them. This keeps local deterministic review usable without Databricks, AWS, Spark or Glue dependencies installed.
|
|
100
|
+
|
|
101
|
+
List supported integration profiles:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
contractforge-ai profiles
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Validate a Databricks job-oriented setup:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
contractforge-ai profile databricks-job --config databricks-profile.json --format json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Generate non-secret onboarding files:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
contractforge-ai init --profile local-cli --output-dir ./contractforge-ai-setup
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Generate repository instructions for coding assistants:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
contractforge-ai agent-instructions --target all --project-name "Orders Platform" --output-dir .
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Build a local knowledge index from reviewed documentation, contracts and examples:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
contractforge-ai knowledge-index build docs contracts examples --output .contractforge-ai/knowledge.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Query the index with citations before attaching model-backed enrichment:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
contractforge-ai knowledge-index query \
|
|
135
|
+
--index .contractforge-ai/knowledge.json \
|
|
136
|
+
--query "How should serverless object storage access be configured?"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The knowledge index is deterministic and local. It redacts common secret patterns, stores source paths and line ranges, and is intended to provide grounded context to future AI planning, critique and project-generation workflows.
|
|
140
|
+
|
|
141
|
+
Route a user intent to the appropriate ContractForge AI workflow:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
contractforge-ai route-task \
|
|
145
|
+
--intent "Generate a shape for nested JSON with arrays" \
|
|
146
|
+
--knowledge-index .contractforge-ai/knowledge.json \
|
|
147
|
+
--format markdown
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Task routing selects the high-level workflow, prompt template, provider-routing task and relevant local context. It is designed to run before model calls so provider-backed enrichment receives focused, cited context instead of a large unstructured prompt.
|
|
151
|
+
|
|
152
|
+
For low-risk advisory tasks, such as metadata commentary or review enrichment, task routing can prefer HTTP-only providers to avoid extra SDK dependencies in constrained runtimes:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
contractforge-ai route-task \
|
|
156
|
+
--intent "Review this contract and summarize low-risk metadata improvements" \
|
|
157
|
+
--knowledge-index .contractforge-ai/knowledge.json \
|
|
158
|
+
--prefer-http-only \
|
|
159
|
+
--format markdown
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`--prefer-http-only` is a routing preference, not a quality override. Workflows that generate project plans, contracts or deployable artifacts still require strict structured-output support even when HTTP-only routing is preferred.
|
|
163
|
+
|
|
164
|
+
Generate a complete intent-first ContractForge project from a natural-language request:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
contractforge-ai generate \
|
|
168
|
+
--prompt "Use table main.raw.orders_sample and create a bronze to gold project. Silver must use hash_diff_upsert. Gold final columns: order_id, customer_id, amount, order_date, status." \
|
|
169
|
+
--schema schemas/orders.json \
|
|
170
|
+
--output-dir ./generated/orders-medallion
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`generate` is the most direct project-creation path. It interprets the user intent, builds a bronze/silver/gold ContractForge structure when the prompt asks for a medallion flow, chains layer outputs as layer inputs, writes split ingestion/annotations/operations contracts and consolidates review guidance into `AI_REVIEW.html`.
|
|
174
|
+
|
|
175
|
+
When the prompt explicitly names a supported adapter such as AWS Glue or Databricks, generated `project.yaml` includes the matching environment entry and each project step points that adapter to the same canonical ingestion contract. ContractForge AI does not fork contract semantics by platform. The generated adapter environment is a deployment scaffold with review-required runtime values; it is not allowed to change source, target, write mode, quality, access or transform intent.
|
|
176
|
+
|
|
177
|
+
AWS-oriented intent:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
contractforge-ai generate \
|
|
181
|
+
--prompt "Create an AWS Glue bronze project from s3://landing/orders into analytics.bronze.b_orders using append." \
|
|
182
|
+
--schema schemas/orders.json \
|
|
183
|
+
--output-dir ./generated/orders-aws
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Databricks-oriented intent:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
contractforge-ai generate \
|
|
190
|
+
--prompt "Create a Databricks Asset Bundle bronze project from /Volumes/raw/orders into main.bronze.b_orders using append." \
|
|
191
|
+
--schema schemas/orders.json \
|
|
192
|
+
--output-dir ./generated/orders-databricks
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Both forms keep the generated ingestion contract portable. The project metadata differs only by environment binding, for example `environments/aws.environment.yaml` or `environments/databricks.environment.yaml`, until an adapter deploy command materializes platform-native artifacts.
|
|
196
|
+
|
|
197
|
+
Provider-backed guided generation can add allowlisted draft fields such as `source_format`, `transform`, `shape`, `quality_rules`, `annotations` and `operations`. It cannot silently overwrite deterministic identity fields such as connector, source path, target, layer or write mode. Conflicting provider proposals are rejected and recorded in the provider proposal audit; provider-filled missing identity values remain review-required. Provider-suggested fields that can change contract behavior or deployment behavior, such as `transform`, `shape`, `quality_rules`, `annotations`, `operations` and `dab_compute`, are always review-required even when the provider claims high confidence. Unsupported runtime fields, secrets or deployment settings are rejected and audited instead of being written into generated contracts.
|
|
198
|
+
|
|
199
|
+
When no schema file is available, provide an inspectable Databricks table as schema evidence:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
contractforge-ai generate \
|
|
203
|
+
--prompt "Create a bronze to gold orders pipeline from the example table and keep only order_id, customer_id, amount and status in gold." \
|
|
204
|
+
--sample-table main.raw.orders_sample \
|
|
205
|
+
--default-catalog main \
|
|
206
|
+
--output-dir ./generated/orders-medallion
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Use `--with-ai --provider <provider>` when configured model guidance should enrich the review report. ContractForge AI still validates the generated artifacts locally and keeps unresolved business decisions explicit, especially keys, SCD behavior, quality gates, PII handling and ownership.
|
|
210
|
+
|
|
211
|
+
When a human-facing report should be delivered in another language, pass `--language <language>` together with `--with-ai`. ContractForge AI first renders the canonical English report, then asks the selected provider to translate narrative prose. Technical labels, statuses, paths, commands, JSON/YAML and code remain in English.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
contractforge-ai generate \
|
|
215
|
+
--prompt "Create a bronze to gold orders pipeline from main.raw.orders_sample." \
|
|
216
|
+
--sample-table main.raw.orders_sample \
|
|
217
|
+
--with-ai \
|
|
218
|
+
--provider openai \
|
|
219
|
+
--language pt-BR \
|
|
220
|
+
--output-dir ./generated/orders-medallion
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Validate generated or AI-reviewed artifacts before treating them as ready:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
contractforge-ai validate-artifact \
|
|
227
|
+
--contract contracts/bronze/orders.ingestion.yaml \
|
|
228
|
+
--format markdown
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The deterministic validation gate normalizes results to `READY`, `NEEDS_DECISIONS`, `INVALID` or `UNSAFE`. It can validate generated ContractForge contracts, generated project plans and provider structured outputs. Provider text never overrides these deterministic statuses.
|
|
232
|
+
|
|
233
|
+
Validate a real ContractForge project folder, including `project.yaml`, environment YAMLs, reusable connection YAMLs and split contract bundles:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
contractforge-ai validate-project-structure ./examples/real-world/supabase-jdbc-medallion --format markdown
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This gate reuses ContractForge Core for environment validation, connection resolution, bundle composition and semantic normalization. ContractForge AI adds CI-friendly findings for project-level mistakes such as legacy flat contract fields, missing connection files, wrapped split sections and inline secrets. Ingestion-level source settings override the reusable connection YAML after the connection is loaded by the core.
|
|
240
|
+
|
|
241
|
+
When adapter packages are installed, add explicit adapter planning gates:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
contractforge-ai validate-project-structure ./examples/real-world/supabase-jdbc-medallion \
|
|
245
|
+
--adapter databricks \
|
|
246
|
+
--adapter aws \
|
|
247
|
+
--format markdown
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Adapter-aware validation calls the public adapter planners only. It does not execute jobs or create infrastructure. `SUPPORTED` remains ready, `SUPPORTED_WITH_WARNINGS` and `REVIEW_REQUIRED` require decisions, and `UNSUPPORTED` fails the gate.
|
|
251
|
+
|
|
252
|
+
Provider-backed explanations can be layered over adapter validation through the `adapter.validation.enrichment.v1` prompt, but the deterministic adapter status remains authoritative.
|
|
253
|
+
|
|
254
|
+
Run second-pass critique over generated or model-enriched output:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
contractforge-ai critique-output \
|
|
258
|
+
--input enriched-project-plan.json \
|
|
259
|
+
--validation validation-report.json \
|
|
260
|
+
--context retrieved-context.json \
|
|
261
|
+
--format markdown
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Critique scoring checks evidence coverage, unresolved decisions, readiness claims, validation failures and contract-boundary mistakes such as metadata being placed inside transformation logic.
|
|
265
|
+
|
|
266
|
+
Review a contract:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Review a separated ContractForge contract bundle by loading sibling annotations and operations files:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --bundle
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Optionally attach provider-backed advisory enrichment while keeping deterministic findings authoritative:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --with-ai --format json
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Return JSON for CI or automation:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --format json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Render a pull-request friendly Markdown report:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --format markdown
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Fail CI when high-risk findings are present:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --fail-on high
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Fail CI for a specific deterministic finding:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
contractforge-ai review contracts/silver/orders.ingestion.yaml --fail-on-code write.keys.nullable
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Explain a failed run from JSON evidence:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
contractforge-ai explain-run --input failed-run.json
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Optionally enrich the deterministic explanation:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
contractforge-ai explain-run --input failed-run.json --with-ai --format json
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Explain a Databricks run by collecting ContractForge control-table evidence:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
contractforge-ai explain-run \
|
|
324
|
+
--run-id 264f171c-83e9-43f5-baea-c0391838145a \
|
|
325
|
+
--catalog main \
|
|
326
|
+
--ctrl-schema ops \
|
|
327
|
+
--format json
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Return JSON for automation:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
contractforge-ai explain-run --input failed-run.json --format json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Analyze aggregate ContractForge control-table evidence:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
contractforge-ai analyze-control-tables \
|
|
340
|
+
--input control-table-evidence.json \
|
|
341
|
+
--format markdown
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Attach provider-backed operational guidance while keeping deterministic metrics and findings authoritative:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
contractforge-ai analyze-control-tables \
|
|
348
|
+
--input control-table-evidence.json \
|
|
349
|
+
--with-ai \
|
|
350
|
+
--provider openai \
|
|
351
|
+
--language pt-BR \
|
|
352
|
+
--format html
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The control-table analyzer accepts redacted JSON evidence with keys such as `runs`, `errors`, `quality`, `streams`, `schema_changes`, `operations` and `collection_errors`. It produces status/risk, aggregate metrics, deterministic findings, recommendations and follow-up SQL queries.
|
|
356
|
+
|
|
357
|
+
The analyzer also detects recurring failure clusters by target/runtime/connector, repeated authentication/network/dependency error categories, schema drift, quality degradation, stream metric inconsistencies, duration outliers and freshness SLA breaches when operations evidence includes SLA lag fields.
|
|
358
|
+
|
|
359
|
+
Example failure evidence:
|
|
360
|
+
|
|
361
|
+
```json
|
|
362
|
+
{
|
|
363
|
+
"run": {
|
|
364
|
+
"run_id": "264f171c-83e9-43f5-baea-c0391838145a",
|
|
365
|
+
"status": "FAILED",
|
|
366
|
+
"target_table": "workspace.cf_examples_bronze.b_cdc_covid",
|
|
367
|
+
"source_connector": "http_file",
|
|
368
|
+
"runtime_type": "serverless",
|
|
369
|
+
"error_message": "urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>"
|
|
370
|
+
},
|
|
371
|
+
"errors": [
|
|
372
|
+
{
|
|
373
|
+
"stack_trace": "Full stack trace or ctrl_ingestion_errors payload"
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Initial deterministic categories include authentication/authorization, network/egress, storage access, schema/SQL, quality gates, missing dependency/driver, runtime limitation and API rate/quota failures.
|
|
380
|
+
|
|
381
|
+
Suggest annotations and quality rules from schema/profile metadata:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
contractforge-ai suggest-metadata --schema schema-profile.json --format yaml
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Suggestions include evidence and confidence in JSON/text output. Treat them as reviewable drafts, not automatic contract changes.
|
|
388
|
+
|
|
389
|
+
Suggest shape configuration from nested JSON samples:
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
contractforge-ai suggest-shape --sample sample.json --format yaml
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Array explosions are marked for review because they can multiply row counts.
|
|
396
|
+
|
|
397
|
+
Generate a draft ingestion contract:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
contractforge-ai generate-contract \
|
|
401
|
+
--schema schema-profile.json \
|
|
402
|
+
--connector files \
|
|
403
|
+
--source-path /Volumes/main/landing/orders \
|
|
404
|
+
--target-catalog main \
|
|
405
|
+
--target-schema bronze \
|
|
406
|
+
--target-table b_orders
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Generated contracts are marked as drafts and include review-required metadata.
|
|
410
|
+
|
|
411
|
+
Generate a reviewable project scaffold:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
contractforge-ai generate-project \
|
|
415
|
+
--target dbt \
|
|
416
|
+
--schema schema-profile.json \
|
|
417
|
+
--project-name orders_analytics \
|
|
418
|
+
--connector files \
|
|
419
|
+
--source-path /Volumes/main/landing/orders \
|
|
420
|
+
--target-catalog main \
|
|
421
|
+
--target-schema bronze \
|
|
422
|
+
--target-table b_orders \
|
|
423
|
+
--output-dir ./generated/orders-dbt
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Project targets currently include `contractforge-yaml`, `contractforge-python`, `databricks-dab`, `aws-glue-iceberg`, `dbt` and `classic-pyspark`. The `contractforge-yaml` target emits canonical split contracts. The `databricks-dab` and `aws-glue-iceberg` targets keep ingestion behavior in the same split contracts and add only adapter deployment scaffolding. The `contractforge-python` target validates through `contractforge-core` by default and exposes explicit adapter actions such as `plan-databricks`, `run-databricks` and `plan-aws`. Generated scaffolds include reviewable docs such as `README.md`, `DECISIONS.md`, `RUNBOOK.md` and `VALIDATION.md`.
|
|
427
|
+
|
|
428
|
+
Planner platform hints come from explicit platform or platform-service wording, not storage locations alone. `s3://...` selects the `s3` connector but does not force AWS; `iceberg` can describe table format without forcing the AWS adapter. If no platform is named and multiple adapters support the connector, planning can recommend multiple adapter targets for the same contract intent.
|
|
429
|
+
|
|
430
|
+
Generate an AWS Glue/Iceberg project scaffold:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
contractforge-ai generate-project \
|
|
434
|
+
--target aws-glue-iceberg \
|
|
435
|
+
--schema schema-profile.json \
|
|
436
|
+
--project-name orders_aws \
|
|
437
|
+
--connector s3 \
|
|
438
|
+
--source-path s3://landing/orders \
|
|
439
|
+
--target-catalog analytics \
|
|
440
|
+
--target-schema bronze \
|
|
441
|
+
--target-table b_orders \
|
|
442
|
+
--output-dir ./generated/orders-aws
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The AWS target writes contracts under `contracts/aws/...`, generates `environments/aws.environment.yaml`, and uses syntactically valid review placeholders such as `s3://review-required-...` so deterministic project validation can run the AWS adapter planner before real S3, Glue and IAM values are filled.
|
|
446
|
+
|
|
447
|
+
Generated artifact names follow the core ContractForge naming policy. Use a naming override file when a scaffold needs explicit contract, bundle, job or task names:
|
|
448
|
+
|
|
449
|
+
```yaml
|
|
450
|
+
policy: caf_default
|
|
451
|
+
logical_name: orders_platform
|
|
452
|
+
contract_basename: orders_contract
|
|
453
|
+
bundle_name: orders-bundle
|
|
454
|
+
job_name: Orders Ingestion
|
|
455
|
+
task_key: orders_ingestion_task
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
contractforge-ai generate-project \
|
|
460
|
+
--target databricks-dab \
|
|
461
|
+
--schema schema-profile.json \
|
|
462
|
+
--project-name orders \
|
|
463
|
+
--connector files \
|
|
464
|
+
--source-path /Volumes/main/landing/orders \
|
|
465
|
+
--target-catalog main \
|
|
466
|
+
--target-schema bronze \
|
|
467
|
+
--target-table b_orders \
|
|
468
|
+
--naming-file naming.yaml
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Plan a project from natural language before generating files:
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
contractforge-ai plan-project \
|
|
475
|
+
--intent "Create a silver ingestion from s3a://landing/orders into main.silver.orders using hash_diff_upsert." \
|
|
476
|
+
--schema schemas/orders.json \
|
|
477
|
+
--format markdown
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Planner output is review-only. It lists missing decisions and recommended `generate-project` commands; it does not write files or deploy resources.
|
|
481
|
+
|
|
482
|
+
Optional provider-backed enrichment can be attached with `--with-ai`, but the deterministic planner result remains authoritative:
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
contractforge-ai plan-project \
|
|
486
|
+
--intent "Create a silver ingestion from s3a://landing/orders into main.silver.orders using hash_diff_upsert." \
|
|
487
|
+
--schema schemas/orders.json \
|
|
488
|
+
--with-ai \
|
|
489
|
+
--format json
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Generate directly from the reviewed planning path when the scenario is ready enough to scaffold:
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
contractforge-ai guided-project \
|
|
496
|
+
--intent "Create a bronze ingestion from https://example.com/orders.csv into main.bronze.b_orders." \
|
|
497
|
+
--schema schemas/orders.json \
|
|
498
|
+
--target databricks-dab \
|
|
499
|
+
--output-dir ./generated/orders-dab
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Use `--with-ai` when a configured provider should help refine the project specification before files are generated:
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
contractforge-ai guided-project \
|
|
506
|
+
--intent "Create a bronze ingestion from https://example.com/events into main.bronze.b_events. The source returns nested JSON payloads." \
|
|
507
|
+
--schema schemas/events.json \
|
|
508
|
+
--target contractforge-yaml \
|
|
509
|
+
--with-ai \
|
|
510
|
+
--provider openai \
|
|
511
|
+
--allow-review-required \
|
|
512
|
+
--output-dir ./generated/events
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
In this path the model does not only write a side report. ContractForge AI first builds an `EnrichedProjectSpec`, asks the provider for structured field updates, validates the response locally, then generates artifacts from the enriched spec. Evidence-backed technical suggestions can be applied to generated draft files, for example `source.format`, full `transform` blocks, `quality_rules`, `annotations` and `operations`. Full transform blocks remain review-required until a human approves the schema/value/cardinality impact.
|
|
516
|
+
|
|
517
|
+
Prompt-explicit values are also carried deterministically when they are clear enough to be materialized. For example, a prompt can provide owners, criticality, freshness SLA, required columns, unique keys, accepted values, expression checks and DAB compute preference such as serverless, existing cluster or job cluster.
|
|
518
|
+
|
|
519
|
+
Business-critical fields stay review-required even when the provider suggests them. Examples include merge keys, hash-diff columns, ownership, SLA, delete semantics, legal PII policy and credentials.
|
|
520
|
+
|
|
521
|
+
Generate from a context directory when no explicit schema file exists yet:
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
contractforge-ai guided-project \
|
|
525
|
+
--intent "Create a bronze ingestion from /landing/orders into main.bronze.b_orders." \
|
|
526
|
+
--context-dir samples/orders \
|
|
527
|
+
--runtime databricks-serverless \
|
|
528
|
+
--target contractforge-yaml \
|
|
529
|
+
--allow-review-required \
|
|
530
|
+
--output-dir ./generated/orders
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Context-aware generation inspects supported local samples such as JSON, JSONL and CSV, creates a reviewable inferred schema profile when possible, and writes `CONTEXT.md` plus `context/context-package.json` into the generated project. Deterministic validation still remains authoritative; context evidence is not treated as proof that a sample covers the whole source.
|
|
534
|
+
|
|
535
|
+
`guided-project` refuses to write files when required decisions remain open. Pass `--allow-review-required` only when the goal is to create a review scaffold with explicit placeholders, unresolved decisions and a rich HTML review.
|
|
536
|
+
|
|
537
|
+
When a guided project is materialized, the result includes deterministic validation and second-pass critique sections. These gates classify the scaffold as `READY`, `NEEDS_DECISIONS`, `INVALID` or `UNSAFE`; generated project files are still review artifacts until those gates and the decision report are clean. The generated rich HTML review consolidates the requested intent, inferred specification, generated artifacts, validation status and unresolved decisions.
|
|
538
|
+
|
|
539
|
+
For repeatable guided generation, use a reviewed requirements file:
|
|
540
|
+
|
|
541
|
+
```yaml
|
|
542
|
+
intent: Create a bronze ingestion from https://example.com/orders.csv into main.bronze.b_orders.
|
|
543
|
+
schema_path: schemas/orders.json
|
|
544
|
+
# Or use context_dir when schema_path is not available yet.
|
|
545
|
+
# context_dir: samples/orders
|
|
546
|
+
runtime: databricks-serverless
|
|
547
|
+
default_catalog: main
|
|
548
|
+
default_schema: bronze
|
|
549
|
+
default_layer: bronze
|
|
550
|
+
preferred_target: contractforge-yaml
|
|
551
|
+
allow_review_required: false
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
contractforge-ai guided-project \
|
|
556
|
+
--requirements requirements/orders-project.yaml \
|
|
557
|
+
--output-dir ./generated/orders
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Evaluate enrichment quality against a deterministic baseline:
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
contractforge-ai eval-enrichment \
|
|
564
|
+
--deterministic deterministic.json \
|
|
565
|
+
--enrichment enriched.json \
|
|
566
|
+
--kind project_plan \
|
|
567
|
+
--format markdown
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
The test suite includes deterministic workflow fixtures for project planning, task routing, provider-output validation and control-table incidents. These fixtures are intended to catch regressions in status, decisions, evidence and validation behavior before provider-backed tests are enabled.
|
|
571
|
+
|
|
572
|
+
Provider quality evaluation also rejects readiness claims that contradict deterministic status. If the baseline is `NEEDS_DECISIONS`, `INVALID`, `UNSAFE`, `UNSUPPORTED` or `FAIL`, provider summaries and recommendations must not claim the project is ready to deploy, publish, run or proceed.
|
|
573
|
+
|
|
574
|
+
## Provider Configuration
|
|
575
|
+
|
|
576
|
+
ContractForge AI can run deterministic checks without any model provider. Configure a provider only when model-enriched explanations or generation features are enabled.
|
|
577
|
+
|
|
578
|
+
Install provider dependencies:
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
pip install "contractforge-ai[openai]"
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
OpenAI:
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
export CONTRACTFORGE_AI_PROVIDER=openai
|
|
588
|
+
export CONTRACTFORGE_AI_MODEL=gpt-4.1
|
|
589
|
+
export OPENAI_API_KEY=...
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
Azure OpenAI:
|
|
593
|
+
|
|
594
|
+
```bash
|
|
595
|
+
export CONTRACTFORGE_AI_PROVIDER=azure_openai
|
|
596
|
+
export CONTRACTFORGE_AI_MODEL=<deployment-name>
|
|
597
|
+
export AZURE_OPENAI_API_KEY=...
|
|
598
|
+
export AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com
|
|
599
|
+
export AZURE_OPENAI_API_VERSION=<api-version>
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
Databricks Model Serving:
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
export CONTRACTFORGE_AI_PROVIDER=databricks
|
|
606
|
+
export CONTRACTFORGE_AI_MODEL=<serving-endpoint-name>
|
|
607
|
+
export DATABRICKS_HOST=https://<workspace-host>
|
|
608
|
+
export DATABRICKS_TOKEN=...
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
DeepSeek:
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
export CONTRACTFORGE_AI_PROVIDER=deepseek
|
|
615
|
+
export CONTRACTFORGE_AI_MODEL=deepseek-chat
|
|
616
|
+
export DEEPSEEK_API_KEY=...
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Anthropic:
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
export CONTRACTFORGE_AI_PROVIDER=anthropic
|
|
623
|
+
export CONTRACTFORGE_AI_MODEL=claude-sonnet-4-5
|
|
624
|
+
export ANTHROPIC_API_KEY=...
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
Google Gemini API:
|
|
628
|
+
|
|
629
|
+
```bash
|
|
630
|
+
export CONTRACTFORGE_AI_PROVIDER=gemini
|
|
631
|
+
export CONTRACTFORGE_AI_MODEL=gemini-2.5-flash
|
|
632
|
+
export GEMINI_API_KEY=...
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
AWS Bedrock:
|
|
636
|
+
|
|
637
|
+
```bash
|
|
638
|
+
pip install "contractforge-ai[aws]"
|
|
639
|
+
export CONTRACTFORGE_AI_PROVIDER=bedrock
|
|
640
|
+
export CONTRACTFORGE_AI_MODEL=anthropic.claude-3-5-sonnet-20240620-v1:0
|
|
641
|
+
export AWS_REGION=us-east-1
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Provider settings are redacted before being returned in diagnostics. Providers receive already-prepared prompts/context and should not read files, resolve secrets or query Databricks directly.
|
|
645
|
+
|
|
646
|
+
Provider capabilities are explicit. OpenAI and Azure OpenAI can use strict structured-output controls, DeepSeek is OpenAI-compatible but JSON-mode only, Anthropic uses tool schema, Gemini uses native JSON schema through `generateContent`, Bedrock uses Converse tool schema through `boto3`, and Databricks Model Serving depends on the served endpoint/model. See [Provider configuration](docs/providers.md) for the current matrix and planned provider registry.
|
|
647
|
+
|
|
648
|
+
Evaluate a configured provider before using it in reviewed workflows:
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
contractforge-ai eval-provider --provider openai --format markdown
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Recommend a provider for a task without calling a model:
|
|
655
|
+
|
|
656
|
+
```bash
|
|
657
|
+
contractforge-ai route-provider --task project_planning --require-strict-schema
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
## Documentation
|
|
661
|
+
|
|
662
|
+
- [Getting started](docs/getting-started.md)
|
|
663
|
+
- [Onboarding profiles](docs/onboarding.md)
|
|
664
|
+
- [Agent and IDE instruction assets](docs/agent-instructions.md)
|
|
665
|
+
- [Security model](docs/security.md)
|
|
666
|
+
- [CI usage](docs/ci.md)
|
|
667
|
+
- [Databricks notebook usage](docs/databricks.md)
|
|
668
|
+
- [Provider configuration](docs/providers.md)
|
|
669
|
+
- [Evidence and confidence model](docs/evidence.md)
|
|
670
|
+
- [Evaluation and regression fixtures](docs/evaluation.md)
|
|
671
|
+
- [Enrichment quality evaluation](docs/enrichment-evaluation.md)
|
|
672
|
+
- [Prompt evaluation harness](docs/prompt-evaluation.md)
|
|
673
|
+
- [Project structure validation](docs/project-structure-validation.md)
|
|
674
|
+
- [Metadata and quality suggestions](docs/suggestions.md)
|
|
675
|
+
- [Shape suggestions](docs/shape.md)
|
|
676
|
+
- [Contract draft generation](docs/contract-generation.md)
|
|
677
|
+
- [Natural-language project planning](docs/project-planning.md)
|
|
678
|
+
- [Project generation core](docs/project-generation.md)
|
|
679
|
+
- [Architecture](docs/architecture.md)
|
|
680
|
+
|
|
681
|
+
## Design Principles
|
|
682
|
+
|
|
683
|
+
- **Companion package over the semantic core**: ContractForge AI depends on `contractforge-core` so validation, naming and contract semantics stay aligned. Platform adapters remain optional execution boundaries.
|
|
684
|
+
- **Deterministic checks first**: hard rules catch known risks before any LLM suggestion is requested.
|
|
685
|
+
- **Provider-neutral**: OpenAI, Azure OpenAI, Databricks Serving or local models can be added behind the same interface.
|
|
686
|
+
- **Redaction by default**: secrets, tokens and passwords are removed before context is sent to a model.
|
|
687
|
+
- **Human-reviewed output**: the tool proposes changes; it does not mutate production contracts or data without explicit user action.
|
|
688
|
+
- **Current-practice review before implementation**: AI-facing features require multi-source research into current implementation guidance, security risks, RAG practices, prompt engineering and eval strategy before code changes.
|
|
689
|
+
|
|
690
|
+
## Roadmap
|
|
691
|
+
|
|
692
|
+
- Contract reviewer with LLM-enriched recommendations.
|
|
693
|
+
- Failure explainer based on `ctrl_ingestion_runs` and `ctrl_ingestion_errors`.
|
|
694
|
+
- Annotation and quality-rule suggestions.
|
|
695
|
+
- Shape generator for nested JSON and arrays.
|
|
696
|
+
- Contract generator from source schema, sample payloads or existing notebooks.
|
|
697
|
+
- Additional project generation targets and optional model-enriched planning.
|