Fix dify-builder contract gen script cwd and stale docstring paths

uv run --project selects the venv but doesn't chdir, so invoking
gen-dify-builder-contract from packages/contracts (as autofix.yml does)
raised ModuleNotFoundError: No module named 'core'. Switch to
--directory so uv chdirs into api/ before running the module. Also
update two contract_gen.py docstrings that still pointed at the old
web/app/components/dify-builder/contract/types.ts output path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Charles YaoandClaude Opus 4.8 committed 2026-09-01 00:06:31 -07:00
1 parent b4f251cd25
commit 1ef298e5fd
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -9,7 +9,7 @@ Regenerate after any change to those sources::
This writes the two checked-in derived files:
- ``api/core/dify_builder/contract_schema.json``
- ``web/app/components/dify-builder/contract/types.ts``
- ``packages/contracts/generated/dify-builder/types.ts``
Both are DERIVED -- never hand-edit them. ``tests/unit_tests/core/
dify_builder/test_contract.py::test_schema_in_lockstep`` byte-compares a
@@ -238,7 +238,7 @@ def generate() -> tuple[dict[str, Any], str]:
def main() -> None:
"""Write ``contract_schema.json`` + ``web/.../contract/types.ts`` to disk."""
"""Write ``contract_schema.json`` + ``packages/contracts/generated/dify-builder/types.ts`` to disk."""
schema, ts_source = generate()
repo_root = next(p for p in Path(__file__).parents if (p / "web").is_dir() and (p / "api").is_dir())
+1 -1
View File
@@ -38,7 +38,7 @@
"gen-enterprise-contract": "openapi-ts -f openapi-ts.enterprise.config.ts",
"gen-enterprise-app-deploy-contract": "openapi-ts -f openapi-ts.enterprise-app-deploy.config.ts",
"gen-knowledge-fs-contract": "node scripts/generate-knowledge-fs-contract.mjs",
"gen-dify-builder-contract": "uv run --project ../../api python -m core.dify_builder.contract_gen",
"gen-dify-builder-contract": "uv run --directory ../../api python -m core.dify_builder.contract_gen",
"test": "vp test",
"type-check": "tsc"
},