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
139 changes: 77 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,105 @@
# Obsidian Sample Plugin
# ClawVault

This is a sample plugin for Obsidian (https://obsidian.md).
Visual memory management for Obsidian vaults. ClawVault provides colored graph views, vault statistics, quick capture, and task management features to help you maintain a healthy knowledge base.

This project uses TypeScript to provide type checking and documentation.
The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definition format, which contains TSDoc comments describing what it does.
## Features

This sample plugin demonstrates some of the basic functionality the plugin API can do.
- Adds a ribbon icon, which shows a Notice when clicked.
- Adds a command "Open modal (simple)" which opens a Modal.
- Adds a plugin setting tab to the settings page.
- Registers a global click event and output 'click' to the console.
- Registers a global interval which logs 'setInterval' to the console.
### Status panel
A sidebar panel showing real-time vault statistics:
- Total files, nodes, and edges in your memory graph
- Node type breakdown (tasks, decisions, people, projects, etc.)
- Today's observations count and categories
- Inbox pending items count
- Quick access to the Kanban board

## First time developing plugins?
### Colored graph view
Automatically colors nodes in Obsidian's graph view based on folder categories:
- **Tasks** (gold/orange)
- **Decisions** (red)
- **People** (blue)
- **Projects** (green)
- **Lessons** (purple)
- **Inbox** (amber)
- **Backlog** (gray)

Quick starting guide for new plugin devs:
Run the "Setup graph colors" command to apply a neural-style color scheme to your graph.

- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with.
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it).
- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder.
- Install NodeJS, then run `npm i` in the command line under your repo folder.
- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`.
- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`.
- Reload Obsidian to load the new version of your plugin.
- Enable plugin in settings window.
- For updates to the Obsidian API run `npm update` in the command line under your repo folder.
### Quick capture
Press `Ctrl+Shift+C` (or run the command) to quickly capture thoughts to your inbox folder without leaving your current context.

## Releasing new releases
### File decorations
Visual indicators in the file explorer showing inbox items and other status markers.

- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release.
- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible.
- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases
- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release.
- Publish the release.
### Kanban board integration
Quick access to open your `Board.md` file as a task board.

> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`.
> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json`
## Commands

## Adding your plugin to the community plugin list
| Command | Description |
|---------|-------------|
| **ClawVault: Quick Capture** | Open the quick capture modal (Ctrl+Shift+C) |
| **ClawVault: Open Status Panel** | Open the status sidebar panel |
| **ClawVault: Open Kanban Board** | Open Board.md in a new tab |
| **ClawVault: Refresh Stats** | Force refresh all vault statistics |
| **ClawVault: Setup graph colors** | Configure neural-style graph colors |

- Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines).
- Publish an initial version.
- Make sure you have a `README.md` file in the root of your repo.
- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin.
## Settings

## How to use
- **Vault path override**: Optional path override for vault detection
- **Auto-refresh interval**: How often to refresh statistics (10-300 seconds)
- **Show status bar**: Toggle the status bar item showing node/edge counts
- **Show file decorations**: Toggle inbox indicators in the file explorer
- **Graph colors**: Customize colors for each category type

- Clone this repo.
- Make sure your NodeJS is at least v16 (`node --version`).
- `npm i` or `yarn` to install dependencies.
- `npm run dev` to start compilation in watch mode.
## Installation

## Manually installing the plugin
### From Obsidian Community Plugins
1. Open **Settings → Community plugins**
2. Select **Browse** and search for "ClawVault"
3. Select **Install**, then **Enable**

- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
### Manual installation
1. Download `main.js`, `manifest.json`, and `styles.css` from the latest release
2. Create a folder named `clawvault` in your vault's `.obsidian/plugins/` directory
3. Copy the downloaded files into the folder
4. Reload Obsidian and enable the plugin in **Settings → Community plugins**

