claude-smart 0.2.33 → 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.33-green.svg" alt="Version">
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">
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Self-improving Claude Code plugin — learns from corrections via reflexio",
5
5
  "keywords": [
6
6
  "claude",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Self-improving Claude Code plugin — learns from corrections across sessions via reflexio",
5
5
  "author": {
6
6
  "name": "Yi Lu"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Self-improving coding assistant plugin — learns from corrections across sessions via reflexio",
5
5
  "author": {
6
6
  "name": "Yi Lu"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "claude-smart"
3
- version = "0.2.33"
3
+ version = "0.2.35"
4
4
  description = "Self-improving Claude Code plugin — learns from corrections via reflexio"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -63,7 +63,15 @@ claude_smart_source_reflexio_env() {
63
63
  value="${value#"${value%%[![:space:]]*}"}"
64
64
  value="${value%"${value##*[![:space:]]}"}"
65
65
  case "$key" in
66
- REFLEXIO_URL|REFLEXIO_API_KEY|REFLEXIO_USER_ID|CLAUDE_SMART_USE_LOCAL_CLI|CLAUDE_SMART_USE_LOCAL_EMBEDDING|CLAUDE_SMART_BACKEND_AUTOSTART|CLAUDE_SMART_DASHBOARD_AUTOSTART|CLAUDE_SMART_CLI_PATH|CLAUDE_SMART_CLI_TIMEOUT|CLAUDE_SMART_STATE_DIR|CLAUDE_SMART_ENABLE_OPTIMIZER)
66
+ # Reflexio identity: file always wins so a rotated key/url overrides
67
+ # whatever a long-lived managed backend or dashboard process inherited.
68
+ REFLEXIO_URL|REFLEXIO_API_KEY|REFLEXIO_USER_ID)
69
+ value="$(claude_smart_env_unquote "$value")"
70
+ export "$key=$value"
71
+ ;;
72
+ # CLAUDE_SMART_* flags: respect anything the caller already exported so
73
+ # per-session overrides (e.g., a manual test) take precedence over the file.
74
+ CLAUDE_SMART_USE_LOCAL_CLI|CLAUDE_SMART_USE_LOCAL_EMBEDDING|CLAUDE_SMART_BACKEND_AUTOSTART|CLAUDE_SMART_DASHBOARD_AUTOSTART|CLAUDE_SMART_CLI_PATH|CLAUDE_SMART_CLI_TIMEOUT|CLAUDE_SMART_STATE_DIR|CLAUDE_SMART_ENABLE_OPTIMIZER)
67
75
  if [ -z "$(eval "printf '%s' \"\${$key:-}\"")" ]; then
68
76
  value="$(claude_smart_env_unquote "$value")"
69
77
  export "$key=$value"
@@ -180,10 +180,12 @@ function loadReflexioEnv() {
180
180
  } catch {
181
181
  return;
182
182
  }
183
- const allowed = new Set([
183
+ const managedReflexioKeys = new Set([
184
184
  "REFLEXIO_URL",
185
185
  "REFLEXIO_API_KEY",
186
186
  "REFLEXIO_USER_ID",
187
+ ]);
188
+ const localConfigKeys = new Set([
187
189
  "CLAUDE_SMART_USE_LOCAL_CLI",
188
190
  "CLAUDE_SMART_USE_LOCAL_EMBEDDING",
189
191
  "CLAUDE_SMART_BACKEND_AUTOSTART",
@@ -200,8 +202,11 @@ function loadReflexioEnv() {
200
202
  const eq = line.indexOf("=");
201
203
  if (eq < 0) continue;
202
204
  const key = line.slice(0, eq).trim();
203
- if (!allowed.has(key) || process.env[key]) continue;
204
- process.env[key] = unquoteEnvValue(line.slice(eq + 1));
205
+ if (managedReflexioKeys.has(key)) {
206
+ process.env[key] = unquoteEnvValue(line.slice(eq + 1));
207
+ } else if (localConfigKeys.has(key) && !process.env[key]) {
208
+ process.env[key] = unquoteEnvValue(line.slice(eq + 1));
209
+ }
205
210
  }
206
211
  }
207
212
 
@@ -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
- if [ -z "${REFLEXIO_API_KEY:-}" ]; then
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
@@ -326,17 +326,10 @@ class Adapter:
326
326
  if client is None:
327
327
  return []
328
328
  try:
329
- if hasattr(client, "get_all_profiles"):
330
- response = client.get_all_profiles(limit=max(top_k * 20, 100))
331
- return [
332
- item
333
- for item in _extract_items(response, "user_profiles")
334
- if _field(item, "user_id") == project_id
335
- ][:top_k]
336
- response = client.search_user_profiles(
329
+ response = client.get_profiles(
337
330
  user_id=project_id,
338
- query="",
339
331
  top_k=top_k,
332
+ status_filter=[None],
340
333
  )
341
334
  except Exception as exc: # noqa: BLE001
342
335
  self._record_read_error("fetch_project_profiles", exc)
@@ -446,12 +439,6 @@ def _extract_items(response: Any, field: str) -> list[Any]:
446
439
  return list(value) if value else []
447
440
 
448
441
 
449
- def _field(item: Any, field: str) -> Any:
450
- if isinstance(item, dict):
451
- return item.get(field)
452
- return getattr(item, field, None)
453
-
454
-
455
442
  def _supports_keyword(callable_obj: Any, keyword: str) -> bool:
456
443
  try:
457
444
  signature = inspect.signature(callable_obj)
package/plugin/uv.lock CHANGED
@@ -419,7 +419,7 @@ wheels = [
419
419
 
420
420
  [[package]]
421
421
  name = "claude-smart"
422
- version = "0.2.33"
422
+ version = "0.2.35"
423
423
  source = { editable = "." }
424
424
  dependencies = [
425
425
  { name = "chromadb" },