Skip to content

Commit ec5cca0

Browse files
chore: rename law2md to lexbuild across monorepo
Rename the project from law2md to lexbuild with the @lexbuild/ npm namespace. Updates package names, bin entry, workspace deps, imports, CLI program name, UI labels, GENERATOR constant, test assertions, fixture snapshots, all documentation, changelogs, .gitignore comments, and changeset config. Regenerated pnpm-lock.yaml. No functional changes.
1 parent 53a5360 commit ec5cca0

48 files changed

Lines changed: 313 additions & 320 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
33
"changelog": "@changesets/cli/changelog",
44
"commit": false,
5-
"fixed": [["@law2md/core", "@law2md/usc", "law2md"]],
5+
"fixed": [["@lexbuild/core", "@lexbuild/usc", "lexbuild"]],
66
"linked": [],
77
"access": "public",
88
"baseBranch": "main",

.github/copilot-instructions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# law2md Workspace Instructions
1+
# lexbuild Workspace Instructions
22

33
## Scope
44

55
These instructions apply to all work in this repository. Keep changes minimal, targeted, and consistent with existing package boundaries. See `CLAUDE.md` for the full USLM schema reference, design decisions, and common pitfalls.
66

77
## Project Overview
88

9-
`law2md` converts U.S. legislative XML (USLM schema) into structured Markdown for AI/RAG ingestion. It is a monorepo built with Turborepo, pnpm workspaces, TypeScript, and Node.js.
9+
`lexbuild` converts U.S. legislative XML (USLM schema) into structured Markdown for AI/RAG ingestion. It is a monorepo built with Turborepo, pnpm workspaces, TypeScript, and Node.js.
1010

1111
## Build and Test
1212

@@ -23,9 +23,9 @@ pnpm turbo lint
2323
Package-scoped pattern:
2424

2525
```bash
26-
pnpm turbo <task> --filter=@law2md/core
27-
pnpm turbo <task> --filter=@law2md/usc
28-
pnpm turbo <task> --filter=law2md
26+
pnpm turbo <task> --filter=@lexbuild/core
27+
pnpm turbo <task> --filter=@lexbuild/usc
28+
pnpm turbo <task> --filter=lexbuild
2929
```
3030

3131
Run the CLI locally during development:
@@ -40,9 +40,9 @@ node packages/cli/dist/index.js convert --titles 1-5 -o ./test-output
4040

4141
This is a Turborepo + pnpm monorepo with three packages:
4242

43-
- `packages/core` (`@law2md/core`): namespace-aware XML parsing (SAX via `saxes`), AST building, Markdown rendering, frontmatter generation, shared utilities.
44-
- `packages/usc` (`@law2md/usc`): USC-specific conversion pipeline and OLRC downloader. Contains `convertTitle()` which orchestrates ReadStream → SAX → AST → Markdown → file writer.
45-
- `packages/cli` (`law2md`): CLI commands (`convert`, `download`), terminal UI (`chalk`, `ora`, `cli-table3`), and user-facing command surface.
43+
- `packages/core` (`@lexbuild/core`): namespace-aware XML parsing (SAX via `saxes`), AST building, Markdown rendering, frontmatter generation, shared utilities.
44+
- `packages/usc` (`@lexbuild/usc`): USC-specific conversion pipeline and OLRC downloader. Contains `convertTitle()` which orchestrates ReadStream → SAX → AST → Markdown → file writer.
45+
- `packages/cli` (`lexbuild`): CLI commands (`convert`, `download`), terminal UI (`chalk`, `ora`, `cli-table3`), and user-facing command surface.
4646

4747
Respect boundaries: keep generic parsing/rendering logic in `core`, USC-specific behavior in `usc`, and CLI orchestration in `cli`. Internal packages use `workspace:*` protocol for dependencies.
4848

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# =============================================================================
2-
# law2md .gitignore
2+
# lexbuild .gitignore
33
# =============================================================================
44

55
# -----------------------------------------------------------------------------
@@ -118,7 +118,7 @@ tags
118118
.zed/
119119

120120
# -----------------------------------------------------------------------------
121-
# law2md operational outputs
121+
# lexbuild operational outputs
122122
# -----------------------------------------------------------------------------
123123

124124
# Downloaded source files (large, regenerable)

CHANGELOG.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
2323

2424
### Fixed
2525

26-
- **Spurious root dependency**: removed accidental `"dependencies": { "law2md-monorepo": "link:" }` from root `package.json`
26+
- **Spurious root dependency**: removed accidental `"dependencies": { "lexbuild-monorepo": "link:" }` from root `package.json`
2727

