refactor: extract shared utilities from duplicated shell code - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
refactor: extract shared utilities from duplicated shell code#3devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Create scripts/lib/shared.sh consolidating repeated patterns: - find_project_root(): was duplicated in 3 scripts - strip_crlf(): was duplicated in 2 stack sync scripts - gh_current_repo(): was inline in 10+ scripts - OPENCODE_STATE_LABELS + transition_issue_state(): duplicated in 2 scripts - oc_root(): standardizes config dir resolution - source_fetch_spec_prd(): dedups fetch_spec_prd sourcing logic Refactored 15 scripts to source shared.sh instead of maintaining their own copies of these utilities. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
scripts/lib/shared.sh— a single source-able library consolidating 6 duplicated patterns found across 15+ shell scripts:find_project_root [dir]format-on-save.sh,auto-test.sh,context-recovery.sh.git/package.json/etc.strip_crlf <file>sync_impl_tooling.sh,sync_spec_tooling.shgh_current_repo [dir]gh repo view --json nameWithOwner)owner/namewith gh→git-remote fallbackOPENCODE_STATE_LABELS+transition_issue_stateissue-state-transition.sh,triage.shoc_rootOC="${OPENCODE_CONFIG:-...}")source_fetch_spec_prd [bin_dir]feature-context,issue-expand-bundlefetch_spec_prd.shwith fallback chainbin/stack/common.shnow delegatesstack_gh_repo_from_dir→gh_current_repo(preserving the public function name for callers).All existing tests (
test_read_spec_repo.sh,block-dangerous-git.sh --self-test,check-crlf.sh, Python unit tests) pass. The one pre-existing failure intest_migrate_repos_registry.pyis unrelated.Link to Devin session: https://app.devin.ai/sessions/04daea238562403aa751c7732b76f65b
Requested by: @roborew