Skip to content

refactor: simplify managed skill agent metadata#218

Merged
crimx merged 2 commits into
mainfrom
codex/simplify-skill-agent-metadata
May 15, 2026
Merged

refactor: simplify managed skill agent metadata#218
crimx merged 2 commits into
mainfrom
codex/simplify-skill-agent-metadata

Conversation

@crimx
Copy link
Copy Markdown
Contributor

@crimx crimx commented May 15, 2026

Summary

  • centralize supported skill agent metadata in a minimal manifest
  • derive labels, ordering, supported agent parsing, and home resolution from the manifest
  • upgrade agentic-markdown usage to presence checks for optional skillSelectionPromptTool
  • document presence checks and capability-based conditions in AGENTS.md and CLAUDE.md

Tests

  • bun run lint:fix
  • bun run ts-check
  • bun run test

@crimx crimx changed the title Simplify managed skill agent metadata refactor: simplify managed skill agent metadata May 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85a5a65e-f949-46be-af51-882c6231be68

📥 Commits

Reviewing files that changed from the base of the PR and between 15e1284 and 05d23ee.

📒 Files selected for processing (18)
  • src/application/bootstrap/run-cli.test.ts
  • src/application/commands/skills/bundled-skill-observation.test.ts
  • src/application/commands/skills/bundled-skill-observation.ts
  • src/application/commands/skills/bundled-skill-paths.ts
  • src/application/commands/skills/check.test.ts
  • src/application/commands/skills/check.ts
  • src/application/commands/skills/index.cli.test.ts
  • src/application/commands/skills/index.test.ts
  • src/application/commands/skills/init.test.ts
  • src/application/commands/skills/list.cli.test.ts
  • src/application/commands/skills/local-skill-source.ts
  • src/application/commands/skills/locate.test.ts
  • src/application/commands/skills/locate.ts
  • src/application/commands/skills/managed-skill-agents.test.ts
  • src/application/commands/skills/managed-skill-hosts.ts
  • src/application/commands/skills/publish.test.ts
  • src/application/commands/skills/share.test.ts
  • src/application/commands/skills/update.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/application/commands/skills/managed-skill-hosts.ts
  • src/application/commands/skills/bundled-skill-observation.ts
  • src/application/commands/skills/check.ts
  • src/application/commands/skills/bundled-skill-observation.test.ts
  • src/application/commands/skills/bundled-skill-paths.ts

Summary by CodeRabbit

  • Documentation

    • Prefer capability-driven conditional blocks for bundled skill markdown; added examples and guidance on optional capability variables.
    • Clarified skill-selection guidance: prefer interactive UI prompts when available; fall back to plain text and treat “None of the above” as “Install neither.”
  • Improvements

    • Unified agent handling and error messaging for missing/uninstalled agents; agent lists and labels formatted more consistently (e.g., dashed names).
    • CLI agent-choice list formatting refined (removes final “or”).
  • Chores

    • Upgraded agentic-markdown dependency.

Walkthrough

This PR adds a new managed-skill-agents module that centralizes supported bundled-skill agent metadata, home-directory resolution, label/format helpers, CLI option parsing, and "agent not installed" error construction. Consuming modules (embedded-assets, bundled-skill-paths, CLI commands, output formatting, and many tests) were updated to delegate to the new module. I18n catalogs were adjusted to use a {agents} placeholder and a generic errors.skills.agentNotInstalled key; docs updated to prefer capability-based agentic-markdown; package.json bumps agentic-markdown.

Sequence Diagram

sequenceDiagram
  participant User
  participant skillCommand
  participant parseManagedSkillAgentOption
  participant resolveManagedSkillAgentHomeDirectory
  participant readBundledSkillFileContent
  participant render
  User->>skillCommand: invoke skills command with --agent
  alt agent option provided and valid
    skillCommand->>parseManagedSkillAgentOption: parse --agent value
    parseManagedSkillAgentOption-->>skillCommand: BundledSkillAgentName
    skillCommand->>resolveManagedSkillAgentHomeDirectory: resolve home directory
    resolveManagedSkillAgentHomeDirectory-->>skillCommand: home directory path
    skillCommand->>readBundledSkillFileContent: read skill markdown
    readBundledSkillFileContent->>readBundledSkillFileContent: call readManagedSkillAgent
    readBundledSkillFileContent->>render: render with agent metadata (title, skillSelectionPromptTool)
    render-->>skillCommand: rendered markdown
  else invalid or missing agent
    skillCommand->>parseManagedSkillAgentOption: parse --agent value
    parseManagedSkillAgentOption->>parseManagedSkillAgentOption: throw CliUserError
    parseManagedSkillAgentOption-->>skillCommand: error with formatted agent list
  end
