Skip to content

feat: auto-install screen-time and profile-readme scheduled jobs#3949

Merged
marcusquinn merged 2 commits intomainfrom
feature/setup-screen-time-jobs
Mar 9, 2026
Merged

feat: auto-install screen-time and profile-readme scheduled jobs#3949
marcusquinn merged 2 commits intomainfrom
feature/setup-screen-time-jobs

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Mar 9, 2026

Summary

  • Adds screen-time snapshot scheduled job to setup.sh (always-install pattern, every 6h) — accumulates daily screen time data beyond macOS Knowledge DB's ~28 day retention
  • Adds profile README update scheduled job to setup.sh (conditional on profile repo in repos.json, daily at 06:00) — auto-updates GitHub profile README with contributor stats
  • Both support macOS (launchd) and Linux (cron), following existing setup.sh patterns (_xml_escape, _cron_escape, _launchd_has_agent, unload-before-reload)

Testing

  • ShellCheck clean
  • Tested on macOS: both plists generated, validated with plutil -lint, loaded successfully
  • Idempotent: re-running setup.sh correctly unloads and reloads existing jobs
  • Profile README job correctly skipped when no profile repo exists in repos.json

Verification

$ launchctl list | grep -E 'screen-time|profile-readme'
-	0	sh.aidevops.profile-readme-update
-	0	sh.aidevops.screen-time-snapshot

$ plutil -lint ~/Library/LaunchAgents/sh.aidevops.screen-time-snapshot.plist
OK
$ plutil -lint ~/Library/LaunchAgents/sh.aidevops.profile-readme-update.plist
OK

Summary by CodeRabbit

Release Notes

  • New Features
    • Added automatic screen time snapshot scheduling, running every 6 hours on both macOS and Linux.
    • Added automatic profile README update scheduling, running daily at 06:00 on both macOS and Linux.
    • Both features include proper logging and validation for reliable execution.

…etup.sh

Add two new scheduled job installations to setup.sh so they deploy
automatically on 'aidevops setup' and 'aidevops update':

- Screen time snapshot (always-install): captures daily screen time
  every 6h to accumulate data beyond macOS Knowledge DB's ~28 day
  retention. macOS: launchd plist. Linux: cron entry.

- Profile README update (conditional): updates GitHub profile README
  with contributor stats daily at 06:00. Only installed when user has
  a profile repo (priority: "profile") in repos.json. Includes PATH
  env for git/gh access. MacOS: launchd plist. Linux: cron entry.

Both follow existing setup.sh patterns: _xml_escape for plists,
_cron_escape for cron, _launchd_has_agent for idempotent upgrades,
unload-before-reload for plist updates.
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions bot added the enhancement Auto-created from TODO.md tag label Mar 9, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2b746219-2d6e-4d25-9b93-08031f873e35

📥 Commits

Reviewing files that changed from the base of the PR and between 82f3ba7 and 138f2fd.

📒 Files selected for processing (1)
  • setup.sh

Walkthrough

The change adds scheduled execution of helper scripts via platform-specific schedulers: LaunchAgent on macOS and cron on Linux, for screen-time snapshots every 6 hours and profile README updates daily at 06:00, with proper path escaping, logging, and environment configuration.

Changes

Cohort / File(s) Summary
Screen Time & Profile README Scheduling
setup.sh
Adds 175 lines implementing cross-platform scheduler installation: LaunchAgent plists for macOS with StartInterval (6h) and StartCalendarInterval (daily 06:00), and cron entries for Linux; includes XML/cron escaping, logging configuration, validation checks, and conditional activation based on script executability and repo priority settings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

📅 The helpers now tick like clockwork so fine,
Six hours apart, or once a day's line,
macOS and Linux dance in perfect time,
setup.sh conducts this automation sublime! ⏰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically summarizes the main change: adding automatic installation of scheduled jobs for screen-time and profile-readme features.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/setup-screen-time-jobs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 392 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Mar 9 01:48:28 UTC 2026: Code review monitoring started
Mon Mar 9 01:48:28 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 392

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 392
  • VULNERABILITIES: 0

Generated on: Mon Mar 9 01:48:31 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
setup.sh (2)

1257-1259: Linux cron entry lacks explicit PATH (minor inconsistency).

