farna-bootstrapper 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +26 -3
- package/dist/compose/resolve.d.ts +8 -1
- package/dist/compose/resolve.js +31 -0
- package/dist/core/constants.d.ts +13 -2
- package/dist/core/constants.js +16 -1
- package/dist/lock/lockfile.d.ts +1 -0
- package/dist/materialise/source-tree.d.ts +2 -2
- package/dist/materialise/source-tree.js +5 -2
- package/dist/source/schema.d.ts +5 -0
- package/dist/source/schema.js +10 -1
- package/dist/verify/containment.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Before 1.0.0, a minor
|
|
7
7
|
release may contain a breaking change; every change of that kind is listed under **Changed**.
|
|
8
8
|
|
|
9
|
+
## [0.1.1] - 2026-11-22
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Persona `mode`.** A persona may declare `mode: primary`, `subagent` or `all`, which both
|
|
14
|
+
OpenCode targets emit as the per-agent `mode`. The default when the key is absent is `subagent`,
|
|
15
|
+
so an existing source renders byte for byte as before. The value composes with `extends`: a
|
|
16
|
+
derived persona inherits its base's mode and may override it.
|
|
17
|
+
- **`W117_PERSONA_MODE_IGNORED`.** Claude Code has no primary/subagent mode, so a persona that
|
|
18
|
+
declares `mode` on the `claudecode` target is reported at info severity, naming the persona and
|
|
19
|
+
the target, and the emitted Claude Code file carries no `mode` key.
|
|
20
|
+
|
|
21
|
+
Both OpenCode examples now declare `mode: primary` on their live persona, and the README documents
|
|
22
|
+
the field, its composition and the Claude Code warning.
|
|
23
|
+
|
|
9
24
|
## [0.1.0] - 2026-11-22
|
|
10
25
|
|
|
11
26
|
The first public release. `farna-bootstrapper` compiles named agent personas and their resources
|
|
@@ -88,4 +103,5 @@ output still matches the source.
|
|
|
88
103
|
runner does not grant), the POSIX mode assertions, the FIFO cases and the install-layout suite are
|
|
89
104
|
skipped on Windows; CI runs them on Linux.
|
|
90
105
|
|
|
106
|
+
[0.1.1]: https://github.com/farnalabs/farna-bootstrapper/releases/tag/v0.1.1
|
|
91
107
|
[0.1.0]: https://github.com/farnalabs/farna-bootstrapper/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -242,6 +242,26 @@ resources:
|
|
|
242
242
|
- permission/python-tools
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
A persona may also declare **`mode`**, which selects its OpenCode agent mode: `primary` makes the
|
|
246
|
+
agent selectable as the main agent, `subagent` makes it callable only by another agent, and `all`
|
|
247
|
+
makes it both. `subagent` is the default when the key is absent. The value is source-derived and
|
|
248
|
+
composes with `extends`: a derived persona inherits its base's `mode`, and a child declaration
|
|
249
|
+
overrides it. Both OpenCode targets emit it; Claude Code has no primary/subagent distinction, so a
|
|
250
|
+
declared `mode` there is reported as `W117_PERSONA_MODE_IGNORED` (info) and no `mode` key is
|
|
251
|
+
written.
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
# .farna/personas/builder.yaml — a primary agent on an OpenCode target
|
|
255
|
+
kind: persona
|
|
256
|
+
id: builder
|
|
257
|
+
displayName: Builder
|
|
258
|
+
purpose: Writes code, runs the tests, and follows the house conventions.
|
|
259
|
+
mode: primary
|
|
260
|
+
resources:
|
|
261
|
+
- rule/house-style
|
|
262
|
+
- permission/builder-default
|
|
263
|
+
```
|
|
264
|
+
|
|
245
265
|
```markdown
|
|
246
266
|
---
|
|
247
267
|
kind: rule
|
|
@@ -367,6 +387,7 @@ tick).
|
|
|
367
387
|
|---|---|---|---|---|---|---|
|
|
368
388
|
| `rule` | native | — | native | — | native | — |
|
|
369
389
|
| `model` | native | — | native | — | native | — |
|
|
390
|
+
| `mode` (`primary`/`subagent`/`all`) | not carried (`W117`) | — | native | — | native | — |
|
|
370
391
|
| `permission` | native (allow-list via opt-in) | — | native (deny-list; `write` folds into `edit`, W112) | — | native (per-tool map; `write` folds into `edit`, W112) | — |
|
|
371
392
|
| `mcp` | not carried | — | not carried in agent mode | profile only (`mcp.servers`) | not carried in agent mode | profile only (flat `mcp.<name>`) |
|
|
372
393
|
| `skill` | not carried | — | not carried in agent mode | profile only | not carried in agent mode | profile only |
|
|
@@ -696,6 +717,7 @@ is part of the code's definition, never set by a flag.
|
|
|
696
717
|
| `W114_RENDERER_INTEGRITY_UNVERIFIED` | medium | No npm lock record at the install root supplied the renderer's tarball integrity. The pinned version is still enforced; this is a provenance gap, never a clean pass. |
|
|
697
718
|
| `W115_CREDENTIAL_IN_URL` | high | An MCP `http` URL carries a credential-shaped query parameter (`token`, `api_key`, `apikey`, `access_token`, `secret`, `password`). The value is never echoed. |
|
|
698
719
|
| `W116_SECRET_IN_ARGS` | high | An MCP `args` literal looks like a credential (`sk-`, `ghp_`, `glpat-`, `npm_`, `AKIA`, a JWT, or a long token-shaped string). The value is never echoed; put the credential in `env` or `headers` instead. |
|
|
720
|
+
| `W117_PERSONA_MODE_IGNORED` | info | A persona declares `mode`, which Claude Code cannot carry: it has no primary/subagent mode. The persona and target are named and no `mode` key is written; the agent file is otherwise emitted in full. |
|
|
699
721
|
|
|
700
722
|
### Exit codes
|
|
701
723
|
|
|
@@ -970,9 +992,10 @@ These are deliberate limits of the current controls, stated rather than implied
|
|
|
970
992
|
- **An empty directory is left after a skill's last file is removed.** Only recorded regular files
|
|
971
993
|
are removed; the now-empty `<skill>/` (or `scripts/`) directory is harmless and carries no
|
|
972
994
|
declaration.
|
|
973
|
-
- **The
|
|
974
|
-
|
|
975
|
-
|
|
995
|
+
- **The per-agent `mode` is source-derived, not implied by the render mode.** A persona's declared
|
|
996
|
+
`mode` (default `subagent`) is emitted on both OpenCode targets; profile mode does not promote the
|
|
997
|
+
live persona implicitly. Claude Code has no primary/subagent mode, so a declaration there is
|
|
998
|
+
reported (`W117`) and no `mode` key is written.
|
|
976
999
|
- **No coverage gate.** There is no coverage provider or threshold in this slice. CI runs lint,
|
|
977
1000
|
type-check, tests (with a minimum count and real-renderer suite assertions), a dependency audit at
|
|
978
1001
|
`moderate`, and a published-tarball check.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
|
-
import { type RenderMode, type SupportedTarget } from '../core/constants.js';
|
|
2
|
+
import { type PersonaMode, type RenderMode, type SupportedTarget } from '../core/constants.js';
|
|
3
3
|
import { type OpencodePermissionCategory, type OpencodePermissionRecord, type ResolvedPermissions } from '../permissions/permissions.js';
|
|
4
4
|
import { type Warning } from '../report/warnings.js';
|
|
5
5
|
import type { HookResource, McpResource, SkillFile, SourceTree } from '../source/load.js';
|
|
@@ -75,6 +75,13 @@ export type ResolvedPersona = {
|
|
|
75
75
|
extends?: string;
|
|
76
76
|
/** The full composition chain, base first, this persona last. */
|
|
77
77
|
chain: string[];
|
|
78
|
+
/**
|
|
79
|
+
* The effective OpenCode agent mode this persona declares, with a composed
|
|
80
|
+
* base's value overridden by its children. Absent means no persona in the
|
|
81
|
+
* chain declared one, so the target emits its default (`subagent`). The
|
|
82
|
+
* field is not emitted on Claude Code, which has no such concept.
|
|
83
|
+
*/
|
|
84
|
+
mode?: PersonaMode;
|
|
78
85
|
rules: ResolvedRule[];
|
|
79
86
|
mcp: ResolvedMcp[];
|
|
80
87
|
skills: ResolvedSkill[];
|
package/dist/compose/resolve.js
CHANGED
|
@@ -106,6 +106,22 @@ function resolveModel(chain, config, target) {
|
|
|
106
106
|
}
|
|
107
107
|
return distinct[0];
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The mode a composed persona declares. A mode is inherited from the base and
|
|
111
|
+
* overridden by the most derived persona that declares one; a chain with no
|
|
112
|
+
* declaration returns `undefined`, which is the target's default. Unlike the
|
|
113
|
+
* model there is no conflict: the child is the more specific declaration, so
|
|
114
|
+
* overriding is the intended composition.
|
|
115
|
+
*/
|
|
116
|
+
function resolveMode(chain) {
|
|
117
|
+
for (let index = chain.length - 1; index >= 0; index -= 1) {
|
|
118
|
+
const declared = chain[index]?.mode;
|
|
119
|
+
if (declared !== undefined) {
|
|
120
|
+
return declared;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
109
125
|
function assertSupportedRef(persona, ref, target, mode) {
|
|
110
126
|
const { kind } = splitRef(ref);
|
|
111
127
|
if (kind === 'model') {
|
|
@@ -178,10 +194,24 @@ function hookProblem(hook) {
|
|
|
178
194
|
}
|
|
179
195
|
function resolveOne(persona, chain, byKind, config, target, mode) {
|
|
180
196
|
const model = resolveModel(chain, config, target);
|
|
197
|
+
const personaMode = resolveMode(chain);
|
|
181
198
|
const resources = new Map();
|
|
182
199
|
const permissions = emptyResolvedPermissions();
|
|
183
200
|
const warnings = [];
|
|
184
201
|
const seenRefs = new Set();
|
|
202
|
+
// Claude Code models one agent per file and has no primary/subagent axis, so
|
|
203
|
+
// a declared mode has no representation there. The declaration is still
|
|
204
|
+
// valid; dropping it silently would hide that the source asked for something
|
|
205
|
+
// the target cannot do. The warning names both the persona and the target,
|
|
206
|
+
// and the emitted file carries no `mode` key at all.
|
|
207
|
+
if (target === 'claudecode' && personaMode !== undefined) {
|
|
208
|
+
warnings.push(warning({
|
|
209
|
+
code: 'W117_PERSONA_MODE_IGNORED',
|
|
210
|
+
persona: persona.id,
|
|
211
|
+
target,
|
|
212
|
+
message: `persona "${persona.id}" declares mode "${personaMode}", which claudecode cannot carry: Claude Code has no primary/subagent mode, so no mode key is written`,
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
185
215
|
const missing = (kind, id, contributor) => {
|
|
186
216
|
const dirs = {
|
|
187
217
|
rule: 'rules',
|
|
@@ -351,6 +381,7 @@ function resolveOne(persona, chain, byKind, config, target, mode) {
|
|
|
351
381
|
purpose: persona.purpose,
|
|
352
382
|
...(persona.extends === undefined ? {} : { extends: persona.extends }),
|
|
353
383
|
chain: chain.map((entry) => entry.id),
|
|
384
|
+
...(personaMode === undefined ? {} : { mode: personaMode }),
|
|
354
385
|
rules: resolvedRules,
|
|
355
386
|
mcp: resolvedMcp,
|
|
356
387
|
skills: resolvedSkills,
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* spelling of each name.
|
|
6
6
|
*/
|
|
7
7
|
export declare const PRODUCT_NAME = "farna-bootstrapper";
|
|
8
|
-
export declare const PRODUCT_VERSION = "0.1.
|
|
8
|
+
export declare const PRODUCT_VERSION = "0.1.1";
|
|
9
9
|
/** The one source/schema version this build understands. */
|
|
10
10
|
export declare const SCHEMA_VERSION: 1;
|
|
11
11
|
/**
|
|
@@ -30,6 +30,17 @@ export declare const RENDER_MODES: readonly ["agent", "profile"];
|
|
|
30
30
|
export type RenderMode = (typeof RENDER_MODES)[number];
|
|
31
31
|
export declare const MODE_AGENT: RenderMode;
|
|
32
32
|
export declare const MODE_PROFILE: RenderMode;
|
|
33
|
+
/**
|
|
34
|
+
* The OpenCode per-agent `mode` values a persona may declare. `primary` makes
|
|
35
|
+
* the agent selectable as the main agent, `subagent` makes it callable only by
|
|
36
|
+
* another agent, and `all` makes it both. The value is OpenCode-facing: Claude
|
|
37
|
+
* Code has no such concept, so a declared mode there is reported (W117) and not
|
|
38
|
+
* emitted. `subagent` is the default when a persona declares no mode, which is
|
|
39
|
+
* the same default this tool emitted before the field existed.
|
|
40
|
+
*/
|
|
41
|
+
export declare const PERSONA_MODES: readonly ["primary", "subagent", "all"];
|
|
42
|
+
export type PersonaMode = (typeof PERSONA_MODES)[number];
|
|
43
|
+
export declare const DEFAULT_PERSONA_MODE: PersonaMode;
|
|
33
44
|
/** The source root, relative to the repository root. */
|
|
34
45
|
export declare const ROOT_DIR = ".farna";
|
|
35
46
|
export declare const CONFIG_FILE = "config.jsonc";
|
|
@@ -245,7 +256,7 @@ export type DiagnosticCode = ErrorCode | typeof DRIFT_CODE;
|
|
|
245
256
|
/** Exit code per diagnostic code. The table lives here once. F007 is absent: drift is a result. */
|
|
246
257
|
export declare const EXIT_BY_CODE: Record<ErrorCode, ExitCode>;
|
|
247
258
|
export type Severity = 'error' | 'high' | 'medium' | 'low' | 'info';
|
|
248
|
-
export declare const WARNING_CODES: readonly ["W101_CAPABILITY_DROPPED", "W106_DENY_WINS", "W107_OUTSIDE_OWNERSHIP", "W109_PROFILE_BY_CHOICE", "W111_ASK_DOWNGRADED", "W112_PERMISSION_LOSSY", "W113_ALLOW_LIST_NARROWS", "W114_RENDERER_INTEGRITY_UNVERIFIED", "W115_CREDENTIAL_IN_URL", "W116_SECRET_IN_ARGS"];
|
|
259
|
+
export declare const WARNING_CODES: readonly ["W101_CAPABILITY_DROPPED", "W106_DENY_WINS", "W107_OUTSIDE_OWNERSHIP", "W109_PROFILE_BY_CHOICE", "W111_ASK_DOWNGRADED", "W112_PERMISSION_LOSSY", "W113_ALLOW_LIST_NARROWS", "W114_RENDERER_INTEGRITY_UNVERIFIED", "W115_CREDENTIAL_IN_URL", "W116_SECRET_IN_ARGS", "W117_PERSONA_MODE_IGNORED"];
|
|
249
260
|
export type WarningCode = (typeof WARNING_CODES)[number];
|
|
250
261
|
/**
|
|
251
262
|
* A warning's default severity is a property of its code.
|
package/dist/core/constants.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* spelling of each name.
|
|
6
6
|
*/
|
|
7
7
|
export const PRODUCT_NAME = 'farna-bootstrapper';
|
|
8
|
-
export const PRODUCT_VERSION = '0.1.
|
|
8
|
+
export const PRODUCT_VERSION = '0.1.1';
|
|
9
9
|
/** The one source/schema version this build understands. */
|
|
10
10
|
export const SCHEMA_VERSION = 1;
|
|
11
11
|
/**
|
|
@@ -29,6 +29,16 @@ export const OPENCODE_V1_SUPPORTED_MAJOR = '1';
|
|
|
29
29
|
export const RENDER_MODES = ['agent', 'profile'];
|
|
30
30
|
export const MODE_AGENT = 'agent';
|
|
31
31
|
export const MODE_PROFILE = 'profile';
|
|
32
|
+
/**
|
|
33
|
+
* The OpenCode per-agent `mode` values a persona may declare. `primary` makes
|
|
34
|
+
* the agent selectable as the main agent, `subagent` makes it callable only by
|
|
35
|
+
* another agent, and `all` makes it both. The value is OpenCode-facing: Claude
|
|
36
|
+
* Code has no such concept, so a declared mode there is reported (W117) and not
|
|
37
|
+
* emitted. `subagent` is the default when a persona declares no mode, which is
|
|
38
|
+
* the same default this tool emitted before the field existed.
|
|
39
|
+
*/
|
|
40
|
+
export const PERSONA_MODES = ['primary', 'subagent', 'all'];
|
|
41
|
+
export const DEFAULT_PERSONA_MODE = 'subagent';
|
|
32
42
|
/** The source root, relative to the repository root. */
|
|
33
43
|
export const ROOT_DIR = '.farna';
|
|
34
44
|
export const CONFIG_FILE = 'config.jsonc';
|
|
@@ -303,6 +313,7 @@ export const WARNING_CODES = [
|
|
|
303
313
|
'W114_RENDERER_INTEGRITY_UNVERIFIED',
|
|
304
314
|
'W115_CREDENTIAL_IN_URL',
|
|
305
315
|
'W116_SECRET_IN_ARGS',
|
|
316
|
+
'W117_PERSONA_MODE_IGNORED',
|
|
306
317
|
];
|
|
307
318
|
/**
|
|
308
319
|
* A warning's default severity is a property of its code.
|
|
@@ -333,4 +344,8 @@ export const WARNING_SEVERITY = {
|
|
|
333
344
|
W114_RENDERER_INTEGRITY_UNVERIFIED: 'medium',
|
|
334
345
|
W115_CREDENTIAL_IN_URL: 'high',
|
|
335
346
|
W116_SECRET_IN_ARGS: 'high',
|
|
347
|
+
// W117 is info: the declaration is not carried, but nothing the target
|
|
348
|
+
// supports is lost. Claude Code has no primary/subagent mode, and the agent
|
|
349
|
+
// file is still emitted with every capability it can carry.
|
|
350
|
+
W117_PERSONA_MODE_IGNORED: 'info',
|
|
336
351
|
};
|
package/dist/lock/lockfile.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ export declare const lockfileDocumentSchema: z.ZodObject<{
|
|
|
163
163
|
W114_RENDERER_INTEGRITY_UNVERIFIED: "W114_RENDERER_INTEGRITY_UNVERIFIED";
|
|
164
164
|
W115_CREDENTIAL_IN_URL: "W115_CREDENTIAL_IN_URL";
|
|
165
165
|
W116_SECRET_IN_ARGS: "W116_SECRET_IN_ARGS";
|
|
166
|
+
W117_PERSONA_MODE_IGNORED: "W117_PERSONA_MODE_IGNORED";
|
|
166
167
|
}>;
|
|
167
168
|
severity: z.ZodEnum<{
|
|
168
169
|
error: "error";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedPersona, ResolvedSource } from '../compose/resolve.js';
|
|
2
|
-
import { type OpencodeTarget, type SupportedTarget } from '../core/constants.js';
|
|
2
|
+
import { type OpencodeTarget, type PersonaMode, type SupportedTarget } from '../core/constants.js';
|
|
3
3
|
import type { RenderFeature } from '../render/port.js';
|
|
4
4
|
/**
|
|
5
5
|
* Join rule bodies into the persona body, in canonical order. The rule body
|
|
@@ -28,7 +28,7 @@ export type ClaudeBlock = {
|
|
|
28
28
|
disallowedTools?: string[];
|
|
29
29
|
};
|
|
30
30
|
export type OpencodePersonaSection = {
|
|
31
|
-
mode:
|
|
31
|
+
mode: PersonaMode;
|
|
32
32
|
model?: string;
|
|
33
33
|
permission?: Record<string, Record<string, 'allow' | 'deny'>>;
|
|
34
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { stringify } from 'yaml';
|
|
4
|
-
import { COMMANDS_DIR, isOpencodeTarget, OPENCODE_V1_TARGET, RULESYNC_HOOKS_FILE, RULESYNC_MCP_FILE, SKILL_FILE_NAME, SKILLS_DIR, } from '../core/constants.js';
|
|
4
|
+
import { COMMANDS_DIR, DEFAULT_PERSONA_MODE, isOpencodeTarget, OPENCODE_V1_TARGET, RULESYNC_HOOKS_FILE, RULESYNC_MCP_FILE, SKILL_FILE_NAME, SKILLS_DIR, } from '../core/constants.js';
|
|
5
5
|
/**
|
|
6
6
|
* Join rule bodies into the persona body, in canonical order. The rule body
|
|
7
7
|
* itself is never re-wrapped or re-indented. This is the only place a persona's
|
|
@@ -85,7 +85,10 @@ export function personaSourceFile(persona) {
|
|
|
85
85
|
* other.
|
|
86
86
|
*/
|
|
87
87
|
export function opencodePersonaFrontmatter(persona, target) {
|
|
88
|
-
|
|
88
|
+
// The persona's own OpenCode mode, or the measured default. This is the one
|
|
89
|
+
// place the value is chosen, so the emitted file and the containment gate
|
|
90
|
+
// cannot drift.
|
|
91
|
+
const section = { mode: persona.mode ?? DEFAULT_PERSONA_MODE };
|
|
89
92
|
if (persona.model !== undefined) {
|
|
90
93
|
section.model = persona.model;
|
|
91
94
|
}
|
package/dist/source/schema.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export declare const personaSchema: z.ZodObject<{
|
|
|
7
7
|
purpose: z.ZodString;
|
|
8
8
|
resources: z.ZodArray<z.ZodString>;
|
|
9
9
|
model: z.ZodOptional<z.ZodString>;
|
|
10
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
primary: "primary";
|
|
12
|
+
subagent: "subagent";
|
|
13
|
+
all: "all";
|
|
14
|
+
}>>;
|
|
10
15
|
extends: z.ZodOptional<z.ZodString>;
|
|
11
16
|
}, z.core.$strict>;
|
|
12
17
|
/**
|
package/dist/source/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ID_MAX_LENGTH, ID_RE } from '../core/constants.js';
|
|
2
|
+
import { ID_MAX_LENGTH, ID_RE, PERSONA_MODES } from '../core/constants.js';
|
|
3
3
|
import { PERMISSION_CATEGORIES, PERMISSION_KEYS } from '../permissions/permissions.js';
|
|
4
4
|
export const idSchema = z.string().regex(ID_RE, 'must be lower-case kebab-case').max(ID_MAX_LENGTH);
|
|
5
5
|
export const personaSchema = z
|
|
@@ -10,6 +10,15 @@ export const personaSchema = z
|
|
|
10
10
|
purpose: z.string().min(1).max(120),
|
|
11
11
|
resources: z.array(z.string().min(1)).max(200),
|
|
12
12
|
model: idSchema.optional(),
|
|
13
|
+
/**
|
|
14
|
+
* The OpenCode agent mode this persona is emitted with. It is
|
|
15
|
+
* OpenCode-facing: `primary` is selectable as the main agent, `subagent`
|
|
16
|
+
* is callable by another agent, and `all` is both. Absent means the
|
|
17
|
+
* emitted default, `subagent`. A composed persona inherits the base's mode
|
|
18
|
+
* and may override it, so a chain declares at most one effective value.
|
|
19
|
+
* Claude Code has no such concept and reports W117 instead of carrying it.
|
|
20
|
+
*/
|
|
21
|
+
mode: z.enum(PERSONA_MODES).optional(),
|
|
13
22
|
extends: idSchema.optional(),
|
|
14
23
|
})
|
|
15
24
|
.superRefine((persona, ctx) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { isDeepStrictEqual } from 'node:util';
|
|
3
3
|
import { parseDocument } from 'yaml';
|
|
4
|
-
import { AGENT_FILE_EXT, CLAUDE_AGENTS_DIR, isOpencodeTarget, OPENCODE_AGENTS_DIR, OPENCODE_COMMANDS_DIR, OPENCODE_CONFIG_FILE, OPENCODE_HOOKS_PLUGIN, OPENCODE_SKILLS_DIR, SKILL_FILE_NAME, } from '../core/constants.js';
|
|
4
|
+
import { AGENT_FILE_EXT, CLAUDE_AGENTS_DIR, DEFAULT_PERSONA_MODE, isOpencodeTarget, OPENCODE_AGENTS_DIR, OPENCODE_COMMANDS_DIR, OPENCODE_CONFIG_FILE, OPENCODE_HOOKS_PLUGIN, OPENCODE_SKILLS_DIR, SKILL_FILE_NAME, } from '../core/constants.js';
|
|
5
5
|
import { declaredNotEmitted } from '../core/errors.js';
|
|
6
6
|
import { readUtf8File } from '../core/fs.js';
|
|
7
7
|
import { compareCodepoints } from '../core/json.js';
|
|
@@ -222,7 +222,7 @@ function verifyOpencodeV2Agent(persona, source, parsed, managedPath) {
|
|
|
222
222
|
}
|
|
223
223
|
assertKeySet(keys, parsed.frontmatter, persona, managedPath);
|
|
224
224
|
assertField(parsed.frontmatter, 'description', persona.purpose, managedPath, persona);
|
|
225
|
-
assertField(parsed.frontmatter, 'mode',
|
|
225
|
+
assertField(parsed.frontmatter, 'mode', persona.mode ?? DEFAULT_PERSONA_MODE, managedPath, persona);
|
|
226
226
|
assertField(parsed.frontmatter, 'model', persona.model, managedPath, persona);
|
|
227
227
|
const expectedPermissions = persona.opencode.records;
|
|
228
228
|
if (expectedPermissions.length === 0) {
|
|
@@ -260,7 +260,7 @@ function verifyOpencodeV1Agent(persona, source, parsed, managedPath) {
|
|
|
260
260
|
assertKeySet(keys, parsed.frontmatter, persona, managedPath);
|
|
261
261
|
assertField(parsed.frontmatter, 'name', persona.id, managedPath, persona);
|
|
262
262
|
assertField(parsed.frontmatter, 'description', persona.purpose, managedPath, persona);
|
|
263
|
-
assertField(parsed.frontmatter, 'mode',
|
|
263
|
+
assertField(parsed.frontmatter, 'mode', persona.mode ?? DEFAULT_PERSONA_MODE, managedPath, persona);
|
|
264
264
|
assertField(parsed.frontmatter, 'model', persona.model, managedPath, persona);
|
|
265
265
|
const expected = {};
|
|
266
266
|
for (const category of persona.opencode.permission) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "farna-bootstrapper",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Compile named agent personas and resources into the configuration each coding harness reads, and prove that the output still matches the source.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Farnalabs Ltd",
|