claude-flow-novice 2.2.4 → 2.2.5
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.
- package/package.json +9 -8
- package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/.claude-flow/metrics/performance.json +9 -0
- package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
- package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
- package/scripts/CLEANUP_QUICK_START.md +268 -0
- package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
- package/scripts/README.md +339 -0
- package/scripts/ace-query.sh +384 -0
- package/scripts/agent-token-analysis.js +430 -0
- package/scripts/auto-setup.js +332 -0
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/build-index.js +43 -0
- package/scripts/build-orchestrator.js +320 -0
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/ci-validation.js +375 -0
- package/scripts/cleanup-blocking-coordination.sh +420 -0
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/collect-build-metrics.js +65 -0
- package/scripts/demo/README.md +79 -0
- package/scripts/demo/autoscaling-demo-simplified.js +963 -0
- package/scripts/demo/comprehensive-dashboard-test.js +693 -0
- package/scripts/demo/confidence-log.js +87 -0
- package/scripts/demo/confidence-report.js +82 -0
- package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
- package/scripts/demo/demo-production-deployment.js +399 -0
- package/scripts/demo/demo-visualization-system.js +149 -0
- package/scripts/demo/performance-analysis.cjs +71 -0
- package/scripts/demo/performance-analysis.js +71 -0
- package/scripts/demo/test-autoscaling-demo.js +314 -0
- package/scripts/dependency-optimizer.js +349 -0
- package/scripts/dependency-security-assessment.js +331 -0
- package/scripts/deploy-sdk.sh +176 -0
- package/scripts/deployment-readiness-report.json +179 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/ecosystem.config.cjs +90 -0
- package/scripts/fix-js-extensions.js +167 -0
- package/scripts/generate-basic-types.js +73 -0
- package/scripts/generate-changelog.js +318 -0
- package/scripts/git-hooks/pre-commit.sh +143 -0
- package/scripts/health-checks.js +634 -0
- package/scripts/hook-wrapper.sh +54 -0
- package/scripts/install/README.md +375 -0
- package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
- package/scripts/install/check-prerequisites.js +303 -0
- package/scripts/install/config-wizard.js +606 -0
- package/scripts/install/dependency-checker.js +385 -0
- package/scripts/install/health-check.js +765 -0
- package/scripts/install/install.js +256 -0
- package/scripts/install/installation-benchmark.js +461 -0
- package/scripts/install/quick-install.js +720 -0
- package/scripts/install/quick-start-wizard.js +295 -0
- package/scripts/install/redis-cli.js +289 -0
- package/scripts/install/redis-install-guides.md +407 -0
- package/scripts/install/redis-setup.js +559 -0
- package/scripts/install/redis-test.js +278 -0
- package/scripts/install/service-manager.js +672 -0
- package/scripts/install/setup.js +832 -0
- package/scripts/install/uninstall.js +526 -0
- package/scripts/install/update.js +461 -0
- package/scripts/install-pre-commit-hook.sh +127 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/memory-monitor-coordinator.js +322 -0
- package/scripts/migrate-to-sdk.sh +520 -0
- package/scripts/migration/QUICK-START.md +189 -0
- package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
- package/scripts/migration/README.md +464 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
- package/scripts/migration/UPDATE-PATHS-README.md +464 -0
- package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
- package/scripts/migration/example-patterns.json +19 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/migration/reorganize-workspace.js +504 -0
- package/scripts/migration/test-update-paths.js +359 -0
- package/scripts/migration/update-paths.js +664 -0
- package/scripts/migration/validate-migration.js +647 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor-migration.js +339 -0
- package/scripts/monitor.py +43 -0
- package/scripts/monitoring/README.md +178 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/analyze-resources.sh +199 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/dynamic-monitor.sh +85 -0
- package/scripts/monitoring/launch-stability-test.sh +184 -0
- package/scripts/monitoring/monitor-test.sh +93 -0
- package/scripts/monitoring/pre-test-validation.sh +208 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
- package/scripts/monitoring/resource-monitor.sh +126 -0
- package/scripts/monitoring/stability-monitor.js +429 -0
- package/scripts/monitoring/test-monitor-quick.sh +54 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/npm-metrics-collector.js +482 -0
- package/scripts/npm-package-validation.cjs +299 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/optimize-package-swarm.js +54 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-monitor.js +644 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/post-deployment-monitoring.js +350 -0
- package/scripts/post-edit-pipeline.js +2091 -0
- package/scripts/post-install-claude-md.js +78 -0
- package/scripts/postinstall.js +79 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/pre-publish-validation.js +429 -0
- package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
- package/scripts/release-announcement.js +425 -0
- package/scripts/release-notification.js +248 -0
- package/scripts/release-rollback.js +376 -0
- package/scripts/release-validation.js +460 -0
- package/scripts/rollback-sdk.sh +66 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/run-stability-validation.sh +687 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/deployment-validation.cjs +279 -0
- package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/install-git-secrets.sh +295 -0
- package/scripts/security/rotate-api-keys.js +469 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/security/security-audit.cjs +538 -0
- package/scripts/security/setup-redis-auth.sh +397 -0
- package/scripts/security/validate-envelope-encryption.cjs +340 -0
- package/scripts/security-scan.js +492 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/switch-api.sh +158 -0
- package/scripts/sync-agents.js +290 -0
- package/scripts/test/50-agent-test.js +625 -0
- package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
- package/scripts/test/STABILITY_TEST_README.md +480 -0
- package/scripts/test/agent-worker.js +309 -0
- package/scripts/test/ai-coordination-test.js +650 -0
- package/scripts/test/ai-mesh-coordination-test.js +416 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/cli-agent-coordination-test.js +313 -0
- package/scripts/test/coordinator-multilingual-test.js +396 -0
- package/scripts/test/coordinator-transparency-demo.js +585 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
- package/scripts/test/multilingual-hello-world-test.js +390 -0
- package/scripts/test/quick-multilingual-demo.js +464 -0
- package/scripts/test/real-agent-test.js +312 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/run-stability-test-examples.sh +292 -0
- package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
- package/scripts/test/stability-results/stability-test-report.json +128 -0
- package/scripts/test/stability-results/stability-test.log +1827 -0
- package/scripts/test/stability-test-50-agents.js +734 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/test-cleanup-performance.sh +416 -0
- package/scripts/test-dashboard-auth.cjs +203 -0
- package/scripts/test-docker-deployment.sh +207 -0
- package/scripts/test-npm-package.cjs +167 -0
- package/scripts/test-provider-routing.cjs +226 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-runner.cjs +154 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/validate-agent-hooks.js +506 -0
- package/scripts/validate-changelog.js +241 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/scripts/validate-docker-infrastructure.sh +502 -0
- package/scripts/validate-entry-points.js +300 -0
- package/scripts/validate-stage3-performance.ts +377 -0
- package/scripts/validate-template-bundling.js +180 -0
- package/scripts/validation/README.md +33 -0
- package/scripts/validation/acl-security-validation.cjs +214 -0
- package/scripts/validation/acl-security-validation.js +402 -0
- package/scripts/validation/byzantine-verification.js +407 -0
- package/scripts/validation/final-phase-2-consensus.cjs +219 -0
- package/scripts/validation/final-security-validation.js +791 -0
- package/scripts/validation/final-wasm-validation.cjs +840 -0
- package/scripts/validation/integration-test-analysis.js +105 -0
- package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
- package/scripts/validation/phase-0-consensus-report.js +139 -0
- package/scripts/validation/phase-0-final-report.js +112 -0
- package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
- package/scripts/validation/phase-0-validation-improved.js +490 -0
- package/scripts/validation/phase-0-validation-test.js +65 -0
- package/scripts/validation/phase-1-consensus-report.cjs +342 -0
- package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
- package/scripts/validation/phase-1-consensus-validation.js +551 -0
- package/scripts/validation/phase-2-consensus-report.cjs +186 -0
- package/scripts/validation/phase-2-validation.cjs +171 -0
- package/scripts/validation/phase-2-validation.js +171 -0
- package/scripts/validation/phase-4-consensus-report.js +181 -0
- package/scripts/validation/phase-4-final-validation.js +351 -0
- package/scripts/validation/phase-5-consensus-report.cjs +113 -0
- package/scripts/validation/phase-5-consensus-report.js +113 -0
- package/scripts/validation/security-analysis.js +49 -0
- package/scripts/validation/security-validation.js +492 -0
- package/scripts/validation/simple-security-validation.js +464 -0
- package/scripts/verify-installation.js +112 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/scripts/verify-sdk-phase1.cjs +293 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Automated Changelog Generator
|
|
5
|
+
* Generates changelog entries based on git commit history and conventional commits
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = path.dirname(__filename);
|
|
15
|
+
const rootDir = path.join(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf8'));
|
|
18
|
+
const currentVersion = packageJson.version;
|
|
19
|
+
|
|
20
|
+
class ChangelogGenerator {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.changelogPath = path.join(rootDir, 'CHANGELOG.md');
|
|
23
|
+
this.changelog = this.loadExistingChangelog();
|
|
24
|
+
this.categories = {
|
|
25
|
+
feat: 'Features',
|
|
26
|
+
fix: 'Bug Fixes',
|
|
27
|
+
docs: 'Documentation',
|
|
28
|
+
style: 'Style Changes',
|
|
29
|
+
refactor: 'Code Refactoring',
|
|
30
|
+
perf: 'Performance Improvements',
|
|
31
|
+
test: 'Testing',
|
|
32
|
+
build: 'Build System',
|
|
33
|
+
ci: 'Continuous Integration',
|
|
34
|
+
chore: 'Chores',
|
|
35
|
+
deps: 'Dependencies',
|
|
36
|
+
security: 'Security',
|
|
37
|
+
breaking: 'Breaking Changes'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
loadExistingChangelog() {
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(this.changelogPath)) {
|
|
44
|
+
const content = fs.readFileSync(this.changelogPath, 'utf8');
|
|
45
|
+
const sections = content.split('\n## ');
|
|
46
|
+
return {
|
|
47
|
+
header: sections[0] || '',
|
|
48
|
+
releases: sections.slice(1).map(section => {
|
|
49
|
+
const lines = section.split('\n');
|
|
50
|
+
const versionLine = lines[0];
|
|
51
|
+
const version = versionLine.match(/\[(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?)\]/)?.[1];
|
|
52
|
+
const date = versionLine.match(/\((\d{4}-\d{2}-\d{2})\)/)?.[1];
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
version,
|
|
56
|
+
date,
|
|
57
|
+
content: lines.slice(1).join('\n').trim()
|
|
58
|
+
};
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.warn('Warning: Could not load existing changelog:', error.message);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
header: '# Changelog\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n',
|
|
68
|
+
releases: []
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getGitHistory(sinceVersion) {
|
|
73
|
+
try {
|
|
74
|
+
const lastTag = this.getLastTag();
|
|
75
|
+
let range = 'HEAD';
|
|
76
|
+
|
|
77
|
+
if (sinceVersion && lastTag) {
|
|
78
|
+
range = `${lastTag}..HEAD`;
|
|
79
|
+
} else if (lastTag) {
|
|
80
|
+
range = `${lastTag}..HEAD`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const gitLog = execSync(
|
|
84
|
+
`git log ${range} --pretty=format:"%H|%s|%b|%an|%ad" --date=short`,
|
|
85
|
+
{ encoding: 'utf8', cwd: rootDir }
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return gitLog.trim().split('\n').map(line => {
|
|
89
|
+
const [hash, subject, body, author, date] = line.split('|');
|
|
90
|
+
return { hash, subject, body, author, date };
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.warn('Warning: Could not get git history:', error.message);
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getLastTag() {
|
|
99
|
+
try {
|
|
100
|
+
return execSync('git describe --tags --abbrev=0', { encoding: 'utf8', cwd: rootDir }).trim();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
parseCommit(commit) {
|
|
107
|
+
const { subject, body, hash } = commit;
|
|
108
|
+
|
|
109
|
+
// Parse conventional commit format
|
|
110
|
+
const conventionalMatch = subject.match(/^(\w+)(\(.+\))?:\s*(.+)$/);
|
|
111
|
+
if (!conventionalMatch) {
|
|
112
|
+
return { type: 'chore', description: subject, breaking: false };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const [, type, scope, description] = conventionalMatch;
|
|
116
|
+
const breaking = subject.includes('BREAKING CHANGE:') ||
|
|
117
|
+
(body && body.includes('BREAKING CHANGE:'));
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
type: type.toLowerCase(),
|
|
121
|
+
scope: scope ? scope.replace(/[()]/g, '') : null,
|
|
122
|
+
description,
|
|
123
|
+
breaking,
|
|
124
|
+
body,
|
|
125
|
+
hash: hash.substring(0, 7)
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
categorizeCommits(commits) {
|
|
130
|
+
const categorized = {};
|
|
131
|
+
|
|
132
|
+
commits.forEach(commit => {
|
|
133
|
+
const parsed = this.parseCommit(commit);
|
|
134
|
+
let category = this.categories[parsed.type] || this.categories.chore;
|
|
135
|
+
|
|
136
|
+
if (parsed.breaking) {
|
|
137
|
+
category = this.categories.breaking;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!categorized[category]) {
|
|
141
|
+
categorized[category] = [];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
categorized[category].push(parsed);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return categorized;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
formatReleaseEntry(version, date, categorizedCommits) {
|
|
151
|
+
let entry = `## [${version}] - ${date}\n\n`;
|
|
152
|
+
|
|
153
|
+
const order = [
|
|
154
|
+
'Breaking Changes',
|
|
155
|
+
'Features',
|
|
156
|
+
'Bug Fixes',
|
|
157
|
+
'Security',
|
|
158
|
+
'Performance Improvements',
|
|
159
|
+
'Documentation',
|
|
160
|
+
'Code Refactoring',
|
|
161
|
+
'Testing',
|
|
162
|
+
'Build System',
|
|
163
|
+
'Continuous Integration',
|
|
164
|
+
'Dependencies',
|
|
165
|
+
'Style Changes',
|
|
166
|
+
'Chores'
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
order.forEach(categoryName => {
|
|
170
|
+
const commits = categorizedCommits[categoryName];
|
|
171
|
+
if (commits && commits.length > 0) {
|
|
172
|
+
entry += `### ${categoryName}\n\n`;
|
|
173
|
+
|
|
174
|
+
commits.forEach(commit => {
|
|
175
|
+
let line = `- ${commit.description}`;
|
|
176
|
+
|
|
177
|
+
if (commit.scope) {
|
|
178
|
+
line = `- **${commit.scope}:** ${commit.description}`;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (commit.breaking) {
|
|
182
|
+
line = `**${line}**`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (commit.hash) {
|
|
186
|
+
line += ` (${commit.hash})`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
entry += line + '\n';
|
|
190
|
+
|
|
191
|
+
// Add breaking change details
|
|
192
|
+
if (commit.body && commit.body.includes('BREAKING CHANGE:')) {
|
|
193
|
+
const breakingMatch = commit.body.match(/BREAKING CHANGE:\s*(.+)/s);
|
|
194
|
+
if (breakingMatch) {
|
|
195
|
+
entry += ` - Breaking change details: ${breakingMatch[1].trim()}\n`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
entry += '\n';
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
return entry;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
updateChangelog(newVersion, date = new Date().toISOString().split('T')[0]) {
|
|
208
|
+
const commits = this.getGitHistory();
|
|
209
|
+
const categorizedCommits = this.categorizeCommits(commits);
|
|
210
|
+
|
|
211
|
+
if (Object.keys(categorizedCommits).length === 0) {
|
|
212
|
+
console.log('No commits found to add to changelog');
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const newEntry = this.formatReleaseEntry(newVersion, date, categorizedCommits);
|
|
217
|
+
|
|
218
|
+
// Update changelog structure
|
|
219
|
+
const newRelease = {
|
|
220
|
+
version: newVersion,
|
|
221
|
+
date,
|
|
222
|
+
content: newEntry.replace(/^## \[.+\] - .+\n\n/, '')
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// Insert new release at the beginning
|
|
226
|
+
this.changelog.releases.unshift(newRelease);
|
|
227
|
+
|
|
228
|
+
// Write updated changelog
|
|
229
|
+
let content = this.changelog.header;
|
|
230
|
+
this.changelog.releases.forEach(release => {
|
|
231
|
+
content += `## [${release.version}] - ${release.date}\n\n`;
|
|
232
|
+
content += release.content + '\n';
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
fs.writeFileSync(this.changelogPath, content, 'utf8');
|
|
236
|
+
console.log(`✅ Changelog updated for version ${newVersion}`);
|
|
237
|
+
|
|
238
|
+
// Show summary
|
|
239
|
+
Object.entries(categorizedCommits).forEach(([category, commits]) => {
|
|
240
|
+
console.log(` ${category}: ${commits.length} commits`);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
validateChangelog() {
|
|
245
|
+
try {
|
|
246
|
+
const content = fs.readFileSync(this.changelogPath, 'utf8');
|
|
247
|
+
|
|
248
|
+
// Check for required sections
|
|
249
|
+
if (!content.includes('# Changelog')) {
|
|
250
|
+
throw new Error('Changelog must have a header');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!content.includes('## [')) {
|
|
254
|
+
throw new Error('Changelog must have at least one release section');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Check for proper format
|
|
258
|
+
const releaseSections = content.match(/## \[([^\]]+)\] - (\d{4}-\d{2}-\d{2})/g);
|
|
259
|
+
if (!releaseSections) {
|
|
260
|
+
throw new Error('Release sections must follow format: ## [version] - YYYY-MM-DD');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
console.log('✅ Changelog validation passed');
|
|
264
|
+
return true;
|
|
265
|
+
} catch (error) {
|
|
266
|
+
console.error('❌ Changelog validation failed:', error.message);
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// CLI Interface
|
|
273
|
+
function main() {
|
|
274
|
+
const args = process.argv.slice(2);
|
|
275
|
+
const command = args[0] || 'update';
|
|
276
|
+
|
|
277
|
+
const generator = new ChangelogGenerator();
|
|
278
|
+
|
|
279
|
+
switch (command) {
|
|
280
|
+
case 'update':
|
|
281
|
+
const version = args[1] || currentVersion;
|
|
282
|
+
const date = args[2] || new Date().toISOString().split('T')[0];
|
|
283
|
+
generator.updateChangelog(version, date);
|
|
284
|
+
break;
|
|
285
|
+
|
|
286
|
+
case 'validate':
|
|
287
|
+
generator.validateChangelog();
|
|
288
|
+
break;
|
|
289
|
+
|
|
290
|
+
case 'init':
|
|
291
|
+
// Initialize changelog if it doesn't exist
|
|
292
|
+
if (!fs.existsSync(generator.changelogPath)) {
|
|
293
|
+
fs.writeFileSync(generator.changelogPath, generator.changelog.header, 'utf8');
|
|
294
|
+
console.log('✅ Changelog initialized');
|
|
295
|
+
} else {
|
|
296
|
+
console.log('Changelog already exists');
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
|
|
300
|
+
default:
|
|
301
|
+
console.log(`
|
|
302
|
+
Usage: node generate-changelog.js [command] [options]
|
|
303
|
+
|
|
304
|
+
Commands:
|
|
305
|
+
update [version] [date] Update changelog with new version (default: current package version)
|
|
306
|
+
validate Validate changelog format and content
|
|
307
|
+
init Initialize changelog file
|
|
308
|
+
|
|
309
|
+
Examples:
|
|
310
|
+
node generate-changelog.js update
|
|
311
|
+
node generate-changelog.js update 1.2.3 2024-01-15
|
|
312
|
+
node generate-changelog.js validate
|
|
313
|
+
node generate-changelog.js init
|
|
314
|
+
`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
main();
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Pre-commit hook for Claude Flow Novice
|
|
3
|
+
# Runs validation checks before allowing commits
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔍 Running pre-commit validation..."
|
|
8
|
+
echo "======================================"
|
|
9
|
+
|
|
10
|
+
# Colors for output
|
|
11
|
+
RED='\033[0;31m'
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Get staged files
|
|
17
|
+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
|
|
18
|
+
|
|
19
|
+
if [ -z "$STAGED_FILES" ]; then
|
|
20
|
+
echo -e "${YELLOW}⚠️ No files staged for commit${NC}"
|
|
21
|
+
exit 0
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Check if npm is available
|
|
25
|
+
if ! command -v npm &> /dev/null; then
|
|
26
|
+
echo -e "${RED}❌ npm not found${NC}"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Run security scan on staged files
|
|
31
|
+
echo ""
|
|
32
|
+
echo "🔒 Security Scan..."
|
|
33
|
+
if npm run security:check --silent; then
|
|
34
|
+
echo -e "${GREEN}✅ Security check passed${NC}"
|
|
35
|
+
else
|
|
36
|
+
echo -e "${RED}❌ Security issues found${NC}"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Run linting on staged JS/TS files
|
|
41
|
+
STAGED_JS_FILES=$(echo "$STAGED_FILES" | grep -E '\.(js|ts|jsx|tsx)$' || true)
|
|
42
|
+
|
|
43
|
+
if [ -n "$STAGED_JS_FILES" ]; then
|
|
44
|
+
echo ""
|
|
45
|
+
echo "📝 Linting staged files..."
|
|
46
|
+
|
|
47
|
+
if npm run lint --silent; then
|
|
48
|
+
echo -e "${GREEN}✅ Linting passed${NC}"
|
|
49
|
+
else
|
|
50
|
+
echo -e "${YELLOW}⚠️ Linting issues found (not blocking)${NC}"
|
|
51
|
+
fi
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# Check for hardcoded secrets in staged files
|
|
55
|
+
echo ""
|
|
56
|
+
echo "🔐 Checking for hardcoded secrets..."
|
|
57
|
+
SECRETS_FOUND=0
|
|
58
|
+
|
|
59
|
+
# Patterns to check for secrets
|
|
60
|
+
declare -a SECRET_PATTERNS=(
|
|
61
|
+
"api[_-]?key\s*[:=]\s*['\"][a-zA-Z0-9]{20,}['\"]"
|
|
62
|
+
"password\s*[:=]\s*['\"][^'\"]{8,}['\"]"
|
|
63
|
+
"secret[_-]?token\s*[:=]\s*['\"][a-zA-Z0-9]{20,}['\"]"
|
|
64
|
+
"-----BEGIN (RSA )?PRIVATE KEY-----"
|
|
65
|
+
"AKIA[0-9A-Z]{16}"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
for file in $STAGED_FILES; do
|
|
69
|
+
if [ -f "$file" ]; then
|
|
70
|
+
for pattern in "${SECRET_PATTERNS[@]}"; do
|
|
71
|
+
if grep -qE "$pattern" "$file" 2>/dev/null; then
|
|
72
|
+
echo -e "${RED}❌ Potential secret found in: $file${NC}"
|
|
73
|
+
SECRETS_FOUND=1
|
|
74
|
+
fi
|
|
75
|
+
done
|
|
76
|
+
fi
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
if [ $SECRETS_FOUND -eq 1 ]; then
|
|
80
|
+
echo -e "${RED}❌ Commit blocked: Remove hardcoded secrets${NC}"
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo -e "${GREEN}✅ No secrets found${NC}"
|
|
85
|
+
|
|
86
|
+
# Check for large files (>1MB)
|
|
87
|
+
echo ""
|
|
88
|
+
echo "📦 Checking file sizes..."
|
|
89
|
+
LARGE_FILES=0
|
|
90
|
+
|
|
91
|
+
for file in $STAGED_FILES; do
|
|
92
|
+
if [ -f "$file" ]; then
|
|
93
|
+
FILE_SIZE=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null || echo 0)
|
|
94
|
+
if [ $FILE_SIZE -gt 1048576 ]; then
|
|
95
|
+
echo -e "${YELLOW}⚠️ Large file detected: $file ($(($FILE_SIZE / 1024))KB)${NC}"
|
|
96
|
+
LARGE_FILES=1
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
done
|
|
100
|
+
|
|
101
|
+
if [ $LARGE_FILES -eq 1 ]; then
|
|
102
|
+
echo -e "${YELLOW}⚠️ Consider using Git LFS for large files${NC}"
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Check for package.json changes
|
|
106
|
+
if echo "$STAGED_FILES" | grep -q "package.json"; then
|
|
107
|
+
echo ""
|
|
108
|
+
echo "📦 package.json changed - validating..."
|
|
109
|
+
|
|
110
|
+
if node -e "JSON.parse(require('fs').readFileSync('package.json', 'utf8'))" 2>/dev/null; then
|
|
111
|
+
echo -e "${GREEN}✅ package.json is valid JSON${NC}"
|
|
112
|
+
else
|
|
113
|
+
echo -e "${RED}❌ package.json is invalid${NC}"
|
|
114
|
+
exit 1
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
# Check if package-lock.json should be updated
|
|
118
|
+
if [ -f "package-lock.json" ] && ! echo "$STAGED_FILES" | grep -q "package-lock.json"; then
|
|
119
|
+
echo -e "${YELLOW}⚠️ package.json changed but package-lock.json not staged${NC}"
|
|
120
|
+
echo -e "${YELLOW} Consider running: npm install && git add package-lock.json${NC}"
|
|
121
|
+
fi
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# Check for CLAUDE.md changes
|
|
125
|
+
if echo "$STAGED_FILES" | grep -q "CLAUDE.md"; then
|
|
126
|
+
echo ""
|
|
127
|
+
echo "📋 CLAUDE.md changed - validating format..."
|
|
128
|
+
|
|
129
|
+
if grep -q "## 1) Critical Rules" "CLAUDE.md" && grep -q "## 2) When Agents Are Mandatory" "CLAUDE.md"; then
|
|
130
|
+
echo -e "${GREEN}✅ CLAUDE.md format valid${NC}"
|
|
131
|
+
else
|
|
132
|
+
echo -e "${RED}❌ CLAUDE.md appears to be malformed${NC}"
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
# Final summary
|
|
138
|
+
echo ""
|
|
139
|
+
echo "======================================"
|
|
140
|
+
echo -e "${GREEN}✅ Pre-commit validation passed${NC}"
|
|
141
|
+
echo "======================================"
|
|
142
|
+
|
|
143
|
+
exit 0
|