@chiimagnus/applebookscli 0.2.0 → 0.3.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
CHANGED
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
# AppleBooksCLI
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
English | [简体中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[AppleBooksCLI](https://github.com/chiimagnus/AppleBooksCLI) is a command-line tool for Apple Books on macOS. It can query your library, reading state, highlights, and notes; read available EPUB/PDF content; export notes; and safely update existing notes or collections when requested.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- 查询划线、笔记、最近批注,并按书籍或时间定位。
|
|
9
|
-
- 查看单条批注时获得可直接跳回 Apple Books 对应划线位置的链接。
|
|
10
|
-
- 读取可用 EPUB 的目录、章节、元数据与批注上下文。
|
|
11
|
-
- 提取 PDF 划线与笔记。
|
|
12
|
-
- 导出 JSON、CSV、Markdown 或 HTML。
|
|
13
|
-
- **安全修改笔记、管理藏书,并在写入前自动备份。**
|
|
14
|
-
- 提供标准 `applebookscli` Agent Skill。
|
|
7
|
+
## Features
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
- Browse and search the Apple Books library and reading state.
|
|
10
|
+
- Query highlights, notes, and recent annotations, with book- and time-based filtering.
|
|
11
|
+
- Open a single annotation back at its Apple Books location when a deep link is available.
|
|
12
|
+
- Read available EPUB tables of contents, chapters, metadata, and annotation context.
|
|
13
|
+
- Extract PDF highlights and notes.
|
|
14
|
+
- Export JSON, CSV, Markdown, or HTML.
|
|
15
|
+
- **Safely update notes and manage collections, with an automatic backup before writes.**
|
|
16
|
+
- Review the last 24 hours of AppleBooksCLI write/sync tool calls through local operation history.
|
|
17
|
+
- Provide a standard `applebookscli` Agent Skill in English and Chinese.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
- 未下载的 EPUB、DRM 内容或当前系统无法读取的内容会明确提示不可用或能力受限;AppleBooksCLI 不绕过系统保护。
|
|
19
|
+
## Requirements
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
- macOS may require Full Disk Access for the terminal or calling process before Apple Books data can be read.
|
|
22
|
+
- Undownloaded EPUBs, DRM-protected content, or content the current system cannot read are reported as unavailable or capability-limited. AppleBooksCLI does not bypass system protections.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
22
25
|
|
|
23
26
|
```sh
|
|
24
|
-
# 安装 CLI
|
|
25
27
|
npm install --global @chiimagnus/applebookscli@latest
|
|
26
|
-
|
|
27
|
-
# 安装 SKILL.md;首次安装时由 Agent Skills CLI 选择目标 Agent
|
|
28
|
-
CLI_VERSION="$(applebookscli --version)"
|
|
29
|
-
npx -y skills@1.5.23 add "chiimagnus/AppleBooksCLI#v${CLI_VERSION}" --skill applebookscli --global
|
|
30
|
-
|
|
28
|
+
npx -y skills@1.5.23 add "chiimagnus/AppleBooksCLI#v$(applebookscli --version)" --skill applebookscli --global
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
Future npm upgrades keep an Agent Skills CLI-managed Skill on the same CLI release tag automatically. `--ignore-scripts` disables that automatic update.
|
|
34
32
|
|
|
35
|
-
##
|
|
33
|
+
## Help
|
|
36
34
|
|
|
37
|
-
CLI
|
|
35
|
+
The installed CLI is the source of truth for current commands and arguments:
|
|
38
36
|
|
|
39
37
|
```sh
|
|
40
38
|
applebookscli --help
|
|
@@ -42,68 +40,68 @@ applebookscli <group> --help
|
|
|
42
40
|
applebookscli <group> <subcommand> --help
|
|
43
41
|
```
|
|
44
42
|
|
|
45
|
-
##
|
|
43
|
+
## Quick start
|
|
46
44
|
|
|
47
45
|
```sh
|
|
48
|
-
#
|
|
46
|
+
# Browse the library
|
|
49
47
|
applebookscli books list
|
|
50
48
|
|
|
51
|
-
#
|
|
49
|
+
# Show books currently in progress
|
|
52
50
|
applebookscli reading in-progress
|
|
53
51
|
|
|
54
|
-
#
|
|
52
|
+
# Show recently created annotations
|
|
55
53
|
applebookscli annotations recent
|
|
56
54
|
|
|
57
|
-
#
|
|
55
|
+
# Show library statistics
|
|
58
56
|
applebookscli stats
|
|
59
57
|
```
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
Most query commands support `--json` when structured output is needed:
|
|
62
60
|
|
|
63
61
|
```sh
|
|
64
62
|
applebookscli books list --json
|
|
65
63
|
applebookscli annotations recent --json
|
|
66
64
|
```
|
|
67
65
|
|
|
68
|
-
##
|
|
66
|
+
## Notes, highlights, and locations
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
Find an annotation first, then inspect it by UUID:
|
|
71
69
|
|
|
72
70
|
```sh
|
|
73
71
|
applebookscli annotations recent --json
|
|
74
72
|
applebookscli annotations get <annotation-uuid>
|
|
75
73
|
```
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
A single-annotation result includes an `appleBooksURL` when available so you can jump back to the book or highlight location in Apple Books.
|
|
78
76
|
|
|
79
|
-
|
|
77
|
+
To read text around a highlight:
|
|
80
78
|
|
|
81
79
|
```sh
|
|
82
80
|
applebookscli content context <annotation-uuid>
|
|
83
81
|
```
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
Use the current help for search, book filters, colors, and time ranges:
|
|
86
84
|
|
|
87
85
|
```sh
|
|
88
86
|
applebookscli annotations --help
|
|
89
87
|
```
|
|
90
88
|
|
|
91
|
-
## EPUB
|
|
89
|
+
## EPUB and PDF
|
|
92
90
|
|
|
93
91
|
```sh
|
|
94
|
-
# EPUB
|
|
92
|
+
# EPUB content commands
|
|
95
93
|
applebookscli content --help
|
|
96
94
|
|
|
97
|
-
#
|
|
95
|
+
# List PDF inventory
|
|
98
96
|
applebookscli pdf list
|
|
99
97
|
|
|
100
|
-
#
|
|
98
|
+
# Extract highlights from a PDF
|
|
101
99
|
applebookscli pdf highlights --help
|
|
102
100
|
```
|
|
103
101
|
|
|
104
|
-
EPUB
|
|
102
|
+
Before reading EPUB text, AppleBooksCLI checks local materialization state without intentionally triggering iCloud hydration and does not bypass DRM. PDF commands only operate on sources that currently resolve to readable local files; equivalent non-hydrating behavior for iCloud placeholders has not been established.
|
|
105
103
|
|
|
106
|
-
##
|
|
104
|
+
## Export
|
|
107
105
|
|
|
108
106
|
```sh
|
|
109
107
|
# Markdown
|
|
@@ -113,15 +111,15 @@ applebookscli export --format markdown --output ~/Desktop/apple-books.md
|
|
|
113
111
|
applebookscli export --format json --output ~/Desktop/apple-books.json
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
|
|
114
|
+
CSV, HTML, grouping by book, highlight/note filtering, Obsidian formatting, covers, and complete-notes archives are also available. EPUB annotations with a CFI make the `Location` text itself an Apple Books deep link in HTML/Markdown; without a CFI, the link falls back to the book level. JSON/CSV preserve the corresponding `appleBooksURL`:
|
|
117
115
|
|
|
118
116
|
```sh
|
|
119
117
|
applebookscli export --help
|
|
120
118
|
```
|
|
121
119
|
|
|
122
|
-
##
|
|
120
|
+
## Safe writes
|
|
123
121
|
|
|
124
|
-
AppleBooksCLI
|
|
122
|
+
AppleBooksCLI can update existing notes and manage collections. It creates a backup before writing and verifies the result afterward. Ordinary queries do not implicitly modify Apple Books data.
|
|
125
123
|
|
|
126
124
|
```sh
|
|
127
125
|
applebookscli annotations update-note --help
|
|
@@ -129,13 +127,13 @@ applebookscli collections --help
|
|
|
129
127
|
applebookscli backups --help
|
|
130
128
|
```
|
|
131
129
|
|
|
132
|
-
|
|
130
|
+
A single collection or annotation mutation can add `--sync` to wait for current-Mac CloudKit acknowledgement after the local commit and cloud projection:
|
|
133
131
|
|
|
134
132
|
```sh
|
|
135
133
|
applebookscli collections create "My Shelf" --sync --json
|
|
136
134
|
```
|
|
137
135
|
|
|
138
|
-
|
|
136
|
+
For several writes, commit the normal mutations first and flush once at the end:
|
|
139
137
|
|
|
140
138
|
```sh
|
|
141
139
|
applebookscli collections create "Shelf A" --json
|
|
@@ -143,19 +141,30 @@ applebookscli annotations update-note <annotation-uuid> --note "New note" --json
|
|
|
143
141
|
applebookscli sync --json
|
|
144
142
|
```
|
|
145
143
|
|
|
146
|
-
`sync`
|
|
144
|
+
`sync` only processes already pending collection/member/annotation cloud records and does not trigger the lifecycle when none are pending. Acknowledgement proves only that **this Mac** completed the Apple Books CloudKit upload; it does not prove that another device already displays the change. A post-commit `cloud_sync_failed` must not cause an automatic mutation retry, and restoring a BKLibrary snapshot is not equivalent to replaying individually flushable cloud mutations.
|
|
145
|
+
|
|
146
|
+
## Operation history
|
|
147
|
+
|
|
148
|
+
AppleBooksCLI keeps a private local history of the last 24 hours of its annotation/collection mutations, backup restores, and explicit `sync` calls. `history list` returns only summaries; `history get` is the explicit full-detail read and may contain the original note/title/details/selectors plus captured stdout/stderr.
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
applebookscli history list --json
|
|
152
|
+
applebookscli history get <history-id> --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
History is stored only for the current user under AppleBooksCLI's Application Support directory. AppleBooksCLI does not send it as telemetry or sync it between devices, and history is evidence of prior tool calls rather than an undo engine.
|
|
147
156
|
|
|
148
|
-
##
|
|
157
|
+
## Optional configuration
|
|
149
158
|
|
|
150
|
-
|
|
159
|
+
Most users do not need a configuration file. `~/.config/applebookscli/config.json` is only needed for an additional EPUB directory or to supplement title/author metadata for historical annotations.
|
|
151
160
|
|
|
152
|
-
|
|
161
|
+
See [`Config/applebookscli.example.json`](Config/applebookscli.example.json).
|
|
153
162
|
|
|
154
|
-
##
|
|
163
|
+
## Development and maintenance
|
|
155
164
|
|
|
156
|
-
|
|
165
|
+
Start with [`docs/index.md`](docs/index.md) for architecture, CLI contract, write safety, release workflow, and other maintainer documentation.
|
|
157
166
|
|
|
158
167
|
## License
|
|
159
168
|
|
|
160
|
-
AppleBooksCLI
|
|
161
|
-
|
|
169
|
+
AppleBooksCLI is licensed under the [AGPLv3 LICENSE](LICENSE).
|
|
170
|
+
Third-party notices and license texts are in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) and [`ThirdPartyLicenses/`](ThirdPartyLicenses/).
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# AppleBooksCLI
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
[AppleBooksCLI](https://github.com/chiimagnus/AppleBooksCLI) 是一个用于 macOS Apple Books 的命令行工具。你可以直接查询自己的书库、阅读状态、划线与笔记,读取可用的 EPUB/PDF 内容,导出笔记,并在需要时安全地修改笔记或藏书。
|
|
6
|
+
|
|
7
|
+
## 主要功能
|
|
8
|
+
|
|
9
|
+
- 浏览、搜索 Apple Books 书库与阅读状态。
|
|
10
|
+
- 查询划线、笔记、最近批注,并按书籍或时间定位。
|
|
11
|
+
- 查看单条批注时获得可直接跳回 Apple Books 对应划线位置的链接。
|
|
12
|
+
- 读取可用 EPUB 的目录、章节、元数据与批注上下文。
|
|
13
|
+
- 提取 PDF 划线与笔记。
|
|
14
|
+
- 导出 JSON、CSV、Markdown 或 HTML。
|
|
15
|
+
- **安全修改笔记、管理藏书,并在写入前自动备份。**
|
|
16
|
+
- 通过本地 operation history 查看最近 24 小时的 AppleBooksCLI 写入/同步 tool calls。
|
|
17
|
+
- 提供标准 `applebookscli` Agent Skill,并提供英文/中文两个版本。
|
|
18
|
+
|
|
19
|
+
## 系统要求
|
|
20
|
+
|
|
21
|
+
- 读取 Apple Books 数据时,macOS 可能要求为终端或调用进程授予 Full Disk Access。
|
|
22
|
+
- 未下载的 EPUB、DRM 内容或当前系统无法读取的内容会明确提示不可用或能力受限;AppleBooksCLI 不绕过系统保护。
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install --global @chiimagnus/applebookscli@latest
|
|
28
|
+
npx -y skills@1.5.23 add "chiimagnus/AppleBooksCLI#v$(applebookscli --version)" --skill applebookscli-zh --global
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
以后通过 npm 升级 CLI 时,由 Agent Skills CLI 管理的 Skill 会自动跟随到相同的 CLI release tag。使用 `--ignore-scripts` 会关闭这项自动更新。
|
|
32
|
+
|
|
33
|
+
## 获取帮助
|
|
34
|
+
|
|
35
|
+
CLI 自带完整帮助,具体命令与参数以当前安装版本为准:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
applebookscli --help
|
|
39
|
+
applebookscli <group> --help
|
|
40
|
+
applebookscli <group> <subcommand> --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 快速开始
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# 浏览书库
|
|
47
|
+
applebookscli books list
|
|
48
|
+
|
|
49
|
+
# 查看正在阅读的书
|
|
50
|
+
applebookscli reading in-progress
|
|
51
|
+
|
|
52
|
+
# 查看最近创建的批注
|
|
53
|
+
applebookscli annotations recent
|
|
54
|
+
|
|
55
|
+
# 查看书库统计
|
|
56
|
+
applebookscli stats
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
需要结构化结果时,大多数查询命令支持 `--json`:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
applebookscli books list --json
|
|
63
|
+
applebookscli annotations recent --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 笔记、划线与定位
|
|
67
|
+
|
|
68
|
+
先找到批注,再用 UUID 查看具体内容:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
applebookscli annotations recent --json
|
|
72
|
+
applebookscli annotations get <annotation-uuid>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
单条批注结果会包含对应的 `appleBooksURL`,可以直接跳回 Apple Books 中该书或对应划线位置。
|
|
76
|
+
|
|
77
|
+
如果需要查看划线前后的正文:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
applebookscli content context <annotation-uuid>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
搜索、按书筛选、颜色、时间范围等能力以当前帮助为准:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
applebookscli annotations --help
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## EPUB 与 PDF
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
# EPUB 内容相关命令
|
|
93
|
+
applebookscli content --help
|
|
94
|
+
|
|
95
|
+
# 查看 PDF inventory
|
|
96
|
+
applebookscli pdf list
|
|
97
|
+
|
|
98
|
+
# 提取某个 PDF 的 highlights
|
|
99
|
+
applebookscli pdf highlights --help
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
EPUB 在读取正文前会先检查本地 materialization 状态,不主动触发 iCloud hydration,也不会绕过 DRM。PDF 只处理当前可解析为可读本地文件的 source;对 iCloud placeholder 的 non-hydrating 行为尚未建立等价保证。
|
|
103
|
+
|
|
104
|
+
## 导出
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
# Markdown
|
|
108
|
+
applebookscli export --format markdown --output ~/Desktop/apple-books.md
|
|
109
|
+
|
|
110
|
+
# JSON
|
|
111
|
+
applebookscli export --format json --output ~/Desktop/apple-books.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
还支持 CSV、HTML、按书分组、筛选划线/笔记、Obsidian 格式、封面与完整笔记归档等选项。有 CFI 的 EPUB 批注在 HTML/Markdown 中会把 `Location` 本身做成 Apple Books deep link;无 CFI 时退化为书籍级链接。JSON/CSV 保留对应 `appleBooksURL`:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
applebookscli export --help
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 安全写入
|
|
121
|
+
|
|
122
|
+
AppleBooksCLI 可以修改已有笔记和管理藏书。写入前会自动创建备份,并在写入后验证结果;普通查询不会隐式修改 Apple Books 数据。
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
applebookscli annotations update-note --help
|
|
126
|
+
applebookscli collections --help
|
|
127
|
+
applebookscli backups --help
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
单条 collection / annotation mutation 可加 `--sync`,在本地 commit + cloud projection 后等待当前 Mac 的 CloudKit acknowledgement:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
applebookscli collections create "My Shelf" --sync --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
连续多条写入时,优先正常提交各 mutation,最后只 flush 一次:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
applebookscli collections create "Shelf A" --json
|
|
140
|
+
applebookscli annotations update-note <annotation-uuid> --note "New note" --json
|
|
141
|
+
applebookscli sync --json
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`sync` 只处理已存在的 pending collection/member/annotation cloud records;无 pending 时不触发生命周期。acknowledgement 只证明**当前 Mac** 已完成 Apple Books CloudKit upload,不等于另一台设备已经显示。post-commit `cloud_sync_failed` 不能触发自动重试;BKLibrary restore 也不等同于可逐条 flush 的 cloud mutation。
|
|
145
|
+
|
|
146
|
+
## 操作历史
|
|
147
|
+
|
|
148
|
+
AppleBooksCLI 会在本机私有保存最近 24 小时的批注/藏书 mutation、backup restore 与显式 `sync` 调用。`history list` 只返回摘要;只有显式 `history get` 才返回完整记录,其中可能包含原始 note/title/details/selector 以及捕获的 stdout/stderr。
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
applebookscli history list --json
|
|
152
|
+
applebookscli history get <history-id> --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
History 只存放在当前用户的 AppleBooksCLI Application Support 目录中;AppleBooksCLI 不把它作为 telemetry 上传,也不跨设备同步。它只是既往 tool call 的证据,不是 undo engine。
|
|
156
|
+
|
|
157
|
+
## 可选配置
|
|
158
|
+
|
|
159
|
+
大多数用户不需要配置文件。只有需要指定额外的 EPUB 目录,或给历史批注补充书名/作者信息时,才需要 `~/.config/applebookscli/config.json`。
|
|
160
|
+
|
|
161
|
+
示例见 [`Config/applebookscli.example.json`](Config/applebookscli.example.json)。
|
|
162
|
+
|
|
163
|
+
## 开发与维护
|
|
164
|
+
|
|
165
|
+
架构、CLI contract、写入安全、发布流程和其它维护者文档从 [`docs/index.md`](docs/index.md) 开始。
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
AppleBooksCLI 使用 [AGPLv3 LICENSE](LICENSE)。
|
|
170
|
+
第三方 notice 与许可证文本见 [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) 和 [`ThirdPartyLicenses/`](ThirdPartyLicenses/)。
|
package/bin/applebookscli
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -3,16 +3,16 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const skillNames = ["applebookscli", "applebookscli-zh"];
|
|
7
7
|
const source = "chiimagnus/AppleBooksCLI";
|
|
8
8
|
const sourceURL = "https://github.com/chiimagnus/AppleBooksCLI.git";
|
|
9
9
|
const skillsVersion = "1.5.23";
|
|
10
10
|
|
|
11
|
-
async function runUpdater() {
|
|
11
|
+
async function runUpdater(names) {
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
const child = spawn(
|
|
14
14
|
"npx",
|
|
15
|
-
["-y", `skills@${skillsVersion}`, "update",
|
|
15
|
+
["-y", `skills@${skillsVersion}`, "update", ...names, "-g", "-y"],
|
|
16
16
|
{
|
|
17
17
|
stdio: "ignore",
|
|
18
18
|
env: { ...process.env, DISABLE_TELEMETRY: "1" },
|
|
@@ -40,25 +40,24 @@ async function main() {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const lock = JSON.parse(rawLock);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
43
|
+
const managed = skillNames.filter((name) => {
|
|
44
|
+
const entry = lock.skills?.[name];
|
|
45
|
+
return entry?.sourceType === "github" &&
|
|
46
|
+
(entry.source === source || entry.sourceUrl === sourceURL);
|
|
47
|
+
});
|
|
48
|
+
if (managed.length === 0) return;
|
|
51
49
|
|
|
52
50
|
const targetRef = `v${packageJSON.version}`;
|
|
53
|
-
|
|
51
|
+
const changed = managed.some((name) => lock.skills[name].ref !== targetRef);
|
|
52
|
+
if (changed) {
|
|
54
53
|
const mode = (await stat(lockPath)).mode & 0o777;
|
|
55
54
|
const temporary = `${lockPath}.${process.pid}.tmp`;
|
|
56
|
-
|
|
55
|
+
for (const name of managed) lock.skills[name].ref = targetRef;
|
|
57
56
|
await writeFile(temporary, `${JSON.stringify(lock, null, 2)}\n`, { mode });
|
|
58
57
|
await rename(temporary, lockPath);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
const code = await runUpdater();
|
|
60
|
+
const code = await runUpdater(managed);
|
|
62
61
|
if (code !== 0) {
|
|
63
62
|
console.warn(
|
|
64
63
|
`applebookscli: Skill update to ${targetRef} did not complete; Agent Skills CLI can retry later.`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chiimagnus/applebookscli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Native Apple Books CLI for macOS on Apple Silicon.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"bin/applebookscli",
|
|
28
28
|
"libexec/applebookscli/applebookscli-pdf-worker",
|
|
29
29
|
"libexec/applebookscli/sync-installed-skill.mjs",
|
|
30
|
+
"README.zh.md",
|
|
30
31
|
"LICENSE",
|
|
31
32
|
"THIRD_PARTY_NOTICES.md",
|
|
32
33
|
"ThirdPartyLicenses"
|