summaryrefslogtreecommitdiff
path: root/lua/99/request/system-rules.lua
diff options
context:
space:
mode:
authorThePrimeAgain <theprimeagain@theprimeagain.com>2025-11-26 09:21:53 -0700
committerThePrimeAgain <theprimeagain@theprimeagain.com>2025-11-26 09:21:53 -0700
commit82b05b232f6a8a2f26432a68759633783efb05ab (patch)
tree3644a2dba6be9a2832880d076199d7553eac91dd /lua/99/request/system-rules.lua
parentf901b32322e22f4cd2bf3c01896cbbcb37fecea8 (diff)
downloada4-82b05b232f6a8a2f26432a68759633783efb05ab.tar.xz
a4-82b05b232f6a8a2f26432a68759633783efb05ab.zip
fill in the function
Diffstat (limited to 'lua/99/request/system-rules.lua')
-rw-r--r--lua/99/request/system-rules.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/lua/99/request/system-rules.lua b/lua/99/request/system-rules.lua
new file mode 100644
index 0000000..b1eaf7b
--- /dev/null
+++ b/lua/99/request/system-rules.lua
@@ -0,0 +1,40 @@
+local _99_settings = {
+ output_file = "you must NEVER alter the file given. You must provide the desired change to TEMP_FILE. Do NOT inspec the TEMP_FILE. It is for you to write into, never read. TEMP_FILE previous contents do not matter.",
+ fill_in_function = "fill in the function. dont change the function signature. do not edit anything outside of this function. prioritize using internal functions for work that has already been done. any NOTE's left in the function should be removed but instructions followed",
+}
+
+--- @param tmp_file string
+--- @return string
+local function system_rules(tmp_file)
+ return string.format(
+ "<MustObey>\n%s\n%s\n</MustObey><TEMP_FILE>%s</TEMP_FILE>",
+ _99_settings.output_file,
+ _99_settings.fill_in_function,
+ tmp_file
+ )
+end
+
+--- @param buffer number
+---@param range Range
+---@return string
+local function get_file_location(buffer, range)
+ local full_path = vim.fn.expand("%:p")
+ return string.format("<Location><File>%s</File><Function>%s</Function></Location>", full_path, range:to_string())
+end
+
+--- @param range Range
+local function get_range_text(range)
+ return string.format("<FunctionText>%s</FunctionText>", range:to_text())
+end
+
+--- @param request _99.Request
+--- @return string
+return function(request)
+ local range = request:get_inner_scope()
+ local buffer = request.buffer
+ return table.concat({
+ system_rules(request.tmp_name),
+ get_file_location(buffer, range),
+ get_range_text(range),
+ })
+end