@onion-architect-ai/cli 4.1.0-beta.1 โ 4.1.0-beta.3
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/dist/cli.js +8 -19
- package/dist/cli.js.map +1 -1
- package/package.json +4 -3
- package/templates/.cursor/agents/compliance/iso-22301-specialist.md +917 -0
- package/templates/.cursor/agents/compliance/iso-27001-specialist.md +641 -0
- package/templates/.cursor/agents/compliance/pmbok-specialist.md +669 -0
- package/templates/.cursor/agents/compliance/security-information-master.md +824 -0
- package/templates/.cursor/agents/compliance/soc2-specialist.md +818 -0
- package/templates/.cursor/agents/deployment/docker-specialist.md +1192 -0
- package/templates/.cursor/agents/meta/agent-creator-specialist.md +1135 -0
- package/templates/.cursor/agents/meta/command-creator-specialist.md +1519 -0
- package/templates/.cursor/agents/meta/metaspec-gate-keeper.md +240 -0
- package/templates/.cursor/agents/meta/onion.md +753 -0
- package/templates/.cursor/agents/research/research-agent.md +292 -0
- package/templates/.cursor/agents/review/corporate-compliance-specialist.md +370 -0
- package/templates/.cursor/commands/common/prompts/README.md +187 -0
- package/templates/.cursor/commands/common/prompts/clickup-patterns.md +144 -0
- package/templates/.cursor/commands/common/prompts/code-review-checklist.md +168 -0
- package/templates/.cursor/commands/common/prompts/git-workflow-patterns.md +235 -0
- package/templates/.cursor/commands/common/prompts/output-formats.md +240 -0
- package/templates/.cursor/commands/common/prompts/technical.md +172 -0
- package/templates/.cursor/commands/common/prompts/validation-rules.md +173 -0
- package/templates/.cursor/commands/common/templates/abstraction-template.md +400 -0
- package/templates/.cursor/commands/common/templates/agent-template.md +353 -0
- package/templates/.cursor/commands/common/templates/business_context_template.md +748 -0
- package/templates/.cursor/commands/common/templates/command-template.md +273 -0
- package/templates/.cursor/commands/common/templates/technical_context_template.md +526 -0
- package/templates/.cursor/commands/development/runflow-dev.md +465 -0
- package/templates/.cursor/commands/docs/build-compliance-docs.md +143 -0
- package/templates/.cursor/commands/git/README.md +606 -0
- package/templates/.cursor/commands/meta/all-tools.md +50 -0
- package/templates/.cursor/commands/meta/analyze-complex-problem.md +186 -0
- package/templates/.cursor/commands/meta/create-abstraction.md +859 -0
- package/templates/.cursor/commands/meta/create-agent-express.md +83 -0
- package/templates/.cursor/commands/meta/create-agent.md +210 -0
- package/templates/.cursor/commands/meta/create-command.md +203 -0
- package/templates/.cursor/commands/meta/create-knowledge-base.md +143 -0
- package/templates/.cursor/commands/meta/create-task-structure.md +150 -0
- package/templates/.cursor/commands/meta/setup-integration.md +257 -0
- package/templates/.cursor/commands/onion/setup.md +843 -0
- package/templates/.cursor/commands/onion.md +168 -0
- package/templates/.cursor/commands/product/README.md +230 -0
- package/templates/.cursor/commands/quick/analisys.md +17 -0
- package/templates/.cursor/commands/validate/collab/pair-testing.md +633 -0
- package/templates/.cursor/commands/validate/collab/three-amigos.md +505 -0
- package/templates/.cursor/commands/validate/qa-points/estimate.md +660 -0
- package/templates/.cursor/commands/validate/test-strategy/analyze.md +1134 -0
- package/templates/.cursor/commands/validate/test-strategy/create.md +392 -0
- package/templates/.cursor/commands/validate/workflow.md +360 -0
- package/templates/.cursor/commands/warm-up.md +91 -0
- package/templates/.cursor/docs/architecture/acoplamento-clickup-problema-analise.md +446 -0
- package/templates/.cursor/docs/architecture/desacoplamento-roadmap.md +360 -0
- package/templates/.cursor/docs/architecture/validacao-fase-1.md +219 -0
- package/templates/.cursor/docs/c4/c4-detection-rules.md +395 -0
- package/templates/.cursor/docs/c4/c4-documentation-templates.md +579 -0
- package/templates/.cursor/docs/c4/c4-mermaid-patterns.md +331 -0
- package/templates/.cursor/docs/c4/c4-templates.md +256 -0
- package/templates/.cursor/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
- package/templates/.cursor/docs/clickup/clickup-auto-update-strategy.md +318 -0
- package/templates/.cursor/docs/clickup/clickup-comment-formatter.md +239 -0
- package/templates/.cursor/docs/clickup/clickup-description-fix.md +355 -0
- package/templates/.cursor/docs/clickup/clickup-dual-comment-strategy.md +505 -0
- package/templates/.cursor/docs/clickup/clickup-formatting.md +302 -0
- package/templates/.cursor/docs/clickup/separador-tamanho-otimizado.md +256 -0
- package/templates/.cursor/docs/engineer/pre-pr-acceptance-validation.md +256 -0
- package/templates/.cursor/docs/onion/ESPERANTO.md +278 -0
- package/templates/.cursor/docs/onion/agents-reference.md +832 -0
- package/templates/.cursor/docs/onion/clickup-integration.md +738 -0
- package/templates/.cursor/docs/onion/commands-guide.md +807 -0
- package/templates/.cursor/docs/onion/engineering-flows.md +865 -0
- package/templates/.cursor/docs/onion/getting-started.md +741 -0
- package/templates/.cursor/docs/onion/maintenance-checklist.md +388 -0
- package/templates/.cursor/docs/onion/naming-conventions.md +268 -0
- package/templates/.cursor/docs/onion/practical-examples.md +782 -0
- package/templates/.cursor/docs/product/story-points-integration.md +254 -0
- package/templates/.cursor/docs/product/story-points-validation.md +224 -0
- package/templates/.cursor/docs/reviews/task-manager-docs-review-2025-11-24.md +167 -0
- package/templates/.cursor/docs/strategies/clickup-comment-patterns.md +766 -0
- package/templates/.cursor/docs/strategies/clickup-integration-tests.md +599 -0
- package/templates/.cursor/docs/strategies/clickup-mcp-wrappers-tests.md +854 -0
- package/templates/.cursor/docs/strategies/clickup-regression-tests.md +589 -0
- package/templates/.cursor/docs/strategies/visual-patterns.md +308 -0
- package/templates/.cursor/docs/templates/README.md +624 -0
- package/templates/.cursor/docs/templates/adr-template.md +226 -0
- package/templates/.cursor/docs/templates/analysis-template.md +280 -0
- package/templates/.cursor/docs/templates/execution-plan-template.md +430 -0
- package/templates/.cursor/docs/templates/guide-template.md +367 -0
- package/templates/.cursor/docs/templates/phase-execution-prompt-template.md +504 -0
- package/templates/.cursor/docs/templates/reference-template.md +522 -0
- package/templates/.cursor/docs/templates/solution-template.md +390 -0
- package/templates/.cursor/docs/tools/README.md +325 -0
- package/templates/.cursor/docs/tools/agents.md +330 -0
- package/templates/.cursor/docs/tools/commands.md +606 -0
- package/templates/.cursor/docs/tools/cursor.md +498 -0
- package/templates/.cursor/docs/tools/mcps.md +858 -0
- package/templates/.cursor/docs/tools/rules.md +423 -0
- package/templates/.cursor/rules/language-and-documentation.mdc +371 -0
- package/templates/.cursor/rules/onion-patterns.mdc +197 -0
- package/templates/.cursor/rules/validation-rules.mdc +194 -0
- package/templates/.cursor/utils/clickup-mcp-wrappers.md +671 -0
- package/templates/.cursor/utils/date-time-standards.md +182 -0
- package/templates/.cursor/utils/task-manager/README.md +94 -0
- package/templates/.cursor/utils/task-manager/adapters/asana.md +377 -0
- package/templates/.cursor/utils/task-manager/adapters/clickup.md +467 -0
- package/templates/.cursor/utils/task-manager/adapters/linear.md +421 -0
- package/templates/.cursor/utils/task-manager/detector.md +290 -0
- package/templates/.cursor/utils/task-manager/factory.md +363 -0
- package/templates/.cursor/utils/task-manager/interface.md +248 -0
- package/templates/.cursor/utils/task-manager/types.md +409 -0
- package/templates/.cursor/validation/product-task-validation.md +344 -0
- package/templates/.onion/contexts/business/.context-config.yml +52 -0
- package/templates/.onion/contexts/business/README.md +222 -0
- package/templates/.onion/contexts/business/agents/branding-specialist.md +1030 -0
- package/templates/.onion/contexts/business/agents/clickup-specialist.md +397 -0
- package/templates/.onion/contexts/business/agents/extract-meeting-specialist.md +395 -0
- package/templates/.onion/contexts/business/agents/gamma-specialist.md +1169 -0
- package/templates/.onion/contexts/business/agents/meeting-consolidator.md +483 -0
- package/templates/.onion/contexts/business/agents/pain-price-specialist.md +509 -0
- package/templates/.onion/contexts/business/agents/presentation-orchestrator.md +1191 -0
- package/templates/.onion/contexts/business/agents/product-agent.md +202 -0
- package/templates/.onion/contexts/business/agents/story-points-specialist.md +539 -0
- package/templates/.onion/contexts/business/agents/storytelling-specialist.md +891 -0
- package/templates/.onion/contexts/business/agents/task-specialist.md +618 -0
- package/templates/.onion/contexts/business/agents/whisper-specialist.md +373 -0
- package/templates/.onion/contexts/business/commands/advanced/analyze-pain-price.md +709 -0
- package/templates/.onion/contexts/business/commands/advanced/branding.md +460 -0
- package/templates/.onion/contexts/business/commands/advanced/checklist-sync.md +241 -0
- package/templates/.onion/contexts/business/commands/advanced/presentation.md +189 -0
- package/templates/.onion/contexts/business/commands/advanced/transform-consolidated.md +592 -0
- package/templates/.onion/contexts/business/commands/help.md +212 -0
- package/templates/.onion/contexts/business/commands/intermediate/check.md +48 -0
- package/templates/.onion/contexts/business/commands/intermediate/collect.md +96 -0
- package/templates/.onion/contexts/business/commands/intermediate/consolidate-meetings.md +306 -0
- package/templates/.onion/contexts/business/commands/intermediate/convert-to-tasks.md +220 -0
- package/templates/.onion/contexts/business/commands/intermediate/extract-meeting.md +241 -0
- package/templates/.onion/contexts/business/commands/intermediate/feature.md +431 -0
- package/templates/.onion/contexts/business/commands/intermediate/light-arch.md +97 -0
- package/templates/.onion/contexts/business/commands/intermediate/task-check.md +340 -0
- package/templates/.onion/contexts/business/commands/intermediate/validate-task.md +294 -0
- package/templates/.onion/contexts/business/commands/intermediate/whisper.md +325 -0
- package/templates/.onion/contexts/business/commands/starter/estimate.md +519 -0
- package/templates/.onion/contexts/business/commands/starter/refine.md +186 -0
- package/templates/.onion/contexts/business/commands/starter/spec.md +107 -0
- package/templates/.onion/contexts/business/commands/starter/task.md +585 -0
- package/templates/.onion/contexts/business/commands/starter/warm-up.md +187 -0
- package/templates/.onion/contexts/technical/.context-config.yml +64 -0
- package/templates/.onion/contexts/technical/README.md +238 -0
- package/templates/.onion/contexts/technical/agents/branch-code-reviewer.md +200 -0
- package/templates/.onion/contexts/technical/agents/branch-doc-writer.md +162 -0
- package/templates/.onion/contexts/technical/agents/branch-metaspec-checker.md +68 -0
- package/templates/.onion/contexts/technical/agents/branch-test-planner.md +177 -0
- package/templates/.onion/contexts/technical/agents/c4-architecture-specialist.md +712 -0
- package/templates/.onion/contexts/technical/agents/c4-documentation-specialist.md +658 -0
- package/templates/.onion/contexts/technical/agents/code-reviewer.md +155 -0
- package/templates/.onion/contexts/technical/agents/cursor-specialist.md +249 -0
- package/templates/.onion/contexts/technical/agents/docs-reverse-engineer.md +418 -0
- package/templates/.onion/contexts/technical/agents/gitflow-specialist.md +1207 -0
- package/templates/.onion/contexts/technical/agents/linux-security-specialist.md +676 -0
- package/templates/.onion/contexts/technical/agents/mermaid-specialist.md +516 -0
- package/templates/.onion/contexts/technical/agents/nodejs-specialist.md +673 -0
- package/templates/.onion/contexts/technical/agents/nx-migration-specialist.md +867 -0
- package/templates/.onion/contexts/technical/agents/nx-monorepo-specialist.md +619 -0
- package/templates/.onion/contexts/technical/agents/postgres-specialist.md +1124 -0
- package/templates/.onion/contexts/technical/agents/react-developer.md +132 -0
- package/templates/.onion/contexts/technical/agents/runflow-specialist.md +278 -0
- package/templates/.onion/contexts/technical/agents/system-doc-orchestrator.md +1388 -0
- package/templates/.onion/contexts/technical/agents/test-agent.md +425 -0
- package/templates/.onion/contexts/technical/agents/test-engineer.md +295 -0
- package/templates/.onion/contexts/technical/agents/test-planner.md +118 -0
- package/templates/.onion/contexts/technical/agents/zen-engine-specialist.md +421 -0
- package/templates/.onion/contexts/technical/commands/advanced/bump.md +43 -0
- package/templates/.onion/contexts/technical/commands/advanced/consolidate-documents.md +424 -0
- package/templates/.onion/contexts/technical/commands/advanced/e2e.md +392 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-finish.md +90 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-publish.md +91 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-start.md +158 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix-finish.md +98 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix-start.md +94 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix.md +186 -0
- package/templates/.onion/contexts/technical/commands/advanced/refine-vision.md +27 -0
- package/templates/.onion/contexts/technical/commands/advanced/release-finish.md +98 -0
- package/templates/.onion/contexts/technical/commands/advanced/release-start.md +95 -0
- package/templates/.onion/contexts/technical/commands/advanced/reverse-consolidate.md +160 -0
- package/templates/.onion/contexts/technical/commands/advanced/validate-phase-sync.md +118 -0
- package/templates/.onion/contexts/technical/commands/help.md +329 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-business-docs.md +276 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-index.md +128 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-tech-docs.md +204 -0
- package/templates/.onion/contexts/technical/commands/intermediate/code-review.md +215 -0
- package/templates/.onion/contexts/technical/commands/intermediate/docs-health.md +142 -0
- package/templates/.onion/contexts/technical/commands/intermediate/fast-commit.md +45 -0
- package/templates/.onion/contexts/technical/commands/intermediate/integration.md +523 -0
- package/templates/.onion/contexts/technical/commands/intermediate/pr-update.md +198 -0
- package/templates/.onion/contexts/technical/commands/intermediate/pre-pr.md +91 -0
- package/templates/.onion/contexts/technical/commands/intermediate/start.md +266 -0
- package/templates/.onion/contexts/technical/commands/intermediate/sync-sessions.md +320 -0
- package/templates/.onion/contexts/technical/commands/intermediate/unit.md +378 -0
- package/templates/.onion/contexts/technical/commands/intermediate/validate-docs.md +159 -0
- package/templates/.onion/contexts/technical/commands/starter/docs.md +39 -0
- package/templates/.onion/contexts/technical/commands/starter/help.md +306 -0
- package/templates/.onion/contexts/technical/commands/starter/init.md +139 -0
- package/templates/.onion/contexts/technical/commands/starter/plan.md +111 -0
- package/templates/.onion/contexts/technical/commands/starter/pr.md +136 -0
- package/templates/.onion/contexts/technical/commands/starter/sync.md +228 -0
- package/templates/.onion/contexts/technical/commands/starter/warm-up.md +173 -0
- package/templates/.onion/contexts/technical/commands/starter/work.md +169 -0
- package/templates/.onion/core/commands/help.md +388 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
# [Tรญtulo da Documentaรงรฃo de Referรชncia]
|
|
2
|
+
|
|
3
|
+
**Tipo:** [API Reference | CLI Reference | Configuration Reference | Schema Reference]
|
|
4
|
+
**Versรฃo:** [Versรฃo atual]
|
|
5
|
+
**รltima atualizaรงรฃo:** [Data]
|
|
6
|
+
**Status:** [Stable | Beta | Experimental | Deprecated]
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## ๐ **Overview**
|
|
11
|
+
|
|
12
|
+
[Descriรงรฃo concisa do que esta referรชncia documenta]
|
|
13
|
+
|
|
14
|
+
### **Key Features**
|
|
15
|
+
- [Feature principal 1]
|
|
16
|
+
- [Feature principal 2]
|
|
17
|
+
- [Feature principal 3]
|
|
18
|
+
|
|
19
|
+
### **Quick Access**
|
|
20
|
+
- ๐ **[Most Common Use Cases](#common-use-cases)**
|
|
21
|
+
- ๐ **[Complete API List](#complete-reference)**
|
|
22
|
+
- ๐ **[Search & Filter](#search)**
|
|
23
|
+
- โก **[Quick Examples](#examples)**
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ๐ **Common Use Cases**
|
|
28
|
+
|
|
29
|
+
### **Use Case 1: [Nome do caso de uso]**
|
|
30
|
+
```typescript
|
|
31
|
+
// Exemplo prรกtico do caso de uso mais comum
|
|
32
|
+
const example = await commonAction({
|
|
33
|
+
param1: 'value',
|
|
34
|
+
param2: true
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### **Use Case 2: [Nome do caso de uso]**
|
|
39
|
+
```bash
|
|
40
|
+
# Comando CLI mais comum
|
|
41
|
+
command-name --param=value --flag
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### **Use Case 3: [Nome do caso de uso]**
|
|
45
|
+
```yaml
|
|
46
|
+
# Configuraรงรฃo mais comum
|
|
47
|
+
common_setting: value
|
|
48
|
+
nested:
|
|
49
|
+
setting: true
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ๐ **Complete Reference**
|
|
55
|
+
|
|
56
|
+
### **Category 1: [Nome da categoria]**
|
|
57
|
+
|
|
58
|
+
#### **Function/Command/Setting 1**
|
|
59
|
+
|
|
60
|
+
**Syntax:**
|
|
61
|
+
```typescript
|
|
62
|
+
functionName(param1: Type1, param2?: Type2): ReturnType
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Parameters:**
|
|
66
|
+
| Parameter | Type | Required | Default | Description |
|
|
67
|
+
|-----------|------|----------|---------|-------------|
|
|
68
|
+
| `param1` | `string` | โ
| - | [Descriรงรฃo detalhada do parรขmetro] |
|
|
69
|
+
| `param2` | `boolean` | โ | `false` | [Descriรงรฃo detalhada do parรขmetro] |
|
|
70
|
+
|
|
71
|
+
**Returns:**
|
|
72
|
+
| Type | Description |
|
|
73
|
+
|------|-------------|
|
|
74
|
+
| `Promise<ReturnType>` | [Descriรงรฃo do que รฉ retornado] |
|
|
75
|
+
|
|
76
|
+
**Example:**
|
|
77
|
+
```typescript
|
|
78
|
+
const result = await functionName('example', true);
|
|
79
|
+
console.log(result); // Expected output
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Error Handling:**
|
|
83
|
+
```typescript
|
|
84
|
+
try {
|
|
85
|
+
const result = await functionName('invalid');
|
|
86
|
+
} catch (error) {
|
|
87
|
+
// Error types and handling
|
|
88
|
+
if (error instanceof ValidationError) {
|
|
89
|
+
// Handle validation error
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
#### **Function/Command/Setting 2**
|
|
97
|
+
|
|
98
|
+
[Continue o padrรฃo...]
|
|
99
|
+
|
|
100
|
+
### **Category 2: [Nome da categoria]**
|
|
101
|
+
|
|
102
|
+
[Continue organizando por categorias...]
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## ๐ **Search & Filter**
|
|
107
|
+
|
|
108
|
+
### **By Type**
|
|
109
|
+
- **[Functions](#functions)** - All available functions
|
|
110
|
+
- **[Properties](#properties)** - Configuration properties
|
|
111
|
+
- **[Events](#events)** - Event types and handlers
|
|
112
|
+
- **[Types](#types)** - TypeScript interfaces and types
|
|
113
|
+
|
|
114
|
+
### **By Status**
|
|
115
|
+
- **[Stable](#stable)** - Production ready
|
|
116
|
+
- **[Beta](#beta)** - Feature complete, may change
|
|
117
|
+
- **[Experimental](#experimental)** - In development
|
|
118
|
+
- **[Deprecated](#deprecated)** - Being phased out
|
|
119
|
+
|
|
120
|
+
### **Alphabetical Index**
|
|
121
|
+
- [A](#a) | [B](#b) | [C](#c) | [D](#d) | [E](#e) | [F](#f) | [G](#g) | [H](#h) | [I](#i) | [J](#j) | [K](#k) | [L](#l) | [M](#m)
|
|
122
|
+
- [N](#n) | [O](#o) | [P](#p) | [Q](#q) | [R](#r) | [S](#s) | [T](#t) | [U](#u) | [V](#v) | [W](#w) | [X](#x) | [Y](#y) | [Z](#z)
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## โก **Examples**
|
|
127
|
+
|
|
128
|
+
### **Basic Examples**
|
|
129
|
+
|
|
130
|
+
#### **Example 1: Simple Usage**
|
|
131
|
+
```typescript
|
|
132
|
+
// Basic example with minimal configuration
|
|
133
|
+
import { SimpleFunction } from '@library/module';
|
|
134
|
+
|
|
135
|
+
const result = await SimpleFunction({
|
|
136
|
+
required: 'value'
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### **Example 2: Advanced Usage**
|
|
141
|
+
```typescript
|
|
142
|
+
// Advanced example with full configuration
|
|
143
|
+
import { AdvancedFunction, Config } from '@library/module';
|
|
144
|
+
|
|
145
|
+
const config: Config = {
|
|
146
|
+
advanced: true,
|
|
147
|
+
options: {
|
|
148
|
+
timeout: 5000,
|
|
149
|
+
retries: 3
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const result = await AdvancedFunction(config);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### **Real-World Examples**
|
|
157
|
+
|
|
158
|
+
#### **Example 3: Production Pattern**
|
|
159
|
+
```typescript
|
|
160
|
+
// Real-world production usage
|
|
161
|
+
import { ProductionPattern } from '@library/module';
|
|
162
|
+
|
|
163
|
+
class MyService {
|
|
164
|
+
private pattern: ProductionPattern;
|
|
165
|
+
|
|
166
|
+
constructor() {
|
|
167
|
+
this.pattern = new ProductionPattern({
|
|
168
|
+
env: process.env.NODE_ENV,
|
|
169
|
+
config: this.loadConfig()
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async processData(data: unknown) {
|
|
174
|
+
return this.pattern.process(data);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### **Integration Examples**
|
|
180
|
+
|
|
181
|
+
#### **Example 4: With Other Libraries**
|
|
182
|
+
```typescript
|
|
183
|
+
// Integration with popular libraries
|
|
184
|
+
import { Library } from '@library/module';
|
|
185
|
+
import { OtherLib } from 'other-library';
|
|
186
|
+
|
|
187
|
+
const combined = new Library({
|
|
188
|
+
adapter: new OtherLib.Adapter({
|
|
189
|
+
// Configuration
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## ๐ ๏ธ **Configuration**
|
|
197
|
+
|
|
198
|
+
### **Configuration Schema**
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
interface Configuration {
|
|
202
|
+
/** Core settings */
|
|
203
|
+
core: {
|
|
204
|
+
/** [Required] Application name */
|
|
205
|
+
name: string;
|
|
206
|
+
/** [Optional] Debug mode */
|
|
207
|
+
debug?: boolean;
|
|
208
|
+
/** [Optional] Environment */
|
|
209
|
+
env?: 'development' | 'production' | 'test';
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/** Feature flags */
|
|
213
|
+
features?: {
|
|
214
|
+
/** Enable experimental features */
|
|
215
|
+
experimental?: boolean;
|
|
216
|
+
/** Enable beta features */
|
|
217
|
+
beta?: boolean;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/** Performance settings */
|
|
221
|
+
performance?: {
|
|
222
|
+
/** Timeout in milliseconds */
|
|
223
|
+
timeout?: number;
|
|
224
|
+
/** Max retry attempts */
|
|
225
|
+
retries?: number;
|
|
226
|
+
/** Enable caching */
|
|
227
|
+
cache?: boolean;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### **Environment Variables**
|
|
233
|
+
|
|
234
|
+
| Variable | Type | Default | Description |
|
|
235
|
+
|----------|------|---------|-------------|
|
|
236
|
+
| `APP_NAME` | `string` | - | Application name (required) |
|
|
237
|
+
| `DEBUG` | `boolean` | `false` | Enable debug logging |
|
|
238
|
+
| `NODE_ENV` | `string` | `development` | Runtime environment |
|
|
239
|
+
| `API_TIMEOUT` | `number` | `5000` | API timeout in milliseconds |
|
|
240
|
+
|
|
241
|
+
### **Configuration Files**
|
|
242
|
+
|
|
243
|
+
#### **package.json**
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"config": {
|
|
247
|
+
"library": {
|
|
248
|
+
"enabled": true,
|
|
249
|
+
"options": {
|
|
250
|
+
"feature1": true,
|
|
251
|
+
"feature2": false
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
#### **Config File (.libraryrc)**
|
|
259
|
+
```yaml
|
|
260
|
+
core:
|
|
261
|
+
name: "my-app"
|
|
262
|
+
debug: false
|
|
263
|
+
env: "production"
|
|
264
|
+
|
|
265
|
+
features:
|
|
266
|
+
experimental: false
|
|
267
|
+
beta: true
|
|
268
|
+
|
|
269
|
+
performance:
|
|
270
|
+
timeout: 10000
|
|
271
|
+
retries: 3
|
|
272
|
+
cache: true
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## ๐ **Lifecycle & Events**
|
|
278
|
+
|
|
279
|
+
### **Event Types**
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
interface EventMap {
|
|
283
|
+
'init': InitEvent;
|
|
284
|
+
'ready': ReadyEvent;
|
|
285
|
+
'error': ErrorEvent;
|
|
286
|
+
'complete': CompleteEvent;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
interface InitEvent {
|
|
290
|
+
timestamp: Date;
|
|
291
|
+
config: Configuration;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface ErrorEvent {
|
|
295
|
+
error: Error;
|
|
296
|
+
context: string;
|
|
297
|
+
recoverable: boolean;
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### **Event Handling**
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
import { EventEmitter } from '@library/module';
|
|
305
|
+
|
|
306
|
+
const emitter = new EventEmitter();
|
|
307
|
+
|
|
308
|
+
// Listen to events
|
|
309
|
+
emitter.on('init', (event: InitEvent) => {
|
|
310
|
+
console.log('Initialized at:', event.timestamp);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
emitter.on('error', (event: ErrorEvent) => {
|
|
314
|
+
if (event.recoverable) {
|
|
315
|
+
// Handle recoverable error
|
|
316
|
+
} else {
|
|
317
|
+
// Handle fatal error
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## ๐จ **Error Handling**
|
|
325
|
+
|
|
326
|
+
### **Error Types**
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
class ValidationError extends Error {
|
|
330
|
+
constructor(field: string, value: unknown) {
|
|
331
|
+
super(`Invalid value for ${field}: ${value}`);
|
|
332
|
+
this.name = 'ValidationError';
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
class TimeoutError extends Error {
|
|
337
|
+
constructor(operation: string, timeout: number) {
|
|
338
|
+
super(`Operation ${operation} timed out after ${timeout}ms`);
|
|
339
|
+
this.name = 'TimeoutError';
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
class ConfigurationError extends Error {
|
|
344
|
+
constructor(message: string) {
|
|
345
|
+
super(`Configuration error: ${message}`);
|
|
346
|
+
this.name = 'ConfigurationError';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### **Error Codes**
|
|
352
|
+
|
|
353
|
+
| Code | Error | Description | Resolution |
|
|
354
|
+
|------|-------|-------------|------------|
|
|
355
|
+
| `E001` | `ValidationError` | Invalid input parameter | Check parameter types and values |
|
|
356
|
+
| `E002` | `TimeoutError` | Operation timed out | Increase timeout or check network |
|
|
357
|
+
| `E003` | `ConfigurationError` | Invalid configuration | Review configuration schema |
|
|
358
|
+
| `E004` | `AuthenticationError` | Authentication failed | Check credentials |
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## ๐ **TypeScript Types**
|
|
363
|
+
|
|
364
|
+
### **Core Types**
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
// Main interfaces
|
|
368
|
+
export interface MainInterface {
|
|
369
|
+
id: string;
|
|
370
|
+
name: string;
|
|
371
|
+
config: ConfigObject;
|
|
372
|
+
status: Status;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Utility types
|
|
376
|
+
export type Status = 'idle' | 'loading' | 'success' | 'error';
|
|
377
|
+
export type ConfigObject = Record<string, unknown>;
|
|
378
|
+
|
|
379
|
+
// Generic types
|
|
380
|
+
export interface ApiResponse<T> {
|
|
381
|
+
data: T;
|
|
382
|
+
status: number;
|
|
383
|
+
message: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Function types
|
|
387
|
+
export type AsyncFunction<T, R> = (input: T) => Promise<R>;
|
|
388
|
+
export type EventHandler<T> = (event: T) => void;
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### **Advanced Types**
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
// Conditional types
|
|
395
|
+
export type ConditionalType<T> = T extends string ? StringHandler : NumberHandler;
|
|
396
|
+
|
|
397
|
+
// Mapped types
|
|
398
|
+
export type PartialConfig<T> = {
|
|
399
|
+
[K in keyof T]?: T[K];
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// Template literal types
|
|
403
|
+
export type EventName<T extends string> = `on${Capitalize<T>}`;
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## ๐ง **Migration Guides**
|
|
409
|
+
|
|
410
|
+
### **Version 2.0 โ 3.0**
|
|
411
|
+
|
|
412
|
+
#### **Breaking Changes**
|
|
413
|
+
- `oldFunction()` โ `newFunction()` - Parameter order changed
|
|
414
|
+
- `ConfigInterface` โ `NewConfigInterface` - Added required field
|
|
415
|
+
|
|
416
|
+
#### **Migration Steps**
|
|
417
|
+
1. **Update function calls:**
|
|
418
|
+
```typescript
|
|
419
|
+
// Before
|
|
420
|
+
oldFunction(param1, param2);
|
|
421
|
+
|
|
422
|
+
// After
|
|
423
|
+
newFunction({ param1, param2 });
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
2. **Update configuration:**
|
|
427
|
+
```typescript
|
|
428
|
+
// Before
|
|
429
|
+
const config: ConfigInterface = {
|
|
430
|
+
setting: true
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// After
|
|
434
|
+
const config: NewConfigInterface = {
|
|
435
|
+
setting: true,
|
|
436
|
+
newRequired: 'value'
|
|
437
|
+
};
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### **Deprecation Notices**
|
|
441
|
+
|
|
442
|
+
| Feature | Deprecated In | Removed In | Alternative |
|
|
443
|
+
|---------|---------------|------------|-------------|
|
|
444
|
+
| `oldFunction` | v2.5.0 | v3.0.0 | Use `newFunction` |
|
|
445
|
+
| `legacy.config` | v2.8.0 | v3.0.0 | Use `modern.config` |
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## ๐งช **Testing**
|
|
450
|
+
|
|
451
|
+
### **Test Utilities**
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
import { createTestInstance, mockConfig } from '@library/testing';
|
|
455
|
+
|
|
456
|
+
describe('Library Tests', () => {
|
|
457
|
+
it('should work with mock config', async () => {
|
|
458
|
+
const instance = createTestInstance(mockConfig);
|
|
459
|
+
const result = await instance.process('test');
|
|
460
|
+
expect(result).toBeDefined();
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### **Mock Examples**
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
// Mock implementation
|
|
469
|
+
const mockLibrary = {
|
|
470
|
+
process: jest.fn().mockResolvedValue('mocked result'),
|
|
471
|
+
configure: jest.fn(),
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
// Test with mock
|
|
475
|
+
jest.mock('@library/module', () => mockLibrary);
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## ๐ **Related Documentation**
|
|
481
|
+
|
|
482
|
+
### **Core Documentation**
|
|
483
|
+
- [Getting Started Guide](../02-quick-start.md)
|
|
484
|
+
- [Configuration Guide](../52-configuration.md)
|
|
485
|
+
- [Troubleshooting](../42-troubleshooting.md)
|
|
486
|
+
|
|
487
|
+
### **Advanced Topics**
|
|
488
|
+
- [Custom Plugins](./advanced/plugins.md)
|
|
489
|
+
- [Performance Optimization](./advanced/performance.md)
|
|
490
|
+
- [Security Considerations](./advanced/security.md)
|
|
491
|
+
|
|
492
|
+
### **External Resources**
|
|
493
|
+
- [Official Documentation](https://external-docs.com)
|
|
494
|
+
- [Community Examples](https://github.com/community/examples)
|
|
495
|
+
- [Blog Posts & Tutorials](https://blog.library.com)
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## ๐ **Performance Considerations**
|
|
500
|
+
|
|
501
|
+
### **Best Practices**
|
|
502
|
+
- โ
**Cache frequently used data**
|
|
503
|
+
- โ
**Use async/await for I/O operations**
|
|
504
|
+
- โ
**Implement proper error boundaries**
|
|
505
|
+
- โ **Don't block the event loop**
|
|
506
|
+
- โ **Avoid synchronous file operations**
|
|
507
|
+
|
|
508
|
+
### **Benchmarks**
|
|
509
|
+
|
|
510
|
+
| Operation | Time (avg) | Memory | Notes |
|
|
511
|
+
|-----------|------------|--------|-------|
|
|
512
|
+
| Simple query | ~50ms | 10MB | Typical usage |
|
|
513
|
+
| Complex operation | ~200ms | 50MB | Heavy computation |
|
|
514
|
+
| Batch processing | ~500ms | 100MB | 1000 items |
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
**๐
Created:** [Date]
|
|
519
|
+
**๐ค Maintainer:** [Name and contact]
|
|
520
|
+
**๐ Last Updated:** [Date]
|
|
521
|
+
**๐ Version:** [Version]
|
|
522
|
+
**๐ Changelog:** [Link to changelog]
|