feat: SourceResolver should query MokoGitea Manifest API for entry_point #249

Open
opened 2026-06-06 18:21:10 +00:00 by jmiller · 1 comment
Owner

Summary

SourceResolver currently uses a filesystem fallback chain (source/, src/, htdocs/) to find the source directory. MokoGitea now has a Manifest API (GET /repos/{owner}/{repo}/manifest) that returns the entry_point field from the repo's .mokogitea/manifest.xml.

The CLI tools should use this API as the primary source for entry-point resolution when running in CI (where GITEA_TOKEN / MOKOGITEA_TOKEN is available), falling back to the local filesystem check when offline.

API Endpoint

GET /api/v1/repos/{owner}/{repo}/manifest

Response includes:

{
  "entry_point": "source/",
  "platform": "joomla",
  "package_type": "package",
  "language": "PHP",
  ...
}

Proposed Changes

  1. Add SourceResolver::resolveFromApi(string $owner, string $repo, string $token, string $apiBase): ?string — calls the Manifest API and returns the entry_point value
  2. Update SourceResolver::resolve() to accept optional API params and try API first, filesystem second
  3. CLI tools that run in CI should pass the token and API base when available
  4. The pre-release workflow already has MOKOGITEA_TOKEN — pass it through to the PHP scripts

Why

The Manifest API is the single source of truth for repo metadata. Filesystem detection can be wrong (e.g., both source/ and src/ exist during a migration). The API reads the canonical .mokogitea/manifest.xml value.

## Summary `SourceResolver` currently uses a filesystem fallback chain (`source/`, `src/`, `htdocs/`) to find the source directory. MokoGitea now has a Manifest API (`GET /repos/{owner}/{repo}/manifest`) that returns the `entry_point` field from the repo's `.mokogitea/manifest.xml`. The CLI tools should use this API as the primary source for entry-point resolution when running in CI (where `GITEA_TOKEN` / `MOKOGITEA_TOKEN` is available), falling back to the local filesystem check when offline. ## API Endpoint ``` GET /api/v1/repos/{owner}/{repo}/manifest ``` Response includes: ```json { "entry_point": "source/", "platform": "joomla", "package_type": "package", "language": "PHP", ... } ``` ## Proposed Changes 1. Add `SourceResolver::resolveFromApi(string $owner, string $repo, string $token, string $apiBase): ?string` — calls the Manifest API and returns the `entry_point` value 2. Update `SourceResolver::resolve()` to accept optional API params and try API first, filesystem second 3. CLI tools that run in CI should pass the token and API base when available 4. The pre-release workflow already has `MOKOGITEA_TOKEN` — pass it through to the PHP scripts ## Why The Manifest API is the single source of truth for repo metadata. Filesystem detection can be wrong (e.g., both `source/` and `src/` exist during a migration). The API reads the canonical `.mokogitea/manifest.xml` value.
Author
Owner

Branch created: feature/249-feat-sourceresolver-should-query-mokogit

git fetch origin
git checkout feature/249-feat-sourceresolver-should-query-mokogit
Branch created: [`feature/249-feat-sourceresolver-should-query-mokogit`](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/src/branch/feature/249-feat-sourceresolver-should-query-mokogit) ```bash git fetch origin git checkout feature/249-feat-sourceresolver-should-query-mokogit ```
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/mokoplatform#249