Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
c322527
adding init
frag223 Jun 17, 2026
fd60bfe
bare min model for boilerplate
frag223 Jun 17, 2026
da771d2
adding more queries
frag223 Jun 17, 2026
a3e9e87
update taskfile
frag223 Jun 17, 2026
0d06027
adding migrator
frag223 Jun 17, 2026
c35468b
min working db
frag223 Jun 17, 2026
39d0b81
adding config
frag223 Jun 17, 2026
9e4035c
adding task
frag223 Jun 17, 2026
06df70e
wip adding ui
frag223 Jun 17, 2026
2b7622e
adding theme
frag223 Jun 17, 2026
05d4ad0
removing shadowing
frag223 Jun 17, 2026
7f83658
adding junie
frag223 Jun 17, 2026
7bade87
adding router and pages
frag223 Jun 18, 2026
d30c4ae
adding query
frag223 Jun 18, 2026
d72b614
adding interface
frag223 Jun 18, 2026
0f2e0bd
adding service
frag223 Jun 18, 2026
06c60fd
adding error handling
frag223 Jun 18, 2026
f0d348d
adding state
frag223 Jun 18, 2026
7119205
adding ui for routing
frag223 Jun 18, 2026
d7f3103
adding ui guidelines
frag223 Jun 18, 2026
585ae47
adding team state management
frag223 Jun 19, 2026
8b1d7c5
passing state down
frag223 Jun 19, 2026
f506162
wip
frag223 Jun 19, 2026
2f225c8
adding new coach form
frag223 Jun 19, 2026
a7395df
adding footer helper
frag223 Jun 19, 2026
ea593eb
wip
frag223 Jun 19, 2026
3ecebea
wip
frag223 Jun 19, 2026
0b46232
adding players
frag223 Jun 19, 2026
0406894
adding page
frag223 Jun 19, 2026
234d3e8
added locker room and players
frag223 Jun 19, 2026
ad01d60
adding ability to update player names
frag223 Jun 19, 2026
294c3c3
adding avatar
frag223 Jun 19, 2026
04f8896
theme
frag223 Jun 19, 2026
677204b
adding local migrator
frag223 Jun 20, 2026
fc1e2e3
adding playbook service
frag223 Jun 20, 2026
3074def
adding playbook service
frag223 Jun 20, 2026
70ac656
adding methods
frag223 Jun 20, 2026
da56d62
documenting formations
frag223 Jun 20, 2026
4b47c47
adding formations
frag223 Jun 20, 2026
7e66426
adding formations
frag223 Jun 20, 2026
c0047f3
adding formations
frag223 Jun 20, 2026
c436e71
adding page
frag223 Jun 20, 2026
6c98d4b
wip
frag223 Jun 20, 2026
40bb26b
fixing
frag223 Jun 20, 2026
58250b0
adding ability to add playbooks
frag223 Jun 20, 2026
c21c1db
adding ability to add playbooks
frag223 Jun 21, 2026
3002ecc
components added
frag223 Jun 21, 2026
0eb2fdb
clean up
frag223 Jun 21, 2026
a1c1cc8
splitting out pages
frag223 Jun 21, 2026
94b9ec3
update
frag223 Jun 21, 2026
24d8bef
wip adding
frag223 Jun 21, 2026
7f11ac9
wip working playbooks
frag223 Jun 21, 2026
da0cceb
wip working playbooks
frag223 Jun 21, 2026
8501d97
update rules
frag223 Jun 21, 2026
064e458
wip generating AI service
frag223 Jun 21, 2026
4cda7c1
fixing + refactoring
frag223 Jun 21, 2026
c4ecfe1
clean up
frag223 Jun 21, 2026
4add609
playbooks generated
frag223 Jun 21, 2026
0d74bf4
adding interface
frag223 Jun 22, 2026
106825d
update tests
frag223 Jun 22, 2026
0206e42
adding ai generation step
frag223 Jun 22, 2026
3b71612
fixing err naming
frag223 Jun 22, 2026
9fc3cd1
update
frag223 Jun 22, 2026
c9a0ce3
resolving a lane
frag223 Jun 22, 2026
2a63702
adding game mechanics
frag223 Jun 22, 2026
bf7797e
adding game mechanics
frag223 Jun 22, 2026
b58e5e3
wip, adding round resolver
frag223 Jun 22, 2026
f3b1925
wip designing game loop
frag223 Jun 22, 2026
6b72184
wip designing game loop
frag223 Jun 24, 2026
7515c4b
adding create + update service
frag223 Jun 25, 2026
5aae518
update
frag223 Jun 25, 2026
ba3aefd
update docs
frag223 Jun 25, 2026
766e598
update test
frag223 Jun 25, 2026
5796e96
adding create page
frag223 Jun 26, 2026
428d5cc
adding method
frag223 Jun 26, 2026
0544778
refactoring title menu
frag223 Jun 26, 2026
1dc27af
fixing var
frag223 Jun 26, 2026
a59410a
adding pages
frag223 Jun 26, 2026
7114a3a
adding battle selection. WIP not working
frag223 Jun 26, 2026
adbc8d3
wip passing deps
frag223 Jun 26, 2026
b827de4
fixing tests
frag223 Jun 26, 2026
6bb3d4f
refactoring
frag223 Jun 26, 2026
f482713
moving for teams to be an orchestrator
frag223 Jun 26, 2026
0188b09
moving function around
frag223 Jun 26, 2026
d499b75
refactoring
frag223 Jun 27, 2026
394e0f2
refactoring
frag223 Jun 27, 2026
ba9e44c
wip kinda working
frag223 Jun 27, 2026
4247ded
kinda fixed
frag223 Jun 27, 2026
f7ec697
wip
frag223 Jun 27, 2026
98cf1ca
wip
frag223 Jun 27, 2026
bde6c60
wip
frag223 Jun 27, 2026
838f350
wip
frag223 Jun 27, 2026
ae2e95e
fixing issue
frag223 Jun 27, 2026
437ab57
fixing issue
frag223 Jun 27, 2026
c298969
forcing version
frag223 Jun 27, 2026
2b1f336
forcing version
frag223 Jun 27, 2026
00e021b
removing lint for now
frag223 Jun 27, 2026
413ea55
adding format checker
frag223 Jun 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .covignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gen.go
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @frag223
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: app ci

