@glbgpt/cli 0.1.0-test.5 → 0.1.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.
Files changed (140) hide show
  1. package/README.md +79 -6
  2. package/dist/src/auth/authClient.d.ts +21 -2
  3. package/dist/src/auth/authClient.js +62 -2
  4. package/dist/src/auth/authClient.js.map +1 -1
  5. package/dist/src/auth/loginFlow.js +5 -2
  6. package/dist/src/auth/loginFlow.js.map +1 -1
  7. package/dist/src/auth/loopbackServer.d.ts +2 -1
  8. package/dist/src/auth/loopbackServer.js +6 -3
  9. package/dist/src/auth/loopbackServer.js.map +1 -1
  10. package/dist/src/commands/accountCommand.js +10 -4
  11. package/dist/src/commands/accountCommand.js.map +1 -1
  12. package/dist/src/commands/configCommand.d.ts +5 -0
  13. package/dist/src/commands/configCommand.js +15 -2
  14. package/dist/src/commands/configCommand.js.map +1 -1
  15. package/dist/src/commands/execCommand.d.ts +6 -0
  16. package/dist/src/commands/execCommand.js +61 -9
  17. package/dist/src/commands/execCommand.js.map +1 -1
  18. package/dist/src/commands/loginCommand.js +9 -6
  19. package/dist/src/commands/loginCommand.js.map +1 -1
  20. package/dist/src/commands/mediaCommand.js +3 -2
  21. package/dist/src/commands/mediaCommand.js.map +1 -1
  22. package/dist/src/commands/skillCommand.d.ts +30 -0
  23. package/dist/src/commands/skillCommand.js +160 -0
  24. package/dist/src/commands/skillCommand.js.map +1 -0
  25. package/dist/src/config/configFile.d.ts +12 -0
  26. package/dist/src/config/configFile.js +12 -0
  27. package/dist/src/config/configFile.js.map +1 -1
  28. package/dist/src/config/env.d.ts +18 -0
  29. package/dist/src/config/env.js +57 -7
  30. package/dist/src/config/env.js.map +1 -1
  31. package/dist/src/core/catalog.d.ts +8 -1
  32. package/dist/src/core/catalog.js +13 -2
  33. package/dist/src/core/catalog.js.map +1 -1
  34. package/dist/src/core/contextPrune.d.ts +13 -0
  35. package/dist/src/core/contextPrune.js +61 -0
  36. package/dist/src/core/contextPrune.js.map +1 -0
  37. package/dist/src/core/httpChatBackend.js +22 -5
  38. package/dist/src/core/httpChatBackend.js.map +1 -1
  39. package/dist/src/core/runChat.d.ts +9 -5
  40. package/dist/src/core/runChat.js +10 -7
  41. package/dist/src/core/runChat.js.map +1 -1
  42. package/dist/src/core/session.d.ts +11 -0
  43. package/dist/src/core/session.js +20 -1
  44. package/dist/src/core/session.js.map +1 -1
  45. package/dist/src/core/toolRegistry.d.ts +14 -3
  46. package/dist/src/core/toolRegistry.js +24 -15
  47. package/dist/src/core/toolRegistry.js.map +1 -1
  48. package/dist/src/core/turnLoop.d.ts +4 -0
  49. package/dist/src/core/turnLoop.js +54 -13
  50. package/dist/src/core/turnLoop.js.map +1 -1
  51. package/dist/src/core/types.d.ts +6 -0
  52. package/dist/src/core/updateCheck.d.ts +46 -0
  53. package/dist/src/core/updateCheck.js +139 -0
  54. package/dist/src/core/updateCheck.js.map +1 -0
  55. package/dist/src/exec/media.d.ts +32 -0
  56. package/dist/src/exec/media.js +70 -0
  57. package/dist/src/exec/media.js.map +1 -0
  58. package/dist/src/exec/output.d.ts +16 -0
  59. package/dist/src/exec/output.js +41 -0
  60. package/dist/src/exec/output.js.map +1 -1
  61. package/dist/src/fs/globTool.d.ts +8 -0
  62. package/dist/src/fs/globTool.js +117 -0
  63. package/dist/src/fs/globTool.js.map +1 -0
  64. package/dist/src/fs/grepTool.d.ts +4 -0
  65. package/dist/src/fs/grepTool.js +146 -0
  66. package/dist/src/fs/grepTool.js.map +1 -0
  67. package/dist/src/fs/index.d.ts +8 -0
  68. package/dist/src/fs/index.js +13 -0
  69. package/dist/src/fs/index.js.map +1 -0
  70. package/dist/src/fs/limits.d.ts +34 -0
  71. package/dist/src/fs/limits.js +74 -0
  72. package/dist/src/fs/limits.js.map +1 -0
  73. package/dist/src/fs/listDirTool.d.ts +2 -0
  74. package/dist/src/fs/listDirTool.js +68 -0
  75. package/dist/src/fs/listDirTool.js.map +1 -0
  76. package/dist/src/fs/readFileTool.d.ts +2 -0
  77. package/dist/src/fs/readFileTool.js +102 -0
  78. package/dist/src/fs/readFileTool.js.map +1 -0
  79. package/dist/src/fs/walk.d.ts +11 -0
  80. package/dist/src/fs/walk.js +38 -0
  81. package/dist/src/fs/walk.js.map +1 -0
  82. package/dist/src/fs/workspaceGuard.d.ts +27 -0
  83. package/dist/src/fs/workspaceGuard.js +96 -0
  84. package/dist/src/fs/workspaceGuard.js.map +1 -0
  85. package/dist/src/index.js +47 -3
  86. package/dist/src/index.js.map +1 -1
  87. package/dist/src/mcp/mediaTools.d.ts +63 -0
  88. package/dist/src/mcp/mediaTools.js +385 -0
  89. package/dist/src/mcp/mediaTools.js.map +1 -0
  90. package/dist/src/mcp/server.d.ts +6 -2
  91. package/dist/src/mcp/server.js +19 -9
  92. package/dist/src/mcp/server.js.map +1 -1
  93. package/dist/src/media/aiApiClient.d.ts +5 -0
  94. package/dist/src/media/aiApiClient.js +12 -1
  95. package/dist/src/media/aiApiClient.js.map +1 -1
  96. package/dist/src/media/budget.d.ts +42 -0
  97. package/dist/src/media/budget.js +95 -0
  98. package/dist/src/media/budget.js.map +1 -0
  99. package/dist/src/media/executor.d.ts +9 -0
  100. package/dist/src/media/executor.js +1 -1
  101. package/dist/src/media/executor.js.map +1 -1
  102. package/dist/src/media/generateImageTool.d.ts +8 -2
  103. package/dist/src/media/generateImageTool.js +51 -3
  104. package/dist/src/media/generateImageTool.js.map +1 -1
  105. package/dist/src/media/promptSanitizer.d.ts +11 -0
  106. package/dist/src/media/promptSanitizer.js +33 -0
  107. package/dist/src/media/promptSanitizer.js.map +1 -0
  108. package/dist/src/media/taskManager.d.ts +8 -1
  109. package/dist/src/media/taskManager.js +1 -1
  110. package/dist/src/media/taskManager.js.map +1 -1
  111. package/dist/src/tui/App.js +30 -21
  112. package/dist/src/tui/App.js.map +1 -1
  113. package/dist/src/tui/ParamEditor.d.ts +11 -2
  114. package/dist/src/tui/ParamEditor.js +17 -6
  115. package/dist/src/tui/ParamEditor.js.map +1 -1
  116. package/dist/src/tui/atPopup.d.ts +8 -0
  117. package/dist/src/tui/atPopup.js +1 -1
  118. package/dist/src/tui/atPopup.js.map +1 -1
  119. package/dist/src/tui/chatController.d.ts +58 -2
  120. package/dist/src/tui/chatController.js +231 -40
  121. package/dist/src/tui/chatController.js.map +1 -1
  122. package/dist/src/tui/models.d.ts +6 -0
  123. package/dist/src/tui/models.js +14 -6
  124. package/dist/src/tui/models.js.map +1 -1
  125. package/dist/src/tui/run.js +50 -16
  126. package/dist/src/tui/run.js.map +1 -1
  127. package/dist/src/util/brokenPipe.d.ts +10 -0
  128. package/dist/src/util/brokenPipe.js +19 -0
  129. package/dist/src/util/brokenPipe.js.map +1 -0
  130. package/package.json +3 -2
  131. package/skills/globalgpt/SKILL.md +94 -0
  132. package/skills/globalgpt/references/troubleshooting.md +34 -0
  133. package/skills/globalgpt-coding/SKILL.md +65 -0
  134. package/skills/globalgpt-coding/references/troubleshooting.md +34 -0
  135. package/skills/globalgpt-image/SKILL.md +109 -0
  136. package/skills/globalgpt-image/references/recipes.md +52 -0
  137. package/skills/globalgpt-image/references/troubleshooting.md +49 -0
  138. package/skills/globalgpt-video/SKILL.md +109 -0
  139. package/skills/globalgpt-video/references/recipes.md +50 -0
  140. package/skills/globalgpt-video/references/troubleshooting.md +49 -0
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/tui/models.ts"],"names":[],"mappings":"AAcA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,4FAA4F;IAC5F,+DAA+D;IAC/D,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,kCAAkC,EAAE;IAChE,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,kCAAkC,EAAE;IACjE,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,0BAA0B,EAAE;CAC3D,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;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AC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,mGAAmG;IACnG,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAC3B,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,CAC/E,CAAC;IACF,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC/G,MAAM,IAAI,KAAK,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAE,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -3,7 +3,7 @@ import { render } from 'ink';
3
3
  import { App } from './App.js';
4
4
  import { sessionsDir } from '../config/paths.js';
5
5
  import { ChatController } from './chatController.js';
6
- import { AuthClient } from '../auth/authClient.js';
6
+ import { AuthClient, describeCredits } from '../auth/authClient.js';
7
7
  import { getDefaultChatModel } from './models.js';
8
8
  import { Session } from '../core/session.js';
9
9
  import { newId } from '../core/id.js';
@@ -18,13 +18,16 @@ import { GenerationExecutor } from '../media/executor.js';
18
18
  import { TaskManager } from '../media/taskManager.js';
19
19
  import { TaskLedger } from '../media/taskLedger.js';
20
20
  import { ConfirmationBridge, TuiConfirmer } from './confirmationBridge.js';
21
+ import { maybeCheckForUpdate } from '../core/updateCheck.js';
22
+ import { VERSION } from '../version.js';
21
23
  import { createInputHistory } from './inputHistory.js';
22
24
  import { resolveToken } from '../auth/token.js';
23
25
  import { CredentialStore } from '../auth/credentialStore.js';
24
26
  import { browserLogin } from '../auth/loginFlow.js';
25
27
  import { openBrowser } from '../util/openBrowser.js';
26
- import { apiBaseUrl, webBaseUrl, lang } from '../config/env.js';
28
+ import { apiBaseUrl, webBaseUrl, lang, apiBaseUrlOverride, baseUrlOverrideWarnings } from '../config/env.js';
27
29
  import { ensureCatalog } from '../core/catalog.js';
30
+ import { createFsTools, workspaceRoot } from '../fs/index.js';
28
31
  import path from 'node:path';
29
32
  /**
30
33
  * Wire the chat engine to the Ink TUI and render it.
@@ -60,6 +63,11 @@ export async function runTui(options = {}) {
60
63
  const confirmationBridge = new ConfirmationBridge();
61
64
  let taskManager;
62
65
  const registry = new ToolRegistry();
66
+ // fs read tools: available to every session (no token needed — they run locally),
67
+ // but only OFFERED to models the catalog marks tool_use (gated registration).
68
+ const wsRoot = await workspaceRoot();
69
+ for (const t of createFsTools(wsRoot))
70
+ registry.register(t, { gated: true });
63
71
  const extras = {};
64
72
  let controllerRef; // assigned after construction; tools resolve refs lazily
65
73
  if (!options.imageTool && token) {
@@ -70,8 +78,9 @@ export async function runTui(options = {}) {
70
78
  // The tools are built before the controller, so reference resolution reads it lazily.
71
79
  const resolveReference = (ref) => controllerRef?.resolveMediaReference(ref);
72
80
  const pendingReferences = () => controllerRef?.getPendingReferenceImages() ?? [];
73
- const imageTool = createGenerateImageTool({ executor, taskManager, ledger, resolveReference, pendingReferences });
74
- const videoTool = createGenerateVideoTool({ executor, taskManager, ledger, resolveReference, pendingReferences });
81
+ const knownMediaRefs = () => controllerRef?.getKnownMediaRefs() ?? [];
82
+ const imageTool = createGenerateImageTool({ executor, taskManager, ledger, resolveReference, pendingReferences, knownMediaRefs });
83
+ const videoTool = createGenerateVideoTool({ executor, taskManager, ledger, resolveReference, pendingReferences, knownMediaRefs });
75
84
  registry.register(imageTool);
76
85
  registry.register(videoTool);
77
86
  // Slash commands run the same tool instances the model uses (same confirm/ledger/polling path).
@@ -79,26 +88,28 @@ export async function runTui(options = {}) {
79
88
  extras.listRecentTasks = () => ledger.list(10);
80
89
  extras.fetchAccountLine = async () => {
81
90
  const info = await new AuthClient({ baseUrl: apiBaseUrl() }).userInfo(currentToken);
82
- const bits = [info.plan && `plan: ${info.plan}`, info.balance !== undefined && `balance: ${info.balance}`];
91
+ const bits = [info.plan && `plan: ${info.plan}`, describeCredits(info) && `balance: ${describeCredits(info)}`];
83
92
  return bits.filter(Boolean).join(' · ') || null;
84
93
  };
85
94
  extras.fetchAccount = async () => {
86
95
  const info = await new AuthClient({ baseUrl: apiBaseUrl() }).userInfo(currentToken);
87
96
  const lines = [`account: ${info.email ?? '(unknown)'}`];
88
97
  if (info.plan)
89
- lines.push(`plan: ${info.plan}`);
90
- if (info.balance !== undefined)
91
- lines.push(`balance: ${info.balance} credits`);
98
+ lines.push(`plan: ${info.plan}${info.planEndDate ? ` (through ${info.planEndDate})` : ''}`);
99
+ const balance = describeCredits(info);
100
+ if (balance)
101
+ lines.push(`balance: ${balance}`);
102
+ if (info.totalCredits !== undefined && info.totalCredits <= 0) {
103
+ lines.push(info.plan
104
+ ? 'Top up at glbgpt.com if you need credits before they reset.'
105
+ : 'Top up or subscribe at glbgpt.com to start generating.');
106
+ }
92
107
  return lines.join('\n');
93
108
  };
94
109
  extras.fetchTransactions = async () => {
95
110
  const bills = await new AuthClient({ baseUrl: apiBaseUrl() }).bills(currentToken, 1, 10);
96
- if (bills.length === 0)
97
- return 'No transactions yet.';
98
111
  // cost is USD; show credits (1 credit ≈ $0.001) to match the generation estimates.
99
- return bills
100
- .map((b) => `${(b.createdAt ?? '').padEnd(20)} ${String(Math.round(b.cost * 1000)).padStart(6)} cr ${b.model}`)
101
- .join('\n');
112
+ return bills.map((b) => ({ createdAt: b.createdAt ?? '', credits: Math.round(b.cost * 1000), model: b.model }));
102
113
  };
103
114
  }
104
115
  else {
@@ -116,9 +127,13 @@ export async function runTui(options = {}) {
116
127
  credentialStore: cs,
117
128
  // No concurrent paste inside the TUI (Ink owns stdin) — the loopback path only. A remote
118
129
  // TUI user should exit and run `glbgpt login --code`; we surface that URL too.
119
- openUrl: ({ loopbackUrl, codeUrl }) => {
120
- controller.note(`Open this URL to authorize (only if you started this login yourself):\n ${loopbackUrl}\n` +
121
- `On a remote machine? Exit and run \`glbgpt login --code\`, or authorize at:\n ${codeUrl}`);
130
+ openUrl: ({ loopbackUrl }) => {
131
+ // no-browser mode never launches anything, so the URL is the primary path
132
+ // there — "if it didn't open" would be nonsense.
133
+ const lead = mode === 'browser'
134
+ ? `Authorize in the browser (only if you started this login yourself).\nIf it didn't open, visit:`
135
+ : `Open this URL in a browser to authorize (only if you started this login yourself):`;
136
+ controller.note(`${lead}\n ${loopbackUrl}\n(On a remote machine? Exit and run \`glbgpt login --code\`.)`);
122
137
  if (mode === 'browser')
123
138
  openBrowser(loopbackUrl);
124
139
  },
@@ -143,6 +158,19 @@ export async function runTui(options = {}) {
143
158
  const turnLoop = new TurnLoop(backend, registry);
144
159
  const controller = new ChatController(session, turnLoop, extras);
145
160
  controllerRef = controller;
161
+ extras.baseUrlOverride = apiBaseUrlOverride;
162
+ // Advise-only update check: cache-only for this start (never blocks; the
163
+ // background refresh lands by the next one). Failures stay silent.
164
+ let updateNotice = null;
165
+ extras.updateNotice = () => updateNotice;
166
+ void maybeCheckForUpdate()
167
+ .then((notice) => {
168
+ if (notice) {
169
+ updateNotice = notice;
170
+ controller.note(`Update available: ${VERSION} → ${notice.latest} — run ${notice.command}`);
171
+ }
172
+ })
173
+ .catch(() => { });
146
174
  const store = new SessionStore(sessionsDir());
147
175
  if (taskManager) {
148
176
  taskManager.subscribe((e) => {
@@ -161,6 +189,12 @@ export async function runTui(options = {}) {
161
189
  // Resuming: show the prior conversation in the timeline.
162
190
  controller.hydrateFromSession(options.timeline);
163
191
  }
192
+ // Non-default base URLs are surfaced loudly (Codex-style): ordinary users never change
193
+ // them, so an override is either us testing or someone redirecting the CLI's traffic.
194
+ // MUST come after hydrateFromSession — hydrating REPLACES the timeline, and the resume
195
+ // path silently swallowing this warning is exactly the failure it exists to prevent.
196
+ for (const warning of baseUrlOverrideWarnings())
197
+ controller.warn(warning);
164
198
  // Persist the current session after each turn so `resume` has data (/new swaps to a new session).
165
199
  let wasBusy = false;
166
200
  controller.subscribe((state) => {
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/tui/run.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,WAA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C;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * EPIPE guard for the process output streams.
3
+ *
4
+ * `glbgpt exec ... | head` closes stdout as soon as head has enough lines; every
5
+ * later write raises EPIPE as a stream 'error' event, which without a listener
6
+ * crashes the process with an unhandled-error stack (observed in the 2026-07-19
7
+ * live smoke). Unix convention: a closed downstream pipe ends the program
8
+ * quietly and successfully. Any other stream error stays loud.
9
+ */
10
+ export declare function guardBrokenPipe(stream: NodeJS.WriteStream, exit?: (code: number) => never): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * EPIPE guard for the process output streams.
3
+ *
4
+ * `glbgpt exec ... | head` closes stdout as soon as head has enough lines; every
5
+ * later write raises EPIPE as a stream 'error' event, which without a listener
6
+ * crashes the process with an unhandled-error stack (observed in the 2026-07-19
7
+ * live smoke). Unix convention: a closed downstream pipe ends the program
8
+ * quietly and successfully. Any other stream error stays loud.
9
+ */
10
+ export function guardBrokenPipe(stream, exit = process.exit) {
11
+ stream.on('error', (err) => {
12
+ if (err.code === 'EPIPE') {
13
+ exit(0);
14
+ return; // reached only in tests, where `exit` is a spy that returns
15
+ }
16
+ throw err;
17
+ });
18
+ }
19
+ //# sourceMappingURL=brokenPipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brokenPipe.js","sourceRoot":"","sources":["../../../src/util/brokenPipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA0B,EAC1B,OAAgC,OAAO,CAAC,IAAI;IAE5C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;QAChD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,4DAA4D;QACtE,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glbgpt/cli",
3
- "version": "0.1.0-test.5",
3
+ "version": "0.1.0",
4
4
  "description": "GlobalGPT in your terminal — chat, image and video generation, and an exec entry point for scripts and agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "dist/src/",
