fix(minimax-docx): restore the CLI project directly#24
fix(minimax-docx): restore the CLI project directly#24JithendraNara wants to merge 2 commits intoMiniMax-AI:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Restores/builds the minimax-docx CLI by targeting the CLI .csproj directly (avoiding directory/.slnx restore issues) and adds support for restricted-network installs via configurable NuGet restore sources and auto-detected local feeds.
Changes:
- Restore/build now targets
scripts/dotnet/MiniMaxAIDocx.Cli/MiniMaxAIDocx.Cli.csprojexplicitly. - Add
MINIMAX_DOCX_NUGET_SOURCES(semicolon-separated) plus auto-detection of local feed directories for offline/restricted restores. - Document restricted-network/offline NuGet restore workflow in
SKILL.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| skills/minimax-docx/scripts/setup.sh | Targets CLI .csproj for restore/build and adds configurable + auto-detected NuGet sources. |
| skills/minimax-docx/scripts/setup.ps1 | Windows equivalent: explicit .csproj restore/build and restore-source configuration. |
| skills/minimax-docx/scripts/env_check.sh | Environment check now restores/builds the CLI .csproj and supports custom/local NuGet sources. |
| skills/minimax-docx/SKILL.md | Documents the new restore target and restricted-network/offline NuGet options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fail "Configured source(s): ${RESTORE_SOURCE_LABELS[*]}" | ||
| fail "Try manually: dotnet restore $CLI_PROJECT --verbosity detailed --ignore-failed-sources" | ||
| fail "Restricted network? Set MINIMAX_DOCX_NUGET_SOURCES='https://mirror.example/v3/index.json;/path/to/local/feed'" |
There was a problem hiding this comment.
The suggested manual commands embed $CLI_PROJECT unquoted. If the repo path contains spaces, users copy/pasting these commands will fail. Wrap the project path in quotes in the printed guidance (same applies to the build guidance and the final “Usage” summary).
skills/minimax-docx/scripts/setup.sh
Outdated
| echo " dotnet run --project $CLI_PROJECT -- create --type report --output my_report.docx" | ||
| echo " bash $SCRIPT_DIR/env_check.sh # Quick environment check" |
There was a problem hiding this comment.
The “Usage” line prints dotnet run --project $CLI_PROJECT ... without quoting the path. If $CLI_PROJECT includes spaces, the copy/paste command will break. Consider printing it with quotes around the project path.
| echo " dotnet run --project $CLI_PROJECT -- create --type report --output my_report.docx" | |
| echo " bash $SCRIPT_DIR/env_check.sh # Quick environment check" | |
| echo " dotnet run --project \"$CLI_PROJECT\" -- create --type report --output my_report.docx" | |
| echo " bash \"$SCRIPT_DIR/env_check.sh\" # Quick environment check" |
| [ -n "$source" ] || continue | ||
| RESTORE_SOURCE_ARGS+=("--source" "$source") | ||
| RESTORE_SOURCE_LABELS+=("$source") | ||
| done |
There was a problem hiding this comment.
Same edge case as in setup.sh: if MINIMAX_DOCX_NUGET_SOURCES is set but all entries trim to empty, RESTORE_SOURCE_ARGS ends up empty and the check will silently fall back to default NuGet.Config sources while still treating it as a “custom source(s)” case. Consider validating that at least one source remains after trimming and otherwise failing or falling back to the default + detected local feeds.
| done | |
| done | |
| # If MINIMAX_DOCX_NUGET_SOURCES was set but no valid sources remained | |
| # after trimming, fall back to the default + detected local feeds. | |
| if [ ${#RESTORE_SOURCE_ARGS[@]} -eq 0 ]; then | |
| RESTORE_SOURCE_ARGS+=("--source" "$DEFAULT_NUGET_SOURCE") | |
| RESTORE_SOURCE_LABELS+=("$DEFAULT_NUGET_SOURCE") | |
| local local_feed | |
| for local_feed in "$DOTNET_DIR/packages" "$PROJECT_DIR/assets/nuget"; do | |
| if [ -d "$local_feed" ]; then | |
| RESTORE_SOURCE_ARGS+=("--source" "$local_feed") | |
| RESTORE_SOURCE_LABELS+=("$local_feed") | |
| fi | |
| done | |
| fi |
| if ($trimmed) { | ||
| $sources += $trimmed | ||
| } | ||
| } |
There was a problem hiding this comment.
Get-RestoreSources treats any non-empty MINIMAX_DOCX_NUGET_SOURCES as “custom”, but if it’s only whitespace/semicolons the trimmed list can end up empty. That leads to restore using default NuGet sources while output still says it’s using custom sources. Consider validating $sources.Count -gt 0 after trimming and either erroring or falling back to $DefaultNugetSource + detected local feeds.
| } | |
| } | |
| if ($sources.Count -eq 0) { | |
| Warn "MINIMAX_DOCX_NUGET_SOURCES contained no valid entries; falling back to default NuGet sources." | |
| $sources += $DefaultNugetSource | |
| $localFeeds = @( | |
| (Join-Path $DotnetDir "packages"), | |
| (Join-Path $ProjectDir "assets/nuget") | |
| ) | |
| foreach ($feed in $localFeeds) { | |
| if (Test-Path $feed) { | |
| $sources += $feed | |
| } | |
| } | |
| } |
| Fail " - Insufficient disk space" | ||
| Fail "Try: dotnet restore --verbosity detailed" | ||
| Fail "Configured source(s): $($restoreSources -join ', ')" | ||
| Fail "Try: dotnet restore $CliProject --verbosity detailed --ignore-failed-sources" |
There was a problem hiding this comment.
The printed “Try:” command includes $CliProject without quotes. If the expanded path contains spaces, users copy/pasting will get a broken command. Consider emitting the suggested command with quotes around the project path.
| Fail "Try: dotnet restore $CliProject --verbosity detailed --ignore-failed-sources" | |
| Fail "Try: dotnet restore `"$CliProject`" --verbosity detailed --ignore-failed-sources" |
| Write-Host "" | ||
| Write-Host " Usage:" | ||
| Write-Host " dotnet run --project $DotnetDir\MiniMaxAIDocx.Cli -- create --type report --output my_report.docx" | ||
| Write-Host " dotnet run --project $CliProject -- create --type report --output my_report.docx" |
There was a problem hiding this comment.
The “Usage” line prints dotnet run --project $CliProject ... without quoting the path. While the script invocation uses a variable (safe), this printed guidance will break when copy/pasted if the path contains spaces. Consider printing it as --project "$CliProject".
| Write-Host " dotnet run --project $CliProject -- create --type report --output my_report.docx" | |
| Write-Host " dotnet run --project `"$CliProject`" -- create --type report --output my_report.docx" |
| [ -n "$source" ] || continue | ||
| RESTORE_SOURCE_ARGS+=("--source" "$source") | ||
| RESTORE_SOURCE_LABELS+=("$source") | ||
| done |
There was a problem hiding this comment.
If MINIMAX_DOCX_NUGET_SOURCES is set but contains only whitespace/empty entries (e.g., '; ;'), this branch runs yet produces an empty RESTORE_SOURCE_ARGS, so restore falls back to whatever NuGet.Config provides while logs still claim “Using custom restore source(s)”. Consider filtering first and, if no valid sources remain, either fail with a clear message or fall back to the default + auto-detected local feeds.
| done | |
| done | |
| # If MINIMAX_DOCX_NUGET_SOURCES was set but yielded no valid entries, | |
| # fall back to the default + local feeds to avoid an empty source set. | |
| if [ "${#RESTORE_SOURCE_ARGS[@]}" -eq 0 ]; then | |
| warn "MINIMAX_DOCX_NUGET_SOURCES is set but contains no valid sources; falling back to default NuGet sources." | |
| RESTORE_SOURCE_ARGS+=("--source" "$DEFAULT_NUGET_SOURCE") | |
| RESTORE_SOURCE_LABELS+=("$DEFAULT_NUGET_SOURCE") | |
| local local_feed | |
| for local_feed in "$DOTNET_DIR/packages" "$PROJECT_DIR/assets/nuget"; do | |
| if [ -d "$local_feed" ]; then | |
| RESTORE_SOURCE_ARGS+=("--source" "$local_feed") | |
| RESTORE_SOURCE_LABELS+=("$local_feed") | |
| fi | |
| done | |
| fi |
What
minimax-docxby targetingMiniMaxAIDocx.Cli.csprojdirectly instead of relying on the repo directory /.slnxfileMINIMAX_DOCX_NUGET_SOURCESsupport plus auto-detected local feed directories for restricted-network installsSKILL.mdWhy
env_check.shandsetup.shcurrently fail ondotnet 8.xbecause the repo contains a.slnxfile, and invokingdotnet restoreagainst the directory does not work there. That blocks installation even whennuget.orgis reachable, and it makes issue #23 much harder to diagnose in sandboxed environments.This PR is scoped to a single bug fix in
minimax-docx: make restore/build reliable on current .NET SDKs and provide a supported path for restricted-network installs.Fixes #23
Verification
bash skills/minimax-docx/scripts/env_check.shbash skills/minimax-docx/scripts/setup.sh --minimal --skip-verifypython3 .claude/skills/pr-review/scripts/validate_skills.py