omp packages

pi-multica-doctor0.1.6

Multica workspace health, one command

GitHub Actions Published 1 day ago MIT ~76 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-multica-doctor

CI Publish npm version npm downloads License: MIT Pi package Trusted Publishing

Multica workspace health, one command.

What this is

pi-multica-doctor is a TypeScript Pi package that reports read-only Multica workspace diagnostics as JSON. Run it as the /multica-doctor-check slash command, let an agent call the multica_doctor_check tool, or run the bundled CLI from a shell or script.

It surfaces problems and hints. It never repairs anything, never mutates Multica state, and never writes to your vault. Two probes really run today, auth_context and feedback_jsonl; the other three check names are reserved and report pass without checking, which the report states explicitly.

Features

  • Read-only diagnostics with a stable JSON report: checks, pass, fail_count, failures, and a per-check results array.
  • auth_context probe: reports whether MULTICA_TOKEN is set and whether a stale .multica/daemon_task_context.json is left in the working directory. Presence only — the token value is never read or printed.
  • feedback_jsonl probe: parses every nonblank line of the .jsonl files directly in the vault's feedback-events directory and reports invalid lines as a bounded file:line list plus one short excerpt.
  • results lists one entry per check in checks order with its own status and detail, so a passing report still shows which probes really ran.
  • Three entry points: a Pi slash command, a Pi tool for agents, and a CLI that prints the report to stdout and exits 0 on pass or 1 on fail.
  • cli_syntax, registry_tables, and stuck_runs are not implemented yet. They report pass without checking and say so in their detail, so nothing hides behind a green report.
  • No network calls and no secret handling beyond token presence checks.

Install

Install the published npm package into your user Pi settings:

pi install npm:pi-multica-doctor

Install into the current project instead:

pi install npm:pi-multica-doctor -l

The package also ships two CLI bins that point at the same entry script, pi-multica-doctor and multica-doctor-check, so the checks can run without Pi. Node >=22.18.0 is required, and the installed bins currently hit a Node TypeScript limit described under Usage → CLI.

Quick start

With the package installed in Pi, run the slash command:

/multica-doctor-check

From a source checkout, load the extension without installing it and run the same command:

npm install
pi -e .

The CLI prints the same report. Run it from a source checkout:

node ./bin/multica-doctor-check.js

Set OBSIDIAN_VAULT_ROOT when the checkout is not the vault root.

Usage

Pi slash command

/multica-doctor-check

The command prints the JSON report and, when Pi has a UI, notifies it with the pass/fail summary.

Pi tool

Agents can call multica_doctor_check directly. The tool takes no parameters and returns JSON like:

{
  "checks": [
    "auth_context",
    "cli_syntax",
    "registry_tables",
    "feedback_jsonl",
    "stuck_runs"
  ],
  "pass": true,
  "fail_count": 0,
  "failures": [],
  "results": [
    {
      "check": "auth_context",
      "status": "pass",
      "detail": "daemon_task_context.json: absent; MULTICA_TOKEN: present"
    },
    {
      "check": "cli_syntax",
      "status": "pass",
      "detail": "cli_syntax probe is not implemented yet; it reports pass without checking"
    },
    {
      "check": "registry_tables",
      "status": "pass",
      "detail": "registry_tables probe is not implemented yet; it reports pass without checking"
    },
    {
      "check": "feedback_jsonl",
      "status": "pass",
      "detail": "All 1 feedback-events JSONL file(s) have valid JSON lines"
    },
    {
      "check": "stuck_runs",
      "status": "pass",
      "detail": "stuck_runs probe is not implemented yet; it reports pass without checking"
    }
  ]
}
  • auth_context checks that MULTICA_TOKEN is nonempty and that .multica/daemon_task_context.json is absent from the current working directory. It does not validate the token with Multica.
  • feedback_jsonl parses each nonblank line of the .jsonl files directly in the vault's feedback-events directory. The probe looks for that directory under OBSIDIAN_VAULT_ROOT when the variable is set, and under the current working directory when it is unset, so OBSIDIAN_VAULT_ROOT takes precedence and there is no fallback to the working directory when the configured directory is missing. The directory is resolved from the FEEDBACK_EVENTS_RELATIVE constant in src/probes/feedback_jsonl.ts, and a failure detail names the relative path that was searched. Each line is parsed on its own, so a pretty-printed JSON object spread over several lines is reported as invalid. A missing or unreadable directory, an unreadable file, or an invalid JSON line fails the probe; an existing directory with no .jsonl files passes.
  • cli_syntax, registry_tables, and stuck_runs are not implemented yet. They report pass without checking CLI syntax, registry tables, or stuck runs, and their detail says so.

