Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{cs,csx}]
indent_style = space
indent_size = 4

[*.{csproj,props,targets,slnx,xml}]
indent_style = space
indent_size = 2

[*.{json,yml,yaml,md,sh,toml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.cs text eol=lf
*.csproj text eol=lf
*.props text eol=lf
*.targets text eol=lf
*.sln text eol=lf
*.slnx text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.md text eol=lf
*.sh text eol=lf
*.toml text eol=lf
.editorconfig text eol=lf
Makefile text eol=lf
16 changes: 16 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ jobs:
throw "High or critical NuGet vulnerability detected."
}

- name: Verify formatting
run: dotnet format CodeIndex.sln --verify-no-changes --no-restore --verbosity minimal

- name: Verify developer task wrapper
if: matrix.os == 'ubuntu-latest' && matrix.test-framework == 'net8.0'
run: make lint

- name: Build
run: dotnet build tests/CodeIndex.Tests/CodeIndex.Tests.csproj --configuration Release --framework ${{ matrix.test-framework }} --no-restore

Expand All @@ -192,6 +199,7 @@ jobs:
"--no-build",
"--nologo",
"--settings", "tests/CodeIndex.Tests/CodeIndex.Tests.runsettings",
"--collect", "XPlat Code Coverage",
"--blame-crash",
"--blame-hang",
"--blame-hang-timeout", "5m",
Expand Down Expand Up @@ -237,6 +245,14 @@ jobs:
TestResults/**/*Sequence*.xml
TestResults/**/*.hangdump

- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Coverage-${{ matrix.os }}-${{ matrix.test-framework }}
if-no-files-found: warn
path: TestResults/**/coverage.cobertura.xml

- name: Publish
if: matrix.os == 'ubuntu-latest' && matrix.test-framework == 'net8.0'
run: dotnet publish src/CodeIndex/CodeIndex.csproj --configuration Release --no-build --output publish
Expand Down
12 changes: 7 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ Before opening a pull request, run the checks that match the change. For code
changes, the default full validation is:

```bash
dotnet restore CodeIndex.sln
dotnet build CodeIndex.sln -c Release
dotnet test CodeIndex.sln -c Release
make lint
make build
make test
```

Use narrower `dotnet test --filter ...` commands while iterating, then finish
with the relevant broader validation before the PR.
Set `FRAMEWORK=net9.0` when you need to match that CI lane, or call
`./dev.sh <task>` directly on systems without `make`. Use narrower
`dotnet test --filter ...` commands while iterating, then finish with the
relevant broader validation before the PR.

## Changelog Fragments

Expand Down
21 changes: 21 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,31 @@
```bash
dotnet build
dotnet test
dotnet format CodeIndex.sln --verify-no-changes
dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --settings tests/CodeIndex.Tests/CodeIndex.Tests.runsettings --blame-crash --blame-hang --blame-hang-timeout 5m
dotnet run --project src/CodeIndex -- <command> [options]
```

CI enforces repository formatting with `.editorconfig` and treats compiler
warnings as errors through `Directory.Build.props`, so local changes should pass
the format check before opening a PR. Existing trim-analysis warnings are
explicitly listed in `WarningsNotAsErrors` until they are fixed without blocking
ordinary compiler-warning enforcement, and ILLink keeps reporting trim warnings
without failing trimmed publish smoke tests.

Common local workflows are also available through the top-level task wrappers:

```bash
make build
make test
make lint
make coverage
make mcp-smoke
```

Use `FRAMEWORK=net9.0 make test` to match the net9 CI lane. On systems without
`make`, run the same tasks as `./dev.sh build`, `./dev.sh test`, and so on.

CLI help is intentionally layered: `cdidx --help` stays brief, `cdidx --help-all`
prints the full command/flag/example reference, `cdidx --help-flags` prints only
shared flag tables, and `cdidx <command> --help` prints one command's usage
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
詳細は DEVELOPER_GUIDE.md および issue #1556 を参照。
-->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);IL2026;IL2067;IL2072;IL2075</WarningsNotAsErrors>
<ILLinkTreatWarningsAsErrors>false</ILLinkTreatWarningsAsErrors>
</PropertyGroup>

</Project>
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CONFIGURATION ?= Release
FRAMEWORK ?= net8.0

.PHONY: build test lint format coverage mcp-smoke clean

build:
CONFIGURATION="$(CONFIGURATION)" FRAMEWORK="$(FRAMEWORK)" ./dev.sh build

test:
CONFIGURATION="$(CONFIGURATION)" FRAMEWORK="$(FRAMEWORK)" ./dev.sh test

lint:
./dev.sh lint

format:
./dev.sh format

coverage:
CONFIGURATION="$(CONFIGURATION)" FRAMEWORK="$(FRAMEWORK)" ./dev.sh coverage

mcp-smoke:
CONFIGURATION="$(CONFIGURATION)" ./dev.sh mcp-smoke

clean:
CONFIGURATION="$(CONFIGURATION)" ./dev.sh clean
15 changes: 15 additions & 0 deletions changelog.d/unreleased/1608.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
category: fixed
issues:
- 1608
affected:
- .github/workflows/dotnet.yml
---

