deepline 0.1.2 → 0.1.4
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/cli/index.js +148 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +148 -8
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/repo/sdk/src/cli/commands/auth.ts +25 -7
- package/dist/repo/sdk/src/cli/index.ts +9 -0
- package/dist/repo/sdk/src/cli/skills-sync.ts +137 -0
- package/dist/repo/sdk/src/version.ts +1 -1
- package/package.json +3 -2
package/dist/cli/index.mjs
CHANGED
|
@@ -169,7 +169,7 @@ function resolveConfig(options) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
// src/version.ts
|
|
172
|
-
var SDK_VERSION = "0.1.
|
|
172
|
+
var SDK_VERSION = "0.1.4";
|
|
173
173
|
var SDK_API_CONTRACT = "2026-04-plays-v1";
|
|
174
174
|
|
|
175
175
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -1464,6 +1464,27 @@ function buildCandidateUrls2(url) {
|
|
|
1464
1464
|
function sleep2(ms) {
|
|
1465
1465
|
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
1466
1466
|
}
|
|
1467
|
+
function printDeeplineLogo() {
|
|
1468
|
+
if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
|
|
1469
|
+
console.log(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557");
|
|
1470
|
+
console.log(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D");
|
|
1471
|
+
console.log(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557");
|
|
1472
|
+
console.log(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D");
|
|
1473
|
+
console.log(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557");
|
|
1474
|
+
console.log(" \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
1475
|
+
console.log("");
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
console.log("DEEPLINE");
|
|
1479
|
+
}
|
|
1480
|
+
function printClaimSuccessBanner(statusData) {
|
|
1481
|
+
console.log("");
|
|
1482
|
+
printDeeplineLogo();
|
|
1483
|
+
console.log("\u2713 All set! Your CLI is connected.");
|
|
1484
|
+
if (statusData.org_name) {
|
|
1485
|
+
console.log(` \u2022 Signed in with organization: ${statusData.org_name}`);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1467
1488
|
async function handleRegister(args) {
|
|
1468
1489
|
const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
|
|
1469
1490
|
let orgName = "";
|
|
@@ -1539,12 +1560,7 @@ async function handleRegister(args) {
|
|
|
1539
1560
|
DEEPLINE_API_KEY: apiKey,
|
|
1540
1561
|
DEEPLINE_CLAIM_TOKEN: ""
|
|
1541
1562
|
}, baseUrl);
|
|
1542
|
-
|
|
1543
|
-
console.log("DEEPLINE");
|
|
1544
|
-
console.log("All set! Your CLI is connected.");
|
|
1545
|
-
if (statusData.org_name) {
|
|
1546
|
-
console.log(` Signed in with organization: ${statusData.org_name}`);
|
|
1547
|
-
}
|
|
1563
|
+
printClaimSuccessBanner(statusData);
|
|
1548
1564
|
return EXIT_OK;
|
|
1549
1565
|
}
|
|
1550
1566
|
}
|
|
@@ -1605,7 +1621,7 @@ async function handleWait(args) {
|
|
|
1605
1621
|
DEEPLINE_API_KEY: apiKey,
|
|
1606
1622
|
DEEPLINE_CLAIM_TOKEN: ""
|
|
1607
1623
|
}, baseUrl);
|
|
1608
|
-
|
|
1624
|
+
printClaimSuccessBanner(data);
|
|
1609
1625
|
return EXIT_OK;
|
|
1610
1626
|
}
|
|
1611
1627
|
}
|
|
@@ -6868,6 +6884,122 @@ async function executeTool(args) {
|
|
|
6868
6884
|
return 0;
|
|
6869
6885
|
}
|
|
6870
6886
|
|
|
6887
|
+
// src/cli/skills-sync.ts
|
|
6888
|
+
import { spawn } from "child_process";
|
|
6889
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
6890
|
+
import { homedir as homedir4 } from "os";
|
|
6891
|
+
import { dirname as dirname7, join as join8 } from "path";
|
|
6892
|
+
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
6893
|
+
var SDK_SKILL_NAME = "deepline-sdk";
|
|
6894
|
+
var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
|
|
6895
|
+
var attemptedSync = false;
|
|
6896
|
+
function shouldSkipSkillsSync() {
|
|
6897
|
+
const value = process.env.DEEPLINE_SKIP_SKILLS_SYNC?.trim().toLowerCase();
|
|
6898
|
+
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
6899
|
+
}
|
|
6900
|
+
function sdkSkillsVersionPath(baseUrl) {
|
|
6901
|
+
const home = process.env.HOME?.trim() || homedir4();
|
|
6902
|
+
return join8(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
|
|
6903
|
+
}
|
|
6904
|
+
function readLocalSkillsVersion(baseUrl) {
|
|
6905
|
+
const path = sdkSkillsVersionPath(baseUrl);
|
|
6906
|
+
if (!existsSync5(path)) return "";
|
|
6907
|
+
try {
|
|
6908
|
+
return readFileSync4(path, "utf-8").trim();
|
|
6909
|
+
} catch {
|
|
6910
|
+
return "";
|
|
6911
|
+
}
|
|
6912
|
+
}
|
|
6913
|
+
function writeLocalSkillsVersion(baseUrl, version) {
|
|
6914
|
+
const path = sdkSkillsVersionPath(baseUrl);
|
|
6915
|
+
mkdirSync4(dirname7(path), { recursive: true });
|
|
6916
|
+
writeFileSync6(path, `${version}
|
|
6917
|
+
`, "utf-8");
|
|
6918
|
+
}
|
|
6919
|
+
async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
6920
|
+
const controller = new AbortController();
|
|
6921
|
+
const timeout = setTimeout(() => controller.abort(), CHECK_TIMEOUT_MS2);
|
|
6922
|
+
try {
|
|
6923
|
+
const response = await fetch(new URL("/api/v2/cli/update-check", baseUrl), {
|
|
6924
|
+
method: "POST",
|
|
6925
|
+
headers: { "Content-Type": "application/json" },
|
|
6926
|
+
body: JSON.stringify({
|
|
6927
|
+
skills: {
|
|
6928
|
+
version: localVersion
|
|
6929
|
+
}
|
|
6930
|
+
}),
|
|
6931
|
+
signal: controller.signal
|
|
6932
|
+
});
|
|
6933
|
+
if (!response.ok) return null;
|
|
6934
|
+
const data = await response.json().catch(() => null);
|
|
6935
|
+
const skills = data?.skills;
|
|
6936
|
+
if (!skills) return null;
|
|
6937
|
+
return {
|
|
6938
|
+
needsUpdate: skills.needs_update === true,
|
|
6939
|
+
remoteVersion: typeof skills.remote?.version === "string" ? skills.remote.version.trim() : ""
|
|
6940
|
+
};
|
|
6941
|
+
} catch {
|
|
6942
|
+
return null;
|
|
6943
|
+
} finally {
|
|
6944
|
+
clearTimeout(timeout);
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
function runSkillsInstall(baseUrl) {
|
|
6948
|
+
const packageUrl = new URL("/.well-known/skills/index.json", baseUrl).toString();
|
|
6949
|
+
const args = [
|
|
6950
|
+
"skills",
|
|
6951
|
+
"add",
|
|
6952
|
+
packageUrl,
|
|
6953
|
+
"--agents",
|
|
6954
|
+
...SKILL_AGENTS,
|
|
6955
|
+
"--global",
|
|
6956
|
+
"--yes",
|
|
6957
|
+
"--skill",
|
|
6958
|
+
SDK_SKILL_NAME,
|
|
6959
|
+
"--full-depth"
|
|
6960
|
+
];
|
|
6961
|
+
return new Promise((resolve8) => {
|
|
6962
|
+
const child = spawn("npx", args, {
|
|
6963
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
6964
|
+
env: process.env
|
|
6965
|
+
});
|
|
6966
|
+
let stderr = "";
|
|
6967
|
+
child.stderr.on("data", (chunk) => {
|
|
6968
|
+
stderr += chunk.toString("utf-8");
|
|
6969
|
+
});
|
|
6970
|
+
child.on("error", (error) => {
|
|
6971
|
+
process.stderr.write(`SDK skills sync failed to start: ${error.message}
|
|
6972
|
+
`);
|
|
6973
|
+
resolve8(false);
|
|
6974
|
+
});
|
|
6975
|
+
child.on("close", (code) => {
|
|
6976
|
+
if (code === 0) {
|
|
6977
|
+
resolve8(true);
|
|
6978
|
+
return;
|
|
6979
|
+
}
|
|
6980
|
+
const detail = stderr.trim();
|
|
6981
|
+
process.stderr.write(
|
|
6982
|
+
`SDK skills sync failed${detail ? `: ${detail}` : ""}
|
|
6983
|
+
Run manually: npx ${args.map((arg) => arg.includes(" ") ? JSON.stringify(arg) : arg).join(" ")}
|
|
6984
|
+
`
|
|
6985
|
+
);
|
|
6986
|
+
resolve8(false);
|
|
6987
|
+
});
|
|
6988
|
+
});
|
|
6989
|
+
}
|
|
6990
|
+
async function syncSdkSkillsIfNeeded(baseUrl) {
|
|
6991
|
+
if (attemptedSync || shouldSkipSkillsSync()) return;
|
|
6992
|
+
attemptedSync = true;
|
|
6993
|
+
const localVersion = readLocalSkillsVersion(baseUrl);
|
|
6994
|
+
const update = await fetchSkillsUpdate(baseUrl, localVersion);
|
|
6995
|
+
if (!update?.needsUpdate || !update.remoteVersion) return;
|
|
6996
|
+
process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
|
|
6997
|
+
const installed = await runSkillsInstall(baseUrl);
|
|
6998
|
+
if (!installed) return;
|
|
6999
|
+
writeLocalSkillsVersion(baseUrl, update.remoteVersion);
|
|
7000
|
+
process.stderr.write("SDK skills are up to date.\n");
|
|
7001
|
+
}
|
|
7002
|
+
|
|
6871
7003
|
// src/cli/index.ts
|
|
6872
7004
|
function shouldPrintStartupPhase() {
|
|
6873
7005
|
if (process.argv.includes("--json")) {
|
|
@@ -6919,6 +7051,14 @@ Output:
|
|
|
6919
7051
|
{ baseUrl },
|
|
6920
7052
|
() => enforceSdkCompatibility(baseUrl)
|
|
6921
7053
|
);
|
|
7054
|
+
if (printStartupPhase) {
|
|
7055
|
+
progress?.phase("checking sdk skills");
|
|
7056
|
+
}
|
|
7057
|
+
await traceCliSpan(
|
|
7058
|
+
"cli.sdk_skills_sync",
|
|
7059
|
+
{ baseUrl },
|
|
7060
|
+
() => syncSdkSkillsIfNeeded(baseUrl)
|
|
7061
|
+
);
|
|
6922
7062
|
});
|
|
6923
7063
|
registerAuthCommands(program);
|
|
6924
7064
|
registerToolsCommands(program);
|