@k67/kaitai-struct-ts 0.5.0 → 0.7.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.
- package/README.md +97 -34
- package/dist/cli.js +2776 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
@@ -46,6 +46,33 @@ yarn add @k67/kaitai-struct-ts
|
|
46
46
|
|
47
47
|
## Quick Start
|
48
48
|
|
49
|
+
### CLI Usage
|
50
|
+
|
51
|
+
Parse binary files directly from the command line:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
# Using npx (no installation needed)
|
55
|
+
npx @k67/kaitai-struct-ts format.ksy data.bin
|
56
|
+
|
57
|
+
# Or with pnpm
|
58
|
+
pnpx @k67/kaitai-struct-ts format.ksy data.bin
|
59
|
+
|
60
|
+
# After installing globally
|
61
|
+
npm install -g @k67/kaitai-struct-ts
|
62
|
+
kaitai format.ksy data.bin
|
63
|
+
|
64
|
+
# Save output to file
|
65
|
+
kaitai format.ksy data.bin -o output.json
|
66
|
+
|
67
|
+
# Extract specific field
|
68
|
+
kaitai format.ksy data.bin --field header.version
|
69
|
+
|
70
|
+
# Get help
|
71
|
+
kaitai --help
|
72
|
+
```
|
73
|
+
|
74
|
+
### Library Usage
|
75
|
+
|
49
76
|
```typescript
|
50
77
|
import { parse, KaitaiStream } from '@k67/kaitai-struct-ts'
|
51
78
|
import { readFileSync } from 'fs'
|
@@ -70,7 +97,7 @@ seq:
|
|
70
97
|
const binaryData = readFileSync('data.bin')
|
71
98
|
|
72
99
|
// Parse!
|
73
|
-
const result =
|
100
|
+
const result = parse(ksyDefinition, binaryData)
|
74
101
|
|
75
102
|
console.log(result.version) // Access parsed fields
|
76
103
|
console.log(result.name)
|
@@ -78,26 +105,26 @@ console.log(result.name)
|
|
78
105
|
|
79
106
|
## Current Status
|
80
107
|
|
81
|
-
**
|
108
|
+
**Version:** 0.7.0
|
109
|
+
**Status:** Production Ready 🚀
|
110
|
+
**Completion:** ~95% toward v1.0.0
|
82
111
|
|
83
|
-
###
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
- [x] Comprehensive tests (58 tests passing)
|
112
|
+
### ✅ Fully Implemented
|
113
|
+
- **Core Runtime** - Complete binary stream reader with all primitive types
|
114
|
+
- **KSY Parser** - Full YAML parser with schema validation
|
115
|
+
- **Type Interpreter** - Execute schemas against binary data
|
116
|
+
- **Expression Evaluator** - Complete Kaitai expression language support
|
117
|
+
- **Advanced Features** - Conditionals, enums, repetitions, instances, switch/case
|
118
|
+
- **CLI Tool** - Command-line utility for parsing binary files
|
119
|
+
- **Testing** - 100+ comprehensive tests, all passing
|
120
|
+
- **Documentation** - Complete user and developer documentation
|
93
121
|
|
94
|
-
###
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
- [ ] repeat-until
|
122
|
+
### 🔄 Remaining for v1.0.0
|
123
|
+
- Substream processing (zlib, encryption)
|
124
|
+
- Type imports across files
|
125
|
+
- Additional performance optimizations
|
99
126
|
|
100
|
-
See [
|
127
|
+
See [docs/development/PROGRESS.md](./docs/development/PROGRESS.md) for detailed progress tracking and [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) for architecture diagrams.
|
101
128
|
|
102
129
|
## API Documentation
|
103
130
|
|
@@ -131,6 +158,30 @@ const value = stream.readU4le() // Read 4-byte unsigned little-endian integer
|
|
131
158
|
|
132
159
|
See [API Documentation](./docs/api.md) for complete reference (coming soon).
|
133
160
|
|
161
|
+
## CLI Reference
|
162
|
+
|
163
|
+
The `kaitai` command-line tool allows you to parse binary files without writing code.
|
164
|
+
|
165
|
+
```bash
|
166
|
+
# Basic usage
|
167
|
+
kaitai <ksy-file> <binary-file> [options]
|
168
|
+
|
169
|
+
# Examples
|
170
|
+
kaitai format.ksy data.bin # Parse and display
|
171
|
+
kaitai format.ksy data.bin -o result.json # Save to file
|
172
|
+
kaitai format.ksy data.bin --field version # Extract field
|
173
|
+
kaitai format.ksy data.bin --quiet # Quiet mode
|
174
|
+
```
|
175
|
+
|
176
|
+
**📖 Full CLI Documentation:** [docs/CLI.md](./docs/CLI.md)
|
177
|
+
|
178
|
+
**Quick Reference:**
|
179
|
+
- `-o, --output <file>` - Write to file
|
180
|
+
- `--field <path>` - Extract specific field
|
181
|
+
- `-q, --quiet` - Suppress progress messages
|
182
|
+
- `-h, --help` - Show help
|
183
|
+
- See [docs/CLI.md](./docs/CLI.md) for all options and examples
|
184
|
+
|
134
185
|
## Examples
|
135
186
|
|
136
187
|
Check the [examples](./examples) directory for more usage examples:
|
@@ -167,30 +218,42 @@ pnpm format
|
|
167
218
|
|
168
219
|
## Roadmap
|
169
220
|
|
170
|
-
### Phase 1: Foundation (
|
171
|
-
- ✅
|
172
|
-
- ✅
|
173
|
-
- ✅
|
174
|
-
- ✅ String encoding support
|
221
|
+
### ✅ Phase 1: Foundation (v0.1.0) - Complete
|
222
|
+
- ✅ Binary stream reader (KaitaiStream)
|
223
|
+
- ✅ All primitive types (u1-u8, s1-s8, f4, f8)
|
224
|
+
- ✅ String encoding (UTF-8, ASCII, Latin-1, UTF-16)
|
175
225
|
- ✅ Byte arrays and positioning
|
226
|
+
- ✅ Error handling system
|
176
227
|
|
177
|
-
### Phase 2: Core Features -
|
228
|
+
### ✅ Phase 2: Core Features (v0.2.0-v0.4.0) - Complete
|
229
|
+
- ✅ KSY parser with validation
|
230
|
+
- ✅ Type interpreter
|
178
231
|
- ✅ Expression evaluator (full Kaitai expression language)
|
179
232
|
- ✅ Conditionals (if attribute)
|
180
233
|
- ✅ Enums with expression access
|
181
234
|
- ✅ Repetitions (repeat-expr, repeat-until, repeat-eos)
|
182
|
-
- ✅
|
235
|
+
- ✅ Nested user-defined types
|
183
236
|
|
184
|
-
### Phase 3: Advanced Features -
|
237
|
+
### ✅ Phase 3: Advanced Features (v0.5.0-v0.6.0) - Complete
|
185
238
|
- ✅ Switch/case type selection
|
186
|
-
- ✅ Instances (lazy-evaluated fields)
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
-
|
191
|
-
|
192
|
-
|
193
|
-
|
239
|
+
- ✅ Instances (lazy-evaluated fields with caching)
|
240
|
+
- ✅ Parametric types
|
241
|
+
- ✅ Positioned reads (pos attribute)
|
242
|
+
- ✅ Sized substreams
|
243
|
+
- ✅ Processing framework (ready for zlib/encryption)
|
244
|
+
|
245
|
+
### ✅ Phase 4: CLI & Polish (v0.7.0) - Complete
|
246
|
+
- ✅ Command-line interface
|
247
|
+
- ✅ Documentation reorganization
|
248
|
+
- ✅ Production-ready release
|
249
|
+
|
250
|
+
### 🔄 Phase 5: v1.0.0 - Final Polish (In Progress)
|
251
|
+
- ⏳ Processing implementations (zlib, encryption)
|
252
|
+
- ⏳ Type imports across files
|
253
|
+
- ⏳ Additional performance optimizations
|
254
|
+
- ⏳ Extended format testing
|
255
|
+
|
256
|
+
**Current Status:** Production-ready, ~95% complete toward v1.0.0
|
194
257
|
|
195
258
|
## Contributing
|
196
259
|
|