{"owner":"mifi","repo":"lossless-cut","hasSkills":true,"totalSkillsCount":1,"totalTokensCount":692,"categories":["project-spec"],"hasMcp":false,"mcpConfig":null,"found":["docs/api.md"],"skills":{"docs/api.md":"# HTTP API 🧪\n\nLosslessCut can be controlled via a HTTP API, if it is being run with the command line option `--http-api`. **Note that the HTTP API is experimental and may change at any time.**\n\nSee also [CLI](cli.md).\n\n## Enabling the API\n\nTo enable the API, run LosslessCut from the command line with this flag:\n\n```bash\nLosslessCut --http-api\n```\n\n## Security\n\nThe server listens on `127.0.0.1` only, so it cannot be reached from other computers. It has no authentication, so any program running on your computer can control LosslessCut while the API is enabled.\n\nRequests coming from a web browser are rejected with `403`, because a web page you visit must not be able to control LosslessCut. This means requests must have a `Host` header of `localhost`/`127.0.0.1` (this prevents [DNS rebinding](https://en.wikipedia.org/wiki/DNS_rebinding)) and must not have an `Origin` header (which browsers always send, but command line tools don't).\n\n## Action endpoint: `POST /api/action/:action`\n\nExecute a keyboard shortcut `action`, similar to the `--keyboard-action` CLI option. This is different from the CLI in that most of the actions (but not all) will wait for the action to finish before responding to the HTTP request.\n\nSee [Available keyboard actions](cli.md#available-keyboard-actions).\n\n### Example actions\n\nExport the currently opened file:\n```bash\ncurl -X POST http://localhost:8080/api/action/export\n```\n\nSeek to time:\n```bash\ncurl -X POST http://localhost:8080/api/action/goToTimecodeDirect --json '{\"time\": \"09:11\"}'\n```\n\nOpen one or more files:\n```bash\ncurl -X POST http://localhost:8080/api/action/openFiles --json '[\"/path/to/file.mp4\"]'\n```\n\n### Batch example\n\nStart the main LosslessCut in one terminal with the HTTP API enabled:\n\n```bash\nLosslessCut --http-api\n```\n\nThen run the script in a different terminal:\n\n```bash\nfor PROJECT in /path/to/folder/with/projects/*.llc\n    LosslessCut $PROJECT\n    sleep 5 # wait for the file to open\n    curl -X POST http://localhost:8080/api/action/export\n    curl -X POST http://localhost:8080/api/action/closeCurrentFile\ndone\n```\n\n## Await event endpoint\n\nThis special endpoint allows you to wait for a certain event to occur in the app. The endpoint will hang and respond/return only when the event fires. Below are supported events.\n\n### Event: `export-start`\n\nEmitted when the export operation starts. The endpoint will return JSON `{ path: string }`.\n\n### Event: `export-complete`\n\nEmitted when the export operation completes (either success or failure). If successful, the endpoint will return JSON `{ paths: string[] }`.\n\n#### Examples\n\nRun a command after each file that has completed exporting:\n```bash\nwhile true; do\n  echo 'Do something with exported file path:' $(curl -s -X POST http://localhost:8080/api/await-event/export-complete | jq -r '.paths[0]')\ndone\n```\n"},"files":{"docs/api.md":"# HTTP API 🧪\n\nLosslessCut can be controlled via a HTTP API, if it is being run with the command line option `--http-api`. **Note that the HTTP API is experimental and may change at any time.**\n\nSee also [CLI](cli.md).\n\n## Enabling the API\n\nTo enable the API, run LosslessCut from the command line with this flag:\n\n```bash\nLosslessCut --http-api\n```\n\n## Security\n\nThe server listens on `127.0.0.1` only, so it cannot be reached from other computers. It has no authentication, so any program running on your computer can control LosslessCut while the API is enabled.\n\nRequests coming from a web browser are rejected with `403`, because a web page you visit must not be able to control LosslessCut. This means requests must have a `Host` header of `localhost`/`127.0.0.1` (this prevents [DNS rebinding](https://en.wikipedia.org/wiki/DNS_rebinding)) and must not have an `Origin` header (which browsers always send, but command line tools don't).\n\n## Action endpoint: `POST /api/action/:action`\n\nExecute a keyboard shortcut `action`, similar to the `--keyboard-action` CLI option. This is different from the CLI in that most of the actions (but not all) will wait for the action to finish before responding to the HTTP request.\n\nSee [Available keyboard actions](cli.md#available-keyboard-actions).\n\n### Example actions\n\nExport the currently opened file:\n```bash\ncurl -X POST http://localhost:8080/api/action/export\n```\n\nSeek to time:\n```bash\ncurl -X POST http://localhost:8080/api/action/goToTimecodeDirect --json '{\"time\": \"09:11\"}'\n```\n\nOpen one or more files:\n```bash\ncurl -X POST http://localhost:8080/api/action/openFiles --json '[\"/path/to/file.mp4\"]'\n```\n\n### Batch example\n\nStart the main LosslessCut in one terminal with the HTTP API enabled:\n\n```bash\nLosslessCut --http-api\n```\n\nThen run the script in a different terminal:\n\n```bash\nfor PROJECT in /path/to/folder/with/projects/*.llc\n    LosslessCut $PROJECT\n    sleep 5 # wait for the file to open\n    curl -X POST http://localhost:8080/api/action/export\n    curl -X POST http://localhost:8080/api/action/closeCurrentFile\ndone\n```\n\n## Await event endpoint\n\nThis special endpoint allows you to wait for a certain event to occur in the app. The endpoint will hang and respond/return only when the event fires. Below are supported events.\n\n### Event: `export-start`\n\nEmitted when the export operation starts. The endpoint will return JSON `{ path: string }`.\n\n### Event: `export-complete`\n\nEmitted when the export operation completes (either success or failure). If successful, the endpoint will return JSON `{ paths: string[] }`.\n\n#### Examples\n\nRun a command after each file that has completed exporting:\n```bash\nwhile true; do\n  echo 'Do something with exported file path:' $(curl -s -X POST http://localhost:8080/api/await-event/export-complete | jq -r '.paths[0]')\ndone\n```\n"},"items":[{"name":"api.md","path":"docs/api.md","rawUrl":"https://raw.githubusercontent.com/mifi/lossless-cut/HEAD/docs/api.md","title":"docs - API Interface Contract & Specifications","category":"project-spec","format":"markdown","content":"# HTTP API 🧪\n\nLosslessCut can be controlled via a HTTP API, if it is being run with the command line option `--http-api`. **Note that the HTTP API is experimental and may change at any time.**\n\nSee also [CLI](cli.md).\n\n## Enabling the API\n\nTo enable the API, run LosslessCut from the command line with this flag:\n\n```bash\nLosslessCut --http-api\n```\n\n## Security\n\nThe server listens on `127.0.0.1` only, so it cannot be reached from other computers. It has no authentication, so any program running on your computer can control LosslessCut while the API is enabled.\n\nRequests coming from a web browser are rejected with `403`, because a web page you visit must not be able to control LosslessCut. This means requests must have a `Host` header of `localhost`/`127.0.0.1` (this prevents [DNS rebinding](https://en.wikipedia.org/wiki/DNS_rebinding)) and must not have an `Origin` header (which browsers always send, but command line tools don't).\n\n## Action endpoint: `POST /api/action/:action`\n\nExecute a keyboard shortcut `action`, similar to the `--keyboard-action` CLI option. This is different from the CLI in that most of the actions (but not all) will wait for the action to finish before responding to the HTTP request.\n\nSee [Available keyboard actions](cli.md#available-keyboard-actions).\n\n### Example actions\n\nExport the currently opened file:\n```bash\ncurl -X POST http://localhost:8080/api/action/export\n```\n\nSeek to time:\n```bash\ncurl -X POST http://localhost:8080/api/action/goToTimecodeDirect --json '{\"time\": \"09:11\"}'\n```\n\nOpen one or more files:\n```bash\ncurl -X POST http://localhost:8080/api/action/openFiles --json '[\"/path/to/file.mp4\"]'\n```\n\n### Batch example\n\nStart the main LosslessCut in one terminal with the HTTP API enabled:\n\n```bash\nLosslessCut --http-api\n```\n\nThen run the script in a different terminal:\n\n```bash\nfor PROJECT in /path/to/folder/with/projects/*.llc\n    LosslessCut $PROJECT\n    sleep 5 # wait for the file to open\n    curl -X POST http://localhost:8080/api/action/export\n    curl -X POST http://localhost:8080/api/action/closeCurrentFile\ndone\n```\n\n## Await event endpoint\n\nThis special endpoint allows you to wait for a certain event to occur in the app. The endpoint will hang and respond/return only when the event fires. Below are supported events.\n\n### Event: `export-start`\n\nEmitted when the export operation starts. The endpoint will return JSON `{ path: string }`.\n\n### Event: `export-complete`\n\nEmitted when the export operation completes (either success or failure). If successful, the endpoint will return JSON `{ paths: string[] }`.\n\n#### Examples\n\nRun a command after each file that has completed exporting:\n```bash\nwhile true; do\n  echo 'Do something with exported file path:' $(curl -s -X POST http://localhost:8080/api/await-event/export-complete | jq -r '.paths[0]')\ndone\n```\n","isInternal":false,"tokens":692,"sizeBytes":2836}],"systemPromptSnippet":"<yakaai_skills repo=\"mifi/lossless-cut\">\n<!-- File: docs/api.md (Tokens: ~692 | Category: project-spec) -->\n# HTTP API 🧪\n\nLosslessCut can be controlled via a HTTP API, if it is being run with the command line option `--http-api`. **Note that the HTTP API is experimental and may change at any time.**\n\nSee also [CLI](cli.md).\n\n## Enabling the API\n\nTo enable the API, run LosslessCut from the command line with this flag:\n\n```bash\nLosslessCut --http-api\n```\n\n## Security\n\nThe server listens on `127.0.0.1` only, so it cannot be reached from other computers. It has no authentication, so any program running on your computer can control LosslessCut while the API is enabled.\n\nRequests coming from a web browser are rejected with `403`, because a web page you visit must not be able to control LosslessCut. This means requests must have a `Host` header of `localhost`/`127.0.0.1` (this prevents [DNS rebinding](https://en.wikipedia.org/wiki/DNS_rebinding)) and must not have an `Origin` header (which browsers always send, but command line tools don't).\n\n## Action endpoint: `POST /api/action/:action`\n\nExecute a keyboard shortcut `action`, similar to the `--keyboard-action` CLI option. This is different from the CLI in that most of the actions (but not all) will wait for the action to finish before responding to the HTTP request.\n\nSee [Available keyboard actions](cli.md#available-keyboard-actions).\n\n### Example actions\n\nExport the currently opened file:\n```bash\ncurl -X POST http://localhost:8080/api/action/export\n```\n\nSeek to time:\n```bash\ncurl -X POST http://localhost:8080/api/action/goToTimecodeDirect --json '{\"time\": \"09:11\"}'\n```\n\nOpen one or more files:\n```bash\ncurl -X POST http://localhost:8080/api/action/openFiles --json '[\"/path/to/file.mp4\"]'\n```\n\n### Batch example\n\nStart the main LosslessCut in one terminal with the HTTP API enabled:\n\n```bash\nLosslessCut --http-api\n```\n\nThen run the script in a different terminal:\n\n```bash\nfor PROJECT in /path/to/folder/with/projects/*.llc\n    LosslessCut $PROJECT\n    sleep 5 # wait for the file to open\n    curl -X POST http://localhost:8080/api/action/export\n    curl -X POST http://localhost:8080/api/action/closeCurrentFile\ndone\n```\n\n## Await event endpoint\n\nThis special endpoint allows you to wait for a certain event to occur in the app. The endpoint will hang and respond/return only when the event fires. Below are supported events.\n\n### Event: `export-start`\n\nEmitted when the export operation starts. The endpoint will return JSON `{ path: string }`.\n\n### Event: `export-complete`\n\nEmitted when the export operation completes (either success or failure). If successful, the endpoint will return JSON `{ paths: string[] }`.\n\n#### Examples\n\nRun a command after each file that has completed exporting:\n```bash\nwhile true; do\n  echo 'Do something with exported file path:' $(curl -s -X POST http://localhost:8080/api/await-event/export-complete | jq -r '.paths[0]')\ndone\n```\n</yakaai_skills>"}