react-agentic 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaenn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,402 @@
1
+ # react-agentic
2
+
3
+ **Build your company's GSD** — Enterprise-grade agentic workflows for Claude Code, authored in TypeScript.
4
+
5
+ Generic workflows exist. But your company has specific expertise, compliance needs, and processes that generic tools can't capture. **react-agentic** lets you build sophisticated multi-agent orchestrations tailored to your domain — with full type safety and compile-time validation.
6
+
7
+ ```tsx
8
+ <Command name="deploy-review" description="Company deployment review workflow">
9
+ <SpawnAgent
10
+ agent="compliance-checker"
11
+ input={{ changes: ctx.diff, policy: ctx.companyPolicy }}
12
+ output={complianceResult}
13
+ />
14
+
15
+ <If condition={complianceResult.hasViolations}>
16
+ <SpawnAgent agent="remediation-advisor" input={{ violations: complianceResult.issues }} />
17
+ </If>
18
+ </Command>
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Why react-agentic?
24
+
25
+ | Challenge | Without react-agentic | With react-agentic |
26
+ |-----------|----------------------|-------------------|
27
+ | Complex orchestration | 500-line markdown, unmaintainable | Composable TSX components |
28
+ | Team collaboration | Copy-paste, no shared patterns | Reusable typed components |
29
+ | Domain models | Untyped, error-prone | `useRuntimeVar<YourEntity>()` |
30
+ | Agent communication | String-based, breaks silently | Typed `input`/`output` contracts |
31
+ | Error detection | Runtime (Claude fails) | Compile-time (build fails) |
32
+
33
+ ---
34
+
35
+ ## Quick Start
36
+
37
+ ### Installation
38
+
39
+ ```bash
40
+ npm install react-agentic
41
+ ```
42
+
43
+ ### Create Your First Command
44
+
45
+ ```tsx
46
+ // src/app/review-pr.tsx
47
+ import { Command, SpawnAgent, If, useRuntimeVar } from 'react-agentic';
48
+
49
+ export default (
50
+ <Command
51
+ name="review-pr"
52
+ description="Review PR with company standards"
53
+ >
54
+ {() => {
55
+ const result = useRuntimeVar<{ approved: boolean; feedback: string }>('RESULT');
56
+
57
+ return (
58
+ <>
59
+ <p>Review this PR against our coding standards.</p>
60
+
61
+ <SpawnAgent
62
+ agent="code-reviewer"
63
+ description="Review PR"
64
+ input={{ standards: "@company-standards.md" }}
65
+ output={result}
66
+ />
67
+
68
+ <If condition={result.approved}>
69
+ <p>PR approved. Ready to merge.</p>
70
+ </If>
71
+ </>
72
+ );
73
+ }}
74
+ </Command>
75
+ );
76
+ ```
77
+
78
+ ### Build
79
+
80
+ ```bash
81
+ npx react-agentic build "src/app/**/*.tsx"
82
+ ```
83
+
84
+ Output: `.claude/commands/review-pr.md` — ready for Claude Code.
85
+
86
+ ### Watch Mode
87
+
88
+ ```bash
89
+ npx react-agentic build "src/app/**/*.tsx" --watch
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Core Concepts
95
+
96
+ ### Commands & Agents
97
+
98
+ ```tsx
99
+ // Command = slash command (/deploy, /review)
100
+ <Command name="deploy" description="Deploy to staging">
101
+ ...
102
+ </Command>
103
+
104
+ // Agent = spawnable worker with specific expertise
105
+ <Agent name="security-auditor" description="Security vulnerability scanner">
106
+ ...
107
+ </Agent>
108
+ ```
109
+
110
+ ### Typed Variables
111
+
112
+ ```tsx
113
+ // Define typed variables for your domain
114
+ const order = useRuntimeVar<Order>('ORDER');
115
+ const patient = useRuntimeVar<PatientRecord>('PATIENT');
116
+ const trade = useRuntimeVar<TradeRequest>('TRADE');
117
+
118
+ // Full autocomplete and type checking
119
+ <If condition={order.status === 'pending'}>
120
+ ...
121
+ </If>
122
+ ```
123
+
124
+ ### Control Flow
125
+
126
+ ```tsx
127
+ // Conditionals
128
+ <If condition={ctx.needsReview}>
129
+ <SpawnAgent agent="reviewer" ... />
130
+ </If>
131
+ <Else>
132
+ <p>Skipping review.</p>
133
+ </Else>
134
+
135
+ // Loops with typed counters
136
+ <Loop max={3} counter={attempt}>
137
+ <SpawnAgent agent="validator" ... />
138
+ <If condition={result.passed}>
139
+ <Break message="Validation passed" />
140
+ </If>
141
+ </Loop>
142
+ ```
143
+
144
+ ### Agent Spawning
145
+
146
+ ```tsx
147
+ <SpawnAgent
148
+ agent="compliance-checker" // Agent name
149
+ model="sonnet" // Model selection
150
+ description="Check compliance" // Task description
151
+ input={{ data: ctx.payload }} // Typed input
152
+ output={complianceResult} // Typed output capture
153
+ />
154
+ ```
155
+
156
+ ### Runtime Functions
157
+
158
+ Bridge TypeScript logic with your commands:
159
+
160
+ ```tsx
161
+ import { runtimeFn } from 'react-agentic';
162
+ import { validateOrder } from './validators.js';
163
+
164
+ const ValidateOrder = runtimeFn(validateOrder);
165
+
166
+ // In your command:
167
+ <ValidateOrder.Call
168
+ args={{ order: ctx.order }}
169
+ output={validationResult}
170
+ />
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Real-World Examples
176
+
177
+ ### Healthcare: HIPAA Compliance Flow
178
+
179
+ ```tsx
180
+ const patient = useRuntimeVar<PatientRecord>('PATIENT');
181
+ const scanResult = useRuntimeVar<PHIScanResult>('SCAN_RESULT');
182
+
183
+ <SpawnAgent
184
+ agent="phi-scanner"
185
+ input={{ record: patient, regulations: "@hipaa-rules.md" }}
186
+ output={scanResult}
187
+ />
188
+
189
+ <If condition={scanResult.hasPHI}>
190
+ <SpawnAgent
191
+ agent="phi-remediation"
192
+ input={{ findings: scanResult.violations }}
193
+ />
194
+ </If>
195
+ ```
196
+
197
+ ### Fintech: Trade Validation
198
+
199
+ ```tsx
200
+ const trade = useRuntimeVar<TradeRequest>('TRADE');
201
+ const riskResult = useRuntimeVar<RiskAssessment>('RISK');
202
+
203
+ <SpawnAgent
204
+ agent="risk-analyzer"
205
+ input={{ trade, limits: ctx.companyLimits }}
206
+ output={riskResult}
207
+ />
208
+
209
+ <If condition={riskResult.score > 0.8}>
210
+ <AskUser
211
+ question="High risk trade detected. Proceed?"
212
+ options={[
213
+ { value: 'approve', label: 'Approve with override' },
214
+ { value: 'reject', label: 'Reject trade' },
215
+ ]}
216
+ output={userChoice}
217
+ />
218
+ </If>
219
+ ```
220
+
221
+ ### E-commerce: Deployment Pipeline
222
+
223
+ ```tsx
224
+ <Loop max={3} counter={attempt}>
225
+ <SpawnAgent agent="staging-deployer" output={deployResult} />
226
+
227
+ <If condition={deployResult.healthy}>
228
+ <SpawnAgent agent="smoke-tester" output={testResult} />
229
+ <If condition={testResult.passed}>
230
+ <Break message="Deployment successful" />
231
+ </If>
232
+ </If>
233
+
234
+ <SpawnAgent agent="rollback-handler" />
235
+ </Loop>
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Components Reference
241
+
242
+ | Component | Purpose | Example |
243
+ |-----------|---------|---------|
244
+ | `<Command>` | Slash command | `/deploy`, `/review` |
245
+ | `<Agent>` | Spawnable worker | Specialized expertise |
246
+ | `<SpawnAgent>` | Spawn agent with typed I/O | Multi-agent orchestration |
247
+ | `<If>` / `<Else>` | Conditional logic | Branch on results |
248
+ | `<Loop>` / `<Break>` | Iteration | Retry loops, validation |
249
+ | `<AskUser>` | User input | Confirmations, choices |
250
+ | `<Return>` | Exit with status | Early termination |
251
+ | `<XmlBlock>` | Structured sections | `<objective>`, `<process>` |
252
+ | `<Table>` | Markdown tables | Data display |
253
+ | `<ExecutionContext>` | File references | `@file.md` includes |
254
+ | `runtimeFn()` | TypeScript bridge | Complex logic |
255
+
256
+ ---
257
+
258
+ ## Project Structure
259
+
260
+ ```
261
+ your-project/
262
+ ├── src/
263
+ │ └── app/
264
+ │ ├── commands/
265
+ │ │ ├── deploy.tsx → .claude/commands/deploy.md
266
+ │ │ └── review.tsx → .claude/commands/review.md
267
+ │ └── agents/
268
+ │ ├── reviewer.tsx → .claude/agents/reviewer.md
269
+ │ └── deployer.tsx → .claude/agents/deployer.md
270
+ ├── package.json
271
+ └── tsconfig.json
272
+ ```
273
+
274
+ ---
275
+
276
+ ## CLI Reference
277
+
278
+ ### Commands
279
+
280
+ ```bash
281
+ # Build specific file
282
+ npx react-agentic build "src/app/deploy.tsx"
283
+
284
+ # Build all commands and agents
285
+ npx react-agentic build "src/app/**/*.tsx"
286
+
287
+ # Watch mode (rebuild on changes)
288
+ npx react-agentic build --watch
289
+
290
+ # Combine options
291
+ npx react-agentic build "src/app/**/*.tsx" --code-split --minify
292
+ ```
293
+
294
+ ### Options
295
+
296
+ | Option | Short | Description |
297
+ |--------|-------|-------------|
298
+ | `--out <dir>` | `-o` | Output directory for markdown files |
299
+ | `--runtime-out <dir>` | | Output directory for runtime bundles |
300
+ | `--code-split` | | Split runtime into per-namespace modules |
301
+ | `--minify` | | Minify runtime bundles |
302
+ | `--watch` | `-w` | Watch for changes and rebuild automatically |
303
+ | `--dry-run` | `-d` | Preview output without writing files |
304
+
305
+ ### Configuration File
306
+
307
+ Create `react-agentic.config.json` in your project root for persistent settings:
308
+
309
+ ```json
310
+ {
311
+ "outputDir": ".claude/commands",
312
+ "runtimeDir": ".claude/runtime",
313
+ "minify": false,
314
+ "codeSplit": false
315
+ }
316
+ ```
317
+
318
+ **Priority** (highest to lowest):
319
+ 1. CLI flags
320
+ 2. `react-agentic.config.json`
321
+ 3. Built-in defaults
322
+
323
+ | Config Key | CLI Flag | Default |
324
+ |------------|----------|---------|
325
+ | `outputDir` | `--out` | `.claude/commands` |
326
+ | `runtimeDir` | `--runtime-out` | `.claude/runtime` |
327
+ | `minify` | `--minify` | `false` |
328
+ | `codeSplit` | `--code-split` | `false` |
329
+
330
+ ---
331
+
332
+ ## Why Not Just Markdown?
333
+
334
+ For simple commands, vanilla markdown works fine. **react-agentic** is for when you need:
335
+
336
+ - **Multi-agent orchestration** — Spawn → check result → branch → spawn again
337
+ - **Typed domain models** — Your entities (`Order`, `Patient`, `Trade`) with autocomplete
338
+ - **Team collaboration** — Shared components, no copy-paste drift
339
+ - **Compile-time safety** — Errors caught at build, not when Claude runs
340
+ - **Complex control flow** — Loops, retries, early exits, user prompts
341
+
342
+ ---
343
+
344
+ ## Comparison
345
+
346
+ | Approach | Best For |
347
+ |----------|----------|
348
+ | Vanilla markdown | Simple commands, quick scripts |
349
+ | Claude Agent SDK | Programmatic execution from apps |
350
+ | **react-agentic** | Complex orchestration, team workflows, enterprise |
351
+
352
+ ---
353
+
354
+ ## Documentation
355
+
356
+ - [Getting Started](docs/getting-started.md)
357
+ - [Commands](docs/command.md)
358
+ - [Agents](docs/agent.md)
359
+ - [Communication (SpawnAgent)](docs/communication.md)
360
+ - [Variables](docs/variables.md)
361
+ - [Control Flow](docs/conditionals.md)
362
+ - [Runtime Functions](docs/build-pipeline.md)
363
+
364
+ ---
365
+
366
+ ## Roadmap
367
+
368
+ **Current focus: Claude Code**
369
+
370
+ react-agentic currently targets **Claude Code** as its primary runtime. We're focused on making the Claude Code integration rock-solid before expanding.
371
+
372
+ **Future providers planned:**
373
+
374
+ | Provider | Status |
375
+ |----------|--------|
376
+ | Claude Code | ✅ Supported |
377
+ | OpenCode | 🔜 Planned |
378
+ | Antigravity | 🔜 Planned |
379
+ | Others | Under consideration |
380
+
381
+ Our approach: **depth before breadth**. Once the core framework is stable and battle-tested with Claude Code, we'll add emit targets for other agentic coding tools.
382
+
383
+ Want to help bring react-agentic to another provider? [Open an issue](https://github.com/anthropics/react-agentic/issues) or contribute a PR!
384
+
385
+ ---
386
+
387
+ ## Contributing
388
+
389
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
390
+
391
+ ---
392
+
393
+ ## License
394
+
395
+ MIT
396
+
397
+ ---
398
+
399
+ <p align="center">
400
+ <b>Build your company's GSD.</b><br>
401
+ Type-safe agentic workflows for Claude Code.
402
+ </p>