Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Plugin focuses on: status panel, task creation, vault stats.
*/

import { Notice, TFile, TFolder } from "obsidian";
import { Notice } from "obsidian";
import type ClawVaultPlugin from "./main";
import { COMMAND_IDS, STATUS_VIEW_TYPE } from "./constants";
import {
Expand All @@ -20,6 +20,52 @@
* Register all ClawVault commands
*/
export function registerCommands(plugin: ClawVaultPlugin): void {
// Sync now command
plugin.addCommand({
id: COMMAND_IDS.SYNC_NOW,
name: "ClawVault: Sync Now",

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 26 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI
hotkeys: [{ modifiers: ["Ctrl", "Shift"], key: "s" }],

Check failure on line 27 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Don't provide a default hotkey, as they might conflict with other hotkeys the user has already set, or that are included with Obsidian by default

Check failure on line 27 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Don't provide a default hotkey, as they might conflict with other hotkeys the user has already set, or that are included with Obsidian by default

Check failure on line 27 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Don't provide a default hotkey, as they might conflict with other hotkeys the user has already set, or that are included with Obsidian by default

Check failure on line 27 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Don't provide a default hotkey, as they might conflict with other hotkeys the user has already set, or that are included with Obsidian by default
callback: () => {
void plugin.syncNow("full");
},
});

// Pull-only sync command
plugin.addCommand({
id: COMMAND_IDS.SYNC_PULL,
name: "ClawVault: Sync Pull",

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 36 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI
callback: () => {
void plugin.syncNow("pull");
},
});

// Push-only sync command
plugin.addCommand({
id: COMMAND_IDS.SYNC_PUSH,
name: "ClawVault: Sync Push",

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 45 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI
callback: () => {
void plugin.syncNow("push");
},
});

// Focus sync status in the sidebar
plugin.addCommand({
id: COMMAND_IDS.SHOW_SYNC_STATUS,
name: "ClawVault: Show Sync Status",

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Use sentence case for UI text

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Use sentence case for UI text

Check failure on line 54 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI
callback: () => {
void plugin.focusSyncStatusSection();
},
});

// Open sync settings
plugin.addCommand({
id: COMMAND_IDS.CONFIGURE_SYNC,
name: "ClawVault: Configure Sync",

Check failure on line 63 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 63 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 63 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI

Check failure on line 63 in src/commands.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

The command name should not include the plugin name, the plugin name is already shown next to the command name in the UI
callback: () => {
plugin.openPluginSettings();
},
});

// Quick Capture command
plugin.addCommand({
id: COMMAND_IDS.QUICK_CAPTURE,
Expand Down
7 changes: 7 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ export const COMMAND_IDS = {
GENERATE_CANVAS_FROM_TEMPLATE: "clawvault-generate-canvas-from-template",
REFRESH_STATS: "clawvault-refresh-stats",
SHOW_OPEN_LOOPS: "clawvault-show-open-loops",
SYNC_NOW: "clawvault-sync-now",
SYNC_PULL: "clawvault-sync-pull",
SYNC_PUSH: "clawvault-sync-push",
SHOW_SYNC_STATUS: "clawvault-sync-status",
CONFIGURE_SYNC: "clawvault-sync-configure",
} as const;

export const MIN_SYNC_INTERVAL_MINUTES = 5;

export const CANVAS_TEMPLATE_IDS = {
PROJECT_BOARD: "project-board",
BRAIN_OVERVIEW: "brain-overview",
Expand Down
Loading
Loading