Loading

Possibly related PRs

  • oomol-lab/oo-cli#140: Modifies skills listing behavior and tests touching src/application/commands/skills/list.ts, which this PR also refactors to use managed-skill agent helpers.
  • oomol-lab/oo-cli#118: Adds CodeBuddy host wiring; overlaps with this PR’s refactor of agent home-resolution and not-installed error handling.
  • oomol-lab/oo-cli#97: Changes index test logic for deriving supported home directories; related to this PR’s move to resolveManagedSkillAgentHomeDirectory across tests.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format <type>(<scope>): <subject> with type 'refactor' and subject 'simplify managed skill agent metadata', clearly describing the main refactoring focus of the changeset.
Description check ✅ Passed The description is directly related to the changeset, outlining the key objectives: centralizing metadata, deriving labels and ordering, upgrading agentic-markdown usage, and documenting changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/simplify-skill-agent-metadata

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/application/commands/skills/bundled-skill-observation.test.ts (1)

155-161: ⚡ Quick win

Derive all expected agent home subdirectories from managed metadata.

Line 156/158/160 hardcode managed home directory names. Use readManagedSkillAgent(...).homeDirectoryName for DeepSeek/Trae/Trae-CN consistently so tests track manifest changes automatically.

Proposed test update
-        expect(resolveDeepSeekTuiHomeDirectory(env)).toBe(
-            join("/tmp/user-home", ".deepseek"),
-        );
-        expect(resolveTraeHomeDirectory(env)).toBe(join("/tmp/user-home", ".trae"));
-        expect(resolveTraeCnHomeDirectory(env)).toBe(
-            join("/tmp/user-home", ".trae-cn"),
-        );
+        expect(resolveDeepSeekTuiHomeDirectory(env)).toBe(
+            join("/tmp/user-home", readManagedSkillAgent("deepseek-tui").homeDirectoryName),
+        );
+        expect(resolveTraeHomeDirectory(env)).toBe(
+            join("/tmp/user-home", readManagedSkillAgent("trae").homeDirectoryName),
+        );
+        expect(resolveTraeCnHomeDirectory(env)).toBe(
+            join("/tmp/user-home", readManagedSkillAgent("trae-cn").homeDirectoryName),
+        );

As per coding guidelines, "**/*.{ts,tsx}: Never duplicate constant values across files. Define once, import or re-export with aliases elsewhere".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/application/commands/skills/bundled-skill-observation.test.ts` around
lines 155 - 161, The test currently hardcodes home directory names for
DeepSeek/Trae/Trae-CN; replace those literals by reading the canonical names
from the managed skill metadata: call readManagedSkillAgent(env) for each agent
(e.g., readManagedSkillAgent(env, "deepseek") / "trae" / "trae-cn" or the
correct id used in your test harness) and use the returned .homeDirectoryName
when building expected paths for resolveDeepSeekTuiHomeDirectory,
resolveTraeHomeDirectory, and resolveTraeCnHomeDirectory so the assertions
derive expected subdirectory names from the manifest instead of hardcoded
strings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/application/commands/skills/bundled-skill-paths.ts`:
- Around line 16-81: The file contains many one-line delegation wrappers
(resolveCodexHomeDirectory, resolveClaudeHomeDirectory,
resolveCodeBuddyHomeDirectory, resolveDeepSeekTuiHomeDirectory,
resolveHermesHomeDirectory, resolveOpenClawHomeDirectory,
resolveQoderWorkHomeDirectory, resolveTraeHomeDirectory,
resolveTraeCnHomeDirectory, resolveWorkBuddyHomeDirectory and
resolveBundledSkillHomeDirectory) that only call
resolveManagedSkillAgentHomeDirectory; remove these redundant wrappers and
update callers to import and call resolveManagedSkillAgentHomeDirectory(env,
agentName) directly (or re-export resolveManagedSkillAgentHomeDirectory under
any needed public name) so the API surface is collapsed and no single-line
pass-through functions remain.

