feat(scripts): maintain.ps1 — daily heartbeat with smart notifications#30
Open
abdout wants to merge 1 commit into
Open
feat(scripts): maintain.ps1 — daily heartbeat with smart notifications#30abdout wants to merge 1 commit into
abdout wants to merge 1 commit into
Conversation
Implements spec #27. Composes sync-repos → self-update → doctor → notify → log into one autonomous run. Silent on green, visible on yellow, loud on red. - New ~/.claude/scripts/maintain.ps1 — main entry point with -Install / -Uninstall / -Status / -Run / -DryRun / -Silent flags - New lib/Notify.ps1 — BurntToast wrapper, Slack webhook poster, .env reader for SLACK_WEBHOOK_URL - Self-update is diff-gated: only re-runs install.ps1 when .claude/ files actually change on main - Log rotation: deletes logs/maintain-*.log older than 30 days - Weekly GitHub snapshot on Mondays (auto via doctor -Report) - Idempotent scheduled task creation: re-running -Install replaces in place - Notification matrix: exit 0 → silent (Monday: GitHub snapshot) exit 2 → toast (warnings) exit 3 → toast offering 'doctor -Update' other → toast + slack (errors) Verified: parses clean, -Status detects unarmed task, -Run -DryRun exercises the full flow without side effects. Closes #27 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
abdout
added a commit
that referenced
this pull request
May 16, 2026
Reflects the reality on the ground after PRs #29/#30/#31 land the v2 scripts: onboarding.mdx: - Promotes 'irm https://kun.databayt.org/install | iex' to the recommended path (one paste, one UAC, three OAuth sign-ins) - Demotes Cowork-driven flow to "Alternative" — still works for Pro/Max users who want narration over a bare paste - Manual fallback updated to use databayt/kun raw URL (the codebase one is now tombstoned in databayt/codebase#2) - Adds 'doctor' to Daily entry points and 'maintain -Install' to the manual fallback chain - "What you end up with" mentions the scheduled task onboarding-reference.mdx: - Scripts contract table flipped: bootstrap, doctor, maintain are now Shipping (no longer 'Planned v2'); health.ps1 marked Deprecated; finish.ps1 reduced to 'Planned (alias for bootstrap)' - Source-of-truth URL changed from databayt/codebase to databayt/kun - Migration order section refreshed — 4 of 6 items checked off, fresh-VM test + team comms remaining Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements spec #27. The daily heartbeat that composes the existing scripts into one autonomous run and surfaces problems through the right notification channel.
Builds on #29 (doctor.ps1) —
maintainis doctor's consumer.What's in the PR
~/.claude/scripts/maintain.ps1(208 lines) — main entry point~/.claude/scripts/lib/Notify.ps1(60 lines) —Send-Toast(BurntToast),Send-Slack(webhook),Get-EnvVar(.env reader)Flow
Total ~20s on a healthy machine. Doesn't block user work.
Notification matrix (from spec #27)
doctorexit0(green)2(warnings)3(updates)1/4(errors)SLACK_WEBHOOK_URL-ReportSilent on green is deliberate — notification fatigue kills daily tasks.
Self-update logic
Diff-gated. Saves cycles when there's no config change.
Log handling
Per-day file at
~/.claude/logs/maintain-<YYYY-MM-DD>.log. Rotated automatically — files older than 30 days are deleted at the start of each run.Scheduled task
maintain -Installcreates a daily Windows task armed at 09:00 local (override via-Schedule HH:mm). Uses/RL HIGHESTso it can refresh certificate stores and run elevated cmdlets. Idempotent (/Freplaces in place; re-running doesn't duplicate).If the user isn't running as Administrator, install fails gracefully and prints the manual
schtaskscommand.Test plan
maintain -Installcreates taskkun-maintain(verify withGet-ScheduledTask)-Installdoesn't duplicate the taskmaintain -Statusshows next run, last result, log pathmaintain -Uninstallremoves the task; idempotentmaintain -Run -DryRunexercises full flow without side effects — verified ✅Start-ScheduledTask kun-maintainfires real notificationsinstall.ps1when.claude/files change in the pulled commitsBurntToastinstall failure falls back gracefully (verified:Send-Toastreturns$false, logs continue)SLACK_WEBHOOK_URLnot in.env→ Slack channel silently skippedOpen items not blocking this PR
Dependencies
This branch stacks on
feat/doctor(PR #29). Once #29 merges to main, rebase this onto main and it lands cleanly.Closes #27
🤖 Generated with Claude Code