Skip to content

Commit f088b47

Browse files
author
codetheuri
committed
feat: complete Tusk framework refactor, RBAC, Huma v2 integration, and documentation
- Refactor authorization models and fix PermissionRecord references - Fix DefaultRegistry Find method integration in service_role.go - Integrate Huma v2 OpenAPI 3.0 router and structured DTO response envelopes - Remove obsolete cmd/genmodule scaffolding tool and Makefile target - Add comprehensive documentation guides in docs/ (getting-started, architecture, routing, authorization, database, querying, responses) - Add CHANGELOG.md, CONTRIBUTING.md, and update package placement guide for future features (Redis, Queues, Audit, Telemetry) - Clean up .github/workflows and update .gitignore
1 parent 00e276b commit f088b47

131 files changed

Lines changed: 5143 additions & 4522 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/rules/architecture.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Tusk Architecture Philosophy
6+
7+
Tusk should feel like Go, not like Laravel, Spring Boot, or ASP.NET.
8+
9+
Every package should have one clear responsibility.
10+
11+
Every module should own its business domain.
12+
13+
Avoid deep abstractions.
14+
15+
Avoid framework magic.
16+
17+
Avoid hidden behavior.
18+
19+
Avoid reflection unless absolutely necessary.
20+
21+
Avoid code generation unless it clearly improves developer experience.
22+
23+
Every dependency should be visible in constructors.
24+
25+
Use dependency injection through constructors.
26+
27+
Keep APIs small.
28+
29+
Keep exported APIs intentional.
30+
31+
Write code that is obvious to read.
32+
33+
If a design becomes difficult to explain, it is probably too complicated.
34+
35+
Prefer standard library solutions over third-party packages unless the package provides significant value.
36+
37+
The framework should teach good Go by example.
38+
39+
Whenever you improve my code:
40+
41+
Do not only rewrite it.
42+
43+
Explain:
44+
45+
- why the original design was less idiomatic
46+
- why the new design is preferred
47+
- what Go principle it follows
48+
- whether the change improves readability, simplicity, testing, or maintainability
49+
50+
Assume I am learning advanced Go architecture.
51+
52+
Prioritize helping me become a better Go engineer over simply producing code.
53+
54+
Before introducing any abstraction, ask:
55+
56+
- Does this abstraction reduce complexity?
57+
- Or does it merely hide complexity?
58+
59+
Avoid abstractions that exist only for future possibilities.
60+
61+
Follow the Go principle:
62+
63+
"A little copying is better than a little dependency."
64+
65+
Prefer duplication over premature abstraction when it leads to simpler, more readable code.

.agents/rules/documenation.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Every exported type
6+
7+
Every exported function
8+
9+
Every package
10+
11+
must contain documentation.
12+
13+
Generated code should teach developers why something exists.

.agents/rules/gostyle.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Always write idiomatic Go.
6+
7+
Prefer the standard library.
8+
9+
Keep functions focused.
10+
11+
Return errors.
12+
13+
Avoid panic except unrecoverable startup failures.
14+
15+
Prefer composition over inheritance.
16+
17+
Use dependency injection.
18+
19+
Never use global mutable state.

.agents/rules/handlers.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Handlers should
6+
7+
- validate input
8+
- call service
9+
- return response
10+
11+
Handlers should never contain business logic.

.agents/rules/identity.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
You are contributing to Tusk.
6+
7+
Tusk is an opinionated Go backend framework focused on clarity, modularity, maintainability, and developer experience.
8+
9+
Every suggestion should align with Tusk's architecture.

.agents/rules/performance.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Prefer clarity.
6+
7+
Avoid premature optimization.
8+
9+
Avoid unnecessary allocations.
10+
11+
Avoid reflection.
12+
13+
Avoid goroutine leaks.
14+
15+
Use benchmarks before optimization.

.agents/rules/repository.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Repositories only access storage.
6+
7+
No business logic.
8+
9+
Use context.Context.
10+
11+
Avoid N+1 queries.
12+
13+
Prefer transactions when needed.

.agents/rules/responses.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
All API responses should be consistent.
6+
7+
Prefer
8+
9+
success
10+
message
11+
data
12+
errors
13+
14+
Return meaningful HTTP status codes.
15+
16+
Never expose internal errors.

.agents/rules/security.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Validate all inputs.
6+
7+
Never trust client data.
8+
9+
Hash passwords using bcrypt or Argon2.
10+
11+
Never log secrets.
12+
13+
Protect against SQL injection.
14+
15+
Use prepared queries.
16+
17+
Use secure JWT practices.

.agents/rules/services.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
Services contain business rules.
6+
7+
Services never know about HTTP.
8+
9+
Services return domain errors.
10+
11+
Services coordinate repositories.

0 commit comments

Comments
 (0)