Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(usage): use the shared CLI invocation guard

[._.]/ Adam Eivy4cfd4151ad60
diff --git a/scripts/backfill-codex-image-usage.js b/scripts/backfill-codex-image-usage.js
index 80a523cdf7..9daf438ead 100644
--- a/scripts/backfill-codex-image-usage.js
+++ b/scripts/backfill-codex-image-usage.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
-import { pathToFileURL } from 'node:url';
+import { isDirectlyInvoked } from './lib/directInvocation.js';
import { publishAccountingFile } from '../server/services/imageRenderUsage.js';
import { planImageRenderBackfill, applyImageRenderBackfill } from '../server/services/imageRenderBackfill.js';
@@ -24,7 +24,7 @@ export async function main(args) {
return { dryRun: true, inventoryHash: plan.inventoryHash, coverage: plan.coverage, unknown: plan.unknown };
}
-if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
+if (isDirectlyInvoked(import.meta.url)) {
main(process.argv.slice(2)).then(result => console.log(JSON.stringify(result, null, 2))).catch(err => {
console.error(`❌ Codex image usage backfill failed: ${err.message}`);
process.exitCode = 1;