diff --git a/AGENTS.md b/AGENTS.md index 2fbe85c..8ed7e10 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,10 +9,12 @@ ## Environment & tooling - Node.js: use current LTS (Node 18+ recommended). -- Package manager: npm. -- Bundler: esbuild (preferred). Rollup or webpack are acceptable if they bundle all external dependencies into `main.js`. +- **Package manager: npm** (required for this sample - `package.json` defines npm scripts and dependencies). +- **Bundler: esbuild** (required for this sample - `esbuild.config.mjs` and build scripts depend on it). Alternative bundlers like Rollup or webpack are acceptable for other projects if they bundle all external dependencies into `main.js`. - Types: `obsidian` type definitions. +**Note**: This sample project has specific technical dependencies on npm and esbuild. If you're creating a plugin from scratch, you could choose different tools, but you'll need to replace the build configuration accordingly. + ### Install @@ -59,7 +61,7 @@ npm run build constants.ts types.ts # TypeScript interfaces and types ``` -- Do not commit `node_modules/` or build artifacts. +- **Do not commit build artifacts**: Never commit `node_modules/`, `main.js`, or other generated files to version control. - Keep the plugin small. Avoid large dependencies. Prefer browser-compatible packages. - Generated output should be placed at the plugin root or `dist/` depending on your build setup. Release artifacts must end up at the top level of the plugin folder in the vault (`main.js`, `manifest.json`, `styles.css`). @@ -94,7 +96,7 @@ npm run build ## Versioning & releases - Bump `version` in `manifest.json` (SemVer) and update `versions.json` to map plugin version → minimum app version. -- Create a GitHub release whose tag exactly matches `manifest.json`'s `version` (avoid a leading `v` unless your repo uses it consistently). +- Create a GitHub release whose tag exactly matches `manifest.json`'s `version`. Do not use a leading `v`. - Attach `manifest.json`, `main.js`, and `styles.css` (if present) to the release as individual assets. - After the initial release, follow the process to add/update your plugin in the community catalog as required. @@ -234,7 +236,8 @@ this.registerInterval(window.setInterval(() => { /* ... */ }, 1000)); ## Troubleshooting -- Plugin doesn't load after build: ensure `main.js` and `manifest.json` are at the top level of the plugin folder under `/.obsidian/plugins//`. +- Plugin doesn't load after build: ensure `main.js` and `manifest.json` are at the top level of the plugin folder under `/.obsidian/plugins//`. +- Build issues: if `main.js` is missing, run `npm run build` or `npm run dev` to compile your TypeScript source code. - Commands not appearing: verify `addCommand` runs after `onload` and IDs are unique. - Settings not persisting: ensure `loadData`/`saveData` are awaited and you re-render the UI after changes. - Mobile-only issues: confirm you're not using desktop-only APIs; check `isDesktopOnly` and adjust.