@iaforged/context-code 1.0.77 → 1.0.80

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 (127) hide show
  1. package/README.md +68 -68
  2. package/cli.js +8515 -8515
  3. package/context-bootstrap.js +27 -27
  4. package/dist/src/bootstrap/state.js +3 -0
  5. package/dist/src/bridge/bridgeMain.js +40 -40
  6. package/dist/src/cli/print.js +12 -12
  7. package/dist/src/commands/agent/agent.js +8 -0
  8. package/dist/src/commands/commit-push-pr.js +55 -55
  9. package/dist/src/commands/createMovedToPluginCommand.js +9 -9
  10. package/dist/src/commands/init-verifiers.js +238 -238
  11. package/dist/src/commands/init.js +226 -225
  12. package/dist/src/commands/install.js +2 -2
  13. package/dist/src/commands/login/login.js +24 -10
  14. package/dist/src/commands/orchestrate/index.js +1 -1
  15. package/dist/src/commands/orchestrate/orchestrate.js +110 -24
  16. package/dist/src/commands/profile/profile.js +15 -1
  17. package/dist/src/commands/provider/index.js +1 -1
  18. package/dist/src/commands/provider/provider.js +34 -1
  19. package/dist/src/commands/review.js +22 -22
  20. package/dist/src/commands/run/index.js +2 -2
  21. package/dist/src/commands/run/run.js +63 -61
  22. package/dist/src/commands/team/index.js +1 -1
  23. package/dist/src/commands/team/team.js +84 -76
  24. package/dist/src/commands/team-auto/teamAuto.js +89 -29
  25. package/dist/src/commands/terminalSetup/terminalSetup.js +24 -24
  26. package/dist/src/commands/usage/index.js +7 -0
  27. package/dist/src/commands/usage/usage.js +5 -0
  28. package/dist/src/commands/workspace/workspace.js +39 -31
  29. package/dist/src/commands.js +0 -2
  30. package/dist/src/components/ConsoleOAuthFlow.js +92 -14
  31. package/dist/src/components/ModelPicker.js +2 -0
  32. package/dist/src/components/agents/AgentsList.js +9 -9
  33. package/dist/src/components/agents/AgentsMenu.js +3 -3
  34. package/dist/src/components/agents/generateAgent.js +92 -92
  35. package/dist/src/components/agents/utils.js +13 -9
  36. package/dist/src/components/grove/Grove.js +10 -10
  37. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +8 -8
  38. package/dist/src/constants/geminiOAuth.js +13 -0
  39. package/dist/src/constants/github-app.js +134 -134
  40. package/dist/src/constants/prompts.js +123 -123
  41. package/dist/src/coordinator/coordinatorMode.js +252 -252
  42. package/dist/src/hooks/useTypeahead.js +7 -7
  43. package/dist/src/ink/reconciler.js +7 -7
  44. package/dist/src/main.js +5 -5
  45. package/dist/src/memdir/findRelevantMemories.js +6 -6
  46. package/dist/src/projectOnboardingState.js +3 -3
  47. package/dist/src/services/MagicDocs/prompts.js +56 -56
  48. package/dist/src/services/PromptSuggestion/promptSuggestion.js +29 -29
  49. package/dist/src/services/SessionMemory/prompts.js +66 -66
  50. package/dist/src/services/api/openai.js +584 -21
  51. package/dist/src/services/limits/adapters/ollama.js +3 -3
  52. package/dist/src/services/oauth/geminiCli.js +107 -0
  53. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +5 -3
  54. package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +18 -18
  55. package/dist/src/services/orchestration/global/reporting.js +2 -2
  56. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +9 -9
  57. package/dist/src/skills/bundled/batch.js +78 -78
  58. package/dist/src/skills/bundled/claudeApi.js +34 -34
  59. package/dist/src/skills/bundled/claudeInChrome.js +4 -4
  60. package/dist/src/skills/bundled/debug.js +36 -36
  61. package/dist/src/skills/bundled/scheduleRemoteAgents.js +151 -151
  62. package/dist/src/skills/bundled/skillify.js +132 -132
  63. package/dist/src/skills/bundled/stuck.js +53 -53
  64. package/dist/src/skills/bundled/updateConfig.js +418 -418
  65. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +26 -26
  66. package/dist/src/tools/AgentTool/AgentTool.js +7 -7
  67. package/dist/src/tools/AgentTool/agentDisplay.js +18 -10
  68. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +67 -67
  69. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +32 -32
  70. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +13 -13
  71. package/dist/src/tools/AgentTool/built-in/planAgent.js +49 -49
  72. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +129 -129
  73. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +119 -119
  74. package/dist/src/tools/AgentTool/prompt.js +131 -131
  75. package/dist/src/tools/AgentTool/runAgent.js +9 -9
  76. package/dist/src/tools/BashTool/BashTool.js +10 -10
  77. package/dist/src/tools/BashTool/prompt.js +94 -94
  78. package/dist/src/tools/ConfigTool/prompt.js +29 -29
  79. package/dist/src/tools/EnterWorktreeTool/prompt.js +27 -27
  80. package/dist/src/tools/FileReadTool/prompt.js +12 -12
  81. package/dist/src/tools/PowerShellTool/prompt.js +82 -82
  82. package/dist/src/tools/RemoteTriggerTool/prompt.js +9 -9
  83. package/dist/src/tools/ScheduleCronTool/prompt.js +37 -37
  84. package/dist/src/tools/TeamCreateTool/prompt.js +110 -110
  85. package/dist/src/tools/TeamDeleteTool/prompt.js +13 -13
  86. package/dist/src/utils/advisor.js +15 -15
  87. package/dist/src/utils/api.js +2 -2
  88. package/dist/src/utils/auth.js +207 -2
  89. package/dist/src/utils/autoUpdater.js +18 -18
  90. package/dist/src/utils/bash/ShellSnapshot.js +86 -86
  91. package/dist/src/utils/bash/commands.js +61 -61
  92. package/dist/src/utils/claudeInChrome/prompt.js +53 -53
  93. package/dist/src/utils/claudeInChrome/setup.js +8 -8
  94. package/dist/src/utils/claudemd.js +19 -7
  95. package/dist/src/utils/databaseMcp/server/queries.js +632 -632
  96. package/dist/src/utils/deepLink/registerProtocol.js +35 -35
  97. package/dist/src/utils/deepLink/terminalLauncher.js +12 -12
  98. package/dist/src/utils/hooks/execAgentHook.js +7 -7
  99. package/dist/src/utils/hooks/execPromptHook.js +4 -4
  100. package/dist/src/utils/hooks/skillImprovement.js +36 -36
  101. package/dist/src/utils/logoV2Utils.js +1 -1
  102. package/dist/src/utils/mcp/dateTimeParser.js +9 -9
  103. package/dist/src/utils/messages.js +191 -191
  104. package/dist/src/utils/model/model.js +18 -0
  105. package/dist/src/utils/model/modelOptions.js +51 -1
  106. package/dist/src/utils/model/modelStrings.js +5 -1
  107. package/dist/src/utils/model/modelSupportOverrides.js +3 -0
  108. package/dist/src/utils/model/providerBaseUrls.js +6 -1
  109. package/dist/src/utils/model/providerCatalog.js +64 -28
  110. package/dist/src/utils/model/providerModels.js +88 -17
  111. package/dist/src/utils/model/providerProfiles.js +8 -0
  112. package/dist/src/utils/model/providerProfilesDb.js +578 -393
  113. package/dist/src/utils/model/providerSwitch.js +12 -0
  114. package/dist/src/utils/model/providerWorkspaces.js +2 -0
  115. package/dist/src/utils/model/providers.js +65 -2
  116. package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +3 -1
  117. package/dist/src/utils/orchestration/store/runStore.js +47 -47
  118. package/dist/src/utils/orchestration/store/teamStore.js +61 -61
  119. package/dist/src/utils/powershell/parser.js +253 -253
  120. package/dist/src/utils/sessionTitle.js +12 -12
  121. package/dist/src/utils/sideQuestion.js +17 -17
  122. package/dist/src/utils/status.js +1 -1
  123. package/dist/src/utils/swarm/backends/registry.js +9 -9
  124. package/dist/src/utils/telemetry/instrumentation.js +9 -9
  125. package/dist/src/utils/teleport.js +15 -15
  126. package/dist/src/utils/undercover.js +28 -28
  127. package/package.json +1 -1
