heraspec 0.1.12 → 0.1.14

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 (129) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +188 -103
  3. package/bin/heraspec.js +4805 -1122
  4. package/bin/heraspec.js.map +4 -4
  5. package/dist/core/templates/skills/CHANGELOG.md +117 -117
  6. package/dist/core/templates/skills/README-template.md +58 -58
  7. package/dist/core/templates/skills/README.md +38 -38
  8. package/dist/core/templates/skills/content-optimization-skill.md +104 -104
  9. package/dist/core/templates/skills/data/design-systems.csv +54 -0
  10. package/dist/core/templates/skills/data/pages-proposed.csv +21 -21
  11. package/dist/core/templates/skills/data/pages.csv +9 -9
  12. package/dist/core/templates/skills/data/typography.csv +57 -57
  13. package/dist/core/templates/skills/deploy-documentation-skill.md +408 -0
  14. package/dist/core/templates/skills/design-system-skill.md +176 -0
  15. package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +63 -63
  16. package/dist/core/templates/skills/documents/templates/documentation.html +49 -49
  17. package/dist/core/templates/skills/documents/templates/landing-script.js +38 -38
  18. package/dist/core/templates/skills/documents/templates/landing-style.css +158 -158
  19. package/dist/core/templates/skills/documents/templates/script.js +56 -56
  20. package/dist/core/templates/skills/documents/templates/style.css +155 -155
  21. package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -16
  22. package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -16
  23. package/dist/core/templates/skills/documents-skill.md +104 -104
  24. package/dist/core/templates/skills/e2e-test-skill.md +119 -119
  25. package/dist/core/templates/skills/git-embed-skill.md +57 -0
  26. package/dist/core/templates/skills/integration-test-skill.md +118 -118
  27. package/dist/core/templates/skills/knowledge/README.md +63 -0
  28. package/dist/core/templates/skills/knowledge/design-systems/airbnb/DESIGN.md +246 -0
  29. package/dist/core/templates/skills/knowledge/design-systems/airtable/DESIGN.md +89 -0
  30. package/dist/core/templates/skills/knowledge/design-systems/apple/DESIGN.md +313 -0
  31. package/dist/core/templates/skills/knowledge/design-systems/bmw/DESIGN.md +180 -0
  32. package/dist/core/templates/skills/knowledge/design-systems/cal/DESIGN.md +259 -0
  33. package/dist/core/templates/skills/knowledge/design-systems/claude/DESIGN.md +312 -0
  34. package/dist/core/templates/skills/knowledge/design-systems/clay/DESIGN.md +304 -0
  35. package/dist/core/templates/skills/knowledge/design-systems/clickhouse/DESIGN.md +281 -0
  36. package/dist/core/templates/skills/knowledge/design-systems/cohere/DESIGN.md +266 -0
  37. package/dist/core/templates/skills/knowledge/design-systems/coinbase/DESIGN.md +129 -0
  38. package/dist/core/templates/skills/knowledge/design-systems/composio/DESIGN.md +307 -0
  39. package/dist/core/templates/skills/knowledge/design-systems/cursor/DESIGN.md +309 -0
  40. package/dist/core/templates/skills/knowledge/design-systems/elevenlabs/DESIGN.md +265 -0
  41. package/dist/core/templates/skills/knowledge/design-systems/expo/DESIGN.md +281 -0
  42. package/dist/core/templates/skills/knowledge/design-systems/figma/DESIGN.md +220 -0
  43. package/dist/core/templates/skills/knowledge/design-systems/framer/DESIGN.md +246 -0
  44. package/dist/core/templates/skills/knowledge/design-systems/hashicorp/DESIGN.md +278 -0
  45. package/dist/core/templates/skills/knowledge/design-systems/ibm/DESIGN.md +332 -0
  46. package/dist/core/templates/skills/knowledge/design-systems/index.json +72 -0
  47. package/dist/core/templates/skills/knowledge/design-systems/intercom/DESIGN.md +146 -0
  48. package/dist/core/templates/skills/knowledge/design-systems/kraken/DESIGN.md +125 -0
  49. package/dist/core/templates/skills/knowledge/design-systems/linear.app/DESIGN.md +367 -0
  50. package/dist/core/templates/skills/knowledge/design-systems/lovable/DESIGN.md +298 -0
  51. package/dist/core/templates/skills/knowledge/design-systems/minimax/DESIGN.md +257 -0
  52. package/dist/core/templates/skills/knowledge/design-systems/mintlify/DESIGN.md +326 -0
  53. package/dist/core/templates/skills/knowledge/design-systems/miro/DESIGN.md +108 -0
  54. package/dist/core/templates/skills/knowledge/design-systems/mistral.ai/DESIGN.md +261 -0
  55. package/dist/core/templates/skills/knowledge/design-systems/mongodb/DESIGN.md +266 -0
  56. package/dist/core/templates/skills/knowledge/design-systems/notion/DESIGN.md +309 -0
  57. package/dist/core/templates/skills/knowledge/design-systems/nvidia/DESIGN.md +293 -0
  58. package/dist/core/templates/skills/knowledge/design-systems/ollama/DESIGN.md +267 -0
  59. package/dist/core/templates/skills/knowledge/design-systems/opencode.ai/DESIGN.md +281 -0
  60. package/dist/core/templates/skills/knowledge/design-systems/pinterest/DESIGN.md +230 -0
  61. package/dist/core/templates/skills/knowledge/design-systems/posthog/DESIGN.md +256 -0
  62. package/dist/core/templates/skills/knowledge/design-systems/raycast/DESIGN.md +268 -0
  63. package/dist/core/templates/skills/knowledge/design-systems/replicate/DESIGN.md +261 -0
  64. package/dist/core/templates/skills/knowledge/design-systems/resend/DESIGN.md +303 -0
  65. package/dist/core/templates/skills/knowledge/design-systems/revolut/DESIGN.md +185 -0
  66. package/dist/core/templates/skills/knowledge/design-systems/runwayml/DESIGN.md +244 -0
  67. package/dist/core/templates/skills/knowledge/design-systems/sanity/DESIGN.md +357 -0
  68. package/dist/core/templates/skills/knowledge/design-systems/sentry/DESIGN.md +262 -0
  69. package/dist/core/templates/skills/knowledge/design-systems/spacex/DESIGN.md +194 -0
  70. package/dist/core/templates/skills/knowledge/design-systems/spotify/DESIGN.md +246 -0
  71. package/dist/core/templates/skills/knowledge/design-systems/stripe/DESIGN.md +322 -0
  72. package/dist/core/templates/skills/knowledge/design-systems/supabase/DESIGN.md +255 -0
  73. package/dist/core/templates/skills/knowledge/design-systems/superhuman/DESIGN.md +252 -0
  74. package/dist/core/templates/skills/knowledge/design-systems/together.ai/DESIGN.md +263 -0
  75. package/dist/core/templates/skills/knowledge/design-systems/uber/DESIGN.md +295 -0
  76. package/dist/core/templates/skills/knowledge/design-systems/vercel/DESIGN.md +310 -0
  77. package/dist/core/templates/skills/knowledge/design-systems/voltagent/DESIGN.md +323 -0
  78. package/dist/core/templates/skills/knowledge/design-systems/warp/DESIGN.md +253 -0
  79. package/dist/core/templates/skills/knowledge/design-systems/webflow/DESIGN.md +92 -0
  80. package/dist/core/templates/skills/knowledge/design-systems/wise/DESIGN.md +173 -0
  81. package/dist/core/templates/skills/knowledge/design-systems/x.ai/DESIGN.md +257 -0
  82. package/dist/core/templates/skills/knowledge/design-systems/zapier/DESIGN.md +328 -0
  83. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/profile.json +27 -0
  84. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/structure.md +137 -0
  85. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/profile.json +39 -0
  86. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/structure.md +208 -0
  87. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/profile.json +51 -0
  88. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/structure.md +369 -0
  89. package/dist/core/templates/skills/knowledge/index.json +65 -0
  90. package/dist/core/templates/skills/module-codebase-skill.md +110 -110
  91. package/dist/core/templates/skills/plugin-directory-skill.md +396 -396
  92. package/dist/core/templates/skills/project-memory-skill.md +222 -0
  93. package/dist/core/templates/skills/project-memory-skill.vi.md +223 -0
  94. package/dist/core/templates/skills/scripts/CODE_EXPLANATION.md +394 -394
  95. package/dist/core/templates/skills/scripts/SEARCH_ALGORITHMS_COMPARISON.md +421 -421
  96. package/dist/core/templates/skills/scripts/SEARCH_MODES_GUIDE.md +238 -238
  97. package/dist/core/templates/skills/scripts/__pycache__/core.cpython-311.pyc +0 -0
  98. package/dist/core/templates/skills/scripts/core.py +391 -385
  99. package/dist/core/templates/skills/scripts/search.py +1 -1
  100. package/dist/core/templates/skills/smart-explore-skill.md +141 -0
  101. package/dist/core/templates/skills/sourcecode-analyzer-skill.md +210 -0
  102. package/dist/core/templates/skills/sourcecode-analyzer-skill.vi.md +210 -0
  103. package/dist/core/templates/skills/suggestion-skill.md +118 -118
  104. package/dist/core/templates/skills/templates/accessibility-checklist.md +40 -40
  105. package/dist/core/templates/skills/templates/example-prompt-full-theme.md +333 -333
  106. package/dist/core/templates/skills/templates/page-types-guide.md +338 -338
  107. package/dist/core/templates/skills/templates/pages-proposed-summary.md +273 -273
  108. package/dist/core/templates/skills/templates/pre-delivery-checklist.md +42 -42
  109. package/dist/core/templates/skills/templates/prompt-template-full-theme.md +313 -313
  110. package/dist/core/templates/skills/templates/responsive-design.md +40 -40
  111. package/dist/core/templates/skills/ui-ux-skill.md +595 -584
  112. package/dist/core/templates/skills/unit-test-skill.md +111 -111
  113. package/dist/core/templates/skills/ux-element/templates/Controller.php +50 -50
  114. package/dist/core/templates/skills/ux-element/templates/Shortcode.php +23 -23
  115. package/dist/core/templates/skills/ux-element/templates/Template.html +20 -20
  116. package/dist/core/templates/skills/ux-element/templates/Thumbnail.svg +8 -8
  117. package/dist/core/templates/skills/ux-element/templates/View.php +21 -21
  118. package/dist/core/templates/skills/ux-element-skill.md +83 -83
  119. package/dist/core/templates/skills/wordpress-plugin-check-skill.md +151 -76
  120. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -47
  121. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -60
  122. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -22
  123. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -15
  124. package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -169
  125. package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -41
  126. package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -21
  127. package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +100 -100
  128. package/dist/index.js +4068 -278
  129. package/package.json +75 -72
