Skip to content

fix(minimax-docx): restore the CLI project directly#24

Open
JithendraNara wants to merge 2 commits intoMiniMax-AI:mainfrom
JithendraNara:codex/fix-minimax-docx-restore
Open

fix(minimax-docx): restore the CLI project directly#24
JithendraNara wants to merge 2 commits intoMiniMax-AI:mainfrom
JithendraNara:codex/fix-minimax-docx-restore

Conversation

@JithendraNara
Copy link
Copy Markdown
Contributor

@JithendraNara JithendraNara commented Mar 25, 2026

What

  • restore and build minimax-docx by targeting MiniMaxAIDocx.Cli.csproj directly instead of relying on the repo directory / .slnx file
  • add MINIMAX_DOCX_NUGET_SOURCES support plus auto-detected local feed directories for restricted-network installs
  • document the restricted-network and offline NuGet path in SKILL.md

Why

env_check.sh and setup.sh currently fail on dotnet 8.x because the repo contains a .slnx file, and invoking dotnet restore against the directory does not work there. That blocks installation even when nuget.org is 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.sh
  • bash skills/minimax-docx/scripts/setup.sh --minimal --skip-verify
  • python3 .claude/skills/pr-review/scripts/validate_skills.py

Copilot AI review requested due to automatic review settings March 25, 2026 16:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.csproj explicitly.
  • 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.

Comment on lines +328 to +330
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'"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines 518 to 519
echo " dotnet run --project $CLI_PROJECT -- create --type report --output my_report.docx"
echo " bash $SCRIPT_DIR/env_check.sh # Quick environment check"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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"

Copilot uses AI. Check for mistakes.
[ -n "$source" ] || continue
RESTORE_SOURCE_ARGS+=("--source" "$source")
RESTORE_SOURCE_LABELS+=("$source")
done
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
if ($trimmed) {
$sources += $trimmed
}
}
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
}
}
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
}
}
}

Copilot uses AI. Check for mistakes.
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"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
Fail "Try: dotnet restore $CliProject --verbosity detailed --ignore-failed-sources"
Fail "Try: dotnet restore `"$CliProject`" --verbosity detailed --ignore-failed-sources"

Copilot uses AI. Check for mistakes.
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"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Suggested change
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"

Copilot uses AI. Check for mistakes.
[ -n "$source" ] || continue
RESTORE_SOURCE_ARGS+=("--source" "$source")
RESTORE_SOURCE_LABELS+=("$source")
done
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[minimax-docx] 部署问题:api.nuget.org 在沙盒/内网环境下无法访问,导致安装失败

2 participants