In `@src/application/commands/skills/managed-skill-agents.test.ts`:
- Around line 37-42: Replace hardcoded POSIX paths in the
managed-skill-agents.test.ts tests by composing them with path.join;
specifically update the env object (variable name env) and all assertions that
currently use "/tmp/..." strings (including the other occurrences around lines
noted: 45-46, 51-52, and 87-99) to use join(process.cwd() or appropriate base
dirs, 'codex-home') or join(os-specific base, 'openclaw-home') so both fixture
inputs and expected values are built with join(), and import/require path.join
at the top of the test file to keep tests platform-agnostic.

---

Nitpick comments:
In `@src/application/commands/skills/bundled-skill-observation.test.ts`:
- Around line 155-161: The test currently hardcodes home directory names for
DeepSeek/Trae/Trae-CN; replace those literals by reading the canonical names
from the managed skill metadata: call readManagedSkillAgent(env) for each agent
(e.g., readManagedSkillAgent(env, "deepseek") / "trae" / "trae-cn" or the
correct id used in your test harness) and use the returned .homeDirectoryName
when building expected paths for resolveDeepSeekTuiHomeDirectory,
resolveTraeHomeDirectory, and resolveTraeCnHomeDirectory so the assertions
derive expected subdirectory names from the manifest instead of hardcoded
strings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d409f53f-25a9-45ec-993b-8af079b9a8cd

📥 Commits

Reviewing files that changed from the base of the PR and between 78d4261 and 15e1284.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (26)
  • AGENTS.md
  • CLAUDE.md
  • contrib/skills/shared/oo-find-skills/SKILL.md
  • contrib/skills/shared/oo-find-skills/references/oo-cli-contract.md
  • package.json
  • src/application/commands/skills/bundled-skill-observation.test.ts
  • src/application/commands/skills/bundled-skill-observation.ts
  • src/application/commands/skills/bundled-skill-paths.ts
  • src/application/commands/skills/check.test.ts
  • src/application/commands/skills/check.ts
  • src/application/commands/skills/embedded-assets.test.ts
  • src/application/commands/skills/embedded-assets.ts
  • src/application/commands/skills/init.test.ts
  • src/application/commands/skills/init.ts
  • src/application/commands/skills/install-output.ts
  • src/application/commands/skills/list.ts
  • src/application/commands/skills/local-skill-source.ts
  • src/application/commands/skills/locate.test.ts
  • src/application/commands/skills/locate.ts
  • src/application/commands/skills/managed-skill-agents.test.ts
  • src/application/commands/skills/managed-skill-agents.ts
  • src/application/commands/skills/managed-skill-host-errors.ts
  • src/application/commands/skills/managed-skill-host-labels.ts
  • src/application/commands/skills/managed-skill-hosts.ts
  • src/application/commands/skills/uninstall.ts
  • src/i18n/catalog.ts
💤 Files with no reviewable changes (2)
  • src/application/commands/skills/managed-skill-host-labels.ts
  • src/application/commands/skills/managed-skill-host-errors.ts

Comment thread src/application/commands/skills/bundled-skill-paths.ts Outdated
Comment thread src/application/commands/skills/managed-skill-agents.test.ts
- Replaced multiple direct calls to resolveCodexHomeDirectory, resolveCodeBuddyHomeDirectory, and other similar functions with a unified approach using resolveManagedSkillAgentHomeDirectory across various test files and implementation files.
- Updated tests to ensure they correctly reference the new method for resolving managed skill agent home directories.
- Removed unused imports related to bundled skill paths to streamline the codebase.
@crimx crimx merged commit 33c75a2 into main May 15, 2026
6 checks passed
@crimx crimx deleted the codex/simplify-skill-agent-metadata branch May 15, 2026 10:14
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.

1 participant