@kaiord/cli 0.1.1 → 2.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pablo Albaladejo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -87,6 +87,62 @@ Example `tolerance.json`:
87
87
  }
88
88
  ```
89
89
 
90
+ ## Configuration File
91
+
92
+ You can create a `.kaiordrc.json` file to set default options. The CLI will search for this file in:
93
+
94
+ 1. Current working directory
95
+ 2. User home directory (`~/.kaiordrc.json`)
96
+
97
+ CLI options always take precedence over config file defaults.
98
+
99
+ ### Example Configuration
100
+
101
+ Create `.kaiordrc.json` in your project or home directory:
102
+
103
+ ```json
104
+ {
105
+ "defaultInputFormat": "fit",
106
+ "defaultOutputFormat": "krd",
107
+ "defaultOutputDir": "./converted",
108
+ "defaultToleranceConfig": "./tolerance.json",
109
+ "verbose": false,
110
+ "quiet": false,
111
+ "json": false,
112
+ "logFormat": "pretty"
113
+ }
114
+ ```
115
+
116
+ ### Configuration Options
117
+
118
+ - **defaultInputFormat**: Default input format (`fit`, `krd`, `tcx`, `zwo`)
119
+ - **defaultOutputFormat**: Default output format (`fit`, `krd`, `tcx`, `zwo`)
120
+ - **defaultOutputDir**: Default output directory for batch conversions
121
+ - **defaultToleranceConfig**: Path to default tolerance configuration file
122
+ - **verbose**: Enable verbose logging by default
123
+ - **quiet**: Enable quiet mode by default
124
+ - **json**: Enable JSON output by default
125
+ - **logFormat**: Default log format (`pretty` or `structured`)
126
+
127
+ ### Usage with Config File
128
+
129
+ With a config file, you can simplify your commands:
130
+
131
+ ```bash
132
+ # Without config file
133
+ kaiord convert --input workout.fit --output workout.krd --output-format krd
134
+
135
+ # With config file (defaultOutputFormat: "krd")
136
+ kaiord convert --input workout.fit --output workout.krd
137
+ ```
138
+
139
+ CLI options override config defaults:
140
+
141
+ ```bash
142
+ # Config has verbose: true, but --quiet overrides it
143
+ kaiord convert --input workout.fit --output workout.krd --quiet
144
+ ```
145
+
90
146
  ## Global Options
91
147
 
92
148
  ### Verbosity Control
@@ -112,14 +168,6 @@ kaiord convert --input workout.fit --output workout.krd --log-format pretty
112
168
  kaiord convert --input workout.fit --output workout.krd --log-format json
113
169
  ```
114
170
 
115
- ## Environment Variables
116
-
117
- The CLI automatically detects the environment and adjusts its behavior:
118
-
119
- - **CI=true**: Enables structured JSON logging
120
- - **NODE_ENV=production**: Enables structured JSON logging
121
- - **TTY detection**: Automatically disables colors and spinners in non-interactive environments
122
-
123
171
  ## Supported Formats
124
172
 
125
173
  - **FIT** (.fit) - Garmin's binary workout file format
@@ -127,47 +175,63 @@ The CLI automatically detects the environment and adjusts its behavior:
127
175
  - **TCX** (.tcx) - Training Center XML format
128
176
  - **ZWO** (.zwo) - Zwift workout XML format
129
177
 
130
- ## Exit Codes
178
+ ### Plugin System (Future Enhancement)
131
179
 
132
- - **0**: Success
133
- - **1**: Error (invalid arguments, file not found, parsing error, validation error)
180
+ The CLI is designed with a plugin architecture that will allow third-party developers to add support for custom workout file formats without modifying the core library. See [Plugin Architecture Documentation](./docs/plugin-architecture.md) for details on the design.
134
181
 
135
- ## Troubleshooting
182
+ **Planned Features:**
136
183
 
