Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions docs/lib/configured-operations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ function isRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}

// SelfCare runs repository-local live checks against this catalog repository
// itself, so it isn't meant to be installed into a consumer's control plane.
// Exclude it from the wizard's operations list even though it's configured
// in central-agentic-ops.json for this repository's own control plane.
const WIZARD_EXCLUDED_SLUGS = new Set(["self-care"]);

export function selectConfiguredOperations(controlPolicy, catalogEntries) {
const controlPlane = isRecord(controlPolicy) ? controlPolicy["control-plane"] : undefined;
const configuredPackages = isRecord(controlPlane) ? controlPlane.packages : undefined;
Expand All @@ -11,9 +17,11 @@ export function selectConfiguredOperations(controlPolicy, catalogEntries) {
}

const catalogEntriesBySlug = new Map(catalogEntries.map((entry) => [entry.slug, entry]));
return Object.keys(configuredPackages).map((slug) => {
const entry = catalogEntriesBySlug.get(slug);
if (!entry) throw new Error(`Configured package ${slug} must have a catalog manifest`);
return entry;
});
return Object.keys(configuredPackages)
.filter((slug) => !WIZARD_EXCLUDED_SLUGS.has(slug))
.map((slug) => {
const entry = catalogEntriesBySlug.get(slug);
if (!entry) throw new Error(`Configured package ${slug} must have a catalog manifest`);
return entry;
});
}
8 changes: 8 additions & 0 deletions tests/unit/landing-page-diagram.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,12 @@ test("configured wizard operations require a matching catalog manifest", () => {
() => selectConfiguredOperations(policy, []),
/Configured package missing must have a catalog manifest/,
);
});

test("configured wizard operations exclude the repository-local self-care package", () => {
const first = { slug: "first" };
const selfCare = { slug: "self-care" };
const policy = { "control-plane": { packages: { "self-care": {}, first: {} } } };

assert.deepEqual(selectConfiguredOperations(policy, [first, selfCare]), [first]);
});
Loading