trelly 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trelly",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "trelly — fast Trello CLI with multi-profile auth, MCP server, and kanban TUI",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/skills/README.md CHANGED
@@ -6,8 +6,8 @@ developing this repo.
6
6
 
7
7
  | Skill | Use when |
8
8
  |-------|----------|
9
- | [trelly](trelly/SKILL.md) | Terminal / bash: `trelly boards list`, auth, `--json` |
10
- | [trelly-mcp](trelly-mcp/SKILL.md) | IDE agent with MCP wired: tool names, envelopes, safety |
9
+ | [trelly](trelly/SKILL.md) | Terminal / bash: `trelly boards list`, auth, attachments, GitHub PR/commit links, `--json` |
10
+ | [trelly-mcp](trelly-mcp/SKILL.md) | IDE agent with MCP wired: tool names, GitHub links via `trello_api`, envelopes, safety |
11
11
 
12
12
  **One copy of the content:** `skills/trelly/` and `skills/trelly-mcp/` in the installed
13
13
  package. Plugins and Pi load from there — you don't maintain separate copies.
@@ -2,9 +2,9 @@
2
2
  name: trelly
3
3
  description: >-
4
4
  Operate the trelly Trello CLI (npm trelly; bins trelly/trello): auth setup/login,
5
- human vs --json output, boards/lists/cards, search, trello ui, trello api. Use when
6
- the user asks to run trelly/trello commands, script Trello from the terminal, or
7
- automate Trello with trelly.
5
+ human vs --json output, boards/lists/cards, search, attachments, GitHub PR/commit
6
+ links on cards, trello ui, trello api. Use when the user asks to run trelly/trello
7
+ commands, link a GitHub PR or commit to a Trello card, or automate Trello with trelly.
8
8
  ---
9
9
 
10
10
  # trelly
