Skip to content

feat(repo-providers): initial code.storage backend support for clone/push#39

Open
figitaki wants to merge 2 commits intomainfrom
feat/codestorage-provider
Open

feat(repo-providers): initial code.storage backend support for clone/push#39
figitaki wants to merge 2 commits intomainfrom
feat/codestorage-provider

Conversation

@figitaki
Copy link
Copy Markdown
Collaborator

@figitaki figitaki commented Mar 15, 2026

Summary

Adds a minimal code.storage repo provider implementation to unblock clone/push under the new RepoProvider architecture introduced in #38.

Included (backend-first)

  • New package: @valet/plugin-codestorage exporting codestorageRepoProvider
  • Provider registration so Worker can resolve *.code.storage URLs
  • Token pass-through minting for API key/JWT style credentials
  • Session env assembly for git runtime, including normalized clone URL and t@ username form for code.storage Git-over-HTTPS
  • Conservative validateRepo and listRepos behavior:
    • works in clone/push bootstrap mode without requiring API base config
    • uses apiBase/issuer metadata if configured for richer validation/listing

Intentionally deferred

  • Provider-specific install/setup callbacks (GitHub-only flow remains unchanged)
  • UI parity in repo/provider settings
  • Provider-specific PR/MR/issue tooling and action surface
  • Full code.storage API schema alignment for list/search pagination edge cases

Notes

This is intentionally narrow and backend-focused to keep risk low and unblock runtime git operations first.

Copy link
Copy Markdown
Owner

@yourbuddyconner yourbuddyconner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall clean and well-scoped. The bootstrap mode approach is pragmatic. A few items inline.

import { githubRepoProvider as rp0 } from '@valet/plugin-github/repo';
import { codestorageRepoProvider as rp0 } from '@valet/plugin-codestorage/repo';
import { githubRepoProvider as rp1 } from '@valet/plugin-github/repo';

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is marked AUTO-GENERATED by scripts/generate-plugin-registry.ts — do not edit. Should be regenerated via make generate-registries rather than hand-edited. The change is correct, but editing auto-generated files directly is fragile and sets a bad precedent.

"./repo": "./src/repo.ts"
},
"scripts": {
"build": "tsc",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tsconfig.json in this package. "build": "tsc" and "typecheck": "tsc --noEmit" will fail or pick up the root config unexpectedly. Every other code plugin has one — needs a tsconfig.json extending the root config, plus references in root tsconfig.json and packages/worker/tsconfig.json.


async assembleSessionEnv(_credential: RepoCredential, opts) {
const parsed = parseCodeStorageRepoUrl(opts.repoUrl);
if (!parsed) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assembleSessionEnv returns a t@ clone URL but doesn't set up a credential helper or GIT_ASKPASS to feed the minted token to git. The GitHub provider does the same, so I assume there's a session-layer mechanism that handles this — but a comment pointing to where/how that happens would help future readers.


const apiBase = parseApiBase(credential);
const token = asToken(credential);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In bootstrap mode (no apiBase), this returns accessible: true based purely on URL syntax + token existence. A typo'd URL or revoked token will pass validation and only fail at clone time. Worth adding a code comment explaining why this is acceptable so future readers don't "fix" it.

Comment thread packages/plugin-codestorage/src/repo.ts Outdated
- Add missing tsconfig.json and wire references in root + worker tsconfigs
- Regenerate plugin registries instead of hand-editing auto-generated file
- Add comments explaining bootstrap-mode validation tradeoffs
- Add comments explaining credential helper flow (Runner git-setup.ts)
- Remove redundant .git strip in parseCodeStorageRepoUrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants