@esotech/contextuate 2.1.0 → 2.1.2

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 (48) hide show
  1. package/dist/commands/doctor.d.ts +6 -0
  2. package/dist/commands/doctor.js +131 -0
  3. package/dist/commands/init.d.ts +0 -2
  4. package/dist/commands/init.js +164 -228
  5. package/dist/commands/install.js +8 -24
  6. package/dist/index.js +7 -0
  7. package/dist/templates/agents/aegis.md +1 -1
  8. package/dist/templates/agents/archon.md +116 -8
  9. package/dist/templates/agents/atlas.md +17 -17
  10. package/dist/templates/agents/canvas.md +1 -1
  11. package/dist/templates/agents/chronicle.md +1 -1
  12. package/dist/templates/agents/chronos.md +1 -1
  13. package/dist/templates/agents/cipher.md +1 -1
  14. package/dist/templates/agents/crucible.md +1 -1
  15. package/dist/templates/agents/echo.md +1 -1
  16. package/dist/templates/agents/forge.md +1 -1
  17. package/dist/templates/agents/ledger.md +34 -3
  18. package/dist/templates/agents/meridian.md +1 -1
  19. package/dist/templates/agents/nexus.md +1 -1
  20. package/dist/templates/agents/pythia.md +1 -1
  21. package/dist/templates/agents/scribe.md +1 -1
  22. package/dist/templates/agents/sentinel.md +1 -1
  23. package/dist/templates/agents/thoth.md +1 -1
  24. package/dist/templates/agents/unity.md +1 -1
  25. package/dist/templates/agents/vox.md +1 -1
  26. package/dist/templates/agents/weaver.md +1 -1
  27. package/dist/templates/{skills → commands}/consult.md +1 -1
  28. package/dist/templates/commands/orchestrate.md +49 -0
  29. package/dist/templates/framework-agents/documentation-expert.md +3 -3
  30. package/dist/templates/framework-agents/tools-expert.md +3 -3
  31. package/dist/templates/templates/contextuate.md +1 -1
  32. package/dist/templates/tools/agent-creator.md +4 -4
  33. package/dist/templates/tools/standards-detector.md +1 -1
  34. package/dist/utils/tools.d.ts +60 -0
  35. package/dist/utils/tools.js +260 -0
  36. package/package.json +2 -2
  37. package/dist/templates/skills/orchestrate.md +0 -173
  38. package/dist/templates/skills/pythia.md +0 -37
  39. package/dist/templates/templates/standards/go.standards.md +0 -167
  40. package/dist/templates/templates/standards/java.standards.md +0 -167
  41. package/dist/templates/templates/standards/javascript.standards.md +0 -292
  42. package/dist/templates/templates/standards/php.standards.md +0 -181
  43. package/dist/templates/templates/standards/python.standards.md +0 -175
  44. package/dist/templates/tools/agent-creator.tool.md +0 -252
  45. package/dist/templates/tools/quickref.tool.md +0 -216
  46. package/dist/templates/tools/spawn.tool.md +0 -31
  47. package/dist/templates/tools/standards-detector.tool.md +0 -301
  48. package/dist/templates/version.json +0 -8
@@ -1,216 +0,0 @@
1
- # Quickref Generation Tool
2
-
3
- > **Type:** AI Tool Guide
4
- > **Purpose:** Instructions for generating AI-friendly quick references from documentation
5
-
6
- ---
7
-
8
- ## When to Use This Tool
9
-
10
- Use this tool when:
11
- - Full documentation exceeds ~200 lines
12
- - A condensed reference would help AI assistants
13
- - Methods/APIs are frequently looked up
14
- - User requests a quickref be generated
15
-
16
- ---
17
-
18
- ## Input
19
-
20
- **Required:** Path to source documentation file
21
-
22
- **Example request:**
23
- > "Generate a quickref for docs/classes/user-service.md"
24
-
25
- ---
26
-
27
- ## Process
28
-
29
- ### Step 1: Read the Source Documentation
30
-
31
- Read the full documentation file to understand:
32
- - What the class/service/API does
33
- - All public methods and their signatures
34
- - Properties and their types
35
- - Common usage patterns
36
-
37
- ### Step 2: Extract Key Information
38
-
39
- For each **method**, capture:
40
- - Method name
41
- - Full parameter signature with types
42
- - One-line description (max 10 words)
43
-
44
- For each **property**, capture:
45
- - Property name
46
- - Type
47
- - One-line description
48
-
49
- For **common usage**, capture:
50
- - The single most common usage pattern
51
- - Keep it to 3-5 lines of code max
52
-
53
- ### Step 3: Organize by Category
54
-
55
- Group methods logically:
56
- - By functionality (CRUD, validation, transformation)
57
- - By access pattern (getters, setters, actions)
58
- - By frequency of use (common first)
59
-
60
- ### Step 4: Generate Quickref
61
-
62
- Write to `docs/ai/quickrefs/{name}.quickref.md` using the template below.
63
-
64
- ---
65
-
66
- ## Output Template
67
-
68
- ```markdown
69
- # {Name} - Quick Reference
70
-
71
- > **Source:** [{source-filename}](../../{path-to-source})
72
- > **Generated:** {YYYY-MM-DD}
73
-
74
- ---
75
-
76
- ## Methods
77
-
78
- ### {Category 1}
79
-
80
- | Method | Description |
81
- |--------|-------------|
82
- | `methodName( param: type )` | Brief description |
83
- | `methodName( a: type, b: type ): returnType` | Brief description |
84
-
85
- ### {Category 2}
86
-
87
- | Method | Description |
88
- |--------|-------------|
89
- | `methodName( param: type )` | Brief description |
90
-
91
- ---
92
-
93
- ## Properties
94
-
95
- | Property | Type | Description |
96
- |----------|------|-------------|
97
- | `propertyName` | type | Brief description |
98
-
99
- ---
100
-
101
- ## Common Usage
102
-
103
- \`\`\`{language}
104
- // Most common pattern - keep brief
105
- \`\`\`
106
-
107
- ---
108
-
109
- *See [full documentation](../../{path-to-source}) for details.*
110
- ```
111
-
112
- ---
113
-
114
- ## Guidelines
115
-
116
- ### Keep It Scannable
117
- - One line per method/property
118
- - No verbose explanations
119
- - Tables for structured data
120
- - Max 100 lines total
121
-
122
- ### Method Signatures
123
- - Include all parameters with types
124
- - Include return type if not void
125
- - Use consistent formatting:
126
- ```
127
- methodName( param1: type, param2: type ): returnType
128
- ```
129
-
130
- ### Descriptions
131
- - Max 10 words per description
132
- - Start with verb: "Gets...", "Sets...", "Returns...", "Creates..."
133
- - No periods at end
134
-
135
- ### Categories
136
- - 2-5 categories typically
137
- - Use clear, short category names
138
- - Most-used methods first
139
-
140
- ### Common Usage
141
- - Single most common pattern
142
- - 3-5 lines of code max
143
- - Must be copy-paste ready
144
-
145
- ---
146
-
147
- ## Example
148
-
149
- **Source:** `docs/classes/cache-service.md` (300 lines)
150
-
151
- **Generated quickref:**
152
-
153
- ```markdown
154
- # Cache Service - Quick Reference
155
-
156
- > **Source:** [cache-service.class.md](../../classes/cache-service.class.md)
157
- > **Generated:** 2024-01-15
158
-
159
- ---
160
-
161
- ## Methods
162
-
163
- ### Core Operations
164
-
165
- | Method | Description |
166
- |--------|-------------|
167
- | `get( key: string ): mixed` | Gets cached value by key |
168
- | `set( key: string, value: mixed, ttl?: int )` | Sets value with optional TTL |
169
- | `delete( key: string ): bool` | Removes key from cache |
170
- | `has( key: string ): bool` | Checks if key exists |
171
- | `clear()` | Removes all cached values |
172
-
173
- ### Batch Operations
174
-
175
- | Method | Description |
176
- |--------|-------------|
177
- | `getMultiple( keys: array ): array` | Gets multiple values at once |
178
- | `setMultiple( items: array, ttl?: int )` | Sets multiple values |
179
- | `deleteMultiple( keys: array ): bool` | Removes multiple keys |
180
-
181
- ---
182
-
183
- ## Properties
184
-
185
- | Property | Type | Description |
186
- |----------|------|-------------|
187
- | `defaultTtl` | int | Default time-to-live in seconds |
188
- | `prefix` | string | Key prefix for namespacing |
189
-
190
- ---
191
-
192
- ## Common Usage
193
-
194
- \`\`\`php
195
- $value = $cache->get( 'user:123' );
196
- if( !$value ){
197
- $value = $this->loadUser( 123 );
198
- $cache->set( 'user:123', $value, 3600 );
199
- }
200
- \`\`\`
201
-
202
- ---
203
-
204
- *See [full documentation](../../classes/cache-service.class.md) for details.*
205
- ```
206
-
207
- ---
208
-
209
- ## Naming Convention
210
-
211
- - **File:** `{source-name}.quickref.md`
212
- - **Location:** `docs/ai/quickrefs/`
213
-
214
- Examples:
215
- - `docs/classes/user-service.md` → `docs/ai/quickrefs/user-service.quickref.md`
216
- - `docs/api/auth-endpoints.md` → `docs/ai/quickrefs/auth-endpoints.quickref.md`
@@ -1,31 +0,0 @@
1
- # Tool: spawn_agent
2
-
3
- > **Status:** EXPERIMENTAL
4
-
5
- The `spawn_agent` tool allows you to launch a specialized sub-agent to perform a specific task in an isolated context.
6
-
7
- ## Usage
8
-
9
- Use this tool when you need to:
10
- 1. Perform a risky operation that should be sandboxed (e.g. "Refactor auth module").
11
- 2. Delegate a large task to a specialized persona (e.g. "Ask documentation-expert to write docs").
12
-
13
- ## Arguments
14
-
15
- | Argument | Type | Description |
16
- | :----------- | :------- | :--------------------------------------------------------------------- |
17
- | `agent_name` | `string` | The name of the agent to spawn (must exist in `docs/ai/agents/`). |
18
- | `goal` | `string` | Specific instructions for what the agent should achieve. |
19
- | `isolation` | `string` | Isolation mode `worktree` (recommended) or `none`. Default `worktree`. |
20
-
21
- ## Example
22
-
23
- ```bash
24
- contextuate run coder-agent --goal "Fix the bug in login.ts" --isolation=worktree
25
- ```
26
-
27
- ## Behavior
28
-
29
- 1. **Isolation:** The agent creates a new git worktree (branch).
30
- 2. **Execution:** The agent runs independently in that directory.
31
- 3. **Result:** The agent commits changes to its branch. You must then merge or review these changes.
@@ -1,301 +0,0 @@
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
- ```
@@ -1,8 +0,0 @@
1
- {
2
- "name": "contextuate",
3
- "version": "1.0.0",
4
- "description": "AI Context Framework - Standardized documentation for AI coding assistants",
5
- "repository": "https://github.com/contextuate/contextuate",
6
- "installed": null,
7
- "updated": null
8
- }