Skip to content

Add MIT license headers to all source files#131

Merged
huangyiirene merged 8 commits intomainfrom
copilot/add-mit-license-header-again
Jan 18, 2026
Merged

Add MIT license headers to all source files#131
huangyiirene merged 8 commits intomainfrom
copilot/add-mit-license-header-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 18, 2026

Add standardized MIT license headers to 216 source files across the monorepo (.ts, .js, .tsx, .jsx, .vue).

Changes

  • Script: Created scripts/add-license-headers.js to automate header insertion

    • Recursively processes source files while excluding node_modules, dist, build, .git, coverage
    • Detects existing headers by scanning first 10 lines for "Copyright" or "License" keywords
    • Idempotent - safe to run multiple times without duplication
  • Headers: Applied to all 216 source files (189 TypeScript, 27 JavaScript)

    • Inserted at top of file, before imports and code
    • Uses copyright year 2026-present and ObjectStack Inc. as rights holder

Header Format

/**
 * ObjectQL
 * Copyright (c) 2026-present ObjectStack Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

The script can be re-run to add headers to new files as the codebase evolves.

Original prompt

我需要给我的开源项目 ObjectQL 的所有源代码文件添加 MIT 许可协议的头部注释。

请编写一个 Node.js 脚本(或者直接修改文件,如果你有权限)来完成以下任务:

  1. 目标文件:递归遍历项目中所有的 .ts, .js, .tsx, .jsx, .vue 文件。
  2. 排除目录:严格排除 node_modules, dist, build, .git, coverage 目录。
  3. 防止重复:读取每个文件,如果文件顶部前 10 行内已经包含 "Copyright" 或 "License" 关键词,则跳过该文件,不要重复添加。
  4. 插入位置:注释必须插在文件的最顶端(在所有的 import 语句之前)。
  5. 注释内容模板
    /**
     * ObjectQL
     * Copyright (c) 2026-present ObjectStack Inc.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.
     */

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MIT license header to all source files Add MIT license headers to all source files Jan 18, 2026
Copilot AI requested a review from huangyiirene January 18, 2026 03:50
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds standardized MIT license headers to all 216 source files across the ObjectStack monorepo to ensure proper copyright attribution and licensing clarity for the open-source project.

Changes:

  • Created an automated script (scripts/add-license-headers.js) to recursively add MIT license headers to TypeScript and JavaScript files
  • Applied consistent license headers to all source files with copyright year 2026-present and rights holder ObjectStack Inc.
  • Ensured idempotent behavior to prevent duplicate headers on subsequent runs

Reviewed changes

Copilot reviewed 213 out of 216 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/add-license-headers.js New automation script for adding license headers with duplicate detection
scripts/validate-yaml.js Added MIT license header
scripts/check-versions.js Added MIT license header
packages/tools/vscode-objectql/src/**/*.ts Added MIT license headers to VS Code extension source files
packages/tools/create/src/**/*.ts Added MIT license headers to project creation tool files
packages/tools/cli/src/**/*.ts Added MIT license headers to CLI tool files
packages/runtime/server/src/**/*.ts Added MIT license headers to server runtime files
packages/runtime/server/test/**/*.ts Added MIT license headers to server test files
packages/foundation/types/src/**/*.ts Added MIT license headers to type definition files
packages/foundation/platform-node/src/**/*.ts Added MIT license headers to Node.js platform files
packages/foundation/core/src/**/*.ts Added MIT license headers to core engine files
packages/drivers//src/**/.ts Added MIT license headers to all database driver files
examples/**/*.ts Added MIT license headers to example project files
**/jest.config.js Added MIT license headers to Jest configuration files

Copilot AI and others added 3 commits January 18, 2026 04:18
The MIT license header was added above the shebang in bin.ts,
causing TypeScript compilation errors. Shebangs must be on line 1.

Fixes build error: TS18026 - '#!' can only be used at the start of a file.

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copilot AI and others added 3 commits January 18, 2026 05:07
The shebang #!/usr/bin/env node was on line 9 instead of line 1,
causing a SyntaxError when the script was executed with 'node' explicitly.
Since the workflow uses 'pnpm exec node scripts/validate-yaml.js',
the shebang is not needed and has been removed.

Fixes workflow run: https://github.com/objectstack-ai/objectql/actions/runs/21106340992

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@huangyiirene huangyiirene marked this pull request as ready for review January 18, 2026 05:28
@huangyiirene huangyiirene merged commit e3af252 into main Jan 18, 2026
8 checks passed
@huangyiirene huangyiirene deleted the copilot/add-mit-license-header-again branch January 18, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants