@open-tomato/rafa 0.22.0 → 0.24.0
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/README.md +15 -1
- package/dist/cli.js +14492 -10455
- package/dist/{describe-0tefrkk7.js → describe-66gth329.js} +2 -2
- package/dist/effort/store/index.js +2 -2
- package/dist/epic-verify-prompt.md +59 -0
- package/dist/{index-28jzpyks.js → index-4fwgqveh.js} +5 -0
- package/dist/{index-ae290g0m.js → index-7qgng1rf.js} +1 -1
- package/dist/{index-e30zazs6.js → index-gt9acb1y.js} +10366 -8046
- package/dist/{index-4a45ffqh.js → index-w1dnwja1.js} +15 -6
- package/dist/{index-gzr2gtmh.js → index-zzvc0gkb.js} +3953 -2449
- package/dist/index.js +4 -4
- package/dist/templates/epic.md +17 -0
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
commandSpelling,
|
|
5
5
|
isRoutingWord,
|
|
6
6
|
isTopLevel
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-4fwgqveh.js";
|
|
8
8
|
import {
|
|
9
9
|
describeValue
|
|
10
10
|
} from "./index-pmkgvtfe.js";
|
|
@@ -82,14 +82,23 @@ function shadowOf(words, find, subjects) {
|
|
|
82
82
|
return;
|
|
83
83
|
return find(subject.name, second);
|
|
84
84
|
}
|
|
85
|
+
function typedAlias(alias) {
|
|
86
|
+
return alias.trim().split(/\s+/).join(" ");
|
|
87
|
+
}
|
|
85
88
|
function indexAliases(commands, find, subjects) {
|
|
86
89
|
const claimed = new Map;
|
|
87
90
|
const aliases = [];
|
|
88
91
|
for (const command of commands) {
|
|
89
92
|
const spelling = commandSpelling(command);
|
|
93
|
+
const lasting = new Set((command.lastingAliases ?? []).map(typedAlias));
|
|
94
|
+
for (const kept of lasting) {
|
|
95
|
+
if (!(command.aliases ?? []).map(typedAlias).includes(kept)) {
|
|
96
|
+
throw new Error(`${REFUSAL}: command "${spelling}" has lasting alias "${kept}", which is not one of its aliases`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
90
99
|
for (const alias of command.aliases ?? []) {
|
|
91
|
-
const
|
|
92
|
-
const
|
|
100
|
+
const typed = typedAlias(alias);
|
|
101
|
+
const words = Object.freeze(typed.split(" "));
|
|
93
102
|
if (!words.every(isRoutingWord)) {
|
|
94
103
|
throw new Error(`${REFUSAL}: command "${spelling}" has alias ${describeValue(alias)},` + " expected words with no slash and no leading dash");
|
|
95
104
|
}
|
|
@@ -103,7 +112,7 @@ function indexAliases(commands, find, subjects) {
|
|
|
103
112
|
throw new Error(`${REFUSAL}: alias "${typed}" of "${spelling}" is spelled as command "${commandSpelling(shadow)}"`);
|
|
104
113
|
}
|
|
105
114
|
claimed.set(typed, command);
|
|
106
|
-
aliases.push(Object.freeze({ words, command }));
|
|
115
|
+
aliases.push(Object.freeze({ words, command, lasting: lasting.has(typed) }));
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
return Object.freeze(aliases.sort((a, b) => b.words.length - a.words.length));
|
|
@@ -189,7 +198,7 @@ function describeArg(arg) {
|
|
|
189
198
|
function describeFlag(flag) {
|
|
190
199
|
return { ...describeArg(flag), aliases: [...flag.aliases ?? []] };
|
|
191
200
|
}
|
|
192
|
-
function
|
|
201
|
+
function typedAlias2(alias) {
|
|
193
202
|
return alias.trim().split(/\s+/).join(" ");
|
|
194
203
|
}
|
|
195
204
|
function describeCommand(command, name, module) {
|
|
@@ -202,7 +211,7 @@ function describeCommand(command, name, module) {
|
|
|
202
211
|
flags: command.flags.map(describeFlag),
|
|
203
212
|
examples: command.examples.map(({ cmd, note }) => ({ cmd, note })),
|
|
204
213
|
outputs: [...command.outputs],
|
|
205
|
-
aliases: module === null ? (command.aliases ?? []).map(
|
|
214
|
+
aliases: module === null ? (command.aliases ?? []).map(typedAlias2) : [],
|
|
206
215
|
deprecated: deprecated === undefined ? null : { since: deprecated.since, use: deprecated.use },
|
|
207
216
|
module,
|
|
208
217
|
spends: spends === undefined ? null : { ...spends }
|