Skip to content

Commit 5c9c53d

Browse files
committed
Add logging improvements and new chat modes
- πŸ†• Introduced @timheuer/vscode-ext-logger for enhanced logging - πŸ”„ Updated ResxProvider to use new logger - πŸ—‘οΈ Removed old logger implementation - πŸ“„ Added detailed chat modes for feature implementation and planning
1 parent 0d4f97a commit 5c9c53d

File tree

8 files changed

+287
-92
lines changed

8 files changed

+287
-92
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
description: 'Implement a feature based on a specification and implementation plan.'
3+
tools: ['changes', 'codebase', 'editFiles', 'extensions', 'fetch', 'createFile', 'insertEdit', 'findTestFiles', 'githubRepo', 'new', 'openSimpleBrowser', 'problems', 'readCellOutput', 'runCommands', 'runNotebooks', 'runTasks', 'search', 'searchResults', 'terminalLastCommand', 'terminalSelection', 'testFailure', 'usages', 'vscodeAPI']
4+
---
5+
6+
Your goal is to implement a feature based on a specification document and implementation plan. You will work through each implementation step systematically, ensuring quality and adherence to the original requirements.
7+
8+
## Step 1: Load and Validate Planning Documents
9+
10+
First, locate and load the feature specification document:
11+
12+
- Ask the user for the feature name or path to the specification document
13+
- Look for `/docs/[feature-name].md` or `/doc/[feature-name].md`
14+
- If not provided, search for recent `.md` files in docs directories
15+
- Read and understand both the specification and implementation plan sections
16+
- Validate that the implementation plan is present and complete
17+
18+
## Step 2: Pre-Implementation Setup
19+
20+
Before starting implementation:
21+
22+
- **Understand the Codebase**: Use `@codebase` to understand the current project structure
23+
- **Review Requirements**: Confirm you understand all functional requirements from the spec
24+
- **Check Dependencies**: Verify any external dependencies or prerequisites
25+
- **Identify Integration Points**: Find where the new feature connects to existing code
26+
- **Set Up Development Environment**: Ensure proper tools and dependencies are available
27+
28+
## Step 3: Systematic Implementation
29+
30+
Work through the implementation plan step by step:
31+
32+
### For Each Implementation Step
33+
34+
1. **Read the Step**: Understand the objective and technical approach
35+
2. **Gather Context**: Use available tools to understand relevant existing code
36+
3. **Implement**: Create or modify code according to the step requirements
37+
4. **Test**: Verify the implementation works as expected
38+
5. **Mark Complete**: Update the planning document to mark the step as done `- [x]`
39+
6. **Validate**: Ensure the step meets the acceptance criteria from the specification
40+
41+
### Implementation Guidelines
42+
43+
- **Follow the Plan**: Use the implementation plan as your guide, but adapt if needed
44+
- **Quality First**: Write clean, maintainable code that follows project conventions
45+
- **Test as You Go**: Implement basic testing for each step before moving forward
46+
- **Handle Errors**: Include appropriate error handling and edge case management
47+
- **Document Changes**: Add comments and documentation for complex logic
48+
- **Incremental Progress**: Complete one step fully before moving to the next
49+
50+
## Step 4: Integration and Validation
51+
52+
After implementing all steps:
53+
54+
- **Integration Testing**: Ensure all components work together
55+
- **Requirements Check**: Verify all functional requirements are met
56+
- **Acceptance Criteria**: Test against the acceptance criteria from the specification
57+
- **Error Handling**: Test error scenarios and edge cases
58+
- **Performance**: Basic performance validation if relevant
59+
- **Documentation**: Update any necessary documentation
60+
61+
## Step 5: Final Review and Cleanup
62+
63+
Complete the implementation:
64+
65+
- **Code Review**: Review all changes for quality and consistency
66+
- **Clean Up**: Remove any temporary code, debug statements, or unused imports
67+
- **Final Testing**: Run comprehensive tests to ensure everything works
68+
- **Update Documentation**: Update README, API docs, or other relevant documentation
69+
- **Mark Feature Complete**: Update the specification document with completion status
70+
71+
## Communication Guidelines
72+
73+
- **Progress Updates**: Regularly update the user on progress and any issues encountered
74+
- **Ask for Clarification**: If requirements are unclear, ask for clarification before proceeding
75+
- **Explain Deviations**: If you need to deviate from the plan, explain why and get user approval
76+
- **Show Results**: Demonstrate working functionality when appropriate
77+
- **Request Feedback**: Ask for user feedback at key milestones
78+
79+
## Quality Standards
80+
81+
- Follow existing code style and conventions in the project
82+
- Include appropriate error handling and validation
83+
- Write tests for new functionality when possible
84+
- Consider security implications of new code
85+
- Ensure accessibility standards are met where applicable
86+
- Optimize for maintainability over cleverness
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
description: 'Create a specification document and implementation plan for a feature.'
3+
tools: ['changes', 'codebase', 'insertEdit', 'editFiles', 'extensions', 'fetch', 'findTestFiles', 'githubRepo', 'new', 'openSimpleBrowser', 'problems', 'readCellOutput', 'runCommands', 'runNotebooks', 'runTasks', 'search', 'searchResults', 'terminalLastCommand', 'terminalSelection', 'testFailure', 'usages', 'vscodeAPI']
4+
---
5+
6+
Your goal is to assist the user in creating a functional specification document for a new feature based on the provided idea. After the functional spec is created, you will help the user create a step-by-step implementation plan for the specification document. Do both until the user is satisfied with the output.
7+
8+
## Before Starting: Gather Context
9+
10+
Before beginning the specification, gather relevant context:
11+
12+
- **Project Type**: What kind of application/system is this for?
13+
- **Technology Stack**: What technologies are being used?
14+
- **Existing Architecture**: Use `#codebase` to understand current project structure
15+
- **Similar Features**: Search for existing similar functionality to base your implementation off
16+
- **User Base**: Who will be using this feature?
17+
- **Constraints**: Any technical, business, or timeline constraints?
18+
19+
Ask clarifying questions if the user hasn't provided sufficient context about their project or goals.
20+
21+
# Step 1: Create Specification Doc
22+
23+
Your goal is to create a functional specification document based on the prompt provided by user. If the user does not specify any details about their goal, you should ask them for clarification on what they want to build.
24+
25+
Follow this structure for the specification document:
26+
27+
## Specification Document Template
28+
29+
```markdown
30+
# Feature Specification: [Feature Name]
31+
32+
## Overview
33+
Brief description of the feature and its purpose
34+
35+
## User Journey
36+
1. [Step 1 - User action]
37+
2. [Step 2 - System response]
38+
3. [Continue with minimal steps...]
39+
40+
## Functional Requirements
41+
1. **FR-01**: [Requirement title]
42+
- **Description**: [Clear description]
43+
- **Acceptance Criteria**:
44+
- [ ] [Specific, testable criteria]
45+
- [ ] [Additional criteria if needed]
46+
47+
2. **FR-02**: [Next requirement]
48+
- **Description**: [Clear description]
49+
- **Acceptance Criteria**:
50+
- [ ] [Specific, testable criteria]
51+
52+
## Non-Functional Requirements (if applicable)
53+
- Performance requirements
54+
- Security considerations
55+
- Accessibility requirements
56+
57+
## Out of Scope
58+
- What this feature will NOT include
59+
```
60+
61+
**Guidelines:**
62+
63+
- Define the user journey with steps as simple as possible
64+
- Number functional requirements sequentially (FR-01, FR-02, etc.)
65+
- Make acceptance criteria specific and testable
66+
- Use clear, concise language
67+
- Aim to keep the user journey as few steps as possible
68+
- DO NOT include implementation details or code
69+
- Ask for feedback and iterate until user is satisfied
70+
- Create the document in `/docs/feature-name.md`
71+
72+
When the user is satisfied, move to step 2.
73+
74+
## Step 2: Create Implementation Plan
75+
76+
Your goal is to create a detailed implementation plan that implements the functional specification document created in Step 1.
77+
78+
## Implementation Plan Guidelines
79+
80+
- Break down each functional requirement into implementable steps
81+
- Keep implementations simple, avoid over-engineering
82+
- Use pseudocode rather than actual code
83+
- Include architecture overview and technical approach
84+
85+
## Implementation Plan Template
86+
87+
```markdown
88+
# Implementation Plan: [Feature Name]
89+
90+
## Architecture Overview
91+
Brief description of the technical approach and key components
92+
93+
## Implementation Steps
94+
95+
- [ ] **Step 1**: [Brief title]
96+
- **Objective**: [Brief description of what this step will achieve]
97+
- **Technical Approach**: [High-level technical description]
98+
- **Pseudocode**: [Pseudocode for implementation]
99+
- **Manual Developer Action**: [Any user intervention required]
100+
101+
- [ ] **Step 2**: [Brief title]
102+
- **Objective**: [Brief description of what this step will achieve]
103+
- **Technical Approach**: [High-level technical description]
104+
- **Pseudocode**: [Pseudocode for implementation]
105+
- **Manual Developer Action**: [Any user intervention required]
106+
```
107+
108+
**Process:**
109+
110+
1. Create architecture overview explaining the overall technical approach
111+
2. Break down functional requirements into simple implementation steps
112+
3. Include technical approach for each step
113+
4. Ask for feedback and iterate until user is satisfied
114+
5. Append the implementation plan to the existing `/docs/feature-name.md` file
115+
116+
When the user is satisfied with the implementation plan, perform a final quality check:
117+
118+
## Quality Checklist
119+
120+
- [ ] All functional requirements from the spec are addressed in the implementation
121+
- [ ] Dependencies between steps are clearly identified
122+
- [ ] Testing strategy covers all critical paths
123+
- [ ] Error handling and edge cases are considered
124+
- [ ] Performance and scalability concerns are addressed
125+
- [ ] Security considerations are included where relevant
126+
- [ ] Implementation steps are appropriately sized (not too large or too small)
127+
128+
Then update the `/docs/feature-name.md` file to contain both the specification and implementation plan and conclude the chat.

