diff --git a/AGENTS.md b/AGENTS.md index ade1677..6c3eb99 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,7 +32,9 @@ Review the codebase with focus on: - Treat the wiki as the primary place for large design ideas, architectural drafts, and framework backlog notes. - If the agent identifies a substantial new concept or design direction, such as scenes, callback agents, a webhook model, or another framework-level abstraction, the agent must ask the user whether it should also formalize that idea as a draft wiki page. - When the user agrees, prefer paired wiki pages such as `Page.md` and `Page-RU.md`, and clearly mark draft design pages with `DRAFT` when the API is not implemented or not yet stable. -- Keep `TODO.md`, the wiki backlog pages, and `CHANGELOG.md` aligned when framework-level items move between planned and completed states. +- Keep `TODO.md`, the wiki backlog pages, and `CHANGELOG.md` aligned when framework-level items move between planned and completed states in the main repository. +- Wiki-only edits must never be added to `CHANGELOG.md`. +- `AGENTS.md`-only edits must never be added to `CHANGELOG.md`. ## Go review expectations Check for: @@ -90,7 +92,8 @@ Prefer the repository’s documented commands. If multiple choices exist, use th ## Versioning and changelog - After every code or documentation change in the main repository, update `CHANGELOG.md`. -- Changes made only inside the `.wiki/` repository do not require a `CHANGELOG.md` update. +- Changes made only inside the `.wiki/` repository must not be added to `CHANGELOG.md`. +- Changes made only in `AGENTS.md` must not be added to `CHANGELOG.md`. - Add changes only to the section for the next version after the latest published git tag. - The agent must check the latest published tag, `CHANGELOG.md`, and `utils/version.go` before editing the changelog. - The agent must verify that the target changelog version matches the version declared in `utils/version.go`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f87692..e24150d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.0.0-rc.14 + +### Changed +- Added missing godoc for the exported observer `Event` marker interface. + ## v1.0.0-rc.13 ### Added diff --git a/TODO.md b/TODO.md index ec11cf8..44cd369 100644 --- a/TODO.md +++ b/TODO.md @@ -12,8 +12,8 @@ Russian page: Current priority split: -- `Priority 2`: service layer and dependency graph model. -- `Partial`: webhook runtime model, plugin composition contract. +- `Partial`: webhook runtime model. +- `Ideas`: service layer and dependency graph model, plugin composition contract. Completed former high-priority items: diff --git a/observer.go b/observer.go index 65fd4e3..d5df215 100644 --- a/observer.go +++ b/observer.go @@ -32,6 +32,7 @@ const ( HandlerSceneMessageKind HandlerEventKind = "scene_message" ) +// Event is the marker interface implemented by all observer runtime events. type Event interface { isEvent() } diff --git a/plugins.go b/plugins.go index f988580..e61a223 100644 --- a/plugins.go +++ b/plugins.go @@ -18,7 +18,7 @@ const ( CommandValueStringType CommandValueType = "string" // CommandValueIntType expects a decimal integer (digits only). CommandValueIntType CommandValueType = "int" - // CommandValueBoolType is reserved for future use (not implemented). + // CommandValueBoolType expects a exact "true" or "false". CommandValueBoolType CommandValueType = "bool" // CommandValueAnyType accepts any input without validation. CommandValueAnyType CommandValueType = "any" @@ -193,6 +193,12 @@ func NewPlugin[T AppData](name string) *Plugin[T] { // AddCommand registers a command in the plugin. // The command's .command field is used as the key. func (p *Plugin[T]) AddCommand(command *Command[T]) *Plugin[T] { + if command == nil { + if p.logger != nil { + p.logger.Warnln("trying to add nil command") + } + return p + } p.commands[command.command] = command return p } @@ -208,6 +214,12 @@ func (p *Plugin[T]) NewCommand(exec CommandExecutor[T], command string, args ... // AddPayload registers a payload (e.g., callback query data) in the plugin. // Payloads are triggered by inline button callback_data, not by message text. func (p *Plugin[T]) AddPayload(command *Command[T]) *Plugin[T] { + if command == nil { + if p.logger != nil { + p.logger.Warnln("trying to add nil command") + } + return p + } p.payloads[command.command] = command return p } diff --git a/tgapi/api.go b/tgapi/api.go index e5ec1e9..79ceddd 100644 --- a/tgapi/api.go +++ b/tgapi/api.go @@ -98,6 +98,11 @@ type API struct { // Always call Close() when done to release resources. func NewAPI(opts *APIOpts) *API { l := utils.CreateLogger("API", utils.GetLoggerLevel()) + if opts == nil { + l.Errorln("Set API options") + _ = l.Close() + return nil + } client := opts.client if client == nil { diff --git a/tgapi/uploader_api.go b/tgapi/uploader_api.go index 5012160..9f812c1 100644 --- a/tgapi/uploader_api.go +++ b/tgapi/uploader_api.go @@ -71,6 +71,11 @@ type Uploader struct { // NewUploader creates a multipart uploader bound to an API client. func NewUploader(api *API) *Uploader { logger := utils.CreateLogger("UPLOADER", utils.GetLoggerLevel()) + if api == nil { + logger.Errorln("api is nil") + _ = logger.Close() + return nil + } return &Uploader{api, logger} } diff --git a/utils/version.go b/utils/version.go index 40e5010..22bdb51 100644 --- a/utils/version.go +++ b/utils/version.go @@ -2,7 +2,7 @@ package utils const ( // VersionString is the module version string. - VersionString = "1.0.0-rc.13" + VersionString = "1.0.0-rc.14" // VersionMajor is the module major version. VersionMajor = 1 // VersionMinor is the module minor version. @@ -10,5 +10,5 @@ const ( // VersionPatch is the module patch version. VersionPatch = 0 // VersionBeta is the prerelease counter for the current version. - VersionBeta = 13 + VersionBeta = 14 )