deepline 0.1.3 → 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 CHANGED
@@ -192,7 +192,7 @@ function resolveConfig(options) {
192
192
  }
193
193
 
194
194
  // src/version.ts
195
- var SDK_VERSION = "0.1.3";
195
+ var SDK_VERSION = "0.1.4";
196
196
  var SDK_API_CONTRACT = "2026-04-plays-v1";
197
197
 
198
198
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -1487,6 +1487,27 @@ function buildCandidateUrls2(url) {
1487
1487
  function sleep2(ms) {
1488
1488
  return new Promise((resolve8) => setTimeout(resolve8, ms));
1489
1489
  }
1490
+ function printDeeplineLogo() {
1491
+ if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
1492
+ 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");
1493
+ 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");
1494
+ 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");
1495
+ 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");
1496
+ 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");
1497
+ 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");
1498
+ console.log("");
1499
+ return;
1500
+ }
1501
+ console.log("DEEPLINE");
1502
+ }
1503
+ function printClaimSuccessBanner(statusData) {
1504
+ console.log("");
1505
+ printDeeplineLogo();
1506
+ console.log("\u2713 All set! Your CLI is connected.");
1507
+ if (statusData.org_name) {
1508
+ console.log(` \u2022 Signed in with organization: ${statusData.org_name}`);
1509
+ }
1510
+ }
1490
1511
  async function handleRegister(args) {
1491
1512
  const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
1492
1513
  let orgName = "";
@@ -1562,12 +1583,7 @@ async function handleRegister(args) {
1562
1583
  DEEPLINE_API_KEY: apiKey,
1563
1584
  DEEPLINE_CLAIM_TOKEN: ""
1564
1585
  }, baseUrl);
1565
- console.log("");
1566
- console.log("DEEPLINE");
1567
- console.log("All set! Your CLI is connected.");
1568
- if (statusData.org_name) {
1569
- console.log(` Signed in with organization: ${statusData.org_name}`);
1570
- }
1586
+ printClaimSuccessBanner(statusData);
1571
1587
  return EXIT_OK;
1572
1588
  }
1573
1589
  }
@@ -1628,7 +1644,7 @@ async function handleWait(args) {
1628
1644
  DEEPLINE_API_KEY: apiKey,
1629
1645
  DEEPLINE_CLAIM_TOKEN: ""
1630
1646
  }, baseUrl);
1631
- console.log("All set! Your CLI is connected.");
1647
+ printClaimSuccessBanner(data);
1632
1648
  return EXIT_OK;
1633
1649
  }
1634
1650
  }
@@ -6887,6 +6903,122 @@ async function executeTool(args) {
6887
6903
  return 0;
6888
6904
  }
6889
6905
 
6906
+ // src/cli/skills-sync.ts
6907
+ var import_node_child_process2 = require("child_process");
6908
+ var import_node_fs8 = require("fs");
6909
+ var import_node_os7 = require("os");
6910
+ var import_node_path10 = require("path");
6911
+ var CHECK_TIMEOUT_MS2 = 3e3;
6912
+ var SDK_SKILL_NAME = "deepline-sdk";
6913
+ var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
6914
+ var attemptedSync = false;
6915
+ function shouldSkipSkillsSync() {
6916
+ const value = process.env.DEEPLINE_SKIP_SKILLS_SYNC?.trim().toLowerCase();
6917
+ return value === "1" || value === "true" || value === "yes" || value === "on";
6918
+ }
6919
+ function sdkSkillsVersionPath(baseUrl) {
6920
+ const home = process.env.HOME?.trim() || (0, import_node_os7.homedir)();
6921
+ return (0, import_node_path10.join)(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
6922
+ }
6923
+ function readLocalSkillsVersion(baseUrl) {
6924
+ const path = sdkSkillsVersionPath(baseUrl);
6925
+ if (!(0, import_node_fs8.existsSync)(path)) return "";
6926
+ try {
6927
+ return (0, import_node_fs8.readFileSync)(path, "utf-8").trim();
6928
+ } catch {
6929
+ return "";
6930
+ }
6931
+ }
6932
+ function writeLocalSkillsVersion(baseUrl, version) {
6933
+ const path = sdkSkillsVersionPath(baseUrl);
6934
+ (0, import_node_fs8.mkdirSync)((0, import_node_path10.dirname)(path), { recursive: true });
6935
+ (0, import_node_fs8.writeFileSync)(path, `${version}
6936
+ `, "utf-8");
6937
+ }
6938
+ async function fetchSkillsUpdate(baseUrl, localVersion) {
6939
+ const controller = new AbortController();
6940
+ const timeout = setTimeout(() => controller.abort(), CHECK_TIMEOUT_MS2);
6941
+ try {
6942
+ const response = await fetch(new URL("/api/v2/cli/update-check", baseUrl), {
6943
+ method: "POST",
6944
+ headers: { "Content-Type": "application/json" },
6945
+ body: JSON.stringify({
6946
+ skills: {
6947
+ version: localVersion
6948
+ }
6949
+ }),
6950
+ signal: controller.signal
6951
+ });
6952
+ if (!response.ok) return null;
6953
+ const data = await response.json().catch(() => null);
6954
+ const skills = data?.skills;
6955
+ if (!skills) return null;
6956
+ return {
6957
+ needsUpdate: skills.needs_update === true,
6958
+ remoteVersion: typeof skills.remote?.version === "string" ? skills.remote.version.trim() : ""
6959
+ };
6960
+ } catch {
6961
+ return null;
6962
+ } finally {
6963
+ clearTimeout(timeout);
6964
+ }
6965
+ }
6966
+ function runSkillsInstall(baseUrl) {
6967
+ const packageUrl = new URL("/.well-known/skills/index.json", baseUrl).toString();
6968
+ const args = [
6969
+ "skills",
6970
+ "add",
6971
+ packageUrl,
6972
+ "--agents",
6973
+ ...SKILL_AGENTS,
6974
+ "--global",
6975
+ "--yes",
6976
+ "--skill",
6977
+ SDK_SKILL_NAME,
6978
+ "--full-depth"
6979
+ ];
6980
+ return new Promise((resolve8) => {
6981
+ const child = (0, import_node_child_process2.spawn)("npx", args, {
6982
+ stdio: ["ignore", "ignore", "pipe"],
6983
+ env: process.env
6984
+ });
6985
+ let stderr = "";
6986
+ child.stderr.on("data", (chunk) => {
6987
+ stderr += chunk.toString("utf-8");
6988
+ });
6989
+ child.on("error", (error) => {
6990
+ process.stderr.write(`SDK skills sync failed to start: ${error.message}
6991
+ `);
6992
+ resolve8(false);
6993
+ });
6994
+ child.on("close", (code) => {
6995
+ if (code === 0) {
6996
+ resolve8(true);
6997
+ return;
6998
+ }
6999
+ const detail = stderr.trim();
7000
+ process.stderr.write(
7001
+ `SDK skills sync failed${detail ? `: ${detail}` : ""}
7002
+ Run manually: npx ${args.map((arg) => arg.includes(" ") ? JSON.stringify(arg) : arg).join(" ")}
7003
+ `
7004
+ );
7005
+ resolve8(false);
7006
+ });
7007
+ });
7008
+ }
7009
+ async function syncSdkSkillsIfNeeded(baseUrl) {
7010
+ if (attemptedSync || shouldSkipSkillsSync()) return;
7011
+ attemptedSync = true;
7012
+ const localVersion = readLocalSkillsVersion(baseUrl);
7013
+ const update = await fetchSkillsUpdate(baseUrl, localVersion);
7014
+ if (!update?.needsUpdate || !update.remoteVersion) return;
7015
+ process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
7016
+ const installed = await runSkillsInstall(baseUrl);
7017
+ if (!installed) return;
7018
+ writeLocalSkillsVersion(baseUrl, update.remoteVersion);
7019
+ process.stderr.write("SDK skills are up to date.\n");
7020
+ }
7021
+
6890
7022
  // src/cli/index.ts
6891
7023
  function shouldPrintStartupPhase() {
6892
7024
  if (process.argv.includes("--json")) {
@@ -6938,6 +7070,14 @@ Output:
6938
7070
  { baseUrl },
6939
7071
  () => enforceSdkCompatibility(baseUrl)
6940
7072
  );
7073
+ if (printStartupPhase) {
7074
+ progress?.phase("checking sdk skills");
7075
+ }
7076
+ await traceCliSpan(
7077
+ "cli.sdk_skills_sync",
7078
+ { baseUrl },
7079
+ () => syncSdkSkillsIfNeeded(baseUrl)
7080
+ );
6941
7081
  });
6942
7082
  registerAuthCommands(program);
6943
7083
  registerToolsCommands(program);