claude-smart 0.2.34 → 0.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
|
|
14
14
|
</a>
|
|
15
15
|
<a href="plugin/pyproject.toml">
|
|
16
|
-
<img src="https://img.shields.io/badge/version-0.2.
|
|
16
|
+
<img src="https://img.shields.io/badge/version-0.2.35-green.svg" alt="Version">
|
|
17
17
|
</a>
|
|
18
18
|
<a href="plugin/pyproject.toml">
|
|
19
19
|
<img src="https://img.shields.io/badge/python-%3E%3D3.12-brightgreen.svg" alt="Python">
|
package/bin/claude-smart.js
CHANGED
|
@@ -40,6 +40,7 @@ const CODEX_PLUGIN_ID = `claude-smart@${CODEX_MARKETPLACE_NAME}`;
|
|
|
40
40
|
const REFLEXIO_ENV_PATH = join(homedir(), ".reflexio", ".env");
|
|
41
41
|
const MANAGED_REFLEXIO_URL = "https://www.reflexio.ai/";
|
|
42
42
|
const REFLEXIO_USER_ID_ENV = "REFLEXIO_USER_ID";
|
|
43
|
+
const MANAGED_SETUP_ENV = "CLAUDE_SMART_MANAGED_SETUP";
|
|
43
44
|
const REFLEXIO_DIR = join(homedir(), ".reflexio");
|
|
44
45
|
const CLAUDE_SMART_STATE_DIR = join(homedir(), ".claude-smart");
|
|
45
46
|
const CODEX_CONFIG_PATH = join(homedir(), ".codex", "config.toml");
|
|
@@ -297,6 +298,10 @@ function configureReflexioSetup(args) {
|
|
|
297
298
|
process.stdout.write(
|
|
298
299
|
`Configured ${REFLEXIO_ENV_PATH} for managed Reflexio (${changed}; API key ${maskSecret(apiKey)}).\n`,
|
|
299
300
|
);
|
|
301
|
+
process.env.REFLEXIO_URL = reflexioUrl;
|
|
302
|
+
process.env.REFLEXIO_API_KEY = apiKey;
|
|
303
|
+
process.env[REFLEXIO_USER_ID_ENV] = userId;
|
|
304
|
+
process.env[MANAGED_SETUP_ENV] = "1";
|
|
300
305
|
return;
|
|
301
306
|
}
|
|
302
307
|
|
package/package.json
CHANGED
package/plugin/pyproject.toml
CHANGED
|
@@ -434,7 +434,66 @@ fi
|
|
|
434
434
|
REFLEXIO_ENV="$HOME/.reflexio/.env"
|
|
435
435
|
mkdir -p "$(dirname "$REFLEXIO_ENV")"
|
|
436
436
|
touch "$REFLEXIO_ENV"
|
|
437
|
-
|
|
437
|
+
claude_smart_env_quote() {
|
|
438
|
+
printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
claude_smart_env_value() {
|
|
442
|
+
local key line value
|
|
443
|
+
key="$1"
|
|
444
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
445
|
+
line="${line#"${line%%[![:space:]]*}"}"
|
|
446
|
+
line="${line%"${line##*[![:space:]]}"}"
|
|
447
|
+
[ -n "$line" ] || continue
|
|
448
|
+
case "$line" in
|
|
449
|
+
\#*) continue ;;
|
|
450
|
+
export\ *) line="${line#export }" ;;
|
|
451
|
+
esac
|
|
452
|
+
[ "${line%%=*}" = "$key" ] || continue
|
|
453
|
+
value="${line#*=}"
|
|
454
|
+
value="${value#"${value%%[![:space:]]*}"}"
|
|
455
|
+
value="${value%"${value##*[![:space:]]}"}"
|
|
456
|
+
claude_smart_env_unquote "$value"
|
|
457
|
+
return 0
|
|
458
|
+
done < "$REFLEXIO_ENV"
|
|
459
|
+
return 1
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
claude_smart_env_upsert() {
|
|
463
|
+
local key value quoted
|
|
464
|
+
key="$1"
|
|
465
|
+
value="$2"
|
|
466
|
+
quoted="$(claude_smart_env_quote "$value")"
|
|
467
|
+
if grep -qE "^(export[[:space:]]+)?${key}=" "$REFLEXIO_ENV"; then
|
|
468
|
+
sed -i.bak -E "s|^(export[[:space:]]+)?${key}=.*$|${key}=\"${quoted}\"|" "$REFLEXIO_ENV"
|
|
469
|
+
rm -f "$REFLEXIO_ENV.bak"
|
|
470
|
+
else
|
|
471
|
+
printf '%s="%s"\n' "$key" "$quoted" >> "$REFLEXIO_ENV"
|
|
472
|
+
fi
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
claude_smart_generate_uuid() {
|
|
476
|
+
if [ -r /proc/sys/kernel/random/uuid ]; then
|
|
477
|
+
cat /proc/sys/kernel/random/uuid
|
|
478
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
479
|
+
python3 -c 'import uuid; print(uuid.uuid4())'
|
|
480
|
+
elif command -v python >/dev/null 2>&1; then
|
|
481
|
+
python -c 'import uuid; print(uuid.uuid4())'
|
|
482
|
+
else
|
|
483
|
+
date +%s%N | sed -E 's/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/\1-\2-\3-\4-\5/'
|
|
484
|
+
fi
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if [ "${CLAUDE_SMART_MANAGED_SETUP:-}" = "1" ] && [ -n "${REFLEXIO_API_KEY:-}" ]; then
|
|
488
|
+
REFLEXIO_URL="${REFLEXIO_URL:-https://www.reflexio.ai/}"
|
|
489
|
+
REFLEXIO_USER_ID="${REFLEXIO_USER_ID:-$(claude_smart_env_value REFLEXIO_USER_ID || true)}"
|
|
490
|
+
REFLEXIO_USER_ID="${REFLEXIO_USER_ID:-$(claude_smart_generate_uuid)}"
|
|
491
|
+
claude_smart_env_upsert REFLEXIO_URL "$REFLEXIO_URL"
|
|
492
|
+
claude_smart_env_upsert REFLEXIO_API_KEY "$REFLEXIO_API_KEY"
|
|
493
|
+
claude_smart_env_upsert REFLEXIO_USER_ID "$REFLEXIO_USER_ID"
|
|
494
|
+
chmod 600 "$REFLEXIO_ENV"
|
|
495
|
+
echo "[claude-smart] configured managed Reflexio in $REFLEXIO_ENV" >&2
|
|
496
|
+
elif [ -z "${REFLEXIO_API_KEY:-}" ]; then
|
|
438
497
|
if ! grep -q '^CLAUDE_SMART_USE_LOCAL_CLI=' "$REFLEXIO_ENV"; then
|
|
439
498
|
printf '\n# Route reflexio generation through the local Claude Code CLI\nCLAUDE_SMART_USE_LOCAL_CLI=1\n' >> "$REFLEXIO_ENV"
|
|
440
499
|
echo "[claude-smart] appended CLAUDE_SMART_USE_LOCAL_CLI=1 to $REFLEXIO_ENV" >&2
|