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
1 change: 0 additions & 1 deletion .Copy2AddInFolder.cmd

This file was deleted.

19 changes: 0 additions & 19 deletions .CreateWorkingFileFormAddInFolder.cmd

This file was deleted.

43 changes: 43 additions & 0 deletions .claude/rules/1-04-vba-style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
paths:
- "**/*.{bas,cls,frm,form,rep,report}"
---

<!-- Generated by AgentsConfig\build-agents.ps1 from parts "AGENTS.parts.txt" (Claude mode). Do not edit here; change the parts or the project extra file and rebuild. -->

## VBA coding style
Applies to standard modules (`.bas`), class modules and code-behind (`.cls`), and form/report files
(`.form`/`.report` from the msaccess-vcs-addin, `.frm`/`.rep` from the ACLib Import Wizard).

### Naming
- Access objects with a one-letter type prefix: tables `t...` (`tCustomers`), forms `f...` (`fCustomer`).
- Controls with a type prefix (`txt`, `lbl`, `chk`, `cmd`, ...), e.g. `txtCustomerNo`, `cmdSave`.
- VBA variables, constants, procedures and classes with meaningful names **without** type prefix (`ErrNumber`, `SaveRecord`, `CustomerRepository`).
- Standard modules (`.bas`) with the prefix `mod` (`modDaoTools`, `modProjectRules`). Class modules get no prefix.
Exceptions without prefix only where a module is used like a namespace (`AppConfig.Value`) or a special case such as `_config` applies; decide per project in the context of its use and record it in the project facts.
Often a better solution is a self-instancing class (`VB_PredeclaredId = True`, used as `AppConfig.Value`): it needs no prefix and its procedures cannot be called without the class name.
Use its default instance only for stateless helpers, factories or read-only configuration; logic classes do not reach for it but receive the values they need (no hidden global state, see the architecture rules).
Keep the existing names of imported third-party code (e.g. ACLib modules).
- Procedures: verb + object (`LoadCustomer`, `CalculateTotal`); functions that return a Boolean read as a question (`IsValid`, `HasItems`).
- Interfaces start with `I` (`ICustomerRepository`); implementing classes are named after what they do (`CustomerRepository`, `CustomerRepositoryFake`).
- Test classes are named `<ClassUnderTest>Tests` (see AccUnit rules).
- Constants in `PascalCase` (no all-caps, no `c`/`k` prefix); enum names singular, members prefixed with the enum name where this avoids clashes.

### Layout
- Indent with 4 spaces (no tabs); keep the indentation style of an existing file.
- One statement per line; avoid line continuations unless they clearly help readability; lines at most ~100 characters.
- Declare variables close to their first use, one per line, always with an explicit type. No `Variant` unless required.
- Use `ByVal` for parameters unless the procedure has to change the caller's value; declare scope (`Public`/`Friend`/`Private`) explicitly.
- Module order: `Option` lines, constants and enums, private members, events, public properties, public procedures, private procedures.
- Standard modules that must not be accessed from outside the project get `Option Private Module` (after `Option Explicit`).
Use it for internal helpers, so that their `Public` procedures stay out of other VBA projects, the macro list and `Application.Run` calls from outside.
Do not set it on modules whose procedures are called from queries, form/report properties or macros: such calls may stop working, so check the callers first.
Class modules have no `Option Private Module` effect; limit what they expose with `Friend` and `Private` members.
- Place objects in the `@Folder` structure used by the project (see `vcs-agent-docs`); do not invent a new structure.

### Comments
- Comments explain why, not what. No commented-out code.
- A public procedure whose name and parameters do not explain it fully gets a short comment line above it.

### Files
- Keep the encoding and line endings of existing files (usually ANSI/Windows-1252 or UTF-8 with BOM, CRLF); take care with umlauts.
24 changes: 24 additions & 0 deletions .claude/rules/1-05-vba-architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
paths:
- "**/*.{bas,cls,frm,form,rep,report}"
---

<!-- Generated by AgentsConfig\build-agents.ps1 from parts "AGENTS.parts.txt" (Claude mode). Do not edit here; change the parts or the project extra file and rebuild. -->

