ktg-plugin-marketplace/plugins/voyage/lib/util/result.mjs
Kjell Tore Guttormsen 7a90d348ad feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs]
Session 5 of voyage-rebrand (V6). Operator-authorized cross-plugin scope.

- git mv plugins/ultraplan-local plugins/voyage (rename detected, history preserved)
- .claude-plugin/marketplace.json: voyage entry replaces ultraplan-local
- CLAUDE.md: voyage row in plugin list, voyage in design-system consumer list
- README.md: bulk rename ultra*-local commands -> trek* commands; ultraplan-local refs -> voyage; type discriminators (type: trekbrief/trekreview); session-title pattern (voyage:<command>:<slug>); v4.0.0 release-note paragraph
- plugins/voyage/.claude-plugin/plugin.json: homepage/repository URLs point to monorepo voyage path
- plugins/voyage/verify.sh: drop URL whitelist exception (no longer needed)

Closes voyage-rebrand. bash plugins/voyage/verify.sh PASS 7/7. npm test 361/361.
2026-05-05 15:37:52 +02:00

35 lines
1 KiB
JavaScript

// lib/util/result.mjs
// Validation result shape used by every validator and parser.
/**
* @typedef {{ code: string, message: string, hint?: string, location?: string }} Issue
* @typedef {{ valid: boolean, errors: Issue[], warnings: Issue[], parsed?: any }} Result
*/
/** @returns {Result} */
export function ok(parsed) {
return { valid: true, errors: [], warnings: [], parsed };
}
/** @returns {Result} */
export function fail(errors, parsed) {
return { valid: false, errors: Array.isArray(errors) ? errors : [errors], warnings: [], parsed };
}
/** @returns {Result} */
export function combine(results) {
const errors = [];
const warnings = [];
let parsed;
for (const r of results) {
if (r.errors) errors.push(...r.errors);
if (r.warnings) warnings.push(...r.warnings);
if (r.parsed !== undefined && parsed === undefined) parsed = r.parsed;
}
return { valid: errors.length === 0, errors, warnings, parsed };
}
/** @returns {Issue} */
export function issue(code, message, hint, location) {
return { code, message, hint, location };
}