knowzcode 0.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 (73) hide show
  1. package/.claude-plugin/marketplace.json +55 -0
  2. package/.claude-plugin/plugin.json +8 -0
  3. package/LICENSE +121 -0
  4. package/README.md +223 -0
  5. package/agents/analyst.md +121 -0
  6. package/agents/architect.md +121 -0
  7. package/agents/builder.md +155 -0
  8. package/agents/closer.md +148 -0
  9. package/agents/knowledge-migrator.md +349 -0
  10. package/agents/microfix-specialist.md +140 -0
  11. package/agents/reviewer.md +220 -0
  12. package/agents/update-coordinator.md +405 -0
  13. package/bin/knowzcode.mjs +869 -0
  14. package/commands/audit.md +108 -0
  15. package/commands/connect-mcp.md +507 -0
  16. package/commands/fix.md +107 -0
  17. package/commands/init.md +320 -0
  18. package/commands/learn.md +308 -0
  19. package/commands/plan.md +125 -0
  20. package/commands/register.md +724 -0
  21. package/commands/status.md +291 -0
  22. package/commands/telemetry-setup.md +368 -0
  23. package/commands/telemetry.md +188 -0
  24. package/commands/work.md +390 -0
  25. package/knowzcode/automation_manifest.md +59 -0
  26. package/knowzcode/claude_code_execution.md +133 -0
  27. package/knowzcode/enterprise/compliance_manifest.md +132 -0
  28. package/knowzcode/enterprise/compliance_status.md +30 -0
  29. package/knowzcode/enterprise/guidelines/code-quality.md +67 -0
  30. package/knowzcode/enterprise/guidelines/custom/.gitkeep +0 -0
  31. package/knowzcode/enterprise/guidelines/security.md +355 -0
  32. package/knowzcode/enterprise/reports/.gitkeep +0 -0
  33. package/knowzcode/enterprise/templates/guideline-template.md +55 -0
  34. package/knowzcode/gitignore.template +13 -0
  35. package/knowzcode/knowzcode_architecture.md +51 -0
  36. package/knowzcode/knowzcode_log.md +142 -0
  37. package/knowzcode/knowzcode_loop.md +515 -0
  38. package/knowzcode/knowzcode_project.md +233 -0
  39. package/knowzcode/knowzcode_tracker.md +40 -0
  40. package/knowzcode/knowzcode_vaults.md +104 -0
  41. package/knowzcode/mcp_config.md +166 -0
  42. package/knowzcode/planning/Readme.md +6 -0
  43. package/knowzcode/platform_adapters.md +388 -0
  44. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -0
  45. package/knowzcode/prompts/Investigate_Codebase.md +227 -0
  46. package/knowzcode/prompts/Migrate_Knowledge.md +301 -0
  47. package/knowzcode/prompts/Refactor_Node.md +72 -0
  48. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -0
  49. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -0
  50. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -0
  51. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -0
  52. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -0
  53. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -0
  54. package/knowzcode/specs/Readme.md +10 -0
  55. package/knowzcode/telemetry_config.md +89 -0
  56. package/knowzcode/user_preferences.md +120 -0
  57. package/package.json +53 -0
  58. package/skills/alias-resolver.json +15 -0
  59. package/skills/architecture-diff.json +12 -0
  60. package/skills/check-installation-status.json +14 -0
  61. package/skills/continue.md +105 -0
  62. package/skills/environment-guard.json +12 -0
  63. package/skills/generate-workgroup-id.json +25 -0
  64. package/skills/install-knowzcode.json +21 -0
  65. package/skills/load-core-context.json +18 -0
  66. package/skills/log-entry-builder.json +15 -0
  67. package/skills/spec-quality-check.json +14 -0
  68. package/skills/spec-template.json +15 -0
  69. package/skills/spec-validator.json +25 -0
  70. package/skills/start-work.md +224 -0
  71. package/skills/tracker-scan.json +12 -0
  72. package/skills/tracker-update.json +28 -0
  73. package/skills/validate-installation.json +14 -0