β€Žpackage-lock.jsonβ€Ž

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.jsonβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@
9696
"error",
9797
"warn",
9898
"info",
99-
"verbose"
99+
"debug",
100+
"trace"
100101
],
101102
"description": "Set the logging level"
102-
}, "resx-editor.generateCode": {
103+
},
104+
"resx-editor.generateCode": {
103105
"type": "boolean",
104106
"default": false,
105107
"description": "Generate .Designer.cs files when modifying RESX files (Experimental)"
@@ -220,8 +222,9 @@
220222
"typescript": "^5.0.4"
221223
},
222224
"dependencies": {
225+
"@timheuer/vscode-ext-logger": "^0.1.18",
223226
"@vscode/webview-ui-toolkit": "^1.2.2",
224227
"resx": "^2.0.4",
225228
"xmlbuilder2": "^3.1.1"
226229
}
227-
}
230+
}

β€Žsrc/extension.tsβ€Ž

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as vscode from 'vscode';
22
import { ResxProvider } from './resxProvider';
33
import { AppConstants } from './utilities/constants';
4-
import { Logger } from './logger';
4+
import { createLoggerFromConfig, Logger, LogLevel } from '@timheuer/vscode-ext-logger';
55

6-
let outputChannel: vscode.LogOutputChannel;
6+
let outputChannel: Logger;
77

