@gangfun/cli 0.17.0 → 0.17.1

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
@@ -251,9 +251,9 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
251
251
  | `GANG_UPDATE_URL` | Where that check asks, default `https://registry.npmjs.org/@gangfun/cli/latest`; set an npm mirror's `…/@gangfun/cli/latest` if npmjs is slow or blocked |
252
252
  | `GANG_PAD` / `GANG_TESTNET_PAD` | Override the merged GangLaunchpad (mainnet / testnet) behind V3 and 打新 (defaults: mainnet `0x15CF…4365`, testnet set 10 `0xFebF…5BB1`). Old names `GANG_V3_PAD` / `GANG_FAIR_PAD`, `GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` still work as aliases |
253
253
  | `GANG_TESTNET_RPC_URL` | Testnet RPC; old names `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` still work |
254
- | `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond (creator bonds, `gang bond`). Testnet built in (`0xB034…EBE3`); mainnet not deployed yet |
254
+ | `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond (creator bonds, `gang bond`). Defaults: mainnet `0xe92d…14E4` (since 2026-10-29, CLI 0.16.2+), testnet `0xd6a8…1086` |
255
255
  | `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet `0xE040…79C4`, testnet set 10 `0x6bB6…C9F6` |
256
256
 
257
257
  ## Version
258
258
 
259
- `0.17.0` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
259
+ `0.17.1` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
package/README.zh-CN.md CHANGED
@@ -219,9 +219,9 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
219
219
  | `GANG_UPDATE_URL` | 新版本检查查询的地址,默认 `https://registry.npmjs.org/@gangfun/cli/latest`;npmjs 慢或打不开时,可以换成 npm 镜像的 `…/@gangfun/cli/latest` |
220
220
  | `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),V3 和打新共用(默认:主网 `0x15CF…4365`,测试网第 10 套 `0xFebF…5BB1`)。旧名 `GANG_V3_PAD` / `GANG_FAIR_PAD`、`GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` 仍可用(别名) |
221
221
  | `GANG_TESTNET_RPC_URL` | 测试网 RPC;旧名 `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` 仍可用 |
222
- | `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond(押金承诺,`gang bond`)。测试网已内置(`0xB034…EBE3`);主网尚未部署 |
222
+ | `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond(押金承诺,`gang bond`)。默认:主网 `0xe92d…14E4`(2026-10-29 起,CLI 0.16.2+),测试网 `0xd6a8…1086` |
223
223
  | `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 `0xE040…79C4`,测试网第 10 套 `0x6bB6…C9F6` |
224
224
 
225
225
  ## 版本
226
226
 
227
- `0.17.0` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
227
+ `0.17.1` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gangfun/cli",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Gang launchpad CLI for Binance Agentic Wallet agents: create on GangLaunchpad (untaxed or tax tokens), 打新 fair mint, PancakeSwap pool trades, LaunchpadV2 and legacy Soft/U/S trade.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/mcp.js CHANGED
@@ -33,7 +33,9 @@ Hard rules (the gang skill has the full list: npx skills add gangfun/gang-launch
33
33
  const TRACK = { type: 'string', enum: ['all', 'v3', 'fair', 'v2', 'soft'], description: 'Launchpad track (default all)' }
34
34
  const ADDR = { type: 'string', pattern: '^0x[0-9a-fA-F]{40}$' }
35
35
  const HASH = { type: 'string', pattern: '^0x[0-9a-fA-F]{64}$' }
36
- const AMOUNT = { type: ['string', 'number'] }
36
+ // one plain type: some MCP hosts (Gemini function calling, OpenAI strict mode) reject a schema with a union type. A number
37
+ // sent anyway is turned into a string before the check (coerce)
38
+ const AMOUNT = { type: 'string', pattern: '^[0-9]+(\\.[0-9]+)?$', description: 'A plain decimal, e.g. "0.05"' }
37
39
  const TESTNET = { type: 'boolean', description: 'BSC testnet GangLaunchpad (tokens have no value)' }
38
40
  const NOTE = {
39
41
  note: { type: 'string', description: 'Public, permanent reason for the trade (1-280 chars, no links). Mainnet curve trades only' },
@@ -130,6 +132,14 @@ export const TOOLS = [
130
132
  const BY_NAME = new Map(TOOLS.map((t) => [t.name, t]))
131
133
  const NOT_VIA_CLI = new Set(['execute', 'watch', 'mcp', 'help'])
132
134
 
135
+ /** A number where the schema asks for a decimal string (models often send amount: 0.05) → its string. */
136
+ export function coerce(t, a) {
137
+ if (a == null || typeof a !== 'object' || Array.isArray(a)) return a
138
+ const out = { ...a }
139
+ for (const [k, v] of Object.entries(a)) if (t.inputSchema.properties[k] === AMOUNT && typeof v === 'number') out[k] = String(v)
140
+ return out
141
+ }
142
+
133
143
  /** Check arguments against a tool's schema (the subset these tools use). → error message or null */
134
144
  export function invalid(t, a) {
135
145
  if (a == null || typeof a !== 'object' || Array.isArray(a)) return 'arguments must be an object'
@@ -143,7 +153,9 @@ export function invalid(t, a) {
143
153
  const ok = types.some((ty) => (ty === 'integer' ? Number.isInteger(v) : ty === 'array' ? Array.isArray(v) : typeof v === ty))
144
154
  if (!ok) return `${k} must be ${types.join(' or ')}`
145
155
  if (s.enum && !s.enum.includes(v)) return `${k} must be one of ${s.enum.join(', ')}`
146
- if (s.pattern && !new RegExp(s.pattern).test(v)) return `${k} is not a valid ${s.pattern.includes('64') ? 'tx hash' : 'address'}`
156
+ if (s.pattern && !new RegExp(s.pattern).test(v)) {
157
+ return s === AMOUNT ? `${k} must be a plain decimal like 0.05 (got ${v})` : `${k} is not a valid ${s.pattern.includes('64') ? 'tx hash' : 'address'}`
158
+ }
147
159
  if (typeof v === 'number' && ((s.minimum != null && v < s.minimum) || (s.maximum != null && v > s.maximum))) return `${k} is out of range`
148
160
  if (Array.isArray(v)) {
149
161
  if (s.minItems && v.length < s.minItems) return `${k} needs at least ${s.minItems} item(s)`
@@ -252,7 +264,7 @@ export function runMcp({ input = process.stdin, output = process.stdout, signals
252
264
  case 'tools/call': {
253
265
  const t = BY_NAME.get(m.params?.name)
254
266
  if (!t) return error(m.id, -32602, `unknown tool: ${m.params?.name}`)
255
- const a = m.params.arguments ?? {}
267
+ const a = coerce(t, m.params.arguments ?? {})
256
268
  const bad = invalid(t, a)
257
269
  if (bad) return reply(m.id, { content: [{ type: 'text', text: JSON.stringify({ success: false, error: bad }) }], isError: true })
258
270
  const read = t.annotations.readOnlyHint === true