claude-agent-personas 1.0.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 (125) hide show
  1. package/README.md +302 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +25 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/add.d.ts +3 -0
  7. package/dist/commands/add.d.ts.map +1 -0
  8. package/dist/commands/add.js +113 -0
  9. package/dist/commands/add.js.map +1 -0
  10. package/dist/commands/debug.d.ts +3 -0
  11. package/dist/commands/debug.d.ts.map +1 -0
  12. package/dist/commands/debug.js +49 -0
  13. package/dist/commands/debug.js.map +1 -0
  14. package/dist/commands/init.d.ts +3 -0
  15. package/dist/commands/init.d.ts.map +1 -0
  16. package/dist/commands/init.js +121 -0
  17. package/dist/commands/init.js.map +1 -0
  18. package/dist/commands/lint.d.ts +3 -0
  19. package/dist/commands/lint.d.ts.map +1 -0
  20. package/dist/commands/lint.js +85 -0
  21. package/dist/commands/lint.js.map +1 -0
  22. package/dist/commands/list.d.ts +3 -0
  23. package/dist/commands/list.d.ts.map +1 -0
  24. package/dist/commands/list.js +36 -0
  25. package/dist/commands/list.js.map +1 -0
  26. package/dist/commands/remove.d.ts +3 -0
  27. package/dist/commands/remove.d.ts.map +1 -0
  28. package/dist/commands/remove.js +72 -0
  29. package/dist/commands/remove.js.map +1 -0
  30. package/dist/commands/update.d.ts +3 -0
  31. package/dist/commands/update.d.ts.map +1 -0
  32. package/dist/commands/update.js +23 -0
  33. package/dist/commands/update.js.map +1 -0
  34. package/dist/installer.d.ts +24 -0
  35. package/dist/installer.d.ts.map +1 -0
  36. package/dist/installer.js +101 -0
  37. package/dist/installer.js.map +1 -0
  38. package/dist/persona-manager.d.ts +60 -0
  39. package/dist/persona-manager.d.ts.map +1 -0
  40. package/dist/persona-manager.js +266 -0
  41. package/dist/persona-manager.js.map +1 -0
  42. package/dist/router.d.ts +28 -0
  43. package/dist/router.d.ts.map +1 -0
  44. package/dist/router.js +84 -0
  45. package/dist/router.js.map +1 -0
  46. package/dist/utils.d.ts +22 -0
  47. package/dist/utils.d.ts.map +1 -0
  48. package/dist/utils.js +122 -0
  49. package/dist/utils.js.map +1 -0
  50. package/package.json +56 -0
  51. package/personas/_template.md +26 -0
  52. package/personas/business/agile-coach.md +34 -0
  53. package/personas/business/business-analyst.md +34 -0
  54. package/personas/business/cfo-advisor.md +33 -0
  55. package/personas/business/contract-lawyer.md +32 -0
  56. package/personas/business/copywriter.md +33 -0
  57. package/personas/business/developer-advocate.md +34 -0
  58. package/personas/business/engineering-manager.md +34 -0
  59. package/personas/business/growth-marketer.md +29 -0
  60. package/personas/business/product-manager.md +33 -0
  61. package/personas/business/solutions-architect.md +34 -0
  62. package/personas/business/startup-advisor.md +29 -0
  63. package/personas/creative-data/career-coach.md +29 -0
  64. package/personas/creative-data/data-scientist.md +32 -0
  65. package/personas/creative-data/financial-analyst.md +32 -0
  66. package/personas/creative-data/seo-specialist.md +28 -0
  67. package/personas/creative-data/technical-writer.md +31 -0
  68. package/personas/creative-data/ux-researcher.md +29 -0
  69. package/personas/engineering/api-designer.md +34 -0
  70. package/personas/engineering/backend/principal-dotnet-developer.md +37 -0
  71. package/personas/engineering/backend/principal-golang-developer.md +38 -0
  72. package/personas/engineering/backend/principal-graphql-developer.md +38 -0
  73. package/personas/engineering/backend/principal-java-developer.md +38 -0
  74. package/personas/engineering/backend/principal-nodejs-developer.md +38 -0
  75. package/personas/engineering/backend/principal-php-developer.md +37 -0
  76. package/personas/engineering/backend/principal-python-developer.md +39 -0
  77. package/personas/engineering/backend/principal-ruby-developer.md +37 -0
  78. package/personas/engineering/backend/principal-rust-developer.md +38 -0
  79. package/personas/engineering/code-reviewer.md +42 -0
  80. package/personas/engineering/data-ml/principal-data-architect.md +37 -0
  81. package/personas/engineering/data-ml/principal-data-engineer.md +38 -0
  82. package/personas/engineering/data-ml/principal-data-scientist.md +39 -0
  83. package/personas/engineering/data-ml/principal-dbt-analyst.md +37 -0
  84. package/personas/engineering/data-ml/principal-llm-engineer.md +39 -0
  85. package/personas/engineering/data-ml/principal-ml-engineer.md +38 -0
  86. package/personas/engineering/data-ml/principal-spark-engineer.md +37 -0
  87. package/personas/engineering/data-ml/principal-sql-analyst.md +38 -0
  88. package/personas/engineering/database/principal-database-architect.md +38 -0
  89. package/personas/engineering/database/principal-mongodb-developer.md +37 -0
  90. package/personas/engineering/database/principal-mysql-dba.md +44 -0
  91. package/personas/engineering/database/principal-postgresql-dba.md +39 -0
  92. package/personas/engineering/database/principal-redis-engineer.md +37 -0
  93. package/personas/engineering/devops/principal-aws-architect.md +39 -0
  94. package/personas/engineering/devops/principal-azure-engineer.md +37 -0
  95. package/personas/engineering/devops/principal-devops-engineer.md +38 -0
  96. package/personas/engineering/devops/principal-gcp-engineer.md +37 -0
  97. package/personas/engineering/devops/principal-kubernetes-engineer.md +38 -0
  98. package/personas/engineering/devops/principal-platform-engineer.md +39 -0
  99. package/personas/engineering/devops/principal-sre-engineer.md +38 -0
  100. package/personas/engineering/devops/principal-terraform-engineer.md +37 -0
  101. package/personas/engineering/frontend/principal-accessibility-engineer.md +38 -0
  102. package/personas/engineering/frontend/principal-angular-developer.md +39 -0
  103. package/personas/engineering/frontend/principal-css-specialist.md +38 -0
  104. package/personas/engineering/frontend/principal-design-system-engineer.md +38 -0
  105. package/personas/engineering/frontend/principal-nextjs-engineer.md +39 -0
  106. package/personas/engineering/frontend/principal-react-developer.md +39 -0
  107. package/personas/engineering/frontend/principal-vue-developer.md +38 -0
  108. package/personas/engineering/frontend/principal-web-performance-engineer.md +39 -0
  109. package/personas/engineering/mobile/principal-android-developer.md +44 -0
  110. package/personas/engineering/mobile/principal-flutter-developer.md +44 -0
  111. package/personas/engineering/mobile/principal-ios-developer.md +44 -0
  112. package/personas/engineering/mobile/principal-react-native-developer.md +44 -0
  113. package/personas/engineering/qa/principal-java-qa-engineer.md +45 -0
  114. package/personas/engineering/qa/principal-javascript-qa-engineer.md +37 -0
  115. package/personas/engineering/qa/principal-mobile-qa-engineer.md +37 -0
  116. package/personas/engineering/qa/principal-performance-tester.md +37 -0
  117. package/personas/engineering/qa/principal-python-qa-engineer.md +38 -0
  118. package/personas/engineering/qa/principal-qa-architect.md +38 -0
  119. package/personas/engineering/qa/principal-security-tester.md +38 -0
  120. package/personas/engineering/security/principal-appsec-engineer.md +42 -0
  121. package/personas/engineering/security/principal-cloud-security-engineer.md +42 -0
  122. package/personas/engineering/security/principal-security-architect.md +44 -0
  123. package/personas/engineering/staff-engineer.md +30 -0
  124. package/personas/router-config.yml +948 -0
  125. package/snippets/claude-md-block.md +17 -0
