aias 0.1.0

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.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc +1 -0
  3. data/.github/workflows/deploy-github-pages.yml +52 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +140 -0
  6. data/COMMITS.md +196 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +249 -0
  9. data/Rakefile +27 -0
  10. data/aia_schedule_idea.md +256 -0
  11. data/docs/assets/images/logo.jpg +0 -0
  12. data/docs/cli/add.md +101 -0
  13. data/docs/cli/check.md +70 -0
  14. data/docs/cli/clear.md +45 -0
  15. data/docs/cli/dry-run.md +57 -0
  16. data/docs/cli/index.md +51 -0
  17. data/docs/cli/install.md +198 -0
  18. data/docs/cli/last.md +49 -0
  19. data/docs/cli/list.md +40 -0
  20. data/docs/cli/next.md +49 -0
  21. data/docs/cli/remove.md +87 -0
  22. data/docs/cli/show.md +54 -0
  23. data/docs/cli/uninstall.md +29 -0
  24. data/docs/cli/update.md +75 -0
  25. data/docs/getting-started/installation.md +69 -0
  26. data/docs/getting-started/quick-start.md +105 -0
  27. data/docs/guides/configuration-layering.md +168 -0
  28. data/docs/guides/cron-environment.md +112 -0
  29. data/docs/guides/scheduling-prompts.md +319 -0
  30. data/docs/guides/understanding-cron.md +134 -0
  31. data/docs/guides/validation.md +114 -0
  32. data/docs/index.md +100 -0
  33. data/docs/reference/api.md +409 -0
  34. data/docs/reference/architecture.md +122 -0
  35. data/docs/reference/environment.md +67 -0
  36. data/docs/reference/logging.md +73 -0
  37. data/example_prompts/code_health_check.md +51 -0
  38. data/example_prompts/daily_digest.md +19 -0
  39. data/example_prompts/morning_standup.md +19 -0
  40. data/example_prompts/reports/monthly_review.md +44 -0
  41. data/example_prompts/reports/weekly_summary.md +22 -0
  42. data/example_prompts/you_are_good.md +22 -0
  43. data/exe/aias +5 -0
  44. data/lib/aias/block_parser.rb +42 -0
  45. data/lib/aias/cli/add.rb +30 -0
  46. data/lib/aias/cli/check.rb +50 -0
  47. data/lib/aias/cli/clear.rb +11 -0
  48. data/lib/aias/cli/dry_run.rb +24 -0
  49. data/lib/aias/cli/install.rb +57 -0
  50. data/lib/aias/cli/last.rb +26 -0
  51. data/lib/aias/cli/list.rb +20 -0
  52. data/lib/aias/cli/next.rb +28 -0
  53. data/lib/aias/cli/remove.rb +14 -0
  54. data/lib/aias/cli/show.rb +18 -0
  55. data/lib/aias/cli/uninstall.rb +15 -0
  56. data/lib/aias/cli/update.rb +30 -0
  57. data/lib/aias/cli/version.rb +10 -0
  58. data/lib/aias/cli.rb +91 -0
  59. data/lib/aias/cron_describer.rb +142 -0
  60. data/lib/aias/crontab_manager.rb +140 -0
  61. data/lib/aias/env_file.rb +75 -0
  62. data/lib/aias/job_builder.rb +56 -0
  63. data/lib/aias/paths.rb +14 -0
  64. data/lib/aias/prompt_scanner.rb +111 -0
  65. data/lib/aias/schedule_config.rb +31 -0
  66. data/lib/aias/validator.rb +101 -0
  67. data/lib/aias/version.rb +5 -0
  68. data/lib/aias.rb +17 -0
  69. data/mkdocs.yml +137 -0
  70. data/sig/aias.rbs +4 -0
  71. metadata +191 -0
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ # SimpleCov must be required and started BEFORE minitest/autorun registers its
7
+ # at_exit hook. Ruby runs at_exit handlers in LIFO order, so whichever gem
8
+ # calls at_exit last will run first. We want:
9
+ # 1. Minitest at_exit → tests execute
10
+ # 2. SimpleCov at_exit → results collected after tests finish
11
+ #
12
+ # Achieving this requires SimpleCov to register its at_exit first (i.e. load
13
+ # before minitest/autorun). The test_prelude is prepended to the -e string
14
+ # before 'require "minitest/autorun"', giving us the correct ordering.
15
+ SIMPLECOV_PRELUDE = <<~RUBY.tr("\n", ";")
16
+ require "simplecov"
17
+ SimpleCov.start do
18
+ add_filter "/test/"
19
+ enable_coverage :branch
20
+ end
21
+ RUBY
22
+
23
+ Minitest::TestTask.create do |t|
24
+ t.test_prelude = "#{SIMPLECOV_PRELUDE} require \"minitest/autorun\"; "
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,256 @@
1
+ # aias Gem — Analysis & Requirements
2
+
3
+ ## Origin
4
+
5
+ Inspired by reviewing the `ai_sentinel` gem (https://github.com/mcelicalderon/ai_sentinel),
6
+ a lightweight Ruby gem for scheduling AI-driven automation tasks via YAML-defined workflows
7
+ and Rufus-scheduler.
8
+
9
+ ---
10
+
11
+ ## Core Concept
12
+
13
+ `aias` is a standalone gem that runs AIA prompts as scheduled batch jobs. Schedule
14
+ information lives directly in the YAML frontmatter of individual AIA prompt files —
15
+ no separate configuration file is needed. The gem scans the prompts directory, discovers
16
+ all prompts that declare a `schedule:` key, and installs them as crontab entries via the
17
+ `whenever` gem.
18
+
19
+ The prompts are self-describing — a prompt that wants to run on a schedule says so in
20
+ its own frontmatter.
21
+
22
+ ---
23
+
24
+ ## Gem Identity
25
+
26
+ | Property | Value |
27
+ |---|---|
28
+ | Gem name | `aias` |
29
+ | Binary | `aias` |
30
+ | Ruby module | `Aias::` |
31
+ | Version | Tracks `aia` version exactly (reads from the same `.version` file) |
32
+ | Author / license | Same as `aia` — madbomber's RubyGems account, MIT license |
33
+ | Distribution | Standalone gem, released independently from `aia` |
34
+ | Entry point | Separate `aias` binary — not an `aia` subcommand |
35
+
36
+ ---
37
+
38
+ ## Scheduling Backend: `whenever`
39
+
40
+ `whenever` was chosen over `rufus-scheduler` because:
41
+
42
+ - AIA is already a CLI tool — scheduled jobs are simply `aia <prompt_id>` invocations
43
+ - No long-running daemon to manage; the OS cron daemon handles reliability and reboots
44
+ - Each job runs as a fresh, clean `aia` process — no shared state between runs
45
+ - Crontab entries are visible and auditable with standard Unix tools (`crontab -l`)
46
+
47
+ `whenever` is normally driven by a hand-written `config/schedule.rb`. `aias` eliminates
48
+ that file entirely — it auto-generates the equivalent by scanning prompt frontmatter,
49
+ then hands the result to `whenever` to install into the user's crontab.
50
+
51
+ `whenever` is a **hard dependency** — its marker-block management and cron DSL are not
52
+ worth reimplementing.
53
+
54
+ ---
55
+
56
+ ## The `schedule:` Frontmatter Key
57
+
58
+ A single string value. No hash form. No additional fields.
59
+
60
+ ```yaml
61
+ # Raw cron expression
62
+ schedule: "0 8 * * *"
63
+
64
+ # whenever human-readable DSL — both forms accepted
65
+ schedule: "every 1.day at 8:00am"
66
+ schedule: "every :monday at 9:00am"
67
+ schedule: "every 6.hours"
68
+ ```
69
+
70
+ Everything else is derived — there is nothing else to configure at the prompt level:
71
+
72
+ | Concern | Behaviour |
73
+ |---|---|
74
+ | Enabled / disabled | Presence of `schedule:` means enabled. Remove the line to disable. |
75
+ | Log file | Composed from prompt ID: `~/.aia/schedule/logs/<prompt_id>.log` |
76
+ | Append vs overwrite | Always append (`>>`). Log entries accumulate across runs. |
77
+ | stdout + stderr | Always combined (`2>&1`). No separate error log. |
78
+ | AIA flags / model / role | AIA reads these from the prompt's own frontmatter. `aias` passes only the prompt ID. |
79
+
80
+ ### Example scheduled prompt
81
+
82
+ ```yaml
83
+ ---
84
+ name: daily_digest
85
+ description: Summarizes overnight news and activity
86
+ schedule: "every 1.day at 8:00am"
87
+ ---
88
+ Summarize what happened overnight in the Ruby and AI ecosystems.
89
+ ```
90
+
91
+ ### Non-scheduled prompt (unchanged, ignored by aias)
92
+
93
+ ```yaml
94
+ ---
95
+ name: ad_hoc
96
+ description: An Ad Hoc prompt for on the fly consultations
97
+ parameters:
98
+ what_now_human: "I'm going to give you my resume and then we are going to talk about it."
99
+ ---
100
+ <%= what_now_human %>
101
+ ```
102
+
103
+ ---
104
+
105
+ ## How It Works
106
+
107
+ ### Prompt Discovery
108
+
109
+ `aias` uses `grep -rl "schedule:" $AIA_PROMPTS_DIR` to find candidate files. This is
110
+ recursive, filename-only output, POSIX-standard, and reads only files that actually
111
+ contain the word `schedule:` — avoiding loading every prompt in the directory.
112
+
113
+ The full subpath relative to `$AIA_PROMPTS_DIR` is the prompt ID:
114
+
115
+ ```
116
+ ~/.prompts/reports/weekly_digest.md → aia reports/weekly_digest
117
+ ~/.prompts/daily_digest.md → aia daily_digest
118
+ ```
119
+
120
+ ### Primary Operation: `aias update`
121
+
122
+ 1. Run `grep -rl "schedule:" $AIA_PROMPTS_DIR` to find candidates
123
+ 2. Parse frontmatter of each candidate via `PM::Metadata`
124
+ 3. Validate each scheduled prompt (see Validation below)
125
+ 4. For valid prompts, build an `aia <prompt_id>` invocation string
126
+ 5. Generate a complete `whenever`-managed crontab block
127
+ 6. Install, replacing the previous `aias`-managed block entirely
128
+
129
+ This is a **full sync on every run**. Orphaned entries (from deleted or de-scheduled
130
+ prompts) are automatically removed because the entire block is replaced.
131
+
132
+ ### The Cron Environment
133
+
134
+ Cron runs in a minimal shell with no PATH, no rbenv/rvm activation, and no user
135
+ environment variables. `aias` solves this by wrapping every cron entry in a login
136
+ shell invocation, detected from `ENV['SHELL']` at `update` time.
137
+
138
+ `whenever` supports this natively via `job_template`:
139
+
140
+ ```ruby
141
+ set :job_template, "zsh -l -c ':job'" # or bash -l -c, fish -l -c, etc.
142
+ ```
143
+
144
+ The login shell sources the user's profile, providing rbenv, PATH, and all AIA
145
+ environment variables automatically. No PATH capture or manual config step required.
146
+
147
+ ### Example Generated Crontab Entry
148
+
149
+ ```
150
+ # aias -- reports/daily_digest
151
+ 0 8 * * * /bin/zsh -l -c 'aia reports/daily_digest >> ~/.aia/schedule/logs/reports/daily_digest.log 2>&1'
152
+ ```
153
+
154
+ ---
155
+
156
+ ## CLI Commands
157
+
158
+ | Command | Description |
159
+ |---|---|
160
+ | `aias update` | Full sync: scan prompts, regenerate all crontab entries, install. Primary command. |
161
+ | `aias clear` | Remove all `aias`-managed entries from crontab. Non-AIA entries untouched. |
162
+ | `aias list` | Report all `aias` jobs currently in the crontab: prompt ID, schedule, log file. |
163
+ | `aias check` | Diff view: prompts with `schedule:` vs what is installed. Surfaces uninstalled, orphaned, and invalid prompts. |
164
+ | `aias dry-run` | Show what `update` would write without touching the crontab. |
165
+ | `aias next [N]` | Show next N scheduled run times for all installed jobs (default N=5). |
166
+ | `aias show <prompt_id>` | Show the installed crontab entry for a single prompt. |
167
+
168
+ ---
169
+
170
+ ## Architecture
171
+
172
+ ```
173
+ aias gem
174
+ ├── Aias::CLI (Thor: update, clear, list, check, dry-run, next, show)
175
+ ├── Aias::PromptScanner (grep -rl discovery + PM::Metadata frontmatter parsing)
176
+ ├── Aias::JobBuilder (prompt ID + schedule string → whenever job definition)
177
+ ├── Aias::CrontabManager (wraps whenever; installs/clears/reads managed crontab block)
178
+ └── Aias::Validator (cron expression syntax, parameter defaults, aia binary presence)
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Validation
184
+
185
+ Before writing to crontab, `aias` validates each scheduled prompt:
186
+
187
+ 1. **Schedule syntax** — cron expression or whenever DSL string is parseable
188
+ 2. **Parameter completeness** — all `parameters:` keys must have default values;
189
+ interactive input is impossible in a cron context
190
+ 3. **AIA binary** — `aia` must be locatable (checked via `which aia` inside the login shell)
191
+ 4. **Prompts directory** — `$AIA_PROMPTS_DIR` must exist and be readable
192
+
193
+ On validation failure during `update`: the invalid prompt is warned loudly, excluded
194
+ from the install, and any existing crontab entry for it is removed.
195
+
196
+ Validation also runs standalone via `aias check`.
197
+
198
+ ---
199
+
200
+ ## Output and Logging
201
+
202
+ - Log directory: `~/.aia/schedule/logs/` — created on first `update` if absent
203
+ - Log file per prompt: `~/.aia/schedule/logs/<prompt_id>.log`
204
+ (subdirectory structure mirrors the prompt subpath, e.g. `logs/reports/daily_digest.log`)
205
+ - stdout and stderr always combined (`2>&1`)
206
+ - Always append — logs accumulate across runs
207
+
208
+ ---
209
+
210
+ ## Key Dependencies
211
+
212
+ ```ruby
213
+ spec.add_dependency "aia" # no version constraint
214
+ spec.add_dependency "prompt_manager" # already used by aia
215
+ spec.add_dependency "whenever" # crontab generation and management
216
+ spec.add_dependency "thor" # CLI framework
217
+ spec.add_dependency "zeitwerk" # autoloading
218
+ ```
219
+
220
+ `sequel`, `sqlite3`, and `rufus-scheduler` are not required.
221
+
222
+ ---
223
+
224
+ ## Deferred Decisions
225
+
226
+ | Topic | Notes |
227
+ |---|---|
228
+ | `timeout:` support | Would require wrapping cron entry with Unix `timeout` command. Deferred to post-v1. |
229
+
230
+ ---
231
+
232
+ ## All Resolved Decisions
233
+
234
+ | Decision | Outcome |
235
+ |---|---|
236
+ | Scheduling backend | `whenever` — no daemon, OS cron handles reliability |
237
+ | Invocation method | Shell out to `aia` binary — fresh process, clean state per job |
238
+ | Separate config file | None — schedule data lives entirely in prompt frontmatter |
239
+ | `schedule:` format | Single string only — cron expression or whenever DSL |
240
+ | Enabled/disabled | Presence of `schedule:` key means enabled; remove line to disable |
241
+ | AIA flags in schedule block | Not needed — AIA reads its own frontmatter; `aias` passes only the prompt ID |
242
+ | Append vs overwrite | Always append |
243
+ | stdout/stderr | Always combined |
244
+ | Log location | Config-anchored: `~/.aia/schedule/logs/<prompt_id>.log` |
245
+ | Prompt discovery | `grep -rl "schedule:" $AIA_PROMPTS_DIR` — POSIX, no extra tools |
246
+ | Prompt ID format | Full subpath relative to prompts dir (e.g. `reports/weekly_digest`) |
247
+ | Cron environment | Login shell wrapping via `whenever`'s `job_template`, detected from `ENV['SHELL']` |
248
+ | Validation failure | Warn loudly, skip invalid prompt, remove any existing crontab entry for it |
249
+ | Parameters in scheduled prompts | All `parameters:` must have defaults in frontmatter |
250
+ | Gem name / binary | `aias` / `aias` |
251
+ | Gem boundary | Standalone gem, distributed separately from `aia` |
252
+ | Version tracking | Matches `aia` version; reads shared `.version` file |
253
+ | Ownership | madbomber RubyGems account, MIT license, same author as `aia` |
254
+ | `aia` dependency constraint | No version pin — user is responsible for compatibility |
255
+ | `whenever` coupling | Hard dependency |
256
+ | Execution history DB | Out of scope — cron logs to files |
Binary file
data/docs/cli/add.md ADDED
@@ -0,0 +1,101 @@
1
+ # aias add
2
+
3
+ Add or replace a single prompt's cron job without touching any other installed jobs.
4
+
5
+ ```bash
6
+ aias add PATH
7
+ ```
8
+
9
+ `PATH` is the path to the prompt file — absolute or relative. The file must live inside the configured prompts directory.
10
+
11
+ ## What It Does
12
+
13
+ 1. Expands `PATH` to an absolute path
14
+ 2. Verifies the file exists and is inside the prompts directory
15
+ 3. Parses the file's YAML frontmatter via `PM::Metadata`
16
+ 4. Errors immediately if the file has no `schedule:` key
17
+ 5. Runs the same validation as `update` (schedule syntax, parameter defaults, `aia` binary)
18
+ 6. Derives the prompt ID from the file's path relative to the prompts directory
19
+ 7. Upserts the single cron entry into the aias-managed crontab block — if the prompt was already installed, its old entry is replaced; all other entries are left untouched
20
+
21
+ ## When to Use `add` vs `update`
22
+
23
+ | Situation | Command |
24
+ |---|---|
25
+ | You edited or created one prompt and want it scheduled now | `aias add PATH` |
26
+ | You edited multiple prompts, or want to sync everything | `aias update` |
27
+ | You want to see what would change first | `aias dry-run` or `aias check` |
28
+
29
+ `add` is faster than `update` for large prompts directories because it does not scan the entire tree — it only reads the one file you specify.
30
+
31
+ ## Example Output
32
+
33
+ **Success:**
34
+
35
+ ```
36
+ aias: added standup (every weekday at 9:00am (0 9 * * 1-5))
37
+ ```
38
+
39
+ **Prompt has no schedule:**
40
+
41
+ ```
42
+ aias [error] 'drafts/idea' has no schedule: in its frontmatter
43
+ ```
44
+
45
+ **Invalid schedule:**
46
+
47
+ ```
48
+ aias [error] bad_prompt: Schedule 'every banana': not a valid cron expression or natural language schedule
49
+ ```
50
+
51
+ **File outside prompts directory:**
52
+
53
+ ```
54
+ aias [error] '/tmp/idea.md' is not inside the prompts directory '/Users/you/.prompts'
55
+ ```
56
+
57
+ ## Upsert Semantics
58
+
59
+ Re-running `add` on the same prompt replaces its cron entry cleanly — no duplicates are created. This makes `add` safe to run any number of times:
60
+
61
+ ```bash
62
+ # Install:
63
+ aias add ~/.prompts/standup.md
64
+ # aias: added standup (every weekday at 9:00am (0 9 * * 1-5))
65
+
66
+ # Update the schedule in the file, then re-install:
67
+ aias add ~/.prompts/standup.md
68
+ # aias: added standup (every weekday at 10:00am (0 10 * * 1-5))
69
+ ```
70
+
71
+ ## Prompt ID Derivation
72
+
73
+ The prompt ID is derived the same way as `update`: the file's absolute path with the prompts directory prefix and `.md` extension removed.
74
+
75
+ ```
76
+ prompts_dir: /Users/you/.prompts
77
+ file: /Users/you/.prompts/reports/weekly.md
78
+ prompt_id: reports/weekly
79
+ ```
80
+
81
+ ## Options
82
+
83
+ | Option | Alias | Description |
84
+ |---|---|---|
85
+ | `--prompts-dir PATH` | `-p` | Use PATH as the prompts directory (also determines the prompt ID prefix) |
86
+
87
+ When `--prompts-dir` is not supplied, the prompts directory is read from `AIA_PROMPTS__DIR` or `AIA_PROMPTS_DIR`. The same value is embedded in the generated `aia` command so the cron job runs against the correct directory.
88
+
89
+ ## Exit Codes
90
+
91
+ | Code | Condition |
92
+ |---|---|
93
+ | `0` | Job installed successfully |
94
+ | `1` | File not found, outside prompts dir, no `schedule:`, validation failure, or crontab write error |
95
+
96
+ ## See Also
97
+
98
+ - [`aias update`](update.md) — sync all scheduled prompts at once
99
+ - [`aias check`](check.md) — diff view before making changes
100
+ - [`aias list`](list.md) — confirm the job was installed
101
+ - [Scheduling Prompts](../guides/scheduling-prompts.md) — schedule format reference
data/docs/cli/check.md ADDED
@@ -0,0 +1,70 @@
1
+ # aias check
2
+
3
+ Diff view: compare prompts that declare `schedule:` against what is currently installed in the crontab.
4
+
5
+ ```bash
6
+ aias check
7
+ ```
8
+
9
+ ## What It Shows
10
+
11
+ `check` categorises every prompt and every installed job into one of four states:
12
+
13
+ | Label | Meaning |
14
+ |---|---|
15
+ | `OK` | Crontab is in sync — nothing to report |
16
+ | `NEW` | Prompt has `schedule:` but is not yet installed — run `update` |
17
+ | `ORPHANED` | Installed in crontab but no corresponding prompt found — run `update` to remove |
18
+ | `INVALID` | Prompt has `schedule:` but failed validation — shown with error details |
19
+
20
+ ## Example Output
21
+
22
+ **In sync:**
23
+
24
+ ```
25
+ === aias check ===
26
+
27
+ OK — crontab is in sync with scheduled prompts
28
+ ```
29
+
30
+ **Changes needed:**
31
+
32
+ ```
33
+ === aias check ===
34
+
35
+ INVALID (would be skipped by update):
36
+ bad_prompt: Schedule 'every banana': undefined method 'banana' for ...
37
+
38
+ NEW (not yet installed — run `aias update`):
39
+ + reports/weekly
40
+
41
+ ORPHANED (installed but no longer scheduled):
42
+ - old_daily_job
43
+ ```
44
+
45
+ ## Typical Workflow
46
+
47
+ Run `check` after editing prompt files to see what `update` would change before actually running it:
48
+
49
+ ```bash
50
+ # Edit a prompt's schedule:
51
+ vim $AIA_PROMPTS_DIR/daily_digest.md
52
+
53
+ # Preview the impact:
54
+ aias check
55
+
56
+ # Apply:
57
+ aias update
58
+ ```
59
+
60
+ ## Options
61
+
62
+ | Option | Alias | Description |
63
+ |---|---|---|
64
+ | `--prompts-dir PATH` | `-p` | Use PATH instead of `AIA_PROMPTS__DIR` / `AIA_PROMPTS_DIR` |
65
+
66
+ ## See Also
67
+
68
+ - [`aias update`](update.md) — apply the changes shown by `check`
69
+ - [`aias dry-run`](dry-run.md) — preview the generated cron lines
70
+ - [`aias list`](list.md) — see all currently installed jobs
data/docs/cli/clear.md ADDED
@@ -0,0 +1,45 @@
1
+ # aias clear
2
+
3
+ Remove all aias-managed crontab entries.
4
+
5
+ ```bash
6
+ aias clear
7
+ ```
8
+
9
+ ## What It Does
10
+
11
+ Calls `whenever --clear` for the `aias` identifier, removing the entire `aias`-managed block from the crontab. All other crontab entries (your own manually added jobs or other `whenever`-managed blocks) are left untouched.
12
+
13
+ ## Output
14
+
15
+ ```
16
+ aias: all managed crontab entries removed
17
+ ```
18
+
19
+ ## Use Cases
20
+
21
+ **Temporarily disable all scheduled prompts** without editing any prompt files:
22
+
23
+ ```bash
24
+ aias clear
25
+ # Re-enable later:
26
+ aias update
27
+ ```
28
+
29
+ **Reset before a clean reinstall:**
30
+
31
+ ```bash
32
+ aias clear
33
+ aias update
34
+ ```
35
+
36
+ ## Notes
37
+
38
+ `clear` does not validate prompts or read `$AIA_PROMPTS_DIR`. It simply removes whatever `aias` block is currently in the crontab.
39
+
40
+ After `clear`, `aias list` returns "no installed jobs" and `aias check` shows all scheduled prompts as `NEW`.
41
+
42
+ ## See Also
43
+
44
+ - [`aias update`](update.md) — reinstall after clearing
45
+ - [`aias list`](list.md) — verify the crontab is empty after clearing
@@ -0,0 +1,57 @@
1
+ # aias dry-run
2
+
3
+ Show what `aias update` would write to the crontab without making any changes.
4
+
5
+ ```bash
6
+ aias dry-run
7
+ ```
8
+
9
+ ## Output
10
+
11
+ The raw cron lines that would be installed, exactly as they would appear in the crontab:
12
+
13
+ ```
14
+ 0 8 * * * /bin/zsh -l -c 'aia daily_digest >> /Users/you/.aia/schedule/logs/daily_digest.log 2>&1'
15
+ 0 9 * * 1 /bin/zsh -l -c 'aia reports/weekly >> /Users/you/.aia/schedule/logs/reports/weekly.log 2>&1'
16
+ ```
17
+
18
+ Invalid prompts are printed to stderr (same as `update`):
19
+
20
+ ```
21
+ aias [skip] bad_prompt: Schedule 'every banana': ...
22
+ ```
23
+
24
+ When no valid prompts are found:
25
+
26
+ ```
27
+ aias: no valid scheduled prompts found
28
+ ```
29
+
30
+ ## Use Cases
31
+
32
+ **Verify the generated cron expression** before committing it to your crontab:
33
+
34
+ ```bash
35
+ aias dry-run
36
+ # Inspect the output, then:
37
+ aias update
38
+ ```
39
+
40
+ **Check login shell wrapping** — confirm the correct shell binary and `-l` flag appear in the output.
41
+
42
+ **Audit from CI** — `dry-run` is safe to run in automated pipelines because it never modifies the crontab.
43
+
44
+ ## Notes
45
+
46
+ `dry-run` runs the full scan and validation pipeline. The only thing it skips is the final crontab write. This means it accurately reflects what `update` would do, including which prompts would be skipped.
47
+
48
+ ## Options
49
+
50
+ | Option | Alias | Description |
51
+ |---|---|---|
52
+ | `--prompts-dir PATH` | `-p` | Use PATH instead of `AIA_PROMPTS__DIR` / `AIA_PROMPTS_DIR` |
53
+
54
+ ## See Also
55
+
56
+ - [`aias update`](update.md) — apply the output shown by `dry-run`
57
+ - [`aias check`](check.md) — higher-level diff view
data/docs/cli/index.md ADDED
@@ -0,0 +1,51 @@
1
+ # CLI Reference
2
+
3
+ `aias` provides nine commands. All are available via `aias help` at the terminal.
4
+
5
+ ```
6
+ aias help
7
+ ```
8
+
9
+ ## Command Summary
10
+
11
+ | Command | Purpose |
12
+ |---|---|
13
+ | [`aias install [PATTERN...]`](install.md) | Capture PATH, API keys, and env vars into `env.sh`. Run once before scheduling any prompts. |
14
+ | [`aias update`](update.md) | Scan prompts, validate, install all scheduled jobs. Primary command. |
15
+ | [`aias add PATH`](add.md) | Add or replace a single prompt's cron job without touching others. |
16
+ | [`aias remove PROMPT_ID`](remove.md) | Remove a single prompt's cron job. Aliases: `rm`, `delete`. |
17
+ | [`aias check`](check.md) | Diff view: what is scheduled vs what is installed. |
18
+ | [`aias list`](list.md) | Print all currently installed jobs. |
19
+ | [`aias dry-run`](dry-run.md) | Preview `update` output without writing the crontab. |
20
+ | [`aias show PROMPT_ID`](show.md) | Inspect a single installed job. |
21
+ | [`aias next [N]`](next.md) | Show next scheduled run time for installed jobs. |
22
+ | [`aias last [N]`](last.md) | Show last-run time for installed jobs. |
23
+ | [`aias clear`](clear.md) | Remove all aias-managed crontab entries. |
24
+ | [`aias uninstall`](uninstall.md) | Remove the managed env block from `env.sh`. |
25
+
26
+ ## Global Option
27
+
28
+ `--prompts-dir PATH` (alias `-p`) overrides the `AIA_PROMPTS__DIR` / `AIA_PROMPTS_DIR` environment variables for any command that reads prompt files. It has no effect on commands that only read from the crontab (`list`, `show`, `next`, `last`, `clear`).
29
+
30
+ ```bash
31
+ aias --prompts-dir ~/work/prompts update
32
+ aias --prompts-dir ~/work/prompts add ~/work/prompts/standup.md
33
+ aias -p ~/work/prompts dry-run
34
+ aias -p ~/work/prompts check
35
+ ```
36
+
37
+ The lookup order for the prompts directory is:
38
+
39
+ 1. `--prompts-dir` CLI option (highest priority)
40
+ 2. `AIA_PROMPTS__DIR` environment variable (AIA >= 0.8.0)
41
+ 3. `AIA_PROMPTS_DIR` environment variable (AIA < 0.8.0)
42
+ 4. Error — neither option nor env var is set
43
+
44
+ ## Exit Codes
45
+
46
+ | Code | Meaning |
47
+ |---|---|
48
+ | `0` | Success |
49
+ | `1` | Error (bad prompts directory, crontab write failure, prompt not found) |
50
+
51
+ Validation failures during `update` do **not** cause a non-zero exit — invalid prompts are warned and skipped while valid ones are installed.