dataiku-sdk 0.2.2 → 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 +6 -3
- 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
|
// ---------------------------------------------------------------------------
|
|
@@ -1021,13 +1021,14 @@ async function main() {
|
|
|
1021
1021
|
if (resource === "install-skill") {
|
|
1022
1022
|
if (flags["help"] === true) {
|
|
1023
1023
|
const lines = [
|
|
1024
|
-
"Usage: dss install-skill [--global] [--agent NAME] [--list-agents]",
|
|
1024
|
+
"Usage: dss install-skill [--global] [--agent NAME] [--target PATH] [--list-agents]",
|
|
1025
1025
|
"",
|
|
1026
1026
|
"Install the dataiku-dss agent skill for detected coding agents.",
|
|
1027
1027
|
"",
|
|
1028
1028
|
"Flags:",
|
|
1029
1029
|
" --global Install to user-level global scope (default: project)",
|
|
1030
1030
|
" --agent NAME Target a specific agent: claude, codex, cursor, pi, omp",
|
|
1031
|
+
" --target PATH Project directory to install into (default: workspace root)",
|
|
1031
1032
|
" --list-agents Print detected agents and exit",
|
|
1032
1033
|
];
|
|
1033
1034
|
process.stderr.write(`${lines.join("\n")}\n`);
|
|
@@ -1036,6 +1037,7 @@ async function main() {
|
|
|
1036
1037
|
const listOnly = flags["list-agents"] === true;
|
|
1037
1038
|
const agentFilter = typeof flags["agent"] === "string" ? flags["agent"] : undefined;
|
|
1038
1039
|
const isGlobal = flags["global"] === true;
|
|
1040
|
+
const targetDir = typeof flags["target"] === "string" ? flags["target"] : undefined;
|
|
1039
1041
|
// Resolve target agents
|
|
1040
1042
|
let targets;
|
|
1041
1043
|
if (agentFilter) {
|
|
@@ -1064,8 +1066,9 @@ async function main() {
|
|
|
1064
1066
|
throw new UsageError("No coding agents detected. Install one (claude, codex, cursor, pi, omp) or use --agent NAME.");
|
|
1065
1067
|
}
|
|
1066
1068
|
const scope = isGlobal ? "global" : "project";
|
|
1069
|
+
const cwd = targetDir ?? (isGlobal ? process.cwd() : findWorkspaceRoot(process.cwd()));
|
|
1067
1070
|
process.stderr.write(`Installing dataiku-dss skill (${scope} scope):\n`);
|
|
1068
|
-
const results = installSkill(targets, { global: isGlobal, cwd
|
|
1071
|
+
const results = installSkill(targets, { global: isGlobal, cwd, });
|
|
1069
1072
|
for (const r of results) {
|
|
1070
1073
|
process.stderr.write(` ${r.agent} \u2192 ${r.path}\n`);
|
|
1071
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 = [];
|