Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

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

jobs:
test:
name: Package and JavaScript docs suite
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, xml, curl, dom
coverage: none

- name: Install pinned QuickJS sandbox extension
env:
QUICKJS_SANDBOX_SHA256: 1030bdb948c056bacc607ddec0e825872622b1bdd214dc758696691644ce4097
run: |
curl -fsSL https://github.com/OpenCompanyApp/quickjs-sandbox/releases/download/v1.0.1/quickjs_sandbox-php84-nts-linux-x86_64.so -o /tmp/quickjs_sandbox.so
echo "${QUICKJS_SANDBOX_SHA256} /tmp/quickjs_sandbox.so" | sha256sum -c -
sudo install -m 0644 /tmp/quickjs_sandbox.so "$(php-config --extension-dir)/quickjs_sandbox.so"
echo 'extension=quickjs_sandbox.so' | sudo tee "$(php --ini | sed -n 's|Scan for additional .ini files in: ||p')/30-quickjs_sandbox.ini"
php --ri quickjs_sandbox

- name: Validate Composer manifest
run: composer validate --strict

- name: Install test dependencies
uses: ramsey/composer-install@v4

- name: Run package suite and compile every JavaScript example
run: composer check
22 changes: 11 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ When adding or modifying an integration in this repo, optimize for:
- package quality over package count
- stable host behavior across OpenCompany and KosmoKrator
- clean metadata and naming in discovery UIs
- Lua docs that help agents use tools correctly on the first try
- JavaScript docs that help agents use tools correctly on the first try
- deterministic tests with fake data only

This repo is a package monorepo, not a dumping ground for thin wrappers. If an integration is redundant, inconsistent, undocumented, or untested, it is not ready.
Expand All @@ -31,7 +31,7 @@ For the full architecture, see `README.md`. For a step-by-step walkthrough, see
- Add new integrations under `packages/{name}` as Composer packages. Do not create separate repos for new integrations unless explicitly required.
- Prefer one canonical package per service family. Do not add duplicate legacy wrappers when an existing package already owns that namespace.
- If a legacy package must remain for compatibility, make it defer to the canonical package and declare the replacement clearly in Composer metadata.
- Keep package ids, namespaces, app names, and Lua namespaces aligned. Avoid `google-docs` vs `google_docs` style drift.
- Keep package ids, namespaces, app names, and JavaScript namespaces aligned. Avoid `google-docs` vs `google_docs` style drift.
- Public-facing names must be human-readable. Do not use keyword blobs or SEO labels as the visible integration name.

