@blod-nm/1kuan-act-01-cli 0.2.0 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blod-nm/1kuan-act-01-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Internal operations CLI: invoke preset database functions via a gateway. Zero dependencies, MCP (stdio) support.",
6
6
  "license": "MIT",
package/src/mcp.js CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { VERSION } from './version.js'
15
15
  import { loadConfig } from './store.js'
16
- import { resolveApikey, execPgsql, gatewayBase } from './tcb.js'
16
+ import { ACCOUNT_SQL, resolveApikey, execPgsql, gatewayBase } from './tcb.js'
17
17
  import { normalizeCreateRedpacket, buildCreateSql, claimTarget } from './redpacket.js'
18
18
 
19
19
  const SERVER_INFO = { name: 'act-01', version: VERSION }
@@ -96,7 +96,8 @@ function withClaimTarget(raw) {
96
96
  return packetNo ? { ...result, qr: { content: claimTarget(packetNo) } } : result
97
97
  }
98
98
 
99
- async function callTool(name, args) {
99
+ /** 导出仅为测试:mock tcb 后可以直接断言工具返回形状 */
100
+ export async function callTool(name, args) {
100
101
  if (name === 'redpacket_create' || name === 'redpacket_check') {
101
102
  const checkOnly = name === 'redpacket_check'
102
103
  const input = normalizeCreateRedpacket(args) // 校验失败抛 ValidationError
package/src/tcb.js CHANGED
@@ -67,7 +67,9 @@ export async function execPgsql(config, apikey, sql) {
67
67
  return { ok: false, status: res.status, raw, message: `HTTP ${res.status}: ${detail}` }
68
68
  }
69
69
 
70
- const rows =
71
- raw && typeof raw === 'object' && Array.isArray(raw.rows) ? raw.rows : undefined
70
+ // exec-pgsql 现在回的是裸数组([{...}]);老形状 { rows: [...] } 也一并兼容
71
+ const rows = Array.isArray(raw)
72
+ ? raw
73
+ : (raw && typeof raw === 'object' && Array.isArray(raw.rows) ? raw.rows : undefined)
72
74
  return { ok: true, status: res.status, rows, raw }
73
75
  }
package/src/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * (test/version.test.js 会断言两者一致,防止再漏升)。
4
4
  */
5
5
 
6
- export const VERSION = '0.2.0'
6
+ export const VERSION = '0.2.2'