Skip to content

Comments

feat: implement Instance Name feature#48

Merged
macrat merged 11 commits intov0.18from
claude/add-instance-name-option-01AKXG5DwTpv3hb9DcL8Yjm1
Nov 22, 2025
Merged

feat: implement Instance Name feature#48
macrat merged 11 commits intov0.18from
claude/add-instance-name-option-01AKXG5DwTpv3hb9DcL8Yjm1

Conversation

@macrat
Copy link
Owner

@macrat macrat commented Nov 22, 2025

No description provided.

dependabot bot and others added 9 commits November 18, 2025 10:16
Bumps the minor-and-patch group with 2 updates: [golang.org/x/crypto](https://github.com/golang/crypto) and [golang.org/x/text](https://github.com/golang/text).


Updates `golang.org/x/crypto` from 0.43.0 to 0.44.0
- [Commits](golang/crypto@v0.43.0...v0.44.0)

Updates `golang.org/x/text` from 0.30.0 to 0.31.0
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.44.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: golang.org/x/text
  dependency-version: 0.31.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Add a new command-line option --name/-n to set an instance name for the Ayd server.
The instance name is:
- Stored as a global variable in internal/meta/instance.go
- Displayed in HTTP page titles and logo
- Included in startup and shutdown logs as instance_name field

This allows users to distinguish between multiple Ayd instances when running
them concurrently or viewing their logs.
Add unit tests for the instance name option:
- Test instance_name template function in templates_test.go
- Test --name/-n command-line option parsing in main_test.go

Both short form (-n) and long form (--name) are tested.
Modify MCP server Implementation Name and Title based on instance name:
- Name: "Ayd - alive monitoring - {instance_name}" (or "Ayd - alive monitoring" if not set)
- Title: "Ayd - {instance_name}" (or "Ayd" if not set)

This allows LLMs to correctly identify the right instance when multiple
Ayd MCP servers are configured.
Use a single impl variable instead of separate variables for Name and Title.
Initialize with default values, then override if instance name is set.
This makes the code more readable and maintainable.
Change MCP server configuration:
- Name: fixed to "ayd" (no longer includes instance name)
- Title: "Ayd ({instance_name})" or "Ayd"
- Instructions: Added with instance name information when set

This approach provides better identification for LLMs when multiple
Ayd instances are configured, using Title and Instructions instead
of overloading the Name field.
Copilot AI review requested due to automatic review settings November 22, 2025 05:36
@macrat macrat changed the base branch from main to v0.18 November 22, 2025 05:36
Copy link
Contributor

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

This PR implements an instance name feature for Ayd that allows users to identify their Ayd instances through a command-line option (-n or --name). The instance name is displayed in page titles, navigation logos, MCP server metadata, and included in server start/stop logs.

Key changes:

  • Added InstanceName field to store and report structures to track instance name throughout the application
  • Refactored test utilities to use an options pattern for better flexibility when creating test stores
  • Updated UI templates and MCP integration to display instance name when available

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cmd/ayd/main.go Added -n/--name flag for setting instance name and passes it to store.New()
cmd/ayd/help.txt Added documentation for the new -n/--name flag
cmd/ayd/server.go Updated server start/stop logging to include instance_name in extra fields
internal/store/store.go Added name field and Name() method to Store struct; includes name in MakeReport()
lib-ayd/report.go Added InstanceName field to Report struct
internal/endpoint/store.go Added Name() method to Store interface
internal/endpoint/templates/base.html Updated title and logo to display instance name when available
internal/endpoint/log.go Added InstanceName to logData struct and template context
internal/endpoint/mcp.go Updated MCP server initialization to include instance name in title and instructions
internal/testutil/store.go Refactored to use options pattern (WithInstanceName, WithConsole, WithLog)
internal/testutil/endpoint.go Updated StartTestServer to accept StoreOption parameters
internal/scheme/http.go Moved HTTPUserAgent initialization to init() function
go.mod/go.sum Updated golang.org/x dependencies to newer versions
Test files Updated all store.New() calls to include name parameter; added comprehensive tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@macrat macrat force-pushed the claude/add-instance-name-option-01AKXG5DwTpv3hb9DcL8Yjm1 branch from 7aac1a3 to 449840b Compare November 22, 2025 05:41
@macrat macrat force-pushed the claude/add-instance-name-option-01AKXG5DwTpv3hb9DcL8Yjm1 branch from 449840b to 42719f6 Compare November 22, 2025 05:42
@macrat macrat requested a review from Copilot November 22, 2025 05:42
@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 40.32258% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.41%. Comparing base (b9a313a) to head (ad9db44).
⚠️ Report is 1 commits behind head on v0.18.

Files with missing lines Patch % Lines
internal/testutil/store.go 0.00% 26 Missing ⚠️
cmd/ayd/server.go 35.71% 8 Missing and 1 partial ⚠️
internal/testutil/endpoint.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            v0.18      #48      +/-   ##
==========================================
- Coverage   88.61%   88.41%   -0.20%     
==========================================
  Files          75       75              
  Lines        5559     5585      +26     
==========================================
+ Hits         4926     4938      +12     
- Misses        489      502      +13     
- Partials      144      145       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

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

Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@macrat macrat merged commit 404ba09 into v0.18 Nov 22, 2025
5 checks passed
@macrat macrat deleted the claude/add-instance-name-option-01AKXG5DwTpv3hb9DcL8Yjm1 branch November 22, 2025 05:53
@macrat macrat mentioned this pull request Nov 22, 2025
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.

2 participants