@@ -4,7 +4,7 @@
4
4
  UI/UX Builder Search - BM25, Vector, and Hybrid search engine for UI/UX style guides
5
5
  Usage: python search.py "<query>" [--domain <domain>] [--stack <stack>] [--mode <mode>] [--max-results 3]
6
6
 
7
- Domains: style, prompt, color, chart, landing, product, ux, typography, pages
7
+ Domains: style, prompt, color, chart, landing, product, ux, typography, pages, design-system
8
8
  Stacks: html-tailwind, react, nextjs, vue, svelte, swiftui, react-native, flutter
9
9
  Modes: bm25 (default), vector, hybrid
10
10
 
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: smart-explore
3
+ description: Token-efficient code exploration — view file structure, search symbols, and read specific implementations without loading full files. Reduces token usage by 4-18x compared to reading entire files.
4
+ projectType: all
5
+ ---
6
+
7
+ # Smart Explore Skill
8
+
9
+ ## Purpose
10
+
11
+ Enable AI agents to **explore codebases efficiently** by viewing structural outlines, searching for symbols, and extracting specific implementations — without reading entire files. This dramatically reduces token consumption when navigating large projects.
12
+
13
+ ## When to Use
14
+
15
+ - **Understanding a new file**: Use `outline` instead of reading the full file
16
+ - **Finding where something is defined**: Use `search` to locate symbols across the project
17
+ - **Reading a specific function**: Use `unfold` to extract just that function's code
18
+
19
+ ## Token Savings
20
+
21
+ | Method | Typical Token Cost | Notes |
22
+ |--------|-------------------|-------|
23
+ | Read full file | ~12,000+ | All content, most irrelevant |
24
+ | **Outline** | ~1,000-2,000 | Structural skeleton only |
25
+ | **Search** | ~2,000-6,000 | Symbol locations across codebase |
26
+ | **Unfold** | ~400-2,100 | Exact function/class source |
27
+
28
+ **Savings: 4-18x** compared to reading full files.
29
+
30
+ ## Available Commands
31
+
32
+ ### 1. Outline — Structural Skeleton
33
+
34
+ View all symbols (functions, classes, interfaces, exports) in a file without reading the full source:
35
+
36
+ ```bash
37
+ heraspec explore outline src/core/memory/memory-store.ts
38
+ ```
39
+
40
+ **Output example:**
41
+ ```
42
+ ## 📄 src/core/memory/memory-store.ts
43
+ *typescript | 285 lines | ~71250 tokens*
44
+
45
+ 🏛️ export class MemoryStore (L20-285)
46
+ ↳ open() (L32-58)
47
+ ↳ close() (L63-68)
48
+ ↳ addObservation(input) (L88-120)
49
+ ↳ getObservationById(id) (L125-132)
50
+ ↳ getRecentObservations(project, limit) (L140-160)
51
+ ↳ addSummary(input) (L165-195)
52
+ ↳ getStatus(project) (L200-260)
53
+ ```
54
+
55
+ ### 2. Search — Find Symbols Across Codebase
56
+
57
+ Search for functions, classes, interfaces by name across the project:
58
+
59
+ ```bash
60
+ heraspec explore search "MemoryStore" src/
61
+ heraspec explore search "addObservation" src/ --limit 10
62
+ ```
63
+
64
+ **Output example:**
65
+ ```
66
+ ## Symbol Search: "MemoryStore" (3 results)
67
+
68
+ | Rel | Type | Name | File | Lines |
69
+ |-----|------|------|------|-------|
70
+ | 100% | 🏛️ class | MemoryStore | src/core/memory/memory-store.ts | L20-285 |
71
+ | 60% | ⚡ function | MemoryStoreFactory | src/core/memory/index.ts | L10-15 |
72
+ | 40% | 📌 variable | memoryStore | src/commands/memory.ts | L25-25 |
73
+ ```
74
+
75
+ ### 3. Unfold — Extract Specific Symbol Source
76
+
77
+ Read just the implementation of a specific function or class:
78
+
79
+ ```bash
80
+ heraspec explore unfold src/core/memory/memory-store.ts addObservation
81
+ ```
82
+
83
+ **Output example:**
84
+ ```
85
+ ## method: addObservation
86
+ *src/core/memory/memory-store.ts:L88-120 | ~800 tokens (vs ~71250 full file)*
87
+
88
+ addObservation(input: ObservationInput): Observation {
89
+ this.ensureOpen();
90
+ // ... full implementation
91
+ }
92
+ ```
93
+
94
+ ## Supported Languages
95
+
96
+ | Language | Extensions | Symbols Detected |
97
+ |----------|-----------|-----------------|
98
+ | TypeScript | `.ts`, `.tsx` | class, interface, type, enum, function, method, variable |
99
+ | JavaScript | `.js`, `.jsx`, `.mjs` | class, function, method, variable |
100
+ | Python | `.py` | class, function, method, variable |
101
+ | PHP | `.php` | class, interface, function |
102
+ | Go | `.go` | struct, interface, func |
103
+ | Rust | `.rs` | struct, trait, enum, fn |
104
+ | Java | `.java` | class, interface, method |
105
+ | C# | `.cs` | class, interface, method |
106
+ | Vue | `.vue` | Same as TypeScript |
107
+ | Svelte | `.svelte` | Same as TypeScript |
108
+
109
+ ## Workflow for AI Agents
110
+
111
+ ### Exploration Strategy
112
+
113
+ ```
114
+ Need to understand a file?
115
+ ├── Step 1: heraspec explore outline <file>
116
+ │ → See all functions, classes, interfaces (~1K tokens)
117
+ ├── Step 2: Identify relevant symbols from outline
118
+ ├── Step 3: heraspec explore unfold <file> <symbol>
119
+ │ → Read just the relevant function (~400-2K tokens)
120
+ └── Only read full file if you need comprehensive understanding
121
+
122
+ Need to find where something is?
123
+ ├── heraspec explore search "<name>" <path>
124
+ │ → Find symbol locations across codebase
125
+ ├── Then use unfold to read specific implementations
126
+ └── Avoid grep-like full-text search when possible
127
+ ```
128
+
129
+ ### Key Principles
130
+
131
+ 1. **Outline first, read later**: Always check the outline before reading full files
132
+ 2. **Unfold specific symbols**: Don't read entire files when you only need one function
133
+ 3. **Search before browsing**: Find what you need by name rather than scanning directories
134
+ 4. **Skip node_modules, dist, .git**: Automatically excluded from search
135
+
136
+ ## Limitations
137
+
138
+ - Uses regex-based parsing (not AST) — may miss some complex patterns
139
+ - Symbol end-line detection is approximate (brace/indent counting)
140
+ - Method detection within classes requires proper indentation
141
+ - Does not handle dynamically generated code or macros
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: sourcecode-analyzer
3
+ description: Multi-agent deep source code analysis for architecture, coding style, design patterns, languages, frameworks, libraries, module structure, extension points, and integration readiness. Use when agents must understand a codebase before planning features, refactoring, integration, migration, auditing, or documentation.
4
+ projectType: all
5
+ ---
6
+
7
+ # Source Code Analyzer
8
+
9
+ ## Objective
10
+ Produce a high-confidence architecture and integration analysis of the repository with evidence from real files.
11
+
12
+ ## Scope
13
+ Analyze:
14
+ - Architecture boundaries and layering
15
+ - Framework/CMS/runtime and dependency stack
16
+ - Coding style and conventions
17
+ - Modules/themes/plugins and extension points
18
+ - API surfaces (REST/GraphQL/webhooks/events/CLI/jobs)
19
+ - Data layer and configuration model
20
+ - Security and operational posture
21
+ - Integration capability and constraints
22
+
23
+ Do not:
24
+ - Modify business logic
25
+ - Run destructive commands
26
+ - Install or upgrade dependencies unless requested
27
+
28
+ ## Required Output
29
+ Write a report to `_analytics/structure.md` (or user-provided path) with the exact section order defined in "Report Template".
30
+
31
+ ## Evidence Rules
32
+ For every important claim:
33
+ - Include concrete evidence (file path, symbol/class/function, and short snippet summary)
34
+ - Mark confidence as `High`, `Medium`, or `Low`
35
+ - Label statement type:
36
+ - `Observed`: Directly confirmed in source
37
+ - `Inferred`: Derived from multiple observed facts
38
+ - `Assumed`: Plausible but not yet confirmed
39
+
40
+ Avoid ungrounded conclusions.
41
+
42
+ ## Multi-Agent Orchestration
43
+ If subagents are available, split work in parallel:
44
+
45
+ 1. `Architecture lane`
46
+ - Map directory topology, layers, modules/plugins/themes
47
+ - Identify entry points and dependency direction
48
+
49
+ 2. `Style and design lane`
50
+ - Detect naming conventions, folder conventions, patterns, anti-patterns
51
+ - Detect coding standards and linting/testing quality gates
52
+
53
+ 3. `Dependency and runtime lane`
54
+ - Detect language/runtime/framework versions
55
+ - Inventory key libraries and their roles
56
+
57
+ 4. `Integration and security lane`
58
+ - Map APIs, events/hooks, queues, cron/jobs, webhooks, third-party SDKs
59
+ - Assess authN/authZ, input validation, secrets handling, and attack surface
60
+
61
+ Coordinator responsibilities:
62
+ - Normalize lane outputs
63
+ - Resolve contradictions
64
+ - Produce one final report with evidence and confidence
65
+
66
+ If subagents are unavailable, execute the same lanes sequentially.
67
+
68
+ ## Workflow
69
+
70
+ ### Step 0 — Knowledge Lookup (Pre-Analysis)
71
+ Before starting full analysis, check if pre-analyzed knowledge exists:
72
+
73
+ 1. Check if `heraspec/knowledge/index.json` exists in the project
74
+ 2. Read all entries and match against the current project:
75
+ - For `file-contains` signals: check if the file exists AND contains the specified string
76
+ - For `directory-exists` signals: check if the directory exists
77
+ - Each matched signal = +1 to the match score
78
+ 3. If `score >= minMatchScore` for any entry:
79
+ - Read the corresponding `structure.md` from `heraspec/knowledge/<knowledgePath>/`
80
+ - Use it as the **baseline analysis** — skip redundant Steps 1-8 for sections already covered
81
+ - Focus only on **project-specific differences** (custom plugins, configs, .env, custom code)
82
+ - Output: merge baseline knowledge + project-specific delta into final report
83
+ 4. Also check `heraspec/knowledge/custom/index.json` for project-specific knowledge entries
84
+ 5. If no match found in either index: proceed with full analysis from Step 1
85
+
86
+ Knowledge hierarchy: `heraspec/knowledge/<category>/<runtime>/<framework>/<cms>/`
87
+
88
+ ### Step 1 - Baseline Metadata
89
+ Read root metadata first:
90
+ - `composer.json`, `composer.lock`
91
+ - `package.json`, lockfiles
92
+ - `docker*`, `Makefile`, CI configs
93
+ - `.env.example`, config directories
94
+
95
+ Capture:
96
+ - Language/runtime versions
97
+ - Framework/CMS versions
98
+ - Build and deployment model
99
+
100
+ ### Step 2 - Repository Topology
101
+ Map major folders and responsibilities:
102
+ - Core/domain/infrastructure boundaries
103
+ - Plugin/module/theme architecture
104
+ - Shared libraries and cross-cutting concerns
105
+ - Bootstrapping and entry points
106
+
107
+ ### Step 3 - Architectural Patterns
108
+ Identify and evaluate:
109
+ - Layered/hexagonal/modular/monolith/microservice patterns
110
+ - Service container/DI usage
111
+ - Event-driven flows
112
+ - Boundaries and coupling hotspots
113
+
114
+ ### Step 4 - Coding Style and Design Conventions
115
+ Inspect representative files from each major layer:
116
+ - Naming conventions (class/function/file)
117
+ - Folder and namespace strategy
118
+ - Error handling patterns
119
+ - Test style and coverage signals
120
+ - Static analysis/lint/format rules
121
+
122
+ ### Step 5 - Extension Model
123
+ Map extensibility mechanisms:
124
+ - Hooks/filters/events/listeners
125
+ - Plugin/module registration and lifecycle
126
+ - Theme/template override model
127
+ - Custom providers, middleware, policies
128
+
129
+ ### Step 6 - API and Interaction Surfaces
130
+ Inventory internal and external interfaces:
131
+ - REST/GraphQL routes and controllers
132
+ - Command bus, queues, jobs, schedulers
133
+ - CLI commands, webhooks, callbacks
134
+ - Public SDK/service abstractions
135
+
136
+ ### Step 7 - Data and State
137
+ Analyze:
138
+ - ORM/data access strategy
139
+ - Migration and seeding patterns
140
+ - Cache/session/queue drivers
141
+ - Transaction boundaries and consistency risks
142
+
143
+ ### Step 8 - Security and Compliance Signals
144
+ Check:
145
+ - Authentication and authorization model
146
+ - CSRF/XSS/SQLi protections
147
+ - Secrets and credential handling
148
+ - Rate limiting and abuse protection
149
+ - Audit logging and sensitive operation traces
150
+
151
+ ### Step 9 - Integration Readiness
152
+ Evaluate integration capability across:
153
+ - Data integration
154
+ - API integration
155
+ - Event integration
156
+ - UI/theme integration
157
+ - Deployment/infra integration
158
+
159
+ For each integration type, summarize:
160
+ - Available entry points
161
+ - Required adapters
162
+ - Estimated complexity (`Low`/`Medium`/`High`)
163
+ - Major risks and mitigations
164
+
165
+ ### Step 10 - Synthesis
166
+ Consolidate findings into one report, prioritize evidence-backed conclusions, and list unknowns that block confidence.
167
+
168
+ ## Report Template
169
+
170
+ Use this exact section order in `_analytics/structure.md`:
171
+
172
+ 1. `Executive Summary`
173
+ 2. `Technology Profile`
174
+ 3. `Repository Topology`
175
+ 4. `Architecture and Dependency Flow`
176
+ 5. `Coding Style and Conventions`
177
+ 6. `Extension Points (Modules/Themes/Plugins/Hooks)`
178
+ 7. `API and Interaction Surfaces`
179
+ 8. `Data Model and State Management`
180
+ 9. `Security Posture`
181
+ 10. `Integration Capability Matrix`
182
+ 11. `Strengths, Weaknesses, Risks`
183
+ 12. `Top 10 Evidence Items`
184
+ 13. `Unknowns and Verification Plan`
185
+ 14. `Recommended Next Actions (30/60/90 day)`
186
+
187
+ ## Integration Capability Matrix Format
188
+
189
+ Use one row per integration domain:
190
+
191
+ | Domain | Entry Points | Required Adapters | Complexity | Risks | Confidence |
192
+ |---|---|---|---|---|---|
193
+
194
+ Domains to include:
195
+ - External APIs
196
+ - Authentication/SSO
197
+ - Payment
198
+ - Messaging/Queue
199
+ - Storage/CDN
200
+ - Observability
201
+ - Admin/UI customization
202
+ - Content/data migration
203
+
204
+ ## Completion Checklist
205
+ Complete the skill execution only when all conditions are met:
206
+ - Report file exists at target path
207
+ - Every critical claim has evidence
208
+ - Assumptions are explicitly marked
209
+ - Integration matrix is complete
210
+ - Top risks include mitigation guidance
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: sourcecode-analyzer
3
+ description: Phân tích sâu source code theo mô hình đa agent cho kiến trúc, coding style, design pattern, ngôn ngữ, framework, thư viện, cấu trúc module, extension point và khả năng tích hợp. Sử dụng khi agent cần hiểu tối đa codebase trước khi lập kế hoạch feature, refactor, integration, migration, audit hoặc documentation.
4
+ projectType: all
5
+ ---
6
+
7
+ # Source Code Analyzer (Tiếng Việt)
8
+
9
+ ## Mục tiêu
10
+ Tạo báo cáo phân tích kiến trúc và khả năng tích hợp có độ tin cậy cao, dựa trên bằng chứng trực tiếp từ source code.
11
+
12
+ ## Phạm vi
13
+ Phân tích:
14
+ - Ranh giới kiến trúc và phân lớp
15
+ - Stack framework/CMS/runtime và dependency
16
+ - Coding style và conventions
17
+ - Modules/themes/plugins và extension points
18
+ - API surfaces (REST/GraphQL/webhooks/events/CLI/jobs)
19
+ - Data layer và mô hình cấu hình
20
+ - Bảo mật và vận hành
21
+ - Khả năng tích hợp và các ràng buộc
22
+
23
+ Không:
24
+ - Sửa business logic
25
+ - Chạy lệnh hủy hoại
26
+ - Cài đặt hoặc nâng cấp dependency nếu chưa được yêu cầu
27
+
28
+ ## Đầu ra bắt buộc
29
+ Ghi báo cáo vào `_analytics/structure.md` (hoặc đường dẫn do người dùng chỉ định), đúng thứ tự section như trong `Report Template`.
30
+
31
+ ## Quy tắc bằng chứng
32
+ Mỗi nhận định quan trọng phải:
33
+ - Có bằng chứng cụ thể (đường dẫn file, symbol/class/function, tóm tắt snippet ngắn)
34
+ - Gán mức độ tin cậy `High`, `Medium` hoặc `Low`
35
+ - Gán loại nhận định:
36
+ - `Observed`: Xác nhận trực tiếp trong source
37
+ - `Inferred`: Suy ra từ nhiều quan sát đã xác thực
38
+ - `Assumed`: Giả định hợp lý nhưng chưa xác thực
39
+
40
+ Không đưa ra kết luận không có cơ sở.
41
+
42
+ ## Điều phối đa agent
43
+ Nếu có subagents, tách song song 4 lane:
44
+
45
+ 1. `Architecture lane`
46
+ - Lập bản đồ topology thư mục, layers, modules/plugins/themes
47
+ - Xác định entry points và hướng phụ thuộc
48
+
49
+ 2. `Style and design lane`
50
+ - Xác định naming conventions, folder conventions, patterns, anti-patterns
51
+ - Xác định coding standards và quality gates (lint/test/static check)
52
+
53
+ 3. `Dependency and runtime lane`
54
+ - Xác định ngôn ngữ/runtime/framework versions
55
+ - Inventory thư viện quan trọng và vai trò
56
+
57
+ 4. `Integration and security lane`
58
+ - Lập bản đồ APIs, events/hooks, queues, cron/jobs, webhooks, third-party SDKs
59
+ - Đánh giá authN/authZ, input validation, secrets handling và attack surface
60
+
61
+ Nhiệm vụ của coordinator:
62
+ - Chuẩn hóa output của các lane
63
+ - Xử lý mâu thuẫn giữa các lane
64
+ - Tổng hợp 1 báo cáo cuối cùng có bằng chứng và confidence
65
+
66
+ Nếu không có subagents, chạy tuần tự theo cùng quy trình lane.
67
+
68
+ ## Workflow
69
+
70
+ ### Step 0 — Knowledge Lookup (Tra cứu kiến thức sẵn có)
71
+ Trước khi phân tích toàn bộ, kiểm tra knowledge base đã có sẵn:
72
+
73
+ 1. Kiểm tra `heraspec/knowledge/index.json` có tồn tại trong dự án không
74
+ 2. Đọc tất cả entries và đối chiếu với dự án hiện tại:
75
+ - Với signal `file-contains`: kiểm tra file tồn tại VÀ chứa chuỗi chỉ định
76
+ - Với signal `directory-exists`: kiểm tra thư mục tồn tại
77
+ - Mỗi signal khớp = +1 điểm match score
78
+ 3. Nếu `score >= minMatchScore` cho bất kỳ entry nào:
79
+ - Đọc `structure.md` tương ứng từ `heraspec/knowledge/<knowledgePath>/`
80
+ - Sử dụng làm **baseline phân tích** — bỏ qua Steps 1-8 cho các section đã có
81
+ - Chỉ tập trung vào **khác biệt riêng dự án** (custom plugins, configs, .env, custom code)
82
+ - Đầu ra: gộp baseline knowledge + delta riêng dự án thành báo cáo cuối
83
+ 4. Kiểm tra thêm `heraspec/knowledge/custom/index.json` cho knowledge riêng dự án
84
+ 5. Nếu không match: tiến hành phân tích đầy đủ từ Step 1
85
+
86
+ Phân cấp knowledge: `heraspec/knowledge/<category>/<runtime>/<framework>/<cms>/`
87
+
88
+ ### Step 1 - Baseline Metadata
89
+ Đọc metadata ở root trước:
90
+ - `composer.json`, `composer.lock`
91
+ - `package.json`, lockfiles
92
+ - `docker*`, `Makefile`, CI configs
93
+ - `.env.example`, config directories
94
+
95
+ Thu thập:
96
+ - Language/runtime versions
97
+ - Framework/CMS versions
98
+ - Build và deployment model
99
+
100
+ ### Step 2 - Repository Topology
101
+ Lập bản đồ thư mục chính và trách nhiệm:
102
+ - Core/domain/infrastructure boundaries
103
+ - Kiến trúc plugin/module/theme
104
+ - Shared libraries và cross-cutting concerns
105
+ - Bootstrapping và entry points
106
+
107
+ ### Step 3 - Architectural Patterns
108
+ Xác định và đánh giá:
109
+ - Layered/hexagonal/modular/monolith/microservice patterns
110
+ - Sử dụng service container/DI
111
+ - Event-driven flows
112
+ - Điểm nóng coupling và boundaries
113
+
114
+ ### Step 4 - Coding Style and Design Conventions
115
+ Kiểm tra các file đại diện mỗi layer:
116
+ - Naming conventions (class/function/file)
117
+ - Folder và namespace strategy
118
+ - Error handling patterns
119
+ - Test style và coverage signals
120
+ - Static analysis/lint/format rules
121
+
122
+ ### Step 5 - Extension Model
123
+ Lập bản đồ cơ chế mở rộng:
124
+ - Hooks/filters/events/listeners
125
+ - Đăng ký module/plugin và lifecycle
126
+ - Theme/template override model
127
+ - Custom providers, middleware, policies
128
+
129
+ ### Step 6 - API and Interaction Surfaces
130
+ Thống kê interfaces nội bộ và bên ngoài:
131
+ - REST/GraphQL routes và controllers
132
+ - Command bus, queues, jobs, schedulers
133
+ - CLI commands, webhooks, callbacks
134
+ - Public SDK/service abstractions
135
+
136
+ ### Step 7 - Data and State
137
+ Phân tích:
138
+ - ORM/data access strategy
139
+ - Migration và seeding patterns
140
+ - Cache/session/queue drivers
141
+ - Transaction boundaries và consistency risks
142
+
143
+ ### Step 8 - Security and Compliance Signals
144
+ Kiểm tra:
145
+ - Authentication và authorization model
146
+ - CSRF/XSS/SQLi protections
147
+ - Secrets và credential handling
148
+ - Rate limiting và abuse protection
149
+ - Audit logging và trace các thao tác nhạy cảm
150
+
151
+ ### Step 9 - Integration Readiness
152
+ Đánh giá khả năng tích hợp theo:
153
+ - Data integration
154
+ - API integration
155
+ - Event integration
156
+ - UI/theme integration
157
+ - Deployment/infra integration
158
+
159
+ Mỗi loại tích hợp cần tóm tắt:
160
+ - Entry points hiện có
161
+ - Adapters cần bổ sung
162
+ - Độ phức tạp ước tính (`Low`/`Medium`/`High`)
163
+ - Rủi ro chính và hướng giảm thiểu
164
+
165
+ ### Step 10 - Synthesis
166
+ Tổng hợp findings vào một báo cáo, ưu tiên kết luận có bằng chứng, và liệt kê unknowns đang cần xác minh.
167
+
168
+ ## Report Template
169
+
170
+ Sử dụng đúng thứ tự section sau trong `_analytics/structure.md`:
171
+
172
+ 1. `Executive Summary`
173
+ 2. `Technology Profile`
174
+ 3. `Repository Topology`
175
+ 4. `Architecture and Dependency Flow`
176
+ 5. `Coding Style and Conventions`
177
+ 6. `Extension Points (Modules/Themes/Plugins/Hooks)`
178
+ 7. `API and Interaction Surfaces`
179
+ 8. `Data Model and State Management`
180
+ 9. `Security Posture`
181
+ 10. `Integration Capability Matrix`
182
+ 11. `Strengths, Weaknesses, Risks`
183
+ 12. `Top 10 Evidence Items`
184
+ 13. `Unknowns and Verification Plan`
185
+ 14. `Recommended Next Actions (30/60/90 day)`
186
+
187
+ ## Integration Capability Matrix Format
188
+
189
+ Mỗi integration domain là 1 dòng:
190
+
191
+ | Domain | Entry Points | Required Adapters | Complexity | Risks | Confidence |
192
+ |---|---|---|---|---|---|
193
+
194
+ Bắt buộc gồm:
195
+ - External APIs
196
+ - Authentication/SSO
197
+ - Payment
198
+ - Messaging/Queue
199
+ - Storage/CDN
200
+ - Observability
201
+ - Admin/UI customization
202
+ - Content/data migration
203
+
204
+ ## Completion Checklist
205
+ Chỉ kết thúc skill khi đủ các điều kiện:
206
+ - Report tồn tại ở đường dẫn mục tiêu
207
+ - Mỗi nhận định quan trọng đều có bằng chứng
208
+ - Giả định được đánh dấu rõ ràng
209
+ - Integration matrix đầy đủ
210
+ - Top risks có hướng giảm thiểu đề xuất