2828
### Changed
2929

@@ -105,11 +105,11 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
105105
#### CI/CD
106106

107107
- **GitHub Actions CI** (`.github/workflows/ci.yml`): lint, typecheck, and test on push to main and pull requests. Node 20/22 matrix, pnpm store caching, concurrency groups. ([`b8f45a7`](../../commit/b8f45a7))
108-
- **npm publish workflow** (`.github/workflows/publish.yml`): changeset-based publish via `changesets/action@v1`. Creates version PR when changesets pending, publishes `@law2md/core`, `@law2md/usc`, and `law2md` to npm when version PR merged. Requires `NPM_TOKEN` secret. ([`ef8d3b2`](../../commit/ef8d3b2))
108+
- **npm publish workflow** (`.github/workflows/publish.yml`): changeset-based publish via `changesets/action@v1`. Creates version PR when changesets pending, publishes `@lexbuild/core`, `@lexbuild/usc`, and `lexbuild` to npm when version PR merged. Requires `NPM_TOKEN` secret. ([`ef8d3b2`](../../commit/ef8d3b2))
109109

110110
### Changed
111111

112-
- **README.md**: updated for public launch — CI badge, npm install instructions, `law2md` command in usage examples, Phase 4 status complete, test count 121→137, link to CONTRIBUTING.md ([`d33e1ff`](../../commit/d33e1ff))
112+
- **README.md**: updated for public launch — CI badge, npm install instructions, `lexbuild` command in usage examples, Phase 4 status complete, test count 121→137, link to CONTRIBUTING.md ([`d33e1ff`](../../commit/d33e1ff))
113113

114114
---
115115

@@ -120,7 +120,7 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
120120
#### OLRC Downloader
121121

122122
- **Downloader** (`packages/usc/src/downloader.ts`): `downloadTitles()` fetches USC XML zips from OLRC, extracts via `yauzl`, cleans up temp files. Hardcoded `CURRENT_RELEASE_POINT` with `--release-point` override for future automation. ([`69444bc`](../../commit/69444bc))
123-
- **`law2md download` command** (`packages/cli/src/commands/download.ts`): `--title N` for individual titles, `--all` for all 54, `-o` for output directory. Reports per-title file sizes and elapsed time. ([`1743e7c`](../../commit/1743e7c))
123+
- **`lexbuild download` command** (`packages/cli/src/commands/download.ts`): `--title N` for individual titles, `--all` for all 54, `-o` for output directory. Reports per-title file sizes and elapsed time. ([`1743e7c`](../../commit/1743e7c))
124124

125125
#### Dry-Run Mode
126126

@@ -205,13 +205,13 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
205205

206206
#### Scaffold
207207

208-
- **Monorepo scaffold** with pnpm workspaces, Turborepo pipeline (build/test/lint/typecheck/dev), and three packages: `@law2md/core`, `@law2md/usc`, `law2md` (CLI) ([`9f55906`](../../commit/9f55906))
208+
- **Monorepo scaffold** with pnpm workspaces, Turborepo pipeline (build/test/lint/typecheck/dev), and three packages: `@lexbuild/core`, `@lexbuild/usc`, `lexbuild` (CLI) ([`9f55906`](../../commit/9f55906))
209209
- **TypeScript 5.x strict mode** with `tsup` (ESM-only) builds, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes` ([`9f55906`](../../commit/9f55906))
210210
- **ESLint** flat config with `typescript-eslint` strict + Prettier integration ([`9f55906`](../../commit/9f55906))
211211
- **Vitest** per-package test configs with co-located test files ([`9f55906`](../../commit/9f55906))
212212
- **Fixture directories**: `fixtures/xml/` (gitignored, user-provided USC XML), `fixtures/fragments/` (synthetic test XML), `fixtures/expected/` (output snapshots) ([`9f55906`](../../commit/9f55906))
213213

214-
#### Core (`@law2md/core`)
214+
#### Core (`@lexbuild/core`)
215215

216216
- **XML Parser** (`src/xml/parser.ts`): streaming SAX parser wrapping `saxes` with namespace normalization — USLM default namespace elements emit bare names (`section`), other namespaces emit prefixed names (`xhtml:table`, `dc:title`). Supports `parseString()` and `parseStream()`. ([`120a553`](../../commit/120a553))
217217
- **Namespace constants** (`src/xml/namespace.ts`): `USLM_NS`, `XHTML_NS`, `DC_NS`, `DCTERMS_NS`, `XSI_NS`, plus element classification sets (`LEVEL_ELEMENTS`, `CONTENT_ELEMENTS`, `INLINE_ELEMENTS`, `NOTE_ELEMENTS`, etc.) ([`120a553`](../../commit/120a553))
@@ -220,13 +220,13 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
220220
- **Markdown Renderer** (`src/markdown/renderer.ts`): stateless AST-to-Markdown conversion with bold inline numbering for subsections (not headings), three cross-reference link modes (plaintext/canonical/relative), source credits after horizontal rule, notes with H2/H3 headings, and blockquote rendering for quoted content ([`9c7189d`](../../commit/9c7189d))
221221
- **Frontmatter Generator** (`src/markdown/frontmatter.ts`): `FrontmatterData` to YAML serialization with controlled field ordering, `format_version` ("1.0.0"), and `generator` metadata ([`9c7189d`](../../commit/9c7189d))
222222

223-
#### USC (`@law2md/usc`)
223+
#### USC (`@lexbuild/usc`)
224224

225225
- **USC Converter** (`src/converter.ts`): full pipeline orchestrator for a single USC XML file — ReadStream → SAX parser → AST builder (emit at section) → Markdown renderer + frontmatter → file writer. Outputs to `usc/title-NN/chapter-NN/section-N.md`. Supports source credit toggling. Uses collect-then-write pattern to avoid async issues during SAX streaming. ([`eb22560`](../../commit/eb22560))
226226

227-
#### CLI (`law2md`)
227+
#### CLI (`lexbuild`)
228228

229-
- **`law2md convert` command** (`src/commands/convert.ts`): accepts input XML path, output directory, link style, and source credit toggle. Validates input, reports timing and section count, supports verbose mode. ([`2147c05`](../../commit/2147c05))
229+
- **`lexbuild convert` command** (`src/commands/convert.ts`): accepts input XML path, output directory, link style, and source credit toggle. Validates input, reports timing and section count, supports verbose mode. ([`2147c05`](../../commit/2147c05))
230230

231231
#### Documentation
232232

@@ -253,4 +253,4 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
253253

254254
### Changed
255255

256-
- **Barrel exports cleaned up**: removed legacy `USLM_NAMESPACE` / `XHTML_NAMESPACE` / `DC_NAMESPACE` / `DCTERMS_NAMESPACE` aliases from `@law2md/core`. Use `USLM_NS`, `XHTML_NS`, `DC_NS`, `DCTERMS_NS` instead. ([`d42bb21`](../../commit/d42bb21))
256+
- **Barrel exports cleaned up**: removed legacy `USLM_NAMESPACE` / `XHTML_NAMESPACE` / `DC_NAMESPACE` / `DCTERMS_NAMESPACE` aliases from `@lexbuild/core`. Use `USLM_NS`, `XHTML_NS`, `DC_NS`, `DCTERMS_NS` instead. ([`d42bb21`](../../commit/d42bb21))

CLAUDE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# CLAUDE.md — law2md
1+
# CLAUDE.md — lexbuild
22

33
## Project Overview
44

5-
`law2md` converts U.S. legislative XML (USLM schema) into structured Markdown for AI/RAG ingestion. It is a monorepo built with Turborepo, pnpm workspaces, TypeScript, and Node.js.
5+
`lexbuild` converts U.S. legislative XML (USLM schema) into structured Markdown for AI/RAG ingestion. It is a monorepo built with Turborepo, pnpm workspaces, TypeScript, and Node.js.
66

77
## Repository Structure
88

99
```
10-
law2md/
10+
lexbuild/
1111
├── packages/
12-
│ ├── core/ # @law2md/core — XML parsing, AST, Markdown rendering, shared utilities
13-
│ ├── usc/ # @law2md/usc — U.S. Code-specific element handlers and downloader
14-
│ └── cli/ # law2md — CLI binary (the published npm package users install)
12+
│ ├── core/ # @lexbuild/core — XML parsing, AST, Markdown rendering, shared utilities
13+
│ ├── usc/ # @lexbuild/usc — U.S. Code-specific element handlers and downloader
14+
│ └── cli/ # lexbuild — CLI binary (the published npm package users install)
1515
├── downloads/
1616
│ └── usc/
1717
│ └── xml/ # Full USC XML files (usc01.xml ... usc54.xml) — gitignored
@@ -50,13 +50,13 @@ pnpm install
5050
pnpm turbo build
5151

