panelize 0.1.0 → 0.1.2
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/CHANGELOG.md +23 -1
- package/README.md +21 -4
- package/bin/panelize.mjs +125 -0
- package/examples/AGENTS.md +1 -1
- package/examples/cursor-rule.mdc +2 -2
- package/llms-full.txt +7 -4
- package/llms.txt +7 -4
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ All notable changes to Panelize are listed here. The format follows [Keep a Chan
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.1.2] - 2026-10-12
|
|
8
|
+
|
|
9
|
+
No change to the components, props, or theme.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `npx panelize init-agents` adds a Panelize section to a project’s `AGENTS.md` so coding agents read `llms.txt` and `docs/composition.md`. It never overwrites existing content and re-running updates only its own section. `--cursor`, `--claude`, `--copilot`, and `--all` write tool-specific files; `--dry-run` previews.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- `examples/AGENTS.md` is now a `##` section meant to be merged into an existing `AGENTS.md`.
|
|
18
|
+
- `examples/cursor-rule.mdc` no longer sets `alwaysApply: true`. The agent pulls it in when the task is building or editing UI.
|
|
19
|
+
- README and `llms.txt` lead with the agent setup step; links to maintainer files in `llms.txt` now point at GitHub.
|
|
20
|
+
|
|
21
|
+
## [0.1.1] - 2026-10-12
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Releases are published through npm trusted publishing with staged releases. No library code changed.
|
|
26
|
+
|
|
7
27
|
## [0.1.0] - 2026-10-11
|
|
8
28
|
|
|
9
29
|
First public release.
|
|
@@ -26,5 +46,7 @@ First public release.
|
|
|
26
46
|
- The library does not load font files and has no scheme toggle. The host owns both.
|
|
27
47
|
- Next.js App Router needs the styled-components registry (see the README).
|
|
28
48
|
|
|
29
|
-
[Unreleased]: https://github.com/jayzizzle/panelize/compare/v0.1.
|
|
49
|
+
[Unreleased]: https://github.com/jayzizzle/panelize/compare/v0.1.2...HEAD
|
|
50
|
+
[0.1.2]: https://github.com/jayzizzle/panelize/compare/v0.1.1...v0.1.2
|
|
51
|
+
[0.1.1]: https://github.com/jayzizzle/panelize/compare/v0.1.0...v0.1.1
|
|
30
52
|
[0.1.0]: https://github.com/jayzizzle/panelize/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -48,6 +48,26 @@ export function App() {
|
|
|
48
48
|
|
|
49
49
|
With no `theme` prop the provider uses `defaultTheme`. To set colors, brand, and type, see [Theme](#theme).
|
|
50
50
|
|
|
51
|
+
## Using an AI agent?
|
|
52
|
+
|
|
53
|
+
Panelize ships docs written for coding agents (`llms.txt` and `docs/`). Installing the package puts them in `node_modules`, but agents do not look there on their own. Point them at it once, from your project root:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npx panelize init-agents
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This adds a short Panelize section to `AGENTS.md`, a file most coding agents read. The section tells the agent to read `node_modules/panelize/llms.txt` and `docs/composition.md` before writing UI, so it stays current when you upgrade the package. If `AGENTS.md` already exists, your content is left alone and only the section between the `<!-- panelize:start -->` and `<!-- panelize:end -->` lines is added or updated. Commit the result.
|
|
60
|
+
|
|
61
|
+
| Option | Also writes |
|
|
62
|
+
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `--cursor` | `.cursor/rules/panelize.mdc`, pulled in by the agent when the task is building or editing UI (`--force` overwrites a file that differs) |
|
|
64
|
+
| `--claude` | `CLAUDE.md` containing an `@AGENTS.md` import, for Claude Code |
|
|
65
|
+
| `--copilot` | `.github/copilot-instructions.md` |
|
|
66
|
+
| `--all` | all of the above |
|
|
67
|
+
| `--dry-run` | Writes nothing; prints what would change |
|
|
68
|
+
|
|
69
|
+
Prefer to do it by hand, or use a tool with no instructions file? Paste the section from [`examples/AGENTS.md`](examples/AGENTS.md) into its instructions or system prompt.
|
|
70
|
+
|
|
51
71
|
## Next.js (App Router)
|
|
52
72
|
|
|
53
73
|
Panelize is client UI with `'use client'` in the bundle, so you can import it from Server Components. styled-components needs its official registry, or server-rendered pages arrive **unstyled** and flash on hydrate.
|
|
@@ -167,10 +187,7 @@ Evergreen browsers: **Chrome / Edge 119+, Safari 16.5+, Firefox 121+**. The floo
|
|
|
167
187
|
|
|
168
188
|
**Using Panelize in an app:** read [`llms.txt`](llms.txt) then [`docs/composition.md`](docs/composition.md). After `npm install panelize`, those files are `node_modules/panelize/llms.txt` (export `panelize/llms.txt`) and `node_modules/panelize/docs/`. One-file dump: `llms-full.txt`.
|
|
169
189
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
- Cursor: `node_modules/panelize/examples/cursor-rule.mdc` → `.cursor/rules/panelize.mdc` (`alwaysApply: true`).
|
|
173
|
-
- Any agent (`AGENTS.md`, Copilot instructions, and so on): `node_modules/panelize/examples/AGENTS.md`.
|
|
190
|
+
Set up the **host** project with `npx panelize init-agents` (see [Using an AI agent?](#using-an-ai-agent)). The drop-in files are `node_modules/panelize/examples/AGENTS.md` and `examples/cursor-rule.mdc`.
|
|
174
191
|
|
|
175
192
|
Copyable layouts (page, sidebar, centered card, form, dashboard grid): [`docs/recipes.md`](docs/recipes.md). One line per export: [`docs/components.md`](docs/components.md).
|
|
176
193
|
|
package/bin/panelize.mjs
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { dirname, join } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
7
|
+
const START = '<!-- panelize:start -->'
|
|
8
|
+
const END = '<!-- panelize:end -->'
|
|
9
|
+
|
|
10
|
+
const USAGE = `Usage: panelize init-agents [options]
|
|
11
|
+
|
|
12
|
+
Adds Panelize agent instructions to the project in the current directory.
|
|
13
|
+
Run it from your project root (the folder with package.json).
|
|
14
|
+
|
|
15
|
+
By default it writes a Panelize section into AGENTS.md. Existing content outside
|
|
16
|
+
the section is never touched, and re-running updates only the section.
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
--cursor also write .cursor/rules/panelize.mdc
|
|
20
|
+
--claude also write CLAUDE.md (imports AGENTS.md)
|
|
21
|
+
--copilot also write .github/copilot-instructions.md
|
|
22
|
+
--all --cursor --claude --copilot
|
|
23
|
+
--force overwrite an existing .cursor/rules/panelize.mdc that differs
|
|
24
|
+
--dry-run print what would change and write nothing
|
|
25
|
+
--help show this message
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const flags = new Set(['--cursor', '--claude', '--copilot', '--all', '--force', '--dry-run'])
|
|
29
|
+
|
|
30
|
+
function fail(message) {
|
|
31
|
+
console.error(message)
|
|
32
|
+
process.exit(1)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const [command, ...args] = process.argv.slice(2)
|
|
36
|
+
if (!command || command === '--help' || command === '-h' || args.includes('--help')) {
|
|
37
|
+
console.log(USAGE)
|
|
38
|
+
process.exit(command ? 0 : 1)
|
|
39
|
+
}
|
|
40
|
+
if (command !== 'init-agents') fail(`Unknown command "${command}".\n\n${USAGE}`)
|
|
41
|
+
const unknown = args.find((arg) => !flags.has(arg))
|
|
42
|
+
if (unknown) fail(`Unknown option "${unknown}".\n\n${USAGE}`)
|
|
43
|
+
|
|
44
|
+
const has = (flag) => args.includes(flag)
|
|
45
|
+
const all = has('--all')
|
|
46
|
+
const dryRun = has('--dry-run')
|
|
47
|
+
const cwd = process.cwd()
|
|
48
|
+
if (!existsSync(join(cwd, 'package.json'))) {
|
|
49
|
+
fail('No package.json in this directory. Run this from your project root.')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const read = (path) => readFileSync(path, 'utf8')
|
|
53
|
+
const packaged = (file) => read(join(packageRoot, file))
|
|
54
|
+
|
|
55
|
+
function write(path, text) {
|
|
56
|
+
if (dryRun) return
|
|
57
|
+
mkdirSync(dirname(path), { recursive: true })
|
|
58
|
+
writeFileSync(path, text)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Insert or replace the marked Panelize section in a Markdown file.
|
|
62
|
+
function mergeSection(file, body) {
|
|
63
|
+
const path = join(cwd, file)
|
|
64
|
+
const section = `${START}\n${body.trim()}\n${END}\n`
|
|
65
|
+
if (!existsSync(path)) {
|
|
66
|
+
write(path, section)
|
|
67
|
+
return 'created'
|
|
68
|
+
}
|
|
69
|
+
const current = read(path)
|
|
70
|
+
const eol = current.includes('\r\n') ? '\r\n' : '\n'
|
|
71
|
+
const text = section.replace(/\n/g, eol)
|
|
72
|
+
const start = current.indexOf(START)
|
|
73
|
+
const end = current.indexOf(END)
|
|
74
|
+
if (start === -1 && end === -1) {
|
|
75
|
+
write(path, current.trim() ? `${current.trimEnd()}${eol}${eol}${text}` : text)
|
|
76
|
+
return 'appended'
|
|
77
|
+
}
|
|
78
|
+
if (start === -1 || end < start) {
|
|
79
|
+
throw new Error(`${file} has a damaged Panelize section (check the ${START} / ${END} lines)`)
|
|
80
|
+
}
|
|
81
|
+
const tail = current.slice(end + END.length).replace(/^\r?\n/, '')
|
|
82
|
+
const next = current.slice(0, start) + text + tail
|
|
83
|
+
if (next === current) return 'unchanged'
|
|
84
|
+
write(path, next)
|
|
85
|
+
return 'updated'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Write a whole file. A different existing file is left alone unless --force.
|
|
89
|
+
function writeWhole(file, body) {
|
|
90
|
+
const path = join(cwd, file)
|
|
91
|
+
if (!existsSync(path)) {
|
|
92
|
+
write(path, body)
|
|
93
|
+
return 'created'
|
|
94
|
+
}
|
|
95
|
+
if (read(path) === body) return 'unchanged'
|
|
96
|
+
if (!has('--force')) return 'skipped (exists and differs; use --force to overwrite)'
|
|
97
|
+
write(path, body)
|
|
98
|
+
return 'overwritten'
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const agents = packaged('examples/AGENTS.md')
|
|
102
|
+
const steps = [['AGENTS.md', () => mergeSection('AGENTS.md', agents)]]
|
|
103
|
+
if (all || has('--cursor')) {
|
|
104
|
+
const rule = () => writeWhole('.cursor/rules/panelize.mdc', packaged('examples/cursor-rule.mdc'))
|
|
105
|
+
steps.push(['.cursor/rules/panelize.mdc', rule])
|
|
106
|
+
}
|
|
107
|
+
if (all || has('--claude')) steps.push(['CLAUDE.md', () => mergeSection('CLAUDE.md', '@AGENTS.md')])
|
|
108
|
+
if (all || has('--copilot')) {
|
|
109
|
+
steps.push([
|
|
110
|
+
'.github/copilot-instructions.md',
|
|
111
|
+
() => mergeSection('.github/copilot-instructions.md', agents),
|
|
112
|
+
])
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let failed = false
|
|
116
|
+
for (const [file, run] of steps) {
|
|
117
|
+
try {
|
|
118
|
+
console.log(`${run()} ${file}${dryRun ? ' (dry run)' : ''}`)
|
|
119
|
+
} catch (error) {
|
|
120
|
+
failed = true
|
|
121
|
+
console.error(`error ${file}: ${error.message}`)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (!failed && !dryRun) console.log('\nCommit these files so everyone on the project gets them.')
|
|
125
|
+
process.exit(failed ? 1 : 0)
|
package/examples/AGENTS.md
CHANGED
package/examples/cursor-rule.mdc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
alwaysApply:
|
|
2
|
+
description: Build and edit frontend UI (pages, views, layouts, components) in a project that has panelize installed, including new files that do not import it yet. Compose with Panelize layout primitives and type.
|
|
3
|
+
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Panelize (this app)
|
package/llms-full.txt
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
> A React layout kit. Named boxes and type are the map of the screen. `createPanelizeTheme` + `PanelizeProvider` + `usePanelizeTheme` standardize paint. Forms are bonus.
|
|
6
6
|
|
|
7
|
-
This file is for agents **building apps and custom components with Panelize**. Maintainers of this repo: [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md). After `npm install panelize`, read `node_modules/panelize/llms.txt` (or the package export `panelize/llms.txt`). One-file dump: [llms-full.txt](llms-full.txt).
|
|
7
|
+
This file is for agents **building apps and custom components with Panelize**. Maintainers of this repo: [CONTRIBUTING.md](https://github.com/jayzizzle/panelize/blob/main/CONTRIBUTING.md) and [AGENTS.md](https://github.com/jayzizzle/panelize/blob/main/AGENTS.md). After `npm install panelize`, read `node_modules/panelize/llms.txt` (or the package export `panelize/llms.txt`). One-file dump: [llms-full.txt](llms-full.txt).
|
|
8
|
+
|
|
9
|
+
**Humans:** if you are setting up a project for an agent, run `npx panelize init-agents` from the project root. It adds a Panelize section to `AGENTS.md` that points agents here. See [Host setup](#host-setup).
|
|
8
10
|
|
|
9
11
|
Import from `'panelize'`. Wrap the host once with `PanelizeProvider`. Do not take over the host’s styled-components `ThemeProvider`. Do not set `html` / `body` from the library. Host CSS must give the shell a height (`html`, `body`, `#root { height: 100% }` for a filled app).
|
|
10
12
|
|
|
@@ -42,10 +44,11 @@ The library does not warn at runtime if a host ignores this. Follow it anyway
|
|
|
42
44
|
|
|
43
45
|
- [llms-full.txt](llms-full.txt): this index, every `docs/` page, and the theme keys in one file
|
|
44
46
|
|
|
45
|
-
## Host setup
|
|
47
|
+
## Host setup
|
|
48
|
+
|
|
49
|
+
Agents only know about these docs if the host project points at them. From the project root, `npx panelize init-agents` adds a marked Panelize section to `AGENTS.md` (created if missing, otherwise appended; re-running updates only that section). Add `--cursor`, `--claude`, `--copilot`, or `--all` for tool-specific files, and `--dry-run` to preview.
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
- [examples/AGENTS.md](examples/AGENTS.md): drop into a host app’s `AGENTS.md`
|
|
51
|
+
By hand, copy the section from [examples/AGENTS.md](examples/AGENTS.md) into the host’s agent instructions (`AGENTS.md`, `CLAUDE.md`, Copilot instructions, or a system prompt). Cursor users can also copy [examples/cursor-rule.mdc](examples/cursor-rule.mdc) to `.cursor/rules/panelize.mdc`.
|
|
49
52
|
|
|
50
53
|
## Human docs
|
|
51
54
|
|
package/llms.txt
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> A React layout kit. Named boxes and type are the map of the screen. `createPanelizeTheme` + `PanelizeProvider` + `usePanelizeTheme` standardize paint. Forms are bonus.
|
|
4
4
|
|
|
5
|
-
This file is for agents **building apps and custom components with Panelize**. Maintainers of this repo: [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md). After `npm install panelize`, read `node_modules/panelize/llms.txt` (or the package export `panelize/llms.txt`). One-file dump: [llms-full.txt](llms-full.txt).
|
|
5
|
+
This file is for agents **building apps and custom components with Panelize**. Maintainers of this repo: [CONTRIBUTING.md](https://github.com/jayzizzle/panelize/blob/main/CONTRIBUTING.md) and [AGENTS.md](https://github.com/jayzizzle/panelize/blob/main/AGENTS.md). After `npm install panelize`, read `node_modules/panelize/llms.txt` (or the package export `panelize/llms.txt`). One-file dump: [llms-full.txt](llms-full.txt).
|
|
6
|
+
|
|
7
|
+
**Humans:** if you are setting up a project for an agent, run `npx panelize init-agents` from the project root. It adds a Panelize section to `AGENTS.md` that points agents here. See [Host setup](#host-setup).
|
|
6
8
|
|
|
7
9
|
Import from `'panelize'`. Wrap the host once with `PanelizeProvider`. Do not take over the host’s styled-components `ThemeProvider`. Do not set `html` / `body` from the library. Host CSS must give the shell a height (`html`, `body`, `#root { height: 100% }` for a filled app).
|
|
8
10
|
|
|
@@ -40,10 +42,11 @@ The library does not warn at runtime if a host ignores this. Follow it anyway
|
|
|
40
42
|
|
|
41
43
|
- [llms-full.txt](llms-full.txt): this index, every `docs/` page, and the theme keys in one file
|
|
42
44
|
|
|
43
|
-
## Host setup
|
|
45
|
+
## Host setup
|
|
46
|
+
|
|
47
|
+
Agents only know about these docs if the host project points at them. From the project root, `npx panelize init-agents` adds a marked Panelize section to `AGENTS.md` (created if missing, otherwise appended; re-running updates only that section). Add `--cursor`, `--claude`, `--copilot`, or `--all` for tool-specific files, and `--dry-run` to preview.
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
- [examples/AGENTS.md](examples/AGENTS.md): drop into a host app’s `AGENTS.md`
|
|
49
|
+
By hand, copy the section from [examples/AGENTS.md](examples/AGENTS.md) into the host’s agent instructions (`AGENTS.md`, `CLAUDE.md`, Copilot instructions, or a system prompt). Cursor users can also copy [examples/cursor-rule.mdc](examples/cursor-rule.mdc) to `.cursor/rules/panelize.mdc`.
|
|
47
50
|
|
|
48
51
|
## Human docs
|
|
49
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelize",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A React layout kit: named panels, tracks, grid, and type, themed with createPanelizeTheme and PanelizeProvider.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"author": "Jon Zamora",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"sideEffects": false,
|
|
26
|
+
"bin": {
|
|
27
|
+
"panelize": "./bin/panelize.mjs"
|
|
28
|
+
},
|
|
26
29
|
"main": "./dist/panelize.cjs",
|
|
27
30
|
"module": "./dist/panelize.es.js",
|
|
28
31
|
"types": "./dist/index.d.ts",
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
"./package.json": "./package.json"
|
|
45
48
|
},
|
|
46
49
|
"files": [
|
|
50
|
+
"bin",
|
|
47
51
|
"dist",
|
|
48
52
|
"llms.txt",
|
|
49
53
|
"llms-full.txt",
|