@helpfeel/cosense-cli 1.14.0 → 1.14.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.md +2 -2
- package/package.json +4 -4
- package/src/cli.ts +1 -1
- package/src/commands/previewDelete.ts +5 -1
- package/src/commands/previewEdit.ts +8 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @helpfeel/cosense-cli
|
|
2
2
|
|
|
3
|
-
Cosenseのページを読み・調べ・編集するAgent Skill
|
|
3
|
+
Cosenseのページを読み・調べ・編集するAgent Skillとそのハーネス
|
|
4
4
|
|
|
5
5
|
## Install Agent Skill
|
|
6
6
|
|
|
@@ -34,7 +34,7 @@ npx skills update cosense
|
|
|
34
34
|
|
|
35
35
|
## Install CLI
|
|
36
36
|
|
|
37
|
-
Skill
|
|
37
|
+
SkillはこのCLIをハーネスとして使います。Skillの実行に必要です
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
npm install -g @helpfeel/cosense-cli
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helpfeel/cosense-cli",
|
|
3
|
-
"version": "1.14.
|
|
4
|
-
"description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skill
|
|
3
|
+
"version": "1.14.2",
|
|
4
|
+
"description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skillのハーネス",
|
|
5
5
|
"homepage": "https://github.com/helpfeel/cosense-cli",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "24.13.3",
|
|
31
31
|
"npm-run-all": "4.1.5",
|
|
32
|
-
"oxfmt": "0.
|
|
33
|
-
"oxlint": "1.
|
|
32
|
+
"oxfmt": "0.64.0",
|
|
33
|
+
"oxlint": "1.79.0",
|
|
34
34
|
"typescript": "7.0.2"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
package/src/cli.ts
CHANGED
|
@@ -254,7 +254,7 @@ const commands: Record<string, CommandSpec> = {
|
|
|
254
254
|
const renderTopLevelHelp = (): string => {
|
|
255
255
|
const nameWidth = Math.max(...Object.keys(commands).map(n => n.length));
|
|
256
256
|
const lines = [
|
|
257
|
-
`cosense v${version} - Cosenseのページを読み・調べ・編集する
|
|
257
|
+
`cosense v${version} - Cosenseのページを読み・調べ・編集するAgent Skillのハーネス`,
|
|
258
258
|
'',
|
|
259
259
|
'Usage:',
|
|
260
260
|
' cosense <command> [args...]',
|
|
@@ -15,7 +15,9 @@ Usage:
|
|
|
15
15
|
<pageId> 削除対象ページのID。 readPage 出力の top-level "id" field から取得する
|
|
16
16
|
|
|
17
17
|
戻り値(plain text):
|
|
18
|
-
previewId / expireAt / status (delete) / project / title のヘッダー +
|
|
18
|
+
previewId / expireAt / status (delete) / project / title / commitId のヘッダー +
|
|
19
|
+
削除されるpage全体。
|
|
20
|
+
commitId は preview を作った時点の削除対象ページの最新コミット。
|
|
19
21
|
preview は dry-run なのでこの段階では削除されない。
|
|
20
22
|
previewId を submitEdit に渡すと削除が確定する。5分で expire する。
|
|
21
23
|
|
|
@@ -27,6 +29,7 @@ HTTPエラー:
|
|
|
27
29
|
|
|
28
30
|
interface PagePreview {
|
|
29
31
|
title?: string;
|
|
32
|
+
commitId?: string;
|
|
30
33
|
lines?: { id: string; text: string }[];
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -67,6 +70,7 @@ export const previewDelete = async (args: string[]): Promise<void> => {
|
|
|
67
70
|
lines.push('status: delete');
|
|
68
71
|
lines.push(`project: ${projectName}`);
|
|
69
72
|
lines.push(`title: ${response.pagePreview?.title ?? ''}`);
|
|
73
|
+
lines.push(`commitId: ${response.pagePreview?.commitId ?? ''}`);
|
|
70
74
|
lines.push('');
|
|
71
75
|
lines.push('page (will be deleted):');
|
|
72
76
|
for (const line of response.pagePreview?.lines ?? []) {
|
|
@@ -47,8 +47,10 @@ stdinから受け取る入力形式(既存ページ編集モード, JSON):
|
|
|
47
47
|
する必要がある(消えた lineId を anchor に指定すると 422)。
|
|
48
48
|
|
|
49
49
|
戻り値(plain text):
|
|
50
|
-
previewId / expireAt / status (create or update) / project / title のヘッダー +
|
|
50
|
+
previewId / expireAt / status (create or update) / project / title / commitId のヘッダー +
|
|
51
51
|
ops summary + 適用後 page 全体。
|
|
52
|
+
commitId は preview を作った時点の編集対象ページの最新コミット。 新規作成 (status: create)
|
|
53
|
+
では出力されない。
|
|
52
54
|
変更行の頭には > (新規) または * (更新) のマーカーと末尾 # <lineId> が付く。
|
|
53
55
|
既存行(変更なし)はマーカーなし。
|
|
54
56
|
preview は dry-run なのでこの段階ではpage URLは確定しない。 確定URLは submitEdit の出力で確認する。
|
|
@@ -98,6 +100,7 @@ type RawChange = RawInsertChange | RawUpdateChange | RawDeleteChange;
|
|
|
98
100
|
interface PagePreview {
|
|
99
101
|
title?: string;
|
|
100
102
|
persistent?: boolean;
|
|
103
|
+
commitId?: string;
|
|
101
104
|
lines?: { id: string; text: string }[];
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -212,6 +215,10 @@ const formatPreview = (
|
|
|
212
215
|
lines.push(`status: ${status}`);
|
|
213
216
|
lines.push(`project: ${projectName}`);
|
|
214
217
|
lines.push(`title: ${title}`);
|
|
218
|
+
// 新規作成 (persistent: false) のページにはまだcommitが無く、サーバーもcommitIdを返さない
|
|
219
|
+
if (typeof pagePreview?.commitId === 'string') {
|
|
220
|
+
lines.push(`commitId: ${pagePreview.commitId}`);
|
|
221
|
+
}
|
|
215
222
|
lines.push('');
|
|
216
223
|
lines.push('ops:');
|
|
217
224
|
for (const op of ops) {
|