Skip to content

Commit 2600ab7

Browse files
authored
Merge pull request #309 from jorgerojas26/feat/fk-jump
feat: add Foreign Key Jump in records table
2 parents 17dd134 + cd8c949 commit 2600ab7

9 files changed

Lines changed: 655 additions & 53 deletions

File tree

.atl/.skill-registry.cache.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"fingerprint": "8c2d82207ff0af3637fdba6bb03105578f142fea"
3+
}

.atl/skill-registry.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Skill Registry — lazysql
2+
3+
<!-- Auto-generated by gentle-ai skill-registry refresh. Run `gentle-ai skill-registry refresh --force` to regenerate. -->
4+
5+
Last updated: 2026-05-25
6+
7+
## Sources scanned
8+
9+
- /Users/jorgerojas/.config/agents/skills
10+
- /Users/jorgerojas/.agents/skills
11+
- /Users/jorgerojas/.config/opencode/skills
12+
- /Users/jorgerojas/.gemini/skills
13+
- /Users/jorgerojas/.copilot/skills
14+
- /Users/jorgerojas/.codex/skills
15+
16+
## Contract
17+
18+
**Delegator use only.** This registry is an index, not a summary. Any agent that launches subagents reads it to select relevant skills, then passes exact `SKILL.md` paths for the subagent to read before work.
19+
20+
`SKILL.md` remains the source of truth. Do not inject generated summaries or compact rules by default; pass paths so subagents load the full runtime contract and preserve author intent.
21+
22+
## Skills
23+
24+
| Skill | Trigger / description | Scope | Path |
25+
| --- | --- | --- | --- |
26+
| `branch-pr` | Create Gentle AI pull requests with issue-first checks. Trigger: creating, opening, or preparing PRs for review. | user | `/Users/jorgerojas/.config/opencode/skills/branch-pr/SKILL.md` |
27+
| `caveman` | Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested. | user | `/Users/jorgerojas/.agents/skills/caveman/SKILL.md` |
28+
| `chained-pr` | Trigger: PRs over 400 lines, stacked PRs, review slices. Split oversized changes into chained PRs that protect review focus. | user | `/Users/jorgerojas/.config/opencode/skills/chained-pr/SKILL.md` |
29+
| `cognitive-doc-design` | Design docs that reduce cognitive load. Trigger: writing guides, READMEs, RFCs, onboarding, architecture, or review-facing docs. | user | `/Users/jorgerojas/.config/opencode/skills/cognitive-doc-design/SKILL.md` |
30+
| `comment-writer` | Write warm, direct collaboration comments. Trigger: PR feedback, issue replies, reviews, Slack messages, or GitHub comments. | user | `/Users/jorgerojas/.config/opencode/skills/comment-writer/SKILL.md` |
31+
| `go-testing` | Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns. | user | `/Users/jorgerojas/.config/opencode/skills/go-testing/SKILL.md` |
32+
| `grill-with-docs` | Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions. | user | `/Users/jorgerojas/.agents/skills/grill-with-docs/SKILL.md` |
33+
| `issue-creation` | Create Gentle AI issues with issue-first checks. Trigger: creating GitHub issues, bug reports, or feature requests. | user | `/Users/jorgerojas/.config/opencode/skills/issue-creation/SKILL.md` |
34+
| `judgment-day` | Trigger: judgment day, dual review, adversarial review, juzgar. Run blind dual review, fix confirmed issues, then re-judge. | user | `/Users/jorgerojas/.config/opencode/skills/judgment-day/SKILL.md` |
35+
| `skill-creator` | Trigger: new skills, agent instructions, documenting AI usage patterns. Create LLM-first skills with valid frontmatter. | user | `/Users/jorgerojas/.config/opencode/skills/skill-creator/SKILL.md` |
36+
| `skill-improver` | Trigger: improve skills, audit skills, refactor skills, skill quality. Audit and upgrade existing LLM-first skills. | user | `/Users/jorgerojas/.config/opencode/skills/skill-improver/SKILL.md` |
37+
| `to-prd` | Turn the current conversation context into a PRD and publish it to the project issue tracker. Use when user wants to create a PRD from the current context. | user | `/Users/jorgerojas/.agents/skills/to-prd/SKILL.md` |
38+
| `work-unit-commits` | Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code. | user | `/Users/jorgerojas/.config/opencode/skills/work-unit-commits/SKILL.md` |
39+
40+
## Loading protocol
41+
42+
1. Match task context and target files against the `Trigger / description` column.
43+
2. Pass only the matching `Path` values to the subagent under `## Skills to load before work`.
44+
3. Instruct the subagent to read those exact `SKILL.md` files before reading, writing, reviewing, testing, or creating artifacts.
45+
4. If no matching skill exists, proceed without project skill injection and report `skill_resolution: none`.

