ima-claude 2.18.0 → 2.25.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.
Files changed (103) hide show
  1. package/README.md +55 -9
  2. package/dist/cli.js +5 -1
  3. package/package.json +1 -1
  4. package/plugins/ima-claude/.claude-plugin/plugin.json +2 -2
  5. package/plugins/ima-claude/agents/explorer.md +29 -15
  6. package/plugins/ima-claude/agents/implementer.md +58 -13
  7. package/plugins/ima-claude/agents/memory.md +19 -19
  8. package/plugins/ima-claude/agents/reviewer.md +56 -34
  9. package/plugins/ima-claude/agents/tester.md +59 -16
  10. package/plugins/ima-claude/agents/wp-developer.md +66 -21
  11. package/plugins/ima-claude/hooks/bootstrap.sh +42 -44
  12. package/plugins/ima-claude/hooks/prompt_coach_digest.md +14 -17
  13. package/plugins/ima-claude/hooks/prompt_coach_system.md +10 -12
  14. package/plugins/ima-claude/personalities/README.md +17 -6
  15. package/plugins/ima-claude/personalities/enable-efficient.md +61 -0
  16. package/plugins/ima-claude/personalities/enable-terse.md +71 -0
  17. package/plugins/ima-claude/skills/agentic-workflows/SKILL.md +97 -0
  18. package/plugins/ima-claude/skills/agentic-workflows/references/phases/deliver.md +181 -0
  19. package/plugins/ima-claude/skills/agentic-workflows/references/phases/draft.md +99 -0
  20. package/plugins/ima-claude/skills/agentic-workflows/references/phases/gather.md +130 -0
  21. package/plugins/ima-claude/skills/agentic-workflows/references/phases/outline.md +106 -0
  22. package/plugins/ima-claude/skills/agentic-workflows/references/phases/review.md +137 -0
  23. package/plugins/ima-claude/skills/agentic-workflows/references/standards/draft-format.md +159 -0
  24. package/plugins/ima-claude/skills/agentic-workflows/references/standards/editorial-standards.md +160 -0
  25. package/plugins/ima-claude/skills/agentic-workflows/references/standards/outline-format.md +110 -0
  26. package/plugins/ima-claude/skills/agentic-workflows/references/templates/avada-construction-guide.md +263 -0
  27. package/plugins/ima-claude/skills/agentic-workflows/references/templates/avada-webinar-example.txt +275 -0
  28. package/plugins/ima-claude/skills/agentic-workflows/references/templates/cta-block-catalog.md +169 -0
  29. package/plugins/ima-claude/skills/agentic-workflows/references/templates/espo-email-preparation.md +241 -0
  30. package/plugins/ima-claude/skills/agentic-workflows/references/templates/webinar-recap-email-espo.html +339 -0
  31. package/plugins/ima-claude/skills/agentic-workflows/references/templates/webinar-reminder-email-espo.html +458 -0
  32. package/plugins/ima-claude/skills/agentic-workflows/references/workflows/editorial/webinar-summary.md +81 -0
  33. package/plugins/ima-claude/skills/architect/SKILL.md +54 -168
  34. package/plugins/ima-claude/skills/compound-bridge/SKILL.md +41 -94
  35. package/plugins/ima-claude/skills/design-to-code/SKILL.md +91 -0
  36. package/plugins/ima-claude/skills/design-to-code/references/guardrails.md +46 -0
  37. package/plugins/ima-claude/skills/design-to-code/references/phase-a-design-to-prompt.md +141 -0
  38. package/plugins/ima-claude/skills/design-to-code/references/phase-b-prompt-to-code.md +155 -0
  39. package/plugins/ima-claude/skills/design-to-code/references/prompt-template.md +95 -0
  40. package/plugins/ima-claude/skills/discourse/SKILL.md +79 -194
  41. package/plugins/ima-claude/skills/discourse-admin/SKILL.md +41 -103
  42. package/plugins/ima-claude/skills/docs-organize/SKILL.md +63 -203
  43. package/plugins/ima-claude/skills/ember-discourse/SKILL.md +90 -200
  44. package/plugins/ima-claude/skills/espocrm/SKILL.md +14 -23
  45. package/plugins/ima-claude/skills/espocrm-api/SKILL.md +79 -192
  46. package/plugins/ima-claude/skills/functional-programmer/SKILL.md +33 -237
  47. package/plugins/ima-claude/skills/gh-cli/SKILL.md +26 -65
  48. package/plugins/ima-claude/skills/ima-bootstrap/SKILL.md +71 -104
  49. package/plugins/ima-claude/skills/ima-bootstrap/references/ima-brand.md +32 -22
  50. package/plugins/ima-claude/skills/ima-brand/SKILL.md +18 -23
  51. package/plugins/ima-claude/skills/ima-copywriting/SKILL.md +68 -179
  52. package/plugins/ima-claude/skills/ima-doc2pdf/SKILL.md +32 -102
  53. package/plugins/ima-claude/skills/ima-editorial-scorecard/SKILL.md +38 -63
  54. package/plugins/ima-claude/skills/ima-editorial-workflow/SKILL.md +69 -114
  55. package/plugins/ima-claude/skills/ima-email-creator/SKILL.md +16 -22
  56. package/plugins/ima-claude/skills/ima-forms-expert/SKILL.md +21 -37
  57. package/plugins/ima-claude/skills/jira-checkpoint/SKILL.md +39 -120
  58. package/plugins/ima-claude/skills/jquery/SKILL.md +107 -233
  59. package/plugins/ima-claude/skills/js-fp/SKILL.md +75 -296
  60. package/plugins/ima-claude/skills/js-fp-api/SKILL.md +52 -162
  61. package/plugins/ima-claude/skills/js-fp-react/SKILL.md +47 -270
  62. package/plugins/ima-claude/skills/js-fp-vue/SKILL.md +55 -209
  63. package/plugins/ima-claude/skills/js-fp-wordpress/SKILL.md +59 -204
  64. package/plugins/ima-claude/skills/livecanvas/SKILL.md +19 -32
  65. package/plugins/ima-claude/skills/mcp-atlassian/SKILL.md +146 -136
  66. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-attachments.md +115 -0
  67. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-auth.md +103 -0
  68. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-bulk.md +149 -0
  69. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-misc.md +195 -0
  70. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-sprints.md +158 -0
  71. package/plugins/ima-claude/skills/mcp-context7/SKILL.md +32 -64
  72. package/plugins/ima-claude/skills/mcp-gitea/SKILL.md +98 -188
  73. package/plugins/ima-claude/skills/mcp-github/SKILL.md +60 -124
  74. package/plugins/ima-claude/skills/mcp-memory/SKILL.md +1 -177
  75. package/plugins/ima-claude/skills/mcp-qdrant/SKILL.md +58 -115
  76. package/plugins/ima-claude/skills/mcp-sequential/SKILL.md +32 -87
  77. package/plugins/ima-claude/skills/mcp-serena/SKILL.md +54 -80
  78. package/plugins/ima-claude/skills/mcp-tavily/SKILL.md +40 -63
  79. package/plugins/ima-claude/skills/mcp-vestige/SKILL.md +75 -116
  80. package/plugins/ima-claude/skills/php-authnet/SKILL.md +32 -65
  81. package/plugins/ima-claude/skills/php-fp/SKILL.md +50 -129
  82. package/plugins/ima-claude/skills/php-fp-wordpress/SKILL.md +25 -73
  83. package/plugins/ima-claude/skills/phpunit-wp/SKILL.md +103 -463
  84. package/plugins/ima-claude/skills/playwright/SKILL.md +69 -220
  85. package/plugins/ima-claude/skills/prompt-starter/SKILL.md +35 -82
  86. package/plugins/ima-claude/skills/prompt-starter/references/code-review.md +38 -0
  87. package/plugins/ima-claude/skills/py-fp/SKILL.md +78 -384
  88. package/plugins/ima-claude/skills/quasar-fp/SKILL.md +54 -255
  89. package/plugins/ima-claude/skills/quickstart/SKILL.md +7 -11
  90. package/plugins/ima-claude/skills/rails/SKILL.md +63 -184
  91. package/plugins/ima-claude/skills/resume-session/SKILL.md +14 -35
  92. package/plugins/ima-claude/skills/rg/SKILL.md +61 -146
  93. package/plugins/ima-claude/skills/ruby-fp/SKILL.md +66 -163
  94. package/plugins/ima-claude/skills/save-session/SKILL.md +10 -39
  95. package/plugins/ima-claude/skills/scorecard/SKILL.md +24 -38
  96. package/plugins/ima-claude/skills/skill-analyzer/SKILL.md +42 -71
  97. package/plugins/ima-claude/skills/skill-creator/SKILL.md +79 -250
  98. package/plugins/ima-claude/skills/task-master/SKILL.md +11 -31
  99. package/plugins/ima-claude/skills/task-planner/SKILL.md +44 -153
  100. package/plugins/ima-claude/skills/task-runner/SKILL.md +61 -143
  101. package/plugins/ima-claude/skills/unit-testing/SKILL.md +59 -134
  102. package/plugins/ima-claude/skills/wp-ddev/SKILL.md +38 -120
  103. package/plugins/ima-claude/skills/wp-local/SKILL.md +26 -108