@@ -36,32 +36,32 @@ export function generatePrompt() {
36
36
  }
37
37
  }
38
38
  const modelSection = generateModelSection();
39
- return `Get or set Context Code configuration settings.
40
-
41
- View or change Context Code settings. Use when the user requests configuration changes, asks about current settings, or when adjusting a setting would benefit them.
42
-
43
-
44
- ## Usage
45
- - **Get current value:** Omit the "value" parameter
46
- - **Set new value:** Include the "value" parameter
47
-
48
- ## Configurable settings list
49
- The following settings are available for you to change:
50
-
51
- ### Global Settings (stored in ~/.context.json)
52
- ${globalSettings.join('\n')}
53
-
54
- ### Project Settings (stored in settings.json)
55
- ${projectSettings.join('\n')}
56
-
57
- ${modelSection}
58
- ## Examples
59
- - Get theme: { "setting": "theme" }
60
- - Set dark theme: { "setting": "theme", "value": "dark" }
61
- - Enable vim mode: { "setting": "editorMode", "value": "vim" }
62
- - Enable verbose: { "setting": "verbose", "value": true }
63
- - Change model: { "setting": "model", "value": "opus" }
64
- - Change permission mode: { "setting": "permissions.defaultMode", "value": "plan" }
39
+ return `Get or set Context Code configuration settings.
40
+
41
+ View or change Context Code settings. Use when the user requests configuration changes, asks about current settings, or when adjusting a setting would benefit them.
42
+
43
+
44
+ ## Usage
45
+ - **Get current value:** Omit the "value" parameter
46
+ - **Set new value:** Include the "value" parameter
47
+
48
+ ## Configurable settings list
49
+ The following settings are available for you to change:
50
+
51
+ ### Global Settings (stored in ~/.context.json)
52
+ ${globalSettings.join('\n')}
53
+
54
+ ### Project Settings (stored in settings.json)
55
+ ${projectSettings.join('\n')}
56
+
57
+ ${modelSection}
58
+ ## Examples
59
+ - Get theme: { "setting": "theme" }
60
+ - Set dark theme: { "setting": "theme", "value": "dark" }
61
+ - Enable vim mode: { "setting": "editorMode", "value": "vim" }
62
+ - Enable verbose: { "setting": "verbose", "value": true }
63
+ - Change model: { "setting": "model", "value": "opus" }
64
+ - Change permission mode: { "setting": "permissions.defaultMode", "value": "plan" }
65
65
  `;
66
66
  }
67
67
  function generateModelSection() {
@@ -71,12 +71,12 @@ function generateModelSection() {
71
71
  const value = o.value === null ? 'null/"default"' : `"${o.value}"`;
72
72
  return ` - ${value}: ${o.descriptionForModel ?? o.description}`;
73
73
  });
74
- return `## Model
75
- - model - Override the default model. Available options:
74
+ return `## Model
75
+ - model - Override the default model. Available options:
76
76
  ${lines.join('\n')}`;
