Skip to content

Commit d2121ae

Browse files
authored
Merge pull request cipherunits#31 from cipherunits/chore/editorconfig-and-commit-hook
chore: add EditorConfig, README, and commit-msg hook
2 parents 7bd7b5f + ce42b60 commit d2121ae

4 files changed

Lines changed: 221 additions & 1 deletion

File tree

‎.agents/skills/fusion-coding-standards/SKILL.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ When you add behavior:
4949

5050
- Stage **individual files only**. Never `git add .` / `git add -A`.
5151
- Only commit when the user asks.
52-
52+
- **Commit messages** follow [Conventional Commits](https://www.conventionalcommits.org/): `<type>(optional-scope): <summary>`. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`, `release`. Optional hook (no npm): `git config core.hooksPath .githooks` → `.githooks/commit-msg`.
53+
- Editor defaults: `.editorconfig` (LF, UTF-8, language-specific indent).
5354
## Docs & skills hygiene
5455

5556
After introducing something agents or developers must know later:

‎.editorconfig‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# EditorConfig — https://editorconfig.org
2+
# Keep editors aligned across Rust, Python, Node, C#, and repo docs.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.{js,mjs,cjs,ts,tsx,jsx,json,yml,yaml}]
15+
indent_size = 2
16+
17+
[*.{cs,csproj,props,targets}]
18+
indent_size = 4
19+
20+
[*.{rs,toml}]
21+
indent_size = 4
22+
23+
[*.py]
24+
indent_size = 4
25+
max_line_length = 100
26+
27+
[*.md]
28+
trim_trailing_whitespace = false
29+
indent_size = 2
30+
31+
[*.html]
32+
indent_size = 2
33+
34+
[*.{css,scss}]
35+
indent_size = 2
36+
37+
[Makefile]
38+
indent_style = tab
39+
40+
[*.sh]
41+
indent_size = 2

‎.githooks/commit-msg‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env sh
2+
# Validate Conventional Commits without Node/npm.
3+
# Enable once per clone: git config core.hooksPath .githooks
4+
#
5+
# Format: <type>(optional-scope)!: <summary>
6+
# Types: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|release
7+
8+
msg_file="$1"
9+
if [ -z "$msg_file" ] || [ ! -f "$msg_file" ]; then
10+
echo "commit-msg: missing commit message file" >&2
11+
exit 1
12+
fi
13+
14+
# First non-comment, non-empty line is the subject.
15+
subject=$(
16+
grep -v '^#' "$msg_file" | sed '/^[[:space:]]*$/d' | head -n 1
17+
)
18+
19+
if [ -z "$subject" ]; then
20+
echo "commit-msg: empty commit subject" >&2
21+
exit 1
22+
fi
23+
24+
# Allow merge / revert subjects produced by git itself.
25+
case "$subject" in
26+
Merge\ *|Revert\ *)
27+
exit 0
28+
;;
29+
esac
30+
31+
pattern='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|release)(\([a-z0-9._/-]+\))?(!)?: .+'
32+
33+
if ! printf '%s\n' "$subject" | grep -Eq "$pattern"; then
34+
cat >&2 <<'EOF'
35+
commit-msg: subject must follow Conventional Commits
36+
37+
<type>(optional-scope): <summary>
38+
39+
Examples:
40+
feat(cache): add get_or_set helper
41+
fix(node): restore swagger navbar versions
42+
docs: expand root README install section
43+
chore(release): bump to 2.0.2
44+
45+
Types: feat fix docs style refactor perf test build ci chore revert release
46+
EOF
47+
exit 1
48+
fi
49+
50+
# Soft limit: keep the subject scannable in git log.
51+
len=$(printf '%s' "$subject" | wc -c | tr -d ' ')
52+
if [ "$len" -gt 100 ]; then
53+
echo "commit-msg: subject is ${len} chars (max 100)" >&2
54+
exit 1
55+
fi
56+
57+
exit 0

