claude-all-hands 1.0.2 → 1.0.4

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 (35) hide show
  1. package/.claude/agents/curator.md +1 -5
  2. package/.claude/agents/documentation-taxonomist.md +255 -0
  3. package/.claude/agents/documentation-writer.md +366 -0
  4. package/.claude/agents/surveyor.md +1 -1
  5. package/.claude/commands/continue.md +12 -10
  6. package/.claude/commands/create-skill.md +2 -2
  7. package/.claude/commands/create-specialist.md +3 -3
  8. package/.claude/commands/debug.md +5 -5
  9. package/.claude/commands/docs-adjust.md +214 -0
  10. package/.claude/commands/docs-audit.md +172 -0
  11. package/.claude/commands/docs-init.md +210 -0
  12. package/.claude/commands/plan.md +6 -6
  13. package/.claude/commands/whats-next.md +2 -2
  14. package/.claude/envoy/README.md +5 -5
  15. package/.claude/envoy/package-lock.json +216 -10
  16. package/.claude/envoy/package.json +9 -0
  17. package/.claude/envoy/src/commands/docs.ts +881 -0
  18. package/.claude/envoy/src/commands/knowledge.ts +33 -42
  19. package/.claude/envoy/src/lib/ast-queries.ts +261 -0
  20. package/.claude/envoy/src/lib/knowledge.ts +176 -124
  21. package/.claude/envoy/src/lib/tree-sitter-utils.ts +301 -0
  22. package/.claude/envoy/src/types/tree-sitter.d.ts +76 -0
  23. package/.claude/hooks/scripts/enforce_research_fetch.py +1 -1
  24. package/.claude/protocols/bug-discovery.yaml +1 -1
  25. package/.claude/protocols/discovery.yaml +1 -1
  26. package/.claude/settings.json +4 -3
  27. package/.claude/skills/discovery-mode/SKILL.md +7 -7
  28. package/.claude/skills/documentation-taxonomy/SKILL.md +287 -0
  29. package/.claude/skills/implementation-mode/SKILL.md +7 -7
  30. package/.claude/skills/knowledge-discovery/SKILL.md +178 -0
  31. package/bin/cli.js +41 -1
  32. package/package.json +1 -1
  33. package/.claude/agents/documentor.md +0 -147
  34. package/.claude/commands/audit-docs.md +0 -94
  35. package/.claude/commands/create-docs.md +0 -100
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Knowledge commands - semantic search and indexing for documentation.
2
+ * Knowledge commands - semantic search and indexing for docs/ documentation.
3
3
  *
4
4
  * Commands:
5
- * envoy knowledge search <index_name> <query>
6
- * envoy knowledge reindex-all [--index_name <name>]
7
- * envoy knowledge reindex-from-changes <index_name> --files <json_array>
5
+ * envoy knowledge search <query> [--metadata-only]
6
+ * envoy knowledge reindex-all
7
+ * envoy knowledge reindex-from-changes --files <json_array>
8
8
  */
9
9
 
10
10
  import { Command } from "commander";
@@ -16,34 +16,34 @@ const getProjectRoot = (): string => {
16
16
  };
17
17
 
18
18
  /**
19
- * Search command - semantic search against indexed documents
19
+ * Search command - semantic search against docs index
20
20
  */
