@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,7 @@
1
+ import type ts from 'typescript';
2
+ import type { ImportReaderPort } from './ports.js';
3
+ /** Bind the maintained TypeScript parser supplied by the host; no parser dependency at runtime. */
4
+ export declare function createTypeScriptImportReader({ compiler }: {
5
+ compiler: typeof ts;
6
+ }): ImportReaderPort;
7
+ //# sourceMappingURL=typescript.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** Bind the maintained TypeScript parser supplied by the host; no parser dependency at runtime. */
2
+ export function createTypeScriptImportReader({ compiler }) {
3
+ return { imports({ file, source }) {
4
+ const tree = compiler.createSourceFile(file, source, compiler.ScriptTarget.Latest, false, compiler.ScriptKind.JS);
5
+ const found = [];
6
+ function visit(node) {
7
+ const literal = compiler.isImportDeclaration(node) || compiler.isExportDeclaration(node)
8
+ ? node.moduleSpecifier
9
+ : compiler.isCallExpression(node) && node.expression.kind === compiler.SyntaxKind.ImportKeyword ? node.arguments[0] : undefined;
10
+ if (literal !== undefined && compiler.isStringLiteral(literal))
11
+ found.push(literal.text);
12
+ compiler.forEachChild(node, visit);
13
+ }
14
+ visit(tree);
15
+ return found;
16
+ } };
17
+ }
18
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1,11 @@
1
+ import type { CommitExportArgs, CommitFile, CommitOptions, CommitOrchestrationArgs, PreviewCommitExportResult, SourceControlCommitOutcome } from './contracts.js';
2
+ /** Normalize platform separators without changing the retained byte payload. */
3
+ export declare function toCommitFile(required: {
4
+ outputFile: string;
5
+ data: string | Buffer;
6
+ }): CommitFile;
7
+ /** Run a real fresh export, without credentials or repository I/O. */
8
+ export declare function previewCommitExport(required: CommitExportArgs, optional?: CommitOptions): Promise<PreviewCommitExportResult>;
9
+ /** Resolve one provider's credential, export into an isolated host-owned directory and commit once. */
10
+ export declare function commitSiteToSourceControl(required: CommitOrchestrationArgs, optional?: CommitOptions): Promise<SourceControlCommitOutcome>;
11
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { firstExportFailure } from '../static-export/failure-summary.js';
2
+ import { validateCommitTarget } from './repository-target.js';
3
+ /** Normalize platform separators without changing the retained byte payload. */
4
+ export function toCommitFile(required) {
5
+ return { path: required.outputFile.replace(/\\/g, '/'), data: required.data };
6
+ }
7
+ async function exportForCommit(input) {
8
+ let outputDir;
9
+ try {
10
+ outputDir = input.layout.outputDirectory({ workspaceId: input.workspaceId, providerId: input.providerId, runId: input.ids.next({}) });
11
+ const report = await input.files.export({ outputDir }, { clean: true });
12
+ const failure = firstExportFailure({ report });
13
+ if (failure)
14
+ return { ok: false, code: 'EXPORT_FAILED', message: `refused to commit: ${failure.count} ${failure.kind}(s) failed to export (first: '${failure.identifier}' — ${failure.reason})` };
15
+ return { ok: true, files: [...report.routes.succeeded.map(toCommitFile), ...report.assets.succeeded.map(toCommitFile)] };
16
+ }
17
+ catch (error) {
18
+ return { ok: false, code: 'EXPORT_FAILED', message: `export failed before committing could start: ${input.describeError({ error })}` };
19
+ }
20
+ finally {
21
+ if (outputDir !== undefined) {
22
+ // Byte payloads are retained by the report; cleanup cannot invalidate the commit.
23
+ try {
24
+ await input.layout.cleanup({ outputDir });
25
+ }
26
+ catch { /* Best effort, matching the original service. */ }
27
+ }
28
+ }
29
+ }
30
+ /** Run a real fresh export, without credentials or repository I/O. */
31
+ export async function previewCommitExport(required, optional = {}) {
32
+ const error = validateCommitTarget(required, optional);
33
+ if (error)
34
+ return { ok: false, code: 'INVALID_CONFIG', message: error };
35
+ const exported = await exportForCommit(required);
36
+ if (!exported.ok)
37
+ return exported;
38
+ return { ok: true, fileCount: exported.files.length, totalBytes: exported.files.reduce((sum, file) => sum + Buffer.byteLength(file.data), 0), paths: exported.files.map(file => file.path).sort().slice(0, 50) };
39
+ }
40
+ /** Resolve one provider's credential, export into an isolated host-owned directory and commit once. */
41
+ export async function commitSiteToSourceControl(required, optional = {}) {
42
+ const configError = validateCommitTarget(required, optional);
43
+ if (configError)
44
+ return { ok: false, code: 'INVALID_CONFIG', message: configError };
45
+ let credential;
46
+ try {
47
+ credential = await required.credentials.resolve({ workspaceId: required.workspaceId, providerId: required.providerId });
48
+ }
49
+ catch (error) {
50
+ return { ok: false, code: 'NO_CREDENTIALS_CONFIGURED', message: `credential could not be resolved: ${required.describeError({ error })}` };
51
+ }
52
+ if (!credential)
53
+ return { ok: false, code: 'NO_CREDENTIALS_CONFIGURED', message: `No source control credential is configured for '${required.providerId}'.` };
54
+ if (credential.providerId !== required.providerId)
55
+ return { ok: false, code: 'NO_CREDENTIALS_CONFIGURED', message: `The resolved default credential is not a '${required.providerId}' connection.` };
56
+ const exported = await exportForCommit(required);
57
+ if (!exported.ok)
58
+ return exported;
59
+ try {
60
+ const result = await required.adapter.commitSite({ token: credential.token, owner: required.owner, repo: required.repo, commitMessage: required.commitMessage, files: exported.files }, { ...(optional.branch !== undefined ? { branch: optional.branch } : {}) });
61
+ if (!result.ok) {
62
+ const codes = { 'repository-not-found': 'REPOSITORY_NOT_FOUND', 'no-changes': 'NO_CHANGES', diverged: 'DIVERGED_BRANCH', 'network-unreachable': 'NETWORK_UNREACHABLE', 'provider-error': 'PROVIDER_ERROR' };
63
+ return { ok: false, code: codes[result.code], message: result.message };
64
+ }
65
+ return { ...result, owner: required.owner, repo: required.repo, divergedPaths: result.divergedPaths ?? [] };
66
+ }
67
+ catch (error) {
68
+ return { ok: false, code: 'PROVIDER_ERROR', message: required.describeError({ error }) };
69
+ }
70
+ }
71
+ //# sourceMappingURL=commit.js.map
@@ -0,0 +1,327 @@
1
+ import type { HttpClientPort } from '@jini-ai/core/primitives';
2
+ import type { ExportReport } from '../static-export/contracts.js';
3
+ /** Repository-relative bytes, passed unchanged to the provider. */
4
+ export interface CommitFile {
5
+ readonly path: string;
6
+ readonly data: string | Buffer;
7
+ }
8
+ export type SourceControlCommitResult = {
9
+ ok: true;
10
+ branch: string;
11
+ branchCreated: boolean;
12
+ commitSha: string;
13
+ commitUrl: string;
14
+ filesChanged: number;
15
+ filesDeleted: number;
16
+ divergedPaths?: readonly string[];
17
+ } | {
18
+ ok: false;
19
+ code: 'repository-not-found' | 'no-changes' | 'diverged' | 'network-unreachable' | 'provider-error';
20
+ message: string;
21
+ };
22
+ export interface CommitSiteInput {
23
+ readonly token: string;
24
+ readonly owner: string;
25
+ readonly repo: string;
26
+ readonly commitMessage: string;
27
+ readonly files: readonly CommitFile[];
28
+ }
29
+ export type ProviderCallFailure = {
30
+ ok: false;
31
+ code: 'provider-error';
32
+ message: string;
33
+ } | {
34
+ ok: false;
35
+ code: 'network-unreachable';
36
+ message: string;
37
+ logDetail: string;
38
+ };
39
+ export interface CredentialedRepositoryTarget {
40
+ readonly baseUrl: string;
41
+ readonly authorization: string;
42
+ readonly owner: string;
43
+ readonly repo: string;
44
+ }
45
+ export interface WriteFile {
46
+ readonly path: string;
47
+ readonly content: string;
48
+ }
49
+ export interface FileWriteState {
50
+ readonly path: string;
51
+ readonly exists: boolean;
52
+ }
53
+ export interface FileWritePlan {
54
+ readonly parentCommitSha: string;
55
+ readonly baseTreeSha: string;
56
+ readonly fileStates: readonly FileWriteState[];
57
+ }
58
+ export type FileWritePlanResult = {
59
+ ok: true;
60
+ plan: FileWritePlan;
61
+ } | {
62
+ ok: false;
63
+ code: 'branch-not-found';
64
+ message: string;
65
+ } | ProviderCallFailure;
66
+ export type CommitFilesResult = {
67
+ ok: true;
68
+ commitSha: string;
69
+ commitUrl: string;
70
+ } | {
71
+ ok: false;
72
+ code: 'diverged';
73
+ message: string;
74
+ } | ProviderCallFailure;
75
+ export interface BackupRepositoryState {
76
+ readonly branch: string;
77
+ readonly parentCommitSha: string;
78
+ readonly baseTreeSha: string;
79
+ readonly htmlUrl: string;
80
+ readonly folderExists: boolean;
81
+ }
82
+ export type InspectBackupRepositoryFailureCode = 'repo-not-found' | 'repo-not-private' | 'no-push-permission' | 'repo-empty' | 'branch-not-found' | 'folder-is-file';
83
+ export type InspectBackupRepositoryResult = {
84
+ ok: true;
85
+ state: BackupRepositoryState;
86
+ } | {
87
+ ok: false;
88
+ code: InspectBackupRepositoryFailureCode;
89
+ message: string;
90
+ } | ProviderCallFailure;
91
+ export interface UploadedBackupBlob {
92
+ readonly path: string;
93
+ readonly blobSha: string;
94
+ readonly bytes: number;
95
+ readonly sha256: string;
96
+ }
97
+ export interface CommitBackupTreeInput extends CredentialedRepositoryTarget {
98
+ readonly branch: string;
99
+ readonly folder: string;
100
+ readonly commitMessage: string;
101
+ readonly parentCommitSha: string;
102
+ readonly baseTreeSha: string;
103
+ readonly htmlUrl: string;
104
+ readonly blobs: readonly UploadedBackupBlob[];
105
+ }
106
+ export interface SourceControlHostFacts {
107
+ readonly id: string;
108
+ readonly label: string;
109
+ readonly apiOrigin: string;
110
+ readonly maxFileBytes?: number;
111
+ readonly reservedPaths?: readonly string[];
112
+ readonly workflowPaths?: readonly string[];
113
+ }
114
+ /** New module ABI: all required inputs, including an approved write plan, are one object. */
115
+ export interface SourceControlProviderOperations {
116
+ commitSite(required: CommitSiteInput, optional?: {
117
+ branch?: string;
118
+ }): Promise<SourceControlCommitResult>;
119
+ readAccountLabel(required: {
120
+ token: string;
121
+ }): Promise<string | null>;
122
+ planFileWrite(required: CredentialedRepositoryTarget & {
123
+ branch: string;
124
+ files: readonly WriteFile[];
125
+ }): Promise<FileWritePlanResult>;
126
+ commitFiles(required: CredentialedRepositoryTarget & {
127
+ branch: string;
128
+ commitMessage: string;
129
+ files: readonly WriteFile[];
130
+ plan: FileWritePlan;
131
+ }): Promise<CommitFilesResult>;
132
+ inspectBackupRepository(required: CredentialedRepositoryTarget & {
133
+ folder: string;
134
+ }, optional?: {
135
+ branch?: string;
136
+ }): Promise<InspectBackupRepositoryResult>;
137
+ uploadBackupBlob(required: {
138
+ target: CredentialedRepositoryTarget;
139
+ file: {
140
+ path: string;
141
+ content: Uint8Array;
142
+ };
143
+ }): Promise<{
144
+ ok: true;
145
+ blob: UploadedBackupBlob;
146
+ } | ProviderCallFailure>;
147
+ commitBackupTree(required: CommitBackupTreeInput): Promise<CommitFilesResult>;
148
+ }
149
+ export interface RepositoryTarget {
150
+ readonly owner: string;
151
+ readonly repo: string;
152
+ }
153
+ export type RepositoryTargetValidator = (required: RepositoryTarget) => string | null;
154
+ export type SourceControlProvider = SourceControlProviderOperations & SourceControlHostFacts & {
155
+ readonly validateTarget?: RepositoryTargetValidator;
156
+ };
157
+ export interface DescribedTransportError {
158
+ readonly refusal: string | undefined;
159
+ readonly logDetail: string;
160
+ }
161
+ /** Structural guarded HTTP port: the host owns origin/DNS/redirect policy and secret redaction. */
162
+ export type { HttpClientPort } from '@jini-ai/core/primitives';
163
+ /** The host binds guarded/native HTTP through object arguments. */
164
+ export type SourceControlFetchPort = (required: {
165
+ url: string;
166
+ }, optional?: {
167
+ init?: RequestInit;
168
+ }) => Promise<Response>;
169
+ export interface SourceControlProviderKit {
170
+ fetch(required: {
171
+ url: string;
172
+ init: RequestInit;
173
+ }): Promise<Response>;
174
+ redirectGuardInit(required: {
175
+ init: RequestInit;
176
+ }): RequestInit;
177
+ assertNotRedirected(required: {
178
+ response: Response;
179
+ hostName: string;
180
+ }): void;
181
+ isRedirectRefusal(required: {
182
+ error: unknown;
183
+ }): boolean;
184
+ readonly httpClient: HttpClientPort;
185
+ describeTransportError(required: {
186
+ error: unknown;
187
+ }): DescribedTransportError;
188
+ }
189
+ export interface SourceControlProviderModule {
190
+ create(required: {
191
+ kit: SourceControlProviderKit;
192
+ }): SourceControlProviderOperations;
193
+ validateTarget?: RepositoryTargetValidator;
194
+ }
195
+ export interface SourceControlProviderDescriptor extends SourceControlHostFacts {
196
+ readonly module: string;
197
+ readonly credential?: unknown;
198
+ readonly i18n?: unknown;
199
+ }
200
+ export interface LoadedSourceControlProvider {
201
+ readonly descriptor: SourceControlProviderDescriptor;
202
+ readonly pluginId: string;
203
+ readonly module: SourceControlProviderModule;
204
+ }
205
+ export interface SourceControlProviderRegistry {
206
+ list(required: Record<string, never>): readonly LoadedSourceControlProvider[];
207
+ get(required: {
208
+ providerId: string;
209
+ }): LoadedSourceControlProvider | undefined;
210
+ readonly refusals: readonly string[];
211
+ readonly switchedOff: ReadonlyMap<string, string>;
212
+ }
213
+ export type CatalogPackage = {
214
+ pluginId: string;
215
+ state: 'refused';
216
+ reason: string;
217
+ } | {
218
+ pluginId: string;
219
+ state: 'inactive';
220
+ descriptorText: string;
221
+ } | {
222
+ pluginId: string;
223
+ state: 'trusted';
224
+ descriptorText: string;
225
+ importModule(required: {
226
+ relativePath: string;
227
+ }): Promise<unknown>;
228
+ };
229
+ /** Only trusted entries may expose importModule. The adapter must verify activation, digest and realpath containment before import. */
230
+ export interface ProviderCatalogPort {
231
+ list(required: {
232
+ workspaceId: string;
233
+ descriptorFileName: string;
234
+ }): Promise<readonly CatalogPackage[]>;
235
+ }
236
+ export type DescriptorExtensions = {
237
+ credential?: unknown;
238
+ i18n?: unknown;
239
+ };
240
+ export type DescriptorExtensionReader = (required: {
241
+ entry: Readonly<Record<string, unknown>>;
242
+ at: string;
243
+ }) => {
244
+ ok: true;
245
+ extensions: DescriptorExtensions;
246
+ } | {
247
+ ok: false;
248
+ reason: string;
249
+ };
250
+ export interface CredentialResolverPort {
251
+ resolve(required: {
252
+ workspaceId: string;
253
+ providerId: string;
254
+ }): Promise<{
255
+ providerId: string;
256
+ token: string;
257
+ } | null>;
258
+ }
259
+ export interface FileSourcePort {
260
+ export(required: {
261
+ outputDir: string;
262
+ }, optional?: {
263
+ clean?: boolean;
264
+ }): Promise<ExportReport>;
265
+ }
266
+ export interface CommitLayoutPort {
267
+ outputDirectory(required: {
268
+ workspaceId: string;
269
+ providerId: string;
270
+ runId: string;
271
+ }): string;
272
+ cleanup(required: {
273
+ outputDir: string;
274
+ }): Promise<void>;
275
+ }
276
+ export interface CommitExportArgs {
277
+ workspaceId: string;
278
+ owner: string;
279
+ repo: string;
280
+ commitMessage: string;
281
+ providerId: string;
282
+ files: FileSourcePort;
283
+ layout: CommitLayoutPort;
284
+ ids: {
285
+ next(required: Record<string, never>): string;
286
+ };
287
+ /** Must return caller-safe text without credentials. */
288
+ describeError(required: {
289
+ error: unknown;
290
+ }): string;
291
+ }
292
+ export interface CommitOrchestrationArgs extends CommitExportArgs {
293
+ credentials: CredentialResolverPort;
294
+ adapter: Pick<SourceControlProviderOperations, 'commitSite'>;
295
+ }
296
+ export interface CommitOptions {
297
+ branch?: string;
298
+ validateTarget?: RepositoryTargetValidator;
299
+ }
300
+ export type CommitFailureCode = 'INVALID_CONFIG' | 'NO_CREDENTIALS_CONFIGURED' | 'EXPORT_FAILED' | 'REPOSITORY_NOT_FOUND' | 'NO_CHANGES' | 'DIVERGED_BRANCH' | 'NETWORK_UNREACHABLE' | 'PROVIDER_ERROR';
301
+ export type SourceControlCommitOutcome = {
302
+ ok: false;
303
+ code: CommitFailureCode;
304
+ message: string;
305
+ } | {
306
+ ok: true;
307
+ owner: string;
308
+ repo: string;
309
+ branch: string;
310
+ branchCreated: boolean;
311
+ commitSha: string;
312
+ commitUrl: string;
313
+ filesChanged: number;
314
+ filesDeleted: number;
315
+ divergedPaths: readonly string[];
316
+ };
317
+ export type PreviewCommitExportResult = {
318
+ ok: true;
319
+ fileCount: number;
320
+ totalBytes: number;
321
+ paths: string[];
322
+ } | {
323
+ ok: false;
324
+ code: 'INVALID_CONFIG' | 'EXPORT_FAILED';
325
+ message: string;
326
+ };
327
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1,6 @@
1
+ export * from './contracts.js';
2
+ export * from './repository-target.js';
3
+ export * from './kit.js';
4
+ export * from './registry.js';
5
+ export * from './commit.js';
6
+ //# sourceMappingURL=entry.d.ts.map
@@ -0,0 +1,6 @@
1
+ export * from './contracts.js';
2
+ export * from './repository-target.js';
3
+ export * from './kit.js';
4
+ export * from './registry.js';
5
+ export * from './commit.js';
6
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1,15 @@
1
+ import type { HttpClientPort } from '@jini-ai/core/primitives';
2
+ import type { DescribedTransportError, SourceControlFetchPort, SourceControlProviderKit } from './contracts.js';
3
+ /** Build a kit without globals or a silently missing guarded HTTP client. */
4
+ export declare function createSourceControlProviderKit(required: {
5
+ httpClient: HttpClientPort;
6
+ fetch: SourceControlFetchPort;
7
+ describeTransportError(required: {
8
+ error: unknown;
9
+ }): DescribedTransportError;
10
+ }): SourceControlProviderKit;
11
+ /** Adapt a host-selected native/guarded fetch without choosing a global transport. */
12
+ export declare function createSourceControlFetchAdapter(required: {
13
+ fetch: typeof fetch;
14
+ }): SourceControlFetchPort;
15
+ //# sourceMappingURL=kit.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { assertNotRedirected, DeployError, redirectGuardInit } from '../deploy/index.js';
2
+ /** Build a kit without globals or a silently missing guarded HTTP client. */
3
+ export function createSourceControlProviderKit(required) {
4
+ return {
5
+ fetch: ({ url, init }) => required.fetch({ url }, { init: redirectGuardInit({ init }) }),
6
+ redirectGuardInit: ({ init }) => redirectGuardInit({ init }),
7
+ assertNotRedirected: ({ response, hostName }) => assertNotRedirected({ resp: response, providerLabel: hostName }),
8
+ isRedirectRefusal: ({ error }) => error instanceof DeployError,
9
+ httpClient: required.httpClient,
10
+ describeTransportError: input => required.describeTransportError(input),
11
+ };
12
+ }
13
+ /** Adapt a host-selected native/guarded fetch without choosing a global transport. */
14
+ export function createSourceControlFetchAdapter(required) {
15
+ return ({ url }, optional = {}) => required.fetch(url, optional.init);
16
+ }
17
+ //# sourceMappingURL=kit.js.map
@@ -0,0 +1,100 @@
1
+ import type { DescriptorExtensionReader, LoadedSourceControlProvider, ProviderCatalogPort, SourceControlProvider, SourceControlProviderDescriptor, SourceControlProviderKit, SourceControlProviderRegistry } from './contracts.js';
2
+ type ParseResult = {
3
+ ok: true;
4
+ descriptors: SourceControlProviderDescriptor[];
5
+ } | {
6
+ ok: false;
7
+ reason: string;
8
+ };
9
+ /** Parse generic host facts; the caller validates credential/i18n extensions. Unknown keys are ignored. */
10
+ export declare function parseSourceControlProvidersFile(required: {
11
+ raw: string;
12
+ readExtensions: DescriptorExtensionReader;
13
+ }): ParseResult;
14
+ /** Fresh instance-local registry; only the catalog can grant the ability to import trusted modules. */
15
+ export declare function loadSourceControlProviderRegistry(required: {
16
+ workspaceId: string;
17
+ descriptorFileName: string;
18
+ catalog: ProviderCatalogPort;
19
+ readExtensions: DescriptorExtensionReader;
20
+ describeError(required: {
21
+ error: unknown;
22
+ }): string;
23
+ }): Promise<SourceControlProviderRegistry>;
24
+ /** Build operations and host facts without allowing module operations to overwrite declared facts. */
25
+ export declare function buildLoadedSourceControlProvider(required: {
26
+ loaded: LoadedSourceControlProvider;
27
+ kit: SourceControlProviderKit;
28
+ }): SourceControlProvider;
29
+ export type BuildSourceControlProviderResult = {
30
+ ok: true;
31
+ provider: SourceControlProvider;
32
+ } | {
33
+ ok: false;
34
+ message: string;
35
+ refusals: readonly string[];
36
+ };
37
+ export interface BuildProviderArgs {
38
+ workspaceId: string;
39
+ providerId: string;
40
+ kit: SourceControlProviderKit;
41
+ load(required: {
42
+ workspaceId: string;
43
+ }): Promise<SourceControlProviderRegistry>;
44
+ noProviderMessage(required: {
45
+ registry: SourceControlProviderRegistry;
46
+ providerId: string;
47
+ }): string;
48
+ }
49
+ /** Operator navigation/copy is supplied by the host, with no descriptor or product defaults. */
50
+ export declare function buildSourceControlProvider(required: BuildProviderArgs): Promise<BuildSourceControlProviderResult>;
51
+ export interface BuildProvidersArgs {
52
+ workspaceId: string;
53
+ kit: SourceControlProviderKit;
54
+ load(required: {
55
+ workspaceId: string;
56
+ }): Promise<SourceControlProviderRegistry>;
57
+ noProviderMessage(required: {
58
+ registry: SourceControlProviderRegistry;
59
+ }): string;
60
+ }
61
+ /** Build every enabled provider over the same guarded kit, in catalog order. */
62
+ export declare function buildSourceControlProviders(required: BuildProvidersArgs): Promise<{
63
+ providers: readonly SourceControlProvider[];
64
+ refusals: readonly string[];
65
+ noProviderMessage: string;
66
+ }>;
67
+ /** Build and select a provider for one custom credential's API origin. */
68
+ export declare function buildSourceControlProviderForApi(required: BuildProvidersArgs & {
69
+ baseUrl: string;
70
+ }): Promise<BuildSourceControlProviderResult>;
71
+ /** Find the folder or ancestor that has provider-defined reserved semantics, ignoring case. */
72
+ export declare function findReservedPath(required: {
73
+ folder: string;
74
+ }, optional?: {
75
+ reservedPaths?: readonly string[];
76
+ }): string | undefined;
77
+ /** Workflow recognition is case-sensitive and relative to repository root. */
78
+ export declare function isUnderWorkflowPath(required: {
79
+ filePath: string;
80
+ }, optional?: {
81
+ workflowPaths?: readonly string[];
82
+ }): boolean;
83
+ /** URL origin or undefined for malformed URLs. */
84
+ export declare function originOf(required: {
85
+ url: string;
86
+ }): string | undefined;
87
+ /** Exact API-origin match first; a sole provider may serve a self-hosted origin. */
88
+ export declare function pickSourceControlProviderForApi(required: {
89
+ providers: readonly SourceControlProvider[];
90
+ baseUrl: string;
91
+ noProviderMessage: string;
92
+ }): {
93
+ ok: true;
94
+ provider: SourceControlProvider;
95
+ } | {
96
+ ok: false;
97
+ message: string;
98
+ };
99
+ export {};
100
+ //# sourceMappingURL=registry.d.ts.map