@@ -5,19 +5,19 @@ description: "Cognitive memory engine with semantic search, spaced repetition, a
5
5
 
6
6
  # Vestige MCP - Cognitive Memory Engine
7
7
 
8
- **Replaces Memory MCP.** Vestige is a Rust-based cognitive memory system with FSRS-6 spaced repetition, semantic search, prediction error gating, and codebase awareness.
8
+ Rust-based cognitive memory system with FSRS-6 spaced repetition, semantic search, prediction error gating, and codebase awareness. Replaces Memory MCP.
9
9
 
10
- ## Architecture (3-Tier Memory)
10
+ ## 3-Tier Memory Architecture
11
11
 
12
- | System | Role | Lifecycle | Example |
13
- |--------|------|-----------|---------|
14
- | **Vestige** | Neural memory — decisions, preferences, patterns, bugs, learnings | Fades if unused (FSRS-6 decay) | "We chose JWT over sessions because..." |
15
- | **Qdrant** | Permanent library — reference material, standards, PRDs, architecture docs | Persistent forever | "Our payment system uses Accept.js with ARB" |
16
- | **Serena Memory** | Project workbench — session state, task progress | Project-scoped, survives git ops | "Currently on task 3/5, next: write tests" |
12
+ | System | Role | Lifecycle |
13
+ |--------|------|-----------|
14
+ | **Vestige** | Neural memory — decisions, preferences, patterns, bugs | Fades if unused (FSRS-6 decay) |
15
+ | **Qdrant** | Permanent library — standards, PRDs, architecture docs | Persistent forever |
16
+ | **Serena Memory** | Project workbench — session state, task progress | Project-scoped |
17
17
 
