mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
The merged branch moved every role-local script out of files/ into a folder named for its language (files/python/, files/php/, files/shell/), but the moves lost their staging and never landed. HEAD still carried the old paths while the worktree had the new ones. Move the 24 remaining scripts and update the six places that resolve them: the mcp-adapter instance/isolation/probe tasks, the litellm key task, the adapter README and the endpoint-path lint. Every changed line in those files is a path. Also drop roles/sys-svc-compose/files/swarm/stack_ready.sh, a stale duplicate of the copy already tracked under files/shell/swarm/. The added comments are the branch's own `nocheck: mirrored-unit-test` directives, which state why a script whose measurement only exists inside its container cannot have a mirrored unit test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Environment:
|
|
* AI_ENGINE_PAYLOAD: base64 of {"environment": {...}, "default_model": "..."}.
|
|
*/
|
|
|
|
// nocheck: mirrored-unit-test - runs through `wp eval-file`, calling WP_CLI and the
|
|
// get_option/update_option pair of the booted site; the WordPress runtime it needs is
|
|
// only present inside the container
|
|
|
|
$payload = json_decode(base64_decode(getenv('AI_ENGINE_PAYLOAD')), true);
|
|
if (!is_array($payload) || empty($payload['environment']['id'])) {
|
|
WP_CLI::error('AI_ENGINE_PAYLOAD did not decode to an environment');
|
|
}
|
|
|
|
$options = get_option('mwai_options', array());
|
|
if (!is_array($options)) {
|
|
$options = array();
|
|
}
|
|
|
|
$existing = (isset($options['ai_envs']) && is_array($options['ai_envs'])) ? $options['ai_envs'] : array();
|
|
$kept = array();
|
|
foreach ($existing as $env) {
|
|
if ((isset($env['id']) ? $env['id'] : '') !== $payload['environment']['id']) {
|
|
$kept[] = $env;
|
|
}
|
|
}
|
|
$kept[] = $payload['environment'];
|
|
|
|
$options['ai_envs'] = $kept;
|
|
$options['ai_default_env'] = $payload['environment']['id'];
|
|
$options['ai_default_model'] = $payload['default_model'];
|
|
|
|
update_option('mwai_options', $options);
|