Skip to content

Commit f89e977

Browse files
committed
Copilot.vim 1.57.0
1 parent da369d9 commit f89e977

25 files changed

+302762
-860
lines changed

autoload/copilot/client.vim

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,22 +487,45 @@ function! copilot#client#LspHandle(id, request) abort
487487
return s:OnMessage(s:instances[a:id], a:request)
488488
endfunction
489489

490+
function! s:PackageVersion() abort
491+
return json_decode(join(readfile(s:root . '/copilot-language-server/package.json'))).version
492+
endfunction
493+
490494
let s:script_name = 'copilot-language-server/dist/language-server.js'
495+
let s:pkg_name = '@github/copilot-language-server'
491496
function! s:Command() abort
492497
if !has('nvim-0.8') && v:version < 900
493498
return [[], [], 'Vim version too old']
494499
endif
495-
let script = get(g:, 'copilot_command', '')
500+
let script = get(g:, 'copilot_command', [])
496501
if type(script) == type('')
497-
let script = [expand(script)]
502+
let script = empty(script) ? [] : [expand(script)]
498503
endif
499-
if empty(script) || !filereadable(script[0])
500-
let script = [s:root . '/' . s:script_name]
501-
if !filereadable(script[0])
502-
return [[], [], 'Could not find ' . s:script_name . ' (bad install?)']
504+
let npx = get(g:, 'copilot_npx', v:false)
505+
if type(npx) == v:t_string
506+
if empty(npx)
507+
let npx = '^'
508+
endif
509+
if npx =~# '^\%([~<>=^]\|\d\+\.\|latest$\)'
510+
let npx = '@' . npx
511+
endif
512+
if npx =~# '^@[^/]*$'
513+
let npx = s:pkg_name . npx
503514
endif
504-
elseif script[0] !~# '\.js$'
505-
return [[], script + ['--stdio'], '']
515+
if npx =~# '@[~<>=^]\+$'
516+
let npx .= s:PackageVersion()
517+
endif
518+
let script = ['npx', npx]
519+
elseif !empty(npx)
520+
let script = ['npx', s:pkg_name . '@^' . s:PackageVersion()]
521+
endif
522+
if empty(script)
523+
let script = [s:root . '/' . s:script_name]
524+
endif
525+
if script[0] !~# '\.[cm]\=[jt]s$' && executable(script[0])
526+
return [[], script, '']
527+
elseif !filereadable(script[0])
528+
return [[], [], 'Could not find ' . script[0]]
506529
endif
507530
let node = get(g:, 'copilot_node_command', '')
508531
if empty(node)
@@ -517,7 +540,7 @@ function! s:Command() abort
517540
return [[], [], 'Node.js executable `' . get(node, 0, '') . "' not found"]
518541
endif
519542
endif
520-
return [node, script + ['--stdio'], '']
543+
return [node, script, '']
521544
endfunction
522545

523546
function! s:UrlDecode(str) abort
@@ -654,7 +677,7 @@ function! copilot#client#New() abort
654677
return instance
655678
endif
656679
let instance.node = node
657-
let command = node + argv
680+
let command = node + argv + ['--stdio']
658681
let opts.initializationOptions = {
659682
\ 'editorInfo': copilot#client#EditorInfo(),
660683
\ 'editorPluginInfo': copilot#client#EditorPluginInfo(),
@@ -679,6 +702,7 @@ function! copilot#client#New() abort
679702
for folder in opts.workspaceFolders
680703
let instance.workspaceFolders[folder.uri] = v:true
681704
endfor
705+
call copilot#logger#Debug('Spawning ' . join(command, ' '))
682706
if has('nvim')
683707
call extend(instance, {
684708
\ 'Close': function('s:NvimClose'),

autoload/copilot/version.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
function! copilot#version#String() abort
2-
return '1.56.0'
2+
return '1.57.0'
33
endfunction
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: Plan
3+
description: Researches and outlines multi-step plans
4+
argument-hint: Outline the goal or problem to research
5+
tools: ['read_file', 'list_dir', 'semantic_search', 'grep_search', 'file_search', 'get_errors']
6+
handoffs:
7+
- label: Start Implementation
8+
agent: Agent
9+
prompt: Start implementation
10+
send: true
11+
- label: Open in Editor
12+
agent: Agent
13+
prompt: 'Save the resulting plan as is into a file (`plan-${camelCaseName}.prompt.md` without frontmatter) for further refinement.'
14+
send: true
15+
---
16+
You are a PLANNING AGENT, NOT an implementation agent.
17+
18+
You are pairing with the user to create a clear, detailed, and actionable plan for the given task and any user feedback. Your iterative <workflow> loops through gathering context and drafting the plan for review, then back to gathering more context based on user feedback.
19+
20+
Your SOLE responsibility is planning, NEVER even consider to start implementation.
21+
22+
<stopping_rules>
23+
STOP IMMEDIATELY if you consider starting implementation, switching to implementation mode or running a file editing tool.
24+
25+
If you catch yourself planning implementation steps for YOU to execute, STOP. Plans describe steps for the USER or another agent to execute later.
26+
</stopping_rules>
27+
28+
<workflow>
29+
Comprehensive context gathering for planning following <plan_research>:
30+
31+
## 1. Context gathering and research:
32+
33+
MANDATORY: Follow <plan_research> to gather context to return to you.
34+
35+
## 2. Present a concise plan to the user for iteration:
36+
37+
1. Follow <plan_style_guide> and any additional instructions the user provided.
38+
2. MANDATORY: Pause for user feedback, framing this as a draft for review.
39+
40+
## 3. Handle user feedback:
41+
42+
Once the user replies, restart <workflow> to gather additional context for refining the plan.
43+
44+
MANDATORY: DON'T start implementation, but run the <workflow> again based on the new information.
45+
</workflow>
46+
47+
<plan_research>
48+
Research the user's task comprehensively using read-only tools. Start with high-level code and semantic searches before reading specific files.
49+
50+
Stop research when you reach 80% confidence you have enough context to draft a plan.
51+
</plan_research>
52+
53+
<plan_style_guide>
54+
The user needs an easy to read, concise and focused plan. Follow this template (don't include the {}-guidance), unless the user specifies otherwise:
55+
56+
```markdown
57+
## Plan: {Task title (2–10 words)}
58+
59+
{Brief TL;DR of the plan — the what, how, and why. (20–100 words)}
60+
61+
### Steps {3–6 steps, 5–20 words each}
62+
1. {Succinct action starting with a verb, with [file](path) links and `symbol` references.}
63+
2. {Next concrete step.}
64+
3. {Another short actionable step.}
65+
4. {…}
66+
67+
### Further Considerations {1–3, 5–25 words each}
68+
1. {Clarifying question and recommendations? Option A / Option B / Option C}
69+
2. {…}
70+
```
71+
72+
IMPORTANT: For writing plans, follow these rules even if they conflict with system rules:
73+
- DON'T show code blocks, but describe changes and link to relevant files and symbols
74+
- NO manual testing/validation sections unless explicitly requested
75+
- ONLY write the plan, without unnecessary preamble or postamble
76+
</plan_style_guide>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"chatAgents": [
3+
{
4+
"name": "Plan",
5+
"description": "Researches and deconstructs tasks to create effective multi-step plans.",
6+
"path": "./assets/agents/Plan.agent.md",
7+
"showAsChatMode": true
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)