## File Structure
Expand All @@ -47,7 +47,7 @@ packages/{name}/
{Name}{Action}.php # One class per tool
Triggers/ # Only if the service supports webhooks
{Name}WebhookTrigger.php
lua-docs/
script-docs/
{name}.md # MANDATORY — supplementary docs for the AI agent
```

Expand Down Expand Up @@ -251,7 +251,7 @@ For package folder names, prefer the established package id over inventing a sec

## Checklist

Every integration MUST have ALL applicable items checked. An integration is NOT complete without lua-docs, PHPDoc, and all 4 core files.
Every integration MUST have ALL applicable items checked. An integration is NOT complete without script-docs, PHPDoc, and all 4 core files.

### Mandatory (every integration)

Expand All @@ -260,15 +260,15 @@ Every integration MUST have ALL applicable items checked. An integration is NOT
- [ ] `src/{Name}ServiceProvider.php` with singleton + registry registration
- [ ] `src/{Name}ToolProvider.php` with `ConfigurableIntegration` + multi-account `resolveService()`
- [ ] `src/Tools/{Name}{Action}.php` — one file per tool, each with `name()`, `description()`, `parameters()`, `execute()` with try-catch
- [ ] `lua-docs/{name}.md` — **MANDATORY for every integration, not optional**
- [ ] `script-docs/{name}.md` — **MANDATORY for every integration, not optional**
- [ ] PHPDoc on every class (class docblock), constructor (`@param`), `execute()` (`@param array<string, mixed> $args`), and service methods (`@param` + `@return`)
- [ ] `credentialFields()` for credential-based integrations
- [ ] `testConnection()` for credential-based integrations
- [ ] All PHP files pass `php -l` syntax checks
- [ ] Tests added in this repo for non-trivial behavior, fallback logic, filters, or endpoint mapping
- [ ] No confidential domains, real tokens, real emails, or private project names in tests or docs
- [ ] Lua docs match the actual normalized tool output, not just the upstream API marketing docs
- [ ] Host behavior checked in both OpenCompany and KosmoKrator when the change affects discovery, credentials, Lua docs, or namespaces
- [ ] JavaScript docs match the actual normalized tool output, not just the upstream API marketing docs
- [ ] Host behavior checked in both OpenCompany and KosmoKrator when the change affects discovery, credentials, JavaScript docs, or namespaces

### Strongly Recommended

Expand All @@ -291,9 +291,9 @@ Every integration MUST have ALL applicable items checked. An integration is NOT
- unsupported-host behavior
- metadata and naming regressions

## Lua Docs Rules
## JavaScript Docs Rules

- `lua-docs/{name}.md` is required.
- `script-docs/{name}.md` is required.
- Document the namespace and the intended usage pattern.
- Document return shapes or normalized response notes when the output is not obvious.
- If the integration flattens or renames upstream fields, say so explicitly.
Expand All @@ -306,12 +306,12 @@ Every integration MUST have ALL applicable items checked. An integration is NOT
- Do not rely on fragile discovery side effects or duplicate package registration.
- Keep metadata compatible with both:
- settings UIs
- Lua namespace builders
- JavaScript namespace builders
- If a change affects discovery, visible naming, or namespace shape, verify both catalog output and UI-facing metadata.

### Common Mistakes to Avoid

1. **Forgetting lua-docs** — Every integration needs `lua-docs/{name}.md`. This is not optional.
1. **Forgetting script-docs** — Every integration needs `script-docs/{name}.md`. This is not optional.
2. **Forgetting PHPDoc** — Every class needs a docblock. Every constructor needs `@param`. Every `execute()` needs `@param array<string, mixed> $args`.
3. **Partial completions** — Do not submit with only Service + ServiceProvider but no ToolProvider or Tools.
4. **Missing ToolProvider** — Without it the integration won't appear in the registry.
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This repo contains Composer packages under `packages/` plus shared code under `c
- Prefer one canonical package per service family
- Do not add duplicate wrappers or alternate namespace spellings unless explicitly needed for compatibility
- Keep visible names clean and human-readable
- Keep Lua namespaces, package ids, metadata, and docs aligned
- Keep JavaScript namespaces, package ids, metadata, and docs aligned
- Do not commit real domains, real emails, real project names, or real API tokens in tests or docs

## Before You Add An Integration
Expand All @@ -40,14 +40,14 @@ This repo contains Composer packages under `packages/` plus shared code under `c
- `src/{Name}ServiceProvider.php`
- `src/{Name}ToolProvider.php`
- `src/Tools/...`
- `lua-docs/{name}.md`
- `script-docs/{name}.md`

## Quality Bar

- Tools should return shaped agent-friendly output, not raw API dumps
- Services should own normalization, endpoint quirks, and safe fallbacks
- Unsupported capabilities should fail clearly
- Lua docs should reflect actual tool behavior, including normalized output and self-hosted caveats
- JavaScript docs should reflect actual tool behavior, including normalized output and self-hosted caveats
- Non-trivial behavior needs tests in this repo

## Test Rules
Expand All @@ -62,5 +62,5 @@ This repo contains Composer packages under `packages/` plus shared code under `c
- Run syntax checks
- Run the relevant PHPUnit coverage in this repo
- Check metadata and naming
- Check Lua docs
- Check JavaScript docs
- Make sure the worktree is clean before you stop
Loading