gaunt-sloth 0.0.1 → 2.0.0-alpha.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 (271) hide show
  1. package/.gsloth.pr-discovery.md +23 -0
  2. package/README.md +48 -3
  3. package/cli.js +23 -0
  4. package/dist/builtInToolsConfig.d.ts +1 -0
  5. package/dist/builtInToolsConfig.js +2 -0
  6. package/dist/builtInToolsConfig.js.map +1 -0
  7. package/dist/cli.d.ts +1 -0
  8. package/dist/cli.js +70 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands/apiCommand.d.ts +3 -0
  11. package/dist/commands/apiCommand.js +25 -0
  12. package/dist/commands/apiCommand.js.map +1 -0
  13. package/dist/commands/askCommand.d.ts +32 -0
  14. package/dist/commands/askCommand.js +73 -0
  15. package/dist/commands/askCommand.js.map +1 -0
  16. package/dist/commands/chatCommand.d.ts +3 -0
  17. package/dist/commands/chatCommand.js +20 -0
  18. package/dist/commands/chatCommand.js.map +1 -0
  19. package/dist/commands/codeCommand.d.ts +3 -0
  20. package/dist/commands/codeCommand.js +23 -0
  21. package/dist/commands/codeCommand.js.map +1 -0
  22. package/dist/commands/commandIntrospection.d.ts +12 -0
  23. package/dist/commands/commandIntrospection.js +70 -0
  24. package/dist/commands/commandIntrospection.js.map +1 -0
  25. package/dist/commands/commandUtils.d.ts +23 -0
  26. package/dist/commands/commandUtils.js +49 -0
  27. package/dist/commands/commandUtils.js.map +1 -0
  28. package/dist/commands/configSetup.d.ts +7 -0
  29. package/dist/commands/configSetup.js +63 -0
  30. package/dist/commands/configSetup.js.map +1 -0
  31. package/dist/commands/execCommand.d.ts +47 -0
  32. package/dist/commands/execCommand.js +110 -0
  33. package/dist/commands/execCommand.js.map +1 -0
  34. package/dist/commands/firstRunDialog.d.ts +66 -0
  35. package/dist/commands/firstRunDialog.js +208 -0
  36. package/dist/commands/firstRunDialog.js.map +1 -0
  37. package/dist/commands/getCommand.d.ts +3 -0
  38. package/dist/commands/getCommand.js +45 -0
  39. package/dist/commands/getCommand.js.map +1 -0
  40. package/dist/commands/initCommand.d.ts +12 -0
  41. package/dist/commands/initCommand.js +29 -0
  42. package/dist/commands/initCommand.js.map +1 -0
  43. package/dist/commands/prCommand.d.ts +3 -0
  44. package/dist/commands/prCommand.js +110 -0
  45. package/dist/commands/prCommand.js.map +1 -0
  46. package/dist/commands/prDiscovery.d.ts +54 -0
  47. package/dist/commands/prDiscovery.js +451 -0
  48. package/dist/commands/prDiscovery.js.map +1 -0
  49. package/dist/commands/reviewCommand.d.ts +3 -0
  50. package/dist/commands/reviewCommand.js +51 -0
  51. package/dist/commands/reviewCommand.js.map +1 -0
  52. package/dist/config.d.ts +1 -0
  53. package/dist/config.js +2 -0
  54. package/dist/config.js.map +1 -0
  55. package/dist/constants.d.ts +1 -0
  56. package/dist/constants.js +2 -0
  57. package/dist/constants.js.map +1 -0
  58. package/dist/core/GthAgentRunner.d.ts +1 -0
  59. package/dist/core/GthAgentRunner.js +2 -0
  60. package/dist/core/GthAgentRunner.js.map +1 -0
  61. package/dist/core/GthLangChainAgent.d.ts +1 -0
  62. package/dist/core/GthLangChainAgent.js +2 -0
  63. package/dist/core/GthLangChainAgent.js.map +1 -0
  64. package/dist/core/types.d.ts +1 -0
  65. package/dist/core/types.js +2 -0
  66. package/dist/core/types.js.map +1 -0
  67. package/dist/helpers/jira/jiraClient.d.ts +1 -0
  68. package/dist/helpers/jira/jiraClient.js +2 -0
  69. package/dist/helpers/jira/jiraClient.js.map +1 -0
  70. package/dist/helpers/jira/jiraLogWork.d.ts +2 -0
  71. package/dist/helpers/jira/jiraLogWork.js +53 -0
  72. package/dist/helpers/jira/jiraLogWork.js.map +1 -0
  73. package/dist/mcp/OAuthClientProviderImpl.d.ts +1 -0
  74. package/dist/mcp/OAuthClientProviderImpl.js +2 -0
  75. package/dist/mcp/OAuthClientProviderImpl.js.map +1 -0
  76. package/dist/middleware/binaryContentInjectionMiddleware.d.ts +1 -0
  77. package/dist/middleware/binaryContentInjectionMiddleware.js +2 -0
  78. package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -0
  79. package/dist/middleware/registry.d.ts +1 -0
  80. package/dist/middleware/registry.js +2 -0
  81. package/dist/middleware/registry.js.map +1 -0
  82. package/dist/middleware/reviewRateMiddleware.d.ts +1 -0
  83. package/dist/middleware/reviewRateMiddleware.js +2 -0
  84. package/dist/middleware/reviewRateMiddleware.js.map +1 -0
  85. package/dist/middleware/types.d.ts +1 -0
  86. package/dist/middleware/types.js +2 -0
  87. package/dist/middleware/types.js.map +1 -0
  88. package/dist/modules/a2a/A2AClientWrapper.d.ts +1 -0
  89. package/dist/modules/a2a/A2AClientWrapper.js +2 -0
  90. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -0
  91. package/dist/modules/apiAgUiModule.d.ts +1 -0
  92. package/dist/modules/apiAgUiModule.js +2 -0
  93. package/dist/modules/apiAgUiModule.js.map +1 -0
  94. package/dist/modules/interactiveSessionModule.d.ts +1 -0
  95. package/dist/modules/interactiveSessionModule.js +2 -0
  96. package/dist/modules/interactiveSessionModule.js.map +1 -0
  97. package/dist/modules/reviewModule.d.ts +1 -0
  98. package/dist/modules/reviewModule.js +2 -0
  99. package/dist/modules/reviewModule.js.map +1 -0
  100. package/dist/modules/startSession.d.ts +13 -0
  101. package/dist/modules/startSession.js +70 -0
  102. package/dist/modules/startSession.js.map +1 -0
  103. package/dist/modules/types.d.ts +1 -0
  104. package/dist/modules/types.js +2 -0
  105. package/dist/modules/types.js.map +1 -0
  106. package/dist/presets/anthropic.d.ts +1 -0
  107. package/dist/presets/anthropic.js +2 -0
  108. package/dist/presets/anthropic.js.map +1 -0
  109. package/dist/presets/deepseek.d.ts +1 -0
  110. package/dist/presets/deepseek.js +2 -0
  111. package/dist/presets/deepseek.js.map +1 -0
  112. package/dist/presets/fake.d.ts +1 -0
  113. package/dist/presets/fake.js +2 -0
  114. package/dist/presets/fake.js.map +1 -0
  115. package/dist/presets/google-genai.d.ts +1 -0
  116. package/dist/presets/google-genai.js +2 -0
  117. package/dist/presets/google-genai.js.map +1 -0
  118. package/dist/presets/groq.d.ts +1 -0
  119. package/dist/presets/groq.js +2 -0
  120. package/dist/presets/groq.js.map +1 -0
  121. package/dist/presets/openai.d.ts +1 -0
  122. package/dist/presets/openai.js +2 -0
  123. package/dist/presets/openai.js.map +1 -0
  124. package/dist/presets/openrouter.d.ts +1 -0
  125. package/dist/presets/openrouter.js +2 -0
  126. package/dist/presets/openrouter.js.map +1 -0
  127. package/dist/presets/vertexai.d.ts +1 -0
  128. package/dist/presets/vertexai.js +2 -0
  129. package/dist/presets/vertexai.js.map +1 -0
  130. package/dist/presets/xai.d.ts +1 -0
  131. package/dist/presets/xai.js +2 -0
  132. package/dist/presets/xai.js.map +1 -0
  133. package/dist/providers/file.d.ts +1 -0
  134. package/dist/providers/file.js +2 -0
  135. package/dist/providers/file.js.map +1 -0
  136. package/dist/providers/ghIssueProvider.d.ts +1 -0
  137. package/dist/providers/ghIssueProvider.js +2 -0
  138. package/dist/providers/ghIssueProvider.js.map +1 -0
  139. package/dist/providers/ghPrDiffProvider.d.ts +1 -0
  140. package/dist/providers/ghPrDiffProvider.js +2 -0
  141. package/dist/providers/ghPrDiffProvider.js.map +1 -0
  142. package/dist/providers/jiraIssueLegacyProvider.d.ts +1 -0
  143. package/dist/providers/jiraIssueLegacyProvider.js +2 -0
  144. package/dist/providers/jiraIssueLegacyProvider.js.map +1 -0
  145. package/dist/providers/jiraIssueProvider.d.ts +1 -0
  146. package/dist/providers/jiraIssueProvider.js +2 -0
  147. package/dist/providers/jiraIssueProvider.js.map +1 -0
  148. package/dist/providers/text.d.ts +1 -0
  149. package/dist/providers/text.js +2 -0
  150. package/dist/providers/text.js.map +1 -0
  151. package/dist/providers/types.d.ts +1 -0
  152. package/dist/providers/types.js +2 -0
  153. package/dist/providers/types.js.map +1 -0
  154. package/dist/state/artifactStore.d.ts +1 -0
  155. package/dist/state/artifactStore.js +2 -0
  156. package/dist/state/artifactStore.js.map +1 -0
  157. package/dist/tools/A2AAgentTool.d.ts +1 -0
  158. package/dist/tools/A2AAgentTool.js +2 -0
  159. package/dist/tools/A2AAgentTool.js.map +1 -0
  160. package/dist/tools/GthCustomToolkit.d.ts +1 -0
  161. package/dist/tools/GthCustomToolkit.js +2 -0
  162. package/dist/tools/GthCustomToolkit.js.map +1 -0
  163. package/dist/tools/GthDevToolkit.d.ts +1 -0
  164. package/dist/tools/GthDevToolkit.js +2 -0
  165. package/dist/tools/GthDevToolkit.js.map +1 -0
  166. package/dist/tools/GthFileSystemToolkit.d.ts +1 -0
  167. package/dist/tools/GthFileSystemToolkit.js +2 -0
  168. package/dist/tools/GthFileSystemToolkit.js.map +1 -0
  169. package/dist/tools/binaryUtils.d.ts +1 -0
  170. package/dist/tools/binaryUtils.js +2 -0
  171. package/dist/tools/binaryUtils.js.map +1 -0
  172. package/dist/tools/gthJiraLogWorkTool.d.ts +3 -0
  173. package/dist/tools/gthJiraLogWorkTool.js +37 -0
  174. package/dist/tools/gthJiraLogWorkTool.js.map +1 -0
  175. package/dist/tools/gthStatusUpdateTool.d.ts +1 -0
  176. package/dist/tools/gthStatusUpdateTool.js +2 -0
  177. package/dist/tools/gthStatusUpdateTool.js.map +1 -0
  178. package/dist/tools/gthWebFetchTool.d.ts +1 -0
  179. package/dist/tools/gthWebFetchTool.js +2 -0
  180. package/dist/tools/gthWebFetchTool.js.map +1 -0
  181. package/dist/tools/showA2UISurfaceTool.d.ts +1 -0
  182. package/dist/tools/showA2UISurfaceTool.js +2 -0
  183. package/dist/tools/showA2UISurfaceTool.js.map +1 -0
  184. package/dist/tui/components/App.d.ts +9 -0
  185. package/dist/tui/components/App.js +266 -0
  186. package/dist/tui/components/App.js.map +1 -0
  187. package/dist/tui/components/DebugPanel.d.ts +33 -0
  188. package/dist/tui/components/DebugPanel.js +74 -0
  189. package/dist/tui/components/DebugPanel.js.map +1 -0
  190. package/dist/tui/components/LiveTurn.d.ts +21 -0
  191. package/dist/tui/components/LiveTurn.js +46 -0
  192. package/dist/tui/components/LiveTurn.js.map +1 -0
  193. package/dist/tui/components/PromptInput.d.ts +8 -0
  194. package/dist/tui/components/PromptInput.js +16 -0
  195. package/dist/tui/components/PromptInput.js.map +1 -0
  196. package/dist/tui/components/Rule.d.ts +22 -0
  197. package/dist/tui/components/Rule.js +48 -0
  198. package/dist/tui/components/Rule.js.map +1 -0
  199. package/dist/tui/components/SelectList.d.ts +25 -0
  200. package/dist/tui/components/SelectList.js +50 -0
  201. package/dist/tui/components/SelectList.js.map +1 -0
  202. package/dist/tui/components/StatusBar.d.ts +15 -0
  203. package/dist/tui/components/StatusBar.js +22 -0
  204. package/dist/tui/components/StatusBar.js.map +1 -0
  205. package/dist/tui/components/Transcript.d.ts +15 -0
  206. package/dist/tui/components/Transcript.js +33 -0
  207. package/dist/tui/components/Transcript.js.map +1 -0
  208. package/dist/tui/debugRender.d.ts +28 -0
  209. package/dist/tui/debugRender.js +132 -0
  210. package/dist/tui/debugRender.js.map +1 -0
  211. package/dist/tui/fixtureAgent.d.ts +14 -0
  212. package/dist/tui/fixtureAgent.js +35 -0
  213. package/dist/tui/fixtureAgent.js.map +1 -0
  214. package/dist/tui/loadInk.d.ts +1 -0
  215. package/dist/tui/loadInk.js +22 -0
  216. package/dist/tui/loadInk.js.map +1 -0
  217. package/dist/tui/markdown.d.ts +29 -0
  218. package/dist/tui/markdown.js +0 -0
  219. package/dist/tui/markdown.js.map +1 -0
  220. package/dist/tui/shouldUseTui.d.ts +30 -0
  221. package/dist/tui/shouldUseTui.js +18 -0
  222. package/dist/tui/shouldUseTui.js.map +1 -0
  223. package/dist/tui/slashCommands.d.ts +68 -0
  224. package/dist/tui/slashCommands.js +92 -0
  225. package/dist/tui/slashCommands.js.map +1 -0
  226. package/dist/tui/tuiSessionModule.d.ts +14 -0
  227. package/dist/tui/tuiSessionModule.js +121 -0
  228. package/dist/tui/tuiSessionModule.js.map +1 -0
  229. package/dist/tui/types.d.ts +66 -0
  230. package/dist/tui/types.js +2 -0
  231. package/dist/tui/types.js.map +1 -0
  232. package/dist/tui/viewModel.d.ts +76 -0
  233. package/dist/tui/viewModel.js +184 -0
  234. package/dist/tui/viewModel.js.map +1 -0
  235. package/dist/utils/ProgressIndicator.d.ts +1 -0
  236. package/dist/utils/ProgressIndicator.js +2 -0
  237. package/dist/utils/ProgressIndicator.js.map +1 -0
  238. package/dist/utils/aiignoreUtils.d.ts +1 -0
  239. package/dist/utils/aiignoreUtils.js +2 -0
  240. package/dist/utils/aiignoreUtils.js.map +1 -0
  241. package/dist/utils/binaryOutputUtils.d.ts +1 -0
  242. package/dist/utils/binaryOutputUtils.js +2 -0
  243. package/dist/utils/binaryOutputUtils.js.map +1 -0
  244. package/dist/utils/consoleUtils.d.ts +1 -0
  245. package/dist/utils/consoleUtils.js +2 -0
  246. package/dist/utils/consoleUtils.js.map +1 -0
  247. package/dist/utils/debugUtils.d.ts +1 -0
  248. package/dist/utils/debugUtils.js +2 -0
  249. package/dist/utils/debugUtils.js.map +1 -0
  250. package/dist/utils/fileUtils.d.ts +1 -0
  251. package/dist/utils/fileUtils.js +2 -0
  252. package/dist/utils/fileUtils.js.map +1 -0
  253. package/dist/utils/globalConfigUtils.d.ts +1 -0
  254. package/dist/utils/globalConfigUtils.js +2 -0
  255. package/dist/utils/globalConfigUtils.js.map +1 -0
  256. package/dist/utils/llmUtils.d.ts +1 -0
  257. package/dist/utils/llmUtils.js +2 -0
  258. package/dist/utils/llmUtils.js.map +1 -0
  259. package/dist/utils/mcpUtils.d.ts +1 -0
  260. package/dist/utils/mcpUtils.js +2 -0
  261. package/dist/utils/mcpUtils.js.map +1 -0
  262. package/dist/utils/stringUtils.d.ts +1 -0
  263. package/dist/utils/stringUtils.js +2 -0
  264. package/dist/utils/stringUtils.js.map +1 -0
  265. package/dist/utils/systemUtils.d.ts +1 -0
  266. package/dist/utils/systemUtils.js +2 -0
  267. package/dist/utils/systemUtils.js.map +1 -0
  268. package/dist/utils/vertexaiUtils.d.ts +1 -0
  269. package/dist/utils/vertexaiUtils.js +2 -0
  270. package/dist/utils/vertexaiUtils.js.map +1 -0
  271. package/package.json +70 -3
