@heihei0299/matt-skills 3.0.1 → 3.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.
package/bin/cli.js CHANGED
@@ -340,26 +340,12 @@ async function initCommand({ dest, all }) {
340
340
  async function syncCommand({ dest, all, dryRun, json, upstreamUrl, ref }) {
341
341
  const onlyProgramming = !all;
342
342
  if (dryRun) {
343
- const { compare } = await import('../scripts/sync-upstream.js');
343
+ const { compare, formatComparison } = await import('../scripts/sync-upstream.js');
344
344
  const cmp = await compare({ upstreamUrl, ref, onlyProgramming });
345
345
  if (json) {
346
346
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
347
347
  } else {
348
- const modeHint = onlyProgramming ? '(默认:engineering + 独有所需)' : '(全量上游)';
349
- const lines = [];
350
- lines.push(`上游 HEAD: ${cmp.head}`);
351
- lines.push(`本地非独有: ${cmp.counts.local} 上游: ${cmp.counts.upstream} ${modeHint}`);
352
- lines.push('');
353
- const totalDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length;
354
- if (totalDiff === 0) lines.push('✅ 已是最新,无差异');
355
- else {
356
- if (cmp.result.added.length) lines.push(`新增 (${cmp.result.added.length}): ${cmp.result.added.join(', ')}`);
357
- if (cmp.result.updated.length) lines.push(`更新 (${cmp.result.updated.length}): ${cmp.result.updated.join(', ')}`);
358
- if (cmp.result.renamed.length) lines.push(`重命名 (${cmp.result.renamed.length}): ${cmp.result.renamed.map((r) => `${r.from}→${r.to}`).join(', ')}`);
359
- if (cmp.result.removed.length) lines.push(`删除 (${cmp.result.removed.length}): ${cmp.result.removed.join(', ')}`);
360
- if (cmp.result.same.length) lines.push(`一致 (${cmp.result.same.length}): ${cmp.result.same.join(', ')}`);
361
- }
362
- process.stdout.write(lines.join('\n') + '\n');
348
+ process.stdout.write(formatComparison(cmp) + '\n');
363
349
  }
364
350
  const { rm } = await import('node:fs/promises');
365
351
  await rm(cmp.dest, { recursive: true, force: true });
@@ -559,7 +545,7 @@ function parseInstallArgs(args) {
559
545
  }
560
546
 
561
547
  async function checkCommand(args) {
562
- const { compare } = await import('../scripts/sync-upstream.js');
548
+ const { compare, formatComparison } = await import('../scripts/sync-upstream.js');
563
549
  const json = args.includes('--json');
564
550
  const onlyProgramming = !args.includes('--all');
565
551
  const upstreamIdx = args.indexOf('--upstream');
@@ -572,22 +558,7 @@ async function checkCommand(args) {
572
558
  if (json) {
573
559
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
574
560
  } else {
575
- const lines = [];
576
- lines.push(`上游 HEAD: ${cmp.head}`);
577
- const modeHint = onlyProgramming ? '(默认:engineering + 独有所需)' : '(全量上游)';
578
- lines.push(`本地非独有: ${cmp.counts.local} 上游: ${cmp.counts.upstream} ${modeHint}`);
579
- lines.push('');
580
- const totalDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length;
581
- if (totalDiff === 0) {
582
- lines.push('✅ 已是最新,无差异');
583
- } else {
584
- if (cmp.result.added.length) lines.push(`新增 (${cmp.result.added.length}): ${cmp.result.added.join(', ')}`);
585
- if (cmp.result.updated.length) lines.push(`更新 (${cmp.result.updated.length}): ${cmp.result.updated.join(', ')}`);
586
- if (cmp.result.renamed.length) lines.push(`重命名 (${cmp.result.renamed.length}): ${cmp.result.renamed.map((r) => `${r.from}→${r.to}`).join(', ')}`);
587
- if (cmp.result.removed.length) lines.push(`删除 (${cmp.result.removed.length}): ${cmp.result.removed.join(', ')}`);
588
- if (cmp.result.same.length) lines.push(`一致 (${cmp.result.same.length}): ${cmp.result.same.join(', ')}`);
589
- }
590
- process.stdout.write(lines.join('\n') + '\n');
561
+ process.stdout.write(formatComparison(cmp) + '\n');
591
562
  }
592
563
  const { rm } = await import('node:fs/promises');
593
564
  await rm(cmp.dest, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heihei0299/matt-skills",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Agent skills + 项目配置模板:一条命令初始化 opencode / pi-agent 项目(含 mattpocock/skills 上游技能)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -111,12 +111,12 @@ async function collectLocalSkills(proprietary) {
111
111
  export async function compare({ upstreamUrl, tmpDir, ref, onlyProgramming = true } = {}) {
112
112
  const proprietary = await loadProprietary();
113
113
  const engineering = await loadEngineering();
114
+ const required = await loadRequired();
114
115
  const fetched = await fetchUpstream({ tmpDir, upstreamUrl, ref });
115
116
  const upstreamRoot = fetched.dest;
116
117
  const upstreamMapFull = await collectUpstreamSkills(upstreamRoot);
117
118
  const localMapFull = await collectLocalSkills(proprietary);
118
119
  // 默认范围:engineering 桶(编程)+ 独有所需(config/required.json,如 grill-to-spec 经 grill-with-docs 所需的 grilling);--all 则含全部 productivity
119
- const required = await loadRequired();
120
120
  const upstreamMap = onlyProgramming
121
121
  ? new Map([...upstreamMapFull.entries()].filter(([name, v]) => v.bucket === 'engineering' || required.has(name)))
122
122
  : upstreamMapFull;
@@ -242,7 +242,7 @@ export async function applySync({ upstreamUrl, tmpDir, ref, dryRun = false, forc
242
242
 
243
243
  return { ...cmp, dest: null, actions, head };
244
244
  }
245
- function formatTable(cmp) {
245
+ export function formatComparison(cmp) {
246
246
  const { result, counts, head, onlyProgramming } = cmp;
247
247
  const lines = [];
248
248
  lines.push(`上游 HEAD: ${head}`);
@@ -307,7 +307,7 @@ Options:
307
307
  if (opts.json) {
308
308
  process.stdout.write(JSON.stringify({ head: res.head, result: res.result, actions: res.actions, dryRun: opts.dryRun, onlyProgramming }, null, 2) + '\n');
309
309
  } else {
310
- process.stdout.write(formatTable(res) + '\n');
310
+ process.stdout.write(formatComparison(res) + '\n');
311
311
  if (res.actions.length) {
312
312
  process.stdout.write(`\n已执行 ${res.actions.length} 项:\n`);
313
313
  for (const a of res.actions) process.stdout.write(` - ${a}\n`);
@@ -324,7 +324,7 @@ Options:
324
324
  if (opts.json) {
325
325
  process.stdout.write(JSON.stringify({ head: cmp.head, counts: cmp.counts, result: cmp.result, onlyProgramming }, null, 2) + '\n');
326
326
  } else {
327
- process.stdout.write(formatTable(cmp) + '\n');
327
+ process.stdout.write(formatComparison(cmp) + '\n');
328
328
  }
329
329
  const hasDiff = cmp.result.added.length + cmp.result.updated.length + cmp.result.removed.length + cmp.result.renamed.length > 0;
330
330
  // 清理临时目录