next-issue 16.11.0 → 16.12.1
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 +65 -13
- package/dist/cli.mjs +4 -1
- package/dist/worker/worker-run.mjs +1 -6
- 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.
|
|
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).
|
|
44
44
|
|
|
45
45
|
## Configuration
|
|
46
46
|
|
package/dist/cli/skills.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { cp, readdir, readFile, rename, rm } from 'node:fs/promises';
|
|
2
3
|
import { homedir } from 'node:os';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
import { createInterface } from 'node:readline/promises';
|
|
5
6
|
import { OWN_SKILLS } from '../shared/agents.mjs';
|
|
7
|
+
import { hasCode } from '../shared/errors.mjs';
|
|
6
8
|
import { repoRoot } from '../shared/git.mjs';
|
|
7
9
|
const SKILLS = join(import.meta.dirname, '..', '..', 'skills');
|
|
8
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) ';
|
|
@@ -39,23 +41,73 @@ async function skillsFolder(scope) {
|
|
|
39
41
|
const base = scope === 'user' ? homedir() : await repoRoot(process.cwd());
|
|
40
42
|
return join(base, '.claude', 'skills');
|
|
41
43
|
}
|
|
44
|
+
async function replaceSkill(folder, name) {
|
|
45
|
+
const target = join(folder, name);
|
|
46
|
+
const staging = join(folder, `.${name}.new`);
|
|
47
|
+
await rm(staging, { recursive: true, force: true });
|
|
48
|
+
try {
|
|
49
|
+
await cp(join(SKILLS, name), staging, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
await rm(staging, { recursive: true, force: true });
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
await rm(target, { recursive: true, force: true });
|
|
56
|
+
await rename(staging, target);
|
|
57
|
+
return target;
|
|
58
|
+
}
|
|
42
59
|
export async function installSkills(scope) {
|
|
43
60
|
const folder = await skillsFolder(scope);
|
|
44
61
|
const written = [];
|
|
45
62
|
for (const name of OWN_SKILLS) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
written.push(await replaceSkill(folder, name));
|
|
64
|
+
}
|
|
65
|
+
return written;
|
|
66
|
+
}
|
|
67
|
+
async function skillHash(folder) {
|
|
68
|
+
let entries;
|
|
69
|
+
try {
|
|
70
|
+
entries = await readdir(folder, { recursive: true, withFileTypes: true });
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (hasCode(error, 'ENOENT')) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
const files = entries
|
|
79
|
+
.filter((entry) => entry.isFile())
|
|
80
|
+
.map((entry) => join(entry.parentPath, entry.name))
|
|
81
|
+
.sort();
|
|
82
|
+
const hash = createHash('sha256');
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
hash.update(`${file.slice(folder.length)}\0`);
|
|
85
|
+
hash.update(await readFile(file));
|
|
86
|
+
hash.update('\0');
|
|
87
|
+
}
|
|
88
|
+
return hash.digest('hex');
|
|
89
|
+
}
|
|
90
|
+
export async function refreshSkills(root) {
|
|
91
|
+
const folders = [
|
|
92
|
+
...new Set([join(homedir(), '.claude', 'skills'), join(root, '.claude', 'skills')]),
|
|
93
|
+
];
|
|
94
|
+
const notes = [];
|
|
95
|
+
for (const name of OWN_SKILLS) {
|
|
96
|
+
const shipped = await skillHash(join(SKILLS, name));
|
|
97
|
+
let installed = false;
|
|
98
|
+
for (const folder of folders) {
|
|
99
|
+
const hash = await skillHash(join(folder, name));
|
|
100
|
+
if (hash === undefined) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
installed = true;
|
|
104
|
+
if (hash !== shipped) {
|
|
105
|
+
notes.push(`updated ${await replaceSkill(folder, name)}`);
|
|
106
|
+
}
|
|
51
107
|
}
|
|
52
|
-
|
|
53
|
-
await
|
|
54
|
-
throw error;
|
|
108
|
+
if (!installed) {
|
|
109
|
+
notes.push(`wrote ${await replaceSkill(join(root, '.claude', 'skills'), name)}`);
|
|
55
110
|
}
|
|
56
|
-
await rm(target, { recursive: true, force: true });
|
|
57
|
-
await rename(staging, target);
|
|
58
|
-
written.push(target);
|
|
59
111
|
}
|
|
60
|
-
return
|
|
112
|
+
return notes;
|
|
61
113
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { serve } from './worker/serve.mjs';
|
|
|
10
10
|
import { startInWorker } from './cli/start.mjs';
|
|
11
11
|
import { STATE_DIR } from './shared/state.mjs';
|
|
12
12
|
import { statusInWorker, stopInWorker, switchInWorker } from './cli/switch-run.mjs';
|
|
13
|
-
import { chooseScope, installSkills } from './cli/skills.mjs';
|
|
13
|
+
import { chooseScope, installSkills, refreshSkills } from './cli/skills.mjs';
|
|
14
14
|
import { WORKTREE_DIR } from './shared/worktree.mjs';
|
|
15
15
|
function write(stream, text) {
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
@@ -52,6 +52,9 @@ async function main() {
|
|
|
52
52
|
if (args.command === 'serve') {
|
|
53
53
|
return serve(root);
|
|
54
54
|
}
|
|
55
|
+
for (const note of await refreshSkills(root)) {
|
|
56
|
+
await write(process.stderr, `${note}\n`);
|
|
57
|
+
}
|
|
55
58
|
await write(process.stderr, await startInWorker(root, argv.slice(1)));
|
|
56
59
|
return 0;
|
|
57
60
|
}
|
|
@@ -39,12 +39,7 @@ export function runsMessage(runs, id) {
|
|
|
39
39
|
}
|
|
40
40
|
export function joinRun(run, given) {
|
|
41
41
|
if (run.stoppedByPerson === true) {
|
|
42
|
-
|
|
43
|
-
return 'the run is stopping';
|
|
44
|
-
}
|
|
45
|
-
run.stop = undefined;
|
|
46
|
-
run.stoppedByPerson = false;
|
|
47
|
-
run.progress = { ...run.progress, status: 'running' };
|
|
42
|
+
return 'the run is stopping';
|
|
48
43
|
}
|
|
49
44
|
if (given.watch !== undefined) {
|
|
50
45
|
setWatching(run, given.watch);
|