-
-
Notifications
You must be signed in to change notification settings - Fork 292
Re-arrange folder structure #2423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideRefactors the project’s directory layout (notably removing leading dots from includes/scripts and standardizing asset/state locations) while adding a migration helper to preserve existing user data and updating references, logging paths, and CI config accordingly. Sequence diagram for startup sourcing and migration processsequenceDiagram
actor User
participant Shell
participant main_sh as main.sh
participant misc as misc_functions.sh
participant globals as global_variables.sh
participant migrate as migration_functions.sh
User ->> Shell: run ds / main.sh
Shell ->> main_sh: execute
main_sh ->> misc: source includes/misc_functions.sh
misc -->> main_sh: functions loaded
main_sh ->> globals: source includes/global_variables.sh
globals -->> main_sh: paths and folders configured
main_sh ->> migrate: source includes/migration_functions.sh
migrate -->> main_sh: MigrateFilesAndFolders available
main_sh ->> main_sh: check MigrateFilesAndFolders is declared
alt migration helper available
main_sh ->> migrate: MigrateFilesAndFolders()
migrate ->> migrate: build MigrationFileMap and MigrationFolderMap
loop for each mapped file
migrate ->> migrate: if NewFile missing and OldFile exists
migrate ->> migrate: RunAndLog mv OldFile -> NewFile
end
loop for each mapped folder
migrate ->> migrate: if NewFolder missing and OldFolder exists
migrate ->> migrate: RunAndLog mv OldFolder -> NewFolder
end
else migration helper missing
main_sh ->> main_sh: continue without migration
end
main_sh ->> main_sh: source remaining includes (pm, run_script, dialog, ds, test, usage, cmdline)
main_sh -->> Shell: ready to handle commands
Shell -->> User: DockSTARTer ready
Flow diagram for file and folder migration and new layoutflowchart LR
subgraph OldLayout["Old layout (before refactor)"]
of1["${SCRIPTPATH}/dockstarter.log"]
of2["${APPLICATION_STATE_FOLDER}/fatal.log"]
of3["${SCRIPTPATH}/fatal.log"]
od1["${APPLICATION_STATE_FOLDER}/.theme"]
od2["${APPLICATION_STATE_FOLDER}/.timestamps"]
od3["${APPLICATION_STATE_FOLDER}/.instances"]
oinc["${SCRIPTPATH}/.includes"]
oscr["${SCRIPTPATH}/.scripts"]
odef["${SCRIPTPATH}/.defaults"]
othm["${SCRIPTPATH}/.themes"]
end
subgraph NewLayout["New layout (after refactor)"]
subgraph LogsState["State and log files"]
nf1["${APPLICATION_LOG} = ${XDG_STATE_HOME}/${APPLICATION_NAME,,}/${APPLICATION_NAME,,}.log"]
nf2["${FATAL_LOG} = ${XDG_STATE_HOME}/${APPLICATION_NAME,,}/${APPLICATION_NAME,,}.fatal.log"]
nd2["${TIMESTAMPS_FOLDER}"]
nd3["${INSTANCES_FOLDER}"]
end
subgraph Assets["Assets in repo"]
aas["${APPLICATION_ASSETS_FOLDER} = ${SCRIPTPATH}/assets"]
ndef["${DEFAULTS_FOLDER} = ${APPLICATION_ASSETS_FOLDER}/defaults"]
nthm["${THEME_FOLDER} = ${APPLICATION_ASSETS_FOLDER}/themes"]
end
subgraph IncludesScripts["Code layout"]
ninc["${SCRIPTPATH}/includes"]
nscr["${SCRIPTPATH}/scripts"]
end
end
subgraph Migration["Migration helper"]
mh["MigrateFilesAndFolders() in includes/migration_functions.sh"]
end
of1 -->|mapped by MigrationFileMap| mh
of2 -->|mapped by MigrationFileMap| mh
of3 -->|mapped by MigrationFileMap| mh
od1 -->|mapped by MigrationFolderMap| mh
od2 -->|mapped by MigrationFolderMap| mh
od3 -->|mapped by MigrationFolderMap| mh
mh --> nf1
mh --> nf2
mh --> nd2
mh --> nd3
oinc --> ninc
oscr --> nscr
odef --> aas
othm --> aas
classDef old fill:#fff5f5,stroke:#ff7f7f,stroke-width:1px
classDef new fill:#f5fff5,stroke:#7fff7f,stroke-width:1px
class of1,of2,of3,od1,od2,od3,oinc,oscr,odef,othm old
class nf1,nf2,nd2,nd3,aas,ndef,nthm,ninc,nscr new
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `includes/migration_functions.sh:21-23` </location>
<code_context>
+ for OldFile in "${!MigrationFileMap[@]}"; do
+ local NewFile="${MigrationFileMap[${OldFile}]}"
+
+ if [[ ! -f ${NewFile} && -f ${OldFile} ]]; then
+ warn "Migrating '${C["File"]}${OldFile}${NC}' to '${C["File"]}${NewFile}${NC}'."
+ RunAndLog warn "mv:warn" \
+ warn "Failed to migrate '${C["File"]}${OldFile}${NC}'." \
+ mv "${OldFile}" "${NewFile}" || true
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `mv ... || true` inside `RunAndLog` suppresses failures and prevents the error branch from running.
Because the `mv` command is wrapped with `|| true`, the overall command always returns 0 to `RunAndLog`, so the failure message branch is never triggered even if `mv` fails. To keep migration failures visible while still preventing the script from aborting, remove `|| true` and, if necessary, handle non‑zero statuses via `RunAndLog`’s return value instead.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if [[ ! -f ${NewFile} && -f ${OldFile} ]]; then | ||
| warn "Migrating '${C["File"]}${OldFile}${NC}' to '${C["File"]}${NewFile}${NC}'." | ||
| RunAndLog warn "mv:warn" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Using mv ... || true inside RunAndLog suppresses failures and prevents the error branch from running.
Because the mv command is wrapped with || true, the overall command always returns 0 to RunAndLog, so the failure message branch is never triggered even if mv fails. To keep migration failures visible while still preventing the script from aborting, remove || true and, if necessary, handle non‑zero statuses via RunAndLog’s return value instead.
Pull request
Purpose
Describe the problem or feature in addition to a link to the issues.
Approach
How does this change address the problem?
Open Questions and Pre-Merge TODOs
Check all boxes as they are completed
Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem
Requirements
Check all boxes as they are completed
Summary by Sourcery
Reorganize shell script folders and application assets while adding a migration path for existing user data.
Enhancements:
CI: