cdx-chores 0.0.7
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/LICENSE +21 -0
- package/README.md +312 -0
- package/dist/cjs/index.cjs +9572 -0
- package/dist/esm/bin.mjs +9544 -0
- package/dist/esm/bin.mjs.map +1 -0
- package/dist/esm/index.d.mts +43 -0
- package/dist/esm/index.mjs +9536 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +787 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dev-pi2pie
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# cdx-chores
|
|
2
|
+
|
|
3
|
+
A Node.js CLI for file-processing chores, data utilities, rename workflows, and Codex-assisted tasks.
|
|
4
|
+
|
|
5
|
+
Current launch-phase focus:
|
|
6
|
+
|
|
7
|
+
- interactive mode + nested CLI commands
|
|
8
|
+
- `doctor` capability checks
|
|
9
|
+
- data conversion, preview, and query workflows
|
|
10
|
+
- `md to-docx` via `pandoc`
|
|
11
|
+
- preview-first rename flows
|
|
12
|
+
- `ffmpeg`-backed video wrappers
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
Install globally from npm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g cdx-chores
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Recommended first check after install:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cdx-chores doctor
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Show command help:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cdx-chores --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Start interactive mode (default when no args are provided in a TTY):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cdx-chores
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Runtime requirement:
|
|
41
|
+
|
|
42
|
+
- Node.js `>= 22.5.0`
|
|
43
|
+
|
|
44
|
+
## Command Overview
|
|
45
|
+
|
|
46
|
+
| Command group | Important subcommands | Purpose | Capability notes |
|
|
47
|
+
| ------------- | --------------------- | ------- | ---------------- |
|
|
48
|
+
| `doctor` | `doctor`, `doctor --json` | Inspect current tool and feature readiness | Run this first on a new machine or after environment changes |
|
|
49
|
+
| `data` | `json-to-csv`, `csv-to-json`, `preview`, `parquet preview`, `query`, `query codex`, `duckdb doctor`, `duckdb extension install` | Data conversion, preview, DuckDB-backed SQL query, and Codex SQL drafting | `query` support depends on DuckDB runtime availability; `sqlite` and `excel` also depend on DuckDB extensions |
|
|
50
|
+
| `md` | `to-docx`, `frontmatter-to-json` | Markdown conversion and metadata extraction | `to-docx` requires `pandoc` |
|
|
51
|
+
| `rename` | `file`, `batch`, `cleanup`, `apply` | Safe rename previews, cleanup flows, and replayable apply runs | Codex analyzer routes are optional, not required for standard rename usage |
|
|
52
|
+
| `video` | `convert`, `resize`, `gif` | `ffmpeg`-backed video wrappers | Requires `ffmpeg` |
|
|
53
|
+
| `interactive` | `interactive` or no args | Guided menu flow for supported command groups | Requires a TTY |
|
|
54
|
+
|
|
55
|
+
## Capability Checks And External Tools
|
|
56
|
+
|
|
57
|
+
The npm package installs the CLI and its Node.js dependencies, but not every command is fully self-contained. Some workflows depend on machine-level tools or environment state outside the main CLI package.
|
|
58
|
+
|
|
59
|
+
Use `cdx-chores doctor` before relying on a command in a script, a CI job, or a fresh machine setup.
|
|
60
|
+
|
|
61
|
+
| Area | What ships with `cdx-chores` | Additional requirement | How to verify or repair |
|
|
62
|
+
| ---- | ---------------------------- | ---------------------- | ----------------------- |
|
|
63
|
+
| `md to-docx` | Markdown-to-DOCX command wrapper | `pandoc` must be installed on `PATH` | Run `cdx-chores doctor` |
|
|
64
|
+
| `video convert`, `video resize`, `video gif` | Video command wrappers | `ffmpeg` must be installed on `PATH` | Run `cdx-chores doctor` |
|
|
65
|
+
| `data query` for `csv`, `tsv`, `parquet` | Query command surface and DuckDB integration | DuckDB runtime must be available in the current install/runtime | Run `cdx-chores doctor` |
|
|
66
|
+
| `data query` for `sqlite`, `excel` | Query command surface | Required DuckDB extension must be loadable for the current DuckDB runtime | Run `cdx-chores doctor`, then `cdx-chores data duckdb doctor` or `cdx-chores data duckdb extension install <name>` |
|
|
67
|
+
| `data query codex` | Natural-language SQL drafting lane | Codex support must be configured and an auth/session signal must be available | Run `cdx-chores doctor` |
|
|
68
|
+
|
|
69
|
+
For automation or machine-readable checks, use:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cdx-chores doctor --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
### Doctor
|
|
78
|
+
|
|
79
|
+
Text output:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cdx-chores doctor
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
JSON output:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cdx-chores doctor --json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Data
|
|
92
|
+
|
|
93
|
+
JSON to CSV:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cdx-chores data json-to-csv -i ./input.json -o ./output.csv
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
CSV to JSON:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cdx-chores data csv-to-json -i ./input.csv -o ./output.json --pretty
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Preview CSV or JSON as a bounded table:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cdx-chores data preview ./input.csv --rows 20
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Preview Parquet through DuckDB:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cdx-chores data parquet preview ./input.parquet --rows 20
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run a SQL query against one input file:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
cdx-chores data query ./input.csv --sql "select * from file limit 20"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Draft SQL from natural-language intent:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cdx-chores data query codex ./input.csv --intent "show the top 10 rows with the highest revenue"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Inspect or repair DuckDB extension state for query inputs such as SQLite or Excel:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cdx-chores data duckdb doctor
|
|
133
|
+
cdx-chores data duckdb extension install sqlite
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Markdown
|
|
137
|
+
|
|
138
|
+
Markdown to DOCX:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
cdx-chores md to-docx -i ./notes.md -o ./notes.docx
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Markdown frontmatter to JSON:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cdx-chores md frontmatter-to-json -i ./notes.md --pretty
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Rename
|
|
151
|
+
|
|
152
|
+
Batch rename preview:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
cdx-chores rename batch ./images --prefix gallery --dry-run
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Single-file rename preview:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
cdx-chores rename file ./images/IMG_1024.JPG --prefix gallery --dry-run
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Cleanup an existing filename by normalizing a matched timestamp:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cdx-chores rename cleanup ./captures/'Screenshot 2026-03-02 at 4.53.04 PM.png' --hint timestamp --style slug --dry-run
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Cleanup a directory with mixed hint families and recursive traversal:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cdx-chores rename cleanup ./captures --hint date,serial,uid --recursive --max-depth 1 --dry-run
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Codex-assisted batch rename preview:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
cdx-chores rename batch ./images --prefix gallery --codex --dry-run
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Apply an exact dry-run snapshot later:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cdx-chores rename apply ./rename-plan-20260225T214012Z-a1b2c3d4.csv
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Recursive image rename with depth limit:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
cdx-chores rename batch ./photos --recursive --max-depth 1 --ext jpg,png,webp --dry-run
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Custom filename template:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
cdx-chores rename batch ./images --prefix trip --pattern "{date}-{stem}-{serial}" --dry-run
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
UID-backed template example:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
cdx-chores rename file ./images/IMG_1024.JPG --pattern "{uid}-{stem}" --dry-run
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Template notes:
|
|
207
|
+
|
|
208
|
+
- available placeholders include `{prefix}`, `{timestamp}`, `{timestamp_local}`, `{timestamp_utc}`, `{timestamp_local_iso}`, `{timestamp_utc_iso}`, `{timestamp_local_12h}`, `{timestamp_utc_12h}`, `{date}`, `{date_local}`, `{date_utc}`, `{stem}`, `{uid}`, and `{serial...}`
|
|
209
|
+
- `--prefix` is optional
|
|
210
|
+
- `--codex` is the common smart-routing flag for CLI mode
|
|
211
|
+
- `--codex-images` and `--codex-docs` are explicit analyzer overrides
|
|
212
|
+
- `{uid}` renders a deterministic `uid-<token>` fragment
|
|
213
|
+
- `{serial...}` enables serial controls
|
|
214
|
+
- `--serial-width` uses a digit count such as `2` or `4`, not `#`
|
|
215
|
+
|
|
216
|
+
Timestamp placeholder notes:
|
|
217
|
+
|
|
218
|
+
- `{timestamp}` uses UTC as the backward-compatible default
|
|
219
|
+
- `{timestamp_local}` uses local time explicitly
|
|
220
|
+
- `{timestamp_utc}` uses UTC explicitly
|
|
221
|
+
- `{timestamp_local_iso}` uses local time with a numeric offset such as `+0800`
|
|
222
|
+
- `{timestamp_utc_iso}` uses UTC with `Z`
|
|
223
|
+
- `{timestamp_local_12h}` and `{timestamp_utc_12h}` use compact `12hr` output with `AM` or `PM`
|
|
224
|
+
- `--timestamp-timezone local|utc` overrides `{timestamp}` only
|
|
225
|
+
|
|
226
|
+
Route A examples:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
cdx-chores rename file ./images/IMG_1024.JPG --pattern "{timestamp_utc_iso}-{stem}" --dry-run
|
|
230
|
+
cdx-chores rename batch ./images --pattern "{timestamp_local_12h}-{stem}" --dry-run
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Cleanup notes:
|
|
234
|
+
|
|
235
|
+
- `rename cleanup <path>` accepts either a single file or a directory
|
|
236
|
+
- `--hint` is the canonical flag and `--hints` is accepted as an alias
|
|
237
|
+
- supported hint families are `date`, `timestamp`, `serial`, and `uid`
|
|
238
|
+
- cleanup applies multiple hint families in this order: `timestamp`, then `date`, then `serial`, then `uid`
|
|
239
|
+
- `--style` defaults to `preserve`; supported values are `preserve` and `slug`
|
|
240
|
+
- `--timestamp-action keep|remove` applies only when `--hint timestamp` is active
|
|
241
|
+
- `--conflict-strategy` currently supports `skip`, `number`, and `uid-suffix`
|
|
242
|
+
|
|
243
|
+
Cleanup option comparison:
|
|
244
|
+
|
|
245
|
+
| Surface | Current role | Current values / scope |
|
|
246
|
+
| ------- | ------------ | ---------------------- |
|
|
247
|
+
| `--hint` | Choose fragment families to clean | `date`, `timestamp`, `serial`, `uid` |
|
|
248
|
+
| `--style` | Format surviving text after cleanup | `preserve`, `slug` |
|
|
249
|
+
| `--timestamp-action` | Keep or remove matched timestamp text | `keep`, `remove` with `--hint timestamp` |
|
|
250
|
+
| `--conflict-strategy` | Resolve collisions only when the cleaned target conflicts | `skip`, `number`, `uid-suffix` |
|
|
251
|
+
|
|
252
|
+
### Video
|
|
253
|
+
|
|
254
|
+
Video to GIF:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
cdx-chores video gif -i ./clip.mp4 -o ./clip.gif --width 480 --fps 10
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Video resize with aspect-ratio-preserving scale:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
cdx-chores video resize -i ./clip.mp4 -o ./clip-small.mp4 --scale 0.5
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Video resize with explicit dimensions override:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
cdx-chores video resize -i ./clip.mp4 -o ./clip-720p.mp4 --width 1280 --height 720
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Guides
|
|
273
|
+
|
|
274
|
+
Rename:
|
|
275
|
+
|
|
276
|
+
- `docs/guides/rename-common-usage.md`
|
|
277
|
+
- `docs/guides/rename-timestamp-format-matrix.md`
|
|
278
|
+
- `docs/guides/rename-scope-and-codex-capability-guide.md`
|
|
279
|
+
|
|
280
|
+
Data query:
|
|
281
|
+
|
|
282
|
+
- `docs/guides/data-query-usage.md`
|
|
283
|
+
- `docs/guides/data-duckdb-usage.md`
|
|
284
|
+
- `docs/guides/data-query-codex-usage.md`
|
|
285
|
+
|
|
286
|
+
Video:
|
|
287
|
+
|
|
288
|
+
- `docs/guides/video-resize-usage-and-ux.md`
|
|
289
|
+
|
|
290
|
+
## Local Development
|
|
291
|
+
|
|
292
|
+
Install dependencies:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
bun install
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Build the package:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
bun run build
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Run the built CLI locally:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
bun run cli --help
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
This project is licensed under the MIT License. See the [LICENSE](https://github.com/dev-pi2pie/cdx-chores/blob/main/LICENSE) file for details.
|