agent-context 0.1.0 → 0.1.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: 71c3555039c6fe5ae6c08d31a01b7ad69fdbc37d5dc13ddedbd9066fbd42a202
4
- data.tar.gz: 496c8d37bc994834ca49328976f53cedef923c1aafd76073eac1218e27322579
3
+ metadata.gz: 5772240bc3bd7661f586cea5f942b21be8c6700dd01df4e287ccf88be7360885
4
+ data.tar.gz: 6e467af1cb56e030210770065eb566bdbcc0b4c17fcc171555096d69482fb081
5
5
  SHA512:
6
- metadata.gz: 35e2df052388b0bc29c373ec4fb287ed595cb4de3aa8e7178e80917be78937e0ee7477d11a75c8403c104a0b328eb3307c75d91ec102616f663fbbe64dbe7ffc
7
- data.tar.gz: 5597bce947893b800f481c9df0ae89a70821e162593ca437116de60c1f58b981847d66c6ff80e90299385aed9e56d369d3d9b714ab794089bab1a65350d3872b
6
+ metadata.gz: ebd792d272ddb3619194bf3ddbd8858a13e81446e32a96c0fbd8a6314609e647ca0ffc7d73423abcd0b151d688b5284df36084b49e2d404763ba5e95bbe40a6e
7
+ data.tar.gz: 8025c2fa9fa4e25d7b6c87c520e34234f0b1ee2114ecb244d1ede213adfc406b49b4e084a4ac32e3f721b72498a890fb5355662684da2265dd30f8e6b78a3ddc
checksums.yaml.gz.sig CHANGED
Binary file
data/agent.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Context
4
4
 
5
- Context files from installed gems providing documentation and guidance for AI agents.
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
6
 
7
7
  ### decode
8
8
 
@@ -69,7 +69,7 @@ def install(gem: nil)
69
69
  installed = @installer.install_all_context
70
70
  if installed.any?
71
71
  puts "Installed context from #{installed.length} gems:"
72
- installed.each { |gem_name| puts " #{gem_name}" }
72
+ installed.each {|gem_name| puts " #{gem_name}"}
73
73
  else
74
74
  puts "No gems with context found"
75
75
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024, by Samuel Williams.
4
+ # Copyright, 2025, by Samuel Williams.
5
+ # Copyright, 2025, by Shopify Inc.
5
6
 
6
7
  require_relative "version"
7
8
  require "fileutils"
8
- require "markly"
9
9
  require "yaml"
10
10
 
11
11
  # @namespace
@@ -44,7 +44,7 @@ module Agent
44
44
  def generate_context_section
45
45
  sections = []
46
46
 
47
- sections << "Context files from installed gems providing documentation and guidance for AI agents."
47
+ sections << "This section provides links to documentation from installed packages. It is automatically generated and may be updated by running `bake agent:context:install`."
48
48
  sections << ""
49
49
 
50
50
  gem_contexts = collect_gem_contexts
@@ -129,7 +129,6 @@ module Agent
129
129
  "## Context",
130
130
  "",
131
131
  context_content,
132
- ""
133
132
  ].join("\n")
134
133
  File.write(agent_md_path, content)
135
134
  end
@@ -274,7 +273,7 @@ module Agent
274
273
 
275
274
  def extract_title(lines)
276
275
  # Look for the first markdown header
277
- header_line = lines.find { |line| line.start_with?("#") }
276
+ header_line = lines.find {|line| line.start_with?("#")}
278
277
  if header_line
279
278
  # Remove markdown header syntax and clean up
280
279
  header_line.sub(/^#+\s*/, "").strip
@@ -26,7 +26,7 @@ module Agent
26
26
  "debugging"
27
27
  ]
28
28
 
29
- # Initialize a new Helper instance.
29
+ # Initialize a new Installer instance.
30
30
  #
31
31
  # @parameter root [String] The root directory to work from (default: current directory).
32
32
  # @parameter specifications [Gem::Specification] The gem specifications to search (default: all installed gems).
