aios-core 3.6.0 → 3.8.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 (62) hide show
  1. package/.aios-core/core/session/context-detector.js +3 -0
  2. package/.aios-core/core/session/context-loader.js +154 -0
  3. package/.aios-core/data/learned-patterns.yaml +3 -0
  4. package/.aios-core/data/workflow-patterns.yaml +347 -3
  5. package/.aios-core/development/agents/dev.md +13 -0
  6. package/.aios-core/development/agents/squad-creator.md +30 -0
  7. package/.aios-core/development/scripts/squad/squad-analyzer.js +638 -0
  8. package/.aios-core/development/scripts/squad/squad-extender.js +871 -0
  9. package/.aios-core/development/scripts/squad/squad-generator.js +107 -19
  10. package/.aios-core/development/scripts/squad/squad-migrator.js +3 -5
  11. package/.aios-core/development/scripts/squad/squad-validator.js +98 -0
  12. package/.aios-core/development/tasks/create-service.md +391 -0
  13. package/.aios-core/development/tasks/next.md +294 -0
  14. package/.aios-core/development/tasks/patterns.md +334 -0
  15. package/.aios-core/development/tasks/squad-creator-analyze.md +315 -0
  16. package/.aios-core/development/tasks/squad-creator-create.md +26 -3
  17. package/.aios-core/development/tasks/squad-creator-extend.md +411 -0
  18. package/.aios-core/development/tasks/squad-creator-validate.md +9 -1
  19. package/.aios-core/development/tasks/waves.md +205 -0
  20. package/.aios-core/development/templates/service-template/README.md.hbs +158 -0
  21. package/.aios-core/development/templates/service-template/__tests__/index.test.ts.hbs +237 -0
  22. package/.aios-core/development/templates/service-template/client.ts.hbs +403 -0
  23. package/.aios-core/development/templates/service-template/errors.ts.hbs +182 -0
  24. package/.aios-core/development/templates/service-template/index.ts.hbs +120 -0
  25. package/.aios-core/development/templates/service-template/jest.config.js +89 -0
  26. package/.aios-core/development/templates/service-template/package.json.hbs +87 -0
  27. package/.aios-core/development/templates/service-template/tsconfig.json +45 -0
  28. package/.aios-core/development/templates/service-template/types.ts.hbs +145 -0
  29. package/.aios-core/development/templates/squad/agent-template.md +69 -0
  30. package/.aios-core/development/templates/squad/checklist-template.md +82 -0
  31. package/.aios-core/development/templates/squad/data-template.yaml +105 -0
  32. package/.aios-core/development/templates/squad/script-template.js +179 -0
  33. package/.aios-core/development/templates/squad/task-template.md +125 -0
  34. package/.aios-core/development/templates/squad/template-template.md +97 -0
  35. package/.aios-core/development/templates/squad/tool-template.js +103 -0
  36. package/.aios-core/development/templates/squad/workflow-template.yaml +108 -0
  37. package/.aios-core/infrastructure/scripts/ide-sync/agent-parser.js +45 -1
  38. package/.aios-core/infrastructure/scripts/ide-sync/transformers/antigravity.js +6 -6
  39. package/.aios-core/infrastructure/scripts/ide-sync/transformers/cursor.js +5 -4
  40. package/.aios-core/infrastructure/scripts/ide-sync/transformers/trae.js +3 -3
  41. package/.aios-core/infrastructure/scripts/ide-sync/transformers/windsurf.js +3 -3
  42. package/.aios-core/install-manifest.yaml +139 -35
  43. package/.aios-core/quality/metrics-collector.js +27 -0
  44. package/.aios-core/scripts/session-context-loader.js +13 -254
  45. package/.aios-core/utils/aios-validator.js +25 -0
  46. package/.aios-core/workflow-intelligence/__tests__/confidence-scorer.test.js +334 -0
  47. package/.aios-core/workflow-intelligence/__tests__/integration.test.js +337 -0
  48. package/.aios-core/workflow-intelligence/__tests__/suggestion-engine.test.js +431 -0
  49. package/.aios-core/workflow-intelligence/__tests__/wave-analyzer.test.js +458 -0
  50. package/.aios-core/workflow-intelligence/__tests__/workflow-registry.test.js +302 -0
  51. package/.aios-core/workflow-intelligence/engine/confidence-scorer.js +305 -0
  52. package/.aios-core/workflow-intelligence/engine/output-formatter.js +285 -0
  53. package/.aios-core/workflow-intelligence/engine/suggestion-engine.js +603 -0
  54. package/.aios-core/workflow-intelligence/engine/wave-analyzer.js +676 -0
  55. package/.aios-core/workflow-intelligence/index.js +327 -0
  56. package/.aios-core/workflow-intelligence/learning/capture-hook.js +147 -0
  57. package/.aios-core/workflow-intelligence/learning/index.js +230 -0
  58. package/.aios-core/workflow-intelligence/learning/pattern-capture.js +340 -0
  59. package/.aios-core/workflow-intelligence/learning/pattern-store.js +498 -0
  60. package/.aios-core/workflow-intelligence/learning/pattern-validator.js +309 -0
  61. package/.aios-core/workflow-intelligence/registry/workflow-registry.js +358 -0
  62. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ # {{pascalCase serviceName}} Service
