@lark-project/meegle 0.0.16 → 1.0.0
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/CHANGELOG.md +17 -0
- package/README.md +322 -45
- package/README.zh-CN.md +312 -45
- package/THIRD_PARTY_NOTICES.md +76 -0
- package/bin/meegle-darwin-arm64 +0 -0
- package/bin/meegle-darwin-x64 +0 -0
- package/bin/meegle-linux-arm64 +0 -0
- package/bin/meegle-linux-x64 +0 -0
- package/bin/meegle-win32-arm64.exe +0 -0
- package/bin/meegle-win32-x64.exe +0 -0
- package/bin/meegle.js +24 -4
- package/package.json +6 -6
- package/third_party_licenses/github.com/cespare/xxhash/v2/LICENSE.txt +22 -0
- package/third_party_licenses/github.com/clipperhouse/displaywidth/LICENSE +21 -0
- package/third_party_licenses/github.com/clipperhouse/uax29/v2/graphemes/LICENSE +21 -0
- package/third_party_licenses/github.com/fatih/color/LICENSE.md +20 -0
- package/third_party_licenses/github.com/mattn/go-colorable/LICENSE +21 -0
- package/third_party_licenses/github.com/mattn/go-isatty/LICENSE +9 -0
- package/third_party_licenses/github.com/mattn/go-runewidth/LICENSE +21 -0
- package/third_party_licenses/github.com/mdp/qrterminal/v3/LICENSE +19 -0
- package/third_party_licenses/github.com/olekukonko/cat/LICENSE +21 -0
- package/third_party_licenses/github.com/olekukonko/errors/LICENSE +21 -0
- package/third_party_licenses/github.com/olekukonko/ll/LICENSE +21 -0
- package/third_party_licenses/github.com/olekukonko/tablewriter/LICENSE.md +19 -0
- package/third_party_licenses/github.com/pkg/browser/LICENSE +23 -0
- package/third_party_licenses/github.com/spf13/cobra/LICENSE.txt +174 -0
- package/third_party_licenses/github.com/spf13/pflag/LICENSE +28 -0
- package/third_party_licenses/golang.org/x/crypto/pbkdf2/LICENSE +27 -0
- package/third_party_licenses/golang.org/x/sys/unix/LICENSE +27 -0
- package/third_party_licenses/golang.org/x/term/LICENSE +27 -0
- package/third_party_licenses/gopkg.in/yaml.v3/LICENSE +50 -0
- package/third_party_licenses/gopkg.in/yaml.v3/NOTICE +13 -0
- package/third_party_licenses/rsc.io/qr/LICENSE +27 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [v1.0.0] - 2026-04-22
|
|
6
|
+
|
|
7
|
+
Initial public release of Meegle CLI, published on npm as `@lark-project/meegle`.
|
|
8
|
+
|
|
9
|
+
### Highlights
|
|
10
|
+
|
|
11
|
+
- **Broad coverage** — 12 business domains and 40+ commands across work items, workflow, subtasks, comments, work hours, relations, my-work, views, charts, team, user, and project
|
|
12
|
+
- **Agent-native** — bundled AI Agent Skill for Trae, Claude Code, Cursor, Windsurf, Gemini CLI, and Copilot; structured JSON output designed for both humans and agents
|
|
13
|
+
- **Two-layer parameters** — ergonomic `--flag-name` for everyday use, with a `--params <json>` fallback for complex payloads
|
|
14
|
+
- **Flexible output** — `json` / `table` / `ndjson` / `raw` formats, with `--select` dot-path projection for piping to other tools
|
|
15
|
+
- **Non-interactive auth** — OAuth browser login plus a `--device-code` flow for CI and agent shells
|
|
16
|
+
- **Dry-run previews** — `--dry-run` on mutation commands to inspect the exact payload before sending
|
|
17
|
+
- **Secure by default** — OS keychain credential storage, `${VAR}` env-var templating so secrets stay out of config files, and multi-profile switching for staging / production
|
package/README.md
CHANGED
|
@@ -1,21 +1,62 @@
|
|
|
1
1
|
# Meegle CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://www.npmjs.com/package/@lark-project/meegle)
|
|
6
|
+
|
|
7
|
+
[English](./README.md) | [简体中文](./README.zh-CN.md)
|
|
4
8
|
|
|
5
9
|
Command-line tool for [Meegle](https://meegle.com?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli) ([Lark Project](https://project.feishu.cn?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli)). Manage work items, schedules, and data from your terminal — no browser needed.
|
|
6
10
|
|
|
11
|
+
[Install](#installation) · [Quick Start](#quick-start-human-users) · [Agent Skill](#ai-agent-skill) · [Commands](#commands) · [Auth](#authentication) · [Config](#configuration) · [Security](#security--risk-warnings) · [Contributing](#contributing)
|
|
12
|
+
|
|
13
|
+
## Why Meegle CLI?
|
|
14
|
+
|
|
15
|
+
- **Agent-Native** — Ships a bundled [AI Agent Skill](#ai-agent-skill) that teaches Trae, Claude Code, Cursor, Windsurf, Gemini CLI and other agents how to drive Meegle with one command. Every CLI command is designed for both humans and agents, with structured JSON output, `--dry-run` previews, and `--device-code` flows for non-TTY environments
|
|
16
|
+
- **Broad Coverage** — 12 business domains (work items, workflow, subtasks, comments, work hours, relations, my-work, views, charts, team, user, project) and 40+ commands mapping to Meegle's core capabilities
|
|
17
|
+
- **Two-Layer Parameters** — Ergonomic `--flag-name` for everyday use, fallback `--params <json>` for complex payloads like `fields[]` — pick the right granularity per call
|
|
18
|
+
- **Flexible Output** — `json` / `table` / `ndjson` / `raw`, with `--select` dot-path projection for piping to other tools
|
|
19
|
+
- **Secure by Default** — OS keychain credential storage, `${VAR}` env-var templating so secrets never land in config files, multi-profile switching for staging / prod
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
| Category | Capabilities |
|
|
24
|
+
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
25
|
+
| 📋 [Work Items](#workitem--work-items) | Create, read, update, batch-read, query (MQL), list operation records, inspect metadata |
|
|
26
|
+
| 🔀 [Workflow](#workflow--workflow) | Transition nodes & states, update node fields, list available transitions and required fields |
|
|
27
|
+
| ✅ [Subtasks](#subtask--subtasks) | Create, update, complete, rollback subtasks |
|
|
28
|
+
| 💬 [Comments](#comment--comments) | Add and list comments on work items |
|
|
29
|
+
| ⏱️ [Work Hours](#workhour--work-hours) | List work hour records, view team-member schedules |
|
|
30
|
+
| 🔗 [Relations](#relation--relations) | List related work items, inspect relation-type definitions |
|
|
31
|
+
| 📌 [My Work](#mywork--my-work) | View this week / overdue / completed to-dos |
|
|
32
|
+
| 👁️ [Views](#view--views) | Create and update fixed views, search views by name |
|
|
33
|
+
| 📊 [Charts](#chart--charts) | List charts under a view, fetch chart details |
|
|
34
|
+
| 👥 [Team & User](#team--user--people) | List teams, team members, search users, view current login |
|
|
35
|
+
| 🗂️ [Projects](#project--projects) | Search projects by keyword |
|
|
36
|
+
| 🔐 [Auth & Config](#authentication) | OAuth login, device-code flow, multi-profile config, env-var injection |
|
|
37
|
+
| 🤖 [Agent Skill](#ai-agent-skill) | Pre-built skill for Trae / Claude Code / Cursor / Windsurf / Gemini CLI / Copilot |
|
|
38
|
+
|
|
7
39
|
## Installation
|
|
8
40
|
|
|
41
|
+
### Requirements
|
|
42
|
+
|
|
43
|
+
- Node.js >= 16 (ships with `npm` / `npx`)
|
|
44
|
+
|
|
45
|
+
### Install
|
|
46
|
+
|
|
9
47
|
```bash
|
|
10
48
|
npm install -g @lark-project/meegle
|
|
11
49
|
```
|
|
12
50
|
|
|
13
|
-
|
|
51
|
+
## Quick Start (Human Users)
|
|
14
52
|
|
|
15
|
-
|
|
53
|
+
> **Note for AI assistants:** if you are an AI Agent helping the user set this up, jump directly to [Quick Start (AI Agent)](#quick-start-ai-agent--ci--headless) — it contains the non-interactive steps you need.
|
|
16
54
|
|
|
17
55
|
```bash
|
|
18
|
-
#
|
|
56
|
+
# (Optional) Persist the host so future logins skip the arrow-key picker
|
|
57
|
+
meegle config set host <host>
|
|
58
|
+
|
|
59
|
+
# 1. Log in (arrow-key host picker + browser OAuth)
|
|
19
60
|
meegle auth login
|
|
20
61
|
|
|
21
62
|
# 2. View this week's to-dos
|
|
@@ -29,6 +70,85 @@ meegle workitem --help
|
|
|
29
70
|
meegle inspect workitem.create
|
|
30
71
|
```
|
|
31
72
|
|
|
73
|
+
## Quick Start (AI Agent / CI / Headless)
|
|
74
|
+
|
|
75
|
+
The default `meegle auth login` uses an arrow-key host picker plus a browser OAuth callback — both require a real TTY, so they will hang or fail in CI runners, pipes, and agent shells like Claude Code. Use the Device Code flow instead: it prints an authorization URL that the user opens in any browser.
|
|
76
|
+
|
|
77
|
+
**Step 1 — Install the CLI**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -g @lark-project/meegle
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Step 2 — Persist the host**
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
meegle config set host <host>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Examples of `<host>`: `project.feishu.cn`, `meegle.com`, or your self-hosted tenant domain such as `your-tenant.example.com`.
|
|
90
|
+
|
|
91
|
+
**Step 3 — Log in with Device Code**
|
|
92
|
+
|
|
93
|
+
> Run this command in the background. It prints an authorization URL — extract it and send it to the user. The command exits automatically once the user completes authorization in the browser.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
meegle auth login --device-code
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Alternatively, pass the host inline each time without persisting it:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
meegle auth login --device-code --host <host>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Step 4 — Verify**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
meegle auth status
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
For fully unattended CI (no human-in-the-loop), inject a token via environment variables instead — see [Sandbox / CI](#sandbox--ci-direct-environment-variable-injection).
|
|
112
|
+
|
|
113
|
+
## AI Agent Skill
|
|
114
|
+
|
|
115
|
+
`skills/meegle/` is a drop-in **skill** that teaches AI Agents — Trae, Claude Code, Cursor, Windsurf, Gemini CLI, GitHub Copilot CLI — how to operate Meegle through this CLI. It bundles the command catalog, MQL syntax, field-value conventions, rich-text Markdown rules, and standard operating procedures for common write flows.
|
|
116
|
+
|
|
117
|
+
### Install
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Install the CLI first (the skill calls `meegle` under the hood)
|
|
121
|
+
npm install -g @lark-project/meegle
|
|
122
|
+
|
|
123
|
+
# Then add the skill — auto-detects installed agents and registers in each
|
|
124
|
+
npx skills add larksuite/meegle-cli -y -g
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`npx skills add` reads `skills/meegle/SKILL.md` from the repo and drops it into the skill directory of every agent CLI it finds on the machine. Re-run any time to pick up updates.
|
|
128
|
+
|
|
129
|
+
### What it covers
|
|
130
|
+
|
|
131
|
+
- **Command reference** — every `meegle` resource / method with required parameters and examples
|
|
132
|
+
- **MQL search** — syntax for `workitem query`, operators, scope keywords
|
|
133
|
+
- **Field values** — how to shape complex field payloads (arrays, nested JSON, date ranges)
|
|
134
|
+
- **Rich text** — Markdown subset supported by Meegle's rich-text editor
|
|
135
|
+
- **SOPs** — step-by-step playbooks for creating work items, transitioning nodes, transitioning states, and updating fields
|
|
136
|
+
- **Auth guard** — the skill refuses to run business commands until `meegle auth status` succeeds
|
|
137
|
+
|
|
138
|
+
See [skills/meegle/SKILL.md](./skills/meegle/SKILL.md) and [skills/meegle/references/](./skills/meegle/references/) for the full contents.
|
|
139
|
+
|
|
140
|
+
### Usage
|
|
141
|
+
|
|
142
|
+
Once installed, just ask the agent in natural language. For example, in Trae:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Show me this week's P0 stories in the PROJ space.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The agent consults the skill, picks the right `meegle` commands, and runs them for you. Pair with `--dry-run` (see [Security](#security--risk-warnings)) to preview side-effectful operations before the agent commits them.
|
|
149
|
+
|
|
150
|
+
> Heads up: the skill name `meegle` is the same string as the CLI binary. When documentation refers to "the **`meegle` skill**" it means the files in `skills/meegle/`; when it refers to "the **`meegle` CLI**" it means the `meegle` command on your PATH.
|
|
151
|
+
|
|
32
152
|
## Commands
|
|
33
153
|
|
|
34
154
|
### workitem — Work Items
|
|
@@ -37,6 +157,7 @@ meegle inspect workitem.create
|
|
|
37
157
|
|---------|-------------|
|
|
38
158
|
| `workitem create` | Create a work item |
|
|
39
159
|
| `workitem get` | View work item details |
|
|
160
|
+
| `workitem +batch-get` | Batch-read work items by IDs (client-side fan-out over `workitem get`; `+` marks scenario/sugar commands) |
|
|
40
161
|
| `workitem update` | Update work item fields |
|
|
41
162
|
| `workitem query` | Search work items using MQL |
|
|
42
163
|
| `workitem list-op-records` | View operation records |
|
|
@@ -172,18 +293,57 @@ meegle workitem get --work-item-id 12345
|
|
|
172
293
|
meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
173
294
|
```
|
|
174
295
|
|
|
296
|
+
### Batch Reading Work Items
|
|
297
|
+
|
|
298
|
+
`workitem +batch-get` fans out to `workitem get` for each ID and aggregates the
|
|
299
|
+
results into one response. Shared flags (e.g. `--project-key`) apply to every
|
|
300
|
+
per-item call. The `+` prefix marks it as a scenario/sugar command with no 1:1
|
|
301
|
+
MCP tool behind it — the CLI composes multiple `get` calls client-side.
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Comma-separated IDs in one invocation
|
|
305
|
+
meegle workitem +batch-get --project-key PROJ --work-item-ids "12345,12346,12347"
|
|
306
|
+
|
|
307
|
+
# Read IDs from a file (one per line; lines starting with '#' are comments)
|
|
308
|
+
meegle workitem +batch-get --project-key PROJ --ids-file ./ids.txt
|
|
309
|
+
|
|
310
|
+
# Stream one JSON row per item; summary row is emitted last
|
|
311
|
+
meegle workitem +batch-get --project-key PROJ --work-item-ids "12345,12346" -o ndjson
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Response envelope (JSON):
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"summary": { "total": 3, "succeeded": 2, "failed": 1 },
|
|
319
|
+
"results": [
|
|
320
|
+
{ "work_item_id": 12345, "data": { /* ... */ } },
|
|
321
|
+
{ "work_item_id": 12346, "data": { /* ... */ } },
|
|
322
|
+
{ "work_item_id": 12347, "error": { "code": "...", "message": "..." } }
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Constraints: up to 200 IDs per invocation, 3 concurrent workers (fixed).
|
|
328
|
+
Partial failures do **not** abort the batch — check `summary.failed` or the
|
|
329
|
+
per-item `error` field. A 401 from the server aborts the whole run.
|
|
330
|
+
|
|
175
331
|
### Creating Work Items
|
|
176
332
|
|
|
177
333
|
```bash
|
|
178
|
-
#
|
|
334
|
+
# Pass fields[] via --params (JSON)
|
|
179
335
|
meegle workitem create --project-key PROJ --work-item-type story \
|
|
180
|
-
--
|
|
181
|
-
|
|
336
|
+
--params '{"fields":[
|
|
337
|
+
{"field_key":"name","field_value":"Optimize login flow"},
|
|
338
|
+
{"field_key":"priority","field_value":"P1"}
|
|
339
|
+
]}'
|
|
182
340
|
|
|
183
|
-
#
|
|
341
|
+
# Complex field values (arrays, nested JSON) also go through --params
|
|
184
342
|
meegle workitem create --project-key PROJ --work-item-type story \
|
|
185
|
-
--
|
|
186
|
-
|
|
343
|
+
--params '{"fields":[
|
|
344
|
+
{"field_key":"name","field_value":"Scheduled task"},
|
|
345
|
+
{"field_key":"schedule","field_value":[1722182400000,1722355199999]}
|
|
346
|
+
]}'
|
|
187
347
|
```
|
|
188
348
|
|
|
189
349
|
### Updating Fields
|
|
@@ -191,12 +351,14 @@ meegle workitem create --project-key PROJ --work-item-type story \
|
|
|
191
351
|
```bash
|
|
192
352
|
# Update work item name
|
|
193
353
|
meegle workitem update --work-item-id 12345 \
|
|
194
|
-
--
|
|
354
|
+
--params '{"fields":[{"field_key":"name","field_value":"New title"}]}'
|
|
195
355
|
|
|
196
356
|
# Update multiple fields at once
|
|
197
357
|
meegle workitem update --work-item-id 12345 \
|
|
198
|
-
--
|
|
199
|
-
|
|
358
|
+
--params '{"fields":[
|
|
359
|
+
{"field_key":"name","field_value":"New title"},
|
|
360
|
+
{"field_key":"priority","field_value":"P0"}
|
|
361
|
+
]}'
|
|
200
362
|
```
|
|
201
363
|
|
|
202
364
|
### MQL Search
|
|
@@ -232,19 +394,31 @@ Each command takes parameters via `--flag-name`:
|
|
|
232
394
|
meegle workitem get --work-item-id 12345 --project-key PROJ
|
|
233
395
|
```
|
|
234
396
|
|
|
235
|
-
###
|
|
397
|
+
### Writing `fields[]` (Write Commands)
|
|
236
398
|
|
|
237
|
-
`workitem create`, `workitem update`, `workflow update-node`, and `subtask update`
|
|
399
|
+
`workitem create`, `workitem update`, `workflow update-node`, and `subtask update` expect the `fields[]` payload. Pass it through `--params`:
|
|
238
400
|
|
|
239
401
|
```bash
|
|
240
|
-
--
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
--set role='{"role":"RD"}' # JSON object
|
|
402
|
+
--params '{"fields":[
|
|
403
|
+
{"field_key":"name","field_value":"Title"},
|
|
404
|
+
{"field_key":"priority","field_value":"P1"}
|
|
405
|
+
]}'
|
|
245
406
|
```
|
|
246
407
|
|
|
247
|
-
|
|
408
|
+
### --set key=value (Generic)
|
|
409
|
+
|
|
410
|
+
`--set` is an alternate syntax for writing **top-level** parameters — `--set key=value` is equivalent to typing `--key value`. Useful when scripting with a uniform `key=value` form, or for writing nested top-level params via dot-path. Values are auto-typed (int / float / bool / string).
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
# These two are equivalent:
|
|
414
|
+
meegle mywork todo --action this_week --page-num 1
|
|
415
|
+
meegle mywork todo --set action=this_week --set page_num=1
|
|
416
|
+
|
|
417
|
+
# Dot-path builds nested maps (rarely used in Meegle, but supported):
|
|
418
|
+
--set extra.flag=true # becomes {"extra":{"flag":true}}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
`--set` only writes **top-level** parameters. To write a work item's `fields[]`, use `--params '{"fields":[...]}'` (see below).
|
|
248
422
|
|
|
249
423
|
### --params JSON (Fallback)
|
|
250
424
|
|
|
@@ -259,8 +433,8 @@ meegle workitem create --project-key PROJ --work-item-type story \
|
|
|
259
433
|
|
|
260
434
|
When `--set`, `--params`, and regular flags are used together:
|
|
261
435
|
|
|
262
|
-
1. `--
|
|
263
|
-
2.
|
|
436
|
+
1. Regular CLI flags beat `--params` / `--set` for the same top-level key
|
|
437
|
+
2. `--set` overrides the same top-level key from `--params`
|
|
264
438
|
|
|
265
439
|
### Array Parameters
|
|
266
440
|
|
|
@@ -283,7 +457,7 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
283
457
|
|
|
284
458
|
| Flag | Short | Description |
|
|
285
459
|
|------|-------|-------------|
|
|
286
|
-
| `--format` | `-o` | Output format: `json` (default), `table`, `ndjson`, `
|
|
460
|
+
| `--format` | `-o` | Output format: `json` (default), `table`, `ndjson`, `raw` |
|
|
287
461
|
| `--select` | | Field projection with dot paths |
|
|
288
462
|
| `--set` | | Set nested parameters (repeatable) |
|
|
289
463
|
| `--params` | `-P` | Full JSON parameter body |
|
|
@@ -291,47 +465,71 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
291
465
|
| `--verbose` | `-v` | Verbose output |
|
|
292
466
|
| `--profile` | | Use a specific configuration profile |
|
|
293
467
|
|
|
294
|
-
##
|
|
468
|
+
## Advanced Usage
|
|
469
|
+
|
|
470
|
+
### Output Formats
|
|
295
471
|
|
|
296
472
|
```bash
|
|
297
473
|
# JSON (default)
|
|
298
474
|
meegle workitem get --work-item-id 12345
|
|
299
475
|
|
|
300
|
-
# Select output properties (supports dot paths)
|
|
301
|
-
meegle workitem get --work-item-id 12345 --select "id,name,status"
|
|
302
|
-
meegle mywork todo --action done --page-num 1 --select "list.work_item_info.work_item_name"
|
|
303
|
-
|
|
304
476
|
# NDJSON (suitable for piping)
|
|
305
477
|
meegle mywork todo --action this_week --page-num 1 -o ndjson
|
|
306
478
|
|
|
307
479
|
# Table
|
|
308
480
|
meegle mywork todo --action this_week --page-num 1 -o table
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Field Projection with `--select`
|
|
309
484
|
|
|
310
|
-
|
|
311
|
-
|
|
485
|
+
`--select` projects fields using `.` notation. A segment after an array
|
|
486
|
+
broadcasts the remaining path over every record of the array and
|
|
487
|
+
collects the results while preserving the enclosing structure.
|
|
312
488
|
|
|
313
|
-
|
|
314
|
-
|
|
489
|
+
| Expression | Response | Projection |
|
|
490
|
+
|---|---|---|
|
|
491
|
+
| `list` | `{"list":[{"a":1}], "total":1}` | `{"list":[{"a":1}]}` |
|
|
492
|
+
| `list.a` | `{"list":[{"a":1,"b":2},{"a":3,"b":4}]}` | `{"list":[{"a":1},{"a":3}]}` |
|
|
493
|
+
| `list.a,list.b` | same as above | `{"list":[{"a":1,"b":2},{"a":3,"b":4}]}` (merged per index) |
|
|
494
|
+
| `list.work_item_info.work_item_name` | `{"list":[{"work_item_info":{"work_item_name":"x"}}]}` | `{"list":[{"work_item_info":{"work_item_name":"x"}}]}` |
|
|
495
|
+
| `nodes.0` | `{"nodes":[{"id":"a"},{"id":"b"}]}` | `{"nodes":{"0":{"id":"a"}}}` (numeric = index) |
|
|
315
496
|
|
|
316
|
-
|
|
317
|
-
|
|
497
|
+
```bash
|
|
498
|
+
# Top-level selection
|
|
499
|
+
meegle workitem get --work-item-id 12345 --select "id,name,status"
|
|
500
|
+
|
|
501
|
+
# Broadcast across arrays — extract fields from nested records
|
|
502
|
+
meegle mywork todo --action done --page-num 1 \
|
|
503
|
+
--select "list.work_item_info.work_item_name,list.state_info.end_state_key_name"
|
|
504
|
+
|
|
505
|
+
# Mix top-level metadata with broadcast — total is retained alongside projected list items
|
|
506
|
+
meegle mywork todo --action done --page-num 1 \
|
|
507
|
+
--select "total,list.work_item_info.work_item_name"
|
|
318
508
|
```
|
|
319
509
|
|
|
320
|
-
###
|
|
510
|
+
### Metadata preservation
|
|
321
511
|
|
|
322
|
-
|
|
512
|
+
The default render preserves the full response shape across every
|
|
513
|
+
`--format`: list endpoints return `{"list":[...], "total":N,
|
|
514
|
+
"pagination":{...}}` verbatim — you see `total` / `pagination` even
|
|
515
|
+
when you do not project them. Drill into records explicitly via
|
|
516
|
+
`--select` (and the broadcast syntax above). Under `--format table`
|
|
517
|
+
and `--format ndjson`, a single-key wrapper like `{"list":[...]}`
|
|
518
|
+
(no sibling metadata) is still peeled into rows — the peel is
|
|
519
|
+
loss-less.
|
|
323
520
|
|
|
324
|
-
|
|
325
|
-
# Extract fields from nested structures
|
|
326
|
-
--select "list.work_item_info.work_item_name,list.state_info.end_state_key_name"
|
|
521
|
+
### Dry Run
|
|
327
522
|
|
|
328
|
-
|
|
329
|
-
|
|
523
|
+
For commands with side effects, preview the rendered request with `--dry-run` before executing:
|
|
524
|
+
|
|
525
|
+
```bash
|
|
526
|
+
meegle workitem create --project-key PROJ --work-item-type story \
|
|
527
|
+
--params '{"fields":[{"field_key":"name","field_value":"Test"}]}' --dry-run
|
|
330
528
|
```
|
|
331
529
|
|
|
332
|
-
|
|
530
|
+
### Command Introspection
|
|
333
531
|
|
|
334
|
-
Use `inspect` to view full parameter information for
|
|
532
|
+
Use `inspect` to view full parameter information for any command:
|
|
335
533
|
|
|
336
534
|
```bash
|
|
337
535
|
# List all commands
|
|
@@ -394,6 +592,57 @@ Main config options:
|
|
|
394
592
|
| Field | Description | Examples |
|
|
395
593
|
|-------|-------------|----------|
|
|
396
594
|
| `host` | Site domain | `project.feishu.cn`, `meegle.com` |
|
|
595
|
+
| `user_access_token` | User access token; use `${VAR}` to read from an environment variable | `${CI_MEEGLE_TOKEN}` |
|
|
596
|
+
| `access_token_header` | Custom HTTP header name that carries the token; empty falls back to default `Authorization: Bearer <token>` | `x-meegle-auth` |
|
|
597
|
+
| `user_agent` | Caller suffix appended to the default `User-Agent` (form: `meegle-cli/<ver> <user_agent>`); supports `${VAR}` template; overridden by the `MEEGLE_USER_AGENT` env var | `my-service/1.0` |
|
|
598
|
+
|
|
599
|
+
### Sandbox / CI: Direct Environment-Variable Injection
|
|
600
|
+
|
|
601
|
+
Two well-known environment variables are read directly at CLI startup and override the matching profile fields without requiring any `config set`:
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
export MEEGLE_HOST=project.feishu.cn
|
|
605
|
+
export MEEGLE_USER_ACCESS_TOKEN=<your-user-token>
|
|
606
|
+
export MEEGLE_USER_AGENT=ci-runner # optional; appended to User-Agent, highest priority over config.user_agent
|
|
607
|
+
meegle workitem get-brief --work_item_id 123
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
Either variable may be set independently. When this path is taken, the CLI bypasses the keychain and does not attempt to refresh on 401 — the caller is responsible for rotating the env value.
|
|
611
|
+
|
|
612
|
+
### Custom Auth Header
|
|
613
|
+
|
|
614
|
+
By default the token is sent via the standard `Authorization: Bearer <token>` header. If the backend requires a different header (and rejects requests that carry `Authorization`), opt in with `access_token_header`:
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
meegle config set access_token_header x-meegle-auth
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Or override at runtime via env var:
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
export MEEGLE_ACCESS_TOKEN_HEADER=x-meegle-auth
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
When enabled the CLI sends `<header>: <token>` with the raw token (no `Bearer ` prefix) and **omits `Authorization` entirely** — suitable for backends that reject requests carrying both headers.
|
|
627
|
+
|
|
628
|
+
### Environment Variable Templates
|
|
629
|
+
|
|
630
|
+
If your runtime exposes a variable with a name other than `MEEGLE_*`, bind it through `config.json` using a `${VAR}` placeholder. The placeholder is resolved against the process environment at runtime. This keeps secrets out of `config.json` while adapting to whatever variable name your runtime (Docker, Kubernetes, CI system) already injects.
|
|
631
|
+
|
|
632
|
+
```json
|
|
633
|
+
{
|
|
634
|
+
"current": "prod",
|
|
635
|
+
"profiles": {
|
|
636
|
+
"prod": { "host": "project.feishu.cn", "user_access_token": "${PROD_CI_TOKEN}" },
|
|
637
|
+
"staging": { "host": "staging.feishu.cn", "user_access_token": "${STAGING_CI_TOKEN}" }
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
Rules:
|
|
643
|
+
- Only whole-string placeholders are recognized. `"${X}"` is expanded; `"Bearer ${X}"` is treated as a literal.
|
|
644
|
+
- When a referenced variable is unset or empty, the CLI fails fast and reports the field path and variable name.
|
|
645
|
+
- When `user_access_token` is configured, it takes precedence over any token stored locally by `meegle auth login`. Because this mode has no refresh path, rotate the environment value yourself when the server returns 401.
|
|
397
646
|
|
|
398
647
|
### Multi-Environment Profiles
|
|
399
648
|
|
|
@@ -431,6 +680,34 @@ meegle auth login
|
|
|
431
680
|
|
|
432
681
|
The command list is cached automatically and refreshed silently in the background when expired.
|
|
433
682
|
|
|
683
|
+
## Security & Risk Warnings
|
|
684
|
+
|
|
685
|
+
This tool is designed to be called by AI Agents to automate Meegle operations, which carries inherent risks — model hallucinations, unpredictable execution, and prompt injection. Once you authorize Meegle permissions, the Agent will act under your user identity within the granted scope, and may perform high-impact actions (field updates, status transitions, work item creation) on your behalf. Use with care.
|
|
686
|
+
|
|
687
|
+
Recommended safeguards:
|
|
688
|
+
|
|
689
|
+
- Preview side-effectful commands with `--dry-run` before running them
|
|
690
|
+
- Use a dedicated profile (`meegle config profile create`) for Agent-driven sessions so you can audit and revoke independently
|
|
691
|
+
- For CI / shared environments, prefer short-lived env-var token injection (`MEEGLE_USER_ACCESS_TOKEN`) and rotate on 401 — do not relax default security settings
|
|
692
|
+
|
|
693
|
+
By using this tool you are deemed to voluntarily assume all related responsibilities.
|
|
694
|
+
|
|
695
|
+
## Star History
|
|
696
|
+
|
|
697
|
+
[](https://star-history.com/#larksuite/meegle-cli&Date)
|
|
698
|
+
|
|
699
|
+
## Contributing
|
|
700
|
+
|
|
701
|
+
Community contributions are welcome. For bugs and feature requests, open an [Issue](https://github.com/larksuite/meegle-cli/issues) or [Pull Request](https://github.com/larksuite/meegle-cli/pulls). For major changes, please start a discussion via an Issue first.
|
|
702
|
+
|
|
434
703
|
## License
|
|
435
704
|
|
|
436
|
-
|
|
705
|
+
This project is licensed under the **MIT License**.
|
|
706
|
+
|
|
707
|
+
When running, it calls Lark/Feishu Open Platform APIs. To use these APIs, you must comply with the following agreements and privacy policies:
|
|
708
|
+
|
|
709
|
+
- [Feishu User Terms of Service](https://www.feishu.cn/terms)
|
|
710
|
+
- [Feishu Privacy Policy](https://www.feishu.cn/privacy)
|
|
711
|
+
- [Feishu Open Platform App Service Provider Security Management Specifications](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/management-practice/app-service-provider-security-management-specifications)
|
|
712
|
+
- [Lark User Terms of Service](https://www.larksuite.com/user-terms-of-service)
|
|
713
|
+
- [Lark Privacy Policy](https://www.larksuite.com/privacy-policy)
|