@@ -0,0 +1,23 @@
1
+ # Change Requirements Discovery
2
+
3
+ You are preparing inputs for a pull request code review before the review agent runs.
4
+
5
+ Your goal is to gather exactly two pieces of information:
6
+
7
+ 1. The pull request diff.
8
+ 2. The requirements that should be used for the review.
9
+
10
+ Use the available tools to infer the current pull request and its requirements. Prefer deterministic sources over guesses:
11
+
12
+ - First, inspect the PR metadata/description. If it contains an explicit requirements link, use that link and do not search nearby issue numbers.
13
+ - Use `gh_pr` to retrieve GitHub PR metadata, including the title, branch names, URL, and description/body. If no PR number is known, call it without a PR number to retrieve the current branch PR.
14
+ - Use `gh_diff` to retrieve a GitHub PR diff; it stores the diff as the review diff automatically and returns a short preview. If no PR number is known, call it without a PR number to retrieve the current branch PR diff.
15
+ - Use `gh_issue` to retrieve GitHub issue descriptions only when the PR description, title, branch name, or another reliable source points to a GitHub issue. Pass the full issue URL when the issue lives in another repository.
16
+ - Use repository, shell, MCP, Jira, and other configured tools when available to find requirement documents or issue tracker items.
17
+
18
+ `gh_diff` already sets the diff for you; only call `set_diff` when you have assembled a better exact diff some other way.
19
+ When you have the best available requirements, call `set_requirements` with the complete requirements text exactly as they should constrain the review.
20
+
21
+ Do not invent requirements. Do not brute-force issue numbers. If no requirements can be found, call `set_requirements` with a concise statement explaining that no external requirements were found and what evidence was checked.
22
+
23
+ Finish with a short summary of what you set and where it came from.
package/README.md CHANGED
@@ -1,4 +1,49 @@
1
- # Gaunt Sloth
1
+ # gaunt-sloth
2
2
 
