Skip to content

Add --ontology-file support for custom domain YAMLs#51

Open
unshDee wants to merge 3 commits into
neo4j-labs:mainfrom
unshDee:feat/manual-ontology-support
Open

Add --ontology-file support for custom domain YAMLs#51
unshDee wants to merge 3 commits into
neo4j-labs:mainfrom
unshDee:feat/manual-ontology-support

Conversation

@unshDee

@unshDee unshDee commented May 27, 2026

Copy link
Copy Markdown
Contributor

Adds support for the documented --ontology-file CLI option so users can scaffold a project from an existing custom domain ontology YAML file (#50)

This matches the manual custom-domain workflow described in the docs

Changes

  • Add --ontology-file FILE to the CLI.
  • Load and validate ontology YAML files with the existing load_domain_from_path() helper.
  • Preserve the raw ontology YAML so generated projects include it at data/ontology.yaml.
  • Make --domain, --ontology-file, and --custom-domain mutually exclusive.
  • Allow saved custom domains in ~/.create-context-graph/custom-domains/ to be loaded by domain id.
  • Add regression coverage for the new CLI path and saved custom-domain loading.

unshDee added 2 commits May 27, 2026 22:17
Add --ontology-file to load a custom domain ontology YAML directly, matching the documented manual custom-domain workflow.
Also allow saved custom domains to be loaded by domain id from the user custom-domains directory.
Copilot AI review requested due to automatic review settings May 27, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for loading custom domain ontologies from a file in the CLI and enhances domain loading to locate saved custom domains by the domain id declared in YAML (not just filename).

Changes:

  • Add --ontology-file CLI option, including mutual exclusivity with --domain / --custom-domain.
  • Enhance load_domain() to search the custom domains directory for YAML files whose declared domain.id matches the requested ID.
  • Add test coverage for the new CLI flag and custom-domain lookup behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_custom_domain.py Adds test ensuring saved custom domain YAMLs can be loaded by declared domain.id.
tests/test_cli.py Adds integration tests for --ontology-file, project-name auto-generation, and flag exclusivity.
src/create_context_graph/ontology.py Extends load_domain() to search custom domain YAMLs by declared ID.
src/create_context_graph/cli.py Adds --ontology-file flag, validation, and scaffolding behavior using a provided ontology YAML.
README.md Documents the new --ontology-file CLI option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/create_context_graph/ontology.py
Comment thread src/create_context_graph/ontology.py
Comment thread src/create_context_graph/cli.py Outdated
Comment thread src/create_context_graph/cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
@unshDee unshDee requested a review from Copilot May 28, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment on lines +263 to +266
if (
isinstance(candidate_data, dict)
and candidate_data.get("domain", {}).get("id") == domain_id
):
Comment on lines +338 to +340
try:
custom_domain_yaml = ontology_file.read_text()
custom_ontology = load_domain_from_path(ontology_file)
Comment thread tests/test_cli.py
Comment on lines +29 to +30
REPO_ROOT = Path(__file__).resolve().parents[1]
HEALTHCARE_ONTOLOGY = REPO_ROOT / "src" / "create_context_graph" / "domains" / "healthcare.yaml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants