Skip to content

Introduce discovery feature: CLI command and core discovery module#9

Open
PredictabilityAtScale wants to merge 1 commit into
mainfrom
codex/review-and-implement-capability-discovery-structure
Open

Introduce discovery feature: CLI command and core discovery module#9
PredictabilityAtScale wants to merge 1 commit into
mainfrom
codex/review-and-implement-capability-discovery-structure

Conversation

@PredictabilityAtScale
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a way for a coding agent to inspect an installed project and propose initial capability candidates so users get a practical starting point after installing CapabilityKit.
  • Offer structured discovery output, conservative organization suggestions, and validation to prevent relying solely on README or package metadata.

Description

  • Add a new core discovery implementation in packages/core/src/discovery.ts that defines types, validation (validateDiscoveryReport), prompt builder (buildCapabilityDiscoveryPrompt), and organization logic (organizeDiscoveredCapabilityMap).
  • Export discovery APIs from packages/core/src/index.ts and add new types for CapabilityDiscoveryReport and related entities.
  • Add a discover CLI command in packages/cli/src/index.ts that builds a discovery prompt, runs an external agent via runExternalAgentCommand, parses the JSON report, validates it, organizes suggestions, and supports output options like --output-prompt, --report, --transcript, --dry-run, and --json.
  • Wire discovery into capability metadata by updating .capabilities/....capability.yamlstatuses toimplementedand includingimplementation.referencespointing topackages/core/src/discovery.ts` and the new tests.
  • Add parsing helpers in the CLI (extractJsonObject, parseDiscoveryReport, formatDiscoveryValidation) to robustly extract and present agent JSON output.

Testing

  • Added unit tests packages/core/tests/discovery.test.ts covering buildCapabilityDiscoveryPrompt and validateDiscoveryReport, and packages/core/tests/discoveryOrganization.test.ts covering organizeDiscoveredCapabilityMap and dependency inference.
  • Run commands used in verification: npm test -- packages/core/tests/discovery.test.ts, npm test -- packages/core/tests/discoveryOrganization.test.ts, and npm run build, and they completed successfully.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8ed92ef5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

issues.push({ code: "missing-candidates", message: "Discovery report must include at least one capability candidate." });
}

for (const candidate of report.candidates ?? []) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard invalid discovery candidate lists

When an external agent returns syntactically valid JSON where candidates is present but not an array, validation records missing-candidates and then immediately tries to iterate that non-array value, throwing before the discover CLI can print the validation errors or write the parsed report. Since this path parses untrusted agent stdout, malformed reports should be reported as invalid instead of crashing during validation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant