dskcode 0.1.17 → 0.1.18

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/index.js CHANGED
@@ -774,7 +774,7 @@ async function getAllSkills(cwd) {
774
774
 
775
775
  // src/cli/index.tsx
776
776
  import { readFile as readFile8 } from "fs/promises";
777
- import { join as join8 } from "path";
777
+ import { join as join9 } from "path";
778
778
 
779
779
  // src/ui/RenderScope.tsx
780
780
  import { render } from "ink";
@@ -4412,7 +4412,20 @@ import chalk4 from "chalk";
4412
4412
  import { Box as Box12, Text as Text13, useInput as useInput5 } from "ink";
4413
4413
  import { useState as useState7, useCallback as useCallback6, useEffect as useEffect6 } from "react";
4414
4414
  import asciichart from "asciichart";
4415
+ import os from "os";
4416
+ import { join as join7 } from "path";
4415
4417
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
4418
+ var SETTINGS_PATH = join7(os.homedir(), ".dskcode", "settings.json");
4419
+ function toFileUrl(p) {
4420
+ const norm = p.replace(/\\/g, "/");
4421
+ if (process.platform === "win32") {
4422
+ return "file://" + norm.replace(/^([a-zA-Z]:)/, "/$1");
4423
+ }
4424
+ return "file://" + norm;
4425
+ }
4426
+ function osc8Link(uri, text) {
4427
+ return `\x1B]8;;${uri}\x1B\\${text}\x1B]8;;\x1B\\`;
4428
+ }
4416
4429
  var MINUTE_API = "https://web.ifzq.gtimg.cn/appstock/app/minute/query?code={code}&r=0.1";
4417
4430
  function normalizeApiCode(code) {
4418
4431
  if (code.startsWith("sh") || code.startsWith("sz")) return code;
@@ -4658,7 +4671,10 @@ function StockList({ codes, onExit, onBackToChat }) {
4658
4671
  ] }, stock.code);
4659
4672
  }) }),
4660
4673
  /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 q \u8FD4\u56DE` }) }),
4661
- /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ~/.dskcode/settings.json` }) }),
4674
+ /* @__PURE__ */ jsxs12(Box12, { children: [
4675
+ /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
4676
+ /* @__PURE__ */ jsx12(Text13, { color: "#c792ea", children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
4677
+ ] }),
4662
4678
  doubleCtrlC && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
4663
4679
  ] });
4664
4680
  }
@@ -4719,7 +4735,7 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
4719
4735
 
4720
4736
  // src/utils/scan-files.ts
4721
4737
  import { readdir as readdir5 } from "fs/promises";
4722
- import { join as join7, relative as relative4 } from "path";
4738
+ import { join as join8, relative as relative4 } from "path";
4723
4739
  var IGNORE_DIRS = /* @__PURE__ */ new Set([
4724
4740
  "node_modules",
4725
4741
  ".git",
@@ -4784,12 +4800,12 @@ async function scanProjectFiles(baseDir, dir) {
4784
4800
  } else if (entry.isFile()) {
4785
4801
  const ext = name.slice(name.lastIndexOf(".")).toLowerCase();
4786
4802
  if (SOURCE_EXTS.has(ext)) {
4787
- files.push(relative4(baseDir, join7(currentDir, name)));
4803
+ files.push(relative4(baseDir, join8(currentDir, name)));
4788
4804
  }
4789
4805
  }
4790
4806
  }
4791
4807
  const nested = await Promise.all(
4792
- dirs.map((d) => scanProjectFiles(baseDir, join7(currentDir, d)))
4808
+ dirs.map((d) => scanProjectFiles(baseDir, join8(currentDir, d)))
4793
4809
  );
4794
4810
  for (const n of nested) {
4795
4811
  files.push(...n);
@@ -4950,7 +4966,7 @@ compdef _dskcode_completion dskcode`);
4950
4966
  program2.command("stock").description("\u67E5\u770B\u81EA\u9009\u80A1\u5B9E\u65F6\u884C\u60C5").argument("[codes...]", "\u80A1\u7968\u4EE3\u7801\uFF08\u7A7A\u683C\u5206\u9694\uFF09\uFF0C\u5982 513090 600519").action(async function(codes) {
4951
4967
  const ctx = this.dskcodeCtx;
4952
4968
  const home = process.env.HOME ?? process.env.USERPROFILE ?? "~";
4953
- const globalConfigPath = join8(home, ".dskcode", "settings.json");
4969
+ const globalConfigPath = join9(home, ".dskcode", "settings.json");
4954
4970
  let globalConfigHasStock = false;
4955
4971
  try {
4956
4972
  const raw = await readFile8(globalConfigPath, "utf-8");