Skip to content

Refactor command registration with shared helpers and metadata#92

Merged
da-ba merged 1 commit into
mainfrom
codex/plan-code-cleanup-and-deduplication
Feb 20, 2026
Merged

Refactor command registration with shared helpers and metadata#92
da-ba merged 1 commit into
mainfrom
codex/plan-code-cleanup-and-deduplication

Conversation

@da-ba

@da-ba da-ba commented Feb 15, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Centralize and formalize per-command metadata (icon + description) so the // command list is driven by a single source of truth.
  • Reduce duplicated cache/load and fire-and-forget side-effect boilerplate across command implementations.
  • Make it simpler and safer to add new commands that automatically appear in the command list.
  • Improve test coverage for the registry and the new helper utilities.

Description

  • Added CommandMetadata type, extended registerCommand(name, spec, metadata?) to optionally store metadata, and added getCommandMetadata for lookup.
  • Introduced src/content/commands/command-helpers.ts with getOrLoadCommandCache (cache-or-load helper) and runNonBlocking (ignore non-critical async errors).
  • Updated the // command list to read metadata via getCommandMetadata with a fallback and removed the duplicated hardcoded metadata map.
  • Migrated /emoji and /mention to use the new helpers and updated many command registrations (giphy, emoji, font, mermaid, mention, now, kbd, link) to include icon + description metadata, plus docs and tests adjustments.

Testing

  • Ran the unit test suite with bun run test, which succeeded (all tests passed).
  • Ran the repo check with bun run check, which initially failed due to Prettier formatting, then fixed formatting with bunx prettier --write and re-ran bun run check, which succeeded.
  • New/updated automated tests: src/content/commands/registry.test.ts and src/content/commands/command-helpers.test.ts were added/updated and executed as part of the test run.

Codex Task

@github-actions

Copy link
Copy Markdown
Contributor

🎨 Demo Preview Deployed

A live preview of this PR is available at:

🔗 https://da-ba.github.io/gsp/pr-92-e1ff794/

Version: 0.0.4 | Build: PR#92@e1ff794


🤖 This preview is automatically updated on each push. View all deployments at the index page.

@github-actions
github-actions Bot temporarily deployed to pr-92 February 15, 2026 18:17 Destroyed
@da-ba
da-ba marked this pull request as ready for review February 20, 2026 18:37
@da-ba
da-ba merged commit 4cb8a6e into main Feb 20, 2026
9 checks passed
@da-ba
da-ba deleted the codex/plan-code-cleanup-and-deduplication branch February 20, 2026 18:37
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