[PR #9] [MERGED] Pronouns Extension v2.0 — Full Refactor: Macro Rename, Platform Compatibility, New Architecture #10

Closed
opened 2026-10-15 18:07:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/SillyTavern/SillyTavern-Pronouns/pull/9
Author: @Wolfsblvt
Created: 4/11/2026
Status: ✅ Merged
Merged: 4/11/2026
Merged by: @Wolfsblvt

Base: main ← Head: dev


📝 Commits (10+)

  • d8bd97d refactor: restructure repo, split into src/ + templates/, init hook, new macro architecture
  • bca614c feat: macro engine refactor — verb-be, contractions, settings migration
  • df8d248 feat: rename macros to camelCase, WyvernChat compat, Janitor fix, pre-processor
  • 73e6b62 feat: WyvernChat Cap macros, Janitor poss_p fix, replacer rewrite, settings subheadings
  • efcdf0e fix: use single quotes for consistency in getPrimaryMacroName default return
  • a5ef178 refactor: simplify CSS by removing redundant gap declarations, add margin to replacer button
  • e78c620 fix: rename persona pronouns heading from 'Pronoun Settings' to 'Pronouns'
  • 00dcf59 refactor: clean up macros.js file header comment
  • 562b48e feat: rewrite slash commands with helpString docs, fix shorthands logic, remove WyvernChat refs
  • 76097bd docs: update slash commands table in README

📊 Changes

14 files changed (+1332 additions, -826 deletions)

View changed files

📝 README.md (+98 -46)
📝 index.js (+43 -457)
📝 manifest.json (+6 -3)
➖ persona-pronouns.html (+0 -51)
➖ pronounsSlashCommands.js (+0 -159)
➖ settings.html (+0 -20)
➕ src/macros.js (+252 -0)
➕ src/pronouns.js (+259 -0)
📝 src/replacer.js (+102 -82)
➕ src/slash-commands.js (+282 -0)
➕ src/ui.js (+201 -0)
📝 style.css (+4 -8)
➕ templates/persona-pronouns.html (+51 -0)
➕ templates/settings.html (+34 -0)

📄 Description

This PR is a complete overhaul of the Pronouns extension — a v2.0 rewrite covering architecture, macro naming, platform compatibility, slash commands, and documentation. The extension is fully restructured, all macro names are standardised, and platform-specific compatibility (WyvernChat, JanitorAI) is made explicit and opt-in where appropriate.


What Changed

Architecture & Project Structure

  • All logic moved into a src/ subfolder (pronouns.js, macros.js, ui.js, replacer.js, slash-commands.js)
  • HTML templates moved into a templates/ subfolder
  • index.js is now a slim entry point that exports init() for the activate lifecycle hook
  • manifest.json updated: display name set to SillyTavern Pronouns, hooks.activate added, version bumped to 2.0.0

Macro Names — Renamed to camelCase

The primary macros are renamed to camelCase to align with WyvernChat's own pronoun placeholder names. This means WyvernChat character cards work out of the box without any compatibility toggle:

Old name New name
{{pronoun-subjective}} {{pronounSubjective}}
{{pronoun-objective}} {{pronounObjective}}
{{pronoun-pos-det}} {{pronounPosDet}}
{{pronoun-pos-pro}} {{pronounPosPro}}
{{pronoun-reflexive}} {{pronounReflexive}}
{{pronoun-verb-be}} {{pronounVerbBe}}

WyvernChat Compatibility

  • Dot-notation pre-processor: {{pronoun.subjective}}, {{pronoun.objective}}, etc. are automatically rewritten to the camelCase names at runtime — WyvernChat cards using the older dot-notation work without any manual conversion or toggle.
  • Capitalized variants ({{pronounSubjectiveCap}} etc.) available as an opt-in toggle for cards that use WyvernChat's capitalized placeholder names.

JanitorAI Compatibility

  • JanitorAI macros ({{sub}}, {{obj}}, {{pos}}, {{poss_p}}, {{ref}}) are behind a dedicated opt-in toggle.
  • Fixed: the possessive determiner was previously listed as {{poss}}; corrected to {{pos}} (confirmed from JanitorAI's UI).

Shorthand Macros — Simplified

  • The "WyvernChat shorthands" toggle is renamed to a generic "Enable shorthand macros" toggle, since the primary macro names are already the WyvernChat names.
  • English shorthand words ({{she}}, {{him}}, {{their_}}, {{hers}}, {{himself}}, etc.) are registered as aliases when enabled.
  • English contraction shorthands ({{they_re}} etc.) removed — too grammar-specific to be a useful general feature.

Settings — New Keys

  • enableShorthands (renamed from enableWyvernShorthands)
  • enableWyvernCompat (new — controls capitalized Cap variants)
  • enableJanitorCompat (renamed from enableJanitorShorthands)
  • _curVersion — internal field stamped on every load with the running extension version, for use in future migration guards
  • Full migration path from v1 (enablePersonaShorthands) and early v2 (enableWyvernShorthands, enableJanitorShorthands) keys

Text Replacer Rewrite

  • Removed Wyvern/Janitor-specific compat logic from the replacer
  • Primary macro names updated to camelCase throughout
  • pickShorthandAlias() introduced: matches by exact value against the correct shorthand group, handles trailing _ on possessive determiner aliases correctly
  • Shorthand checkbox in the popup: always visible, disabled+unchecked when shorthands are globally off, checked by default when they're on

Slash Commands — Improved

  • resolveShorthandsArg() helper centralises shorthand toggle argument handling: warns the user and returns early (empty string) if shorthands=true is passed but the toggle is globally disabled
  • Full HTML helpString added to all four commands with descriptions, behaviour notes, and usage examples
  • Argument descriptions improved: full sentences, inline enum value descriptions
  • All stale WyvernChat-specific references removed from command definitions

Commands:

  • /pronouns-set key=<key> <value> — set a single pronoun field
  • /pronouns-set-preset <preset> — apply a preset (she/he/they/it)
  • /pronouns-replace [shorthands] [preset] [subjective/objective/...] <text> — replace pronoun words in text with macros
  • /pronouns-open-replacer [shorthands] [text] — open the replacer popup

Minor Fixes & Polish

  • Persona pronoun section heading renamed from "Pronoun Settings" to "Pronouns"
  • CSS cleaned up: redundant gap declarations removed, margin added to replacer button
  • Settings panel: separator and info text added above the platform compatibility toggles with a clear "Platform Compatibility" subheading
  • manifest.json: required client_version set to 1.13.5

Why These Changes

The v1 macro names (pronoun-subjective etc.) were inconsistent with both WyvernChat's naming and general camelCase conventions for SillyTavern macros. Since many users import WyvernChat cards, the primary macros now match WyvernChat exactly — no toggle, no conversion needed for the common case.

The platform compatibility features (WyvernChat capitalized variants, JanitorAI macros) are opt-in because they register short or generic macro names that could collide with other extensions or user-defined macros. Making them explicit toggles gives users control and avoids silent conflicts.

The architecture refactor was needed to make the codebase maintainable — the original index.js contained everything in one 500-line file. The src/ split makes each concern independently readable and testable.


Settings Migration

Existing users are migrated automatically on first load:

  • enablePersonaShorthands (v1) → enableShorthands
  • enableWyvernShorthands (early v2) → enableShorthands
  • enableJanitorShorthands (early v2) → enableJanitorCompat

No user action required.


Breaking Changes

  • Primary macro names changed. Any prompts or system templates using the old hyphenated names ({{pronoun-subjective}} etc.) will need to be updated to the new camelCase names. The old names are not aliased.
  • Settings keys are renamed (migrated automatically, but externally stored settings referencing the old keys by name will need manual updating).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/SillyTavern/SillyTavern-Pronouns/pull/9 **Author:** [@Wolfsblvt](https://github.com/Wolfsblvt) **Created:** 4/11/2026 **Status:** ✅ Merged **Merged:** 4/11/2026 **Merged by:** [@Wolfsblvt](https://github.com/Wolfsblvt) **Base:** `main` ← **Head:** `dev` --- ### 📝 Commits (10+) - [`d8bd97d`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/d8bd97d39cf1affc862c3c599e3ae6722b22a579) refactor: restructure repo, split into src/ + templates/, init hook, new macro architecture - [`bca614c`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/bca614c365a61d0d1b7f018e0cb775cb01266897) feat: macro engine refactor — verb-be, contractions, settings migration - [`df8d248`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/df8d2480feb6651b9ead78108938b5239eb1820a) feat: rename macros to camelCase, WyvernChat compat, Janitor fix, pre-processor - [`73e6b62`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/73e6b6267d4bca5ea8d367eb15937635ba080f96) feat: WyvernChat Cap macros, Janitor poss_p fix, replacer rewrite, settings subheadings - [`efcdf0e`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/efcdf0e09633bf629139014f7b18b65345de74ac) fix: use single quotes for consistency in getPrimaryMacroName default return - [`a5ef178`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/a5ef178cc95b868cc84f962251813acc8bfe7609) refactor: simplify CSS by removing redundant gap declarations, add margin to replacer button - [`e78c620`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/e78c620cf1bdbb7a31835e698dcc5428c20dfc5e) fix: rename persona pronouns heading from 'Pronoun Settings' to 'Pronouns' - [`00dcf59`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/00dcf597bcafab35fb3d00ba055012ec475f1e6b) refactor: clean up macros.js file header comment - [`562b48e`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/562b48e68653671578ee0931c4c8ff32b4096db4) feat: rewrite slash commands with helpString docs, fix shorthands logic, remove WyvernChat refs - [`76097bd`](https://github.com/SillyTavern/SillyTavern-Pronouns/commit/76097bd61af33400aff82afd2984379033e427dd) docs: update slash commands table in README ### 📊 Changes **14 files changed** (+1332 additions, -826 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+98 -46) 📝 `index.js` (+43 -457) 📝 `manifest.json` (+6 -3) ➖ `persona-pronouns.html` (+0 -51) ➖ `pronounsSlashCommands.js` (+0 -159) ➖ `settings.html` (+0 -20) ➕ `src/macros.js` (+252 -0) ➕ `src/pronouns.js` (+259 -0) 📝 `src/replacer.js` (+102 -82) ➕ `src/slash-commands.js` (+282 -0) ➕ `src/ui.js` (+201 -0) 📝 `style.css` (+4 -8) ➕ `templates/persona-pronouns.html` (+51 -0) ➕ `templates/settings.html` (+34 -0) </details> ### 📄 Description This PR is a complete overhaul of the Pronouns extension — a v2.0 rewrite covering architecture, macro naming, platform compatibility, slash commands, and documentation. The extension is fully restructured, all macro names are standardised, and platform-specific compatibility (WyvernChat, JanitorAI) is made explicit and opt-in where appropriate. --- ### What Changed #### Architecture & Project Structure - All logic moved into a `src/` subfolder (`pronouns.js`, `macros.js`, `ui.js`, `replacer.js`, `slash-commands.js`) - HTML templates moved into a `templates/` subfolder - `index.js` is now a slim entry point that exports `init()` for the `activate` lifecycle hook - `manifest.json` updated: display name set to `SillyTavern Pronouns`, `hooks.activate` added, version bumped to `2.0.0` #### Macro Names — Renamed to camelCase The primary macros are renamed to camelCase to align with WyvernChat's own pronoun placeholder names. This means **WyvernChat character cards work out of the box** without any compatibility toggle: | Old name | New name | |---|---| | `{{pronoun-subjective}}` | `{{pronounSubjective}}` | | `{{pronoun-objective}}` | `{{pronounObjective}}` | | `{{pronoun-pos-det}}` | `{{pronounPosDet}}` | | `{{pronoun-pos-pro}}` | `{{pronounPosPro}}` | | `{{pronoun-reflexive}}` | `{{pronounReflexive}}` | | `{{pronoun-verb-be}}` | `{{pronounVerbBe}}` | #### WyvernChat Compatibility - **Dot-notation pre-processor**: `{{pronoun.subjective}}`, `{{pronoun.objective}}`, etc. are automatically rewritten to the camelCase names at runtime — WyvernChat cards using the older dot-notation work without any manual conversion or toggle. - **Capitalized variants** (`{{pronounSubjectiveCap}}` etc.) available as an opt-in toggle for cards that use WyvernChat's capitalized placeholder names. #### JanitorAI Compatibility - JanitorAI macros (`{{sub}}`, `{{obj}}`, `{{pos}}`, `{{poss_p}}`, `{{ref}}`) are behind a dedicated opt-in toggle. - Fixed: the possessive determiner was previously listed as `{{poss}}`; corrected to `{{pos}}` (confirmed from JanitorAI's UI). #### Shorthand Macros — Simplified - The "WyvernChat shorthands" toggle is renamed to a generic **"Enable shorthand macros"** toggle, since the primary macro names are already the WyvernChat names. - English shorthand words (`{{she}}`, `{{him}}`, `{{their_}}`, `{{hers}}`, `{{himself}}`, etc.) are registered as aliases when enabled. - English contraction shorthands (`{{they_re}}` etc.) removed — too grammar-specific to be a useful general feature. #### Settings — New Keys - `enableShorthands` (renamed from `enableWyvernShorthands`) - `enableWyvernCompat` (new — controls capitalized Cap variants) - `enableJanitorCompat` (renamed from `enableJanitorShorthands`) - `_curVersion` — internal field stamped on every load with the running extension version, for use in future migration guards - Full migration path from v1 (`enablePersonaShorthands`) and early v2 (`enableWyvernShorthands`, `enableJanitorShorthands`) keys #### Text Replacer Rewrite - Removed Wyvern/Janitor-specific compat logic from the replacer - Primary macro names updated to camelCase throughout - `pickShorthandAlias()` introduced: matches by exact value against the correct shorthand group, handles trailing `_` on possessive determiner aliases correctly - Shorthand checkbox in the popup: always visible, disabled+unchecked when shorthands are globally off, checked by default when they're on #### Slash Commands — Improved - `resolveShorthandsArg()` helper centralises shorthand toggle argument handling: warns the user and returns early (empty string) if `shorthands=true` is passed but the toggle is globally disabled - Full HTML `helpString` added to all four commands with descriptions, behaviour notes, and usage examples - Argument descriptions improved: full sentences, inline enum value descriptions - All stale WyvernChat-specific references removed from command definitions **Commands:** - `/pronouns-set key=<key> <value>` — set a single pronoun field - `/pronouns-set-preset <preset>` — apply a preset (she/he/they/it) - `/pronouns-replace [shorthands] [preset] [subjective/objective/...] <text>` — replace pronoun words in text with macros - `/pronouns-open-replacer [shorthands] [text]` — open the replacer popup #### Minor Fixes & Polish - Persona pronoun section heading renamed from "Pronoun Settings" to "Pronouns" - CSS cleaned up: redundant `gap` declarations removed, margin added to replacer button - Settings panel: separator and info text added above the platform compatibility toggles with a clear "Platform Compatibility" subheading - `manifest.json`: required `client_version` set to `1.13.5` --- ### Why These Changes The v1 macro names (`pronoun-subjective` etc.) were inconsistent with both WyvernChat's naming and general camelCase conventions for SillyTavern macros. Since many users import WyvernChat cards, the primary macros now match WyvernChat exactly — no toggle, no conversion needed for the common case. The platform compatibility features (WyvernChat capitalized variants, JanitorAI macros) are opt-in because they register short or generic macro names that could collide with other extensions or user-defined macros. Making them explicit toggles gives users control and avoids silent conflicts. The architecture refactor was needed to make the codebase maintainable — the original `index.js` contained everything in one 500-line file. The `src/` split makes each concern independently readable and testable. --- ### Settings Migration Existing users are migrated automatically on first load: - `enablePersonaShorthands` (v1) → `enableShorthands` - `enableWyvernShorthands` (early v2) → `enableShorthands` - `enableJanitorShorthands` (early v2) → `enableJanitorCompat` No user action required. --- ### Breaking Changes - **Primary macro names changed.** Any prompts or system templates using the old hyphenated names (`{{pronoun-subjective}}` etc.) will need to be updated to the new camelCase names. The old names are not aliased. - Settings keys are renamed (migrated automatically, but externally stored settings referencing the old keys by name will need manual updating). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 18:07:30 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SillyTavern/SillyTavern-Pronouns#10
No description provided.