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

+22 -8
View File
@@ -9,22 +9,36 @@ const artifacts = require('../../cli/src/internal/maintenance/upgradeArtifacts.c
const { installBundle } = require('../../shell/install-bundle.cjs');
test('offline environment loading treats installation paths as data and preserves the caller directory', async (t) => {
const directory = await fs.mkdtemp(path.join(require('node:os').tmpdir(), 'ql-offline-path-'));
const directory = await fs.mkdtemp(
path.join(require('node:os').tmpdir(), 'ql-offline-path-'),
);
t.after(() => fs.rm(directory, { recursive: true, force: true }));
const root = path.join(directory, 'panel space \' " $(echo injected) `echo injected`;');
const root = path.join(
directory,
'panel space \' " $(echo injected) `echo injected`;',
);
await fs.mkdir(path.join(root, 'shell'), { recursive: true });
await fs.writeFile(path.join(root, 'shell/share.sh'), 'import_config() { ql_port=5789; ql_base_url=/panel/; }\n');
await fs.writeFile(path.join(root, 'shell/env.sh'), 'export QL_BRANCH=develop\n');
await fs.writeFile(
path.join(root, 'shell/share.sh'),
'import_config() { ql_port=5789; ql_base_url=/panel/; }\n',
);
await fs.writeFile(
path.join(root, 'shell/env.sh'),
'export QL_BRANCH=develop\n',
);
const cwd = process.cwd();
let captured;
t.mock.method(artifacts, 'stageUpgrade', async ({ env }) => {
captured = env;
throw new Error('reached staging');
});
await assert.rejects(installBundle(
['--file', path.join(root, 'unused.tar.gz'), '--download-only'],
{ ...process.env, QL_DIR: root },
), /reached staging/);
await assert.rejects(
installBundle(
['--file', path.join(root, 'unused.tar.gz'), '--download-only'],
{ ...process.env, QL_DIR: root },
),
/reached staging/,
);
assert.equal(captured.QL_DIR, root);
assert.equal(captured.QlPort, '5789');
assert.equal(captured.QlBaseUrl, '/panel/');