Mamori Inspector is a unified code inspection platform for VS Code that orchestrates multiple analysis tools and presents results in a single, developer-friendly interface.
- Japanese: README.ja.md
- Marketplace display name: Mamori Inspector: Code Quality Guard
Installation
- Install the Mamori Inspector extension in VS Code. In the Marketplace listing, it is displayed as Mamori Inspector: Code Quality Guard.
- Open the target repository as a VS Code workspace.
- Run the command
Mamori Inspector: Enable In Workspacefor the workspace folder where you want automatic save-time validation. - Save a supported file to trigger automatic save-time validation.
- If you also want validation on commit and push, run the command
Mamori Inspector: Install Git Hooksonce. - To remove the managed hooks, run
Mamori Inspector: Uninstall Git Hooks. Only Mamori-managed hooks are removed; hooks that Mamori did not create are left untouched.
CI
- GitHub Actions runs on
push,pull_request, andworkflow_dispatch. - The quality job runs
npm ci,npm run compile,npm run lint, andnpm teston Ubuntu and Windows. - The integration job runs
xvfb-run -a npm run test:integrationon Ubuntu after the quality job succeeds. - When a non-prerelease GitHub Release is published, a dedicated release workflow verifies that the release tag matches
package.jsonversion, accepting bothvX.Y.ZandX.Y.Z, and then publishes to the VS Code Marketplace by using theVSCE_PATsecret. Prerelease publishes run the same checks but skip Marketplace publication.
Initial Setup Notes
- Save-time validation is disabled by default and starts only after you run
Mamori Inspector: Enable In Workspacefor the target workspace folder. - Git hook validation does not start automatically on extension installation. You must install the managed hooks explicitly.
- To remove managed hooks, run
Mamori Inspector: Uninstall Git Hooks. This removes only the hooks that Mamori created and leaves any other hooks in.git/hooksuntouched. Mamori Inspector: Install Git Hookssynchronizes the bundled runner runtime into the workspace.mamori/directory before writing managed hooks, and the synchronized runtime includes.mamori/package.jsonwithtype: commonjsso the repository-local runner keeps loading correctly even when the target project uses"type": "module".- When a workspace already contains
.mamori/, Mamori also re-synchronizes that managed runtime automatically on extension activation and when the workspace folder is added in VS Code, so upgraded users normally do not need to rerun setup or hook installation after opening the workspace once. - If
.git/hooks/pre-commitor.git/hooks/pre-pushhas been replaced with a hook that is not managed by Mamori, Mamori does not overwrite it automatically. In that case, review the existing hook and switch it manually if you want to return to the managed hook behavior. - Managed pre-commit and pre-push hooks print a warning to stderr and exit successfully when
$REPO_ROOT/.mamori/mamori.jsis missing or the resolvednodecommand is unavailable, so stale hooks do not block commit or push. - If you want to pre-download the managed toolchain before the first validation run, execute
Mamori Inspector: Setup Managed Toolsonce. precommit/stagedrequires the Git CLI onPATHbecause staged files are resolved withgit -c core.quotepath=false diff --cached --name-only --diff-filter=ACMR.- For web checkers, Mamori resolves configuration in this order: explicit setting, discovered config file,
package.jsonsetting, bundled minimal config. - JavaScript files and HTML inline script checks fall back to the bundled minimal ESLint config when project configuration is not detected. The bundled fallback is intentionally conservative and uses compatibility-oriented core rules.
- TypeScript files use ESLint only when project configuration is provided explicitly, discovered from the workspace, or resolved from
package.json. Mamori does not apply the bundled JavaScript ESLint fallback to TypeScript files. - CSS and SCSS and Sass checks, and HTML inline style checks, fall back to the bundled minimal Stylelint config when project configuration is not detected.
- HTML checks fall back to the bundled minimal htmlhint config when project configuration is not detected.
Managed Tool Provisioning
- Mamori automatically provisions missing managed tools during
runexecution and stores them under.mamori/toolsand.mamori/nodein the workspace. - Use
Mamori Inspector: Setup Managed Toolswhen you want to download the managed toolchain in advance. - Use
Mamori Inspector: Clear Managed Tool Cachewhen you want to remove.mamori/tools,.mamori/node, and.mamori-inline-tmpand force a fresh download on the next run. - CLI equivalents are
mamori.js setupandmamori.js cache-clear. - During
setupandrun --execute, Mamori also updates the local.git/info/excludewith the workspace-root/.mamori/and/.mamori-inline-tmp/entries and any discovered repo-relative nested.mamorientries on a best-effort basis when the workspace contains a Git repository. This does not modify.gitignore, and it does not affect files that are already tracked by Git.
| Tool group | Managed version | Install location | Notes |
|---|---|---|---|
| Maven | 3.9.11 | .mamori/tools/maven/<version> |
Used when mvn is not available on PATH. |
| Gradle | 8.14.4 | .mamori/tools/gradle/<version> |
Used when gradle is not available on PATH. |
| Semgrep | 1.151.0 | .mamori/tools/python/packages |
Installed with pip when semgrep is not available on PATH. |
| Prettier / ESLint / Stylelint / htmlhint / TypeScript / HTML-Validate / Oxlint / doiuse / Knip | npm latest at install time | .mamori/node/node_modules/.bin |
Installed with npm and used when a project-local node_modules/.bin tool is not available. |
- For web tools, Mamori prefers the nearest project
node_modules/.binexecutable and falls back to.mamori/nodeonly when the project copy is missing. - For Maven, Gradle, and Semgrep, Mamori uses an existing command on
PATHfirst and only installs the managed copy when the command is missing. - Managed Node tool installation requires
npmonPATH. Managed Semgrep installation installs the Semgrep package automatically, but still requires a usable Python launcher such aspy,python, orpython3. On Windows, Mamori also probes the standardpylauncher location under the system root.
Current Behavior
- Java, JavaScript, JavaScript React, TypeScript, TypeScript React, CSS, SCSS, Sass, and HTML files trigger an automatic background check on save with debounce and recursion suppression only when
Mamori Inspector: Enable In Workspacehas been run for that workspace folder. - Save-time validation formats supported files first, then publishes diagnostics from the generated SARIF.
- Save-time formatting runs as Mamori Inspector's own internal workflow and does not modify VS Code's
editor.defaultFormatter,editor.formatOnSave, oreditor.codeActionsOnSaveautomatically. - If a save-time run ends with an execution error after writing partial SARIF output, Mamori still reflects the diagnostics that were already generated and keeps the failure detail in the output log.
- Save-time validation also shows a status bar message each time a formatter or checker actually starts, using the saved file name plus the single running tool name.
- JavaScript save-time validation skips Prettier and uses
eslint --fixfor direct files when explicit or discovered project ESLint configuration is available, and otherwise uses Prettier plus Mamori's bundled minimal ESLint config. Here, direct files do not include inline script extracted from HTML. - TypeScript save-time validation skips Prettier and uses
eslint --fixplus ESLint for direct files when project configuration is available through explicit settings, workspace discovery, orpackage.json#eslintConfig, and does not use Mamori's bundled JavaScript fallback for TypeScript. - CSS and SCSS and Sass save-time validation use Prettier and Stylelint, preferring explicit or discovered project configuration and otherwise using Mamori's bundled minimal Stylelint config.
- HTML save-time validation also extracts inline style blocks whose type is compatible with CSS into temporary CSS files for Stylelint, maps diagnostics back to the original HTML locations, and removes the temporary files after execution while preferring project Stylelint configuration and otherwise using Mamori's bundled minimal Stylelint config.
- HTML save-time validation uses Prettier and htmlhint, preferring explicit or discovered project configuration and otherwise using Mamori's bundled minimal htmlhint config.
- HTML save-time validation also extracts inline script blocks without
srcinto temporary JavaScript files for ESLint, maps diagnostics back to the original HTML locations, and removes the temporary files after execution while preferring project ESLint configuration and otherwise using Mamori's bundled minimal ESLint config. precommit/stagedresolves staged files viagit -c core.quotepath=false diff --cached --name-only --diff-filter=ACMRso that non-ASCII file names are passed through without octal escaping, runs Spotless first when available, and re-stages formatted files withgit add -- <files>. Managed pre-commit hooks wait for that formatting and re-staging step before letting the commit continue.precommit/stagedrunseslint --fixfor staged direct JavaScript and TypeScript files when project ESLint configuration is available, and otherwise runs Prettier for JavaScript plus CSS, SCSS, Sass, and HTML files before the configured checkers.precommit/stagedincludes HTML inline style blocks in the Stylelint target set while keeping HTML files themselves on htmlhint.precommit/stagedincludes HTML inline script blocks in the ESLint target set while keeping HTML files themselves on htmlhint.- Static analysis checks for
precommit/stagedcontinue in the background after formatting and re-staging when a managed pre-commit hook is used, and the results are surfaced through the follow-up notification flow. precommit/stagedreturns success without running checks when no staged files are detected, and requires the Git CLI onPATHfor staged-file resolution.prepush/workspaceruns lightweight Java checks plus CPD, and adds SpotBugs only when compiled class roots such astarget/classesorbuild/classes/java/mainexist.prepush/workspacealso runs ESLint, Stylelint, and htmlhint for workspace files, preferring explicit or discovered project configuration and otherwise using Mamori's bundled minimal configs.prepush/workspaceincludes HTML inline style blocks in Stylelint by using temporary CSS files and reporting findings on the original HTML locations.prepush/workspaceincludes HTML inline script blocks in ESLint by using temporary JavaScript files and reporting findings on the original HTML locations.manual/workspacecurrently reuses the lightweight Java check plan, and also runs ESLint, Stylelint, and htmlhint for workspace files by using the same resolution rules asprepush/workspace.- The command
Mamori Inspector: Run Workspace Checkexecutes a workspace-wide manual check and publishes diagnostics from the generated SARIF. - When a manual workspace check starts, Mamori shows a short-lived notification toast to signal the start, while the ongoing static-analysis progress remains in the status bar.
- Save-time and manual static-analysis progress are shown in the status bar, not as toast notifications.
- When a manual workspace check succeeds, the extension replaces previously published save diagnostics for the same workspace with the latest manual results.
- When a managed pre-commit run finds issues, Mamori shows a selectable notification that lets you open the Mamori output or run a workspace check, and the commit continues without automatically republishing staged-only findings to Problems.
- When a managed pre-push run finds rule violations, Mamori updates Problems from the latest pre-push SARIF, shows a warning notification, and lets the push continue.
- When a managed pre-push run ends with an execution error, Mamori still shows an error notification that asks you to review Problems and the Mamori Inspector output, reuses any generated pre-push SARIF when available, and lets the push continue.
- The commands
Mamori Inspector: Enable In WorkspaceandMamori Inspector: Disable In Workspacetoggle automatic save-time validation per workspace folder. The default is disabled. Enable In WorkspaceandDisable In Workspaceonly changemamori-inspector.enabled; they do not rewrite VS Code formatter or save-related editor settings.- When
mamori-inspector.saveCheckSkipFormattersis set totrue, all formatters (Spotless, Prettier, ESLint auto-fix) are skipped during automatic save checks. Static analysis checkers still run and diagnostics are still reported. The default isfalse. This setting is useful when an AI coding tool is editing files, because save-time formatting can cause the AI to encounter mismatched file content on subsequent edits. - The commands
Mamori Inspector: Enable Save FormattersandMamori Inspector: Disable Save Formatterstogglemamori-inspector.saveCheckSkipFormattersper workspace folder without opening the settings UI. - The command
Mamori Inspector: Setup Managed Toolsdownloads the managed Maven, Gradle, Semgrep, Prettier, ESLint, Stylelint, htmlhint, TypeScript, HTML-Validate, Oxlint, doiuse, and Knip toolchain into the workspace cache. - The command
Mamori Inspector: Clear Managed Tool Cacheremoves the managed cache directories under.mamori/toolsand.mamori/node, and also removes.mamori-inline-tmp. - The commands
Mamori Inspector: Install Git HooksandMamori Inspector: Uninstall Git Hookscall the same runner as the CLI and manage.git/hooks/pre-commitand.git/hooks/pre-push. - Maven and Gradle build definitions are inspected to resolve Java tooling such as Checkstyle, PMD, Spotless, CPD, and SpotBugs.
mamori.js setupprepares the same managed toolchain as the VS Code setup command and best-effort updates the local.git/info/excludewith the workspace-root/.mamori/and/.mamori-inline-tmp/entries and any discovered repo-relative nested.mamorientries, whilemamori.js cache-clearremoves the same cache directories and.mamori-inline-tmpas the VS Code cache-clear command.mamori.js hooks installandmamori.js hooks uninstallcreate or remove managedpre-commitandpre-pushhooks under.git/hooks.
HTML Inline JS And CSS Checks
- Mamori splits HTML validation across htmlhint for markup, ESLint for inline script blocks, and Stylelint for inline style blocks.
- Inline script checks target only
scripttags withoutsrcwhosetypeis omitted, empty,module, or a JavaScript MIME type such astext/javascript,application/javascript, orapplication/ecmascript. - Parameterized JavaScript MIME types such as
text/javascript; charset=utf-8are normalized and treated as JavaScript. - Inline script blocks with non-JavaScript
typevalues such astext/plainare excluded from ESLint. - Inline style checks target only
styletags whosetypeis omitted, empty,text/css, or a parameterizedtext/cssvalue such astext/css; charset=utf-8. - Inline style blocks with non-CSS
typevalues are excluded from Stylelint. - Findings from inline script and inline style checks are mapped back to the original HTML locations, and the temporary extracted files created under the workspace-root
.mamori-inline-tmp/directory are removed after each execution.
Validation Modes
| Trigger | Starts automatically after extension install | Additional setup | Scope | Notes |
|---|---|---|---|---|
| Save | No | Run Mamori Inspector: Enable In Workspace |
Saved file only | Runs when a supported file is saved in a workspace folder where Mamori Inspector is enabled. |
| Pre-commit | No | Run Mamori Inspector: Install Git Hooks |
Staged files only | Waits for formatting and re-staging, then lets static-analysis notifications arrive asynchronously while the commit continues. |
| Pre-push | No | Run Mamori Inspector: Install Git Hooks |
Workspace | Updates Problems and shows a notification on validation failure, then lets the push continue. |
| Manual | No | None | Workspace | Run with Mamori Inspector: Run Workspace Check. |
Save Validation Versus Git Hook Validation
- Save validation does not start until the target workspace folder is enabled with
Mamori Inspector: Enable In Workspace, and then runs only for the file being saved. - Save validation is intended for fast editor feedback and updates VS Code Problems from the generated SARIF.
- Git hook validation does not run until the managed hooks are installed.
- Managed hooks also skip with a warning instead of blocking when the local runner file has been removed or the resolved
nodecommand is unavailable. - Pre-commit validation runs on staged files only and re-stages formatter changes automatically. Managed hooks run formatting and re-staging before the commit proceeds, then continue static analysis in the background.
- Pre-push validation runs on the workspace scope, updates Problems when diagnostics are available, and surfaces the result as a notification before pushing changes continue.
AI Coding Tools
- Save-time formatters (Spotless, Prettier, ESLint auto-fix) rewrite file content immediately after each save. When an AI coding tool is making sequential edits during a session, these rewrites can cause the AI to encounter unexpected file content on the next edit, disrupting its context.
- To avoid this, run
Mamori Inspector: Disable Save Formattersbefore starting an AI coding session. This setsmamori-inspector.saveCheckSkipFormatterstotrueand skips all formatters during automatic save checks. Static analysis checkers still run and diagnostics are still reported as usual. - Run
Mamori Inspector: Enable Save Formatterswhen the AI coding session ends to restore normal save-time formatting. mamori-inspector.saveCheckSkipFormatterscan also be toggled manually in the VS Code workspace settings UI.
Files Required For Each Check
| Check | Files you should prepare | Notes |
|---|---|---|
| Java Checkstyle | pom.xml, build.gradle, or build.gradle.kts with Checkstyle configuration |
Java checks are resolved from Maven or Gradle build definitions. |
| Java PMD | pom.xml, build.gradle, or build.gradle.kts with PMD configuration |
Java checks are resolved from Maven or Gradle build definitions. |
| Java Spotless | pom.xml, build.gradle, or build.gradle.kts with Spotless configuration |
Used for Java formatting during save and pre-commit when configured. |
| Java SpotBugs | pom.xml, build.gradle, or build.gradle.kts with SpotBugs configuration |
prepush/workspace also needs compiled classes under target/classes or build/classes/java/main. |
| Java Semgrep | No required config file, or optional .semgrep.yml |
If .semgrep.yml is not present, Mamori uses the default p/java ruleset. |
| JavaScript / TypeScript ESLint | Optional: one of eslint.config.js, eslint.config.mjs, eslint.config.cjs, eslint.config.ts, eslint.config.mts, eslint.config.cts, .eslintrc, .eslintrc.js, .eslintrc.cjs, .eslintrc.json, .eslintrc.yaml, .eslintrc.yml, .eslintrc.ts, .eslintrc.mts, .eslintrc.cts, or package.json with eslintConfig |
Mamori prefers project configuration when present. JavaScript files and HTML inline script checks otherwise use a bundled minimal ESLint config, while TypeScript files require project ESLint configuration. |
| CSS / SCSS / Sass Stylelint | Optional: one of stylelint.config.js, stylelint.config.mjs, stylelint.config.cjs, stylelint.config.ts, stylelint.config.mts, stylelint.config.cts, .stylelintrc, .stylelintrc.js, .stylelintrc.cjs, .stylelintrc.json, .stylelintrc.yaml, .stylelintrc.yml, .stylelintrc.ts, .stylelintrc.mts, .stylelintrc.cts, or package.json with stylelint |
Mamori prefers project configuration when present and otherwise uses a bundled minimal Stylelint config for CSS files and HTML inline style checks. |
| HTML htmlhint | Optional: one of .htmlhintrc, .htmlhintrc.js, .htmlhintrc.cjs, .htmlhintrc.json, .htmlhintrc.yaml, .htmlhintrc.yml, or package.json with htmlhint |
Mamori prefers project configuration when present and otherwise uses a bundled minimal htmlhint config for HTML checks. |
| Prettier for JavaScript / CSS / HTML | No Mamori-specific config file is required | If your project uses a Prettier config, keep it in the project as usual so formatting behavior matches your repository rules. |
TypeScript tsc --noEmit |
tsconfig.json, or an explicitly configured tsconfig path |
No bundled default. Mamori skips tsc with a warning when no tsconfig is found. Used in pre-push and manual runs. |
| HTML HTML-Validate | Optional: one of .htmlvalidate.js, .htmlvalidate.cjs, .htmlvalidate.mjs, .htmlvalidate.json |
Complements htmlhint with structural and accessibility checks. When no config is found, Mamori uses a bundled minimal HTML-Validate config. |
| JavaScript / TypeScript Oxlint | Optional: .oxlintrc.json or oxlint.config.ts |
Runs as a fast complement to ESLint. When no config is found, Mamori uses a bundled minimal Oxlint config. Applies to direct files only (not HTML inline script) in the current release. |
| CSS / SCSS / Sass doiuse | package.json with browserslist, .browserslistrc, or a browserslist file |
Browserslist-based browser compatibility check. Mamori skips doiuse with a warning when no Browserslist config is found. Used in pre-push and manual runs. |
| JavaScript / TypeScript Knip | package.json, and optionally one of knip.json, knip.jsonc, .knip.json, .knip.jsonc, knip.js, knip.ts, and tsconfig.json |
Unused file, export, and dependency analysis. Mamori skips Knip with a warning when no package.json is found. Used in manual runs only. |
Spec
- docs/spec.md
Runner Structure
- docs/runner-structure.md