elelem 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2885faeaffa4f0ee7eff742f50bbf1ee78f257f7989c6401c787c4d4feb5d6a2
4
- data.tar.gz: '0965d3a94ce8633cd01e7471e5688912216794e9b6af49450d0c1a5326e24645'
3
+ metadata.gz: 0a92bbacb94cf0c5d56ce42a83f48efc0079f59cbafb066a7fdd3a8c382cadc1
4
+ data.tar.gz: 8bdf5148c6e082a070dd528bde2165093cb0e34a82d5c9e7260e24eef0c5b9ca
5
5
  SHA512:
6
- metadata.gz: e00079252cb138588937776e7d37fc28de2e451c1ac72a190f842d29d27df537123a524b3358c6f36a685704b18e5c3a424cd819b3c8eb3ed1259f1937bdf02d
7
- data.tar.gz: c77a7a8b34cf326e812db4ac23a38de0f7841fc1763f18f569a60d783be6719e251ff1eae59234b4da68cb8276c71fb617491ea46d97905ec39e05f5359b405f
6
+ metadata.gz: f9f80b2af42fc637d70dc1fbffc72af9fdb1e1465c7db4a54adf789ae02861e8c306319cb35ebe3152a28bd22fed9202fdd21dba54415492593ea98cfb5fed4d
7
+ data.tar.gz: 6fb3ea9891e2ae9f9e5377791bae7ac46d89303134d8a1d65de87e550be7ddb38f1f12d83cc3e257b32623e232317eb2fc4b48ed3a2d92adf6e2d402d80ae04b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2025-11-26
4
+
5
+ ### Added
6
+ - Updated version to 0.4.1
7
+
3
8
  ## [0.4.0] - 2025-11-10
4
9
 
5
10
  ### Added
@@ -116,3 +121,17 @@
116
121
  ## [0.1.0] - 2025-08-08
117
122
 
118
123
  - Initial release
124
+
125
+ ## [0.4.2] - 2025-11-27
126
+
127
+ ### Added
128
+ - `elelem files` subcommand: generates Claude‑compatible XML file listings.
129
+ - Rake task `files:prompt` to output a ready‑to‑copy list of files for prompts.
130
+
131
+ ### Changed
132
+ - Refactor tool‑call formatting to a more compact JSON payload for better LLM parsing.
133
+ - Updated CI and documentation to use GitHub instead of previous hosting.
134
+ - Runtime validation of command‑line parameters against a JSON schema.
135
+
136
+ ### Fixed
137
+ - Minor documentation and CI workflow adjustments.
data/Rakefile CHANGED
@@ -5,4 +5,15 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
+ task :files do
9
+ IO.popen(%w[git ls-files], chdir: __dir__, err: IO::NULL) do |ls|
10
+ ls.readlines.each do |f|
11
+ next if f.start_with?(*%w[bin/ spec/ pkg/ .git .rspec Gemfile Rakefile])
12
+ next if f.strip.end_with?(*%w[.toml .txt .md])
13
+
14
+ puts f
15
+ end
16
+ end
17
+ end
18
+
8
19
  task default: %i[spec]
data/lib/elelem/agent.rb CHANGED
@@ -65,20 +65,12 @@ module Elelem
65
65
  HELP
66
66
  end
67
67
 
68
- def format_tool_call(name, args)
69
- case name
70
- when "execute"
71
- cmd = args["cmd"]
72
- cmd_args = args["args"] || []
73
- cmd_args.empty? ? cmd : "#{cmd} #{cmd_args.join(' ')}"
74
- when "grep" then "grep(#{args["query"]})"
75
- when "list" then "list(#{args["path"] || "."})"
76
- when "patch" then "patch(#{args["diff"]&.lines&.count || 0} lines)"
77
- when "read" then "read(#{args["path"]})"
78
- when "write" then "write(#{args["path"]})"
79
- else
80
- "#{name}(#{args.to_s[0...50]})"
81
- end
68
+ def format_tool_call_result(result)
69
+ return result["stdout"] if result["stdout"]
70
+ return result["stderr"] if result["stderr"]
71
+ return result[:error] if result[:error]
72
+
73
+ ""
82
74
  end
