feat: new commit instructions

This commit is contained in:
dextmorgn
2025-10-29 08:31:41 +01:00
parent 639dbfec36
commit 56586e3bf4
13 changed files with 11194 additions and 28 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
/node_modules/
# C extensions # C extensions
*.so *.so
*transform_logs *transform_logs

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1}

67
.versionrc.json Normal file
View File

@@ -0,0 +1,67 @@
{
"header": "# Changelog\n\nAll notable changes to Flowsint will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "style",
"hidden": true
},
{
"type": "chore",
"hidden": true
},
{
"type": "test",
"hidden": true
},
{
"type": "build",
"section": "Build System",
"hidden": false
},
{
"type": "ci",
"hidden": true
}
],
"packageFiles": [
{
"filename": "flowsint-app/package.json",
"type": "json"
}
],
"bumpFiles": [
{
"filename": "flowsint-app/package.json",
"type": "json"
},
{
"filename": "pyproject.toml",
"updater": "scripts/pyproject-updater.js"
}
],
"scripts": {
"postbump": "node scripts/sync-versions.js $(node -p \"require('./flowsint-app/package.json').version\")"
}
}

6
CHANGELOG.md Normal file
View File

@@ -0,0 +1,6 @@
# Changelog
All notable changes to Flowsint 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).

24
commitlint.config.js Normal file
View File

@@ -0,0 +1,24 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat', // New feature
'fix', // Bug fix
'docs', // Documentation only changes
'style', // Code style changes (formatting, etc)
'refactor', // Code refactoring
'perf', // Performance improvements
'test', // Adding or updating tests
'build', // Build system or dependencies
'ci', // CI/CD changes
'chore', // Other changes that don't modify src
'revert', // Revert previous commit
],
],
'scope-case': [2, 'always', 'kebab-case'],
'subject-case': [0], // Allow any case for subject
},
};

254
docs/VERSIONING.md Normal file
View File