2
+
3
+ > {{description}}
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @aios/{{kebabCase serviceName}}
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { create{{pascalCase serviceName}}Service } from '@aios/{{kebabCase serviceName}}';
15
+
16
+ const service = create{{pascalCase serviceName}}Service({
17
+ {{#each envVars}}
18
+ {{camelCase this.name}}: process.env.{{this.name}},
19
+ {{/each}}
20
+ });
21
+
22
+ // Use the service
23
+ const result = await service.execute();
24
+ ```
25
+
26
+ ## Configuration
27
+
28
+ ### Environment Variables
29
+
30
+ | Variable | Required | Description |
31
+ |----------|----------|-------------|
32
+ {{#each envVars}}
33
+ | `{{this.name}}` | {{#if this.required}}Yes{{else}}No{{/if}} | {{this.description}} |
34
+ {{/each}}
35
+
36
+ ### Programmatic Configuration
37
+
38
+ ```typescript
39
+ import { create{{pascalCase serviceName}}Service, {{pascalCase serviceName}}Config } from '@aios/{{kebabCase serviceName}}';
40
+
41
+ const config: {{pascalCase serviceName}}Config = {
42
+ {{#each envVars}}
43
+ {{camelCase this.name}}: '{{this.example}}',
44
+ {{/each}}
45
+ };
46
+
47
+ const service = create{{pascalCase serviceName}}Service(config);
48
+ ```
49
+
50
+ {{#if isApiIntegration}}
51
+ ## API Integration
52
+
53
+ This service integrates with an external API. Features include:
54
+
55
+ - **Rate Limiting**: Automatic request throttling
56
+ - **Retry Logic**: Exponential backoff on failures
57
+ - **Error Handling**: Typed errors with actionable messages
58
+
59
+ ### Rate Limits
60
+
61
+ > **Note:** The values below are placeholders. Update them according to your API's actual rate limits.
62
+
63
+ | Tier | Requests/min | Burst |
64
+ |------|--------------|-------|
65
+ | Free | 60 | 10 |
66
+ | Pro | 600 | 100 |
67
+
68
+ {{/if}}
69
+ ## Usage Examples
70
+
71
+ ### Basic Usage
72
+
73
+ ```typescript
74
+ const service = create{{pascalCase serviceName}}Service(config);
75
+
76
+ try {
77
+ const result = await service.execute();
78
+ console.log('Success:', result);
79
+ } catch (error) {
80
+ if (error instanceof {{pascalCase serviceName}}Error) {
81
+ console.error('Service error:', error.code, error.message);
82
+ }
83
+ throw error;
84
+ }
85
+ ```
86
+
87
+ {{#if hasAuth}}
88
+ ### Authentication
89
+
90
+ This service requires authentication. Set your credentials via environment variables or config:
91
+
92
+ ```typescript
93
+ const service = create{{pascalCase serviceName}}Service({
94
+ apiKey: process.env.{{upperCase serviceName}}_API_KEY,
95
+ // or
96
+ accessToken: process.env.{{upperCase serviceName}}_ACCESS_TOKEN,
97
+ });
98
+ ```
99
+
100
+ {{/if}}
101
+ ## Error Handling
102
+
103
+ The service provides typed errors for common failure scenarios:
104
+
105
+ ```typescript
106
+ import { {{pascalCase serviceName}}Error, {{pascalCase serviceName}}ErrorCode } from '@aios/{{kebabCase serviceName}}';
107
+
108
+ try {
109
+ await service.execute();
110
+ } catch (error) {
111
+ if (error instanceof {{pascalCase serviceName}}Error) {
112
+ switch (error.code) {
113
+ case {{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR:
114
+ // Handle configuration issues
115
+ break;
116
+ case {{pascalCase serviceName}}ErrorCode.NETWORK_ERROR:
117
+ // Handle network issues
118
+ break;
119
+ {{#if isApiIntegration}}
120
+ case {{pascalCase serviceName}}ErrorCode.RATE_LIMIT_EXCEEDED:
121
+ // Handle rate limiting
122
+ break;
123
+ {{/if}}
124
+ default:
125
+ // Handle other errors
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ ## API Reference
132
+
133
+ See the [TypeScript definitions](./dist/types.d.ts) for complete API documentation.
134
+
135
+ ## Development
136
+
137
+ ```bash
138
+ # Install dependencies
139
+ npm install
140
+
141
+ # Run tests
142
+ npm test
143
+
144
+ # Build
145
+ npm run build
146
+
147
+ # Type check
148
+ npm run typecheck
149
+ ```
150
+
151
+ ## License
152
+
153
+ MIT
154
+
155
+ ---
156
+
157
+ *Generated by AIOS-FullStack Service Template*
158
+ *Story: {{storyId}}*
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Tests for {{pascalCase serviceName}} service.
3
+ * @module @aios/{{kebabCase serviceName}}/tests
4
+ * @story {{storyId}}
5
+ */
6
+
7
+ import {
8
+ create{{pascalCase serviceName}}Service,
9
+ {{pascalCase serviceName}}Error,
10
+ {{pascalCase serviceName}}ErrorCode,
11
+ } from '../index';
12
+ import type { {{pascalCase serviceName}}Config, {{pascalCase serviceName}}Service } from '../types';
13
+
14
+ describe('{{pascalCase serviceName}}Service', () => {
15
+ // ─────────────────────────────────────────────────────────────────────────────
16
+ // Test Configuration
17
+ // ─────────────────────────────────────────────────────────────────────────────
18
+
19
+ const validConfig: {{pascalCase serviceName}}Config = {
20
+ {{#each envVars}}
21
+ {{camelCase this.name}}: 'test-{{kebabCase this.name}}',
22
+ {{/each}}
23
+ };
24
+
25
+ // ─────────────────────────────────────────────────────────────────────────────
26
+ // Factory Function Tests
27
+ // ─────────────────────────────────────────────────────────────────────────────
28
+
29
+ describe('create{{pascalCase serviceName}}Service', () => {
30
+ it('should create a service instance with valid config', () => {
31
+ const service = create{{pascalCase serviceName}}Service(validConfig);
32
+
33
+ expect(service).toBeDefined();
34
+ expect(typeof service.execute).toBe('function');
35
+ expect(typeof service.getConfig).toBe('function');
36
+ expect(typeof service.healthCheck).toBe('function');
37
+ });
38
+
39
+ it('should throw on null config', () => {
40
+ expect(() => {
41
+ create{{pascalCase serviceName}}Service(null as unknown as {{pascalCase serviceName}}Config);
42
+ }).toThrow({{pascalCase serviceName}}Error);
43
+ });
44
+
45
+ it('should throw on undefined config', () => {
46
+ expect(() => {
47
+ create{{pascalCase serviceName}}Service(undefined as unknown as {{pascalCase serviceName}}Config);
48
+ }).toThrow({{pascalCase serviceName}}Error);
49
+ });
50
+
51
+ {{#each envVars}}
52
+ {{#if this.required}}
53
+ it('should throw when {{this.name}} is missing', () => {
54
+ const configWithoutField = { ...validConfig };
55
+ delete (configWithoutField as Record<string, unknown>).{{camelCase this.name}};
56
+
57
+ expect(() => {
58
+ create{{pascalCase serviceName}}Service(configWithoutField as {{pascalCase serviceName}}Config);
59
+ }).toThrow(expect.objectContaining({
60
+ code: {{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR,
61
+ }));
62
+ });
63
+
64
+ {{/if}}
65
+ {{/each}}
66
+ });
67
+
68
+ // ─────────────────────────────────────────────────────────────────────────────
69
+ // Configuration Tests
70
+ // ─────────────────────────────────────────────────────────────────────────────
71
+
72
+ describe('getConfig', () => {
73
+ let service: {{pascalCase serviceName}}Service;
74
+
75
+ beforeEach(() => {
76
+ service = create{{pascalCase serviceName}}Service(validConfig);
77
+ });
78
+
79
+ it('should return configuration without sensitive values', () => {
80
+ const config = service.getConfig();
81
+
82
+ expect(config).toBeDefined();
83
+ expect(typeof config).toBe('object');
84
+ });
85
+
86
+ it('should not expose sensitive configuration', () => {
87
+ const config = service.getConfig();
88
+
89
+ // Verify sensitive fields are not exposed
90
+ {{#each envVars}}
91
+ {{#if this.sensitive}}
92
+ expect(config.{{camelCase this.name}}).toBeUndefined();
93
+ {{/if}}
94
+ {{/each}}
95
+ });
96
+ });
97
+
98
+ // ─────────────────────────────────────────────────────────────────────────────
99
+ // Service Method Tests
100
+ // ─────────────────────────────────────────────────────────────────────────────
101
+
102
+ describe('execute', () => {
103
+ let service: {{pascalCase serviceName}}Service;
104
+
105
+ beforeEach(() => {
106
+ service = create{{pascalCase serviceName}}Service(validConfig);
107
+ });
108
+
109
+ it('should throw NOT_IMPLEMENTED for unimplemented execute', async () => {
110
+ await expect(service.execute()).rejects.toThrow(expect.objectContaining({
111
+ code: {{pascalCase serviceName}}ErrorCode.NOT_IMPLEMENTED,
112
+ }));
113
+ });
114
+ });
115
+
116
+ describe('healthCheck', () => {
117
+ let service: {{pascalCase serviceName}}Service;
118
+
119
+ beforeEach(() => {
120
+ service = create{{pascalCase serviceName}}Service(validConfig);
121
+ });
122
+
123
+ it('should return boolean', async () => {
124
+ const result = await service.healthCheck();
125
+
126
+ expect(typeof result).toBe('boolean');
127
+ });
128
+ });
129
+
130
+ // ─────────────────────────────────────────────────────────────────────────────
131
+ // Error Handling Tests
132
+ // ─────────────────────────────────────────────────────────────────────────────
133
+
134
+ describe('{{pascalCase serviceName}}Error', () => {
135
+ it('should have correct name', () => {
136
+ const error = new {{pascalCase serviceName}}Error('Test error');
137
+
138
+ expect(error.name).toBe('{{pascalCase serviceName}}Error');
139
+ });
140
+
141
+ it('should have default error code', () => {
142
+ const error = new {{pascalCase serviceName}}Error('Test error');
143
+
144
+ expect(error.code).toBe({{pascalCase serviceName}}ErrorCode.UNKNOWN_ERROR);
145
+ });
146
+
147
+ it('should accept custom error code', () => {
148
+ const error = new {{pascalCase serviceName}}Error(
149
+ 'Config error',
150
+ {{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR
151
+ );
152
+
153
+ expect(error.code).toBe({{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR);
154
+ });
155
+
156
+ it('should include error details', () => {
157
+ const details = { field: 'test', reason: 'invalid' };
158
+ const error = new {{pascalCase serviceName}}Error(
159
+ 'Validation error',
160
+ {{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR,
161
+ { details }
162
+ );
163
+
164
+ expect(error.details).toEqual(details);
165
+ });
166
+
167
+ it('should preserve cause error', () => {
168
+ const cause = new Error('Original error');
169
+ const error = new {{pascalCase serviceName}}Error(
170
+ 'Wrapped error',
171
+ {{pascalCase serviceName}}ErrorCode.NETWORK_ERROR,
172
+ { cause }
173
+ );
174
+
175
+ expect(error.cause).toBe(cause);
176
+ });
177
+
178
+ it('should serialize to JSON correctly', () => {
179
+ const error = new {{pascalCase serviceName}}Error(
180
+ 'Test error',
181
+ {{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR,
182
+ { details: { key: 'value' } }
183
+ );
184
+
185
+ const json = error.toJSON();
186
+
187
+ expect(json.name).toBe('{{pascalCase serviceName}}Error');
188
+ expect(json.code).toBe({{pascalCase serviceName}}ErrorCode.CONFIGURATION_ERROR);
189
+ expect(json.message).toBe('Test error');
190
+ expect(json.details).toEqual({ key: 'value' });
191
+ });
192
+ });
193
+ });
194
+
195
+ {{#if isApiIntegration}}
196
+ // ─────────────────────────────────────────────────────────────────────────────
197
+ // API Client Tests (API Integrations Only)
198
+ // ─────────────────────────────────────────────────────────────────────────────
199
+
200
+ describe('{{pascalCase serviceName}}Client', () => {
201
+ // Import client for API integration testing
202
+ const { {{pascalCase serviceName}}Client } = require('../client');
203
+
204
+ const clientConfig: {{pascalCase serviceName}}Config = {
205
+ ...validConfig,
206
+ baseUrl: 'https://api.example.com',
207
+ timeout: 5000,
208
+ maxRetries: 2,
209
+ debug: false,
210
+ };
211
+
212
+ describe('constructor', () => {
213
+ it('should create client with config', () => {
214
+ const client = new {{pascalCase serviceName}}Client(clientConfig);
215
+
216
+ expect(client).toBeDefined();
217
+ });
218
+
219
+ it('should use default values for optional config', () => {
220
+ const client = new {{pascalCase serviceName}}Client(validConfig);
221
+
222
+ expect(client).toBeDefined();
223
+ });
224
+ });
225
+
226
+ describe('getRateLimit', () => {
227
+ it('should return null initially', () => {
228
+ const client = new {{pascalCase serviceName}}Client(clientConfig);
229
+
230
+ expect(client.getRateLimit()).toBeNull();
231
+ });
232
+ });
233
+
234
+ // Note: Additional client tests require mocking fetch/network
235
+ // These should be added based on specific API requirements
236
+ });
237
+ {{/if}}