‎README.md‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Fusion Framework
2+
3+
Class-based HTTP APIs with one shared Rust core and first-class bindings for **Python**, **Node.js**, and **C#**. Routes, middleware, OpenAPI/Swagger, cache, templates, and background tasks share the same semantics across languages — write once in `fusion-core`, expose through each binding.
4+
5+
| | |
6+
|---|---|
7+
| **Docs** | [fusion.cipherunit.xyz](https://fusion.cipherunit.xyz/) |
8+
| **CLI / scaffolds** | [cipherunits/fusion-tool](https://github.com/cipherunits/fusion-tool) |
9+
| **License** | [BSD 3-Clause](LICENSE) |
10+
| **Version** | `2.0.1` |
11+
12+
## Why this repo
13+
14+
Most multi-language frameworks drift: each binding invents its own router rules and OpenAPI shapes. Fusion keeps shared behavior in Rust (`crates/fusion-core`) and thin glue in each language, so `api/[module]/{id}`, versioned Swagger, and middleware chains stay aligned.
15+
16+
## Install (applications)
17+
18+
Use published packages for app projects. Scaffold with Fusion Tool when you want a full project tree:
19+
20+
```bash
21+
# CLI
22+
# https://github.com/cipherunits/fusion-tool
23+
fusion init --lang python --name my-app # or node / csharp
24+
```
25+
26+
| Language | Package |
27+
|----------|---------|
28+
| Python | `pip install fusion-framework` |
29+
| Node.js | `npm install fusion-framework` |
30+
| C# | `dotnet add package Fusion-Framework` |
31+
32+
Binding-specific quick starts live next to the packages:
33+
34+
- [Python](crates/fusion-py/README.md)
35+
- [Node](crates/fusion-node/README.md)
36+
- [C#](bindings/csharp/FusionFramework/README.md)
37+
38+
## Repository layout
39+
40+
```text
41+
crates/fusion-core/ Shared Rust: routing, HTTP, cache, templates, tasks
42+
crates/fusion-py/ Python (PyO3) + fusion_framework package
43+
crates/fusion-node/ Node (N-API) package published as fusion-framework
44+
crates/fusion-ffi/ C ABI used by the C# binding
45+
bindings/csharp/ Managed C# API (NuGet: Fusion-Framework)
46+
examples/ Side-by-side demos (.py / .mjs / .cs)
47+
tests/ Executable tests (not inside installable packages)
48+
scripts/ Dev install + version bump helpers
49+
.agents/skills/ Agent skills for contributors working in this repo
50+
```
51+
52+
## Develop from source
53+
54+
Prerequisites: Rust (stable), Python 3.9+, Node 18+, .NET SDK matching the C# target (`net10.0`).
55+
56+
From the repo root:
57+
58+
```bash
59+
./scripts/dev-install-python.sh --create-venv # or --venv .venv
60+
./scripts/dev-install-node.sh
61+
./scripts/dev-install-csharp.sh
62+
# or all three:
63+
./scripts/dev-install-all.sh
64+
```
65+
66+
Details: [scripts/README.md](scripts/README.md).
67+
68+
### Tests
69+
70+
```bash
71+
./tests/scripts/run-all.sh
72+
```
73+
74+
Per binding and layout notes: [tests/README.md](tests/README.md).
75+
76+
### Examples
77+
78+
Runnable samples under `examples/` mirror public APIs across languages (routing, cache, middleware, templates, static files, and more). Prefer adding a trio (`.py` / `.mjs` / `.cs`) when you introduce a new cross-binding feature.
79+
80+
## Contributing
81+
82+
### Cross-binding parity
83+
84+
If a feature is user-facing in one binding (routes, middleware, permissions, settings, Swagger, UI helpers, …), implement it in **Python, Node, and C#** in the same change set unless the change is explicitly scoped. Put shared semantics in `fusion-core` first.
85+
86+
### Commit messages
87+
88+
Use [Conventional Commits](https://www.conventionalcommits.org/):
89+
90+
```text
91+
<type>(optional-scope): <short summary>
92+
93+
feat(cache): add get_or_set helper
94+
fix(node): restore swagger navbar versions
95+
docs: expand root README install section
96+
chore(release): bump to 2.0.2
97+
```
98+
99+
Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`, `release`.
100+
101+
Optional local check (POSIX shell, no npm):
102+
103+
```bash
104+
git config core.hooksPath .githooks
105+
```
106+
107+
That installs [`.githooks/commit-msg`](.githooks/commit-msg). Editor defaults: [`.editorconfig`](.editorconfig).
108+
### Staging
109+
110+
Stage files by path (`git add path/to/file`). Do not use `git add .` / `git add -A` in this repository.
111+
112+
## Links
113+
114+
- Site & docs: https://fusion.cipherunit.xyz/
115+
- Issues: https://github.com/cipherunits/fusion-framework/issues
116+
- Fusion Tool (CLI): https://github.com/cipherunits/fusion-tool
117+
- Author: [CipherUnits](https://cipherunit.xyz)
118+
119+
## License
120+
121+
BSD 3-Clause. See [LICENSE](LICENSE).

0 commit comments

Comments
 (0)