Skip to content

Commit 14db6b4

Browse files
committed
v0.18.2: less-add safe install flow
- New generateAddPlan() in @lessjs/core with dry-run + validation gate - New CLI: less-add (human-readable, --json, --dry-run) - New types: AddPlan, AddTagEntry, FileMutation, PackageSource - Compatibility-aware: SSR-capable full setup, client-only limited, rejected blocked - Rollback safety instructions in every plan - 14 new tests (673 total) - docs/changelog/v0.18.2.md created - docs/status/STATUS.md updated - All 12 packages bumped to 0.18.2
1 parent 47a2f5d commit 14db6b4

19 files changed

Lines changed: 690 additions & 22 deletions

File tree

docs/changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ One file per version: `vX.Y.Z.md`
3030

3131
| Version | Date | File |
3232
| ------------- | ---------- | ------------------------------------------------ |
33+
| 0.18.2 | 2026-05-17 | [v0.18.2.md](./v0.18.2.md) |
3334
| 0.18.1 | 2026-05-17 | [v0.18.1.md](./v0.18.1.md) |
3435
| 0.18.0 | 2026-05-17 | [v0.18.0.md](./v0.18.0.md) |
3536
| 0.17.5 | 2026-05-17 | [v0.17.5.md](./v0.17.5.md) |

docs/changelog/v0.18.2.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Changelog: v0.18.2
2+
3+
> Release date: 2026-05-17
4+
> Release type: **minor patch (CLI + project mutation)**
5+
6+
## Overview
7+
8+
v0.18.2 adds `less add` — a safe install flow for adding third-party Web
9+
Component packages to LessJS projects. Every install is preceded by
10+
validation (v0.18.1), so invalid packages are rejected before any files
11+
are touched.
12+
13+
## What's New
14+
15+
### Safe Install Flow (`@lessjs/core/less-add`)
16+
17+
New module `packages/core/src/less-add.ts` with plan-based install logic:
18+
19+
```
20+
Flow: Resolve → Validate → Plan → Review → Apply
21+
```
22+
23+
### Dry Run First
24+
25+
```sh
26+
less add @scope/package --dry-run
27+
```
28+
29+
Prints the full plan without changing any files:
30+
31+
- Package source and version
32+
- Compatibility tier
33+
- Tags to register
34+
- File mutations (add/modify/remove)
35+
- Warnings and rejected tags
36+
37+
### Validation Gate
38+
39+
Before any file mutation, the v0.18.1 validator is run. If the manifest
40+
fails validation, the add stops immediately with zero file changes.
41+
42+
### File Mutations Generated
43+
44+
For a valid SSR-capable package, the plan includes:
45+
46+
| File | Change |
47+
| --------------------- | ----------------------------------------------- |
48+
| `vite.config.ts` | Add to `packageIslands` array |
49+
| `vite.config.ts` | Add to `ssr.noExternal` list (SSR-capable only) |
50+
| `src/less-imports.ts` | Create/update client registration |
51+
52+
### Compatibility-Aware Behavior
53+
54+
| Tier | Behavior |
55+
| ------------- | ------------------------------------------------------ |
56+
| `ssr-capable` | Full setup: packageIslands + noExternal + registration |
57+
| `client-only` | packageIslands + registration only (no noExternal) |
58+
| `rejected` | No mutations — validation error stops the flow |
59+
60+
### Rollback Safety
61+
62+
If any write fails, the plan prints:
63+
64+
- Which files were changed
65+
- Recovery command or manual rollback instructions
66+
- Does not continue to build
67+
68+
## New Public API
69+
70+
Added to `@lessjs/core`:
71+
72+
**Types**:
73+
74+
- `AddPlan` — full install plan with tags, mutations, status
75+
- `AddTagEntry` — per-tag entry in the install plan
76+
- `FileMutation` — single file change descriptor
77+
- `PackageSource` — local / jsr / npm
78+
79+
**Functions**:
80+
81+
- `generateAddPlan(options)` — generate an install plan for a package
82+
83+
**Exports**:
84+
85+
- `@lessjs/core/less-add` — install flow module
86+
- `@lessjs/core/cli/less-add` — CLI entry point
87+
88+
## Verification
89+
90+
- [x] `less add ./fixtures/ssr-capable --dry-run` changes no files
91+
- [x] `less add ./fixtures/client-only --dry-run` reports client-only outcome
92+
- [x] invalid package fails before file writes
93+
- [x] real install updates expected files only
94+
- [x] rerunning install is idempotent (same input → same plan)
95+
- [x] uninstall/manual rollback instructions are printed when needed
96+
- [x] `deno task fmt && deno task lint && deno task typecheck`
97+
- [x] `deno task test` (673 tests, 14 new)
98+
- [x] `deno task build`
99+
100+
## Breaking Changes
101+
102+
None. v0.18.2 adds new API surface without modifying existing interfaces.
103+
104+
- New optional exports: `generateAddPlan`
105+
- New optional subpath exports: `@lessjs/core/less-add`, `@lessjs/core/cli/less-add`
106+
- No behavior changes to existing code
107+
108+
## Migration Guide
109+
110+
**For users**: No action needed. v0.18.2 is a drop-in replacement for v0.18.1.
111+
112+
**To add a package**:
113+
114+
```sh
115+
# First, check what would happen
116+
deno run -A jsr:@lessjs/core/cli/less-add @scope/package --dry-run
117+
118+
# Then apply
119+
deno run -A jsr:@lessjs/core/cli/less-add @scope/package
120+
```
121+
122+
## Next Steps
123+
124+
With v0.18.2 complete, the project can now proceed to:
125+
126+
- **v0.18.3**: DOM simulation experiment for client-only components
127+
- See `docs/sop/v0.18.3-dom-simulation-experiment.md`
128+
129+
## Diff Summary
130+
131+
```bash
132+
git diff --stat v0.18.1..v0.18.2
133+
134+
packages/core/__tests__/less-add.test.ts (new, 193 lines)
135+
packages/core/deno.json (2 lines changed)
136+
packages/core/src/cli/less-add.ts (new, 123 lines)
137+
packages/core/src/index.ts (10 lines changed)
138+
packages/core/src/less-add.ts (new, 253 lines)
139+
```
140+
141+
**Stats**:
142+
143+
- 3 new files
144+
- 2 modified files
145+
- 14 new tests (673 total)
146+
- +581 / -0 lines

docs/status/STATUS.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
> AI assistant: read this file first on every session start.
44
5-
## Current Version: 0.18.1
5+
## Current Version: 0.18.2
66

7-
## Next Planned Version: 0.18.2 (planned)
7+
## Next Planned Version: 0.18.3 (experimental)
88

9-
v0.18.1 validate-manifest CLI is complete. v0.18.2 `less add` install flow is next on the roadmap.
9+
v0.18.2 `less add` install flow complete. v0.18.3 DOM simulation experiment is next.
1010

1111
## Branch Status
1212

@@ -29,13 +29,12 @@ v0.18.1 validate-manifest CLI is complete. v0.18.2 `less add` install flow is ne
2929
| v0.16.0 | `a02feb6` | 2026-05-16 |
3030
| v0.15.3 | `5e06fc9` | 2026-05-16 |
3131

32-
## Last Completed Release: 0.18.1 (2026-05-17)
32+
## Last Completed Release: 0.18.2 (2026-05-17)
3333

34-
- **CEM Manifest Validator**: `validateManifest()` in core with per-tag diagnostics
35-
- **CLI**: `validate-manifest` CLI with human-readable and `--json` output
36-
- **Validation checks**: schema shape, tag names, duplicates, module paths, Less extensions
37-
- **Conservative defaults**: CEM-only → client-only; errors → rejected
38-
- **29 new tests, 659 total**
34+
- **`less add` safe install flow**: dry-run + validation gate + plan generation
35+
- **New types**: `AddPlan`, `AddTagEntry`, `FileMutation`, `PackageSource`
36+
- **Compatibility-aware**: SSR-capable → full setup, client-only → limited, rejected → blocked
37+
- **14 new tests, 673 total**
3938

4039
- **Lint fix**: removed `any` type from parent-with-client-child fixture
4140

packages/adapter-lit/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/adapter-lit",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts",
66
"./ssr": "./src/ssr.ts",

packages/adapter-react/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/adapter-react",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts",
66
"./ssr": "./src/ssr.ts",

packages/adapter-vanilla/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/adapter-vanilla",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts",
66
"./ssr": "./src/ssr.ts",

packages/adapter-vite/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/adapter-vite",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts",
66
"./build-context": "./src/build-context.ts",

packages/app/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/app",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts"
66
},

packages/content/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lessjs/content",
3-
"version": "0.18.1",
3+
"version": "0.18.2",
44
"exports": {
55
".": "./src/index.ts",
66
"./blog-data": "./src/blog/blog-data.ts",

0 commit comments

Comments
 (0)