next-issue 17.2.1 → 17.2.3
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/README.md +1 -1
- package/dist/cli/skills.mjs +41 -13
- package/dist/cli.mjs +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Give an issue the `status:todo` label to have it picked up. See [Issue format](h
|
|
|
40
40
|
|
|
41
41
|
### Skills for Claude Code
|
|
42
42
|
|
|
43
|
-
`init` (see [Configuration](#configuration)) installs the `create-issue` skill, which writes an issue that the harness can claim, and the `answer-hand-over` skill, which helps you answer a hand-over. It asks whether to install them for your user or for the project; `--scope user|project` answers in advance. `start` updates an outdated copy and installs a missing skill for the project. See [Skills](https://github.com/ravshansbox/next-issue/blob/main/packages/next-issue/docs/behaviour.md#skills).
|
|
43
|
+
`init` (see [Configuration](#configuration)) installs the `create-issue` skill, which writes an issue that the harness can claim, and the `answer-hand-over` skill, which helps you answer a hand-over. It asks whether to install them for your user or for the project; `--scope user|project` answers in advance. `start` updates an outdated copy and installs a missing skill for the project. next-issue keeps its project skill folders in `info/exclude`; when git tracks them, `start` asks to untrack them and stages the removal for you to commit and push. See [Skills](https://github.com/ravshansbox/next-issue/blob/main/packages/next-issue/docs/behaviour.md#skills).
|
|
44
44
|
|
|
45
45
|
## Configuration
|
|
46
46
|
|
package/dist/cli/skills.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { OWN_SKILLS } from '../shared/agents.mjs';
|
|
|
7
7
|
import { hasCode } from '../shared/errors.mjs';
|
|
8
8
|
import { git, repoRoot } from '../shared/git.mjs';
|
|
9
9
|
const SKILLS = join(import.meta.dirname, '..', '..', 'skills');
|
|
10
|
+
export const PROJECT_SKILL_FOLDERS = OWN_SKILLS.map((name) => `.claude/skills/${name}/`);
|
|
10
11
|
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
12
|
const ANSWERS = new Map([
|
|
12
13
|
['user', 'user'],
|
|
@@ -14,20 +15,23 @@ const ANSWERS = new Map([
|
|
|
14
15
|
['project', 'project'],
|
|
15
16
|
['p', 'project'],
|
|
16
17
|
]);
|
|
17
|
-
async function
|
|
18
|
-
const prompt = createInterface({ input, output });
|
|
18
|
+
async function ask(question, output) {
|
|
19
|
+
const prompt = createInterface({ input: process.stdin, output });
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
-
const scope = ANSWERS.get(answer);
|
|
22
|
-
if (scope === undefined) {
|
|
23
|
-
throw new Error(`answer user or project, not ${JSON.stringify(answer)}`);
|
|
24
|
-
}
|
|
25
|
-
return scope;
|
|
21
|
+
return (await prompt.question(question)).trim().toLowerCase();
|
|
26
22
|
}
|
|
27
23
|
finally {
|
|
28
24
|
prompt.close();
|
|
29
25
|
}
|
|
30
26
|
}
|
|
27
|
+
async function askScope() {
|
|
28
|
+
const answer = await ask(QUESTION, process.stdout);
|
|
29
|
+
const scope = ANSWERS.get(answer);
|
|
30
|
+
if (scope === undefined) {
|
|
31
|
+
throw new Error(`answer user or project, not ${JSON.stringify(answer)}`);
|
|
32
|
+
}
|
|
33
|
+
return scope;
|
|
34
|
+
}
|
|
31
35
|
export async function chooseScope(scope) {
|
|
32
36
|
if (scope !== undefined) {
|
|
33
37
|
return scope;
|
|
@@ -35,7 +39,7 @@ export async function chooseScope(scope) {
|
|
|
35
39
|
if (process.stdin.isTTY !== true) {
|
|
36
40
|
throw new Error('`init` needs `--scope user|project` when there is no terminal to ask where to install the skills');
|
|
37
41
|
}
|
|
38
|
-
return askScope(
|
|
42
|
+
return askScope();
|
|
39
43
|
}
|
|
40
44
|
async function skillsFolder(scope) {
|
|
41
45
|
const base = scope === 'user' ? homedir() : await repoRoot(process.cwd());
|
|
@@ -122,10 +126,7 @@ export async function refreshSkills(root) {
|
|
|
122
126
|
if (hash === shipped) {
|
|
123
127
|
continue;
|
|
124
128
|
}
|
|
125
|
-
if (
|
|
126
|
-
notes.push(`kept ${join(folder, name)}: tracked by git`);
|
|
127
|
-
}
|
|
128
|
-
else if (await isOwnSkill(join(folder, name))) {
|
|
129
|
+
if (await isOwnSkill(join(folder, name))) {
|
|
129
130
|
notes.push(`updated ${await replaceSkill(folder, name)}`);
|
|
130
131
|
}
|
|
131
132
|
else {
|
|
@@ -138,3 +139,30 @@ export async function refreshSkills(root) {
|
|
|
138
139
|
}
|
|
139
140
|
return notes;
|
|
140
141
|
}
|
|
142
|
+
export async function untrackSkills(root) {
|
|
143
|
+
const folders = [];
|
|
144
|
+
for (const folder of PROJECT_SKILL_FOLDERS) {
|
|
145
|
+
if (await isTracked(root, folder)) {
|
|
146
|
+
folders.push(folder);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (folders.length === 0) {
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
const tracked = `git tracks the next-issue skills in ${folders.join(', ')}`;
|
|
153
|
+
const untrack = `git rm -r --cached -- ${folders.join(' ')}`;
|
|
154
|
+
if (process.stdin.isTTY !== true) {
|
|
155
|
+
throw new Error(`${tracked}; untrack them in ${root} with \`${untrack}\`, commit and push the removal, and run \`npx -y next-issue@latest start\` again`);
|
|
156
|
+
}
|
|
157
|
+
const answer = await ask(`${tracked}. Untrack them? (y/n) `, process.stderr);
|
|
158
|
+
if (answer !== 'y' && answer !== 'yes') {
|
|
159
|
+
throw new Error(`${tracked}; \`npx -y next-issue@latest start\` needs them untracked`);
|
|
160
|
+
}
|
|
161
|
+
const committed = (await git(root, ['ls-tree', '-r', '--name-only', 'HEAD', '--', ...folders])) !== '';
|
|
162
|
+
await git(root, ['rm', '-r', '-q', '--cached', '-f', '--ignore-unmatch', '--', ...folders]);
|
|
163
|
+
return [
|
|
164
|
+
committed
|
|
165
|
+
? `untracked ${folders.join(', ')} (staged); commit and push the removal`
|
|
166
|
+
: `untracked ${folders.join(', ')}`,
|
|
167
|
+
];
|
|
168
|
+
}
|
package/dist/cli.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { serve } from './worker/serve.mjs';
|
|
|
11
11
|
import { startInWorker } from './cli/start.mjs';
|
|
12
12
|
import { STATE_DIR } from './shared/state.mjs';
|
|
13
13
|
import { statusInWorker, stopInWorker, switchInWorker } from './cli/switch-run.mjs';
|
|
14
|
-
import { chooseScope, installSkills, refreshSkills } from './cli/skills.mjs';
|
|
14
|
+
import { chooseScope, installSkills, PROJECT_SKILL_FOLDERS, refreshSkills, untrackSkills, } from './cli/skills.mjs';
|
|
15
15
|
import { WORKTREE_DIR } from './shared/worktree.mjs';
|
|
16
16
|
function write(stream, text) {
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
@@ -56,7 +56,7 @@ async function main() {
|
|
|
56
56
|
if (args.command === 'serve') {
|
|
57
57
|
return serve(root);
|
|
58
58
|
}
|
|
59
|
-
for (const note of await refreshSkills(root)) {
|
|
59
|
+
for (const note of [...(await untrackSkills(root)), ...(await refreshSkills(root))]) {
|
|
60
60
|
await write(process.stderr, `${note}\n`);
|
|
61
61
|
}
|
|
62
62
|
await write(process.stderr, await startInWorker(root, argv.slice(1)));
|
|
@@ -90,7 +90,10 @@ async function init(root, args) {
|
|
|
90
90
|
}
|
|
91
91
|
async function excludeStateDirectories(root, stream) {
|
|
92
92
|
const exclude = await excludeFile(root);
|
|
93
|
-
const entries = [
|
|
93
|
+
const entries = [
|
|
94
|
+
...[STATE_DIR, WORKTREE_DIR].map((directory) => `${directory}/`),
|
|
95
|
+
...PROJECT_SKILL_FOLDERS,
|
|
96
|
+
];
|
|
94
97
|
for (const entry of entries) {
|
|
95
98
|
if (await ensureExcluded(exclude, entry)) {
|
|
96
99
|
await write(stream, `added ${entry} to ${exclude}\n`);
|