package/README.md ADDED
@@ -0,0 +1,302 @@
1
+ # claude-agent-personas
2
+
3
+ > Claude Code that automatically thinks like the expert you need — no commands, no switching, no token waste.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/claude-agent-personas.svg)](https://www.npmjs.com/package/claude-agent-personas)
6
+ [![npm downloads](https://img.shields.io/npm/dw/claude-agent-personas.svg)](https://www.npmjs.com/package/claude-agent-personas)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ---
10
+
11
+ ## The Problem
12
+
13
+ Most Claude Code power users put expert personas in their `CLAUDE.md`. Smart idea — except Claude Code **re-injects your entire CLAUDE.md on every single message turn**. Define 20 personas and you're burning ~5,000 tokens before you type a word.
14
+
15
+ | Setup | Tokens/turn | Monthly cost (est.) |
16
+ |-------|-------------|---------------------|
17
+ | Default Claude Code | ~200 | ~$2 |
18
+ | 20 personas in CLAUDE.md (naive) | ~5,000 | ~$60–120 |
19
+ | **claude-agent-personas (lazy)** | ~350 | ~$4 |
20
+
21
+ Existing tools also make you manually type `@security-auditor` or `/use-persona lawyer` before every message. People forget. It breaks flow.
22
+
23
+ **claude-agent-personas** fixes both — lazy-loading + automatic detection. Zero commands to remember.
24
+
25
+ ---
26
+
27
+ ## How It Works
28
+
29
+ Instead of loading all personas upfront, claude-agent-personas:
30
+
31
+ 1. Puts a tiny **routing engine** (~50 lines) in your `CLAUDE.md`
32
+ 2. Stores **72 expert personas** as individual files in `~/.claude/personas/`
33
+ 3. On every message, the router **detects domain signals** and loads only the matching file
34
+
35
+ You type naturally. It routes silently.
36
+
37
+ ```
38
+ "why is my postgres query slow?" → loads principal-postgresql-dba.md
39
+ "review this NDA clause" → loads contract-lawyer.md
40
+ "optimize my React component renders" → loads principal-react-developer.md
41
+ "design a Kubernetes deployment strategy" → loads principal-kubernetes-engineer.md
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ npx claude-agent-personas init
50
+ ```
51
+
52
+ That's it. Takes under 5 seconds. Your existing `CLAUDE.md` is never overwritten — the router block is appended to the end.
53
+
54
+ ---
55
+
56
+ ## Quick Start
57
+
58
+ ```bash
59
+ # Install
60
+ npx claude-agent-personas init
61
+
62
+ # Open Claude Code in any project
63
+ claude
64
+
65
+ # Just type naturally — routing is automatic
66
+ "why is my postgres query slow?" # → PostgreSQL DBA
67
+ "review this indemnification clause" # → Contract Lawyer
68
+ "design a system for 10k concurrent users" # → Staff Engineer
69
+ "set up a CI/CD pipeline with GitHub Actions" # → DevOps Engineer
70
+
71
+ # Force a specific persona with @ prefix
72
+ "@security-auditor review this auth flow"
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Debug Mode
78
+
79
+ Not sure which persona would load? Check before you send:
80
+
81
+ ```bash
82
+ npx claude-agent-personas debug "why is my postgres query slow"
83
+ ```
84
+
85
+ Output:
86
+ ```
87
+ claude-agent-personas debug
88
+
89
+ Message: "why is my postgres query slow"
90
+
91
+ Persona Signals Matched Score Load?
92
+ ──────────────────────────────────────────────────────────────────────────────
93
+ principal-postgresql-dba postgres, query, slow 3 YES
94
+ principal-mysql-dba query 1 no
95
+ dba-expert postgres, query, slow 3 no (dup)
96
+
97
+ Would load: principal-postgresql-dba.md (3 signal matches)
98
+ ```
99
+
100
+ ---
101
+
102
+ ## All Commands
103
+
104
+ ```bash
105
+ npx claude-agent-personas init # Install everything
106
+ npx claude-agent-personas init --dry-run # Preview without writing
107
+ npx claude-agent-personas init --profile engineering # Install only engineering personas
108
+ npx claude-agent-personas init --profile business # Install only business personas
109
+ npx claude-agent-personas update # Refresh personas from latest package
110
+ npx claude-agent-personas list # Show all personas + token counts
111
+ npx claude-agent-personas debug "<message>" # Show routing decision
112
+ npx claude-agent-personas remove # Clean uninstall
113
+ npx claude-agent-personas add ./my-persona.md # Add a custom persona
114
+ npx claude-agent-personas lint ./my-persona.md # Validate + token count
115
+ ```
116
+
117
+ Short alias `persona` also works:
118
+
119
+ ```bash
120
+ persona init
121
+ persona debug "my message"
122
+ persona list
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Bundled Personas (72)
128
+
129
+ ### Engineering (55)
130
+
131
+ #### General (3)
132
+ | Persona | Triggers on |
133
+ |---------|-------------|
134
+ | Staff Engineer | architecture, scale, system design, tradeoff, distributed |
135
+ | API Designer | api, rest, graphql, endpoint, swagger, openapi, schema |
136
+ | Code Reviewer | review, pr, pull request, refactor, clean code, solid |
137
+
138
+ #### Frontend (8)
139
+ | Persona | Triggers on |
140
+ |---------|-------------|
141
+ | React Developer | react, jsx, hooks, useState, useEffect, zustand, react query |
142
+ | Next.js Engineer | next.js, app router, server component, server actions, vercel |
143
+ | Vue Developer | vue, vuex, pinia, nuxt, composition api, vueuse |
144
+ | Angular Developer | angular, rxjs, ngrx, angular material, ngmodule |
145
+ | CSS Specialist | css, scss, tailwind, styled components, flexbox, css grid |
146
+ | Web Performance Engineer | core web vitals, lighthouse, lcp, cls, bundle size |
147
+ | Accessibility Engineer | a11y, wcag, aria, screen reader, keyboard navigation |
148
+ | Design System Engineer | design system, storybook, design tokens, component library |
149
+
150
+ #### Backend (9)
151
+ | Persona | Triggers on |
152
+ |---------|-------------|
153
+ | Python Developer | python, django, flask, fastapi, sqlalchemy, celery, pydantic |
154
+ | Node.js Developer | node.js, express, nestjs, fastify, prisma, typeorm |
155
+ | Java Developer | java, spring boot, maven, gradle, hibernate, jpa |
156
+ | Go Developer | golang, goroutine, gin, echo, gorm, go module |
157
+ | Rust Developer | rust, cargo, tokio, actix, axum, borrow checker |
158
+ | .NET Developer | dotnet, c#, asp.net, entity framework, blazor, linq |
159
+ | Ruby Developer | ruby, rails, activerecord, rspec, sidekiq |
160
+ | PHP Developer | php, laravel, symfony, composer, eloquent |
161
+ | GraphQL Developer | graphql, apollo, resolver, mutation, hasura, federation |
162
+
163
+ #### Database (5)
164
+ | Persona | Triggers on |
165
+ |---------|-------------|
166
+ | PostgreSQL DBA | postgresql, postgres, plpgsql, vacuum, explain analyze |
167
+ | MySQL DBA | mysql, mariadb, innodb, binlog, proxysql |
168
+ | MongoDB Developer | mongodb, mongoose, aggregation pipeline, atlas |
169
+ | Redis Engineer | redis, pub sub, redis stream, redis cluster, cache invalidation |
170
+ | Database Architect | data modeling, schema design, normalization, polyglot persistence |
171
+
172
+ #### Data & ML (8)
173
+ | Persona | Triggers on |
174
+ |---------|-------------|
175
+ | Data Scientist | data science, scikit-learn, pandas, numpy, jupyter |
176
+ | ML Engineer | mlops, pytorch, tensorflow, mlflow, model serving |
177
+ | LLM Engineer | llm, rag, prompt engineering, langchain, llamaindex, embeddings |
178
+ | Data Engineer | data pipeline, etl, airflow, kafka, data lake |
179
+ | dbt Analyst | dbt, analytics engineering, dbt model, dimensional modeling |
180
+ | SQL Analyst | sql query, window function, cte, snowflake, redshift |
181
+ | Spark Engineer | apache spark, pyspark, spark sql, databricks |
182
+ | Data Architect | data mesh, data fabric, data governance, data catalog |
183
+
184
+ #### DevOps & Infrastructure (8)
185
+ | Persona | Triggers on |
186
+ |---------|-------------|
187
+ | DevOps Engineer | devops, ci/cd, pipeline, github actions, docker |
188
+ | Kubernetes Engineer | kubernetes, k8s, kubectl, helm, argocd, istio |
189
+ | Terraform Engineer | terraform, infrastructure as code, hcl, terragrunt |
190
+ | AWS Architect | aws, ec2, s3, lambda, ecs, cloudformation, cdk |
191
+ | GCP Engineer | gcp, google cloud, gke, cloud run, bigquery |
192
+ | Azure Engineer | azure, aks, azure functions, cosmos db, bicep |
193
+ | Platform Engineer | platform engineering, backstage, developer portal, golden path |
194
+ | SRE Engineer | sre, slo, sla, error budget, incident management, chaos engineering |
195
+
196
+ #### QA & Testing (7)
197
+ | Persona | Triggers on |
198
+ |---------|-------------|
199
+ | Python QA Engineer | pytest, selenium python, playwright python, robot framework |
200
+ | JavaScript QA Engineer | jest, cypress, playwright, vitest, testing library |
201
+ | Java QA Engineer | junit, mockito, testng, testcontainers, cucumber |
202
+ | Performance Tester | load test, jmeter, gatling, k6, locust, stress test |
203
+ | Security Tester | penetration test, owasp zap, burp suite, vulnerability scan |
204
+ | Mobile QA Engineer | appium, xcuitest, espresso, detox, device farm |
205
+ | QA Architect | test strategy, test pyramid, quality gates, shift left |
206
+
207
+ #### Mobile (4)
208
+ | Persona | Triggers on |
209
+ |---------|-------------|
210
+ | iOS Developer | ios, swift, swiftui, uikit, xcode, cocoapods |
211
+ | Android Developer | android, kotlin, jetpack compose, room, hilt |
212
+ | React Native Developer | react native, expo, react navigation, hermes |
213
+ | Flutter Developer | flutter, dart, bloc, riverpod, flutter pub |
214
+
215
+ #### Security (3)
216
+ | Persona | Triggers on |
217
+ |---------|-------------|
218
+ | AppSec Engineer | sql injection, xss, csrf, owasp, security code review |
219
+ | Cloud Security Engineer | cloud security, iam security, cspm, zero trust |
220
+ | Security Architect | threat model, security design, nist csf, defense in depth |
221
+
222
+ ### Business & Strategy (11)
223
+ | Persona | Triggers on |
224
+ |---------|-------------|
225
+ | Contract Lawyer | contract, agreement, clause, nda, terms, liability, indemnify |
226
+ | CFO Advisor | runway, burn, cap table, valuation, fundraise, arr, mrr |
227
+ | Growth Marketer | launch, gtm, funnel, conversion, retention, cac, ltv |
228
+ | Product Manager | roadmap, prd, user story, sprint, okr, backlog, prioritize |
229
+ | Copywriter | copy, email, headline, landing page, cta, hook, aida |
230
+ | Startup Advisor | pitch, yc, investor, idea, market size, tam, mvp |
231
+ | Engineering Manager | 1:1, hiring, performance review, team building, sprint planning |
232
+ | Agile Coach | scrum, kanban, retrospective, velocity, story points, ceremonies |
233
+ | Solutions Architect | pre-sales, rfp, integration, vendor evaluation, poc, technical proposal |
234
+ | Business Analyst | brd, requirements, process mapping, gap analysis, stakeholder, use case |
235
+ | Developer Advocate | devrel, developer experience, api docs, tutorial, code sample, changelog |
236
+
237
+ ### Creative & Data (6)
238
+ | Persona | Triggers on |
239
+ |---------|-------------|
240
+ | Data Scientist | pandas, dataframe, ml, model, sklearn, feature, accuracy |
241
+ | Technical Writer | docs, readme, documentation, guide, tutorial, write |
242
+ | UX Researcher | user research, persona, interview, usability, ux, journey |
243
+ | SEO Specialist | seo, keyword, ranking, backlink, meta, crawl, serp |
244
+ | Financial Analyst | dcf, npv, irr, model, forecast, revenue, p&l, ebitda |
245
+ | Career Coach | resume, interview, linkedin, job, career, salary negotiation |
246
+
247
+ ---
248
+
249
+ ## Manual Override
250
+
251
+ Always available — just prefix your message with `@persona-name`:
252
+
253
+ ```
254
+ @principal-react-developer should I use useMemo or useCallback here?
255
+ @contract-lawyer what does this liability cap actually mean?
256
+ @principal-kubernetes-engineer review my deployment manifest
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Add Your Own Persona
262
+
263
+ Takes under 10 minutes. Copy `personas/_template.md`, fill in the 5 sections, add signals to `router-config.yml`:
264
+
265
+ ```bash
266
+ # Copy template
267
+ cp ~/.claude/personas/_template.md ~/.claude/personas/my-expert.md
268
+
269
+ # Edit it, then validate
270
+ npx claude-agent-personas lint ~/.claude/personas/my-expert.md
271
+
272
+ # Add to routing config
273
+ # Edit ~/.claude/personas/router-config.yml and add your signals
274
+ ```
275
+
276
+ Token budget: keep personas under **500 tokens**. The linter will warn you if you go over.
277
+
278
+ ---
279
+
280
+ ## Contributing a Persona
281
+
282
+ Want to add your persona to the official library? See [CONTRIBUTING.md](./CONTRIBUTING.md).
283
+
284
+ PRs welcome — the more domain experts in the library, the better it gets for everyone.
285
+
286
+ ---
287
+
288
+ ## Uninstall
289
+
290
+ ```bash
291
+ # Remove router block from CLAUDE.md (keeps persona files)
292
+ npx claude-agent-personas remove
293
+
294
+ # Remove everything including persona files
295
+ npx claude-agent-personas remove --personas
296
+ ```
297
+
298
+ ---
299
+
300
+ ## License
301
+
302
+ MIT © [D-Ankita](https://github.com/D-Ankita)
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const init_js_1 = require("./commands/init.js");
6
+ const update_js_1 = require("./commands/update.js");
7
+ const list_js_1 = require("./commands/list.js");
8
+ const debug_js_1 = require("./commands/debug.js");
9
+ const remove_js_1 = require("./commands/remove.js");
10
+ const lint_js_1 = require("./commands/lint.js");
11
+ const add_js_1 = require("./commands/add.js");
12
+ const program = new commander_1.Command();
13
+ program
14
+ .name("persona")
15
+ .description("Intelligent persona routing OS for Claude Code")
16
+ .version("1.0.0");
17
+ program.addCommand(init_js_1.initCommand);
18
+ program.addCommand(update_js_1.updateCommand);
19
+ program.addCommand(list_js_1.listCommand);
20
+ program.addCommand(debug_js_1.debugCommand);
21
+ program.addCommand(remove_js_1.removeCommand);
22
+ program.addCommand(lint_js_1.lintCommand);
23
+ program.addCommand(add_js_1.addCommand);
24
+ program.parse(process.argv);
25
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,gDAAiD;AACjD,oDAAqD;AACrD,gDAAiD;AACjD,kDAAmD;AACnD,oDAAqD;AACrD,gDAAiD;AACjD,8CAA+C;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,gDAAgD,CAAC;KAC7D,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO,CAAC,UAAU,CAAC,qBAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,yBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,qBAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,uBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,yBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,qBAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,mBAAU,CAAC,CAAC;AAE/B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const addCommand: Command;
3
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,UAAU,SAyEnB,CAAC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.addCommand = void 0;
40
+ const commander_1 = require("commander");
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const chalk_1 = __importDefault(require("chalk"));
44
+ const persona_manager_js_1 = require("../persona-manager.js");
45
+ const utils_js_1 = require("../utils.js");
46
+ exports.addCommand = new commander_1.Command("add")
47
+ .description("Install a custom persona file")
48
+ .argument("<source>", "Path to a local persona .md file or URL")
49
+ .action(async (source) => {
50
+ console.log(chalk_1.default.bold.blue("\nclaude-agent-personas") + " add\n");
51
+ let filePath;
52
+ let tempFile = null;
53
+ if (source.startsWith("http://") || source.startsWith("https://")) {
54
+ // Fetch from URL
55
+ console.log(chalk_1.default.dim(` Fetching ${source}...`));
56
+ try {
57
+ const response = await fetch(source);
58
+ if (!response.ok) {
59
+ console.log(chalk_1.default.red(` ✗ Failed to fetch: ${response.status} ${response.statusText}\n`));
60
+ process.exit(1);
61
+ }
62
+ const content = await response.text();
63
+ tempFile = path.join((0, utils_js_1.personasDir)(), "_temp_add.md");
64
+ (0, utils_js_1.ensureDir)((0, utils_js_1.personasDir)());
65
+ fs.writeFileSync(tempFile, content, "utf-8");
66
+ filePath = tempFile;
67
+ }
68
+ catch (err) {
69
+ console.log(chalk_1.default.red(` ✗ Failed to fetch URL: ${err}\n`));
70
+ process.exit(1);
71
+ return;
72
+ }
73
+ }
74
+ else {
75
+ filePath = path.resolve(source);
76
+ if (!fs.existsSync(filePath)) {
77
+ console.log(chalk_1.default.red(` ✗ File not found: ${filePath}\n`));
78
+ process.exit(1);
79
+ }
80
+ }
81
+ // Lint the file
82
+ const result = await (0, persona_manager_js_1.lintPersona)(filePath);
83
+ if (result.errors.length > 0) {
84
+ console.log(chalk_1.default.red(" Lint errors found:\n"));
85
+ for (const err of result.errors) {
86
+ console.log(chalk_1.default.red(` ✗ ${err}`));
87
+ }
88
+ if (tempFile)
89
+ fs.unlinkSync(tempFile);
90
+ console.log(chalk_1.default.red("\n Persona not installed. Fix errors and try again.\n"));
91
+ process.exit(1);
92
+ }
93
+ // Copy to personas directory
94
+ const destName = tempFile
95
+ ? path.basename(source).replace(/[^a-zA-Z0-9.-]/g, "-")
96
+ : path.basename(filePath);
97
+ const dest = path.join((0, utils_js_1.personasDir)(), destName);
98
+ (0, utils_js_1.ensureDir)((0, utils_js_1.personasDir)());
99
+ if (tempFile) {
100
+ fs.renameSync(tempFile, dest);
101
+ }
102
+ else {
103
+ fs.copyFileSync(filePath, dest);
104
+ }
105
+ console.log(chalk_1.default.green(" ✓") + ` Installed ${destName} to ~/.claude/personas/`);
106
+ if (result.warnings.length > 0) {
107
+ for (const warn of result.warnings) {
108
+ console.log(chalk_1.default.yellow(` ⚠ ${warn}`));
109
+ }
110
+ }
111
+ console.log(chalk_1.default.dim(`\n To activate: add signals to ~/.claude/personas/router-config.yml\n`));
112
+ });
113
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","source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AC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,6BAA6B;IAC7B,MAAM,QAAQ,GAAG,QAAQ;QACvB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;QACvD,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAA,sBAAW,GAAE,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAA,oBAAS,EAAC,IAAA,sBAAW,GAAE,CAAC,CAAC;IAEzB,IAAI,QAAQ,EAAE,CAAC;QACb,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,cAAc,QAAQ,yBAAyB,CAAC,CAAC;IAElF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,GAAG,CAAC,wEAAwE,CAAC,CACpF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const debugCommand: Command;
3
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,YAAY,SAkDrB,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.debugCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const router_js_1 = require("../router.js");
10
+ const persona_manager_js_1 = require("../persona-manager.js");
11
+ exports.debugCommand = new commander_1.Command("debug")
12
+ .description("Show routing decision for a message")
13
+ .argument("<message>", "The message to test routing against")
14
+ .action((message) => {
15
+ const configs = (0, persona_manager_js_1.loadRouterConfig)();
16
+ if (configs.length === 0) {
17
+ console.log(chalk_1.default.yellow("\n No router config found. Run: persona init\n"));
18
+ return;
19
+ }
20
+ console.log(chalk_1.default.bold.blue("\nclaude-agent-personas") + " debug\n");
21
+ console.log(chalk_1.default.dim(` Message: "${message}"\n`));
22
+ const results = (0, router_js_1.routeAll)(message, configs);
23
+ const winner = (0, router_js_1.route)(message, configs);
24
+ if (results.length > 0) {
25
+ console.log(" " +
26
+ chalk_1.default.bold("Persona".padEnd(24)) +
27
+ chalk_1.default.bold("Signals Matched".padEnd(30)) +
28
+ chalk_1.default.bold("Score".padEnd(8)) +
29
+ chalk_1.default.bold("Load?"));
30
+ console.log(" " + "─".repeat(68));
31
+ for (const r of results) {
32
+ const loadMarker = r.wouldLoad ? chalk_1.default.green("✓ YES") : chalk_1.default.dim("no");
33
+ console.log(" " +
34
+ r.persona.padEnd(24) +
35
+ r.signals.join(", ").padEnd(30) +
36
+ String(r.score).padEnd(8) +
37
+ loadMarker);
38
+ }
39
+ }
40
+ console.log();
41
+ if (winner.persona) {
42
+ console.log(chalk_1.default.bold.green(` Would load: ${winner.persona}.md (${winner.score} signal match${winner.score > 1 ? "es" : ""})`));
43
+ }
44
+ else {
45
+ console.log(chalk_1.default.dim(" No persona matched. Claude Code will use default behaviour."));
46
+ }
47
+ console.log();
48
+ });
49
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,4CAA+C;AAC/C,8DAAyD;AAE5C,QAAA,YAAY,GAAG,IAAI,mBAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,qCAAqC,CAAC;KAClD,QAAQ,CAAC,WAAW,EAAE,qCAAqC,CAAC;KAC5D,MAAM,CAAC,CAAC,OAAe,EAAE,EAAE;IAC1B,MAAM,OAAO,GAAG,IAAA,qCAAgB,GAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,iDAAiD,CAAC,CAAC,CAAC;QAC7E,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,UAAU,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,eAAe,OAAO,KAAK,CAAC,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,IAAA,oBAAQ,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,IAAA,iBAAK,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEvC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CACT,IAAI;YACF,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAChC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACxC,eAAK,CAAC,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Command;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,WAAW,SA8EpB,CAAC"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.initCommand = void 0;
40
+ const commander_1 = require("commander");
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const chalk_1 = __importDefault(require("chalk"));
44
+ const utils_js_1 = require("../utils.js");
45
+ const persona_manager_js_1 = require("../persona-manager.js");
46
+ const installer_js_1 = require("../installer.js");
47
+ exports.initCommand = new commander_1.Command("init")
48
+ .description("Install persona routing system into Claude Code")
49
+ .option("--dry-run", "Show what would happen, write nothing")
50
+ .option("--profile <profile>", "Persona profile to install (engineering, business, creative-data, all)", "all")
51
+ .option("--force", "Overwrite existing files")
52
+ .action(async (options) => {
53
+ const dryRun = options.dryRun || false;
54
+ const profile = options.profile;
55
+ const force = options.force || false;
56
+ // Banner
57
+ console.log(chalk_1.default.bold.blue("\nclaude-agent-personas") + " v1.0.0\n");
58
+ if (dryRun) {
59
+ console.log(chalk_1.default.yellow(" [DRY RUN] No files will be written.\n"));
60
+ }
61
+ // Step 1-2: Ensure directories
62
+ if (!dryRun) {
63
+ (0, utils_js_1.ensureDir)((0, utils_js_1.claudeDir)());
64
+ (0, utils_js_1.ensureDir)((0, utils_js_1.personasDir)());
65
+ }
66
+ console.log(chalk_1.default.green(" ✓") + " Ensured ~/.claude/personas/ exists");
67
+ // Step 3: Copy router-config.yml
68
+ if (!dryRun) {
69
+ const installed = (0, persona_manager_js_1.installRouterConfig)(force);
70
+ if (installed) {
71
+ console.log(chalk_1.default.green(" ✓") + " Installed router-config.yml");
72
+ }
73
+ else {
74
+ console.log(chalk_1.default.dim(" ○ router-config.yml already exists (skipped)"));
75
+ }
76
+ }
77
+ else {
78
+ console.log(chalk_1.default.dim(" ○ Would install router-config.yml"));
79
+ }
80
+ // Step 4: Copy persona files
81
+ if (!dryRun) {
82
+ const { copied, skipped } = (0, persona_manager_js_1.installPersonas)(profile, force);
83
+ console.log(chalk_1.default.green(" ✓") + ` Installed ${copied} personas (${skipped} skipped)`);
84
+ }
85
+ else {
86
+ console.log(chalk_1.default.dim(` ○ Would install personas (profile: ${profile})`));
87
+ }
88
+ // Step 5-10: Handle CLAUDE.md
89
+ const routerBlock = fs.readFileSync(path.join((0, utils_js_1.bundledSnippetsDir)(), "claude-md-block.md"), "utf-8");
90
+ const claudeMdPath = (0, installer_js_1.findClaudeMd)();
91
+ if (claudeMdPath) {
92
+ const content = fs.readFileSync(claudeMdPath, "utf-8");
93
+ if ((0, installer_js_1.hasRouterBlock)(content)) {
94
+ console.log(chalk_1.default.dim(" ○ Already installed. Run persona update to refresh."));
95
+ }
96
+ else if (!dryRun) {
97
+ (0, installer_js_1.appendRouterBlock)(claudeMdPath, routerBlock);
98
+ console.log(chalk_1.default.green(" ✓") + ` Appended router block to ${claudeMdPath}`);
99
+ }
100
+ else {
101
+ console.log(chalk_1.default.dim(` ○ Would append router block to ${claudeMdPath}`));
102
+ }
103
+ }
104
+ else {
105
+ if (!dryRun) {
106
+ const created = (0, installer_js_1.createClaudeMd)((0, utils_js_1.claudeDir)(), routerBlock);
107
+ console.log(chalk_1.default.green(" ✓") + ` Created ${created} with router block`);
108
+ }
109
+ else {
110
+ console.log(chalk_1.default.dim(" ○ Would create ~/.claude/CLAUDE.md"));
111
+ }
112
+ }
113
+ // Success summary
114
+ console.log(chalk_1.default.bold.green("\n ✓ Setup complete!\n"));
115
+ console.log(chalk_1.default.dim(" Quick start:"));
116
+ console.log(` Try: ${chalk_1.default.cyan('"why is my postgres query slow?"')} → loads dba-expert`);
117
+ console.log(` Try: ${chalk_1.default.cyan('"review this NDA clause"')} → loads contract-lawyer`);
118
+ console.log(` Try: ${chalk_1.default.cyan('"@staff-engineer design this API"')} → forces staff-engineer`);
119
+ console.log();
120
+ });
121
+ //# sourceMappingURL=init.js.map