Code repositories
Create a repository connector for GitHub, GitLab, Bitbucket, a local checkout, or an archive, test that the source is reachable, and browse its files to feed repository intelligence.
By the end of this page you will have a saved repository connector that reaches your source code, a confirmed reachability test, and a browse listing of the files and directories it exposes — ready to feed repository intelligence. Algenta supports five repository source types through one connector API: github_repo, gitlab_repo, bitbucket_repo, local_repo, and repo_archive.
Prerequisites: an API key and a base URL (see Authentication), and access to the source — a clone URL (with a token for private repositories), a filesystem path, or an archive path. Use https://api.algenta.ai for Algenta cloud, or your own origin such as http://localhost:8000 for a self-hosted deployment.
Set your credentials
Export your API key and base URL so every command below picks them up from the environment. For a private hosted repository, keep the access token in its own variable so it never appears in shell history inline.
export ALGENTA_API_KEY="$ALGENTA_API_KEY"
export ALGENTA_BASE_URL="https://api.algenta.ai"
export GITHUB_TOKEN="$GITHUB_TOKEN"Verify the variables are set:
echo "${ALGENTA_API_KEY:?set ALGENTA_API_KEY}" >/dev/null && echo "key present"
echo "$ALGENTA_BASE_URL"Expected result: key present and your base URL print without error. A token is only needed for private repositories.
Confirm the engine accepts repository types
Ask the engine which connector types it supports and confirm your repository type is in the list.
curl -s "$ALGENTA_BASE_URL/v1/connectors/types" \
-H "Authorization: Bearer $ALGENTA_API_KEY"Expected result: a JSON object with a types array that includes the repository types, for example {"types": ["github_repo", "gitlab_repo", "bitbucket_repo", "local_repo", "repo_archive", ...]}. If your type is present, the next step's config shape is accepted.
Create the repository connector
POST /v1/connectors stores the connector and returns it with status: "untested". Pick the tab that matches where your code lives.
Use type github_repo with an http(s) repository_url. For a private repository, add an access_token — the engine uses it as the x-access-token clone credential.
curl -s -X POST "$ALGENTA_BASE_URL/v1/connectors" \
-H "Authorization: Bearer $ALGENTA_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"payments-service\",
\"connector_type\": \"github_repo\",
\"config\": {
\"repository_url\": \"https://github.com/acme/payments-service.git\",
\"access_token\": \"$GITHUB_TOKEN\"
}
}"Use type gitlab_repo with an http(s) repository_url. For a private project, add an access_token — the engine uses it as the oauth2 clone credential.
curl -s -X POST "$ALGENTA_BASE_URL/v1/connectors" \
-H "Authorization: Bearer $ALGENTA_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"billing-lib\",
\"connector_type\": \"gitlab_repo\",
\"config\": {
\"repository_url\": \"https://gitlab.com/acme/billing-lib.git\",
\"access_token\": \"$GITLAB_TOKEN\"
}
}"Use type bitbucket_repo with an http(s) repository_url. For a private repository, add an access_token — the engine uses it as the x-token-auth clone credential.
Use type local_repo with a path to a checkout the engine can read. A git working tree lets the engine resolve a revision; a plain directory is read as-is.
Use type repo_archive with a path to a .tar, .tar.gz, or .zip archive. The engine extracts it and reads the contents.
Capture the returned id for the steps that follow:
export CONNECTOR_ID="$CONNECTOR_ID"Expected result: a 201 response with the connector id, your connector_type, and "status": "untested". Any access_token is encrypted at rest — the connector object never returns your config back to you.
Test that the source is reachable
POST /v1/connectors/{id}/test resolves the source for real — it shallow-clones a hosted repository, opens a local checkout, or extracts an archive — and reports the source and how many entries it found. On success the connector flips to live; on failure it flips to error.
curl -s -X POST "$ALGENTA_BASE_URL/v1/connectors/$CONNECTOR_ID/test" \
-H "Authorization: Bearer $ALGENTA_API_KEY"Expected result: {"success": true, "status": "live", "message": "Repository source reachable: https://github.com/acme/payments-service.git (4213 entries)."}, and the connector's stored status is now live. On failure, success is false; error_type (for example auth, not_found, or permission) plus recoverable tell you what to fix.
Browse the repository entries
GET /v1/connectors/{id}/browse lists the files and directories at the top of the source (up to 100 entries), so you can confirm the right code is reachable. This returns 409 not_connected if the connector is not live — run the test step first.
curl -s "$ALGENTA_BASE_URL/v1/connectors/$CONNECTOR_ID/browse" \
-H "Authorization: Bearer $ALGENTA_API_KEY"Expected result: a response whose items array holds repository entries (each with id, label, a kind of file or directory, a selection of {"path": "<relative path>"}, and — for files — a detected language and size), a total, and a message such as Found 42 repository entries.
Expected result
Other ways to connect
The same endpoints back the de CLI and the Python SDK — all three hit the identical API.
de connectors create connector.json # POST /v1/connectors from a JSON body
de connectors test $CONNECTOR_ID # resolve and reach the source
de connectors browse $CONNECTOR_ID # list the repository entriesimport os
from decision_engine import AlgentaClient
client = AlgentaClient(
api_key=os.environ["ALGENTA_API_KEY"],
base_url="https://api.algenta.ai",
)
connector = client.create_connector(
name="payments-service",
connector_type="github_repo",
config={
"repository_url": "https://github.com/acme/payments-service.git",
"access_token": os.environ["GITHUB_TOKEN"],
},
)
test = client.test_connector(connector.id)
assert test.success, test.message
browse = client.browse_connector(connector.id)
print(browse.total, "repository entries")Troubleshooting
Next
Triage a repositoryConnectors overviewConnectors referenceLast updated
Was this helpful?