@deksden-com/dd-flow-cli 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +10 -3
- package/dist/build-info.json +5 -5
- package/dist/cli/help.js +24 -11
- package/dist/cli/run-cli.js +117 -28
- package/dist/domain/flow-contract.js +15 -4
- package/dist/domain/session-coverage.js +88 -0
- package/dist/runtime/context.js +8 -2
- package/dist/schemas/code-stage-report.schema.json +7 -2
- package/dist/schemas/engine-manifest.schema.json +22 -0
- package/dist/schemas/flow-contract.schema.json +15 -13
- package/dist/schemas/flow-run.schema.json +1 -0
- package/dist/schemas/mb-upgrade-migration-report.schema.json +3 -1
- package/dist/schemas/merge-stage-report-legacy-0.4.2.schema.json +24 -0
- package/dist/schemas/run-engine-binding.schema.json +37 -0
- package/dist/schemas/stage-prompt.schema.json +9 -5
- package/dist/schemas/stage-start-response.schema.json +6 -5
- package/dist/services/canon.js +15 -1
- package/dist/services/cleanup.js +77 -0
- package/dist/services/cli-operation-classifier.js +52 -8
- package/dist/services/compatibility-preflight.js +1 -1
- package/dist/services/dashboard.js +2 -2
- package/dist/services/engines.js +408 -30
- package/dist/services/hooks.js +28 -15
- package/dist/services/lanes.js +0 -4
- package/dist/services/merge-queue.js +48 -0
- package/dist/services/merge-worker.js +3 -4
- package/dist/services/migrations.js +307 -44
- package/dist/services/plan-runtime.js +4 -4
- package/dist/services/plans.js +5 -3
- package/dist/services/protocols.js +23 -2
- package/dist/services/run-engine-bindings.js +157 -0
- package/dist/services/run-projection.js +18 -4
- package/dist/services/runs.js +54 -7
- package/dist/services/schema-validation.js +96 -0
- package/dist/services/sessions.js +33 -73
- package/dist/services/stage-lifecycle.js +298 -45
- package/dist/services/status.js +8 -3
- package/dist/storage/database.js +32 -11
- package/package.json +1 -1
package/dist/services/status.js
CHANGED
|
@@ -9,7 +9,7 @@ import { getProjectVersionStatus, resolveStatusProjectRoot } from "./version-sta
|
|
|
9
9
|
import { findProjectByRoot } from "./projects.js";
|
|
10
10
|
import { classifyCliOperation } from "./cli-operation-classifier.js";
|
|
11
11
|
import { compatibilityReport } from "./compatibility-preflight.js";
|
|
12
|
-
import { selectEngine } from "./engines.js";
|
|
12
|
+
import { compatibilityContexts, selectEngine } from "./engines.js";
|
|
13
13
|
export function getRuntimeStatus(context, input = {}) {
|
|
14
14
|
const cwd = process.cwd();
|
|
15
15
|
const projectRootResolution = resolveStatusProjectRoot({ requestedRoot: input.projectRoot, cwd });
|
|
@@ -26,9 +26,13 @@ export function getRuntimeStatus(context, input = {}) {
|
|
|
26
26
|
const cli = getCliBuildInfo();
|
|
27
27
|
const compatibilityManifest = resolvedCanonForProject ? readCompatibilityManifest(canon) : null;
|
|
28
28
|
const cliCompatibility = cliCompatibilityVerdict(cli, compatibilityManifest);
|
|
29
|
-
const
|
|
29
|
+
const classification = classifyCliOperation(["status"], context.env);
|
|
30
|
+
const engineSelection = projectRoot
|
|
31
|
+
? selectEngine(context, { projectRoot, env: context.env }, { allowCurrentInProcess: true }, classification)
|
|
32
|
+
: null;
|
|
30
33
|
const flowContract = projectRoot ? projectFlowContractStatus(projectRoot) : null;
|
|
31
34
|
const registry = input.checkRegistry ? checkNpmRegistry(context, cli.package_name) : undefined;
|
|
35
|
+
const contexts = projectRoot ? compatibilityContexts(context, { projectRoot, env: context.env, classification }) : null;
|
|
32
36
|
return {
|
|
33
37
|
ok: true,
|
|
34
38
|
schema_id: "dd-flow/status-report@1",
|
|
@@ -54,7 +58,8 @@ export function getRuntimeStatus(context, input = {}) {
|
|
|
54
58
|
engine: engineSelection
|
|
55
59
|
? {
|
|
56
60
|
selection: engineSelection,
|
|
57
|
-
compatibility: compatibilityReport(engineSelection,
|
|
61
|
+
compatibility: compatibilityReport(engineSelection, classification),
|
|
62
|
+
contexts
|
|
58
63
|
}
|
|
59
64
|
: null,
|
|
60
65
|
canon: {
|
package/dist/storage/database.js
CHANGED
|
@@ -5,27 +5,48 @@ import { ensureDir } from "./paths.js";
|
|
|
5
5
|
import { AppError } from "../shared/errors.js";
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
7
|
const { DatabaseSync } = require("node:sqlite");
|
|
8
|
-
export function getDatabase(ddFlowHome) {
|
|
9
|
-
ensureDir(ddFlowHome);
|
|
8
|
+
export function getDatabase(ddFlowHome, mode = "initialize") {
|
|
10
9
|
const dbPath = path.join(ddFlowHome, "db.sqlite");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const exists = fs.existsSync(dbPath);
|
|
11
|
+
if (mode === "read_existing" && !exists) {
|
|
12
|
+
return emptyReadOnlyDatabase(dbPath);
|
|
13
|
+
}
|
|
14
|
+
if (!exists || mode === "migrate")
|
|
15
|
+
ensureDir(ddFlowHome);
|
|
16
|
+
const db = mode === "read_existing" ? new DatabaseSync(dbPath, { readOnly: true }) : new DatabaseSync(dbPath);
|
|
17
|
+
configureDatabase(db, mode);
|
|
18
|
+
// Existing storage is never schema-migrated by an ordinary initialize open.
|
|
19
|
+
// Only the explicit migrate handle is allowed to execute DDL on it.
|
|
20
|
+
if (!exists || mode === "migrate")
|
|
21
|
+
migrate(db);
|
|
22
|
+
if (mode === "read_existing")
|
|
23
|
+
db.exec("PRAGMA query_only = ON");
|
|
14
24
|
db.exec("PRAGMA foreign_keys = ON");
|
|
15
25
|
return {
|
|
16
26
|
path: dbPath,
|
|
27
|
+
writable: mode !== "read_existing",
|
|
17
28
|
exec: (sql) => db.exec(sql),
|
|
18
29
|
run: (sql, params = []) => db.prepare(sql).run(...params),
|
|
19
30
|
get: (sql, params = []) => db.prepare(sql).get(...params),
|
|
20
31
|
all: (sql, params = []) => db.prepare(sql).all(...params)
|
|
21
32
|
};
|
|
22
33
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
function emptyReadOnlyDatabase(dbPath) {
|
|
35
|
+
return {
|
|
36
|
+
path: dbPath,
|
|
37
|
+
writable: false,
|
|
38
|
+
exec: () => { throw new AppError("read_only_storage", "Read-only access cannot write absent dd-flow storage", 1, { path: dbPath }); },
|
|
39
|
+
run: () => { throw new AppError("read_only_storage", "Read-only access cannot write absent dd-flow storage", 1, { path: dbPath }); },
|
|
40
|
+
get: () => undefined,
|
|
41
|
+
all: () => []
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function configureDatabase(db, mode) {
|
|
45
|
+
db.exec("PRAGMA busy_timeout = 4000");
|
|
46
|
+
if (mode !== "read_existing") {
|
|
47
|
+
db.exec("PRAGMA journal_mode = WAL");
|
|
48
|
+
db.exec("PRAGMA synchronous = NORMAL");
|
|
49
|
+
}
|
|
29
50
|
}
|
|
30
51
|
function migrate(db) {
|
|
31
52
|
db.exec(`
|