mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 18:44:45 +00:00
75b3e97cdb
Hermes doesn't set a working directory when firing cron jobs, so any
relative path in a template's cron prompt (`.scarf/config.json`,
`status-log.md`, etc.) resolves against whatever dir Hermes happens
to be in — NOT the installed project. Practical effect: site-status-
checker's cron job fires, agent runs with relative paths, finds
nothing to read, silently bails. User sees "Run now" complete with
zero output and nothing updated on disk.
Fix: the installer now substitutes template-author placeholders in
cron prompts at install time, before calling `hermes cron create`.
The registered cron job carries a fully-qualified, CWD-independent
prompt.
Supported tokens (deliberately few — each is part of the template
format contract from now on):
- `{{PROJECT_DIR}}` — absolute path of the installed project dir.
The one that was motivating this fix; required for any cron prompt
that reads or writes project files.
- `{{TEMPLATE_ID}}` — the `owner/name` from the manifest, for
templates that want to tag delivery payloads or log lines.
- `{{TEMPLATE_SLUG}}` — the sanitised slug used by the installer for
dir name + skills namespace, for templates that want to reference
their skills install path.
Implemented as a static `ProjectTemplateInstaller.substituteCronTokens`
so it's testable as a pure function. Unsupported placeholders pass
through verbatim — template authors notice in testing that their
token didn't get replaced and either use a supported one or file
a request.
Site Status Checker v1.1.0 updated to use the tokens:
- cron/jobs.json prompt now opens with "Run the site status check
for the Scarf project at {{PROJECT_DIR}}" and references
{{PROJECT_DIR}}/.scarf/config.json, {{PROJECT_DIR}}/status-log.md,
and {{PROJECT_DIR}}/.scarf/dashboard.json explicitly.
- AGENTS.md gains a note explaining that the cron-registered prompt
carries absolute paths (installer substitutes at install time),
while interactive-chat agents can keep using relative paths.
- bundle rebuilt, catalog regenerated.
templates/CONTRIBUTING.md documents the three supported tokens under
the cron/jobs.json bullet so future authors don't have to discover
this by hitting the same CWD bug.
Tests:
- ProjectTemplateExampleTemplateTests.siteStatusCheckerParsesAndPlans
extended to assert the bundled prompt contains {{PROJECT_DIR}}
UNRESOLVED. If someone accidentally bakes an absolute path into
the template (their install dir), every user of that template
would get the wrong path — this test catches that.
- Four new substitution tests in ProjectTemplateInstallerTests:
resolves PROJECT_DIR / resolves ID + SLUG / leaves unknown tokens
untouched / substitutes repeated occurrences. All go through the
static helper directly; no install round-trip needed.
57/57 Swift tests + 24/24 Python tests pass. Catalog check clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
2.2 KiB
JSON
69 lines
2.2 KiB
JSON
{
|
|
"generated": true,
|
|
"schemaVersion": 1,
|
|
"templates": [
|
|
{
|
|
"author": {
|
|
"name": "Alan Wizemann",
|
|
"url": "https://github.com/awizemann/scarf"
|
|
},
|
|
"bundleSha256": "a3c3a3b1cd1799443fa32ac5f1f643bf28b2e1b30c1b7786a1fa93ef227b0c7e",
|
|
"bundleSize": 7197,
|
|
"category": "monitoring",
|
|
"config": {
|
|
"modelRecommendation": {
|
|
"preferred": "claude-haiku-4",
|
|
"rationale": "Simple tool-use task \u2014 HTTP GETs + a short summary. Haiku is plenty and keeps cost low when the cron runs daily."
|
|
},
|
|
"schema": [
|
|
{
|
|
"default": [
|
|
"https://example.com",
|
|
"https://example.org"
|
|
],
|
|
"description": "One URL per item. HTTP or HTTPS. You can add and remove entries after install via the Configuration button on the dashboard.",
|
|
"itemType": "string",
|
|
"key": "sites",
|
|
"label": "Sites to Watch",
|
|
"maxItems": 25,
|
|
"minItems": 1,
|
|
"required": true,
|
|
"type": "list"
|
|
},
|
|
{
|
|
"default": 10,
|
|
"description": "How long to wait for each URL before giving up.",
|
|
"key": "timeout_seconds",
|
|
"label": "Request Timeout (seconds)",
|
|
"max": 60,
|
|
"min": 1,
|
|
"required": false,
|
|
"type": "number"
|
|
}
|
|
]
|
|
},
|
|
"contents": {
|
|
"agentsMd": true,
|
|
"config": 2,
|
|
"cron": 1,
|
|
"dashboard": true
|
|
},
|
|
"description": "A daily uptime check for a list of URLs you configure on install. Writes status to status-log.md and updates the dashboard with current counts.",
|
|
"detailSlug": "awizemann-site-status-checker",
|
|
"id": "awizemann/site-status-checker",
|
|
"installUrl": "https://raw.githubusercontent.com/awizemann/scarf/main/templates/awizemann/site-status-checker/site-status-checker.scarftemplate",
|
|
"minHermesVersion": "0.9.0",
|
|
"minScarfVersion": "2.3.0",
|
|
"name": "Site Status Checker",
|
|
"tags": [
|
|
"monitoring",
|
|
"uptime",
|
|
"cron",
|
|
"starter",
|
|
"configurable"
|
|
],
|
|
"version": "1.1.0"
|
|
}
|
|
]
|
|
}
|