@buzzni/saycode-cli 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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/index.mjs +22 -16
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -179,11 +179,11 @@ GitHub Actions 가 태그로 발행합니다 (`.github/workflows/publish-saycode
179
179
 
180
180
  ```bash
181
181
  # 1. 버전 올리기 — 데스크탑 앱 버전과 무관합니다
182
- vi cli/manifest.json # "version": "0.1.3"
182
+ vi cli/manifest.json # "version": "0.1.4"
183
183
 
184
184
  # 2. 커밋하고 태그를 밀면 끝
185
- git tag -a saycode-cli-v0.1.3 -m "Release saycode-cli 0.1.3"
186
- git push origin saycode-cli-v0.1.3
185
+ git tag -a saycode-cli-v0.1.4 -m "Release saycode-cli 0.1.4"
186
+ git push origin saycode-cli-v0.1.4
187
187
  ```
188
188
 
189
189
  워크플로는 발행 전에 이 순서로 막습니다:
package/index.mjs CHANGED
@@ -40,7 +40,7 @@ function _mergeNamespaces(n, m) {
40
40
  }
41
41
  return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
42
42
  }
43
- const version = "0.1.3";
43
+ const version = "0.1.4";
44
44
  const manifest = {
45
45
  version
46
46
  };
@@ -26264,6 +26264,10 @@ const ARROW_UP = `${ESC}[A`;
26264
26264
  const ARROW_DOWN = `${ESC}[B`;
26265
26265
  const ARROW_RIGHT = `${ESC}[C`;
26266
26266
  const ARROW_LEFT = `${ESC}[D`;
26267
+ const PAGE_UP = `${ESC}[5~`;
26268
+ const PAGE_DOWN = `${ESC}[6~`;
26269
+ const HOME_KEYS = /* @__PURE__ */ new Set([`${ESC}[H`, `${ESC}OH`, `${ESC}[1~`]);
26270
+ const END_KEYS = /* @__PURE__ */ new Set([`${ESC}[F`, `${ESC}OF`, `${ESC}[4~`]);
26267
26271
  function isPrintable(key) {
26268
26272
  if (key.length !== 1) return false;
26269
26273
  const code = key.charCodeAt(0);
@@ -26273,6 +26277,10 @@ function keyToAction(key, filtering) {
26273
26277
  if (key === CTRL_C) return { type: "quit" };
26274
26278
  if (key === ARROW_UP) return { type: "up" };
26275
26279
  if (key === ARROW_DOWN) return { type: "down" };
26280
+ if (key === PAGE_UP) return { type: "page-up" };
26281
+ if (key === PAGE_DOWN) return { type: "page-down" };
26282
+ if (HOME_KEYS.has(key)) return { type: "first" };
26283
+ if (END_KEYS.has(key)) return { type: "last" };
26276
26284
  if (filtering) {
26277
26285
  if (key === "\r" || key === "\n") return { type: "filter-commit" };
26278
26286
  if (key === ESC) return { type: "filter-cancel" };
@@ -26388,19 +26396,9 @@ function startKeyboard(input, hooks = process) {
26388
26396
  restore
26389
26397
  };
26390
26398
  }
26399
+ const KEY_SEQUENCE = /\u001b(?:\[[0-?]*[ -/]*[@-~]|O[\s\S])|[\s\S]/g;
26391
26400
  function splitKeys(chunk) {
26392
- const keys = [];
26393
- let index = 0;
26394
- while (index < chunk.length) {
26395
- if (chunk[index] === "\x1B" && chunk[index + 1] === "[" && index + 2 < chunk.length) {
26396
- keys.push(chunk.slice(index, index + 3));
26397
- index += 3;
26398
- continue;
26399
- }
26400
- keys.push(chunk[index]);
26401
- index += 1;
26402
- }
26403
- return keys;
26401
+ return chunk.match(KEY_SEQUENCE) ?? [];
26404
26402
  }
26405
26403
  const STATUS_MARKER = {
26406
26404
  working: "●",
@@ -26525,7 +26523,7 @@ function clampCursor(state) {
26525
26523
  const max = Math.max(0, visibleItems(state).length - 1);
26526
26524
  return state.cursor > max ? { ...state, cursor: 0 } : state;
26527
26525
  }
26528
- function applyAction(state, action) {
26526
+ function applyAction(state, action, pageSize = 1) {
26529
26527
  switch (action.type) {
26530
26528
  case "items-loaded":
26531
26529
  return clampCursor({ ...state, items: action.items, loading: false });
@@ -26535,6 +26533,14 @@ function applyAction(state, action) {
26535
26533
  return { ...state, cursor: Math.max(0, state.cursor - 1) };
26536
26534
  case "down":
26537
26535
  return { ...state, cursor: Math.min(Math.max(0, visibleItems(state).length - 1), state.cursor + 1) };
26536
+ case "page-up":
26537
+ return { ...state, cursor: Math.max(0, state.cursor - Math.max(1, Math.floor(pageSize))) };
26538
+ case "page-down":
26539
+ return { ...state, cursor: Math.min(Math.max(0, visibleItems(state).length - 1), state.cursor + Math.max(1, Math.floor(pageSize))) };
26540
+ case "first":
26541
+ return { ...state, cursor: 0 };
26542
+ case "last":
26543
+ return { ...state, cursor: Math.max(0, visibleItems(state).length - 1) };
26538
26544
  case "select": {
26539
26545
  const chosen = visibleItems(state)[state.cursor];
26540
26546
  if (!chosen) return state;
@@ -26677,7 +26683,7 @@ function paint(context, state) {
26677
26683
  out.push(line.selected ? `\x1B[7m${line.text}\x1B[0m` : line.text);
26678
26684
  }
26679
26685
  out.push("");
26680
- out.push("↑/↓ move · Enter open · Esc back · / filter · r refresh · q quit");
26686
+ out.push("↑/↓ move · PgUp/PgDn page · Home/End jump · Enter open · Esc back · / filter · r refresh · q quit");
26681
26687
  context.out.raw(out.join("\n"));
26682
26688
  }
26683
26689
  async function runBrowse(context) {
@@ -26719,7 +26725,7 @@ async function runBrowse(context) {
26719
26725
  }
26720
26726
  const key = pending.shift();
26721
26727
  if (key === void 0) continue;
26722
- state = applyAction(state, keyToAction(key, state.filtering));
26728
+ state = applyAction(state, keyToAction(key, state.filtering), screenHeight());
26723
26729
  if (state.quit) break;
26724
26730
  if (state.done) {
26725
26731
  const chosen = state.done;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buzzni/saycode-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Drive Saycode sessions across your machines from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {