@esotech/contextuate 2.0.0 → 2.1.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 (105) hide show
  1. package/README.md +169 -1
  2. package/dist/commands/claude.d.ts +21 -0
  3. package/dist/commands/claude.js +213 -0
  4. package/dist/commands/context.d.ts +1 -0
  5. package/dist/commands/create.d.ts +3 -0
  6. package/dist/commands/index.d.ts +4 -0
  7. package/dist/commands/init.d.ts +7 -0
  8. package/dist/commands/init.js +67 -6
  9. package/dist/commands/install.d.ts +28 -0
  10. package/dist/commands/install.js +116 -11
  11. package/dist/commands/monitor.d.ts +55 -0
  12. package/dist/commands/monitor.js +1007 -0
  13. package/dist/commands/remove.d.ts +3 -0
  14. package/dist/commands/run.d.ts +6 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +113 -1
  17. package/dist/monitor/daemon/circuit-breaker.d.ts +121 -0
  18. package/dist/monitor/daemon/circuit-breaker.js +552 -0
  19. package/dist/monitor/daemon/cli.d.ts +8 -0
  20. package/dist/monitor/daemon/cli.js +82 -0
  21. package/dist/monitor/daemon/index.d.ts +137 -0
  22. package/dist/monitor/daemon/index.js +695 -0
  23. package/dist/monitor/daemon/notifier.d.ts +25 -0
  24. package/dist/monitor/daemon/notifier.js +98 -0
  25. package/dist/monitor/daemon/processor.d.ts +89 -0
  26. package/dist/monitor/daemon/processor.js +455 -0
  27. package/dist/monitor/daemon/state.d.ts +80 -0
  28. package/dist/monitor/daemon/state.js +162 -0
  29. package/dist/monitor/daemon/watcher.d.ts +47 -0
  30. package/dist/monitor/daemon/watcher.js +171 -0
  31. package/dist/monitor/daemon/wrapper-manager.d.ts +106 -0
  32. package/dist/monitor/daemon/wrapper-manager.js +374 -0
  33. package/dist/monitor/hooks/emit-event.js +652 -0
  34. package/dist/monitor/persistence/file-store.d.ts +88 -0
  35. package/dist/monitor/persistence/file-store.js +335 -0
  36. package/dist/monitor/persistence/index.d.ts +7 -0
  37. package/dist/monitor/persistence/index.js +10 -0
  38. package/dist/monitor/server/adapters/redis.d.ts +38 -0
  39. package/dist/monitor/server/adapters/redis.js +213 -0
  40. package/dist/monitor/server/adapters/unix-socket.d.ts +33 -0
  41. package/dist/monitor/server/adapters/unix-socket.js +182 -0
  42. package/dist/monitor/server/broker.d.ts +135 -0
  43. package/dist/monitor/server/broker.js +475 -0
  44. package/dist/monitor/server/cli.d.ts +8 -0
  45. package/dist/monitor/server/cli.js +98 -0
  46. package/dist/monitor/server/fastify.d.ts +16 -0
  47. package/dist/monitor/server/fastify.js +184 -0
  48. package/dist/monitor/server/index.d.ts +36 -0
  49. package/dist/monitor/server/index.js +153 -0
  50. package/dist/monitor/server/websocket.d.ts +80 -0
  51. package/dist/monitor/server/websocket.js +453 -0
  52. package/dist/monitor/ui/assets/index-4IssW9On.js +59 -0
  53. package/dist/monitor/ui/assets/index-vo9hLe5R.css +32 -0
  54. package/dist/monitor/ui/favicon.png +0 -0
  55. package/dist/monitor/ui/index.html +14 -0
  56. package/dist/monitor/ui/logo.png +0 -0
  57. package/dist/monitor/ui/logo.svg +1 -0
  58. package/dist/runtime/driver.d.ts +16 -0
  59. package/dist/runtime/tools.d.ts +10 -0
  60. package/dist/templates/README.md +33 -7
  61. package/dist/templates/agents/aegis.md +4 -0
  62. package/dist/templates/agents/archon.md +13 -22
  63. package/dist/templates/agents/atlas.md +4 -0
  64. package/dist/templates/agents/canvas.md +4 -0
  65. package/dist/templates/agents/chronicle.md +4 -0
  66. package/dist/templates/agents/chronos.md +4 -0
  67. package/dist/templates/agents/cipher.md +4 -0
  68. package/dist/templates/agents/crucible.md +4 -0
  69. package/dist/templates/agents/echo.md +4 -0
  70. package/dist/templates/agents/forge.md +4 -0
  71. package/dist/templates/agents/ledger.md +4 -0
  72. package/dist/templates/agents/meridian.md +4 -0
  73. package/dist/templates/agents/nexus.md +4 -0
  74. package/dist/templates/agents/pythia.md +217 -0
  75. package/dist/templates/agents/scribe.md +4 -0
  76. package/dist/templates/agents/sentinel.md +4 -0
  77. package/dist/templates/agents/{oracle.md → thoth.md} +11 -7
  78. package/dist/templates/agents/unity.md +4 -0
  79. package/dist/templates/agents/vox.md +4 -0
  80. package/dist/templates/agents/weaver.md +4 -0
  81. package/dist/templates/framework-agents/documentation-expert.md +3 -3
  82. package/dist/templates/framework-agents/tools-expert.md +8 -8
  83. package/dist/templates/skills/consult.md +138 -0
  84. package/dist/templates/skills/orchestrate.md +173 -0
  85. package/dist/templates/skills/pythia.md +37 -0
  86. package/dist/templates/standards/agent-roles.md +68 -21
  87. package/dist/templates/standards/coding-standards.md +9 -26
  88. package/dist/templates/templates/context.md +17 -2
  89. package/dist/templates/templates/contextuate.md +21 -28
  90. package/dist/templates/templates/standards/go.md +167 -0
  91. package/dist/templates/templates/standards/java.md +167 -0
  92. package/dist/templates/templates/standards/javascript.md +292 -0
  93. package/dist/templates/templates/standards/php.md +181 -0
  94. package/dist/templates/templates/standards/python.md +175 -0
  95. package/dist/templates/tools/agent-creator.md +252 -0
  96. package/dist/templates/tools/agent-creator.tool.md +2 -2
  97. package/dist/templates/tools/quickref.md +216 -0
  98. package/dist/templates/tools/spawn.md +31 -0
  99. package/dist/templates/tools/standards-detector.md +301 -0
  100. package/dist/templates/version.json +1 -1
  101. package/dist/types/monitor.d.ts +660 -0
  102. package/dist/types/monitor.js +75 -0
  103. package/dist/utils/git.d.ts +9 -0
  104. package/dist/utils/tokens.d.ts +10 -0
  105. package/package.json +18 -5