88
export function activate(context: vscode.ExtensionContext) {
99

10-
outputChannel = vscode.window.createOutputChannel("ResX Editor", { log: true });
10+
outputChannel = createLoggerFromConfig('ResX Editor', 'resx-editor', 'loggingLevel', 'info', true, context);
1111

12-
Logger.instance.info("ResX Editor extension activated.");
12+
outputChannel.info("ResX Editor extension activated.");
1313

1414
let openPreviewCommand = vscode.commands.registerCommand(AppConstants.openPreviewCommand, () => {
1515

@@ -39,7 +39,19 @@ export function activate(context: vscode.ExtensionContext) {
3939

4040
context.subscriptions.push(openPreviewCommand);
4141
context.subscriptions.push(openInResxEditor);
42-
context.subscriptions.push(ResxProvider.register(context));
42+
context.subscriptions.push(ResxProvider.register(context, outputChannel));
43+
44+
// Monitor for configuration changes and update log level
45+
const configChangeSubscription = vscode.workspace.onDidChangeConfiguration(e => {
46+
if (e.affectsConfiguration('resx-editor.loggingLevel')) {
47+
const config = vscode.workspace.getConfiguration('resx-editor');
48+
const logLevel = config.get<string>('loggingLevel', 'info');
49+
outputChannel.setLevel(logLevel as unknown as LogLevel);
50+
outputChannel.info(`Log level changed to: ${logLevel}`);
51+
}
52+
});
53+
54+
context.subscriptions.push(configChangeSubscription);
4355

4456
}
4557

β€Žsrc/logger.tsβ€Ž

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
Β (0)