feat(cron): expose run receipts and modularize execution

Return committed trigger IDs and add CLI wait and trigger-specific logs while
preserving API, CLI, transaction, deduplication and unknown-result semantics.

Move scheduling, lifecycle, settlement, queries and legacy adapters into
back/cron; remove obsolete internal import paths and circular dependencies.

Apply project formatting across the repository, cover CJS/MJS in formatting
hooks, add prettier:check and require formatting checks in AGENTS.md.

Validation: backend build; 1398 backend/frontend tests passed (17 platform
skips); 327 CLI tests passed (6 platform skips); 670 files pass format checks.
This commit is contained in:
whyour committed 2026-11-22 12:24:29 +08:00
1 parent 77ece406ac
commit c5458596c8
346 files changed
+32133 -11556

No files matched your search

+25 -6
View File
@@ -9,19 +9,38 @@ const { installCliEntrypoints } = require('../../dist/local/entrypoints');
test('generated entries treat quotes, newlines and code-like paths as data', async (t) => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'ql-entry-paths-'));
t.after(() => fs.rm(root, { recursive: true, force: true }));
const cliRoot = path.join(root, "CLI '中文\n\");throw new Error('injected');//");
const cliRoot = path.join(
root,
"CLI '中文\n\");throw new Error('injected');//",
);
const bin = path.join(root, 'bin');
await fs.mkdir(path.join(cliRoot, 'dist'), { recursive: true });
await fs.writeFile(path.join(cliRoot, 'dist/ql.js'), 'exports.qlMain=async()=>{console.log(JSON.stringify(process.argv.slice(2)));return 7;};');
await fs.writeFile(path.join(cliRoot, 'dist/task.js'), 'exports.taskMain=async()=>{throw new Error("secret-value");};');
await fs.writeFile(
path.join(cliRoot, 'dist/ql.js'),
'exports.qlMain=async()=>{console.log(JSON.stringify(process.argv.slice(2)));return 7;};',
);
await fs.writeFile(
path.join(cliRoot, 'dist/task.js'),
'exports.taskMain=async()=>{throw new Error("secret-value");};',
);
await installCliEntrypoints(bin, cliRoot);
const ql = spawnSync(process.execPath, [path.join(bin, 'ql'), '--literal', 'value'], { encoding: 'utf8' });
const ql = spawnSync(
process.execPath,
[path.join(bin, 'ql'), '--literal', 'value'],
{ encoding: 'utf8' },
);
assert.equal(ql.status, 7, ql.stderr);
assert.deepEqual(JSON.parse(ql.stdout), ['--literal', 'value']);
for (const language of ['en', 'zh']) {
const result = spawnSync(process.execPath, [path.join(bin, 'task')], { encoding: 'utf8', env: { QL_LANG: language } });
const result = spawnSync(process.execPath, [path.join(bin, 'task')], {
encoding: 'utf8',
env: { QL_LANG: language },
});
assert.equal(result.status, 1);
assert.equal(result.stderr, language === 'en' ? 'CLI invocation failed.\n' : 'CLI 调用失败。\n');
assert.equal(
result.stderr,
language === 'en' ? 'CLI invocation failed.\n' : 'CLI 调用失败。\n',
);
assert.doesNotMatch(result.stderr, /secret-value/);
}
});