Files
msd-core/sdk/src/query/commands-list.ts
Tom Boucher 9811782e6d fix(#3121): implement commands verb in SDK native registry (#3146)
- Add commandsList handler — returns sorted JSON array of all registered
  verb strings; satisfies workstream-flag.md + agent tooling discoverability
- Register ['commands', commandsList] in DECISION_ROUTING_STATIC_CATALOG
- Add golden-policy exemption (SDK-only, no CJS mirror needed)
- check.decision-coverage-plan/verify were already registered; commands was the remaining gap

Closes #3121
2026-05-05 15:02:34 -04:00

20 lines
837 B
TypeScript

import type { QueryHandler } from './utils.js';
import { createRegistry } from './index.js';
/**
* `commands` — return the full list of registered query command strings.
*
* Closes #3121: the `commands` verb was referenced in workflow files
* (references/workstream-flag.md) but had no native SDK handler, causing
* a fallback to gsd-tools.cjs which threw "Unknown command: commands".
*
* Returns: JSON array of all canonical + alias command strings the SDK
* registry accepts, sorted alphabetically. Suitable for discoverability
* and for agent auto-complete when constructing `gsd-sdk query` calls.
*/
export const commandsList: QueryHandler<string[]> = async (_args, _projectDir) => {
const registry = createRegistry();
const cmds = registry.commands().sort((a, b) => a.localeCompare(b));
return { data: cmds };
};