## Improve code quality with eslint
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
- This project already has eslint preconfigured, you can invoke a check by running`npm run lint`
- Together with a custom eslint [plugin](https://github.com/obsidianmd/eslint-plugin) for Obsidan specific code guidelines.
- A GitHub action is preconfigured to automatically lint every commit on all branches.
## Vault structure

## Funding URL
ClawVault works best with vaults organized into category folders:

You can include funding URLs where people who use your plugin can financially support it.
```
vault/
├── inbox/ # Uncategorized captures
├── tasks/ # Task notes
├── decisions/ # Decision records
├── people/ # People notes
├── projects/ # Project documentation
├── lessons/ # Lessons learned
├── observations/ # Daily observations
├── backlog/ # Backlog items
├── .clawvault.json # Optional config file
└── .clawvault/
└── graph-index.json # Optional graph index
```

The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file:
### Configuration file (optional)

Create a `.clawvault.json` file in your vault root to customize behavior:

```json
{
"fundingUrl": "https://buymeacoffee.com"
"name": "My Vault",
"categories": ["tasks", "decisions", "people", "projects", "lessons"],
"version": "1.0"
}
```

If you have multiple URLs, you can also do:
## Support

```json
{
"fundingUrl": {
"Buy Me a Coffee": "https://buymeacoffee.com",
"GitHub Sponsor": "https://github.com/sponsors",
"Patreon": "https://www.patreon.com/"
}
}
```
- [GitHub Issues](https://github.com/Versatly/clawvault/issues) — Report bugs or request features
- [ClawVault Documentation](https://clawvault.dev) — Full documentation

## API Documentation
## License

See https://docs.obsidian.md
This plugin is released under the [0-BSD License](LICENSE).
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "ClawVault",
"version": "0.1.0",
"minAppVersion": "1.5.0",
"description": "Visual memory management for ClawVault vaults — colored graph, task dashboard, vault stats, and Tailscale sync.",
"description": "Visual memory management for Obsidian vaults — colored graph, task dashboard, and vault stats.",
"author": "Versatly",
"authorUrl": "https://clawvault.dev",
"fundingUrl": "https://github.com/Versatly/clawvault",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "obsidian-sample-plugin",
"version": "1.0.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"name": "obsidian-clawvault",
"version": "0.1.0",
"description": "Visual memory management for Obsidian vaults — colored graph, task dashboard, and vault stats.",
"main": "main.js",
"type": "module",
"scripts": {
Expand Down
22 changes: 11 additions & 11 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export function registerCommands(plugin: ClawVaultPlugin): void {
// Quick Capture command
plugin.addCommand({
id: COMMAND_IDS.QUICK_CAPTURE,
name: "ClawVault: Quick Capture",
hotkeys: [{ modifiers: ["Ctrl", "Shift"], key: "c" }],
name: "Quick capture",
callback: () => {
new CaptureModal(plugin.app).open();
},
Expand All @@ -27,7 +26,7 @@ export function registerCommands(plugin: ClawVaultPlugin): void {
// Open Status Panel command
plugin.addCommand({
id: COMMAND_IDS.OPEN_STATUS_PANEL,
name: "ClawVault: Open Status Panel",
name: "Open status panel",
callback: () => {
void activateStatusView(plugin);
},
Expand All @@ -36,7 +35,7 @@ export function registerCommands(plugin: ClawVaultPlugin): void {
// Open Kanban Board command
plugin.addCommand({
id: COMMAND_IDS.OPEN_KANBAN_BOARD,
name: "ClawVault: Open Kanban Board",
name: "Open kanban board",
callback: () => {
void plugin.app.workspace.openLinkText("Board.md", "", "tab");
},
Expand All @@ -45,7 +44,7 @@ export function registerCommands(plugin: ClawVaultPlugin): void {
// Force Refresh Stats command
plugin.addCommand({
id: COMMAND_IDS.REFRESH_STATS,
name: "ClawVault: Refresh Stats",
name: "Refresh stats",
callback: () => {
void plugin.refreshAll();
},
Expand All @@ -54,7 +53,7 @@ export function registerCommands(plugin: ClawVaultPlugin): void {
// Setup Graph Colors command
plugin.addCommand({
id: COMMAND_IDS.SETUP_GRAPH_COLORS,
name: "ClawVault: Setup graph colors (neural style)",
name: "Setup graph colors (neural style)",
callback: () => {
void setupGraphColors(plugin);
},
Expand Down Expand Up @@ -92,7 +91,8 @@ async function setupGraphColors(plugin: ClawVaultPlugin): Promise<void> {
const adapter = plugin.app.vault.adapter;

// 1. Write the CSS snippet
const snippetPath = ".obsidian/snippets/clawvault-graph.css";
const configDir = plugin.app.vault.configDir;
const snippetPath = `${configDir}/snippets/clawvault-graph.css`;
const snippetCSS = `/* ClawVault Graph Colors — Neural Style */
/* Auto-generated by ClawVault plugin. Dark bg, colored nodes, green links. */

Expand All @@ -112,7 +112,7 @@ async function setupGraphColors(plugin: ClawVaultPlugin): Promise<void> {
color: #2a7d4a;
}`;

const snippetDir = ".obsidian/snippets";
const snippetDir = `${configDir}/snippets`;
if (!(await adapter.exists(snippetDir))) {
await adapter.mkdir(snippetDir);
}
Expand Down Expand Up @@ -151,7 +151,7 @@ async function setupGraphColors(plugin: ClawVaultPlugin): Promise<void> {
color: { a: 1, rgb: hexToRgbInt(categoryColors[cat] ?? "#7f8c8d") },
}));

const graphConfigPath = ".obsidian/graph.json";
const graphConfigPath = `${configDir}/graph.json`;
let graphConfig: Record<string, unknown> = {};
try {
if (await adapter.exists(graphConfigPath)) {
Expand All @@ -163,7 +163,7 @@ async function setupGraphColors(plugin: ClawVaultPlugin): Promise<void> {
await adapter.write(graphConfigPath, JSON.stringify(graphConfig, null, 2));

// 3. Enable the CSS snippet
const appearancePath = ".obsidian/appearance.json";
const appearancePath = `${configDir}/appearance.json`;
let appearance: Record<string, unknown> = {};
try {
if (await adapter.exists(appearancePath)) {
Expand All @@ -180,7 +180,7 @@ async function setupGraphColors(plugin: ClawVaultPlugin): Promise<void> {
appearance["enabledCssSnippets"] = enabledSnippets;
await adapter.write(appearancePath, JSON.stringify(appearance, null, 2));

new Notice("ClawVault: Graph colors configured (neural style). Reload Obsidian to see changes.");
new Notice("Graph colors configured (neural style). Reload Obsidian to see changes.");
} catch (error) {
new Notice(`ClawVault: Failed to setup graph colors: ${error instanceof Error ? error.message : "unknown"}`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class ClawVaultPlugin extends Plugin {
});

// Add ribbon icon
this.addRibbonIcon("database", "ClawVault status", () => {
this.addRibbonIcon("database", "Open status panel", () => {
void this.activateStatusView();
});

Expand Down Expand Up @@ -182,7 +182,7 @@ export default class ClawVaultPlugin extends Plugin {
`🐘 ${stats.nodeCount.toLocaleString()} nodes · ${stats.edgeCount.toLocaleString()} edges`
);
} catch {
this.statusBarItem.setText("🐘 ClawVault");
this.statusBarItem.setText("Status unavailable");
}
}

Expand Down
12 changes: 3 additions & 9 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,9 @@ export class ClawVaultSettingTab extends PluginSettingTab {
const { containerEl } = this;
containerEl.empty();

// Header
new Setting(containerEl).setName("ClawVault settings").setHeading();

// General section
new Setting(containerEl).setName("General").setHeading();

new Setting(containerEl)
.setName("Vault path override")
.setDesc("Optional: Override the vault path (leave empty to auto-detect)")
.setDesc("Optional: override the vault path (leave empty to auto-detect)")
.addText((text) =>
text
.setPlaceholder("Auto-detect")
Expand Down Expand Up @@ -178,10 +172,10 @@ export class ClawVaultSettingTab extends PluginSettingTab {
new Setting(containerEl).setName("About").setHeading();

containerEl.createEl("p", {
text: "ClawVault is a visual memory health plugin for Obsidian. It provides graph insights, quick capture, and vault statistics.",
text: "A visual memory health plugin for Obsidian. It provides graph insights, quick capture, and vault statistics.",
});
containerEl.createEl("p", {
text: "For more information, visit the ClawVault documentation.",
text: "For more information, visit the documentation.",
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/status-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ClawVaultStatusView extends ItemView {
}

getDisplayText(): string {
return "ClawVault status";
return "Clawvault status";
}

getIcon(): string {
Expand Down Expand Up @@ -86,7 +86,7 @@ export class ClawVaultStatusView extends ItemView {

// Header
const header = this.statusContentEl.createDiv({ cls: "clawvault-status-header" });
header.createEl("h3", { text: "🐘 ClawVault" });
header.createEl("h3", { text: "Clawvault status" });
header.createEl("hr");

// Vault info
Expand All @@ -102,7 +102,7 @@ export class ClawVaultStatusView extends ItemView {

// Memory Graph section
const graphSection = this.statusContentEl.createDiv({ cls: "clawvault-status-section" });
graphSection.createEl("h4", { text: "Memory Graph" });
graphSection.createEl("h4", { text: "Memory graph" });

const graphStats = graphSection.createDiv({ cls: "clawvault-graph-stats" });
graphStats.createDiv({
Expand Down Expand Up @@ -158,7 +158,7 @@ export class ClawVaultStatusView extends ItemView {
// Kanban board link
const kanbanSection = this.statusContentEl.createDiv({ cls: "clawvault-status-section" });
const kanbanLink = kanbanSection.createEl("a", {
text: "📋 Open Kanban Board",
text: "Open kanban board",
cls: "clawvault-kanban-link",
});
kanbanLink.addEventListener("click", (event) => {
Expand Down Expand Up @@ -196,7 +196,7 @@ export class ClawVaultStatusView extends ItemView {
if (!this.statusContentEl) return;

const errorDiv = this.statusContentEl.createDiv({ cls: "clawvault-status-error" });
errorDiv.createEl("h4", { text: "🐘 ClawVault" });
errorDiv.createEl("h4", { text: "Clawvault status" });
errorDiv.createEl("p", {
text: "Could not load vault statistics.",
cls: "clawvault-error-message",
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"1.0.0": "0.15.0"
"0.1.0": "1.5.0"
}