@skillsmith/cli 0.6.3 → 0.6.4

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.
Files changed (178) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/commands/__meta__/telemetry-coverage.test.d.ts +20 -0
  4. package/dist/src/commands/__meta__/telemetry-coverage.test.d.ts.map +1 -0
  5. package/dist/src/commands/__meta__/telemetry-coverage.test.js +118 -0
  6. package/dist/src/commands/__meta__/telemetry-coverage.test.js.map +1 -0
  7. package/dist/src/commands/ab-test.d.ts +1 -0
  8. package/dist/src/commands/ab-test.d.ts.map +1 -1
  9. package/dist/src/commands/ab-test.js +17 -8
  10. package/dist/src/commands/ab-test.js.map +1 -1
  11. package/dist/src/commands/analyze.d.ts +1 -0
  12. package/dist/src/commands/analyze.d.ts.map +1 -1
  13. package/dist/src/commands/analyze.js +32 -23
  14. package/dist/src/commands/analyze.js.map +1 -1
  15. package/dist/src/commands/audit-collisions.d.ts +1 -4
  16. package/dist/src/commands/audit-collisions.d.ts.map +1 -1
  17. package/dist/src/commands/audit-collisions.js +32 -23
  18. package/dist/src/commands/audit-collisions.js.map +1 -1
  19. package/dist/src/commands/audit-sources.action.d.ts +37 -0
  20. package/dist/src/commands/audit-sources.action.d.ts.map +1 -0
  21. package/dist/src/commands/audit-sources.action.js +300 -0
  22. package/dist/src/commands/audit-sources.action.js.map +1 -0
  23. package/dist/src/commands/audit-sources.d.ts +37 -0
  24. package/dist/src/commands/audit-sources.d.ts.map +1 -0
  25. package/dist/src/commands/audit-sources.js +55 -0
  26. package/dist/src/commands/audit-sources.js.map +1 -0
  27. package/dist/src/commands/audit-sources.test.d.ts +9 -0
  28. package/dist/src/commands/audit-sources.test.d.ts.map +1 -0
  29. package/dist/src/commands/audit-sources.test.js +228 -0
  30. package/dist/src/commands/audit-sources.test.js.map +1 -0
  31. package/dist/src/commands/audit.d.ts +2 -6
  32. package/dist/src/commands/audit.d.ts.map +1 -1
  33. package/dist/src/commands/audit.js +52 -31
  34. package/dist/src/commands/audit.js.map +1 -1
  35. package/dist/src/commands/author/index.d.ts +2 -1
  36. package/dist/src/commands/author/index.d.ts.map +1 -1
  37. package/dist/src/commands/author/index.js +4 -1
  38. package/dist/src/commands/author/index.js.map +1 -1
  39. package/dist/src/commands/author/init.action.d.ts +29 -0
  40. package/dist/src/commands/author/init.action.d.ts.map +1 -0
  41. package/dist/src/commands/author/init.action.js +131 -0
  42. package/dist/src/commands/author/init.action.js.map +1 -0
  43. package/dist/src/commands/author/init.d.ts +0 -14
  44. package/dist/src/commands/author/init.d.ts.map +1 -1
  45. package/dist/src/commands/author/init.js +3 -87
  46. package/dist/src/commands/author/init.js.map +1 -1
  47. package/dist/src/commands/author/mcp-init.d.ts +1 -0
  48. package/dist/src/commands/author/mcp-init.d.ts.map +1 -1
  49. package/dist/src/commands/author/mcp-init.js +21 -13
  50. package/dist/src/commands/author/mcp-init.js.map +1 -1
  51. package/dist/src/commands/author/subagent.d.ts +1 -0
  52. package/dist/src/commands/author/subagent.d.ts.map +1 -1
  53. package/dist/src/commands/author/subagent.js +23 -15
  54. package/dist/src/commands/author/subagent.js.map +1 -1
  55. package/dist/src/commands/author/transform.d.ts +1 -0
  56. package/dist/src/commands/author/transform.d.ts.map +1 -1
  57. package/dist/src/commands/author/transform.js +23 -15
  58. package/dist/src/commands/author/transform.js.map +1 -1
  59. package/dist/src/commands/config.d.ts +2 -0
  60. package/dist/src/commands/config.d.ts.map +1 -1
  61. package/dist/src/commands/config.js +43 -28
  62. package/dist/src/commands/config.js.map +1 -1
  63. package/dist/src/commands/create.d.ts +1 -0
  64. package/dist/src/commands/create.d.ts.map +1 -1
  65. package/dist/src/commands/create.js +28 -19
  66. package/dist/src/commands/create.js.map +1 -1
  67. package/dist/src/commands/diff.d.ts +4 -0
  68. package/dist/src/commands/diff.d.ts.map +1 -1
  69. package/dist/src/commands/diff.js +57 -42
  70. package/dist/src/commands/diff.js.map +1 -1
  71. package/dist/src/commands/diff.test.js +30 -0
  72. package/dist/src/commands/diff.test.js.map +1 -1
  73. package/dist/src/commands/import-local.d.ts +7 -0
  74. package/dist/src/commands/import-local.d.ts.map +1 -1
  75. package/dist/src/commands/import-local.js +43 -34
  76. package/dist/src/commands/import-local.js.map +1 -1
  77. package/dist/src/commands/import.d.ts +6 -0
  78. package/dist/src/commands/import.d.ts.map +1 -1
  79. package/dist/src/commands/import.js +23 -14
  80. package/dist/src/commands/import.js.map +1 -1
  81. package/dist/src/commands/info.d.ts +7 -0
  82. package/dist/src/commands/info.d.ts.map +1 -1
  83. package/dist/src/commands/info.js +77 -68
  84. package/dist/src/commands/info.js.map +1 -1
  85. package/dist/src/commands/install-skill.d.ts +3 -0
  86. package/dist/src/commands/install-skill.d.ts.map +1 -1
  87. package/dist/src/commands/install-skill.js +23 -15
  88. package/dist/src/commands/install-skill.js.map +1 -1
  89. package/dist/src/commands/install.d.ts +21 -0
  90. package/dist/src/commands/install.d.ts.map +1 -1
  91. package/dist/src/commands/install.js +154 -139
  92. package/dist/src/commands/install.js.map +1 -1
  93. package/dist/src/commands/login.d.ts +4 -0
  94. package/dist/src/commands/login.d.ts.map +1 -1
  95. package/dist/src/commands/login.js +56 -47
  96. package/dist/src/commands/login.js.map +1 -1
  97. package/dist/src/commands/logout.d.ts +1 -0
  98. package/dist/src/commands/logout.d.ts.map +1 -1
  99. package/dist/src/commands/logout.js +36 -27
  100. package/dist/src/commands/logout.js.map +1 -1
  101. package/dist/src/commands/manage.d.ts +3 -9
  102. package/dist/src/commands/manage.d.ts.map +1 -1
  103. package/dist/src/commands/manage.js +69 -45
  104. package/dist/src/commands/manage.js.map +1 -1
  105. package/dist/src/commands/merge.d.ts +7 -0
  106. package/dist/src/commands/merge.d.ts.map +1 -1
  107. package/dist/src/commands/merge.js +117 -108
  108. package/dist/src/commands/merge.js.map +1 -1
  109. package/dist/src/commands/pin.d.ts +2 -0
  110. package/dist/src/commands/pin.d.ts.map +1 -1
  111. package/dist/src/commands/pin.js +88 -73
  112. package/dist/src/commands/pin.js.map +1 -1
  113. package/dist/src/commands/recommend.d.ts +1 -0
  114. package/dist/src/commands/recommend.d.ts.map +1 -1
  115. package/dist/src/commands/recommend.js +35 -27
  116. package/dist/src/commands/recommend.js.map +1 -1
  117. package/dist/src/commands/search-formatters.d.ts +1 -0
  118. package/dist/src/commands/search-formatters.d.ts.map +1 -1
  119. package/dist/src/commands/search-formatters.js +3 -0
  120. package/dist/src/commands/search-formatters.js.map +1 -1
  121. package/dist/src/commands/search.action.d.ts +16 -0
  122. package/dist/src/commands/search.action.d.ts.map +1 -0
  123. package/dist/src/commands/search.action.js +384 -0
  124. package/dist/src/commands/search.action.js.map +1 -0
  125. package/dist/src/commands/search.d.ts +3 -0
  126. package/dist/src/commands/search.d.ts.map +1 -1
  127. package/dist/src/commands/search.js +5 -354
  128. package/dist/src/commands/search.js.map +1 -1
  129. package/dist/src/commands/sync.action.d.ts +39 -0
  130. package/dist/src/commands/sync.action.d.ts.map +1 -0
  131. package/dist/src/commands/sync.action.js +353 -0
  132. package/dist/src/commands/sync.action.js.map +1 -0
  133. package/dist/src/commands/sync.d.ts +3 -0
  134. package/dist/src/commands/sync.d.ts.map +1 -1
  135. package/dist/src/commands/sync.js +8 -310
  136. package/dist/src/commands/sync.js.map +1 -1
  137. package/dist/src/commands/telemetry.action.d.ts +38 -0
  138. package/dist/src/commands/telemetry.action.d.ts.map +1 -0
  139. package/dist/src/commands/telemetry.action.js +350 -0
  140. package/dist/src/commands/telemetry.action.js.map +1 -0
  141. package/dist/src/commands/telemetry.d.ts +5 -13
  142. package/dist/src/commands/telemetry.d.ts.map +1 -1
  143. package/dist/src/commands/telemetry.js +13 -302
  144. package/dist/src/commands/telemetry.js.map +1 -1
  145. package/dist/src/commands/whoami.d.ts +1 -0
  146. package/dist/src/commands/whoami.d.ts.map +1 -1
  147. package/dist/src/commands/whoami.js +29 -21
  148. package/dist/src/commands/whoami.js.map +1 -1
  149. package/dist/src/utils/open-database.d.ts +10 -2
  150. package/dist/src/utils/open-database.d.ts.map +1 -1
  151. package/dist/src/utils/open-database.js +15 -2
  152. package/dist/src/utils/open-database.js.map +1 -1
  153. package/dist/src/utils/skills-directory.d.ts.map +1 -1
  154. package/dist/src/utils/skills-directory.js +5 -1
  155. package/dist/src/utils/skills-directory.js.map +1 -1
  156. package/dist/tests/e2e/audit-sources-apply.test.d.ts +13 -0
  157. package/dist/tests/e2e/audit-sources-apply.test.d.ts.map +1 -0
  158. package/dist/tests/e2e/audit-sources-apply.test.js +166 -0
  159. package/dist/tests/e2e/audit-sources-apply.test.js.map +1 -0
  160. package/dist/tests/e2e/audit-sources-recovery.test.d.ts +15 -0
  161. package/dist/tests/e2e/audit-sources-recovery.test.d.ts.map +1 -0
  162. package/dist/tests/e2e/audit-sources-recovery.test.js +179 -0
  163. package/dist/tests/e2e/audit-sources-recovery.test.js.map +1 -0
  164. package/dist/tests/e2e/audit-sources-roundtrip.test.d.ts +23 -0
  165. package/dist/tests/e2e/audit-sources-roundtrip.test.d.ts.map +1 -0
  166. package/dist/tests/e2e/audit-sources-roundtrip.test.js +107 -0
  167. package/dist/tests/e2e/audit-sources-roundtrip.test.js.map +1 -0
  168. package/dist/tests/e2e/utils/source-recovery-fixture.d.ts +49 -0
  169. package/dist/tests/e2e/utils/source-recovery-fixture.d.ts.map +1 -0
  170. package/dist/tests/e2e/utils/source-recovery-fixture.js +106 -0
  171. package/dist/tests/e2e/utils/source-recovery-fixture.js.map +1 -0
  172. package/dist/tests/init.test.js +2 -1
  173. package/dist/tests/init.test.js.map +1 -1
  174. package/dist/tests/install-quarantine.test.d.ts +10 -0
  175. package/dist/tests/install-quarantine.test.d.ts.map +1 -0
  176. package/dist/tests/install-quarantine.test.js +86 -0
  177. package/dist/tests/install-quarantine.test.js.map +1 -0
  178. package/package.json +4 -5
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @fileoverview SMI-5407 end-to-end — `sklx audit sources --apply` write paths.
3
+ *
4
+ * Real temp manifest (redirected via $HOME) + real temp SQLite. Covers:
5
+ * 3. Collision safety — ambiguous low match is NOT auto-written; `--set` then
6
+ * writes the user-specified owner/skill-name id + https source.
7
+ * 6. Idempotency + never-clobber — a second `--apply` is a no-op; a pre-existing
8
+ * healthy entry with a differing source is left untouched.
9
+ * 8. --write-frontmatter churn guard — never writes `repository:` into a `.git`
10
+ * dir or when one already exists; DOES write into a non-git dir lacking it.
11
+ */
12
+ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';
13
+ import * as fs from 'node:fs';
14
+ import * as os from 'node:os';
15
+ import * as path from 'node:path';
16
+ import { writeSourceFixture, seedSkillsDb, skillMd, FIXTURE_DIRS, } from './utils/source-recovery-fixture.js';
17
+ let runAuditSources;
18
+ let tempHome = '';
19
+ let skillsRoot = '';
20
+ let manifestPath = '';
21
+ let originalHome;
22
+ let dbCounter = 0;
23
+ function makeOpts(o) {
24
+ return {
25
+ skillsRoot: o.skillsRoot ?? skillsRoot,
26
+ apply: o.apply ?? false,
27
+ yes: o.yes ?? false,
28
+ set: o.set,
29
+ minConfidence: o.minConfidence ?? 'high',
30
+ json: o.json ?? false,
31
+ embedding: false,
32
+ catalogHint: false,
33
+ writeFrontmatter: o.writeFrontmatter ?? false,
34
+ forceWriteFrontmatter: o.forceWriteFrontmatter ?? false,
35
+ db: o.db,
36
+ };
37
+ }
38
+ function readManifest() {
39
+ return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
40
+ }
41
+ function entry(name) {
42
+ return readManifest().installedSkills[name];
43
+ }
44
+ async function seededDb() {
45
+ const dbPath = path.join(tempHome, `cands-${dbCounter++}.db`);
46
+ await seedSkillsDb(dbPath, [
47
+ { id: 'coll-1', name: FIXTURE_DIRS.collision, repoUrl: 'https://github.com/coll1/repoA' },
48
+ { id: 'coll-2', name: FIXTURE_DIRS.collision, repoUrl: 'https://github.com/coll2/repoB' },
49
+ ]);
50
+ return dbPath;
51
+ }
52
+ async function emptyDb() {
53
+ const dbPath = path.join(tempHome, `empty-${dbCounter++}.db`);
54
+ await seedSkillsDb(dbPath, []);
55
+ return dbPath;
56
+ }
57
+ beforeAll(async () => {
58
+ originalHome = process.env['HOME'];
59
+ tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-apply-home-'));
60
+ process.env['HOME'] = tempHome;
61
+ skillsRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-apply-skills-'));
62
+ manifestPath = path.join(tempHome, '.skillsmith', 'manifest.json');
63
+ writeSourceFixture(skillsRoot);
64
+ ({ runAuditSources } = await import('../../src/commands/audit-sources.action.js'));
65
+ });
66
+ afterAll(() => {
67
+ if (originalHome === undefined)
68
+ delete process.env['HOME'];
69
+ else
70
+ process.env['HOME'] = originalHome;
71
+ for (const dir of [tempHome, skillsRoot]) {
72
+ if (dir)
73
+ fs.rmSync(dir, { recursive: true, force: true });
74
+ }
75
+ });
76
+ beforeEach(() => {
77
+ fs.rmSync(manifestPath, { force: true });
78
+ });
79
+ describe('SMI-5407 e2e — collision safety (scenario 3)', () => {
80
+ it('does not auto-write an ambiguous (low) collision, then writes it via --set', async () => {
81
+ const db = await seededDb();
82
+ // Default min high: the low collision match must NOT land in the manifest.
83
+ await runAuditSources(makeOpts({ db, apply: true, yes: true }));
84
+ expect(entry(FIXTURE_DIRS.collision)).toBeUndefined();
85
+ // git + plugin (exact/high) DID land.
86
+ expect(entry(FIXTURE_DIRS.git)).toBeDefined();
87
+ expect(entry(FIXTURE_DIRS.plugin)).toBeDefined();
88
+ // --set resolves it explicitly at user-specified confidence.
89
+ await runAuditSources(makeOpts({
90
+ db,
91
+ apply: true,
92
+ yes: true,
93
+ set: [`${FIXTURE_DIRS.collision}=picked-owner/picked-repo`],
94
+ }));
95
+ const resolved = entry(FIXTURE_DIRS.collision);
96
+ expect(resolved).toBeDefined();
97
+ expect(resolved.id).toBe(`picked-owner/${FIXTURE_DIRS.collision}`);
98
+ expect(resolved.source).toBe('https://github.com/picked-owner/picked-repo');
99
+ });
100
+ });
101
+ describe('SMI-5407 e2e — idempotency + never-clobber (scenario 6)', () => {
102
+ it('a second --apply writes nothing and leaves the manifest byte-identical', async () => {
103
+ const db = await emptyDb();
104
+ await runAuditSources(makeOpts({ db, apply: true, yes: true }));
105
+ const afterFirst = fs.readFileSync(manifestPath, 'utf-8');
106
+ await runAuditSources(makeOpts({ db, apply: true, yes: true }));
107
+ const afterSecond = fs.readFileSync(manifestPath, 'utf-8');
108
+ expect(afterSecond).toBe(afterFirst);
109
+ });
110
+ it('never clobbers a healthy pre-existing entry whose source differs', async () => {
111
+ const preExisting = {
112
+ version: '1.0.0',
113
+ installedSkills: {
114
+ [FIXTURE_DIRS.git]: {
115
+ id: 'preexisting-id',
116
+ name: FIXTURE_DIRS.git,
117
+ version: '9.9.9',
118
+ source: 'https://github.com/someoneelse/different',
119
+ installPath: path.join(skillsRoot, FIXTURE_DIRS.git),
120
+ installedAt: '2020-01-01T00:00:00.000Z',
121
+ lastUpdated: '2020-01-01T00:00:00.000Z',
122
+ },
123
+ },
124
+ };
125
+ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
126
+ fs.writeFileSync(manifestPath, JSON.stringify(preExisting, null, 2));
127
+ await runAuditSources(makeOpts({ db: await emptyDb(), apply: true, yes: true }));
128
+ const git = entry(FIXTURE_DIRS.git);
129
+ expect(git.id).toBe('preexisting-id');
130
+ expect(git.source).toBe('https://github.com/someoneelse/different');
131
+ expect(git.version).toBe('9.9.9');
132
+ });
133
+ });
134
+ describe('SMI-5407 e2e — --write-frontmatter churn guard (scenario 8)', () => {
135
+ it('writes repository: only into non-git dirs lacking one', async () => {
136
+ // Isolated, mutable fixture (write-frontmatter rewrites SKILL.md).
137
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-fm-'));
138
+ writeSourceFixture(root); // provides git-skill (.git) + plugin-skill (plugin.json)
139
+ const nosrc = path.join(root, 'nosrc-skill');
140
+ fs.mkdirSync(nosrc, { recursive: true });
141
+ fs.writeFileSync(path.join(nosrc, 'SKILL.md'), skillMd('nosrc-skill'));
142
+ const hasrepo = path.join(root, 'hasrepo-skill');
143
+ fs.mkdirSync(hasrepo, { recursive: true });
144
+ fs.writeFileSync(path.join(hasrepo, 'SKILL.md'), skillMd('hasrepo-skill', 'repository: https://github.com/existing/existing'));
145
+ const gitBefore = fs.readFileSync(path.join(root, FIXTURE_DIRS.git, 'SKILL.md'), 'utf-8');
146
+ const hasrepoBefore = fs.readFileSync(path.join(hasrepo, 'SKILL.md'), 'utf-8');
147
+ await runAuditSources(makeOpts({
148
+ db: await emptyDb(),
149
+ skillsRoot: root,
150
+ apply: true,
151
+ yes: true,
152
+ writeFrontmatter: true,
153
+ forceWriteFrontmatter: true,
154
+ set: ['nosrc-skill=me/no', 'hasrepo-skill=me/has'],
155
+ }));
156
+ // .git dir: never rewritten.
157
+ expect(fs.readFileSync(path.join(root, FIXTURE_DIRS.git, 'SKILL.md'), 'utf-8')).toBe(gitBefore);
158
+ // Non-git, no existing repository: gets the recovered source written in.
159
+ expect(fs.readFileSync(path.join(root, FIXTURE_DIRS.plugin, 'SKILL.md'), 'utf-8')).toContain('repository: https://github.com/o/r');
160
+ expect(fs.readFileSync(path.join(nosrc, 'SKILL.md'), 'utf-8')).toContain('repository: https://github.com/me/no');
161
+ // Already-present repository: never duplicated / overwritten.
162
+ expect(fs.readFileSync(path.join(hasrepo, 'SKILL.md'), 'utf-8')).toBe(hasrepoBefore);
163
+ fs.rmSync(root, { recursive: true, force: true });
164
+ });
165
+ });
166
+ //# sourceMappingURL=audit-sources-apply.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-sources-apply.test.js","sourceRoot":"","sources":["../../../tests/e2e/audit-sources-apply.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ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,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC/F,yEAAyE;QACzE,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAC1F,oCAAoC,CACrC,CAAA;QACD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CACtE,sCAAsC,CACvC,CAAA;QACD,8DAA8D;QAC9D,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAEpF,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview SMI-5407 end-to-end — `sklx audit sources` recovery (read paths).
3
+ *
4
+ * Real temp filesystem fixture + real temp SQLite (seeded `skills`) + real temp
5
+ * manifest (redirected via $HOME). No value-baked mocks: the only injected edge
6
+ * is network absence (an empty / unseeded candidate DB). Covers:
7
+ * 1. CLI full-path `--json` — per-dir method/confidence/status; no manifest write.
8
+ * 4. ssh-vs-https — both git fixtures normalize to one owner/repo + parse via buildRawUrl.
9
+ * 7. Offline degradation — empty DB: git+plugin resolve, registry/collision unknown, no throw.
10
+ *
11
+ * $HOME is set BEFORE the dynamic import of the action module so its
12
+ * module-level MANIFEST_PATH (utils/manifest.ts) freezes onto the temp home.
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=audit-sources-recovery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-sources-recovery.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/audit-sources-recovery.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @fileoverview SMI-5407 end-to-end — `sklx audit sources` recovery (read paths).
3
+ *
4
+ * Real temp filesystem fixture + real temp SQLite (seeded `skills`) + real temp
5
+ * manifest (redirected via $HOME). No value-baked mocks: the only injected edge
6
+ * is network absence (an empty / unseeded candidate DB). Covers:
7
+ * 1. CLI full-path `--json` — per-dir method/confidence/status; no manifest write.
8
+ * 4. ssh-vs-https — both git fixtures normalize to one owner/repo + parse via buildRawUrl.
9
+ * 7. Offline degradation — empty DB: git+plugin resolve, registry/collision unknown, no throw.
10
+ *
11
+ * $HOME is set BEFORE the dynamic import of the action module so its
12
+ * module-level MANIFEST_PATH (utils/manifest.ts) freezes onto the temp home.
13
+ */
14
+ import { describe, it, expect, beforeAll, afterAll, beforeEach, vi } from 'vitest';
15
+ import * as fs from 'node:fs';
16
+ import * as os from 'node:os';
17
+ import * as path from 'node:path';
18
+ import { writeSourceFixture, seedSkillsDb, buildRawUrl, FIXTURE_DIRS, GIT_OWNER, GIT_REPO, } from './utils/source-recovery-fixture.js';
19
+ let runAuditSources;
20
+ let tempHome = '';
21
+ let skillsRoot = '';
22
+ let manifestPath = '';
23
+ let originalHome;
24
+ let dbCounter = 0;
25
+ function makeOpts(o) {
26
+ return {
27
+ skillsRoot,
28
+ apply: o.apply ?? false,
29
+ yes: o.yes ?? false,
30
+ set: o.set,
31
+ minConfidence: o.minConfidence ?? 'high',
32
+ json: o.json ?? false,
33
+ embedding: false,
34
+ catalogHint: false,
35
+ writeFrontmatter: o.writeFrontmatter ?? false,
36
+ forceWriteFrontmatter: o.forceWriteFrontmatter ?? false,
37
+ db: o.db,
38
+ };
39
+ }
40
+ /** Run `audit sources --json` and return the parsed `{ skills, summary }`. */
41
+ async function runJson(dbPath) {
42
+ const chunks = [];
43
+ const spy = vi
44
+ .spyOn(process.stdout, 'write')
45
+ .mockImplementation((chunk) => {
46
+ chunks.push(typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf-8'));
47
+ return true;
48
+ });
49
+ try {
50
+ await runAuditSources(makeOpts({ db: dbPath, json: true }));
51
+ }
52
+ finally {
53
+ spy.mockRestore();
54
+ }
55
+ return JSON.parse(chunks.join('').trim());
56
+ }
57
+ function bySkill(skills, name) {
58
+ const found = skills.find((s) => s.skillName === name);
59
+ if (!found)
60
+ throw new Error(`fixture skill not found in report: ${name}`);
61
+ return found;
62
+ }
63
+ /** A fresh seeded candidate DB: registry-skill (1 row) + collision-skill (2 rows). */
64
+ async function seededDb() {
65
+ const dbPath = path.join(tempHome, `cands-${dbCounter++}.db`);
66
+ await seedSkillsDb(dbPath, [
67
+ {
68
+ id: 'reg-uuid-0001',
69
+ name: FIXTURE_DIRS.registry,
70
+ repoUrl: 'https://github.com/regowner/regrepo',
71
+ },
72
+ {
73
+ id: 'coll-uuid-0001',
74
+ name: FIXTURE_DIRS.collision,
75
+ repoUrl: 'https://github.com/coll1/repoA',
76
+ },
77
+ {
78
+ id: 'coll-uuid-0002',
79
+ name: FIXTURE_DIRS.collision,
80
+ repoUrl: 'https://github.com/coll2/repoB',
81
+ },
82
+ ]);
83
+ return dbPath;
84
+ }
85
+ /** A fresh EMPTY candidate DB (no skills rows) — models the offline path. */
86
+ async function emptyDb() {
87
+ const dbPath = path.join(tempHome, `empty-${dbCounter++}.db`);
88
+ await seedSkillsDb(dbPath, []);
89
+ return dbPath;
90
+ }
91
+ beforeAll(async () => {
92
+ originalHome = process.env['HOME'];
93
+ tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-recov-home-'));
94
+ process.env['HOME'] = tempHome;
95
+ skillsRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-recov-skills-'));
96
+ manifestPath = path.join(tempHome, '.skillsmith', 'manifest.json');
97
+ writeSourceFixture(skillsRoot);
98
+ ({ runAuditSources } = await import('../../src/commands/audit-sources.action.js'));
99
+ });
100
+ afterAll(() => {
101
+ if (originalHome === undefined)
102
+ delete process.env['HOME'];
103
+ else
104
+ process.env['HOME'] = originalHome;
105
+ for (const dir of [tempHome, skillsRoot]) {
106
+ if (dir)
107
+ fs.rmSync(dir, { recursive: true, force: true });
108
+ }
109
+ });
110
+ beforeEach(() => {
111
+ fs.rmSync(manifestPath, { force: true });
112
+ });
113
+ describe('SMI-5407 e2e — audit sources --json (scenario 1)', () => {
114
+ it('reports the correct method/confidence/status per directory', async () => {
115
+ const { skills, summary } = await runJson(await seededDb());
116
+ const git = bySkill(skills, FIXTURE_DIRS.git);
117
+ expect(git.method).toBe('git-remote');
118
+ expect(git.confidence).toBe('exact');
119
+ expect(git.status).toBe('recovered');
120
+ const plugin = bySkill(skills, FIXTURE_DIRS.plugin);
121
+ expect(plugin.method).toBe('plugin-json');
122
+ expect(plugin.confidence).toBe('high');
123
+ expect(plugin.status).toBe('recovered');
124
+ const registry = bySkill(skills, FIXTURE_DIRS.registry);
125
+ expect(registry.method).toBe('registry-name');
126
+ expect(registry.confidence).toBe('medium');
127
+ expect(registry.registryId).toBe('reg-uuid-0001');
128
+ expect(registry.status).toBe('recovered');
129
+ const collision = bySkill(skills, FIXTURE_DIRS.collision);
130
+ expect(collision.candidates).toHaveLength(2);
131
+ expect(collision.confidence).toBe('low');
132
+ expect(collision.status).toBe('unknown');
133
+ const backup = bySkill(skills, FIXTURE_DIRS.backup);
134
+ expect(backup.status).toBe('skipped_backup');
135
+ const unknown = bySkill(skills, FIXTURE_DIRS.unknown);
136
+ expect(unknown.status).toBe('unknown');
137
+ expect(unknown.confidence).toBe('unknown');
138
+ // Summary echoes the per-dir tally (3 recovered: git + https + plugin).
139
+ expect(summary['skipped_backup']).toBe(1);
140
+ expect(summary['total']).toBe(skills.length);
141
+ });
142
+ it('does not write the manifest on a dry-run (--json)', async () => {
143
+ await runJson(await seededDb());
144
+ expect(fs.existsSync(manifestPath)).toBe(false);
145
+ });
146
+ });
147
+ describe('SMI-5407 e2e — ssh vs https git remotes (scenario 4)', () => {
148
+ it('normalizes both git fixtures to one owner/repo and a buildRawUrl-parseable source', async () => {
149
+ const { skills } = await runJson(await seededDb());
150
+ const git = bySkill(skills, FIXTURE_DIRS.git);
151
+ const https = bySkill(skills, FIXTURE_DIRS.https);
152
+ for (const result of [git, https]) {
153
+ expect(result.recoveredSource).not.toBeNull();
154
+ expect(result.recoveredSource?.owner).toBe(GIT_OWNER);
155
+ expect(result.recoveredSource?.repo).toBe(GIT_REPO);
156
+ expect(result.recoveredSource?.url).toBe(`https://github.com/${GIT_OWNER}/${GIT_REPO}`);
157
+ expect(buildRawUrl(result.recoveredSource.url)).toBe(`https://raw.githubusercontent.com/${GIT_OWNER}/${GIT_REPO}/main/SKILL.md`);
158
+ }
159
+ expect(git.recoveredSource).toEqual(https.recoveredSource);
160
+ });
161
+ });
162
+ describe('SMI-5407 e2e — offline degradation (scenario 7)', () => {
163
+ it('resolves git+plugin and degrades registry/collision to unknown without throwing', async () => {
164
+ let report;
165
+ await expect((async () => {
166
+ report = await runJson(await emptyDb());
167
+ })()).resolves.toBeUndefined();
168
+ const skills = report.skills;
169
+ expect(bySkill(skills, FIXTURE_DIRS.git).status).toBe('recovered');
170
+ expect(bySkill(skills, FIXTURE_DIRS.https).status).toBe('recovered');
171
+ expect(bySkill(skills, FIXTURE_DIRS.plugin).status).toBe('recovered');
172
+ // With no candidate rows, the name tiers degrade — no throw, no network.
173
+ expect(bySkill(skills, FIXTURE_DIRS.registry).status).toBe('unknown');
174
+ expect(bySkill(skills, FIXTURE_DIRS.registry).confidence).toBe('unknown');
175
+ expect(bySkill(skills, FIXTURE_DIRS.collision).status).toBe('unknown');
176
+ expect(bySkill(skills, FIXTURE_DIRS.collision).candidates).toHaveLength(0);
177
+ });
178
+ });
179
+ //# sourceMappingURL=audit-sources-recovery.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-sources-recovery.test.js","sourceRoot":"","sources":["../../../tests/e2e/audit-sources-recovery.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAClF,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAA;AAI3C,IAAI,eAA0D,CAAA;AAC9D,IAAI,QAAQ,GAAG,EAAE,CAAA;AACjB,IAAI,UAAU,GAAG,EAAE,CAAA;AACnB,IAAI,YAAY,GAAG,EAAE,CAAA;AACrB,IAAI,YAAgC,CAAA;AACpC,IAAI,SAAS,GAAG,CAAC,CAAA;AAEjB,SAAS,QAAQ,CAAC,CAAgD;IAChE,OAAO;QACL,UAAU;QACV,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK;QACvB,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,KAAK;QACnB,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,MAAM;QACxC,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK;QACrB,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;QAClB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB,IAAI,KAAK;QAC7C,qBAAqB,EAAE,CAAC,CAAC,qBAAqB,IAAI,KAAK;QACvD,EAAE,EAAE,CAAC,CAAC,EAAE;KACT,CAAA;A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AQ,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACzE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACtE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview SMI-5407 end-to-end — GATE (write half): recover -> backfill.
3
+ *
4
+ * Drives the REAL CLI apply path (`audit sources --apply --yes --min-confidence
5
+ * medium`) into a REAL temp manifest and asserts the load-bearing backfill keys:
6
+ * - a single registry-name match (medium) writes the registry UUID as `id`
7
+ * (the only id form `skill_outdated` can resolve a registry skill by);
8
+ * - a git remote (exact) writes an owner/skill-name `id` (no UUID — the git
9
+ * tier has none);
10
+ * - both write an https `source` that `buildRawUrl` accepts (View-Changes).
11
+ *
12
+ * The READ half — that real `skill_outdated` resolves the UUID id (and NOT the
13
+ * owner/skill-name, owner/repo, or URL decoy forms), while the git owner/skill-
14
+ * name id resolves to `unknown` yet keeps a working View-Changes source — lives
15
+ * in `packages/mcp-server/src/__tests__/skill-outdated-resolution.test.ts`.
16
+ * It cannot live here: importing the mcp-server `executeOutdated`/`ToolContext`
17
+ * source across the package boundary is structurally invalid under the CLI
18
+ * tsconfig rootDir (TS6059/TS6307), and those symbols are not part of the
19
+ * mcp-server package's public exports. The shared REG_UUID + manifest shape are
20
+ * the contract linking the two halves.
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=audit-sources-roundtrip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-sources-roundtrip.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/audit-sources-roundtrip.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @fileoverview SMI-5407 end-to-end — GATE (write half): recover -> backfill.
3
+ *
4
+ * Drives the REAL CLI apply path (`audit sources --apply --yes --min-confidence
5
+ * medium`) into a REAL temp manifest and asserts the load-bearing backfill keys:
6
+ * - a single registry-name match (medium) writes the registry UUID as `id`
7
+ * (the only id form `skill_outdated` can resolve a registry skill by);
8
+ * - a git remote (exact) writes an owner/skill-name `id` (no UUID — the git
9
+ * tier has none);
10
+ * - both write an https `source` that `buildRawUrl` accepts (View-Changes).
11
+ *
12
+ * The READ half — that real `skill_outdated` resolves the UUID id (and NOT the
13
+ * owner/skill-name, owner/repo, or URL decoy forms), while the git owner/skill-
14
+ * name id resolves to `unknown` yet keeps a working View-Changes source — lives
15
+ * in `packages/mcp-server/src/__tests__/skill-outdated-resolution.test.ts`.
16
+ * It cannot live here: importing the mcp-server `executeOutdated`/`ToolContext`
17
+ * source across the package boundary is structurally invalid under the CLI
18
+ * tsconfig rootDir (TS6059/TS6307), and those symbols are not part of the
19
+ * mcp-server package's public exports. The shared REG_UUID + manifest shape are
20
+ * the contract linking the two halves.
21
+ */
22
+ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';
23
+ import * as fs from 'node:fs';
24
+ import * as os from 'node:os';
25
+ import * as path from 'node:path';
26
+ import { writeSourceFixture, seedSkillsDb, buildRawUrl, FIXTURE_DIRS, GIT_OWNER, GIT_REPO, } from './utils/source-recovery-fixture.js';
27
+ let runAuditSources;
28
+ let tempHome = '';
29
+ let skillsRoot = '';
30
+ let manifestPath = '';
31
+ let originalHome;
32
+ let dbCounter = 0;
33
+ // git tier: owner/skill-name id (no registry UUID).
34
+ const GIT_ID = `${GIT_OWNER}/${FIXTURE_DIRS.git}`;
35
+ // registry tier: a single-name match carrying the UUID.
36
+ const REG_UUID = 'a1b2c3d4-0000-4000-8000-000000000001';
37
+ const REG_OWNER = 'regowner';
38
+ const REG_REPO = 'regrepo';
39
+ const REG_SOURCE = `https://github.com/${REG_OWNER}/${REG_REPO}`;
40
+ function makeOpts(o) {
41
+ return {
42
+ skillsRoot,
43
+ apply: o.apply ?? false,
44
+ yes: o.yes ?? false,
45
+ set: o.set,
46
+ minConfidence: o.minConfidence ?? 'high',
47
+ json: o.json ?? false,
48
+ embedding: false,
49
+ catalogHint: false,
50
+ writeFrontmatter: false,
51
+ forceWriteFrontmatter: false,
52
+ db: o.db,
53
+ };
54
+ }
55
+ function entry(name) {
56
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
57
+ return manifest.installedSkills[name];
58
+ }
59
+ beforeAll(async () => {
60
+ originalHome = process.env['HOME'];
61
+ tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-rt-home-'));
62
+ process.env['HOME'] = tempHome;
63
+ skillsRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'smi5407-rt-skills-'));
64
+ manifestPath = path.join(tempHome, '.skillsmith', 'manifest.json');
65
+ writeSourceFixture(skillsRoot);
66
+ ({ runAuditSources } = await import('../../src/commands/audit-sources.action.js'));
67
+ });
68
+ afterAll(() => {
69
+ if (originalHome === undefined)
70
+ delete process.env['HOME'];
71
+ else
72
+ process.env['HOME'] = originalHome;
73
+ for (const dir of [tempHome, skillsRoot]) {
74
+ if (dir)
75
+ fs.rmSync(dir, { recursive: true, force: true });
76
+ }
77
+ });
78
+ beforeEach(() => {
79
+ fs.rmSync(manifestPath, { force: true });
80
+ });
81
+ describe('SMI-5407 e2e GATE (write) — recover -> backfill (scenario 2)', () => {
82
+ it('writes the registry UUID id (medium) and the git owner/skill-name id (exact)', async () => {
83
+ const db = path.join(tempHome, `rt-${dbCounter++}.db`);
84
+ await seedSkillsDb(db, [{ id: REG_UUID, name: FIXTURE_DIRS.registry, repoUrl: REG_SOURCE }]);
85
+ // --min-confidence medium so the single registry-name match qualifies
86
+ // (fixed qualifies(): the minConfidence floor IS the gate, no AUTO_QUALIFY).
87
+ await runAuditSources(makeOpts({ db, apply: true, yes: true, minConfidence: 'medium' }));
88
+ // registry: the load-bearing UUID id + https owner/repo source.
89
+ const registry = entry(FIXTURE_DIRS.registry);
90
+ expect(registry.id).toBe(REG_UUID);
91
+ expect(registry.source).toBe(REG_SOURCE);
92
+ expect(buildRawUrl(registry.source)).toBe(`https://raw.githubusercontent.com/${REG_OWNER}/${REG_REPO}/main/SKILL.md`);
93
+ // git: exact, owner/skill-name id, buildRawUrl-parseable source.
94
+ const git = entry(FIXTURE_DIRS.git);
95
+ expect(git.id).toBe(GIT_ID);
96
+ expect(git.source).toBe(`https://github.com/${GIT_OWNER}/${GIT_REPO}`);
97
+ expect(buildRawUrl(git.source)).not.toBeNull();
98
+ });
99
+ it('default min-confidence (high) leaves the medium registry match unwritten', async () => {
100
+ const db = path.join(tempHome, `rt-${dbCounter++}.db`);
101
+ await seedSkillsDb(db, [{ id: REG_UUID, name: FIXTURE_DIRS.registry, repoUrl: REG_SOURCE }]);
102
+ await runAuditSources(makeOpts({ db, apply: true, yes: true }));
103
+ expect(entry(FIXTURE_DIRS.registry)).toBeUndefined();
104
+ expect(entry(FIXTURE_DIRS.git)).toBeDefined();
105
+ });
106
+ });
107
+ //# sourceMappingURL=audit-sources-roundtrip.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-sources-roundtrip.test.js","sourceRoot":"","sources":["../../../tests/e2e/audit-sources-roundtrip.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAC9E,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EACL,kBAAkB,EAClB,YAAY,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0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,SAAS,EAAE,KAAK,CAAC,CAAA;QACtD,MAAM,YAAY,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;QAE5F,MAAM,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAE/D,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QACpD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @fileoverview Shared real-filesystem fixture for the SMI-5407 source-recovery
3
+ * end-to-end / integration suite.
4
+ * @see SMI-5407
5
+ *
6
+ * NOT a `*.test.ts` file, so vitest never executes it as a test. It only
7
+ * touches `fs` / `path` and the `@skillsmith/core` DB factory; it computes no
8
+ * homedir-derived state, so it is safe to import statically (the homedir-frozen
9
+ * manifest modules are imported dynamically by the test files themselves).
10
+ */
11
+ /** A minimal but parser-valid SKILL.md body. `extra` lands inside frontmatter. */
12
+ export declare function skillMd(name: string, extra?: string): string;
13
+ /** Directory basenames produced by {@link writeSourceFixture}. */
14
+ export declare const FIXTURE_DIRS: {
15
+ readonly git: "git-skill";
16
+ readonly https: "https-skill";
17
+ readonly plugin: "plugin-skill";
18
+ readonly registry: "registry-skill";
19
+ readonly collision: "collision-skill";
20
+ readonly backup: "something.backup-20260101-120000";
21
+ readonly unknown: "unknown-skill";
22
+ };
23
+ /** Canonical GitHub owner/repo carried by both git fixtures (ssh + https). */
24
+ export declare const GIT_OWNER = "wrsmith108";
25
+ export declare const GIT_REPO = "linear-claude-skill";
26
+ /**
27
+ * Materialize the canonical fixture tree under `root`. Returns the absolute
28
+ * directory paths keyed by {@link FIXTURE_DIRS} key.
29
+ */
30
+ export declare function writeSourceFixture(root: string): Record<keyof typeof FIXTURE_DIRS, string>;
31
+ /** A skills-row seed spec for the CLI candidate-lookup database. */
32
+ export interface SkillSeedRow {
33
+ id: string;
34
+ name: string;
35
+ repoUrl: string;
36
+ qualityScore?: number;
37
+ }
38
+ /**
39
+ * Create a file-backed skills DB at `dbPath` and insert `rows` into `skills`.
40
+ * Opened and closed synchronously so the CLI can re-open the same file.
41
+ */
42
+ export declare function seedSkillsDb(dbPath: string, rows: SkillSeedRow[]): Promise<void>;
43
+ /**
44
+ * Replica of `diff.ts:buildRawUrl` (SMI-5406) — used to assert a backfilled
45
+ * `source` is in the exact form View-Changes accepts. Kept byte-identical to
46
+ * the production regex so the assertion stays load-bearing.
47
+ */
48
+ export declare function buildRawUrl(source: string): string | null;
49
+ //# sourceMappingURL=source-recovery-fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-recovery-fixture.d.ts","sourceRoot":"","sources":["../../../../tests/e2e/utils/source-recovery-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAW5D;AAiBD,kEAAkE;AAClE,eAAO,MAAM,YAAY;;;;;;;;CAQf,CAAA;AAEV,8EAA8E;AAC9E,eAAO,MAAM,SAAS,eAAe,CAAA;AACrC,eAAO,MAAM,QAAQ,wBAAwB,CAAA;AAE7C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,OAAO,YAAY,EAAE,MAAM,CAAC,CA8B1F;AAED,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAatF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMzD"}