77
77
  }
78
78
  catch {
79
- return `## Model
79
+ return `## Model
80
80
  - model - Override the default model (sonnet, opus, haiku, best, or full model ID)`;
81
81
  }
82
82
  }
@@ -1,30 +1,30 @@
1
1
  export function getEnterWorktreeToolPrompt() {
2
- return `Use this tool ONLY when the user explicitly asks to work in a worktree. This tool creates an isolated git worktree and switches the current session into it.
3
-
4
- ## When to Use
5
-
6
- - The user explicitly says "worktree" (e.g., "start a worktree", "work in a worktree", "create a worktree", "use a worktree")
7
-
8
- ## When NOT to Use
9
-
10
- - The user asks to create a branch, switch branches, or work on a different branch — use git commands instead
11
- - The user asks to fix a bug or work on a feature — use normal git workflow unless they specifically mention worktrees
12
- - Never use this tool unless the user explicitly mentions "worktree"
13
-
14
- ## Requirements
15
-
16
- - Must be in a git repository, OR have WorktreeCreate/WorktreeRemove hooks configured in settings.json
17
- - Must not already be in a worktree
18
-
19
- ## Behavior
20
-
21
- - In a git repository: creates a new git worktree inside \`.claude/worktrees/\` with a new branch based on HEAD
22
- - Outside a git repository: delegates to WorktreeCreate/WorktreeRemove hooks for VCS-agnostic isolation
23
- - Switches the session's working directory to the new worktree
24
- - Use ExitWorktree to leave the worktree mid-session (keep or remove). On session exit, if still in the worktree, the user will be prompted to keep or remove it
25
-
26
- ## Parameters
27
-
28
- - \`name\` (optional): A name for the worktree. If not provided, a random name is generated.
2
+ return `Use this tool ONLY when the user explicitly asks to work in a worktree. This tool creates an isolated git worktree and switches the current session into it.
3
+
4
+ ## When to Use
5
+
6
+ - The user explicitly says "worktree" (e.g., "start a worktree", "work in a worktree", "create a worktree", "use a worktree")
7
+
8
+ ## When NOT to Use
9
+
10
+ - The user asks to create a branch, switch branches, or work on a different branch — use git commands instead
11
+ - The user asks to fix a bug or work on a feature — use normal git workflow unless they specifically mention worktrees
12
+ - Never use this tool unless the user explicitly mentions "worktree"
13
+
14
+ ## Requirements
15
+
16
+ - Must be in a git repository, OR have WorktreeCreate/WorktreeRemove hooks configured in settings.json
17
+ - Must not already be in a worktree
18
+
19
+ ## Behavior
20
+
21
+ - In a git repository: creates a new git worktree inside \`.claude/worktrees/\` with a new branch based on HEAD
22
+ - Outside a git repository: delegates to WorktreeCreate/WorktreeRemove hooks for VCS-agnostic isolation
23
+ - Switches the session's working directory to the new worktree
24
+ - Use ExitWorktree to leave the worktree mid-session (keep or remove). On session exit, if still in the worktree, the user will be prompted to keep or remove it
25
+
26
+ ## Parameters
27
+
28
+ - \`name\` (optional): A name for the worktree. If not provided, a random name is generated.
29
29
  `;
30
30
  }
@@ -13,19 +13,19 @@ export const OFFSET_INSTRUCTION_TARGETED = '- When you already know which part o
13
13
  * the runtime-computed parts.
14
14
  */