CLI

node ./bin/multica-doctor-check.js

The CLI writes the JSON report to stdout whether the checks pass or fail. It exits with status 0 when pass is true and 1 when pass is false. On failure, see fail_count and failures in the report. On any run, results shows which probes really ran. A startup error may exit without a report. Set OBSIDIAN_VAULT_ROOT if the checkout isn't the vault root.

The installed package exposes the same entry script as the bins pi-multica-doctor and multica-doctor-check, so npx pi-multica-doctor and npx multica-doctor-check are the installed forms. Node does not strip TypeScript types from files under node_modules, so those forms currently exit with ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING; run node ./bin/multica-doctor-check.js from a source checkout instead.

Package contents

Path Purpose
bin/multica-doctor-check.js CLI entry point behind both bins and the Pi multica-doctor-check command
extensions/index.ts Pi extension entry: registers the /multica-doctor-check command and the multica_doctor_check tool
src/multica_doctor_check.ts Check runner and the JSON report contract (CHECK_NAMES, results)
src/probes/auth_context.ts auth_context probe
src/probes/feedback_jsonl.ts feedback_jsonl probe and feedback-events directory discovery
README.md, LICENSE, CHANGELOG.md Shipped package docs

Those are the paths listed in files in package.json; tests/ and the GitHub workflows stay in the repository and are not part of the npm tarball.

Development

npm install
npm run ci
pi -e .

npm run ci runs npm run check: tsc --noEmit, node --test tests/*.test.mjs, and npm pack --dry-run. Run npm pack --dry-run yourself whenever you add, remove, or rename a shipped file. CI runs the same command on Ubuntu, Windows, and macOS. See CONTRIBUTING.md.

Release

Publishing uses npm Trusted Publishing by GitHub OIDC (id-token: write in .github/workflows/publish.yml). No NPM_TOKEN is stored in repository secrets, and none should be added.

Pushes and merges to main run CI only. A release is prepared in a pull request and then started explicitly:

  1. The version bump in package.json and the matching CHANGELOG.md entry ride in the same pull request. The workflows read the version from package.json on main.
  2. After that pull request merges, an owner dispatches .github/workflows/auto-release.yml on main with release_authorized set to true. It skips when the version matches the last v* tag or the tag already exists; otherwise it creates and pushes v<version>, opens the GitHub release, and triggers publish.yml for that tag.
  3. publish.yml checks out the ref, runs npm ci and npm run ci, skips a version that npm already has, and runs npm publish --access public.

publish.yml also runs on a v*.*.* tag push, on a published GitHub release, on a manual dispatch with an optional ref, and when the workflow file itself changes on main. Ordinary maintenance verification must not publish: do not tag or dispatch these workflows unless a release is authorized.

Docs

This README is the entry point on both GitHub and npm; the package keeps no separate docs/ directory.

Security

Pi packages can execute code with your local user permissions. Review extensions before installing third-party packages.

This package is read-only: it checks whether MULTICA_TOKEN is set without reading its value, looks for a stale .multica/daemon_task_context.json, and parses feedback JSONL files. It performs no network calls and writes nothing.

Only the latest published version receives security fixes. To report a vulnerability, see SECURITY.md.

Links

License

MIT — see LICENSE.