skillmkt 0.3.0 → 0.3.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.
@@ -8,8 +8,9 @@ import { fetchRef } from '../lib/registries/index.js';
8
8
  import { auditDir, stripFilter, writeScan } from '../lib/audit.js';
9
9
  import { readSkillDir, copyDir, rmDir, walk, treeHash } from '../lib/package.js';
10
10
  import { projectSkill, resolveTargets } from '../lib/project.js';
11
+ import { primaryDir } from '../lib/scanner.js';
11
12
  import { cacheLookup } from '../lib/state.js';
12
- import { confirm } from '../lib/prompt.js';
13
+ import { confirm, multiChoose } from '../lib/prompt.js';
13
14
  import { ok, warn, fail, info } from '../lib/render.js';
14
15
 
15
16
  // 来源取证:.git remote → skills-lock.json → .market-skills.json → frontmatter
@@ -128,10 +129,26 @@ export async function run(ctx) {
128
129
  }
129
130
 
130
131
  // ④ 投影目标:收编默认仅原 harness;其余 --to/--target/default_targets(空则全部 installed)
131
- const targets = adopted && !flags.target
132
+ let targets = adopted && !flags.target
132
133
  ? [{ id: adopted.harnessId, dir: path.dirname(adopted.from), mode: 'copy' }]
133
134
  : resolveTargets(ctx, { allowAdopted: ctx.harnesses.filter((h) => h.state === 'installed').map((h) => h.id) });
134
135
 
136
+ // TTY 自选:未显式 --to/--target/--scope/--yes 且非收编 → 候选=解析结果∪全部可投影 agent,预勾选=解析结果
137
+ if (ctx.tty && !ctx.flags.yes && !flags.to && !flags.target && !flags.scope && !adopted) {
138
+ const pool = [...targets];
139
+ const have = new Set(pool.map((t) => t.id));
140
+ for (const h of ctx.harnesses) {
141
+ if (h.detectOnly || h.state === 'absent' || have.has(h.id)) continue;
142
+ const dir = primaryDir(h);
143
+ if (dir) pool.push({ id: h.id, dir, mode: 'copy' });
144
+ }
145
+ if (pool.length) {
146
+ const checked = pool.map((_, i) => i).slice(0, targets.length);
147
+ const idx = await multiChoose(`装到哪些位置?`, pool.map((t) => `${t.id} → ${t.dir}`), { checked });
148
+ targets = idx.map((i) => pool[i]);
149
+ }
150
+ }
151
+
135
152
  // ⑤ 投影 + lock
136
153
  const results = [];
137
154
  const lockTargets = {};
@@ -20,3 +20,18 @@ export async function choose(question, options) {
20
20
  const n = parseInt(ans, 10);
21
21
  return options[n - 1] ?? options[0];
22
22
  }
23
+
24
+ // 多选:序号逗号/空格分隔;回车=保持预勾选;0/none=全不选。返回选中的下标数组
25
+ export async function multiChoose(question, options, { checked = [] } = {}) {
26
+ if (!process.stdin.isTTY) return checked;
27
+ const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
28
+ process.stderr.write(`${question}(序号逗号分隔,回车=当前勾选,0=全不装)\n`);
29
+ options.forEach((o, i) => process.stderr.write(` ${checked.includes(i) ? '[x]' : '[ ]'} ${i + 1}. ${o.label || o}\n`));
30
+ const ans = await new Promise((res) => rl.question('> ', res));
31
+ rl.close();
32
+ const t = ans.trim().toLowerCase();
33
+ if (!t) return checked;
34
+ if (t === '0' || t === 'none') return [];
35
+ const idx = t.split(/[,\s]+/).map((x) => parseInt(x, 10) - 1).filter((i) => i >= 0 && i < options.length);
36
+ return [...new Set(idx)];
37
+ }
@@ -153,12 +153,12 @@ async function render() {
153
153
  <div id="model-box"><label class="field">模型名称</label>
154
154
  <div class="combo"><input type="text" id="mmodel" autocomplete="off" placeholder="可输入关键字搜索,扫描后自动列出发现的模型" value="${esc(cfg.llm?.model || '')}">
155
155
  <div class="combo-list" id="model-drop" style="display:none"></div></div></div>
156
- <div class="row"><button id="smoke">测试连接</button><span id="smoke-out" class="mut"></span></div></div>
156
+ <div class="row end" style="margin-top:14px"><span id="smoke-out" class="mut"></span><button id="smoke">测试连接</button></div></div>
157
157
  <div class="card"><h3>第 2 步 · skill 默认安装位置</h3>
158
158
  <p class="mut">勾选的 AI 工具会在你安装新 skill 时自动收到一份副本。已勾过的话保存即生效。</p>
159
159
  ${h.map((x) => `<label class="check"><input type="checkbox" data-h="${esc(x.id)}" ${sel.has(x.id) ? 'checked' : ''} ${x.state === 'absent' ? 'disabled' : ''}> ${esc(x.id)} ${pill(x.state)} <span class="mut">${esc(x.primaryDir || '')}</span></label>`).join('')}</div>
160
160
  <div class="card"><h3>第 3 步 · 保存</h3>
161
- <div class="row"><button class="primary" id="save">保存设置</button><span id="save-out" class="mut"></span></div></div>`;
161
+ <div class="row end"><span id="save-out" class="mut"></span><button class="primary" id="save">保存设置</button></div></div>`;
162
162
  const modelMap = new Map(); // model → base_url(选中模型自动回填地址)
163
163
  const loadedModels = new Map(); // 密钥端点拉到的模型——重扫后保留
164
164
  let epsList = [], lastScan = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillmkt",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "Local-first agent skill manager: install, audit, merge, distribute.",
6
6
  "license": "MIT",