@@ -63,7 +63,7 @@ module Agent
63
63
 
64
64
  # Find a specific gem with context.
65
65
  def find_gem_with_context(gem_name)
66
- spec = @specifications.find { |s| s.name == gem_name }
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")
@@ -86,7 +86,7 @@ module Agent
86
86
  gem = find_gem_with_context(gem_name)
87
87
  return nil unless gem
88
88
 
89
- Dir.glob(File.join(gem[:path], "**/*")).select { |f| File.file?(f) }
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.
@@ -101,7 +101,7 @@ module Agent
101
101
  File.join(gem[:path], "#{file_name}.md")
102
102
  ]
103
103
 
104
- file_path = possible_paths.find { |path| File.exist?(path) }
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)
@@ -214,7 +214,7 @@ module Agent
214
214
 
215
215
  def extract_title(lines)
216
216
  # Look for the first markdown header
217
- header_line = lines.find { |line| line.start_with?("#") }
217
+ header_line = lines.find {|line| line.start_with?("#")}
218
218
  if header_line
219
219
  # Remove markdown header syntax and clean up
220
220
  header_line.sub(/^#+\s*/, "").strip
@@ -6,6 +6,6 @@
6
6
 
7
7
  module Agent
8
8
  module Context
9
- VERSION = "0.1.0"
9
+ VERSION = "0.1.1"
10
10
  end
11
11
  end
data/lib/agent/context.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2025, by Shopify Inc.
5
+ # Copyright, 2025, by Samuel Williams.
5
6
 
6
7
  require_relative "context/version"
7
8
  require_relative "context/installer"
data/readme.md CHANGED
@@ -14,22 +14,23 @@ When you install context from gems, they are placed in the `.context/` directory
14
14
 
15
15
  Add the gem to your project and install context from all available gems:
16
16
 
17
- ```bash
17
+ ``` bash
18
18
  $ bundle add agent-context
19
19
  $ bake agent:context:install
20
20
  ```
21
21
 
22
22
  This workflow:
23
- - Adds the `agent-context` gem to your project.
24
- - Installs context files from all gems into `.context/`.
25
- - Generates or updates `agent.md` with a comprehensive overview.
26
- - Follows the <https://agent.md> specification for agentic coding tools.
23
+
24
+ - Adds the `agent-context` gem to your project.
25
+ - Installs context files from all gems into `.context/`.
26
+ - Generates or updates `agent.md` with a comprehensive overview.
27
+ - Follows the <https://agent.md> specification for agentic coding tools.
27
28
 
28
29
  ## Context
29
30
 
30
31
  This gem provides its own context files in the `context/` directory, including:
31
32
 
32
- - `usage.md` - Comprehensive guide for using and providing context files.
33
+ - `usage.md` - Comprehensive guide for using and providing context files.
33
34
 
34
35
  When you install context from other gems, they will be placed in the `.context/` directory and referenced in `agent.md`.
35
36
 
@@ -39,7 +40,7 @@ When you install context from other gems, they will be placed in the `.context/`
39
40
 
40
41
  Add the `agent-context` gem to your project:
41
42
 
42
- ```bash
43
+ ``` bash
43
44
  $ bundle add agent-context
44
45
  ```
45
46
 
@@ -49,13 +50,13 @@ $ bundle add agent-context
49
50
 
50
51
  Install context from all available gems and update `agent.md`:
51
52
 
52
- ```bash
53
+ ``` bash
53
54
  $ bake agent:context:install
54
55
  ```
55
56
 
56
57
  Install context from a specific gem:
57
58
 
58
- ```bash
59
+ ``` bash
59
60
  $ bake agent:context:install --gem async
60
61
  ```
61
62
 
@@ -63,13 +64,13 @@ $ bake agent:context:install --gem async
63
64
 
64
65
  List all gems that have context available:
65
66
 
66
- ```bash
67
+ ``` bash
67
68
  $ bake agent:context:list
68
69
  ```
69
70
 
70
71
  List context files for a specific gem:
71
72
 
72
- ```bash
73
+ ``` bash
73
74
  $ bake agent:context:list --gem async
74
75
  ```
75
76
 
@@ -77,7 +78,7 @@ $ bake agent:context:list --gem async
77
78
 
78
79
  Show the content of a specific context file:
79
80
 
80
- ```bash
81
+ ``` bash
81
82
  $ bake agent:context:show --gem async --file thread-safety
82
83
  ```
83
84
 
@@ -85,30 +86,28 @@ $ bake agent:context:show --gem async --file thread-safety
85
86
 
86
87
  Both `.context/` and `agent.md` should be committed to git:
87
88
 
88
- - `agent.md` is user-facing documentation that should be versioned.
89
- - `.context/` files are referenced by `agent.md` and needed for AI agents to function properly.
90
- - This ensures AI agents in CI have access to the full context.
89
+ - `agent.md` is user-facing documentation that should be versioned.
90
+ - `.context/` files are referenced by `agent.md` and needed for AI agents to function properly.
91
+ - This ensures AI agents in CI have access to the full context.
91
92
 
92
93
  ## Providing Context in Your Gem
93
94
 
94
95
  To provide context files in your gem, create a `context/` directory in your gem's root:
95
96
 
96
- ```
97
- your-gem/
98
- ├── context/
99
- │ ├── getting-started.md
100
- │ ├── usage.md
101
- ├── configuration.md
102
- │ └── index.yaml (optional)
103
- ├── lib/
104
- └── your-gem.gemspec
105
- ```
97
+ your-gem/
98
+ ├── context/
99
+ ├── getting-started.md
100
+ │ ├── usage.md
101
+ │ ├── configuration.md
102
+ └── index.yaml (optional)
103
+ ├── lib/
104
+ └── your-gem.gemspec
106
105
 
107
106
  ### Optional: Custom Index File
108
107
 
109
108
  You can provide a custom `index.yaml` file to control ordering and metadata:
110
109
 
111
- ```yaml
110
+ ``` yaml
112
111
  description: "Your gem description from gemspec"
113
112
  version: "1.0.0"
114
113
  files:
@@ -127,37 +126,44 @@ If no `index.yaml` is provided, one will be generated automatically from your ge
127
126
  The generated `agent.md` file can be integrated with various AI coding tools by creating symbolic links to their expected locations:
128
127
 
129
128
  ### Cline
130
- ```bash
129
+
130
+ ``` bash
131
131
  ln -s agent.md .clinerules
132
132
  ```
133
133
 
134
134
  ### Claude Code
135
- ```bash
135
+
136
+ ``` bash
136
137
  ln -s agent.md CLAUDE.md
137
138
  ```
138
139
 
139
140
  ### Cursor
140
- ```bash
141
+
142
+ ``` bash
141
143
  ln -s agent.md .cursorrules
142
144
  ```
143
145
 
144
146
  ### Gemini CLI, OpenAI Codex, OpenCode
145
- ```bash
147
+
148
+ ``` bash
146
149
  ln -s agent.md AGENTS.md
147
150
  ```
148
151
 
149
152
  ### GitHub Copilot
150
- ```bash
153
+
154
+ ``` bash
151
155
  ln -s ../../agent.md .github/copilot-instructions.md
152
156
  ```
153
157
 
154
158
  ### Replit
155
- ```bash
159
+
160
+ ``` bash
156
161
  ln -s agent.md .replit.md
157
162
  ```
158
163
 
159
164
  ### Windsurf
160
- ```bash
165
+
166
+ ``` bash
161
167
  ln -s agent.md .windsurfrules
162
168
  ```
163
169
 
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -40,33 +40,19 @@ cert_chain:
40
40
  date: 1980-01-02 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
- name: console
43
+ name: bake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '1.25'
48
+ version: '0.23'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '1.25'
56
- - !ruby/object:Gem::Dependency
57
- name: markly
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.9'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '0.9'
55
+ version: '0.23'
70
56
  executables: []
71
57
  extensions: []
72
58
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file