15
15
  export function renderPromptTemplate(lineFormat, maxSizeInstruction, offsetInstruction) {
16
- return `Reads a file from the local filesystem. You can access any file directly by using this tool.
17
- Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
18
-
19
- Usage:
20
- - The file_path parameter must be an absolute path, not a relative path
21
- - By default, it reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file${maxSizeInstruction}
22
- ${offsetInstruction}
23
- ${lineFormat}
16
+ return `Reads a file from the local filesystem. You can access any file directly by using this tool.
17
+ Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
18
+
19
+ Usage:
20
+ - The file_path parameter must be an absolute path, not a relative path
21
+ - By default, it reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file${maxSizeInstruction}
22
+ ${offsetInstruction}
23
+ ${lineFormat}
24
24
  - This tool allows Context Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Context Code is a multimodal LLM.${isPDFSupported()
25
25
  ? '\n- This tool can read PDF files (.pdf). For large PDFs (more than 10 pages), you MUST provide the pages parameter to read specific page ranges (e.g., pages: "1-5"). Reading a large PDF without the pages parameter will fail. Maximum 20 pages per request.'
26
- : ''}
27
- - This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
28
- - This tool can only read files, not directories. To read a directory, use an ls command via the ${BASH_TOOL_NAME} tool.
29
- - You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
26
+ : ''}
27
+ - This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
28
+ - This tool can only read files, not directories. To read a directory, use an ls command via the ${BASH_TOOL_NAME} tool.
29
+ - You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
30
30
  - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`;
31
31
  }
@@ -26,12 +26,12 @@ function getSleepGuidance() {
26
26
  isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)) {
27
27
  return null;
28
28
  }
29
- return ` - Avoid unnecessary \`Start-Sleep\` commands:
30
- - Do not sleep between commands that can run immediately — just run them.
31
- - If your command is long running and you would like to be notified when it finishes — simply run your command using \`run_in_background\`. There is no need to sleep in this case.
32
- - Do not retry failing commands in a sleep loop — diagnose the root cause or consider an alternative approach.
33
- - If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll.
34
- - If you must poll an external process, use a check command rather than sleeping first.
29
+ return ` - Avoid unnecessary \`Start-Sleep\` commands:
30
+ - Do not sleep between commands that can run immediately — just run them.
31
+ - If your command is long running and you would like to be notified when it finishes — simply run your command using \`run_in_background\`. There is no need to sleep in this case.
32
+ - Do not retry failing commands in a sleep loop — diagnose the root cause or consider an alternative approach.
33
+ - If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll.
34
+ - If you must poll an external process, use a check command rather than sleeping first.
35
35
  - If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.`;
36
36
  }
37
37
  /**
@@ -41,94 +41,94 @@ function getSleepGuidance() {
41
41
  */
42
42
  function getEditionSection(edition) {
43
43
  if (edition === 'desktop') {
44
- return `PowerShell edition: Windows PowerShell 5.1 (powershell.exe)
45
- - Pipeline chain operators \`&&\` and \`||\` are NOT available — they cause a parser error. To run B only if A succeeds: \`A; if ($?) { B }\`. To chain unconditionally: \`A; B\`.
46
- - Ternary (\`?:\`), null-coalescing (\`??\`), and null-conditional (\`?.\`) operators are NOT available. Use \`if/else\` and explicit \`$null -eq\` checks instead.
47
- - Avoid \`2>&1\` on native executables. In 5.1, redirecting a native command's stderr inside PowerShell wraps each line in an ErrorRecord (NativeCommandError) and sets \`$?\` to \`$false\` even when the exe returned exit code 0. stderr is already captured for you — don't redirect it.
48
- - Default file encoding is UTF-16 LE (with BOM). When writing files other tools will read, pass \`-Encoding utf8\` to \`Out-File\`/\`Set-Content\`.
44
+ return `PowerShell edition: Windows PowerShell 5.1 (powershell.exe)
45
+ - Pipeline chain operators \`&&\` and \`||\` are NOT available — they cause a parser error. To run B only if A succeeds: \`A; if ($?) { B }\`. To chain unconditionally: \`A; B\`.
46
+ - Ternary (\`?:\`), null-coalescing (\`??\`), and null-conditional (\`?.\`) operators are NOT available. Use \`if/else\` and explicit \`$null -eq\` checks instead.
47
+ - Avoid \`2>&1\` on native executables. In 5.1, redirecting a native command's stderr inside PowerShell wraps each line in an ErrorRecord (NativeCommandError) and sets \`$?\` to \`$false\` even when the exe returned exit code 0. stderr is already captured for you — don't redirect it.
48
+ - Default file encoding is UTF-16 LE (with BOM). When writing files other tools will read, pass \`-Encoding utf8\` to \`Out-File\`/\`Set-Content\`.
49
49
  - \`ConvertFrom-Json\` returns a PSCustomObject, not a hashtable. \`-AsHashtable\` is not available.`;
50
50
  }
51
51
  if (edition === 'core') {
52
- return `PowerShell edition: PowerShell 7+ (pwsh)
53
- - Pipeline chain operators \`&&\` and \`||\` ARE available and work like bash. Prefer \`cmd1 && cmd2\` over \`cmd1; cmd2\` when cmd2 should only run if cmd1 succeeds.
54
- - Ternary (\`$cond ? $a : $b\`), null-coalescing (\`??\`), and null-conditional (\`?.\`) operators are available.
52
+ return `PowerShell edition: PowerShell 7+ (pwsh)
53
+ - Pipeline chain operators \`&&\` and \`||\` ARE available and work like bash. Prefer \`cmd1 && cmd2\` over \`cmd1; cmd2\` when cmd2 should only run if cmd1 succeeds.
54
+ - Ternary (\`$cond ? $a : $b\`), null-coalescing (\`??\`), and null-conditional (\`?.\`) operators are available.
55
55
  - Default file encoding is UTF-8 without BOM.`;
56
56
  }
57
57
  // Detection not yet resolved (first prompt build before any tool call) or
58
58
  // PS not installed. Give the conservative 5.1-safe guidance.
59
- return `PowerShell edition: unknown — assume Windows PowerShell 5.1 for compatibility
60
- - Do NOT use \`&&\`, \`||\`, ternary \`?:\`, null-coalescing \`??\`, or null-conditional \`?.\`. These are PowerShell 7+ only and parser-error on 5.1.
59
+ return `PowerShell edition: unknown — assume Windows PowerShell 5.1 for compatibility
60
+ - Do NOT use \`&&\`, \`||\`, ternary \`?:\`, null-coalescing \`??\`, or null-conditional \`?.\`. These are PowerShell 7+ only and parser-error on 5.1.
61
61
  - To chain commands conditionally: \`A; if ($?) { B }\`. Unconditionally: \`A; B\`.`;
62
62
  }
