This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ai_command_widget() { | |
| local input="$READLINE_LINE" | |
| local cmdout | |
| cmdout=$(echo "$input" | node "$HOME/ai-shell-helper/main.js") | |
| READLINE_LINE="$cmdout" | |
| READLINE_POINT=${#READLINE_LINE} | |
| } | |
| # Bind Ctrl+G to the function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ai-command-widget() { | |
| alias ai-cmd='node $HOME/ai-shell-helper/main.js' | |
| local input | |
| input="$LBUFFER" | |
| local cmdout | |
| cmdout=$(echo "$input" | ai-cmd) | |
| # Replace current buffer with AI-generated command | |
| LBUFFER="$cmdout" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INFERENCE_MODE="<ollama|aws_bedrock>" | |
| # For local inference | |
| OLLAMA_URL="http://localhost:11434" | |
| # For Bedrock inference | |
| BEDROCK_FLOW_IDENTIFIER="<flow ID or ARN>" | |
| BEDROCK_FLOW_ALIAS="<alias name or ARN>" | |
| AWS_REGION="us-east-1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INFERENCE_MODE="<ollama|aws_bedrock>" | |
| # For local inference | |
| OLLAMA_URL="http://localhost:11434" | |
| # For Bedrock inference | |
| BEDROCK_FLOW_IDENTIFIER="<flow ID or ARN>" | |
| BEDROCK_FLOW_ALIAS="<alias name or ARN>" | |
| AWS_REGION="us-east-1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "Statement1", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "bedrock:InvokeFlow" | |
| ], | |
| "Resource": "<flow resource arn>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -d @/tmp/payload.json -H 'Content-Type: application/json' 'http://localhost:11434/api/generate' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "model": "phi4:latest", | |
| "prompt": "You are a linux system administrator and devops engineer assistant used in an automated system that parses your responses as raw JSON.\nSTRICT RULES:\n- Output MUST be only valid raw JSON. Do NOT include markdown, backticks, or formatting tags.\n- NO explanations, no introductory text, and no comments.\n- If no suitable command is found, output: {\"command\": \"\", \"notes\": \"no command found\", \"status\": \"error\"}\n- Output must always follow this exact schema:\n{\n \"command\": \"<actual Linux command here>\",\n \"notes\": \"<if applicable, add any notes to the command>\",\n \"status\": \"success/error\"\n}\n- Any deviation from this format will result in system error.\nRespond to the following user query as per the rules above:\nstart nginx container backed by alpine image", | |
| "stream": false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "command": "docker run -d --name my-nginx -p 80:80 -p 443:443 -v /etc/nginx/conf.d:/etc/nginx/conf.d nginx:alpine", | |
| "notes": "Replace 'my-nginx' with a suitable container name.", | |
| "status": "success" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| { | |
| "command": "docker run -d --name my-nginx -p 80:80 -p 443:443 -v /etc/nginx/conf.d:/etc/nginx/conf.d nginx:alpine", | |
| "notes": "Replace 'my-nginx' with a suitable container name.", | |
| "status": "success" | |
| } | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| You are a linux system administrator and devops engineer assistant used in an automated system that parses your responses as raw JSON. | |
| STRICT RULES: | |
| - Output MUST be only valid raw JSON. Do NOT include markdown, backticks, or formatting tags. | |
| - NO explanations, no introductory text, and no comments. | |
| - If no suitable command is found, output: {"command": "", "notes": "no command found", "status": "error"} | |
| - Output must always follow this exact schema: | |
| { | |
| "command": "<actual Linux command here>", | |
| "notes": "<if applicable, add any notes to the command>", |