## English

- **CI now collects coverage reports (#1608)** — the build workflow runs tests with the XPlat Code Coverage collector and uploads Cobertura reports as per-lane artifacts.

## 日本語

- **CI が coverage report を収集するようになりました (#1608)** — build workflow は XPlat Code Coverage collector 付きでテストを実行し、Cobertura report を lane ごとの artifact としてアップロードします。
19 changes: 19 additions & 0 deletions changelog.d/unreleased/1609.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
category: internal
issues:
- 1609
affected:
- .gitattributes
- .editorconfig
- Directory.Build.props
- .github/workflows/dotnet.yml
- DEVELOPER_GUIDE.md
---

## English

- **Formatting and warning drift are now gated (#1609)** — the repository has root formatting metadata, CI verifies `dotnet format`, and builds treat compiler warnings as errors with an explicit allowlist for existing trim-analysis warnings.

## 日本語

- **format と warning の drift を CI で検出するようになりました (#1609)** — repository root に format metadata を追加し、CI が `dotnet format` を検証し、build では既存の trim-analysis warning を明示 allowlist に入れたうえで compiler warning を error として扱います。
19 changes: 19 additions & 0 deletions changelog.d/unreleased/1611.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
category: internal
issues:
- 1611
affected:
- Makefile
- dev.sh
- .github/workflows/dotnet.yml
- CONTRIBUTING.md
- DEVELOPER_GUIDE.md
---

## English

- **Common developer tasks now have shared wrappers (#1611)** — contributors can run build, test, lint, format, coverage, MCP smoke, and clean tasks through `make` or `./dev.sh`, and CI verifies the wrapper path.

## 日本語

- **共通の開発タスクに共有 wrapper を追加しました (#1611)** — contributor は build / test / lint / format / coverage / MCP smoke / clean を `make` または `./dev.sh` から実行でき、CI でも wrapper 経路を検証します。
68 changes: 68 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -euo pipefail

CONFIGURATION="${CONFIGURATION:-Release}"
FRAMEWORK="${FRAMEWORK:-net8.0}"
RESULTS_DIRECTORY="${RESULTS_DIRECTORY:-./TestResults}"

usage() {
cat <<'USAGE'
Usage: ./dev.sh <task>

Tasks:
build Build the test project for FRAMEWORK.
test Run the test suite for FRAMEWORK.
lint Verify formatting without changing files.
format Apply dotnet format.
coverage Run tests with XPlat Code Coverage.
mcp-smoke Run a minimal MCP help/build smoke.
clean Clean build outputs and local test artifacts.
USAGE
}

task="${1:-}"
case "$task" in
build)
dotnet build tests/CodeIndex.Tests/CodeIndex.Tests.csproj \
--configuration "$CONFIGURATION" \
--framework "$FRAMEWORK"
;;
test)
dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj \
--configuration "$CONFIGURATION" \
--framework "$FRAMEWORK" \
--settings tests/CodeIndex.Tests/CodeIndex.Tests.runsettings \
--blame-crash \
--blame-hang \
--blame-hang-timeout 5m
;;
lint)
dotnet format CodeIndex.sln --verify-no-changes --verbosity minimal
;;
format)
dotnet format CodeIndex.sln --verbosity minimal
;;
coverage)
dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj \
--configuration "$CONFIGURATION" \
--framework "$FRAMEWORK" \
--settings tests/CodeIndex.Tests/CodeIndex.Tests.runsettings \
--collect "XPlat Code Coverage" \
--results-directory "$RESULTS_DIRECTORY"
;;
mcp-smoke)
dotnet build src/CodeIndex/CodeIndex.csproj --configuration "$CONFIGURATION"
dotnet run --project src/CodeIndex -- mcp --help > /dev/null
;;
clean)
dotnet clean CodeIndex.sln --configuration "$CONFIGURATION"
rm -rf "$RESULTS_DIRECTORY" publish
;;
-h|--help|help|"")
usage
;;
*)
usage >&2
exit 2
;;
esac
52 changes: 26 additions & 26 deletions src/CodeIndex/Cli/ConsoleUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,55 +320,55 @@ public static string[] GetSpinnerFrames(string? easterEgg)

