dataiku-sdk 0.12.7 → 1.1.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 (61) hide show
  1. package/README.md +93 -15
  2. package/bin/dss.js +21 -2
  3. package/dist/build-metadata.json +1 -0
  4. package/dist/packages/types/src/index.d.ts +128 -3
  5. package/dist/packages/types/src/index.js +106 -3
  6. package/dist/src/cli/coerce.d.ts +2 -1
  7. package/dist/src/cli/coerce.js +84 -26
  8. package/dist/src/cli/commands/app.js +6 -6
  9. package/dist/src/cli/commands/code.js +2 -2
  10. package/dist/src/cli/commands/data-quality.js +50 -8
  11. package/dist/src/cli/commands/dataset.d.ts +23 -0
  12. package/dist/src/cli/commands/dataset.js +197 -12
  13. package/dist/src/cli/commands/folder.js +5 -4
  14. package/dist/src/cli/commands/future.js +2 -2
  15. package/dist/src/cli/commands/index.js +2 -0
  16. package/dist/src/cli/commands/job.js +26 -13
  17. package/dist/src/cli/commands/notebook.js +1 -1
  18. package/dist/src/cli/commands/project-git.d.ts +2 -0
  19. package/dist/src/cli/commands/project-git.js +563 -0
  20. package/dist/src/cli/commands/project.js +118 -14
  21. package/dist/src/cli/commands/recipe.js +14 -17
  22. package/dist/src/cli/commands/scenario.js +4 -4
  23. package/dist/src/cli/contract.d.ts +6 -4
  24. package/dist/src/cli/contract.js +595 -68
  25. package/dist/src/cli/doctor.d.ts +12 -2
  26. package/dist/src/cli/doctor.js +50 -19
  27. package/dist/src/cli/flags.js +23 -2
  28. package/dist/src/cli/helpers/cleanup.js +30 -1
  29. package/dist/src/cli/helpers/dataset.js +1 -1
  30. package/dist/src/cli/output.d.ts +5 -2
  31. package/dist/src/cli/output.js +13 -12
  32. package/dist/src/cli/types.d.ts +2 -0
  33. package/dist/src/cli/usage.d.ts +1 -1
  34. package/dist/src/cli/usage.js +2 -1
  35. package/dist/src/cli/version.d.ts +48 -6
  36. package/dist/src/cli/version.js +177 -11
  37. package/dist/src/cli.js +94 -39
  38. package/dist/src/client.d.ts +31 -1
  39. package/dist/src/client.js +39 -7
  40. package/dist/src/errors.d.ts +1 -1
  41. package/dist/src/index.d.ts +6 -4
  42. package/dist/src/index.js +3 -1
  43. package/dist/src/resources/connections.d.ts +3 -1
  44. package/dist/src/resources/connections.js +82 -21
  45. package/dist/src/resources/datasets.d.ts +43 -0
  46. package/dist/src/resources/datasets.js +241 -30
  47. package/dist/src/resources/folders.js +7 -3
  48. package/dist/src/resources/project-git.d.ts +154 -0
  49. package/dist/src/resources/project-git.js +427 -0
  50. package/dist/src/resources/projects.d.ts +36 -3
  51. package/dist/src/resources/projects.js +127 -16
  52. package/dist/src/resources/recipes.js +4 -4
  53. package/dist/src/schemas.d.ts +2 -2
  54. package/dist/src/schemas.js +1 -1
  55. package/dist/src/utils/project-archive.d.ts +32 -0
  56. package/dist/src/utils/project-archive.js +624 -0
  57. package/package.json +6 -5
  58. package/packages/types/dist/index.d.ts +128 -3
  59. package/packages/types/dist/index.js +106 -3
  60. package/plugin.json +1 -1
  61. package/skills/dataiku-dss/SKILL.md +26 -19
