frostx 0.1.0

frostx monitors project directories for inactivity. Once a configured inactivity threshold elapses (e.g. "90 days since any file was modified"), frostx executes a pipeline of **actions** - e.g., checking git state, creating archives, uploading backups, deleting local copies. Automating the lifecycle of projects, frostx helps users manage disk space and maintain a clean workspace.
Documentation
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# frostx CLI Reference

## Synopsis

```
frostx <COMMAND> [OPTIONS] [PATH]
```

`PATH` defaults to the current working directory when omitted.

## Global Options

| Flag                | Short | Description                                                                   |
|---------------------|-------|-------------------------------------------------------------------------------|
| `--dry-run`         | `-n`  | Show what would happen without executing any actions                          |
| `--json`            |       | Output all results as JSON instead of human-readable text                     |
| `--verbose`         | `-v`  | Increase output verbosity (repeat for more: `-vv`)                            |
| `--quiet`           | `-q`  | Suppress all output except errors                                             |
| `--yes`             | `-y`  | Skip interactive confirmations and the `init` questionnaire (except `local.delete`, which always confirms) |
| `--config <FILE>`   |       | Use a specific `frostx.toml` instead of the one in PATH                       |
| `--library <DIR>`   |       | Override the config library directory (default: `~/.config/frostx/library/`)  |
| `--state-dir <DIR>` |       | Override the state directory (default: `$XDG_DATA_HOME/frostx/`)              |

`--json` and `--quiet` are mutually exclusive. `--json` implies machine-readable output on stdout; errors are still
written to stderr as JSON.

---

## Output Formats

### Human-readable (default)

Colored, aligned text output intended for interactive use. Respects `NO_COLOR`.

### JSON (`--json`)

A single JSON object (or array for `scan`) written to stdout. The schema is stable and versioned via a top-level
`"frostx_version"` field. All timestamps are ISO 8601. All durations are in seconds.

Errors and warnings are written to stderr as a JSON object:

```json
{
  "frostx_version": "0.1.0",
  "error": "frostx.toml not found",
  "code": 3
}
```

---

## Commands

### `init`

Initialize a new frostx project in a directory by creating a `frostx.toml` with a generated UUID and a starter
configuration.

```
frostx init [OPTIONS] [PATH]
```

**Options:**

| Flag               | Description                                         |
|--------------------|-----------------------------------------------------|
| `--include <NAME>` | Bootstrap from a library template (can be repeated) |
| `--force`          | Overwrite an existing `frostx.toml`                 |

**Behavior:**