63
63
  export async function getPrompt() {
64
64
  const backgroundNote = getBackgroundUsageNote();
65
65
  const sleepGuidance = getSleepGuidance();
66
66
  const edition = await getPowerShellEdition();
67
- return `Executes a given PowerShell command with optional timeout. Working directory persists between commands; shell state (variables, functions) does not.
68
-
69
- IMPORTANT: This tool is for terminal operations via PowerShell: git, npm, docker, and PS cmdlets. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
70
-
71
- ${getEditionSection(edition)}
72
-
73
- Before executing the command, please follow these steps:
74
-
75
- 1. Directory Verification:
76
- - If the command will create new directories or files, first use \`Get-ChildItem\` (or \`ls\`) to verify the parent directory exists and is the correct location
77
-
78
- 2. Command Execution:
79
- - Always quote file paths that contain spaces with double quotes
80
- - Capture the output of the command.
81
-
82
- PowerShell Syntax Notes:
83
- - Variables use $ prefix: $myVar = "value"
84
- - Escape character is backtick (\`), not backslash
85
- - Use Verb-Noun cmdlet naming: Get-ChildItem, Set-Location, New-Item, Remove-Item
86
- - Common aliases: ls (Get-ChildItem), cd (Set-Location), cat (Get-Content), rm (Remove-Item)
87
- - Pipe operator | works similarly to bash but passes objects, not text
88
- - Use Select-Object, Where-Object, ForEach-Object for filtering and transformation
89
- - String interpolation: "Hello $name" or "Hello $($obj.Property)"
90
- - Registry access uses PSDrive prefixes: \`HKLM:\\SOFTWARE\\...\`, \`HKCU:\\...\` — NOT raw \`HKEY_LOCAL_MACHINE\\...\`
91
- - Environment variables: read with \`$env:NAME\`, set with \`$env:NAME = "value"\` (NOT \`Set-Variable\` or bash \`export\`)
92
- - Call native exe with spaces in path via call operator: \`& "C:\\Program Files\\App\\app.exe" arg1 arg2\`
93
-
94
- Interactive and blocking commands (will hang — this tool runs with -NonInteractive):
95
- - NEVER use \`Read-Host\`, \`Get-Credential\`, \`Out-GridView\`, \`$Host.UI.PromptForChoice\`, or \`pause\`
96
- - Destructive cmdlets (\`Remove-Item\`, \`Stop-Process\`, \`Clear-Content\`, etc.) may prompt for confirmation. Add \`-Confirm:$false\` when you intend the action to proceed. Use \`-Force\` for read-only/hidden items.
97
- - Never use \`git rebase -i\`, \`git add -i\`, or other commands that open an interactive editor
98
-
99
- Passing multiline strings (commit messages, file content) to native executables:
100
- - Use a single-quoted here-string so PowerShell does not expand \`$\` or backticks inside. The closing \`'@\` MUST be at column 0 (no leading whitespace) on its own line — indenting it is a parse error:
101
- <example>
102
- git commit -m @'
103
- Commit message here.
104
- Second line with $literal dollar signs.
105
- '@
106
- </example>
107
- - Use \`@'...'@\` (single-quoted, literal) not \`@"..."@\` (double-quoted, interpolated) unless you need variable expansion
108
- - For arguments containing \`-\`, \`@\`, or other characters PowerShell parses as operators, use the stop-parsing token: \`git log --% --format=%H\`
109
-
110
- Usage notes:
111
- - The command argument is required.
112
- - You can specify an optional timeout in milliseconds (up to ${getMaxTimeoutMs()}ms / ${getMaxTimeoutMs() / 60000} minutes). If not specified, commands will timeout after ${getDefaultTimeoutMs()}ms (${getDefaultTimeoutMs() / 60000} minutes).
113
- - It is very helpful if you write a clear, concise description of what this command does.
114
- - If the output exceeds ${getMaxOutputLength()} characters, output will be truncated before being returned to you.
115
- ${backgroundNote ? backgroundNote + '\n' : ''}\
116
- - Avoid using PowerShell to run commands that have dedicated tools, unless explicitly instructed:
117
- - File search: Use ${GLOB_TOOL_NAME} (NOT Get-ChildItem -Recurse)
118
- - Content search: Use ${GREP_TOOL_NAME} (NOT Select-String)
119
- - Read files: Use ${FILE_READ_TOOL_NAME} (NOT Get-Content)
120
- - Edit files: Use ${FILE_EDIT_TOOL_NAME}
121
- - Write files: Use ${FILE_WRITE_TOOL_NAME} (NOT Set-Content/Out-File)
122
- - Communication: Output text directly (NOT Write-Output/Write-Host)
123
- - When issuing multiple commands:
124
- - If the commands are independent and can run in parallel, make multiple ${POWERSHELL_TOOL_NAME} tool calls in a single message.
125
- - If the commands depend on each other and must run sequentially, chain them in a single ${POWERSHELL_TOOL_NAME} call (see edition-specific chaining syntax above).
126
- - Use \`;\` only when you need to run commands sequentially but don't care if earlier commands fail.
127
- - DO NOT use newlines to separate commands (newlines are ok in quoted strings and here-strings)
128
- - Do NOT prefix commands with \`cd\` or \`Set-Location\` -- the working directory is already set to the correct project directory automatically.
129
- ${sleepGuidance ? sleepGuidance + '\n' : ''}\
130
- - For git commands:
131
- - Prefer to create a new commit rather than amending an existing commit.
132
- - Before running destructive operations (e.g., git reset --hard, git push --force, git checkout --), consider whether there is a safer alternative that achieves the same goal. Only use destructive operations when they are truly the best approach.
67
+ return `Executes a given PowerShell command with optional timeout. Working directory persists between commands; shell state (variables, functions) does not.
68
+
69
+ IMPORTANT: This tool is for terminal operations via PowerShell: git, npm, docker, and PS cmdlets. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
70
+
71
+ ${getEditionSection(edition)}
72
+
73
+ Before executing the command, please follow these steps:
74
+
75
+ 1. Directory Verification:
76
+ - If the command will create new directories or files, first use \`Get-ChildItem\` (or \`ls\`) to verify the parent directory exists and is the correct location
77
+
78
+ 2. Command Execution:
79
+ - Always quote file paths that contain spaces with double quotes
80
+ - Capture the output of the command.
81
+
82
+ PowerShell Syntax Notes:
83
+ - Variables use $ prefix: $myVar = "value"
84
+ - Escape character is backtick (\`), not backslash
85
+ - Use Verb-Noun cmdlet naming: Get-ChildItem, Set-Location, New-Item, Remove-Item
86
+ - Common aliases: ls (Get-ChildItem), cd (Set-Location), cat (Get-Content), rm (Remove-Item)
87
+ - Pipe operator | works similarly to bash but passes objects, not text
88
+ - Use Select-Object, Where-Object, ForEach-Object for filtering and transformation
89
+ - String interpolation: "Hello $name" or "Hello $($obj.Property)"
90
+ - Registry access uses PSDrive prefixes: \`HKLM:\\SOFTWARE\\...\`, \`HKCU:\\...\` — NOT raw \`HKEY_LOCAL_MACHINE\\...\`
91
+ - Environment variables: read with \`$env:NAME\`, set with \`$env:NAME = "value"\` (NOT \`Set-Variable\` or bash \`export\`)
92
+ - Call native exe with spaces in path via call operator: \`& "C:\\Program Files\\App\\app.exe" arg1 arg2\`
93
+
94
+ Interactive and blocking commands (will hang — this tool runs with -NonInteractive):
95
+ - NEVER use \`Read-Host\`, \`Get-Credential\`, \`Out-GridView\`, \`$Host.UI.PromptForChoice\`, or \`pause\`
96
+ - Destructive cmdlets (\`Remove-Item\`, \`Stop-Process\`, \`Clear-Content\`, etc.) may prompt for confirmation. Add \`-Confirm:$false\` when you intend the action to proceed. Use \`-Force\` for read-only/hidden items.
97
+ - Never use \`git rebase -i\`, \`git add -i\`, or other commands that open an interactive editor
98
+
99
+ Passing multiline strings (commit messages, file content) to native executables:
100
+ - Use a single-quoted here-string so PowerShell does not expand \`$\` or backticks inside. The closing \`'@\` MUST be at column 0 (no leading whitespace) on its own line — indenting it is a parse error:
101
+ <example>
102
+ git commit -m @'
103
+ Commit message here.
104
+ Second line with $literal dollar signs.
105
+ '@
106
+ </example>
107
+ - Use \`@'...'@\` (single-quoted, literal) not \`@"..."@\` (double-quoted, interpolated) unless you need variable expansion
108
+ - For arguments containing \`-\`, \`@\`, or other characters PowerShell parses as operators, use the stop-parsing token: \`git log --% --format=%H\`
109
+
110
+ Usage notes:
111
+ - The command argument is required.
112
+ - You can specify an optional timeout in milliseconds (up to ${getMaxTimeoutMs()}ms / ${getMaxTimeoutMs() / 60000} minutes). If not specified, commands will timeout after ${getDefaultTimeoutMs()}ms (${getDefaultTimeoutMs() / 60000} minutes).
113
+ - It is very helpful if you write a clear, concise description of what this command does.
114
+ - If the output exceeds ${getMaxOutputLength()} characters, output will be truncated before being returned to you.
115
+ ${backgroundNote ? backgroundNote + '\n' : ''}\
116
+ - Avoid using PowerShell to run commands that have dedicated tools, unless explicitly instructed:
117
+ - File search: Use ${GLOB_TOOL_NAME} (NOT Get-ChildItem -Recurse)
118
+ - Content search: Use ${GREP_TOOL_NAME} (NOT Select-String)
119
+ - Read files: Use ${FILE_READ_TOOL_NAME} (NOT Get-Content)
120
+ - Edit files: Use ${FILE_EDIT_TOOL_NAME}
121
+ - Write files: Use ${FILE_WRITE_TOOL_NAME} (NOT Set-Content/Out-File)
122
+ - Communication: Output text directly (NOT Write-Output/Write-Host)
123
+ - When issuing multiple commands:
124
+ - If the commands are independent and can run in parallel, make multiple ${POWERSHELL_TOOL_NAME} tool calls in a single message.
125
+ - If the commands depend on each other and must run sequentially, chain them in a single ${POWERSHELL_TOOL_NAME} call (see edition-specific chaining syntax above).
126
+ - Use \`;\` only when you need to run commands sequentially but don't care if earlier commands fail.
127
+ - DO NOT use newlines to separate commands (newlines are ok in quoted strings and here-strings)
128
+ - Do NOT prefix commands with \`cd\` or \`Set-Location\` -- the working directory is already set to the correct project directory automatically.
129
+ ${sleepGuidance ? sleepGuidance + '\n' : ''}\
130
+ - For git commands:
131
+ - Prefer to create a new commit rather than amending an existing commit.
132
+ - Before running destructive operations (e.g., git reset --hard, git push --force, git checkout --), consider whether there is a safer alternative that achieves the same goal. Only use destructive operations when they are truly the best approach.
133
133
  - Never skip hooks (--no-verify) or bypass signing (--no-gpg-sign, -c commit.gpgsign=false) unless the user has explicitly asked for it. If a hook fails, investigate and fix the underlying issue.`;
134
134
  }
@@ -1,12 +1,12 @@
1
1
  export const REMOTE_TRIGGER_TOOL_NAME = 'RemoteTrigger';
2
2
  export const DESCRIPTION = 'Manage scheduled remote Context Code agents (triggers) via the claude.ai CCR API. Auth is handled in-process — the token never reaches the shell.';
3
- export const PROMPT = `Call the claude.ai remote-trigger API. Use this instead of curl — the OAuth token is added automatically in-process and never exposed.
4
-
5
- Actions:
6
- - list: GET /v1/code/triggers
7
- - get: GET /v1/code/triggers/{trigger_id}
8
- - create: POST /v1/code/triggers (requires body)
9
- - update: POST /v1/code/triggers/{trigger_id} (requires body, partial update)
10
- - run: POST /v1/code/triggers/{trigger_id}/run
11
-
3
+ export const PROMPT = `Call the claude.ai remote-trigger API. Use this instead of curl — the OAuth token is added automatically in-process and never exposed.
4
+
5
+ Actions:
6
+ - list: GET /v1/code/triggers
7
+ - get: GET /v1/code/triggers/{trigger_id}
8
+ - create: POST /v1/code/triggers (requires body)
9
+ - update: POST /v1/code/triggers/{trigger_id} (requires body, partial update)
10
+ - run: POST /v1/code/triggers/{trigger_id}/run
11
+
12
12
  The response is the raw JSON from the API.`;
@@ -57,48 +57,48 @@ export function buildCronCreateDescription(durableEnabled) {
57
57
  }
58
58
  export function buildCronCreatePrompt(durableEnabled) {
59
59
  const durabilitySection = durableEnabled
60
- ? `## Durability
61
-
60
+ ? `## Durability
61
+
62
62
  By default (durable: false) the job lives only in this Claude session — nothing is written to disk, and the job is gone when Claude exits. Pass durable: true to write to .claude/scheduled_tasks.json so the job survives restarts. Only use durable: true when the user explicitly asks for the task to persist ("keep doing this every day", "set this up permanently"). Most "remind me in 5 minutes" / "check back in an hour" requests should stay session-only.`