18
18
  ## Session Start Protocol (REQUIRED)
19
19
 
20
- At session start, BEFORE asking questions:
20
+ Run BEFORE asking questions:
21
21
 
22
22
  ```
23
23
  mcp__vestige__search query: "{project-name}" limit: 5
@@ -25,14 +25,11 @@ mcp__vestige__search query: "user-eric preferences" limit: 5
25
25
  mcp__vestige__intention action: "check"
26
26
  ```
27
27
 
28
- If working in a Serena-activated project, also check:
29
- ```
30
- mcp__serena__list_memories
31
- ```
28
+ If Serena-activated project, also run `mcp__serena__list_memories`.
32
29
 
33
30
  ## Core Tools
34
31
 
35
- ### Search (Your Most-Used Tool)
32
+ ### search
36
33
 
37
34
  ```
38
35
  mcp__vestige__search
@@ -40,9 +37,9 @@ mcp__vestige__search
40
37
  limit: 5
41
38
  ```
42
39
 
43
- Hybrid search — keyword + semantic + RRF fusion. Returns ranked results with similarity scores.
40
+ Hybrid keyword + semantic + RRF fusion. Your most-used tool.
44
41
 
45
- ### Smart Ingest (Intelligent Storage)
42
+ ### smart_ingest
46
43
 
47
44
  ```
48
45
  mcp__vestige__smart_ingest
@@ -50,17 +47,17 @@ mcp__vestige__smart_ingest
50
47
  node_type: "decision"
51
48
  ```
52
49
 
53
- Automatically handles CREATE/UPDATE/SUPERSEDE based on similarity thresholds:
50
+ Auto-handles CREATE/UPDATE/SUPERSEDE:
54
51
 
55
- | Similarity | Action | Meaning |
56
- |------------|--------|---------|
57
- | >92% | REINFORCE | Near-duplicate — strengthen existing memory |
58
- | 75-92% | UPDATE | Related — merge new info into existing |
59
- | <75% | CREATE | Novel store as new memory |
52
+ | Similarity | Action |
53
+ |------------|--------|
54
+ | >92% | REINFORCE — strengthen existing |
55
+ | 75-92% | UPDATE — merge into existing |
56
+ | <75% | CREATE — new memory |
60
57
 
61
- **Always prefer `smart_ingest` over `ingest`**it prevents duplicates and maintains coherence.
58
+ Prefer `smart_ingest` over `ingest` — prevents duplicates.
62
59
 
63
- ### Direct Ingest (When You Need Control)
60
+ ### ingest
64
61
 
65
62
  ```
66
63
  mcp__vestige__ingest
@@ -68,9 +65,9 @@ mcp__vestige__ingest
68
65
  node_type: "preference"
69
66
  ```
