Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

project bindings: sort lists A→Z by display name + codify the rule in CLAUDE.md §8

wyt3a997951a273
diff --git a/CLAUDE.md b/CLAUDE.md
index c8b66fc9..18bf7d65 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -272,6 +272,7 @@ Vanilla HTML/CSS/JS, classic `<script>` multi-file (no ESM, no build). Cross-fil
- `src/renderer/` **does not participate in typecheck** (vanilla + DOM gives too many checkJs false positives); main/ stays at `checkJs: true`.
- Process-info-row icons use only Unicode Geometric Shapes (`▶ ● ◆ ◇ ■ ▣ ▷ ◐ ◉ ○ ◯ ▪`); **no colored emoji**.
- The UI shares one set of classes (`.btn / .btn-sm / .btn-primary / .btn-danger / .detail-actions / .empty / .muted`); differences are expressed via `.is-*` modifiers; **don't open near-duplicate classes**.
+- **Inventory lists sort A→Z by display name**: any UI list of user-named entities the user scans by name (agents / skills / project bindings + candidate pickers / similar future inventories) defaults to A→Z using `(a.name || a.id || '').localeCompare(other, undefined, { sensitivity: 'base', numeric: true })` — case + diacritics fold, `Item 2` precedes `Item 10`, zh + en mix sorts under default locale collation. **Why:** insertion / mtime order isn't a stable mental model for a name-lookup UI — re-renders shuffle it and users report "很乱" the moment a list grows past a screen. **Exempt** lists where the ordering IS the signal: conversation sidebar (last_active_at desc), search results (score desc), plan rail (step index asc), KB tree (path hierarchy), agent / skill picker fuzzy-search results (match-quality desc — see `agents.js::_renderAgentPickerList`).
- **IME composition guard on Enter / Arrow shortcuts**: every keydown handler on an `<input>` / `<textarea>` that triggers an action (Enter→submit / search-jump / form-confirm; Arrow→list selection) **must early-return when `e.isComposing || e.keyCode === 229`**. **Why:** Chinese / Japanese / Korean IMEs use Enter to commit a composition candidate; without this guard, "Enter to confirm an English candidate when the primary suggestion is already English" silently fires the action and the user navigates away mid-typing. We've already hit this on the global search overlay; the chat input (`modules/conversation.js`) and the new-chat input (`modules/state.js`) had it from the start, the search input was missing it. Pattern to copy: `if (e.isComposing || e.keyCode === 229) return;` at the top of the handler. The `keyCode === 229` arm covers older Electron / Safari builds where `isComposing` is occasionally inaccurate.
### i18n (zh / en)
diff --git a/src/renderer/modules/project-detail.js b/src/renderer/modules/project-detail.js
index a3eba970..e05e2581 100644
--- a/src/renderer/modules/project-detail.js
+++ b/src/renderer/modules/project-detail.js
@@ -80,8 +80,9 @@ function _renderProjectDetail() {
function _renderBindingsRows(kind, items, staleIds) {
const lang = _activeLang();
const removeLabel = escapeHtml(t('project.bindings.remove'));
+ const sorted = (items || []).slice().sort(_byDisplayName);
const rows = [];
- for (const it of items) {
+ for (const it of sorted) {
const id = (kind === 'agent') ? it.agent_id : it.id;
const name = escapeHtml(it.name || id);
const desc = _pickItemDescription(it, lang);
@@ -125,6 +126,17 @@ function _activeLang() {
return 'en';
}
+/** Stable A→Z order by display name (case + diacritic insensitive,
+ * numeric-aware so "Item 2" precedes "Item 10"). Falls back to id when
+ * a name is missing. Used in both the bound-items rail and the candidate
+ * picker so user-facing lists stay legible regardless of insertion
+ * order. zh + en mix sorts reasonably under default locale collation. */
+function _byDisplayName(a, b) {
+ const na = (a && (a.name || a.agent_id || a.id)) || '';
+ const nb = (b && (b.name || b.agent_id || b.id)) || '';
+ return na.localeCompare(nb, undefined, { sensitivity: 'base', numeric: true });
+}
+
function _pickItemDescription(item, lang) {
// Centralised across the renderer: `utils.js::pickDesc` does the
// cross-locale fallback (zh ?? en ?? '') so a one-language entry never
@@ -164,7 +176,7 @@ async function _openAddPicker(kind) {
projectId: _projectDetailPid,
});
if (!res?.ok) throw new Error(res?.error || 'load_failed');
- candidates = (kind === 'agent') ? (res.agents || []) : (res.skills || []);
+ candidates = ((kind === 'agent') ? (res.agents || []) : (res.skills || [])).slice().sort(_byDisplayName);
} catch (err) {
_projectDetailLog.warn('load candidates failed', err);
return;