@skillsmith/cli 0.6.3 → 0.6.5
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/CHANGELOG.md +11 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/commands/__meta__/telemetry-coverage.test.d.ts +20 -0
- package/dist/src/commands/__meta__/telemetry-coverage.test.d.ts.map +1 -0
- package/dist/src/commands/__meta__/telemetry-coverage.test.js +118 -0
- package/dist/src/commands/__meta__/telemetry-coverage.test.js.map +1 -0
- package/dist/src/commands/ab-test.d.ts +1 -0
- package/dist/src/commands/ab-test.d.ts.map +1 -1
- package/dist/src/commands/ab-test.js +17 -8
- package/dist/src/commands/ab-test.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +1 -0
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +32 -23
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/audit-collisions.d.ts +1 -4
- package/dist/src/commands/audit-collisions.d.ts.map +1 -1
- package/dist/src/commands/audit-collisions.js +32 -23
- package/dist/src/commands/audit-collisions.js.map +1 -1
- package/dist/src/commands/audit-sources.action.d.ts +37 -0
- package/dist/src/commands/audit-sources.action.d.ts.map +1 -0
- package/dist/src/commands/audit-sources.action.js +321 -0
- package/dist/src/commands/audit-sources.action.js.map +1 -0
- package/dist/src/commands/audit-sources.d.ts +37 -0
- package/dist/src/commands/audit-sources.d.ts.map +1 -0
- package/dist/src/commands/audit-sources.js +55 -0
- package/dist/src/commands/audit-sources.js.map +1 -0
- package/dist/src/commands/audit-sources.test.d.ts +9 -0
- package/dist/src/commands/audit-sources.test.d.ts.map +1 -0
- package/dist/src/commands/audit-sources.test.js +228 -0
- package/dist/src/commands/audit-sources.test.js.map +1 -0
- package/dist/src/commands/audit.d.ts +2 -6
- package/dist/src/commands/audit.d.ts.map +1 -1
- package/dist/src/commands/audit.js +52 -31
- package/dist/src/commands/audit.js.map +1 -1
- package/dist/src/commands/author/index.d.ts +2 -1
- package/dist/src/commands/author/index.d.ts.map +1 -1
- package/dist/src/commands/author/index.js +4 -1
- package/dist/src/commands/author/index.js.map +1 -1
- package/dist/src/commands/author/init.action.d.ts +29 -0
- package/dist/src/commands/author/init.action.d.ts.map +1 -0
- package/dist/src/commands/author/init.action.js +131 -0
- package/dist/src/commands/author/init.action.js.map +1 -0
- package/dist/src/commands/author/init.d.ts +0 -14
- package/dist/src/commands/author/init.d.ts.map +1 -1
- package/dist/src/commands/author/init.js +3 -87
- package/dist/src/commands/author/init.js.map +1 -1
- package/dist/src/commands/author/mcp-init.d.ts +1 -0
- package/dist/src/commands/author/mcp-init.d.ts.map +1 -1
- package/dist/src/commands/author/mcp-init.js +21 -13
- package/dist/src/commands/author/mcp-init.js.map +1 -1
- package/dist/src/commands/author/subagent.d.ts +1 -0
- package/dist/src/commands/author/subagent.d.ts.map +1 -1
- package/dist/src/commands/author/subagent.js +23 -15
- package/dist/src/commands/author/subagent.js.map +1 -1
- package/dist/src/commands/author/transform.d.ts +1 -0
- package/dist/src/commands/author/transform.d.ts.map +1 -1
- package/dist/src/commands/author/transform.js +23 -15
- package/dist/src/commands/author/transform.js.map +1 -1
- package/dist/src/commands/config.d.ts +2 -0
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +43 -28
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/create.d.ts +1 -0
- package/dist/src/commands/create.d.ts.map +1 -1
- package/dist/src/commands/create.js +28 -19
- package/dist/src/commands/create.js.map +1 -1
- package/dist/src/commands/diff.d.ts +4 -0
- package/dist/src/commands/diff.d.ts.map +1 -1
- package/dist/src/commands/diff.js +90 -54
- package/dist/src/commands/diff.js.map +1 -1
- package/dist/src/commands/diff.test.js +52 -0
- package/dist/src/commands/diff.test.js.map +1 -1
- package/dist/src/commands/import-local.d.ts +7 -0
- package/dist/src/commands/import-local.d.ts.map +1 -1
- package/dist/src/commands/import-local.js +43 -34
- package/dist/src/commands/import-local.js.map +1 -1
- package/dist/src/commands/import.d.ts +6 -0
- package/dist/src/commands/import.d.ts.map +1 -1
- package/dist/src/commands/import.js +23 -14
- package/dist/src/commands/import.js.map +1 -1
- package/dist/src/commands/info.d.ts +7 -0
- package/dist/src/commands/info.d.ts.map +1 -1
- package/dist/src/commands/info.js +77 -68
- package/dist/src/commands/info.js.map +1 -1
- package/dist/src/commands/install-skill.d.ts +3 -0
- package/dist/src/commands/install-skill.d.ts.map +1 -1
- package/dist/src/commands/install-skill.js +23 -15
- package/dist/src/commands/install-skill.js.map +1 -1
- package/dist/src/commands/install.d.ts +21 -0
- package/dist/src/commands/install.d.ts.map +1 -1
- package/dist/src/commands/install.js +154 -139
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/login.d.ts +4 -0
- package/dist/src/commands/login.d.ts.map +1 -1
- package/dist/src/commands/login.js +56 -47
- package/dist/src/commands/login.js.map +1 -1
- package/dist/src/commands/logout.d.ts +1 -0
- package/dist/src/commands/logout.d.ts.map +1 -1
- package/dist/src/commands/logout.js +36 -27
- package/dist/src/commands/logout.js.map +1 -1
- package/dist/src/commands/manage.d.ts +3 -9
- package/dist/src/commands/manage.d.ts.map +1 -1
- package/dist/src/commands/manage.js +69 -45
- package/dist/src/commands/manage.js.map +1 -1
- package/dist/src/commands/merge.d.ts +7 -0
- package/dist/src/commands/merge.d.ts.map +1 -1
- package/dist/src/commands/merge.js +117 -108
- package/dist/src/commands/merge.js.map +1 -1
- package/dist/src/commands/pin.d.ts +2 -0
- package/dist/src/commands/pin.d.ts.map +1 -1
- package/dist/src/commands/pin.js +88 -73
- package/dist/src/commands/pin.js.map +1 -1
- package/dist/src/commands/recommend.d.ts +1 -0
- package/dist/src/commands/recommend.d.ts.map +1 -1
- package/dist/src/commands/recommend.js +35 -27
- package/dist/src/commands/recommend.js.map +1 -1
- package/dist/src/commands/search-formatters.d.ts +1 -0
- package/dist/src/commands/search-formatters.d.ts.map +1 -1
- package/dist/src/commands/search-formatters.js +3 -0
- package/dist/src/commands/search-formatters.js.map +1 -1
- package/dist/src/commands/search.action.d.ts +16 -0
- package/dist/src/commands/search.action.d.ts.map +1 -0
- package/dist/src/commands/search.action.js +384 -0
- package/dist/src/commands/search.action.js.map +1 -0
- package/dist/src/commands/search.d.ts +3 -0
- package/dist/src/commands/search.d.ts.map +1 -1
- package/dist/src/commands/search.js +5 -354
- package/dist/src/commands/search.js.map +1 -1
- package/dist/src/commands/sync.action.d.ts +39 -0
- package/dist/src/commands/sync.action.d.ts.map +1 -0
- package/dist/src/commands/sync.action.js +353 -0
- package/dist/src/commands/sync.action.js.map +1 -0
- package/dist/src/commands/sync.d.ts +3 -0
- package/dist/src/commands/sync.d.ts.map +1 -1
- package/dist/src/commands/sync.js +8 -310
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/telemetry.action.d.ts +38 -0
- package/dist/src/commands/telemetry.action.d.ts.map +1 -0
- package/dist/src/commands/telemetry.action.js +350 -0
- package/dist/src/commands/telemetry.action.js.map +1 -0
- package/dist/src/commands/telemetry.d.ts +5 -13
- package/dist/src/commands/telemetry.d.ts.map +1 -1
- package/dist/src/commands/telemetry.js +13 -302
- package/dist/src/commands/telemetry.js.map +1 -1
- package/dist/src/commands/whoami.d.ts +1 -0
- package/dist/src/commands/whoami.d.ts.map +1 -1
- package/dist/src/commands/whoami.js +29 -21
- package/dist/src/commands/whoami.js.map +1 -1
- package/dist/src/utils/open-database.d.ts +10 -2
- package/dist/src/utils/open-database.d.ts.map +1 -1
- package/dist/src/utils/open-database.js +15 -2
- package/dist/src/utils/open-database.js.map +1 -1
- package/dist/src/utils/skills-directory.d.ts.map +1 -1
- package/dist/src/utils/skills-directory.js +5 -1
- package/dist/src/utils/skills-directory.js.map +1 -1
- package/dist/tests/e2e/audit-sources-affix.test.d.ts +11 -0
- package/dist/tests/e2e/audit-sources-affix.test.d.ts.map +1 -0
- package/dist/tests/e2e/audit-sources-affix.test.js +121 -0
- package/dist/tests/e2e/audit-sources-affix.test.js.map +1 -0
- package/dist/tests/e2e/audit-sources-apply.test.d.ts +13 -0
- package/dist/tests/e2e/audit-sources-apply.test.d.ts.map +1 -0
- package/dist/tests/e2e/audit-sources-apply.test.js +166 -0
- package/dist/tests/e2e/audit-sources-apply.test.js.map +1 -0
- package/dist/tests/e2e/audit-sources-recovery.test.d.ts +15 -0
- package/dist/tests/e2e/audit-sources-recovery.test.d.ts.map +1 -0
- package/dist/tests/e2e/audit-sources-recovery.test.js +179 -0
- package/dist/tests/e2e/audit-sources-recovery.test.js.map +1 -0
- package/dist/tests/e2e/audit-sources-roundtrip.test.d.ts +23 -0
- package/dist/tests/e2e/audit-sources-roundtrip.test.d.ts.map +1 -0
- package/dist/tests/e2e/audit-sources-roundtrip.test.js +139 -0
- package/dist/tests/e2e/audit-sources-roundtrip.test.js.map +1 -0
- package/dist/tests/e2e/utils/source-recovery-fixture.d.ts +49 -0
- package/dist/tests/e2e/utils/source-recovery-fixture.d.ts.map +1 -0
- package/dist/tests/e2e/utils/source-recovery-fixture.js +106 -0
- package/dist/tests/e2e/utils/source-recovery-fixture.js.map +1 -0
- package/dist/tests/init.test.js +2 -1
- package/dist/tests/init.test.js.map +1 -1
- package/dist/tests/install-quarantine.test.d.ts +10 -0
- package/dist/tests/install-quarantine.test.d.ts.map +1 -0
- package/dist/tests/install-quarantine.test.js +86 -0
- package/dist/tests/install-quarantine.test.js.map +1 -0
- package/package.json +4 -5
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Action implementation for `sklx audit sources`.
|
|
3
|
+
* @module @skillsmith/cli/commands/audit-sources.action
|
|
4
|
+
* @see SMI-5407
|
|
5
|
+
*
|
|
6
|
+
* Wires SourceRecoveryService (with real findCandidatesByName over the CLI DB)
|
|
7
|
+
* and backfillManifest. Applies an already_tracked overlay after recovery (the
|
|
8
|
+
* core service cannot know the current manifest state).
|
|
9
|
+
*
|
|
10
|
+
* Safety:
|
|
11
|
+
* - Dry-run unless --apply.
|
|
12
|
+
* - --apply requires typed phrase `BACKFILL SOURCES` (waived by --yes).
|
|
13
|
+
* - --write-frontmatter requires --force-write-frontmatter and prints a bold
|
|
14
|
+
* stderr WARNING before proceeding.
|
|
15
|
+
*
|
|
16
|
+
* Output:
|
|
17
|
+
* Human: === Skillsmith — Source Recovery === + table + footer summary.
|
|
18
|
+
* --json: { skills, summary } to stdout, no prompts, no file mutation.
|
|
19
|
+
*/
|
|
20
|
+
import { input } from '@inquirer/prompts';
|
|
21
|
+
import chalk from 'chalk';
|
|
22
|
+
import { hashContent } from '@skillsmith/core/services/skill-installation-helpers';
|
|
23
|
+
import { SourceRecoveryService, defaultSkillsRoot, backfillManifest, parseRepoUrl, skillNameVariants, METHOD_LABELS, } from '@skillsmith/core';
|
|
24
|
+
import { withTelemetry } from '@skillsmith/core/telemetry';
|
|
25
|
+
import { openCliDatabase } from '../utils/open-database.js';
|
|
26
|
+
import { loadManifest } from '../utils/manifest.js';
|
|
27
|
+
import { sanitizeError } from '../utils/sanitize.js';
|
|
28
|
+
import { DEFAULT_DB_PATH } from '../config.js';
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Constants
|
|
31
|
+
// ============================================================================
|
|
32
|
+
const BACKFILL_PHRASE = 'BACKFILL SOURCES';
|
|
33
|
+
const CONFIDENCE_BADGES = {
|
|
34
|
+
exact: '[EXACT]',
|
|
35
|
+
high: '[HIGH]',
|
|
36
|
+
medium: '[MEDIUM]',
|
|
37
|
+
low: '[LOW]',
|
|
38
|
+
'user-specified': '[SET]',
|
|
39
|
+
unknown: '[-]',
|
|
40
|
+
};
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Helpers
|
|
43
|
+
// ============================================================================
|
|
44
|
+
/** Parse `--set` pairs like `"dirName=owner/repo"` → Record. */
|
|
45
|
+
function parseSetPairs(pairs) {
|
|
46
|
+
if (!pairs || pairs.length === 0)
|
|
47
|
+
return {};
|
|
48
|
+
const out = {};
|
|
49
|
+
for (const pair of pairs) {
|
|
50
|
+
const eq = pair.indexOf('=');
|
|
51
|
+
if (eq < 1) {
|
|
52
|
+
console.error(chalk.yellow(`[audit sources] ignoring malformed --set pair: ${pair}`));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
out[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** Parse `minConfidence` CLI value; fall back to `'high'` on unknown input. */
|
|
60
|
+
function parseMinConfidence(value) {
|
|
61
|
+
const valid = ['exact', 'high', 'medium', 'low', 'user-specified'];
|
|
62
|
+
const v = (value ?? 'high');
|
|
63
|
+
return valid.includes(v) ? v : 'high';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Apply the already_tracked overlay: a skill whose manifest entry already has a
|
|
67
|
+
* non-empty source should be marked `already_tracked` (the core service cannot
|
|
68
|
+
* know the current manifest state).
|
|
69
|
+
*
|
|
70
|
+
* Mutates `report.skills` in place and recomputes `report.summary`.
|
|
71
|
+
*/
|
|
72
|
+
async function overlayAlreadyTracked(report) {
|
|
73
|
+
const manifest = await loadManifest();
|
|
74
|
+
const installed = manifest.installedSkills ?? {};
|
|
75
|
+
for (const skill of report.skills) {
|
|
76
|
+
const entry = installed[skill.skillName];
|
|
77
|
+
if (entry && typeof entry.source === 'string' && entry.source.trim().length > 0) {
|
|
78
|
+
skill.status = 'already_tracked';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Recompute summary totals from mutated statuses.
|
|
82
|
+
report.summary.recovered = 0;
|
|
83
|
+
report.summary.already_tracked = 0;
|
|
84
|
+
report.summary.unknown = 0;
|
|
85
|
+
report.summary.skipped_backup = 0;
|
|
86
|
+
for (const skill of report.skills) {
|
|
87
|
+
report.summary[skill.status] += 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// ============================================================================
|
|
91
|
+
// Output — human-readable
|
|
92
|
+
// ============================================================================
|
|
93
|
+
const COL_SKILL = 24;
|
|
94
|
+
const COL_SOURCE = 46;
|
|
95
|
+
const COL_CONF = 12;
|
|
96
|
+
function pad(s, n) {
|
|
97
|
+
return s.length >= n ? s.slice(0, n - 1) + ' ' : s.padEnd(n);
|
|
98
|
+
}
|
|
99
|
+
function sourceCell(skill) {
|
|
100
|
+
if (skill.status === 'already_tracked')
|
|
101
|
+
return '(already tracked)';
|
|
102
|
+
if (skill.status === 'skipped_backup')
|
|
103
|
+
return '(backup — skipped)';
|
|
104
|
+
if (skill.candidates.length > 1)
|
|
105
|
+
return '(ambiguous)';
|
|
106
|
+
if (!skill.recoveredSource)
|
|
107
|
+
return '(unresolved)';
|
|
108
|
+
return skill.recoveredSource.url;
|
|
109
|
+
}
|
|
110
|
+
function confCell(skill) {
|
|
111
|
+
if (skill.status === 'already_tracked' || skill.status === 'skipped_backup')
|
|
112
|
+
return '-';
|
|
113
|
+
return CONFIDENCE_BADGES[skill.confidence] ?? '?';
|
|
114
|
+
}
|
|
115
|
+
function methodCell(skill) {
|
|
116
|
+
if (skill.status === 'already_tracked' || skill.status === 'skipped_backup')
|
|
117
|
+
return '-';
|
|
118
|
+
if (!skill.method)
|
|
119
|
+
return '-';
|
|
120
|
+
return METHOD_LABELS[skill.method] ?? skill.method;
|
|
121
|
+
}
|
|
122
|
+
function printHumanReport(report, applying) {
|
|
123
|
+
console.log(chalk.bold.blue('\n=== Skillsmith — Source Recovery ===\n'));
|
|
124
|
+
const hdr = pad('skill', COL_SKILL) +
|
|
125
|
+
'| ' +
|
|
126
|
+
pad('source', COL_SOURCE) +
|
|
127
|
+
'| ' +
|
|
128
|
+
pad('confidence', COL_CONF) +
|
|
129
|
+
'| method';
|
|
130
|
+
const sep = '-'.repeat(hdr.length);
|
|
131
|
+
console.log(hdr);
|
|
132
|
+
console.log(sep);
|
|
133
|
+
for (const skill of report.skills) {
|
|
134
|
+
const row = pad(skill.skillName, COL_SKILL) +
|
|
135
|
+
'| ' +
|
|
136
|
+
pad(sourceCell(skill), COL_SOURCE) +
|
|
137
|
+
'| ' +
|
|
138
|
+
pad(confCell(skill), COL_CONF) +
|
|
139
|
+
'| ' +
|
|
140
|
+
methodCell(skill);
|
|
141
|
+
console.log(row);
|
|
142
|
+
// Multi-candidate indented row for ambiguous name matches.
|
|
143
|
+
if (skill.candidates.length > 1) {
|
|
144
|
+
const parts = skill.candidates
|
|
145
|
+
.map((c, i) => `(${i + 1}) ${c.owner}/${c.repo}`)
|
|
146
|
+
.join(' ');
|
|
147
|
+
console.log(chalk.dim(` -> ${parts} [ambiguous — --set or --embedding]`));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
console.log();
|
|
151
|
+
const s = report.summary;
|
|
152
|
+
const exactCount = report.skills.filter((sk) => sk.status === 'recovered' && sk.confidence === 'exact').length;
|
|
153
|
+
const highCount = report.skills.filter((sk) => sk.status === 'recovered' && (sk.confidence === 'high' || sk.confidence === 'user-specified')).length;
|
|
154
|
+
console.log(chalk.bold(`Summary: ${s.total} scanned, ${s.recovered} recovered ` +
|
|
155
|
+
`(${exactCount} exact, ${highCount} high), ` +
|
|
156
|
+
`${s.already_tracked} already-tracked, ` +
|
|
157
|
+
`${s.unknown} unresolved, ` +
|
|
158
|
+
`${s.skipped_backup} backups skipped.`));
|
|
159
|
+
if (!applying) {
|
|
160
|
+
console.log(chalk.dim('Dry run — --apply to backfill.'));
|
|
161
|
+
}
|
|
162
|
+
console.log();
|
|
163
|
+
}
|
|
164
|
+
// ============================================================================
|
|
165
|
+
// Typed-confirmation gate
|
|
166
|
+
// ============================================================================
|
|
167
|
+
async function requireBackfillPhrase() {
|
|
168
|
+
const answer = await input({
|
|
169
|
+
message: `Type ${chalk.bold(BACKFILL_PHRASE)} to confirm writing recovered sources to the manifest`,
|
|
170
|
+
});
|
|
171
|
+
if (answer !== BACKFILL_PHRASE) {
|
|
172
|
+
throw new Error(`Confirmation phrase mismatch — operation aborted. ` + `Must be exactly: ${BACKFILL_PHRASE}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// ============================================================================
|
|
176
|
+
// Main entry
|
|
177
|
+
// ============================================================================
|
|
178
|
+
export async function runAuditSources(options) {
|
|
179
|
+
const skillsRoot = options.skillsRoot ?? defaultSkillsRoot();
|
|
180
|
+
const setOverrides = parseSetPairs(options.set);
|
|
181
|
+
const minConfidence = parseMinConfidence(options.minConfidence);
|
|
182
|
+
// --write-frontmatter requires --force-write-frontmatter.
|
|
183
|
+
if (options.writeFrontmatter && !options.forceWriteFrontmatter) {
|
|
184
|
+
console.error(chalk.red('--write-frontmatter requires --force-write-frontmatter. ' +
|
|
185
|
+
'Re-run with both flags to modify SKILL.md files inside installed skill directories.'));
|
|
186
|
+
process.exit(1);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// Bold warning when frontmatter mutation is armed.
|
|
190
|
+
if (options.writeFrontmatter && options.forceWriteFrontmatter) {
|
|
191
|
+
console.error(chalk.bold.yellow('WARNING: --write-frontmatter will modify SKILL.md files inside ' +
|
|
192
|
+
'git-tracked skill repos. This operation is irreversible without a git reset.'));
|
|
193
|
+
}
|
|
194
|
+
// Open local DB (required for findCandidatesByName).
|
|
195
|
+
const db = await openCliDatabase(options.db);
|
|
196
|
+
let report;
|
|
197
|
+
try {
|
|
198
|
+
const findCandidatesByName = async (name) => {
|
|
199
|
+
const variants = skillNameVariants(name);
|
|
200
|
+
const placeholders = variants.map(() => '?').join(', ');
|
|
201
|
+
const rows = db
|
|
202
|
+
.prepare(`SELECT id, name, repo_url, quality_score FROM skills WHERE name IN (${placeholders})`)
|
|
203
|
+
.all(...variants);
|
|
204
|
+
const candidates = [];
|
|
205
|
+
for (const row of rows) {
|
|
206
|
+
if (!row.repo_url)
|
|
207
|
+
continue;
|
|
208
|
+
try {
|
|
209
|
+
const parsed = parseRepoUrl(row.repo_url);
|
|
210
|
+
candidates.push({
|
|
211
|
+
id: row.id,
|
|
212
|
+
name: row.name,
|
|
213
|
+
owner: parsed.owner,
|
|
214
|
+
repo: parsed.repo,
|
|
215
|
+
url: `https://github.com/${parsed.owner}/${parsed.repo}`,
|
|
216
|
+
qualityScore: row.quality_score ?? 0,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
// Non-GitHub repo_url — skip candidate.
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// Prefer an exact-name match so the affix-broadened query never downgrades
|
|
224
|
+
// a clean exact hit to ambiguous; fall back to affix variants. SMI-5413.
|
|
225
|
+
const exact = candidates.filter((c) => c.name.toLowerCase() === name.toLowerCase());
|
|
226
|
+
return exact.length > 0 ? exact : candidates;
|
|
227
|
+
};
|
|
228
|
+
// SMI-5411: enrich a git/plugin-recovered source's manifest id with the
|
|
229
|
+
// registry UUID when the repo is catalog-known. The recovered URL is the
|
|
230
|
+
// canonical `https://github.com/<owner>/<repo>` form, and the catalog stores
|
|
231
|
+
// repo_url in that same canonical form, so an exact match is correct (and
|
|
232
|
+
// safer than normalizing, which would false-positive across monorepo
|
|
233
|
+
// siblings sharing one repo root). Returns null when no row matches.
|
|
234
|
+
const findRegistryIdByRepoUrl = async (repoUrl) => {
|
|
235
|
+
const row = db
|
|
236
|
+
.prepare('SELECT id FROM skills WHERE repo_url = ?')
|
|
237
|
+
.get(repoUrl);
|
|
238
|
+
return row?.id ?? null;
|
|
239
|
+
};
|
|
240
|
+
const service = new SourceRecoveryService({
|
|
241
|
+
hashContent,
|
|
242
|
+
findCandidatesByName,
|
|
243
|
+
findRegistryIdByRepoUrl,
|
|
244
|
+
});
|
|
245
|
+
report = await service.recoverSources({
|
|
246
|
+
skillsRoot,
|
|
247
|
+
enableEmbedding: options.embedding,
|
|
248
|
+
enableCatalogHint: options.catalogHint,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
db.close();
|
|
253
|
+
}
|
|
254
|
+
// Overlay already_tracked status from the current manifest.
|
|
255
|
+
await overlayAlreadyTracked(report);
|
|
256
|
+
// --json: emit raw data, no prompts, no writes.
|
|
257
|
+
if (options.json) {
|
|
258
|
+
process.stdout.write(JSON.stringify({ skills: report.skills, summary: report.summary }, null, 2));
|
|
259
|
+
process.stdout.write('\n');
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
printHumanReport(report, options.apply);
|
|
263
|
+
if (!options.apply)
|
|
264
|
+
return;
|
|
265
|
+
// --apply: confirm and write.
|
|
266
|
+
if (!options.yes) {
|
|
267
|
+
await requireBackfillPhrase();
|
|
268
|
+
}
|
|
269
|
+
const outcome = await backfillManifest(report, {
|
|
270
|
+
minConfidence,
|
|
271
|
+
apply: true,
|
|
272
|
+
setOverrides,
|
|
273
|
+
writeFrontmatter: options.writeFrontmatter,
|
|
274
|
+
});
|
|
275
|
+
if (outcome.written.length > 0) {
|
|
276
|
+
console.log(chalk.green(`Backfilled ${outcome.written.length} skill(s): ${outcome.written.join(', ')}`));
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
console.log(chalk.dim('Nothing new to backfill.'));
|
|
280
|
+
}
|
|
281
|
+
if (outcome.skipped.length > 0) {
|
|
282
|
+
console.log(chalk.dim(`Skipped: ${outcome.skipped.join(', ')}`));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// ============================================================================
|
|
286
|
+
// withTelemetry-wrapped export (SMI-5127+)
|
|
287
|
+
// ============================================================================
|
|
288
|
+
async function auditSourcesActionImpl(skillsRoot, opts) {
|
|
289
|
+
try {
|
|
290
|
+
await runAuditSources({
|
|
291
|
+
skillsRoot,
|
|
292
|
+
apply: opts['apply'] ?? false,
|
|
293
|
+
yes: opts['yes'] ?? false,
|
|
294
|
+
set: opts['set'],
|
|
295
|
+
minConfidence: opts['minConfidence'] ?? 'high',
|
|
296
|
+
json: opts['json'] ?? false,
|
|
297
|
+
embedding: opts['embedding'] ?? false,
|
|
298
|
+
catalogHint: opts['catalogHint'] ?? false,
|
|
299
|
+
writeFrontmatter: opts['writeFrontmatter'] ?? false,
|
|
300
|
+
forceWriteFrontmatter: opts['forceWriteFrontmatter'] ?? false,
|
|
301
|
+
db: opts['db'] ?? DEFAULT_DB_PATH,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
const msg = error instanceof Error ? error.message : sanitizeError(error);
|
|
306
|
+
if (msg.startsWith('Confirmation phrase mismatch')) {
|
|
307
|
+
console.error(chalk.yellow(msg));
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
console.error(chalk.red('Error:'), msg);
|
|
311
|
+
}
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export const auditSourcesAction = withTelemetry(auditSourcesActionImpl, {
|
|
316
|
+
source: 'cli',
|
|
317
|
+
extractSkillId: () => 'audit-sources',
|
|
318
|
+
extractFramework: () => 'cli',
|
|
319
|
+
});
|
|
320
|
+
export { BACKFILL_PHRASE };
|
|
321
|
+
//# sourceMappingURL=audit-sources.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-sources.action.js","sourceRoot":"","sources":["../../../src/commands/audit-sources.action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AAClF,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,GAKd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,M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AU,CAAC,8BAA8B,CAAC,EAAE,CAAC;YACnD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;QAClC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAA;QACzC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,sBAAsB,EAAE;IACtE,MAAM,EAAE,KAAK;IACb,cAAc,EAAE,GAAG,EAAE,CAAC,eAAe;IACrC,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;CAC9B,CAAC,CAAA;AAEF,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `sklx audit sources` — skill source provenance recovery subcommand factory.
|
|
3
|
+
* @module @skillsmith/cli/commands/audit-sources
|
|
4
|
+
* @see SMI-5407
|
|
5
|
+
*
|
|
6
|
+
* Sibling of `sklx audit advisories` and `sklx audit collisions`.
|
|
7
|
+
* Implementation lives in `audit-sources.action.ts` (SMI-5127+ split).
|
|
8
|
+
*
|
|
9
|
+
* Flags:
|
|
10
|
+
* [skillsRoot] Optional positional: override the scan root
|
|
11
|
+
* (default: ~/.claude/skills).
|
|
12
|
+
* --apply Write recovered sources to the manifest.
|
|
13
|
+
* Dry-run when omitted.
|
|
14
|
+
* --yes Skip typed-confirmation gate (requires --apply).
|
|
15
|
+
* --set <pair...> Override: dirName=owner/repo. Repeatable.
|
|
16
|
+
* --min-confidence <c> Minimum confidence to backfill.
|
|
17
|
+
* One of: exact|high|medium|low. Default: high.
|
|
18
|
+
* --json Emit JSON to stdout; no prompts; no file mutation.
|
|
19
|
+
* --embedding Enable embedding tiebreak tier (off by default).
|
|
20
|
+
* --catalog-hint Enable catalog / author hint tier (off by default).
|
|
21
|
+
* --write-frontmatter Write repository: into non-git SKILL.md frontmatter.
|
|
22
|
+
* Requires --force-write-frontmatter.
|
|
23
|
+
* --force-write-frontmatter Confirm SKILL.md mutation (required with
|
|
24
|
+
* --write-frontmatter). Prints a bold warning.
|
|
25
|
+
* -d, --db <path> SQLite database path (default: ~/.skillsmith/skills.db).
|
|
26
|
+
*
|
|
27
|
+
* Community tier (no requireTier call). Read-only by default; --apply enables
|
|
28
|
+
* the manifest write path.
|
|
29
|
+
*/
|
|
30
|
+
import { Command } from 'commander';
|
|
31
|
+
/**
|
|
32
|
+
* Build the `audit sources` subcommand. Registered in `createAuditCommand()`
|
|
33
|
+
* beside `advisories` and `collisions`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createAuditSourcesSubcommand(): Command;
|
|
36
|
+
export default createAuditSourcesSubcommand;
|
|
37
|
+
//# sourceMappingURL=audit-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-sources.d.ts","sourceRoot":"","sources":["../../../src/commands/audit-sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,CA0BtD;AAED,eAAe,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `sklx audit sources` — skill source provenance recovery subcommand factory.
|
|
3
|
+
* @module @skillsmith/cli/commands/audit-sources
|
|
4
|
+
* @see SMI-5407
|
|
5
|
+
*
|
|
6
|
+
* Sibling of `sklx audit advisories` and `sklx audit collisions`.
|
|
7
|
+
* Implementation lives in `audit-sources.action.ts` (SMI-5127+ split).
|
|
8
|
+
*
|
|
9
|
+
* Flags:
|
|
10
|
+
* [skillsRoot] Optional positional: override the scan root
|
|
11
|
+
* (default: ~/.claude/skills).
|
|
12
|
+
* --apply Write recovered sources to the manifest.
|
|
13
|
+
* Dry-run when omitted.
|
|
14
|
+
* --yes Skip typed-confirmation gate (requires --apply).
|
|
15
|
+
* --set <pair...> Override: dirName=owner/repo. Repeatable.
|
|
16
|
+
* --min-confidence <c> Minimum confidence to backfill.
|
|
17
|
+
* One of: exact|high|medium|low. Default: high.
|
|
18
|
+
* --json Emit JSON to stdout; no prompts; no file mutation.
|
|
19
|
+
* --embedding Enable embedding tiebreak tier (off by default).
|
|
20
|
+
* --catalog-hint Enable catalog / author hint tier (off by default).
|
|
21
|
+
* --write-frontmatter Write repository: into non-git SKILL.md frontmatter.
|
|
22
|
+
* Requires --force-write-frontmatter.
|
|
23
|
+
* --force-write-frontmatter Confirm SKILL.md mutation (required with
|
|
24
|
+
* --write-frontmatter). Prints a bold warning.
|
|
25
|
+
* -d, --db <path> SQLite database path (default: ~/.skillsmith/skills.db).
|
|
26
|
+
*
|
|
27
|
+
* Community tier (no requireTier call). Read-only by default; --apply enables
|
|
28
|
+
* the manifest write path.
|
|
29
|
+
*/
|
|
30
|
+
import { Command } from 'commander';
|
|
31
|
+
import { DEFAULT_DB_PATH } from '../config.js';
|
|
32
|
+
import { auditSourcesAction } from './audit-sources.action.js';
|
|
33
|
+
/**
|
|
34
|
+
* Build the `audit sources` subcommand. Registered in `createAuditCommand()`
|
|
35
|
+
* beside `advisories` and `collisions`.
|
|
36
|
+
*/
|
|
37
|
+
export function createAuditSourcesSubcommand() {
|
|
38
|
+
return new Command('sources')
|
|
39
|
+
.description('Recover the canonical GitHub source of locally-installed skills ' +
|
|
40
|
+
'and optionally backfill ~/.skillsmith/manifest.json')
|
|
41
|
+
.argument('[skillsRoot]', 'Root directory to scan (default: ~/.claude/skills)')
|
|
42
|
+
.option('--apply', 'Write recovered sources to the manifest (dry-run by default)', false)
|
|
43
|
+
.option('--yes', 'Skip typed-confirmation phrase (requires --apply)', false)
|
|
44
|
+
.option('--set <pair...>', 'Override source for a skill: dirName=owner/repo (repeatable)')
|
|
45
|
+
.option('--min-confidence <c>', 'Minimum confidence to backfill: exact|high|medium|low', 'high')
|
|
46
|
+
.option('--json', 'Emit JSON to stdout; no prompts; no file mutation', false)
|
|
47
|
+
.option('--embedding', 'Enable embedding tiebreak tier (off by default)', false)
|
|
48
|
+
.option('--catalog-hint', 'Enable catalog / author hint tier (off by default)', false)
|
|
49
|
+
.option('--write-frontmatter', 'Write repository: into non-git SKILL.md frontmatter (requires --force-write-frontmatter)', false)
|
|
50
|
+
.option('--force-write-frontmatter', 'Confirm SKILL.md mutation — required with --write-frontmatter (prints a bold warning)', false)
|
|
51
|
+
.option('-d, --db <path>', 'Database file path', DEFAULT_DB_PATH)
|
|
52
|
+
.action(auditSourcesAction);
|
|
53
|
+
}
|
|
54
|
+
export default createAuditSourcesSubcommand;
|
|
55
|
+
//# sourceMappingURL=audit-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-sources.js","sourceRoot":"","sources":["../../../src/commands/audit-sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D;;;GAGG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SAC1B,WAAW,CACV,kEAAkE;QAChE,qDAAqD,CACxD;SACA,QAAQ,CAAC,cAAc,EAAE,oDAAoD,CAAC;SAC9E,MAAM,CAAC,SAAS,EAAE,8DAA8D,EAAE,KAAK,CAAC;SACxF,MAAM,CAAC,OAAO,EAAE,mDAAmD,EAAE,KAAK,CAAC;SAC3E,MAAM,CAAC,iBAAiB,EAAE,8DAA8D,CAAC;SACzF,MAAM,CAAC,sBAAsB,EAAE,uDAAuD,EAAE,MAAM,CAAC;SAC/F,MAAM,CAAC,QAAQ,EAAE,mDAAmD,EAAE,KAAK,CAAC;SAC5E,MAAM,CAAC,aAAa,EAAE,iDAAiD,EAAE,KAAK,CAAC;SAC/E,MAAM,CAAC,gBAAgB,EAAE,oDAAoD,EAAE,KAAK,CAAC;SACrF,MAAM,CACL,qBAAqB,EACrB,0FAA0F,EAC1F,KAAK,CACN;SACA,MAAM,CACL,2BAA2B,EAC3B,uFAAuF,EACvF,KAAK,CACN;SACA,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,CAAC;SAChE,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAC/B,CAAC;AAED,eAAe,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Unit tests for `sklx audit sources` CLI command.
|
|
3
|
+
* @see SMI-5407: Skill Source Provenance Recovery
|
|
4
|
+
*
|
|
5
|
+
* Tests the action layer (`runAuditSources`) with injected mocks so the test
|
|
6
|
+
* suite runs fully offline without a real DB or skills directory.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=audit-sources.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-sources.test.d.ts","sourceRoot":"","sources":["../../../src/commands/audit-sources.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|