Automatic File Headers
Automatic File Headers
Section titled “Automatic File Headers”Automatically configures VS Code with customizable file headers based on your project’s license, company, and team information.
Features
Section titled “Features”✨ Two header styles:
- Simple (default): Standard 3-line header with project, copyright, and license
- Custom: Your own multi-line header template
🔧 Flexible configuration:
- Project name (required)
- License in SPDX format (default: MIT)
- Company/organization name (optional)
- Copyright start year (optional, defaults to current year)
- Contributors list (optional)
🚀 Helper script: h4-init-headers command to initialize headers in any project
Installation
Section titled “Installation”Add to your .devcontainer/devcontainer.json:
Simple Header (Default)
Section titled “Simple Header (Default)”This generates headers like:
Custom Header
Section titled “Custom Header”After the container is created, initialize headers in your project:
This command:
- Reads your feature configuration
- Generates appropriate header settings
- Creates or merges with
.vscode/settings.json
Configuration Options
Section titled “Configuration Options”| Option | Type | Default | Description |
|---|---|---|---|
headerType | string | simple | Header style: simple or custom |
projectName | string | required | Project name for header |
license | string | MIT | SPDX license identifier |
company | string | optional | Company or organization name |
contributors | string | optional | Comma-separated contributor names |
sinceYear | string | current year | Copyright start year |
customHeaderLines | string | required for custom | Custom header lines (separated by literal \n). Supports placeholders: {{projectName}}, {{license}}, {{company}}, {{contributors}}, {{sinceYear}}, {{currentYear}}, {{copyrightYears}}, {{author}} (= company or projectName). |
Examples
Section titled “Examples”TypeScript Project with LGPL License
Section titled “TypeScript Project with LGPL License”Apache Licensed Corporate Project
Section titled “Apache Licensed Corporate Project”Custom Header with Specific Format
Section titled “Custom Header with Specific Format”What Gets Created
Section titled “What Gets Created”After running h4-init-headers:
.vscode/settings.json: Updated with file header configuration- Feature configuration: Stored in
/etc/h4-auto-header/config.json(system-wide)
Typical Workflow
Section titled “Typical Workflow”Integrating with Your Workflow
Section titled “Integrating with Your Workflow”Auto-initialize on Container Creation
Section titled “Auto-initialize on Container Creation”Add postCreateCommand to auto-initialize:
Multiple Projects
Section titled “Multiple Projects”Run h4-init-headers in each project directory:
The script will use the appropriate .vscode directory for each project.
Common License Identifiers
Section titled “Common License Identifiers”MIT- MIT LicenseApache-2.0- Apache License 2.0GPL-3.0- GNU General Public License v3.0LGPL-3.0- GNU Lesser General Public License v3.0BSD-2-Clause- BSD 2-Clause LicenseBSD-3-Clause- BSD 3-Clause LicenseISC- ISC LicenseMPL-2.0- Mozilla Public License 2.0
See SPDX License List for complete list.
Troubleshooting
Section titled “Troubleshooting”Script not found
Section titled “Script not found”Settings not applied
Section titled “Settings not applied”Headers not auto-inserting
Section titled “Headers not auto-inserting”- Verify file header support is installed and enabled
- Check
.vscode/settings.jsonexists and has correct config - Restart VS Code or reload window:
Ctrl+Shift+P→ “Developer: Reload Window”
Year not updating automatically
Section titled “Year not updating automatically”The headers are generated with fixed copyright years (e.g., 2024-2026) at the time the devcontainer is created. If you want the year to automatically update:
- Rebuild the devcontainer to regenerate the configuration with current year
- Or manually update the copyright years in
.vscode/settings.json
Integration with helpers4 Projects
Section titled “Integration with helpers4 Projects”This feature complements the helpers4 development environment:
- typescript: Work with properly licensed utility functions
- devcontainer: Ensure consistent headers across team
- action: Validate file headers in CI/CD pipelines
License
Section titled “License”Copyright (c) 2025 helpers4
Licensed under LGPL-3.0 - see LICENSE file for details