Skip to Content
harness-kit

protected-paths

The built-in Policy protected-paths, against writes to files that must not be edited, or outside where they belong: its defaults, its options and a configuration that writes it.

To learn what it guards against and see it at work, read the guide: Paths and new files.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeclosed
Timeout2000 ms
Eventsset by its options
Toolsevery tool, or as its options set
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
hintstring—The step that clears a refusal, in place of the kit's own.
pathsstring[]requiredGlobs, relative to the folder the Policy works in, of the files no tool may change.

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: 'protected-paths',
      // The constructor's options, which it decodes.
      options: {
        // The step that clears a refusal, in place of the kit's own.
        hint: 'Ask the user to change this file by hand.',
        // Globs, relative to the folder the Policy works in, of the files no tool may change.
        paths: ['.env*'],
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'protected-paths',
    },
  ],
});

On this page