Infra for AI Code Assistants
Work with codebases.
Authenticate GitHub users.
Clone repos, make commits, create PRs.
Run tasks with custom code.
Use Node.js library
import Reptoid from '@reptoid/codebases'
const reptoid = new Reptoid({ accessToken: '<YOUR_TOKEN>' })
Sync your users with Reptoid accounts
Each account will have access to one of your users' GitHub account.
Accounts can operate with codebases and synchronize them with GitHub.
Create manually
const { accountId } = await.reptoid.accounts().create()
await reptoid
    .accountId(accountId)
    .github()
    .setAccessToken(accessToken)
Auth with GitHub inside callback
const {
    accountId,
    email,
    githubLogin,
    accessToken,
} = await reptoid.github().authByCode(code)
Manage workspaces
Workspace is a folder with files and connected GitHub repo.
Create empty workspace
const { workspaceId } = await reptoid
    .account(accountId)
    .workspaces()
    .create()
Clone from GitHub
const { workspaceId } = await reptoid
    .account(accountId)
    .github()
    .clone('xreptoid/viperfish')
Manage files
NFS
Mount a remote disk directly on your instance and work with workspaces as if it were local files.
echo $YOUR_KERBEROS_TOKEN | kinit $YOUR_USERAME@reptoid.com

mount \
    -t nfs4 \
    -o sec=krb5p,timeo=600 \
    nfs.reptoid.com:/w/$WORKSPACE_ID \
    ~/workspace

echo 'Hello, world!' > ~/workspace/test.txt
API
// write
await reptoid
    .account(accountId)
    .workspace(workspaceId)
    .files('/test.txt')
    .write('Hello, world!')

// read
const content = await reptoid
    .account(accountId)
    .workspace(workspaceId)
    .files('/test.txt')
    .read()
Git/GitHub
Perform Git/GitHub commands without thinking about auth.
// create new repo & set origin
await reptoid
    .account(accountId)
    .github()
    .create('your-org/test-repo')
await reptoid
    .account(accountId)
    .workspace(workspaceId)
    .github()
    .setOrigin('your-org/test-repo')

// commit & push
await reptoid.account(accountId).workspace(workspaceId).addAll()
await reptoid.account(accountId).workspace(workspaceId).commit({ message: 'Test commit' })
await reptoid.account(accountId).workspace(workspaceId).push()