@imdeadpool/guardex 7.0.43 → 7.1.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.
Files changed (68) hide show
  1. package/README.md +35 -0
  2. package/package.json +4 -1
  3. package/scripts/prepublish-bump-version.js +191 -0
  4. package/skills/gx-act/SKILL.md +82 -0
  5. package/src/agents/activity.js +279 -0
  6. package/src/agents/inspect.js +17 -4
  7. package/src/agents/launch.js +10 -1
  8. package/src/agents/status.js +9 -6
  9. package/src/budget/index.js +2 -1
  10. package/src/cli/args.js +118 -5
  11. package/src/cli/commands/agents.js +381 -0
  12. package/src/cli/commands/bootstrap.js +92 -0
  13. package/src/cli/commands/branch.js +127 -0
  14. package/src/cli/commands/claude.js +674 -0
  15. package/src/cli/commands/doctor.js +268 -0
  16. package/src/cli/commands/finish.js +26 -0
  17. package/src/cli/commands/mcp.js +122 -0
  18. package/src/cli/commands/misc.js +304 -0
  19. package/src/cli/commands/pr.js +439 -0
  20. package/src/cli/commands/prompt.js +92 -0
  21. package/src/cli/commands/release.js +305 -0
  22. package/src/cli/commands/report.js +244 -0
  23. package/src/cli/commands/review.js +32 -0
  24. package/src/cli/commands/setup.js +242 -0
  25. package/src/cli/commands/status.js +338 -0
  26. package/src/cli/commands/watch.js +234 -0
  27. package/src/cli/main.js +68 -3726
  28. package/src/cli/shared/repo-env.js +161 -0
  29. package/src/cli/shared/sandbox.js +417 -0
  30. package/src/cli/shared/scaffolding.js +535 -0
  31. package/src/cli/shared/toolchain-shims.js +420 -0
  32. package/src/context.js +229 -11
  33. package/src/core/runtime.js +6 -1
  34. package/src/doctor/index.js +42 -13
  35. package/src/finish/index.js +147 -5
  36. package/src/finish/preflight.js +177 -0
  37. package/src/finish/review-gate.js +182 -0
  38. package/src/git/index.js +446 -4
  39. package/src/hooks/index.js +0 -64
  40. package/src/mcp/collect.js +394 -0
  41. package/src/mcp/server.js +163 -0
  42. package/src/output/index.js +67 -1
  43. package/src/pr-review.js +23 -0
  44. package/src/pr.js +381 -0
  45. package/src/sandbox/index.js +13 -2
  46. package/src/scaffold/agent-worktree-prep.js +220 -0
  47. package/src/scaffold/index.js +108 -10
  48. package/src/scaffold/provision-config.js +314 -0
  49. package/src/speckit/index.js +226 -0
  50. package/src/terminal/index.js +1 -76
  51. package/src/terminal/kitty.js +20 -0
  52. package/src/terminal/tmux.js +9 -1
  53. package/src/toolchain/index.js +20 -0
  54. package/templates/AGENTS.monorepo-apps.md +26 -0
  55. package/templates/AGENTS.multiagent-safety.md +68 -344
  56. package/templates/AGENTS.multiagent-safety.min.md +11 -0
  57. package/templates/codex/skills/gx-act/SKILL.md +82 -0
  58. package/templates/githooks/pre-commit +22 -19
  59. package/templates/scripts/agent-branch-finish.sh +17 -33
  60. package/templates/scripts/agent-branch-merge.sh +4 -1
  61. package/templates/scripts/agent-branch-start.sh +115 -6
  62. package/templates/scripts/agent-file-locks.py +245 -50
  63. package/templates/scripts/agent-preflight.sh +31 -5
  64. package/templates/scripts/agent-worktree-prune.sh +1 -1
  65. package/templates/scripts/codex-agent.sh +0 -91
  66. package/src/agents/detect.js +0 -160
  67. package/src/cockpit/keybindings.js +0 -224
  68. package/src/cockpit/layout.js +0 -224
