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
117 changes: 74 additions & 43 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: build-and-release

# Builds the x64 plugin, runs the Catch2 test suite, and packages a
# Plugins-Admin-ready zip.
# Builds the plugin for x64, x86 (Win32) and ARM64 Notepad++, runs the Catch2
# test suite, and packages one Plugins-Admin-ready zip per architecture.
#
# * push / PR -> build + test + upload the zip as a CI artifact
# * push a "v*" tag -> additionally publish a GitHub Release with the zip
# and print the SHA-256 needed for the nppPluginList PR
# * push / PR -> build + test + upload the zips as CI artifacts
# * push a "v*" tag -> additionally publish a GitHub Release with the zips
# and print the SHA-256 needed for each nppPluginList PR
#
# The DLL is placed at the ROOT of the zip and named exactly LLMAssistant.dll,
# In each zip the DLL sits at the ROOT and is named exactly LLMAssistant.dll,
# which is what Notepad++ Plugins Admin requires.

on:
Expand Down Expand Up @@ -40,6 +40,25 @@ jobs:
/p:WindowsTargetPlatformVersion=10.0
/m

- name: Build plugin (Win32 Release)
run: >
msbuild LLMAssistant.vcxproj
/p:Configuration=Release
/p:Platform=Win32
/p:PlatformToolset=v143
/p:WindowsTargetPlatformVersion=10.0
/m

# The runner's v143 tools (MSVC 14.44) cover x64 and x86 only, so ARM64
# builds with the project's own toolset (v145).
- name: Build plugin (ARM64 Release)
run: >
msbuild LLMAssistant.vcxproj
/p:Configuration=Release
/p:Platform=ARM64
/p:WindowsTargetPlatformVersion=10.0
/m

- name: Configure tests (CMake)
run: cmake -S . -B CMakeBuild

Expand All @@ -49,7 +68,18 @@ jobs:
- name: Run tests
run: ctest --test-dir CMakeBuild --output-on-failure -C Debug

- name: Package Plugins-Admin zip
# The 32-bit DLL compiles the same core code, so run the tests as 32-bit
# too. (The x64 runner can't run ARM64 binaries.)
- name: Configure tests (CMake, Win32)
run: cmake -S . -B CMakeBuild-Win32 -A Win32

- name: Build tests (Win32)
run: cmake --build CMakeBuild-Win32 --config Debug

- name: Run tests (Win32)
run: ctest --test-dir CMakeBuild-Win32 --output-on-failure -C Debug

- name: Package Plugins-Admin zips
id: package
shell: pwsh
run: |
Expand All @@ -58,52 +88,53 @@ jobs:
} else {
$ver = "dev"
}
$zip = "LLMAssistant_v${ver}_x64.zip"

# DLL must sit at the zip root and be named exactly LLMAssistant.dll.
Copy-Item "x64\Release\LLMAssistant.dll" ".\LLMAssistant.dll" -Force
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path ".\LLMAssistant.dll" -DestinationPath $zip -Force

$hash = (Get-FileHash $zip -Algorithm SHA256).Hash.ToUpper()
"zip=$zip" >> $env:GITHUB_OUTPUT
"version=$ver" >> $env:GITHUB_OUTPUT
"sha256=$hash" >> $env:GITHUB_OUTPUT
$notes = @(
'### Notepad++ Plugins Admin metadata',
'',
'Each Notepad++ architecture has its own plugin list in nppPluginList. `id` is the SHA-256 of that architecture''s zip.'
)
foreach ($platform in "x64", "x86", "arm64") {
# Checks the DLL's CPU type, version and Notepad++ exports, zips it
# as LLMAssistant.dll at the zip root, prints the zip's SHA-256, and
# returns the nppPluginList entry with that SHA-256 as "id".
$entry = & .\packaging\make-release-zip.ps1 -Platform $platform -Version $ver -OutDir dist
$notes += '', "Add / update this in ``src/pl.$platform.json``:", '', '```json', $entry, '```'
}

Write-Host "==============================================="
Write-Host "Package : $zip"
Write-Host "SHA-256 : $hash <-- use as \"id\" in pl.x64.json"
Write-Host "==============================================="
$notes | Set-Content dist\release-notes.md
$notes | Add-Content $env:GITHUB_STEP_SUMMARY
"version=$ver" >> $env:GITHUB_OUTPUT

- name: Upload CI artifact
- name: Upload CI artifact (x64)
uses: actions/upload-artifact@v4
with:
name: LLMAssistant-x64
path: ${{ steps.package.outputs.zip }}
path: dist/LLMAssistant_v${{ steps.package.outputs.version }}_x64.zip
if-no-files-found: error

- name: Upload CI artifact (x86)
uses: actions/upload-artifact@v4
with:
name: LLMAssistant-x86
path: dist/LLMAssistant_v${{ steps.package.outputs.version }}_x86.zip
if-no-files-found: error