return easterEgg switch
{
"--sushi" =>
[
"\U0001f363 Slicing ", "\U0001f363 Slicing. ", "\U0001f363 Slicing.. ", "\U0001f363 Slicing... ",
"--sushi" =>
[
"\U0001f363 Slicing ", "\U0001f363 Slicing. ", "\U0001f363 Slicing.. ", "\U0001f363 Slicing... ",
"\U0001f363 Shaping ", "\U0001f363 Shaping. ", "\U0001f363 Shaping.. ", "\U0001f363 Shaping... ",
"\U0001f363 Pressing ", "\U0001f363 Pressing. ", "\U0001f363 Pressing.. ", "\U0001f363 Pressing... ",
"\U0001f363 Itadakimasu! ",
],
"--coffee" =>
[
"\u2615 Grinding ", "\u2615 Grinding. ", "\u2615 Grinding.. ", "\u2615 Grinding... ",
"--coffee" =>
[
"\u2615 Grinding ", "\u2615 Grinding. ", "\u2615 Grinding.. ", "\u2615 Grinding... ",
"\u2615 Heating ", "\u2615 Heating. ", "\u2615 Heating.. ", "\u2615 Heating... ",
"\u2615 Brewing ", "\u2615 Brewing. ", "\u2615 Brewing.. ", "\u2615 Brewing... ",
],
"--ramen" =>
[
"\U0001f35c Boiling ", "\U0001f35c Boiling. ", "\U0001f35c Boiling.. ", "\U0001f35c Boiling... ",
"--ramen" =>
[
"\U0001f35c Boiling ", "\U0001f35c Boiling. ", "\U0001f35c Boiling.. ", "\U0001f35c Boiling... ",
"\U0001f35c Steaming ", "\U0001f35c Steaming. ", "\U0001f35c Steaming.. ", "\U0001f35c Steaming... ",
"\U0001f35c Slurping ", "\U0001f35c Slurping. ", "\U0001f35c Slurping.. ", "\U0001f35c Slurping... ",
"\U0001f35c Itadakimasu! ",
],
"--wine" =>
[
"\U0001f377 Crushing ", "\U0001f377 Crushing. ", "\U0001f377 Crushing.. ", "\U0001f377 Crushing... ",
"--wine" =>
[
"\U0001f377 Crushing ", "\U0001f377 Crushing. ", "\U0001f377 Crushing.. ", "\U0001f377 Crushing... ",
"\U0001f377 Aging ", "\U0001f377 Aging. ", "\U0001f377 Aging.. ", "\U0001f377 Aging... ",
"\U0001f377 Pouring ", "\U0001f377 Pouring. ", "\U0001f377 Pouring.. ", "\U0001f377 Pouring... ",
"\U0001f377 Sant\u00e9! ",
],
"--beer" =>
[
"\U0001f37a Tapping ", "\U0001f37a Tapping. ", "\U0001f37a Tapping.. ", "\U0001f37a Tapping... ",
"--beer" =>
[
"\U0001f37a Tapping ", "\U0001f37a Tapping. ", "\U0001f37a Tapping.. ", "\U0001f37a Tapping... ",
"\U0001f37a Pouring ", "\U0001f37a Pouring. ", "\U0001f37a Pouring.. ", "\U0001f37a Pouring... ",
"\U0001f37a Foaming ", "\U0001f37a Foaming. ", "\U0001f37a Foaming.. ", "\U0001f37a Foaming... ",
"\U0001f37a Cheers! ",
],
"--matcha" =>
[
"\U0001f375 Sifting ", "\U0001f375 Sifting. ", "\U0001f375 Sifting.. ", "\U0001f375 Sifting... ",
"--matcha" =>
[
"\U0001f375 Sifting ", "\U0001f375 Sifting. ", "\U0001f375 Sifting.. ", "\U0001f375 Sifting... ",
"\U0001f375 Pouring ", "\U0001f375 Pouring. ", "\U0001f375 Pouring.. ", "\U0001f375 Pouring... ",
"\U0001f375 Whisking ", "\U0001f375 Whisking. ", "\U0001f375 Whisking.. ", "\U0001f375 Whisking... ",
"\U0001f375 Douzo! ",
],
"--whisky" =>
[
"\U0001f943 Mashing ", "\U0001f943 Mashing. ", "\U0001f943 Mashing.. ", "\U0001f943 Mashing... ",
"--whisky" =>
[
"\U0001f943 Mashing ", "\U0001f943 Mashing. ", "\U0001f943 Mashing.. ", "\U0001f943 Mashing... ",
"\U0001f943 Distilling ", "\U0001f943 Distilling. ", "\U0001f943 Distilling.. ", "\U0001f943 Distilling... ",
"\U0001f943 Aging ", "\U0001f943 Aging. ", "\U0001f943 Aging.. ", "\U0001f943 Aging... ",
"\U0001f943 Slainte! ",
],
// Default: Braille spinner / デフォルト: ブレイルスピナー
// Default: Braille spinner / デフォルト: ブレイルスピナー
_ => DefaultBrailleSpinnerFrames,
};
}
Expand Down Expand Up @@ -594,11 +594,11 @@ public static void PrintEasterEggMessage(string flag, UiLanguage? languageOverri
{
var pair = flag switch
{
"--sushi" => UiMessages.EasterEggSushi,
"--sushi" => UiMessages.EasterEggSushi,
"--coffee" => UiMessages.EasterEggCoffee,
"--ramen" => UiMessages.EasterEggRamen,
"--wine" => UiMessages.EasterEggWine,
"--beer" => UiMessages.EasterEggBeer,
"--ramen" => UiMessages.EasterEggRamen,
"--wine" => UiMessages.EasterEggWine,
"--beer" => UiMessages.EasterEggBeer,
"--matcha" => UiMessages.EasterEggMatcha,
"--whisky" => UiMessages.EasterEggWhisky,
_ => null,
Expand Down
Loading
Loading