## VBA architecture (SRP, layers, testability)
- **Single responsibility is the main rule.**
- A procedure does one thing; split long procedures into named steps, a reader should grasp it without scrolling.
- A class or module has one reason to change. When a class needs "and" to describe it, split it.
- Treat length as a warning signal, not as a hard limit: a procedure over ~30 lines or a class over ~300 lines is a reason to check for several responsibilities.
- **Layers** (dependencies point downwards only):
1. UI: forms and reports. Event procedures contain no logic; they call well-named procedures that only read inputs, delegate and show results.
2. Logic: classes and standard modules with the rules of the application. No reference to forms (`Forms!...`, `Me`), no `MsgBox`, no direct database access (`CurrentDb`, `DoCmd`).
3. Data access: own classes or modules (repository style) that read and write data, built on DAO/ADODB or the ACLib data modules.
- Apply the layers to new code with real application logic; forms that only show and edit data need no extra layers (YAGNI).
- **Testable by design:** logic receives what it needs through parameters or properties (dependency injection), not by reaching for globals or the database.
Describe collaborators with an interface (`Implements`) when a fake is useful in tests. Logic classes keep no hidden global state.
- If the project uses AccUnit, new logic comes with tests (see the AccUnit rules).
- Put logic into classes or modules, not into form modules; a form module only wires the UI to the logic.
- Return results and raise errors; the UI layer decides how to show them.
- **Reuse before writing new code:** check the AccessCodeLib modules first, then existing project modules; write new code only if neither fits.
- Do not restructure existing code unasked. In code you touch for another reason, apply these rules to the new and changed parts; report further findings instead of fixing them.
53 changes: 53 additions & 0 deletions .github/workflows/build-accdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build-accdb (on push, pull)

on:
push:
branches:
- main
- feature/**
- bugfix/**
paths:
- 'source/**'
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: write
id-token: write
attestations: write

jobs:
build:
runs-on: [self-hosted, Windows, Office]

steps:
- name: "Checkout code for release tag"
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- name: "Build Access file (accdb/accde)"
id: build_access_file
uses: AccessCodeLib/msaccess-vcs-build@main
with:
vcs-url: ""
source-dir: "source"
target-dir: "access-add-in"
file-name: "DbmsConnectionWizard.accda"
app-config: "deployment/AddIn-Config.json"
timeout-minutes: 10

- name: "Upload Build Artifact"
uses: actions/upload-artifact@v4
id: "upload"
with:
name: "Install files"
path: "./access-add-in/*"
if-no-files-found: warn
- name: "Attestation"
uses: actions/attest-build-provenance@v2
with:
subject-name: "BInstall files"
subject-digest: sha256:${{ steps.upload.outputs.artifact-digest }}
85 changes: 85 additions & 0 deletions .github/workflows/build-release-zip-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build-install-zip-file (on release)

on:
release:
types: [published]

permissions:
contents: write
id-token: write
attestations: write

jobs:
build:
runs-on: [self-hosted, Windows, Office]

steps:
- name: "Checkout code for release tag"
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- name: "Build Access file (accdb/accde)"
id: build_access_file
uses: AccessCodeLib/msaccess-vcs-build@main
with:
vcs-url: ""
source-dir: "source"
target-dir: "access-add-in"
file-name: "DbmsConnectionWizard.accda"
app-config: "deployment/AddIn-Config.json"
timeout-minutes: 10

- name: "Create versioned ZIP file"
run: |
$zipName = "DbmsConnectionWizard_${{ github.event.release.tag_name }}.zip"
Compress-Archive -Path .\access-add-in\* -DestinationPath $zipName
echo "ZIP_NAME=$zipName" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: "Upload ZIP to GitHub Release"
uses: softprops/action-gh-release@v1
with:
files: ${{ env.ZIP_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Calculate SHA256 of ZIP"
id: hash
shell: pwsh
run: |
$zipName = "${{ env.ZIP_NAME }}"
$hash = Get-FileHash -Algorithm SHA256 -Path $zipName
$digest = "sha256:$($hash.Hash.ToLower())"
echo "ZIP_DIGEST=$digest" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "digest=$digest" >> $env:GITHUB_OUTPUT

- name: "Attestation"
uses: actions/attest-build-provenance@v2
id: attestation
with:
subject-name: "${{ env.ZIP_NAME }}"
subject-digest: "${{ steps.hash.outputs.digest }}"

- name: "Update release description with attestation URL"
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name }}
run: |
$ErrorActionPreference = "Stop"

# get current release notes
$oldBody = gh release view $env:TAG --repo $env:REPO --json body --template "{{.body}}"

# build Attestation URL
$attestationId = "${{ steps.attestation.outputs.attestation-id }}"
$attestationUrl = "https://github.com/$($env:REPO)/attestations/$attestationId"

# join release notes with Attestation url
$newBody = "$oldBody`n`nAttestation: $attestationUrl"

# save release notes
gh release edit $env:TAG --repo $env:REPO --notes "$newBody"


7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/*.accdb
*.laccdb
*.env
logs/
test-results/
.env.*
!.env*.example
*.zip
Loading
Loading