my-ruby-coding-agents 0.1.0 → 0.4.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
- data/CHANGELOG.md +73 -0
- data/README.md +157 -3
- data/doc/CHANGELOG.md +73 -0
- data/doc/MyRubyCodingAgents/CLI.md +3 -3
- data/doc/MyRubyCodingAgents/CLIHelp.md +11 -0
- data/doc/MyRubyCodingAgents/CLIOptions.md +26 -0
- data/doc/MyRubyCodingAgents/Installer.md +2 -1
- data/doc/MyRubyCodingAgents/Locations/Location.md +17 -0
- data/doc/MyRubyCodingAgents/Locations.md +20 -0
- data/doc/MyRubyCodingAgents/NotesCheck.md +36 -0
- data/doc/MyRubyCodingAgents/Planner.md +3 -2
- data/doc/MyRubyCodingAgents/PluginInstaller.md +35 -0
- data/doc/MyRubyCodingAgents.md +7 -1
- data/doc/README.md +157 -3
- data/lib/my_ruby_coding_agents/cli.rb +34 -47
- data/lib/my_ruby_coding_agents/cli_help.rb +44 -0
- data/lib/my_ruby_coding_agents/cli_options.rb +58 -0
- data/lib/my_ruby_coding_agents/installer.rb +11 -4
- data/lib/my_ruby_coding_agents/locations.rb +31 -0
- data/lib/my_ruby_coding_agents/notes_check.rb +97 -0
- data/lib/my_ruby_coding_agents/planner.rb +11 -11
- data/lib/my_ruby_coding_agents/plugin_installer.rb +90 -0
- data/lib/my_ruby_coding_agents/version.rb +1 -1
- data/lib/my_ruby_coding_agents.rb +5 -0
- data/llms.txt +7 -1
- data/templates/agents/advisor.md +33 -0
- data/templates/agents/chief_of_staff.md +21 -0
- data/templates/agents/code_archaeologist.md +4 -2
- data/templates/agents/coherence_reviewer.md +11 -0
- data/templates/agents/contract_mapper.md +2 -0
- data/templates/agents/evidence_reviewer.md +2 -0
- data/templates/agents/quality_investigator.md +2 -0
- data/templates/agents/rails_explorer.md +2 -0
- data/templates/agents/rails_implementer.md +3 -1
- data/templates/agents/security_mapper.md +4 -0
- data/templates/agents/security_reviewer.md +2 -0
- data/templates/agents/test_designer.md +2 -0
- data/templates/instructions.md +18 -1
- data/templates/models.yml +9 -0
- metadata +15 -1
data/doc/README.md
CHANGED
|
@@ -43,6 +43,18 @@ delegation section in `AGENTS.md` and `CLAUDE.md`. The directory defaults to
|
|
|
43
43
|
`.`. `--codex` and `--claude` limit which tool's files are installed; with
|
|
44
44
|
neither flag, both targets are installed.
|
|
45
45
|
|
|
46
|
+
For a repository that must not get these files, such as an employer's,
|
|
47
|
+
install into your home folders instead. Agents go to `~/.codex/agents/` and
|
|
48
|
+
`~/.claude/agents/`, the delegation section to `~/.codex/AGENTS.md` and
|
|
49
|
+
`~/.claude/CLAUDE.md`, and plugins install with Claude Code's user scope.
|
|
50
|
+
`CODEX_HOME` and `CLAUDE_CONFIG_DIR` move those folders, as they do for the
|
|
51
|
+
tools. The agents then load in every project on that machine.
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
my-ruby-coding-agents install --user
|
|
55
|
+
my-ruby-coding-agents status --user
|
|
56
|
+
```
|
|
57
|
+
|
|
46
58
|
### Refreshing after a gem upgrade
|
|
47
59
|
|
|
48
60
|
Each generated agent file has a marker line with a hash of its content: a
|
|
@@ -115,6 +127,15 @@ Claude Code reads a line `@AGENTS.md` in `CLAUDE.md` as an import of
|
|
|
115
127
|
|
|
116
128
|
A linked `CLAUDE.md` that points to `AGENTS.md` is also written only once.
|
|
117
129
|
|
|
130
|
+
### Sub-agents and context
|
|
131
|
+
|
|
132
|
+
Every agent file and the delegation guide say "Start every sub-agent with a
|
|
133
|
+
fresh context window". Claude Code does this by default: a sub-agent sees
|
|
134
|
+
only the prompt it is given, and only a `fork` inherits the parent's
|
|
135
|
+
conversation. Codex does not: in a test on 2026-12-01 a spawned agent
|
|
136
|
+
inherited the parent's context. So in Codex the line is a request, not a
|
|
137
|
+
guarantee; write each sub-agent's task so it stands on its own.
|
|
138
|
+
|
|
118
139
|
List the included agents with their tier, models, and efforts:
|
|
119
140
|
|
|
120
141
|
```sh
|
|
@@ -128,10 +149,30 @@ effort, and description:
|
|
|
128
149
|
rails_explorer | fast | Codex: gpt-6-luna (low) | Claude: sonnet (low) | Trace a Ruby workflow ...
|
|
129
150
|
```
|
|
130
151
|
|
|
131
|
-
The
|
|
152
|
+
The fifteen agents are `rails_explorer`, `contract_mapper`, `test_designer`,
|
|
132
153
|
`rails_implementer`, `api_cli_implementer`, `evidence_reviewer`,
|
|
133
154
|
`quality_investigator`, `ui_implementer`, `security_mapper`,
|
|
134
|
-
`security_reviewer`, `code_archaeologist`,
|
|
155
|
+
`security_reviewer`, `code_archaeologist`, `pr_readiness_checker`,
|
|
156
|
+
`chief_of_staff`, `coherence_reviewer`, and `advisor`.
|
|
157
|
+
|
|
158
|
+
`coherence_reviewer` reads a diff or plan for coherence with the rest of the
|
|
159
|
+
codebase: a second way of doing something that already exists, naming drift,
|
|
160
|
+
rules that live only in prose, and traps for the next change. For each finding
|
|
161
|
+
it names the cheapest guardrail that would have caught it (a name, a doc line,
|
|
162
|
+
a test, a lint rule, a CI check). It and `rails_implementer` use the
|
|
163
|
+
[design checklist](docs/design-checklist.md) when a project has a copy in
|
|
164
|
+
`docs/`.
|
|
165
|
+
|
|
166
|
+
The read-only agents label every claim by its source (a `path:line` they
|
|
167
|
+
opened, `CLAIMED by`, `UNVERIFIED`, or `ASSUMPTION`) and say when the briefing
|
|
168
|
+
was wrong about the code.
|
|
169
|
+
|
|
170
|
+
`chief_of_staff` keeps the week plan, the work log, update drafts for your
|
|
171
|
+
team and an end-of-week showcase in `NOTES_FOLDER/weeks/`, and answers "what
|
|
172
|
+
should I do now" from the plan and the open decisions. It reads who you are,
|
|
173
|
+
the team's mission and the weekly rhythm from `NOTES_FOLDER/context/`, so the
|
|
174
|
+
gem holds nothing personal. It drafts and never sends. As a subagent it cannot
|
|
175
|
+
see the conversation, so the lead briefs it with what was done and why.
|
|
135
176
|
|
|
136
177
|
`code_archaeologist` researches how and why part of the code works and writes
|
|
137
178
|
what it finds into `docs/archaeology/`, one note per topic plus an index. On
|
|
@@ -145,6 +186,15 @@ repository and reports which are ready to merge, which need changes from the
|
|
|
145
186
|
contributor, and which need a decision from you. It never merges, labels, or
|
|
146
187
|
posts comments. Run it from a checkout where `gh auth status` succeeds.
|
|
147
188
|
|
|
189
|
+
`advisor` is a read-only consultant for decisions before implementation:
|
|
190
|
+
architecture tradeoffs, ambiguous requirements, a bug that stays unexplained
|
|
191
|
+
after investigation, or changes that touch correctness, concurrency, or
|
|
192
|
+
security. It uses the strongest models (Codex gpt-6-astra, Claude fable) at
|
|
193
|
+
medium effort, so the delegation guide tells the lead not to call it for
|
|
194
|
+
routine implementation, simple refactoring, or straightforward fixes. An
|
|
195
|
+
advisor helps decide before the work; a reviewer judges finished work. Keep
|
|
196
|
+
the roles separate to avoid needless calls to the expensive model.
|
|
197
|
+
|
|
148
198
|
Use the generated delegation guide to choose a focused agent for independent
|
|
149
199
|
work. Handle small, coupled tasks yourself; parallelize independent bounded
|
|
150
200
|
tasks when the benefit outweighs coordination and token costs. Implementers
|
|
@@ -153,7 +203,7 @@ work. The names `rails_explorer` and `rails_implementer` also cover standalone
|
|
|
153
203
|
Ruby projects; the fleet keeps the same names across projects.
|
|
154
204
|
|
|
155
205
|
Models come from a tier table in `templates/models.yml`. Each tier (`fast`,
|
|
156
|
-
`investigate`, `implement`, `strong`, `review`) sets a model and reasoning effort for
|
|
206
|
+
`investigate`, `implement`, `strong`, `review`, `advise`) sets a model and reasoning effort for
|
|
157
207
|
Codex and for Claude, and each agent template names one tier with `tier:`.
|
|
158
208
|
Edit `templates/models.yml` to change routing; it is the one place model names
|
|
159
209
|
live. The installer builds the model sentence in the delegation guide from the
|
|
@@ -163,6 +213,110 @@ Model assignments are starting points, not benchmark-proven rankings. The lead
|
|
|
163
213
|
narrows ambiguous or unsuccessful tasks or uses a stronger available model;
|
|
164
214
|
there is no automatic model router.
|
|
165
215
|
|
|
216
|
+
### Rails risk checks and evaluation
|
|
217
|
+
|
|
218
|
+
The existing implementation, test, quality, and security roles include focused
|
|
219
|
+
Rails checks for query growth, stable pagination, tenant-scoped lookups,
|
|
220
|
+
server-owned parameters, retryable jobs, external side effects, and migration
|
|
221
|
+
rollout safety. They apply only to the changed behavior and require evidence of
|
|
222
|
+
the project's Rails version, database, and queue adapter. The fuller checklist
|
|
223
|
+
and official guide links are in [Rails risk checks](docs/rails-risk-checklists.md).
|
|
224
|
+
|
|
225
|
+
The [Rails review pilot](evaluation/README.md) compares plain prompts with the
|
|
226
|
+
role templates on three deliberately faulty Rails excerpts. It retains the
|
|
227
|
+
tasks, scoring rubric, raw responses, and measured results. It measures static
|
|
228
|
+
defect detection, not implementation success or general productivity; the same
|
|
229
|
+
Luna model is used in both conditions to isolate the template content. The
|
|
230
|
+
[first results](evaluation/results/2026-10-31/README.md) found all six seeded
|
|
231
|
+
defects in both conditions, with no observed detection improvement.
|
|
232
|
+
|
|
233
|
+
## Plugins
|
|
234
|
+
|
|
235
|
+
`plugins/advisor` is a plugin for Claude Code and Codex that turns the `advisor`
|
|
236
|
+
agent into a workflow. With `/advisor` on, the lead agent writes a briefing and
|
|
237
|
+
consults the advisor at four checkpoints: before a major decision, when stuck,
|
|
238
|
+
before declaring a change done, and on request. Hooks mark pending edits, log
|
|
239
|
+
each consult to `.advisor/log.md`, and nudge once when a turn ends with edits
|
|
240
|
+
nobody consulted on.
|
|
241
|
+
|
|
242
|
+
Install it together with the agents:
|
|
243
|
+
|
|
244
|
+
```sh
|
|
245
|
+
my-ruby-coding-agents install ./my-app --advisor
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
After the usual file writes, `--advisor` runs each selected tool's own plugin
|
|
249
|
+
commands with this repository as the marketplace:
|
|
250
|
+
|
|
251
|
+
```sh
|
|
252
|
+
codex plugin marketplace add lucianghinda/my-ruby-coding-agents
|
|
253
|
+
codex plugin add advisor@my-ruby-coding-agents
|
|
254
|
+
claude plugin marketplace add lucianghinda/my-ruby-coding-agents
|
|
255
|
+
claude plugin install advisor@my-ruby-coding-agents --scope project
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Both tools accept these commands again on later runs. Claude Code records
|
|
259
|
+
the plugin in the project's `.claude/settings.json`; Codex enables it in
|
|
260
|
+
`~/.codex/config.toml` and caches a copy. A tool missing from `PATH` is
|
|
261
|
+
skipped. A failed command stops that tool and makes `install` exit 1.
|
|
262
|
+
`--dry-run` prints the commands without running them. Use
|
|
263
|
+
`--advisor-source` to point at a checkout of this repository instead of
|
|
264
|
+
GitHub, for example while developing the plugin.
|
|
265
|
+
|
|
266
|
+
The plugin carries the skill and the hooks. The `advisor` agent itself comes
|
|
267
|
+
from the regular install, so `--advisor` needs the agents installed too. See
|
|
268
|
+
[plugins/advisor/README.md](plugins/advisor/README.md) for the details.
|
|
269
|
+
|
|
270
|
+
## Watching your pull requests
|
|
271
|
+
|
|
272
|
+
The `pr-watch` plugin reports what changed on your open pull requests, in every repository, since the last run: new comments, reviews and review-thread replies from other people, CI turning red or green, merge conflicts, review decisions, commits someone else pushed, and pull requests that were merged or closed. A Ruby script does the watching with `gh`; the `pr-watch` skill reads each event and says what it needs from you, such as the failing test in a CI log. It never writes to GitHub.
|
|
273
|
+
|
|
274
|
+
```sh
|
|
275
|
+
my-ruby-coding-agents install --user --pr-watch
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
In Claude Code, `/loop 10m /pr-watch` checks every ten minutes. To watch without a model, run the script from cron or launchd with `--notify` for a desktop notification; see the [pr-watch skill](plugins/pr-watch/skills/pr-watch/SKILL.md).
|
|
279
|
+
|
|
280
|
+
## Notes folder
|
|
281
|
+
|
|
282
|
+
The skills and `chief_of_staff` write documents and the work log to `NOTES_FOLDER`, a folder you pick outside every repository, so nothing they write turns up in a commit. One folder per project or job works well:
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
$NOTES_FOLDER/
|
|
286
|
+
research/ codebase-research documents
|
|
287
|
+
open-decisions/ open-decision files, one per issue
|
|
288
|
+
handoffs/ handoff files for unfinished sessions, _archive/ once resumed
|
|
289
|
+
specs/ change-spec documents
|
|
290
|
+
codebase/ map, conventions and guardrails notes (code_archaeologist)
|
|
291
|
+
weeks/ plan, log, updates and showcase per week
|
|
292
|
+
context/ your role, the team's mission and rhythm, the rules every
|
|
293
|
+
agent follows, and checklists (design-checklist.md,
|
|
294
|
+
rails-risk-checklists.md) read before the repo's docs/
|
|
295
|
+
team/ decisions
|
|
296
|
+
templates/ optional starter files, e.g. templates/weeks/ for a new week
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Set it in your shell profile, then check it and create the subfolders:
|
|
300
|
+
|
|
301
|
+
```sh
|
|
302
|
+
export NOTES_FOLDER="$HOME/notes/my-app"
|
|
303
|
+
my-ruby-coding-agents notes --init
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`notes` exits 1 and says what to fix when the folder is missing or inside a git repository, when Codex's sandbox would block writes to it (`writable_roots`), when Claude Code would ask before every write (`permissions.additionalDirectories`), or when a `skillOverrides` setting hides one of the skills. Whatever is specific to you (name, mission, weekly rhythm, house rules) lives in `context/`, not in this gem; the delegation guide tells every agent to read it first.
|
|
307
|
+
|
|
308
|
+
Each week `chief_of_staff` helps you pick one **main focus**: the item worth most to the company, its products and your colleagues, broken into one small step per day. It sits at the top of `weeks/<week>/plan.md`, and every agent keeps it in view: they tie their work to it, say when a request pulls away from it, and suggest the next small step when a task ends.
|
|
309
|
+
|
|
310
|
+
## Change workflow skills
|
|
311
|
+
|
|
312
|
+
Skills for one code change: `codebase-research` (how the code works today, with a `path:line` for every claim), `open-decision` (an issue you looked into but cannot decide yet: options, unknowns and the steps to decide, in one file updated until you decide) and `change-spec` (the spec for a decided change, the brief for `rails_implementer`), plus `handoff`, `handoff-resume` and `handoff-list` to save an unfinished session and continue it later, in Claude Code, Codex or by hand. Install them with:
|
|
313
|
+
|
|
314
|
+
```sh
|
|
315
|
+
my-ruby-coding-agents install ./my-app --skills
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
They write to the folder in `NOTES_FOLDER`, outside the repository. See the [change-workflow plugin README](plugins/change-workflow/README.md).
|
|
319
|
+
|
|
166
320
|
## Development
|
|
167
321
|
|
|
168
322
|
After checking out the repository, run `bin/setup`, then `bundle exec rake` to
|
|
@@ -5,14 +5,16 @@ require "optparse"
|
|
|
5
5
|
module MyRubyCodingAgents
|
|
6
6
|
# Handles the command line interface for installing, checking, and listing agents.
|
|
7
7
|
class CLI
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
# plugin_runner runs the plugin commands for install --advisor.
|
|
9
|
+
def self.run(argv, out: $stdout, err: $stderr, plugin_runner: PluginInstaller::DEFAULT_RUNNER)
|
|
10
|
+
new(argv, out:, err:, plugin_runner:).run
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
def initialize(argv, out:, err:)
|
|
13
|
+
def initialize(argv, out:, err:, plugin_runner:)
|
|
13
14
|
@argv = argv.dup
|
|
14
15
|
@out = out
|
|
15
16
|
@err = err
|
|
17
|
+
@plugin_runner = plugin_runner
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def run
|
|
@@ -29,6 +31,7 @@ module MyRubyCodingAgents
|
|
|
29
31
|
when "install" then install
|
|
30
32
|
when "status" then status
|
|
31
33
|
when "list" then list
|
|
34
|
+
when "notes" then notes
|
|
32
35
|
when "--version", "-v" then @out.puts(MyRubyCodingAgents::VERSION)
|
|
33
36
|
when "--help", "-h", nil then @out.puts(help)
|
|
34
37
|
else unknown_command(command)
|
|
@@ -41,12 +44,16 @@ module MyRubyCodingAgents
|
|
|
41
44
|
2
|
|
42
45
|
end
|
|
43
46
|
|
|
47
|
+
# Exit 1 when a plugin command fails.
|
|
44
48
|
def install
|
|
45
49
|
options = parse_options("install")
|
|
46
50
|
return 0 if options[:help]
|
|
47
51
|
|
|
48
52
|
installer(options).install(force: options[:force], dry_run: options[:dry_run], out: @out)
|
|
49
|
-
0
|
|
53
|
+
return 0 if options[:plugins].empty?
|
|
54
|
+
|
|
55
|
+
scope = options[:user] ? "user" : "project"
|
|
56
|
+
plugin_installer(options).install(out: @out, dry_run: options[:dry_run], scope:) ? 0 : 1
|
|
50
57
|
end
|
|
51
58
|
|
|
52
59
|
# Exit 0 when every planned file is up to date, 1 otherwise.
|
|
@@ -57,40 +64,39 @@ module MyRubyCodingAgents
|
|
|
57
64
|
installer(options).status(out: @out) ? 0 : 1
|
|
58
65
|
end
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
options[:targets] = %i[codex claude] if options[:targets].empty?
|
|
66
|
-
options
|
|
67
|
-
end
|
|
67
|
+
# Exit 0 when the notes folder works for the selected tools, 1 otherwise.
|
|
68
|
+
def notes
|
|
69
|
+
options = parse_options("notes")
|
|
70
|
+
return 0 if options[:help]
|
|
71
|
+
raise ArgumentError, "notes takes no directory; it reads NOTES_FOLDER" unless @argv.empty?
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
opts.on("--codex", "Use Codex agents and AGENTS.md") { options[:targets] << :codex }
|
|
73
|
-
opts.on("--claude", "Use Claude agents and CLAUDE.md") { options[:targets] << :claude }
|
|
74
|
-
add_install_options(opts, options) if command == "install"
|
|
75
|
-
opts.on("-h", "--help", "Show this help") { show_help(opts, options) }
|
|
76
|
-
end
|
|
73
|
+
check = NotesCheck.new(targets: options[:targets])
|
|
74
|
+
check.init.each { |dir| @out.puts("create #{dir}") } if options[:init]
|
|
75
|
+
report_notes(check.problems)
|
|
77
76
|
end
|
|
78
77
|
|
|
79
|
-
def
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
def report_notes(problems)
|
|
79
|
+
@out.puts(problems.empty? ? "Notes folder: OK" : problems.map { |problem| "- #{problem}" })
|
|
80
|
+
problems.empty? ? 0 : 1
|
|
82
81
|
end
|
|
83
82
|
|
|
84
|
-
def
|
|
85
|
-
@out
|
|
86
|
-
options[:help] = true
|
|
83
|
+
def parse_options(command)
|
|
84
|
+
CLIOptions.parse(command, @argv, out: @out)
|
|
87
85
|
end
|
|
88
86
|
|
|
89
87
|
def installer(options)
|
|
90
88
|
models = Templates.models
|
|
91
89
|
agents = Templates.agents(models)
|
|
92
90
|
Installer.new(dir: @argv.first || ".", agents:, instructions: Templates.instructions(models, agents),
|
|
93
|
-
targets: options[:targets])
|
|
91
|
+
targets: options[:targets], user: options[:user])
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# A user install runs the plugin commands from the home folder, with
|
|
95
|
+
# Claude Code's user scope.
|
|
96
|
+
def plugin_installer(options)
|
|
97
|
+
dir = options[:user] ? Dir.home : @argv.first || "."
|
|
98
|
+
PluginInstaller.new(dir:, targets: options[:targets], plugins: options[:plugins],
|
|
99
|
+
source: options[:plugin_source], runner: @plugin_runner)
|
|
94
100
|
end
|
|
95
101
|
|
|
96
102
|
def list
|
|
@@ -104,26 +110,7 @@ module MyRubyCodingAgents
|
|
|
104
110
|
end
|
|
105
111
|
|
|
106
112
|
def help
|
|
107
|
-
|
|
108
|
-
Usage: my-ruby-coding-agents <command> [options]
|
|
109
|
-
|
|
110
|
-
Commands:
|
|
111
|
-
install [DIR] Install or refresh agents and delegation instructions (default DIR: .)
|
|
112
|
-
status [DIR] Show which files are missing, outdated, edited, or up to date
|
|
113
|
-
list List bundled agents
|
|
114
|
-
|
|
115
|
-
Options:
|
|
116
|
-
--codex Use Codex files only
|
|
117
|
-
--claude Use Claude Code files only
|
|
118
|
-
--force install: overwrite agent files, including edited ones
|
|
119
|
-
--dry-run install: show planned writes without changing files
|
|
120
|
-
-v, --version Show version
|
|
121
|
-
-h, --help Show this help
|
|
122
|
-
|
|
123
|
-
install writes missing files and refreshes generated agent files nobody
|
|
124
|
-
edited. It skips edited agent files unless --force is given.
|
|
125
|
-
status exits 0 when everything is up to date and 1 otherwise.
|
|
126
|
-
HELP
|
|
113
|
+
CLIHelp::TEXT
|
|
127
114
|
end
|
|
128
115
|
end
|
|
129
116
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MyRubyCodingAgents
|
|
4
|
+
# Usage text for the command line interface.
|
|
5
|
+
module CLIHelp
|
|
6
|
+
TEXT = <<~HELP.freeze
|
|
7
|
+
Usage: my-ruby-coding-agents <command> [options]
|
|
8
|
+
|
|
9
|
+
Commands:
|
|
10
|
+
install [DIR] Install or refresh agents and delegation instructions (default DIR: .)
|
|
11
|
+
status [DIR] Show which files are missing, outdated, edited, or up to date
|
|
12
|
+
list List bundled agents
|
|
13
|
+
notes Check the NOTES_FOLDER setup for the skills and
|
|
14
|
+
chief_of_staff (--init creates its subfolders)
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--codex Use Codex files only
|
|
18
|
+
--claude Use Claude Code files only
|
|
19
|
+
--user Use your home folders (~/.codex, ~/.claude; CODEX_HOME and
|
|
20
|
+
CLAUDE_CONFIG_DIR move them) instead of a project, so
|
|
21
|
+
nothing is written into the repository
|
|
22
|
+
--force install: overwrite agent files, including edited ones
|
|
23
|
+
--dry-run install: show planned writes without changing files
|
|
24
|
+
--advisor install: also install the advisor plugin into Codex and Claude Code
|
|
25
|
+
--skills install: also install the change-workflow skills plugin
|
|
26
|
+
(codebase-research, open-decision, change-spec)
|
|
27
|
+
--pr-watch install: also install the pr-watch plugin (reports new
|
|
28
|
+
comments, reviews and CI failures on your open PRs)
|
|
29
|
+
--plugin-source SOURCE
|
|
30
|
+
install: marketplace source for the plugin flags
|
|
31
|
+
(default: #{PluginInstaller::DEFAULT_SOURCE};
|
|
32
|
+
--advisor-source is an alias)
|
|
33
|
+
-v, --version Show version
|
|
34
|
+
-h, --help Show this help
|
|
35
|
+
|
|
36
|
+
install writes missing files and refreshes generated agent files nobody
|
|
37
|
+
edited. It skips edited agent files unless --force is given.
|
|
38
|
+
status exits 0 when everything is up to date and 1 otherwise.
|
|
39
|
+
install --advisor, --skills or --pr-watch runs `plugin marketplace add` and the
|
|
40
|
+
plugin install command of each selected tool. A tool missing from PATH is skipped, and
|
|
41
|
+
a failed command exits 1.
|
|
42
|
+
HELP
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "optparse"
|
|
4
|
+
|
|
5
|
+
module MyRubyCodingAgents
|
|
6
|
+
# Parses the options of the install and status commands. Removes them from
|
|
7
|
+
# argv, leaving at most the target directory.
|
|
8
|
+
module CLIOptions
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
# Raises OptionParser::ParseError on bad options. Prints the command's
|
|
12
|
+
# help to out and sets :help when asked for it.
|
|
13
|
+
def parse(command, argv, out:)
|
|
14
|
+
options = { targets: [], force: false, dry_run: false, help: false, plugins: [], user: false, init: false,
|
|
15
|
+
plugin_source: PluginInstaller::DEFAULT_SOURCE }
|
|
16
|
+
parser(command, options, out).parse!(argv)
|
|
17
|
+
raise OptionParser::InvalidArgument, "expected at most one target directory" if argv.length > 1
|
|
18
|
+
if user_with_dir?(options, argv)
|
|
19
|
+
raise OptionParser::InvalidArgument, "--user uses your home folders; drop the directory"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
options[:targets] = %i[codex claude] if options[:targets].empty?
|
|
23
|
+
options
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def parser(command, options, out)
|
|
27
|
+
OptionParser.new do |opts|
|
|
28
|
+
opts.banner = "Usage: my-ruby-coding-agents #{command} [DIR] [options]"
|
|
29
|
+
opts.on("--codex", "Use Codex agents and AGENTS.md") { options[:targets] << :codex }
|
|
30
|
+
opts.on("--claude", "Use Claude agents and CLAUDE.md") { options[:targets] << :claude }
|
|
31
|
+
opts.on("--user", "Use ~/.codex and ~/.claude instead of the project") { options[:user] = true }
|
|
32
|
+
add_install_options(opts, options) if command == "install"
|
|
33
|
+
opts.on("--init", "Create the notes folder and its subfolders") { options[:init] = true } if command == "notes"
|
|
34
|
+
opts.on("-h", "--help", "Show this help") { show_help(opts, options, out) }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def add_install_options(opts, options)
|
|
39
|
+
opts.on("--force", "Overwrite agent files, including edited ones") { options[:force] = true }
|
|
40
|
+
opts.on("--dry-run", "Show planned writes without changing files") { options[:dry_run] = true }
|
|
41
|
+
opts.on("--advisor", "Also install the advisor plugin") { options[:plugins] |= ["advisor"] }
|
|
42
|
+
opts.on("--skills", "Also install the change-workflow skills plugin") { options[:plugins] |= ["change-workflow"] }
|
|
43
|
+
opts.on("--pr-watch", "Also install the pr-watch plugin") { options[:plugins] |= ["pr-watch"] }
|
|
44
|
+
opts.on("--plugin-source SOURCE", "--advisor-source SOURCE", "Marketplace source for plugins") do |src|
|
|
45
|
+
options[:plugin_source] = src
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def show_help(opts, options, out)
|
|
50
|
+
out.puts(opts)
|
|
51
|
+
options[:help] = true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def user_with_dir?(options, argv)
|
|
55
|
+
options[:user] && !argv.empty?
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -15,9 +15,12 @@ module MyRubyCodingAgents
|
|
|
15
15
|
outdated: "outdated", edited: "edited", imported: "skipped" }.freeze
|
|
16
16
|
CLEAN_STATES = %i[up_to_date imported].freeze
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@
|
|
18
|
+
# user: true installs into each tool's home folder instead of dir.
|
|
19
|
+
def initialize(dir:, agents:, instructions:, targets:, user: false)
|
|
20
|
+
@root = user ? Dir.home : File.expand_path(dir)
|
|
21
|
+
@shown_root = user ? "~/" : ""
|
|
22
|
+
locations = user ? Locations.user : Locations.project(@root)
|
|
23
|
+
@planner = Planner.new(locations:, agents:, instructions:, targets:)
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
# Writes missing and outdated files. Edited agent files are kept unless
|
|
@@ -61,8 +64,12 @@ module MyRubyCodingAgents
|
|
|
61
64
|
entry.note ? "#{relative(entry.path)} (#{entry.note})" : relative(entry.path)
|
|
62
65
|
end
|
|
63
66
|
|
|
67
|
+
# Paths under the root are shown relative to it (with ~/ for a user
|
|
68
|
+
# install); a tool home moved elsewhere is shown in full.
|
|
64
69
|
def relative(path)
|
|
65
|
-
path.
|
|
70
|
+
return path unless path.start_with?("#{@root}/")
|
|
71
|
+
|
|
72
|
+
"#{@shown_root}#{path.delete_prefix("#{@root}/")}"
|
|
66
73
|
end
|
|
67
74
|
end
|
|
68
75
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MyRubyCodingAgents
|
|
4
|
+
# Where each tool's agent files and guide file go. A project install keeps
|
|
5
|
+
# them in the project. A user install puts them in each tool's home folder,
|
|
6
|
+
# so nothing is written into the repository; use it for repositories you do
|
|
7
|
+
# not own, such as an employer's.
|
|
8
|
+
module Locations
|
|
9
|
+
# dir holds the agent files; guide is the file that gets the delegation block.
|
|
10
|
+
Location = Data.define(:dir, :guide)
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def project(root)
|
|
15
|
+
{ codex: Location.new(dir: File.join(root, ".codex/agents"), guide: File.join(root, "AGENTS.md")),
|
|
16
|
+
claude: Location.new(dir: File.join(root, ".claude/agents"), guide: File.join(root, "CLAUDE.md")) }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# CODEX_HOME and CLAUDE_CONFIG_DIR move the homes, as they do for the tools.
|
|
20
|
+
def user(env: ENV, home: Dir.home)
|
|
21
|
+
codex = tool_home(env["CODEX_HOME"], File.join(home, ".codex"))
|
|
22
|
+
claude = tool_home(env["CLAUDE_CONFIG_DIR"], File.join(home, ".claude"))
|
|
23
|
+
{ codex: Location.new(dir: File.join(codex, "agents"), guide: File.join(codex, "AGENTS.md")),
|
|
24
|
+
claude: Location.new(dir: File.join(claude, "agents"), guide: File.join(claude, "CLAUDE.md")) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def tool_home(value, default)
|
|
28
|
+
File.expand_path(value.to_s.empty? ? default : value)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fileutils"
|
|
4
|
+
require "json"
|
|
5
|
+
require "open3"
|
|
6
|
+
|
|
7
|
+
module MyRubyCodingAgents
|
|
8
|
+
# Checks that the notes folder works for the selected tools. The skills and
|
|
9
|
+
# chief_of_staff write research, specs, open decisions and the work log to
|
|
10
|
+
# NOTES_FOLDER, a folder outside every repository. Each check returns the
|
|
11
|
+
# problems it found as plain sentences with the fix.
|
|
12
|
+
class NotesCheck
|
|
13
|
+
SUBFOLDERS = %w[research specs open-decisions handoffs codebase weeks context team].freeze
|
|
14
|
+
SKILLS = %w[codebase-research open-decision change-spec handoff handoff-resume handoff-list].freeze
|
|
15
|
+
|
|
16
|
+
# env and home are injectable for tests.
|
|
17
|
+
def initialize(targets:, env: ENV, home: Dir.home)
|
|
18
|
+
@targets = targets
|
|
19
|
+
@env = env
|
|
20
|
+
@home = home
|
|
21
|
+
@notes = env["NOTES_FOLDER"].to_s
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def problems
|
|
25
|
+
return [unset_problem] if @notes.empty?
|
|
26
|
+
|
|
27
|
+
[*folder_problems, *@targets.flat_map { |target| public_send(:"#{target}_problems") }]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Creates the notes folder and its standard subfolders. Returns the ones created.
|
|
31
|
+
def init
|
|
32
|
+
return [] if @notes.empty?
|
|
33
|
+
|
|
34
|
+
SUBFOLDERS.map { |name| File.join(@notes, name) }.reject { |dir| File.directory?(dir) }.each do |dir|
|
|
35
|
+
FileUtils.mkdir_p(dir)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def codex_problems
|
|
40
|
+
config = File.join(tool_home("CODEX_HOME", ".codex"), "config.toml")
|
|
41
|
+
return [] if File.file?(config) && File.read(config).include?(@notes)
|
|
42
|
+
|
|
43
|
+
["Codex's sandbox blocks writes to #{@notes}. Add it to #{config}:\n" \
|
|
44
|
+
" [sandbox_workspace_write]\n writable_roots = [\"#{@notes}\"]"]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def claude_problems
|
|
48
|
+
path = File.join(tool_home("CLAUDE_CONFIG_DIR", ".claude"), "settings.json")
|
|
49
|
+
settings = File.file?(path) ? JSON.parse(File.read(path)) : {}
|
|
50
|
+
[*hidden_skills(settings, path), *missing_directory(settings, path)]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def unset_problem
|
|
56
|
+
"NOTES_FOLDER is not set. Pick a folder outside every repository and add to your shell profile:\n" \
|
|
57
|
+
" export NOTES_FOLDER=\"$HOME/notes/<project>\""
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def folder_problems
|
|
61
|
+
return ["NOTES_FOLDER (#{@notes}) does not exist. Create it with: my-ruby-coding-agents notes --init"] \
|
|
62
|
+
unless File.directory?(@notes)
|
|
63
|
+
|
|
64
|
+
top, status = Open3.capture2e("git", "-C", @notes, "rev-parse", "--show-toplevel")
|
|
65
|
+
return [] unless status.success?
|
|
66
|
+
|
|
67
|
+
["NOTES_FOLDER is inside the git repository #{top.strip}; notes would end up in commits. " \
|
|
68
|
+
"Pick a folder outside it."]
|
|
69
|
+
rescue Errno::ENOENT
|
|
70
|
+
[]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def hidden_skills(settings, path)
|
|
74
|
+
overrides = settings.fetch("skillOverrides", {})
|
|
75
|
+
SKILLS.select { |name| overrides[name] == "off" }.map do |name|
|
|
76
|
+
"#{path} turns the #{name} skill off (\"skillOverrides\": { \"#{name}\": \"off\" }). Remove that line."
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def missing_directory(settings, path)
|
|
81
|
+
dirs = Array(settings.dig("permissions", "additionalDirectories")).map { |dir| expand(dir) }
|
|
82
|
+
return [] if dirs.include?(File.expand_path(@notes))
|
|
83
|
+
|
|
84
|
+
["Claude Code asks before every write to #{@notes}. Add it to #{path}:\n" \
|
|
85
|
+
" \"permissions\": { \"additionalDirectories\": [\"#{@notes}\"] }"]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Expands ~ against the home given to this check, not the process HOME.
|
|
89
|
+
def expand(path)
|
|
90
|
+
File.expand_path(path.sub(%r{\A~(?=/|\z)}, @home), @home)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def tool_home(variable, default)
|
|
94
|
+
Locations.tool_home(@env[variable], File.join(@home, default))
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -9,16 +9,14 @@ module MyRubyCodingAgents
|
|
|
9
9
|
# (CLAUDE.md that imports AGENTS.md). note is extra text for output.
|
|
10
10
|
Entry = Data.define(:path, :content, :kind, :state, :note)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
codex: { dir: ".codex/agents", ext: "toml", guide: "AGENTS.md" },
|
|
14
|
-
claude: { dir: ".claude/agents", ext: "md", guide: "CLAUDE.md" }
|
|
15
|
-
}.freeze
|
|
12
|
+
EXTENSIONS = { codex: "toml", claude: "md" }.freeze
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
# locations maps each target to its Locations::Location.
|
|
15
|
+
def initialize(locations:, agents:, instructions:, targets:)
|
|
16
|
+
@locations = locations
|
|
19
17
|
@agents = agents
|
|
20
18
|
@instructions = instructions
|
|
21
|
-
@targets =
|
|
19
|
+
@targets = EXTENSIONS.keys & Array(targets).map(&:to_sym)
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
# Entries in install order. A linked CLAUDE.md and AGENTS.md refer to the
|
|
@@ -30,9 +28,9 @@ module MyRubyCodingAgents
|
|
|
30
28
|
private
|
|
31
29
|
|
|
32
30
|
def target_entries(target)
|
|
33
|
-
|
|
31
|
+
dir = @locations.fetch(target).dir
|
|
34
32
|
agents = @agents.map do |agent|
|
|
35
|
-
path = File.join(
|
|
33
|
+
path = File.join(dir, "#{agent.name}.#{EXTENSIONS.fetch(target)}")
|
|
36
34
|
agent_entry(path, Renderers.public_send(target, agent))
|
|
37
35
|
end
|
|
38
36
|
agents << guide_entry(target)
|
|
@@ -52,9 +50,11 @@ module MyRubyCodingAgents
|
|
|
52
50
|
end
|
|
53
51
|
|
|
54
52
|
def guide_entry(target)
|
|
55
|
-
path =
|
|
53
|
+
path = @locations.fetch(target).guide
|
|
56
54
|
return instruction_entry(path) unless target == :claude && InstructionFile.imports_agents?(path)
|
|
57
|
-
|
|
55
|
+
if @targets == [:claude]
|
|
56
|
+
return instruction_entry(File.join(File.dirname(path), "AGENTS.md"), note: "imported by CLAUDE.md")
|
|
57
|
+
end
|
|
58
58
|
|
|
59
59
|
Entry.new(path:, content: nil, kind: :instructions, state: :imported, note: "imports AGENTS.md")
|
|
60
60
|
end
|