70
67
 
71
- Bypasses dedup logic. Use only when you specifically want to force a new entry.
68
+ Bypasses dedup. Use only when forcing a new entry.
72
69
 
73
- ### Memory (Retrieve/Remove/Check)
70
+ ### memory
74
71
 
75
72
  ```
76
73
  mcp__vestige__memory
@@ -80,7 +77,7 @@ mcp__vestige__memory
80
77
 
81
78
  Actions: `get`, `remove`, `check_state`
82
79
 
83
- ## Codebase Tools
80
+ ### codebase
84
81
 
85
82
  ```
86
83
  mcp__vestige__codebase
@@ -88,20 +85,18 @@ mcp__vestige__codebase
88
85
  pattern_type: "architecture"
89
86
  ```
90
87
 
91
- Store codebase patterns and architectural decisions. Pattern types: `architecture`, `pattern`, `convention`, `dependency`.
88
+ Pattern types: `architecture`, `pattern`, `convention`, `dependency`
92
89
 
93
- ## Feedback Tools
90
+ ### Feedback
94
91
 
95
92
  ```
96
93
  mcp__vestige__promote_memory id: "{memory-id}"
97
94
  mcp__vestige__demote_memory id: "{memory-id}"
98
95
  ```
99
96
 
100
- Strengthen or weaken memories based on relevance. Use when:
101
- - **Promote**: Memory proved useful, user referenced it, decision confirmed
102
- - **Demote**: Memory outdated, user contradicted it, no longer relevant
97
+ Promote when memory proved useful. Demote when outdated or contradicted.
103
98
 
104
- ## Intention Tools
99
+ ### intention
105
100
 
106
101
  ```
107
102
  mcp__vestige__intention
@@ -112,66 +107,48 @@ mcp__vestige__intention
112
107
 
113
108
  Actions: `set`, `check`, `complete`, `cancel`
114
109
 
115
- Set reminders and future triggers that surface automatically at session start.
116
-
117
- ## Session & Maintenance Tools
110
+ ## Maintenance Tools
118
111
 
119
112
  | Tool | Purpose |
120
113
  |------|---------|
121
- | `session_checkpoint` | Batch-save an entire session's work |
114
+ | `session_checkpoint` | Batch-save entire session |
122
115
  | `find_duplicates` | Detect and merge redundant memories |
123
116
  | `consolidate` | Run FSRS-6 decay and maintenance |
124
- | `importance_score` | 4-channel scoring (novelty, arousal, reward, attention) |
125
- | `memory_timeline` | Browse memories chronologically |
126
- | `health_check` | System health with warnings |
117
+ | `memory_timeline` | Browse chronologically |
118
+ | `health_check` | System health warnings |
127
119
 
128
- ## Proactive Behavior Rules
120
+ ## Proactive Behavior (MUST, not suggestions)
129
121
 
130
- **These are MUST behaviors, not suggestions:**
131
-
132
- ### 1. Session Start: Search for Context
133
- When beginning work on any project, **automatically search** for relevant context:
134
- ```
135
- mcp__vestige__search query: "{project-name}"
136
- mcp__vestige__search query: "user-eric"
137
- mcp__vestige__intention action: "check"
138
- ```
139
-
140
- ### 2. During Work: Store Decisions As They Happen
141
- When ANY of these occur, **immediately store without being asked**:
122
+ ### Store immediately no prompting needed
142
123
 
143
124
  | Event | Action |
144
125
  |-------|--------|
145
- | User states a preference | `smart_ingest` with node_type: "preference" |
146
- | Architectural decision made | `smart_ingest` with node_type: "decision" |
147
- | Bug root cause identified | `smart_ingest` with node_type: "bug" |
148
- | Pattern chosen over alternatives | `smart_ingest` with node_type: "pattern" |
149
- | User corrects your approach | `smart_ingest` with node_type: "preference" |
126
+ | User states preference | `smart_ingest` node_type: "preference" |
127
+ | Architectural decision | `smart_ingest` node_type: "decision" |
128
+ | Bug root cause identified | `smart_ingest` node_type: "bug" |
129
+ | Pattern chosen over alternatives | `smart_ingest` node_type: "pattern" |
130
+ | User corrects your approach | `smart_ingest` node_type: "preference" |
150
131
  | Codebase pattern discovered | `codebase` with appropriate pattern_type |
