A summary of 55+ pull requests merged across the Chi War project in the first weeks of January 2026.
Chi War is a web application and CLI for managing Feng Shui 2 tabletop RPG campaigns. The system consists of three components: a Phoenix/Elixir backend (shot-elixir), a Next.js frontend (shot-client-next), and a TypeScript command-line interface (chi-war-cli).
This post covers the major features implemented between January 7-11, 2026. The project remains in alpha, with no active player base yet.
I added a complete notifications system for user-facing alerts. The implementation spans both backend and frontend.
The notification schema stores the essential fields:
schema "notifications" do
field :type, :string
field :title, :string
field :message, :string
field :payload, :map, default: %{}
field :read_at, :utc_datetime
field :dismissed_at, :utc_datetime
belongs_to :user, ShotElixir.Accounts.User
timestamps(type: :utc_datetime)
end
The payload field holds structured metadata—campaign context, originating user, and any other relevant data. Two nullable timestamps (read_at and dismissed_at) track notification state without requiring separate status columns.
The REST API exposes standard CRUD endpoints plus two special operations:
GET /api/v2/notifications/unread_count — Returns a count for badge displayPOST /api/v2/notifications/dismiss_all — Bulk dismissalA security constraint: the update endpoint only allows modifying read_at and dismissed_at. Users cannot alter notification content after creation.
When a notification is created, Phoenix PubSub broadcasts to the user's channel:
Phoenix.PubSub.broadcast!(
ShotElixir.PubSub,
"user:#{target_user.id}",
{:notification_created, notification}
)
The frontend subscribes to this channel via WebSocket. Notifications appear instantly without polling.
The NotificationBell component displays a badge with unread count. Clicking opens a dropdown showing recent notifications with time-ago formatting ("5m ago", "2h ago").
The component subscribes to real-time updates:
useEffect(() => {
const unsubscribe = subscribeToNotifications(notification => {
setUnreadCount(prev => prev + 1)
if (isMenuOpenRef.current) {
setNotifications(prev => [notification, ...prev])
}
})
return unsubscribe
}, [subscribeToNotifications])
A 60-second polling fallback ensures reliability if the WebSocket connection drops.
The first automated notification: AI credit exhaustion. When a user's configured AI provider runs out of credits, the system creates a persistent, dismissable notification instead of showing an ephemeral banner that disappears on page navigation.
The command-line interface now supports full combat management. Running an entire Feng Shui 2 fight from the terminal is possible.
# Set the active encounter
chiwar encounter set <fight-id>
# Combat actions
chiwar encounter attack jack -t "Thunder Cop"
chiwar encounter wound "Big Boss" 8
chiwar encounter heal jack 5
chiwar encounter mooks "Mook Squad" -3
chiwar encounter spend jack 3
# Dice rolling
chiwar encounter roll "Martial Arts check"
chiwar encounter initiative
# Session management
chiwar encounter start
chiwar encounter end
Typing full character names repeatedly is tedious. The CLI implements a four-tier fuzzy matching system:
function findCombatant(query: string, combatants: Combatant[]): Combatant | Combatant[] | null {
const q = query.toLowerCase().trim();
// 1. Exact match
const exact = combatants.find(c => c.name.toLowerCase() === q);
if (exact) return exact;
// 2. Starts-with match
const startsWith = combatants.filter(c => c.name.toLowerCase().startsWith(q));
if (startsWith.length === 1) return startsWith[0];
if (startsWith.length > 1) return startsWith;
// 3. Contains match
const contains = combatants.filter(c => c.name.toLowerCase().includes(q));
if (contains.length === 1) return contains[0];
if (contains.length > 1) return contains;
// 4. Word-starts-with match
const wordMatch = combatants.filter(c =>
c.name.toLowerCase().split(/\s+/).some(word => word.startsWith(q))
);
if (wordMatch.length === 1) return wordMatch[0];
if (wordMatch.length > 1) return wordMatch;
return null;
}
Typing jack matches "Jack Burton". Typing egg matches "Egg Shen" via word-starts-with. If multiple characters match, the CLI lists all options and asks for clarification.
Attack resolution follows Feng Shui 2 rules:
export function calculateAttack(
attacker: Combatant,
target: Combatant,
swerve: SwerveResult
): AttackResult {
const effectiveAttack = attackValue - (attacker.impairments || 0);
const attackRoll = swerve.total + effectiveAttack;
const hit = attackRoll >= defense;
const outcome = hit ? attackRoll - defense : 0;
const smackdown = hit ? outcome + damage : 0;
if (targetIsMook) {
mooksDropped = Math.min(smackdown, maxMooks);
} else {
woundsDealt = Math.max(0, smackdown - toughness);
}
}
Dice rolling happens server-side. The API handles exploding dice (6s reroll and add) and returns the swerve result. This keeps the random number generation consistent and auditable.
Two-way synchronization between Chi War and Notion is now functional.
Characters can be created directly from Notion pages:
chiwar notion search "Thunder King"
# Returns matching Notion pages
chiwar character create --from-notion <page-id>
# Extracts action values, description, and metadata
The system parses Notion properties and maps them to Chi War character fields. Missing fields get sensible defaults rather than null values—a bug fix that prevented frontend crashes.
Existing characters linked to Notion pages support bidirectional sync:
Each sync operation is logged with timestamps. A "Prune Old Logs" function removes entries older than 30 days.
A subtle but important fix: when a linked Notion page is deleted or archived, Chi War now automatically unlinks it. Previously, the system would repeatedly fail to sync, generating errors indefinitely. Now it detects Notion's "archived" response and clears the notion_page_id from the character.
Creating development workspaces got faster.
Setting up a new git worktree for feature development took 3-4 minutes. Most of that time was Elixir compilation—building the Phoenix application from scratch.
The create-workspace.sh script now copies the pre-built _build directory:
echo ">>> Copying pre-built Elixir artifacts..."
if [ -d "$MAIN_DIR/shot-elixir/_build" ]; then
cp -R "$MAIN_DIR/shot-elixir/_build" shot-elixir/_build
echo " Copied _build from main repo (skips compilation)"
else
echo " No _build found in main repo, will compile from scratch"
fi
A 4.2-second copy operation replaces 118 seconds of compilation.
Multiple workspaces can run simultaneously on different port offsets. Port 4012/3011 for one feature, 4022/3021 for another. Each workspace is isolated with its own branches in all three repositories.
The frontend now presents different views based on user role.
Players see a simplified dashboard focused on their characters. Gamemasters see the full interface: fights, parties, sites, NPCs, and campaign management tools.
The navigation menu is split into separate GM and Player components. This reduces visual noise for players who don't need campaign administration options.
Dashboard modules now subscribe to WebSocket channels. When character data changes—through the CLI, another browser tab, or another user—the dashboard updates automatically. No more stale data requiring manual page reloads.
WebSocket subscriptions were added to several areas:
The pattern is consistent across all real-time features: Phoenix PubSub broadcasts events, frontend components subscribe via channels, and UI updates without user intervention.
The profile page was overloaded. It now splits into three focused pages:
/profile): Identity, hero image, campaign memberships/settings): Password, passkeys, CLI sessions/integrations): AI providers, Discord linkingEach page serves a distinct purpose. Finding specific settings is easier.
.json URL suffix for debuggingThe focus areas for this development sprint:
The project continues to be in alpha. These features prepare the foundation for eventual player testing.