@lexbuild/cli 1.0.0 → 1.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/README.md +114 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @lexbuild/cli
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@lexbuild/cli)
|
|
4
|
+
[](https://github.com/chris-c-thomas/lexbuild/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/chris-c-thomas/lexbuild/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
This package is part of the [LexBuild](https://github.com/chris-c-thomas/lexbuild) monorepo, a tool that converts U.S. legislative XML into structured Markdown optimized for AI, RAG pipelines, and semantic search. See the monorepo for full documentation, architecture details, and contribution guidelines.
|
|
8
|
+
|
|
9
|
+
It provides the CLI entry point for downloading and converting legal and civic texts. Currently supports the [United States Code](https://uscode.house.gov/) via [`@lexbuild/usc`](https://www.npmjs.com/package/@lexbuild/usc), with additional sources (CFR, state statutes) planned.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @lexbuild/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or run directly with npx:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx @lexbuild/cli download --all
|
|
21
|
+
npx @lexbuild/cli convert --all
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Download and convert all 54 titles
|
|
28
|
+
lexbuild download --all && lexbuild convert --all
|
|
29
|
+
|
|
30
|
+
# Start small — download and convert Title 1
|
|
31
|
+
lexbuild download --titles 1 && lexbuild convert --titles 1
|
|
32
|
+
|
|
33
|
+
# Download and convert a range
|
|
34
|
+
lexbuild download --titles 1-5 && lexbuild convert --titles 1-5
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
### `lexbuild download`
|
|
40
|
+
|
|
41
|
+
Fetch U.S. Code XML files from the OLRC.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
lexbuild download --titles 1 # Single title
|
|
45
|
+
lexbuild download --titles 1-5,8,11 # Range + specific titles
|
|
46
|
+
lexbuild download --all # All 54 titles (single bulk zip)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| Option | Default | Description |
|
|
50
|
+
|--------|---------|-------------|
|
|
51
|
+
| `--titles <spec>` | — | Title(s) to download: `1`, `1-5`, `1-5,8,11` |
|
|
52
|
+
| `--all` | — | Download all 54 titles |
|
|
53
|
+
| `-o, --output <dir>` | `./downloads/usc/xml` | Output directory |
|
|
54
|
+
| `--release-point <id>` | current | OLRC release point |
|
|
55
|
+
|
|
56
|
+
### `lexbuild convert`
|
|
57
|
+
|
|
58
|
+
Convert downloaded XML to Markdown.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
lexbuild convert --titles 1 # By title number
|
|
62
|
+
lexbuild convert --all # All downloaded titles
|
|
63
|
+
lexbuild convert ./downloads/usc/xml/usc01.xml # Direct file path
|
|
64
|
+
lexbuild convert --titles 1 -g chapter # Chapter-level output
|
|
65
|
+
lexbuild convert --titles 1 --link-style canonical # OLRC website links
|
|
66
|
+
lexbuild convert --titles 42 --dry-run # Preview without writing
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Option | Default | Description |
|
|
70
|
+
|--------|---------|-------------|
|
|
71
|
+
| `--titles <spec>` | — | Title(s) to convert |
|
|
72
|
+
| `--all` | — | Convert all titles in input directory |
|
|
73
|
+
| `-i, --input-dir <dir>` | `./downloads/usc/xml` | Input directory for XML files |
|
|
74
|
+
| `-o, --output <dir>` | `./output` | Output directory |
|
|
75
|
+
| `-g, --granularity <level>` | `section` | `section` or `chapter` |
|
|
76
|
+
| `--link-style <style>` | `plaintext` | `plaintext`, `canonical`, or `relative` |
|
|
77
|
+
| `--no-include-source-credits` | — | Exclude source credits |
|
|
78
|
+
| `--no-include-notes` | — | Exclude all notes |
|
|
79
|
+
| `--include-editorial-notes` | — | Include editorial notes only |
|
|
80
|
+
| `--include-statutory-notes` | — | Include statutory notes only |
|
|
81
|
+
| `--include-amendments` | — | Include amendment notes only |
|
|
82
|
+
| `--dry-run` | — | Parse and report without writing files |
|
|
83
|
+
| `-v, --verbose` | — | Verbose logging |
|
|
84
|
+
|
|
85
|
+
## Output
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
output/usc/
|
|
89
|
+
title-01/
|
|
90
|
+
README.md
|
|
91
|
+
_meta.json
|
|
92
|
+
chapter-01/
|
|
93
|
+
_meta.json
|
|
94
|
+
section-1.md
|
|
95
|
+
section-2.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each section file includes YAML frontmatter (identifier, title, chapter, section, status, source credit) followed by the statutory text with bold inline numbering.
|
|
99
|
+
|
|
100
|
+
## Performance
|
|
101
|
+
|
|
102
|
+
The full U.S. Code — all 54 titles, 60,000+ sections, ~85 million estimated tokens — converts in about 20-30 seconds on modern machines. SAX streaming keeps memory bounded for even the largest titles (100MB+ XML).
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
- [Monorepo README](https://github.com/chris-c-thomas/lexbuild#readme)
|
|
107
|
+
- [Architecture](https://github.com/chris-c-thomas/lexbuild/blob/main/docs/architecture.md)
|
|
108
|
+
- [Output Format](https://github.com/chris-c-thomas/lexbuild/blob/main/docs/output-format.md)
|
|
109
|
+
- [XML Element Reference](https://github.com/chris-c-thomas/lexbuild/blob/main/docs/xml-element-reference.md)
|
|
110
|
+
- [Extending](https://github.com/chris-c-thomas/lexbuild/blob/main/docs/extending.md)
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[MIT](https://github.com/chris-c-thomas/lexbuild/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexbuild/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Compiler for legal and civic texts. Converts disparate statutory data into structured formats optimized for AI, RAG, and semantic search.",
|
|
5
5
|
"author": "Chris Thomas",
|
|
6
6
|
"license": "MIT",
|