on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install sqlc
uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: '1.27.0'

- name: Run generation
run: task generate

- name: Run format checker
run: task format-check

# - name: golangci-lint
# uses: golangci/golangci-lint-action@v9
# with:
# version: v2.12

- name: Run sqlc vet
run: sqlc vet

- name: Run tests
run: task cover
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ go.work.sum

# env file
.env
.env.local
.idea
.db
.task

# Editor/IDE
# .idea/
Expand Down
48 changes: 48 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "2"

linters:
enable:
- cyclop
- nestif
- bodyclose
- iface
- gosec
- errcheck
- errchkjson
- errname
- errorlint
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- govet
- importas
- ireturn
- perfsprint
- recvcheck
- sloglint
- staticcheck
- unparam
- unused
- wastedassign
exclusions:
generated: lax

rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
- cyclop
- dupl
- gosec
- forbidigo
- exhaustruct

settings:
depguard:
rules:
main:
list-mode: lax


229 changes: 229 additions & 0 deletions .junie/guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@

## Global rules
- You must always ask before creating mocks

## SQLite queries

- When writing sqlite queries use the tool [sqlc](https://sqlc.dev/)
- When writing SQL queries ensure you annotate your queries
- Following are examples of correct annotations
- after you finished writing the queries, use the command `task gen` to generate the boilerplate go code

```sql
-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = ? LIMIT 1;

-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;

-- name: CreateAuthor :one
INSERT INTO authors (
name, bio
) VALUES (
?, ?
)
RETURNING *;

-- name: UpdateAuthor :exec
UPDATE authors
set name = ?,
bio = ?
WHERE id = ?;

-- name: DeleteAuthor :exec
DELETE FROM authors
WHERE id = ?;
```

## Frontend

## Golang

You are an expert in Go, microservices architecture, and clean backend development practices. Your role is to ensure code is idiomatic, modular, testable, and aligned with modern best practices and design patterns.

review `taskfile.yaml` for list of commands available in repo.

### UI
- UI is https://github.com/charmbracelet/bubbletea
- Use components: https://github.com/charmbracelet/bubbles
- Use styling: https://github.com/charmbracelet/lipgloss

### General Responsibilities:
- Do not add useless comments
- Guide the development of idiomatic, maintainable, and high-performance Go code.
- Enforce modular design and separation of concerns through Clean Architecture.
- Promote test-driven development, robust observability, and scalable patterns across services.

### Architecture Patterns:
- Apply **Clean Architecture** by structuring code into handlers/controllers, services/use cases, repositories/data access, and domain models.
- Use **domain-driven design** principles where applicable.
- Prioritise **interface-driven development** with explicit dependency injection.
- Prefer **composition over inheritance**; favour small, purpose-specific interfaces.
- Ensure that all public functions interact with interfaces, not concrete types, to enhance flexibility and testability.

### Project Structure Guidelines:
- Use a consistent project layout:
- cmd/: application entrypoint
- internal/: core application logic (not exposed externally)
- Group code by feature when it improves clarity and cohesion.
- Keep logic decoupled from framework-specific code.

### Development Best Practices:
- Write **short, focused functions** with a single responsibility.
- Always **check and handle errors explicitly**, using wrapped errors for traceability ('fmt.Errorf("context: %w", err)').
- Avoid **global state**; use constructor functions to inject dependencies.
- Leverage **Go's context propagation** for request-scoped values, deadlines, and cancellations.
- Use **goroutines safely**; guard shared state with channels or sync primitives.
- **Defer closing resources** and handle them carefully to avoid leaks.

### Security and Resilience:
- Apply **input validation and sanitisation** rigorously, especially on inputs from external sources.
- Use secure defaults for **JWT, cookies**, and configuration settings.
- Isolate sensitive operations with clear **permission boundaries**.
- Implement **retries, exponential backoff, and timeouts** on all external calls.
- Use **circuit breakers and rate limiting** for service protection.
- Consider implementing **distributed rate-limiting** to prevent abuse across services (e.g., using Redis).

### Testing:
- Write **unit tests** using use [odize](https://github.com/code-gorilla-au/odize) as the test framework and parallel execution.
- Do not mock out the database, we're using sqlite and embedded db for tests.
- Think about edge cases, within reason.
- **Mock external interfaces** cleanly using generated ([Moq](https://github.com/matryer/moq)) or handwritten mocks.
- Separate **fast unit tests** from slower integration and E2E tests.
- Ensure **test coverage** for every exported function, with behavioural checks.
- Test command with coverage is: `task cover`.


#### Example odize framework
```golang
func TestQueries(t *testing.T) {
group := odize.NewGroup(t, nil)

owner := "acme"
repo := "super-repo"
topic := "tooling"

err := group.
Test("queryReposByTopic builds expected search query", func(t *testing.T) {
q := queryReposByTopic(owner, topic)

odize.AssertTrue(t, containsAll(q, []string{
"search(",
"type: REPOSITORY",
"first: 100",
"pageInfo",
"hasNextPage",
"endCursor",
"repositoryCount",
"edges",
"... on Repository",
"name",
"url",
"owner",
"login",
}))

odize.AssertTrue(t, containsAll(q, []string{
"owner:" + owner,
"topic:" + topic,
}))
}).
Test("queryGetRepoDetails builds expected repository details query", func(t *testing.T) {
q := queryGetRepoDetails(owner, repo)

odize.AssertTrue(t, containsAll(q, []string{
"repository(owner: \"" + owner + "\"",
", name: \"" + repo + "\")",
}))

odize.AssertTrue(t, containsAll(q, []string{
"name",
"url",
"owner",
"login",
}))

odize.AssertTrue(t, containsAll(q, []string{
"pullRequests",
"orderBy: {field: CREATED_AT, direction: ASC}",
"totalCount",
"nodes",
"id",
"state",
"title",
"createdAt",
"mergedAt",
"permalink",
"author",
"login",
}))

odize.AssertTrue(t, containsAll(q, []string{
"vulnerabilityAlerts",
"pageInfo",
"hasNextPage",
"endCursor",
"nodes",
"securityVulnerability",
"package",
"name",
"advisory",
"severity",
"firstPatchedVersion",
"identifier",
"updatedAt",
}))
}).
Run()

odize.AssertNoError(t, err)
}


func TestService_GetAllOrganisations(t *testing.T) {
group := odize.NewGroup(t, nil)

var s *Service

ctx := context.Background()

group.BeforeEach(func() {
s = NewService(ctx, _testDB, _testTxnDB)
})

err := group.
Test("should return all existing organisations", func(t *testing.T) {
initialOrgs, err := s.GetAllOrganisations()
odize.AssertNoError(t, err)
initialCount := len(initialOrgs)
odize.AssertTrue(t, initialCount > 0)
}).
Run()
odize.AssertNoError(t, err)
}
```

### Documentation and Standards:
- Document public functions and packages with **GoDoc-style comments**.
- Provide concise **READMEs** for services and libraries.
- Maintain a 'CONTRIBUTING.md' and 'ARCHITECTURE.md' to guide team practices.
- Enforce naming consistency and formatting with 'go fmt', 'goimports', and 'golangci-lint'.

### Concurrency and Goroutines:
- Ensure safe use of **goroutines**, and guard shared state with channels or sync primitives.
- Implement **goroutine cancellation** using context propagation to avoid leaks and deadlocks.

### Tooling and Dependencies:
- Rely on **stable, minimal third-party libraries**; prefer the standard library where possible.
- Use **Go modules** for dependency management and reproducibility.
- Version-lock dependencies for deterministic builds.
- Integrate **linting, testing, and security checks** in CI pipelines.

### Key Conventions:
1. Prioritise **readability, simplicity, and maintainability**.
2. Design for **change**: isolate business logic and minimise framework lock-in.
3. Emphasise clear **boundaries** and **dependency inversion**.
4. Ensure all behaviour is **observable, testable, and documented**.
5. **Automate workflows** for testing, building, and deployment.
Empty file added .junie/memory/errors.md
Empty file.
Empty file added .junie/memory/feedback.md
Empty file.
1 change: 1 addition & 0 deletions .junie/memory/language.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions .junie/memory/memory.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
Empty file added .junie/memory/tasks.md
Empty file.
Loading
Loading