21
21
  class SearchCommand extends BaseCommand {
22
22
  readonly name = "search";
23
- readonly description = "Semantic search (use descriptive phrases, not keywords)";
23
+ readonly description = "Semantic search docs (use descriptive phrases, not keywords)";
24
24
 
25
25
  defineArguments(cmd: Command): void {
26
26
  cmd
27
- .argument("<index_name>", "Index to search (docs, curator)")
28
- .argument("<query>", "Descriptive phrase (e.g. 'how to handle API authentication' not 'auth')");
27
+ .argument("<query>", "Descriptive phrase (e.g. 'how to handle API authentication' not 'auth')")
28
+ .option("--metadata-only", "Return only file paths and descriptions (no full content)");
29
29
  }
30
30
 
31
31
  async execute(args: Record<string, unknown>): Promise<CommandResult> {
32
- const indexName = args.index_name as string;
33
32
  const query = args.query as string;
33
+ const metadataOnly = !!args.metadataOnly;
34
34
 
35
- if (!indexName || !query) {
36
- return this.error("validation_error", "index_name and query are required");
35
+ if (!query) {
36
+ return this.error("validation_error", "query is required");
37
37
  }
38
38
 
39
39
  try {
40
40
  const service = new KnowledgeService(getProjectRoot());
41
- const results = await service.search(indexName, query);
41
+ const results = await service.search(query, 50, metadataOnly);
42
42
 
43
43
  return this.success({
44
44
  message: "Search completed",
45
45
  query,
46
- index: indexName,
46
+ metadata_only: metadataOnly,
47
47
  results,
48
48
  result_count: results.length,
49
49
  });
@@ -57,26 +57,24 @@ class SearchCommand extends BaseCommand {
57
57
  }
58
58
 
59
59
  /**
60
- * Reindex-all command - full rebuild of one or all indexes
60
+ * Reindex-all command - full rebuild of docs index
61
61
  */
62
62
  class ReindexAllCommand extends BaseCommand {
63
63
  readonly name = "reindex-all";
64
- readonly description = "Rebuild search index from all documents";
64
+ readonly description = "Rebuild docs search index";
65
65
 
66
- defineArguments(cmd: Command): void {
67
- cmd.option("--index_name <name>", "Specific index to reindex (default: all)");
66
+ defineArguments(): void {
67
+ // No arguments
68
68
  }
69
69
 
70
- async execute(args: Record<string, unknown>): Promise<CommandResult> {
71
- const indexName = args.index_name as string | undefined;
72
-
70
+ async execute(): Promise<CommandResult> {
73
71
  try {
74
72
  const service = new KnowledgeService(getProjectRoot());
75
- const results = await service.reindexAll(indexName);
73
+ const result = await service.reindexAll();
76
74
 
77
75
  return this.success({
78
- message: indexName ? `Index '${indexName}' reindexed` : "All indexes reindexed",
79
- stats: results,
76
+ message: "Docs index reindexed",
77
+ stats: result,
80
78
  });
81
79
  } catch (e) {
82
80
  return this.error(
@@ -92,23 +90,17 @@ class ReindexAllCommand extends BaseCommand {
92
90
  */
93
91
  class ReindexFromChangesCommand extends BaseCommand {
94
92
  readonly name = "reindex-from-changes";
95
- readonly description = "Update index from changed files (for git hooks)";
93
+ readonly description = "Update docs index from changed files (for git hooks)";
96
94
 
97
95
  defineArguments(cmd: Command): void {
98
- cmd
99
- .argument("<index_name>", "Index to update (docs, curator)")
100
- .requiredOption("--files <json>", "JSON array of file changes");
96
+ cmd.requiredOption("--files <json>", "JSON array of file changes");
101
97
  }
102
98
 
103
99
  async execute(args: Record<string, unknown>): Promise<CommandResult> {
104
- const indexName = args.index_name as string;
105
100
  const filesJson = args.files as string;
106
101
 
107
- if (!indexName || !filesJson) {
108
- return this.error(
109
- "validation_error",
110
- "index_name and --files are required"
111
- );
102
+ if (!filesJson) {
103
+ return this.error("validation_error", "--files is required");
112
104
  }
113
105
 
114
106
  let changes: FileChange[];
@@ -120,7 +112,7 @@ class ReindexFromChangesCommand extends BaseCommand {
120
112
 
121
113
  try {
122
114
  const service = new KnowledgeService(getProjectRoot());
123
- const result = await service.reindexFromChanges(indexName, changes);
115
+ const result = await service.reindexFromChanges(changes);
124
116
 
125
117
  if (!result.success) {
126
118
  return {
@@ -150,25 +142,24 @@ class ReindexFromChangesCommand extends BaseCommand {
150
142
  }
151
143
 
152
144
  /**
153
- * Status command - check index health
145
+ * Status command - check docs index health
154
146
  */
155
147
  class StatusCommand extends BaseCommand {
156
148
  readonly name = "status";
157
- readonly description = "Check index status and health";
149
+ readonly description = "Check docs index status";
158
150
 
159
- defineArguments(cmd: Command): void {
160
- // No arguments needed
151
+ defineArguments(): void {
152
+ // No arguments
161
153
  }
162
154
 
163
155
  async execute(): Promise<CommandResult> {
164
156
  try {
165
157
  const service = new KnowledgeService(getProjectRoot());
166
- const status = await service.checkIndexes();
158
+ const status = await service.checkIndex();
167
159
 
168
160
  return this.success({
169
- valid_indexes: status.valid,
170
- missing_indexes: status.missing,
171
- needs_reindex: status.missing.length > 0,
161
+ index_exists: status.exists,
162
+ needs_reindex: !status.exists,
172
163
  });
173
164
  } catch (e) {
174
165
  return this.error(
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Tree-sitter query patterns for symbol resolution across languages.
3
+ * Used by docs commands to find symbols for reference formatting.
4
+ */
5
+
6
+ export type SymbolType = "function" | "class" | "variable" | "type" | "export" | "method" | "struct";
7
+
8
+ export interface SymbolQuery {
9
+ query: string;
10
+ nameCapture: string;
11
+ }
12
+
13
+ export interface LanguageQueries {
14
+ [key: string]: SymbolQuery;
15
+ }
16
+
17
+ /**
18
+ * Language-specific tree-sitter queries for finding symbol definitions.
19
+ * Each query captures the symbol name via @name capture group.
20
+ */
21
+ export const languageQueries: Record<string, LanguageQueries> = {
22
+ typescript: {
23
+ function: {
24
+ query: `(function_declaration name: (identifier) @name)`,
25
+ nameCapture: "name",
26
+ },
27
+ class: {
28
+ query: `(class_declaration name: (type_identifier) @name)`,
29
+ nameCapture: "name",
30
+ },
31
+ variable: {
32
+ query: `(variable_declarator name: (identifier) @name)`,
33
+ nameCapture: "name",
34
+ },
35
+ type: {
36
+ query: `(type_alias_declaration name: (type_identifier) @name)`,
37
+ nameCapture: "name",
38
+ },
39
+ interface: {
40
+ query: `(interface_declaration name: (type_identifier) @name)`,
41
+ nameCapture: "name",
42
+ },
43
+ method: {
44
+ query: `(method_definition name: (property_identifier) @name)`,
45
+ nameCapture: "name",
46
+ },
47
+ export: {
48
+ query: `(export_statement declaration: (function_declaration name: (identifier) @name))`,
49
+ nameCapture: "name",
50
+ },
51
+ arrowFunction: {
52
+ query: `(lexical_declaration
53
+ (variable_declarator
54
+ name: (identifier) @name
55
+ value: (arrow_function)))`,
56
+ nameCapture: "name",
57
+ },
58
+ },
59
+
60
+ javascript: {
61
+ function: {
62
+ query: `(function_declaration name: (identifier) @name)`,
63
+ nameCapture: "name",
64
+ },
65
+ class: {
66
+ query: `(class_declaration name: (identifier) @name)`,
67
+ nameCapture: "name",
68
+ },
69
+ variable: {
70
+ query: `(variable_declarator name: (identifier) @name)`,
71
+ nameCapture: "name",
72
+ },
73
+ method: {
74
+ query: `(method_definition name: (property_identifier) @name)`,
75
+ nameCapture: "name",
76
+ },
77
+ arrowFunction: {
78
+ query: `(lexical_declaration
79
+ (variable_declarator
80
+ name: (identifier) @name
81
+ value: (arrow_function)))`,
82
+ nameCapture: "name",
83
+ },
84
+ },
85
+
86
+ python: {
87
+ function: {
88
+ query: `(function_definition name: (identifier) @name)`,
89
+ nameCapture: "name",
90
+ },
91
+ class: {
92
+ query: `(class_definition name: (identifier) @name)`,
93
+ nameCapture: "name",
94
+ },
95
+ variable: {
96
+ query: `(assignment left: (identifier) @name)`,
97
+ nameCapture: "name",
98
+ },
99
+ method: {
100
+ query: `(function_definition name: (identifier) @name)`,
101
+ nameCapture: "name",
102
+ },
103
+ },
104
+
105
+ go: {
106
+ function: {
107
+ query: `(function_declaration name: (identifier) @name)`,
108
+ nameCapture: "name",
109
+ },
110
+ type: {
111
+ query: `(type_declaration (type_spec name: (type_identifier) @name))`,
112
+ nameCapture: "name",
113
+ },
114
+ method: {
115
+ query: `(method_declaration name: (field_identifier) @name)`,
116
+ nameCapture: "name",
117
+ },
118
+ variable: {
119
+ query: `(var_declaration (var_spec name: (identifier) @name))`,
120
+ nameCapture: "name",
121
+ },
122
+ const: {
123
+ query: `(const_declaration (const_spec name: (identifier) @name))`,
124
+ nameCapture: "name",
125
+ },
126
+ },
127
+
128
+ rust: {
129
+ function: {
130
+ query: `(function_item name: (identifier) @name)`,
131
+ nameCapture: "name",
132
+ },
133
+ struct: {
134
+ query: `(struct_item name: (type_identifier) @name)`,
135
+ nameCapture: "name",
136
+ },
137
+ enum: {
138
+ query: `(enum_item name: (type_identifier) @name)`,
139
+ nameCapture: "name",
140
+ },
141
+ impl: {
142
+ query: `(impl_item type: (type_identifier) @name)`,
143
+ nameCapture: "name",
144
+ },
145
+ trait: {
146
+ query: `(trait_item name: (type_identifier) @name)`,
147
+ nameCapture: "name",
148
+ },
149
+ const: {
150
+ query: `(const_item name: (identifier) @name)`,
151
+ nameCapture: "name",
152
+ },
153
+ },
154
+
155
+ java: {
156
+ class: {
157
+ query: `(class_declaration name: (identifier) @name)`,
158
+ nameCapture: "name",
159
+ },
160
+ interface: {
161
+ query: `(interface_declaration name: (identifier) @name)`,
162
+ nameCapture: "name",
163
+ },
164
+ method: {
165
+ query: `(method_declaration name: (identifier) @name)`,
166
+ nameCapture: "name",
167
+ },
168
+ field: {
169
+ query: `(field_declaration declarator: (variable_declarator name: (identifier) @name))`,
170
+ nameCapture: "name",
171
+ },
172
+ enum: {
173
+ query: `(enum_declaration name: (identifier) @name)`,
174
+ nameCapture: "name",
175
+ },
176
+ },
177
+
178
+ ruby: {
179
+ function: {
180
+ query: `(method name: (identifier) @name)`,
181
+ nameCapture: "name",
182
+ },
183
+ class: {
184
+ query: `(class name: (constant) @name)`,
185
+ nameCapture: "name",
186
+ },
187
+ module: {
188
+ query: `(module name: (constant) @name)`,
189
+ nameCapture: "name",
190
+ },
191
+ },
192
+
193
+ swift: {
194
+ function: {
195
+ query: `(function_declaration name: (simple_identifier) @name)`,
196
+ nameCapture: "name",
197
+ },
198
+ class: {
199
+ query: `(class_declaration name: (type_identifier) @name)`,
200
+ nameCapture: "name",
201
+ },
202
+ struct: {
203
+ query: `(struct_declaration name: (type_identifier) @name)`,
204
+ nameCapture: "name",
205
+ },
206
+ enum: {
207
+ query: `(enum_declaration name: (type_identifier) @name)`,
208
+ nameCapture: "name",
209
+ },
210
+ protocol: {
211
+ query: `(protocol_declaration name: (type_identifier) @name)`,
212
+ nameCapture: "name",
213
+ },
214
+ },
215
+ };
216
+
217
+ /**
218
+ * Extension to language mapping
219
+ */
220
+ export const extensionToLanguage: Record<string, string> = {
221
+ ".ts": "typescript",
222
+ ".tsx": "typescript",
223
+ ".js": "javascript",
224
+ ".jsx": "javascript",
225
+ ".mjs": "javascript",
226
+ ".cjs": "javascript",
227
+ ".py": "python",
228
+ ".go": "go",
229
+ ".rs": "rust",
230
+ ".java": "java",
231
+ ".rb": "ruby",
232
+ ".swift": "swift",
233
+ };
234
+
235
+ /**
236
+ * Get the language for a file extension
237
+ */
238
+ export function getLanguageForExtension(ext: string): string | null {
239
+ return extensionToLanguage[ext] || null;
240
+ }
241
+
242
+ /**
243
+ * Get queries for a language
244
+ */
245
+ export function getQueriesForLanguage(language: string): LanguageQueries | null {
246
+ return languageQueries[language] || null;
247
+ }
248
+
249
+ /**
250
+ * Check if a language is supported
251
+ */
252
+ export function isLanguageSupported(language: string): boolean {
253
+ return language in languageQueries;
254
+ }
255
+
256
+ /**
257
+ * Get all supported extensions
258
+ */
259
+ export function getSupportedExtensions(): string[] {
260
+ return Object.keys(extensionToLanguage);
261
+ }