tkeron 5.3.0 → 6.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.
Files changed (59) hide show
  1. package/README.md +17 -16
  2. package/bun.lock +13 -196
  3. package/changelog.md +55 -0
  4. package/examples/init_sample/websrc/about.html +19 -0
  5. package/examples/init_sample/websrc/components/content/about-intro.com.md +7 -0
  6. package/examples/init_sample/websrc/components/layout/hero-section.com.html +88 -0
  7. package/examples/init_sample/websrc/components/layout/site-footer.com.html +20 -0
  8. package/examples/init_sample/websrc/components/layout/site-header.com.html +44 -0
  9. package/examples/init_sample/websrc/components/ui/counter-button.com.html +48 -0
  10. package/examples/init_sample/websrc/components/ui/crypto-prices-card.com.html +52 -0
  11. package/examples/init_sample/websrc/components/ui/html-components-card.com.html +10 -0
  12. package/examples/init_sample/websrc/{info-card.com.html → components/ui/info-card.com.html} +10 -6
  13. package/examples/init_sample/websrc/components/ui/markdown-card.com.html +21 -0
  14. package/examples/init_sample/websrc/{pre-render-card.com.html → components/ui/pre-render-card.com.html} +6 -3
  15. package/examples/init_sample/websrc/components/ui/quote-card.com.html +32 -0
  16. package/examples/init_sample/websrc/components/ui/styles-injector.com.ts +5 -0
  17. package/examples/init_sample/websrc/components/ui/ts-components-card.com.html +11 -0
  18. package/examples/init_sample/websrc/components/ui/user-badge.com.ts +30 -0
  19. package/examples/init_sample/websrc/docs.html +33 -0
  20. package/examples/init_sample/websrc/index.html +10 -209
  21. package/examples/init_sample/websrc/index.post.ts +70 -0
  22. package/examples/init_sample/websrc/index.pre.ts +10 -61
  23. package/examples/init_sample/websrc/index.ts +9 -7
  24. package/examples/init_sample/websrc/styles/global-styles.com.ts +5 -0
  25. package/examples/init_sample/websrc/styles/main.css +112 -0
  26. package/examples/init_sample/websrc/utils/api-service.ts +93 -0
  27. package/examples/with_global_styles/websrc/bad.html +23 -0
  28. package/examples/with_global_styles/websrc/global-styles.com.ts +5 -0
  29. package/examples/with_global_styles/websrc/good.html +22 -0
  30. package/examples/with_global_styles/websrc/index.html +25 -0
  31. package/examples/with_global_styles/websrc/styles.css +24 -0
  32. package/examples/with_style_dedup/websrc/tag-chip.com.html +15 -0
  33. package/examples/with_style_dedup/websrc/tag-chip.com.ts +2 -18
  34. package/index.ts +15 -0
  35. package/package.json +9 -13
  36. package/skills/tkeron/SKILL.md +287 -0
  37. package/skills/tkeron-components/SKILL.md +785 -0
  38. package/skills/tkeron-organization/SKILL.md +231 -0
  39. package/skills/tkeron-patterns/SKILL.md +587 -0
  40. package/skills/tkeron-testing/SKILL.md +194 -0
  41. package/skills/tkeron-troubleshooting/SKILL.md +263 -0
  42. package/src/build.ts +4 -6
  43. package/src/develop.ts +1 -2
  44. package/src/init.ts +1 -2
  45. package/src/skills.ts +139 -0
  46. package/src/skillsWrapper.ts +79 -0
  47. package/docs/mcp-server.md +0 -240
  48. package/examples/init_sample/websrc/api-service.ts +0 -98
  49. package/examples/init_sample/websrc/counter-card.com.html +0 -9
  50. package/examples/init_sample/websrc/favicon.ico +0 -0
  51. package/examples/init_sample/websrc/hero-section.com.html +0 -23
  52. package/examples/init_sample/websrc/html-components-card.com.html +0 -6
  53. package/examples/init_sample/websrc/ts-components-card.com.html +0 -6
  54. package/examples/init_sample/websrc/user-badge.com.ts +0 -17
  55. package/mcp-server.ts +0 -272
  56. package/src/cleanupOrphanedTempDirs.ts +0 -31
  57. package/src/promptUser.ts +0 -15
  58. package/src/setupSigintHandler.ts +0 -6
  59. /package/examples/init_sample/websrc/{profile.png → assets/profile.png} +0 -0
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: tkeron-organization
3
+ description: "Tkeron project organization: root=sitemap principle, directory layout, where components live, naming conventions for files and components, and the discipline of when to componentize vs leave inline. Use this skill when starting a new tkeron project, restructuring an existing one, naming new files, or deciding whether to extract markup into a component."
4
+ ---
5
+
6
+ # Tkeron — Project Organization
7
+
8
+ ## Fundamental Principle: root = sitemap
9
+
10
+ The root of `websrc/` must be a **faithful image of the final sitemap**. Every `.html` at root or inside a subdirectory maps directly to a route. Components, utils and styles live in dedicated directories that are NOT routes.
11
+
12
+ ```
13
+ websrc/
14
+ ├── index.html # → /
15
+ ├── index.ts # Browser JS for /
16
+ ├── index.pre.ts # Pre-render for /
17
+ ├── about.html # → /about
18
+ ├── pricing.html # → /pricing
19
+
20
+ ├── blog/
21
+ │ ├── index.html # → /blog/
22
+ │ └── post-template.html # → /blog/post-template
23
+
24
+ ├── docs/
25
+ │ ├── index.html # → /docs/
26
+ │ ├── getting-started.html # → /docs/getting-started
27
+ │ └── cli-reference.html # → /docs/cli-reference
28
+
29
+ ├── components/ # ← NOT a route, only stores components
30
+ │ ├── layout/
31
+ │ │ ├── site-header.com.html
32
+ │ │ ├── site-footer.com.html
33
+ │ │ └── page-sidebar.com.html
34
+ │ ├── ui/
35
+ │ │ ├── info-card.com.html
36
+ │ │ ├── user-badge.com.ts
37
+ │ │ └── alert-box.com.ts
38
+ │ └── content/
39
+ │ ├── hero-text.com.md
40
+ │ └── about-section.com.md
41
+
42
+ ├── styles/ # OPTIONAL — .css source files (or place them
43
+ │ │ anywhere). Never loaded via <link>; a
44
+ │ │ .com.ts component reads and inlines them.
45
+ │ └── main.css # Tokens + resets + body typography (small!)
46
+
47
+ └── utils/
48
+ ├── format.ts # Helpers (imported by .com.ts or .pre.ts)
49
+ └── api-service.ts # API functions
50
+ ```
51
+
52
+ ### Principles
53
+
54
+ - **Root = sitemap**: scanning the root of `websrc/` reveals the URL structure of the site.
55
+ - **Components outside root**: ALWAYS in `components/` with subfolders by domain (`layout/`, `ui/`, `content/`).
56
+ - Related files for a page stay together (`page.html` + `page.ts` + `page.pre.ts` + `page.post.ts` in the same directory).
57
+ - Flat when there are few files, subfolders when it grows.
58
+ - Local override components live next to the page that uses them (resolution priority — see `tkeron-components`).
59
+
60
+ ### Why NOT a `pages/` subdirectory
61
+
62
+ Putting pages inside `pages/` breaks the root = sitemap principle. The routes `/about` and `/contact` must appear as `about.html` and `contact.html` directly at root, not hidden inside `pages/about/about.html`. The root **is** the sitemap.
63
+
64
+ ---
65
+
66
+ ## When to Componentize (and When Not)
67
+
68
+ Tkeron gives a lot of freedom: you can have no components or turn everything into a component. That freedom requires discipline.
69
+
70
+ ### Golden rule
71
+
72
+ > A component justifies its existence if it **eliminates real duplication** (2+ uses) or **encapsulates logic** (`.com.ts` with attributes). If it does neither, it is gratuitous indirection.
73
+
74
+ ### ✅ Create a component WHEN
75
+
76
+ | Situation | Recommended type |
77
+ | ---------------------------------------------------- | ----------------------- |
78
+ | Markup shared between 2+ pages (header, footer, nav) | `.com.html` |
79
+ | Dynamic block whose attributes vary per instance | `.com.ts` |
80
+ | Markdown content referenced from several pages | `.com.md` |
81
+ | Template + complex logic worth isolating | `.com.html` + `.com.ts` |
82
+
83
+ ### ❌ Do NOT create a component WHEN
84
+
85
+ | Situation | Why not |
86
+ | -------------------------------------------------- | ------------------------------------------------------- |
87
+ | Used only once, no logic | Indirection with no benefit — reading inline is clearer |
88
+ | HTML is trivial (2–5 lines) | Not worth a file for `<div class="divider"></div>` |
89
+ | "For visual organization" because the page is long | Use sections + comments + indentation inside the HTML |
90
+ | "Might be reused someday" | YAGNI — extract when actually needed, not before |
91
+
92
+ ### The freedom problem — both extremes
93
+
94
+ ```
95
+ ❌ Bad: bloated HTML, no components
96
+ websrc/
97
+ ├── index.html ← 400 lines, header/footer/cards duplicated
98
+ ├── about.html ← 300 lines, same header/footer/cards copy-paste
99
+ └── contact.html ← 200 lines, same header/footer copy-paste
100
+
101
+ ✅ Fix: extract what is shared
102
+ websrc/
103
+ ├── index.html ← <site-header>, <info-card>, <site-footer>
104
+ ├── about.html ← <site-header>, <info-card>, <site-footer>
105
+ ├── contact.html ← <site-header>, <site-footer>
106
+ └── components/
107
+ └── layout/
108
+ ├── site-header.com.html
109
+ ├── site-footer.com.html
110
+ └── info-card.com.html
111
+ ```
112
+
113
+ ```
114
+ ❌ Bad: over-componentization
115
+ websrc/
116
+ ├── index.html ← only 8 custom elements, empty HTML
117
+ ├── hero-section.com.html ← used 1 time
118
+ ├── intro-text.com.html ← used 1 time
119
+ ├── feature-list.com.html ← used 1 time
120
+ ├── cta-block.com.html ← used 1 time
121
+ └── ...
122
+ To understand index.html you must open 8 files.
123
+
124
+ ✅ Fix: leave inline what is used once
125
+ websrc/
126
+ ├── index.html ← full HTML, readable top to bottom
127
+ ├── components/
128
+ │ └── layout/
129
+ │ ├── site-header.com.html ← shared with about.html
130
+ │ └── site-footer.com.html ← shared with about.html
131
+ └── about.html
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Naming
137
+
138
+ ### Components — mandatory hyphen
139
+
140
+ Every component file MUST produce a tag with a hyphen (HTML custom-elements standard) and MUST NOT collide with a standard HTML tag.
141
+
142
+ ```
143
+ ✅ GOOD:
144
+ user-profile-card.com.html → <user-profile-card>
145
+ nav-menu-item.com.html → <nav-menu-item>
146
+ blog-post-card.com.ts → <blog-post-card>
147
+ social-share-button.com.ts → <social-share-button>
148
+ hero-section.com.md → <hero-section>
149
+
150
+ ❌ BAD:
151
+ card.com.html → No hyphen (invalid custom element)
152
+ header.com.html → Standard HTML tag (collision)
153
+ button.com.html → Standard HTML tag (collision)
154
+ UserProfile.com.html → Works but not idiomatic
155
+ component1.com.html → No meaning
156
+ btn.com.html → Too abbreviated
157
+ thing.com.html → No clear purpose
158
+ ```
159
+
160
+ **Format**: kebab-case, lowercase with hyphens.
161
+
162
+ ### Pages and general files
163
+
164
+ ```
165
+ ✅ GOOD:
166
+ index.html, about.html, blog-post.html
167
+ api-service.ts, format-utils.ts
168
+ main.css, tokens.css
169
+
170
+ ❌ BAD:
171
+ Index.html → Always lowercase
172
+ About Page.html → No spaces (tkeron does not handle them)
173
+ blog_post.html → Hyphens, not underscores
174
+ temp.html, test123.html → No meaning
175
+ ```
176
+
177
+ ### Assets — no spaces
178
+
179
+ Tkeron does not handle file names with spaces correctly — the build may fail silently or not copy the asset to the output. Applies to ALL files in `websrc/` (assets, components, scripts).
180
+
181
+ ```
182
+ ❌ BAD
183
+ websrc/assets/my logo.webp
184
+ websrc/assets/hero image.png
185
+
186
+ ✅ GOOD — hyphen or underscore
187
+ websrc/assets/my-logo.webp
188
+ websrc/assets/hero-image.png
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Where Each File Type Lives
194
+
195
+ | File | Location |
196
+ | ----------------------------- | -------------------------------------------------------------- |
197
+ | Pages (`*.html`) | Root of `websrc/` or sub-route directories — never in `pages/` |
198
+ | Per-page scripts (`*.ts`) | Same directory as the paired `.html` |
199
+ | Per-page `.pre.ts`/`.post.ts` | Same directory as the paired `.html` |
200
+ | Shared components | `websrc/components/<domain>/` (`layout/`, `ui/`, `content/`) |
201
+ | Local-override components | Same directory as the page that uses them (wins by priority) |
202
+ | Global styles | Free choice (root of `websrc/`, a `styles/` folder, next to the loader component). Source `.css` files are NOT loaded via `<link>`; a `.com.ts` reads them and inlines as `<style>` (see `tkeron-patterns` → "CSS via components"). Per-component CSS lives **inside** each `.com.html`. |
203
+ | Build-time utils (Bun) | `websrc/utils/` — imported by `.pre.ts`, `.post.ts`, `.com.ts` |
204
+ | Static assets | `websrc/assets/` (or wherever — they are copied as-is) |
205
+ | Output | `web/` — **NEVER edit, always in `.gitignore`** |
206
+
207
+ ---
208
+
209
+ ## Excessive Nesting
210
+
211
+ Components can use other components (Tkeron processes up to 10 iterations), but deep chains are hard to debug.
212
+
213
+ ```
214
+ ❌ BAD (hard to debug):
215
+ page → layout → section → card → header → icon → svg (7 levels)
216
+
217
+ ✅ GOOD (2–3 levels max):
218
+ page.html → site-header.com.html → nav-logo.com.html
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Quick Checklist Before Committing Structure
224
+
225
+ 1. ✅ Every `.html` at root corresponds to an actual route
226
+ 2. ✅ Every component lives under `components/<domain>/`, never loose at root
227
+ 3. ✅ Every component name has a hyphen and is not a standard HTML tag
228
+ 4. ✅ No file names with spaces, capitals, or underscores (use kebab-case)
229
+ 5. ✅ Local overrides (same-directory components) are intentional, not accidental
230
+ 6. ✅ No component is extracted "just in case" — only with 2+ uses or logic
231
+ 7. ✅ Component chains are ≤ 3 levels deep when possible