@@ -0,0 +1,254 @@
# Versioning & Changelog Guide
This document explains how versioning and changelog management works in Flowsint.
## Overview
Flowsint uses **Conventional Commits** and automated tooling to manage versions and generate changelogs:
- **Commitizen** - Interactive commit message helper
- **Commitlint** - Validates commit messages
- **Standard-Version** - Automatic versioning and changelog generation
- **Husky** - Git hooks for enforcing conventions
## Commit Message Format
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
```
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
```
### Types
- `feat:` - New feature (MINOR version bump)
- `fix:` - Bug fix (PATCH version bump)
- `perf:` - Performance improvement
- `refactor:` - Code refactoring
- `docs:` - Documentation changes
- `style:` - Code style changes (formatting, etc)
- `test:` - Adding or updating tests
- `build:` - Build system changes
- `ci:` - CI/CD changes
- `chore:` - Other changes
- `revert:` - Revert previous commit
### Breaking Changes
Add `BREAKING CHANGE:` in the footer or `!` after type to trigger a MAJOR version bump:
```
feat!: remove legacy API endpoints
BREAKING CHANGE: The /v1/ endpoints have been removed.
```
## Making Commits
### Option 1: Interactive (Recommended)
Use Commitizen for an interactive prompt:
```bash
# From root directory
yarn commit
# Or from flowsint-app directory
cd flowsint-app
yarn commit
```
### Option 2: Manual
Write commits manually following the format:
```bash
git commit -m "feat(api): add user authentication endpoint"
```
Commitlint will validate your message via the pre-commit hook.
## Creating Releases
### Automatic Version Bump
Let standard-version determine the version based on commits:
```bash
# Always run from root directory
yarn release
```
This will:
1. Analyze commits since last release
2. Determine version bump (major/minor/patch)
3. Update version in `package.json` and `pyproject.toml`
4. Generate/update `CHANGELOG.md`
5. Create a git commit and tag
### Manual Version Bump
Specify the version bump explicitly:
```bash
# Patch release (0.1.0 → 0.1.1)
yarn release:patch
# Minor release (0.1.0 → 0.2.0)
yarn release:minor
# Major release (0.1.0 → 1.0.0)
yarn release:major
```
### First Release
For the initial release:
```bash
yarn release:first
```
## After Creating a Release
1. **Review the changes**: Check `CHANGELOG.md` and version numbers
2. **Push to remote**:
```bash
git push --follow-tags origin main
```
## Version Synchronization
Versions are automatically synchronized across:
- `flowsint-app/package.json`
- `pyproject.toml`
The `scripts/sync-versions.js` script handles this synchronization.
## Manual Version Sync
If you need to manually sync versions:
```bash
yarn sync-version 1.2.3
```
## Workflow Examples
### Example 1: Adding a New Feature
```bash
# Make your changes
git add .
# Interactive commit
yarn commit
# Select: feat
# Scope: graph
# Description: add force-directed layout
# Create release
yarn release
# Push
git push --follow-tags origin main
```
### Example 2: Multiple Commits Before Release
```bash
# Commit 1
git commit -m "feat(ui): add dark mode toggle"
# Commit 2
git commit -m "fix(api): resolve connection timeout issue"
# Commit 3
git commit -m "docs: update API documentation"
# Create release (automatically determines version)
yarn release
# Result: Minor version bump (due to 'feat' commit)
# CHANGELOG.md includes all commits grouped by type
# Push
git push --follow-tags origin main
```
### Example 3: Breaking Change
```bash
# Make breaking changes
git add .
# Commit with breaking change
git commit -m "feat!: redesign authentication system
BREAKING CHANGE: Old auth tokens are no longer valid. Users must re-authenticate."
# Create release
yarn release
# Result: Major version bump
# CHANGELOG.md includes breaking change notice
# Push
git push --follow-tags origin main
```
## Configuration Files
- `.versionrc.json` - Standard-version configuration
- `commitlint.config.js` - Commit message rules
- `.husky/commit-msg` - Git hook for commit validation
- `scripts/sync-versions.js` - Version synchronization script
- `scripts/pyproject-updater.js` - Custom updater for pyproject.toml
## Troubleshooting
### Commit Message Rejected
If your commit is rejected by commitlint:
1. Check the error message for details
2. Follow the conventional commit format
3. Use `yarn commit` for guided commit creation
### Version Out of Sync
If versions are out of sync:
```bash
yarn sync-version <version>
```
### Incorrect Version Bump
If standard-version chose the wrong version:
1. Delete the tag: `git tag -d v1.2.3`
2. Reset the commit: `git reset HEAD~1`
3. Use explicit version: `yarn release:patch` (or minor/major)
## Best Practices
1. **Commit Often**: Make small, focused commits
2. **Use Commitizen**: Interactive prompts help ensure correct format
3. **Test Before Release**: Run tests before creating a release
4. **Review CHANGELOG**: Check generated changelog before pushing
5. **Meaningful Scopes**: Use consistent scope names (e.g., `api`, `ui`, `core`)
6. **Clear Descriptions**: Write descriptive commit messages
7. **Document Breaking Changes**: Always explain breaking changes in detail
## References
- [Conventional Commits](https://www.conventionalcommits.org/)
- [Semantic Versioning](https://semver.org/)
- [Standard-Version](https://github.com/conventional-changelog/standard-version)
- [Commitizen](https://github.com/commitizen/cz-cli)
- [Commitlint](https://commitlint.js.org/)

View File

@@ -3,7 +3,7 @@
"productName": "Flowsint", "productName": "Flowsint",
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"description": "AI-powered graph analysis and intelligence platform to help you discover hidden relationships and insights.", "description": "Graph analysis and intelligence platform to help you discover hidden relationships and insights.",
"author": "DexterMorgan", "author": "DexterMorgan",
"homepage": "https://www.flowsint.io/", "homepage": "https://www.flowsint.io/",
"scripts": { "scripts": {
@@ -126,6 +126,7 @@
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.3", "eslint-plugin-react": "^7.34.3",
"framer-motion": "^12.0.6", "framer-motion": "^12.0.6",
"husky": "^9.1.7",
"immer": "^10.1.1", "immer": "^10.1.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"postcss": "^8.4.35", "postcss": "^8.4.35",
@@ -133,6 +134,7 @@
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-icons": "^5.4.0", "react-icons": "^5.4.0",
"standard-version": "^9.5.0",
"tailwind-merge": "^3.3.0", "tailwind-merge": "^3.3.0",
"typescript": "^5.5.2", "typescript": "^5.5.2",
"vite": "^5.3.1", "vite": "^5.3.1",

View File

@@ -9,6 +9,7 @@ import { GraphNode } from '@/types'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import { useLayoutStore } from '@/stores/layout-store' import { useLayoutStore } from '@/stores/layout-store'
import { useNodesDisplaySettings } from '@/stores/node-display-settings' import { useNodesDisplaySettings } from '@/stores/node-display-settings'
import type { ItemType } from '@/stores/node-display-settings'
import { Badge } from '../ui/badge' import { Badge } from '../ui/badge'
import LaunchFlow from './launch-transform' import LaunchFlow from './launch-transform'
import { TypeBadge } from '../type-badge' import { TypeBadge } from '../type-badge'
@@ -55,7 +56,7 @@ export const SelectedList = () => {
return ( return (
<div className="flex flex-col gap-1.5 p-1"> <div className="flex flex-col gap-1.5 p-1">
{displayItems.map((item: GraphNode, index: number) => { {displayItems.map((item: GraphNode, index: number) => {
const color = colors[item.data.type] const color = colors[item.data.type as ItemType] ?? '#999999'
return <SelectedNodeItem key={index} node={item} color={color} /> return <SelectedNodeItem key={index} node={item} color={color} />
})} })}
{remainingCount > 0 && ( {remainingCount > 0 && (

File diff suppressed because it is too large Load Diff

32
package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "flowsint",
"version": "0.1.0",
"description": "Graph analysis and intelligence platform",
"private": true,
"type": "module",
"scripts": {
"prepare": "husky",
"commit": "cz",
"release": "standard-version",
"release:minor": "standard-version --release-as minor",
"release:major": "standard-version --release-as major",
"release:patch": "standard-version --release-as patch",
"release:first": "standard-version --first-release",
"sync-version": "node scripts/sync-versions.js"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"devDependencies": {
"husky": "^9.1.7",
"@commitlint/cli": "^20.1.0",
"@commitlint/config-conventional": "^20.0.0",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0"
},
"workspaces": [
"flowsint-app"
]
}

20
scripts/pyproject-updater.js Executable file
View File

@@ -0,0 +1,20 @@
/**
* Custom updater for pyproject.toml
* Used by standard-version to bump version in pyproject.toml
*/
const stringifyPackage = require('stringify-package');
const detectIndent = require('detect-indent');
const detectNewline = require('detect-newline');
module.exports.readVersion = function (contents) {
const match = contents.match(/^version = "(.*)"$/m);
return match ? match[1] : null;
};
module.exports.writeVersion = function (contents, version) {
return contents.replace(
/^version = ".*"$/m,
`version = "${version}"`
);
};

74
scripts/sync-versions.js Executable file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/env node
/**
* Version Synchronization Script
*
* Keeps versions synchronized across:
* - pyproject.toml (root)
* - flowsint-app/package.json
*
* Usage: node scripts/sync-versions.js <new-version>
*/
import { readFileSync, writeFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const ROOT_DIR = join(__dirname, '..');
function updatePyprojectVersion(version) {
const pyprojectPath = join(ROOT_DIR, 'pyproject.toml');
let content = readFileSync(pyprojectPath, 'utf8');
// Update version in [tool.poetry] section
content = content.replace(
/^version = ".*"$/m,
`version = "${version}"`
);
writeFileSync(pyprojectPath, content, 'utf8');
console.log(`✓ Updated pyproject.toml to ${version}`);
}
function updatePackageJsonVersion(version) {
const packagePath = join(ROOT_DIR, 'flowsint-app', 'package.json');
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
pkg.version = version;
writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
console.log(`✓ Updated flowsint-app/package.json to ${version}`);
}
function getCurrentVersion() {
const packagePath = join(ROOT_DIR, 'flowsint-app', 'package.json');
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
return pkg.version;
}
// Main execution
const newVersion = process.argv[2];
if (!newVersion) {
console.log(`Current version: ${getCurrentVersion()}`);
console.log('\nUsage: node scripts/sync-versions.js <version>');
console.log('Example: node scripts/sync-versions.js 1.2.3');
process.exit(1);
}
// Validate semantic version format
if (!/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(newVersion)) {
console.error('Error: Invalid version format. Expected: X.Y.Z or X.Y.Z-suffix');
process.exit(1);
}
try {
updatePyprojectVersion(newVersion);
updatePackageJsonVersion(newVersion);
console.log(`\n✓ All versions synchronized to ${newVersion}`);
} catch (error) {
console.error('Error syncing versions:', error.message);
process.exit(1);
}

8868
yarn.lock

File diff suppressed because it is too large Load Diff