@jini-ai/devops 0.3.3 → 0.5.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +65 -5
  3. package/dist/agent-jobs/entry.d.ts +4 -0
  4. package/dist/agent-jobs/entry.js +4 -0
  5. package/dist/agent-jobs/jobs.d.ts +25 -0
  6. package/dist/agent-jobs/jobs.js +115 -0
  7. package/dist/agent-jobs/node.d.ts +12 -0
  8. package/dist/agent-jobs/node.js +53 -0
  9. package/dist/agent-jobs/ports.d.ts +69 -0
  10. package/dist/agent-jobs/ports.js +2 -0
  11. package/dist/checks/coverage/diff.d.ts +57 -0
  12. package/dist/checks/coverage/diff.js +48 -0
  13. package/dist/checks/coverage/disk.d.ts +65 -0
  14. package/dist/checks/coverage/disk.js +136 -0
  15. package/dist/checks/coverage/floors.d.ts +31 -0
  16. package/dist/checks/coverage/floors.js +24 -0
  17. package/dist/checks/coverage/index.d.ts +7 -0
  18. package/dist/checks/coverage/index.js +6 -0
  19. package/dist/checks/coverage/integrity.d.ts +79 -0
  20. package/dist/checks/coverage/integrity.js +140 -0
  21. package/dist/checks/coverage/lcov.d.ts +65 -0
  22. package/dist/checks/coverage/lcov.js +64 -0
  23. package/dist/checks/node.d.ts +19 -0
  24. package/dist/checks/node.js +40 -0
  25. package/dist/checks/ports.d.ts +67 -0
  26. package/dist/checks/ports.js +2 -0
  27. package/dist/checks/published-types/index.d.ts +77 -0
  28. package/dist/checks/published-types/index.js +186 -0
  29. package/dist/deploy/host-kit.d.ts +27 -10
  30. package/dist/deploy/index.d.ts +0 -4
  31. package/dist/deploy/index.js +0 -4
  32. package/dist/deploy/naming.d.ts +9 -6
  33. package/dist/deploy/naming.js +5 -7
  34. package/dist/deploy/node.d.ts +18 -0
  35. package/dist/deploy/node.js +57 -0
  36. package/dist/deploy/reachability.d.ts +47 -18
  37. package/dist/deploy/reachability.js +77 -71
  38. package/dist/deploy/redirect-guard.d.ts +15 -11
  39. package/dist/deploy/redirect-guard.js +11 -12
  40. package/dist/deploy/tokens.d.ts +17 -14
  41. package/dist/deploy/tokens.js +16 -16
  42. package/dist/deploy/tool.d.ts +12 -8
  43. package/dist/deploy/tool.js +9 -10
  44. package/dist/deploy/types.d.ts +27 -15
  45. package/dist/deploy/types.js +3 -3
  46. package/dist/index.d.ts +2 -1
  47. package/dist/index.js +2 -1
  48. package/dist/local-dev/index.d.ts +34 -0
  49. package/dist/local-dev/index.js +37 -0
  50. package/dist/packaging/electron/archive.d.ts +41 -0
  51. package/dist/packaging/electron/archive.js +77 -0
  52. package/dist/packaging/electron/asar-adapter.d.ts +13 -0
  53. package/dist/packaging/electron/asar-adapter.js +5 -0
  54. package/dist/packaging/electron/entry.d.ts +9 -0
  55. package/dist/packaging/electron/entry.js +9 -0
  56. package/dist/packaging/electron/imports.d.ts +13 -0
  57. package/dist/packaging/electron/imports.js +44 -0
  58. package/dist/packaging/electron/node.d.ts +8 -0
  59. package/dist/packaging/electron/node.js +51 -0
  60. package/dist/packaging/electron/policies.d.ts +64 -0
  61. package/dist/packaging/electron/policies.js +63 -0
  62. package/dist/packaging/electron/ports.d.ts +113 -0
  63. package/dist/packaging/electron/ports.js +2 -0
  64. package/dist/packaging/electron/stability.d.ts +9 -0
  65. package/dist/packaging/electron/stability.js +12 -0
  66. package/dist/packaging/electron/staging.d.ts +108 -0
  67. package/dist/packaging/electron/staging.js +249 -0
  68. package/dist/packaging/electron/typescript.d.ts +7 -0
  69. package/dist/packaging/electron/typescript.js +18 -0
  70. package/dist/source-control/commit.d.ts +11 -0
  71. package/dist/source-control/commit.js +71 -0
  72. package/dist/source-control/contracts.d.ts +327 -0
  73. package/dist/source-control/contracts.js +2 -0
  74. package/dist/source-control/entry.d.ts +6 -0
  75. package/dist/source-control/entry.js +6 -0
  76. package/dist/source-control/kit.d.ts +15 -0
  77. package/dist/source-control/kit.js +17 -0
  78. package/dist/source-control/registry.d.ts +100 -0
  79. package/dist/source-control/registry.js +174 -0
  80. package/dist/source-control/repository-target.d.ts +13 -0
  81. package/dist/source-control/repository-target.js +28 -0
  82. package/dist/static-export/contracts.d.ts +138 -0
  83. package/dist/static-export/contracts.js +5 -0
  84. package/dist/static-export/entry.d.ts +6 -0
  85. package/dist/static-export/entry.js +6 -0
  86. package/dist/static-export/failure-summary.d.ts +12 -0
  87. package/dist/static-export/failure-summary.js +12 -0
  88. package/dist/static-export/fetch-adapter.d.ts +6 -0
  89. package/dist/static-export/fetch-adapter.js +5 -0
  90. package/dist/static-export/node-adapters.d.ts +11 -0
  91. package/dist/static-export/node-adapters.js +111 -0
  92. package/dist/static-export/runner.d.ts +6 -0
  93. package/dist/static-export/runner.js +135 -0
  94. package/dist/static-export/transforms.d.ts +53 -0
  95. package/dist/static-export/transforms.js +154 -0
  96. package/package.json +82 -5
  97. package/dist/deploy/cloudflare-pages.d.ts +0 -105
  98. package/dist/deploy/cloudflare-pages.js +0 -943
  99. package/dist/deploy/github-pages.d.ts +0 -62
  100. package/dist/deploy/github-pages.js +0 -373
  101. package/dist/deploy/netlify.d.ts +0 -40
  102. package/dist/deploy/netlify.js +0 -299
  103. package/dist/deploy/vercel.d.ts +0 -56
  104. package/dist/deploy/vercel.js +0 -258
@@ -0,0 +1,40 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ /** Explicit Node filesystem adapter. Temporary parents must already exist. */
5
+ export function createNodeFilesystem(_args) {
6
+ return {
7
+ exists: ({ path: file }) => existsSync(file),
8
+ isSymbolicLink: ({ path: file }) => lstatSync(file).isSymbolicLink(),
9
+ readText: ({ path: file }) => readFileSync(file, 'utf8'),
10
+ readDirectory: ({ path: dir }) => readdirSync(dir),
11
+ writeText: ({ path: file, text }) => { writeFileSync(file, text); },
12
+ createTempDirectory: ({ parent, prefix }) => mkdtempSync(path.join(parent, prefix)),
13
+ createDirectory: ({ path: dir }) => { mkdirSync(dir); },
14
+ ensureDirectory: ({ path: dir }) => { mkdirSync(dir, { recursive: true }); },
15
+ copyDirectory: ({ source, destination }) => { cpSync(source, destination, { recursive: true, force: false, errorOnExist: true }); },
16
+ removeDirectory: ({ path: dir }) => { rmSync(dir, { recursive: true, force: true }); },
17
+ };
18
+ }
19
+ /** Uses Node's environment precedence: exported variables win over file values. Requires Node 20.12+. */
20
+ export function createNodeEnvLoader(_args) {
21
+ return { load: ({ path: file }) => { process.loadEnvFile(file); } };
22
+ }
23
+ /** Shell-free runner; captures compiler output and reports signals/spawn failures as null exits. */
24
+ export function createNodeProcessRunner(_args, { maxBuffer = 32 * 1024 * 1024, timeoutMs = 300_000 } = {}) {
25
+ return {
26
+ run: ({ command, args, cwd }) => new Promise((resolve) => {
27
+ execFile(command, [...args], { cwd, encoding: 'utf8', maxBuffer, timeout: timeoutMs }, (error, stdout, stderr) => {
28
+ const exitCode = error ? (typeof error.code === 'number' ? error.code : null) : 0;
29
+ resolve({ exitCode, stdout, stderr: stderr || error?.message || '' });
30
+ });
31
+ }),
32
+ };
33
+ }
34
+ /** Optional npm executable adapter. The caller explicitly selects the executable and runner. */
35
+ export function createNpmInstaller({ runner, command }, { args = [
36
+ 'install', '--no-audit', '--no-fund', '--no-package-lock', '--workspaces=false', '--ignore-scripts',
37
+ ] } = {}) {
38
+ return { install: ({ directory }) => runner.run({ command, args, cwd: directory }) };
39
+ }
40
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1,67 @@
1
+ /** A shell-free executable request. Paths and executables belong to the host. */
2
+ export interface ProcessRequest {
3
+ readonly command: string;
4
+ readonly args: readonly string[];
5
+ readonly cwd: string;
6
+ }
7
+ /** Null means the executable could not complete, including signals and spawn failures. */
8
+ export interface ProcessResult {
9
+ readonly exitCode: number | null;
10
+ readonly stdout: string;
11
+ readonly stderr: string;
12
+ }
13
+ export interface ProcessRunnerPort {
14
+ run(args: ProcessRequest): Promise<ProcessResult>;
15
+ }
16
+ export interface SourceReaderPort {
17
+ readText(args: {
18
+ path: string;
19
+ }): string;
20
+ }
21
+ /** Synchronous filesystem operations; createDirectory must fail when the path already exists. */
22
+ export interface FilesystemPort extends SourceReaderPort {
23
+ exists(args: {
24
+ path: string;
25
+ }): boolean;
26
+ isSymbolicLink(args: {
27
+ path: string;
28
+ }): boolean;
29
+ readDirectory(args: {
30
+ path: string;
31
+ }): readonly string[];
32
+ writeText(args: {
33
+ path: string;
34
+ text: string;
35
+ }): void;
36
+ createTempDirectory(args: {
37
+ parent: string;
38
+ prefix: string;
39
+ }): string;
40
+ createDirectory(args: {
41
+ path: string;
42
+ }): void;
43
+ ensureDirectory(args: {
44
+ path: string;
45
+ }): void;
46
+ copyDirectory(args: {
47
+ source: string;
48
+ destination: string;
49
+ }): void;
50
+ removeDirectory(args: {
51
+ path: string;
52
+ }): void;
53
+ }
54
+ export interface PackageInstallerPort {
55
+ /** Install the manifest already written in directory; return captured output, never exit. */
56
+ install(args: {
57
+ directory: string;
58
+ }): Promise<ProcessResult>;
59
+ }
60
+ export interface CheckLoggerPort {
61
+ log(args: {
62
+ projectKey: string;
63
+ status: string;
64
+ message: string;
65
+ }): void;
66
+ }
67
+ //# sourceMappingURL=ports.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ports.js.map
@@ -0,0 +1,77 @@
1
+ import type { CheckLoggerPort, FilesystemPort, PackageInstallerPort, ProcessRequest, ProcessResult, ProcessRunnerPort } from '../ports.js';
2
+ export type { CheckLoggerPort, FilesystemPort, PackageInstallerPort, ProcessRequest, ProcessResult, ProcessRunnerPort } from '../ports.js';
3
+ export interface DependencyManifest {
4
+ dependencies?: Record<string, string>;
5
+ devDependencies?: Record<string, string>;
6
+ overrides?: Record<string, unknown>;
7
+ }
8
+ interface ProjectBase {
9
+ key: string;
10
+ directory: string;
11
+ manifestPath: string;
12
+ }
13
+ export interface LinksProject extends ProjectBase {
14
+ mode: 'links';
15
+ }
16
+ export interface CompileProject extends ProjectBase {
17
+ mode: 'drift' | 'published';
18
+ /** Must be a closer source ancestor than the real install; the host owns this assertion. */
19
+ shadowAnchor: string;
20
+ /** Existing writable scratch parent; unique temporary directories prevent run collisions. */
21
+ scratchParent: string;
22
+ prerequisites: readonly ProcessRequest[];
23
+ /** Runs against the real project config; the library never substitutes tsconfig paths. */
24
+ compiler: ProcessRequest;
25
+ }
26
+ export type PublishedTypesProject = LinksProject | CompileProject;
27
+ export type PublishedTypesStatus = 'pass' | 'skipped' | 'linked' | 'drift' | 'install-error' | 'prerequisite-error' | 'typecheck-error' | 'operation-error';
28
+ export interface PublishedTypesResult {
29
+ projectKey: string;
30
+ status: PublishedTypesStatus;
31
+ versions: Readonly<Record<string, string>>;
32
+ linkedPackages: readonly string[];
33
+ diagnostics: readonly string[];
34
+ baselineDiagnostics: readonly string[];
35
+ output: string;
36
+ }
37
+ export interface PublishedTypesReport {
38
+ ok: boolean;
39
+ projects: readonly PublishedTypesResult[];
40
+ }
41
+ /** Select registry-resolved dependencies from the required scope; explicit local specs are exempt. */
42
+ export declare function registryDependencies({ manifest, scope }: {
43
+ manifest: DependencyManifest;
44
+ scope: string;
45
+ }): Record<string, string>;
46
+ /** Split compiler output into whole diagnostics; wrapped details stay attached to their first line. */
47
+ export declare function parseDiagnosticBlocks({ output }: {
48
+ output: string;
49
+ }): string[];
50
+ /**
51
+ * Check projects sequentially so overlapping source trees cannot see each other's shadows.
52
+ * Ports never exit the host process. Operational failures remain failures, including cleanup errors.
53
+ */
54
+ export declare function check({ projects, scope, fs, runner, installer }: {
55
+ projects: readonly PublishedTypesProject[];
56
+ scope: string;
57
+ fs: FilesystemPort;
58
+ runner: ProcessRunnerPort;
59
+ installer: PackageInstallerPort;
60
+ }, { logger }?: {
61
+ logger?: CheckLoggerPort;
62
+ }): Promise<PublishedTypesReport>;
63
+ export interface TypecheckLog extends ProcessResult {
64
+ projectKey: string;
65
+ }
66
+ export interface TypecheckDiagnosis {
67
+ ok: boolean;
68
+ failures: readonly (TypecheckLog & {
69
+ hits: readonly string[];
70
+ })[];
71
+ }
72
+ /** Diagnose captured CI results for the supplied scope without reading files or running commands. */
73
+ export declare function diagnosePublishedTypes({ scope, logs }: {
74
+ scope: string;
75
+ logs: readonly TypecheckLog[];
76
+ }): TypecheckDiagnosis;
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,186 @@
1
+ import path from 'node:path';
2
+ function validateScope(scope) {
3
+ if (!/^@[a-z0-9][a-z0-9._-]*$/.test(scope))
4
+ throw new TypeError('scope must be an npm scope such as @example');
5
+ }
6
+ /** Select registry-resolved dependencies from the required scope; explicit local specs are exempt. */
7
+ export function registryDependencies({ manifest, scope }) {
8
+ validateScope(scope);
9
+ const dependencies = {};
10
+ for (const [name, spec] of Object.entries({ ...manifest.dependencies, ...manifest.devDependencies })) {
11
+ if (!name.startsWith(`${scope}/`) || /^(file:|workspace:|link:)/.test(spec))
12
+ continue;
13
+ if (!new RegExp(`^${escapeRegex(scope)}/[a-z0-9][a-z0-9._-]*$`).test(name))
14
+ throw new TypeError(`invalid dependency name: ${name}`);
15
+ dependencies[name] = spec;
16
+ }
17
+ return dependencies;
18
+ }
19
+ /** Split compiler output into whole diagnostics; wrapped details stay attached to their first line. */
20
+ export function parseDiagnosticBlocks({ output }) {
21
+ const blocks = [];
22
+ let current = [];
23
+ for (const line of output.replace(/\r\n/g, '\n').split('\n')) {
24
+ if (/^\S.*\(\d+,\d+\): error TS\d+:/.test(line) || /^error TS\d+:/.test(line)) {
25
+ if (current.length)
26
+ blocks.push(current.join('\n').trimEnd());
27
+ current = [line];
28
+ }
29
+ else if (current.length)
30
+ current.push(line);
31
+ }
32
+ if (current.length)
33
+ blocks.push(current.join('\n').trimEnd());
34
+ return blocks;
35
+ }
36
+ function emptyResult(projectKey, status, output = '') {
37
+ return { projectKey, status, output, versions: {}, linkedPackages: [], diagnostics: [], baselineDiagnostics: [] };
38
+ }
39
+ function combined(result) { return `${result.stdout}${result.stderr}`; }
40
+ function escapeRegex(text) { return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
41
+ function checkLinks(project, deps, fs) {
42
+ const linkedPackages = Object.keys(deps).filter((name) => {
43
+ const location = path.join(project.directory, 'node_modules', name);
44
+ // lstat also sees broken symlinks; exists() alone does not.
45
+ try {
46
+ return fs.isSymbolicLink({ path: location });
47
+ }
48
+ catch (error) {
49
+ if (isMissingPath(error))
50
+ return false;
51
+ throw error;
52
+ }
53
+ });
54
+ return { ...emptyResult(project.key, linkedPackages.length ? 'linked' : 'pass'), linkedPackages };
55
+ }
56
+ function isMissingPath(error) {
57
+ return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
58
+ }
59
+ /** Acquire ownership before copying. Existing scope directories are never removed or replaced. */
60
+ function createShadow(project, source, scope, fs) {
61
+ const nodeModules = path.join(project.shadowAnchor, 'node_modules');
62
+ const scopeDir = path.join(nodeModules, scope);
63
+ const parentExisted = fs.exists({ path: nodeModules });
64
+ if (parentExisted && fs.isSymbolicLink({ path: nodeModules }))
65
+ throw new Error('shadow node_modules must not be a symlink');
66
+ if (!parentExisted)
67
+ fs.createDirectory({ path: nodeModules });
68
+ let scopeOwned = false;
69
+ const cleanup = () => {
70
+ if (scopeOwned)
71
+ fs.removeDirectory({ path: scopeDir });
72
+ // Preserve any entries another process added while the compiler ran.
73
+ if (!parentExisted && fs.readDirectory({ path: nodeModules }).length === 0)
74
+ fs.removeDirectory({ path: nodeModules });
75
+ };
76
+ try {
77
+ fs.createDirectory({ path: scopeDir });
78
+ scopeOwned = true;
79
+ fs.copyDirectory({ source, destination: scopeDir });
80
+ return cleanup;
81
+ }
82
+ catch (error) {
83
+ cleanup();
84
+ throw error;
85
+ }
86
+ }
87
+ function evaluateCompile(project, registry, baseline, versions) {
88
+ const output = combined(registry);
89
+ const baselineDiagnostics = parseDiagnosticBlocks({ output: combined(baseline) });
90
+ const diagnostics = parseDiagnosticBlocks({ output });
91
+ const base = { ...emptyResult(project.key, 'pass', output), versions, diagnostics, baselineDiagnostics };
92
+ if (registry.exitCode === 0)
93
+ return base;
94
+ if (project.mode === 'published' || registry.exitCode === null || diagnostics.length === 0)
95
+ return { ...base, status: 'typecheck-error' };
96
+ // A broken baseline is not valid evidence for suppressing registry failures.
97
+ if (baseline.exitCode === null || (baseline.exitCode !== 0 && baselineDiagnostics.length === 0))
98
+ return { ...base, status: 'typecheck-error' };
99
+ const known = new Set(baselineDiagnostics);
100
+ const drift = diagnostics.filter((block) => !known.has(block));
101
+ return { ...base, status: drift.length ? 'drift' : 'pass', diagnostics: drift };
102
+ }
103
+ async function checkCompile(project, manifest, deps, scope, fs, runner, installer) {
104
+ if (Object.keys(deps).length === 0)
105
+ return emptyResult(project.key, 'skipped', 'no registry-resolved scoped dependencies');
106
+ for (const command of project.prerequisites) {
107
+ const result = await runner.run(command);
108
+ if (result.exitCode !== 0)
109
+ return emptyResult(project.key, 'prerequisite-error', combined(result));
110
+ }
111
+ const scratch = fs.createTempDirectory({ parent: project.scratchParent, prefix: 'published-types-' });
112
+ try {
113
+ const overrides = Object.fromEntries(Object.entries(manifest.overrides ?? {}).filter(([name]) => name.startsWith(`${scope}/`)));
114
+ fs.writeText({ path: path.join(scratch, 'package.json'), text: JSON.stringify({ name: 'published-types-scratch', private: true, dependencies: deps, overrides }, null, 2) });
115
+ const installed = await installer.install({ directory: scratch });
116
+ if (installed.exitCode !== 0)
117
+ return emptyResult(project.key, 'install-error', combined(installed));
118
+ const source = path.join(scratch, 'node_modules', scope);
119
+ if (fs.isSymbolicLink({ path: source }))
120
+ throw new Error('installed scope must not be linked');
121
+ for (const entry of fs.readDirectory({ path: source })) {
122
+ if (fs.isSymbolicLink({ path: path.join(source, entry) }))
123
+ throw new Error(`installed scoped package is linked: ${entry}`);
124
+ }
125
+ const versions = {};
126
+ for (const name of Object.keys(deps)) {
127
+ const pkg = JSON.parse(fs.readText({ path: path.join(scratch, 'node_modules', name, 'package.json') }));
128
+ versions[name] = pkg.version;
129
+ }
130
+ const baseline = project.mode === 'drift' ? await runner.run(project.compiler) : { exitCode: 0, stdout: '', stderr: '' };
131
+ // Copy the entire installed scope, including hoisted transitive packages.
132
+ const cleanup = createShadow(project, source, scope, fs);
133
+ let registry;
134
+ try {
135
+ registry = await runner.run(project.compiler);
136
+ }
137
+ finally {
138
+ cleanup();
139
+ }
140
+ return evaluateCompile(project, registry, baseline, versions);
141
+ }
142
+ finally {
143
+ fs.removeDirectory({ path: scratch });
144
+ }
145
+ }
146
+ /**
147
+ * Check projects sequentially so overlapping source trees cannot see each other's shadows.
148
+ * Ports never exit the host process. Operational failures remain failures, including cleanup errors.
149
+ */
150
+ export async function check({ projects, scope, fs, runner, installer }, { logger } = {}) {
151
+ validateScope(scope);
152
+ if (projects.length === 0)
153
+ throw new TypeError('at least one project is required');
154
+ const results = [];
155
+ for (const project of projects) {
156
+ let result;
157
+ try {
158
+ const manifest = JSON.parse(fs.readText({ path: project.manifestPath }));
159
+ const deps = registryDependencies({ manifest, scope });
160
+ result = project.mode === 'links' ? checkLinks(project, deps, fs) : await checkCompile(project, manifest, deps, scope, fs, runner, installer);
161
+ }
162
+ catch (error) {
163
+ result = emptyResult(project.key, 'operation-error', error instanceof Error ? error.message : String(error));
164
+ }
165
+ results.push(result);
166
+ logger?.log({ projectKey: project.key, status: result.status, message: result.output });
167
+ }
168
+ return { ok: results.every((result) => result.status === 'pass' || result.status === 'skipped'), projects: results };
169
+ }
170
+ /** Diagnose captured CI results for the supplied scope without reading files or running commands. */
171
+ export function diagnosePublishedTypes({ scope, logs }) {
172
+ validateScope(scope);
173
+ const escapedScope = escapeRegex(scope);
174
+ const missingExport = new RegExp(`Module ["']{1,2}${escapedScope}/[^"']+["']{1,2} has no exported member ["']([^"']+)["']`, 'g');
175
+ const missingModule = new RegExp(`Cannot find module ["']{1,2}(${escapedScope}/[^"']+)["']{1,2} or its corresponding type declarations`, 'g');
176
+ const failures = logs.filter((log) => log.exitCode !== 0).map((log) => {
177
+ const text = combined(log);
178
+ const hits = [
179
+ ...[...text.matchAll(missingExport)].map((match) => `missing export '${match[1]}'`),
180
+ ...[...text.matchAll(missingModule)].map((match) => `missing module '${match[1]}'`),
181
+ ];
182
+ return { ...log, hits };
183
+ });
184
+ return { ok: failures.length === 0, failures };
185
+ }
186
+ //# sourceMappingURL=index.js.map
@@ -14,7 +14,7 @@
14
14
  import type { assertNotRedirected, redirectGuardInit } from './redirect-guard.js';
15
15
  import type { safeDnsLabel, safeProjectLabel } from './naming.js';
16
16
  import type { checkDeploymentUrl, normalizeDeploymentUrl, waitForReachableDeploymentUrl } from './reachability.js';
17
- import type { DeployError, DeployTarget, JsonObject } from './types.js';
17
+ import type { DeployError, DeployTarget, UnknownRecord } from './types.js';
18
18
  /**
19
19
  * The resolved saved credential a module builds its target from: always a
20
20
  * `token`, plus whatever extra fields that host's credential carries (an
@@ -47,19 +47,32 @@ export interface SigV4ClientOptions {
47
47
  * before sending it, retrying a 5xx/429 with backoff.
48
48
  */
49
49
  export interface SigV4Client {
50
- fetch(input: string, init?: RequestInit): Promise<Response>;
50
+ fetch(requiredArgs: {
51
+ input: string;
52
+ }, optionalArgs?: {
53
+ init?: RequestInit;
54
+ }): Promise<Response>;
51
55
  /** Signs a request without sending it, so the caller can send it through `DeployHostKit.fetch`. */
52
- sign(input: string, init?: RequestInit): Promise<Request>;
56
+ sign(requiredArgs: {
57
+ input: string;
58
+ }, optionalArgs?: {
59
+ init?: RequestInit;
60
+ }): Promise<Request>;
53
61
  }
54
62
  /** Everything a module may call that is not a runtime builtin. The host builds it and passes it in. */
55
63
  export interface DeployHostKit {
56
- /** `fetch`, aborted after `options.timeoutMs`. */
57
- fetch(url: string, init: RequestInit, options: {
58
- readonly timeoutMs: number;
64
+ /** `fetch`, aborted after `requiredArgs.timeoutMs`. */
65
+ fetch(requiredArgs: {
66
+ url: string;
67
+ timeoutMs: number;
68
+ }, optionalArgs?: {
69
+ init?: RequestInit;
59
70
  }): Promise<Response>;
60
71
  readonly timeouts: DeployFetchTimeouts;
61
72
  /** Delay between poll attempts. Injected so a test never waits in real time. */
62
- sleep(ms: number): Promise<void>;
73
+ sleep(requiredArgs: {
74
+ ms: number;
75
+ }): Promise<void>;
63
76
  readonly checkDeploymentUrl: typeof checkDeploymentUrl;
64
77
  readonly waitForReachableDeploymentUrl: typeof waitForReachableDeploymentUrl;
65
78
  readonly normalizeDeploymentUrl: typeof normalizeDeploymentUrl;
@@ -75,7 +88,7 @@ export interface DeployHostKit {
75
88
  }
76
89
  export interface DeployTargetCreateContext {
77
90
  readonly credential: DeployTargetCredential;
78
- readonly config: JsonObject;
91
+ readonly config: UnknownRecord;
79
92
  readonly kit: DeployHostKit;
80
93
  }
81
94
  /**
@@ -105,9 +118,13 @@ export interface DeployCredentialCheckContext {
105
118
  export interface DeployTargetModule {
106
119
  create(context: DeployTargetCreateContext): DeployTarget;
107
120
  /** A human-readable config error, or `null` when `config` is usable. */
108
- validateConfig?(config: JsonObject): string | null;
121
+ validateConfig?(requiredArgs: {
122
+ config: UnknownRecord;
123
+ }): string | null;
109
124
  /** The path prefix the host serves the site from, when it is not the root. */
110
- basePath?(config: JsonObject): string | undefined;
125
+ basePath?(requiredArgs: {
126
+ config: UnknownRecord;
127
+ }): string | undefined;
111
128
  /** One bounded, read-only authenticated request against the host's own API.
112
129
  * May throw: the caller folds any throw into `unreachable`. Never returns
113
130
  * the credential or a response body. */
@@ -3,10 +3,6 @@ export * from './naming.js';
3
3
  export * from './reachability.js';
4
4
  export * from './redirect-guard.js';
5
5
  export * from './host-kit.js';
6
- export * from './vercel.js';
7
- export * from './cloudflare-pages.js';
8
- export * from './netlify.js';
9
- export * from './github-pages.js';
10
6
  export * from './tokens.js';
11
7
  export * from './tool.js';
12
8
  //# sourceMappingURL=index.d.ts.map
@@ -3,10 +3,6 @@ export * from './naming.js';
3
3
  export * from './reachability.js';
4
4
  export * from './redirect-guard.js';
5
5
  export * from './host-kit.js';
6
- export * from './vercel.js';
7
- export * from './cloudflare-pages.js';
8
- export * from './netlify.js';
9
- export * from './github-pages.js';
10
6
  export * from './tokens.js';
11
7
  export * from './tool.js';
12
8
  //# sourceMappingURL=index.js.map
@@ -1,18 +1,21 @@
1
1
  /**
2
- * Shared label-sanitizing helpers used by both the Vercel and Cloudflare
3
- * Pages adapters to turn a caller-supplied `projectName` into a
2
+ * Shared label-sanitizing helpers deploy targets use to turn a caller-supplied `projectName` into a
4
3
  * provider-safe identifier (lowercase, hyphenated, length-capped). Lifted
5
4
  * verbatim from `apps/daemon/src/deploy.ts`'s `safeProjectLabel` — pure
6
5
  * string logic, no OD dependency to strip.
7
6
  *
8
- * @param raw - Arbitrary caller input (may be empty, non-ASCII, etc).
9
- * @param maxLength - Hard cap on the returned label's length.
7
+ * @param requiredArgs - Arbitrary `raw` input and the required `maxLength` cap.
10
8
  * @returns A label containing only `[a-z0-9-]`, with no leading/trailing/
11
9
  * duplicate hyphens, truncated to `maxLength`.
12
10
  * @complexity O(n) in the length of `raw`.
13
11
  * @overallScore 100/100
14
12
  */
15
- export declare function safeProjectLabel(raw: unknown, maxLength: number): string;
13
+ export declare function safeProjectLabel({ raw, maxLength }: {
14
+ raw: unknown;
15
+ maxLength: number;
16
+ }): string;
16
17
  /** DNS-label-safe variant (63-char cap, the DNS label limit). */
17
- export declare function safeDnsLabel(raw: unknown): string;
18
+ export declare function safeDnsLabel({ raw }: {
19
+ raw: unknown;
20
+ }): string;
18
21
  //# sourceMappingURL=naming.d.ts.map
@@ -1,18 +1,16 @@
1
1
  /**
2
- * Shared label-sanitizing helpers used by both the Vercel and Cloudflare
3
- * Pages adapters to turn a caller-supplied `projectName` into a
2
+ * Shared label-sanitizing helpers deploy targets use to turn a caller-supplied `projectName` into a
4
3
  * provider-safe identifier (lowercase, hyphenated, length-capped). Lifted
5
4
  * verbatim from `apps/daemon/src/deploy.ts`'s `safeProjectLabel` — pure
6
5
  * string logic, no OD dependency to strip.
7
6
  *
8
- * @param raw - Arbitrary caller input (may be empty, non-ASCII, etc).
9
- * @param maxLength - Hard cap on the returned label's length.
7
+ * @param requiredArgs - Arbitrary `raw` input and the required `maxLength` cap.
10
8
  * @returns A label containing only `[a-z0-9-]`, with no leading/trailing/
11
9
  * duplicate hyphens, truncated to `maxLength`.
12
10
  * @complexity O(n) in the length of `raw`.
13
11
  * @overallScore 100/100
14
12
  */
15
- export function safeProjectLabel(raw, maxLength) {
13
+ export function safeProjectLabel({ raw, maxLength }) {
16
14
  return String(raw)
17
15
  .normalize('NFKD')
18
16
  .toLowerCase()
@@ -23,7 +21,7 @@ export function safeProjectLabel(raw, maxLength) {
23
21
  .replace(/-+$/g, '');
24
22
  }
25
23
  /** DNS-label-safe variant (63-char cap, the DNS label limit). */
26
- export function safeDnsLabel(raw) {
27
- return safeProjectLabel(raw, 63);
24
+ export function safeDnsLabel({ raw }) {
25
+ return safeProjectLabel({ raw, maxLength: 63 });
28
26
  }
29
27
  //# sourceMappingURL=naming.js.map
@@ -0,0 +1,18 @@
1
+ import type { lookup } from 'node:dns';
2
+ import type { ReachabilityArgs } from './reachability.js';
3
+ /**
4
+ * Node default for deployment probes: URL rejection plus connection-time DNS validation.
5
+ * The address validated by platform's lookup is the address the socket connects to; a
6
+ * preflight DNS check would permit rebinding between validation and connection (SEC-003).
7
+ * Share the lazily-created default dispatcher to retain connection pooling. A host/test
8
+ * lookup override owns a separate dispatcher and never changes that shared policy.
9
+ * Native fetch remains a framework ABI, including undici's dispatcher extension.
10
+ * Attach the dispatcher as a runtime extension so the @types/node bundled
11
+ * undici-types Dispatcher version need not match the runtime undici Agent.
12
+ * Native fetch uses that Agent's dispatch method; no port casts are needed.
13
+ */
14
+ export declare function createNodeReachabilityPorts(_required: Record<string, never>, options?: {
15
+ fetch?: typeof globalThis.fetch;
16
+ lookupImpl?: typeof lookup;
17
+ }): Pick<ReachabilityArgs, 'fetch' | 'guard'>;
18
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1,57 @@
1
+ import { Agent } from 'undici';
2
+ import { assertSafePublicUrl, createValidatingLookup } from '@jini-ai/platform';
3
+ let defaultDispatcher;
4
+ function isLookupAddress(value) {
5
+ return value !== null && typeof value === 'object' && 'address' in value &&
6
+ typeof value.address === 'string' && 'family' in value && typeof value.family === 'number';
7
+ }
8
+ function createDispatcher(lookupImpl) {
9
+ const validatingLookup = createValidatingLookup(lookupImpl);
10
+ const connectionLookup = (hostname, options, callback) => {
11
+ validatingLookup(hostname, options, (error, address, family) => {
12
+ if (error) {
13
+ callback(error, '');
14
+ return;
15
+ }
16
+ if (typeof address === 'string') {
17
+ callback(null, address, family);
18
+ return;
19
+ }
20
+ if (Array.isArray(address) && address.every(isLookupAddress)) {
21
+ callback(null, address, family);
22
+ return;
23
+ }
24
+ callback(new Error('DNS lookup returned an invalid address'), '');
25
+ });
26
+ };
27
+ return new Agent({ connect: { lookup: connectionLookup } });
28
+ }
29
+ /**
30
+ * Node default for deployment probes: URL rejection plus connection-time DNS validation.
31
+ * The address validated by platform's lookup is the address the socket connects to; a
32
+ * preflight DNS check would permit rebinding between validation and connection (SEC-003).
33
+ * Share the lazily-created default dispatcher to retain connection pooling. A host/test
34
+ * lookup override owns a separate dispatcher and never changes that shared policy.
35
+ * Native fetch remains a framework ABI, including undici's dispatcher extension.
36
+ * Attach the dispatcher as a runtime extension so the @types/node bundled
37
+ * undici-types Dispatcher version need not match the runtime undici Agent.
38
+ * Native fetch uses that Agent's dispatch method; no port casts are needed.
39
+ */
40
+ export function createNodeReachabilityPorts(_required, options = {}) {
41
+ let dispatcher;
42
+ return {
43
+ guard: { assertSafeUrl: ({ raw }) => assertSafePublicUrl(raw) },
44
+ fetch: ({ url }, { init } = {}) => {
45
+ if (options.lookupImpl)
46
+ dispatcher ??= createDispatcher(options.lookupImpl);
47
+ else
48
+ dispatcher = defaultDispatcher ??= createDispatcher();
49
+ const guardedInit = { ...init };
50
+ Object.defineProperty(guardedInit, 'dispatcher', {
51
+ value: dispatcher, enumerable: true, configurable: true, writable: true,
52
+ });
53
+ return (options.fetch ?? globalThis.fetch)(url, guardedInit);
54
+ },
55
+ };
56
+ }
57
+ //# sourceMappingURL=node.js.map