@helpfeel/cosense-cli 1.11.0 → 1.11.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.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skill用のCLI",
5
5
  "homepage": "https://github.com/helpfeel/cosense-cli",
6
6
  "license": "MIT",
@@ -29,7 +29,8 @@ HTTPエラー:
29
29
  HTTP 400 <oldTitle> と <newTitle> が同じ / どちらかが空 / <newTitle> がリンク記法として成立しない
30
30
  HTTP 401 認証なし
31
31
  HTTP 403 権限不足(PAT利用時、projectのmemberでない 等)
32
- HTTP 500 一部のページの更新に失敗した。 同じ引数で再実行すると、 未置換のページだけが再び対象になる
32
+ HTTP 500 一部のページの更新に失敗した。 同じ引数で再実行できる。 置換済みのリンクが
33
+ 別の文字列へ再置換される事はない
33
34
  `;
34
35
 
35
36
  interface ReplaceLinksResponse {
@@ -24,6 +24,10 @@ Usage:
24
24
  タイトルに auto-suffix を付ける (新規作成でも既存ページのタイトル変更でも起きる)。
25
25
  title/url にはその suffix が反映される。
26
26
 
27
+ 既存ページのタイトルが変わった編集では、続けて以下を出力する:
28
+ titleChanged: "<変更前title>" -> "<変更後title>"
29
+ 新旧タイトルはそれぞれJSON string
30
+
27
31
  HTTPエラー:
28
32
  HTTP 400 preview を生成した時と違う project の URL を渡している
29
33
  HTTP 401 認証なし
@@ -41,6 +45,7 @@ previewId は1回限り (consume-on-submit)。submit 後・5分 expire 後・con
41
45
  interface SubmitResponse {
42
46
  commitId: string;
43
47
  page: { title?: string } | null;
48
+ titleChanged?: { from?: string; to?: string };
44
49
  }
45
50
 
46
51
  export const submitEdit = async (args: string[]): Promise<void> => {
@@ -69,4 +74,18 @@ export const submitEdit = async (args: string[]): Promise<void> => {
69
74
  process.stdout.write(
70
75
  `commitId: ${response.commitId}\ntitle: ${title}\nurl: ${url}\n`
71
76
  );
77
+
78
+ // titleChangedはサーバーが対応している場合のみ返る
79
+ const titleChanged = response.titleChanged;
80
+ if (
81
+ typeof titleChanged?.from === 'string' &&
82
+ typeof titleChanged.to === 'string'
83
+ ) {
84
+ // タイトルには " や -> が含まれうるので、境界が一意に読めるようJSON stringで出力する
85
+ process.stdout.write(
86
+ `titleChanged: ${JSON.stringify(titleChanged.from)} -> ${JSON.stringify(
87
+ titleChanged.to
88
+ )}\n`
89
+ );
90
+ }
72
91
  };