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

+31 -11
View File
@@ -8,22 +8,42 @@ const { openOperations } = require('../../dist/remote/api/openOperations');
test('body-consuming backend routes expose a CLI request body or upload', () => {
const root = path.resolve(__dirname, '../../../back/api');
let checked = 0;
for (const filename of fs.readdirSync(root).filter(name => name.endsWith('.ts'))) {
for (const filename of fs
.readdirSync(root)
.filter((name) => name.endsWith('.ts'))) {
const text = fs.readFileSync(path.join(root, filename), 'utf8');
const mount = text.match(/app\.use\(['"]([^'"]+)/)?.[1];
if (!mount) continue;
const source = ts.createSourceFile(filename, text, ts.ScriptTarget.Latest, true);
const visit = node => {
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)
&& node.expression.expression.getText(source) === 'route'
&& ['post', 'put', 'delete'].includes(node.expression.name.text)
&& node.arguments[0] && ts.isStringLiteral(node.arguments[0])
&& /\breq\.body\b/.test(node.getText(source))) {
const endpoint = [mount, node.arguments[0].text].join('/').split('/').filter(Boolean).join('/');
const source = ts.createSourceFile(
filename,
text,
ts.ScriptTarget.Latest,
true,
);
const visit = (node) => {
if (
ts.isCallExpression(node) &&
ts.isPropertyAccessExpression(node.expression) &&
node.expression.expression.getText(source) === 'route' &&
['post', 'put', 'delete'].includes(node.expression.name.text) &&
node.arguments[0] &&
ts.isStringLiteral(node.arguments[0]) &&
/\breq\.body\b/.test(node.getText(source))
) {
const endpoint = [mount, node.arguments[0].text]
.join('/')
.split('/')
.filter(Boolean)
.join('/');
const method = node.expression.name.text.toUpperCase();
const operation = openOperations.find(item => item.method === method && item.path === endpoint);
const operation = openOperations.find(
(item) => item.method === method && item.path === endpoint,
);
assert.ok(operation, `${method} ${endpoint} is missing`);
assert.ok(operation.body || operation.upload, `${operation.name} cannot provide req.body`);
assert.ok(
operation.body || operation.upload,
`${operation.name} cannot provide req.body`,
);
checked++;
}
ts.forEachChild(node, visit);