Skip to content

Commit 3080891

Browse files
DumpySquareclaude
andcommitted
v1.6.0: Universal parser, discovery APIs, and dependency cleanup
## New Features - Universal recursive TMOS parser (src/universalParse.ts) - Full-depth parsing to JSON (not just main objects as strings) - iRule-aware bracket matching for proper TCL handling - Edge cases: multiline strings, pseudo-arrays, empty objects, monitor min X of - Preserves original config in 'line' property for reconstruction - String input method: loadParseString(configText, fileName?) - Parse TMOS config directly from string (no file required) - Ideal for MCP servers and programmatic workflows - Discovery APIs for efficient filtering: - listPartitions(): Returns array of unique partition names - listApps(partition?): Returns array of virtual server paths - listAppsSummary(partition?): Returns lightweight app summaries - Enhanced apps() method with filter options: - apps({ partition: 'Tenant1' }) - apps({ partitions: ['T1', 'T2'] }) - apps({ apps: ['/Common/vs1', '/T1/vs2'] }) ## Dependency Updates - Removed @types/deepmerge (unused - using deepmerge-ts) - Updated glob 11.1.0 → 13.0.0 - npm audit: 0 vulnerabilities ## Test Fixes - Updated tests to handle new parser output structure - DO Classes: Updated expected count (34 → 60, more thorough parsing) - ASM/WAF: Changed 'status' → 'active' property check - All 107 tests passing ## Documentation - Added PARSER_ANALYSIS.md, MERGE_STRATEGY.md - Added code_cleanup.Jan2026.md for pending cleanup tracking - Updated CLAUDE.md with new APIs and architecture 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b56942b commit 3080891

32 files changed

Lines changed: 22937 additions & 16131 deletions

CHANGELOG.md

Lines changed: 405 additions & 358 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 334 additions & 205 deletions
Large diffs are not rendered by default.

MERGE_STRATEGY.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
# Merge Strategy: tmos-converter into f5-corkscrew
2+
3+
**Date:** 2025-12-31
4+
**Status:** Phase 1 Complete ✅ | Phase 2 Pending
5+
6+
---
7+
8+
## Progress Summary
9+
10+
### ✅ Phase 1: Universal Parser (COMPLETE)
11+
12+
| Task | Status |
13+
|------|--------|
14+
| Port recursive parser from tmos-converter | ✅ Done |
15+
| Add `loadParseString()` method | ✅ Done |
16+
| Add `listPartitions()` method | ✅ Done |
17+
| Add `listApps()` method | ✅ Done |
18+
| Add `listAppsSummary()` method | ✅ Done |
19+
| Enhance `apps()` with filter options | ✅ Done |
20+
| Add comprehensive tests | ✅ Done (~41 tests) |
21+
| Update documentation | ✅ Done |
22+
23+
### ⏳ Phase 2: Converters (PENDING)
24+
25+
| Task | Status |
26+
|------|--------|
27+
| Port AS3 converter | ⏳ Pending |
28+
| Port DO converter | ⏳ Pending |
29+
| Port schema validators | ⏳ Pending |
30+
| Add `toAS3()` method | ⏳ Pending |
31+
| Add `toDO()` method | ⏳ Pending |
32+
| Add `validateAS3()` method | ⏳ Pending |
33+
34+
---
35+
36+
## Current Architecture
37+
38+
```
39+
f5-corkscrew/
40+
├── src/
41+
│ ├── index.ts # Main exports
42+
│ ├── ltm.ts # BigipConfig class (enhanced ✅)
43+
│ ├── universalParse.ts # NEW: Recursive parser ✅
44+
│ ├── models.ts # Types (enhanced ✅)
45+
│ │
46+
│ ├── digConfigs.ts # App extraction
47+
│ ├── digGslb.ts # GTM extraction
48+
│ ├── unPackerStream.ts # Archive streaming
49+
│ ├── regex.ts # Regex patterns
50+
│ └── ...
51+
52+
└── tests/
53+
├── 070_universalParser.tests.ts # NEW: Parser tests ✅
54+
└── ...
55+
```
56+
57+
---
58+
59+
## Current API (Implemented)
60+
61+
```typescript
62+
import BigipConfig from 'f5-corkscrew';
63+
64+
const bigip = new BigipConfig();
65+
66+
// Load from file (existing)
67+
await bigip.loadParseAsync('/path/to/config.ucs');
68+
69+
// Load from string (NEW ✅)
70+
await bigip.loadParseString(configText);
71+
72+
// Discovery (NEW ✅)
73+
const partitions = bigip.listPartitions();
74+
const apps = bigip.listApps('Tenant1');
75+
const summaries = bigip.listAppsSummary();
76+
77+
// Filtered extraction (ENHANCED ✅)
78+
const allApps = await bigip.apps();
79+
const tenant1Apps = await bigip.apps({ partition: 'Tenant1' });
80+
const multiTenant = await bigip.apps({ partitions: ['T1', 'T2'] });
81+
const specific = await bigip.apps({ apps: ['/Common/vs1'] });
82+
83+
// Full explosion (existing)
84+
const explosion = await bigip.explode();
85+
```
86+
87+
---
88+
89+
## Phase 2: Converter Integration Plan
90+
91+
### Target Architecture
92+
93+
```
94+
f5-corkscrew/
95+
├── src/
96+
│ ├── converters/ # NEW: From tmos-converter
97+
│ │ ├── as3/
98+
│ │ │ ├── index.ts
99+
│ │ │ ├── engine/
100+
│ │ │ └── maps/
101+
│ │ └── do/
102+
│ │ ├── index.ts
103+
│ │ └── maps/
104+
│ │
105+
│ ├── validators/ # NEW: Schema validation
106+
│ │ ├── as3.ts
107+
│ │ └── do.ts
108+
│ │
109+
│ └── ...existing files...
110+
111+
├── deps/ # NEW: Bundled schemas
112+
│ ├── f5-appsvcs-classic-schema-X.X.X.tgz
113+
│ └── f5-declarative-onboarding-X.X.X.tgz
114+
115+
└── tests/
116+
├── converters/ # NEW: Converter tests
117+
└── ...
118+
```
119+
120+
### Target API
121+
122+
```typescript
123+
// Future methods (not yet implemented)
124+
const as3 = await bigip.toAS3({
125+
tenant: 'Tenant1',
126+
controls: true
127+
});
128+
129+
const doDecl = bigip.toDO();
130+
131+
const validation = await bigip.validateAS3(modifiedDeclaration);
132+
```
133+
134+
### Implementation Steps
135+
136+
1. **Copy converter directories**
137+
```bash
138+
cp -r ~/tmos-converter/src/converters src/
139+
```
140+
141+
2. **Copy validator files**
142+
```bash
143+
cp -r ~/tmos-converter/src/validators src/
144+
```
145+
146+
3. **Copy schema dependencies**
147+
```bash
148+
mkdir -p deps
149+
cp ~/tmos-converter/deps/*.tgz deps/
150+
```
151+
152+
4. **Update package.json**
153+
```json
154+
{
155+
"dependencies": {
156+
"@automation-toolchain/f5-appsvcs-classic-schema": "file:deps/f5-appsvcs-classic-schema-1.4.0.tgz",
157+
"@automation-toolchain/f5-do": "file:deps/f5-declarative-onboarding-X.X.X.tgz",
158+
"ajv": "^8.17.1",
159+
"lodash": "^4.17.21"
160+
}
161+
}
162+
```
163+
164+
5. **Add BigipConfig methods**
165+
```typescript
166+
async toAS3(options?: AS3Options): Promise<AS3Result> {
167+
const parsed = this.getFullConfig();
168+
return as3Converter(parsed, options);
169+
}
170+
```
171+
172+
6. **Port tests**
173+
- AS3 converter tests (304 tests)
174+
- DO converter tests (63 tests)
175+
- Validator tests
176+
177+
---
178+
179+
## Decision: When to Add Converters
180+
181+
**Current recommendation:** Hold off on converters until:
182+
183+
1. The MCP server confirms the parser enhancements meet workflow needs
184+
2. There's a concrete need for built-in AS3/DO conversion
185+
3. The current tmos-converter can be used separately if needed
186+
187+
**Reasons to wait:**
188+
- Converters add significant complexity (~30+ files)
189+
- Bundled schema dependencies increase package size
190+
- MCP server can call tmos-converter directly for now
191+
- Focus on stabilizing parser changes first
192+
193+
**Triggers to proceed:**
194+
- User feedback requesting built-in conversion
195+
- Performance issues with separate tmos-converter calls
196+
- Need for tighter integration between parsing and conversion
197+
198+
---
199+
200+
## Test Coverage Summary
201+
202+
### Phase 1 Tests (Complete)
203+
204+
| Area | Tests |
205+
|------|-------|
206+
| Universal parser | 12 |
207+
| loadParseString | 14 |
208+
| listPartitions | 2 |
209+
| listApps | 4 |
210+
| listAppsSummary | 1 |
211+
| apps() filters | 7 |
212+
| MCP workflow | 1 |
213+
| **Total** | **~41** |
214+
215+
### Phase 2 Tests (Pending)
216+
217+
| Area | Tests (estimated) |
218+
|------|-------------------|
219+
| AS3 converter | 304 |
220+
| DO converter | 63 |
221+
| Validators | 10 |
222+
| Integration | 20 |
223+
| **Total** | **~400** |
224+
225+
---
226+
227+
## Deprecation Plan for tmos-converter
228+
229+
After Phase 2 is complete and stable:
230+
231+
1. **Update tmos-converter README**
232+
```markdown
233+
> ⚠️ **Deprecated**: This package has been merged into
234+
> [f5-corkscrew](https://github.com/f5devcentral/f5-corkscrew).
235+
> Please migrate to f5-corkscrew for new projects.
236+
```
237+
238+
2. **Publish final tmos-converter version** with deprecation notice
239+
240+
3. **Archive tmos-converter repo** (after 6 months)
241+
242+
---
243+
244+
## Related Documentation
245+
246+
- **[PARSER_ANALYSIS.md](PARSER_ANALYSIS.md)** - Technical comparison (updated)
247+
- **[CLAUDE.md](CLAUDE.md)** - Development guide with new APIs
248+
- **[README.md](README.md)** - User documentation with examples

0 commit comments

Comments
 (0)