@@ -0,0 +1,291 @@
1
+ ---
2
+ description: Check KnowzCode MCP server connection status and available tools
3
+ ---
4
+
5
+ # KnowzCode MCP Connection Status
6
+
7
+ You are the **KnowzCode Status Agent**. Your task is to verify the KnowzCode MCP server configuration and test connectivity.
8
+
9
+ ## What This Checks
10
+
11
+ - MCP server configuration status
12
+ - Connection to KnowzCode API
13
+ - Available tools and their status
14
+ - API key validity
15
+ - **Code Vault** configuration and status
16
+ - **Research Vault** configuration and status
17
+ - Project indexing status
18
+
19
+ ## Your Task
20
+
21
+ Check the KnowzCode MCP server status and report findings to the user.
22
+
23
+ ### Steps to Execute
24
+
25
+ 1. **Check MCP server configuration**
26
+ ```bash
27
+ claude mcp get knowzcode
28
+ ```
29
+
30
+ - If configured: Extract scope, endpoint, headers
31
+ - If not configured: Report and suggest `/kc:connect`
32
+
33
+ 2. **Check vault configuration**
34
+ - **Primary**: Read `knowzcode/knowzcode_vaults.md` for multi-vault routing
35
+ - Parse `## Connected Vaults` section
36
+ - Extract all configured vaults (ID, Name, Type, Description)
37
+ - **Fallback**: Read `knowzcode/mcp_config.md` for legacy single-vault config
38
+ - Extract Code Vault ID and name
39
+ - Extract Research Vault ID and name
40
+ - Note if no vaults are configured
41
+
42
+ 3. **Verify connection and vault health (if configured)**
43
+ - The MCP server should automatically list its available tools
44
+ - Check if tools are accessible
45
+ - If vaults are configured, attempt `list_vaults(includeStats=true)` to verify vault accessibility
46
+ - Report vault document counts and last sync times
47
+ - If vault IDs are configured but inaccessible, show warning with remediation steps
48
+
49
+ 4. **Report status**
50
+
51
+ **If configured and working**:
52
+ ```
53
+ ✅ KnowzCode MCP Server: Connected
54
+
55
+ Configuration:
56
+ • Scope: <local|project|user>
57
+ • Endpoint: https://mcp.knowz.io/mcp
58
+ • Status: Active
59
+
60
+ Connected Vaults (from knowzcode_vaults.md):
61
+ ┌────┬──────────────────────┬──────────┬─────────────────────────────────┐
62
+ │ # │ Name │ Type │ Description (routing) │
63
+ ├────┼──────────────────────┼──────────┼─────────────────────────────────┤
64
+ │ 1 │ Engineering Knowledge│ research │ Patterns, decisions, conventions│
65
+ │ 2 │ my-project-code │ code │ Source code for main API │
66
+ │ 3 │ Team Wiki │ research │ Processes, onboarding │
67
+ └────┴──────────────────────┴──────────┴─────────────────────────────────┘
68
+
69
+ Vault Routing:
70
+ • Code questions → my-project-code
71
+ • Convention questions → Engineering Knowledge (default research)
72
+ • Learning capture → Engineering Knowledge (or prompt if ambiguous)
73
+
74
+ Available Tools:
75
+ ✓ search_knowledge - Vector search across vaults
76
+ ✓ ask_question - AI Q&A with research mode
77
+ ✓ create_knowledge - Save learnings to vault
78
+ ✓ update_knowledge - Update existing items
79
+ ✓ find_entities - Find people/locations/events
80
+
81
+ Project: <project-path>
82
+ Last sync: <if available>
83
+
84
+ All systems operational. Agents can use MCP tools.
85
+ ```
86
+
87
+ **If configured but not working**:
88
+ ```
89
+ ⚠️ KnowzCode MCP Server: Configured but unavailable
90
+
91
+ Configuration:
92
+ • Scope: <scope>
93
+ • Endpoint: <endpoint>
94
+ • Status: Cannot connect
95
+
96
+ Possible issues:
97
+ • API key may be invalid or expired
98
+ • Network connectivity issues
99
+ • KnowzCode API may be down
100
+
101
+ Troubleshooting:
102
+ 1. Check your internet connection
103
+ 2. Verify API key: https://knowz.io/api-keys
104
+ 3. Reconfigure: /kc:connect-mcp <new-key>
105
+ 4. Check status: https://status.knowz.io
106
+ ```
107
+
108
+ **If MCP connected but vaults not configured**:
109
+ ```
110
+ ⚠️ KnowzCode MCP Server: Connected (vaults not configured)
111
+
112
+ Configuration:
113
+ • Scope: <scope>
114
+ • Endpoint: <endpoint>
115
+ • Status: Active
116
+
117
+ Connected Vaults: ⚠️ None configured
118
+
119
+ MCP is connected but you haven't configured your vaults yet.
120
+ Vaults enable semantic search and learning capture.
121
+
122
+ To configure vaults:
123
+ /kc:connect-mcp --configure-vaults
124
+ (Interactive vault discovery and selection)
125
+
126
+ Or manually edit: knowzcode/knowzcode_vaults.md
127
+ ```
128
+
129
+ **If not configured at all**:
130
+ ```
131
+ ℹ️ KnowzCode MCP Server: Not configured
132
+
133
+ KnowzCode works fine without MCP! All core features work:
134
+ ✓ TDD workflow (/kc:work)
135
+ ✓ Spec generation
136
+ ✓ Impact analysis
137
+ ✓ Quality audits
138
+
139
+ MCP adds enhanced capabilities:
140
+ • Vector search across indexed code (Code Vault)
141
+ • Convention and pattern lookups (Research Vault)
142
+ • AI-powered Q&A with research mode
143
+ • Automatic learning capture
144
+
145
+ To enable these features:
146
+ New user? /kc:register (creates account + configures)
147
+ Have a key? /kc:connect-mcp <api-key>
148
+ ```
149
+
150
+ 5. **Additional diagnostics (if helpful)**
151
+ - Check if project is indexed (if MCP connected)
152
+ - Show vault document counts and last sync times
153
+ - Report any rate limiting or quota issues
154
+ - List any cached data available
155
+ - Show learning capture status (enabled/disabled)
156
+
157
+ ## Output Format
158
+
159
+ Use clear status indicators:
160
+ - ✅ Green check: Working perfectly
161
+ - ⚠️ Warning: Configured but issues
162
+ - ℹ️ Info: Not configured
163
+ - ❌ Error: Critical failure
164
+
165
+ ## Connection Details
166
+
167
+ If connection is active, optionally show:
168
+
169
+ ```
170
+ Connection Details:
171
+ • Response time: <ms>
172
+ • Tools loaded: <count>
173
+ • Cache status: <enabled/disabled>
174
+ • Rate limit: <remaining/total>
175
+ ```
176
+
177
+ ## MCP Tool Details
178
+
179
+ For each available tool, can optionally show:
180
+
181
+ ```
182
+ search_knowledge
183
+ Description: Vector similarity search across vaults
184
+ Vaults: Code Vault, Research Vault
185
+ Status: ✓ Available
186
+ Last used: <time>
187
+
188
+ ask_question
189
+ Description: AI-powered Q&A with optional research mode
190
+ Vaults: Research Vault (primary)
191
+ Research Mode: Enabled (8000+ token comprehensive answers)
192
+ Status: ✓ Available
193
+ Last used: <time>
194
+
195
+ create_knowledge
196
+ Description: Save learnings to research vault
197
+ Vaults: Research Vault (write)
198
+ Used by: closer, /kc:learn
199
+ Status: ✓ Available
200
+ Last used: <time>
201
+ ```
202
+
203
+ ## Vault Status Details
204
+
205
+ If vaults are configured, optionally show:
206
+
207
+ ```
208
+ Code Vault: my-project-code
209
+ • Documents indexed: <count>
210
+ • Last index: <timestamp>
211
+ • Index status: Up to date / Stale / Indexing...
212
+ • Paths: src/, tests/, packages/
213
+
214
+ Research Vault: engineering-knowledge
215
+ • Documents: <count>
216
+ • Notes: <count>
217
+ • Last updated: <timestamp>
218
+ • Top tags: architecture, security, patterns
219
+ ```
220
+
221
+ ## Error States
222
+
223
+ ### Invalid API Key
224
+ ```
225
+ ❌ Authentication Error
226
+ The API key is invalid or expired.
227
+
228
+ Update: /kc:connect-mcp <new-key>
229
+ ```
230
+
231
+ ### Network Issues
232
+ ```
233
+ ❌ Connection Error
234
+ Cannot reach KnowzCode API at <endpoint>
235
+
236
+ Check:
237
+ • Internet connection
238
+ • Firewall settings
239
+ • VPN configuration
240
+ ```
241
+
242
+ ### Service Down
243
+ ```
244
+ ❌ Service Unavailable
245
+ KnowzCode API is not responding.
246
+
247
+ Status: https://status.knowz.io
248
+ ```
249
+
250
+ ## Usage Examples
251
+
252
+ ### Basic status check
253
+ ```bash
254
+ /kc:status
255
+ ```
256
+
257
+ ### After configuration
258
+ ```bash
259
+ /kc:connect-mcp <api-key>
260
+ # ... restart Claude Code ...
261
+ /kc:status # Verify everything works
262
+ ```
263
+
264
+ ### Troubleshooting
265
+ ```bash
266
+ /kc:status # Check what's wrong
267
+ # Follow suggested remediation steps
268
+ ```
269
+
270
+ ## Integration Notes
271
+
272
+ This command is useful:
273
+ - **After initial setup**: Verify `/kc:connect` worked
274
+ - **When tools seem unavailable**: Debug MCP connection
275
+ - **Before starting work**: Confirm enhanced features active
276
+ - **Troubleshooting**: Diagnose connectivity issues
277
+
278
+ ## Related Commands
279
+
280
+ - `/kc:connect-mcp` - Configure MCP server
281
+ - `/kc:init` - Initialize KnowzCode
282
+ - `/kc:work` - Start feature (uses MCP if available)
283
+
284
+ ## Important Notes
285
+
286
+ - **Restart required**: After `/kc:connect-mcp`, Claude Code must restart
287
+ - **Graceful degradation**: KnowzCode works without MCP (just less powerful)
288
+ - **No credentials shown**: Never display full API keys
289
+ - **Clear guidance**: Always suggest next steps if issues found
290
+
291
+ Execute this status check now.
@@ -0,0 +1,368 @@
1
+ ---
2
+ description: "Configure telemetry sources (Sentry, App Insights) for /kc:telemetry"
3
+ argument-hint: "[sentry|appinsights|all]"
4
+ ---
5
+
6
+ # KnowzCode Telemetry Setup
7
+
8
+ Configure telemetry sources for `/kc:telemetry` investigations.
9
+
10
+ **Usage**: `/kc:telemetry-setup [scope]`
11
+
12
+ | Scope | Description |
13
+ |-------|-------------|
14
+ | `all` | Configure all detected sources (default) |
15
+ | `sentry` | Configure Sentry only |
16
+ | `appinsights` | Configure Azure App Insights only |
17
+
18
+ **Examples**:
19
+ ```
20
+ /kc:telemetry-setup
21
+ /kc:telemetry-setup sentry
22
+ /kc:telemetry-setup appinsights
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Workflow
28
+
29
+ ### Step 1: Detect Available Tools
30
+
31
+ Check which telemetry tools are available. **CLI is preferred when properly configured; MCP is a fallback.**
32
+
33
+ #### 1.1 Check Sentry CLI (Preferred)
34
+
35
+ ```bash
36
+ # Check Sentry CLI installation
37
+ which sentry-cli 2>/dev/null && echo "SENTRY_CLI_INSTALLED" || echo "NO_SENTRY_CLI"
38
+ ```
39
+
40
+ If installed, verify authentication:
41
+ ```bash
42
+ # Verify Sentry CLI is authenticated
43
+ sentry-cli info 2>&1 | grep -q "Organization" && echo "SENTRY_AUTHENTICATED" || echo "SENTRY_NOT_AUTHENTICATED"
44
+ ```
45
+
46
+ **If Sentry CLI installed + authenticated → use CLI method, skip MCP check for Sentry.**
47
+
48
+ #### 1.2 Check Sentry MCP (Fallback)
49
+
50
+ **Only check MCP if CLI is not available or not authenticated.**
51
+
52
+ Attempt to detect MCP by checking if Sentry MCP tools respond. The agent should:
53
+ 1. Try to use `sentry_search_issues` or `mcp__sentry__search_issues` with a minimal test query
54
+ 2. If it responds (even with "no results") → MCP is available
55
+ 3. If it errors with "tool not found" → MCP not configured
56
+
57
+ **If MCP available → use MCP method for Sentry.**
58
+
59
+ #### 1.3 Check Azure CLI + App Insights
60
+
61
+ ```bash
62
+ # Check Azure CLI
63
+ which az 2>/dev/null && echo "AZURE_CLI_INSTALLED" || echo "NO_AZURE_CLI"
64
+
65
+ # Check App Insights extension
66
+ az extension list --query "[?name=='application-insights'].name" -o tsv 2>/dev/null || echo "NO_APPINSIGHTS_EXTENSION"
67
+ ```
68
+
69
+ **Report detected tools and methods** before proceeding:
70
+
71
+ ```markdown
72
+ **Detection Results:**
73
+
74
+ | Source | Status | Method |
75
+ |--------|--------|--------|
76
+ | Sentry | ✓ Available | CLI (preferred) |
77
+ | App Insights | ✓ Available | CLI |
78
+
79
+ or
80
+
81
+ | Source | Status | Method |
82
+ |--------|--------|--------|
83
+ | Sentry | ✓ Available | MCP (CLI not configured) |
84
+ | App Insights | ✗ Not available | - |
85
+ ```
86
+
87
+ ### Step 2: Verify Authentication
88
+
89
+ For each installed tool, verify authentication:
90
+
91
+ ```bash
92
+ # Sentry: Check if authenticated
93
+ sentry-cli info 2>&1 | head -5
94
+
95
+ # Azure: Check if authenticated
96
+ az account show --query "{name:name, user:user.name}" -o table 2>&1 | head -5
97
+ ```
98
+
99
+ **If not authenticated**, provide setup instructions and stop for that source:
100
+
101
+ **For Sentry**:
102
+ ```markdown
103
+ ⚠️ Sentry CLI is installed but not authenticated.
104
+
105
+ Run these commands to authenticate:
106
+ \`\`\`bash
107
+ sentry-cli login
108
+ # OR set the auth token directly
109
+ export SENTRY_AUTH_TOKEN="your-token-here"
110
+ \`\`\`
111
+
112
+ Then run `/kc:telemetry-setup sentry` again.
113
+ ```
114
+
115
+ **For Azure**:
116
+ ```markdown
117
+ ⚠️ Azure CLI is installed but not authenticated.
118
+
119
+ Run these commands to authenticate:
120
+ \`\`\`bash
121
+ az login
122
+ az extension add --name application-insights # If not installed
123
+ \`\`\`
124
+
125
+ Then run `/kc:telemetry-setup appinsights` again.
126
+ ```
127
+
128
+ ### Step 3: Auto-Discover Resources
129
+
130
+ For each authenticated source, discover available resources:
131
+
132
+ **Sentry**:
133
+ ```bash
134
+ # List organizations
135
+ sentry-cli organizations list 2>/dev/null
136
+
137
+ # List projects (for each org)
138
+ sentry-cli projects list --org {org-slug} 2>/dev/null
139
+ ```
140
+
141
+ **Azure App Insights**:
142
+ ```bash
143
+ # List all App Insights resources
144
+ az monitor app-insights component list \
145
+ --query "[].{name:name, appId:appId, resourceGroup:resourceGroup}" \
146
+ -o table 2>/dev/null
147
+ ```
148
+
149
+ **Report discovered resources** in a clear format.
150
+
151
+ ### Step 4: Interactive Configuration
152
+
153
+ Present discovered resources and ask user to map environments:
154
+
155
+ ```markdown
156
+ ## Discovered Resources
157
+
158
+ ### Sentry Projects
159
+ | # | Organization | Project |
160
+ |---|--------------|---------|
161
+ | 1 | my-company | backend-api |
162
+ | 2 | my-company | frontend-web |
163
+ | 3 | my-company | worker-service |
164
+
165
+ ### App Insights Resources
166
+ | # | Name | App ID | Resource Group |
167
+ |---|------|--------|----------------|
168
+ | 1 | appinsights-prod | abc-123-def | rg-production |
169
+ | 2 | appinsights-staging | ghi-456-jkl | rg-staging |
170
+ | 3 | appinsights-dev | mno-789-pqr | rg-development |
171
+
172
+ ---
173
+
174
+ **Please map each environment to a resource:**
175
+
176
+ For Sentry:
177
+ - Production → (enter project number or skip)
178
+ - Staging → (enter project number or skip)
179
+ - Dev → (enter project number or skip)
180
+
181
+ For App Insights:
182
+ - Production → (enter resource number or skip)
183
+ - Staging → (enter resource number or skip)
184
+ - Dev → (enter resource number or skip)
185
+ ```
186
+
187
+ Use the AskUserQuestion tool to collect mappings if multiple resources exist.
188
+
189
+ ### Step 5: Save Configuration
190
+
191
+ Update `knowzcode/telemetry_config.md` with the discovered and mapped values.
192
+
193
+ **Include the detection method** (cli or mcp) for each source.
194
+
195
+ **Example result** (CLI method):
196
+
197
+ ```markdown
198
+ ## Sentry
199
+
200
+ | Field | Value |
201
+ |-------|-------|
202
+ | Enabled | true |
203
+ | Method | cli |
204
+ | Organization | my-company |
205
+
206
+ ### Environment Mapping
207
+
208
+ | Environment | Project |
209
+ |-------------|---------|
210
+ | production | my-company/backend-api |
211
+ | staging | my-company/backend-staging |
212
+ | dev | my-company/backend-dev |
213
+
214
+ ## Azure Application Insights
215
+
216
+ | Field | Value |
217
+ |-------|-------|
218
+ | Enabled | true |
219
+ | Subscription | 12345678-1234-1234-1234-123456789012 |
220
+ | Resource Group | rg-production |
221
+
222
+ ### Environment Mapping
223
+
224
+ | Environment | App Name | App ID |
225
+ |-------------|----------|--------|
226
+ | production | appinsights-prod | abc-123-def |
227
+ | staging | appinsights-staging | ghi-456-jkl |
228
+ | dev | appinsights-dev | mno-789-pqr |
229
+ ```
230
+
231
+ **Example result** (MCP method - when CLI not available):
232
+
233
+ ```markdown
234
+ ## Sentry
235
+
236
+ | Field | Value |
237
+ |-------|-------|
238
+ | Enabled | true |
239
+ | Method | mcp |
240
+ | Organization | my-company |
241
+
242
+ ### Environment Mapping
243
+
244
+ | Environment | Project |
245
+ |-------------|---------|
246
+ | production | my-company/backend-api |
247
+ | staging | my-company/backend-staging |
248
+ | dev | my-company/backend-dev |
249
+ ```
250
+
251
+ ### Step 6: Confirm Setup
252
+
253
+ After saving, show a summary **including the detection method**:
254
+
255
+ ```markdown
256
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
257
+ ◆ TELEMETRY CONFIGURATION COMPLETE
258
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
259
+
260
+ **Sentry**: ✓ Configured
261
+ - Method: CLI (preferred)
262
+ - Organization: my-company
263
+ - Environments mapped: production, staging, dev
264
+
265
+ **App Insights**: ✓ Configured
266
+ - Method: CLI
267
+ - Subscription: my-subscription
268
+ - Environments mapped: production, staging, dev
269
+
270
+ **Configuration saved to**: knowzcode/telemetry_config.md
271
+
272
+ You can now run:
273
+ /kc:telemetry "error 500 in staging in the last hour"
274
+
275
+ The telemetry investigator will automatically use the correct
276
+ project/resource for the specified environment.
277
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Error Handling
283
+
284
+ ### No Tools Installed
285
+
286
+ If NEITHER CLI nor MCP is available for a source, ask which to install:
287
+
288
+ ```markdown
289
+ ⚠️ No Sentry connection detected.
290
+
291
+ Would you like to set up Sentry? Choose an option:
292
+
293
+ **Option 1: Sentry CLI** (Recommended)
294
+ - Better error details and breadcrumbs
295
+ - Full issue management capabilities
296
+ \`\`\`bash
297
+ npm install -g @sentry/cli
298
+ sentry-cli login
299
+ \`\`\`
300
+
301
+ **Option 2: Sentry MCP**
302
+ - Configure Sentry MCP server in Claude Code settings
303
+ - Tools: `sentry_search_issues`, `sentry_get_issue_details`, `sentry_list_events`
304
+ - See: https://github.com/modelcontextprotocol/servers/tree/main/sentry
305
+
306
+ ---
307
+
308
+ ⚠️ No Azure App Insights connection detected.
309
+
310
+ **For Azure App Insights** (CLI only):
311
+ \`\`\`bash
312
+ # Install Azure CLI (if not installed)
313
+ brew install azure-cli # macOS
314
+ # or see https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
315
+
316
+ az login
317
+ az extension add --name application-insights
318
+ \`\`\`
319
+
320
+ Then run `/kc:telemetry-setup` again.
321
+ ```
322
+
323
+ ### No Resources Found
324
+
325
+ ```markdown
326
+ ⚠️ Authenticated but no resources found.
327
+
328
+ **Sentry**: No projects found for your account.
329
+ - Create a project at https://sentry.io
330
+
331
+ **App Insights**: No Application Insights resources found.
332
+ - Create one in Azure portal or via CLI:
333
+ \`\`\`bash
334
+ az monitor app-insights component create \
335
+ --app my-app-name \
336
+ --location eastus \
337
+ --resource-group my-rg
338
+ \`\`\`
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Configuration File Location
344
+
345
+ The configuration is saved to:
346
+ - **Path**: `knowzcode/telemetry_config.md`
347
+ - **Git**: Should be committed (shared team configuration)
348
+ - **Override**: Team members can edit locally if needed
349
+
350
+ For sensitive tokens, use environment variables instead of the config file:
351
+ - `SENTRY_AUTH_TOKEN` - Sentry authentication
352
+ - `AZURE_*` - Azure CLI uses `az login` session
353
+
354
+ ---
355
+
356
+ ## Verification
357
+
358
+ After setup, test the configuration:
359
+
360
+ ```bash
361
+ /kc:telemetry "test query in production in the last 5 min"
362
+ ```
363
+
364
+ This should:
365
+ 1. Load the config from `knowzcode/telemetry_config.md`
366
+ 2. Map "production" to the configured project/app
367
+ 3. Query the correct telemetry source
368
+ 4. Return results (or "no events found" if no matching errors)