- Generates a UUID v4 and writes it as `id` in the new `frostx.toml`.
- If `--include` is given, the named library entries are added to the `include` list.
- Exits with a non-zero code if `frostx.toml` already exists and `--force` is not set.
- When `--force` is used on a directory with an existing UUID, a new UUID is generated and a fresh state file is
  created. Use this to resolve a UUID collision after copying a project (
  see [State: UUID Collisions]state.md#uuid-collisions).

**Interactive questionnaire:**

When stdin is a TTY and neither `--yes` nor `--json` is passed, `frostx init` runs an interactive questionnaire:

1. **Project name** - optional; written as `name = "..."` in `frostx.toml`.
2. **Project description** - optional; written as `description = "..."`.
3. **Library templates** - multi-select from all `.toml` files found in the library directory. Any entries already
   specified with `--include` are pre-selected.
4. **Template variables** - for each selected template that contains `{{variable}}` placeholders, a value is prompted
   and stored in the `[template]` table of `frostx.toml`.

Pass `--yes` (or pipe stdin from a non-TTY) to skip the questionnaire and use only the values supplied on the command
line. Pass `--json` to imply non-interactive mode.

See [includes.md](includes.md#template-variables) for the template variable system.

**Human-readable output:**

```
initialized  ~/projects/my-app
uuid         a1b2c3d4-e5f6-...
```

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "path": "/home/user/projects/my-app",
  "uuid": "a1b2c3d4-e5f6-..."
}
```

---

### `check`

Inspect a project without executing any actions. Reports inactivity duration, which rules would trigger, and the
expected next actions.

```
frostx check [OPTIONS] [PATH]
```

**Human-readable output:**

```
project  my-app  (a1b2c3d4-...)
path     ~/projects/my-app
inactive 97 days

rule #1  after=90d  ● TRIGGERED
  ✓ git.check_clean    - working tree is clean
  ✓ git.check_pushed   - all commits pushed
  ✗ backup.check       - not found on backup server

rule #2  after=180d  ○ not yet (83 days remaining)
```

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "project": "my-app",
  "path": "/home/user/projects/my-app",
  "uuid": "a1b2c3d4-...",
  "inactive_seconds": 8380800,
  "rules": [
    {
      "index": 1,
      "after_seconds": 7776000,
      "triggered": true,
      "actions": [
        {
          "name": "git.check_clean",
          "status": "ok",
          "message": "working tree is clean"
        },
        {
          "name": "git.check_pushed",
          "status": "ok",
          "message": "all commits pushed"
        },
        {
          "name": "backup.check",
          "status": "failed",
          "message": "not found on backup server"
        }
      ]
    },
    {
      "index": 2,
      "after_seconds": 15552000,
      "triggered": false,
      "remaining_seconds": 7171200,
      "actions": []
    }
  ]
}
```

---

### `run`

Execute the inactivity pipeline for a project. Evaluates each rule in order and runs triggered actions sequentially,
stopping a chain on the first failure.

```
frostx run [OPTIONS] [PATH]
```

**Options:**

| Flag              | Description                                               |
|-------------------|-----------------------------------------------------------|
| `--rule <N>`      | Run only rule number N (1-indexed)                        |
| `--action <NAME>` | Run a single named action, skipping rule threshold checks |
| `--force`         | Re-execute completed mutation actions                     |

**Behavior:**

- A rule is skipped if the inactivity threshold has not been reached.
- Within a rule, if an action fails, subsequent actions in that rule are skipped.
- Bail out: a failure in rule #1 does prevents rule #2 from being evaluated.
- Completed mutation actions are recorded in the state file and skipped on subsequent runs unless `--force` is given.

**JSON output** - one JSON object per action, streamed as newline-delimited JSON (NDJSON):

```json
{
  "frostx_version": "0.1.0",
  "rule": 1,
  "action": "git.check_clean",
  "status": "ok",
  "message": "working tree is clean"
}
{
  "frostx_version": "0.1.0",
  "rule": 1,
  "action": "git.check_pushed",
  "status": "ok",
  "message": "all commits pushed"
}
{
  "frostx_version": "0.1.0",
  "rule": 1,
  "action": "backup.check",
  "status": "failed",
  "message": "not found on backup server"
}
```

`run` uses NDJSON rather than a single object so that progress is visible in real time when piped.

---

### `scan`

Recursively walk a directory tree and report the status of every frostx project found.

```
frostx scan [OPTIONS] [ROOT]
```

**Options:**

| Flag               | Description                                            |
|--------------------|--------------------------------------------------------|
| `--triggered-only` | Only show projects with at least one triggered rule    |
| `--depth <N>`      | Maximum directory depth to search (default: unlimited) |

**JSON output** - a JSON array of `check`-shaped objects:

```json
[
  {
    "frostx_version": "0.1.0",
    "project": "my-app",
    "path": "...",
    "uuid": "...",
    "inactive_seconds": 8380800,
    "rules": [
      ...
    ]
  },
  {
    "frostx_version": "0.1.0",
    "project": "other",
    "path": "...",
    "uuid": "...",
    "inactive_seconds": 1234567,
    "rules": [
      ...
    ]
  }
]
```

---

### `doctor`

Validate a `frostx.toml` file for correctness: checks UUID presence, valid durations, resolvable includes, and known
action names.

```
frostx doctor [PATH]
```

Exits `0` if valid, `1` if errors, `2` if only warnings.

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "valid": false,
  "errors": [
    {
      "field": "rule[1].after",
      "message": "invalid duration '90x'"
    }
  ],
  "warnings": [
    {
      "field": "include[0]",
      "message": "library entry 'unknown' not found"
    }
  ]
}
```

---

### `gc`

Remove orphaned state files - entries in the state directory whose recorded `project_path` no longer contains a
`frostx.toml` with a matching UUID.

```
frostx gc [OPTIONS]
```

**Behavior:**

- Reads every `<uuid>.toml` in the state directory.
- Checks whether the recorded `project_path` exists and its `frostx.toml` contains the same UUID.
- Deletes any state file that fails this check, unless `--dry-run` is set.

**Human-readable output:**

```
orphaned  a1b2c3d4-....toml  (path no longer exists: /home/user/projects/old-app)
orphaned  e5f6a7b8-....toml  (UUID mismatch at /home/user/projects/other-app)

