diff --git a/analysis/generate-manifest.sh b/analysis/generate-manifest.sh index a4b7151..09cf527 100755 --- a/analysis/generate-manifest.sh +++ b/analysis/generate-manifest.sh @@ -80,7 +80,18 @@ extract_category() { else local rel="${path#$WORKSPACE_ROOT/}" local first_component="${rel%%/*}" - echo "$first_component" + # For @ts/, go one level deeper to get namespace (e.g., @ts/@auth) + if [[ "$first_component" == "@ts" ]]; then + local rest="${rel#*/}" + local second_component="${rest%%/*}" + if [[ -n "$second_component" && "$second_component" != "$rest" ]]; then + echo "@ts/$second_component" + else + echo "@ts" + fi + else + echo "$first_component" + fi fi } @@ -205,43 +216,38 @@ find_python_packages() { detect_language_pairs() { log "🔗 Detecting language pairs..." - # Build map of directory names to packages - # For the new structure, TypeScript packages are in @ts// and Python in @py// - declare -A TS_BY_DIR=() - declare -A PY_BY_DIR=() + # Name-based matching: normalize package names and find overlaps + # TS: strip scope prefix (@lilith/foo → foo) + # Python: strip lilith- prefix (lilith-foo → foo) + declare -A TS_BY_BASENAME=() + declare -A PY_BY_BASENAME=() for name in "${!TS_PACKAGES[@]}"; do IFS='|' read -r version description category path should_publish source <<< "${TS_PACKAGES[$name]}" - # Only consider packages in @ts/ directory - if [[ "$path" == *"/@ts/"* ]]; then - local dir_name - dir_name=$(extract_dir_name "$path") - TS_BY_DIR["$dir_name"]="$name|$version" - fi + # Strip scope: @lilith/queue → queue, @transftw/foo → foo + local base_name="${name#@*/}" + TS_BY_BASENAME["$base_name"]="$name|$version" done for name in "${!PY_PACKAGES[@]}"; do IFS='|' read -r version description category path source <<< "${PY_PACKAGES[$name]}" - # Only consider packages in @py/ directory - if [[ "$path" == *"/@py/"* ]]; then - local dir_name - dir_name=$(extract_dir_name "$path") - PY_BY_DIR["$dir_name"]="$name|$version" - fi + # Strip lilith- prefix: lilith-queue → queue + local base_name="${name#lilith-}" + PY_BY_BASENAME["$base_name"]="$name|$version" done - # Find pairs by matching directory names between @ts/ and @py/ - for dir_name in "${!TS_BY_DIR[@]}"; do - if [[ -n "${PY_BY_DIR[$dir_name]:-}" ]]; then - IFS='|' read -r ts_name ts_version <<< "${TS_BY_DIR[$dir_name]}" - IFS='|' read -r py_name py_version <<< "${PY_BY_DIR[$dir_name]}" + # Find pairs by matching normalized base names + for base_name in "${!TS_BY_BASENAME[@]}"; do + if [[ -n "${PY_BY_BASENAME[$base_name]:-}" ]]; then + IFS='|' read -r ts_name ts_version <<< "${TS_BY_BASENAME[$base_name]}" + IFS='|' read -r py_name py_version <<< "${PY_BY_BASENAME[$base_name]}" local sync_type="loose" - if is_strict_sync "$dir_name"; then + if is_strict_sync "$base_name"; then sync_type="strict" fi - PAIRS["$dir_name"]="$ts_name|$ts_version|$py_name|$py_version|$sync_type" + PAIRS["$base_name"]="$ts_name|$ts_version|$py_name|$py_version|$sync_type" fi done