kadai 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +19 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -166,6 +166,12 @@ function parseMetadataFromContent(content) {
166
166
  case "fullscreen":
167
167
  meta.fullscreen = value.trim() === "true";
168
168
  break;
169
+ case "index": {
170
+ const parsed = Number(value.trim());
171
+ if (!Number.isNaN(parsed))
172
+ meta.index = parsed;
173
+ break;
174
+ }
169
175
  }
170
176
  }
171
177
  return meta;
@@ -186,7 +192,8 @@ async function extractMetadata(filePath) {
186
192
  description: frontmatter.description,
187
193
  confirm: frontmatter.confirm ?? false,
188
194
  hidden: frontmatter.hidden ?? false,
189
- fullscreen: frontmatter.fullscreen ?? false
195
+ fullscreen: frontmatter.fullscreen ?? false,
196
+ index: frontmatter.index
190
197
  };
191
198
  }
192
199
  return {
@@ -983,7 +990,7 @@ var init_commands = __esm(() => {
983
990
  var require_package = __commonJS((exports, module) => {
984
991
  module.exports = {
985
992
  name: "kadai",
986
- version: "1.0.0",
993
+ version: "1.0.2",
987
994
  type: "module",
988
995
  bin: {
989
996
  kadai: "./dist/cli.js"
@@ -2754,7 +2761,8 @@ function buildMenuItems(actions, path) {
2754
2761
  emoji: action.meta.emoji,
2755
2762
  description: action.meta.description,
2756
2763
  value: action.id,
2757
- isNew: newActionIds.has(action.id)
2764
+ isNew: newActionIds.has(action.id),
2765
+ index: action.meta.index
2758
2766
  });
2759
2767
  }
2760
2768
  }
@@ -2770,7 +2778,8 @@ function buildMenuItems(actions, path) {
2770
2778
  emoji: action.meta.emoji,
2771
2779
  description: action.meta.description,
2772
2780
  value: action.id,
2773
- isNew: newActionIds.has(action.id)
2781
+ isNew: newActionIds.has(action.id),
2782
+ index: action.meta.index
2774
2783
  });
2775
2784
  } else if (action.category.length > path.length) {
2776
2785
  const subCategory = action.category[path.length];
@@ -2800,6 +2809,12 @@ function buildMenuItems(actions, path) {
2800
2809
  return 1;
2801
2810
  }
2802
2811
  }
2812
+ if (a.type === "action" && b.type === "action") {
2813
+ const aIdx = a.index ?? Infinity;
2814
+ const bIdx = b.index ?? Infinity;
2815
+ if (aIdx !== bIdx)
2816
+ return aIdx - bIdx;
2817
+ }
2803
2818
  return a.label.localeCompare(b.label);
2804
2819
  });
2805
2820
  return items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kadai",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "kadai": "./dist/cli.js"