2 orphaned state files found. Run without --dry-run to delete.
```

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "orphaned": [
    {
      "state_file": "a1b2c3d4-....toml",
      "reason": "path_missing",
      "path": "/home/user/projects/old-app"
    },
    {
      "state_file": "e5f6a7b8-....toml",
      "reason": "uuid_mismatch",
      "path": "/home/user/projects/other-app"
    }
  ],
  "removed": 0
}
```

---

### `projects`

Manage the tracked-project registry. Every `frostx check` or `frostx run` call registers the project automatically;
these sub-commands let you manage that registry explicitly.

#### `projects list`

List all currently tracked projects.

```
frostx projects list
```

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "projects": [
    {
      "uuid": "a1b2c3d4-...",
      "path": "/home/user/projects/my-app",
      "last_scan": "2026-01-15T10:30:00Z"
    },
    {
      "uuid": "e5f6a7b8-...",
      "path": "/home/user/projects/other",
      "last_scan": null
    }
  ]
}
```

---

#### `projects add`

Register one or more projects in the state directory without running `check` first.

```
frostx projects add [--scan <DIR>] [PATH...]
```

**Options:**

| Flag           | Description                                                  |
|----------------|--------------------------------------------------------------|
| `--scan <DIR>` | Recursively walk DIR and register every frostx project found |

**Behavior:**

- Reads the UUID from `frostx.toml` at each PATH.
- Aborts a single path with an error if a UUID collision is detected; continues with the remaining paths.
- Paths where `frostx.toml` is absent are reported in `skipped`.

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "added": [
    {
      "uuid": "a1b2c3d4-...",
      "path": "/home/user/projects/my-app"
    }
  ],
  "skipped": [
    {
      "path": "/tmp/not-a-project",
      "reason": "no frostx.toml found in ..."
    }
  ]
}
```

---

#### `projects rm`

Unregister a project by deleting its state file.

```
frostx projects rm <PATH>
```

**Behavior:**

- Reads the UUID from `frostx.toml` at PATH if it exists; otherwise searches state files by recorded path.
- Deletes the matching state file.
- Exits `3` if no matching state entry is found.

**JSON output:**

```json
{
  "frostx_version": "0.1.0",
  "uuid": "a1b2c3d4-...",
  "path": "/home/user/projects/my-app"
}
```

---

#### `projects check`

Run `check` on every tracked project.

```
frostx projects check
```

Human mode prints each project's check output in sequence. JSON mode outputs a single array of check objects (same shape
as `scan`).

**JSON output** - array of `check`-shaped objects:

```json
[
  {
    "frostx_version": "0.1.0",
    "project": "my-app",
    "path": "...",
    "uuid": "...",
    "inactive_seconds": 8380800,
    "rules": [
      ...
    ]
  },
  {
    "frostx_version": "0.1.0",
    "project": "other",
    "path": "...",
    "uuid": "...",
    "inactive_seconds": 1234567,
    "rules": [
      ...
    ]
  }
]
```

---

#### `projects run`

Run the inactivity pipeline for every tracked project.

```
frostx projects run [OPTIONS]
```

**Options:**

| Flag              | Description                                                           |
|-------------------|-----------------------------------------------------------------------|
| `--rule <N>`      | Run only rule number N (1-indexed) on every project                   |
| `--action <NAME>` | Run a single named action on every project, skipping threshold checks |
| `--force`         | Re-execute completed mutation actions                                 |

**JSON output** - NDJSON per action, same as `run --json` but with an added `"project"` field:

```json
{
  "frostx_version": "0.1.0",
  "project": "/home/user/projects/my-app",
  "rule": 1,
  "action": "git.check_clean",
  "status": "ok",
  "message": "working tree is clean"
}
{
  "frostx_version": "0.1.0",
  "project": "/home/user/projects/other",
  "rule": 1,
  "action": "git.check_clean",
  "status": "failed",
  "message": "uncommitted changes"
}
```

---

## Exit Codes

| Code | Meaning                                                                 |
|------|-------------------------------------------------------------------------|
| `0`  | Success                                                                 |
| `1`  | General error (invalid config, action failure, etc.)                    |
| `2`  | Warning (used by `doctor`: valid config but with warnings)              |
| `3`  | Project not initialized (no `frostx.toml` found)                        |
| `4`  | UUID collision detected (project is a copy - run `frostx init --force`) |

---

## Environment Variables

| Variable        | Description                                                                                       |
|-----------------|---------------------------------------------------------------------------------------------------|
| `XDG_DATA_HOME` | Base directory for state files; frostx uses `$XDG_DATA_HOME/frostx/` (default: `~/.local/share/`) |
| `NO_COLOR`      | Disable colored output                                                                            |