fns-cli 0.4.0__tar.gz

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.
fns_cli-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 crazykuma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fns_cli-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.1
2
+ Name: fns-cli
3
+ Version: 0.4.0
4
+ Summary: CLI tool for Fast Note Sync (Obsidian)
5
+ Home-page: https://github.com/crazykuma/fns-cli
6
+ Author: crazykuma
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/crazykuma/fns-cli
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: click>=8.1
16
+
17
+ **Languages**: πŸ‡ΊπŸ‡Έ English | [πŸ‡¨πŸ‡³ δΈ­ζ–‡](README.zh.md)
18
+
19
+ ---
20
+
21
+ # FNS CLI (Fast Note Sync CLI)
22
+
23
+ > **From Local to Cloud**: Transform Obsidian notes from locally-managed files into **cloud-managed, AI-accessible knowledge**. Edit once, sync everywhere.
24
+
25
+ FNS CLI is a powerful command-line tool for interacting with the **[Fast Note Sync (FNS)](https://github.com/haierkeys/fast-note-sync-service)** service. Manage, read, write, and sync your Obsidian notes directly from the terminal β€” optimized for both **human workflows** and **AI Agent integration**.
26
+
27
+ ## 🎯 Design Philosophy
28
+
29
+ This tool bridges the gap between **local Obsidian editing** and **cloud-based AI knowledge management**:
30
+
31
+ ```
32
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
33
+ β”‚ Obsidian App │────▢│ FNS Service │◀────│ FNS CLI (this) β”‚
34
+ β”‚ (Desktop/Mobileβ”‚ β”‚ (Cloud Server) β”‚ β”‚ (Terminal/AI) β”‚
35
+ β”‚ Editor) │◀────│ │────▢│ (read/write) β”‚
36
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
37
+ β”‚
38
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
39
+ β”‚ AI Agents β”‚
40
+ β”‚ Claude Code, β”‚
41
+ β”‚ OpenCode, Cursor... β”‚
42
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
43
+ ```
44
+
45
+ **One edit/update β†’ all devices synced.** Whether you write in Obsidian on your desktop or manage notes via CLI/AI on a server, everything stays in sync through the FNS cloud service.
46
+
47
+ ## ✨ Features
48
+
49
+ ### Core
50
+ - **Full Note CRUD** β€” Create, read, update, append, prepend, move, delete
51
+ - **Smart Append** β€” Automatically handles newlines to prevent content merging
52
+ - **Local File Upload** β€” Use `@file.txt` prefix to upload any local file
53
+ - **Note History** β€” View and restore previous versions
54
+ - **Recycle Bin** β€” Recover deleted notes
55
+ - **Find & Replace** β€” Search and replace content (supports regex)
56
+ - **Cross-Platform** β€” macOS / Linux / Windows (Python 3.6+)
57
+
58
+ ### Knowledge Graph
59
+ - **Backlinks** β€” See which notes link to the current note
60
+ - **Outlinks** β€” See which notes the current note links to
61
+ - **Folder Tree** β€” Browse your vault's directory structure
62
+
63
+ ### Sharing & Metadata
64
+ - **Share Links** β€” Create shareable URLs with optional password and expiry
65
+ - **Frontmatter Editing** β€” View and modify note metadata (tags, title, etc.)
66
+
67
+ ### AI Agent Friendly
68
+ - **`--json` Mode** β€” Machine-readable output for AI parsing
69
+ - **`--quiet` Mode** β€” Silent operation for scripting
70
+ - **Zero interactive prompts** when arguments are provided
71
+
72
+ ### Administration
73
+ - **Vault Management** β€” List, view details, create, delete vaults
74
+ - **Server Status** β€” Check version and health
75
+ - **Auto-Setup** β€” Interactive guide on first login (URL β†’ credentials β†’ vault selection)
76
+
77
+ ## πŸ“¦ Installation
78
+
79
+ ```bash
80
+ git clone https://github.com/crazykuma/fns-cli.git
81
+ cd fns-cli
82
+ pip install -e .
83
+ ```
84
+
85
+ This installs the `fns` command globally on your system.
86
+
87
+ **Dependencies**: `click>=8.1` (installed automatically) + `curl` (pre-installed on most systems)
88
+
89
+ ## βš™οΈ Quick Setup
90
+
91
+ ### First-Time (Interactive Guide)
92
+
93
+ ```bash
94
+ fns login
95
+ # Enter FNS server URL: https://your-server
96
+ # Username or email: you@example.com
97
+ # Password: **** (hidden)
98
+ # πŸ“¦ Available vaults:
99
+ # 1. defaultVault
100
+ # Select vault [1]: 1
101
+ # πŸŽ‰ Ready! Try: fns list
102
+ ```
103
+
104
+ ### Script-Friendly (Non-Interactive)
105
+
106
+ ```bash
107
+ fns login -u https://your-server username password
108
+ ```
109
+
110
+ ### Manual Configuration
111
+
112
+ ```bash
113
+ fns config url "https://your-server/api"
114
+ ```
115
+
116
+ ## πŸš€ Command Reference
117
+
118
+ ### Authentication & Setup
119
+ ```bash
120
+ fns login [user] [pass] [-u URL] # Login (interactive if args omitted)
121
+ fns config show # Show current configuration
122
+ fns config url <value> # Set API URL
123
+ fns config vault <value> # Set vault name
124
+ ```
125
+
126
+ ### Note CRUD
127
+ ```bash
128
+ fns read <path> # Read a note
129
+ fns write <path> <text|@file> # Create/overwrite (use @ to upload local file)
130
+ fns append <path> <text|@file> # Append content (smart newline handling)
131
+ fns prepend <path> <text|@file> # Prepend content (after frontmatter)
132
+ fns delete <path> # Delete note (moves to recycle bin)
133
+ fns move <old> <new> # Move/rename a note
134
+ fns replace <path> <find> <replace> # Find and replace (supports regex)
135
+ fns history <path> # View revision history
136
+ fns restore <path> # Restore note from recycle bin
137
+ ```
138
+
139
+ ### Knowledge & Links
140
+ ```bash
141
+ fns list [keyword] # List/search notes
142
+ fns tree [path] # View folder tree structure
143
+ fns backlinks <path> # Notes linking to this one
144
+ fns outlinks <path> # Notes this one links to
145
+ ```
146
+
147
+ ### Sharing & Metadata
148
+ ```bash
149
+ fns share <path> [--expire 24h] [--password secret] # Create share link
150
+ fns unshare <path> # Remove sharing
151
+ fns frontmatter <path> # View frontmatter
152
+ fns frontmatter <path> --set key=value --remove key # Edit frontmatter
153
+ ```
154
+
155
+ ### Vault & Server
156
+ ```bash
157
+ fns vaults # List available vaults
158
+ fns vault-info [id] # Show vault details
159
+ fns vault-create <name> # Create vault (with confirmation)
160
+ fns vault-delete <id> # Delete vault (double confirmation)
161
+ fns recycle-bin [keyword] # View recycle bin
162
+ fns version # Show server version
163
+ fns health # Check server health
164
+ fns info # Show current user info
165
+ ```
166
+
167
+ ### Global Flags
168
+ ```bash
169
+ fns --json <command> # Output as JSON (for AI/script parsing)
170
+ fns --quiet <command> # Suppress non-essential output
171
+ fns --version / -v # Show version
172
+ fns --help # Show help
173
+ ```
174
+
175
+ ## πŸ€– AI Agent Integration
176
+
177
+ This tool is designed to give AI agents **long-term memory and knowledge access**:
178
+
179
+ - **Read Context**: `fns read` specific notes before coding tasks
180
+ - **Auto-Documentation**: `fns append` changelogs to daily notes
181
+ - **Knowledge Retrieval**: `fns list` / `fns tree` to discover relevant files
182
+ - **Knowledge Graph**: `fns backlinks` / `fns outlinks` to find related notes
183
+
184
+ **Example with AI Agent:**
185
+ ```bash
186
+ # Ask AI to read context, work, then document
187
+ fns read "projects/architecture.md" --json
188
+ # ... AI works ...
189
+ fns append "daily/2024-05-20.md" "- Completed architecture review"
190
+ ```
191
+
192
+ ## πŸ“ File Structure
193
+
194
+ ```
195
+ fns-cli/
196
+ β”œβ”€β”€ fns.py # Main CLI logic
197
+ β”œβ”€β”€ setup.py # Installation script
198
+ β”œβ”€β”€ requirements.txt # Dependencies
199
+ β”œβ”€β”€ tests/
200
+ β”‚ └── test_fns.py # Unit tests
201
+ β”œβ”€β”€ README.md # This file
202
+ β”œβ”€β”€ README.zh.md # Chinese version
203
+ β”œβ”€β”€ skill.md # Usage examples
204
+ β”œβ”€β”€ CHANGELOG.md # Version history
205
+ └── LICENSE # MIT License
206
+ ```
207
+
208
+ ## πŸ“– Usage Examples
209
+
210
+ For detailed examples, see the portable Skill at [`fns-skill/SKILL.md`](fns-skill/SKILL.md). You can copy the entire `fns-skill/` directory into your own AI agent's Skills folder (Qwen Code, Claude Code, etc.).
211
+
212
+ ## πŸ§ͺ Running Tests
213
+
214
+ ```bash
215
+ python -m unittest discover -s tests -v
216
+ ```
217
+
218
+ ## πŸ”— Related Projects
219
+
220
+ - **[fast-note-sync-service](https://github.com/haierkeys/fast-note-sync-service)** β€” The FNS backend server
221
+ - **[obsidian-fast-note-sync](https://github.com/haierkeys/obsidian-fast-note-sync)** β€” Obsidian plugin
222
+
223
+ ## πŸ“œ License
224
+
225
+ MIT License β€” see [LICENSE](LICENSE).
@@ -0,0 +1,209 @@
1
+ **Languages**: πŸ‡ΊπŸ‡Έ English | [πŸ‡¨πŸ‡³ δΈ­ζ–‡](README.zh.md)
2
+
3
+ ---
4
+
5
+ # FNS CLI (Fast Note Sync CLI)
6
+
7
+ > **From Local to Cloud**: Transform Obsidian notes from locally-managed files into **cloud-managed, AI-accessible knowledge**. Edit once, sync everywhere.
8
+
9
+ FNS CLI is a powerful command-line tool for interacting with the **[Fast Note Sync (FNS)](https://github.com/haierkeys/fast-note-sync-service)** service. Manage, read, write, and sync your Obsidian notes directly from the terminal β€” optimized for both **human workflows** and **AI Agent integration**.
10
+
11
+ ## 🎯 Design Philosophy
12
+
13
+ This tool bridges the gap between **local Obsidian editing** and **cloud-based AI knowledge management**:
14
+
15
+ ```
16
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
17
+ β”‚ Obsidian App │────▢│ FNS Service │◀────│ FNS CLI (this) β”‚
18
+ β”‚ (Desktop/Mobileβ”‚ β”‚ (Cloud Server) β”‚ β”‚ (Terminal/AI) β”‚
19
+ β”‚ Editor) │◀────│ │────▢│ (read/write) β”‚
20
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
21
+ β”‚
22
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
23
+ β”‚ AI Agents β”‚
24
+ β”‚ Claude Code, β”‚
25
+ β”‚ OpenCode, Cursor... β”‚
26
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
27
+ ```
28
+
29
+ **One edit/update β†’ all devices synced.** Whether you write in Obsidian on your desktop or manage notes via CLI/AI on a server, everything stays in sync through the FNS cloud service.
30
+
31
+ ## ✨ Features
32
+
33
+ ### Core
34
+ - **Full Note CRUD** β€” Create, read, update, append, prepend, move, delete
35
+ - **Smart Append** β€” Automatically handles newlines to prevent content merging
36
+ - **Local File Upload** β€” Use `@file.txt` prefix to upload any local file
37
+ - **Note History** β€” View and restore previous versions
38
+ - **Recycle Bin** β€” Recover deleted notes
39
+ - **Find & Replace** β€” Search and replace content (supports regex)
40
+ - **Cross-Platform** β€” macOS / Linux / Windows (Python 3.6+)
41
+
42
+ ### Knowledge Graph
43
+ - **Backlinks** β€” See which notes link to the current note
44
+ - **Outlinks** β€” See which notes the current note links to
45
+ - **Folder Tree** β€” Browse your vault's directory structure
46
+
47
+ ### Sharing & Metadata
48
+ - **Share Links** β€” Create shareable URLs with optional password and expiry
49
+ - **Frontmatter Editing** β€” View and modify note metadata (tags, title, etc.)
50
+
51
+ ### AI Agent Friendly
52
+ - **`--json` Mode** β€” Machine-readable output for AI parsing
53
+ - **`--quiet` Mode** β€” Silent operation for scripting
54
+ - **Zero interactive prompts** when arguments are provided
55
+
56
+ ### Administration
57
+ - **Vault Management** β€” List, view details, create, delete vaults
58
+ - **Server Status** β€” Check version and health
59
+ - **Auto-Setup** β€” Interactive guide on first login (URL β†’ credentials β†’ vault selection)
60
+
61
+ ## πŸ“¦ Installation
62
+
63
+ ```bash
64
+ git clone https://github.com/crazykuma/fns-cli.git
65
+ cd fns-cli
66
+ pip install -e .
67
+ ```
68
+
69
+ This installs the `fns` command globally on your system.
70
+
71
+ **Dependencies**: `click>=8.1` (installed automatically) + `curl` (pre-installed on most systems)
72
+
73
+ ## βš™οΈ Quick Setup
74
+
75
+ ### First-Time (Interactive Guide)
76
+
77
+ ```bash
78
+ fns login
79
+ # Enter FNS server URL: https://your-server
80
+ # Username or email: you@example.com
81
+ # Password: **** (hidden)
82
+ # πŸ“¦ Available vaults:
83
+ # 1. defaultVault
84
+ # Select vault [1]: 1
85
+ # πŸŽ‰ Ready! Try: fns list
86
+ ```
87
+
88
+ ### Script-Friendly (Non-Interactive)
89
+
90
+ ```bash
91
+ fns login -u https://your-server username password
92
+ ```
93
+
94
+ ### Manual Configuration
95
+
96
+ ```bash
97
+ fns config url "https://your-server/api"
98
+ ```
99
+
100
+ ## πŸš€ Command Reference
101
+
102
+ ### Authentication & Setup
103
+ ```bash
104
+ fns login [user] [pass] [-u URL] # Login (interactive if args omitted)
105
+ fns config show # Show current configuration
106
+ fns config url <value> # Set API URL
107
+ fns config vault <value> # Set vault name
108
+ ```
109
+
110
+ ### Note CRUD
111
+ ```bash
112
+ fns read <path> # Read a note
113
+ fns write <path> <text|@file> # Create/overwrite (use @ to upload local file)
114
+ fns append <path> <text|@file> # Append content (smart newline handling)
115
+ fns prepend <path> <text|@file> # Prepend content (after frontmatter)
116
+ fns delete <path> # Delete note (moves to recycle bin)
117
+ fns move <old> <new> # Move/rename a note
118
+ fns replace <path> <find> <replace> # Find and replace (supports regex)
119
+ fns history <path> # View revision history
120
+ fns restore <path> # Restore note from recycle bin
121
+ ```
122
+
123
+ ### Knowledge & Links
124
+ ```bash
125
+ fns list [keyword] # List/search notes
126
+ fns tree [path] # View folder tree structure
127
+ fns backlinks <path> # Notes linking to this one
128
+ fns outlinks <path> # Notes this one links to
129
+ ```
130
+
131
+ ### Sharing & Metadata
132
+ ```bash
133
+ fns share <path> [--expire 24h] [--password secret] # Create share link
134
+ fns unshare <path> # Remove sharing
135
+ fns frontmatter <path> # View frontmatter
136
+ fns frontmatter <path> --set key=value --remove key # Edit frontmatter
137
+ ```
138
+
139
+ ### Vault & Server
140
+ ```bash
141
+ fns vaults # List available vaults
142
+ fns vault-info [id] # Show vault details
143
+ fns vault-create <name> # Create vault (with confirmation)
144
+ fns vault-delete <id> # Delete vault (double confirmation)
145
+ fns recycle-bin [keyword] # View recycle bin
146
+ fns version # Show server version
147
+ fns health # Check server health
148
+ fns info # Show current user info
149
+ ```
150
+
151
+ ### Global Flags
152
+ ```bash
153
+ fns --json <command> # Output as JSON (for AI/script parsing)
154
+ fns --quiet <command> # Suppress non-essential output
155
+ fns --version / -v # Show version
156
+ fns --help # Show help
157
+ ```
158
+
159
+ ## πŸ€– AI Agent Integration
160
+
161
+ This tool is designed to give AI agents **long-term memory and knowledge access**:
162
+
163
+ - **Read Context**: `fns read` specific notes before coding tasks
164
+ - **Auto-Documentation**: `fns append` changelogs to daily notes
165
+ - **Knowledge Retrieval**: `fns list` / `fns tree` to discover relevant files
166
+ - **Knowledge Graph**: `fns backlinks` / `fns outlinks` to find related notes
167
+
168
+ **Example with AI Agent:**
169
+ ```bash
170
+ # Ask AI to read context, work, then document
171
+ fns read "projects/architecture.md" --json
172
+ # ... AI works ...
173
+ fns append "daily/2024-05-20.md" "- Completed architecture review"
174
+ ```
175
+
176
+ ## πŸ“ File Structure
177
+
178
+ ```
179
+ fns-cli/
180
+ β”œβ”€β”€ fns.py # Main CLI logic
181
+ β”œβ”€β”€ setup.py # Installation script
182
+ β”œβ”€β”€ requirements.txt # Dependencies
183
+ β”œβ”€β”€ tests/
184
+ β”‚ └── test_fns.py # Unit tests
185
+ β”œβ”€β”€ README.md # This file
186
+ β”œβ”€β”€ README.zh.md # Chinese version
187
+ β”œβ”€β”€ skill.md # Usage examples
188
+ β”œβ”€β”€ CHANGELOG.md # Version history
189
+ └── LICENSE # MIT License
190
+ ```
191
+
192
+ ## πŸ“– Usage Examples
193
+
194
+ For detailed examples, see the portable Skill at [`fns-skill/SKILL.md`](fns-skill/SKILL.md). You can copy the entire `fns-skill/` directory into your own AI agent's Skills folder (Qwen Code, Claude Code, etc.).
195
+
196
+ ## πŸ§ͺ Running Tests
197
+
198
+ ```bash
199
+ python -m unittest discover -s tests -v
200
+ ```
201
+
202
+ ## πŸ”— Related Projects
203
+
204
+ - **[fast-note-sync-service](https://github.com/haierkeys/fast-note-sync-service)** β€” The FNS backend server
205
+ - **[obsidian-fast-note-sync](https://github.com/haierkeys/obsidian-fast-note-sync)** β€” Obsidian plugin
206
+
207
+ ## πŸ“œ License
208
+
209
+ MIT License β€” see [LICENSE](LICENSE).