feat: add Amara plugin - #648
Conversation
|
@GarvChopra is attempting to deploy a commit to the corsair Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR adds a complete Amara provider package. It includes typed API contracts, authenticated endpoint handlers, schema validation, retry policies, Corsair plugin wiring, provider registration, package configuration, and API contract tests. ChangesAmara provider integration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR replaces the Amara scaffold with a real API-key-authenticated integration.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Corsair consumer
participant Plugin as Amara endpoint
participant Client as makeAmaraRequest
participant API as amara.org/api
App->>Plugin: Invoke typed endpoint
Plugin->>Client: Path, API key, query/body
Client->>API: HTTP request with X-api-key
API-->>Client: Amara response
Client-->>Plugin: Raw response
Plugin->>Plugin: Validate output with Zod
Plugin-->>App: Typed result
Reviews (4): Last reviewed commit: "fix(amara): cover all handlers and tight..." | Re-trigger Greptile |
Plugin PR scorecard —
|
| Check | Status | Notes |
|---|---|---|
| R1 — Scope: plugin files only | ✅ | |
| R2 — Tests with assertions | ✅ | |
| R3 — Description complete | ✅ | |
| R3 — Linked issue / claim | No "Fixes #…" or claim link — add one if this PR has a claim or issue | |
| R4 — Demo video / recording | ✅ |
Rules: PLUGIN_PR_RULES.md · re-runs on every push
|
Hey @GarvChopra, thanks for the contribution! 🏴☠️ Before a maintainer reviews, please fix the items below — the review re-runs automatically on your next push. Must fix
Knowledge Base Used: The provider-plugin package pattern
Rule Used: Flag boilerplate residue from the plugin generator... (source) Knowledge Base Used: The provider-plugin package pattern
Rule Used: Plugin packages must include at least one *.test.t... (source) Knowledge Base Used: The provider-plugin package pattern Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! PR requirements (rules)
If anything remains after your next push, a bot commit will clean it up; a maintainer always does the final review and merge. |
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/amara/client.ts`:
- Around line 55-60: Update the catch logic in makeAmaraRequest to detect
ApiError before the generic Error handling and rethrow it unchanged, preserving
retryAfter and other API metadata for RATE_LIMIT_ERROR.handler. Keep wrapping
non-ApiError instances in AmaraAPIError with their existing message or the
Unknown error fallback.
- Around line 15-16: Update packages/amara/client.ts lines 15-16 to set
AMARA_API_BASE to https://amara.org/api/ and use Amara’s documented
authentication headers; update the callback matcher in packages/amara/index.ts
lines 152-155 to use a supported callback identifier instead of
x-amara-signature, and add outbound and inbound integration tests covering these
behaviors.
In `@packages/amara/jest.config.cjs`:
- Line 2: Remove the preset: 'ts-jest' entry from the Jest configuration while
retaining the existing custom transform map, so the configuration uses only one
transform strategy.
- Around line 35-44: Update the JavaScript transformer rule in the Jest
configuration so ts-jest receives allowJs: true in its tsconfig, or remove the
.*\\.js$ transform and corresponding uuid exception if JavaScript transformation
is unnecessary. Keep the existing ESM and interop settings intact.
In `@packages/amara/package.json`:
- Line 5: Update the package test script in package.json to invoke Jest with
Node’s --experimental-vm-modules flag, or reuse a workspace-level NODE_OPTIONS
configuration that sets it before Jest runs. Ensure the existing test command
remains otherwise unchanged and ESM tests execute under Jest 29.
- Around line 9-15: Update the package exports configuration so the published
package’s "." entry does not reference the absent ./index.ts: either remove the
workspace-only "dev-source" export or include index.ts and all required source
files in the package files list. Ensure npm pack --dry-run confirms the chosen
published-interface behavior.
- Around line 25-32: Declare `@types/node` in the devDependencies of the package
manifest using the repository’s version catalog, since
packages/amara/tsconfig.json requests Node typings. Keep the plugin
self-contained and do not rely on workspace-hoisted dependencies; only remove
"node" from compilerOptions.types if Node typings are not required.
In `@packages/amara/webhooks/tenant-matcher.ts`:
- Around line 17-24: Update tenant matching in tenant-matcher.ts around the
externalId extraction to use Amara’s documented team or primary_team identifier
and team slug fields instead of tenant_external_id. In oauth-tenant-link.ts,
remove the unsupported access_token or /me fallback and use only the enterprise
OAuth integration contract; apply the corresponding change to the sibling site
as needed.
In `@packages/amara/webhooks/types.ts`:
- Around line 52-58: Implement verifyAmaraWebhookSignature to read the
documented Amara signing header, validate the expected signature and payload
format, compute the corresponding HMAC, and compare signatures using a
timing-safe comparison. Return valid: false with an error whenever the header is
missing, malformed, or does not match; only return valid: true for a verified
request.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c9709fd-8da0-43b2-9dd6-72ece5d92c6b
📒 Files selected for processing (19)
packages/amara/client.tspackages/amara/endpoints/example.tspackages/amara/endpoints/index.tspackages/amara/endpoints/types.tspackages/amara/error-handlers.tspackages/amara/index.tspackages/amara/jest.config.cjspackages/amara/package.jsonpackages/amara/schema.test.tspackages/amara/schema/database.tspackages/amara/schema/index.tspackages/amara/tsconfig.jsonpackages/amara/tsup.config.tspackages/amara/webhooks/example.tspackages/amara/webhooks/index.tspackages/amara/webhooks/oauth-tenant-link.tspackages/amara/webhooks/tenant-matcher.tspackages/amara/webhooks/types.tspackages/corsair/core/constants.ts
| @@ -0,0 +1,55 @@ | |||
| module.exports = { | |||
| preset: 'ts-jest', | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Remove the ts-jest preset when supplying a custom transform.
This configuration sets preset: 'ts-jest' and then replaces the transform map. The ts-jest documentation warns that combining a preset with a custom transform can cause Jest to transform files incorrectly. Remove the preset or build the transform map from the selected preset. (kulshekhar.github.io)
Verification
#!/usr/bin/env bash
set -euo pipefail
rg -n 'preset|transform' packages/amara/jest.config.cjsUse one transform configuration strategy.
Also applies to: 20-34
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/jest.config.cjs` at line 2, Remove the preset: 'ts-jest' entry
from the Jest configuration while retaining the existing custom transform map,
so the configuration uses only one transform strategy.
| '.*\\.js$': [ | ||
| 'ts-jest', | ||
| { | ||
| useESM: true, | ||
| tsconfig: { | ||
| esModuleInterop: true, | ||
| allowSyntheticDefaultImports: true, | ||
| }, | ||
| }, | ||
| ], |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not send JavaScript files through ts-jest without enabling allowJs.
The .*\\.js$ rule sends JavaScript files to ts-jest, and the uuid exception allows matching dependency files to reach that rule. The TypeScript configuration does not set allowJs: true. ts-jest requires allowJs for its JavaScript-with-TypeScript/ESM transforms. (kulshekhar.github.io)
Enable allowJs for this transformer, or remove the JavaScript transform and its dependency exception if they are not required.
Verification
#!/usr/bin/env bash
set -euo pipefail
rg -n 'allowJs|\\.js\\$|transformIgnorePatterns' \
packages/amara/jest.config.cjs \
packages/amara/tsconfig.jsonAlso applies to: 51-51
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/jest.config.cjs` around lines 35 - 44, Update the JavaScript
transformer rule in the Jest configuration so ts-jest receives allowJs: true in
its tsconfig, or remove the .*\\.js$ transform and corresponding uuid exception
if JavaScript transformation is unnecessary. Keep the existing ESM and interop
settings intact.
| "name": "@corsair-dev/amara", | ||
| "version": "0.1.0", | ||
| "description": "Amara plugin for Corsair", | ||
| "type": "module", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Enable the Node ESM runtime for the package test command.
The package uses ESM and the Jest configuration emits ESM. The script still runs plain jest. Jest 29 requires Node's --experimental-vm-modules flag for ESM execution. Add the flag or verify that the workspace sets NODE_OPTIONS before invoking this script. (jestjs.io)
Possible fix
- "test": "jest"
+ "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js"Verification
#!/usr/bin/env bash
set -euo pipefail
rg -n 'experimental-vm-modules|NODE_OPTIONS|"test"[[:space:]]*:' \
--glob '**/package.json' \
--glob '**/*.yml' \
--glob '**/*.yaml' \
.Also applies to: 19-19
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/package.json` at line 5, Update the package test script in
package.json to invoke Jest with Node’s --experimental-vm-modules flag, or reuse
a workspace-level NODE_OPTIONS configuration that sets it before Jest runs.
Ensure the existing test command remains otherwise unchanged and ESM tests
execute under Jest 29.
| "exports": { | ||
| ".": { | ||
| "dev-source": "./index.ts", | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the dev-source export valid in the packed package.
exports["."]."dev-source" targets ./index.ts, but files includes only dist. npm includes only the selected files when packing, so the published package does not contain that target. (docs.npmjs.com)
If dev-source is workspace-only, remove it from the published export map or verify that release tooling strips it. Otherwise include the source entry and its required files.
Verification
#!/usr/bin/env bash
set -euo pipefail
npm pack --dry-run --ignore-scripts --json packages/amara |
jq -e '.[0].files[] | select(.path == "index.ts")'The command should find index.ts if dev-source is part of the published interface.
Also applies to: 41-43
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/package.json` around lines 9 - 15, Update the package exports
configuration so the published package’s "." entry does not reference the absent
./index.ts: either remove the workspace-only "dev-source" export or include
index.ts and all required source files in the package files list. Ensure npm
pack --dry-run confirms the chosen published-interface behavior.
| export function verifyAmaraWebhookSignature( | ||
| request: WebhookRequest<AmaraWebhookPayload>, | ||
| secret: string, | ||
| ): { valid: boolean; error?: string } { | ||
| // TODO: Implement webhook signature verification | ||
| return { valid: true }; | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
Implement signature verification before registering this webhook.
This function returns valid: true for every request. An attacker can submit a forged webhook if the caller uses this result as the authentication gate.
Verify the documented Amara signing header and payload format. Compute and compare the signature with a timing-safe comparison. Fail closed when the signature is missing, malformed, or invalid.
#!/bin/bash
set -euo pipefail
rg -n -C 5 'verifyAmaraWebhookSignature|signature|WebhookRequest' packages/amara packages/corsair🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/webhooks/types.ts` around lines 52 - 58, Implement
verifyAmaraWebhookSignature to read the documented Amara signing header,
validate the expected signature and payload format, compute the corresponding
HMAC, and compare signatures using a timing-safe comparison. Return valid: false
with an error whenever the header is missing, malformed, or does not match; only
return valid: true for a verified request.
|
@greptile review |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
packages/amara/endpoints/videos.ts (1)
71-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the no-op destructure.
const { ...body } = input;copies every property and creates no new binding semantics. Useinputdirectly.♻️ Proposed change
export const create: AmaraEndpoints['videosCreate'] = async (ctx, input) => { - const { ...body } = input; const raw = await makeAmaraRequest('videos/', ctx.key, { method: 'POST', - body, + body: input, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/amara/endpoints/videos.ts` around lines 71 - 76, Remove the no-op rest destructuring in create and pass input directly as the request body to makeAmaraRequest, preserving the existing POST behavior.packages/amara/client.test.ts (1)
95-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGuarantee that the catch block runs.
If
makeAmaraRequestresolves, the assertions in the catch block never run and the test still passes. The second test in this file uses an explicit guard. Use the same pattern here, or addexpect.assertions(4).♻️ Proposed change
try { await makeAmaraRequest('videos/', 'k'); + throw new Error('expected makeAmaraRequest to throw'); } catch (error) { const amaraError = error as AmaraAPIError;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/amara/client.test.ts` around lines 95 - 112, Add an assertion guard to the test for makeAmaraRequest, using expect.assertions(4) or the explicit failure pattern already used by the neighboring test, so the catch block's four property assertions must execute when verifying the wrapped AmaraAPIError.packages/amara/api.test.ts (2)
178-196: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDelete the created video, or drop the live write test.
This test performs a non-idempotent write against the real Amara account. When creation succeeds, the video stays in the account. Repeated runs accumulate records. Add a cleanup step that deletes the created video in a
finallyblock, or restrict the write path to the mocked client tests.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/amara/api.test.ts` around lines 178 - 196, The live videos.create test leaves successful creations in the Amara account; either remove this live write test or add cleanup in a finally block that deletes the created video using its returned id, while preserving the existing error assertion.
15-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSet an explicit timeout for the live suite.
Every test in this suite performs at least one network call, and some perform three. The Jest default timeout is 5000 ms. Pass a timeout to each
it, or calljest.setTimeoutfor the file, so a slow Amara response does not produce a false failure.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/amara/api.test.ts` around lines 15 - 16, Set an explicit Jest timeout for the entire test file, preferably near the test setup, using jest.setTimeout with a duration appropriate for the network-backed tests. Ensure all tests in the suite, including those making multiple Amara requests, use this extended timeout without changing their assertions.packages/amara/error-handlers.ts (1)
21-94: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winApply the message heuristics only when the status is unknown.
Each matcher first checks the status, then falls back to substring checks on the message. The fallback also runs when the status is known and does not match. A message can contain a foreign number, for example a video id
4045or a body fragment"404", so a 500 error can route toNOT_FOUND_ERRORand lose its retries. Gate the message checks onstatus === undefined.♻️ Proposed change for one matcher; apply the same pattern to the others
NOT_FOUND_ERROR: { match: (error: Error) => { - if (getStatus(error) === 404) return true; + const status = getStatus(error); + if (status !== undefined) return status === 404; const msg = error.message.toLowerCase(); return msg.includes('404') || msg.includes('not found'); },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/amara/error-handlers.ts` around lines 21 - 94, Update the match functions in errorHandlers—RATE_LIMIT_ERROR, AUTH_ERROR, NOT_FOUND_ERROR, VALIDATION_ERROR, and SERVER_ERROR—so message substring heuristics run only when getStatus(error) returns undefined. Preserve direct status matching, and return false immediately for known non-matching statuses to prevent message contents from overriding the classified error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/amara/endpoints/types.test.ts`:
- Around line 14-26: Extend the test named “requires video_url and title when
creating a video” with a case containing video_url but omitting title, and
assert that AmaraEndpointInputSchemas.videosCreate.safeParse(...).success is
false. Keep the existing valid case and missing-video_url rejection unchanged.
In `@packages/amara/endpoints/users.ts`:
- Around line 16-21: Remove the raw input.identifier from the
logEventFromContext payloads in both the amara.users.getData and
amara.users.getActivity handlers, or replace it with the project’s established
hashing mechanism so persisted events never retain human-readable identifiers.
In `@packages/amara/endpoints/videos.ts`:
- Around line 265-281: Update VideosCreateSubtitleLanguageInputSchema and
createSubtitleLanguage so the request input uses and sends the required
language_code field to Amara’s languages endpoint instead of language. Add a
write-path test covering the POST body and retain the existing response parsing
and event logging behavior.
---
Nitpick comments:
In `@packages/amara/api.test.ts`:
- Around line 178-196: The live videos.create test leaves successful creations
in the Amara account; either remove this live write test or add cleanup in a
finally block that deletes the created video using its returned id, while
preserving the existing error assertion.
- Around line 15-16: Set an explicit Jest timeout for the entire test file,
preferably near the test setup, using jest.setTimeout with a duration
appropriate for the network-backed tests. Ensure all tests in the suite,
including those making multiple Amara requests, use this extended timeout
without changing their assertions.
In `@packages/amara/client.test.ts`:
- Around line 95-112: Add an assertion guard to the test for makeAmaraRequest,
using expect.assertions(4) or the explicit failure pattern already used by the
neighboring test, so the catch block's four property assertions must execute
when verifying the wrapped AmaraAPIError.
In `@packages/amara/endpoints/videos.ts`:
- Around line 71-76: Remove the no-op rest destructuring in create and pass
input directly as the request body to makeAmaraRequest, preserving the existing
POST behavior.
In `@packages/amara/error-handlers.ts`:
- Around line 21-94: Update the match functions in
errorHandlers—RATE_LIMIT_ERROR, AUTH_ERROR, NOT_FOUND_ERROR, VALIDATION_ERROR,
and SERVER_ERROR—so message substring heuristics run only when getStatus(error)
returns undefined. Preserve direct status matching, and return false immediately
for known non-matching statuses to prevent message contents from overriding the
classified error.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1a468e98-d466-4b77-a98a-d3c792d69ce0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
packages/amara/api.test.tspackages/amara/client.test.tspackages/amara/client.tspackages/amara/endpoints/activity.tspackages/amara/endpoints/index.tspackages/amara/endpoints/languages.tspackages/amara/endpoints/messages.tspackages/amara/endpoints/teams.tspackages/amara/endpoints/types.test.tspackages/amara/endpoints/types.tspackages/amara/endpoints/users.tspackages/amara/endpoints/videos.tspackages/amara/error-handlers.test.tspackages/amara/error-handlers.tspackages/amara/index.tspackages/amara/package.jsonpackages/amara/schema.test.tspackages/amara/schema/database.tspackages/amara/schema/index.tspackages/corsair/core/constants.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/corsair/core/constants.ts
- packages/amara/package.json
| export const createSubtitleLanguage: AmaraEndpoints['videosCreateSubtitleLanguage'] = | ||
| async (ctx, input) => { | ||
| const { video_id, ...body } = input; | ||
| const raw = await makeAmaraRequest( | ||
| `${videoPath(video_id)}languages/`, | ||
| ctx.key, | ||
| { method: 'POST', body }, | ||
| ); | ||
| const response = SubtitleLanguageSchema.parse(raw); | ||
| await logEventFromContext( | ||
| ctx, | ||
| 'amara.videos.createSubtitleLanguage', | ||
| { video_id }, | ||
| 'completed', | ||
| ); | ||
| return response; | ||
| }; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Amara API create subtitle language POST videos languages request body field
💡 Result:
To create a new subtitle language track for a video in the Amara API, you perform a POST request to the languages endpoint associated with the specific video [1][2]. Endpoint URL: POST https://amara.org/api/videos/(video-id)/languages/ [1][2] Request Body Fields: When creating a subtitle language, the request body should be a JSON object containing the following primary field: 1. language_code (string, required): The ISO 639-1 two-letter language code (e.g., "en", "es", "fr") for the subtitle language you wish to create [2][3][4]. Additionally, you can include the following optional field: 2. is_primary_audio_language (boolean, optional): Set to true if this language is the primary spoken language of the video; otherwise, set to false (default is false) [1][2]. Example Request Body: { "language_code": "en", "is_primary_audio_language": false } Important Considerations: - Each video can have multiple subtitle languages, but you cannot create the same language twice for the same video [3][5]. - It is recommended to use list_subtitle_languages to check for existing languages before attempting to create a new one [3][5]. - While ISO 639-1 codes are standard, other codes may be accepted by the API, though they may display as the code itself if not explicitly supported by the platform [6].
Citations:
- 1: https://amara.readthedocs.io/en/dev/api.html
- 2: https://apidocs.amara.org/
- 3: https://docs.composio.dev/toolkits/amara
- 4: https://ceven.io/docs/integrations/amara
- 5: https://type.com/integrations/amara
- 6: https://support.amara.org/support/solutions/articles/215283-languages-supported-on-amara
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- relevant files ---'
fd -i '.*' packages/amara | sed -n '1,120p'
printf '%s\n' '--- schema and endpoint references ---'
rg -n -C 8 'VideosCreateSubtitleLanguageInputSchema|videosCreateSubtitleLanguage|createSubtitleLanguage|updateSubtitleLanguage|language_code|is_primary_audio_language' packages/amaraRepository: corsairdev/corsair
Length of output: 43422
Send language_code when creating a subtitle language.
VideosCreateSubtitleLanguageInputSchema defines language, but Amara requires language_code for POST /videos/{video_id}/languages/. Update the schema and add a write-path test.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/amara/endpoints/videos.ts` around lines 265 - 281, Update
VideosCreateSubtitleLanguageInputSchema and createSubtitleLanguage so the
request input uses and sends the required language_code field to Amara’s
languages endpoint instead of language. Add a write-path test covering the POST
body and retain the existing response parsing and event logging behavior.
|
@greptile review |
|
Remaining findings are being fixed by a bot commit — it will be re-reviewed automatically. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/amara/api.test.ts`:
- Around line 196-198: Update the catch block in the team-creation test to
assert the structured HTTP 400 status and the documented “Team is required”
error explicitly, rather than matching any string containing 400 or “Bad
Request.” Preserve the finally cleanup behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 44be75d6-df15-444b-b3e1-7dba5b3ba7e0
📒 Files selected for processing (9)
packages/amara/api.test.tspackages/amara/client.test.tspackages/amara/endpoints/types.test.tspackages/amara/endpoints/types.tspackages/amara/endpoints/users.tspackages/amara/endpoints/videos.test.tspackages/amara/endpoints/videos.tspackages/amara/error-handlers.test.tspackages/amara/error-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/amara/endpoints/types.test.ts
- packages/amara/client.test.ts
- packages/amara/endpoints/users.ts
- packages/amara/endpoints/videos.ts
- packages/amara/error-handlers.ts
- packages/amara/endpoints/types.ts
|
@greptile review |
Maintainer review neededAutomated rounds are exhausted. Remaining findings:
Rule Used: Flag Knowledge Base Used: The provider-plugin package pattern Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
Description
Adds the Amara plugin (
@corsair-dev/amara) with 30 endpoints against the live Amara API (https://amara.org/api), authenticated viaX-api-key.Covers videos, subtitle languages/subtitles/notes/actions, video URLs, users, teams, activity, languages, and messages. Zod schemas match official Amara response shapes. Webhook scaffold removed (Amara has no triggers here). Includes unit + live contract tests.
Checklist
Before submitting your PR, please verify the following:
pnpm lintand all checks passpnpm typecheckand there are no TypeScript errorspnpm buildand all packages build successfullypnpm testand all tests passScreenshots / Demos (if applicable)
Additional Notes
X-api-key)AMARA_API_KEY=... pnpm --filter @corsair-dev/amara testSummary by CodeRabbit
New Features
Bug Fixes
Tests
Summary by CodeRabbit