generated-paths
The built-in Policy generated-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
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | closed |
| Timeout | 2000 ms |
| Events | set by its options |
| Tools | every tool, or as its options set |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
mirrors | object[] | required | The generated mirrors, each { path, stamp?, sourceField?, hint? }: a folder whose files are written from a source, which an edit must change instead. |
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: 'generated-paths',
// The constructor's options, which it decodes.
options: {
// The generated mirrors, each `{ path, stamp?, sourceField?, hint? }`: a folder whose files
// are written from a source, which an edit must change instead.
mirrors: [
{
// The fix, with `{source}` standing for the file's source; used when the file names
// one.
hint: 'Edit the record at its source: {source}',
// The mirror's folder, relative to the folder the Policy works in.
path: 'docs/decisions',
// The front matter field of a mirrored file that names its source.
sourceField: 'source',
// A file in the mirror's folder whose presence proves the folder is the generated
// mirror; without it, the folder always is.
stamp: '.pulled',
},
],
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'generated-paths',
},
],
});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.
allowed-paths
The built-in Policy allowed-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.