next-issue 17.0.0 → 17.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/dist/cli/skills.mjs +33 -6
- package/package.json +1 -1
package/dist/cli/skills.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { join } from 'node:path';
|
|
|
5
5
|
import { createInterface } from 'node:readline/promises';
|
|
6
6
|
import { OWN_SKILLS } from '../shared/agents.mjs';
|
|
7
7
|
import { hasCode } from '../shared/errors.mjs';
|
|
8
|
-
import { repoRoot } from '../shared/git.mjs';
|
|
8
|
+
import { git, repoRoot } from '../shared/git.mjs';
|
|
9
9
|
const SKILLS = join(import.meta.dirname, '..', '..', 'skills');
|
|
10
10
|
const QUESTION = 'Install the skills for the user, in ~/.claude/skills, or for the project, in .claude/skills of the main worktree? (user/project) ';
|
|
11
11
|
const ANSWERS = new Map([
|
|
@@ -87,10 +87,28 @@ async function skillHash(folder) {
|
|
|
87
87
|
}
|
|
88
88
|
return hash.digest('hex');
|
|
89
89
|
}
|
|
90
|
+
async function isOwnSkill(folder) {
|
|
91
|
+
let text;
|
|
92
|
+
try {
|
|
93
|
+
text = await readFile(join(folder, 'SKILL.md'), 'utf8');
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (hasCode(error, 'ENOENT')) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text)?.[1] ?? '';
|
|
102
|
+
return frontmatter
|
|
103
|
+
.split(/\r?\n/)
|
|
104
|
+
.some((line) => line.startsWith('description:') && line.includes('next-issue'));
|
|
105
|
+
}
|
|
106
|
+
async function isTracked(root, folder) {
|
|
107
|
+
return (await git(root, ['ls-files', '--', folder])) !== '';
|
|
108
|
+
}
|
|
90
109
|
export async function refreshSkills(root) {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
];
|
|
110
|
+
const project = join(root, '.claude', 'skills');
|
|
111
|
+
const folders = [...new Set([join(homedir(), '.claude', 'skills'), project])];
|
|
94
112
|
const notes = [];
|
|
95
113
|
for (const name of OWN_SKILLS) {
|
|
96
114
|
const shipped = await skillHash(join(SKILLS, name));
|
|
@@ -101,12 +119,21 @@ export async function refreshSkills(root) {
|
|
|
101
119
|
continue;
|
|
102
120
|
}
|
|
103
121
|
installed = true;
|
|
104
|
-
if (hash
|
|
122
|
+
if (hash === shipped) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (folder === project && (await isTracked(root, join(folder, name)))) {
|
|
126
|
+
notes.push(`kept ${join(folder, name)}: tracked by git`);
|
|
127
|
+
}
|
|
128
|
+
else if (await isOwnSkill(join(folder, name))) {
|
|
105
129
|
notes.push(`updated ${await replaceSkill(folder, name)}`);
|
|
106
130
|
}
|
|
131
|
+
else {
|
|
132
|
+
notes.push(`kept ${join(folder, name)}: not a next-issue skill`);
|
|
133
|
+
}
|
|
107
134
|
}
|
|
108
135
|
if (!installed) {
|
|
109
|
-
notes.push(`wrote ${await replaceSkill(
|
|
136
|
+
notes.push(`wrote ${await replaceSkill(project, name)}`);
|
|
110
137
|
}
|
|
111
138
|
}
|
|
112
139
|
return notes;
|