151
- | `/workflows:compound` creates solution | `smart_ingest` with node_type: "pattern" (root cause + insight) |
152
- | `/workflows:plan` research completes | `smart_ingest` with node_type: "decision" (approach chosen) |
153
- | `/workflows:review` finds P1/P2 | `smart_ingest` with node_type: "pattern" (finding summary) |
154
132
 
155
- **Recognition patterns** — store when you hear:
156
- - "I prefer..." / "I like..." / "I always..." / "I never..."
133
+ Recognition phrases — store when you hear:
134
+ - "I prefer..." / "I always..." / "I never..."
157
135
  - "Let's go with X because..." / "We chose X over Y"
158
- - "The reason this failed was..." / "Root cause:"
159
- - "From now on..." / "Going forward..."
160
- - "That's not how we do it" / "Actually, we..."
161
-
162
- ### 3. Session End: Capture Learnings
163
- Before ending significant sessions:
164
- - What decisions were made that should persist?
165
- - What did you learn about the user's preferences?
166
- - Set any intentions for future work?
167
-
168
- ### 4. Before Asking Questions You Might Already Know
169
- Before asking "What framework do you use?" or "How do you prefer X?", **search first**:
136
+ - "Root cause:" / "The reason this failed was..."
137
+ - "From now on..." / "That's not how we do it"
138
+
139
+ ### Before asking questions, search first
140
+
170
141
  ```
171
142
  mcp__vestige__search query: "preference {topic}"
172
143
  ```
173
144
 
174
- ## Node Types Reference
145
+ ### Session end — capture before closing
146
+
147
+ - What decisions persist?
148
+ - What preferences were revealed?
149
+ - Set intentions for next session?
150
+
151
+ ## Node Types
175
152
 
176
153
  | Type | Use For |
177
154
  |------|---------|
@@ -185,75 +162,57 @@ mcp__vestige__search query: "preference {topic}"
185
162
 
186
163
  ## Memory States
187
164
 
188
- Vestige manages memory lifecycle automatically via FSRS-6:
189
-
190
165
  | State | Meaning |
191
166
  |-------|---------|
192
- | **Active** | Readily accessible, frequently retrieved |
193
- | **Dormant** | Stored but weakly retrievable — promote if still relevant |
194
- | **Silent** | Deeply encoded, temporarily inaccessible |
195
- | **Unavailable** | Naturally decayed or removed |
196
-
197
- Memories that are searched for get reinforced. Unused memories naturally decay. This prevents knowledge bloat without manual cleanup.
167
+ | Active | Readily accessible |
168
+ | Dormant | Weakly retrievable — promote if still relevant |
169
+ | Silent | Deeply encoded, temporarily inaccessible |
170
+ | Unavailable | Decayed or removed |
198
171
 
199
172
  ## Decision Logic
200
173
 
201
- **Will it fade if we stop referencing it? That determines where it goes.**
202
-
203
174
  ```
204
- IF knowledge that should strengthen with use, fade if unused
205
- (preferences, decisions, patterns, bugs, learnings):
206
- → Vestige smart_ingest (neural memory — decays naturally)
207
- ELSE IF reference material that should never be forgotten
208
- (wiki, standards, PRDs, architecture docs, code samples):
209
- → Qdrant qdrant-store (permanent library)
175
+ IF knowledge that strengthens with use, fades if unused
176
+ (preferences, decisions, patterns, bugs):
177
+ → Vestige smart_ingest
178
+ ELSE IF reference material that must never be forgotten
179
+ (standards, PRDs, architecture docs):
180
+ → Qdrant qdrant-store
210
181
  ELSE IF session state or project progress:
211
- → Serena write_memory (project workbench)
212
- ELSE IF future reminder or intention:
182
+ → Serena write_memory
183
+ ELSE IF future reminder:
213
184
  → Vestige intention
214
185
  ELSE IF codebase architecture pattern:
215
186
  → Vestige codebase
216
187
  ELSE IF searching for prior context:
217
- → Vestige search (semantic + keyword)
188
+ → Vestige search
218
189
  ```
219
190
 
220
191
  ## What NOT to Store
221
192
 
222
- - Temporary debugging steps (use Serena session state instead)
193
+ - Temporary debugging steps (use Serena session state)
223
194
  - One-off fixes unlikely to recur
224
- - Information already in project docs (CLAUDE.md, README)
225
- - Sensitive data (credentials, API keys)
226
- - Session progress (use Serena for that)
195
+ - Info already in CLAUDE.md or README
196
+ - Credentials, API keys
197
+ - Session progress (use Serena)
227
198
 
228
199
  ## Migration from Memory MCP
229
200
 
230
- Vestige replaces Memory MCP. The mapping:
231
-
232
201
  | Memory MCP | Vestige Equivalent |