137
- ### File Not Found
184
+ - Dynamic plugin discovery and loading
185
+ - Type-safe plugin interface
186
+ - Automatic format detection for plugin formats
187
+ - Plugin configuration via `.kaiordrc.json`
188
+ - Plugin management commands (`kaiord plugins list`, `install`, etc.)
138
189
 
139
- Ensure the input file path is correct and the file exists:
190
+ **Example Plugin Usage (Future):**
140
191
 
141
192
  ```bash
142
- ls -la workout.fit
143
- kaiord convert --input workout.fit --output workout.krd
193
+ # Install a plugin
194
+ npm install -g @kaiord/plugin-gpx
195
+
196
+ # Use plugin format
197
+ kaiord convert --input workout.gpx --output workout.krd
144
198
  ```
145
199
 
146
- ### Permission Errors
200
+ See [Example GPX Plugin](./docs/example-plugin-gpx.md) for a complete plugin implementation example.
147
201
 
148
- Check file permissions:
202
+ ## Exit Codes
149
203
 
150
- ```bash
151
- chmod 644 workout.fit
152
- kaiord convert --input workout.fit --output workout.krd
153
- ```
204
+ - **0**: Success
205
+ - **1**: Error (invalid arguments, file not found, parsing error, validation error)
154
206
 
155
- ### Format Detection Issues
207
+ ## Documentation
156
208
 
157
- If automatic format detection fails, use explicit format flags:
209
+ ### Main Documentation
158
210
 
159
- ```bash
160
- kaiord convert --input data.bin --input-format fit --output workout.krd --output-format krd
161
- ```
211
+ - **[Getting Started](../../docs/getting-started.md)** - Installation and basic usage
212
+ - **[KRD Format Specification](../../docs/krd-format.md)** - Complete format documentation
213
+ - **[Deployment Guide](../../docs/deployment.md)** - CI/CD and npm publishing
214
+
215
+ ### Package-Specific Documentation
162
216
 
163
- ### Corrupted Files
217
+ - **[npm Publish Verification](./docs/npm-publish-verification.md)** - Publishing checklist and verification
164
218
 
165
- If a file is corrupted, the CLI will display a descriptive error message:
219
+ ## Development
166
220
 
167
221
  ```bash
168
- kaiord convert --input corrupted.fit --output workout.krd
169
- # Error: Failed to parse FIT file
170
- # Details: Corrupted file header
222
+ # Install dependencies
223
+ pnpm install
224
+
225
+ # Build the CLI
226
+ pnpm build
227
+
228
+ # Run in development mode
229
+ pnpm dev -- convert --input workout.fit --output workout.krd
230
+
231
+ # Link for local testing
232
+ npm link
233
+ kaiord --version
234
+ npm unlink -g
171
235
  ```
172
236
 
173
237
  ## Testing
@@ -191,37 +255,6 @@ pnpm test:smoke
191
255
  pnpm test:watch
192
256
  ```
193
257
 
194
- ## Development
195
-
196
- ```bash
197
- # Install dependencies
198
- pnpm install
199
-
200
- # Build the CLI
201
- pnpm build
202
-
203
- # Run in development mode
204
- pnpm dev -- convert --input workout.fit --output workout.krd
205
-
206
- # Link for local testing
207
- npm link
208
- kaiord --version
209
- npm unlink -g
210
- ```
211
-
212
- ## Documentation
213
-
214
- For more information about the Kaiord project and the KRD format, see:
215
-
216
- - [Kaiord Core Library](https://github.com/your-org/kaiord/tree/main/packages/core)
217
- - [KRD Format Specification](https://github.com/your-org/kaiord/blob/main/docs/KRD_FORMAT.md)
218
- - [Contributing Guide](https://github.com/your-org/kaiord/blob/main/CONTRIBUTING.md)
219
-
220
258
  ## License
221
259
 
222
260
  MIT - See [LICENSE](../../LICENSE) file for details.
223
-
224
- ## Support
225
-
226
- - Report issues: [GitHub Issues](https://github.com/your-org/kaiord/issues)
227
- - Ask questions: [GitHub Discussions](https://github.com/your-org/kaiord/discussions)