Skip to Content
harness-kit

workspace-links

The built-in Policy workspace-links, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it.

To learn what it guards against and see it at work, read the guide: Session start.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeopen
Timeout9000 ms
EventsSessionStart, PreToolUse
ToolsBash, Edit, MultiEdit, NotebookEdit, Write
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
deadlineMillisinteger—How long the check may take, in milliseconds, before it says why it could not finish (6000 when absent).
installCommandstring—The command the context tells the agent to run in the checkout; the project's package manager's when absent.
manifestsstring—The glob, relative to the checkout, of its workspace packages' manifests; when absent, the manifests of the folders the workspaces of the checkout's root package.json names (an array of globs, or Yarn's { packages }), none without one.
scopestring—The prefix of the workspace package names the check reads, such as @acme/; every workspace package when absent.

Example

A configuration that writes every option, a comment above each:

import { defineConfig } from '@microeinhundert/harness-kit';

export default defineConfig({
  // The Policy entries, in the order their Decisions merge in.
  policies: [
    {
      // The Policy's name, unique in the configuration; messages and logs name the Policy by it.
      id: 'workspace-links',
      // The constructor's options, which it decodes.
      options: {
        // How long the check may take, in milliseconds, before it says why it could not finish
        // (6000 when absent).
        deadlineMillis: 1,
        // The command the context tells the agent to run in the checkout; the project's package
        // manager's when absent.
        installCommand: 'npm ci',
        // The glob, relative to the checkout, of its workspace packages' manifests; when absent,
        // the manifests of the folders the `workspaces` of the checkout's root `package.json` names
        // (an array of globs, or Yarn's `{ packages }`), none without one.
        manifests: 'packages/*/package.json',
        // The prefix of the workspace package names the check reads, such as `@acme/`; every
        // workspace package when absent.
        scope: '@acme/',
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'workspace-links',
    },
  ],
});

On this page