chore(lean): drop skill-manifest refactors from PoC scope
This commit is contained in:
parent
6714253197
commit
08a9d1d3e3
|
|
@ -3,7 +3,7 @@ const fs = require('fs-extra');
|
||||||
const yaml = require('yaml');
|
const yaml = require('yaml');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load skill manifest from a directory.
|
* Load bmad-skill-manifest.yaml from a directory.
|
||||||
* Single-entry manifests (canonicalId at top level) apply to all files in the directory.
|
* Single-entry manifests (canonicalId at top level) apply to all files in the directory.
|
||||||
* Multi-entry manifests are keyed by source filename.
|
* Multi-entry manifests are keyed by source filename.
|
||||||
* @param {string} dirPath - Directory to check for bmad-skill-manifest.yaml
|
* @param {string} dirPath - Directory to check for bmad-skill-manifest.yaml
|
||||||
|
|
@ -31,30 +31,18 @@ async function loadSkillManifest(dirPath) {
|
||||||
* @returns {string} canonicalId or empty string
|
* @returns {string} canonicalId or empty string
|
||||||
*/
|
*/
|
||||||
function getCanonicalId(manifest, filename) {
|
function getCanonicalId(manifest, filename) {
|
||||||
const manifestEntry = resolveManifestEntry(manifest, filename);
|
if (!manifest) return '';
|
||||||
return manifestEntry?.canonicalId || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolve a manifest entry for a source filename.
|
|
||||||
* Handles single-entry manifests and extension fallbacks.
|
|
||||||
* @param {Object|null} manifest - Loaded manifest
|
|
||||||
* @param {string} filename - Source filename
|
|
||||||
* @returns {Object|null} Manifest entry object
|
|
||||||
*/
|
|
||||||
function resolveManifestEntry(manifest, filename) {
|
|
||||||
if (!manifest) return null;
|
|
||||||
// Single-entry manifest applies to all files in the directory
|
// Single-entry manifest applies to all files in the directory
|
||||||
if (manifest.__single) return manifest.__single;
|
if (manifest.__single) return manifest.__single.canonicalId || '';
|
||||||
// Multi-entry: look up by filename directly
|
// Multi-entry: look up by filename directly
|
||||||
if (manifest[filename]) return manifest[filename];
|
if (manifest[filename]) return manifest[filename].canonicalId || '';
|
||||||
// Fallback: try alternate extensions for compiled files
|
// Fallback: try alternate extensions for compiled files
|
||||||
const baseName = filename.replace(/\.(md|xml)$/i, '');
|
const baseName = filename.replace(/\.(md|xml)$/i, '');
|
||||||
const agentKey = `${baseName}.agent.yaml`;
|
const agentKey = `${baseName}.agent.yaml`;
|
||||||
if (manifest[agentKey]) return manifest[agentKey];
|
if (manifest[agentKey]) return manifest[agentKey].canonicalId || '';
|
||||||
const xmlKey = `${baseName}.xml`;
|
const xmlKey = `${baseName}.xml`;
|
||||||
if (manifest[xmlKey]) return manifest[xmlKey];
|
if (manifest[xmlKey]) return manifest[xmlKey].canonicalId || '';
|
||||||
return null;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue