paneltir 0.6.0

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.
@@ -0,0 +1,66 @@
1
+ # Block to paste into each consumer project's CLAUDE.md (not this repository's)
2
+
3
+ This is not documentation of the kit — it is the block that goes into the
4
+ `CLAUDE.md` of every project that uses it. `CLAUDE.md` is reloaded every
5
+ session, unlike `INSTALL.md`, which is read once at install time. This is the
6
+ rule that has to survive a "just add X to the dashboard" request six months
7
+ from now, without anyone repeating it.
8
+
9
+ ---
10
+
11
+ ## Admin dashboard
12
+
13
+ This project's admin dashboard uses `paneltir` (`node_modules/paneltir`), a
14
+ library shared with other projects. Rules:
15
+
16
+ - **Never edit files inside `node_modules/paneltir`.** Not even when asked to
17
+ "change the dashboard" or "add X to the cards" — that phrasing almost always
18
+ means the content or the data, not the library.
19
+ - **Content, data and business logic** (which columns exist, what each card
20
+ shows, where the data comes from, what happens on click) live in
21
+ `src/dashboard/` <!-- adjust to this project's real path --> and are built
22
+ by composing the kit's components (`Board`, `Card`, `StatTile`, and so on —
23
+ props like `children` and `renderCard` exist for this).
24
+ - **If a request implies changing the structure or behaviour of the kit
25
+ itself** (layout, how drag and drop works, theming), do not solve it
26
+ locally: say so explicitly before touching anything. That change belongs in
27
+ the `paneltir` repository and reaches this project as a new version. See
28
+ `node_modules/paneltir/INSTALL.md` for the order to follow (composition →
29
+ change in the kit → patch-package).
30
+ - The dashboard palette lives in <!-- path to this project's theme file, e.g.
31
+ src/dashboard-theme.ts -->. Colour changes go there, never in the kit. The
32
+ dashboard's **shape** is a `DashboardThemeForm` passed to the same provider
33
+ (`panel` or `ledger`); it too is this project's choice, not the kit's.
34
+ - **The panel's gate is this project's, not the library's.** `middleware.ts`,
35
+ `lib/session.ts` and `api/login.ts` / `api/logout.ts` / `api/panel-state.ts`
36
+ were copied here by `npx paneltir init`. They hold this project's password
37
+ rule and point at this project's repository. Edit them here; they do not
38
+ change when the kit updates, and `paneltir init` will not overwrite them.
39
+ The password, the GitHub token and the target repository are environment
40
+ variables where this project is hosted — never in this repository.
41
+ - **The panel explains itself once.** New readers get a short guided tour the
42
+ first time they open the board; each note is dismissed and stays dismissed,
43
+ per browser. **Help** in the header reports what the panel needs — the
44
+ password, the GitHub token, the target repository — with what is missing and
45
+ the steps to fix it, asked from the server so it reports the truth rather
46
+ than a guess. "Show the guide again" in there brings the tour back.
47
+ - **Say which version the dashboard runs on.** `paneltirBuild.short` from
48
+ `paneltir` renders as `vX.Y.Z · <first 12 of the fingerprint>`; keep it visible somewhere in
49
+ the panel. `npx paneltir version` answers the same question from a terminal,
50
+ and `npx paneltir check <version>` exits non-zero when what is installed is
51
+ not what was meant.
52
+ - **The board's shape is checked, so a broken one says which line.** Editing
53
+ `src/data/panel-state.json` by hand is allowed, and sometimes the fastest
54
+ way. Run `npx paneltir board` afterwards: it names every problem — a card in
55
+ a column that was renamed, an intent nothing can honour, a completion with no
56
+ start — instead of the panel opening on a blank screen. The write API refuses
57
+ the same shapes, so a bad save never reaches the repository.
58
+ - **Kit fingerprint (so re-reading it does not cost tokens).** The version of
59
+ `paneltir` integrated here has the hash
60
+ `<!-- paste the "hash" field from node_modules/paneltir/fingerprint.json -->`.
61
+ Before re-reading `node_modules/paneltir/README.md`, `INSTALL.md` or its
62
+ source, compare that value with the current `hash` in
63
+ `node_modules/paneltir/fingerprint.json`: **if they match, the kit did not
64
+ change and nothing needs to be read again.** If they differ, read only what
65
+ is necessary — the `files` map names which files changed — and update this
66
+ hash afterwards.
package/INSTALL.md ADDED
@@ -0,0 +1,261 @@
1
+ # Install instructions (written for Claude Code)
2
+
3
+ > This file is an instruction for an agent, not documentation for a human
4
+ > reader. When `paneltir` should go into a project, paste this — or "follow
5
+ > the instructions in paneltir's INSTALL.md" — to Claude Code in that
6
+ > repository. Nothing else needs explaining.
7
+
8
+ ## Task
9
+
10
+ Install `paneltir` in this project so that the admin dashboard uses the
11
+ kit's structure and behaviour, but **with this project's own visual
12
+ identity** — never another project's.
13
+
14
+ ## Steps
15
+
16
+ 1. **Install the package**, pinned to an exact tag:
17
+
18
+ ```bash
19
+ npm install paneltir
20
+
21
+ # or, without npm access, straight from the repository:
22
+ # npm install github:daifukus/paneltir#v0.6.0
23
+ ```
24
+
25
+ (Use the tag you were given; never install without pinning a version.)
26
+
27
+ 2. **Find the palette this project already has**, before writing anything.
28
+ `npx paneltir init` names the files it found it in, if the gate is being
29
+ installed too.
30
+ Look, in this order:
31
+ - an existing design-token or theme file (`theme.ts`, `colors.ts`,
32
+ `tailwind.config.js`, CSS variables in `globals.css` or similar);
33
+ - the colours already used by current components (buttons, header,
34
+ backgrounds);
35
+ - the project's branding (name, logo, any brand guide in the repository).
36
+
37
+ **Do not invent a new palette when one already exists.** The goal is a
38
+ dashboard that looks like part of *this* project, not a generic theme and
39
+ not another project's theme.
40
+
41
+ 3. **If no palette is defined yet**, do not make up values: `paneltir` ships
42
+ base themes that are already designed and tested (`cyberpunkTheme`,
43
+ `midnightTheme`, `oldMoneyTheme`, all exported in `THEME_PRESETS`). Ask
44
+ which one fits the project best — and if the answer is not available right
45
+ now, use `midnightTheme`, the most neutral one, and say so explicitly.
46
+ Store the decision in a new file (for example `src/dashboard-theme.ts`),
47
+ re-exporting the chosen preset, or copying its values if they are expected
48
+ to diverge:
49
+
50
+ ```tsx
51
+ // src/dashboard-theme.ts
52
+ export { cyberpunkTheme as dashboardTheme } from 'paneltir'
53
+ ```
54
+
55
+ Make it clear in the code that this is a decision that was taken, and
56
+ which preset it came from — not a placeholder.
57
+
58
+ 4. **Map those colours to `DashboardThemeTokens`** (the interface the package
59
+ exports): `ground`, `groundRaised`, `panel`, `raised`, `line`, `lineFaint`,
60
+ `ink`, `inkDim`, `inkFaint`, `accent` (plus optional `accentStart`,
61
+ `accentEnd`, `accentInk`), `danger`, `warning`, `success`, `neutral`. Each
62
+ role is documented in the package's `.d.ts` — read it before guessing what
63
+ belongs where.
64
+
65
+ 5. **Optionally pick a form.** Colour alone leaves every project the same
66
+ object repainted. A `DashboardThemeForm` chooses the *shape* instead:
67
+ `shape: 'panel'` (the default — raised cards floating in a rounded column)
68
+ or `shape: 'ledger'` (a ruled book: no fill, hairline rows, priority marked
69
+ in the gutter, set in a serif). `THEME_FORMS.panel` and `THEME_FORMS.ledger`
70
+ are ready to use, and the other fields — radii, `borderWidth`,
71
+ `fontFamily`, `labelTracking`, `density` — tune whichever is chosen. Skip
72
+ this and the kit renders exactly as it always has.
73
+
74
+ 6. **Wrap this project's admin section**:
75
+
76
+ ```tsx
77
+ import { DashboardThemeProvider, THEME_FORMS } from 'paneltir'
78
+ import 'paneltir/style.css'
79
+
80
+ <DashboardThemeProvider tokens={thisProjectTokens} form={THEME_FORMS.panel}>
81
+ {/* dashboard */}
82
+ </DashboardThemeProvider>
83
+ ```
84
+
85
+ The `import 'paneltir/style.css'` goes in once, at the dashboard's entry
86
+ point — do not repeat it per screen.
87
+
88
+ To give this project its own typeface, set `--pt-font-family` (or the form's
89
+ `fontFamily`) — never `font-family` on the element the provider renders: the
90
+ form's face is written inline there, and a stylesheet rule on the same
91
+ element would silently win.
92
+
93
+ 7. **Build the screens with the kit's components** (`Board`, `Card`,
94
+ `StatTile`, `HealthPill`, `FilterChip`, `DetailSheet` and the rest — see
95
+ `paneltir`'s `README.md` for the full list and examples), wired to this
96
+ project's real data. Business logic, data fetching and what goes in each
97
+ column or card remain this project's responsibility: the kit neither
98
+ provides nor assumes them.
99
+
100
+ 8. **Install the gate, the board and the skill:**
101
+
102
+ ```bash
103
+ npx paneltir init
104
+ ```
105
+
106
+ **It looks at the project before it writes.** Most projects installing this
107
+ are not empty: they have a palette, an admin area, often a password already
108
+ in use, sometimes another dashboard package still installed. `init` reports
109
+ each one it finds and says what to do about it — reuse the password rather
110
+ than adding a second, build inside the existing admin area rather than
111
+ beside it, adopt the palette rather than inventing one. It reads names, never
112
+ values: no secret is printed.
113
+
114
+ It copies three things, and all of them belong to the project once written:
115
+
116
+ - **The gate** — `middleware.ts`, `lib/session.ts`, `api/login.ts`,
117
+ `api/logout.ts`, `api/panel-state.ts`. Not part of the library: they hold
118
+ this project's password rule, point at this project's repository, and run
119
+ on the hosting platform rather than in the bundle. Shipping them inside
120
+ the library would mean every project's front door moving whenever the
121
+ library updates.
122
+ - **The board** — `src/data/panel-state.json`, empty, with the columns
123
+ already there and three questions nobody has answered. It is the only
124
+ file `init --force` will not replace: it stops being a template the
125
+ moment this project writes its first card into it.
126
+ - **The skill** — `.claude/skills/panel/SKILL.md`, which is how *this
127
+ project's* Claude knows what the board means: that `order` is a request,
128
+ that three of the nine intents are refusals, what moving a card claims,
129
+ and that a standing question with no answer is asked rather than guessed.
130
+ Say `/panel` in a session to use it.
131
+
132
+ Re-running `init` never overwrites anything that is already there, and
133
+ `--force` replaces only the gate.
134
+
135
+ **Then mount the panel. It is one component, not an assembly.**
136
+
137
+ ```tsx
138
+ import 'paneltir/style.css'
139
+ import { PanelApp } from 'paneltir'
140
+ import board from './data/panel-state.json'
141
+
142
+ <PanelApp state={board} saveEndpoint="/admin/api/panel-state" showHistory />
143
+ ```
144
+
145
+ That is the whole page. `PanelApp` draws the board, the analysis, the card
146
+ sheet, the settings, the guide and the notifications, and it offers the
147
+ kit's themes with no further configuration. Everything a project wants
148
+ differently is a prop rather than a fork:
149
+
150
+ | Prop | What it changes |
151
+ | --- | --- |
152
+ | `themes`, `defaultTheme` | The identities the settings sheet offers. Defaults to the kit's presets. |
153
+ | `brand` | What sits where a name goes in the header. Defaults to the board's `project`. |
154
+ | `capabilities`, `extras` | Sections of the caller's own. Not drawn when absent. |
155
+ | `links`, `footer`, `decoration`, `className` | Where else to go, what sits under the panel, and anything the caller draws behind it. |
156
+ | `saveEndpoint` | The one that changes behaviour rather than appearance: with it the panel commits, without it nothing is written and the guide says so. |
157
+
158
+ The components are still exported, so a project that wants to build its own
159
+ screen out of `Board`, `StatTile` and the rest can. `PanelApp` is there so
160
+ that it does not have to.
161
+
162
+ Then set these where the project is hosted — never in the repository:
163
+
164
+ | Variable | Value |
165
+ | --- | --- |
166
+ | `ADMIN_PASSWORD` | This project's panel password. Required; without it the panel answers 503 rather than becoming public. |
167
+ | `GH_TOKEN` | A fine-grained token with *contents: read and write* on **this project's** repository only. |
168
+ | `PANEL_REPO` | This project's `owner/repo`. There is no default: writing to the wrong repository is worse than not writing. |
169
+ | `PANEL_FILE` | Where the board lives in it, if not `src/data/panel-state.json`. |
170
+ | `SESSION_SECRET` | Optional. Defaults to `ADMIN_PASSWORD`, so changing the password ends every session already issued. |
171
+
172
+ Two things to check before trusting it: `/admin` signed out must land on
173
+ `/login`, and **the panel's own JavaScript bundle must answer 401 signed
174
+ out**. If it does not, point the last entry of the matcher in
175
+ `middleware.ts` at wherever this project's build emits it — protecting the
176
+ page but not the bundle leaves the board readable by anyone who opens the
177
+ HTML.
178
+
179
+ 9. **Record the kit fingerprint.** The kit reports itself, so no one has to
180
+ read `node_modules` to find out what is installed:
181
+
182
+ ```bash
183
+ npx paneltir version # version, fingerprint, where it came from
184
+ npx paneltir check 0.6.0 # exits non-zero if that is not what is installed
185
+ npx paneltir board # read the board and say what is wrong with it
186
+ ```
187
+
188
+ ```tsx
189
+ import { paneltirBuild } from 'paneltir'
190
+ // paneltirBuild.short → "vX.Y.Z · <first 12 of the fingerprint>"
191
+ ```
192
+
193
+ Put `paneltirBuild.short` somewhere the panel shows it — a footer or a
194
+ settings sheet. A dashboard that cannot say which version it is built on is
195
+ a dashboard nobody can support: "it looks wrong" and "it is three versions
196
+ behind" are indistinguishable from the outside. Paste the same hash into the
197
+ block from `CLAUDE_MD_SNIPPET.md`; comparing it later is enough to know
198
+ whether the kit changed, with no need to re-read its code.
199
+
200
+ 10. **Never edit files inside `node_modules/paneltir` by hand.** An
201
+ `npm install` overwrites them without warning, and the project is left with
202
+ an invisible divergence: `package.json` still names the same version while
203
+ the real code is something else. The files `paneltir init` copied are the
204
+ exception, and the only one: they live in the project, not in
205
+ `node_modules`, and are meant to be edited.
206
+
207
+ ## If the kit is missing something this project needs
208
+
209
+ Work through this order, without skipping steps:
210
+
211
+ 1. **Can it be solved by composition, without touching the kit?** Most cases
212
+ land here. `Card` takes `children` for extra content, `Board` takes
213
+ `renderCard` for full control over how each card looks, and
214
+ `DetailSheet`/`DetailSection` are generic containers. Build the new
215
+ behaviour in this project's code, wrapping the kit's components rather than
216
+ modifying them.
217
+
218
+ 2. **Is it structural, and will the other projects need it eventually** (a new
219
+ component, a change to how dragging behaves, a layout adjustment)? Then the
220
+ change belongs in the `paneltir` repository: make it there, test it, tag a
221
+ new version, and update this project to that version. Do not simulate it
222
+ locally "in the meantime".
223
+
224
+ 3. **Is it genuinely specific to this project**, with no reason to live in the
225
+ shared kit? Then diverging is fine, but do it traceably:
226
+
227
+ ```bash
228
+ npx patch-package paneltir
229
+ ```
230
+
231
+ after editing the code inside `node_modules/paneltir`. That generates
232
+ `patches/paneltir+<version>.patch`, which is committed to the repository
233
+ and re-applied on every `npm install` (this needs a `postinstall:
234
+ patch-package` script in this project's `package.json` — add it if it is
235
+ missing). Unlike a hand edit, the patch is versioned and tied to an exact
236
+ version of the kit: if the project moves to a newer kit and the patch no
237
+ longer applies, it fails loudly instead of disappearing in silence, and
238
+ that is the signal to decide whether the patch is still needed.
239
+
240
+ Leave a comment above the patch, or in the commit, explaining why it
241
+ exists, so it is a documented decision rather than a mystery six months
242
+ from now.
243
+
244
+ Divergence between projects is not the problem — it happens with any shared
245
+ library. The problem is invisible divergence. With versions pinned by tag plus
246
+ `patch-package` for what is truly specific, reading a project's `package.json`
247
+ and `patches/` folder is enough to know exactly which version it is on and
248
+ what was added on top.
249
+
250
+ ## How to check it went well
251
+
252
+ - The dashboard shows *this* project's colours and brand, not generic colours
253
+ and not another project's.
254
+ - No file in this repository hard-codes a colour for a kit component —
255
+ everything goes through the tokens from step 4.
256
+ - The board's drag and drop works on touch (try a narrow viewport or touch
257
+ emulation), not just with a mouse.
258
+ - There are no hand edits inside `node_modules/paneltir`: anything the kit was
259
+ missing is either composed in this project's own code or recorded as a
260
+ `patch-package` patch in `patches/`.
261
+ - This project's `CLAUDE.md` carries the kit fingerprint from step 7.
package/LICENSE ADDED
@@ -0,0 +1,90 @@
1
+ LICENCIA PROPIETARIA DE PANELTIR
2
+ Versión 1.0 — 4 de septiembre de 2026
3
+
4
+ Copyright (c) 2026 DFKlabs (daifukus). Todos los derechos reservados.
5
+
6
+ Este software, incluido su código fuente, código compilado, documentación,
7
+ temas, ejemplos y cualquier material asociado (en conjunto, el "Software",
8
+ conocido comercialmente como "Paneltir"), es propiedad exclusiva de DFKlabs
9
+ (el "Titular") y está protegido por las leyes de propiedad intelectual y los
10
+ tratados internacionales aplicables.
11
+
12
+ 1. AUSENCIA DE LICENCIA ABIERTA
13
+ Este NO es software libre ni de código abierto. El hecho de que el código
14
+ sea visible en un repositorio no otorga ningún derecho sobre él. Salvo lo
15
+ expresamente autorizado por escrito por el Titular, no se concede ninguna
16
+ licencia, expresa o implícita, sobre el Software.
17
+
18
+ 2. USO PERMITIDO
19
+ El Titular autoriza el uso del Software únicamente a:
20
+ a) el propio Titular y las personas que trabajen bajo su dirección;
21
+ b) los proyectos, productos y clientes que el Titular designe de forma
22
+ expresa y por escrito.
23
+ Cualquier otra persona o entidad que acceda al Software debe limitarse a
24
+ consultarlo y no adquiere derecho alguno de uso.
25
+
26
+ 3. PROHIBICIONES
27
+ Sin autorización previa, expresa y por escrito del Titular, queda prohibido:
28
+ a) copiar, reproducir, distribuir, publicar, sublicenciar, alquilar, vender
29
+ o ceder el Software, en todo o en parte;
30
+ b) modificar, traducir, adaptar o crear obras derivadas del Software;
31
+ c) incorporar el Software, o fragmentos de él, en otros productos, servicios
32
+ o bibliotecas, propios o de terceros;
33
+ d) redistribuir el Software como dependencia (npm, Git u otro mecanismo)
34
+ fuera de los proyectos autorizados según la cláusula 2;
35
+ e) eliminar, ocultar o alterar avisos de autoría, copyright o de esta
36
+ licencia;
37
+ f) utilizar el Software, su documentación o su código para entrenar,
38
+ ajustar o evaluar modelos de aprendizaje automático;
39
+ g) utilizar el nombre "Paneltir", "DFKlabs" o cualquier marca asociada para
40
+ promocionar productos o servicios sin consentimiento del Titular.
41
+
42
+ 4. TITULARIDAD
43
+ El Software se licencia, no se vende. El Titular conserva todos los
44
+ derechos, títulos e intereses sobre el Software, incluidas las
45
+ contribuciones que terceros aporten al repositorio. Al enviar una
46
+ contribución, el contribuyente cede al Titular todos los derechos sobre
47
+ ella de forma irrevocable y gratuita.
48
+
49
+ 5. CONFIDENCIALIDAD
50
+ El acceso al Software se concede con carácter confidencial. Quien acceda a
51
+ él se compromete a no revelarlo a terceros no autorizados.
52
+
53
+ 6. TERMINACIÓN
54
+ Cualquier incumplimiento de esta licencia extingue de forma automática e
55
+ inmediata todo permiso de uso. En ese caso, deberá cesarse en el uso del
56
+ Software y destruirse todas las copias en su poder.
57
+
58
+ 7. AUSENCIA DE GARANTÍA
59
+ EL SOFTWARE SE ENTREGA "TAL CUAL", SIN GARANTÍA DE NINGÚN TIPO, EXPRESA O
60
+ IMPLÍCITA, INCLUIDAS, SIN LIMITACIÓN, LAS GARANTÍAS DE COMERCIALIZACIÓN,
61
+ IDONEIDAD PARA UN FIN DETERMINADO Y NO INFRACCIÓN.
62
+
63
+ 8. LIMITACIÓN DE RESPONSABILIDAD
64
+ EN NINGÚN CASO EL TITULAR SERÁ RESPONSABLE DE DAÑOS DIRECTOS, INDIRECTOS,
65
+ INCIDENTALES, ESPECIALES O CONSECUENTES DERIVADOS DEL USO O LA IMPOSIBILIDAD
66
+ DE USO DEL SOFTWARE, AUNQUE SE LE HAYA ADVERTIDO DE LA POSIBILIDAD DE TALES
67
+ DAÑOS.
68
+
69
+ 9. LEGISLACIÓN APLICABLE
70
+ Esta licencia se rige por la legislación del domicilio del Titular. Toda
71
+ controversia se someterá a los tribunales competentes de dicho domicilio.
72
+
73
+ 10. CONTACTO
74
+ Para solicitar una autorización de uso, distribución o licencia comercial,
75
+ contactar con el Titular a través de https://DFKlabs.com.
76
+
77
+ ---
78
+
79
+ PANELTIR PROPRIETARY LICENSE (English summary — the Spanish text above
80
+ prevails)
81
+
82
+ Copyright (c) 2026 DFKlabs (daifukus). All rights reserved.
83
+
84
+ This is NOT open-source software. Source visibility grants no rights. Use is
85
+ restricted to the copyright holder and to projects it explicitly authorises in
86
+ writing. Copying, redistribution, modification, sublicensing, incorporation
87
+ into other products, and use for training machine-learning models are
88
+ prohibited without prior written consent. Contributions are assigned to the
89
+ holder. The software is provided "AS IS", without warranty of any kind. Any
90
+ breach terminates all permissions immediately. Contact: https://DFKlabs.com.