skillmkt 0.4.38 → 0.4.40
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.
|
@@ -50,7 +50,8 @@ async function fetchTarball(owner, repo, ref, { mirror = null } = {}) {
|
|
|
50
50
|
export async function fetchSkill({ owner, repo, ref = null, path: sub = null, mirror = null }) {
|
|
51
51
|
const sha = headSha(owner, repo, ref) || ref || 'HEAD';
|
|
52
52
|
const got = await fetchTarball(owner, repo, sha, { mirror });
|
|
53
|
-
|
|
53
|
+
const hint = /\./.test(owner) ? L(`(${owner} 看着是私有源域名,不是 GitHub 组织——skills.sh 私有源 skill 目前装不了)`, ` (${owner} looks like a private registry domain, not a GitHub owner — private-source skills aren't installable yet)`) : '';
|
|
54
|
+
if (!got) throw new Error(`fetch failed: ${owner}/${repo}@${sha}${L('(直连与镜像均不可达)', ' (direct and mirror both unreachable)')}${hint}`);
|
|
54
55
|
execFileSync('tar', ['xzf', got.tar, '-C', got.tmp]);
|
|
55
56
|
const root = fs.readdirSync(got.tmp).find((d) => d.startsWith(`${owner.replace(/\W/g, '')}`) || d.includes('-'))
|
|
56
57
|
?? fs.readdirSync(got.tmp).find((d) => fs.statSync(path.join(got.tmp, d)).isDirectory());
|
package/client/public/app.js
CHANGED
|
@@ -80,6 +80,7 @@ const I18N = {
|
|
|
80
80
|
mk_ph: '搜关键词,或粘 owner/repo / 绝对路径', mk_search: '搜索', mk_direct: '按输入直接安装', mk_install: '安装',
|
|
81
81
|
mk_busy: '处理中…', ins_done: '完成', ins_fail: (c) => `失败(退出码 ${c})`,
|
|
82
82
|
mk_susp: '审核判为可疑——了解风险后仍要装?', mk_force: '仍要安装', ext_force: '仍要收编',
|
|
83
|
+
mk_nosrc: '私有源暂不可装',
|
|
83
84
|
sk_remove: '移除', sk_remove_sure: '再点一次确认', sk_removed: '已移除',
|
|
84
85
|
det_btn: '详情', det_files: (n) => `${n} 个文件`, det_diff: '上游 diff', det_rollback: '回滚上一版',
|
|
85
86
|
ext_h: (n) => `agent 目录里没收编的 skill(${n})`,
|
|
@@ -164,6 +165,7 @@ const I18N = {
|
|
|
164
165
|
mk_ph: 'keywords, or paste owner/repo / absolute path', mk_search: 'Search', mk_direct: 'Install input as ref/path', mk_install: 'Install',
|
|
165
166
|
mk_busy: 'Working…', ins_done: 'Done', ins_fail: (c) => `Failed (exit ${c})`,
|
|
166
167
|
mk_susp: 'Audit flagged this suspicious — install anyway?', mk_force: 'Install anyway', ext_force: 'Adopt anyway',
|
|
168
|
+
mk_nosrc: 'private source — N/A',
|
|
167
169
|
sk_remove: 'Remove', sk_remove_sure: 'Click again to confirm', sk_removed: 'Removed',
|
|
168
170
|
det_btn: 'Details', det_files: (n) => `${n} files`, det_diff: 'Upstream diff', det_rollback: 'Rollback a version',
|
|
169
171
|
ext_h: (n) => `Unmanaged skills in agent dirs (${n})`,
|
|
@@ -278,8 +280,8 @@ async function render() {
|
|
|
278
280
|
app.querySelectorAll('[data-rm]').forEach((b) => {
|
|
279
281
|
let armed = false, timer = null;
|
|
280
282
|
b.onclick = async () => {
|
|
281
|
-
if (!armed) { armed = true; b.textContent = t('sk_remove_sure'); b.
|
|
282
|
-
clearTimeout(timer); b.disabled = true; b.textContent = t('op_busy');
|
|
283
|
+
if (!armed) { armed = true; b.textContent = t('sk_remove_sure'); b.classList.add('danger'); timer = setTimeout(() => { armed = false; b.textContent = t('sk_remove'); b.classList.remove('danger'); }, 3000); return; }
|
|
284
|
+
clearTimeout(timer); b.disabled = true; b.classList.remove('danger'); b.textContent = t('op_busy');
|
|
283
285
|
const r = await api('/remove', { method: 'POST', body: JSON.stringify({ name: b.dataset.rm }) });
|
|
284
286
|
b.textContent = r.code === 0 ? t('sk_removed') : t('ins_fail', r.code);
|
|
285
287
|
if (r.code === 0) refresh();
|
|
@@ -388,10 +390,13 @@ async function render() {
|
|
|
388
390
|
};
|
|
389
391
|
const renderResults = () => {
|
|
390
392
|
res.innerHTML = (mkState.results || []).map((s) => {
|
|
391
|
-
|
|
393
|
+
// source 才是仓库坐标(owner/repo);uizze.sh/smithery.ai 这类私有源不含 '/' → 不可经 github 装
|
|
394
|
+
const src = s.source || '', repo = src.includes('/') ? src : null;
|
|
395
|
+
const sub = repo && s.slug.startsWith(src + '/') ? s.slug.slice(src.length + 1) : '';
|
|
392
396
|
const done = mkState.installed.has(s.slug), perm = mkState.perm.has(s.slug);
|
|
397
|
+
const label = !repo ? t('mk_nosrc') : done ? t('ins_done') : perm ? t('mk_force') : t('mk_install');
|
|
393
398
|
return `<div class="card row"><b>${esc(s.name)}</b><span class="mut">${esc(s.slug)} · ${s.installs} installs</span>
|
|
394
|
-
<button class="mk-i" style="margin-left:auto" data-s="${esc(s.slug)}" data-r="${esc(
|
|
399
|
+
<button class="mk-i" style="margin-left:auto" data-s="${esc(s.slug)}" data-r="${esc(repo || '')}" data-p="${esc(sub)}" ${done || !repo ? 'disabled' : ''}>${label}</button>
|
|
395
400
|
<span class="iout mut">${esc(mkState.status[s.slug] || '')}</span></div>`;
|
|
396
401
|
}).join('') || (mkState.results ? `<div class="empty">${t('cf_empty')}</div>` : '');
|
|
397
402
|
res.querySelectorAll('.mk-i').forEach((b) => b.onclick = () =>
|
package/client/public/index.html
CHANGED
|
@@ -67,6 +67,7 @@ button:hover { border-color: var(--color-ink-mut); }
|
|
|
67
67
|
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
|
|
68
68
|
outline: 2px solid var(--color-accent); outline-offset: 2px; }
|
|
69
69
|
button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
|
|
70
|
+
button.danger { background: var(--color-bad); border-color: var(--color-bad); color: var(--color-accent-ink); }
|
|
70
71
|
button.primary:hover { filter: brightness(0.94); }
|
|
71
72
|
button:disabled { opacity: 0.45; cursor: default; }
|
|
72
73
|
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
|