83
75
 
84
76
  def execute_turn(messages, tools:)
@@ -110,8 +102,9 @@ module Elelem
110
102
  name = call.dig("function", "name")
111
103
  args = call.dig("function", "arguments")
112
104
 
113
- puts "Tool> #{format_tool_call(name, args)}"
105
+ puts "Tool> #{name}(#{args})"
114
106
  result = toolbox.run_tool(name, args)
107
+ puts format_tool_call_result(result)
115
108
  turn_context << { role: "tool", content: JSON.dump(result) }
116
109
  end
117
110
 
@@ -13,7 +13,6 @@ module Elelem
13
13
  type: :string,
14
14
  desc: "Ollama model",
15
15
  default: ENV.fetch("OLLAMA_MODEL", "gpt-oss")
16
-
17
16
  def chat(*)
18
17
  client = Net::Llm::Ollama.new(
19
18
  host: options[:host],
@@ -24,6 +23,20 @@ module Elelem
24
23
  agent.repl
25
24
  end
26
25
 
26
+ desc "files", "Generate CXML of the files"
27
+ def files
28
+ puts '<documents>'
29
+ $stdin.read.split("\n").map(&:strip).reject(&:empty?).each_with_index do |file, i|
30
+ next unless File.file?(file)
31
+
32
+ puts " <document index=\"#{i + 1}\">"
33
+ puts " <source><![CDATA[#{file}]]></source>"
34
+ puts " <document_content><![CDATA[#{File.read(file)}]]></document_content>"
35
+ puts " </document>"
36
+ end
37
+ puts '</documents>'
38
+ end
39
+
27
40
  desc "version", "The version of this CLI"
28
41
  def version
29
42
  say "v#{Elelem::VERSION}"
@@ -1,4 +1,4 @@
1
- You are a reasoning coding and system agent.
1
+ You are a reasoning coding and system agent working from: <%= Dir.pwd %>.
2
2
 
3
3
  - Less is more
4
4
  - No code comments
data/lib/elelem/tool.rb CHANGED
@@ -17,8 +17,7 @@ module Elelem
17
17
  end
18
18
 
19
19
  def valid?(args)
20
- # TODO:: Use JSON Schema Validator
21
- true
20
+ JSON::Validator.validate(@schema.dig(:function, :parameters), args)
22
21
  end
23
22
 
24
23
  def to_h
@@ -8,7 +8,7 @@ module Elelem
8
8
  full_path.exist? ? { content: full_path.read } : { error: "File not found: #{path}" }
9
9
  end
10
10
 
11
- EXEC_TOOL = Tool.build("execute", "Execute shell commands directly. Commands run in a shell context. Examples: 'date', 'git status'.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
11
+ EXEC_TOOL = Tool.build("execute", "Run shell commands. For git: execute({\"cmd\": \"git\", \"args\": [\"log\", \"--oneline\"]}). Returns stdout/stderr/exit_status.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
12
12
  Elelem.shell.execute(
13
13
  args["cmd"],
14
14
  args: args["args"] || [],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Elelem
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elelem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -198,14 +198,14 @@ files:
198
198
  - lib/elelem/tool.rb
199
199
  - lib/elelem/toolbox.rb
200
200
  - lib/elelem/version.rb
201
- homepage: https://gitlab.com/mokhax/elelem
201
+ homepage: https://github.com/xlgmokha/elelem
202
202
  licenses:
203
203
  - MIT
204
204
  metadata:
205
205
  allowed_push_host: https://rubygems.org
206
- homepage_uri: https://gitlab.com/mokhax/elelem
207
- source_code_uri: https://gitlab.com/mokhax/elelem
208
- changelog_uri: https://gitlab.com/mokhax/elelem/-/blob/main/CHANGELOG.md
206
+ homepage_uri: https://github.com/xlgmokha/elelem
207
+ source_code_uri: https://github.com/xlgmokha/elelem
208
+ changelog_uri: https://github.com/xlgmokha/elelem/blob/main/CHANGELOG.md
209
209
  rdoc_options: []
210
210
  require_paths:
211
211
  - lib