blob: 27e736ab11a24d7fed0c204056ea417a22a7c095 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# iphone-notes
Create real **Apple Notes** on an iPhone from Linux by driving
[icloud.com/notes](https://www.icloud.com/notes/) with a **Rust** CLI
(`chromiumoxide` + headless Chromium) and a saved browser profile.
Also packaged as a Cursor/Goose agent skill (`SKILL.md`).
## Quick start
```bash
./scripts/setup.sh # cargo build --release + Chromium + ~/.local/bin
icloud-note login # Apple ID + 2FA once (visible window)
icloud-note create --title "Hello" --body "From Linux"
icloud-note update --title "Hello" --body "Revised from Linux"
```
## CLI
| Command | Purpose |
|---|---|
| `icloud-note setup` | Build/install binary + ensure Chromium |
| `icloud-note login` | **Only** command that opens a visible browser |
| `icloud-note status` | Headless session check |
| `icloud-note create` | Headless **new** note (`--title`, `--body` / `--body-file`) |
| `icloud-note update` | Headless **update** existing note by title (never creates) |
## Formatting
Bodies may be plain text or light Markdown. The CLI rewrites them to match
[Apple Notes formatting](https://support.apple.com/guide/iphone/create-and-format-notes-iph1ac0b3a2/ios)
([Mac guide](https://support.apple.com/guide/notes/format-notes-apd1955d3b21/mac),
[lists](https://support.apple.com/guide/notes/add-lists-apd93c815aa0/mac)):
- First line = **Title**; blank line before the rest
- `##` / `###` → **Heading** / **Subheading** (collapsible sections on device)
- List shortcuts: `*` → bulleted (`•`), `-` → dashed (`–`), `1.` → numbered
- `- [ ]` / `- [x]` → checklist (☐ / ☑)
- `---` → divider line; `> …` → block quote; pipe tables → aligned monospaced grid
- Inline `**bold**` / links / fences cleaned (rich bold/highlight needs the iOS UI)
`ICLOUD_NOTES_DRY_RUN=1` prints a formatted preview without touching iCloud.
**Updates and Title size:** Prefer `update` after installing a build that copies
TopoText from `createNoteWithTitleText` (first line Title, rest Body). Older
updates used `createInitialTopoTextString`, which can mark every line as Title
(huge text). You do **not** need a permanent new note — re-`update` with the
fixed CLI, or create once and delete the broken copy if you prefer.
## Layout
```text
src/ Rust library + CLI (chromiumoxide)
scripts/setup.sh Build, install, skill symlinks
SKILL.md Agent instructions
tests/ cargo test + CLI dry-run + Conventional Commits
legacy/nodejs/ Previous Playwright implementation (reference only)
```
Runtime config (**never commit** — see [SECURITY.md](SECURITY.md)):
```text
~/.config/icloud-notes/
browser-profile/ Chromium user-data / cookies (private)
session.ok Marker after successful login
```
This public repo contains **no** Apple account credentials. Auth stays in that
local XDG directory after `icloud-note login`.
Optional: `ICLOUD_NOTES_CHROME=/path/to/chrome`
Tests: `ICLOUD_NOTES_DRY_RUN=1`
## Tests
```bash
./tests/run.sh
# or
cargo test && ./tests/cli.test.sh && ./tests/conventional-commits.test.sh
```
## Why Rust
Single binary, `cargo test` for helpers, and headless Chromium via CDP without a
Node/Playwright process flashing a window on Linux. The Notes web app is still
driven through JavaScript evaluation — that part is inherent to iCloud.
## License
MIT
|