@@ -40,6 +40,8 @@ Credentials: `~/.config/trelly/config.json` (migrates from `~/.config/trello-cli
40
40
  | Pretty JSON | `--json --pretty` |
41
41
 
42
42
  - **Scripts:** always `--json` if parsing stdout.
43
+ - **Token cost:** raw `--json` returns full Trello objects (a board list ≈ 10k tokens) — trim with `jq` (e.g. `| jq '.data[] | {id,name}'`) or request fewer fields (`--fields`, `--query "fields=id,name"`).
44
+ - **Showing cards to a human?** Render one markdown line per card: `[name](shortUrl)` + non-zero badges `💬 n · 📎 n · ✓ x/y · ⏰ due` + labels as colored dots (red 🔴 orange 🟠 yellow 🟡 green 🟢 blue 🔵 purple 🟣). Slim the JSON first: `jq '.data[] | {name, shortUrl, labels: [.labels[] | {name, color}], badges: {comments: .badges.comments, attachments: .badges.attachments, checkItems: .badges.checkItems, checkItemsChecked: .badges.checkItemsChecked}, due, dueComplete}'`.
43
45
  - **`--pretty` alone** does not emit JSON; it only indents `--json` output.
44
46
  - Errors: red `✗` in human mode; exit code `1`.
45
47
 
@@ -56,6 +58,8 @@ trelly cards comments CARD_ID
56
58
  trelly cards create --list LIST_ID --name "Task"
57
59
  trelly cards move CARD_ID --list OTHER_LIST_ID
58
60
  trelly cards comment CARD_ID --text "Done"
61
+ trelly cards attachments CARD_ID
62
+ trelly cards add-attachment CARD_ID --url "https://github.com/org/repo/pull/42"
59
63
  trelly search "query"
60
64
  trelly ui BOARD_ID # interactive kanban (TTY required)
61
65
  trelly auth list
@@ -73,6 +77,89 @@ trelly api -X POST --path /cards --body '{"idList":"LIST_ID","name":"Hi"}'
73
77
 
74
78
  Request body flag is **`--body`** (not `--json` — that flag is global output).
75
79
 
80
+ ## Card attachments
81
+
82
+ ```bash
83
+ trelly cards attachments CARD_ID
84
+ trelly cards add-attachment CARD_ID --url "https://…" [--name "label"]
85
+ trelly cards add-attachment CARD_ID --file ./screenshot.png [--name "label"]
86
+ trelly cards delete-attachment CARD_ID ATTACHMENT_ID
87
+ ```
88
+
89
+ Pass **exactly one** of `--url` or `--file`. In `trelly ui`, open a card's detail (**⏎**), then **a** opens the attach prompt (URL or local path).
90
+
91
+ ## GitHub PR / commit on a card
92
+
93
+ Boards with the **GitHub Power-Up** enabled can show rich PR metadata in the Trello UI.
94
+ trelly attaches the same underlying **URL attachment** — it does **not** drive the
95
+ Power-Up picker or OAuth flow.
96
+
97
+ ### Link a PR or commit (preferred)
98
+
99
+ ```bash
100
+ # Pull request — set --name so the attachment is scannable in lists/UI
101
+ trelly cards add-attachment CARD_ID \
102
+ --url "https://github.com/PangoliaDev/dogster/pull/197" \
103
+ --name "#197 fix(pre-existing-tests-and-types)"
104
+
105
+ # Commit
106
+ trelly cards add-attachment CARD_ID \
107
+ --url "https://github.com/PangoliaDev/dogster/commit/2d856ea" \
108
+ --name "2d856ea Merge PR #197"
109
+
110
+ # Issue (same mechanism)
111
+ trelly cards add-attachment CARD_ID \
112
+ --url "https://github.com/PangoliaDev/dogster/issues/42"
113
+ ```
114
+
115
+ Accepted URL shapes: `…/pull/N`, `…/commit/SHA`, `…/issues/N`, `…/tree/branch`.
116
+ Use the canonical `https://github.com/…` URL (no `/files` or `/commits` tab suffix).
117
+
118
+ ### Power-Up UI vs trelly URL attachment
119
+
120
+ | Feature | GitHub Power-Up (Trello UI) | `cards add-attachment --url` |
121
+ |--------|-----------------------------|------------------------------|
122
+ | Link on card | Yes | Yes |
123
+ | Readable `--name` / PR title | Yes (auto) | Set `--name` yourself (recommended) |
124
+ | CI/check badges on card front | Yes | No |
125
+ | Pick PR from repo browser | Yes | No — pass URL |
126
+ | Comment back on GitHub PR | Yes (optional setting) | No |
127
+
128
+ If the user needs badges or GitHub-side back-links, attach via **Power-Ups → GitHub**
129
+ in Trello. For agent/CLI workflows (ship PR → link card → move list), URL attachment
130
+ is enough.
131
+
132
+ ### Agent workflow patterns
133
+
134
+ **After opening or merging a PR** — attach and optionally move the card:
135
+
136
+ ```bash
137
+ CARD_ID=…
138
+ PR_URL="https://github.com/PangoliaDev/dogster/pull/197"
139
+ trelly cards add-attachment "$CARD_ID" --url "$PR_URL" --name "#197 fix scope"
140
+ trelly cards move "$CARD_ID" --list PENDING_REVIEW_LIST_ID
141
+ ```
142
+
143
+ **Fallback — comment only** (visible in activity, not Attachments):
144
+
145
+ ```bash
146
+ trelly cards comment CARD_ID --text "PR: https://github.com/org/repo/pull/42"
147
+ ```
148
+
149
+ **Inspect what's linked:**
150
+
151
+ ```bash
152
+ trelly --json cards attachments CARD_ID | jq '.data[] | {name, url}'
153
+ ```
154
+
155
+ ### Raw API (same as CLI)
156
+
157
+ ```bash
158
+ trelly api -X POST --path "/cards/CARD_ID/attachments" \
159
+ --query "url=https://github.com/org/repo/pull/42" \
160
+ --query "name=#42 feature title"
161
+ ```
162
+
76
163
  ## Custom fields (list-type)
77
164
 
78
165
  ```bash
@@ -2,8 +2,8 @@
2
2
  name: trelly-mcp
3
3
  description: >-
4
4
  Configure and use the trelly MCP stdio server (trello_boards_list,
5
- trello_card_create, trello_search, etc.). Use when wiring Cursor/Claude MCP,
6
- calling Trello from an IDE agent, or choosing between MCP tools vs trelly CLI.
5
+ trello_card_create, trello_search, trello_api, etc.). Use when wiring Cursor/Claude
6
+ MCP, linking GitHub PRs/commits to Trello cards from an agent, or choosing MCP vs CLI.
7
7
  ---
8
8
 
9
9
  # trelly-mcp
@@ -12,6 +12,28 @@ MCP server for Trello (npm package **trelly**, bin **`trelly-mcp`**). Returns JS
12
12
  envelope on every tool: `{ ok, profile, data }` /
13
13
  `{ ok: false, error, status?, details? }`. Never uses CLI human/Ink output.
14
14
 
15
+ List/get tools default to lean `fields` (id, name, url, due, …) to keep responses
16
+ token-cheap; pass `fields: "all"` or a comma list when you need more.
17
+ `trello_list_cards` and `trello_card_get` also include slim `badges`
18
+ (comments/attachments/checkItems counts) and `labels` for rich rendering.
19
+
20
+ ## Rendering card lists for humans
21
+
22
+ When the user asks to **see** cards (not automation), render one markdown line per
23
+ card — title linked to the card, then only the badges that are non-zero:
24
+
25
+ ```
26
+ 1. [Publish module behavior](https://trello.com/c/1jH2UTAu) 🔴 `Priority: Highest` · 💬 4 · 📎 2 · ✓ 2/5 · ⏰ Jul 5
27
+ ```
28
+
29
+ - Title → `[name](shortUrl)`. Counts from `badges`: 💬 comments · 📎 attachments · ✓ checkItemsChecked/checkItems.
30
+ - Due: `⏰ Jul 5`, add `(overdue)` if past and not `dueComplete`; `✓` if complete.
31
+ - Labels: colored dot + name in backticks. Trello color → emoji: red 🔴 · orange 🟠 · yellow 🟡 · green/lime 🟢 · blue/sky 🔵 · purple/pink 🟣 · black ⚫ · none ⚪.
32
+ - Whole board: add `fields: "…,badges,labels"` to `trello_board_cards` (lean by default).
33
+ - Custom-field chips (e.g. `Priority: Highest`): fetch defs once via `trello_api` GET
34
+ `/boards/{boardId}/customFields`, request `customFieldItems` on cards, match
35
+ `idValue` → option text/color. Skip unless the user wants them — it's an extra call.
36
+
15
37
  ## Setup
16
38
 
17
39
  ### 1. Auth (CLI, once)
@@ -99,6 +121,66 @@ Starts stdio MCP manually (IDE normally launches `trelly-mcp` itself).
99
121
  | `trello_webhook_delete` | Delete webhook |
100
122
  | `trello_api` | Raw REST (`method`, `path`, `query`, `body`) |
101
123
 
124
+ There is **no dedicated attachment MCP tool** yet — use `trello_api` or the CLI
125
+ `cards add-attachment` (see **trelly** skill).
126
+
127
+ ## GitHub PR / commit on a card (MCP)
128
+
129
+ Boards with the **GitHub Power-Up** show rich PR UI when attached through Trello.
130
+ Agents link the same way via **`trello_api`** — a URL attachment, not the Power-Up
131
+ OAuth picker.
132
+
133
+ ### Attach PR or commit
134
+
135
+ ```
136
+ trello_api
137
+ method: POST
138
+ path: /cards/{cardId}/attachments
139
+ query: { "url": "https://github.com/org/repo/pull/42", "name": "#42 feature title" }
140
+ ```
141
+
142
+ Commit:
143
+
144
+ ```
145
+ query: { "url": "https://github.com/org/repo/commit/abc1234", "name": "abc1234 message" }
146
+ ```
147
+
148
+ Always set **`name`** to something scannable (`#N title` or short SHA + subject).
149
+
150
+ ### List or remove attachments
151
+
152
+ ```
153
+ trello_api GET /cards/{cardId}/attachments
154
+ trello_api DELETE /cards/{cardId}/attachments/{attachmentId}
155
+ ```
156
+
157
+ ### Comment fallback
158
+
159
+ ```
160
+ trello_card_comment cardId text: "PR: https://github.com/org/repo/pull/42"
161
+ ```
162
+
163
+ Comments appear in card activity; they are **not** Attachments.
164
+
165
+ ### Power-Up vs MCP/API
166
+
167
+ | Feature | GitHub Power-Up (UI) | `trello_api` URL attachment |
168
+ |--------|----------------------|-----------------------------|
169
+ | Link on card | Yes | Yes |
170
+ | PR title / custom name | Auto | Set `name` in query |
171
+ | CI badges on card front | Yes | No |
172
+ | GitHub PR back-link comment | Yes (optional) | No |
173
+
174
+ Use the Power-Up UI when the user needs badges or GitHub-side comments. For
175
+ agent workflows (link PR after push, move card to review), POST the GitHub URL.
176
+
177
+ ### Typical agent sequence
178
+
179
+ 1. `trello_search` or `trello_list_cards` — find the card
180
+ 2. `trello_api` POST `/cards/{id}/attachments` with PR URL + name
181
+ 3. `trello_card_move` — e.g. To do → Pending review
182
+ 4. Optional: `trello_card_comment` with the same PR URL
183
+
102
184
  ## When to use MCP vs CLI
103
185
 
104
186
  | Use MCP | Use CLI |
@@ -19,11 +19,49 @@ export const profileField = z.string().optional().describe("Auth profile name");
19
19
  export function toolResult(envelope: ToolEnvelope): CallToolResult {
20
20
  return {
21
21
  structuredContent: envelope,
22
- content: [{ type: "text", text: JSON.stringify(envelope, null, 2) }],
22
+ content: [{ type: "text", text: JSON.stringify(envelope) }],
23
23
  isError: envelope.ok === false,
24
24
  };
25
25
  }
26
26
 
27
+ // Trello's badges object is ~400 chars of mostly unused keys; keep the 4 that matter.
28
+ const BADGE_KEYS = ["comments", "attachments", "checkItems", "checkItemsChecked"];
29
+
30
+ function slimCard(card: Record<string, unknown>): Record<string, unknown> {
31
+ const out = { ...card };
32
+ if (out.badges && typeof out.badges === "object" && !Array.isArray(out.badges)) {
33
+ const badges = out.badges as Record<string, unknown>;
34
+ out.badges = Object.fromEntries(
35
+ BADGE_KEYS.filter((key) => badges[key] !== undefined).map((key) => [
36
+ key,
37
+ badges[key],
38
+ ]),
39
+ );
40
+ }
41
+ if (Array.isArray(out.labels)) {
42
+ out.labels = out.labels.map((label) => {
43
+ const { id, name, color } = label as Record<string, unknown>;
44
+ return { id, name, color };
45
+ });
46
+ }
47
+ return out;
48
+ }
49
+
50
+ /** Slim badges/labels on a card or card array returned by Trello. */
51
+ export function slimCards(data: unknown): unknown {
52
+ if (Array.isArray(data)) {
53
+ return data.map((item) =>
54
+ item && typeof item === "object"
55
+ ? slimCard(item as Record<string, unknown>)
56
+ : item,
57
+ );
58
+ }
59
+ if (data && typeof data === "object") {
60
+ return slimCard(data as Record<string, unknown>);
61
+ }
62
+ return data;
63
+ }
64
+
27
65
  export async function withClient<T>(
28
66
  profile: string | undefined,
29
67
  fn: (client: TrelloClient, profileName: string) => Promise<T>,
@@ -1,6 +1,11 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { profileField, toolEnvelopeSchema, withClient } from "../handlers.ts";
3
+ import {
4
+ profileField,
5
+ slimCards,
6
+ toolEnvelopeSchema,
7
+ withClient,
8
+ } from "../handlers.ts";
4
9
 
5
10
  export function registerBoardTools(server: McpServer): void {
6
11
  const outputSchema = toolEnvelopeSchema;
@@ -25,7 +30,10 @@ export function registerBoardTools(server: McpServer): void {
25
30
  ])
26
31
  .optional()
27
32
  .default("open"),
28
- fields: z.string().optional(),
33
+ fields: z
34
+ .string()
35
+ .default("id,name,shortUrl,closed")
36
+ .describe('comma-separated fields, "all" for everything'),
29
37
  },
30
38
  annotations: { readOnlyHint: true },
31
39
  outputSchema,
@@ -41,7 +49,10 @@ export function registerBoardTools(server: McpServer): void {
41
49
  inputSchema: {
42
50
  profile: profileField,
43
51
  boardId: z.string().min(1),
44
- fields: z.string().optional(),
52
+ fields: z
53
+ .string()
54
+ .default("id,name,desc,shortUrl,closed")
55
+ .describe('comma-separated fields, "all" for everything'),
45
56
  },
46
57
  annotations: { readOnlyHint: true },
47
58
  outputSchema,
@@ -94,23 +105,38 @@ export function registerBoardTools(server: McpServer): void {
94
105
  profile: profileField,
95
106
  boardId: z.string().min(1),
96
107
  filter: z.string().optional().default("open"),
108
+ fields: z
109
+ .string()
110
+ .default("id,name,closed,pos")
111
+ .describe('comma-separated fields, "all" for everything'),
97
112
  },
98
113
  annotations: { readOnlyHint: true },
99
114
  outputSchema,
100
115
  },
101
- async ({ profile, boardId, filter }) =>
102
- withClient(profile, (client) => client.boardLists(boardId, { filter })),
116
+ async ({ profile, boardId, filter, fields }) =>
117
+ withClient(profile, (client) => client.boardLists(boardId, { filter, fields })),
103
118
  );
104
119
 
105
120
  server.registerTool(
106
121
  "trello_board_cards",
107
122
  {
108
123
  description: "List all cards on a board.",
109
- inputSchema: { profile: profileField, boardId: z.string().min(1) },
124
+ inputSchema: {
125
+ profile: profileField,
126
+ boardId: z.string().min(1),
127
+ fields: z
128
+ .string()
129
+ .default("id,name,idList,due,dueComplete,shortUrl,closed")
130
+ .describe(
131
+ 'comma-separated fields, "all" for everything; add "badges,labels" for rich lists',
132
+ ),
133
+ },
110
134
  annotations: { readOnlyHint: true },
111
135
  outputSchema,
112
136
  },
113
- async ({ profile, boardId }) =>
114
- withClient(profile, (client) => client.boardCards(boardId)),
137
+ async ({ profile, boardId, fields }) =>
138
+ withClient(profile, async (client) =>
139
+ slimCards(await client.boardCards(boardId, { fields })),
140
+ ),
115
141
  );
116
142
  }