12
+ "skills/",
12
13
  "README.md"
13
14
  ],
14
15
  "engines": {
@@ -42,4 +43,4 @@
42
43
  "typescript": "^5.6.0",
43
44
  "vitest": "^2.1.0"
44
45
  }
45
- }
46
+ }
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: globalgpt
3
+ description: >
4
+ The all-in-one entry to the user's GlobalGPT account via the glbgpt CLI: generate
5
+ images and videos, delegate code or text work to GlobalGPT chat models, and check
6
+ the account — balance, billing, models, and generation tasks. Use when the user
7
+ mentions GlobalGPT or glbgpt itself (their balance, spend, account, a past
8
+ generation task, or "what can GlobalGPT do"), or invokes /globalgpt. When the user
9
+ asks for a specific job in natural conversation — an image, a video, delegated
10
+ code — prefer the specialized skills instead: globalgpt-image, globalgpt-video,
11
+ globalgpt-coding.
12
+ ---
13
+
14
+ # GlobalGPT
15
+
16
+ The one entry point to everything on the user's GlobalGPT account. Invoked bare,
17
+ show what is available and the balance; invoked with a request, just do it using
18
+ the commands below.
19
+
20
+ <!-- shared:banner -->
21
+ > **Generation spends real credits.** Price a job without running it using
22
+ > `--estimate`; show the balance with `glbgpt account`.
23
+ <!-- /shared:banner -->
24
+
25
+ ## Before the first call
26
+
27
+ <!-- shared:setup -->
28
+ Run `glbgpt whoami`. If the command is not found, tell the user to install it with
29
+ `npm i -g @glbgpt/cli`. If it reports that nobody is signed in, ask the user to
30
+ run `glbgpt login` themselves — it opens a browser. Never try to authenticate for
31
+ them.
32
+ <!-- /shared:setup -->
33
+
34
+ ## When invoked bare
35
+
36
+ Run `glbgpt account` and present a short menu:
37
+
38
+ 1. **Images** — describe one and I'll generate it (`/globalgpt-image` for the full
39
+ workflow: model menu, recipes, editing).
40
+ 2. **Video** — same, minutes-long (`/globalgpt-video` for start/end frames and recipes).
41
+ 3. **Delegate code or text** to a GlobalGPT chat model (`/globalgpt-coding` for the
42
+ full flow).
43
+ 4. **Account** — balance, recent spend, past generation tasks, available models.
44
+
45
+ Then do whatever the user picks, right here, with the commands below.
46
+
47
+ ## Generate
48
+
49
+ ```bash
50
+ glbgpt image "a red fox in falling snow, cinematic lighting" # blocks until saved
51
+ glbgpt video "slow waves on a beach at sunset" --ar 16:9 # minutes; also blocks
52
+ glbgpt image "a red fox in snow" --estimate # price only
53
+ ```
54
+
55
+ Files land in `./glbgpt-output/`. Reference images go in `-i ./ref.png`
56
+ (image-to-image) or `--start-image` / `--end-image` (video) — never pasted into the
57
+ prompt text. When the user says what to make, generate with the default model —
58
+ do NOT show a model menu first; offer `glbgpt model list image|video` only when
59
+ they ask to choose. The money rules: never retry a failed generation
60
+ automatically, ask before generating more than two or three items, and never
61
+ describe a result you have not seen.
62
+
63
+ ## Delegate to a chat model
64
+
65
+ ```bash
66
+ glbgpt model list chat # pick one first
67
+ glbgpt exec "add JSDoc to every exported function" --file src/util.ts -m <model>
68
+ ```
69
+
70
+ The prompt must come before `--file`. Each call is a fresh, stateless turn.
71
+ Everything the delegate reads is sent to GlobalGPT's backend — no secrets. Review
72
+ the output yourself before applying it anywhere.
73
+
74
+ ## Account and tasks
75
+
76
+ All read-only and free:
77
+
78
+ ```bash
79
+ glbgpt account # membership + credit balance
80
+ glbgpt account transactions # recent spend (authoritative billing)
81
+ glbgpt task list # recent generation tasks
82
+ glbgpt task show last # one task's status
83
+ glbgpt task download last # fetch a finished result
84
+ glbgpt model list # everything available on this account
85
+ ```
86
+
87
+ ## When something fails
88
+
89
+ Read the error — the CLI says what went wrong (not signed in, not enough credits, a
90
+ parameter the model rejects). A genuine generation failure is not charged. Never
91
+ retry blindly; report and let the user decide. Common cases:
92
+ [references/troubleshooting.md](references/troubleshooting.md). For deeper
93
+ workflows, hand over to the specialized skill: `/globalgpt-image`,
94
+ `/globalgpt-video`, `/globalgpt-coding`.
@@ -0,0 +1,34 @@
1
+ # Troubleshooting
2
+
3
+ <!-- shared:login -->
4
+ ## "Not signed in"
5
+
6
+ The user must run `glbgpt login` themselves — it opens a browser. On a headless box
7
+ or over SSH, `glbgpt login --code` prints a URL instead: the user opens it on any
8
+ machine with a browser, authorizes there, and pastes the code the page shows back
9
+ into the terminal. Do not
10
+ attempt to authenticate for them.
11
+ <!-- /shared:login -->
12
+
13
+ ## Not enough credits, or a plan restriction
14
+
15
+ The command reports a payment problem instead of generating. Show the user
16
+ `glbgpt account` (balance and membership) and stop — do not retry, and do not try a
17
+ different model hoping it is cheaper unless the user asks.
18
+
19
+ ## "Unknown model"
20
+
21
+ The catalog is server-driven. Run `glbgpt model list` (optionally `chat`, `image`,
22
+ or `video`) and use a name it prints.
23
+
24
+ ## A generation failed or seems stuck
25
+
26
+ A genuine failure is not charged — the CLI says so when it reports one. A video
27
+ that seems to hang is usually still generating (minutes are normal); if the process
28
+ was interrupted, `glbgpt task list` finds the task and `glbgpt task download <id>`
29
+ fetches the result once ready. Never retry automatically.
30
+
31
+ ## Anything deeper
32
+
33
+ Hand over to the specialized skill: `/globalgpt-image`, `/globalgpt-video`, or
34
+ `/globalgpt-coding` — each carries its own detailed troubleshooting.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: globalgpt-coding
3
+ description: >
4
+ Delegates code-writing subtasks to a GlobalGPT chat model the user picks, via the
5
+ glbgpt CLI — useful for offloading boilerplate, getting a second model's take, or
6
+ working while other model quotas are tight. Use ONLY when the user invokes
7
+ /globalgpt-coding or explicitly asks to have a GlobalGPT model do the work.
8
+ Never volunteer it: for ordinary coding, debugging, refactoring, or review
9
+ requests, do the work yourself and do not mention this skill. NOT for images or
10
+ videos — use globalgpt-image or globalgpt-video.
11
+ ---
12
+
13
+ # GlobalGPT coding delegation
14
+
15
+ Hand a code-writing subtask to a GlobalGPT chat model of the user's choice. You
16
+ stay the engineer: you frame the task, review what comes back, and apply it to
17
+ files yourself — the delegate only produces text.
18
+
19
+ > **Costs and privacy.** Delegated work bills the user's GlobalGPT account per
20
+ > token, and everything the delegate reads — the prompt, attached files, and any
21
+ > repository files it opens itself — is sent to GlobalGPT's backend. Do not
22
+ > delegate work involving secrets, credentials, or code the user would not send
23
+ > to a third-party service.
24
+
25
+ <!-- shared:setup -->
26
+ Run `glbgpt whoami`. If the command is not found, tell the user to install it with
27
+ `npm i -g @glbgpt/cli`. If it reports that nobody is signed in, ask the user to
28
+ run `glbgpt login` themselves — it opens a browser. Never try to authenticate for
29
+ them.
30
+ <!-- /shared:setup -->
31
+
32
+ ## Flow
33
+
34
+ 1. Run `glbgpt model list chat` and show the models as a menu — use your host's native option picker if it has one, else a numbered list. Let the
35
+ user pick; there is no default here — the choice is the point of this skill.
36
+ 2. Frame ONE well-scoped task. The prompt comes first, then flags:
37
+
38
+ ```bash
39
+ glbgpt exec "add JSDoc comments to every exported function in this file" \
40
+ --file src/utils/date.ts -m <model>
41
+ ```
42
+
43
+ 3. Tool-capable models can also explore the repository themselves — inside
44
+ `glbgpt exec` they have read-only file tools (list, read, glob, grep) jailed
45
+ to the current directory — so for multi-file context you can describe the
46
+ task and let the delegate read what it needs instead of attaching everything.
47
+ 4. Review the returned code yourself, then apply it to files. The delegate never
48
+ writes files; correctness stays your responsibility.
49
+
50
+ ## Footguns
51
+
52
+ - **Each `glbgpt exec` call is a fresh, stateless turn.** Iterating means
53
+ re-sending the context (or re-attaching files) — there is no conversation to
54
+ continue.
55
+ - **The prompt must come before `--file`.** `--file` takes one or more paths and
56
+ swallows everything after it; a prompt placed after it reads as a file path
57
+ and the command fails with "No prompt provided".
58
+ - **Scope one task per call.** "Fix this function" works; "refactor the app"
59
+ produces unreviewable output.
60
+ - Costs scale with what the delegate reads. Attach or point at the files that
61
+ matter, not the whole tree.
62
+
63
+ ## When something fails
64
+
65
+ See [references/troubleshooting.md](references/troubleshooting.md).
@@ -0,0 +1,34 @@
1
+ # Troubleshooting
2
+
3
+ <!-- shared:login -->
4
+ ## "Not signed in"
5
+
6
+ The user must run `glbgpt login` themselves — it opens a browser. On a headless box
7
+ or over SSH, `glbgpt login --code` prints a URL instead: the user opens it on any
8
+ machine with a browser, authorizes there, and pastes the code the page shows back
9
+ into the terminal. Do not
10
+ attempt to authenticate for them.
11
+ <!-- /shared:login -->
12
+
13
+ ## "No prompt provided"
14
+
15
+ `--file` takes one or more paths (`--file <path...>`) and keeps eating positionals
16
+ until it hits a flag, so a prompt written after it is swallowed as another file path.
17
+ Put the prompt first: `glbgpt exec "summarise the decisions" --file notes.md`, not
18
+ `glbgpt exec --file notes.md "summarise the decisions"`.
19
+
20
+ ## Not enough credits, or a plan restriction
21
+
22
+ The command reports a payment problem instead of running the delegation. Show the
23
+ user `glbgpt account` (balance and membership) and stop — do not retry, and do not
24
+ try a different model hoping it is cheaper unless the user asks.
25
+
26
+ ## "Unknown model"
27
+
28
+ The catalog is server-driven and the name you used no longer exists (or never did).
29
+ Run `glbgpt model list chat` and use a name it prints.
30
+
31
+ ## The delegate's code does not compile
32
+
33
+ The delegate cannot run your build. Treat its output as a draft: fix or re-delegate
34
+ with the error text attached (`--file` the build log, prompt first).
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: globalgpt-image
3
+ description: >
4
+ Generates and edits images through the user's GlobalGPT account via the glbgpt CLI.
5
+ Use when the user wants to create, generate, edit, restyle, or touch up an image,
6
+ picture, photo, logo, illustration, poster, thumbnail, banner, or icon — including
7
+ image-to-image edits that build on a reference image. NOT for video, animation, or
8
+ animating a still image — use globalgpt-video for those. NOT for delegating code
9
+ work to a GlobalGPT model — that is globalgpt-coding, which the user invokes
10
+ explicitly.
11
+ ---
12
+
13
+ # GlobalGPT image generation
14
+
15
+ Generate images through the user's GlobalGPT account with the `glbgpt` CLI.
16
+
17
+ <!-- shared:banner -->
18
+ > **Generation spends real credits.** Price a job without running it using
19
+ > `--estimate`; show the balance with `glbgpt account`.
20
+ <!-- /shared:banner -->
21
+
22
+ ## Before the first call
23
+
24
+ <!-- shared:setup -->
25
+ Run `glbgpt whoami`. If the command is not found, tell the user to install it with
26
+ `npm i -g @glbgpt/cli`. If it reports that nobody is signed in, ask the user to
27
+ run `glbgpt login` themselves — it opens a browser. Never try to authenticate for
28
+ them.
29
+ <!-- /shared:setup -->
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ glbgpt image "a red fox in falling snow, cinematic lighting" # blocks until saved
35
+ glbgpt image "a red fox in snow" --estimate # price only, generates nothing
36
+ ```
37
+
38
+ The first line prints the saved path once it finishes. Files land in
39
+ `./glbgpt-output/` unless `-o <dir>` says otherwise.
40
+
41
+ ## When invoked directly
42
+
43
+ If the user ran /globalgpt-image without saying what to make, run
44
+ `glbgpt model list image` and show the models as a menu — use your host's native option picker if it has one, else a numbered list — adding:
45
+ "pick one, or just tell me what to make and I'll use the default." Generate with
46
+ `-m <model>` when they pick. When this skill triggers from ordinary conversation
47
+ instead, skip the menu: use the default model and only ask something when the
48
+ subject itself is unclear.
49
+
50
+ ## Before you spend
51
+
52
+ A generation you have to redo costs the full price again, so know what to generate
53
+ before you run the command — without interrogating the user:
54
+
55
+ - **Subject unclear or missing** ("make me an image"): ask what it should show — one
56
+ short question, not a menu of options.
57
+ - **Two plausible readings**: say how you read it and confirm before generating.
58
+ A word that does not parse cleanly, a likely typo, or anything you had to
59
+ reinterpret to make sense of COUNTS as two readings — even if one reading feels
60
+ obvious to you. Guessing and offering to redo doubles the cost of being wrong.
61
+ - **Subject clear**: go. Style, aspect ratio and model all have sensible defaults —
62
+ do not ask about them unless the user seems to care.
63
+ - Never ask more than one question per turn.
64
+
65
+ ## Choosing a model
66
+
67
+ Run `glbgpt model list image` and choose from what it prints. `glbgpt model show
68
+ <model>` gives one model's parameters and limits, including which aspect ratios and
69
+ resolutions it accepts.
70
+
71
+ The catalog is served from the account and changes over time, so treat a model name
72
+ you remember as a guess: list first. Omit `-m/--model` entirely unless the user asked
73
+ for a specific model — the default is chosen for general use.
74
+
75
+ ## Footguns
76
+
77
+ These are the mistakes that cost money or silently produce the wrong thing.
78
+
79
+ - **Reference images belong in a flag, never in the prompt.** Use `-i ./ref.png` for
80
+ image-to-image. A path or URL written into the prompt text reaches the media model
81
+ as literal words; it cannot fetch anything.
82
+ - **Do not describe a result you have not seen.** Never tell the user what the image
83
+ looks like, its resolution, or any detail you have not verified in the file itself.
84
+ Most settings came from the model's own defaults, not from you.
85
+ - **Do not build a polling loop.** `glbgpt image` generation blocks until the file is
86
+ saved. Reach for `--detach` only when you deliberately want several generations
87
+ running at once, then collect them with `glbgpt task wait <id>` and
88
+ `glbgpt task download <id>`.
89
+ - **Never retry a failed generation automatically.** A genuine failure is not charged,
90
+ but a generation that timed out or was interrupted may still be running on the server
91
+ and will be charged — retrying pays twice for the same thing. Report the failure and
92
+ let the user decide.
93
+ - **Ask before batches.** More than two or three generations is real money. Confirm
94
+ the plan with the user first.
95
+ - **Set only the parameters the user asked for.** Every flag you leave out falls back
96
+ to a default tuned for that model; invented values make results worse and can cost
97
+ more.
98
+
99
+ ## Common jobs
100
+
101
+ Ready-made command lines for thumbnails, product shots, and image edits:
102
+ [references/recipes.md](references/recipes.md).
103
+
104
+ ## When something fails
105
+
106
+ Read the error text — the CLI says what went wrong (not signed in, not enough
107
+ credits, a parameter the chosen model does not support). Fix the cause or report it
108
+ to the user; never retry blindly. Common failures and what they mean:
109
+ [references/troubleshooting.md](references/troubleshooting.md).
@@ -0,0 +1,52 @@
1
+ # Recipes
2
+
3
+ Intent → command. Check `glbgpt model list image` for what is available before
4
+ picking a model; these recipes deliberately leave `-m` off so the default applies.
5
+
6
+ ## Images
7
+
8
+ **Square social image**
9
+ ```bash
10
+ glbgpt image "<subject>, <style>" --ar 1:1
11
+ ```
12
+
13
+ **Wide thumbnail or cover**
14
+ ```bash
15
+ glbgpt image "<subject>, bold composition, high contrast" --ar 16:9
16
+ ```
17
+
18
+ **Product shot on a clean background**
19
+ ```bash
20
+ glbgpt image "<product>, studio lighting, plain white background, product photography" --ar 1:1 --res 2K
21
+ ```
22
+
23
+ **Edit or restyle an existing image**
24
+ ```bash
25
+ glbgpt image "<what to change>" -i ./original.png
26
+ ```
27
+
28
+ **Avoid something specific**
29
+ ```bash
30
+ glbgpt image "<subject>" --negative-prompt "text, watermark, extra fingers"
31
+ ```
32
+
33
+ **Reproducible output** — reuse a seed the user gives you:
34
+ ```bash
35
+ glbgpt image "<subject>" --seed 12345
36
+ ```
37
+
38
+ ## Pricing a job first
39
+
40
+ ```bash
41
+ glbgpt image "<subject>" --estimate # prints the price, generates nothing
42
+ ```
43
+
44
+ ## Several at once
45
+
46
+ Only when the user has agreed to the batch:
47
+ ```bash
48
+ glbgpt image "<a>" --detach # prints a task id immediately
49
+ glbgpt image "<b>" --detach
50
+ glbgpt task list # ids and status
51
+ glbgpt task download <id> # fetch a finished result
52
+ ```