Files
workinf_Blender_Wasm/tools/web/print-task-context.mjs
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

19 lines
1.1 KiB
JavaScript

import { buildTaskContext, compactTaskContext, contextSizeReport } from "./task-context-lib.mjs";
const index = process.argv.indexOf("--task");
const task = index >= 0 ? process.argv[index + 1] : undefined;
const bundle = buildTaskContext(task);
const report = contextSizeReport(bundle);
if (!report.withinBudget) {
// Never send an oversized task package to the caller. The compact command
// retains its nonzero exit for oversized source packages. Emit only the
// separately bounded pointer so the next read can resume the current task.
process.stderr.write(`task-context-over-budget task=${bundle.context.task} contentTokens=${report.totalTokens} envelopeTokens=${report.serializedContextTokens}/${report.reservedEnvelopeTokens} estimatedTokens=${report.estimatedContextTokens}\n`);
if (report.serializedContextTokens <= report.reservedEnvelopeTokens) {
process.stdout.write(JSON.stringify(compactTaskContext(bundle.context)) + "\n");
}
process.exitCode = 1;
} else {
process.stdout.write(`${JSON.stringify({ ...compactTaskContext(bundle.context), size: report }, null, 2)}\n`);
}