@@ -1,6 +1,11 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { profileField, toolEnvelopeSchema, withClient } from "../handlers.ts";
3
+ import {
4
+ profileField,
5
+ slimCards,
6
+ toolEnvelopeSchema,
7
+ withClient,
8
+ } from "../handlers.ts";
4
9
 
5
10
  export function registerCardTools(server: McpServer): void {
6
11
  const outputSchema = toolEnvelopeSchema;
@@ -12,13 +17,18 @@ export function registerCardTools(server: McpServer): void {
12
17
  inputSchema: {
13
18
  profile: profileField,
14
19
  cardId: z.string().min(1),
15
- fields: z.string().optional(),
20
+ fields: z
21
+ .string()
22
+ .default("id,name,desc,due,dueComplete,idList,shortUrl,labels,badges")
23
+ .describe('comma-separated fields, "all" for everything'),
16
24
  },
17
25
  annotations: { readOnlyHint: true },
18
26
  outputSchema,
19
27
  },
20
28
  async ({ profile, cardId, fields }) =>
21
- withClient(profile, (client) => client.cardGet(cardId, { fields })),
29
+ withClient(profile, async (client) =>
30
+ slimCards(await client.cardGet(cardId, { fields })),
31
+ ),
22
32
  );
23
33
 
24
34
  server.registerTool(
@@ -1,6 +1,11 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { profileField, toolEnvelopeSchema, withClient } from "../handlers.ts";
3
+ import {
4
+ profileField,
5
+ slimCards,
6
+ toolEnvelopeSchema,
7
+ withClient,
8
+ } from "../handlers.ts";
4
9
 
5
10
  export function registerListTools(server: McpServer): void {
6
11
  const outputSchema = toolEnvelopeSchema;
@@ -27,11 +32,20 @@ export function registerListTools(server: McpServer): void {
27
32
  "trello_list_cards",
28
33
  {
29
34
  description: "List cards in a list.",
30
- inputSchema: { profile: profileField, listId: z.string().min(1) },
35
+ inputSchema: {
36
+ profile: profileField,
37
+ listId: z.string().min(1),
38
+ fields: z
39
+ .string()
40
+ .default("id,name,idList,due,dueComplete,shortUrl,closed,badges,labels")
41
+ .describe('comma-separated fields, "all" for everything'),
42
+ },
31
43
  annotations: { readOnlyHint: true },
32
44
  outputSchema,
33
45
  },
34
- async ({ profile, listId }) =>
35
- withClient(profile, (client) => client.listCards(listId)),
46
+ async ({ profile, listId, fields }) =>
47
+ withClient(profile, async (client) =>
48
+ slimCards(await client.listCards(listId, { fields })),
49
+ ),
36
50
  );
37
51
  }
@@ -15,16 +15,28 @@ export function registerSearchTools(server: McpServer): void {
15
15
  modelTypes: z.string().optional(),
16
16
  cardsLimit: z.number().int().positive().optional(),
17
17
  boardsLimit: z.number().int().positive().optional(),
18
+ cardFields: z.string().default("id,name,idList,shortUrl"),
19
+ boardFields: z.string().default("id,name,shortUrl"),
18
20
  },
19
21
  annotations: { readOnlyHint: true },
20
22
  outputSchema,
21
23
  },
22
- async ({ profile, query, modelTypes, cardsLimit, boardsLimit }) =>
24
+ async ({
25
+ profile,
26
+ query,
27
+ modelTypes,
28
+ cardsLimit,
29
+ boardsLimit,
30
+ cardFields,
31
+ boardFields,
32
+ }) =>
23
33
  withClient(profile, (client) =>
24
34
  client.search(query, {
25
35
  modelTypes,
26
36
  cards_limit: cardsLimit,
27
37
  boards_limit: boardsLimit,
38
+ card_fields: cardFields,
39
+ board_fields: boardFields,
28
40
  }),
29
41
  ),
30
42
  );