Skip to content

Commit 5c4767c

Browse files
committed
Significant updates to copilot instructions infrastructure.
Docker image build fieldworks Don't allow forceable resetting of git-worktrees
1 parent 713483c commit 5c4767c

75 files changed

Lines changed: 3719 additions & 723 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Build outputs
2+
Output/
3+
Obj/
4+
bin/
5+
obj/
6+
*.user
7+
8+
# Test results
9+
TestResults/
10+
11+
# NuGet packages
12+
packages/
13+
.nuget/
14+
15+
# Git
16+
.git/
17+
.github/
18+
.gitignore
19+
.gitattributes
20+
21+
# Visual Studio
22+
.vs/
23+
*.suo
24+
*.sln.docstates
25+
26+
# Documentation and analysis files
27+
*.md
28+
!ReadMe.md
29+
COPILOT.md
30+
*.prompt.md
31+
BUILD_CHALLENGES_ANALYSIS.md
32+
CLARIFICATIONS-NEEDED.md
33+
COMPREHENSIVE_COMMIT_ANALYSIS.md
34+
CONVERGENCE-FRAMEWORK.md
35+
CONVERGENCE-STATUS.md
36+
DEEP_COMMIT_ANALYSIS.md
37+
DLL_MODERNIZATION_PLAN.md
38+
LEGACY_REMOVAL_SUMMARY.md
39+
MIGRATION_DOCS_INDEX.md
40+
MIGRATION_FIXES_SUMMARY.md
41+
MIGRATION_SUMMARY_BY_PHASE.md
42+
NON_SDK_ELIMINATION.md
43+
NUNIT4_CONVERSION_SUMMARY.md
44+
PACKAGE_MANAGEMENT_QUICKSTART.md
45+
RHINOMOCKS_TO_MOQ_MIGRATION.md
46+
SDK-MIGRATION.md
47+
TRAVERSAL_SDK_IMPLEMENTATION.md
48+
49+
# Test projects and data
50+
TestLangProj/
51+
specs/
52+
53+
# Vagrant
54+
vagrant/
55+
56+
# Python scripts (not needed in container)
57+
*.py
58+
59+
# Docs
60+
Docs/
61+
62+
# Resources (will copy specific ones if needed)
63+
resources/
64+
65+
# Scripts (not needed for Docker build)
66+
scripts/
67+
68+
# FLExInstaller (not building installer in container)
69+
FLExInstaller/
70+
71+
# Sample/test code
72+
Samples/
73+
74+
# Large binary files
75+
*.exe
76+
!DistFiles/**/*.exe
77+
*.dll
78+
!DistFiles/**/*.dll
79+
*.pdb
80+
*.lib
81+
*.exp
82+
83+
# Temporary files
84+
*.tmp
85+
*.log
86+
*.bak
87+
*~

.github/copilot-instructions.md