63
- : `## Session-only
64
-
63
+ : `## Session-only
64
+
65
65
  Jobs live only in this Claude session — nothing is written to disk, and the job is gone when Claude exits.`;
66
66
  const durableRuntimeNote = durableEnabled
67
67
  ? 'Durable jobs persist to .claude/scheduled_tasks.json and survive session restarts — on next launch they resume automatically. One-shot durable tasks that were missed while the REPL was closed are surfaced for catch-up. Session-only jobs die with the process. '
68
68
  : '';
69
- return `Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
70
-
71
- Uses standard 5-field cron in the user's local timezone: minute hour day-of-month month day-of-week. "0 9 * * *" means 9am local — no timezone conversion needed.
72
-
73
- ## One-shot tasks (recurring: false)
74
-
75
- For "remind me at X" or "at <time>, do Y" requests — fire once then auto-delete.
76
- Pin minute/hour/day-of-month/month to specific values:
77
- "remind me at 2:30pm today to check the deploy" → cron: "30 14 <today_dom> <today_month> *", recurring: false
78
- "tomorrow morning, run the smoke test" → cron: "57 8 <tomorrow_dom> <tomorrow_month> *", recurring: false
79
-
80
- ## Recurring jobs (recurring: true, the default)
81
-
82
- For "every N minutes" / "every hour" / "weekdays at 9am" requests:
83
- "*/5 * * * *" (every 5 min), "0 * * * *" (hourly), "0 9 * * 1-5" (weekdays at 9am local)
84
-
85
- ## Avoid the :00 and :30 minute marks when the task allows it
86
-
87
- Every user who asks for "9am" gets \`0 9\`, and every user who asks for "hourly" gets \`0 *\` — which means requests from across the planet land on the API at the same instant. When the user's request is approximate, pick a minute that is NOT 0 or 30:
88
- "every morning around 9" → "57 8 * * *" or "3 9 * * *" (not "0 9 * * *")
89
- "hourly" → "7 * * * *" (not "0 * * * *")
90
- "in an hour or so, remind me to..." → pick whatever minute you land on, don't round
91
-
92
- Only use minute 0 or 30 when the user names that exact time and clearly means it ("at 9:00 sharp", "at half past", coordinating with a meeting). When in doubt, nudge a few minutes early or late — the user will not notice, and the fleet will.
93
-
94
- ${durabilitySection}
95
-
96
- ## Runtime behavior
97
-
98
- Jobs only fire while the REPL is idle (not mid-query). ${durableRuntimeNote}The scheduler adds a small deterministic jitter on top of whatever you pick: recurring tasks fire up to 10% of their period late (max 15 min); one-shot tasks landing on :00 or :30 fire up to 90 s early. Picking an off-minute is still the bigger lever.
99
-
100
- Recurring tasks auto-expire after ${DEFAULT_MAX_AGE_DAYS} days — they fire one final time, then are deleted. This bounds session lifetime. Tell the user about the ${DEFAULT_MAX_AGE_DAYS}-day limit when scheduling recurring jobs.
101
-
69
+ return `Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.
70
+
71
+ Uses standard 5-field cron in the user's local timezone: minute hour day-of-month month day-of-week. "0 9 * * *" means 9am local — no timezone conversion needed.
72
+
73
+ ## One-shot tasks (recurring: false)
74
+
75
+ For "remind me at X" or "at <time>, do Y" requests — fire once then auto-delete.
76
+ Pin minute/hour/day-of-month/month to specific values:
77
+ "remind me at 2:30pm today to check the deploy" → cron: "30 14 <today_dom> <today_month> *", recurring: false
78
+ "tomorrow morning, run the smoke test" → cron: "57 8 <tomorrow_dom> <tomorrow_month> *", recurring: false
79
+
80
+ ## Recurring jobs (recurring: true, the default)
81
+
82
+ For "every N minutes" / "every hour" / "weekdays at 9am" requests:
83
+ "*/5 * * * *" (every 5 min), "0 * * * *" (hourly), "0 9 * * 1-5" (weekdays at 9am local)
84
+
85
+ ## Avoid the :00 and :30 minute marks when the task allows it
86
+
87
+ Every user who asks for "9am" gets \`0 9\`, and every user who asks for "hourly" gets \`0 *\` — which means requests from across the planet land on the API at the same instant. When the user's request is approximate, pick a minute that is NOT 0 or 30:
88
+ "every morning around 9" → "57 8 * * *" or "3 9 * * *" (not "0 9 * * *")
89
+ "hourly" → "7 * * * *" (not "0 * * * *")
90
+ "in an hour or so, remind me to..." → pick whatever minute you land on, don't round
91
+
92
+ Only use minute 0 or 30 when the user names that exact time and clearly means it ("at 9:00 sharp", "at half past", coordinating with a meeting). When in doubt, nudge a few minutes early or late — the user will not notice, and the fleet will.
93
+
94
+ ${durabilitySection}
95
+
96
+ ## Runtime behavior
97
+
98
+ Jobs only fire while the REPL is idle (not mid-query). ${durableRuntimeNote}The scheduler adds a small deterministic jitter on top of whatever you pick: recurring tasks fire up to 10% of their period late (max 15 min); one-shot tasks landing on :00 or :30 fire up to 90 s early. Picking an off-minute is still the bigger lever.
99
+
100
+ Recurring tasks auto-expire after ${DEFAULT_MAX_AGE_DAYS} days — they fire one final time, then are deleted. This bounds session lifetime. Tell the user about the ${DEFAULT_MAX_AGE_DAYS}-day limit when scheduling recurring jobs.
101
+
102
102
  Returns a job ID you can pass to ${CRON_DELETE_TOOL_NAME}.`;
103
103
  }
104
104
  export const CRON_DELETE_DESCRIPTION = 'Cancel a scheduled cron job by ID';