|
| 1 | +# Technical Documentation |
| 2 | + |
| 3 | +This document contains technical details about the Simple Coding Time Tracker VS Code extension, including development setup, release processes, and internal architecture. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | +- Node.js 18 or higher |
| 9 | +- Visual Studio Code |
| 10 | +- Git |
| 11 | + |
| 12 | +### Project Structure |
| 13 | +``` |
| 14 | +vsc-ext-coding-time-tracker/ |
| 15 | +├── src/ # Source code |
| 16 | +│ ├── extension.ts # Main extension file |
| 17 | +│ ├── statusBar.ts # Status bar functionality |
| 18 | +│ ├── summaryView.ts # Summary view implementation |
| 19 | +│ ├── timeTracker.ts # Time tracking logic |
| 20 | +│ ├── database.ts # Database operations |
| 21 | +│ └── utils.ts # Utility functions |
| 22 | +├── scripts/ # Development scripts |
| 23 | +│ └── generate-test-data.js # Test data generation |
| 24 | +├── .github/workflows/ # GitHub Actions workflows |
| 25 | +│ ├── release.yml # Release automation |
| 26 | +│ └── publish.yml # Marketplace publishing |
| 27 | +└── images/ # Documentation images |
| 28 | +``` |
| 29 | + |
| 30 | +## Release Process |
| 31 | + |
| 32 | +The extension uses GitHub Actions to automate the release process. There are two types of releases supported: |
| 33 | + |
| 34 | +### Beta Releases |
| 35 | + |
| 36 | +Beta releases are pre-release versions used for testing new features or changes before a stable release. |
| 37 | + |
| 38 | +To create a beta release: |
| 39 | +```bash |
| 40 | +git tag v<version>-beta.<number> |
| 41 | +git push origin v<version>-beta.<number> |
| 42 | +``` |
| 43 | + |
| 44 | +Example: |
| 45 | +```bash |
| 46 | +git tag v3.2.1-beta.1 |
| 47 | +git push origin v3.2.1-beta.1 |
| 48 | +``` |
| 49 | + |
| 50 | +For multiple beta releases of the same version, increment the beta number: |
| 51 | +- v3.2.1-beta.1 |
| 52 | +- v3.2.1-beta.2 |
| 53 | +- v3.2.1-beta.3 |
| 54 | + |
| 55 | +### Production Releases |
| 56 | + |
| 57 | +Production releases are stable versions ready for general use. |
| 58 | + |
| 59 | +To create a production release: |
| 60 | +```bash |
| 61 | +git tag v<version> |
| 62 | +git push origin v<version> |
| 63 | +``` |
| 64 | + |
| 65 | +Example: |
| 66 | +```bash |
| 67 | +git tag v3.2.1 |
| 68 | +git push origin v3.2.1 |
| 69 | +``` |
| 70 | + |
| 71 | +### Automated Actions |
| 72 | + |
| 73 | +When a tag is pushed, the following automated actions are performed: |
| 74 | + |
| 75 | +1. **Build Process**: |
| 76 | + - Checks out the code |
| 77 | + - Sets up Node.js environment |
| 78 | + - Installs dependencies |
| 79 | + - Compiles the TypeScript code |
| 80 | + - Packages the VS Code extension (.vsix file) |
| 81 | + |
| 82 | +2. **Release Creation**: |
| 83 | + - Creates a GitHub release |
| 84 | + - Attaches the .vsix package to the release |
| 85 | + - Sets appropriate release metadata: |
| 86 | + - For beta releases: |
| 87 | + - Marked as "pre-release" |
| 88 | + - Tagged with "🧪 Beta Release" |
| 89 | + - Includes beta warning message |
| 90 | + - For production releases: |
| 91 | + - Marked as full release |
| 92 | + - Tagged with "🚀 Release" |
| 93 | + - Includes stable release message |
| 94 | + - Links to CHANGELOG.md for detailed changes |
| 95 | + |
| 96 | +3. **Extension Publishing**: |
| 97 | + - Automatically publishes the extension to the Visual Studio Code Marketplace |
| 98 | + - Updates the extension version and metadata |
| 99 | + |
| 100 | +### Best Practices |
| 101 | + |
| 102 | +- Create beta releases from feature branches when testing new functionality |
| 103 | +- Create production releases only from the main branch |
| 104 | +- Always update the CHANGELOG.md before creating a new release |
| 105 | +- Keep version numbers consistent between beta and production releases |
| 106 | +- Follow semantic versioning (MAJOR.MINOR.PATCH) |
| 107 | +- Test beta releases thoroughly before creating a production release |
| 108 | + |
| 109 | +### Release Files |
| 110 | + |
| 111 | +The release process is defined in two GitHub Actions workflow files: |
| 112 | + |
| 113 | +1. `.github/workflows/release.yml`: Handles the release creation process |
| 114 | +2. `.github/workflows/publish.yml`: Handles publishing to the VS Code Marketplace |
| 115 | + |
| 116 | +## Internal Architecture |
| 117 | + |
| 118 | +### Core Components |
| 119 | + |
| 120 | +1. **Extension Entry Point (`extension.ts`)** |
| 121 | + - Activates the extension |
| 122 | + - Initializes core components |
| 123 | + - Registers VS Code commands |
| 124 | + - Handles workspace events |
| 125 | + |
| 126 | +2. **Time Tracker (`timeTracker.ts`)** |
| 127 | + - Core time tracking logic |
| 128 | + - Activity detection |
| 129 | + - Session management |
| 130 | + - Project identification |
| 131 | + |
| 132 | +3. **Database (`database.ts`)** |
| 133 | + - Data persistence layer |
| 134 | + - Time entry storage |
| 135 | + - Summary data generation |
| 136 | + - Search functionality |
| 137 | + |
| 138 | +4. **Status Bar (`statusBar.ts`)** |
| 139 | + - Real-time time display |
| 140 | + - Activity status indication |
| 141 | + - Quick access to commands |
| 142 | + - Tooltip information |
| 143 | + |
| 144 | +5. **Summary View (`summaryView.ts`)** |
| 145 | + - Interactive data visualization |
| 146 | + - Chart rendering |
| 147 | + - Search and filtering |
| 148 | + - Data export |
| 149 | + |
| 150 | +6. **Utilities (`utils.ts`)** |
| 151 | + - Time formatting |
| 152 | + - Data processing |
| 153 | + - Helper functions |
| 154 | + |
| 155 | +### Data Flow |
| 156 | + |
| 157 | +1. User activity triggers events in VS Code |
| 158 | +2. TimeTracker processes these events and tracks active time |
| 159 | +3. Data is periodically saved to the Database |
| 160 | +4. StatusBar updates in real-time |
| 161 | +5. SummaryView queries the Database for visualization |
| 162 | + |
| 163 | +### Configuration Options |
| 164 | + |
| 165 | +The extension supports several configuration options in `package.json`: |
| 166 | + |
| 167 | +```json |
| 168 | +{ |
| 169 | + "simpleCodingTimeTracker.saveInterval": { |
| 170 | + "type": "number", |
| 171 | + "default": 5, |
| 172 | + "description": "Interval in seconds to save the current coding session" |
| 173 | + }, |
| 174 | + "simpleCodingTimeTracker.inactivityTimeout": { |
| 175 | + "type": "number", |
| 176 | + "default": 300, |
| 177 | + "description": "Time in seconds of inactivity before tracking stops" |
| 178 | + } |
| 179 | +} |
| 180 | +``` |
| 181 | + |
| 182 | +## Contributing |
| 183 | + |
| 184 | +For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.md). |
| 185 | + |
| 186 | +## Testing |
| 187 | + |
| 188 | +### Generate Test Data |
| 189 | + |
| 190 | +The extension includes a script to generate test data for development: [ON PROGRESS] |
| 191 | + |
| 192 | +```bash |
| 193 | +npm run generate-test-data |
| 194 | +``` |
| 195 | + |
| 196 | +This will create sample time entries for the last 90 days with varied projects and durations. |
| 197 | + |
| 198 | +### Manual Testing Checklist |
| 199 | + |
| 200 | +Before submitting a pull request: |
| 201 | + |
| 202 | +1. Verify time tracking starts/stops correctly |
| 203 | +2. Check status bar updates |
| 204 | +3. Test inactivity detection |
| 205 | +4. Validate data persistence |
| 206 | +5. Check summary view visualizations |
| 207 | +6. Test search and filtering |
| 208 | +7. Verify theme compatibility |
0 commit comments