Skip to content

Commit 6053b7d

Browse files
committed
chore(marketplace): update shared table.ts with smart termW(), sync SHAs to 4bac22c
The release script syncs tools/table/index.ts into plugin lib/ dirs. The termW() improvements must live in the shared source to survive syncs. Co-Authored-By: Magus <magus@madappgang.com> Crafted with agentic harness Magus (https://github.com/MadAppGang/magus)
1 parent 4bac22c commit 6053b7d

3 files changed

Lines changed: 134 additions & 24 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"url": "MadAppGang/magus",
1919
"path": "plugins/code-analysis",
2020
"ref": "main",
21-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
21+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
2222
},
2323
"description": "Deep code investigation with mnemex MCP server. v5.0.1: Renamed mnemex CLI tool.",
2424
"version": "5.1.0",
@@ -52,7 +52,7 @@
5252
"url": "MadAppGang/magus",
5353
"path": "plugins/multimodel",
5454
"ref": "main",
55-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
55+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
5656
},
5757
"description": "Multi-model collaboration, orchestration, and workflow patterns. v3.1.2: Fix internal model leaked to claudish \u2014 filter sentinel before external dispatch.",
5858
"version": "3.1.2",
@@ -87,7 +87,7 @@
8787
"url": "MadAppGang/magus",
8888
"path": "plugins/agentdev",
8989
"ref": "main",
90-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
90+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
9191
},
9292
"description": "Create, implement, and review Claude Code agents and commands with multi-model validation, LLM performance tracking, and session-based artifact isolation. v1.6.1: Fix manifest schema \u2014 agents paths, hooks format.",
9393
"version": "1.6.1",
@@ -118,7 +118,7 @@
118118
"url": "MadAppGang/magus",
119119
"path": "plugins/seo",
120120
"ref": "main",
121-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
121+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
122122
},
123123
"description": "Highly autonomous SEO toolkit (~80% autonomy) with AUTO GATEs, self-correction loops, and multi-model validation. v1.6.5: Command parameter fixes.",
124124
"version": "1.7.0",
@@ -148,7 +148,7 @@
148148
"url": "MadAppGang/magus",
149149
"path": "plugins/video-editing",
150150
"ref": "main",
151-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
151+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
152152
},
153153
"description": "Professional video editing toolkit with FFmpeg operations, Whisper transcription, and Apple Final Cut Pro project generation. v1.1.1: Marketplace rename to magus. Features intelligent video analysis, automated transcription with timing sync, FCPXML timeline creation.",
154154
"version": "1.1.3",
@@ -179,7 +179,7 @@
179179
"url": "MadAppGang/magus",
180180
"path": "plugins/nanobanana",
181181
"ref": "main",
182-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
182+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
183183
},
184184
"description": "AI image generation and editing using Google Gemini 3 Pro Image API. v2.3.1: Marketplace rename to magus. Simple Node.js CLI with markdown styles and batch generation.",
185185
"version": "2.4.0",
@@ -208,7 +208,7 @@
208208
"url": "MadAppGang/magus",
209209
"path": "plugins/conductor",
210210
"ref": "main",
211-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
211+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
212212
},
213213
"description": "Context-Driven Development workflow inspired by Gemini Conductor. v2.1.3: Fix manifest schema \u2014 commands paths, add skills registration.",
214214
"version": "2.1.3",
@@ -239,7 +239,7 @@
239239
"url": "MadAppGang/magus",
240240
"path": "plugins/dev",
241241
"ref": "main",
242-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
242+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
243243
},
244244
"description": "Universal development assistant. v2.6.0: self-learning Stop hook \u2014 automated session learning with LLM classifier, background daemon, /dev:learn --apply/--prune.",
245245
"version": "2.7.0",
@@ -288,7 +288,7 @@
288288
"url": "MadAppGang/magus",
289289
"path": "plugins/statusline",
290290
"ref": "main",
291-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
291+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
292292
},
293293
"description": "Adaptive statusline \u2014 always-visible bars, background highlights for critical states, provider-aware model display, vim mode, diff stats, compaction count, memory usage. v2.1.0: Prominent reset countdowns when rate-limited, process memory display.",
294294
"version": "2.1.0",
@@ -316,7 +316,7 @@
316316
"url": "MadAppGang/magus",
317317
"path": "plugins/browser-use",
318318
"ref": "main",
319-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
319+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
320320
},
321321
"description": "Full-platform browser automation for Claude Code. v1.1.0: Thin wrapper over built-in BrowserUseServer \u2014 63% less code. Fix TCC downloads_path, per-PID Chrome profiles, graceful shutdown. 19 MCP tools, 5 skills.",
322322
"version": "1.1.1",
@@ -348,7 +348,7 @@
348348
"url": "MadAppGang/magus",
349349
"path": "plugins/designer",
350350
"ref": "main",
351-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
351+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
352352
},
353353
"description": "UI design validation with pixel-diff comparison engine. v0.2.0: Design review agent, visual comparison, style guide creation, browser-use optional integration. 6 skills.",
354354
"version": "0.3.0",
@@ -380,7 +380,7 @@
380380
"url": "MadAppGang/magus",
381381
"path": "plugins/terminal",
382382
"ref": "main",
383-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
383+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
384384
},
385385
"description": "Interactive terminal integration for Claude Code. v4.0.0: agentic-first rewrite \u2014 single Go tmux-mcp binary replaces ht-mcp + npm tmux-mcp. New agentic tools (start-and-watch, watch-pane, run-in-repl, pane-state) eliminate all polling loops. 5 skills, 9 commands, 1 agent.",
386386
"version": "4.0.2",
@@ -409,7 +409,7 @@
409409
"url": "MadAppGang/magus",
410410
"path": "plugins/gtd",
411411
"ref": "main",
412-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
412+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
413413
},
414414
"description": "GTD (Getting Things Done) workflow integration. v2.0.0: Canonical GTD terminology (Clarify, Engage), sequential task IDs (#1, #2), boxed terminal display, reference list, Bun display tool. Real-time sync via hooks, 7 commands, 2 skills.",
415415
"version": "2.0.1",
@@ -440,7 +440,7 @@
440440
"url": "MadAppGang/magus",
441441
"path": "plugins/kanban",
442442
"ref": "main",
443-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
443+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
444444
},
445445
"description": "Kanban board view for task management. v1.3.0: Auto-open board in tmux split pane with real TTY, smart terminal width detection chain (stdout/COLUMNS/tmux/parent-TTY/120), remove --width hack. Visual board with 5 columns, task dependencies (cycle-safe), priority indicators, WIP limits. Shares tasks.json with GTD plugin \u2014 works standalone or alongside GTD.",
446446
"version": "1.3.0",
@@ -470,7 +470,7 @@
470470
"url": "MadAppGang/magus",
471471
"path": "plugins/autopilot",
472472
"ref": "main",
473-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
473+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
474474
},
475475
"description": "Autonomous task execution with Linear integration. Picks tasks from Linear, routes to agents via tag-to-command mapping, generates proof-of-work artifacts, and handles feedback loops.",
476476
"version": "0.2.4",
@@ -500,7 +500,7 @@
500500
"url": "MadAppGang/magus",
501501
"path": "plugins/instantly",
502502
"ref": "main",
503-
"sha": "af9911e626dd1406295b20c8e4d80f52ff3d8266"
503+
"sha": "4bac22cba2a12ce92331a11938235b45764bcc25"
504504
},
505505
"description": "Cold email outreach toolkit with Instantly.ai MCP integration. Campaign analytics, sequence building, A/B testing, lead management, and auto-optimization.",
506506
"version": "1.0.6",

