@helpfeel/cosense-cli 1.14.0 → 1.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpfeel/cosense-cli",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skill用のCLI",
5
5
  "homepage": "https://github.com/helpfeel/cosense-cli",
6
6
  "license": "MIT",
@@ -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 のヘッダー + 削除されるpage全体。
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) {