Lines changed: 86 additions & 212 deletions
Large diffs are not rendered by default.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
applyTo: "Src/AppCore/**"
3+
name: "appcore.instructions"
4+
description: "Auto-generated concise instructions from COPILOT.md for AppCore"
5+
---
6+
7+
# AppCore (Concise)
8+
9+
## Purpose & Scope
10+
Summarized key points from COPILOT.md
11+
12+
## Key Rules
13+
- **AfGfx** class (AfGfx.h/cpp): Static utility methods for Windows GDI operations
14+
- `LoadSysColorBitmap()`: Loads system-colored bitmaps from resources
15+
- `FillSolidRect()`: Fills rectangle with solid color using palette
16+
- `InvertRect()`, `CreateSolidBrush()`: Rectangle inversion and brush creation
17+
- `SetBkColor()`, `SetTextColor()`: Palette-aware color setting
18+
- `DrawBitMap()`: Bitmap drawing with source/dest rectangles
19+
20+
## Example (from summary)
21+
22+
---
23+
last-reviewed: 2025-10-31
24+
last-reviewed-tree: d533214a333e8de29f0eaa52ed6bbffd80815cfb0f1f3fac15cd08b96aafb15e
25+
status: draft
26+
---
27+
28+
# AppCore COPILOT summary
29+
30+
## Purpose
31+
Provides Windows GDI wrapper classes and graphics utilities for FieldWorks native applications. Includes device context management (SmartDc), GDI object wrappers (FontWrap, BrushWrap, PenWrap, RgnWrap), color palette support (ColorTable with 40 predefined colors, SmartPalette), and writing system style inheritance utilities (FwStyledText namespace). These utilities abstract Windows graphics APIs and provide consistent rendering behavior across FieldWorks.
32+
33+
## Architecture
34+
C++ native header-only library. Headers and implementation files are designed to be included into consumer projects (primarily views) via include search paths rather than built as a standalone library. The code provides three major areas: graphics primitives and GDI abstractions (AfGfx, AfGdi), styled text property management (FwStyledText namespace), and color management (ColorTable global singleton).
35+
36+
## Key Components
37+
- **AfGfx** class (AfGfx.h/cpp): Static utility methods for Windows GDI operations
38+
- `LoadSysColorBitmap()`: Loads system-colored bitmaps from resources
39+
- `FillSolidRect()`: Fills rectangle with solid color using palette
40+
- `InvertRect()`, `CreateSolidBrush()`: Rectangle inversion and brush creation
41+
- `SetBkColor()`, `SetTextColor()`: Palette-aware color setting
42+
- `DrawBitMap()`: Bitmap drawing with source/dest rectangles
43+
- `EnsureVisibleRect()`: Validates/adjusts rectangle visibility
44+
- **AfGdi** class (AfGfx.h): Tracked wrappers for GDI resource creation/destruction with leak detection
45+
- Device context tracking: `CreateDC()`, `CreateCompatibleDC()`, `DeleteDC()`, `GetDC()`, `ReleaseDC()`
46+
- Font tracking: `CreateFont()`, `CreateFontIndirect()`, `DeleteObject()` with s_cFonts counter
47+
- GDI object tracking: `CreatePen()`, `CreateBrush()`, `SelectObject()` with debug counters
48+
- Debug flags: `s_fSh

.github/instructions/build.instructions.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
---
22
applyTo: "**/*"
3+
name: "build.instructions"
34
description: "FieldWorks build guidelines and inner-loop tips"
45
---
56
# Build guidelines and inner-loop tips
67

8+
## Purpose & Scope
9+
This file describes the build system and inner-loop tips for developers working on FieldWorks. Use it for top-level build instructions, not for project-specific guidance.
10+
711
## Quick Start
812

913
FieldWorks uses the **MSBuild Traversal SDK** for declarative build ordering. All builds use `FieldWorks.proj`.
@@ -63,10 +67,11 @@ Error: Cannot generate Views.cs without native artifacts.
6367
Run: msbuild Build\Src\NativeBuild\NativeBuild.csproj
6468
```
6569

66-
## Context loading
67-
- Always initialize the environment when using scripts: `source ./environ`.
68-
- The build system automatically sets up VS Developer Environment if needed.
69-
- Environment variables (`fwrt`, `Platform`, etc.) are set by `SetupInclude.targets`.
70+
## Developer environment setup
71+
72+
- On Windows: Use `.\build.ps1` (automatically sets up VS Developer Environment) or open a Developer Command Prompt for Visual Studio before running manual `msbuild` commands.
73+
- On Linux/macOS: Use `./build.sh` and ensure `msbuild`, `dotnet`, and native build tools are installed.
74+
- Environment variables (`fwrt`, `Platform`, etc.) are set by `SetupInclude.targets` during build.
7075

