kadai 1.0.1 → 1.0.3
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 +11 -8
- package/dist/cli.js +44 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ Add metadata as comments in the first 20 lines of any script:
|
|
|
66
66
|
# kadai:emoji 🚀
|
|
67
67
|
# kadai:description Deploy the app to staging
|
|
68
68
|
# kadai:confirm true
|
|
69
|
+
# kadai:index 10
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
For JS/TS, use `//` comments:
|
|
@@ -74,16 +75,18 @@ For JS/TS, use `//` comments:
|
|
|
74
75
|
// kadai:name Reset Database
|
|
75
76
|
// kadai:emoji 🗑️
|
|
76
77
|
// kadai:confirm true
|
|
78
|
+
// kadai:index 20
|
|
77
79
|
```
|
|
78
80
|
|
|
79
|
-
| Key | Type | Description
|
|
80
|
-
|
|
81
|
-
| `name` | string | Display name (inferred from filename if omitted)
|
|
82
|
-
| `emoji` | string | Emoji prefix in menus
|
|
83
|
-
| `description` | string | Short description
|
|
84
|
-
| `confirm` | boolean | Require confirmation before running
|
|
85
|
-
| `hidden` | boolean | Hide from menu (still runnable via CLI)
|
|
86
|
-
| `fullscreen` | boolean | Use alternate screen buffer (`.tsx` only)
|
|
81
|
+
| Key | Type | Description |
|
|
82
|
+
|---------------|---------|--------------------------------------------------------------------|
|
|
83
|
+
| `name` | string | Display name (inferred from filename if omitted) |
|
|
84
|
+
| `emoji` | string | Emoji prefix in menus |
|
|
85
|
+
| `description` | string | Short description |
|
|
86
|
+
| `confirm` | boolean | Require confirmation before running |
|
|
87
|
+
| `hidden` | boolean | Hide from menu (still runnable via CLI) |
|
|
88
|
+
| `fullscreen` | boolean | Use alternate screen buffer (`.tsx` only) |
|
|
89
|
+
| `index` | number | Sort key for menu ordering (indexed actions appear before unindexed) |
|
|
87
90
|
|
|
88
91
|
### Ink TUI Actions
|
|
89
92
|
|
package/dist/cli.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -166,6 +184,12 @@ function parseMetadataFromContent(content) {
|
|
|
166
184
|
case "fullscreen":
|
|
167
185
|
meta.fullscreen = value.trim() === "true";
|
|
168
186
|
break;
|
|
187
|
+
case "index": {
|
|
188
|
+
const parsed = Number(value.trim());
|
|
189
|
+
if (!Number.isNaN(parsed))
|
|
190
|
+
meta.index = parsed;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
169
193
|
}
|
|
170
194
|
}
|
|
171
195
|
return meta;
|
|
@@ -186,7 +210,8 @@ async function extractMetadata(filePath) {
|
|
|
186
210
|
description: frontmatter.description,
|
|
187
211
|
confirm: frontmatter.confirm ?? false,
|
|
188
212
|
hidden: frontmatter.hidden ?? false,
|
|
189
|
-
fullscreen: frontmatter.fullscreen ?? false
|
|
213
|
+
fullscreen: frontmatter.fullscreen ?? false,
|
|
214
|
+
index: frontmatter.index
|
|
190
215
|
};
|
|
191
216
|
}
|
|
192
217
|
return {
|
|
@@ -983,7 +1008,7 @@ var init_commands = __esm(() => {
|
|
|
983
1008
|
var require_package = __commonJS((exports, module) => {
|
|
984
1009
|
module.exports = {
|
|
985
1010
|
name: "kadai",
|
|
986
|
-
version: "1.0.
|
|
1011
|
+
version: "1.0.3",
|
|
987
1012
|
type: "module",
|
|
988
1013
|
bin: {
|
|
989
1014
|
kadai: "./dist/cli.js"
|
|
@@ -2754,7 +2779,8 @@ function buildMenuItems(actions, path) {
|
|
|
2754
2779
|
emoji: action.meta.emoji,
|
|
2755
2780
|
description: action.meta.description,
|
|
2756
2781
|
value: action.id,
|
|
2757
|
-
isNew: newActionIds.has(action.id)
|
|
2782
|
+
isNew: newActionIds.has(action.id),
|
|
2783
|
+
index: action.meta.index
|
|
2758
2784
|
});
|
|
2759
2785
|
}
|
|
2760
2786
|
}
|
|
@@ -2770,7 +2796,8 @@ function buildMenuItems(actions, path) {
|
|
|
2770
2796
|
emoji: action.meta.emoji,
|
|
2771
2797
|
description: action.meta.description,
|
|
2772
2798
|
value: action.id,
|
|
2773
|
-
isNew: newActionIds.has(action.id)
|
|
2799
|
+
isNew: newActionIds.has(action.id),
|
|
2800
|
+
index: action.meta.index
|
|
2774
2801
|
});
|
|
2775
2802
|
} else if (action.category.length > path.length) {
|
|
2776
2803
|
const subCategory = action.category[path.length];
|
|
@@ -2800,6 +2827,12 @@ function buildMenuItems(actions, path) {
|
|
|
2800
2827
|
return 1;
|
|
2801
2828
|
}
|
|
2802
2829
|
}
|
|
2830
|
+
if (a.type === "action" && b.type === "action") {
|
|
2831
|
+
const aIdx = a.index ?? Infinity;
|
|
2832
|
+
const bIdx = b.index ?? Infinity;
|
|
2833
|
+
if (aIdx !== bIdx)
|
|
2834
|
+
return aIdx - bIdx;
|
|
2835
|
+
}
|
|
2803
2836
|
return a.label.localeCompare(b.label);
|
|
2804
2837
|
});
|
|
2805
2838
|
return items;
|
|
@@ -2885,7 +2918,11 @@ if (parsed.type === "mcp") {
|
|
|
2885
2918
|
const projectRoot = kadaiDir ? (await import("path")).dirname(kadaiDir) : cwd;
|
|
2886
2919
|
await ensureMcpConfig2(projectRoot);
|
|
2887
2920
|
await startMcpServer2(kadaiDir, cwd);
|
|
2888
|
-
await new Promise(() => {
|
|
2921
|
+
await new Promise((resolve3) => {
|
|
2922
|
+
process.stdin.on("end", resolve3);
|
|
2923
|
+
process.stdin.on("close", resolve3);
|
|
2924
|
+
});
|
|
2925
|
+
process.exit(0);
|
|
2889
2926
|
}
|
|
2890
2927
|
if (parsed.type === "list" || parsed.type === "run" || parsed.type === "sync" || parsed.type === "rerun") {
|
|
2891
2928
|
const kadaiDir = findZcliDir(cwd);
|