@xcanwin/manyoyo 8.7.1 → 8.7.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.
@@ -103,8 +103,73 @@ function listUsableSlashCommands(stored) {
103
103
  return stored.all.filter(name => !terminal.has(name) && (skills.has(name) || HEADLESS_BUILTIN_COMMANDS.has(name)));
104
104
  }
105
105
 
106
+ // 目录(initialize 响应的 commands)里不该给用户看的内部命令
107
+ const INTERNAL_SLASH_COMMANDS = new Set(['workflow-launch-exec', 'heapdump']);
108
+ // 目录里标了 builtin 的不一定是命令:自带 skill(code-review、loop …)也标 builtin。
109
+ // 没跑过任何一轮、拿不到 init 的 skills 列表时,靠这张表排除“不是 skill 也不在 -p 下可用”的内置命令(claude 2.1.310 实测)
110
+ const NON_SKILL_BUILTIN_COMMANDS = new Set([
111
+ 'agents', 'auto-mode-setup', 'autocompact', 'clear', 'color', 'compact', 'config', 'output-style', 'effort', 'fast',
112
+ 'focus', 'model', 'reload-plugins', 'reload-skills', 'insights', 'goal', 'team-onboarding'
113
+ ]);
114
+ const SOURCE_SUFFIX_PATTERN = /\s*\((user|project|plugin[^)]*)\)\s*$/;
115
+ const COMMAND_DESCRIPTION_MAX_CHARS = 160;
116
+ const COMMAND_HINT_MAX_CHARS = 60;
117
+
118
+ // 把 initialize 响应里的 commands 整理成 [{ name, description, argumentHint, source, builtin }];
119
+ // 全部来自容器,按不可信文本处理
120
+ function normalizeCommandCatalog(commands) {
121
+ if (!Array.isArray(commands)) {
122
+ return [];
123
+ }
124
+ const seen = new Set();
125
+ const result = [];
126
+ for (const item of commands) {
127
+ const raw = item && typeof item === 'object' ? item : {};
128
+ const name = typeof raw.name === 'string' ? raw.name.replace(/^\//, '') : '';
129
+ if (!SLASH_COMMAND_PATTERN.test(name) || name.startsWith('__') || INTERNAL_SLASH_COMMANDS.has(name) || seen.has(name)) {
130
+ continue;
131
+ }
132
+ seen.add(name);
133
+ const description = toDisplayText(raw.description, COMMAND_DESCRIPTION_MAX_CHARS + 20);
134
+ const matched = description.match(SOURCE_SUFFIX_PATTERN);
135
+ result.push({
136
+ name,
137
+ description: Array.from(description.replace(SOURCE_SUFFIX_PATTERN, '')).slice(0, COMMAND_DESCRIPTION_MAX_CHARS).join(''),
138
+ argumentHint: toDisplayText(raw.argumentHint, COMMAND_HINT_MAX_CHARS),
139
+ source: matched ? matched[1].replace(/\s.*$/, '') : '',
140
+ builtin: raw.builtin === true
141
+ });
142
+ if (result.length >= SLASH_COMMANDS_MAX * 2) {
143
+ break;
144
+ }
145
+ }
146
+ return result;
147
+ }
148
+
149
+ // 候选命令(带说明)。跑过一轮有 init 记录就以它为准(skill + -p 下可用的内置命令);
150
+ // 还没跑过时只能看目录:用户 / 项目 / 插件 skill、自带 skill、-p 下可用的内置命令
151
+ function listSlashCommandEntries(stored, catalog) {
152
+ const entries = Array.isArray(catalog) ? catalog : [];
153
+ const byName = new Map(entries.map(entry => [entry.name, entry]));
154
+ const view = name => {
155
+ const entry = byName.get(name);
156
+ return { name, description: entry ? entry.description : '', argumentHint: entry ? entry.argumentHint : '', source: entry ? entry.source : '' };
157
+ };
158
+ if (stored && Array.isArray(stored.all)) {
159
+ return listUsableSlashCommands(stored).filter(name => !name.startsWith('__') && !INTERNAL_SLASH_COMMANDS.has(name)).map(view);
160
+ }
161
+ return entries
162
+ .filter(entry => HEADLESS_BUILTIN_COMMANDS.has(entry.name) || !NON_SKILL_BUILTIN_COMMANDS.has(entry.name))
163
+ .map(entry => view(entry.name));
164
+ }
165
+
106
166
  module.exports = {
107
167
  HEADLESS_BUILTIN_COMMANDS,
168
+ toDisplayText,
169
+ INTERNAL_SLASH_COMMANDS,
170
+ NON_SKILL_BUILTIN_COMMANDS,
171
+ normalizeCommandCatalog,
172
+ listSlashCommandEntries,
108
173
  listUsableSlashCommands,
109
174
  TITLE_MAX_CHARS,
110
175
  FIRST_PROMPT_MAX_CHARS,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xcanwin/manyoyo",
3
- "version": "8.7.1",
4
- "imageVersion": "2.3.0-common",
3
+ "version": "8.7.2",
4
+ "imageVersion": "2.3.1-common",
5
5
  "playwrightCliVersion": "0.1.22",
6
6
  "patchrightCoreVersion": "1.64.1",
7
7
  "patchrightCoreIntegrity": "sha512-nUWuqaaUVd60qepdDPv+i5g257F8jywbzn7aKV8fPRur4dmkFLxYV/xus8f69gKAB7+S/zfdYe0zA3mJkO6+0w==",