dataiku-sdk 0.2.1 → 0.2.3
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/dist/src/cli.js +17 -8
- package/dist/src/skill.d.ts +5 -0
- package/dist/src/skill.js +26 -1
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import { validateCredentials, } from "./auth.js";
|
|
|
9
9
|
import { DataikuClient, } from "./client.js";
|
|
10
10
|
import { deleteCredentials, getCredentialsPath, loadCredentials, maskApiKey, saveCredentials, } from "./config.js";
|
|
11
11
|
import { DataikuError, } from "./errors.js";
|
|
12
|
-
import { AGENTS, detectAgents, installSkill, } from "./skill.js";
|
|
12
|
+
import { AGENTS, detectAgents, findWorkspaceRoot, installSkill, } from "./skill.js";
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
// Utility helpers
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
@@ -158,6 +158,10 @@ const SHORT_FLAGS = {
|
|
|
158
158
|
f: "format",
|
|
159
159
|
o: "output",
|
|
160
160
|
};
|
|
161
|
+
/** Long-flag aliases: these are normalized to the canonical name in parseArgs. */
|
|
162
|
+
const FLAG_ALIASES = {
|
|
163
|
+
project: "project-key",
|
|
164
|
+
};
|
|
161
165
|
function parseArgs(argv) {
|
|
162
166
|
const positional = [];
|
|
163
167
|
const flags = {};
|
|
@@ -171,10 +175,11 @@ function parseArgs(argv) {
|
|
|
171
175
|
if (arg.startsWith("--")) {
|
|
172
176
|
const eqIdx = arg.indexOf("=");
|
|
173
177
|
if (eqIdx !== -1) {
|
|
174
|
-
|
|
178
|
+
const raw = arg.slice(2, eqIdx);
|
|
179
|
+
flags[FLAG_ALIASES[raw] ?? raw] = arg.slice(eqIdx + 1);
|
|
175
180
|
}
|
|
176
181
|
else {
|
|
177
|
-
const flagName = arg.slice(2);
|
|
182
|
+
const flagName = FLAG_ALIASES[arg.slice(2)] ?? arg.slice(2);
|
|
178
183
|
if (BOOLEAN_FLAGS.has(flagName)) {
|
|
179
184
|
flags[flagName] = true;
|
|
180
185
|
}
|
|
@@ -577,13 +582,14 @@ const commands = {
|
|
|
577
582
|
},
|
|
578
583
|
download: {
|
|
579
584
|
handler: async (c, a, f) => {
|
|
580
|
-
requireArgs(a, 2, "dss folder download <name-or-id> <path>");
|
|
585
|
+
requireArgs(a, 2, "dss folder download <name-or-id> <remote-path> [local-path]");
|
|
586
|
+
const localPath = a[2] ?? f["output"];
|
|
581
587
|
return c.folders.download(await resolveFolderId(c, a[0], f), a[1], {
|
|
582
|
-
localPath
|
|
588
|
+
localPath,
|
|
583
589
|
projectKey: f["project-key"],
|
|
584
590
|
});
|
|
585
591
|
},
|
|
586
|
-
usage: "dss folder download <name-or-id> <path> [--output PATH] [--project-key KEY]",
|
|
592
|
+
usage: "dss folder download <name-or-id> <remote-path> [local-path] [--output PATH] [--project-key KEY]",
|
|
587
593
|
},
|
|
588
594
|
upload: {
|
|
589
595
|
handler: async (c, a, f) => {
|
|
@@ -1015,13 +1021,14 @@ async function main() {
|
|
|
1015
1021
|
if (resource === "install-skill") {
|
|
1016
1022
|
if (flags["help"] === true) {
|
|
1017
1023
|
const lines = [
|
|
1018
|
-
"Usage: dss install-skill [--global] [--agent NAME] [--list-agents]",
|
|
1024
|
+
"Usage: dss install-skill [--global] [--agent NAME] [--target PATH] [--list-agents]",
|
|
1019
1025
|
"",
|
|
1020
1026
|
"Install the dataiku-dss agent skill for detected coding agents.",
|
|
1021
1027
|
"",
|
|
1022
1028
|
"Flags:",
|
|
1023
1029
|
" --global Install to user-level global scope (default: project)",
|
|
1024
1030
|
" --agent NAME Target a specific agent: claude, codex, cursor, pi, omp",
|
|
1031
|
+
" --target PATH Project directory to install into (default: workspace root)",
|
|
1025
1032
|
" --list-agents Print detected agents and exit",
|
|
1026
1033
|
];
|
|
1027
1034
|
process.stderr.write(`${lines.join("\n")}\n`);
|
|
@@ -1030,6 +1037,7 @@ async function main() {
|
|
|
1030
1037
|
const listOnly = flags["list-agents"] === true;
|
|
1031
1038
|
const agentFilter = typeof flags["agent"] === "string" ? flags["agent"] : undefined;
|
|
1032
1039
|
const isGlobal = flags["global"] === true;
|
|
1040
|
+
const targetDir = typeof flags["target"] === "string" ? flags["target"] : undefined;
|
|
1033
1041
|
// Resolve target agents
|
|
1034
1042
|
let targets;
|
|
1035
1043
|
if (agentFilter) {
|
|
@@ -1058,8 +1066,9 @@ async function main() {
|
|
|
1058
1066
|
throw new UsageError("No coding agents detected. Install one (claude, codex, cursor, pi, omp) or use --agent NAME.");
|
|
1059
1067
|
}
|
|
1060
1068
|
const scope = isGlobal ? "global" : "project";
|
|
1069
|
+
const cwd = targetDir ?? (isGlobal ? process.cwd() : findWorkspaceRoot(process.cwd()));
|
|
1061
1070
|
process.stderr.write(`Installing dataiku-dss skill (${scope} scope):\n`);
|
|
1062
|
-
const results = installSkill(targets, { global: isGlobal, cwd
|
|
1071
|
+
const results = installSkill(targets, { global: isGlobal, cwd, });
|
|
1063
1072
|
for (const r of results) {
|
|
1064
1073
|
process.stderr.write(` ${r.agent} \u2192 ${r.path}\n`);
|
|
1065
1074
|
}
|
package/dist/src/skill.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export interface DetectedAgent {
|
|
|
23
23
|
via: "binary" | "config-dir" | "flag";
|
|
24
24
|
}
|
|
25
25
|
export declare function detectAgents(): DetectedAgent[];
|
|
26
|
+
/**
|
|
27
|
+
* Walk upward from startDir looking for common workspace markers.
|
|
28
|
+
* Returns the first directory containing a marker, or startDir if none found.
|
|
29
|
+
*/
|
|
30
|
+
export declare function findWorkspaceRoot(startDir: string): string;
|
|
26
31
|
export interface InstallResult {
|
|
27
32
|
agent: string;
|
|
28
33
|
path: string;
|
package/dist/src/skill.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFileSync, } from "node:child_process";
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync, } from "node:fs";
|
|
3
3
|
import { homedir, } from "node:os";
|
|
4
|
-
import { join, } from "node:path";
|
|
4
|
+
import { dirname, join, } from "node:path";
|
|
5
5
|
const SKILL_BODY = `# Dataiku DSS CLI
|
|
6
6
|
|
|
7
7
|
The \`dss\` CLI (npm: dataiku-sdk) manages Dataiku DSS resources from the terminal.
|
|
@@ -200,6 +200,31 @@ export function detectAgents() {
|
|
|
200
200
|
}
|
|
201
201
|
return found;
|
|
202
202
|
}
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
// Skill installation
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
// Workspace root detection
|
|
208
|
+
// ---------------------------------------------------------------------------
|
|
209
|
+
const WORKSPACE_MARKERS = [".git", ".cursor", ".claude", ".codex", ".vscode",];
|
|
210
|
+
/**
|
|
211
|
+
* Walk upward from startDir looking for common workspace markers.
|
|
212
|
+
* Returns the first directory containing a marker, or startDir if none found.
|
|
213
|
+
*/
|
|
214
|
+
export function findWorkspaceRoot(startDir) {
|
|
215
|
+
let dir = startDir;
|
|
216
|
+
for (let i = 0; i < 20; i++) {
|
|
217
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
218
|
+
if (existsSync(join(dir, marker)))
|
|
219
|
+
return dir;
|
|
220
|
+
}
|
|
221
|
+
const parent = dirname(dir);
|
|
222
|
+
if (parent === dir)
|
|
223
|
+
break;
|
|
224
|
+
dir = parent;
|
|
225
|
+
}
|
|
226
|
+
return startDir;
|
|
227
|
+
}
|
|
203
228
|
export function installSkill(agents, opts) {
|
|
204
229
|
const home = homedir();
|
|
205
230
|
const results = [];
|