@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,301 @@
1
+ # Standards Detector Tool
2
+
3
+ > **Type:** AI Tool Guide
4
+ > **Purpose:** Analyze project files to detect and document coding standards
5
+
6
+ ---
7
+
8
+ ## When to Use This Tool
9
+
10
+ Use this tool when:
11
+ - Setting up Contextuate in an existing project
12
+ - User wants coding standards documented
13
+ - Standards need to be inferred from existing code
14
+ - Creating project-specific coding standards
15
+
16
+ ---
17
+
18
+ ## Input
19
+
20
+ **Required:** Access to project source files
21
+
22
+ **Optional:**
23
+ - Specific languages to analyze
24
+ - Specific directories to focus on
25
+ - Existing style config files (.eslintrc, .prettierrc, phpcs.xml, etc.)
26
+
27
+ ---
28
+
29
+ ## Process
30
+
31
+ ### Step 1: Detect Languages
32
+
33
+ Scan project for source files and identify languages:
34
+
35
+ | Extension | Language |
36
+ |-----------|----------|
37
+ | `.php` | PHP |
38
+ | `.js`, `.jsx` | JavaScript |
39
+ | `.ts`, `.tsx` | TypeScript |
40
+ | `.py` | Python |
41
+ | `.go` | Go |
42
+ | `.rb` | Ruby |
43
+ | `.java` | Java |
44
+ | `.cs` | C# |
45
+ | `.rs` | Rust |
46
+
47
+ ### Step 2: Check for Config Files
48
+
49
+ Look for existing style configuration:
50
+
51
+ | File | Tool | Language |
52
+ |------|------|----------|
53
+ | `.eslintrc*` | ESLint | JS/TS |
54
+ | `.prettierrc*` | Prettier | JS/TS/CSS |
55
+ | `phpcs.xml` | PHP_CodeSniffer | PHP |
56
+ | `.php-cs-fixer.php` | PHP CS Fixer | PHP |
57
+ | `pyproject.toml` | Black/Ruff | Python |
58
+ | `.editorconfig` | EditorConfig | All |
59
+ | `tslint.json` | TSLint | TypeScript |
60
+ | `.rubocop.yml` | RuboCop | Ruby |
61
+
62
+ If config files exist, extract rules from them first.
63
+
64
+ ### Step 3: Analyze Sample Files
65
+
66
+ For each detected language, read 3-5 representative files:
67
+ - Prefer files in `src/`, `app/`, `lib/` directories
68
+ - Choose files with 50-200 lines (not too short, not too long)
69
+ - Include different file types (classes, utilities, controllers)
70
+
71
+ ### Step 4: Detect Patterns
72
+
73
+ For each file, analyze:
74
+
75
+ #### Formatting
76
+ - **Indentation:** Count leading whitespace characters
77
+ - All tabs → tabs
78
+ - 2 spaces → 2-space indent
79
+ - 4 spaces → 4-space indent
80
+ - **Braces:** Check if `{` appears on same line or next line
81
+ - **Spacing:** Check patterns inside parentheses, after keywords
82
+ - **Semicolons (JS):** Present at end of statements?
83
+ - **Quotes (JS):** Single or double quotes predominant?
84
+
85
+ #### Naming
86
+ - **Classes:** PascalCase, snake_case, etc.
87
+ - **Functions:** camelCase, snake_case, etc.
88
+ - **Variables:** camelCase, snake_case, etc.
89
+ - **Constants:** UPPER_CASE, camelCase, etc.
90
+
91
+ #### Structure
92
+ - **Import organization:** Grouped? Alphabetized?
93
+ - **File organization:** Class structure patterns
94
+
95
+ #### Documentation
96
+ - **DocBlocks:** Present? Format?
97
+ - **Comments:** Inline style?
98
+
99
+ ### Step 5: Resolve Conflicts
100
+
101
+ If patterns vary across files:
102
+ 1. Count occurrences of each pattern
103
+ 2. Use majority pattern (60%+ agreement)
104
+ 3. Note inconsistencies for user review
105
+ 4. Flag if no clear majority exists
106
+
107
+ ### Step 6: Generate Standards Document
108
+
109
+ Use the appropriate template from `templates/standards/`:
110
+ - `php.standards.md` for PHP
111
+ - `javascript.standards.md` for JS/TS
112
+
113
+ Fill in detected values, replacing `{placeholders}`.
114
+
115
+ ---
116
+
117
+ ## Output
118
+
119
+ Create files in `docs/ai/standards/` (user-customizable location):
120
+
121
+ ```
122
+ docs/ai/standards/
123
+ ├── php.standards.md # If PHP detected
124
+ ├── javascript.standards.md # If JS/TS detected
125
+ └── {language}.standards.md # For other languages
126
+ ```
127
+
128
+ These user standards take priority over framework defaults in `docs/ai/.context/templates/standards/`.
129
+ See [coding-standards.md](../standards/coding-standards.md) for resolution order.
130
+
131
+ ---
132
+
133
+ ## Analysis Checklist
134
+
135
+ ### PHP Analysis
136
+
137
+ ```php
138
+ // Check for:
139
+ // 1. Indentation
140
+ $line = " code"; // 4 spaces
141
+ $line = "\tcode"; // tab
142
+
143
+ // 2. Brace style
144
+ class Foo { // same-line
145
+ class Foo // next-line
146
+ {
147
+
148
+ // 3. Parentheses spacing
149
+ function foo( $param ) // spaces inside
150
+ function foo($param) // no spaces
151
+
152
+ // 4. Array syntax
153
+ $arr = array(); // long syntax
154
+ $arr = []; // short syntax
155
+
156
+ // 5. Visibility
157
+ public $prop; // explicit
158
+ var $prop; // implicit (old style)
159
+
160
+ // 6. Type hints
161
+ function foo( string $a ): int // yes
162
+ function foo( $a ) // no
163
+ ```
164
+
165
+ ### JavaScript Analysis
166
+
167
+ ```javascript
168
+ // Check for:
169
+ // 1. Semicolons
170
+ const x = 1; // with semicolon
171
+ const x = 1 // without
172
+
173
+ // 2. Quotes
174
+ 'single quotes'
175
+ "double quotes"
176
+
177
+ // 3. Variable declaration
178
+ const x = 1; // const preferred
179
+ let x = 1; // let used
180
+ var x = 1; // var used (legacy)
181
+
182
+ // 4. Arrow functions
183
+ const fn = () => {}; // arrow
184
+ function fn() {} // declaration
185
+
186
+ // 5. Trailing commas
187
+ { a: 1, b: 2, } // trailing
188
+ { a: 1, b: 2 } // no trailing
189
+
190
+ // 6. Object shorthand
191
+ { name: name } // verbose
192
+ { name } // shorthand
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Example Output
198
+
199
+ After analyzing a PHP project:
200
+
201
+ ```markdown
202
+ # PHP Coding Standards
203
+
204
+ > **Language:** PHP
205
+ > **Generated:** 2024-01-15
206
+ > **Detected from:** src/Services/, src/Controllers/
207
+
208
+ ---
209
+
210
+ ## Formatting
211
+
212
+ ### Indentation
213
+ - **Style:** tabs
214
+ - **Size:** 1 tab
215
+
216
+ ### Braces
217
+ - **Classes/Functions:** same-line
218
+ - **Control structures:** same-line
219
+
220
+ ### Spacing
221
+ - **Inside parentheses:** yes - `function( $param )`
222
+ - **After keywords:** yes - `if( $x )`
223
+ - **Array brackets:** no-spaces - `$arr['key']`
224
+
225
+ ---
226
+
227
+ ## Naming Conventions
228
+
229
+ ### Classes
230
+ - **Style:** PascalCase
231
+ - **Example:** `UserService`, `PaymentController`
232
+
233
+ ### Methods
234
+ - **Style:** camelCase
235
+ - **Example:** `getUserById()`, `processPayment()`
236
+
237
+ ### Variables
238
+ - **Style:** snake_case
239
+ - **Example:** `$user_name`, `$is_active`
240
+
241
+ ...
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Edge Cases
247
+
248
+ ### Mixed Standards
249
+ If project has inconsistent standards:
250
+ 1. Document the majority pattern
251
+ 2. Add a note about inconsistencies
252
+ 3. Suggest the user choose one
253
+
254
+ ```markdown
255
+ > **Note:** Mixed indentation detected (60% tabs, 40% 2-space).
256
+ > Documenting tabs as primary. Consider standardizing.
257
+ ```
258
+
259
+ ### No Clear Pattern
260
+ If no pattern emerges:
261
+ 1. Leave placeholder in template
262
+ 2. Note that manual input is needed
263
+
264
+ ```markdown
265
+ ### Variables
266
+ - **Style:** {inconsistent - needs manual specification}
267
+ ```
268
+
269
+ ### Config File Conflicts
270
+ If config files disagree with actual code:
271
+ 1. Prefer config file settings (they're intentional)
272
+ 2. Note that code may not follow config
273
+ 3. Suggest running linter to fix
274
+
275
+ ---
276
+
277
+ ## Reporting
278
+
279
+ After generating standards, report:
280
+
281
+ 1. Languages detected
282
+ 2. Files analyzed
283
+ 3. Config files found
284
+ 4. Standards documents created
285
+ 5. Any inconsistencies or manual input needed
286
+
287
+ ```
288
+ Standards Detection Complete
289
+ ============================
290
+ Languages: PHP, JavaScript
291
+ Files analyzed: 12
292
+ Config files: .eslintrc.js, .editorconfig
293
+
294
+ Created:
295
+ - docs/ai/standards/php.standards.md
296
+ - docs/ai/standards/javascript.standards.md
297
+
298
+ Notes:
299
+ - PHP: Inconsistent variable naming (70% snake_case)
300
+ - JS: No semicolons detected, matches .eslintrc
301
+ ```
@@ -2,7 +2,7 @@
2
2
  "name": "contextuate",
3
3
  "version": "1.0.0",
4
4
  "description": "AI Context Framework - Standardized documentation for AI coding assistants",
5
- "repository": "https://github.com/esotech/contextuate",
5
+ "repository": "https://github.com/contextuate/contextuate",
6
6
  "installed": null,
7
7
  "updated": null
8
8
  }