- name: Upload CI artifact (arm64)
uses: actions/upload-artifact@v4
with:
name: LLMAssistant-arm64
path: dist/LLMAssistant_v${{ steps.package.outputs.version }}_arm64.zip
if-no-files-found: error

- name: Publish GitHub Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.package.outputs.zip }}
files: |
dist/LLMAssistant_v${{ steps.package.outputs.version }}_x64.zip
dist/LLMAssistant_v${{ steps.package.outputs.version }}_x86.zip
dist/LLMAssistant_v${{ steps.package.outputs.version }}_arm64.zip
fail_on_unmatched_files: true
generate_release_notes: true
body: |
### Notepad++ Plugins Admin metadata

Add / update this in `nppPluginList` (`src/pl.x64.json`):

```json
{
"folder-name": "LLMAssistant",
"display-name": "LLM Assistant",
"version": "${{ steps.package.outputs.version }}",
"id": "${{ steps.package.outputs.sha256 }}",
"repository": "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ steps.package.outputs.zip }}",
"description": "AI-powered text processing (enhance, translate, summarize, grammar, code) via the OpenAI API, directly inside Notepad++.",
"author": "Gvo87",
"homepage": "${{ github.server_url }}/${{ github.repository }}"
}
```

`id` is the SHA-256 of the attached zip: `${{ steps.package.outputs.sha256 }}`
body_path: dist/release-notes.md
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# x64 build directory
# Build directories (one per platform)
x64/
CMakeBuild/
Win32/
ARM64/
CMakeBuild*/
_deps/

# Release packaging output
Expand Down
13 changes: 9 additions & 4 deletions INSTALLATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
## Quick Start

### Step 1: Download
- Get the plugin file: `LLMAssistant.dll` from the `x64\Release\` directory
- Get the plugin file `LLMAssistant.dll` for your Notepad++ architecture:
- from a [release](https://github.com/Gvo87/NotepadPlusPlus-LLM-Plugin/releases/latest): `LLMAssistant_v<version>_x64.zip`, `_x86.zip` (32-bit) or `_arm64.zip`
- or from your own build: `x64\Release\`, `Win32\Release\` or `ARM64\Release\`
- **?** > **About Notepad++** shows whether your Notepad++ is 64-bit, 32-bit or ARM64. Notepad++ can't load a DLL built for another architecture.

### Step 2: Install
1. **Create the plugin directory:**
```
C:\Program Files\Notepad++\plugins\LLMAssistant\
```
For 32-bit Notepad++ on 64-bit Windows it's
`C:\Program Files (x86)\Notepad++\plugins\LLMAssistant\`.

2. **Copy the plugin file:**
- Place `LLMAssistant.dll` in the directory you just created
Expand Down Expand Up @@ -52,7 +57,7 @@ After installation, you'll see these 8 options in `Plugins > LLM Assistant`:

### Plugin doesn't appear
- Check the directory path: `C:\Program Files\Notepad++\plugins\LLMAssistant\`
- Make sure you have 64-bit Notepad++
- Make sure the DLL matches your Notepad++ architecture (x64, x86 or ARM64)
- Restart Notepad++ completely

### "API key not configured" error
Expand All @@ -65,8 +70,8 @@ After installation, you'll see these 8 options in `Plugins > LLM Assistant`:

## System Requirements

- **Notepad++**: Version 7.0+ (64-bit recommended)
- **Windows**: 10 or later (64-bit)
- **Notepad++**: Version 7.0+, 64-bit (x64), 32-bit (x86) or ARM64
- **Windows**: 10 or later
- **Internet**: Required for API calls
- **OpenAI API Key**: Required for LLM functionality

Expand Down
47 changes: 39 additions & 8 deletions LLMAssistant.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- One DLL per Notepad++ architecture: x64, Win32 (32-bit) and ARM64. The
settings below depend only on the configuration, so every platform builds
the same way. -->
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
Expand All @@ -9,6 +12,22 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
Expand All @@ -18,13 +37,13 @@
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
Expand All @@ -36,28 +55,39 @@
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='Debug'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='Release'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<!-- Output goes to <Platform>\<Configuration>\, e.g. Win32\Release\LLMAssistant.dll.
MSBuild's default already does this for x64 and ARM64, but puts Win32
output in Release\ and Debug\. -->
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<LinkIncremental>true</LinkIncremental>
<TargetName>LLMAssistant</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<LinkIncremental>false</LinkIncremental>
<TargetName>LLMAssistant</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;LLMASSISTANT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- Static CRT in both configurations, as in the Notepad++ plugin template:
the DLL then loads without the VC++ Redistributable for its
architecture being installed. -->
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand All @@ -72,13 +102,14 @@
<AdditionalIncludeDirectories>$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;LLMASSISTANT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ A powerful Notepad++ plugin that integrates Large Language Model (LLM) capabilit

## 📋 Requirements

- **Notepad++**: Version 7.0 or later (64-bit recommended)
- **Notepad++**: Version 7.0 or later: 64-bit (x64), 32-bit (x86) or ARM64
- **OpenAI API Key**: Get one from [OpenAI Platform](https://platform.openai.com/api-keys)
- **Operating System**: Windows 10 or later
- **Architecture**: 64-bit Windows (plugin compiled for x64)
- **Architecture**: each release has one zip per Notepad++ architecture (`_x64`, `_x86`, `_arm64`). Use the one that matches your Notepad++. Plugins Admin picks it for you.

## 📦 Installation

Expand All @@ -44,8 +44,8 @@ Maintainers: see [`packaging/PLUGINS_ADMIN_SUBMISSION.md`](packaging/PLUGINS_ADM
for how releases and the Plugins Admin listing are produced.

### Quick Installation (manual)
1. **Download** the plugin: `LLMAssistant.dll`
2. **Create directory**: `C:\Program Files\Notepad++\plugins\LLMAssistant\`
1. **Download** the zip for your Notepad++ from the [latest release](https://github.com/Gvo87/NotepadPlusPlus-LLM-Plugin/releases/latest) (`_x64`, `_x86` or `_arm64`) and extract `LLMAssistant.dll`
2. **Create directory**: `C:\Program Files\Notepad++\plugins\LLMAssistant\` (32-bit Notepad++ on 64-bit Windows: `C:\Program Files (x86)\Notepad++\plugins\LLMAssistant\`)
3. **Copy file**: Place `LLMAssistant.dll` in the created directory
4. **Restart** Notepad++
5. **Configure**: Go to `Plugins > LLM Assistant > Settings` and enter your OpenAI API key
Expand Down Expand Up @@ -90,6 +90,7 @@ The **Custom Prompt** option allows maximum flexibility:
### Prerequisites
- **Visual Studio 2022 or later** (any edition, or Build Tools) with the "Desktop development with C++" workload
- **Windows SDK** (installed with that workload)
- **For ARM64 builds only**: the "MSVC Build Tools for ARM64/ARM64EC (Latest)" component (on Visual Studio 2022: "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)"), added under Individual components in the Visual Studio Installer
- **Git** (for cloning the repository)

### Build Steps
Expand All @@ -103,16 +104,22 @@ cd NotepadPlusPlus-LLM-Plugin

# The compiled DLL will be in:
# x64\Release\LLMAssistant.dll

# Or build for 32-bit or ARM64 Notepad++:
.\build.bat x86 # Win32\Release\LLMAssistant.dll
.\build.bat arm64 # ARM64\Release\LLMAssistant.dll
```

