agent-context 0.1.3 → 0.2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/{usage.md → getting-started.md} +19 -3
- data/context/index.yaml +13 -0
- data/lib/agent/context/index.rb +2 -0
- data/lib/agent/context/installer.rb +18 -23
- data/lib/agent/context/version.rb +1 -1
- data/post.md +7 -2
- data/readme.md +20 -1
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
- data/agent.md +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dcf6ef1ced870cf21a982f53ef4d270621f9b215f2f21084b0f7aff9c71655c
|
4
|
+
data.tar.gz: 7ecbef44d024fa43a2dca67bdb2adc3765bb008fa0b36f33a1fd8bef7319286a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05edd6a2285f3921f3501895b13d0d6d1b2b0b615fa2ac5c9248906f65f23e5c0985a0727123a88e90ad3fd3c00f28c6c625d14786de324fa27afc7b28e44757
|
7
|
+
data.tar.gz: 56e2699947955a527b50480439e81ef574a93c2841ff0b19e02b24575b60dd08c95cd94df2f110f7518c9dcbc56b541b6c9c9fe229d1de2615cf801b5b5e442e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,10 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# Getting Started
|
2
2
|
|
3
|
-
|
3
|
+
This guide explains how to use `agent-context`, a tool for discovering and installing contextual information from Ruby gems to help AI agents.
|
4
|
+
|
5
|
+
## Overview
|
4
6
|
|
5
7
|
`agent-context` is a tool that helps you discover and install contextual information from Ruby gems for AI agents. Gems can provide additional documentation, examples, and guidance in a `context/` directory.
|
6
8
|
|
7
|
-
##
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add the gem to your project:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ bundle add agent-context
|
15
|
+
```
|
16
|
+
|
17
|
+
Then install agent context files:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ bundle exec bake agent:context:install
|
21
|
+
```
|
22
|
+
|
23
|
+
## Commands
|
8
24
|
|
9
25
|
```bash
|
10
26
|
# See what context is available
|
data/context/index.yaml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Automatically generated context index for Utopia::Project guides.
|
2
|
+
# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
|
3
|
+
---
|
4
|
+
description: Install and manage context files from Ruby gems.
|
5
|
+
metadata:
|
6
|
+
documentation_uri: https://ioquatix.github.io/agent-context/
|
7
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
8
|
+
source_code_uri: https://github.com/ioquatix/agent-context.git
|
9
|
+
files:
|
10
|
+
- path: getting-started.md
|
11
|
+
title: Getting Started
|
12
|
+
description: This guide explains how to use `agent-context`, a tool for discovering
|
13
|
+
and installing contextual information from Ruby gems to help AI agents.
|
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
|
|
@@ -170,7 +170,6 @@ module Agent
|
|
170
170
|
|
171
171
|
{
|
172
172
|
"description" => gem[:summary] || "Context files for #{gem[:name]}",
|
173
|
-
"version" => gem[:version],
|
174
173
|
"metadata" => gem[:metadata],
|
175
174
|
"files" => files
|
176
175
|
}
|
@@ -183,7 +182,7 @@ module Agent
|
|
183
182
|
unless File.exist?(index_path)
|
184
183
|
# Generate dynamic index from gemspec
|
185
184
|
index = generate_dynamic_index(gem, gem_directory)
|
186
|
-
|
185
|
+
|
187
186
|
# Write the generated index
|
188
187
|
File.write(index_path, index.to_yaml)
|
189
188
|
Console.debug("Generated dynamic index for #{gem[:name]}: #{index_path}")
|
@@ -196,7 +195,6 @@ module Agent
|
|
196
195
|
# Return a fallback index
|
197
196
|
{
|
198
197
|
"description" => gem[:summary] || "Context files for #{gem[:name]}",
|
199
|
-
"version" => gem[:version],
|
200
198
|
"metadata" => gem[:metadata],
|
201
199
|
"files" => []
|
202
200
|
}
|
@@ -251,9 +249,6 @@ module Agent
|
|
251
249
|
|
252
250
|
# Join the lines and truncate if too long
|
253
251
|
description = description_lines.join(" ").strip
|
254
|
-
if description.length > 197
|
255
|
-
description = description[0..196] + "..."
|
256
|
-
end
|
257
252
|
|
258
253
|
description
|
259
254
|
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,10 @@ 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
|
+
|
41
|
+
- [Getting Started](https://ioquatix.github.io/agent-context/guides/getting-started/index) - This guide explains how to use `agent-context`, a tool for discovering and installing contextual information from Ruby gems to help AI agents.
|
42
|
+
|
39
43
|
### Installation
|
40
44
|
|
41
45
|
Add the `agent-context` gem to your project:
|
@@ -151,7 +155,7 @@ Then create `.cursor/rules/agent.mdc` with:
|
|
151
155
|
---
|
152
156
|
alwaysApply: true
|
153
157
|
---
|
154
|
-
|
158
|
+
Read the `agent.md` file in the project root directory for detailed context relating to this project and external dependencies.
|
155
159
|
```
|
156
160
|
|
157
161
|
This approach uses Cursor's proper front-matter format and directs the AI to consult the main `agent.md` file.
|
@@ -180,10 +184,25 @@ ln -s agent.md .replit.md
|
|
180
184
|
ln -s agent.md .windsurfrules
|
181
185
|
```
|
182
186
|
|
187
|
+
## Releases
|
188
|
+
|
189
|
+
Please see the [project releases](https://ioquatix.github.io/agent-context/releases/index) for all releases.
|
190
|
+
|
191
|
+
### v0.2.0
|
192
|
+
|
193
|
+
- Don't limit description length.
|
194
|
+
|
183
195
|
## See Also
|
184
196
|
|
185
197
|
- [Bake](https://github.com/ioquatix/bake) — The bake task execution tool.
|
186
198
|
|
199
|
+
### Gems With Context Files
|
200
|
+
|
201
|
+
- [Async](https://github.com/socketry/async)
|
202
|
+
- [Decode](https://github.com/ioquatix/decode)
|
203
|
+
- [Falcon](https:///github.com/socketry/falcon)
|
204
|
+
- [Sus](https://github.com/socketry/sus)
|
205
|
+
|
187
206
|
## Contributing
|
188
207
|
|
189
208
|
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.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -57,9 +57,9 @@ executables: []
|
|
57
57
|
extensions: []
|
58
58
|
extra_rdoc_files: []
|
59
59
|
files:
|
60
|
-
- agent.md
|
61
60
|
- bake/agent/context.rb
|
62
|
-
- context/
|
61
|
+
- context/getting-started.md
|
62
|
+
- context/index.yaml
|
63
63
|
- lib/agent/context.rb
|
64
64
|
- lib/agent/context/index.rb
|
65
65
|
- lib/agent/context/installer.rb
|
@@ -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
|
data/agent.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# Agent
|
2
|
-
|
3
|
-
## Context
|
4
|
-
|
5
|
-
This section provides links to documentation from installed packages. It is automatically generated and may be updated by running `bake agent:context:install`.
|
6
|
-
|
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
|
-
|
9
|
-
### decode
|
10
|
-
|
11
|
-
Code analysis for documentation generation.
|
12
|
-
|
13
|
-
#### [Getting Started with Decode](.context/decode/getting-started.md)
|
14
|
-
|
15
|
-
The Decode gem provides programmatic access to Ruby code structure and metadata. It can parse Ruby files and extract definitions, comments, and documentation pragmas, enabling code analysis, docume...
|
16
|
-
|
17
|
-
#### [Documentation Coverage](.context/decode/coverage.md)
|
18
|
-
|
19
|
-
This guide explains how to test and monitor documentation coverage in your Ruby projects using the Decode gem's built-in bake tasks.
|
20
|
-
|
21
|
-
#### [Ruby Documentation](.context/decode/ruby-documentation.md)
|
22
|
-
|
23
|
-
This guide covers documentation practices and pragmas supported by the Decode gem for documenting Ruby code. These pragmas provide structured documentation that can be parsed and used to generate A...
|
24
|
-
|
25
|
-
### sus
|
26
|
-
|
27
|
-
A fast and scalable test runner.
|
28
|
-
|
29
|
-
#### [Using Sus Testing Framework](.context/sus/usage.md)
|
30
|
-
|
31
|
-
Sus is a modern Ruby testing framework that provides a clean, BDD-style syntax for writing tests. It's designed to be fast, simple, and expressive.
|
32
|
-
|
33
|
-
#### [Mocking](.context/sus/mocking.md)
|
34
|
-
|
35
|
-
There are two types of mocking in sus: `receive` and `mock`. The `receive` matcher is a subset of full mocking and is used to set expectations on method calls, while `mock` can be used to replace m...
|
36
|
-
|
37
|
-
#### [Shared Test Behaviors and Fixtures](.context/sus/shared.md)
|
38
|
-
|
39
|
-
Sus provides shared test contexts which can be used to define common behaviours or tests that can be reused across one or more test files.
|