Skip to content

Commit 4dfd693

Browse files
committed
fix: address fourteenth round of Copilot PR review feedback
- Extract stable source_id from display label in reconciliation: parse 'extension:foo v1.0' to 'foo' instead of passing the human-facing display string as source_id - Fix bash lowercase to be POSIX-compatible: use tr instead of ${,,} which requires Bash 4+ and fails on macOS default Bash 3.2
1 parent c655b0e commit 4dfd693

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

scripts/bash/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ except Exception:
442442
print('replace\t')
443443
" 2>/dev/null) && {
444444
IFS=$'\t' read -r strategy manifest_file <<< "$result"
445-
strategy="${strategy,,}" # normalize to lowercase
445+
strategy=$(printf '%s' "$strategy" | tr '[:upper:]' '[:lower:]')
446446
}
447447
fi
448448
# Try manifest file path first, then convention path

src/specify_cli/presets.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,16 @@ def _reconcile_composed_commands(self, command_names: List[str]) -> None:
675675
if not registered:
676676
# Top layer is a non-preset source (extension, core, or
677677
# project override). Register directly from the layer path.
678+
# Extract stable source_id from display label
679+
source = layers[0]["source"]
680+
if source.startswith("extension:"):
681+
# "extension:foo v1.0" → "foo"
682+
source_id = source.split(":", 1)[1].split(" ", 1)[0]
683+
else:
684+
source_id = source
678685
self._register_command_from_path(
679686
registrar, cmd_name, top_path,
680-
source_id=layers[0]["source"],
687+
source_id=source_id,
681688
)
682689
else:
683690
# Composed command — resolve from full stack
@@ -719,9 +726,14 @@ def _reconcile_composed_commands(self, command_names: List[str]) -> None:
719726
shared_composed.mkdir(parents=True, exist_ok=True)
720727
composed_file = shared_composed / f"{cmd_name}.md"
721728
composed_file.write_text(composed, encoding="utf-8")
729+
source = layers[0]["source"]
730+
if source.startswith("extension:"):
731+
source_id = source.split(":", 1)[1].split(" ", 1)[0]
732+
else:
733+
source_id = source
722734
self._register_command_from_path(
723735
registrar, cmd_name, composed_file,
724-
source_id=layers[0]["source"],
736+
source_id=source_id,
725737
)
726738

727739
def _register_command_from_path(

0 commit comments

Comments
 (0)