Notepad++ only loads a plugin built for its own architecture, so use the DLL that matches your Notepad++ (x64, x86 or ARM64).

### Development Environment
The build script automatically:
- Finds the newest Visual Studio with the C++ tools (using `vswhere`)
- Sets up the build environment
- Compiles with the project's platform toolset (v145), or with the newest installed toolset if v145 is missing (for example v143 on Visual Studio 2022)
- Links required Windows libraries
- Links required Windows libraries, and links the C/C++ runtime statically, so the DLL doesn't need the Visual C++ Redistributable installed

`deploy.bat` builds the same way, then copies the DLL into `C:\Program Files\Notepad++\plugins\LLMAssistant\`. Run it as Administrator. It closes Notepad++ the same way its close button does, so unsaved files are handled as usual: Notepad++ asks whether to save them, or, if session snapshot is on, keeps them in its backup for the next start. It won't copy anything while Notepad++ is still open.
`deploy.bat` builds the x64 DLL the same way, then copies it into `C:\Program Files\Notepad++\plugins\LLMAssistant\`. Run it as Administrator. It closes Notepad++ the same way its close button does, so unsaved files are handled as usual: Notepad++ asks whether to save them, or, if session snapshot is on, keeps them in its backup for the next start. It won't copy anything while Notepad++ is still open.

### Automated Tests
The portable request, JSON, and UTF-8 regression tests use Catch2. Configure them with CMake:
Expand Down Expand Up @@ -172,7 +179,7 @@ API keys are stored in: `HKEY_CURRENT_USER\Software\LLMAssistant\APIKey`
**Plugin doesn't appear in menu**
- Ensure DLL is in correct directory: `C:\Program Files\Notepad++\plugins\LLMAssistant\`
- Restart Notepad++ completely
- Check if you have 64-bit Notepad++ (plugin is compiled for x64)
- Check that the DLL matches your Notepad++ architecture (x64, x86 or ARM64). Notepad++ can't load a DLL built for another one. **?** > **About Notepad++** shows which one you have

**"API key not configured" error**
- Go to Settings and enter your OpenAI API key
Expand All @@ -190,7 +197,7 @@ API keys are stored in: `HKEY_CURRENT_USER\Software\LLMAssistant\APIKey`
### Debug Information
If you encounter issues, check:
1. Notepad++ version (should be 7.0+)
2. Windows architecture (plugin requires 64-bit)
2. Notepad++ architecture (x64, x86 or ARM64) matches the plugin zip you installed
3. API key validity on OpenAI platform
4. Available API credits/quota

Expand Down
Loading
Loading