krx-cli 1.7.2 → 1.7.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/SKILL.md CHANGED
@@ -7,7 +7,7 @@ install: npm install -g krx-cli
7
7
  binary: krx
8
8
  metadata:
9
9
  author: kyo504
10
- version: "1.7.2"
10
+ version: "1.7.3"
11
11
  invariants:
12
12
  - Always use YYYYMMDD format for --date (e.g., 20260310)
13
13
  - Data is T-1 (previous trading day), available from 2010 onwards
package/dist/cli.js CHANGED
@@ -48878,6 +48878,17 @@ function applyPipeline(data, options) {
48878
48878
  return result;
48879
48879
  }
48880
48880
 
48881
+ // src/utils/isin.ts
48882
+ var KRX_ISIN_RE = /^KR\d{10}$/;
48883
+ function matchesIsuCode(isuCd, srtCd, query) {
48884
+ if (isuCd === query || srtCd === query) return true;
48885
+ if (KRX_ISIN_RE.test(query)) {
48886
+ const short = query.slice(3, 9);
48887
+ return isuCd === short || srtCd === short;
48888
+ }
48889
+ return false;
48890
+ }
48891
+
48881
48892
  // src/cli/command-helper.ts
48882
48893
  async function executeCommand(options) {
48883
48894
  const { endpoint, params, program: program3, noDataMessage } = options;
@@ -48969,7 +48980,13 @@ async function executeCommand(options) {
48969
48980
  data = result.data;
48970
48981
  }
48971
48982
  if (codeFilter) {
48972
- data = data.filter((row) => row["ISU_CD"] === codeFilter);
48983
+ data = data.filter(
48984
+ (row) => matchesIsuCode(
48985
+ String(row["ISU_CD"] ?? ""),
48986
+ String(row["ISU_SRT_CD"] ?? ""),
48987
+ codeFilter
48988
+ )
48989
+ );
48973
48990
  }
48974
48991
  if (data.length === 0) {
48975
48992
  writeError(noDataMessage ?? "No data");
@@ -60603,7 +60620,9 @@ function buildInputSchema(endpoints) {
60603
60620
  date_to: external_exports.string().optional().describe(
60604
60621
  "End date for range query (YYYYMMDD). Use with date_from for multi-day data."
60605
60622
  ),
60606
- isuCd: external_exports.string().optional().describe("Stock/item code (ISU_CD) to filter a specific item"),
60623
+ isuCd: external_exports.string().optional().describe(
60624
+ "Stock/item code to filter. Accepts both ISIN (e.g., KR7005930003) and short code (e.g., 005930)."
60625
+ ),
60607
60626
  sort: external_exports.string().optional().describe("Sort results by this field name"),
60608
60627
  sort_direction: external_exports.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
60609
60628
  offset: external_exports.number().optional().describe("Skip first N results (use with limit for pagination)"),
@@ -60678,7 +60697,9 @@ function createCategoryTool(categoryId) {
60678
60697
  }
60679
60698
  let data2 = rangeResult.data;
60680
60699
  if (isuCd) {
60681
- data2 = data2.filter((row) => row["ISU_CD"] === isuCd);
60700
+ data2 = data2.filter(
60701
+ (row) => matchesIsuCode(row["ISU_CD"] ?? "", row["ISU_SRT_CD"] ?? "", isuCd)
60702
+ );
60682
60703
  }
60683
60704
  const filterExpr = args.filter;
60684
60705
  const sortField2 = args.sort;
@@ -60722,7 +60743,9 @@ function createCategoryTool(categoryId) {
60722
60743
  const limitN = args.limit;
60723
60744
  let data = result.data;
60724
60745
  if (isuCd) {
60725
- data = data.filter((row) => row["ISU_CD"] === isuCd);
60746
+ data = data.filter(
60747
+ (row) => matchesIsuCode(row["ISU_CD"] ?? "", row["ISU_SRT_CD"] ?? "", isuCd)
60748
+ );
60726
60749
  }
60727
60750
  data = applyPipeline(data, {
60728
60751
  filter: filterExpr2,