CONTEXT.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Lazysql
2+
3+
Context language for interactive database exploration in terminal UI.
4+
5+
## Language
6+
7+
**Foreign Key Jump**:
8+
Keyboard action that follows a foreign key value from a source row cell to a referenced table view with a prefilled filter.
9+
_Avoid_: FK drilldown, relation follow, link jump
10+
11+
## Relationships
12+
13+
- A **Foreign Key Jump** starts from one selected table cell in a source row.
14+
- A **Foreign Key Jump** targets one referenced table view filtered by the selected value.
15+
16+
## Example dialogue
17+
18+
> **Dev:** "Should Enter open JSON or follow relation here?"
19+
> **Domain expert:** "If this cell supports **Foreign Key Jump**, Enter follows relation; otherwise Enter keeps existing behavior."
20+
21+
## Flagged ambiguities
22+
23+
- "drilldown" was used to mean both JSON inspection and FK navigation - resolved: use **Foreign Key Jump** only for relation navigation.

components/home.go

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (home *Home) showTable(databaseName, tableName string) {
205205
table = tab.Content.(*ResultsTable)
206206
home.TabbedPane.SwitchToTabByReference(tab.Reference)
207207
} else {
208-
table = NewResultsTable(&home.ListOfDBChanges, home.Tree, home.DBDriver, home.ConnectionIdentifier, home.ConnectionURL, home.ReadOnly).WithFilter()
208+
table = NewResultsTable(&home.ListOfDBChanges, home.Tree, home.DBDriver, home, home.ConnectionIdentifier, home.ConnectionURL, home.ReadOnly).WithFilter()
209209
table.SetDatabaseName(databaseName)
210210
table.SetTableName(tableName)
211211

@@ -233,6 +233,53 @@ func (home *Home) showTable(databaseName, tableName string) {
233233
app.App.ForceDraw()
234234
}
235235

236+
func (home *Home) ShowTableWithFilter(databaseName, tableName, where string) error {
237+
if tableName == "" {
238+
return fmt.Errorf("table name is required")
239+
}
240+
241+
tabReference := fmt.Sprintf("%s.%s", databaseName, tableName)
242+
tab := home.TabbedPane.GetTabByReference(tabReference)
243+
244+
var table *ResultsTable
245+
if tab != nil {
246+
table = tab.Content.(*ResultsTable)
247+
home.TabbedPane.SwitchToTabByReference(tab.Reference)
248+
} else {
249+
table = NewResultsTable(&home.ListOfDBChanges, home.Tree, home.DBDriver, home, home.ConnectionIdentifier, home.ConnectionURL, home.ReadOnly).WithFilter()
250+
table.SetDatabaseName(databaseName)
251+
table.SetTableName(tableName)
252+
home.TabbedPane.AppendTab(tableName, table, tabReference)
253+
}
254+
255+
if table.Filter != nil {
256+
table.Filter.SetCurrentFilterUnsafe(where)
257+
}
258+
259+
results := table.FetchRecords(func() {
260+
home.focusLeftWrapper()
261+
})
262+
263+
if !app.App.Config().DisableSidebar && len(results) > 1 && !table.GetShowSidebar() {
264+
table.ShowSidebar(true)
265+
}
266+
267+
if table.state.error == "" {
268+
if !home.treePinned && home.leftWrapperVisible {
269+
home.toggleLeftWrapper()
270+
}
271+
home.focusRightWrapper()
272+
}
273+
274+
app.App.ForceDraw()
275+
276+
if table.state.error != "" {
277+
return fmt.Errorf(table.state.error)
278+
}
279+
280+
return nil
281+
}
282+
236283
func (home *Home) focusRightWrapper() {
237284
home.Tree.RemoveHighlight()
238285

@@ -551,7 +598,7 @@ func (home *Home) createOrFocusEditorTab() {
551598
go table.loadEditorSchema()
552599
}
553600
} else {
554-
tableWithEditor := NewResultsTable(&home.ListOfDBChanges, home.Tree, home.DBDriver, home.ConnectionIdentifier, home.ConnectionURL, home.ReadOnly)
601+
tableWithEditor := NewResultsTable(&home.ListOfDBChanges, home.Tree, home.DBDriver, home, home.ConnectionIdentifier, home.ConnectionURL, home.ReadOnly)
555602
// Set database name before WithEditor so the table is ready for schema loading
556603
if dbName != "" {
557604
tableWithEditor.SetDatabaseName(dbName)

components/result_table_filter.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package components
22

33
import (
4+
"strings"
5+
46
"github.com/gdamore/tcell/v2"
57
"github.com/rivo/tview"
68

@@ -80,6 +82,24 @@ func (filter *ResultsTableFilter) GetCurrentFilter() string {
8082
return filter.currentFilter
8183
}
8284

85+
func (filter *ResultsTableFilter) SetCurrentFilterUnsafe(whereClause string) {
86+
trimmed := strings.TrimSpace(whereClause)
87+
if trimmed == "" {
88+
filter.currentFilter = ""
89+
filter.Input.SetText("")
90+
return
91+
}
92+
93+
if strings.HasPrefix(strings.ToUpper(trimmed), "WHERE ") {
94+
filter.currentFilter = trimmed
95+
filter.Input.SetText(strings.TrimSpace(trimmed[6:]))
96+
return
97+
}
98+
99+
filter.currentFilter = "WHERE " + trimmed
100+
filter.Input.SetText(trimmed)
101+
}
102+
83103
// Function to blur
84104
func (filter *ResultsTableFilter) RemoveHighlight() {
85105
filter.SetBorderColor(app.Styles.InverseTextColor)

0 commit comments

Comments
 (0)