Skip to content

Commit 6e102a5

Browse files
committed
Clean commit, clean branch due to private info that slipped into the git history.
0 parents  commit 6e102a5

32 files changed

+1334
-0
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = tab
9+
indent_size = 4
10+
tab_width = 4

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
3+
main.js

.eslintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"env": { "node": true },
5+
"plugins": [
6+
"@typescript-eslint"
7+
],
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/eslint-recommended",
11+
"plugin:@typescript-eslint/recommended"
12+
],
13+
"parserOptions": {
14+
"sourceType": "module"
15+
},
16+
"rules": {
17+
"no-unused-vars": "off",
18+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
19+
"@typescript-eslint/ban-ts-comment": "off",
20+
"no-prototype-builtins": "off",
21+
"@typescript-eslint/no-empty-function": "off"
22+
}
23+
}

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release Obsidian plugin
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Use Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: "18.x"
19+
20+
- name: Build plugin
21+
run: |
22+
npm install
23+
npm run build
24+
npm run build-css
25+
cp dist/styles.css styles.css
26+
cp dist/main.js main.js
27+
28+
- name: Create release
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
tag="${GITHUB_REF#refs/tags/}"
33+
34+
gh release create "$tag" \
35+
--title="$tag" \
36+
--draft \
37+
main.js manifest.json styles.css

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# vscode
2+
.vscode
3+
4+
# Intellij
5+
*.iml
6+
.idea
7+
8+
# npm
9+
node_modules
10+
11+
# Don't include the compiled main.js file in the repo.
12+
# They should be uploaded to GitHub releases instead.
13+
main.js
14+
src/**/*.js
15+
dist
16+
17+
# Exclude sourcemaps
18+
*.map
19+
20+
# obsidian
21+
data.json
22+
23+
# Exclude macOS Finder (System Explorer) View States
24+
.DS_Store
25+
26+
# Dev notes and utility scripts
27+
*.local.md
28+
*.local.sh

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tag-version-prefix=""

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 @ctrl_alt_focus
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Auto Tag Plugin for Obsidian.md
2+
3+
Easily generate relevant tags for your Obsidian notes using the power of OpenAI.
4+
5+
## Overview
6+
7+
The Auto Tag plugin for Obsidian assists users in automatically generating tags for their notes. Whether you're unsure about which tags to use, forget to add them, or simply want to enhance your note's metadata, this plugin has got you covered.
8+
9+
## Features
10+
11+
- **Automatic Tag Generation**: Analyze the entire note or just a selected portion to generate relevant tags.
12+
- **Frontmatter Integration**: Automatically inserts tags into the note's frontmatter. If frontmatter doesn't exist, the plugin creates it.
13+
- **OpenAI Powered**: Utilizes OpenAI's API to ensure accurate and relevant tag suggestions.
14+
- **Demo Mode**: Try out the plugin's functionality and settings combinations without needing an API key.
15+
16+
## Getting Started
17+
18+
- Installation: Install the Auto Tag plugin from Obsidian's community plugins list.
19+
- Usage:
20+
- Open a note in Obsidian.
21+
- Optionally, select a portion of the text.
22+
- Trigger the "Auto Tag" command via the command dropdown.
23+
- OpenAI API Setup:
24+
- Create a new API key at [https://platform.openai.com](https://platform.openai.com).
25+
- Set up your billing and set a maximum monthly spending limit (start with 1 USD for example).
26+
- Open the plugin settings and enter your API key.
27+
28+
## Keeping cost down
29+
30+
The plugin comes with a **demo** mode **enabled by default**, allowing users to experience its functionality before deciding to set up an OpenAI API key. Please be aware that using the OpenAI API requires setting up payment and will incur costs, so review OpenAI's pricing before enabling the full mode.
31+
32+
The GPT 3.5 model is very cheap to use and works well enough. You can start by setting a maximum cost **limit of 1 or 2 USD** per month and see how it goes.
33+
34+
If cheaper and good enough alternatives to OpenAI become available that you would like me to try out, let me know!
35+
36+
## Feedback & Support
37+
38+
If you have suggestions, issues, or just want to share your experience with the plugin, please create an issue on GitHub.

esbuild.config.mjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import esbuild from "esbuild";
2+
import process from "process";
3+
import builtins from "builtin-modules";
4+
5+
const banner =
6+
`/*
7+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
8+
if you want to view the source, please visit the github repository of this plugin
9+
*/
10+
`;
11+
12+
const prod = ( process.argv[2] === "production" );
13+
14+
const context = await esbuild.context( {
15+
banner: {
16+
js: banner,
17+
},
18+
entryPoints: ["main.ts"],
19+
bundle: true,
20+
external: [
21+
"obsidian",
22+
"electron",
23+
"@codemirror/autocomplete",
24+
"@codemirror/collab",
25+
"@codemirror/commands",
26+
"@codemirror/language",
27+
"@codemirror/lint",
28+
"@codemirror/search",
29+
"@codemirror/state",
30+
"@codemirror/view",
31+
"@lezer/common",
32+
"@lezer/highlight",
33+
"@lezer/lr",
34+
...builtins],
35+
format: "cjs",
36+
target: "es2018",
37+
logLevel: "info",
38+
sourcemap: prod ? false : "inline",
39+
treeShaking: true,
40+
outdir: "dist",
41+
} );
42+
43+
if ( prod ) {
44+
await context.rebuild();
45+
process.exit( 0 );
46+
} else {
47+
await context.watch();
48+
}

main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import AutoTagPlugin from "src/plugin/autoTagPlugin";
2+
3+
export default AutoTagPlugin;

0 commit comments

Comments
 (0)