@@ -1,224 +0,0 @@
1
- const DEFAULT_SESSION_NAME = 'guardex';
2
- const DEFAULT_SIDEBAR_WIDTH = 34;
3
- const DEFAULT_TERMINAL_COLUMNS = 120;
4
- const DEFAULT_TERMINAL_ROWS = 40;
5
- const MIN_CONTENT_COLUMNS = 20;
6
-
7
- function text(value, fallback = '') {
8
- if (typeof value === 'string') return value.trim() || fallback;
9
- if (value === null || value === undefined) return fallback;
10
- return String(value).trim() || fallback;
11
- }
12
-
13
- function positiveInteger(value, fallback) {
14
- const parsed = Number.parseInt(String(value), 10);
15
- return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
16
- }
17
-
18
- function sidebarWidthFor(value, terminalColumns) {
19
- const requested = positiveInteger(value, DEFAULT_SIDEBAR_WIDTH);
20
- if (terminalColumns <= MIN_CONTENT_COLUMNS) {
21
- return Math.max(1, terminalColumns - 1);
22
- }
23
- return Math.min(requested, terminalColumns - MIN_CONTENT_COLUMNS);
24
- }
25
-
26
- function shellQuote(value) {
27
- return `'${String(value).replace(/'/g, "'\\''")}'`;
28
- }
29
-
30
- function normalizeSessions(sessions) {
31
- if (!Array.isArray(sessions)) return [];
32
- return sessions.map((session, index) => ({
33
- sessionId: text(session.sessionId || session.id, `session-${index + 1}`),
34
- branch: text(session.branch),
35
- worktreePath: text(session.worktreePath),
36
- command: text(session.command),
37
- }));
38
- }
39
-
40
- function paneTarget(sessionName, paneIndex) {
41
- return `${sessionName}:0.${paneIndex}`;
42
- }
43
-
44
- function windowTarget(sessionName) {
45
- return `${sessionName}:0`;
46
- }
47
-
48
- function agentGrid(count) {
49
- if (count <= 1) return { columns: 1, rows: 1 };
50
- const columns = Math.ceil(Math.sqrt(count));
51
- return {
52
- columns,
53
- rows: Math.ceil(count / columns),
54
- };
55
- }
56
-
57
- function dimension(total, parts, index) {
58
- const base = Math.floor(total / parts);
59
- const remainder = total % parts;
60
- return base + (index < remainder ? 1 : 0);
61
- }
62
-
63
- function offset(total, parts, index) {
64
- let value = 0;
65
- for (let part = 0; part < index; part += 1) {
66
- value += dimension(total, parts, part);
67
- }
68
- return value;
69
- }
70
-
71
- function agentGeometry(index, count, sidebarWidth, terminalColumns, terminalRows) {
72
- const mainColumns = Math.max(1, terminalColumns - sidebarWidth);
73
- const grid = agentGrid(count);
74
- const column = index % grid.columns;
75
- const row = Math.floor(index / grid.columns);
76
- return {
77
- x: sidebarWidth + offset(mainColumns, grid.columns, column),
78
- y: offset(terminalRows, grid.rows, row),
79
- width: dimension(mainColumns, grid.columns, column),
80
- height: dimension(terminalRows, grid.rows, row),
81
- };
82
- }
83
-
84
- function sidebarPane(sessionName, sidebarWidth, terminalRows, command) {
85
- return {
86
- role: 'sidebar',
87
- target: paneTarget(sessionName, 0),
88
- width: sidebarWidth,
89
- height: terminalRows,
90
- command,
91
- };
92
- }
93
-
94
- function agentCommand(session) {
95
- if (session.command) return session.command;
96
- if (!session.worktreePath) return 'gx agents status';
97
- return `cd ${shellQuote(session.worktreePath)} && exec ${'${SHELL:-bash}'}`;
98
- }
99
-
100
- function agentPane(sessionName, session, index, count, selectedSessionId, sidebarWidth, terminalColumns, terminalRows) {
101
- return {
102
- role: 'agent',
103
- target: paneTarget(sessionName, index + 1),
104
- sessionId: session.sessionId,
105
- branch: session.branch,
106
- worktreePath: session.worktreePath,
107
- selected: session.sessionId === selectedSessionId,
108
- command: agentCommand(session),
109
- ...agentGeometry(index, count, sidebarWidth, terminalColumns, terminalRows),
110
- };
111
- }
112
-
113
- function detailsPane(sessionName, paneIndex, sidebarWidth, terminalColumns, terminalRows, command) {
114
- return {
115
- role: 'details',
116
- target: paneTarget(sessionName, paneIndex),
117
- x: sidebarWidth,
118
- y: 0,
119
- width: Math.max(1, terminalColumns - sidebarWidth),
120
- height: terminalRows,
121
- command,
122
- };
123
- }
124
-
125
- function sendKeysCommand(role, target, command) {
126
- return {
127
- role,
128
- args: ['send-keys', '-t', target, command, 'C-m'],
129
- };
130
- }
131
-
132
- function buildTmuxCommands(plan) {
133
- const commands = [
134
- {
135
- role: 'session',
136
- args: ['new-session', '-d', '-s', plan.sessionName],
137
- },
138
- sendKeysCommand('sidebar', plan.panes[0].target, plan.panes[0].command),
139
- ];
140
-
141
- const contentPanes = plan.panes.filter((pane) => pane.role !== 'sidebar');
142
- if (contentPanes.length > 0) {
143
- commands.push({
144
- role: 'content',
145
- args: ['split-window', '-h', '-t', plan.panes[0].target],
146
- });
147
- commands.push({
148
- role: 'sidebar',
149
- args: ['resize-pane', '-t', plan.panes[0].target, '-x', String(plan.sidebarWidth)],
150
- });
151
- }
152
-
153
- for (let index = 1; index < contentPanes.length; index += 1) {
154
- commands.push({
155
- role: contentPanes[index].role,
156
- args: ['split-window', index % 2 === 1 ? '-h' : '-v', '-t', contentPanes[index - 1].target],
157
- });
158
- }
159
-
160
- if (contentPanes.filter((pane) => pane.role === 'agent').length > 1) {
161
- commands.push({
162
- role: 'layout',
163
- args: ['select-layout', '-t', windowTarget(plan.sessionName), 'tiled'],
164
- });
165
- commands.push({
166
- role: 'sidebar',
167
- args: ['resize-pane', '-t', plan.panes[0].target, '-x', String(plan.sidebarWidth)],
168
- });
169
- }
170
-
171
- for (const pane of contentPanes) {
172
- commands.push(sendKeysCommand(pane.role, pane.target, pane.command));
173
- }
174
-
175
- return commands;
176
- }
177
-
178
- function planCockpitLayout(options = {}) {
179
- const sessions = normalizeSessions(options.sessions);
180
- const terminalColumns = positiveInteger(options.terminalColumns, DEFAULT_TERMINAL_COLUMNS);
181
- const terminalRows = positiveInteger(options.terminalRows, DEFAULT_TERMINAL_ROWS);
182
- const sessionName = text(options.sessionName, DEFAULT_SESSION_NAME);
183
- const sidebarWidth = sidebarWidthFor(options.sidebarWidth, terminalColumns);
184
- const sidebarCommand = text(options.sidebarCommand, 'gx agents status');
185
- const selectedSessionId = text(options.selectedSessionId);
186
- const panes = [
187
- sidebarPane(sessionName, sidebarWidth, terminalRows, sidebarCommand),
188
- ];
189
-
190
- if (sessions.length === 0) {
191
- panes.push(detailsPane(sessionName, 1, sidebarWidth, terminalColumns, terminalRows, 'gx agents status'));
192
- } else {
193
- sessions.forEach((session, index) => {
194
- panes.push(agentPane(
195
- sessionName,
196
- session,
197
- index,
198
- sessions.length,
199
- selectedSessionId,
200
- sidebarWidth,
201
- terminalColumns,
202
- terminalRows,
203
- ));
204
- });
205
- }
206
-
207
- const plan = {
208
- sessionName,
209
- terminalColumns,
210
- terminalRows,
211
- sidebarWidth,
212
- panes,
213
- };
214
- return {
215
- ...plan,
216
- tmuxCommands: buildTmuxCommands(plan),
217
- };
218
- }
219
-
220
- module.exports = {
221
- DEFAULT_SESSION_NAME,
222
- DEFAULT_SIDEBAR_WIDTH,
223
- planCockpitLayout,
224
- };