Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

chore: fix changesets (#1414)

Ralph Khreish5c4e939b3701
diff --git a/.changeset/fix-emoji-box-titles.md b/.changeset/fix-emoji-box-titles.md
index de92c8ce..3575ee8a 100644
--- a/.changeset/fix-emoji-box-titles.md
+++ b/.changeset/fix-emoji-box-titles.md
@@ -1,5 +1,5 @@
---
-'@tm/cli': patch
+'task-master-ai': patch
---
Fix box title alignment by adding emoji variant selector to warning sign
diff --git a/.github/scripts/validate-changesets.mjs b/.github/scripts/validate-changesets.mjs
new file mode 100644
index 00000000..5e360548
--- /dev/null
+++ b/.github/scripts/validate-changesets.mjs
@@ -0,0 +1,136 @@
+#!/usr/bin/env node
+
+import { readFileSync, readdirSync } from 'node:fs';
+import { join, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = dirname(__filename);
+const rootDir = join(__dirname, '../..');
+
+// Define allowed public packages that can be referenced in changesets
+const PUBLIC_PACKAGES = ['task-master-ai', 'extension'];
+
+/**
+ * Parse a changeset file and extract package names from the frontmatter
+ * This uses a simple YAML parser that's sufficient for changeset files
+ * and doesn't require external dependencies.
+ *
+ * @param {string} filePath - Path to the changeset file
+ * @returns {string[]} - Array of package names
+ * @throws {Error} - If file cannot be read or parsed
+ */
+function parseChangesetFile(filePath) {
+ try {
+ const content = readFileSync(filePath, 'utf-8');
+
+ // Extract frontmatter between --- markers
+ const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
+
+ if (!frontmatterMatch) {
+ throw new Error('No valid frontmatter found (missing --- delimiters)');
+ }
+
+ const frontmatter = frontmatterMatch[1];
+ const packages = [];
+
+ // Parse simple YAML format: 'package-name': version
+ // This handles the standard changeset format without needing a full YAML parser
+ const lines = frontmatter.split(/\r?\n/);
+
+ for (const line of lines) {
+ const trimmed = line.trim();
+
+ // Skip empty lines and comments
+ if (!trimmed || trimmed.startsWith('#')) {
+ continue;
+ }
+
+ // Match package declarations: 'package-name': version or "package-name": version
+ const match = trimmed.match(/^['"]?([^'":\s]+)['"]?\s*:\s*.+$/);
+
+ if (match) {
+ packages.push(match[1]);
+ }
+ }
+
+ if (packages.length === 0) {
+ throw new Error('No packages found in frontmatter');
+ }
+
+ return packages;
+ } catch (error) {
+ if (error.code === 'ENOENT') {
+ throw new Error(`File not found: ${filePath}`);
+ }
+ throw new Error(`Failed to parse ${filePath}: ${error.message}`);
+ }
+}
+
+/**
+ * Validate all changeset files in the .changeset directory
+ * @returns {boolean} - True if all changesets are valid
+ */
+function validateChangesets() {
+ try {
+ const changesetsDir = join(rootDir, '.changeset');
+ const files = readdirSync(changesetsDir);
+
+ const errors = [];
+
+ for (const file of files) {
+ // Skip config files and README
+ if (
+ file === 'config.json' ||
+ file === 'README.md' ||
+ !file.endsWith('.md')
+ ) {
+ continue;
+ }
+
+ const filePath = join(changesetsDir, file);
+
+ try {
+ const packages = parseChangesetFile(filePath);
+
+ for (const pkg of packages) {
+ // Only allow packages in the PUBLIC_PACKAGES whitelist
+ if (!PUBLIC_PACKAGES.includes(pkg)) {
+ errors.push({
+ file,
+ package: pkg,
+ message: `Invalid package "${pkg}". Only these packages are allowed: ${PUBLIC_PACKAGES.join(', ')}`
+ });
+ }
+ }
+ } catch (error) {
+ errors.push({
+ file,
+ package: 'N/A',
+ message: `Parse error: ${error.message}`
+ });
+ }
+ }
+
+ // Print results
+ if (errors.length === 0) {
+ console.log('✅ All changesets are valid!');
+ return true;
+ }
+
+ console.error('\n❌ Changeset validation failed:\n');
+ for (const error of errors) {
+ console.error(` ${error.file}:`);
+ console.error(` ${error.message}`);
+ console.error('');
+ }
+
+ return false;
+ } catch (error) {
+ console.error(`\n❌ Fatal error during validation: ${error.message}\n`);
+ return false;
+ }
+}
+
+const isValid = validateChangesets();
+process.exit(isValid ? 0 : 1);
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 125d3e60..94b39533 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -43,6 +43,27 @@ jobs:
env:
FORCE_COLOR: 1
+ changeset-validation:
+ name: Validate Changesets
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: "npm"
+
+ - name: Validate changeset package references
+ run: |
+ # Validate that changesets only reference public packages
+ # This catches issues like using @tm/cli instead of task-master-ai
+ node .github/scripts/validate-changesets.mjs
+ env:
+ FORCE_COLOR: 1
+
typecheck:
name: Typecheck
timeout-minutes: 10
@@ -104,7 +125,7 @@ jobs:
name: Test
timeout-minutes: 15
runs-on: ubuntu-latest
- needs: [format-check, typecheck, build]
+ needs: [format-check, typecheck, build, changeset-validation]
steps:
- uses: actions/checkout@v4
with:
diff --git a/package.json b/package.json
index 77830e11..293a5891 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"test:e2e-report": "./tests/e2e/run_e2e.sh --analyze-log",
"postpack": "chmod +x dist/task-master.js dist/mcp-server.js",
"changeset": "changeset",
+ "changeset:validate": "node .github/scripts/validate-changesets.mjs",
"release": "changeset publish",
"publish-packages": "turbo run build lint test && changeset version && changeset publish",
"inspector": "npx @modelcontextprotocol/inspector node dist/mcp-server.js",