Skip to content

Commit d88e6d3

Browse files
committed
Add rulesync commands for Keyshort flashcards
1 parent a9cc2c5 commit d88e6d3

File tree

2 files changed

+162
-0
lines changed

2 files changed

+162
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
targets:
3+
- '*'
4+
description: Create Logseq Keyshort pages with #card flashcards using the <Scope>/Keyshort/<Action> (and optional <Subscope>) format
5+
argument-hint: Scope (required); Action (required); optional Subscope; Shortcut; Description; optional Grouped cards
6+
---
7+
# Create a Logseq Keyshort Page (with #card flashcards)
8+
9+
This command creates or updates Logseq Keyshort pages using the canonical `<Scope>/Keyshort/<Action>` format, with optional `<Subscope>` segments. It ensures `#card` flashcards are children of a parent block that carries the needed ancestry tags for Logseq's `{{cards ...}}` queries.
10+
11+
## Variables
12+
13+
- **Scope****Required**: The tool or domain (e.g., `VSCode`, `Lazygit`, `tmux`).
14+
- **Action****Required**: The shortcut action (e.g., `Open the Source Control Panel`).
15+
- **Subscope** – Optional: A subgroup within the scope (e.g., `Git`, `Terminal`, `Pane`).
16+
- **Shortcut** – Optional: Key chord(s) for the action (e.g., `Cmd+Shift+P`).
17+
- **Description** – Optional: Short explanation of what it does.
18+
- **Grouped cards** – Optional: If multiple related shortcuts should live on one page (e.g., Next/Previous), list them.
19+
20+
## Conventions
21+
22+
- **Page naming**:
23+
- Without subscope: `pages/<Scope>___Keyshort___<Action>.md`
24+
- With subscope: `pages/<Scope>___Keyshort___<Subscope>___<Action>.md`
25+
- **Link format**:
26+
- `[[<Scope>/Keyshort]]` and optionally `[[<Scope>/Keyshort/<Subscope>]]`
27+
- Always include `[[Keyshort]]` and `[[<Scope>]]` in the parent block.
28+
- **Flashcards**:
29+
- Use `#card` blocks only.
30+
- Avoid `Question :: Answer` blocks and any "Flashcard Questions" section.
31+
- **Frontmatter**:
32+
- Do not add or remove `tags::` on existing pages.
33+
34+
## Workflow
35+
36+
### Step 1: Normalize inputs
37+
38+
- Confirm Scope, Action, and optional Subscope.
39+
- If shortcut or description is missing, ask for it (or leave placeholders if the user wants a stub).
40+
- If grouped cards are requested, list each card's action, shortcut, and description.
41+
42+
### Step 2: Determine target page path
43+
44+
- If Subscope is provided, use: `pages/<Scope>___Keyshort___<Subscope>___<Action>.md`
45+
- Otherwise, use: `pages/<Scope>___Keyshort___<Action>.md`
46+
47+
### Step 3: Check for existing pages (dedup)
48+
49+
- Search for existing pages matching the intended title and close variants.
50+
- If a matching page exists, update it rather than creating a new page.
51+
52+
### Step 4: Create or update content (LFM)
53+
54+
- Use Logseq Flavored Markdown (bulleted blocks, no blank lines).
55+
- Create a parent block that includes ancestry tags:
56+
- `[[Keyshort]] [[<Scope>]] [[<Scope>/Keyshort]]`
57+
- Add `[[<Scope>/Keyshort/<Subscope>]]` if applicable.
58+
- Add `#card` blocks as children of that parent block.
59+
- For grouped cards, place multiple `#card` blocks under the same tagged parent block.
60+
61+
#### Example (single card)
62+
63+
~~~markdown
64+
- [[Keyshort]] [[VSCode]] [[VSCode/Keyshort]] [[VSCode/Keyshort/Git]]
65+
- **Open the Source Control Panel** #card
66+
- Shortcut: `Ctrl+Shift+G`
67+
- Description: Opens the Source Control panel.
68+
~~~
69+
70+
#### Example (grouped cards)
71+
72+
~~~markdown
73+
- [[Keyshort]] [[tmux]] [[tmux/Keyshort]] [[tmux/Keyshort/Pane]]
74+
- **Move Pane Up** #card
75+
- Shortcut: `<keys>`
76+
- Description: Moves the pane up.
77+
- **Move Pane Down** #card
78+
- Shortcut: `<keys>`
79+
- Description: Moves the pane down.
80+
~~~
81+
82+
## Report
83+
84+
- Report the created/updated page path.
85+
- Summarize the cards added or updated.
86+
87+
## Related
88+
89+
Use the prefix that matches the type: `rule:` for rules, `command:` for commands, `skill:` for skills.
90+
91+
- rule: `logseq-page-naming-reference` – File naming and link conventions
92+
- rule: `logseq-flavored-markdown` – LFM formatting rules
93+
- command: `logseq-manage-shortcut-flashcards` – Audit and maintain Keyshort pages
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
targets:
3+
- '*'
4+
description: Audit or update Logseq Keyshort pages to ensure #card flashcards and proper ancestry tags
5+
argument-hint: Optional Scope (e.g., VSCode, Lazygit); optional Subscope; mode (audit or update)
6+
---
7+
# Manage Logseq Keyshort Flashcards
8+
9+
This command audits or updates Keyshort pages to ensure `#card` flashcards inherit the correct tags from parent blocks and are picked up by Logseq `{{cards ...}}` queries.
10+
11+
## Variables
12+
13+
- **Scope** – Optional: Restrict to a specific scope (e.g., `VSCode`, `Lazygit`, `tmux`).
14+
- **Subscope** – Optional: Narrow further (e.g., `Git`, `Terminal`).
15+
- **Mode****Required**: `audit` or `update`.
16+
17+
## Conventions
18+
19+
- **Pages**:
20+
- `pages/<Scope>___Keyshort___<Action>.md`
21+
- `pages/<Scope>___Keyshort___<Subscope>___<Action>.md`
22+
- **Ancestry tags**:
23+
- Parent block must include `[[Keyshort]]` and `[[<Scope>]]`.
24+
- Include `[[<Scope>/Keyshort]]` and `[[<Scope>/Keyshort/<Subscope>]]` when applicable.
25+
- **Flashcards**:
26+
- Use `#card` blocks only.
27+
- Do not add `Question :: Answer` blocks.
28+
- **Frontmatter**:
29+
- Do not add or remove `tags::` on existing pages.
30+
31+
## Workflow
32+
33+
### Step 1: Discover Keyshort pages
34+
35+
- If Scope is provided, search for:
36+
- `pages/<Scope>___Keyshort___*.md`
37+
- If Scope is not provided, search for all `pages/*___Keyshort___*.md`.
38+
39+
### Step 2: Audit each page
40+
41+
Check for:
42+
- Presence of a parent block containing `[[Keyshort]]` and `[[<Scope>]]`.
43+
- Presence of `[[<Scope>/Keyshort]]` (and `[[<Scope>/Keyshort/<Subscope>]]` if applicable).
44+
- `#card` blocks as children of the tagged parent block.
45+
- Any "Flashcard Questions" sections or `Question :: Answer` blocks (flag these for removal or refactor).
46+
47+
### Step 3: Apply updates (only in `update` mode)
48+
49+
- Add missing ancestry links to the parent block without altering existing content.
50+
- If a page has shortcut content but no `#card`, wrap or convert the relevant block into a `#card` block.
51+
- If `Question :: Answer` blocks exist, convert to `#card` blocks or remove the section (ask if ambiguous).
52+
53+
### Step 4: Summarize results
54+
55+
- List pages audited.
56+
- For updates, summarize changes per page.
57+
58+
## Report
59+
60+
- Provide a concise audit summary, with any pages needing manual review.
61+
- If updates were applied, list each updated page path.
62+
63+
## Related
64+
65+
Use the prefix that matches the type: `rule:` for rules, `command:` for commands, `skill:` for skills.
66+
67+
- rule: `logseq-page-naming-reference` – File naming and link conventions
68+
- rule: `logseq-flavored-markdown` – LFM formatting rules
69+
- command: `logseq-create-shortcut` – Create new Keyshort pages

0 commit comments

Comments
 (0)