fix(cli): use wmill.yaml key (not branch name) for workspace-specific filenames

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-04-21 18:10:51 +02:00
parent f8c916cb60
commit 3ff23aae9a
4 changed files with 147 additions and 9 deletions
+10 -5
View File
@@ -179,20 +179,25 @@ export async function findResourceFile(path: string) {
let contentBasePathJSON = splitPath[0] + "." + splitPath[1] + ".json";
let contentBasePathYAML = splitPath[0] + "." + splitPath[1] + ".yaml";
// Check for branch-specific metadata files first
// Check for workspace-specific metadata files first, using the wmill.yaml
// config key for the current git branch as the filename suffix (falls back
// to the branch name when no matching workspace entry exists).
const currentBranch = getCurrentGitBranch();
const wsName = currentBranch
? await specificItems.resolveWsNameForGitBranch(currentBranch)
: null;
const candidates = [contentBasePathJSON, contentBasePathYAML];
if (currentBranch) {
// Add branch-specific candidates at the beginning (higher priority)
if (wsName) {
// Add workspace-specific candidates at the beginning (higher priority)
const branchSpecificJSON = specificItems.toWorkspaceSpecificPath(
contentBasePathJSON,
currentBranch
wsName
);
const branchSpecificYAML = specificItems.toWorkspaceSpecificPath(
contentBasePathYAML,
currentBranch
wsName
);
candidates.unshift(branchSpecificJSON, branchSpecificYAML);
}