plugins/gtd/lib/table.ts

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Output: print
1515
*/
1616

17+
import { execSync } from "child_process";
18+
1719
// ── ANSI helpers ─────────────────────────────────────────────────────────────
1820

1921
export const S = {
@@ -54,11 +56,64 @@ export function fg(style: string, text: string): string {
5456

5557
// ── Text utilities ────────────────────────────────────────────────────────────
5658

57-
/** Terminal width. Checks stdout, COLUMNS env var, defaults to 80. */
59+
/**
60+
* Terminal width detection chain.
61+
*
62+
* Tries, in order:
63+
* 1. process.stdout.columns (works when stdout is a TTY)
64+
* 2. $COLUMNS env var (set by some shells / wrappers)
65+
* 3. tmux pane_width (most accurate when inside a tmux pane)
66+
* 4. Parent process TTY via stty (works when our own stdout is piped)
67+
* 5. Fallback to 120 (reasonable default for modern terminals)
68+
*
69+
* Every shell-out is wrapped in try/catch so failures fall through silently.
70+
*/
5871
export function termW(): number {
59-
return process.stdout.columns
60-
|| (process.env.COLUMNS ? parseInt(process.env.COLUMNS) : 0)
61-
|| 80;
72+
// 1. Direct stdout columns
73+
if (process.stdout.columns && process.stdout.columns > 0) {
74+
return process.stdout.columns;
75+
}
76+
77+
// 2. $COLUMNS env var
78+
const envCols = process.env.COLUMNS ? parseInt(process.env.COLUMNS, 10) : 0;
79+
if (envCols > 0) return envCols;
80+
81+
// 3. tmux pane width (only when TMUX env is set)
82+
if (process.env.TMUX) {
83+
try {
84+
const w = parseInt(
85+
execSync("tmux display-message -p '#{pane_width}'", { stdio: ["pipe", "pipe", "pipe"] })
86+
.toString()
87+
.trim(),
88+
10,
89+
);
90+
if (w > 0) return w;
91+
} catch { /* not in tmux or tmux unavailable */ }
92+
}
93+
94+
// 4. Parent process TTY via stty
95+
try {
96+
const ppid = process.ppid ?? process.env.PPID;
97+
if (ppid) {
98+
const ttyName = execSync(`ps -o tty= -p ${ppid}`, { stdio: ["pipe", "pipe", "pipe"] })
99+
.toString()
100+
.trim();
101+
if (ttyName && ttyName !== "?" && ttyName !== "??") {
102+
const devPath = ttyName.startsWith("/dev/") ? ttyName : `/dev/${ttyName}`;
103+
const sttyOut = execSync(`stty size < ${devPath}`, {
104+
stdio: ["pipe", "pipe", "pipe"],
105+
shell: "/bin/sh",
106+
})
107+
.toString()
108+
.trim();
109+
const cols = parseInt(sttyOut.split(/\s+/)[1], 10);
110+
if (cols > 0) return cols;
111+
}
112+
}
113+
} catch { /* no parent TTY or stty failed */ }
114+
115+
// 5. Fallback
116+
return 120;
62117
}
63118

64119
/** Remove all ANSI escape codes from text. */

tools/table/index.ts

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Output: print
1515
*/
1616

17+
import { execSync } from "child_process";
18+
1719
// ── ANSI helpers ─────────────────────────────────────────────────────────────
1820

1921
export const S = {
@@ -54,11 +56,64 @@ export function fg(style: string, text: string): string {
5456

5557
// ── Text utilities ────────────────────────────────────────────────────────────
5658

57-
/** Terminal width. Checks stdout, COLUMNS env var, defaults to 80. */
59+
/**
60+
* Terminal width detection chain.
61+
*
62+
* Tries, in order:
63+
* 1. process.stdout.columns (works when stdout is a TTY)
64+
* 2. $COLUMNS env var (set by some shells / wrappers)
65+
* 3. tmux pane_width (most accurate when inside a tmux pane)
66+
* 4. Parent process TTY via stty (works when our own stdout is piped)
67+
* 5. Fallback to 120 (reasonable default for modern terminals)
68+
*
69+
* Every shell-out is wrapped in try/catch so failures fall through silently.
70+
*/
5871
export function termW(): number {
59-
return process.stdout.columns
60-
|| (process.env.COLUMNS ? parseInt(process.env.COLUMNS) : 0)
61-
|| 80;
72+
// 1. Direct stdout columns
73+
if (process.stdout.columns && process.stdout.columns > 0) {
74+
return process.stdout.columns;
75+
}
76+
77+
// 2. $COLUMNS env var
78+
const envCols = process.env.COLUMNS ? parseInt(process.env.COLUMNS, 10) : 0;
79+
if (envCols > 0) return envCols;
80+
81+
// 3. tmux pane width (only when TMUX env is set)
82+
if (process.env.TMUX) {
83+
try {
84+
const w = parseInt(
85+
execSync("tmux display-message -p '#{pane_width}'", { stdio: ["pipe", "pipe", "pipe"] })
86+
.toString()
87+
.trim(),
88+
10,
89+
);
90+
if (w > 0) return w;
91+
} catch { /* not in tmux or tmux unavailable */ }
92+
}
93+
94+
// 4. Parent process TTY via stty
95+
try {
96+
const ppid = process.ppid ?? process.env.PPID;
97+
if (ppid) {
98+
const ttyName = execSync(`ps -o tty= -p ${ppid}`, { stdio: ["pipe", "pipe", "pipe"] })
99+
.toString()
100+
.trim();
101+
if (ttyName && ttyName !== "?" && ttyName !== "??") {
102+
const devPath = ttyName.startsWith("/dev/") ? ttyName : `/dev/${ttyName}`;
103+
const sttyOut = execSync(`stty size < ${devPath}`, {
104+
stdio: ["pipe", "pipe", "pipe"],
105+
shell: "/bin/sh",
106+
})
107+
.toString()
108+
.trim();
109+
const cols = parseInt(sttyOut.split(/\s+/)[1], 10);
110+
if (cols > 0) return cols;
111+
}
112+
}
113+
} catch { /* no parent TTY or stty failed */ }
114+
115+
// 5. Fallback
116+
return 120;
62117
}
63118

64119
/** Remove all ANSI escape codes from text. */

0 commit comments

Comments
 (0)