This file provides context for AI coding agents (Claude Code, GitHub Copilot, Cursor, etc.) working in this repository.
richdocuments is the ownCloud Server app that integrates Collabora Online for real-time
collaborative editing of documents, spreadsheets and presentations. ownCloud acts as the WOPI host;
Collabora Online is the WOPI client. The app ships in two flavours: a classic server-rendered
frontend and a connector for ownCloud Web.
- Product family: Classic (ownCloud Server)
- Supported server versions:
mastertargets ownCloud 11 with PHP 8.3; branch4.2targets ownCloud 10.11+ with PHP 7.4 (seeappinfo/info.xml) - Primary language(s): PHP, TypeScript/Vue, JavaScript
- Build system: Composer, Make, pnpm + Vite
- Test framework: PHPUnit (unit), karma + Jasmine (JavaScript unit), Behat (webUI acceptance)
- CI system: GitHub Actions
- License: AGPL-3.0
appinfo/- App metadata and registration (info.xml,routes.php,app.php,Migrations/)lib/- PHP backend:Controller/(WOPI, document, settings, federation endpoints),Db/(WOPI token storage),Panels/(admin and personal settings),BackgroundJob/(expired WOPI token cleanup), plus theDiscoveryService,DocumentService,FederationServiceandFileServiceclassessrc/- Vue/TypeScript source of the ownCloud Web connector (index.ts,editor.vue), built with@ownclouders/extension-sdkjs/- Classic frontend JavaScript, hand-written (documents.js,settings-admin.js,settings-personal.js,viewer/).js/web/richdocuments.jsis the committed Vite build output ofsrc/- do not edit it by handcss/- Stylesheetstemplates/- Server-side PHP templatesassets/- Empty office document templates used when creating new filesimg/- App icons and imagesl10n/- Translationstests/- PHPUnit, JavaScript and acceptance tests (tests/unit/,tests/js/,tests/acceptance/)admin.php/settings.php- Settings entry pointsMakefile- Build and test automationcomposer.json- PHP dependenciespackage.json- JavaScript dependenciesvite.config.ts- Vite build configuration for the Web connectorphpunit.xml- PHPUnit configuration (singleunittest suite)phpcs.xml- PHP_CodeSniffer configuration.php-cs-fixer.dist.php- php-cs-fixer configurationphpstan.neon- PHPStan configuration.phan/- Phan static analysis configurationsonar-project.properties- SonarCloud configurationvendor-bin/- Isolated tool dependencies (phpunit, php-cs-fixer, phpcs, phan, phpstan, behat)
- Branching:
masterfor the ownCloud 11 line,4.2for the ownCloud 10.x line. Fixes that apply to both need a PR per branch. - Commit messages: DCO sign-off required (
git commit -s). Must follow Conventional Commits format - enforced by CI viaowncloud/reusable-workflows/.github/workflows/semantic-git-message.yml. The repository squash-merges and takes the PR title as the commit subject, so the PR title must follow the same format. - Code style: php-cs-fixer with the ownCloud coding standard, plus PHP_CodeSniffer (
phpcs.xml) for the backend; ESLint and Prettier for the frontend. - Static analysis: Phan and PHPStan.
- PR process: Open a PR against the target branch. All CI checks must pass.
- Quality gate: SonarCloud analyses the repository.
# Show all available targets
make help
# Build distribution tarball
make dist
# Install PHP dependencies
composer install
# Build the ownCloud Web connector (src/ -> js/web/)
pnpm install
pnpm build
# Test (PHPUnit)
make test-php-unit
# Test (JavaScript unit, js/ only)
make test-js
# same, on a machine without Firefox
KARMA_BROWSER=ChromeHeadless make test-js
# Test (WebUI Acceptance)
make test-acceptance-webui
# Lint (PHP code style)
make test-php-style
# Fix code style
make test-php-style-fix
# Lint (JavaScript/TypeScript)
pnpm lint
# Static analysis
make test-php-phan
make test-php-phpstan
# Clean build artifacts and dependencies
make clean- Tests need a core checkout:
make test-php-unitresolves PHPUnit at../../lib/composer/bin/phpunit, so the app must be checked out asapps/richdocumentsinside an ownCloud Server tree. It cannot be run from a standalone clone. The same holds formake test-js: the scripts injs/expect the globals the server puts on the page, sotests/js/karma.config.cjsloads jQuery, jQuery UI andOCfrom the surrounding core checkout (core/js/core.json,core/vendor/,core/js/tests/specHelper.js). Core's node dependencies have to be installed there once (makein the core root), which is what creates thecore/vendorsymlink. - JavaScript unit tests only cover
js/:tests/js/runs the classic frontend. The Vue connector insrc/has no unit tests yet; it needs a separate vitest setup, as used byowncloud/web-extensions. make distis the only packaging target: it copies an explicit allowlist (all_src) intobuild/dist/and is what the release workflow publishes. It callsocc integrity:sign-apponly when a signing key and certificate are present in~/.owncloud/certificates/, and skips signing otherwise, so a local build needs no certificates.- WOPI dependency: Requires a running Collabora Online server that the ownCloud server can reach, and that can reach the ownCloud server in turn.
- Dual frontend: Has both a classic frontend (
js/) and an ownCloud Web connector (src/, built with Vite intojs/web/). Frontend changes usually need to be made in both places. - Generated frontend bundle is committed: regenerate
js/web/richdocuments.jswithpnpm buildand commit the result; never hand-edit it. - License: AGPL-3.0, as declared in
appinfo/info.xmland in the header of every source file. All contributions must be compatible with it. Note that this repository has no rootLICENSE/COPYINGfile yet; adding one is tracked as OSPO follow-up work. - Copyleft + Apache 2.0 migration: The broader ownCloud organization is migrating repositories to Apache 2.0. AGPL-3.0 is Category X under Apache policy, so migration requires full relicensing. Do not introduce new copyleft dependencies without discussion in an issue first.
- Translations: Must be submitted via Transifex, not as pull requests.
- Only use actions owned by
owncloud, created by GitHub (actions/*), verified on the GitHub Marketplace, or verified by the ownCloud Maintainers. - Pin all actions to their full commit SHA (not tags):
uses: actions/checkout@<SHA> # vX.Y.Z - Never introduce actions from unverified third parties.
- Dependabot is configured for automated dependency updates.
- Review and merge Dependabot PRs as part of regular maintenance.
- Do not introduce new dependencies without discussion in an issue first.
- Rebase policy: Always rebase; never create merge commits. Use
git pull --rebaseandgit rebasebefore pushing. - Signed commits: All commits must be PGP/GPG signed (
git commit -S -s). - DCO sign-off: Every commit needs a
Signed-off-byline (git commit -s). - Conventional Commits & Squash Merge: Use the Conventional Commits format where the repository enforces it. Many repos use squash merge, where the PR title becomes the commit message on the default branch — apply Conventional Commits format to PR titles as well. A reusable GitHub Actions workflow enforces this.
- This is an ownCloud Server app (the Classic product line), not an oCIS extension.
- The PHP backend implements the WOPI host side of the protocol; Collabora Online is the WOPI client.
- WOPI access tokens live in the app's own
richdocuments_wopitable (created byappinfo/Migrations/) and are cleaned up by theCleanupExpiredWopiTokensbackground job - be careful with their lifetime and validation when touchinglib/Controller/WopiController.php. - Secure View (watermarking, restricted download) is gated behind an enterprise license via
ILicenseManager, seeAppConfig::enterpriseFeaturesEnabled(). Its acceptance coverage lives intests/acceptance/features/webUISecureView/, which is the only acceptance suite in this repo -make test-acceptance-apiexists but has no features to run here. - Runtime configuration is done via
occ config:app:set richdocuments <key> --value <value>; seelib/AppConfig.phpfor the supported keys. - Match existing code style, keep PRs focused, and do not refactor unrelated code in the same PR.
- Write tests for new functionality.