Open-source software for Joomla, Gitea, and web platforms. Home of MokoSuite, MokoGitea, and MokoCLI.
Tennessee
standards/Coding-Standards.-
Coding Standards
PHP Standards
- PSR-12 coding style (extended)
- Namespace:
MokoCli\CliFramework\... - Strict types:
declare(strict_types=1);in every file - Use typed properties and return types
- No
@error suppression
Naming Conventions
| Element | Convention | Example |
|---|---|---|
| Classes | PascalCase | ReleaseManager |
| Methods | camelCase | getVersion() |
| Constants | UPPER_SNAKE | MAX_RETRIES |
| Variables | camelCase | $releaseTag |
| Files | PascalCase (class) | ReleaseManager.php |
| CLI commands | kebab-case | release-create |
Directory Structure
src/
Commands/ # CLI command classes
Services/ # Business logic
Providers/ # DI service providers
Traits/ # Shared traits
Exceptions/ # Custom exceptions
Go Standards (MokoGitea)
- Follow standard Go conventions (
gofmt,golint) - Imports: stdlib first, then module imports, separated by blank line
- Error handling: always check and return errors, never ignore
- Use
ctx(context) parameter consistently - API routes: use
ctx.APIError(status, msg)(2 args),ctx.APIErrorNotFound() - Database: use
db.GetEngine(ctx)frommodels/db, notctx.Orm() - Request parsing:
json.NewDecoder(ctx.Req.Body).Decode(&req), notctx.BindJSON()
JavaScript/TypeScript Standards
- ES modules (
import/export), not CommonJS - TypeScript preferred for all new MCP servers
- Use
fetch()for HTTP requests (notnode:httpsfor complex bodies) - Consistent error handling with typed errors
Revision History
| Date | Author | Changes |
|---|---|---|
| 2026-06-21 | jmiller | Initial consolidation from .profile and mokocli wikis |
Pages