7176
## Deterministic requirements
7277

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
description: 'C++ project configuration and package management'
3+
applyTo: '**/*.cmake, **/CMakeLists.txt, **/*.cpp, **/*.h, **/*.hpp'
4+
name: 'cmake-vcpkg.instructions'
5+
---
6+
7+
## Purpose & Scope
8+
This file captures vcpkg and CMake practices for the native C++ projects and helps Copilot make sensible recommendations.
9+
10+
This project uses vcpkg in manifest mode. Please keep this in mind when giving vcpkg suggestions. Do not provide suggestions like vcpkg install library, as they will not work as expected.
11+
Prefer setting cache variables and other types of things through CMakePresets.json if possible.
12+
Give information about any CMake Policies that might affect CMake variables that are suggested or mentioned.
13+
This project needs to be cross-platform and cross-compiler for MSVC, Clang, and GCC.
14+
When providing OpenCV samples that use the file system to read files, please always use absolute file paths rather than file names, or relative file paths. For example, use `video.open("C:/project/file.mp4")`, not `video.open("file.mp4")`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
applyTo: "Src/Common/**"
3+
name: "common.instructions"
4+
description: "Key conventions and integration points for the Common project."
5+
---
6+
7+
# Common Library Guidelines
8+
9+
## Purpose & Scope
10+
- Document public utility contracts, expected threading model, and test patterns for `Src/Common`.
11+
12+
## Conventions
13+
- Keep public API surface minimal and stable; add unit tests for contract changes.
14+
- Avoid adding heavy dependencies to Common; favor small, well-defined helper functions.
15+
16+
## Examples
17+
```csharp
18+
// Good: small, well-defined helper public API
19+
public static string NormalizePath(string path) => Path.GetFullPath(path);
20+
```
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
applyTo: '**/*.cs'
3+
name: 'csharp.instructions'
4+
description: 'Guidelines for building C# applications'
5+
---
6+
7+
# C# Development
8+
9+
## Purpose & Scope
10+
Provide concise C# conventions and style rules to keep code consistent across the repository.
11+
12+
## C# Instructions
13+
- Always use the latest version C#, currently C# 14 features.
14+
- Write clear and concise comments for each function.
15+
16+
## General Instructions
17+
- Make only high confidence suggestions when reviewing code changes.
18+
- Write code with good maintainability practices, including comments on why certain design decisions were made.
19+
- Handle edge cases and write clear exception handling.
20+
- For libraries or external dependencies, mention their usage and purpose in comments.
21+
22+
## Naming Conventions
23+
24+
- Follow PascalCase for component names, method names, and public members.
25+
- Use camelCase for private fields and local variables.
26+
- Prefix interface names with "I" (e.g., IUserService).
27+
28+
## Formatting
29+
30+
- Apply code-formatting style defined in `.editorconfig`.
31+
- Prefer file-scoped namespace declarations and single-line using directives.
32+
- Insert a newline before the opening curly brace of any code block (e.g., after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.).
33+
- Ensure that the final return statement of a method is on its own line.
34+
- Use pattern matching and switch expressions wherever possible.
35+
- Use `nameof` instead of string literals when referring to member names.
36+
- Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments.
37+
38+
## Project Setup and Structure
39+
40+
- Guide users through creating a new .NET project with the appropriate templates.
41+
- Explain the purpose of each generated file and folder to build understanding of the project structure.
42+
- Demonstrate how to organize code using feature folders or domain-driven design principles.
43+
- Show proper separation of concerns with models, services, and data access layers.
44+
- Explain the Program.cs and configuration system in ASP.NET Core 10 including environment-specific settings.
45+
46+
## Nullable Reference Types
47+
48+
- Declare variables non-nullable, and check for `null` at entry points.
49+
- Always use `is null` or `is not null` instead of `== null` or `!= null`.
50+
- Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.
51+
52+
## Data Access Patterns
53+
54+
- Guide the implementation of a data access layer using Entity Framework Core.
55+
- Explain different options (SQL Server, SQLite, In-Memory) for development and production.
56+
- Demonstrate repository pattern implementation and when it's beneficial.
57+
- Show how to implement database migrations and data seeding.
58+
- Explain efficient query patterns to avoid common performance issues.
59+
60+
## Authentication and Authorization
61+
62+
- Guide users through implementing authentication using JWT Bearer tokens.
63+
- Explain OAuth 2.0 and OpenID Connect concepts as they relate to ASP.NET Core.
64+
- Show how to implement role-based and policy-based authorization.
65+
- Demonstrate integration with Microsoft Entra ID (formerly Azure AD).
66+
- Explain how to secure both controller-based and Minimal APIs consistently.
67+
68+
## Validation and Error Handling
69+
70+
- Guide the implementation of model validation using data annotations and FluentValidation.
71+
- Explain the validation pipeline and how to customize validation responses.
72+
- Demonstrate a global exception handling strategy using middleware.
73+
- Show how to create consistent error responses across the API.
74+
- Explain problem details (RFC 7807) implementation for standardized error responses.
75+
76+
## API Versioning and Documentation
77+
78+
- Guide users through implementing and explaining API versioning strategies.
79+
- Demonstrate Swagger/OpenAPI implementation with proper documentation.
80+
- Show how to document endpoints, parameters, responses, and authentication.
81+
- Explain versioning in both controller-based and Minimal APIs.
82+
- Guide users on creating meaningful API documentation that helps consumers.
83+
84+
## Logging and Monitoring
85+
86+
- Guide the implementation of structured logging using Serilog or other providers.
87+
- Explain the logging levels and when to use each.
88+
- Demonstrate integration with Application Insights for telemetry collection.
89+
- Show how to implement custom telemetry and correlation IDs for request tracking.
90+
- Explain how to monitor API performance, errors, and usage patterns.
91+
92+
## Testing
93+
94+
- Always include test cases for critical paths of the application.
95+
- Guide users through creating unit tests.
96+
- Do not emit "Act", "Arrange" or "Assert" comments.
97+
- Copy existing style in nearby files for test method names and capitalization.
98+
- Explain integration testing approaches for API endpoints.
99+
- Demonstrate how to mock dependencies for effective testing.
100+
- Show how to test authentication and authorization logic.
101+
- Explain test-driven development principles as applied to API development.
102+
103+
## Performance Optimization
104+
105+
- Guide users on implementing caching strategies (in-memory, distributed, response caching).
106+
- Explain asynchronous programming patterns and why they matter for API performance.
107+
- Demonstrate pagination, filtering, and sorting for large data sets.
108+
- Show how to implement compression and other performance optimizations.
109+
- Explain how to measure and benchmark API performance.
110+
111+
## Deployment and DevOps
112+
113+
- Guide users through containerizing their API using .NET's built-in container support (`dotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer`).
114+
- Explain the differences between manual Dockerfile creation and .NET's container publishing features.
115+
- Explain CI/CD pipelines for NET applications.
116+
- Demonstrate deployment to Azure App Service, Azure Container Apps, or other hosting options.
117+
- Show how to implement health checks and readiness probes.
118+
- Explain environment-specific configurations for different deployment stages.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
applyTo: "Src/Common/FieldWorks/**"
3+
name: "fieldworks.instructions"
4+
description: "Auto-generated concise instructions from COPILOT.md for FieldWorks"
5+
---
6+
7+
# FieldWorks (Concise)
8+
9+
## Purpose & Scope
10+
Summarized key points from COPILOT.md
11+
12+
## Key Rules
13+
- **FieldWorks** class (FieldWorks.cs): Main application singleton
14+
- Manages application lifecycle and FwApp instances
15+
- Handles project selection, opening, and closing
16+
- Coordinates window creation and management
17+
- Provides LcmCache access
18+
- Main entry point: OutputType=WinExe
19+
20+
## Example (from summary)
21+
22+
---
23+
last-reviewed: 2025-10-31
24+
last-reviewed-tree: 02736fd2ef91849ac9b0a8f07f2043ff2e3099bbab520031f8b27b4fe42a33cf
25+
status: draft
26+
---
27+
28+
# FieldWorks COPILOT summary
29+
30+
## Purpose
31+
Core FieldWorks-specific application infrastructure and utilities providing fundamental application services. Includes project management (FieldWorksManager interface, ProjectId for project identification), settings management (FwRestoreProjectSettings for backup restoration), application startup coordination (WelcomeToFieldWorksDlg, FieldWorks main class), busy state handling (ApplicationBusyDialog), Windows installer querying (WindowsInstallerQuery), remote request handling (RemoteRequest), lexical service provider integration (ILexicalProvider, LexicalServiceProvider), and Phonology Assistant integration objects (PaObjects/ namespace). Central to coordinating application lifecycle, managing shared resources, and enabling interoperability across FieldWorks applications.
32+
33+
## Architecture
34+
C# Windows executable (WinExe) targeting .NET Framework 4.8.x. Main entry point for FieldWorks application launcher. Contains FieldWorks singleton class managing application lifecycle, project opening/closing, and window management. Includes three specialized namespaces: LexicalProvider/ for lexicon service integration, PaObjects/ for Phonology Assistant data transfer objects, and main SIL.FieldWorks namespace for core infrastructure. Test project (FieldWorksTests) provides unit tests for project ID, PA objects, and welcome dialog.
35+
36+
## Key Components
37+
- **FieldWorks** class (FieldWorks.cs): Main application singleton
38+
- Manages application lifecycle and FwApp instances
39+
- Handles project selection, opening, and closing
40+
- Coordinates window creation and management
41+
- Provides LcmCache access
42+
- Main entry point: OutputType=WinExe
43+
- **FieldWorksManager** class (FieldWorksManager.cs): IFieldWorksManager implementation
44+
- Pass-through facade ensuring single FieldWorks instance per process
45+
- `Cache` propert

0 commit comments

Comments
 (0)