Skip to content

Commit 90a3cd4

Browse files
committed
Remove redundant non-null assertions on agent docs_url, update Codex CLI edit and ask args, and fix hunk header parsing in generate_diff_markdown
- the generated diff markdown is incorrect: [Pasted text] whereas file is: [Pasted text] (there is [Pasted text] prematurely) └── apps └── editor └── src └── utils └── agentic-cli-invocation ├── agents │ ├── antigravity.ts │ ├── claude.ts │ ├── codex.ts │ ├── cursor.ts │ ├── grok.ts │ ├── index.ts │ ├── muse.ts │ └── opencode.ts ├── index.ts ├── invoke-agentic-cli.ts ├── types.ts └── utils ├── check-command-exists.ts ├── format-duration.ts ├── generate-diff-markdown.ts └── get-progress-dots.ts
1 parent f49d238 commit 90a3cd4

8 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎apps/editor/src/utils/agentic-cli-invocation/agents/antigravity.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const antigravity_agent: CodingAgent = {
1313
label: agent_name,
1414
cmd: 'agy',
1515
is_installed: () => check_command_exists('agy'),
16-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
16+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1717
get_edit_args: (prompt: string) => [
1818
'-p',
1919
prompt,

‎apps/editor/src/utils/agentic-cli-invocation/agents/claude.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const claude_agent: CodingAgent = {
2929
label: agent_name,
3030
cmd: 'claude',
3131
is_installed: () => check_command_exists('claude'),
32-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
32+
get_documentation_url: () => AGENTS[agent_name].docs_url,
3333
get_edit_args: (prompt: string) => [
3434
'-p',
3535
prompt,

‎apps/editor/src/utils/agentic-cli-invocation/agents/codex.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@ export const codex_agent: CodingAgent = {
1313
label: agent_name,
1414
cmd: 'codex',
1515
is_installed: () => check_command_exists('codex'),
16-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
16+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1717
get_edit_args: (prompt: string) => [
1818
'exec',
1919
prompt,
2020
'--json',
21-
'--ephemeral',
2221
'--sandbox',
23-
'workspace-write'
24-
],
25-
get_ask_args: (prompt: string) => [
26-
prompt,
27-
'--ephemeral',
28-
'--sandbox',
29-
'read-only'
22+
'workspace-write',
23+
'--skip-git-repo-check'
3024
],
25+
get_ask_args: (prompt: string) => [prompt, '--sandbox', 'read-only'],
3126
parse_stream_line: (parsed, report_progress) => {
3227
if (parsed.type == 'item.started' && parsed.item) {
3328
const item = parsed.item

‎apps/editor/src/utils/agentic-cli-invocation/agents/cursor.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const cursor_agent: CodingAgent = {
99
label: agent_name,
1010
cmd: 'agent',
1111
is_installed: () => check_command_exists('agent'),
12-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
12+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1313
get_edit_args: (prompt: string) => [
1414
'-p',
1515
prompt,

‎apps/editor/src/utils/agentic-cli-invocation/agents/grok.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const grok_agent: CodingAgent = {
1111
label: agent_name,
1212
cmd: 'grok',
1313
is_installed: () => check_command_exists('grok'),
14-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
14+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1515
get_edit_args: (prompt: string) => {
1616
accumulated_output = ''
1717
return [

‎apps/editor/src/utils/agentic-cli-invocation/agents/muse.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const muse_agent: CodingAgent = {
1414
label: agent_name,
1515
cmd: 'muse',
1616
is_installed: () => check_command_exists('muse'),
17-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
17+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1818
get_edit_args: (prompt: string) => {
1919
accumulated_output = ''
2020
return ['exec', '--json', '--yolo', prompt]

‎apps/editor/src/utils/agentic-cli-invocation/agents/opencode.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const opencode_agent: CodingAgent = {
1313
label: agent_name,
1414
cmd: 'opencode',
1515
is_installed: () => check_command_exists('opencode'),
16-
get_documentation_url: () => AGENTS[agent_name].docs_url!,
16+
get_documentation_url: () => AGENTS[agent_name].docs_url,
1717
get_edit_args: (prompt: string) => [
1818
'run',
1919
prompt,

‎apps/editor/src/utils/agentic-cli-invocation/utils/generate-diff-markdown.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,21 @@ export const generate_diff_markdown = async (
5858
const stdout: string = err.stdout
5959
const diff_lines = stdout.split('\n')
6060
const at_at_index = diff_lines.findIndex((l) =>
61-
l.startsWith('@@ ')
61+
l.startsWith('@@')
6262
)
6363
if (at_at_index !== -1) {
64-
const diff_body = diff_lines.slice(at_at_index).join('\n')
64+
const diff_body = diff_lines
65+
.slice(at_at_index)
66+
.map((line) => {
67+
if (line.startsWith('@@')) {
68+
const match = line.match(/^(@@ .+? @@)/)
69+
if (match) {
70+
return match[1]
71+
}
72+
}
73+
return line
74+
})
75+
.join('\n')
6576
diff_markdown +=
6677
'\n### Updated file: `' +
6778
unix_rel_path +

0 commit comments

Comments
 (0)