@thirdfy/agent-cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/thirdfy-agent.mjs +21 -7
- package/package.json +1 -1
package/bin/thirdfy-agent.mjs
CHANGED
|
@@ -1094,15 +1094,29 @@ async function resolveActionSelection(ctx, flags) {
|
|
|
1094
1094
|
return { requestedAction, resolvedAction: requestedAction };
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
);
|
|
1100
|
-
if (
|
|
1101
|
-
return { requestedAction, resolvedAction:
|
|
1097
|
+
// Prefer direct action id matches over alias matches.
|
|
1098
|
+
// This keeps UX simple for commands like `--action swap` when another action aliases to "swap".
|
|
1099
|
+
const exactKey = keyed.filter((entry) => entry.key.toLowerCase() === requestedLower);
|
|
1100
|
+
if (exactKey.length === 1) {
|
|
1101
|
+
return { requestedAction, resolvedAction: exactKey[0].key };
|
|
1102
|
+
}
|
|
1103
|
+
if (exactKey.length > 1) {
|
|
1104
|
+
throw new Error(
|
|
1105
|
+
`Ambiguous --action "${requestedAction}". Multiple exact matches found: ${formatActionList(
|
|
1106
|
+
exactKey.map((v) => v.key)
|
|
1107
|
+
)}.`
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
const exactAlias = keyed.filter((entry) => entry.aliases.some((a) => a.toLowerCase() === requestedLower));
|
|
1112
|
+
if (exactAlias.length === 1) {
|
|
1113
|
+
return { requestedAction, resolvedAction: exactAlias[0].key };
|
|
1102
1114
|
}
|
|
1103
|
-
if (
|
|
1115
|
+
if (exactAlias.length > 1) {
|
|
1104
1116
|
throw new Error(
|
|
1105
|
-
`Ambiguous --action "${requestedAction}".
|
|
1117
|
+
`Ambiguous --action "${requestedAction}". Alias matches multiple actions: ${formatActionList(
|
|
1118
|
+
exactAlias.map((v) => v.key)
|
|
1119
|
+
)}.`
|
|
1106
1120
|
);
|
|
1107
1121
|
}
|
|
1108
1122
|
|