@@ -38,6 +38,7 @@ export interface FixtureDiscoveryResult {
38
38
  export interface DoctorEnvironment {
39
39
  projectKey?: string;
40
40
  dssVersion?: string;
41
+ dssApiVersion?: string;
41
42
  instanceTime?: string;
42
43
  integrationFlags: {
43
44
  mutating: boolean;
@@ -48,6 +49,15 @@ export interface DoctorEnvironment {
48
49
  apiServices: boolean;
49
50
  };
50
51
  }
52
+ /**
53
+ * Server provenance captured from documented response headers on the public
54
+ * project-list connectivity call. Null entries mean the header was absent.
55
+ */
56
+ export interface DoctorVersionInfo {
57
+ dssVersion: string | null;
58
+ dssApiVersion: string | null;
59
+ instanceTime: string | null;
60
+ }
51
61
  export interface DoctorResult {
52
62
  ok: boolean;
53
63
  checks: DoctorCheck[];
@@ -66,7 +76,7 @@ export interface DoctorResult {
66
76
  export declare function errorDetails(error: unknown): Record<string, unknown>;
67
77
  export declare function firstStringField(items: unknown[] | undefined, fields: string[]): string | null;
68
78
  export declare function integrationFlag(name: string): boolean;
69
- export declare function doctorEnvironment(projectKey?: string): DoctorEnvironment;
79
+ export declare function doctorEnvironment(projectKey?: string, versionInfo?: DoctorVersionInfo): DoctorEnvironment;
70
80
  export declare function permissionStatusForError(error: unknown): PermissionStatus;
71
81
  export declare function probeDoctorPermission(probe: () => Promise<unknown>): Promise<{
72
82
  status: PermissionStatus;
@@ -96,7 +106,7 @@ export declare function firstSafeJupyterNotebook(items: unknown[]): {
96
106
  unsafe: FixtureReject[];
97
107
  };
98
108
  export declare function discoverFixtureReport(client: DataikuClient, projectKey: string, flags: Record<string, string | boolean>): Promise<FixtureDiscoveryResult>;
99
- export declare function doctorCapabilities(client: DataikuClient, projectKey: string | undefined, accessibleProjects: unknown[] | undefined, flags: Record<string, string | boolean>): Promise<Pick<DoctorResult, "permissions" | "permissionDetails" | "fixtures" | "environment">>;
109
+ export declare function doctorCapabilities(client: DataikuClient, projectKey: string | undefined, accessibleProjects: unknown[] | undefined, flags: Record<string, string | boolean>, versionInfo?: DoctorVersionInfo): Promise<Pick<DoctorResult, "permissions" | "permissionDetails" | "fixtures" | "environment">>;
100
110
  export declare function runDoctor(flags: Record<string, string | boolean>): Promise<{
101
111
  result: DoctorResult;
102
112
  exitCode: number;
@@ -1,5 +1,6 @@
1
1
  import { DataikuClient, } from "../client.js";
2
2
  import { DataikuError, } from "../errors.js";
3
+ import { ProjectSummaryArraySchema, safeParseSchema, } from "../schemas.js";
3
4
  import { num, splitCsvFlag, stringField, } from "./coerce.js";
4
5
  import { currentCommandContext, resolveCredentials, } from "./runtime.js";
5
6
  import { UsageError, } from "./usage.js";
@@ -31,9 +32,12 @@ export function integrationFlag(name) {
31
32
  const value = process.env[name];
32
33
  return value === "1" || value?.toLowerCase() === "true";
33
34
  }
34
- export function doctorEnvironment(projectKey) {
35
+ export function doctorEnvironment(projectKey, versionInfo) {
35
36
  return {
36
37
  ...(projectKey ? { projectKey, } : {}),
38
+ ...(versionInfo?.dssVersion ? { dssVersion: versionInfo.dssVersion, } : {}),
39
+ ...(versionInfo?.dssApiVersion ? { dssApiVersion: versionInfo.dssApiVersion, } : {}),
40
+ ...(versionInfo?.instanceTime ? { instanceTime: versionInfo.instanceTime, } : {}),
37
41
  integrationFlags: {
38
42
  mutating: integrationFlag("RUN_DATAIKU_INTEGRATION_MUTATING"),
39
43
  adminMutating: integrationFlag("RUN_DATAIKU_ADMIN_MUTATING"),
@@ -174,7 +178,7 @@ export async function discoverFixtureReport(client, projectKey, flags) {
174
178
  },
175
179
  };
176
180
  }
177
- export async function doctorCapabilities(client, projectKey, accessibleProjects, flags) {
181
+ export async function doctorCapabilities(client, projectKey, accessibleProjects, flags, versionInfo) {
178
182
  const probeProjectKey = projectKey ?? firstStringField(accessibleProjects, ["projectKey",])
179
183
  ?? undefined;
180
184
  const probes = {
@@ -210,7 +214,7 @@ export async function doctorCapabilities(client, projectKey, accessibleProjects,
210
214
  const capabilityResult = {
211
215
  permissions,
212
216
  ...(Object.keys(permissionDetails).length > 0 ? { permissionDetails, } : {}),
213
- environment: doctorEnvironment(projectKey),
217
+ environment: doctorEnvironment(projectKey, versionInfo),
214
218
  };
215
219
  if (flags["fast"] !== true && probeProjectKey) {
216
220
  try {
@@ -255,9 +259,10 @@ export async function runDoctor(flags) {
255
259
  : "Missing Dataiku URL and/or API key. Set DATAIKU_URL/DATAIKU_API_KEY or pass --url/--api-key.",
256
260
  });
257
261
  let accessibleProjects;
262
+ let environmentVersion;
258
263
  if (credentialsOk) {
259
- const requestTimeoutMs = num(flags["request-timeout"]);
260
- const retryMaxAttempts = num(flags["retries"]);
264
+ const requestTimeoutMs = num(flags["request-timeout"], "--request-timeout");
265
+ const retryMaxAttempts = num(flags["retries"], "--retries");
261
266
  const client = new DataikuClient({
262
267
  url,
263
268
  apiKey,
@@ -269,14 +274,40 @@ export async function runDoctor(flags) {
269
274
  caCertPath,
270
275
  });
271
276
  try {
272
- const projects = await client.projects.list();
273
- accessibleProjects = projects;
274
- checks.push({
275
- name: "connectivity",
276
- ok: true,
277
- message: "Connected to DSS and listed accessible projects.",
278
- details: { projectCount: projects.length, },
279
- });
277
+ const projects = await client.getWithMetadata("/public/api/projects/");
278
+ // Documented headers on the public project-list call populate the
279
+ // optional environment fields; absent headers stay absent. Header
280
+ // provenance is independent of the body being well-formed.
281
+ environmentVersion = {
282
+ dssVersion: projects.meta.dssVersion,
283
+ dssApiVersion: projects.meta.dssApiVersion,
284
+ instanceTime: projects.meta.date,
285
+ };
286
+ // A reachable endpoint that answers with something other than a
287
+ // project list is not working connectivity: the body never becomes
288
+ // capability input, so probes cannot iterate a non-array.
289
+ const parsed = safeParseSchema(ProjectSummaryArraySchema, projects.data);
290
+ if (parsed.success) {
291
+ accessibleProjects = parsed.data;
292
+ checks.push({
293
+ name: "connectivity",
294
+ ok: true,
295
+ message: "Connected to DSS and listed accessible projects.",
296
+ details: { projectCount: parsed.data.length, },
297
+ });
298
+ }
299
+ else {
300
+ checks.push({
301
+ name: "connectivity",
302
+ ok: false,
303
+ message: "Connected to DSS but the project list response was not a project list.",
304
+ details: {
305
+ reason: "invalid_project_list",
306
+ errorCount: parsed.errors.length,
307
+ errors: parsed.errors.slice(0, 5),
308
+ },
309
+ });
310
+ }
280
311
  }
281
312
  catch (error) {
282
313
  checks.push({
@@ -311,8 +342,8 @@ export async function runDoctor(flags) {
311
342
  }
312
343
  const result = { ok: checks.every((check) => check.ok), checks, context, };
313
344
  if (flags["capabilities"] === true && credentialsOk) {
314
- const requestTimeoutMs = num(flags["request-timeout"]);
315
- const retryMaxAttempts = num(flags["retries"]) ?? 1;
345
+ const requestTimeoutMs = num(flags["request-timeout"], "--request-timeout");
346
+ const retryMaxAttempts = num(flags["retries"], "--retries") ?? 1;
316
347
  const client = new DataikuClient({
317
348
  url,
318
349
  apiKey,
@@ -323,8 +354,8 @@ export async function runDoctor(flags) {
323
354
  tlsRejectUnauthorized,
324
355
  caCertPath,
325
356
  });
326
- result.environment = doctorEnvironment(projectKey);
327
- Object.assign(result, await doctorCapabilities(client, projectKey, accessibleProjects, flags));
357
+ result.environment = doctorEnvironment(projectKey, environmentVersion);
358
+ Object.assign(result, await doctorCapabilities(client, projectKey, accessibleProjects, flags, environmentVersion));
328
359
  }
329
360
  return { result, exitCode: result.ok ? 0 : 2, };
330
361
  }
@@ -340,8 +371,8 @@ export async function runFixtures(flags) {
340
371
  throw new UsageError("Missing project key. Set DATAIKU_PROJECT_KEY or pass --project-key.", "missing_required_flag");
341
372
  }
342
373
  currentCommandContext.projectKey = projectKey;
343
- const requestTimeoutMs = num(flags["request-timeout"]);
344
- const retryMaxAttempts = num(flags["retries"]) ?? 1;
374
+ const requestTimeoutMs = num(flags["request-timeout"], "--request-timeout");
375
+ const retryMaxAttempts = num(flags["retries"], "--retries") ?? 1;
345
376
  const client = new DataikuClient({
346
377
  url,
347
378
  apiKey,
@@ -7,7 +7,6 @@ export const BOOLEAN_FLAGS = new Set([
7
7
  "global",
8
8
  "list-agents",
9
9
  "include-raw",
10
- "raw",
11
10
  "include-payload",
12
11
  "no-payload",
13
12
  "include-logs",
@@ -22,7 +21,6 @@ export const BOOLEAN_FLAGS = new Set([
22
21
  "wait",
23
22
  "if-not-exists",
24
23
  "if-exists",
25
- "json",
26
24
  "no-wait",
27
25
  "force-rebuild",
28
26
  "latest",
@@ -40,6 +38,14 @@ export const BOOLEAN_FLAGS = new Set([
40
38
  "drop-data",
41
39
  "normalize",
42
40
  "unconfirmed-creation",
41
+ "remote",
42
+ "duplicate-project",
43
+ "delete-remotely",
44
+ "force-delete",
45
+ "i-know-what-i-am-doing",
46
+ "no-add-to-python-path",
47
+ "delete-directory",
48
+ "peek",
43
49
  ]);
44
50
  export const SHORT_FLAGS = {
45
51
  v: "verbose",
@@ -71,26 +77,32 @@ export const VALUE_FLAGS = new Set([
71
77
  "backup-dir",
72
78
  "backend-type",
73
79
  "backup",
80
+ "branch",
74
81
  "ca-cert",
75
82
  "catalog",
83
+ "checkout",
76
84
  "cell-id",
77
85
  "allow-types",
78
86
  "color",
87
+ "commit",
79
88
  "connection",
80
89
  "contains",
81
90
  "content",
82
91
  "content-type",
92
+ "count",
83
93
  "data",
84
94
  "active",
85
95
  "deployment-mode",
86
96
  "env-version",
87
97
  "expect-hash",
88
98
  "expect-project-incarnation",
99
+ "expected",
89
100
  "expect-version",
90
101
  "data-file",
91
102
  "database",
92
103
  "dataset",
93
104
  "file",
105
+ "file-name",
94
106
  "file-type",
95
107
  "env",
96
108
  "install-core-packages",
@@ -110,6 +122,7 @@ export const VALUE_FLAGS = new Set([
110
122
  "package",
111
123
  "packages",
112
124
  "local",
125
+ "login",
113
126
  "manifest-version",
114
127
  "max-edges",
115
128
  "max-lines",
@@ -120,6 +133,7 @@ export const VALUE_FLAGS = new Set([
120
133
  "max-rows",
121
134
  "limit",
122
135
  "max-timestamp",
136
+ "message",
123
137
  "only-monitored",
124
138
  "min-timestamp",
125
139
  "mode",
@@ -140,12 +154,16 @@ export const VALUE_FLAGS = new Set([
140
154
  "partition",
141
155
  "parent",
142
156
  "path",
157
+ "path-in-repository",
143
158
  "preview",
144
159
  "prediction-type",
145
160
  "project-key",
146
161
  "recipe",
162
+ "reference",
163
+ "repository",
147
164
  "request-timeout",
148
165
  "params",
166
+ "password-env",
149
167
  "results-per-page",
150
168
  "record-cleanup",
151
169
  "rule-id",
@@ -164,11 +182,14 @@ export const VALUE_FLAGS = new Set([
164
182
  "sql",
165
183
  "schema",
166
184
  "sql-file",
185
+ "start-commit",
167
186
  "start-retries",
168
187
  "standard",
169
188
  "state",
170
189
  "streaming-endpoint",
171
190
  "target",
191
+ "target-project-folder-id",
192
+ "target-project-key",
172
193
  "task-type",
173
194
  "test-dataset",
174
195
  "train-dataset",
@@ -4,7 +4,7 @@ export function projectArg(projectKey) {
4
4
  }
5
5
  export function cleanupLedgerEntry(resource, action, args, flags, result, projectKey) {
6
6
  if (!(action.startsWith("create") || action === "clone" || action === "duplicate"
7
- || action === "upload"))
7
+ || action === "import" || action === "upload"))
8
8
  return undefined;
9
9
  const record = resultRecord(result);
10
10
  if (record.skipped !== undefined)
@@ -190,6 +190,35 @@ export function cleanupLedgerEntry(resource, action, args, flags, result, projec
190
190
  path: args[1],
191
191
  cleanup: { argv: ["folder", "delete-file", args[0], args[1], ...withProject,], },
192
192
  };
193
+ case "project.import": {
194
+ const usedProjectKey = stringField(record, ["usedProjectKey",]);
195
+ const recordedIncarnation = stringField(record, ["projectIncarnationHash",]);
196
+ const boundIncarnation = recordedIncarnation
197
+ && /^[0-9a-f]{64}$/.test(recordedIncarnation)
198
+ ? recordedIncarnation
199
+ : undefined;
200
+ // Only a verified success may produce a cleanup entry, and it must
201
+ // bind the concrete landed project incarnation: replaying an
202
+ // unbound delete could remove a replacement project that reused the
203
+ // key. Never emit legacy/unbound project entries.
204
+ if (!usedProjectKey || !boundIncarnation)
205
+ return undefined;
206
+ return {
207
+ ...base,
208
+ projectKey: usedProjectKey,
209
+ name: usedProjectKey,
210
+ cleanup: {
211
+ argv: [
212
+ "project",
213
+ "delete",
214
+ usedProjectKey,
215
+ "--if-exists",
216
+ "--expect-project-incarnation",
217
+ boundIncarnation,
218
+ ],
219
+ },
220
+ };
221
+ }
193
222
  case "app.create-instance":
194
223
  case "app.create-successor-instance": {
195
224
  const targetKey = stringField(record, ["projectKey", "targetProjectKey",]);
@@ -6,7 +6,7 @@ export function datasetSourceSummary(details) {
6
6
  projectKey: details.projectKey,
7
7
  type: details.type,
8
8
  managed: details.managed,
9
- connection: params.connection,
9
+ connection: params.connection ?? params.uploadConnection,
10
10
  catalog: params.catalog,
11
11
  schema: params.schema,
12
12
  table: params.table,
@@ -1,8 +1,9 @@
1
1
  import type { DataikuClient } from "../client.js";
2
2
  import { type StableErrorCode } from "../errors.js";
3
- export declare function setCompactJsonOutput(compact: boolean): void;
4
3
  export declare function setOutputFieldProjection(fields: string[] | undefined): void;
5
4
  export declare function enqueueCliWarning(warning: Record<string, unknown>): void;
5
+ /** Emit queued warnings as one JSONL warning event on stderr. Idempotent. */
6
+ export declare function flushCliWarnings(): void;
6
7
  export declare function pickResultFields(item: unknown, fields: string[]): unknown;
7
8
  /**
8
9
  * Project the top-level fields callers asked for via --fields. Arrays are mapped
@@ -20,7 +21,8 @@ export declare function commandFailureExitCode(result: unknown): number | undefi
20
21
  * Stable error code for a command-level failure report. A failed synchronous
21
22
  * assertion (exit 4) is a distinct outcome from a failed long-running remote
22
23
  * operation (also exit 4), so agents must never see `long_running_failure`
23
- * for a result that finished synchronously with `unchanged: false`.
24
+ * for a result that finished synchronously with `unchanged: false` or
25
+ * `satisfied: false`.
24
26
  */
25
27
  export declare function commandFailureCode(result: unknown, exitCode: number): StableErrorCode;
26
28
  export declare class CommandResultFailure extends Error {
@@ -43,6 +45,7 @@ export declare function planResult(resource: string, action: string, options: {
43
45
  payload?: unknown;
44
46
  localWrites?: unknown;
45
47
  plannedAndDryRun?: boolean;
48
+ requests?: unknown;
46
49
  wait?: unknown;
47
50
  }): Record<string, unknown>;
48
51
  export declare function encodedProjectEndpoint(client: DataikuClient, projectKey: string | undefined, suffix: string): string;
@@ -1,9 +1,5 @@
1
1
  import { DataikuError, } from "../errors.js";
2
2
  let outputFieldProjection;
3
- let compactJsonOutput = false;
4
- export function setCompactJsonOutput(compact) {
5
- compactJsonOutput = compact;
6
- }
7
3
  export function setOutputFieldProjection(fields) {
8
4
  outputFieldProjection = fields;
9
5
  }
@@ -17,7 +13,7 @@ export function enqueueCliWarning(warning) {
17
13
  pendingCliWarnings.push(warning);
18
14
  }
19
15
  /** Emit queued warnings as one JSONL warning event on stderr. Idempotent. */
20
- function flushCliWarnings() {
16
+ export function flushCliWarnings() {
21
17
  if (pendingCliWarnings.length === 0)
22
18
  return;
23
19
  const warnings = pendingCliWarnings;
@@ -57,7 +53,7 @@ export function writeCommandResult(result) {
57
53
  const projected = outputFieldProjection
58
54
  ? projectResultFields(result, outputFieldProjection)
59
55
  : result;
60
- process.stdout.write(`${JSON.stringify(projected ?? { ok: true, }, null, compactJsonOutput ? undefined : 2)}\n`);
56
+ process.stdout.write(`${JSON.stringify(projected ?? { ok: true, })}\n`);
61
57
  }
62
58
  export function transientBodyWithTargetContext(body, target, elapsedMs) {
63
59
  try {
@@ -91,10 +87,10 @@ export function isFailedWaitResult(result) {
91
87
  && (typeof record.state === "string" || typeof record.outcome === "string");
92
88
  }
93
89
  export function isAssertionFailureResult(result) {
94
- return result !== null
95
- && typeof result === "object"
96
- && !Array.isArray(result)
97
- && result.unchanged === false;
90
+ if (result === null || typeof result !== "object" || Array.isArray(result))
91
+ return false;
92
+ const record = result;
93
+ return record.unchanged === false || record.satisfied === false;
98
94
  }
99
95
  function isNestedAssertionFailureResult(result) {
100
96
  if (result === null || typeof result !== "object" || Array.isArray(result))
@@ -125,7 +121,8 @@ export function commandFailureExitCode(result) {
125
121
  * Stable error code for a command-level failure report. A failed synchronous
126
122
  * assertion (exit 4) is a distinct outcome from a failed long-running remote
127
123
  * operation (also exit 4), so agents must never see `long_running_failure`
128
- * for a result that finished synchronously with `unchanged: false`.
124
+ * for a result that finished synchronously with `unchanged: false` or
125
+ * `satisfied: false`.
129
126
  */
130
127
  export function commandFailureCode(result, exitCode) {
131
128
  if (isAssertionFailureResult(result) || isNestedAssertionFailureResult(result)) {
@@ -154,7 +151,10 @@ export function commandFailureMessage(result) {
154
151
  return `Command completed with failed long-running result${state ? `: ${state}` : ""}.`;
155
152
  }
156
153
  if (isAssertionFailureResult(result)) {
157
- return "Command completed with failed assertion result.";
154
+ const record = result;
155
+ return record.unchanged === false
156
+ ? "Command completed with failed assertion result."
157
+ : "Command completed with unsatisfied assertion result.";
158
158
  }
159
159
  if (isNestedAssertionFailureResult(result)) {
160
160
  return "Command completed with nested failed assertion result.";
@@ -192,6 +192,7 @@ export function planResult(resource, action, options) {
192
192
  ...(options.endpoint ? { endpoint: options.endpoint, } : {}),
193
193
  ...(options.payload !== undefined ? { payload: options.payload, } : {}),
194
194
  ...(options.localWrites !== undefined ? { localWrites: options.localWrites, } : {}),
195
+ ...(options.requests !== undefined ? { requests: options.requests, } : {}),
195
196
  ...(options.wait !== undefined ? { wait: options.wait, } : {}),
196
197
  idempotency: options.idempotency,
197
198
  async: options.asyncKind,
@@ -1,5 +1,6 @@
1
1
  import type { DataikuClient } from "../client.js";
2
2
  export type CommandHandler = (client: DataikuClient, args: string[], flags: Record<string, string | boolean>) => Promise<unknown>;
3
+ export type LocalCommandHandler = (args: string[], flags: Record<string, string | boolean>) => Promise<unknown>;
3
4
  export interface CommandPayloadSchema {
4
5
  stdin?: boolean;
5
6
  dataFlag?: boolean;
@@ -19,6 +20,7 @@ export interface CommandRegistryOverride {
19
20
  }
20
21
  export interface CommandMeta extends CommandRegistryOverride {
21
22
  handler: CommandHandler;
23
+ localHandler?: LocalCommandHandler;
22
24
  usage: string;
23
25
  description?: string;
24
26
  examples?: string[];
@@ -6,7 +6,7 @@ export declare class UsageError extends Error {
6
6
  readonly details?: Record<string, unknown>;
7
7
  constructor(message: string, code?: StableErrorCode, hint?: string, details?: Record<string, unknown>);
8
8
  }
9
- export declare const COMMANDS_RUN_HINT = "Use `dss commands run --fields RESOURCE.ACTION --json` for scoped, compact command discovery; omit --fields only when you need the full registry.";
9
+ export declare const COMMANDS_RUN_HINT = "Use `dss commands run --fields RESOURCE.ACTION` for scoped command discovery; use `dss commands run` for the action summary or `--output PATH` to export the full registry.";
10
10
  export declare function unsupportedHelpFlag(): UsageError;
11
11
  export declare function noCommandError(): UsageError;
12
12
  export declare function missingActionError(resource: string, validActions: string[], usage?: string): UsageError;
@@ -8,6 +8,7 @@ export const RESOURCE_NAMES = [
8
8
  "api-deployer",
9
9
  "bundle",
10
10
  "project-deployer",
11
+ "project-git",
11
12
  "project-library",
12
13
  "streaming-endpoint",
13
14
  "continuous-activity",
@@ -59,7 +60,7 @@ export class UsageError extends Error {
59
60
  this.details = details;
60
61
  }
61
62
  }
62
- export const COMMANDS_RUN_HINT = "Use `dss commands run --fields RESOURCE.ACTION --json` for scoped, compact command discovery; omit --fields only when you need the full registry.";
63
+ export const COMMANDS_RUN_HINT = "Use `dss commands run --fields RESOURCE.ACTION` for scoped command discovery; use `dss commands run` for the action summary or `--output PATH` to export the full registry.";
63
64
  export function unsupportedHelpFlag() {
64
65
  return new UsageError("Help screens are not supported.", "usage_error", COMMANDS_RUN_HINT, { command: "dss commands run", });
65
66
  }
@@ -1,14 +1,56 @@
1
1
  export declare function findPackageRoot(): string | undefined;
2
2
  export declare function packageVersion(packageRoot: string | undefined): string;
3
3
  export declare function gitDirectory(packageRoot: string): string;
4
+ export declare function isFullRevision(value: unknown): boolean;
5
+ /**
6
+ * Full checkout HEAD revision (40-lowercase-hex) — the basis for staleness
7
+ * comparison. Resolution follows Git's own layouts: a detached revision, then
8
+ * loose refs in the worktree git dir, then the shared store reached through
9
+ * `commondir`, then packed-refs in each. Anything that is not a full
10
+ * lowercase hexadecimal revision is rejected.
11
+ */
12
+ export declare function gitFullRevision(packageRoot: string | undefined): string | undefined;
4
13
  export declare function gitRevision(packageRoot: string | undefined): string | undefined;
14
+ export type CliLoadSource = "source" | "dist";
15
+ export type CliRuntime = "bun" | "node";
16
+ export declare function detectLoadSource(modulePath?: string): CliLoadSource;
17
+ export declare function buildMetadataRevision(packageRoot: string | undefined): string | undefined;
18
+ /**
19
+ * Whether compiled CLI output predates any source input. The build metadata
20
+ * file is written after `tsc`, so its mtime is the build-completion marker.
21
+ * Installed packages omit `src/`; without both sides there is no drift claim.
22
+ */
23
+ export declare function sourceTreeNewerThanBuild(packageRoot: string | undefined): boolean;
24
+ /**
25
+ * CLI provenance payload. `source` distinguishes a source checkout run from a
26
+ * published dist run; `runtime` names the executing runtime. `buildRevision`
27
+ * is only ever claimed by a dist build that carries build metadata — source
28
+ * execution never claims one. `staleBuild` is true only when the running dist
29
+ * build revision differs from the checkout or a source input is newer than the
30
+ * build-completion marker.
31
+ */
32
+ export interface CliVersionPayload {
33
+ version: string;
34
+ gitRevision: string | null;
35
+ source: CliLoadSource;
36
+ runtime: CliRuntime;
37
+ buildRevision: string | null;
38
+ staleBuild: boolean;
39
+ }
40
+ export declare function detectRuntime(): CliRuntime;
41
+ export declare function buildVersionPayload(input: {
42
+ packageVersion: string;
43
+ checkoutRevision: string | undefined;
44
+ checkoutFullRevision: string | undefined;
45
+ loadSource: string | undefined;
46
+ buildRevision: string | undefined;
47
+ sourceNewerThanBuild?: boolean;
48
+ runtime: CliRuntime;
49
+ }): CliVersionPayload;
5
50
  export declare const PACKAGE_ROOT: string | undefined;
6
51
  export declare const CLI_VERSION: string;
7
52
  export declare const CLI_GIT_REVISION: string | undefined;
8
- export declare const AGENT_CONTRACT_VERSION = 1;
53
+ export declare const AGENT_CONTRACT_VERSION = 2;
9
54
  export declare const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
10
- export declare const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-v1.json";
11
- export declare function cliVersionResult(): {
12
- version: string;
13
- gitRevision: string | null;
14
- };
55
+ export declare const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-v2.json";
56
+ export declare function cliVersionResult(): CliVersionPayload;