Guidance for AI coding agents working with bkper-gs.
Google Apps Script library providing access to the Bkper REST API for bookkeeping within Google Workspace.
| Command | Purpose |
|---|---|
bun test |
Run test suite |
bun build |
Full build (clean, test, generate types) |
bun run dev |
Watch mode with auto-deploy |
bun run push |
Deploy to Google Apps Script |
bun run clasp:activate |
Activate stored clasp credentials |
Resource<T>→ Base class with payload managementResourceProperty<T>→ Adds custom property support (key/value pairs)- Entity classes (
Account,Book,Transaction,Group, etc.) extendResourceProperty
- Fluent builders: All entities use method chaining (
.setX().setY().create()) - Service layer: Namespaces suffixed with
_handle API communication (e.g.,AccountService_) - Lazy loading:
Bookloads data on first access viacheckBookLoaded_() - Global namespace: No ES6 imports/exports; uses
/// <reference path="..."/>directives
src/model/- Entity classessrc/service/- API communication (internal, suffixed with_)src/BkperApp.ts- Main public API entry pointsrc/Utils_.ts,src/CachedProperties_.ts- Utilities
- Target ES2019 (V8 runtime)
- Module system:
"none"- all code runs in global scope - File push order defined in
.clasp.jsonfor dependency resolution - Requires HttpRequestApp library for HTTP requests
- API types from
@bkper/bkper-api-typesunderbkpernamespace - No implicit any/returns enforced
- Mocha + Chai, bundled into single file before execution
- Limited coverage:
test/Group.spec.ts,test/Utils_.spec.ts
- Internal/private items suffixed with
_(e.g.,Utils_,checkBookLoaded_()) - Hidden properties end with
_(filtered bygetVisibleProperties()) - Services use static methods for CRUD with JSON serialization
- HTTP requests include retry logic with exponential backoff (up to 5 retries)