next-issue 17.2.2 → 17.2.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.
- package/README.md +1 -1
- package/dist/cli/skills.mjs +8 -38
- package/dist/shared/exec.mjs +0 -1
- 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. next-issue keeps its project skill folders in `info/exclude`; when git tracks them, `start` asks to untrack them and commit and push
|
|
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
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { cp,
|
|
3
|
-
import { homedir
|
|
2
|
+
import { cp, readdir, readFile, rename, rm } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { createInterface } from 'node:readline/promises';
|
|
6
6
|
import { OWN_SKILLS } from '../shared/agents.mjs';
|
|
7
|
-
import { loadConfig } from '../shared/config.mjs';
|
|
8
7
|
import { hasCode } from '../shared/errors.mjs';
|
|
9
|
-
import { must } from '../shared/exec.mjs';
|
|
10
8
|
import { git, repoRoot } from '../shared/git.mjs';
|
|
11
9
|
const SKILLS = join(import.meta.dirname, '..', '..', 'skills');
|
|
12
10
|
export const PROJECT_SKILL_FOLDERS = OWN_SKILLS.map((name) => `.claude/skills/${name}/`);
|
|
13
|
-
const UNTRACK_SUBJECT = 'chore: stop tracking the next-issue skills';
|
|
14
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) ';
|
|
15
12
|
const ANSWERS = new Map([
|
|
16
13
|
['user', 'user'],
|
|
@@ -145,54 +142,27 @@ export async function refreshSkills(root) {
|
|
|
145
142
|
export async function untrackSkills(root) {
|
|
146
143
|
const folders = [];
|
|
147
144
|
for (const folder of PROJECT_SKILL_FOLDERS) {
|
|
148
|
-
if (await isTracked(root, folder)) {
|
|
145
|
+
if ((await isTracked(root, folder)) && (await isOwnSkill(join(root, folder)))) {
|
|
149
146
|
folders.push(folder);
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
149
|
if (folders.length === 0) {
|
|
153
150
|
return [];
|
|
154
151
|
}
|
|
155
|
-
const { remote } = await loadConfig(root);
|
|
156
152
|
const tracked = `git tracks the next-issue skills in ${folders.join(', ')}`;
|
|
153
|
+
const untrack = `git rm -r --cached -- ${folders.join(' ')}`;
|
|
157
154
|
if (process.stdin.isTTY !== true) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`git push ${remote} HEAD`,
|
|
162
|
-
];
|
|
163
|
-
throw new Error(`${tracked}; untrack them in ${root} with ${commands.map((command) => `\`${command}\``).join(', then ')}, and run \`npx -y next-issue@latest start\` again`);
|
|
164
|
-
}
|
|
165
|
-
const answer = await ask(`${tracked}. Untrack them, commit the removal and push it to ${remote}? (y/n) `, process.stderr);
|
|
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);
|
|
166
158
|
if (answer !== 'y' && answer !== 'yes') {
|
|
167
159
|
throw new Error(`${tracked}; \`npx -y next-issue@latest start\` needs them untracked`);
|
|
168
160
|
}
|
|
169
161
|
const committed = (await git(root, ['ls-tree', '-r', '--name-only', 'HEAD', '--', ...folders])) !== '';
|
|
170
|
-
if (committed) {
|
|
171
|
-
await commitUntracked(root, folders);
|
|
172
|
-
try {
|
|
173
|
-
await git(root, ['push', '-q', remote, 'HEAD']);
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
await git(root, ['reset', '-q', '--soft', 'HEAD~1']);
|
|
177
|
-
throw error;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
162
|
await git(root, ['rm', '-r', '-q', '--cached', '-f', '--ignore-unmatch', '--', ...folders]);
|
|
181
163
|
return [
|
|
182
164
|
committed
|
|
183
|
-
? `untracked ${folders.join(', ')} and
|
|
165
|
+
? `untracked ${folders.join(', ')} (staged); commit and push the removal`
|
|
184
166
|
: `untracked ${folders.join(', ')}`,
|
|
185
167
|
];
|
|
186
168
|
}
|
|
187
|
-
async function commitUntracked(root, folders) {
|
|
188
|
-
const directory = await mkdtemp(join(tmpdir(), 'next-issue-'));
|
|
189
|
-
const options = { cwd: root, env: { GIT_INDEX_FILE: join(directory, 'index') } };
|
|
190
|
-
try {
|
|
191
|
-
await must('git', ['read-tree', 'HEAD'], options);
|
|
192
|
-
await must('git', ['rm', '-r', '-q', '--cached', '--ignore-unmatch', '--', ...folders], options);
|
|
193
|
-
await must('git', ['commit', '-q', '--no-verify', '-m', UNTRACK_SUBJECT], options);
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
await rm(directory, { recursive: true, force: true });
|
|
197
|
-
}
|
|
198
|
-
}
|
package/dist/shared/exec.mjs
CHANGED
|
@@ -25,7 +25,6 @@ export function withDefaultTimeout(ms, body) {
|
|
|
25
25
|
function spawnChild(command, args, options) {
|
|
26
26
|
return spawn(command, args, {
|
|
27
27
|
cwd: options.cwd,
|
|
28
|
-
env: options.env === undefined ? undefined : { ...process.env, ...options.env },
|
|
29
28
|
detached: true,
|
|
30
29
|
stdio: [
|
|
31
30
|
options.input === undefined ? 'ignore' : 'pipe',
|