5252
# Build a specific package
53-
pnpm turbo build --filter=@law2md/core
53+
pnpm turbo build --filter=@lexbuild/core
5454

5555
# Run all tests
5656
pnpm turbo test
5757

5858
# Run tests for a specific package
59-
pnpm turbo test --filter=@law2md/usc
59+
pnpm turbo test --filter=@lexbuild/usc
6060

6161
# Type check
6262
pnpm turbo typecheck
@@ -313,9 +313,9 @@ output/usc/title-{NN}/chapter-{NN}/section-{N}.md
313313
> **Note**: The extension architecture is aspirational. No pluggable handler interfaces exist yet — element handling is built into the `ASTBuilder` class. See `docs/extending.md` for details.
314314
315315
1. Create a new package: `packages/cfr/` (or `packages/state-il/`, etc.)
316-
2. Implement a converter function analogous to `convertTitle()` in `@law2md/usc`
316+
2. Implement a converter function analogous to `convertTitle()` in `@lexbuild/usc`
317317
3. Extend or adapt the `ASTBuilder` for source-specific elements
318318
4. Add a new CLI command in `packages/cli`
319-
5. Reuse `@law2md/core` for XML parsing, AST types, Markdown rendering, and frontmatter
319+
5. Reuse `@lexbuild/core` for XML parsing, AST types, Markdown rendering, and frontmatter
320320
6. Add source-specific download logic if applicable
321321
7. Document the source's XML schema in the package README

CONTRIBUTING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to law2md
1+
# Contributing to lexbuild
22

33
Thanks for your interest in contributing! This guide covers everything you need to get set up and submit changes.
44

@@ -10,8 +10,8 @@ Thanks for your interest in contributing! This guide covers everything you need
1010
## Setup
1111

1212
```bash
13-
git clone https://github.com/chris-c-thomas/law2md.git
14-
cd law2md
13+
git clone https://github.com/chris-c-thomas/lexbuild.git
14+
cd lexbuild
1515
pnpm install
1616
pnpm turbo build
1717
```
@@ -37,9 +37,9 @@ pnpm turbo dev # Watch mode (rebuild on change)
3737
To scope commands to a single package:
3838

3939
```bash
40-
pnpm turbo build --filter=@law2md/core
41-
pnpm turbo test --filter=@law2md/usc
42-
pnpm turbo test --filter=law2md
40+
pnpm turbo build --filter=@lexbuild/core
41+
pnpm turbo test --filter=@lexbuild/usc
42+
pnpm turbo test --filter=lexbuild
4343
```
4444

4545
### Running the CLI Locally
@@ -65,9 +65,9 @@ Formatting is enforced by Prettier (double quotes, trailing commas, 100 char pri
6565

6666
```
6767
packages/
68-
core/ @law2md/core — XML parsing, AST, Markdown rendering, shared utilities
69-
usc/ @law2md/usc — U.S. Code conversion logic and OLRC downloader
70-
cli/ law2md — CLI entry point (the published npm package)
68+
core/ @lexbuild/core — XML parsing, AST, Markdown rendering, shared utilities
69+
usc/ @lexbuild/usc — U.S. Code conversion logic and OLRC downloader
70+
cli/ lexbuild — CLI entry point (the published npm package)
7171
```
7272

7373
The `core` package provides the general-purpose XML-to-Markdown pipeline. The `usc` package adds U.S. Code-specific handling. The `cli` package wires everything together as a command-line tool. Internal packages use `workspace:*` protocol for dependencies.
@@ -103,7 +103,7 @@ Tests are co-located with source files (`parser.ts` → `parser.test.ts`).
103103

104104
```bash
105105
pnpm turbo test # Run all tests
106-
pnpm turbo test --filter=@law2md/usc # Run one package
106+
pnpm turbo test --filter=@lexbuild/usc # Run one package
107107
```
108108

109109
Name test cases descriptively:
@@ -128,7 +128,7 @@ Review the diff in `fixtures/expected/` to confirm only intended changes, then c
128128

129129
- `fixtures/fragments/` — Small synthetic XML snippets for unit tests (committed)
130130
- `fixtures/expected/` — Pinned expected output for snapshot tests (committed)
131-
- `downloads/usc/xml/` — Full USC XML files (gitignored, download with `law2md download`)
131+
- `downloads/usc/xml/` — Full USC XML files (gitignored, download with `lexbuild download`)
132132

133133
## Submitting Changes
134134

0 commit comments

Comments
 (0)