233
202
  |------------|-------------------|
234
- | `search_nodes` | `search` (semantic + keyword hybrid) |
203
+ | `search_nodes` | `search` |
235
204
  | `open_nodes` | `search` with specific name |
236
- | `create_entities` | `smart_ingest` (auto-dedup) |
237
- | `add_observations` | `smart_ingest` (auto-UPDATE on similarity) |
238
- | `create_relations` | Not needed spreading activation via semantic similarity |
205
+ | `create_entities` | `smart_ingest` |
206
+ | `add_observations` | `smart_ingest` |
207
+ | `create_relations` | Not needed (spreading activation via semantic similarity) |
239
208
  | `read_graph` | `memory_timeline` or `search` |
240
- | `delete_*` | `memory` with action: "remove" or `demote_memory` |
209
+ | `delete_*` | `memory` action: "remove" or `demote_memory` |
241
210
 
242
211
  ## Setup
243
212
 
244
- Install Vestige MCP:
245
-
246
213
  ```bash
247
- # Via cargo (Rust required)
248
214
  cargo install vestige-mcp
249
-
250
- # Or download binary from releases
251
- # https://github.com/samvallad33/vestige/releases
252
- ```
253
-
254
- Configure in Claude Code:
255
- ```bash
256
215
  claude mcp add --scope user vestige -- vestige-mcp
257
216
  ```
258
217
 
259
- Configuration is stored in `~/.config/vestige/` (global) or `.vestige/` (per-project).
218
+ Config: `~/.config/vestige/` (global) or `.vestige/` (per-project).
@@ -5,14 +5,12 @@ description: "Authorize.Net PHP SDK patterns for payment processing, CIM profile
5
5
 
6
6
  # Authorize.Net PHP SDK
7
7
 
8
- Patterns and reference for the `authorizenet/authorizenet` PHP SDK (^2.0). PHP-only — no JavaScript, Python, Ruby, or Node patterns.
8
+ Patterns for `authorizenet/authorizenet` PHP SDK (^2.0). PHP-only.
9
9
 
10
- **Companion skills**: `php-fp` (core FP patterns), `php-fp-wordpress` (WordPress integration)
10
+ **Companion skills**: `php-fp`, `php-fp-wordpress`
11
11
 
12
12
  ## Architecture: Three-Layer FP Pattern
13
13
 
14
- Authorize.Net integration follows a strict three-layer separation:
15
-
16
14
  ```
17
15
  [Pure Builders] → [SDK Adapter (Impure)] → [Pure Parsers]
18
16
  plain arrays SDK objects + I/O result arrays
@@ -20,7 +18,7 @@ Authorize.Net integration follows a strict three-layer separation:
20
18
 
21
19
  ### Layer 1: Pure Request Builders
22
20
 
23
- Normalize input into plain arrays. No SDK imports, no `date()`, no side effects.
21
+ Normalize input to plain arrays. No SDK imports, no `date()`, no side effects.
24
22
 
25
23
  ```php
26
24
  <?php declare(strict_types=1);
