ktg-plugin-marketplace/plugins/ms-ai-architect/scripts
Kjell Tore Guttormsen 30d7a2024c feat(ms-ai-architect): add install-kb-cron standalone helper for cross-OS cron registration [skip-docs]
Step 11 of v1.12.0 plan (.claude/projects/2026-05-04-kb-update-fork-and-own/plan.md).

scripts/install-kb-cron.mjs lives at the scripts/ root (not inside
scripts/kb-update/) because it is a plugin-wide install tool, not part of
the KB-update pipeline itself. Reads the appropriate template from
scripts/kb-update/templates/, fills {{NODE_BIN}}, {{PLUGIN_ROOT}},
{{LOG_FILE}}, {{SCHEDULE_HOUR/MINUTE/DAY_OF_WEEK}} placeholders, writes
to the platform-specific scheduler dir, and registers the job:

  macOS  - launchctl bootstrap gui/<uid> <plist>  (load -w fallback)
  Linux  - systemctl --user daemon-reload && enable --now <timer>
  Windows - powershell -ExecutionPolicy Bypass -File <ps1>  (beta)

Flags: --print-only, --target macos|linux|windows, --uninstall, --purge,
--node-bin, --claude-bin, --schedule "M H * * D" (default: Wed 04:23).

UID resolution for launchctl is guarded by process.getuid() POSIX-only
(undefined on Windows). MCP server presence in ~/.claude.json is
warning-only per brief Spørsmål 7. WSL detected via /proc/version.
Cross-OS rendering supported via --print-only --target <other>; install
on a non-host target rejects with explicit error.

11 subprocess + filesystem-snapshot tests in
tests/kb-update/test-install-cron.test.mjs verify --print-only produces
filled templates with no unsubstituted {{...}} placeholders, --print-only
writes nothing under HOME, --uninstall is idempotent on an empty HOME,
--schedule substitutes correctly, and invalid flags reject with non-zero
exit. Tests never invoke launchctl/systemctl/Register-ScheduledTask
against real schedulers.

Tests: 110/110 pass (was 99 before this step).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:26:54 +02:00
..
kb-update feat(ms-ai-architect): rewrite weekly-kb-cron with portable paths, auth-mode-aware pre-flight, lock+backup+rollback [skip-docs] 2026-05-05 11:10:17 +02:00
skill-gen chore(ms-ai-architect): sanitize all private references for open-source 2026-04-07 17:27:10 +02:00
build-demo-state.mjs feat(ms-ai-architect): release v1.11.0 — design-system 100%-adoption + visual upgrade 2026-05-04 17:41:36 +02:00
export-pdf.py feat(ms-ai-architect): add plugin to open marketplace (v1.5.0 baseline) 2026-04-07 17:17:17 +02:00
install-kb-cron.mjs feat(ms-ai-architect): add install-kb-cron standalone helper for cross-OS cron registration [skip-docs] 2026-05-05 11:26:54 +02:00
kb-staleness-check.sh feat(ms-ai-architect): add plugin to open marketplace (v1.5.0 baseline) 2026-04-07 17:17:17 +02:00