@@ -0,0 +1,167 @@
1
+ # Java Coding Standards
2
+
3
+ > **Language:** Java
4
+ > **Generated:** {DATE}
5
+
6
+ ---
7
+
8
+ ## Formatting
9
+
10
+ ### Indentation
11
+ - **Style:** {Spaces}
12
+ - **Size:** {4} {spaces}
13
+
14
+ ### Braces
15
+ - **Style:** K&R (same line) for classes and methods.
16
+
17
+ ### Line Length
18
+ - **Max Length:** {100|120} chars
19
+
20
+ ---
21
+
22
+ ## Naming Conventions
23
+
24
+ ### Classes/Interfaces
25
+ - **Style:** PascalCase
26
+ - **Example:** `UserManager`, `PaymentProcessor`
27
+
28
+ ### Methods
29
+ - **Style:** camelCase
30
+ - **Example:** `calculateTotal()`, `findUserById()`
31
+
32
+ ### Variables
33
+ - **Style:** camelCase
34
+ - **Example:** `firstName`, `orderCount`
35
+
36
+ ### Constants (static final)
37
+ - **Style:** UPPER_SNAKE_CASE
38
+ - **Example:** `DEFAULT_TIMEOUT`, `MAX_USERS`
39
+
40
+ ### Generics
41
+ - **Style:** Single capital letter
42
+ - **Example:** `E` (element), `T` (type), `K` (key), `V` (value)
43
+
44
+ ---
45
+
46
+ ## Structure
47
+
48
+ ### File Organization
49
+ ```java
50
+ // 1. Package declaration
51
+ package com.company.project.service;
52
+
53
+ // 2. Imports (sorted alphabetically, no wildcards)
54
+ import java.util.List;
55
+ import org.springframework.stereotype.Service;
56
+
57
+ // 3. Class definition
58
+ @Service
59
+ public class UserService {
60
+
61
+ // 4. Constants
62
+ private static final int MAX_AGE = 100;
63
+
64
+ // 5. Fields
65
+ private final UserRepository userRepository;
66
+
67
+ // 6. Constructor
68
+ public UserService(UserRepository userRepository) {
69
+ this.userRepository = userRepository;
70
+ }
71
+
72
+ // 7. Public methods
73
+ public User getUser(Long id) {
74
+ // ...
75
+ }
76
+
77
+ // 8. Private methods
78
+ private void validate(User user) {
79
+ // ...
80
+ }
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Documentation (Javadoc)
87
+
88
+ ### Required Elements
89
+ - **Classes:** Purpose of the class.
90
+ - **Public Methods:** Description, `@param`, `@return`, `@throws`.
91
+
92
+ ```java
93
+ /**
94
+ * Processes payment transactions.
95
+ */
96
+ public class PaymentService {
97
+
98
+ /**
99
+ * Authorizes a transaction.
100
+ *
101
+ * @param amount The amount to authorize
102
+ * @return true if successful
103
+ * @throws PaymentException if connection fails
104
+ */
105
+ public boolean authorize(BigDecimal amount) throws PaymentException { ... }
106
+ }
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Error Handling
112
+
113
+ ### Exceptions
114
+ - **Guideline:** Use unchecked exceptions (`RuntimeException`) for recoverable errors.
115
+ - **Guideline:** Avoid swallowing exceptions.
116
+
117
+ ```java
118
+ // GOOD
119
+ try {
120
+ file.read();
121
+ } catch (IOException e) {
122
+ throw new UncheckedIOException("Failed to read config", e);
123
+ }
124
+
125
+ // BAD
126
+ catch (Exception e) {
127
+ e.printStackTrace(); // Use a logger
128
+ }
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Common Patterns
134
+
135
+ ### Optional
136
+ - **Guideline:** Use `Optional<T>` for return types that may be null.
137
+ - **Avoid:** Using `Optional` in parameters or fields.
138
+
139
+ ```java
140
+ public Optional<User> findByEmail(String email) { ... }
141
+ ```
142
+
143
+ ### Streams API
144
+ - **Guideline:** Prefer Streams for collections processing.
145
+
146
+ ```java
147
+ List<String> names = users.stream()
148
+ .filter(User::isActive)
149
+ .map(User::getName)
150
+ .collect(Collectors.toList());
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Anti-Patterns
156
+
157
+ ```java
158
+ // BAD: Public fields
159
+ public String name; // Use private + getter
160
+
161
+ // BAD: Magic numbers
162
+ if (status == 4) // Use constant STATUS_ACTIVE
163
+ ```
164
+
165
+ ---
166
+
167
+ *This file should be customized for your project. Replace placeholders with actual values.*
@@ -0,0 +1,292 @@
1
+ # JavaScript/TypeScript Coding Standards
2
+
3
+ > **Language:** JavaScript / TypeScript
4
+ > **Generated:** {DATE}
5
+
6
+ ---
7
+
8
+ ## Formatting
9
+
10
+ ### Indentation
11
+ - **Style:** {tabs|spaces}
12
+ - **Size:** {2|4} {spaces|tabs}
13
+
14
+ ### Semicolons
15
+ - **Required:** {yes|no}
16
+
17
+ ### Quotes
18
+ - **Strings:** {single|double|backticks for templates}
19
+
20
+ ### Trailing Commas
21
+ - **Style:** {none|es5|all}
22
+
23
+ ---
24
+
25
+ ## Naming Conventions
26
+
27
+ ### Classes/Components
28
+ - **Style:** PascalCase
29
+ - **Example:** `UserService`, `PaymentForm`
30
+
31
+ ### Functions/Methods
32
+ - **Style:** camelCase
33
+ - **Example:** `getUserById()`, `handleSubmit()`
34
+
35
+ ### Variables
36
+ - **Style:** camelCase
37
+ - **Example:** `userName`, `isActive`
38
+
39
+ ### Constants
40
+ - **Style:** {UPPER_SNAKE_CASE|camelCase}
41
+ - **Example:** `MAX_RETRIES` or `maxRetries`
42
+
43
+ ### Private Members
44
+ - **Style:** {underscore prefix|# prefix|none}
45
+ - **Example:** `_privateMethod()` or `#privateField`
46
+
47
+ ### File Names
48
+ - **Style:** {kebab-case|camelCase|PascalCase}
49
+ - **Example:** `user-service.js` or `UserService.js`
50
+
51
+ ---
52
+
53
+ ## Structure
54
+
55
+ ### Module Organization
56
+ ```javascript
57
+ // 1. Imports - external
58
+ import React from 'react';
59
+ import axios from 'axios';
60
+
61
+ // 2. Imports - internal
62
+ import { UserService } from './services';
63
+ import { formatDate } from './utils';
64
+
65
+ // 3. Types/Interfaces (TypeScript)
66
+ interface User {
67
+ id: number;
68
+ name: string;
69
+ }
70
+
71
+ // 4. Constants
72
+ const API_URL = '/api/v1';
73
+
74
+ // 5. Main export
75
+ export class MyClass {
76
+ // ...
77
+ }
78
+
79
+ // 6. Helper functions (if not exported separately)
80
+ function helperFunction() {
81
+ // ...
82
+ }
83
+ ```
84
+
85
+ ### Function Length
86
+ - **Guideline:** {max lines per function}
87
+
88
+ ---
89
+
90
+ ## Variable Declarations
91
+
92
+ ### Preferred Keywords
93
+ - **Immutable:** `const` (default)
94
+ - **Mutable:** `let`
95
+ - **Avoid:** `var`
96
+
97
+ ```javascript
98
+ // GOOD
99
+ const user = getUser();
100
+ let count = 0;
101
+
102
+ // BAD
103
+ var user = getUser();
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Functions
109
+
110
+ ### Declaration Style
111
+ ```javascript
112
+ // Preferred: {function declaration|arrow function|mixed}
113
+
114
+ // Function declaration
115
+ function processData( data ) {
116
+ // ...
117
+ }
118
+
119
+ // Arrow function
120
+ const processData = ( data ) => {
121
+ // ...
122
+ };
123
+ ```
124
+
125
+ ### Parameters
126
+ ```javascript
127
+ // Destructuring: {preferred|optional}
128
+ function createUser( { name, email, role = 'user' } ) {
129
+ // ...
130
+ }
131
+
132
+ // Default values
133
+ function greet( name = 'Guest' ) {
134
+ // ...
135
+ }
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Async/Await
141
+
142
+ ### Preferred Style
143
+ ```javascript
144
+ // {async/await|promises|callbacks for specific cases}
145
+
146
+ // GOOD
147
+ async function fetchUser( id ) {
148
+ try {
149
+ const response = await api.get( `/users/${id}` );
150
+ return response.data;
151
+ } catch( error ) {
152
+ handleError( error );
153
+ }
154
+ }
155
+
156
+ // AVOID (unless necessary)
157
+ function fetchUser( id ) {
158
+ return api.get( `/users/${id}` )
159
+ .then( response => response.data )
160
+ .catch( handleError );
161
+ }
162
+ ```
163
+
164
+ ---
165
+
166
+ ## TypeScript Specific
167
+
168
+ ### Type Annotations
169
+ ```typescript
170
+ // {Required|Inferred where possible}
171
+
172
+ // Explicit
173
+ function getUser( id: number ): Promise<User> {
174
+ // ...
175
+ }
176
+
177
+ // Inferred (if allowed)
178
+ const count = 0; // inferred as number
179
+ ```
180
+
181
+ ### Interfaces vs Types
182
+ ```typescript
183
+ // Preferred for objects: {interface|type}
184
+ interface User {
185
+ id: number;
186
+ name: string;
187
+ }
188
+
189
+ // Use type for: unions, primitives, tuples
190
+ type Status = 'active' | 'inactive';
191
+ ```
192
+
193
+ ### Strict Mode
194
+ - **Enabled:** {yes|no}
195
+ - **Null checks:** {strict|relaxed}
196
+
197
+ ---
198
+
199
+ ## Error Handling
200
+
201
+ ### Try/Catch
202
+ ```javascript
203
+ try {
204
+ await riskyOperation();
205
+ } catch( error ) {
206
+ if( error instanceof SpecificError ){
207
+ // handle specific
208
+ } else {
209
+ // handle general
210
+ }
211
+ }
212
+ ```
213
+
214
+ ### Error Types
215
+ ```typescript
216
+ // Custom errors: {yes|no}
217
+ class ValidationError extends Error {
218
+ constructor( message: string, public field: string ){
219
+ super( message );
220
+ this.name = 'ValidationError';
221
+ }
222
+ }
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Imports/Exports
228
+
229
+ ### Module Style
230
+ ```javascript
231
+ // Named exports (preferred for utilities)
232
+ export function helper() {}
233
+ export const CONSTANT = 'value';
234
+
235
+ // Default export (for main class/component)
236
+ export default class MainService {}
237
+ ```
238
+
239
+ ### Import Organization
240
+ ```javascript
241
+ // 1. External packages
242
+ // 2. Internal absolute paths
243
+ // 3. Internal relative paths
244
+ // 4. Styles/assets
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Common Patterns
250
+
251
+ ### Null/Undefined Handling
252
+ ```javascript
253
+ // Optional chaining
254
+ const city = user?.address?.city;
255
+
256
+ // Nullish coalescing
257
+ const name = user.name ?? 'Anonymous';
258
+
259
+ // Default parameters
260
+ function greet( name = 'Guest' ) {}
261
+ ```
262
+
263
+ ### Object Manipulation
264
+ ```javascript
265
+ // Spread for copies
266
+ const updated = { ...user, name: 'New Name' };
267
+
268
+ // Destructuring
269
+ const { id, name } = user;
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Anti-Patterns
275
+
276
+ ```javascript
277
+ // BAD: {description}
278
+ {bad example}
279
+
280
+ // GOOD: {description}
281
+ {good example}
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Framework-Specific
287
+
288
+ {Add any React/Vue/Node/etc. specific conventions here}
289
+
290
+ ---
291
+
292
+ *This file should be customized for your project. Replace placeholders with actual values.*
@@ -0,0 +1,181 @@
1
+ # PHP Coding Standards
2
+
3
+ > **Language:** PHP
4
+ > **Generated:** {DATE}
5
+
6
+ ---
7
+
8
+ ## Formatting
9
+
10
+ ### Indentation
11
+ - **Style:** {tabs|spaces}
12
+ - **Size:** {2|4} {spaces|tabs}
13
+
14
+ ### Braces
15
+ - **Classes/Functions:** {same-line|next-line}
16
+ - **Control structures:** {same-line|next-line}
17
+
18
+ ### Spacing
19
+ - **Inside parentheses:** {yes|no} - `function( $param )` vs `function($param)`
20
+ - **After keywords:** {yes|no} - `if ( $x )` vs `if($x)`
21
+ - **Array brackets:** {no-spaces} - `$arr['key']`
22
+
23
+ ---
24
+
25
+ ## Naming Conventions
26
+
27
+ ### Classes
28
+ - **Style:** PascalCase
29
+ - **Example:** `UserService`, `PaymentController`
30
+
31
+ ### Methods
32
+ - **Style:** camelCase
33
+ - **Example:** `getUserById()`, `processPayment()`
34
+
35
+ ### Variables
36
+ - **Style:** {camelCase|snake_case}
37
+ - **Example:** `$userName` or `$user_name`
38
+
39
+ ### Constants
40
+ - **Style:** UPPER_SNAKE_CASE
41
+ - **Example:** `MAX_RETRY_COUNT`, `API_VERSION`
42
+
43
+ ### Properties
44
+ - **Style:** {camelCase|snake_case}
45
+ - **Visibility prefix:** {none|underscore for private}
46
+
47
+ ---
48
+
49
+ ## Structure
50
+
51
+ ### File Organization
52
+ ```php
53
+ <?php
54
+ // 1. Strict types declaration (if used)
55
+ declare( strict_types=1 );
56
+
57
+ // 2. Namespace
58
+ namespace App\Services;
59
+
60
+ // 3. Use statements (alphabetized)
61
+ use App\Models\User;
62
+ use Exception;
63
+
64
+ // 4. Class definition
65
+ class UserService {
66
+ // 5. Constants
67
+ // 6. Properties
68
+ // 7. Constructor
69
+ // 8. Public methods
70
+ // 9. Protected methods
71
+ // 10. Private methods
72
+ }
73
+ ```
74
+
75
+ ### Method Length
76
+ - **Guideline:** {max lines per method}
77
+ - **Complexity:** {max cyclomatic complexity}
78
+
79
+ ---
80
+
81
+ ## Type Hints
82
+
83
+ ### Parameters
84
+ ```php
85
+ // {Required|Optional}
86
+ public function process( string $name, int $count ): void
87
+ ```
88
+
89
+ ### Return Types
90
+ ```php
91
+ // {Required|Optional}
92
+ public function getData(): array
93
+ ```
94
+
95
+ ### Property Types (PHP 7.4+)
96
+ ```php
97
+ // {Required|Optional}
98
+ private string $name;
99
+ private User|null $user = null;
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Documentation
105
+
106
+ ### Class DocBlocks
107
+ ```php
108
+ /**
109
+ * {Required|Optional}
110
+ * Brief description of the class.
111
+ */
112
+ class MyClass
113
+ ```
114
+
115
+ ### Method DocBlocks
116
+ ```php
117
+ /**
118
+ * {Required|Optional|Only for complex methods}
119
+ *
120
+ * @param string $name Description
121
+ * @return array Description
122
+ * @throws Exception When condition
123
+ */
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Error Handling
129
+
130
+ ### Exceptions
131
+ - **Custom exceptions:** {yes|no}
132
+ - **Base exception class:** {name if applicable}
133
+
134
+ ### Try/Catch
135
+ ```php
136
+ try {
137
+ // code
138
+ } catch( SpecificException $e ){
139
+ // handle
140
+ } catch( Exception $e ){
141
+ // fallback
142
+ }
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Common Patterns
148
+
149
+ ### Dependency Injection
150
+ ```php
151
+ // {Constructor injection|Setter injection|Container}
152
+ public function __construct( private UserRepository $repo )
153
+ ```
154
+
155
+ ### Null Handling
156
+ ```php
157
+ // Preferred: {null coalescing|ternary|early return}
158
+ $value = $data['key'] ?? 'default';
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Anti-Patterns
164
+
165
+ ```php
166
+ // BAD: {description}
167
+ {bad example}
168
+
169
+ // GOOD: {description}
170
+ {good example}
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Framework-Specific
176
+
177
+ {Add any framework-specific conventions here}
178
+
179
+ ---
180
+
181
+ *This file should be customized for your project. Replace placeholders with actual values.*