1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# Phase 01 — Rename namespace
**Estimated time:** ~30 minutes
**Touches:** Every file in the gem.
## Goal
Rename the entire codebase from `Claude` to `MiniMax`. After this phase the
gem still functionally targets api.anthropic.com (configuration swap is in
phase 04) — we are only renaming the Ruby surface, files, and gemspec here.
## Steps
### 1. Rename source directories and files
```text
lib/dispatch/adapter/claude.rb → lib/dispatch/adapter/minimax.rb
lib/dispatch/adapter/claude/ → lib/dispatch/adapter/minimax/
sig/dispatch/adapter/claude.rbs → sig/dispatch/adapter/minimax.rbs
spec/dispatch/adapter/claude/ → spec/dispatch/adapter/minimax/
spec/dispatch/adapter/claude_spec.rb → spec/dispatch/adapter/minimax_spec.rb
dispatch-adapter-claude.gemspec → dispatch-adapter-minimax.gemspec
```
DELETE the built-gem artifact:
```text
dispatch-adapter-claude-0.2.0.gem → DELETED
```
### 2. Rename Ruby module everywhere
Replace `Dispatch::Adapter::Claude` with `Dispatch::Adapter::MiniMax`
throughout the codebase. `MiniMax` uses CamelCase exactly as written
(double capital).
Concretely, in every `*.rb` and `*.rbs` file under `lib/`, `spec/`, `sig/`,
`bin/`, and `examples/`:
- `class Claude < Base` → `class MiniMax < Base`
- `Dispatch::Adapter::Claude` → `Dispatch::Adapter::MiniMax`
- `class Claude::Foo` (and similar nested forms) → `class MiniMax::Foo`
- `Claude::VERSION` → `MiniMax::VERSION`
- `Claude::DEFAULT_*` → `MiniMax::DEFAULT_*`
- The `module ClaudeVersion` block in `lib/dispatch/adapter/minimax/version.rb`
→ `module MiniMaxVersion`
- The `ClaudeErrors` module → `MiniMaxErrors`
### 3. Update `require_relative` paths in `lib/dispatch/adapter/minimax.rb`
All sub-module requires must point at the new directory:
```ruby
require_relative "minimax/version"
require_relative "minimax/errors"
require_relative "minimax/key_store" # was token_store — rename in phase 03
require_relative "minimax/headers"
require_relative "minimax/pricing_table"
require_relative "minimax/model_catalog"
require_relative "minimax/request_builder"
require_relative "minimax/response_builder"
require_relative "minimax/stream_collector"
require_relative "minimax/sse_parser"
require_relative "minimax/http_client"
```
NOTE: At this phase `key_store` does not yet exist; the file is still named
`token_store.rb`. Leave the require pointing at `minimax/token_store` for now
and rename in phase 03. DO NOT delete `pkce`, `oauth`, `cloaking`,
`usage_client`, or `rate_limit_headers` requires yet — that's phase 02.
### 4. Reset the version
Edit `lib/dispatch/adapter/minimax/version.rb`:
```ruby
# frozen_string_literal: true
module Dispatch
module Adapter
module MiniMaxVersion
VERSION = "0.1.0"
end
end
end
```
### 5. Rewrite the gemspec
Edit `dispatch-adapter-minimax.gemspec`:
- `spec.name` → `"dispatch-adapter-minimax"`
- `spec.version` → `Dispatch::Adapter::MiniMaxVersion::VERSION`
- `spec.summary` → `"MiniMax adapter for the Dispatch interface."`
- `spec.description` → A one-paragraph description mentioning MiniMax M2.7,
Token Plan, Anthropic-compatible /v1/messages endpoint.
- `spec.metadata["source_code_uri"]` and `homepage_uri` → adjust as needed
(leave placeholder if you don't know the new repo URL yet).
Keep all existing runtime dependencies (`dispatch-adapter-interface`).
DO NOT add new dependencies in this phase.
### 6. Rename the spec helper if it references Claude
`spec/spec_helper.rb` may contain `require "dispatch/adapter/claude"` —
update to `require "dispatch/adapter/minimax"`.
### 7. Update the `Gemfile` if it has explicit references
The `Gemfile` should NOT need changes (it loads the gemspec dynamically),
but verify there are no hardcoded `dispatch-adapter-claude` references.
### 8. Delete the lockfile so it regenerates
DELETE `Gemfile.lock`. It will regenerate on the next `bundle install`.
### 9. Update `.rspec`, `Rakefile`, `README.md`, `CHANGELOG.md`
For now, just rename references; the full README rewrite is phase 09.
At minimum:
- `.rspec` — usually doesn't reference the module; verify.
- `Rakefile` — replace any `Dispatch::Adapter::Claude` references.
- `README.md` — replace `Claude` with `MiniMax` in references; full rewrite later.
- `CHANGELOG.md` — replace existing content with a single line:
```
## 0.1.0 (unreleased)
- Initial release: forked from dispatch-adapter-claude.
```
- `AGENTS.md` — leave for now or skip; rewriting is phase 09.
### 10. Update file headers
The `# Anthropic Claude adapter` style comments at the top of files should
be updated to MiniMax equivalents where they appear (do not invent
references; just retarget existing comments).
## Acceptance criteria
After completing this phase:
- `grep -rn 'Dispatch::Adapter::Claude' .` (excluding `.git/`, `.rules/`,
`Gemfile.lock`) returns ZERO matches.
- `grep -rn 'class Claude' lib/ spec/ sig/` returns ZERO matches.
- `grep -rn 'ClaudeVersion\|ClaudeErrors' lib/ spec/ sig/` returns ZERO matches.
- The file `lib/dispatch/adapter/claude.rb` does NOT exist.
- The file `lib/dispatch/adapter/minimax.rb` exists.
- The directory `lib/dispatch/adapter/claude/` does NOT exist.
- The directory `lib/dispatch/adapter/minimax/` exists with the
ten `.rb` files (version, errors, token_store [still named that for now],
pkce, oauth, oauth/callback_server.rb, cloaking, headers, pricing_table,
model_catalog, request_builder, response_builder, stream_collector,
sse_parser, http_client, usage_client, rate_limit_headers).
- `dispatch-adapter-minimax.gemspec` exists; `dispatch-adapter-claude.gemspec`
and `dispatch-adapter-claude-0.2.0.gem` do NOT.
- `bundle install` runs cleanly inside the gem directory.
## Verification
Run `run_tests` with `project_path=reference/dispatch-adapter-minimax`.
Both rubocop and rspec must exit 0.
The specs may have many failures referencing OAuth / PKCE / cloaking
machinery that hasn't been deleted yet — this is expected. They should
not have failures from the rename itself (e.g. `NameError:
uninitialized constant Dispatch::Adapter::Claude`). If a spec fails
because of a renamed constant, fix the spec to use the new name.
If specs targeting OAuth/PKCE/cloaking/usage are STILL failing after the
rename (because the underlying code still uses Anthropic endpoints, which
won't be reachable in test mode), that's acceptable — those specs will
be deleted in phase 08. As long as rspec EXITS NON-ZERO only on
test-doubles / NameError / NoMethodError that the rename caused, you can
proceed.
**HOWEVER**: rubocop MUST pass cleanly. Resolve any naming-related
violations (e.g. `Naming/FileName` if a file's class name no longer matches
its filename) before calling `ask_for_next_plan`.
If rspec failures persist beyond rename-related causes, document them in
the summary and proceed. Phase 02 will delete the offending code.
|