larkway 0.3.58 → 0.3.59

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  You @ the bot in a Feishu thread. It runs on your machine — reading your real codebase, executing commands, opening MRs — and posts the result back. You define what the agent knows and what it can do. Larkway just carries the messages.
10
10
 
11
- **Current release: v0.3.58**
11
+ **Current release: v0.3.59**
12
12
 
13
13
  ---
14
14
 
@@ -61,7 +61,7 @@ Feishu thread
61
61
 
62
62
  **What Larkway does NOT do** — the agent decides everything else:
63
63
 
64
- - No GitLab/GitHub API calls (the agent runs `glab`/`gh` itself)
64
+ - No GitHub/GitLab API calls (the agent runs `gh`/`glab` itself)
65
65
  - No worktree creation (the agent runs `git worktree add`)
66
66
  - No dev server management (the agent starts it)
67
67
  - No orchestration logic — the agent reads your `AGENTS.md` / `CLAUDE.md` / skills and plans its own steps
@@ -194,10 +194,11 @@ platform-fact writeups: [docs/task-handle.md](docs/task-handle.md).
194
194
 
195
195
  ## Requirements
196
196
 
197
+ - **macOS or Linux** — native Windows is not supported yet (the runtime depends on POSIX tooling such as `bash` and `pgrep`); on Windows, install and run everything (Node.js, larkway, Claude Code / Codex, `lark-cli`) inside [WSL](https://learn.microsoft.com/windows/wsl/install)
197
198
  - **Node.js 20+ LTS**
198
199
  - **A Claude Code or Codex subscription** with local CLI installed and logged in
199
200
  - **`lark-cli`** — Feishu long-connection client and message utilities: `npm i -g @larksuite/cli`, then `lark-cli auth login` (the agent uses it to read thread history and attachments; `larkway doctor` checks it's present)
200
- - **`glab` + `git`** — for bots that open MRs (optional for read-only bots)
201
+ - **`git` + `gh`** — for bots that open PRs (GitHub is the default forge; use `glab` instead for GitLab repos; both optional for read-only bots)
201
202
  - **An always-on host machine** — the bridge must stay running to receive Feishu events; a laptop that sleeps will miss messages; a small server or desktop works well
202
203
 
203
204
  ---
package/README.zh.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  你在飞书话题里 @ bot,它在你的机器上运行——读真实代码库、执行命令、开 MR——把结果贴回飞书。你定义 agent 知道什么、能做什么。Larkway 只负责传递消息。
10
10
 
11
- **当前版本:v0.3.58**
11
+ **当前版本:v0.3.59**
12
12
 
13
13
  ---
14
14
 
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ // larkway CLI shim — resolves the package root from this script's own location
3
+ // so it works whether invoked via `bin/larkway`, an absolute path, or a symlink
4
+ // on PATH (e.g. after `npm i -g`).
5
+ //
6
+ // Written in Node (not bash) so npm's cross-platform bin shims work everywhere:
7
+ // a bash shebang made Windows installs fail at startup with
8
+ // `/bin/bash: C:Users...: No such file or directory` before any of our code ran.
9
+ //
10
+ // Startup priority:
11
+ // 1. dist/cli/index.js exists → import it in-process (installed package / post-build)
12
+ // 2. otherwise → `npx tsx src/cli/index.ts` (fresh clone dev mode, no build)
13
+ import { existsSync } from "node:fs";
14
+ import { spawnSync } from "node:child_process";
15
+ import path from "node:path";
16
+ import { fileURLToPath, pathToFileURL } from "node:url";
17
+
18
+ if (process.platform === "win32") {
19
+ // The bridge runtime depends on POSIX tooling (bash supervisor, pgrep, lsof),
20
+ // so native Windows is not supported yet — fail fast with guidance instead of
21
+ // crashing later with an obscure error.
22
+ console.error(
23
+ [
24
+ "larkway 暂不支持原生 Windows 运行(依赖 bash / pgrep 等 POSIX 工具)。",
25
+ "推荐在 WSL(Windows Subsystem for Linux)中安装使用:",
26
+ " 1. 安装 WSL: https://learn.microsoft.com/windows/wsl/install",
27
+ " 2. 在 WSL 终端内安装 Node.js 20+,然后 `npm i -g larkway`",
28
+ " 3. Claude Code / Codex 也需安装在 WSL 内",
29
+ "",
30
+ "larkway does not yet support native Windows (it depends on POSIX tooling",
31
+ "such as bash and pgrep). Please install and run it inside WSL instead.",
32
+ ].join("\n"),
33
+ );
34
+ process.exit(1);
35
+ }
36
+
37
+ const selfPath = fileURLToPath(import.meta.url);
38
+ const repoRoot = path.resolve(path.dirname(selfPath), "..");
39
+ const distEntry = path.join(repoRoot, "dist", "cli", "index.js");
40
+
41
+ if (existsSync(distEntry)) {
42
+ await import(pathToFileURL(distEntry).href);
43
+ } else {
44
+ // Dev fallback: run TypeScript source directly via tsx.
45
+ const result = spawnSync(
46
+ "npx",
47
+ ["tsx", path.join(repoRoot, "src", "cli", "index.ts"), ...process.argv.slice(2)],
48
+ { stdio: "inherit" },
49
+ );
50
+ process.exit(result.status ?? 1);
51
+ }
package/dist/cli/index.js CHANGED
@@ -127480,6 +127480,9 @@ function repoLooksGitLab(urlOrSlug) {
127480
127480
  function botUsesGitLab(bot) {
127481
127481
  return bot.repos.some((repo) => repoLooksGitLab(repo.url ?? repo.slug));
127482
127482
  }
127483
+ function botUsesGitHub(bot) {
127484
+ return bot.repos.some((repo) => !repoLooksGitLab(repo.url ?? repo.slug));
127485
+ }
127483
127486
  function addCliRequirement(requirements, input) {
127484
127487
  const existing = requirements.get(`cli:${input.command}`);
127485
127488
  if (existing) {
@@ -127563,6 +127566,16 @@ function runtimeRequirementsForBots(bots) {
127563
127566
  });
127564
127567
  }
127565
127568
  }
127569
+ if (botUsesGitHub(bot)) {
127570
+ addCliRequirement(requirements, {
127571
+ command: "gh",
127572
+ label: "GitHub CLI",
127573
+ severity: "optional",
127574
+ botIds: [bot.id],
127575
+ reason: "Only needed when an agent uses GitHub-specific actions such as PRs, issues, or releases.",
127576
+ installHint: "Install gh only for bots that need GitHub-specific workflow commands."
127577
+ });
127578
+ }
127566
127579
  if (botUsesGitLab(bot)) {
127567
127580
  addCliRequirement(requirements, {
127568
127581
  command: "glab",
package/dist/main.js CHANGED
@@ -115431,7 +115431,7 @@ async function renderPrompt(input) {
115431
115431
  ` lark-cli docs +get <doc-url>${profileFlag}`,
115432
115432
  "- \u53D6\u672C\u6761\u6D88\u606F\u7684\u9644\u4EF6/\u5185\u8054\u56FE(post \u5185\u8054\u56FE\u4E0D\u5728\u4E0A\u9762 attachments/images \u91CC)\u3001\u62C9\u8BDD\u9898\u5386\u53F2:",
115433
115433
  attachmentHelpLine,
115434
- "- glab / gh / git API",
115434
+ "- gh / glab / git API",
115435
115435
  "- pnpm / npm",
115436
115436
  "",
115437
115437
  chatHistoryFirst ? "**\u91CD\u8981**:\u8FD9\u662F\u5355\u804A/\u7C98\u8FDE session \u573A\u666F,\u4E0A\u4E0B\u6587\u5386\u53F2\u7528\u4E0A\u9762\u7684 chat-messages-list \u62C9\u53D6;\u4E0D\u8981\u628A `thread_id` \u5F53\u4F5C\u53EF\u62C9\u53D6\u7684\u6D88\u606F id \u4F7F\u7528\u3002" : "**\u91CD\u8981**:`thread_id` \u5C31\u662F\u8BDD\u9898\u9996\u697C\u7684 message_id\u3002\u5982\u679C\u5F53\u524D\u6D88\u606F attachments/feishu_doc_links \u4E3A\u7A7A,\u8BF4\u660E\u8FD0\u8425\u628A\u7D20\u6750\u653E\u5728\u9996\u697C,**\u5148\u62C9\u9996\u697C\u770B\u8FD0\u8425\u539F\u59CB\u9700\u6C42**,\u518D\u51B3\u5B9A\u4E0B\u4E00\u6B65\u3002",
@@ -118792,6 +118792,7 @@ stderr: ${stderr}`));
118792
118792
  var CORE_ALLOW_RULES = [
118793
118793
  "Bash(lark-cli *)",
118794
118794
  "Bash(git *)",
118795
+ "Bash(gh *)",
118795
118796
  "Bash(glab *)",
118796
118797
  "Bash(lsof *)",
118797
118798
  "Bash(curl *)",
@@ -127694,6 +127695,9 @@ function repoLooksGitLab(urlOrSlug) {
127694
127695
  function botUsesGitLab(bot) {
127695
127696
  return bot.repos.some((repo) => repoLooksGitLab(repo.url ?? repo.slug));
127696
127697
  }
127698
+ function botUsesGitHub(bot) {
127699
+ return bot.repos.some((repo) => !repoLooksGitLab(repo.url ?? repo.slug));
127700
+ }
127697
127701
  function addCliRequirement(requirements, input) {
127698
127702
  const existing = requirements.get(`cli:${input.command}`);
127699
127703
  if (existing) {
@@ -127777,6 +127781,16 @@ function runtimeRequirementsForBots(bots) {
127777
127781
  });
127778
127782
  }
127779
127783
  }
127784
+ if (botUsesGitHub(bot)) {
127785
+ addCliRequirement(requirements, {
127786
+ command: "gh",
127787
+ label: "GitHub CLI",
127788
+ severity: "optional",
127789
+ botIds: [bot.id],
127790
+ reason: "Only needed when an agent uses GitHub-specific actions such as PRs, issues, or releases.",
127791
+ installHint: "Install gh only for bots that need GitHub-specific workflow commands."
127792
+ });
127793
+ }
127780
127794
  if (botUsesGitLab(bot)) {
127781
127795
  addCliRequirement(requirements, {
127782
127796
  command: "glab",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larkway",
3
- "version": "0.3.58",
3
+ "version": "0.3.59",
4
4
  "description": "Thin bridge: Feishu thread to local Claude Code CLI",
5
5
  "license": "MIT",
6
6
  "author": "Chuck Wu (chuckwu0)",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "type": "module",
19
19
  "bin": {
20
- "larkway": "bin/larkway"
20
+ "larkway": "bin/larkway.mjs"
21
21
  },
22
22
  "scripts": {
23
23
  "start": "tsx src/main.ts",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "files": [
56
56
  "dist/",
57
- "bin/larkway",
57
+ "bin/larkway.mjs",
58
58
  "README.md"
59
59
  ]
60
60
  }
package/bin/larkway DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env bash
2
- # larkway CLI shim — resolves the package root from this script's own location
3
- # so it works whether invoked via `bin/larkway`, an absolute path, or a symlink
4
- # on PATH (e.g. after `npm i -g`).
5
- #
6
- # Startup priority:
7
- # 1. dist/cli/index.js exists → `node dist/cli/index.js` (installed package / post-build)
8
- # 2. otherwise → `npx tsx src/cli/index.ts` (fresh clone dev mode, no build)
9
- set -euo pipefail
10
- SOURCE="${BASH_SOURCE[0]}"
11
- while [ -h "$SOURCE" ]; do
12
- DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
13
- SOURCE="$(readlink "$SOURCE")"
14
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
15
- done
16
- REPO_ROOT="$(cd -P "$(dirname "$SOURCE")/.." >/dev/null 2>&1 && pwd)"
17
-
18
- DIST_ENTRY="$REPO_ROOT/dist/cli/index.js"
19
-
20
- if [ -f "$DIST_ENTRY" ]; then
21
- exec node "$DIST_ENTRY" "$@"
22
- else
23
- # Dev fallback: run TypeScript source directly via tsx.
24
- exec npx tsx "$REPO_ROOT/src/cli/index.ts" "$@"
25
- fi