@openreachtech/hora-skills-ort-renchan 0.2.0 → 0.2.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/README.ja.md +4 -4
- package/README.md +4 -4
- package/dist/skills/hor-agent-loop/references/testing.md +15 -20
- package/dist/skills/hor-external-api-client/references/testing.md +11 -16
- package/dist/skills/hor-post-worker/SKILL.md +5 -4
- package/lib/equip/HoraSkillsCli.js +2 -2
- package/package.json +6 -5
package/README.ja.md
CHANGED
|
@@ -57,7 +57,7 @@ npx --no hora-skills-ort-renchan install
|
|
|
57
57
|
|
|
58
58
|
### 複数のドメインを入れる
|
|
59
59
|
|
|
60
|
-
`hora-skills` のパッケージはいずれも同じ `.claude/skills/` に配置し、それぞれが自分の配置内容を `.hora
|
|
60
|
+
`hora-skills` のパッケージはいずれも同じ `.claude/skills/` に配置し、それぞれが自分の配置内容を `.hora/<スコープを外したパッケージ名>.json` に記録します。したがって、ある実行が削除するのはそのパッケージが配置したものだけで、他には手を触れません。
|
|
61
61
|
|
|
62
62
|
```json
|
|
63
63
|
{
|
|
@@ -73,7 +73,7 @@ npx --no hora-skills-ort-renchan install
|
|
|
73
73
|
|
|
74
74
|
`.claude/` と、その中の `skills/` は、シンボリックリンクではなくリポジトリのディレクトリである必要があります。インストールは対象へ至る各段を検査し、いずれかがリンクであれば、何も書き込まず、何も削除せずに終了します。 インストール内容の記録である `.hora/hora-skills-ort-renchan.json` も同じように検査します。ここにリンクがあると、書き込みがリンク先へ届き、その中身を上書きしてしまうためです。
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
リンクに当たって止まったインストールは、どの段だったかを告げ、何も変更せず、0 以外の終了コードで終わります。プロジェクト自身の `postinstall` として実行しているなら、それは `npm install` の出力に現れます。単独で実行した場合は `npx --no hora-skills-ort-renchan install` が同じことを告げます。
|
|
77
77
|
|
|
78
78
|
リンクはコマンドを実行する人の指示ではなく、リポジトリの中身です。それを辿ると、スキルをどこへ書くか、そして前回のスキルをどこから消すかを、リポジトリ側が決められることになります。
|
|
79
79
|
|
|
@@ -104,10 +104,10 @@ npx --no hora-skills-ort-renchan install
|
|
|
104
104
|
| :-- | :-- |
|
|
105
105
|
| `hora-skills-ort-renchan install` | このパッケージが配布する全スキルを配置し、前回配置したものを置き換える |
|
|
106
106
|
| `hora-skills-ort-renchan list` | このパッケージが配布するスキルを表示する(配置はしない) |
|
|
107
|
-
| `hora-skills-ort-renchan uninstall` |
|
|
107
|
+
| `hora-skills-ort-renchan uninstall` | このパッケージが 1 つのディレクトリに配置したスキルと、その配置の記録を削除する |
|
|
108
108
|
| `hora-skills-ort-renchan help` | 使い方を表示する |
|
|
109
109
|
|
|
110
|
-
`--dir <path>`
|
|
110
|
+
`--dir <path>` は `.claude/skills` 以外のディレクトリを名指しするもので、`install` と `uninstall` のどちらもこれを受けます。2 つのディレクトリに配置したリポジトリは、したがって `uninstall` を 2 回実行することになり、記録ファイルはその最後の 1 回で消えます。
|
|
111
111
|
|
|
112
112
|
## コントリビューション
|
|
113
113
|
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ The skills land in your repository's `.claude/skills/`. Claude Code discovers th
|
|
|
57
57
|
|
|
58
58
|
### Installing more than one domain
|
|
59
59
|
|
|
60
|
-
Each `hora-skills` package installs into the same `.claude/skills/`, and each records its own installation in `.hora/<package name>.json`. A run therefore removes only what that package installed, and leaves the others alone:
|
|
60
|
+
Each `hora-skills` package installs into the same `.claude/skills/`, and each records its own installation in `.hora/<package name, without its scope>.json`. A run therefore removes only what that package installed, and leaves the others alone:
|
|
61
61
|
|
|
62
62
|
```json
|
|
63
63
|
{
|
|
@@ -73,7 +73,7 @@ Because a prefix belongs to exactly one package, and every skill's folder name i
|
|
|
73
73
|
|
|
74
74
|
`.claude/`, and the `skills/` directory inside it, have to be directories of your repository rather than symbolic links. An installation verifies every step it is reached through, and finding a link at any of them it writes nothing and removes nothing. `.hora/hora-skills-ort-renchan.json`, the record of what was installed, is verified the same way: a link there would send the write to whatever it stands for and overwrite it.
|
|
75
75
|
|
|
76
|
-
An installation
|
|
76
|
+
An installation stopped by a link says which step it was, changes nothing, and ends with a failing exit code. Where the command runs as your project's own `postinstall`, that is what `npm install` reports; run on its own, `npx --no hora-skills-ort-renchan install` tells you the same.
|
|
77
77
|
|
|
78
78
|
A link is content of the repository rather than an instruction of whoever runs the command, so following one would let the repository decide where skills are written and, worse, where the skills of the previous run are removed from.
|
|
79
79
|
|
|
@@ -104,10 +104,10 @@ A skill your own repository authored is left alone, as long as its name is not o
|
|
|
104
104
|
| :-- | :-- |
|
|
105
105
|
| `hora-skills-ort-renchan install` | Install every skill this package distributes, replacing the previously installed ones |
|
|
106
106
|
| `hora-skills-ort-renchan list` | Print the skills this package distributes, installing nothing |
|
|
107
|
-
| `hora-skills-ort-renchan uninstall` | Remove
|
|
107
|
+
| `hora-skills-ort-renchan uninstall` | Remove the skills this package installed into one directory, and the record of that installation |
|
|
108
108
|
| `hora-skills-ort-renchan help` | Print the usage text |
|
|
109
109
|
|
|
110
|
-
`--dir <path>`
|
|
110
|
+
`--dir <path>` names a directory other than `.claude/skills`, and `install` and `uninstall` take it alike. A repository that has installed into two of them therefore takes two `uninstall` runs, and the record file goes when the last of them does.
|
|
111
111
|
|
|
112
112
|
## Contribution
|
|
113
113
|
|
|
@@ -9,7 +9,7 @@ These follow the **`hoc-jest` skill** — read it for the general rules; this fi
|
|
|
9
9
|
applies them to the agent-loop classes. In short: one file per class; nest
|
|
10
10
|
`describe(ClassName) > describe('#member()' / '.get:member') > describe('should …') > test.each(cases)`;
|
|
11
11
|
write each test as **Arrange / Act / Assert** separated by blank lines, taking the Act result into a
|
|
12
|
-
`received` variable; bind every
|
|
12
|
+
`received` variable; bind every spy to a `~Spy` variable; and keep `cases` data unique and
|
|
13
13
|
index-readable (`fake-keyword-0001`, `100001`, …).
|
|
14
14
|
|
|
15
15
|
## Grand principle: swap `context` for a stub and touch no real I/O
|
|
@@ -91,19 +91,18 @@ describe('SearchAction', () => {
|
|
|
91
91
|
]
|
|
92
92
|
|
|
93
93
|
test.each(cases)('keyword: $tally.keyword', async ({ tally }) => {
|
|
94
|
-
const searchSpy = jest.fn()
|
|
95
|
-
.mockResolvedValue({
|
|
96
|
-
items: [], // neutral; not under test
|
|
97
|
-
})
|
|
98
94
|
const args = {
|
|
99
95
|
argumentHash: tally,
|
|
100
96
|
context: {
|
|
101
97
|
searchClient: {
|
|
102
|
-
search:
|
|
98
|
+
search: async () => ({
|
|
99
|
+
items: [], // neutral; not under test
|
|
100
|
+
}),
|
|
103
101
|
},
|
|
104
102
|
},
|
|
105
|
-
onProgress:
|
|
103
|
+
onProgress: () => {},
|
|
106
104
|
}
|
|
105
|
+
const searchSpy = jest.spyOn(args.context.searchClient, 'search')
|
|
107
106
|
|
|
108
107
|
await SearchAction.create()
|
|
109
108
|
.run(args)
|
|
@@ -138,18 +137,16 @@ describe('SearchAction', () => {
|
|
|
138
137
|
]
|
|
139
138
|
|
|
140
139
|
test.each(cases)('keyword: $input.keyword', async ({ input, expected }) => {
|
|
141
|
-
const searchSpy = jest.fn()
|
|
142
|
-
.mockResolvedValue(expected)
|
|
143
140
|
const args = {
|
|
144
141
|
argumentHash: {
|
|
145
142
|
keyword: input.keyword,
|
|
146
143
|
},
|
|
147
144
|
context: {
|
|
148
145
|
searchClient: {
|
|
149
|
-
search:
|
|
146
|
+
search: async () => expected,
|
|
150
147
|
},
|
|
151
148
|
},
|
|
152
|
-
onProgress:
|
|
149
|
+
onProgress: () => {},
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
const received = await SearchAction.create()
|
|
@@ -281,7 +278,7 @@ describe('ResearchJobWorker', () => {
|
|
|
281
278
|
const worker = new ResearchJobWorker({
|
|
282
279
|
engine: {
|
|
283
280
|
subscriptionBroker: {
|
|
284
|
-
publish:
|
|
281
|
+
publish: async () => null,
|
|
285
282
|
},
|
|
286
283
|
},
|
|
287
284
|
config: {
|
|
@@ -295,7 +292,6 @@ describe('ResearchJobWorker', () => {
|
|
|
295
292
|
errorHash: {},
|
|
296
293
|
})
|
|
297
294
|
|
|
298
|
-
const updateProgressSpy = jest.fn()
|
|
299
295
|
const args = {
|
|
300
296
|
body: {
|
|
301
297
|
jobId: input.jobId,
|
|
@@ -304,11 +300,12 @@ describe('ResearchJobWorker', () => {
|
|
|
304
300
|
parcel: {
|
|
305
301
|
jobModel: {
|
|
306
302
|
job: {
|
|
307
|
-
updateProgress:
|
|
303
|
+
updateProgress: async () => null,
|
|
308
304
|
},
|
|
309
305
|
},
|
|
310
306
|
},
|
|
311
307
|
}
|
|
308
|
+
const updateProgressSpy = jest.spyOn(args.parcel.jobModel.job, 'updateProgress')
|
|
312
309
|
|
|
313
310
|
await worker.executeJob(args)
|
|
314
311
|
|
|
@@ -366,11 +363,6 @@ describe('RequestResearchMutationResolver', () => {
|
|
|
366
363
|
errorHash: {},
|
|
367
364
|
})
|
|
368
365
|
|
|
369
|
-
const dispatchJobSpy = jest.fn()
|
|
370
|
-
.mockResolvedValue({
|
|
371
|
-
hasResponse: () => true,
|
|
372
|
-
idKey: expected.jobId,
|
|
373
|
-
})
|
|
374
366
|
const args = {
|
|
375
367
|
variables: {
|
|
376
368
|
input: {
|
|
@@ -380,7 +372,10 @@ describe('RequestResearchMutationResolver', () => {
|
|
|
380
372
|
context: {
|
|
381
373
|
share: {
|
|
382
374
|
jobDispatcherProvider: {
|
|
383
|
-
dispatchJob:
|
|
375
|
+
dispatchJob: async () => ({
|
|
376
|
+
hasResponse: () => true,
|
|
377
|
+
idKey: expected.jobId,
|
|
378
|
+
}),
|
|
384
379
|
},
|
|
385
380
|
},
|
|
386
381
|
},
|
|
@@ -39,17 +39,19 @@ The unit-test conventions for an external API client. The files live under
|
|
|
39
39
|
- That the base launcher extends `BaseLauncher`, and that `clientConfig` returns the expected
|
|
40
40
|
connection settings.
|
|
41
41
|
- That the derived launcher's `Payload` / `Capsule` return the right classes.
|
|
42
|
-
- That `launchRequest()`, with **`fetch`
|
|
43
|
-
the correct `Request` (URL, method, headers, body) and returns a
|
|
42
|
+
- That `launchRequest()`, with **`fetch` spied** (`static get fetch ()` returns the native one, so the
|
|
43
|
+
spy goes there), is called with the correct `Request` (URL, method, headers, body) and returns a
|
|
44
|
+
`Capsule`.
|
|
44
45
|
- For an SDK wrapper ([sdk-wrapper.md](./sdk-wrapper.md)), inject a stub SDK through
|
|
45
46
|
`create({ sdkClient })` and assert that `launchRequest()` calls the SDK method with the right
|
|
46
47
|
arguments and returns the result carried in a `Capsule`.
|
|
47
48
|
|
|
48
|
-
##
|
|
49
|
+
## Spy the native `fetch` the getter returns
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
`static get fetch ()` returns the native `fetch`, so leave the getter alone and spy the real function
|
|
52
|
+
it hands back — the shape `hoc-jest` gives for a getter that returns a function. Have
|
|
53
|
+
`jest.spyOn(globalThis, 'fetch').mockResolvedValue(...)` return a `Response`, then assert that it was
|
|
54
|
+
called and what the `Capsule` extracted. No sub-class is needed.
|
|
53
55
|
|
|
54
56
|
```js
|
|
55
57
|
import CreateDocumentLauncher from '../../../../app/documentApiClient/CreateDocumentLauncher.js'
|
|
@@ -97,19 +99,12 @@ describe('CreateDocumentLauncher', () => {
|
|
|
97
99
|
status: 200,
|
|
98
100
|
}
|
|
99
101
|
)
|
|
100
|
-
const fetchSpy = jest.
|
|
102
|
+
const fetchSpy = jest.spyOn(globalThis, 'fetch')
|
|
101
103
|
.mockResolvedValue(responseTally)
|
|
102
104
|
|
|
103
|
-
const
|
|
104
|
-
/** @override */
|
|
105
|
-
static get fetch () {
|
|
106
|
-
return fetchSpy
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const launcher = SpyLauncher.create()
|
|
105
|
+
const launcher = CreateDocumentLauncher.create()
|
|
111
106
|
|
|
112
|
-
const payload =
|
|
107
|
+
const payload = CreateDocumentLauncher.createPayload(params)
|
|
113
108
|
|
|
114
109
|
const capsule = await launcher.launchRequest({
|
|
115
110
|
payload,
|
|
@@ -271,19 +271,20 @@ split files per class.
|
|
|
271
271
|
- **On success** (`error: null`, `output` present) → **dispatch is called** with the expected
|
|
272
272
|
`DispatcherCtor` and `body`.
|
|
273
273
|
- **On failure** (`error` present) → **dispatch is not called** (early return).
|
|
274
|
-
- Stub the dispatch entry point.
|
|
275
|
-
`jest.
|
|
274
|
+
- Stub the dispatch entry point. Give `context.share.jobDispatcherProvider.dispatchJob` a stub
|
|
275
|
+
function, spy that property with `jest.spyOn()`, and verify the arguments (`DispatcherCtor` /
|
|
276
|
+
`body`). **Don't actually enqueue a job.**
|
|
276
277
|
|
|
277
278
|
```js
|
|
278
279
|
// Success case: verify only that dispatch is called with the correct Dispatcher and body
|
|
279
|
-
const dispatchJobSpy = jest.fn()
|
|
280
280
|
const context = {
|
|
281
281
|
share: {
|
|
282
282
|
jobDispatcherProvider: {
|
|
283
|
-
dispatchJob:
|
|
283
|
+
dispatchJob: async () => null,
|
|
284
284
|
},
|
|
285
285
|
},
|
|
286
286
|
}
|
|
287
|
+
const dispatchJobSpy = jest.spyOn(context.share.jobDispatcherProvider, 'dispatchJob')
|
|
287
288
|
|
|
288
289
|
await SignUpPostWorker.create({ engine })
|
|
289
290
|
.onResolved({
|
|
@@ -182,11 +182,11 @@ export default class HoraSkillsCli {
|
|
|
182
182
|
'Commands:',
|
|
183
183
|
' install Install every skill this package distributes, replacing the installed ones',
|
|
184
184
|
' list Print the skills this package distributes, installing nothing',
|
|
185
|
-
' uninstall Remove
|
|
185
|
+
' uninstall Remove the skills this package installed into one directory',
|
|
186
186
|
' help Print this text',
|
|
187
187
|
'',
|
|
188
188
|
'Options:',
|
|
189
|
-
' --dir <path> Directory to install into (default: .claude/skills)',
|
|
189
|
+
' --dir <path> Directory to install into or remove from (default: .claude/skills)',
|
|
190
190
|
]
|
|
191
191
|
.join('\n')
|
|
192
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreachtech/hora-skills-ort-renchan",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Distributes the renchan backend skills used to develop with Hora Kit.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -49,15 +49,16 @@
|
|
|
49
49
|
"@openreachtech/renchan-env": "^1.0.6",
|
|
50
50
|
"@types/jest": "^30.0.0",
|
|
51
51
|
"eslint": "^9.39.5",
|
|
52
|
-
"jest": "^30.
|
|
52
|
+
"jest": "^30.5.2"
|
|
53
53
|
},
|
|
54
54
|
"overrides": {
|
|
55
55
|
"@humanfs/node": "^0.16.8",
|
|
56
|
-
"brace-expansion@
|
|
57
|
-
"
|
|
56
|
+
"brace-expansion@1": "^1.1.21",
|
|
57
|
+
"brace-expansion@5": "^5.0.12",
|
|
58
|
+
"flatted": "^3.4.4"
|
|
58
59
|
},
|
|
59
60
|
"allowScripts": {
|
|
60
|
-
"
|
|
61
|
+
"@parcel/watcher": false,
|
|
61
62
|
"unrs-resolver": false
|
|
62
63
|
}
|
|
63
64
|
}
|