All hardcoded 'clawdie' references in production code now derive from AGENT_NAME (default: 'clawdie'). This makes the mevy canary strategy reliable — changing AGENT_NAME is all that's needed. Changes: - Hardcoded paths: CMS_WEBROOT, ASTRO_SITE_PATH, verify checks, controlplane dashboard dir, sessions dir, output dir, chown user - Prometheus metrics: prefixed with AGENT_NAME for multi-install dashboards - hostd log strings: use AGENT_NAME instead of 'clawdie-hostd' - MCP server name: derived from AGENT_NAME - Skill modify patches: container image and mount allowlist use AGENT_NAME - SQL migration file renamed: clawdie-brain-hybrid-upgrade → brain-hybrid-upgrade - Temp dir prefixes: all use AGENT_NAME Kept as-is (correct pattern): - 'clawdie' as default fallback when AGENT_NAME is unset - .pi/extensions/clawdie-harness/ directory (pi package identity) - html/docs-clawdie-si/ (public docs site URL) --- Build: pass | Tests: pass — 1527 passed, 3 failed (2 files, pre-existing)
60 lines
2 KiB
TypeScript
60 lines
2 KiB
TypeScript
/**
|
|
* Fetch NanoClaw upstream changes without merging.
|
|
* Safe to run on a cron — read-only git operation.
|
|
*
|
|
* Usage:
|
|
* npx tsx scripts/fetch-upstream.ts
|
|
*
|
|
* Output: prints divergence summary (commits in nanoclaw/main not in HEAD)
|
|
*
|
|
* Typical cron (weekly, run as agent user):
|
|
* 0 3 * * 1 cd /home/<agent>/<agent>-ai && npx tsx scripts/fetch-upstream.ts >> logs/upstream.log 2>&1
|
|
*/
|
|
import { formatDisplayDate } from '../src/display-date.js';
|
|
import { classificationHint } from '../src/upstream/classify.js';
|
|
import {
|
|
fetchRemote,
|
|
getUpstreamConfig,
|
|
readEnvFlag,
|
|
remoteExists,
|
|
} from '../src/upstream/git.js';
|
|
import { getUpstreamStatus } from '../src/upstream/status.js';
|
|
|
|
function main(): void {
|
|
const config = getUpstreamConfig({ repoDir: process.cwd() });
|
|
|
|
if (!readEnvFlag(config.repoDir, 'NANOCLAW_UPSTREAM_ENABLED')) {
|
|
console.log('NANOCLAW_UPSTREAM_ENABLED=false — skipping fetch');
|
|
process.exit(0);
|
|
}
|
|
|
|
if (!remoteExists(config.repoDir, config.remoteName)) {
|
|
console.error(`Remote '${config.remoteName}' not configured. Run: npx tsx setup/index.ts --step upstream --enable`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const timestamp = formatDisplayDate(new Date());
|
|
console.log(`[${timestamp}] Fetching ${config.remoteName}/${config.branch}...`);
|
|
|
|
fetchRemote(config.repoDir, config.remoteName);
|
|
|
|
const status = getUpstreamStatus(config);
|
|
|
|
if (status.aheadCount === 0) {
|
|
const behindText = status.behindCount > 0
|
|
? ` (${status.behindCount} local commit(s) ahead of upstream)`
|
|
: '';
|
|
console.log(`✓ Up to date with NanoClaw upstream${behindText}`);
|
|
} else {
|
|
console.log(`! ${status.aheadCount} upstream commit(s) available:`);
|
|
for (const commit of status.commits) {
|
|
console.log(`${commit.hash.slice(0, 7)} ${commit.subject}`);
|
|
console.log(` ${commit.classification}: ${classificationHint(commit.classification)}`);
|
|
}
|
|
if (status.behindCount > 0) {
|
|
console.log(` (${status.behindCount} local commit(s) ahead of upstream)`);
|
|
}
|
|
}
|
|
}
|
|
|
|
main();
|