@helpfeel/cosense-cli 1.14.1 → 1.15.0
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 +5 -5
- package/src/cli.ts +1 -1
- package/src/commands/previewEdit.ts +16 -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.
|
|
4
|
-
"description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skill
|
|
3
|
+
"version": "1.15.0",
|
|
4
|
+
"description": "Cosense (旧Scrapbox) のページを読み・調べ・編集するAgent Skillのハーネス",
|
|
5
5
|
"homepage": "https://github.com/helpfeel/cosense-cli",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"format": "oxfmt"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"tsx": "4.23.
|
|
27
|
+
"tsx": "4.23.13"
|
|
28
28
|
},
|
|
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.65.0",
|
|
33
|
+
"oxlint": "1.80.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...]',
|
|
@@ -48,11 +48,14 @@ stdinから受け取る入力形式(既存ページ編集モード, JSON):
|
|
|
48
48
|
|
|
49
49
|
戻り値(plain text):
|
|
50
50
|
previewId / expireAt / status (create or update) / project / title / commitId のヘッダー +
|
|
51
|
-
ops summary + 適用後 page
|
|
51
|
+
ops summary + 適用後 page 全体 + 変更行の内部リンク一覧。
|
|
52
52
|
commitId は preview を作った時点の編集対象ページの最新コミット。 新規作成 (status: create)
|
|
53
53
|
では出力されない。
|
|
54
54
|
変更行の頭には > (新規) または * (更新) のマーカーと末尾 # <lineId> が付く。
|
|
55
55
|
既存行(変更なし)はマーカーなし。
|
|
56
|
+
末尾の internal links in changed lines: は、 この変更で書き換えた行と、 変更の影響でリンク記法
|
|
57
|
+
として解釈されるようになった既存行から張られる内部リンクの接続先を、 重複を除いて列挙する。
|
|
58
|
+
[title] と #tag は title、 [/project/title] は /project/title の形。 1件も無ければ (none)。
|
|
56
59
|
preview は dry-run なのでこの段階ではpage URLは確定しない。 確定URLは submitEdit の出力で確認する。
|
|
57
60
|
previewId は submitEdit に渡して commit を確定する。5分で expire する。
|
|
58
61
|
|
|
@@ -108,6 +111,7 @@ interface PreviewResponse {
|
|
|
108
111
|
previewId: string;
|
|
109
112
|
expireAt: string;
|
|
110
113
|
pagePreview: PagePreview | null;
|
|
114
|
+
changedLinks?: string[];
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
const newLineId = (): string => randomBytes(12).toString('hex');
|
|
@@ -235,6 +239,17 @@ const formatPreview = (
|
|
|
235
239
|
lines.push(` ${line.text}`);
|
|
236
240
|
}
|
|
237
241
|
}
|
|
242
|
+
// changedLinksはサーバーが対応している場合のみ返る
|
|
243
|
+
if (Array.isArray(response.changedLinks)) {
|
|
244
|
+
lines.push('');
|
|
245
|
+
lines.push('internal links in changed lines:');
|
|
246
|
+
if (response.changedLinks.length === 0) {
|
|
247
|
+
lines.push(' (none)');
|
|
248
|
+
}
|
|
249
|
+
for (const link of response.changedLinks) {
|
|
250
|
+
lines.push(` ${link}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
238
253
|
return lines.join('\n');
|
|
239
254
|
};
|
|
240
255
|
|