3
- This is a package holder for Gaunt Sloth, for future use,
4
- Gaunt Sloth is currently available as (https://www.npmjs.com/package/gaunt-sloth-assistant)[https://www.npmjs.com/package/gaunt-sloth-assistant]
3
+ The main CLI application for Gaunt Sloth.
4
+
5
+ ## Contents
6
+
7
+ - CLI entry point and commander-based command registration
8
+ - Commands: `ask`, `review`, `pr`, `chat`, `code`, `init`, `get`, `api`
9
+ - Command utilities and config setup
10
+ - Vendor package wiring (all LangChain provider packages)
11
+ - Integration tests
12
+
13
+ ## CLI Binaries
14
+
15
+ The package registers four equivalent binary aliases:
16
+
17
+ - `gaunt-sloth` (primary)
18
+ - `gth`
19
+ - `gsloth`
20
+ - `gaunt-sloth-assistant` (back-compat alias for the former package name)
21
+
22
+ ## Dependencies
23
+
24
+ - `@gaunt-sloth/core`
25
+ - `@gaunt-sloth/agent`
26
+ - `@gaunt-sloth/review`
27
+ - `commander`
28
+ - All LangChain vendor packages (anthropic, google-genai, groq, openai, vertexai, xai, etc.)
29
+
30
+ This is the only package in the workspace that pulls in AI vendor dependencies directly. All other packages treat vendors as optional peers.
31
+
32
+ ## Re-exports
33
+
34
+ `gaunt-sloth` re-exports public APIs from the sub-packages for convenience, so common imports are available from a single entry point.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install -g gaunt-sloth
40
+ ```
41
+
42
+ For full usage documentation see the [root README](../../README.md) and [docs/COMMANDS.md](../../docs/COMMANDS.md).
43
+
44
+ ## Related packages
45
+
46
+ - [`@gaunt-sloth/core`](../core) — Core utilities, config, and agent infrastructure
47
+ - [`@gaunt-sloth/agent`](../agent) — Agent runtime, built-in tools, API/AG-UI/ACP server
48
+ - [`@gaunt-sloth/review`](../review) — Review and Q&A modules with standalone CLI
49
+ - [`gaunt-sloth`](../app) — Main CLI application (this package)
package/cli.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Suppress deprecation warnings programmatically
4
+ process.removeAllListeners('warning');
5
+ process.on('warning', (warning) => {
6
+ if (warning.name === 'DeprecationWarning' || warning.name === 'ExperimentalWarning') {
7
+ return;
8
+ }
9
+ console.warn(warning);
10
+ });
11
+
12
+ // This is a minimalistic entry point that sets the installDir in systemUtils
13
+ // and delegates to the compiled TypeScript code in dist/cli.js
14
+ import { setEntryPoint } from './dist/utils/systemUtils.js';
15
+
16
+ // Set the installation directory in systemUtils
17
+ setEntryPoint(import.meta.url);
18
+
19
+ // Import and run the compiled TypeScript code
20
+ import('./dist/cli.js').catch((err) => {
21
+ console.error('Failed to load application:', err);
22
+ process.exit(1);
23
+ });
@@ -0,0 +1 @@
1
+ export * from '@gaunt-sloth/agent/builtInToolsConfig.js';
@@ -0,0 +1,2 @@
1
+ export * from '@gaunt-sloth/agent/builtInToolsConfig.js';
2
+ //# sourceMappingURL=builtInToolsConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtInToolsConfig.js","sourceRoot":"","sources":["../src/builtInToolsConfig.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,70 @@
1
+ import { Command, Option } from 'commander';
2
+ import { askCommand } from '#src/commands/askCommand.js';
3
+ import { execCommand } from '#src/commands/execCommand.js';
4
+ import { initCommand } from '#src/commands/initCommand.js';
5
+ import { reviewCommand } from '#src/commands/reviewCommand.js';
6
+ import { prCommand } from '#src/commands/prCommand.js';
7
+ import { chatCommand } from '#src/commands/chatCommand.js';
8
+ import { codeCommand } from '#src/commands/codeCommand.js';
9
+ import { apiCommand } from '#src/commands/apiCommand.js';
10
+ import { getCommand } from '#src/commands/getCommand.js';
11
+ import { argv, getSlothVersion, readStdin } from '@gaunt-sloth/core/utils/systemUtils.js';
12
+ import { coerceBooleanOrString } from '@gaunt-sloth/core/utils/consoleUtils.js';
13
+ const program = new Command();
14
+ program
15
+ .name('gsloth')
16
+ .description('Gaunt Sloth Assistant reviewing your PRs')
17
+ .version(getSlothVersion())
18
+ .option('--verbose', 'Set LangChain/LangGraph to verbose mode, ' +
19
+ 'causing LangChain/LangGraph to log many details to the console. ' +
20
+ 'Consider using debugLog from config.ts for less intrusive debug logging.')
21
+ .option('-c, --config <path>', 'Path to custom configuration file')
22
+ .option('-i, --identity-profile <identity>', 'Identity profile (separate config and prompts)')
23
+ .option('-w, --write-output-to-file <value>', 'Write output to file. Accepts true/false or a filename. Shortcuts: -wn or -w0 for false.')
24
+ .option('--tui', 'Force the interactive Ink TUI for chat/code sessions (overrides CI auto-off)')
25
+ .option('--no-tui', 'Force the plain readline session for chat/code (disable the TUI)')
26
+ .addOption(new Option('--nopipe').hideHelp(true));
27
+ const cliConfigOverrides = {};
28
+ // Parse global options before binding any commands
29
+ program.parseOptions(argv);
30
+ if (program.getOptionValue('verbose')) {
31
+ /**
32
+ * Set LangChain/LangGraph to verbose mode,
33
+ * causing LangChain/LangGraph to log many details to the console.
34
+ * debugLog from config.ts may be a less intrusive option.
35
+ */
36
+ cliConfigOverrides.verbose = true;
37
+ }
38
+ if (program.getOptionValue('config')) {
39
+ // Set a custom config path
40
+ cliConfigOverrides.customConfigPath = program.getOptionValue('config');
41
+ }
42
+ if (program.getOptionValue('identityProfile')) {
43
+ cliConfigOverrides.identityProfile = program.getOptionValue('identityProfile');
44
+ }
45
+ // Tri-state TUI flag: leave `tui` undefined (auto-detect) unless the user explicitly passed
46
+ // `--tui` or `--no-tui`. Commander's `--no-tui` defaults the value to `true`, so we key off
47
+ // the value *source* rather than the value to tell "auto" from an explicit choice.
48
+ if (program.getOptionValueSource('tui') === 'cli') {
49
+ cliConfigOverrides.tui = program.getOptionValue('tui');
50
+ }
51
+ const writeToFile = program.getOptionValue('writeOutputToFile');
52
+ // Commander does an interesting thing: if a shortcut like -w exists,
53
+ // everything after this shortcut without a space becomes the value.
54
+ // Examples: -wn comes with value 'n', -w0 => '0', -wreview.md => 'review.md'
55
+ const coerced = coerceBooleanOrString(writeToFile);
56
+ if (coerced !== undefined) {
57
+ cliConfigOverrides.writeOutputToFile = coerced;
58
+ }
59
+ // Initialize all commands - they will handle their own config loading
60
+ initCommand(program);
61
+ reviewCommand(program, cliConfigOverrides);
62
+ prCommand(program, cliConfigOverrides);
63
+ askCommand(program, cliConfigOverrides);
64
+ execCommand(program, cliConfigOverrides);
65
+ chatCommand(program, cliConfigOverrides);
66
+ codeCommand(program, cliConfigOverrides);
67
+ apiCommand(program, cliConfigOverrides);
68
+ getCommand(program, cliConfigOverrides);
69
+ await readStdin(program);
70
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAG1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,0CAA0C,CAAC;KACvD,OAAO,CAAC,eAAe,EAAE,CAAC;KAC1B,MAAM,CACL,WAAW,EACX,2CAA2C;IACzC,kEAAkE;IAClE,0EAA0E,CAC7E;KACA,MAAM,CAAC,qBAAqB,EAAE,mCAAmC,CAAC;KAClE,MAAM,CAAC,mCAAmC,EAAE,gDAAgD,CAAC;KAC7F,MAAM,CACL,oCAAoC,EACpC,0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sEAAsE;AACtE,WAAW,CAAC,OAAO,CAAC,CAAC;AACrB,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAC3C,SAAS,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACvC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACxC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACxC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAExC,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
3
+ export declare function apiCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
@@ -0,0 +1,25 @@
1
+ import { initConfig } from '@gaunt-sloth/core/config.js';
2
+ import { displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
3
+ import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
4
+ export function apiCommand(program, commandLineConfigOverrides) {
5
+ const api = program.command('api').description('Start an API server for Gaunt Sloth');
6
+ api
7
+ .command('ag-ui')
8
+ .description('Start an AG-UI protocol HTTP server')
9
+ .option('--port <port>', 'Port to listen on')
10
+ .action(async (options) => {
11
+ try {
12
+ const config = await initConfig(commandLineConfigOverrides);
13
+ const port = options.port
14
+ ? parseInt(options.port, 10)
15
+ : (config.commands?.api?.port ?? 3000);
16
+ const { startAgUiServer } = await import('@gaunt-sloth/agent/modules/apiAgUiModule.js');
17
+ await startAgUiServer(config, port);
18
+ }
19
+ catch (error) {
20
+ displayError(error instanceof Error ? error.message : String(error));
21
+ setExitCode(1);
22
+ }
23
+ });
24
+ }
25
+ //# sour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C,CAAC;AACP,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { Command } from 'commander';
2
+ import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
3
+ import type { GthConfig } from '@gaunt-sloth/core/config.js';
4
+ interface AskCommandOptions {
5
+ file?: string[];
6
+ /**
7
+ * Opt `ask` into "do-the-job" mode: enable the same full filesystem + dev tools that
8
+ * `exec`/`code` get, so the question can act (read/write files, run commands) rather than
9
+ * just chat. Off by default; loud when active because it grants write access.
10
+ */
11
+ write?: boolean;
12
+ }
13
+ /**
14
+ * When `ask --write` is set, upgrade the effective config so the `ask` run gets the same
15
+ * "do-the-job" capabilities as `exec`/`code`: full (`all`) filesystem access plus dev tools.
16
+ *
17
+ * Filesystem mode is overridden on the per-command `commands.ask` slice (where
18
+ * `getEffectiveConfig` reads it from), and `askWriteMode` is set so the agent's tool resolution
19
+ * enables dev tools for `ask`. Dev tools reuse exec's (falling back to code's) `devTools` config
20
+ * so users don't have to configure a separate `commands.ask.devTools`. Returns the config
21
+ * untouched when `--write` is not set.
22
+ *
23
+ * Exported for unit testing.
24
+ */
25
+ export declare function applyAskWriteMode(config: GthConfig, options: AskCommandOptions): GthConfig;
26
+ /**
27
+ * Adds the ask command to the program
28
+ * @param program - The commander program
29
+ * @param commandLineConfigOverrides - command line config overrides
30
+ */
31
+ export declare function askCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
32
+ export {};
@@ -0,0 +1,73 @@
1
+ import { initConfig } from '@gaunt-sloth/core/config.js';
2
+ import { getAskSystemPrompt } from '#src/commands/commandIntrospection.js';
3
+ import { getStringFromStdin } from '@gaunt-sloth/core/utils/systemUtils.js';
4
+ import { displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
5
+ import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
6
+ import { readMultipleFilesFromProjectDir } from '@gaunt-sloth/core/utils/fileUtils.js';
7
+ /**
8
+ * When `ask --write` is set, upgrade the effective config so the `ask` run gets the same
9
+ * "do-the-job" capabilities as `exec`/`code`: full (`all`) filesystem access plus dev tools.
10
+ *
11
+ * Filesystem mode is overridden on the per-command `commands.ask` slice (where
12
+ * `getEffectiveConfig` reads it from), and `askWriteMode` is set so the agent's tool resolution
13
+ * enables dev tools for `ask`. Dev tools reuse exec's (falling back to code's) `devTools` config
14
+ * so users don't have to configure a separate `commands.ask.devTools`. Returns the config
15
+ * untouched when `--write` is not set.
16
+ *
17
+ * Exported for unit testing.
18
+ */
19
+ export function applyAskWriteMode(config, options) {
20
+ if (!options.write) {
21
+ return config;
22
+ }
23
+ displayWarning('ask --write: filesystem and dev tools enabled — this run can read/write files and run commands.');
24
+ const askDevTools = config.commands?.exec?.devTools ?? config.commands?.code?.devTools;
25
+ return {
26
+ ...config,
27
+ askWriteMode: true,
28
+ commands: {
29
+ ...config.commands,
30
+ ask: {
31
+ ...config.commands?.ask,
32
+ filesystem: 'all',
33
+ ...(askDevTools ? { devTools: askDevTools } : {}),
34
+ },
35
+ },
36
+ };
37
+ }
38
+ /**
39
+ * Adds the ask command to the program
40
+ * @param program - The commander program
41
+ * @param commandLineConfigOverrides - command line config overrides
42
+ */
43
+ export function askCommand(program, commandLineConfigOverrides) {
44
+ program
45
+ .command('ask')
46
+ .description('Ask a question')
47
+ .argument('[message]', 'A message')
48
+ .option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the message')
49
+ .option('--write', 'Let ask act, not just chat: enable full filesystem + dev tools (like exec/code) so it can ' +
50
+ 'read/write files and run commands. Grants write access — use with care.')
51
+ .action(async (message, options) => {
52
+ const config = applyAskWriteMode(await initConfig(commandLineConfigOverrides), options);
53
+ const content = [];
54
+ if (options.file) {
55
+ content.push(readMultipleFilesFromProjectDir(options.file));
56
+ }
57
+ const stringFromStdin = getStringFromStdin();
58
+ if (stringFromStdin) {
59
+ content.push(wrapContent(stringFromStdin, 'stdin-content'));
60
+ }
61
+ if (message) {
62
+ content.push(wrapContent(message, 'message', 'user message'));
63
+ }
64
+ // Validate that at least one input source is provided
65
+ if (content.length === 0) {
66
+ throw new Error('At least one of the following is required: file, stdin, or message');
67
+ }
68
+ const { runSingleShot } = await import('@gaunt-sloth/core/runtime/singleShot.js');
69
+ const { createResolvers } = await import('@gaunt-sloth/agent/resolvers.js');
70
+ await runSingleShot('ASK', getAskSystemPrompt(config), content.join('\n'), config, createResolvers());
71
+ });
72
+ }
73
+ //# sourceMappingURL=askCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askCommand.js","sourceRoot":"","sources":["../../src/commands/askCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAYvF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,OAA0B;IAC7E,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,cAAc,CACZ,iGAAiG,CAClG,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC;IACvF,OAAO;QACL,GAAG,MAAM;QACT,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE;YACR,GAAG,MAAM,CAAC,QAAQ;YAClB,GAAG,EAAE;gBACH,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG;gBACvB,UAAU,EAAE,KAAK;gBACjB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,Q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E,GAAG,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;QAC5E,MAAM,aAAa,CACjB,KAAK,EACL,kBAAkB,CAAC,MAAM,CAAC,EAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAClB,MAAM,EACN,eAAe,EAAE,CAClB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
3
+ export declare function chatCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
@@ -0,0 +1,20 @@
1
+ import { startSession } from '#src/modules/startSession.js';
2
+ import { readChatPrompt } from '@gaunt-sloth/core/utils/llmUtils.js';
3
+ export function chatCommand(program, commandLineConfigOverrides) {
4
+ const sessionConfig = {
5
+ mode: 'chat',
6
+ readModePrompt: readChatPrompt,
7
+ description: 'Start an interactive chat session with Gaunt Sloth',
8
+ readyMessage: '\nGaunt Sloth is ready to chat. Type your prompt.',
9
+ exitMessage: "Type 'exit' or hit Ctrl+C to exit chat\n",
10
+ };
11
+ // Chat command (REL-3: the no-subcommand default is now `code`, registered in codeCommand)
12
+ program
13
+ .command('chat')
14
+ .description('Start an interactive chat session with Gaunt Sloth')
15
+ .argument('[message]', 'Initial message to start the chat')
16
+ .action(async (message) => {
17
+ await startSession(sessionConfig, commandLineConfigOverrides, message);
18
+ });
19
+ }
20
+ //# sourceMappingURL=chatCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatCommand.js","sourceRoot":"","sources":["../../src/commands/chatCommand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,MAAM,aAAa,GAAkB;QACnC,IAAI,EAAE,MAAM;QACZ,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,oDAAoD;QACjE,YAAY,EAAE,mDAAmD;QACjE,WAAW,EAAE,0CAA0C;KACxD,CAAC;IACF,2FAA2F;IAC3F,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oDAAoD,CAAC;SACjE,QAAQ,CAAC,WAAW,EAAE,mCAAmC,CAAC;SAC1D,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;QAChC,MAAM,YAAY,CAAC,aAAa,EAAE,0BAA0B,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
3
+ export declare function codeCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
@@ -0,0 +1,23 @@
1
+ import { startSession } from '#src/modules/startSession.js';
2
+ import { readCodePrompt } from '@gaunt-sloth/core/utils/llmUtils.js';
3
+ export function codeCommand(program, commandLineConfigOverrides) {
4
+ const sessionConfig = {
5
+ mode: 'code',
6
+ readModePrompt: readCodePrompt,
7
+ description: 'Interactively write code with sloth (has full file system access within your project)',
8
+ readyMessage: '\nGaunt Sloth is ready to code. Type your prompt.',
9
+ exitMessage: "Type 'exit' or hit Ctrl+C to exit code session\n",
10
+ };
11
+ // REL-3: bare `gth` (no subcommand) now defaults to the agentic code session.
12
+ program.action(async () => {
13
+ await startSession(sessionConfig, commandLineConfigOverrides);
14
+ });
15
+ program
16
+ .command('code')
17
+ .description('Interactively write code with sloth (has full file system access within your project)')
18
+ .argument('[message]', 'Initial message to start the code session')
19
+ .action(async (message) => {
20
+ await startSession(sessionConfig, commandLineConfigOverrides, message);
21
+ });
22
+ }
23
+ //# sourceMappingURL=codeCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeCommand.js","sourceRoot":"","sources":["../../src/commands/codeCommand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,0BAAsD;IAEtD,MAAM,aAAa,GAAkB;QACnC,IAAI,EAAE,MAAM;QACZ,cAAc,EAAE,cAAc;QAC9B,WAAW,EACT,uFAAuF;QACzF,YAAY,EAAE,mDAAmD;QACjE,WAAW,EAAE,kDAAkD;KAChE,CAAC;IAEF,8EAA8E;IAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,YAAY,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,uFAAuF,CACxF;SACA,QAAQ,CAAC,WAAW,EAAE,2CAA2C,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;QAChC,MAAM,YAAY,CAAC,aAAa,EAAE,0BAA0B,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
+ import { type ContentProviderType, type RequirementsProviderType } from '#src/commands/commandUtils.js';
3
+ export type PromptCommandType = 'ask' | 'review' | 'pr' | 'pr-discovery' | 'chat' | 'code' | 'exec';
4
+ export type ProviderCommandType = 'review' | 'pr';
5
+ export type ProviderInputType = 'content' | 'requirements';
6
+ export declare function getAskSystemPrompt(config: GthConfig): string;
7
+ export declare function getExecSystemPrompt(config: GthConfig): string;
8
+ export declare function getReviewSystemPrompt(config: GthConfig): string;
9
+ export declare function getCommandSystemPrompt(command: PromptCommandType, config: GthConfig): string;
10
+ export declare function getEffectiveRequirementsProvider(command: ProviderCommandType, config: GthConfig, cliProvider?: RequirementsProviderType): RequirementsProviderType | undefined;
11
+ export declare function getEffectiveContentProvider(command: ProviderCommandType, config: GthConfig, cliProvider?: ContentProviderType): ContentProviderType | undefined;
12
+ export declare function getCommandProviderInput(command: ProviderCommandType, inputType: ProviderInputType, id: string | undefined, config: GthConfig, cliProvider?: RequirementsProviderType | ContentProviderType): Promise<string>;
@@ -0,0 +1,70 @@
1
+ import { getContentFromProvider, getRequirementsFromProvider, } from '#src/commands/commandUtils.js';
2
+ import { buildSystemMessages, readBackstory, readChatPrompt, readCodePrompt, readExecPrompt, readGuidelines, readReviewInstructions, readSystemPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
3
+ import { readPrDiscoveryPrompt } from '#src/commands/prDiscovery.js';
4
+ export function getAskSystemPrompt(config) {
5
+ const parts = [readBackstory(config), readGuidelines(config)];
6
+ const systemPrompt = readSystemPrompt(config);
7
+ if (systemPrompt) {
8
+ parts.push(systemPrompt);
9
+ }
10
+ return parts.join('\n');
11
+ }
12
+ export function getExecSystemPrompt(config) {
13
+ return flattenSystemMessageContent(config, readExecPrompt(config));
14
+ }
15
+ export function getReviewSystemPrompt(config) {
16
+ const parts = [readBackstory(config), readGuidelines(config), readReviewInstructions(config)];
17
+ const systemPrompt = readSystemPrompt(config);
18
+ if (systemPrompt) {
19
+ parts.push(systemPrompt);
20
+ }
21
+ return parts.join('\n');
22
+ }
23
+ export function getCommandSystemPrompt(command, config) {
24
+ if (command === 'ask') {
25
+ return getAskSystemPrompt(config);
26
+ }
27
+ if (command === 'exec') {
28
+ return getExecSystemPrompt(config);
29
+ }
30
+ if (command === 'review' || command === 'pr') {
31
+ return getReviewSystemPrompt(config);
32
+ }
33
+ const modePrompt = command === 'pr-discovery'
34
+ ? readPrDiscoveryPrompt(config)
35
+ : command === 'chat'
36
+ ? readChatPrompt(config)
37
+ : readCodePrompt(config);
38
+ return flattenSystemMessageContent(config, modePrompt);
39
+ }
40
+ function flattenSystemMessageContent(config, modePrompt) {
41
+ const [systemMessage] = buildSystemMessages(config, modePrompt);
42
+ const content = systemMessage?.content;
43
+ if (typeof content === 'string') {
44
+ return content;
45
+ }
46
+ if (Array.isArray(content)) {
47
+ return content
48
+ .map((item) => (typeof item === 'string' ? item : 'text' in item ? item.text : ''))
49
+ .join('\n');
50
+ }
51
+ return '';
52
+ }
53
+ export function getEffectiveRequirementsProvider(command, config, cliProvider) {
54
+ return (cliProvider ??
55
+ config?.commands?.[command]?.requirementsProvider ??
56
+ config?.requirementsProvider);
57
+ }
58
+ export function getEffectiveContentProvider(command, config, cliProvider) {
59
+ return (cliProvider ??
60
+ config?.commands?.[command]?.contentProvider ??
61
+ config?.contentProvider ??
62
+ (command === 'pr' ? 'github' : undefined));
63
+ }
64
+ export async function getCommandProviderInput(command, inputType, id, config, cliProvider) {
65
+ if (inputType === 'requirements') {
66
+ return getRequirementsFromProvider(getEffectiveRequirementsProvider(command, config, cliProvider), id, config);
67
+ }
68
+ return getContentFromProvider(getEffectiveContentProvider(command, config, cliProvider), id, config);
69
+ }
70
+ //# sourceMappingURL=commandIntrospection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAG5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAMrE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,KAAK,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,YAA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EACtB,MAAiB,EACjB,WAA4D;IAE5D,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,2BAA2B,CAChC,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAuC,CAAC,EAC1F,EAAE,EACF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAC3B,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,WAAkC,CAAC,EAChF,EAAE,EACF,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
+ /**
3
+ * Requirements providers. Aliases are mapped to actual package paths.
4
+ */
5
+ export declare const REQUIREMENTS_PROVIDERS: {
6
+ readonly 'jira-legacy': "@gaunt-sloth/review/sources/jiraIssueLegacySource.js";
7
+ readonly jira: "@gaunt-sloth/review/sources/jiraIssueSource.js";
8
+ readonly github: "@gaunt-sloth/review/sources/ghIssueSource.js";
9
+ readonly text: "@gaunt-sloth/review/sources/textSource.js";
10
+ readonly file: "@gaunt-sloth/review/sources/fileSource.js";
11
+ };
12
+ export type RequirementsProviderType = keyof typeof REQUIREMENTS_PROVIDERS;
13
+ /**
14
+ * Content providers. Aliases are mapped to actual package paths.
15
+ */
16
+ export declare const CONTENT_PROVIDERS: {
17
+ readonly github: "@gaunt-sloth/review/sources/ghPrDiffSource.js";
18
+ readonly text: "@gaunt-sloth/review/sources/textSource.js";
19
+ readonly file: "@gaunt-sloth/review/sources/fileSource.js";
20
+ };
21
+ export type ContentProviderType = keyof typeof CONTENT_PROVIDERS;
22
+ export declare function getRequirementsFromProvider(requirementsProvider: RequirementsProviderType | undefined, requirementsId: string | undefined, config: GthConfig): Promise<string>;
23
+ export declare function getContentFromProvider(contentProvider: ContentProviderType | undefined, contentId: string | undefined, config: GthConfig): Promise<string>;
@@ -0,0 +1,49 @@
1
+ import { displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
2
+ import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
3
+ /**
4
+ * Requirements providers. Aliases are mapped to actual package paths.
5
+ */
6
+ export const REQUIREMENTS_PROVIDERS = {
7
+ 'jira-legacy': '@gaunt-sloth/review/sources/jiraIssueLegacySource.js',
8
+ jira: '@gaunt-sloth/review/sources/jiraIssueSource.js',
9
+ github: '@gaunt-sloth/review/sources/ghIssueSource.js',
10
+ text: '@gaunt-sloth/review/sources/textSource.js',
11
+ file: '@gaunt-sloth/review/sources/fileSource.js',
12
+ };
13
+ /**
14
+ * Content providers. Aliases are mapped to actual package paths.
15
+ */
16
+ export const CONTENT_PROVIDERS = {
17
+ github: '@gaunt-sloth/review/sources/ghPrDiffSource.js',
18
+ text: '@gaunt-sloth/review/sources/textSource.js',
19
+ file: '@gaunt-sloth/review/sources/fileSource.js',
20
+ };
21
+ export async function getRequirementsFromProvider(requirementsProvider, requirementsId, config) {
22
+ const requirements = await getFromProvider(requirementsProvider, requirementsId, (config?.requirementsProviderConfig ?? {})[requirementsProvider], REQUIREMENTS_PROVIDERS);
23
+ return wrapContent(requirements, requirementsProvider, 'requirements');
24
+ }
25
+ export async function getContentFromProvider(contentProvider, contentId, config) {
26
+ const content = await getFromProvider(contentProvider, contentId, (config?.contentProviderConfig ?? {})[contentProvider], CONTENT_PROVIDERS);
27
+ return wrapContent(content, contentProvider, contentProvider === 'github' ? 'GitHub diff' : 'content');
28
+ }
29
+ async function getFromProvider(provider, id,
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ config, legitPredefinedProviders) {
32
+ if (typeof provider === 'string') {
33
+ // Use one of the predefined providers
34
+ if (legitPredefinedProviders[provider]) {
35
+ const providerPath = legitPredefinedProviders[provider];
36
+ const { get } = await import(providerPath);
37
+ return await get(config, id);
38
+ }
39
+ else {
40
+ displayError(`Unknown provider: ${provider}. Continuing without it.`);
41
+ }
42
+ }
43
+ else if (typeof provider === 'function') {
44
+ // Type assertion to handle function call
45
+ return await provider(id);
46
+ }
47
+ return '';
48
+ }
49
+ //# sourceMappingURL=commandUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../src/commands/commandUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,sDAAsD;IACrE,IAAI,EAAE,gDAAgD;IACtD,MAAM,EAAE,8CAA8C;IACtD,IAAI,EAAE,2CAA2C;IACjD,IAAI,EAAE,2CAA2C;CACzC,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,+CAA+C;IACvD,IAAI,EAAE,2CAA2C;IACjD,IAAI,EAAE,2CAA2C;CACzC,CAAC;AAIX,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,oBAA0D,EAC1D,cAAkC,EAClC,MAAiB;IAEjB,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,oBAAoB,EACpB,cAAc,EACd,CAAC,MAAM,EAAE,0BAA0B,IAAI,EAAE,CAAC,CAAC,oBAA8B,CAAC,EAC1E,sBAAsB,CACvB,CAAC;IACF,OAAO,WAAW,CAAC,YAAY,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,eAAgD,EAChD,SAA6B,EAC7B,MAAiB;IAEjB,MAAM,OAAO,GAAG,MAAM,eAAe,CACnC,eAAe,EACf,SAAS,EACT,CAAC,MAAM,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAC,eAAyB,CAAC,EAChE,iBAAiB,CAClB,CAAC;IACF,OAAO,WAAW,CAChB,OAAO,EACP,eAAe,EACf,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CACzD,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,QAAoE,EACpE,EAAsB;AACtB,8DAA8D;AAC9D,MAAW,EACX,wBAAkF;IAElF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,sCAAsC;QACtC,IAAI,wBAAwB,CAAC,QAAiD,CAAC,EAAE,CAAC;YAChF,MAAM,YAAY,GAChB,wBAAwB,CAAC,QAAiD,CAAC,CAAC;YAC9E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;YAC3C,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,qBAAqB,QAAQ,0BAA0B,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1C,yCAAyC;QACzC,OAAO,MAAO,QAAwD,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function createProjectConfig(configType: string): Promise<void>;
2
+ /**
3
+ * Ensures that the .gsloth directory exists in the project root.
4
+ * Creates it if it does not exist.
5
+ */
6
+ export declare function ensureGslothDir(): void;
7
+ export declare function writeProjectReviewPreamble(): void;