feat(linkedin-studio): RE-R3c — autonomous trigger (scheduler + headless entry) [skip-docs]
Closes research-engine hulls (1) no autonomous trigger + (6) no headless entry. Makes the daily research loop closed + headless: deterministic-brief-only (C1), print-first (C2 — the tool never runs launchctl or the cron table; --install writes only the inert launchd plist file). - NEW scripts/trends/src/schedule.ts — pure string emitters (launchd plist + cron-line + install/uninstall instructions + defaultLabel). No clock/fs/env/AI; byte-deterministic. - NEW scripts/trends/run-daily.sh — bash-3.2 headless wrapper: resolves node, cd's into the package so tsx resolves, logs via the data-path twin seam; runs the deterministic brief and appends one compact cron.log line per fire. The (e) AI-capture seam is documented, not built. - EDIT cli.ts — schedule --pillars <a,b> [--at HH:MM] [--fresh-days N] [--platform auto|launchd|cron] [--install|--uninstall] [--store <p>]; print-first, no new exit code; logPath anchored to dirname(defaultStorePath()) (not the --store override). - WIRE trend-spotter.md (one prose line) + README (scheduler + wrapper + the C1 boundary). - Gate: TRENDS_TESTS_FLOOR 171->192, ASSERT_BASELINE_FLOOR 105->111, new UNCONDITIONAL Section 16l (6 deps-absent greps + non-vacuity self-test), header-enum + floor-history append. TDD two-phase RED -> GREEN. trends 192/192, gate 126/0, hook-suite 139/0 (untouched), plutil -lint OK. No schema change (SCHEMA_VERSION 4 / BRIEF_SCHEMA_VERSION 1). Counts 29/19/27 unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011vmzxpsFpc8q19LaogAWLD
This commit is contained in:
parent
b43757462b
commit
3276e44dbf
9 changed files with 768 additions and 9 deletions
39
scripts/trends/run-daily.sh
Executable file
39
scripts/trends/run-daily.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# RE-R3c headless entry: runs the DETERMINISTIC morning brief from a scheduler's
|
||||
# profile-less env (launchd/cron inherit no shell profile). No AI.
|
||||
#
|
||||
# The (e) slice will insert a pre-brief AI capture step here (poll -> score -> capture)
|
||||
# before the `brief` call below; R3c builds ONLY the deterministic store -> artifact path.
|
||||
#
|
||||
# Data-path: the FOURTH sanctioned twin of store.ts:defaultStorePath / data-root.mjs:getDataRoot
|
||||
# / analytics/src/utils/storage.ts:getDataRoot (the shell form of references/data-path-convention.md
|
||||
# rule 1). Keep in sync. Bash 3.2-compatible: ASCII-only, all expansions quoted, no bash-4 features.
|
||||
set -eu
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$DIR" # so `--import tsx` resolves node_modules even under cron's $HOME cwd
|
||||
|
||||
NODE_BIN="${NODE_BIN:-$(command -v node 2>/dev/null || true)}"
|
||||
if [ -z "$NODE_BIN" ]; then
|
||||
for c in /usr/local/bin/node /opt/homebrew/bin/node /usr/bin/node; do
|
||||
if [ -x "$c" ]; then NODE_BIN="$c"; break; fi
|
||||
done
|
||||
fi
|
||||
|
||||
LOG="${LINKEDIN_STUDIO_DATA:-$HOME/.claude/linkedin-studio}/trends/cron.log"
|
||||
mkdir -p "$(dirname "$LOG")"
|
||||
TS="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
|
||||
if [ -z "$NODE_BIN" ]; then
|
||||
printf '%s exit=127 node not found\n' "$TS" >> "$LOG"
|
||||
exit 127
|
||||
fi
|
||||
|
||||
set +e
|
||||
OUT="$("$NODE_BIN" --import tsx "$DIR/src/cli.ts" brief "$@" --json 2>&1)"; CODE=$?
|
||||
set -e
|
||||
|
||||
# `brief --json` is pretty-printed (cli.ts JSON.stringify(…, null, 2)); collapse it to ONE line.
|
||||
OUT="$(printf '%s' "$OUT" | tr '\n' ' ' | tr -s ' ')"
|
||||
printf '%s exit=%s %s\n' "$TS" "$CODE" "$OUT" >> "$LOG"
|
||||
exit "$CODE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue