knowledge-catalog
OtherGoogleCloudPlatform/knowledge-catalog
Tools and samples for Google Cloud Knowledge Catalog, an AI-powered metadata platform.
Overview
This repository provides tools, agents, and samples that demonstrate Google Cloud Knowledge Catalog (formerly Dataplex) features. It helps users build context management, enrichment, and retrieval solutions for structured and unstructured data, powered by an AI-driven knowledge graph.
README Preview
# Knowledge Catalog\n\n[Knowledge Catalog](https://cloud.google.com/products/knowledge-catalog) (formerly Dataplex), is an AI-powered data catalog and metadata management platform. It provides a dynamic knowledge graph of all your data, structured and unstructured, to provide semantics and business context to AI agents\n\nThis repository features tools, agents, and samples that demonstrate Knowledge Catalog features, and building context management, enrichment and retrieval solutions.\n\n\n## Getting Started\n\n[](https://console.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2FGoogleCloudPlatform%2Fknowledge-catalog.git)\n\n\n## Contributing\n\nSee the contributing [instructions](CONTRIBUTING.md) to get started contributed.\n\n\n## License\n\nAll solutions within this repository are provided under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license. Please see [LICENSE](LICENSE.md) for more detailed terms and conditions.\n\n\n## Disclaimer\n\nThis repository and its contents are not an official Google product.\n
FAQ (5)
TroubleshootingWhy does `kcmd init` exit with code 0 even when it fails with a 403?
This is caused by src/tool/main.ts discarding the exit code returned by commands.init(). Replace await commands.init(options); with:
const exitCode = await commands.init(options);
process.exit(exitCode);
This matches how pull and push already handle their exit codes. After the fix, a failure such as Error: failed to create entry group ...: 403 exits with status 1, so CI commands like kcmd init && kcmd push stop instead of continuing. Update to a release containing the fix, or apply the patch above.
TroubleshootingWhy do mdcode scenario tests pass even when a `contains` assertion is wrong?
The assertion runner in tests/libts/scenarios.ts only handles a bare string or an object with a contains key. However, YAML entries written as a list parse to an array, for example [{ contains: "..." }]. Because arrays do not satisfy the object check, the contains assertion is skipped and only fs.existsSync runs.
Immediate workaround: write the assertion as a mapping instead of a list:
catalog/e1.yaml:
contains: "name: e1"
Permanent fix: update tests/libts/scenarios.ts to handle arrays, e.g. add an Array.isArray(condition) branch and execute each contained assertion. Then run:
npm test
Verify the fix by temporarily setting an impossible expected value; the test should now fail instead of passing. Enabling these checks also exposes incorrect existing expectations, such as pull_bq.yaml expecting name: p.d.t1 when the actual value is name: p.d/t1; those fixture expectations must be corrected separately.
TroubleshootingWhy does `kcmd push --validate-only` still write catalog entries for entryGroup, bq-dataset, or kb scopes?
This is caused by a bug in CatalogSync.push: it accepts validateOnly (and force) but does not read them on non-semantic-model scopes. Therefore kcmd push --validate-only still creates/updates entries and exits 0 for entryGroup, bq-dataset, and kb scopes. Upgrade to a release containing the fix "honor --validate-only in CatalogSync.push on non-semantic scopes," or apply that patch. On affected versions, do not treat --validate-only as a safe dry run for those scopes; use a scratch catalog or read-only credentials until patched. The flag already works correctly on semantic-model scopes.
TroubleshootingHow to fix "(target ?? DEFAULT_TARGET).toLowerCase is not a function" when running `kcmd push --target`?
Pass a valid target value instead of using the bare flag:
kcmd push --target <target>
Or omit --target to use the default target:
kcmd push
The error occurs because the CLI parser returns boolean true for --target without a value, and resolveTargets() then calls .toLowerCase() on it. The issue is fixed in the PR for mdcode issue #311; upgrade to a release containing that fix for proper validation/error handling.
TroubleshootingHow do I fix missing graph edges for bundle-relative absolute links like /concepts/b.md in the OKF viewer?
This is caused by _extract_links in okf/src/reference_agent/viewer/generator.py skipping every target starting with /, even though such paths are internal bundle-relative links. As a workaround, use relative links such as ./b.md, which generate edges correctly. To fix the viewer, stop skipping leading-slash targets and resolve them against bundle_root:
if "://" in target:
continue
if target.startswith("/"):
resolved = (bundle_root / target.lstrip("/")).resolve()
else:
resolved = (doc_dir / target).resolve()
Ensure bundle_root is available in _extract_links; pass it into the function if necessary. The "://" check still excludes external URLs.