agent-context 0.1.3 → 0.2.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/agent.md +2 -0
- data/lib/agent/context/index.rb +2 -0
- data/lib/agent/context/installer.rb +18 -21
- data/lib/agent/context/version.rb +1 -1
- data/post.md +7 -2
- data/readme.md +18 -1
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 788628a6f37f9d5b903a2ff5925198ac462c548c60982dc26bd343c16d3fe385
|
4
|
+
data.tar.gz: 92906fb976b9190dca498e6c7b1ab8a506c31def843440c244a70fbb0d3bb449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e275a751175acbbc81843a8a814d0cbf46d009526aa3d21f60332fdaedd9507d63c98ae49a2f5ccf50491aae064a9c50f25f0bba9e050f4d245fb43b6ba55d
|
7
|
+
data.tar.gz: ff10810cb0cfe267d39c6f57ea6a75b3cc974a42bd20b3440e2f68fbfaf05ea944b6f155f23d3b00c7918ea4610649b7d60d1195a6fcfe9599e95075793a966c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/agent.md
CHANGED
@@ -6,6 +6,8 @@ This section provides links to documentation from installed packages. It is auto
|
|
6
6
|
|
7
7
|
**Important:** Before performing any code, documentation, or analysis tasks, always read and apply the full content of any relevant documentation referenced in the following sections. These context files contain authoritative standards and best practices for documentation, code style, and project-specific workflows. **Do not proceed with any actions until you have read and incorporated the guidance from relevant context files.**
|
8
8
|
|
9
|
+
**Setup Instructions:** If the referenced files are not present or if dependencies have been updated, run `bake agent:context:install` to install the latest context files.
|
10
|
+
|
9
11
|
### decode
|
10
12
|
|
11
13
|
Code analysis for documentation generation.
|
data/lib/agent/context/index.rb
CHANGED
@@ -48,6 +48,8 @@ module Agent
|
|
48
48
|
sections << ""
|
49
49
|
sections << "**Important:** Before performing any code, documentation, or analysis tasks, always read and apply the full content of any relevant documentation referenced in the following sections. These context files contain authoritative standards and best practices for documentation, code style, and project-specific workflows. **Do not proceed with any actions until you have read and incorporated the guidance from relevant context files.**"
|
50
50
|
sections << ""
|
51
|
+
sections << "**Setup Instructions:** If the referenced files are not present or if dependencies have been updated, run `bake agent:context:install` to install the latest context files."
|
52
|
+
sections << ""
|
51
53
|
|
52
54
|
gem_contexts = collect_gem_contexts
|
53
55
|
|
@@ -25,7 +25,7 @@ module Agent
|
|
25
25
|
"troubleshooting",
|
26
26
|
"debugging"
|
27
27
|
]
|
28
|
-
|
28
|
+
|
29
29
|
# Initialize a new Installer instance.
|
30
30
|
#
|
31
31
|
# @parameter root [String] The root directory to work from (default: current directory).
|
@@ -37,11 +37,11 @@ module Agent
|
|
37
37
|
end
|
38
38
|
|
39
39
|
attr_reader :context_path
|
40
|
-
|
40
|
+
|
41
41
|
# Find all gems that have a context directory
|
42
42
|
def find_gems_with_context(skip_local: true)
|
43
43
|
gems_with_context = []
|
44
|
-
|
44
|
+
|
45
45
|
@specifications.each do |spec|
|
46
46
|
# Skip gems loaded from current working directory if requested:
|
47
47
|
next if skip_local && spec.full_gem_path == @root
|
@@ -57,17 +57,17 @@ module Agent
|
|
57
57
|
}
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
gems_with_context
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
# Find a specific gem with context.
|
65
65
|
def find_gem_with_context(gem_name)
|
66
66
|
spec = @specifications.find {|spec| spec.name == gem_name}
|
67
67
|
return nil unless spec
|
68
|
-
|
68
|
+
|
69
69
|
context_path = File.join(spec.full_gem_path, "context")
|
70
|
-
|
70
|
+
|
71
71
|
if Dir.exist?(context_path)
|
72
72
|
{
|
73
73
|
name: spec.name,
|
@@ -80,33 +80,33 @@ module Agent
|
|
80
80
|
nil
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
# List context files for a gem.
|
85
85
|
def list_context_files(gem_name)
|
86
86
|
gem = find_gem_with_context(gem_name)
|
87
87
|
return nil unless gem
|
88
|
-
|
88
|
+
|
89
89
|
Dir.glob(File.join(gem[:path], "**/*")).select {|f| File.file?(f)}
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
# Show content of a specific context file.
|
93
93
|
def show_context_file(gem_name, file_name)
|
94
94
|
gem = find_gem_with_context(gem_name)
|
95
95
|
return nil unless gem
|
96
|
-
|
96
|
+
|
97
97
|
# Try to find the file with or without extension:
|
98
98
|
possible_paths = [
|
99
99
|
File.join(gem[:path], file_name),
|
100
100
|
File.join(gem[:path], "#{file_name}.md"),
|
101
101
|
File.join(gem[:path], "#{file_name}.md")
|
102
102
|
]
|
103
|
-
|
103
|
+
|
104
104
|
file_path = possible_paths.find {|path| File.exist?(path)}
|
105
105
|
return nil unless file_path
|
106
|
-
|
106
|
+
|
107
107
|
File.read(file_path)
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
# Install context from a specific gem.
|
111
111
|
def install_gem_context(gem_name)
|
112
112
|
gem = find_gem_with_context(gem_name)
|
@@ -127,18 +127,18 @@ module Agent
|
|
127
127
|
|
128
128
|
true
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
# Install context from all gems.
|
132
132
|
def install_all_context(skip_local: true)
|
133
133
|
gems = find_gems_with_context(skip_local: skip_local)
|
134
134
|
installed = []
|
135
|
-
|
135
|
+
|
136
136
|
gems.each do |gem|
|
137
137
|
if install_gem_context(gem[:name])
|
138
138
|
installed << gem[:name]
|
139
139
|
end
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
installed
|
143
143
|
end
|
144
144
|
|
@@ -183,7 +183,7 @@ module Agent
|
|
183
183
|
unless File.exist?(index_path)
|
184
184
|
# Generate dynamic index from gemspec
|
185
185
|
index = generate_dynamic_index(gem, gem_directory)
|
186
|
-
|
186
|
+
|
187
187
|
# Write the generated index
|
188
188
|
File.write(index_path, index.to_yaml)
|
189
189
|
Console.debug("Generated dynamic index for #{gem[:name]}: #{index_path}")
|
@@ -251,9 +251,6 @@ module Agent
|
|
251
251
|
|
252
252
|
# Join the lines and truncate if too long
|
253
253
|
description = description_lines.join(" ").strip
|
254
|
-
if description.length > 197
|
255
|
-
description = description[0..196] + "..."
|
256
|
-
end
|
257
254
|
|
258
255
|
description
|
259
256
|
end
|
data/post.md
CHANGED
@@ -90,8 +90,13 @@ my-awesome-gem/
|
|
90
90
|
**Ruby:** "Good question! The generated `agent.md` can be linked to whatever your tool expects:"
|
91
91
|
|
92
92
|
**For Cursor:**
|
93
|
-
|
94
|
-
|
93
|
+
Create `.cursor/rules/agent.mdc` with:
|
94
|
+
|
95
|
+
``` markdown
|
96
|
+
---
|
97
|
+
alwaysApply: true
|
98
|
+
---
|
99
|
+
Read the `agent.md` file in the project root directory for detailed context relating to this project and external dependencies.
|
95
100
|
```
|
96
101
|
|
97
102
|
**For GitHub Copilot:**
|
data/readme.md
CHANGED
@@ -36,6 +36,8 @@ When you install context from other gems, they will be placed in the `.context/`
|
|
36
36
|
|
37
37
|
## Usage
|
38
38
|
|
39
|
+
Please see the [project documentation](https://ioquatix.github.io/agent-context/) for more details.
|
40
|
+
|
39
41
|
### Installation
|
40
42
|
|
41
43
|
Add the `agent-context` gem to your project:
|
@@ -151,7 +153,7 @@ Then create `.cursor/rules/agent.mdc` with:
|
|
151
153
|
---
|
152
154
|
alwaysApply: true
|
153
155
|
---
|
154
|
-
|
156
|
+
Read the `agent.md` file in the project root directory for detailed context relating to this project and external dependencies.
|
155
157
|
```
|
156
158
|
|
157
159
|
This approach uses Cursor's proper front-matter format and directs the AI to consult the main `agent.md` file.
|
@@ -180,10 +182,25 @@ ln -s agent.md .replit.md
|
|
180
182
|
ln -s agent.md .windsurfrules
|
181
183
|
```
|
182
184
|
|
185
|
+
## Releases
|
186
|
+
|
187
|
+
Please see the [project releases](https://ioquatix.github.io/agent-context/releases/index) for all releases.
|
188
|
+
|
189
|
+
### v0.2.0
|
190
|
+
|
191
|
+
- Don't limit description length.
|
192
|
+
|
183
193
|
## See Also
|
184
194
|
|
185
195
|
- [Bake](https://github.com/ioquatix/bake) — The bake task execution tool.
|
186
196
|
|
197
|
+
### Gems With Context Files
|
198
|
+
|
199
|
+
- [Async](https://github.com/socketry/async)
|
200
|
+
- [Decode](https://github.com/ioquatix/decode)
|
201
|
+
- [Falcon](https:///github.com/socketry/falcon)
|
202
|
+
- [Sus](https://github.com/socketry/sus)
|
203
|
+
|
187
204
|
## Contributing
|
188
205
|
|
189
206
|
We welcome contributions to this project.
|
data/releases.md
ADDED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agent-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- license.md
|
68
68
|
- post.md
|
69
69
|
- readme.md
|
70
|
+
- releases.md
|
70
71
|
- specification.md
|
71
72
|
homepage: https://github.com/ioquatix/agent-context
|
72
73
|
licenses:
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: '0'
|
91
92
|
requirements: []
|
92
|
-
rubygems_version: 3.6.
|
93
|
+
rubygems_version: 3.6.9
|
93
94
|
specification_version: 4
|
94
95
|
summary: Install and manage context files from Ruby gems.
|
95
96
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|