@knowcode/doc-builder 1.4.3 → 1.4.4

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,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node:*)",
5
+ "Bash(git add:*)",
6
+ "Bash(git commit:*)",
7
+ "Bash(npm version:*)",
8
+ "Bash(npm pack)",
9
+ "Bash(cat:*)",
10
+ "Bash(rm:*)",
11
+ "Bash(npm publish:*)"
12
+ ],
13
+ "deny": []
14
+ }
15
+ }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.4] - 2025-07-21
9
+
10
+ ### Added
11
+ - Added doc-builder version tooltip to "Last updated" text in header
12
+ - When hovering over the deployment date, users now see which version of doc-builder was used
13
+ - Version is dynamically loaded from package.json during build
14
+
8
15
  ## [1.4.3] - 2025-07-20
9
16
 
10
17
  ### Fixed
package/CLAUDE.md ADDED
@@ -0,0 +1,317 @@
1
+ # CLAUDE.md - @knowcode/doc-builder
2
+
3
+ This file provides comprehensive guidance for Claude Code when working with the @knowcode/doc-builder project - a Notion-inspired documentation generator that converts markdown files to beautiful static HTML sites with Vercel deployment support.
4
+
5
+ ## Project Overview
6
+
7
+ **Name**: @knowcode/doc-builder
8
+ **Version**: 1.4.3
9
+ **Purpose**: Transform markdown documentation into beautiful, searchable static HTML sites with a Notion-inspired design
10
+ **NPM Package**: Published at https://www.npmjs.com/package/@knowcode/doc-builder
11
+
12
+ ### Key Features
13
+ - 📝 **Markdown to HTML conversion** with syntax highlighting and mermaid diagram support
14
+ - 🎨 **Notion-inspired design** with dark mode support
15
+ - 🚀 **One-command Vercel deployment** with zero configuration
16
+ - 🔍 **Auto-generated navigation** from folder structure
17
+ - 🔐 **Optional authentication** for private documentation
18
+ - 📊 **Mermaid diagram support** out of the box
19
+ - 📱 **Fully responsive** design
20
+ - 🔧 **Zero configuration** - works with sensible defaults
21
+
22
+ ## Repository Structure
23
+
24
+ ```
25
+ doc-builder/
26
+ ├── assets/ # Static assets (CSS, JS)
27
+ │ ├── css/
28
+ │ │ └── notion-style.css # Main stylesheet
29
+ │ └── js/
30
+ │ ├── main.js # Client-side functionality
31
+ │ └── auth.js # Authentication logic
32
+ ├── lib/ # Core library files
33
+ │ ├── builder.js # Main build orchestrator
34
+ │ ├── core-builder.js # Core build logic & HTML generation
35
+ │ ├── config.js # Configuration management
36
+ │ ├── deploy.js # Vercel deployment logic
37
+ │ └── dev-server.js # Development server
38
+ ├── scripts/ # NPM scripts
39
+ │ ├── npx-runner.js # NPX entry point
40
+ │ └── setup.js # Post-install setup
41
+ ├── templates/ # HTML templates
42
+ ├── cli.js # CLI entry point
43
+ ├── index.js # Programmatic API entry point
44
+ ├── package.json # NPM configuration
45
+ ├── CHANGELOG.md # Version history
46
+ └── README.md # User documentation
47
+ ```
48
+
49
+ ## Technical Architecture
50
+
51
+ ### Core Components
52
+
53
+ 1. **CLI Interface** (`cli.js`)
54
+ - Commander.js based CLI with commands: build, dev, deploy, init
55
+ - Extensive help documentation built-in
56
+ - Interactive prompts for Vercel deployment
57
+
58
+ 2. **Build System** (`lib/core-builder.js`)
59
+ - Scans for markdown files recursively
60
+ - Extracts titles and summaries for navigation tooltips
61
+ - Generates HTML with embedded navigation
62
+ - Copies static assets
63
+ - Auto-generates README.md if missing
64
+
65
+ 3. **Navigation System**
66
+ - Automatically builds hierarchical navigation from folder structure
67
+ - Collapsible folder sections
68
+ - Active page highlighting
69
+ - Tooltips showing document summaries
70
+ - Search/filter functionality
71
+
72
+ 4. **Deployment System** (`lib/deploy.js`)
73
+ - Integrated Vercel deployment
74
+ - Automatic project setup for first-time users
75
+ - Production and preview deployments
76
+ - vercel.json generation for proper routing
77
+
78
+ ### Key Functions
79
+
80
+ #### core-builder.js
81
+ - `buildDocumentation(config)` - Main build orchestrator
82
+ - `processMarkdownFile(file, output, allFiles, config)` - Process individual markdown files
83
+ - `extractSummary(content)` - Extract document summary for tooltips
84
+ - `buildNavigationStructure(files, currentFile)` - Build navigation tree
85
+ - `generateHTML(title, content, navigation, currentPath, config)` - Generate final HTML
86
+
87
+ #### deploy.js
88
+ - `deployToVercel(config, isProduction)` - Deploy to Vercel
89
+ - `setupVercelProject(config)` - First-time Vercel setup
90
+ - `prepareDeployment(config)` - Prepare files for deployment
91
+
92
+ ## Configuration
93
+
94
+ ### Default Configuration (doc-builder.config.js)
95
+ ```javascript
96
+ module.exports = {
97
+ siteName: 'Documentation',
98
+ siteDescription: 'Documentation site',
99
+ docsDir: 'docs', // Input directory
100
+ outputDir: 'html', // Output directory
101
+ features: {
102
+ authentication: false, // Enable password protection
103
+ changelog: true, // Auto-generate changelog
104
+ mermaid: true, // Mermaid diagram support
105
+ darkMode: true // Dark mode toggle
106
+ }
107
+ };
108
+ ```
109
+
110
+ ### Presets
111
+ The tool supports presets for common configurations. Currently available:
112
+ - `notion-inspired` - Default Notion-like styling
113
+
114
+ ## Common Commands
115
+
116
+ ### Development
117
+ ```bash
118
+ # Install dependencies
119
+ npm install
120
+
121
+ # Run locally (development)
122
+ node cli.js dev
123
+
124
+ # Build documentation
125
+ node cli.js build
126
+
127
+ # Deploy to Vercel
128
+ node cli.js deploy
129
+ ```
130
+
131
+ ### Testing
132
+ ```bash
133
+ # Pack for local testing
134
+ npm pack
135
+
136
+ # Test in another project
137
+ npm install /path/to/doc-builder/knowcode-doc-builder-1.4.3.tgz
138
+ ```
139
+
140
+ ### Publishing
141
+ ```bash
142
+ # Update version in package.json
143
+ npm version patch # or minor/major
144
+
145
+ # Publish to npm
146
+ npm publish
147
+
148
+ # Tag release
149
+ git tag v1.4.3
150
+ git push origin v1.4.3
151
+ ```
152
+
153
+ ## Recent Changes & Known Issues
154
+
155
+ ### Version 1.4.3 (2025-07-20)
156
+ - Fixed tooltip functionality by restoring extractSummary function
157
+ - Removed unwanted Home link from sidebar
158
+ - Fixed excessive left padding issue caused by JavaScript margin-left assignments
159
+
160
+ ### Version 1.4.2 (2025-01-20)
161
+ - Fixed content layout to use flexbox properly
162
+ - Removed dynamic margin-left JavaScript that was overriding CSS
163
+
164
+ ### Known Issues
165
+ - NPX caching can cause older versions to run - use `npm install` instead
166
+ - Global npm packages can interfere - check with `which doc-builder`
167
+
168
+ ## Development Guidelines
169
+
170
+ ### Code Style
171
+ - Use ES6+ features where appropriate
172
+ - Maintain consistent error handling with try/catch blocks
173
+ - Use chalk for colored console output
174
+ - Use ora for loading spinners
175
+ - Clear, descriptive variable and function names
176
+
177
+ ### Testing Changes
178
+ 1. Build the package: `npm pack`
179
+ 2. Test in a real project before publishing
180
+ 3. Verify all commands work: build, dev, deploy
181
+ 4. Check generated HTML renders correctly
182
+ 5. Test Vercel deployment
183
+
184
+ ### Git Workflow
185
+ 1. Create feature branch from main
186
+ 2. Make changes with clear commits
187
+ 3. Update CHANGELOG.md
188
+ 4. Update version in package.json
189
+ 5. Create PR with description of changes
190
+ 6. After merge, publish to npm
191
+
192
+ ### Publishing Checklist
193
+ - [ ] Update version in package.json
194
+ - [ ] Update CHANGELOG.md with changes
195
+ - [ ] Run `npm pack` and test locally
196
+ - [ ] Commit changes with version bump
197
+ - [ ] Run `npm publish`
198
+ - [ ] Create git tag for version
199
+ - [ ] Push tag to GitHub
200
+
201
+ ## Debugging Tips
202
+
203
+ ### Common Issues
204
+
205
+ 1. **Build not finding files**
206
+ - Check docsDir configuration
207
+ - Ensure markdown files have .md extension
208
+ - Check for hidden directories (start with .)
209
+
210
+ 2. **Vercel deployment fails**
211
+ - Ensure Vercel CLI is installed globally
212
+ - Check authentication with `vercel whoami`
213
+ - Verify Root Directory is empty in Vercel settings
214
+
215
+ 3. **Styles not loading**
216
+ - Check asset paths in generated HTML
217
+ - Verify assets are copied to output directory
218
+ - Check browser console for 404 errors
219
+
220
+ 4. **Navigation not showing files**
221
+ - Check file paths don't contain special characters
222
+ - Verify markdown files are valid
223
+ - Check console for JavaScript errors
224
+
225
+ ### Debug Mode
226
+ Set environment variables for more verbose output:
227
+ ```bash
228
+ DEBUG=doc-builder* node cli.js build
229
+ ```
230
+
231
+ ## Integration with Other Projects
232
+
233
+ ### As NPM Dependency
234
+ ```json
235
+ {
236
+ "devDependencies": {
237
+ "@knowcode/doc-builder": "^1.4.3"
238
+ },
239
+ "scripts": {
240
+ "build:docs": "doc-builder build",
241
+ "dev:docs": "doc-builder dev",
242
+ "deploy:docs": "doc-builder deploy"
243
+ }
244
+ }
245
+ ```
246
+
247
+ ### Programmatic Usage
248
+ ```javascript
249
+ const { build } = require('@knowcode/doc-builder');
250
+
251
+ const config = {
252
+ siteName: 'My Docs',
253
+ docsDir: './documentation',
254
+ outputDir: './dist'
255
+ };
256
+
257
+ build(config).then(() => {
258
+ console.log('Build complete!');
259
+ });
260
+ ```
261
+
262
+ ## Architecture Decisions
263
+
264
+ ### Why Flexbox for Layout?
265
+ - Avoids JavaScript-based resizing issues
266
+ - Better responsive behavior
267
+ - Simpler to maintain
268
+ - Native browser support
269
+
270
+ ### Why Extract Git History?
271
+ - This project was extracted from a monorepo using `git filter-branch`
272
+ - Preserves commit history for better understanding of evolution
273
+ - Allows independent versioning and releases
274
+
275
+ ### Why Notion-Inspired Design?
276
+ - Clean, modern interface
277
+ - Familiar to many users
278
+ - Good information hierarchy
279
+ - Excellent readability
280
+
281
+ ## Future Enhancements
282
+
283
+ ### Planned Features
284
+ - [ ] Full-text search functionality
285
+ - [ ] PDF export capability
286
+ - [ ] Multiple theme support
287
+ - [ ] Plugin system for extensions
288
+ - [ ] Improved mermaid diagram styling
289
+ - [ ] Better mobile navigation UX
290
+
291
+ ### Technical Debt
292
+ - [ ] Add comprehensive test suite
293
+ - [ ] Refactor CSS to use CSS modules or styled-components
294
+ - [ ] Improve build performance for large documentation sets
295
+ - [ ] Add progress indicators for long builds
296
+
297
+ ## Support & Contributing
298
+
299
+ ### Getting Help
300
+ - File issues at: https://github.com/your-username/doc-builder/issues
301
+ - Check existing issues before creating new ones
302
+ - Include version number and error messages
303
+
304
+ ### Contributing
305
+ 1. Fork the repository
306
+ 2. Create feature branch
307
+ 3. Add tests if applicable
308
+ 4. Update documentation
309
+ 5. Submit pull request
310
+
311
+ ## License
312
+
313
+ MIT License - See LICENSE file for details
314
+
315
+ ---
316
+
317
+ **Note**: This project was extracted from the cybersolstice monorepo on 2025-07-21 with full git history preservation.
@@ -0,0 +1,101 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="description" content="Documentation site built with @knowcode/doc-builder">
7
+ <title>Test Documentation - Documentation</title>
8
+
9
+ <!-- Fonts -->
10
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
11
+
12
+ <!-- Icons -->
13
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
14
+
15
+ <!-- Mermaid -->
16
+ <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
17
+
18
+ <!-- Styles -->
19
+ <link rel="stylesheet" href="/css/notion-style.css">
20
+ <link rel="stylesheet" href="/css/style.css">
21
+
22
+ <!-- Favicon -->
23
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📚</text></svg>">
24
+ </head>
25
+ <body>
26
+ <!-- Header -->
27
+ <header class="header">
28
+ <div class="header-content">
29
+ <a href="/index.html" class="logo">Documentation</a>
30
+
31
+ <div class="header-actions">
32
+ <div class="deployment-info">
33
+ <span class="deployment-date" title="Built with doc-builder v1.4.4">Last updated: Jul 21, 2025, 10:35 AM UTC</span>
34
+ </div>
35
+
36
+
37
+
38
+ <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
39
+ <i class="fas fa-moon"></i>
40
+ </button>
41
+
42
+ <button id="menu-toggle" class="menu-toggle" aria-label="Toggle menu">
43
+ <i class="fas fa-bars"></i>
44
+ </button>
45
+ </div>
46
+ </div>
47
+ </header>
48
+
49
+ <!-- Preview Banner -->
50
+ <div id="preview-banner" class="preview-banner">
51
+ <div class="banner-content">
52
+ <i class="fas fa-exclamation-triangle banner-icon"></i>
53
+ <span class="banner-text">This documentation is a preview version - some content may be incomplete</span>
54
+ <button id="dismiss-banner" class="banner-dismiss" aria-label="Dismiss banner">
55
+ <i class="fas fa-times"></i>
56
+ </button>
57
+ </div>
58
+ </div>
59
+
60
+ <!-- Breadcrumbs -->
61
+ <nav class="breadcrumbs" id="breadcrumbs">
62
+ <!-- Breadcrumbs will be generated by JavaScript -->
63
+ </nav>
64
+
65
+ <!-- Main Content -->
66
+ <div class="main-wrapper">
67
+ <!-- Sidebar -->
68
+ <aside class="sidebar">
69
+ <div class="sidebar-header">
70
+ <div class="filter-box">
71
+ <input type="text" placeholder="Filter items..." class="filter-input" id="nav-filter">
72
+ <i class="fas fa-search filter-icon"></i>
73
+ </div>
74
+ </div>
75
+ <nav class="navigation">
76
+
77
+ <div class="nav-section" data-level="0">
78
+ <a class="nav-title expanded" href="/README.html" >
79
+ <i class="fas fa-home"></i> Documentation
80
+ </a>
81
+ <div class="nav-content" >
82
+ <a href="/README.html" class="nav-item active" data-tooltip="This is a test document to verify the doc-builder version tooltip."><i class="fas fa-file-alt"></i> Overview</a></div></div>
83
+ </nav>
84
+ <div class="resize-handle"></div>
85
+ </aside>
86
+
87
+ <!-- Content Area -->
88
+ <main class="content">
89
+ <div class="content-inner">
90
+ <h1>Test Documentation</h1>
91
+ <p>This is a test document to verify the doc-builder version tooltip.</p>
92
+
93
+ </div>
94
+ </main>
95
+ </div>
96
+
97
+ <!-- Scripts -->
98
+ <script src="/js/main.js"></script>
99
+
100
+ </body>
101
+ </html>