The profile-readme-update cron entry (line 1353) includes PATH="/usr/local/bin:/usr/bin:/bin", but this screen-time-snapshot entry does not. While journalctl is typically in the default cron PATH, adding an explicit PATH would be more consistent with the other scheduled jobs in this file.

🔧 Suggested fix for consistency
-				echo "0 */6 * * * /bin/bash ${_cron_st_script} snapshot >> \"\$HOME/.aidevops/.agent-workspace/logs/screen-time-snapshot.log\" 2>&1 # aidevops: screen-time-snapshot"
+				echo "0 */6 * * * PATH=\"/usr/local/bin:/usr/bin:/bin\" /bin/bash ${_cron_st_script} snapshot >> \"\$HOME/.aidevops/.agent-workspace/logs/screen-time-snapshot.log\" 2>&1 # aidevops: screen-time-snapshot"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@setup.sh` around lines 1257 - 1259, The cron entry for screen-time-snapshot
is missing an explicit PATH variable; update the cron line that echoes the job
(the one referencing _cron_st_script and the comment "aidevops:
screen-time-snapshot") to include PATH="/usr/local/bin:/usr/bin:/bin" before
executing the script (matching the profile-readme-update entry) so the job runs
with a consistent environment and can find binaries like journalctl.

1229-1233: Consider adding PATH to EnvironmentVariables for screen-time snapshot.

The screen-time-helper.sh script likely calls external commands like sqlite3 (for querying the macOS Knowledge DB) and other utilities. Without PATH in the EnvironmentVariables dict, launchd jobs run with a minimal environment where these tools may not be found.

The memory-pressure-monitor plist (lines 1149-1154) includes PATH. For consistency and reliability, this plist should too.

♻️ Suggested fix: Add PATH to EnvironmentVariables
 	<key>EnvironmentVariables</key>
 	<dict>
+		<key>PATH</key>
+		<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
 		<key>HOME</key>
 		<string>${_xml_st_home}</string>
 	</dict>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@setup.sh` around lines 1229 - 1233, The EnvironmentVariables dict for the
screen-time snapshot plist only sets HOME and should also set PATH so launchd
can find external commands (e.g., sqlite3) when running screen-time-helper.sh;
update the <key>EnvironmentVariables</key> block that currently contains
<key>HOME</key> / <string>${_xml_st_home}</string> to also include a
<key>PATH</key> entry (matching the PATH used in memory-pressure-monitor) so the
job runs with the expected executable search path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@setup.sh`:
- Around line 1257-1259: The cron entry for screen-time-snapshot is missing an
explicit PATH variable; update the cron line that echoes the job (the one
referencing _cron_st_script and the comment "aidevops: screen-time-snapshot") to
include PATH="/usr/local/bin:/usr/bin:/bin" before executing the script
(matching the profile-readme-update entry) so the job runs with a consistent
environment and can find binaries like journalctl.
- Around line 1229-1233: The EnvironmentVariables dict for the screen-time
snapshot plist only sets HOME and should also set PATH so launchd can find
external commands (e.g., sqlite3) when running screen-time-helper.sh; update the
<key>EnvironmentVariables</key> block that currently contains <key>HOME</key> /
<string>${_xml_st_home}</string> to also include a <key>PATH</key> entry
(matching the PATH used in memory-pressure-monitor) so the job runs with the
expected executable search path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd728aeb-5382-4730-bf4b-b35213369022

📥 Commits

Reviewing files that changed from the base of the PR and between baf1942 and 82f3ba7.

📒 Files selected for processing (1)
  • setup.sh

Address CodeRabbit review: add PATH to both the launchd plist
EnvironmentVariables and the Linux cron entry for screen-time-snapshot,
matching the pattern used by profile-readme-update and memory-pressure-monitor.
Ensures sqlite3 and other tools are findable in the launchd environment.
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 392 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Mar 9 01:54:42 UTC 2026: Code review monitoring started
Mon Mar 9 01:54:43 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 392

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 392
  • VULNERABILITIES: 0

Generated on: Mon Mar 9 01:54:45 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@marcusquinn marcusquinn merged commit d75ac85 into main Mar 9, 2026
12 checks passed
@marcusquinn marcusquinn deleted the feature/setup-screen-time-jobs branch March 9, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Auto-created from TODO.md tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant