mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-28 09:02:12 +08:00
* feat(cli): add unified Commander CLI for QingLong 2.x * fix(cli): publish via npm and address security review feedback * ci(cli): package npm artifacts and remove evaluation collateral * test(cli): use a fixed shell fixture for log retention * refactor(cli): separate remote npm client from panel tools * feat(cli): cover active panel OpenAPI resources * docs(cli): unify authentication and skill guidance * refactor(cli): isolate internal commands and generate Commander help * refactor(cli): organize remote and internal modules by responsibility * ci(cli): publish verified npm archives from master * fix(cli): publish under the whyour npm scope * ci: use npm trusted publishing for both packages * docs: introduce the published CLI on the project homepage * fix(cli): preserve server log truncation and correct login hints * fix(cli): accept dashboard record request bodies * fix(cli): preserve stdin for local task execution * fix(cli): resolve task executables after changing directory * fix(cli): preserve shell function tasks and sanitize test failures * fix(cli): preserve shell hook state and resolve workdir after hooks * fix(cli): preserve cleanup across shared shell task timeouts * fix(cli): isolate shell control descriptors and reap timed-out descendants
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
// Used only after start --no-startup in a disposable container without its old entrypoint.
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
assert.equal(process.env.QL_PANEL_INTEGRATION, '1');
|
|
(async () => {
|
|
const result = JSON.parse(fs.readFileSync('/tmp/start-result.json', 'utf8'));
|
|
assert.equal(result.code, 200);
|
|
assert.equal(result.data.mode, 'install');
|
|
assert.equal(result.data.startup, 'skipped');
|
|
assert.equal(result.data.service.manager, 'pm2');
|
|
const response = await fetch('http://127.0.0.1:5700/api/system', {
|
|
signal: AbortSignal.timeout(5000),
|
|
});
|
|
const system = await response.json();
|
|
assert.equal(system.code, 200);
|
|
assert.equal(system.data.isInitialized, false);
|
|
const html = await (
|
|
await fetch('http://127.0.0.1:5700/', { signal: AbortSignal.timeout(5000) })
|
|
).text();
|
|
assert.match(html, /<div\s+id=["']root["']/);
|
|
const saved = JSON.parse(fs.readFileSync('/root/.pm2/dump.pm2', 'utf8'));
|
|
assert.ok(saved.some((app) => app.name === 'qinglong'));
|
|
for (const file of ['config.sh', 'task_before.sh', 'task_after.sh'])
|
|
assert.ok(fs.existsSync(`/ql/data/config/${file}`));
|
|
console.log(
|
|
JSON.stringify({
|
|
install: true,
|
|
startupRegistration: result.data.startup,
|
|
healthy: true,
|
|
initialized: false,
|
|
pm2StateSaved: true,
|
|
configurationPrepared: true,
|
|
}),
|
|
);
|
|
})().catch((error) => {
|
|
console.error(error.message);
|
|
process.exitCode = 1;
|
|
});
|