run402 4.82.0 → 4.84.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/cli.mjs +1 -1
- package/gitvault-surface.json +1 -1
- package/lib/deploy-v2.mjs +41 -71
- package/lib/doctor-source-scan.mjs +2 -547
- package/lib/doctor.mjs +28 -8
- package/lib/sdk-errors.mjs +7 -0
- package/lib/status.mjs +1 -1
- package/lib/up.mjs +62 -21
- package/lib/up.test.mjs +16 -0
- package/lib/update-check.mjs +11 -6
- package/lib/update-check.test.mjs +18 -5
- package/package.json +1 -1
- package/sdk/dist/actions.d.ts +16 -3
- package/sdk/dist/actions.d.ts.map +1 -1
- package/sdk/dist/config.d.ts +1 -1
- package/sdk/dist/config.d.ts.map +1 -1
- package/sdk/dist/config.js.map +1 -1
- package/sdk/dist/index.d.ts +2 -0
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +2 -0
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +2 -1
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +6 -0
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/edge-evidence.d.ts +22 -0
- package/sdk/dist/namespaces/edge-evidence.d.ts.map +1 -0
- package/sdk/dist/namespaces/edge-evidence.js +38 -0
- package/sdk/dist/namespaces/edge-evidence.js.map +1 -0
- package/sdk/dist/namespaces/projects.d.ts.map +1 -1
- package/sdk/dist/namespaces/projects.js +9 -7
- package/sdk/dist/namespaces/projects.js.map +1 -1
- package/sdk/dist/node/actions-node.d.ts +18 -0
- package/sdk/dist/node/actions-node.d.ts.map +1 -1
- package/sdk/dist/node/actions-node.js +139 -91
- package/sdk/dist/node/actions-node.js.map +1 -1
- package/sdk/dist/node/app-scope.d.ts +24 -0
- package/sdk/dist/node/app-scope.d.ts.map +1 -0
- package/sdk/dist/node/app-scope.js +47 -0
- package/sdk/dist/node/app-scope.js.map +1 -0
- package/sdk/dist/node/deploy-manifest.d.ts +6 -0
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +61 -0
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/node/index.d.ts +6 -1
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +8 -2
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/manifest-export.d.ts +5 -0
- package/sdk/dist/node/manifest-export.d.ts.map +1 -0
- package/sdk/dist/node/manifest-export.js +78 -0
- package/sdk/dist/node/manifest-export.js.map +1 -0
- package/sdk/dist/node/preflight.d.ts +65 -0
- package/sdk/dist/node/preflight.d.ts.map +1 -0
- package/sdk/dist/node/preflight.js +23 -0
- package/sdk/dist/node/preflight.js.map +1 -0
- package/sdk/dist/node/source-scan.d.ts +73 -0
- package/sdk/dist/node/source-scan.d.ts.map +1 -0
- package/sdk/dist/node/source-scan.js +552 -0
- package/sdk/dist/node/source-scan.js.map +1 -0
- package/sdk/dist/rest-diagnostics.d.ts +15 -0
- package/sdk/dist/rest-diagnostics.d.ts.map +1 -0
- package/sdk/dist/rest-diagnostics.js +19 -0
- package/sdk/dist/rest-diagnostics.js.map +1 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { relative, resolve } from "node:path";
|
|
2
|
+
import { LocalError } from "../errors.js";
|
|
3
|
+
export function manifestExportUnsupported(path, reason) {
|
|
4
|
+
throw new LocalError(`Cannot export ${path}: ${reason}`, "exporting authoring manifest", {
|
|
5
|
+
code: "MANIFEST_EXPORT_UNSUPPORTED", details: { field_paths: [path], reason },
|
|
6
|
+
next_actions: [{ type: "edit_manifest", why: "Use supported declarative release inputs, then retry --print-manifest. --print-spec is SDK-native inspection only." }],
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
/** Export relative to the original manifest directory, never the caller's cwd. */
|
|
10
|
+
export function serializeDeployManifest(loaded, baseDir, explicitProject) {
|
|
11
|
+
if (loaded.config?.env_accessed.length)
|
|
12
|
+
manifestExportUnsupported("config.env", "evaluated environment values may contain secrets; keep them in the trusted config");
|
|
13
|
+
const secrets = loaded.spec.secrets;
|
|
14
|
+
if (secrets && Object.keys(secrets).some((key) => !["require", "delete"].includes(key)))
|
|
15
|
+
manifestExportUnsupported("secrets", "embedded secret values are not exportable");
|
|
16
|
+
const aliases = { timeoutSeconds: "timeout_seconds", memoryMb: "memory_mb", contentType: "content_type", requireAuth: "require_auth", requireRole: "require_role", idColumn: "id_column", roleColumn: "role_column", cacheTtl: "cache_ttl", onDeny: "on_deny", signInPath: "sign_in_path", defaultLocale: "default_locale", unknownLocalePolicy: "unknown_locale_policy" };
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
function visit(value, path, content = false) {
|
|
19
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number")
|
|
20
|
+
return value;
|
|
21
|
+
if (value instanceof Uint8Array)
|
|
22
|
+
return { data: Buffer.from(value).toString("base64"), encoding: "base64" };
|
|
23
|
+
if (value instanceof ArrayBuffer)
|
|
24
|
+
return { data: Buffer.from(value).toString("base64"), encoding: "base64" };
|
|
25
|
+
if (typeof value !== "object" || value === undefined)
|
|
26
|
+
return manifestExportUnsupported(path, "executable or non-JSON value");
|
|
27
|
+
if (seen.has(value))
|
|
28
|
+
return manifestExportUnsupported(path, "cyclic object");
|
|
29
|
+
seen.add(value);
|
|
30
|
+
try {
|
|
31
|
+
if (Array.isArray(value))
|
|
32
|
+
return value.map((item, index) => visit(item, `${path}[${index}]`));
|
|
33
|
+
const record = value;
|
|
34
|
+
if (record.__source === "fs-file")
|
|
35
|
+
return { path: relative(baseDir, record.path).split("\\").join("/"), ...(record.contentType ? { content_type: record.contentType } : {}) };
|
|
36
|
+
if (record.__source === "local-dir")
|
|
37
|
+
return manifestExportUnsupported(path, "directory enumeration is dynamic; use explicit file entries for a reloadable JSON export");
|
|
38
|
+
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
|
|
39
|
+
return manifestExportUnsupported(path, "streams and runtime objects are not declarative JSON");
|
|
40
|
+
const isNamedMap = /^(functions\.(replace|patch\.set)|site\.(replace|patch\.put))$/.test(path) || path.endsWith(".files");
|
|
41
|
+
const schemaAliases = path === "i18n" || /^functions\.(?:replace|patch\.set)\.[^.]+(?:\.config|\.requireRole)?$/.test(path) || content;
|
|
42
|
+
const result = {};
|
|
43
|
+
for (const [key, child] of Object.entries(record)) {
|
|
44
|
+
if (child === undefined)
|
|
45
|
+
continue;
|
|
46
|
+
result[isNamedMap || !schemaAliases ? key : aliases[key] ?? key] = visit(child, path ? `${path}.${key}` : key, (isNamedMap && !path.startsWith("functions.")) || path.endsWith(".files") || (key === "source" && /^(functions|assets)\./.test(path)) || (key === "data" && content));
|
|
47
|
+
}
|
|
48
|
+
// ContentSource {data: Uint8Array} wraps bytes; its authoring encoding
|
|
49
|
+
// belongs alongside data, not in a second nested data wrapper.
|
|
50
|
+
if (record.data instanceof Uint8Array || record.data instanceof ArrayBuffer) {
|
|
51
|
+
Object.assign(result, visit(record.data, `${path}.data`));
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
seen.delete(value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const { project: _project, ...spec } = loaded.spec;
|
|
60
|
+
const result = visit(spec, "");
|
|
61
|
+
const project = explicitProject ?? loaded.manifest.project_id ?? loaded.manifest.project;
|
|
62
|
+
if (project)
|
|
63
|
+
result.project_id = project;
|
|
64
|
+
if (loaded.idempotencyKey)
|
|
65
|
+
result.idempotency_key = loaded.idempotencyKey;
|
|
66
|
+
if (loaded.verify)
|
|
67
|
+
result.verify = visit(loaded.verify, "verify");
|
|
68
|
+
const migrations = result.database?.migrations;
|
|
69
|
+
loaded.manifest.database?.migrations?.forEach((migration, index) => {
|
|
70
|
+
const path = migration.sql_path ?? migration.sql_file;
|
|
71
|
+
if (path && migrations?.[index]) {
|
|
72
|
+
delete migrations[index].sql;
|
|
73
|
+
migrations[index].sql_path = relative(baseDir, resolve(baseDir, path)).split("\\").join("/");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=manifest-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-export.js","sourceRoot":"","sources":["../../src/node/manifest-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,MAAc;IACpE,MAAM,IAAI,UAAU,CAAC,iBAAiB,IAAI,KAAK,MAAM,EAAE,EAAE,8BAA8B,EAAE;QACvF,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE;QAC7E,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,oHAAoH,EAAE,CAAC;KACrK,CAAC,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,uBAAuB,CAAC,MAAgC,EAAE,OAAe,EAAE,eAA+B;IACxH,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM;QAAE,yBAAyB,CAAC,YAAY,EAAE,mFAAmF,CAAC,CAAC;IACrK,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IACpC,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,C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C,OAAO,CAAC;IACzF,IAAI,OAAO;QAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC;IACzC,IAAI,MAAM,CAAC,cAAc;QAAE,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;IAC1E,IAAI,MAAM,CAAC,MAAM;QAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClE,MAAM,UAAU,GAAI,MAAM,CAAC,QAAmE,EAAE,UAAU,CAAC;IAC3G,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QACjE,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC;QACtD,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;YAC7B,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ReleaseSpec } from "../namespaces/deploy.types.js";
|
|
2
|
+
export interface LocalPreflightTarget {
|
|
3
|
+
project_id: string | null;
|
|
4
|
+
project_name: string | null;
|
|
5
|
+
source: "explicit" | "workspace_link" | "manifest" | "create" | "unresolved";
|
|
6
|
+
}
|
|
7
|
+
export declare function describeLocalPreflight(input: {
|
|
8
|
+
appRoot: string;
|
|
9
|
+
manifestPath: string | null;
|
|
10
|
+
spec?: Partial<ReleaseSpec>;
|
|
11
|
+
authoring?: unknown;
|
|
12
|
+
entryPoint?: "up" | "deploy apply";
|
|
13
|
+
target: LocalPreflightTarget;
|
|
14
|
+
buildDeferred?: boolean;
|
|
15
|
+
apiBase?: string;
|
|
16
|
+
profile?: string;
|
|
17
|
+
}): {
|
|
18
|
+
app_root: string;
|
|
19
|
+
manifest_path: string | null;
|
|
20
|
+
gateway_validated: false;
|
|
21
|
+
target: {
|
|
22
|
+
api_base: string | null;
|
|
23
|
+
profile: string | null;
|
|
24
|
+
project_id: string | null;
|
|
25
|
+
project_name: string | null;
|
|
26
|
+
source: "explicit" | "workspace_link" | "manifest" | "create" | "unresolved";
|
|
27
|
+
};
|
|
28
|
+
checks: ({
|
|
29
|
+
name: string;
|
|
30
|
+
status: string;
|
|
31
|
+
scope: string | null;
|
|
32
|
+
evidence_count: number;
|
|
33
|
+
} | {
|
|
34
|
+
reason?: string | undefined;
|
|
35
|
+
name: string;
|
|
36
|
+
status: string;
|
|
37
|
+
scope: string;
|
|
38
|
+
evidence_count: number;
|
|
39
|
+
})[];
|
|
40
|
+
warnings: (import("./source-scan.js").SourceScanFinding | {
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
pattern: string;
|
|
44
|
+
})[];
|
|
45
|
+
summary: {
|
|
46
|
+
file_references: number | null;
|
|
47
|
+
functions: number;
|
|
48
|
+
migrations: number;
|
|
49
|
+
routes: number;
|
|
50
|
+
};
|
|
51
|
+
next_actions: ({
|
|
52
|
+
why: string;
|
|
53
|
+
argv: string[];
|
|
54
|
+
type: string;
|
|
55
|
+
} | {
|
|
56
|
+
why: string;
|
|
57
|
+
sdk_call: string;
|
|
58
|
+
type: string;
|
|
59
|
+
})[] | {
|
|
60
|
+
type: string;
|
|
61
|
+
safe_to_auto_execute: boolean;
|
|
62
|
+
why: string;
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/node/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIjE,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;CAC9E;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC/F,UAAU,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC/H;;;;;;;oBARa,MAAM,GAAG,IAAI;sBACX,MAAM,GAAG,IAAI;gBACnB,UAAU,GAAG,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyB7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { collectLocalFileReferences, collectAuthoringFileReferences } from "./deploy-manifest.js";
|
|
2
|
+
import { scanDeploymentSources } from "./source-scan.js";
|
|
3
|
+
export function describeLocalPreflight(input) {
|
|
4
|
+
const spec = input.spec ?? {};
|
|
5
|
+
const refs = input.authoring ? collectAuthoringFileReferences(input.authoring, input.appRoot) : collectLocalFileReferences(spec);
|
|
6
|
+
const scan = scanDeploymentSources(spec, input.appRoot);
|
|
7
|
+
const warningRoutes = (spec.routes?.replace ?? []).filter((route) => route.target.type === "function" && spec.functions?.replace && !spec.functions.replace[route.target.name]);
|
|
8
|
+
const checks = [
|
|
9
|
+
{ name: "manifest", status: "passed", scope: input.manifestPath, evidence_count: 1 },
|
|
10
|
+
{ name: "target_agreement", status: "passed", scope: input.appRoot, evidence_count: input.target.project_id ? 1 : 0 },
|
|
11
|
+
{ name: "file_references", status: input.buildDeferred ? "deferred" : "passed", scope: input.appRoot, evidence_count: input.buildDeferred ? 0 : refs.length, ...(input.buildDeferred ? { reason: "Build commands may produce these files. No build was executed." } : {}) },
|
|
12
|
+
{ name: "source_scan", status: process.env.RUN402_DEPLOY_SKIP_SCAN === "1" ? "skipped" : "passed", scope: scan.scan_root, evidence_count: scan.checked_files, reason: process.env.RUN402_DEPLOY_SKIP_SCAN === "1" ? "Explicit RUN402_DEPLOY_SKIP_SCAN override." : "Selected application source and explicit file references; unrelated applications excluded." },
|
|
13
|
+
...["remote_policy", "quota", "cost", "secret_existence", "migration_registry", "content_presence", "base_release_drift"].map((name) => ({ name, status: "deferred", scope: "gateway", evidence_count: 0, reason: "Requires gateway --plan review." })),
|
|
14
|
+
];
|
|
15
|
+
return {
|
|
16
|
+
app_root: input.appRoot, manifest_path: input.manifestPath, gateway_validated: false,
|
|
17
|
+
target: { ...input.target, api_base: input.apiBase ?? null, profile: input.profile ?? null }, checks,
|
|
18
|
+
warnings: [...scan.findings.filter((finding) => finding.severity !== "error"), ...warningRoutes.map((route) => ({ code: "LOCAL_ROUTE_TARGET_UNDECLARED", message: "Route references a function absent from functions.replace; review this target.", pattern: route.pattern }))],
|
|
19
|
+
summary: { file_references: input.buildDeferred ? null : refs.length, functions: Object.keys(spec.functions?.replace ?? spec.functions?.patch?.set ?? {}).length, migrations: spec.database?.migrations?.length ?? 0, routes: spec.routes?.replace?.length ?? 0 },
|
|
20
|
+
next_actions: input.target.project_id ? [{ type: "review_plan", ...(input.manifestPath ? { argv: ["run402", ...(input.entryPoint === "deploy apply" ? ["deploy", "apply"] : ["up"]), "--manifest", input.manifestPath, "--project", input.target.project_id, "--plan"] } : { sdk_call: "project(project_id).apply.plan(spec)" }), why: "Review gateway-authoritative policy, cost and current state." }] : [{ type: "select_project", safe_to_auto_execute: false, why: input.target.source === "create" ? "Create intent is selected; the new project must exist before gateway plan review." : "Choose an existing project or an explicit new-project name before deploying." }],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/node/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAQzD,MAAM,UAAU,sBAAsB,CAAC,KAGtC;IACC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,8BAA8B,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACjI,MAAM,IAAI,GAAG,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAChL,MAAM,MAAM,GAAG;QACb,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ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E,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,sCAAsC,EAAE,CAAC,EAAE,GAAG,EAAE,8DAA8D,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,mFAAmF,CAAC,CAAC,CAAC,8EAA8E,EAAE,CAAC;KACnpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ReleaseSpec } from "../namespaces/deploy.types.js";
|
|
2
|
+
export interface SourceScanFinding {
|
|
3
|
+
code: string;
|
|
4
|
+
severity: string;
|
|
5
|
+
file: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
message: string;
|
|
8
|
+
canonical_name?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface ScanOptions {
|
|
12
|
+
excludeFiles?: Set<string>;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
filePath?: string;
|
|
15
|
+
declaredCapabilities?: Set<string> | string[];
|
|
16
|
+
}
|
|
17
|
+
/** Severity ladder for scanner findings. `error` blocks deploy; `warn`
|
|
18
|
+
* reports but doesn't block. The `run402 doctor` exit code is non-zero
|
|
19
|
+
* whenever any `error`-severity finding is present. */
|
|
20
|
+
export declare const SCAN_SEVERITY: Readonly<{
|
|
21
|
+
ERROR: "error";
|
|
22
|
+
WARN: "warn";
|
|
23
|
+
}>;
|
|
24
|
+
/** Scan a single file's content. Returns the array of findings (zero
|
|
25
|
+
* or more). Pure / no I/O — tests pass strings directly. */
|
|
26
|
+
export declare function scanFileContent(content: string, opts?: ScanOptions): SourceScanFinding[];
|
|
27
|
+
/** Recursively walk `srcDir` and scan every file with a relevant
|
|
28
|
+
* extension. Returns the combined findings list, sorted by file +
|
|
29
|
+
* line for stable output. */
|
|
30
|
+
export declare function scanSourceTree(srcDir: string, opts?: ScanOptions): SourceScanFinding[];
|
|
31
|
+
/** Scan an explicit list of on-disk file paths — no directory walk.
|
|
32
|
+
* Used by `run402 deploy apply` for manifest/spec/stdin deploys, where
|
|
33
|
+
* the artifact is exactly the set of files the manifest references, NOT
|
|
34
|
+
* whatever happens to live under cwd/src. Files without a
|
|
35
|
+
* scannable extension are ignored; unreadable files become a WARN
|
|
36
|
+
* finding (never throw). Returns the combined findings list, sorted by
|
|
37
|
+
* file + line for stable output, exactly like `scanSourceTree`. */
|
|
38
|
+
export declare function scanSourceFiles(filePaths: string[], opts?: ScanOptions): SourceScanFinding[];
|
|
39
|
+
/** Convenience for tests: synchronous, no FS access. */
|
|
40
|
+
export declare function _testOnly_hallucinatedNames(): {
|
|
41
|
+
name: string;
|
|
42
|
+
canonical: string;
|
|
43
|
+
origin: string;
|
|
44
|
+
}[];
|
|
45
|
+
export declare function _testOnly_authProperties(): {
|
|
46
|
+
name: string;
|
|
47
|
+
canonical: string;
|
|
48
|
+
}[];
|
|
49
|
+
/** Read the union of `capabilities` declared across all function entries in
|
|
50
|
+
* `run402.config.json` (the apply spec). Used by the tenant-assertion mint
|
|
51
|
+
* check (#8) to suppress the warning when "auth.sessionMint" is declared.
|
|
52
|
+
*
|
|
53
|
+
* Functions live under `functions.replace.<name>` / `functions.set.<name>`
|
|
54
|
+
* with `capabilities?: string[]` as a sibling to `config`. Best-effort:
|
|
55
|
+
* a missing or malformed config returns an empty set (the scanner then
|
|
56
|
+
* warns, which is the safe default — the runtime gate is the hard
|
|
57
|
+
* enforcement). Returns a `Set<string>`. */
|
|
58
|
+
export declare function readDeclaredCapabilities(cwd?: string): Set<string>;
|
|
59
|
+
/** Resolve the project's src/ directory. Astro convention is `<root>/src`;
|
|
60
|
+
* bare Node projects use `<root>/src` or `<root>`. We prefer `src/` if
|
|
61
|
+
* it exists. */
|
|
62
|
+
export declare function resolveScanRoot(cwd?: string): string;
|
|
63
|
+
/** The same selected-app scope gates up/apply and is reported by doctor. */
|
|
64
|
+
export declare function scanDeploymentSources(spec: Partial<ReleaseSpec>, appRoot: string, sourceRoot?: string): {
|
|
65
|
+
app_root: string;
|
|
66
|
+
scan_root: string;
|
|
67
|
+
checked_files: number;
|
|
68
|
+
explicit_references: number;
|
|
69
|
+
findings: SourceScanFinding[];
|
|
70
|
+
errors: SourceScanFinding[];
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=source-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-scan.d.ts","sourceRoot":"","sources":["../../src/node/source-scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAAE;AACrK,UAAU,WAAW;IAAG,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC;CAAE;AAsCrI;;wDAE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