@@ -37,7 +35,7 @@ function build_charge_request(array $payment_data): array {
37
35
 
38
36
  ### Layer 2: SDK Adapter (Impure)
39
37
 
40
- All `use net\authorize\api\...` imports confined here. Builds SDK objects, executes requests, normalizes responses to plain arrays. Never throws — catches exceptions and returns error arrays.
38
+ All `use net\authorize\api\...` imports confined here. Builds SDK objects, executes requests, normalizes responses to plain arrays. Never throws — catches exceptions, returns error arrays.
41
39
 
42
40
  ```php
43
41
  <?php declare(strict_types=1);
@@ -57,8 +55,6 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
57
55
  $merchant_auth->setName($credentials['api_login_id']);
58
56
  $merchant_auth->setTransactionKey($credentials['transaction_key']);
59
57
 
60
- // ... build SDK objects from plain array ...
61
-
62
58
  $controller = new AnetController\CreateTransactionController($request);
63
59
  $response = $controller->executeWithApiResponse($credentials['api_url']);
64
60
 
@@ -67,7 +63,6 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
67
63
  return [
68
64
  'result_code' => $response->getMessages()->getResultCode(),
69
65
  'transaction_id' => $response->getTransactionResponse()?->getTransId(),
70
- // ... normalize all fields to plain values ...
71
66
  ];
72
67
  } catch (\Exception $e) {
73
68
  return array_merge($null_response, [
@@ -80,7 +75,7 @@ function sdk_charge_customer(array $payment_data, array $credentials): array {
80
75
 
81
76
  ### Layer 3: Pure Response Parsers
82
77
 
83
- Interpret normalized arrays into standard `['success' => bool, ...]` results. No SDK dependencies.
78
+ Interpret normalized arrays into `['success' => bool, ...]` results. No SDK dependencies.
84
79
 
85
80
  ```php
86
81
  <?php declare(strict_types=1);
@@ -96,23 +91,22 @@ function parse_charge_response(array $response): array {
96
91
  }
97
92
  ```
98
93
 
99
- ### SDK Orchestrator Pattern
94
+ ### Orchestrator
100
95
 
101
- Thin glue connecting adapter to parser — no business logic:
96
+ Thin glue — no business logic:
102
97
 
103
98
  ```php
104
99
  function charge_customer_via_sdk(array $payment_data, array $credentials): array {
105
- $normalized = sdk_charge_customer($payment_data, $credentials);
106
- return parse_charge_response($normalized);
100
+ return parse_charge_response(sdk_charge_customer($payment_data, $credentials));
107
101
  }
108
102
  ```
109
103
 
110
104
  ## SDK Namespace Reference
111
105
 
112
106
  ```php
113
- use net\authorize\api\contract\v1 as AnetAPI; // Data types (request/response objects)
114
- use net\authorize\api\controller as AnetController; // Controllers (execute requests)
115
- use net\authorize\api\constants\ANetEnvironment; // SANDBOX / PRODUCTION URLs
107
+ use net\authorize\api\contract\v1 as AnetAPI; // Data types (request/response objects)
108
+ use net\authorize\api\controller as AnetController; // Controllers (execute requests)
109
+ use net\authorize\api\constants\ANetEnvironment; // SANDBOX / PRODUCTION URLs
116
110
  ```
117
111
 
118
112
  ## Authentication
@@ -123,22 +117,19 @@ $merchant_auth->setName($credentials['api_login_id']);
123
117
  $merchant_auth->setTransactionKey($credentials['transaction_key']);
124
118
  ```
125
119
 
126
- **Credential storage**: Use `wp-config.php` constants first, options table as fallback.
120
+ **Credential storage**: `wp-config.php` constants first, options table as fallback.
127
121
 
128
122
  ```php
129
- // Constants-first pattern
130
123
  $api_login = defined('IMA_PAYMENTS_API_LOGIN_ID')
131
124
  ? IMA_PAYMENTS_API_LOGIN_ID
132
125
  : get_option('ima_payments_api_login_id', '');
133
126
  ```
134
127
 
135
- **Environment switching**:
128
+ **Environment**:
136
129
 
137
130
  ```php
138
- // Sandbox
139
- $controller->executeWithApiResponse(ANetEnvironment::SANDBOX);
140
- // Production
141
- $controller->executeWithApiResponse(ANetEnvironment::PRODUCTION);
131
+ $controller->executeWithApiResponse(ANetEnvironment::SANDBOX); // Sandbox
132
+ $controller->executeWithApiResponse(ANetEnvironment::PRODUCTION); // Production
142
133
  ```
143
134
 
144
135
  ## Transaction Types
@@ -151,24 +142,20 @@ $controller->executeWithApiResponse(ANetEnvironment::PRODUCTION);
151
142
  | Refund | `refundTransaction` | Refund settled transaction |
152
143
  | Void | `voidTransaction` | Cancel unsettled transaction |
153
144
 
154
- ## Accept.js Integration (PCI Compliance)
145
+ ## Accept.js Integration
155
146
 
156
- Accept.js tokenizes card data client-side. The server never sees raw card numbers only opaque payment nonces (valid 15 minutes).
157
-
158
- **Server-side token consumption**:
147
+ Accept.js tokenizes card data client-side server never sees raw card numbers. Nonces valid 15 minutes.
159
148
 
160
149
  ```php
161
150
  $opaque_data = new AnetAPI\OpaqueDataType();
162
- $opaque_data->setDataDescriptor('COMMON.ACCEPT.INAPP.PAYMENT');
151
+ $opaque_data->setDataDescriptor('COMMON.ACCEPT.INAPP.PAYMENT'); // always this value
163
152
  $opaque_data->setDataValue($payment_nonce);
164
153
 
165
154
  $payment_type = new AnetAPI\PaymentType();
166
155
  $payment_type->setOpaqueData($opaque_data);
167
156
  ```
168
157
 
169
- **Data descriptor** is always `'COMMON.ACCEPT.INAPP.PAYMENT'` for Accept.js tokens.
170
-
171
- ## Quick Reference: Common Operations
158
+ ## Common Operations
172
159
 
173
160
  ### Charge with Accept.js Token
174
161
 
@@ -176,7 +163,7 @@ $payment_type->setOpaqueData($opaque_data);
176
163
  $transaction_request = new AnetAPI\TransactionRequestType();
177
164
  $transaction_request->setTransactionType('authCaptureTransaction');
178
165
  $transaction_request->setAmount($amount);
179
- $transaction_request->setPayment($payment_type); // from Accept.js opaque data
166
+ $transaction_request->setPayment($payment_type);
180
167
  ```
181
168
 
182
169
  ### Charge Stored CIM Profile
@@ -195,12 +182,12 @@ $transaction_request->setAmount($amount);
195
182
  $transaction_request->setProfile($profile_to_charge);
196
183
  ```
197
184
 
198
- ### Refund a Settled Transaction
185
+ ### Refund Settled Transaction
199
186
 
200
187
  ```php
201
188
  $credit_card = new AnetAPI\CreditCardType();
202
189
  $credit_card->setCardNumber('XXXX1234'); // last 4 digits
203
- $credit_card->setExpirationDate('XXXX'); // literal 'XXXX'
190
+ $credit_card->setExpirationDate('XXXX'); // literal 'XXXX'
204
191
 
205
192
  $payment = new AnetAPI\PaymentType();
206
193
  $payment->setCreditCard($credit_card);
@@ -212,7 +199,7 @@ $tx->setRefTransId($original_transaction_id);
212
199
  $tx->setPayment($payment);
213
200
  ```
214
201
 
215
- ### Void an Unsettled Transaction
202
+ ### Void Unsettled Transaction
216
203
 
217
204
  ```php
218
205
  $tx = new AnetAPI\TransactionRequestType();
@@ -222,14 +209,11 @@ $tx->setRefTransId($transaction_id);
222
209
 
223
210
  ## Error Handling
224
211
 
225
- ### Response Structure
226
-
227
- AuthNet responses have two levels of messages:
228
-
229
- 1. **Top-level**: `$response->getMessages()` — API-level success/failure
212
+ Responses have two message levels:
213
+ 1. **Top-level**: `$response->getMessages()` — API success/failure
230
214
  2. **Transaction-level**: `$tresponse->getErrors()` / `$tresponse->getMessages()` — transaction result
231
215
 
232
- Always check both. A transaction can fail (`tresponse->getErrors()`) even when the API call succeeds (`result_code === 'Ok'`).
216
+ Always check both. Transaction can fail even when API call succeeds.
233
217
 
234
218
  ### Common Error Codes
235
219
 
@@ -244,32 +228,15 @@ Always check both. A transaction can fail (`tresponse->getErrors()`) even when t
244
228
 
245
229
  ### E00039 Duplicate Profile Recovery
246
230
 
247
- AuthNet includes the existing profile ID in the error text:
248
-
249
231
  ```php
250
232
  function extract_profile_id_from_error(string $error_text): string|false {
251
233
  return preg_match('/ID\s+(\d+)/', $error_text, $m) ? $m[1] : false;
252
234
  }
253
235
  ```
254
236
 
255
- ## When to Load Reference Files
256
-
257
- ### Full API Reference
258
- **File**: `references/api-reference.md`
259
- **Load when**:
260
- - Need complete SDK class/method listings
261
- - Working with CIM customer profiles (create, update, delete, payment profiles)
262
- - Working with ARB recurring billing (subscriptions, schedules, trials)
263
- - Need webhook event types and HMAC-SHA512 signature validation
264
- - Working with transaction reporting API
265
- - Need response code tables or field constraints
266
- - Implementing refunds, voids, or auth-only flows
267
-
268
- ### Sandbox & Testing Guide
269
- **File**: `references/sandbox-testing.md`
270
- **Load when**:
271
- - Setting up sandbox environment or test credentials
272
- - Need test card numbers and expected responses
273
- - Debugging sandbox-specific issues (CIM→ARB propagation delay)
274
- - Writing PHPUnit tests for payment functions
275
- - Need sandbox vs production behavioral differences
237
+ ## Reference Files
238
+
239
+ | File | Load when |
240
+ |------|-----------|
241
+ | `references/api-reference.md` | Complete SDK class/method listings; CIM profiles; ARB subscriptions; webhooks + HMAC-SHA512; reporting API; response codes; refunds/voids/auth-only |
242
+ | `references/sandbox-testing.md` | Sandbox setup; test card numbers; sandbox vs production differences; CIM→ARB propagation delay; PHPUnit patterns |