feat: deploy agent from any git URL (from_git / from_git_local)
- DeployConfig: add git_url, main_script, apt_deps fields - Deployer: new _deploy_from_git() and _detect_main_script() methods Auto-detects main script (agent_*.py > main.py > grep __main__) Uses minimal apt defaults, reads requirements.txt for pip deps - deploy skill: add from_git and from_git_local actions from_git <url> <nom> <host> <user> password|key <cred> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script] from_git_local <url> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+48
-1
@@ -21,7 +21,9 @@ DESCRIPTION = "Déployer un agent sur une machine distante (SSH) ou locale"
|
||||
USAGE = (
|
||||
"SKILL:deploy ARGS:catalog — liste les agents déployables\n"
|
||||
"SKILL:deploy ARGS:start <type> <nom> <host> <user> password <mdp> <xmpp_jid> <xmpp_pass> <mqtt_host>\n"
|
||||
"SKILL:deploy ARGS:local <type> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host>"
|
||||
"SKILL:deploy ARGS:local <type> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host>\n"
|
||||
"SKILL:deploy ARGS:from_git <git_url> <nom> <host> <user> password|key <credential> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]\n"
|
||||
"SKILL:deploy ARGS:from_git_local <git_url> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]"
|
||||
)
|
||||
|
||||
|
||||
@@ -77,6 +79,51 @@ def run(args: str, context) -> str:
|
||||
)
|
||||
return _do_deploy(cfg, context)
|
||||
|
||||
if action == "from_git":
|
||||
# ARGS: from_git <git_url> <nom> <host> <user> password|key <credential> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]
|
||||
p = rest.split()
|
||||
if len(p) < 9:
|
||||
return (
|
||||
"Format : from_git <git_url> <nom> <host> <user> password|key <credential> "
|
||||
"<xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]"
|
||||
)
|
||||
cfg = DeployConfig(
|
||||
agent_type="custom",
|
||||
agent_name=p[1],
|
||||
host=p[2],
|
||||
ssh_user=p[3],
|
||||
ssh_auth=p[4],
|
||||
ssh_credential=p[5],
|
||||
xmpp_jid=p[6],
|
||||
xmpp_password=p[7],
|
||||
mqtt_host=p[8],
|
||||
mqtt_port=int(p[9]) if len(p) > 9 and p[9].isdigit() else 1883,
|
||||
git_url=p[0],
|
||||
main_script=p[10] if len(p) > 10 else None,
|
||||
)
|
||||
return _do_deploy(cfg, context)
|
||||
|
||||
if action == "from_git_local":
|
||||
# ARGS: from_git_local <git_url> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]
|
||||
p = rest.split()
|
||||
if len(p) < 5:
|
||||
return "Format : from_git_local <git_url> <nom> <xmpp_jid> <xmpp_pass> <mqtt_host> [main_script]"
|
||||
cfg = DeployConfig(
|
||||
agent_type="custom",
|
||||
agent_name=p[1],
|
||||
host="localhost",
|
||||
ssh_user="root",
|
||||
ssh_auth="",
|
||||
ssh_credential="",
|
||||
xmpp_jid=p[2],
|
||||
xmpp_password=p[3],
|
||||
mqtt_host=p[4],
|
||||
local=True,
|
||||
git_url=p[0],
|
||||
main_script=p[5] if len(p) > 5 else None,
|
||||
)
|
||||
return _do_deploy(cfg, context)
|
||||
|
||||
if action == "status":
|
||||
host = rest.strip()
|
||||
if not host:
|
||||
|
||||
Reference in New Issue
Block a user