{"id":27876798,"url":"https://github.com/mjtechguy/orchestraitor","last_synced_at":"2025-05-05T02:52:27.383Z","repository":{"id":272814992,"uuid":"917837083","full_name":"mjtechguy/orchestraitor","owner":"mjtechguy","description":"Linux CLI capture tool to capture CLI commands and file edits and pass to AI to generate Ansible playbooks.","archived":false,"fork":false,"pushed_at":"2025-01-16T19:58:49.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T20:44:37.325Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjtechguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-16T18:30:09.000Z","updated_at":"2025-01-16T19:58:50.000Z","dependencies_parsed_at":"2025-01-16T20:12:48.998Z","dependency_job_id":"682c83d7-f95f-4eeb-9820-a09b63cb37f5","html_url":"https://github.com/mjtechguy/orchestraitor","commit_stats":null,"previous_names":["mjtechguy/orchestraitor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjtechguy%2Forchestraitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjtechguy%2Forchestraitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjtechguy%2Forchestraitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjtechguy%2Forchestraitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjtechguy","download_url":"https://codeload.github.com/mjtechguy/orchestraitor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429945,"owners_count":21746571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-05T02:52:26.819Z","updated_at":"2025-05-05T02:52:27.373Z","avatar_url":"https://github.com/mjtechguy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OrchestrAItor (orcai)\n\n**OrchestrAItor** (`orcai`) is a CLI tool that monitors shell commands and file changes, capturing detailed modifications to files and converting them into Ansible playbooks using an OpenAI-compatible LLM endpoint. It provides seamless integration with systemd to run as a background service and allows flexible configuration through both interactive prompts and command-line flags.\n\n---\n\n## Features\n\n- **Monitor Shell Commands**: Logs shell commands executed by the user.\n- **Track File Edits**: Captures detailed changes (diffs) to files, allowing precise recreation of modifications.\n- **Generate Ansible Playbooks**: Converts captured commands and file edits into Ansible playbooks via an LLM endpoint.\n- **Flexible Configuration**: Set API endpoint, API key, model, and context length through interactive prompts or command-line flags.\n- **Systemd Integration**: Runs as a managed background service.\n\n---\n\n## Installation\n\n### Prerequisites\n\n- Python 3.8 or higher\n- `pip` or `pipx` for package installation\n- Root access to set up the `systemd` service\n\n### Steps\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/mjtechguy/orchestraitor.git\ncd orchestraitor\n```\n\n2.\tInstall the package:\n\n```bash\npip install .\n```\n\n3.\tVerify the installation:\n\n```bash\norcai --help\n```\n\n## Commands\n\n1. `orcai config`\n\nConfigures the tool interactively by prompting for necessary details:\n\n```bash\norcai config\n```\n\n### Config Prompts:\n\n- API Endpoint: The OpenAI-compatible API endpoint (e.g., https://api.openai.com/v1/completions).\n- API Key: Your API key for authentication.\n- Model: The model to use (e.g., gpt-4).\n- Context Length: The maximum number of tokens in the response (e.g., 2048).\n\nConfiguration is saved to ~/.orcai_config.json.\n\n2. `orcai start`\n\nStarts monitoring shell commands and file changes. By default, the service uses the saved configuration.\n\n#### Example:\n\n```bash\norcai start\n```\n\nYou can override configuration values with flags:\n\n```bash\norcai start --api-endpoint https://api.openai.com/v1/completions --api-key my-key --model gpt-4 --context-length 8096\n```\n\n3. `orcai stop`\n\nStops monitoring and generates an Ansible playbook. The program sends the captured data to the LLM endpoint and prompts you to save the playbook.\n\n#### Example:\n\n```bash\norcai stop\n```\n\nAfter stopping, the program will prompt:\n\n`Enter the file path to save the Ansible playbook:`\n\n4. Command-Line Flags\n\nUse flags to override saved configuration settings:\n\n- \t`--api-endpoint`: Override the API endpoint.\n- \t`--api-key`: Override the API key.\n- \t`--model`: Override the model.\n- \t`--context-length`: Override the maximum context length.\n\n#### Example:\n\n```bash\norcai start --api-endpoint https://api.example.com --model gpt-3.5\n```\n\n## Configuration File\n\nThe configuration is stored in a JSON file at ~/.orcai_config.json. Example:\n\n\n```json\n{\n    \"api_endpoint\": \"https://api.openai.com/v1/completions\",\n    \"api_key\": \"your-api-key\",\n    \"model\": \"gpt-4\",\n    \"context_length\": 2048\n}\n```\n\nTo update the configuration, run:\n\n```bash\norcai config\n```\n\n#### Example Workflow\n\n1.\tConfigure the Tool:\n\n```bash\norcai config\n```\n\n2.\tStart Capturing:\n\n```bash\norcai start\n```\n\nPerform shell commands and make file edits. The tool will log your actions and track file changes.\n\n3.\tStop Capturing:\n\n```bash\norcai stop\n```\n\nThe captured data is converted into an Ansible playbook, and you will be prompted to save it.\n\n## Service Management\n\nThe orcai daemon can also be managed using systemd. By default, the installer sets it up as a systemd service.\n\nCheck Service Status:\n\n```bash\nsystemctl status orcai\n```\n\nRestart the Service:\n\n```bash\nsystemctl restart orcai\n```\n\nStop the Service:\n\n```bash\nsystemctl stop orcai\n```\n\n## Uninstallation\n\nTo uninstall Orchestraitor:\n\n1.\tStop the systemd service:\n\n```bash\nsystemctl stop orcai\n```\n\n\n2.\tDisable the service:\n\n```bash\nsystemctl disable orcai\n```\n\n3.\tRemove the service file:\n\n```bash\nsudo rm /etc/systemd/system/orcai.service\n```\n\n4.\tUninstall the Python package:\n\n```bash\npip uninstall orchestraitor\n```\n\n## Troubleshooting\n\nThe daemon isn’t running:\n\n- Check the service status:\n\n```bash\nsystemctl status orcai\n```\n\n- Restart the service:\n\n```bash\nsystemctl restart orcai\n```\n\n- No configuration found:\n\n  - Run `orcai config` to set up the configuration.\n\n## Future Improvements\n\n- Add support for monitoring additional system activities (e.g., network traffic, permission changes).\n- Improve diff handling for binary files.\n- Provide more detailed Ansible playbook generation for complex workflows.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjtechguy%2Forchestraitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjtechguy%2Forchestraitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjtechguy%2Forchestraitor/lists"}