mela-cli 1.0.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.
- mela_cli-1.0.0/LICENSE +21 -0
- mela_cli-1.0.0/PKG-INFO +359 -0
- mela_cli-1.0.0/README.md +339 -0
- mela_cli-1.0.0/pyproject.toml +43 -0
- mela_cli-1.0.0/setup.cfg +4 -0
- mela_cli-1.0.0/src/mela_cli/__init__.py +3 -0
- mela_cli-1.0.0/src/mela_cli/__main__.py +4 -0
- mela_cli-1.0.0/src/mela_cli/cli.py +405 -0
- mela_cli-1.0.0/src/mela_cli/discovery.py +353 -0
- mela_cli-1.0.0/src/mela_cli/formatters.py +195 -0
- mela_cli-1.0.0/src/mela_cli/store.py +696 -0
- mela_cli-1.0.0/src/mela_cli/utils.py +26 -0
- mela_cli-1.0.0/src/mela_cli.egg-info/PKG-INFO +359 -0
- mela_cli-1.0.0/src/mela_cli.egg-info/SOURCES.txt +18 -0
- mela_cli-1.0.0/src/mela_cli.egg-info/dependency_links.txt +1 -0
- mela_cli-1.0.0/src/mela_cli.egg-info/entry_points.txt +2 -0
- mela_cli-1.0.0/src/mela_cli.egg-info/top_level.txt +1 -0
- mela_cli-1.0.0/tests/test_cli.py +197 -0
- mela_cli-1.0.0/tests/test_discovery.py +75 -0
- mela_cli-1.0.0/tests/test_store.py +117 -0
mela_cli-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
mela_cli-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mela-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Read-only CLI for browsing and exporting recipes from the Mela macOS app
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
9
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Utilities
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Mela CLI
|
|
22
|
+
|
|
23
|
+
`mela` is a read-only macOS CLI for browsing and exporting recipes from the local Mela app catalog.
|
|
24
|
+
|
|
25
|
+
It reads Mela's local Core Data SQLite store directly and never writes to the live database.
|
|
26
|
+
|
|
27
|
+
## About Mela
|
|
28
|
+
|
|
29
|
+
[Mela](https://mela.recipes/) is a recipe manager for iOS and macOS with iCloud sync. The
|
|
30
|
+
official app supports collecting recipes from the web, feeds, and scans, then using them in
|
|
31
|
+
cook mode, meal planning, and groceries workflows. See the official
|
|
32
|
+
[Help](https://mela.recipes/help/) and [File Format Documentation](https://mela.recipes/fileformat/index.html)
|
|
33
|
+
for product details and the `melarecipe` / `melarecipes` formats.
|
|
34
|
+
|
|
35
|
+
## Project Relationship
|
|
36
|
+
|
|
37
|
+
`mela` is an unofficial companion CLI for people who want shell access to their local Mela
|
|
38
|
+
catalog. It is not the Mela app itself and it does not use an official Mela API.
|
|
39
|
+
|
|
40
|
+
## Why Read-only
|
|
41
|
+
|
|
42
|
+
Mela stores its live catalog in a local Core Data SQLite store inside its macOS app-group
|
|
43
|
+
container, and syncing is handled through CloudKit-backed Core Data state rather than simple
|
|
44
|
+
document files.
|
|
45
|
+
|
|
46
|
+
That makes read access practical, but direct writes are risky:
|
|
47
|
+
|
|
48
|
+
- raw SQLite writes would bypass the Core Data and CloudKit bookkeeping that Mela expects
|
|
49
|
+
- the live store includes sync/history metadata in addition to recipe content
|
|
50
|
+
- there is no documented public API for in-place catalog edits
|
|
51
|
+
|
|
52
|
+
`mela` therefore treats the local store as read-only. It is designed to be safe for browsing,
|
|
53
|
+
searching, diagnostics, and export. When you need a writable format, use `--format melarecipe`
|
|
54
|
+
or `export-all` to generate importable files rather than mutating the live database.
|
|
55
|
+
|
|
56
|
+
## Status
|
|
57
|
+
|
|
58
|
+
- Platform: macOS only
|
|
59
|
+
- Python: 3.11+
|
|
60
|
+
- Scope: read-only
|
|
61
|
+
- Primary install path: `pipx install mela-cli`
|
|
62
|
+
|
|
63
|
+
## What It Does
|
|
64
|
+
|
|
65
|
+
- Lists and searches recipes in your local Mela catalog as table, JSON, or CSV summaries
|
|
66
|
+
- Shows individual recipes in terminal-friendly text, Markdown, or JSON
|
|
67
|
+
- Exports recipes as `.melarecipe`, JSON, or Markdown
|
|
68
|
+
- Reports tags, catalog stats, and discovery/runtime diagnostics
|
|
69
|
+
|
|
70
|
+
## What It Does Not Do
|
|
71
|
+
|
|
72
|
+
- It does not write to Mela's live SQLite database
|
|
73
|
+
- It does not provide a supported import/write workflow yet
|
|
74
|
+
- It does not target non-macOS platforms
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
Recommended:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pipx install mela-cli
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Development install:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python3 -m pip install -e .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Discovery
|
|
91
|
+
|
|
92
|
+
By default, `mela` tries to discover the official installed Mela app and derive the live catalog paths from the app's bundle metadata and group container layout.
|
|
93
|
+
|
|
94
|
+
Discovery precedence:
|
|
95
|
+
|
|
96
|
+
1. CLI flags
|
|
97
|
+
2. Environment variables
|
|
98
|
+
3. Auto-discovery
|
|
99
|
+
|
|
100
|
+
Supported overrides:
|
|
101
|
+
|
|
102
|
+
- `--app-path`
|
|
103
|
+
- `--db-path`
|
|
104
|
+
- `--support-dir`
|
|
105
|
+
- `--compression-tool`
|
|
106
|
+
|
|
107
|
+
Environment variables:
|
|
108
|
+
|
|
109
|
+
- `MELA_APP_PATH`
|
|
110
|
+
- `MELA_DB_PATH`
|
|
111
|
+
- `MELA_SUPPORT_DIR`
|
|
112
|
+
- `MELA_COMPRESSION_TOOL`
|
|
113
|
+
|
|
114
|
+
Use `mela doctor` to inspect what was discovered.
|
|
115
|
+
|
|
116
|
+
## Commands
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
mela list [-q QUERY] [-f] [-w] [-t TAG] [-n N] [--format table|json|csv]
|
|
120
|
+
mela search QUERY [-f] [-w] [-t TAG] [-n N] [--format table|json|csv] # alias for list --query
|
|
121
|
+
mela show SELECTOR [--format text|markdown|json]
|
|
122
|
+
mela export SELECTOR [--format melarecipe|json|markdown] [-o DIR] [--filename-style slug|id|id-slug] [--compact]
|
|
123
|
+
mela export-all [-q QUERY] [-f] [-w] [-t TAG] [-n N] [--format melarecipe|json|markdown] [-o DIR] [--filename-style slug|id|id-slug] [--compact]
|
|
124
|
+
mela tags [--format table|json]
|
|
125
|
+
mela stats [--format table|json]
|
|
126
|
+
mela doctor [--format table|json]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Selector resolution order for single-recipe commands:
|
|
130
|
+
|
|
131
|
+
1. Numeric primary key
|
|
132
|
+
2. Exact Mela record ID
|
|
133
|
+
3. Exact title
|
|
134
|
+
4. Unique record-ID prefix
|
|
135
|
+
5. Unique title fragment
|
|
136
|
+
|
|
137
|
+
Ambiguous matches fail with a clear error and suggested PKs.
|
|
138
|
+
|
|
139
|
+
## Option Reference
|
|
140
|
+
|
|
141
|
+
Global options available before any subcommand:
|
|
142
|
+
|
|
143
|
+
- `--app-path`: override auto-discovery and point directly at `Mela.app`
|
|
144
|
+
- `--db-path`: use a specific `Curcuma.sqlite` file
|
|
145
|
+
- `--support-dir`: use a specific Core Data external blob directory
|
|
146
|
+
- `--compression-tool`: use a specific `compression_tool` path or command name
|
|
147
|
+
|
|
148
|
+
`list` options (`search` is an alias that takes the query as a positional argument):
|
|
149
|
+
|
|
150
|
+
- `-q`/`--query QUERY`: case-insensitive text search across recipe content
|
|
151
|
+
- `-f`/`--favorite`: only include favorite recipes
|
|
152
|
+
- `-w`/`--want-to-cook`: only include recipes marked want-to-cook
|
|
153
|
+
- `-t`/`--tag TAG`: filter by tag; repeat the flag to require multiple tags
|
|
154
|
+
- `-n`/`--limit N`: cap the number of returned recipes
|
|
155
|
+
- `--format table|json|csv`: choose human-readable table output or machine-readable JSON/CSV
|
|
156
|
+
|
|
157
|
+
`show` options:
|
|
158
|
+
|
|
159
|
+
- `SELECTOR`: recipe PK, exact record ID, exact title, unique record-ID prefix, or unique title fragment
|
|
160
|
+
- `--format text|markdown|json`: choose terminal text, Markdown, or full recipe JSON
|
|
161
|
+
|
|
162
|
+
`export` options:
|
|
163
|
+
|
|
164
|
+
- `SELECTOR`: same selector rules as `show`
|
|
165
|
+
- `--format melarecipe|json|markdown`: choose Mela import JSON, full recipe JSON, or Markdown
|
|
166
|
+
- `-o`/`--output DIR`: directory to write the exported file (default: current directory)
|
|
167
|
+
- `--filename-style slug|id|id-slug`: filename style — title-based slug (default), record UUID, or UUID + slug
|
|
168
|
+
- `--compact`: minify JSON output for `melarecipe` and `json` exports; ignored for `markdown`
|
|
169
|
+
|
|
170
|
+
`export-all` options:
|
|
171
|
+
|
|
172
|
+
- `-q`/`--query QUERY`: full-text filter across recipe content
|
|
173
|
+
- `-f`/`--favorite`, `-w`/`--want-to-cook`, `-t`/`--tag TAG`, `-n`/`--limit N`: same filtering as `list`
|
|
174
|
+
- `--format melarecipe|json|markdown`: output format for each exported recipe
|
|
175
|
+
- `-o`/`--output DIR`: destination directory for bulk exports (default: current directory)
|
|
176
|
+
- `--filename-style slug|id|id-slug`: filename style — title-based slug (default), record UUID, or UUID + slug
|
|
177
|
+
- `--compact`: minify JSON output for `melarecipe` and `json` exports; ignored for `markdown`
|
|
178
|
+
|
|
179
|
+
`tags`, `stats`, and `doctor` options:
|
|
180
|
+
|
|
181
|
+
- `--format table|json`: choose human-readable table output or machine-readable JSON
|
|
182
|
+
|
|
183
|
+
## Examples
|
|
184
|
+
|
|
185
|
+
List favorite recipes:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
mela list --favorite
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Search for soup recipes as JSON:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
mela list -q soup --format json
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Export the current summary catalog as CSV:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
mela list --format csv
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Show one recipe in Markdown:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
mela show 42 --format markdown
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Export one recipe as a Mela import file to the current directory:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
mela export "Instant Pot Chicken Adobo"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Export one recipe to a specific directory, named by record ID:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
mela export "Instant Pot Chicken Adobo" --output ./exports --filename-style id
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Export minified JSON and inspect it:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
mela export 42 --format json --compact | jq .
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Export matching recipes to a directory:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
mela export-all --tag Dessert --output ./desserts
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Inspect runtime discovery:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
mela doctor
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Machine-readable Output
|
|
240
|
+
|
|
241
|
+
JSON is the stable machine-readable interface for v1. CSV is the stable summary export
|
|
242
|
+
format for `list` (and its `search` alias).
|
|
243
|
+
|
|
244
|
+
- `list` returns an array of recipe summaries
|
|
245
|
+
- `show` returns a full recipe object
|
|
246
|
+
- `tags` returns an array of tag/count objects
|
|
247
|
+
- `stats` returns a fixed stats object
|
|
248
|
+
- `doctor` returns a structured discovery report
|
|
249
|
+
|
|
250
|
+
Human-readable table/text/Markdown output may evolve.
|
|
251
|
+
|
|
252
|
+
Summary fields for `list --format json` and `list --format csv`:
|
|
253
|
+
|
|
254
|
+
- `pk`
|
|
255
|
+
- `id`
|
|
256
|
+
- `title`
|
|
257
|
+
- `tags`
|
|
258
|
+
- `favorite`
|
|
259
|
+
- `wantToCook`
|
|
260
|
+
- `link`
|
|
261
|
+
- `createdAt`
|
|
262
|
+
- `prepTime`
|
|
263
|
+
- `cookTime`
|
|
264
|
+
- `totalTime`
|
|
265
|
+
- `yield`
|
|
266
|
+
- `imageCount`
|
|
267
|
+
|
|
268
|
+
CSV conventions:
|
|
269
|
+
|
|
270
|
+
- fixed header order matching the field list above
|
|
271
|
+
- `tags` serialized as a semicolon-delimited string
|
|
272
|
+
- booleans serialized as `true` / `false`
|
|
273
|
+
- missing values serialized as empty fields
|
|
274
|
+
- `imageCount` serialized as an integer
|
|
275
|
+
|
|
276
|
+
`tags --format json` returns:
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
[
|
|
280
|
+
{"tag": "Breakfast", "count": 12}
|
|
281
|
+
]
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`stats --format json` returns:
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"recipes": 204,
|
|
289
|
+
"favorites": 10,
|
|
290
|
+
"wantToCook": 3,
|
|
291
|
+
"tags": 37,
|
|
292
|
+
"recipesWithImages": 166,
|
|
293
|
+
"recipesWithLinks": 170
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Export format differences:
|
|
298
|
+
|
|
299
|
+
- `--format json` uses the full Mela CLI recipe schema. It includes fields like `pk`,
|
|
300
|
+
`createdAt`, and structured image objects with metadata plus base64 payloads.
|
|
301
|
+
- `--format melarecipe` uses a Mela import-oriented schema. It omits CLI-only fields
|
|
302
|
+
like `pk` and `createdAt`, omits empty optional fields, and serializes `images` as
|
|
303
|
+
an array of base64 strings.
|
|
304
|
+
- Both are JSON-encoded. Use `json` for automation against the CLI contract and
|
|
305
|
+
`melarecipe` when you want a file that Mela can import.
|
|
306
|
+
|
|
307
|
+
`doctor --format json` returns:
|
|
308
|
+
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"ok": true,
|
|
312
|
+
"supportedPlatform": true,
|
|
313
|
+
"bundleId": "recipes.mela.appkit",
|
|
314
|
+
"applicationGroup": "TEAMID.recipes.mela",
|
|
315
|
+
"appPath": "/Applications/Mela.app",
|
|
316
|
+
"appPathSource": "auto-discovery",
|
|
317
|
+
"appExists": true,
|
|
318
|
+
"dbPath": "/Users/example/Library/Group Containers/TEAMID.recipes.mela/Data/Curcuma.sqlite",
|
|
319
|
+
"dbPathSource": "derived from app entitlement",
|
|
320
|
+
"dbExists": true,
|
|
321
|
+
"supportDir": "/Users/example/Library/Group Containers/TEAMID.recipes.mela/Data/.Curcuma_SUPPORT/_EXTERNAL_DATA",
|
|
322
|
+
"supportDirSource": "derived from app entitlement",
|
|
323
|
+
"supportDirExists": true,
|
|
324
|
+
"compressionTool": "compression_tool",
|
|
325
|
+
"compressionToolSource": "default",
|
|
326
|
+
"compressionToolResolvedPath": "/usr/bin/compression_tool",
|
|
327
|
+
"compressionToolAvailable": true,
|
|
328
|
+
"canReadCatalog": true,
|
|
329
|
+
"canDecodeExternalImages": true,
|
|
330
|
+
"recipeCount": 204,
|
|
331
|
+
"warnings": []
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
`doctor` fields are intended for diagnostics and environment inspection. `ok` means the CLI
|
|
336
|
+
can read the catalog and decode external image blobs with the currently discovered runtime.
|
|
337
|
+
|
|
338
|
+
## Troubleshooting
|
|
339
|
+
|
|
340
|
+
If discovery does not find your Mela install or live catalog:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
mela doctor
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
If needed, override the paths explicitly:
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
mela --db-path "/path/to/Curcuma.sqlite" --support-dir "/path/to/_EXTERNAL_DATA" list
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Implementation Notes
|
|
353
|
+
|
|
354
|
+
- The CLI is based on Mela's current local macOS schema and storage layout.
|
|
355
|
+
- Image extraction supports:
|
|
356
|
+
- inline blobs
|
|
357
|
+
- raw Core Data external blobs
|
|
358
|
+
- LZFSE-compressed keyed-archive external blobs via macOS `compression_tool`
|
|
359
|
+
- `.melarecipe` output is produced from reverse-engineered local data rather than an official Mela API.
|