@@ -32,8 +32,10 @@ function M.setup()
3232 })
3333
3434 vim .api .nvim_create_user_command (" EcaAddFile" , function (opts )
35- if opts .args and opts .args ~= " " then
36- require (" eca.api" ).add_file_context (opts .args )
35+ Logger .notify (" EcaAddFile is deprecated. Use EcaChatAddFile instead." , vim .log .levels .WARN )
36+
37+ if opts .args and opts .args ~= " " and type (opts .args ) == " string" then
38+ require (" eca.api" ).add_file_context (vim .fn .fnamemodify (opts .args , " :p" ))
3739 else
3840 require (" eca.api" ).add_current_file_context ()
3941 end
@@ -43,102 +45,98 @@ function M.setup()
4345 complete = " file" ,
4446 })
4547
46- vim .api .nvim_create_user_command (" EcaAddSelection" , function ()
47- -- Force exit visual mode and set marks
48- vim .cmd (" normal! \\ <Esc>" )
49- vim .defer_fn (function ()
50- require (" eca.api" ).add_selection_context ()
51- end , 50 ) -- Small delay to ensure marks are set
52- end , {
53- desc = " Add current selection as context to ECA" ,
54- range = true ,
55- })
56-
57- vim .api .nvim_create_user_command (" EcaListContexts" , function ()
58- require (" eca.api" ).list_contexts ()
59- end , {
60- desc = " List active contexts in ECA" ,
61- })
62-
63- vim .api .nvim_create_user_command (" EcaClearContexts" , function ()
64- require (" eca.api" ).clear_contexts ()
48+ vim .api .nvim_create_user_command (" EcaChatAddFile" , function (opts )
49+ if opts .args and opts .args ~= " " and type (opts .args ) == " string" then
50+ require (" eca.api" ).add_file_context (vim .fn .fnamemodify (opts .args , " :p" ))
51+ else
52+ require (" eca.api" ).add_current_file_context ()
53+ end
6554 end , {
66- desc = " Clear all contexts from ECA" ,
55+ desc = " Add file as context to ECA" ,
56+ nargs = " ?" ,
57+ complete = " file" ,
6758 })
6859
6960 vim .api .nvim_create_user_command (" EcaRemoveContext" , function (opts )
70- if opts .args and opts .args ~= " " then
71- require (" eca.api" ).remove_context (opts .args )
61+ Logger .notify (" EcaRemoveContext is deprecated. Use EcaChatRemoveFile instead." , vim .log .levels .WARN )
62+
63+ if opts .args and opts .args ~= " " and type (opts .args ) == " string" then
64+ require (" eca.api" ).remove_file_context (vim .fn .fnamemodify (opts .args , " :p" ))
7265 else
73- Logger . notify ( " Please provide a file path to remove " , vim . log . levels . WARN )
66+ require ( " eca.api " ). remove_current_file_context ( )
7467 end
7568 end , {
76- desc = " Remove specific context from ECA" ,
77- nargs = " + " ,
69+ desc = " Remove specific file context from ECA" ,
70+ nargs = " ? " ,
7871 complete = " file" ,
7972 })
8073
81- vim .api .nvim_create_user_command (" EcaAddRepoMap" , function ()
82- require (" eca.api" ).add_repo_map_context ()
74+ vim .api .nvim_create_user_command (" EcaChatRemoveFile" , function (opts )
75+ if opts .args and opts .args ~= " " and type (opts .args ) == " string" then
76+ require (" eca.api" ).remove_file_context (vim .fn .fnamemodify (opts .args , " :p" ))
77+ else
78+ require (" eca.api" ).remove_current_file_context ()
79+ end
8380 end , {
84- desc = " Add repository map context to ECA" ,
81+ desc = " Remove specific file context from ECA" ,
82+ nargs = " ?" ,
83+ complete = " file" ,
8584 })
8685
87- -- ===== Selected Code Commands =====
86+ vim .api .nvim_create_user_command (" EcaAddSelection" , function ()
87+ Logger .notify (" EcaAddSelection is deprecated. Use EcaChatAddSelection instead." , vim .log .levels .WARN )
8888
89- vim .api .nvim_create_user_command (" EcaShowSelection" , function ()
90- require (" eca.api" ).show_selected_code ()
89+ -- Force exit visual mode and set marks
90+ vim .cmd (" normal! \\ <Esc>" )
91+ vim .defer_fn (function ()
92+ require (" eca.api" ).add_selection_context ()
93+ end , 50 ) -- Small delay to ensure marks are set
9194 end , {
92- desc = " Show currently selected code in ECA" ,
95+ desc = " Add current selection as context to ECA" ,
96+ range = true ,
9397 })
9498
95- vim .api .nvim_create_user_command (" EcaClearSelection" , function ()
96- require (" eca.api" ).clear_selected_code ()
99+ vim .api .nvim_create_user_command (" EcaChatAddSelection" , function ()
100+ -- Force exit visual mode and set marks
101+ vim .cmd (" normal! \\ <Esc>" )
102+ vim .defer_fn (function ()
103+ require (" eca.api" ).add_selection_context ()
104+ end , 50 ) -- Small delay to ensure marks are set
97105 end , {
98- desc = " Clear selected code from ECA" ,
106+ desc = " Add current selection as context to ECA" ,
107+ range = true ,
99108 })
100109
101- -- ===== TODOs Commands =====
110+ vim .api .nvim_create_user_command (" EcaListContexts" , function ()
111+ Logger .notify (" EcaListContexts is deprecated. Use EcaChatListContexts instead." )
102112
103- vim .api .nvim_create_user_command (" EcaAddTodo" , function (opts )
104- if opts .args and opts .args ~= " " then
105- require (" eca.api" ).add_todo (opts .args )
106- else
107- Logger .notify (" Please provide TODO content" , vim .log .levels .WARN )
108- end
113+ require (" eca.api" ).list_contexts ()
109114 end , {
110- desc = " Add a new TODO to ECA" ,
111- nargs = " +" ,
115+ desc = " List active contexts in ECA" ,
112116 })
113117
114- vim .api .nvim_create_user_command (" EcaListTodos " , function ()
115- require (" eca.api" ).list_todos ()
118+ vim .api .nvim_create_user_command (" EcaChatListContexts " , function ()
119+ require (" eca.api" ).list_contexts ()
116120 end , {
117- desc = " List active TODOs in ECA" ,
121+ desc = " List active contexts in ECA" ,
118122 })
119123
120- vim .api .nvim_create_user_command (" EcaToggleTodo" , function (opts )
121- if opts .args and opts .args ~= " " then
122- local index = tonumber (opts .args )
123- if index then
124- require (" eca.api" ).toggle_todo (index )
125- else
126- Logger .notify (" Please provide a valid TODO index" , vim .log .levels .WARN )
127- end
128- else
129- Logger .notify (" Please provide TODO index to toggle" , vim .log .levels .WARN )
130- end
124+ vim .api .nvim_create_user_command (" EcaClearContexts" , function ()
125+ Logger .notify (" EcaClearContexts is deprecated. Use EcaChatClearContexts instead." )
126+
127+ require (" eca.api" ).clear_contexts ()
131128 end , {
132- desc = " Toggle TODO completion status" ,
133- nargs = 1 ,
129+ desc = " Clear all contexts from ECA" ,
134130 })
135131
136- vim .api .nvim_create_user_command (" EcaClearTodos " , function ()
137- require (" eca.api" ).clear_todos ()
132+ vim .api .nvim_create_user_command (" EcaChatClearContexts " , function ()
133+ require (" eca.api" ).clear_contexts ()
138134 end , {
139- desc = " Clear all TODOs from ECA" ,
135+ desc = " Clear all contexts from ECA" ,
140136 })
141137
138+ -- ===== Server Commands =====
139+
142140 vim .api .nvim_create_user_command (" EcaServerStart" , function ()
143141 require (" eca.api" ).start_server ()
144142 end , {
0 commit comments