farna-bootstrapper 0.0.0-stage → 0.1.0
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 +91 -0
- package/LICENSE +30 -0
- package/NOTICE +42 -0
- package/README.md +1079 -2
- package/SECURITY.md +65 -0
- package/dist/cli/commands/check.d.ts +58 -0
- package/dist/cli/commands/check.js +198 -0
- package/dist/cli/commands/generate.d.ts +75 -0
- package/dist/cli/commands/generate.js +218 -0
- package/dist/cli/commands/init.d.ts +52 -0
- package/dist/cli/commands/init.js +271 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +51 -0
- package/dist/cli/program.d.ts +23 -0
- package/dist/cli/program.js +183 -0
- package/dist/compose/resolve.d.ts +154 -0
- package/dist/compose/resolve.js +545 -0
- package/dist/config/load.d.ts +4 -0
- package/dist/config/load.js +45 -0
- package/dist/config/schema.d.ts +22 -0
- package/dist/config/schema.js +46 -0
- package/dist/core/constants.d.ts +268 -0
- package/dist/core/constants.js +336 -0
- package/dist/core/errors.d.ts +44 -0
- package/dist/core/errors.js +75 -0
- package/dist/core/fs.d.ts +31 -0
- package/dist/core/fs.js +169 -0
- package/dist/core/json.d.ts +22 -0
- package/dist/core/json.js +174 -0
- package/dist/core/paths.d.ts +45 -0
- package/dist/core/paths.js +110 -0
- package/dist/core/text.d.ts +10 -0
- package/dist/core/text.js +27 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -0
- package/dist/lock/lockfile.d.ts +229 -0
- package/dist/lock/lockfile.js +333 -0
- package/dist/materialise/source-tree.d.ts +77 -0
- package/dist/materialise/source-tree.js +264 -0
- package/dist/permissions/permissions.d.ts +128 -0
- package/dist/permissions/permissions.js +452 -0
- package/dist/render/commit.d.ts +59 -0
- package/dist/render/commit.js +279 -0
- package/dist/render/generate-lock.d.ts +9 -0
- package/dist/render/generate-lock.js +203 -0
- package/dist/render/identity.d.ts +23 -0
- package/dist/render/identity.js +396 -0
- package/dist/render/orphans.d.ts +59 -0
- package/dist/render/orphans.js +234 -0
- package/dist/render/port.d.ts +96 -0
- package/dist/render/port.js +1 -0
- package/dist/render/prepare.d.ts +33 -0
- package/dist/render/prepare.js +139 -0
- package/dist/render/root-cleanliness.d.ts +28 -0
- package/dist/render/root-cleanliness.js +76 -0
- package/dist/render/stage.d.ts +36 -0
- package/dist/render/stage.js +92 -0
- package/dist/render/staging.d.ts +16 -0
- package/dist/render/staging.js +94 -0
- package/dist/render/structured.d.ts +35 -0
- package/dist/render/structured.js +258 -0
- package/dist/render/upstream.d.ts +41 -0
- package/dist/render/upstream.js +179 -0
- package/dist/report/format.d.ts +7 -0
- package/dist/report/format.js +97 -0
- package/dist/report/warnings.d.ts +21 -0
- package/dist/report/warnings.js +24 -0
- package/dist/source/digest.d.ts +18 -0
- package/dist/source/digest.js +77 -0
- package/dist/source/frontmatter.d.ts +12 -0
- package/dist/source/frontmatter.js +29 -0
- package/dist/source/load.d.ts +103 -0
- package/dist/source/load.js +676 -0
- package/dist/source/schema.d.ts +149 -0
- package/dist/source/schema.js +283 -0
- package/dist/source/yaml.d.ts +10 -0
- package/dist/source/yaml.js +49 -0
- package/dist/verify/containment.d.ts +22 -0
- package/dist/verify/containment.js +753 -0
- package/package.json +79 -4
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import { type RenderMode, type SupportedTarget } from '../core/constants.js';
|
|
3
|
+
import { type OpencodePermissionCategory, type OpencodePermissionRecord, type ResolvedPermissions } from '../permissions/permissions.js';
|
|
4
|
+
import { type Warning } from '../report/warnings.js';
|
|
5
|
+
import type { HookResource, McpResource, SkillFile, SourceTree } from '../source/load.js';
|
|
6
|
+
export type ResolvedRule = {
|
|
7
|
+
kind: 'rule';
|
|
8
|
+
id: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
body: string;
|
|
11
|
+
sha256: string;
|
|
12
|
+
path: string;
|
|
13
|
+
/** The persona in the composition chain that contributed this resource. */
|
|
14
|
+
fromPersona: string;
|
|
15
|
+
};
|
|
16
|
+
export type ResolvedPermission = {
|
|
17
|
+
kind: 'permission';
|
|
18
|
+
id: string;
|
|
19
|
+
sha256: string;
|
|
20
|
+
path: string;
|
|
21
|
+
fromPersona: string;
|
|
22
|
+
};
|
|
23
|
+
export type ResolvedCommand = {
|
|
24
|
+
kind: 'command';
|
|
25
|
+
id: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
body: string;
|
|
28
|
+
sha256: string;
|
|
29
|
+
path: string;
|
|
30
|
+
fromPersona: string;
|
|
31
|
+
};
|
|
32
|
+
export type ResolvedSkill = {
|
|
33
|
+
kind: 'skill';
|
|
34
|
+
id: string;
|
|
35
|
+
description: string;
|
|
36
|
+
body: string;
|
|
37
|
+
files: SkillFile[];
|
|
38
|
+
sha256: string;
|
|
39
|
+
path: string;
|
|
40
|
+
fromPersona: string;
|
|
41
|
+
};
|
|
42
|
+
export type ResolvedMcp = {
|
|
43
|
+
kind: 'mcp';
|
|
44
|
+
id: string;
|
|
45
|
+
server: McpResource['server'];
|
|
46
|
+
sha256: string;
|
|
47
|
+
path: string;
|
|
48
|
+
fromPersona: string;
|
|
49
|
+
};
|
|
50
|
+
export type ResolvedHook = {
|
|
51
|
+
kind: 'hook';
|
|
52
|
+
id: string;
|
|
53
|
+
phase: HookResource['phase'];
|
|
54
|
+
matcher?: string;
|
|
55
|
+
command: string;
|
|
56
|
+
sha256: string;
|
|
57
|
+
path: string;
|
|
58
|
+
fromPersona: string;
|
|
59
|
+
};
|
|
60
|
+
export type ResolvedResource = ResolvedRule | ResolvedPermission | ResolvedCommand | ResolvedSkill | ResolvedMcp | ResolvedHook;
|
|
61
|
+
/**
|
|
62
|
+
* A hook plus whether this target can carry it. A hook OpenCode cannot express
|
|
63
|
+
* is kept in the resolved set (so the lockfile still records the declaration)
|
|
64
|
+
* but is never materialised; `reason` is what the warning prints.
|
|
65
|
+
*/
|
|
66
|
+
export type ResolvedHookOutcome = ResolvedHook & {
|
|
67
|
+
carried: boolean;
|
|
68
|
+
reason?: string;
|
|
69
|
+
};
|
|
70
|
+
export type ResolvedPersona = {
|
|
71
|
+
id: string;
|
|
72
|
+
displayName: string;
|
|
73
|
+
purpose: string;
|
|
74
|
+
/** The base persona id when this persona is composed. */
|
|
75
|
+
extends?: string;
|
|
76
|
+
/** The full composition chain, base first, this persona last. */
|
|
77
|
+
chain: string[];
|
|
78
|
+
rules: ResolvedRule[];
|
|
79
|
+
mcp: ResolvedMcp[];
|
|
80
|
+
skills: ResolvedSkill[];
|
|
81
|
+
commands: ResolvedCommand[];
|
|
82
|
+
hooks: ResolvedHookOutcome[];
|
|
83
|
+
/** Every resolved resource, canonically ordered, each sorted by id. */
|
|
84
|
+
resources: ResolvedResource[];
|
|
85
|
+
permissions: ResolvedPermissions;
|
|
86
|
+
/**
|
|
87
|
+
* The exact Claude Code entries, already sorted and capitalised. Empty on a
|
|
88
|
+
* target that is not Claude Code. `allowlist` is true only when a contributing
|
|
89
|
+
* permission resource opted in: by default the entries are a deny-list,
|
|
90
|
+
* because `tools` is an allow-list in the target.
|
|
91
|
+
*/
|
|
92
|
+
claude: {
|
|
93
|
+
allow: string[];
|
|
94
|
+
deny: string[];
|
|
95
|
+
allowlist: boolean;
|
|
96
|
+
};
|
|
97
|
+
/** The rulesync permission map and the records OpenCode emits from it. */
|
|
98
|
+
opencode: {
|
|
99
|
+
permission: OpencodePermissionCategory[];
|
|
100
|
+
records: OpencodePermissionRecord[];
|
|
101
|
+
};
|
|
102
|
+
model?: string;
|
|
103
|
+
path: string;
|
|
104
|
+
/** Canonical digest of the persona's resolved resources. */
|
|
105
|
+
digest: string;
|
|
106
|
+
/** Canonical digest of the resolved permission map. */
|
|
107
|
+
permissionDigest: string;
|
|
108
|
+
warnings: Warning[];
|
|
109
|
+
};
|
|
110
|
+
export type ResolvedSource = {
|
|
111
|
+
target: SupportedTarget;
|
|
112
|
+
/** `profile` when one persona owns the workspace, `agent` otherwise. */
|
|
113
|
+
mode: RenderMode;
|
|
114
|
+
/** The active persona id in profile mode; `null` in agent mode. */
|
|
115
|
+
active: string | null;
|
|
116
|
+
/** Every persona resolved but not live, sorted. Empty in agent mode. */
|
|
117
|
+
notLive: string[];
|
|
118
|
+
personas: ResolvedPersona[];
|
|
119
|
+
/** Every workspace resource any live persona declares, deduplicated by id. */
|
|
120
|
+
mcp: ResolvedMcp[];
|
|
121
|
+
skills: ResolvedSkill[];
|
|
122
|
+
commands: ResolvedCommand[];
|
|
123
|
+
hooks: ResolvedHookOutcome[];
|
|
124
|
+
warnings: Warning[];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The one selection override the CLI accepts. A present persona wins over
|
|
128
|
+
* `targets.<target>.active`; both select profile mode.
|
|
129
|
+
*/
|
|
130
|
+
export type SourceSelection = {
|
|
131
|
+
persona?: string;
|
|
132
|
+
};
|
|
133
|
+
/** The one configured target. The config schema admits exactly one. */
|
|
134
|
+
export declare function configuredTarget(config: Config): SupportedTarget;
|
|
135
|
+
/**
|
|
136
|
+
* Resolve every persona's composition chain into its resource set. The base
|
|
137
|
+
* persona's rules, permissions and workspace resources are unioned in; the
|
|
138
|
+
* stricter permission value wins; two different models are a conflict, never a
|
|
139
|
+
* silent override.
|
|
140
|
+
*
|
|
141
|
+
* The target's mode is computed here, never chosen by a heuristic:
|
|
142
|
+
*
|
|
143
|
+
* - `targets.<target>.active` (or the `--persona` override) selects profile
|
|
144
|
+
* mode, makes exactly that persona live, and refuses F001 when the persona or
|
|
145
|
+
* the target's profile support is missing;
|
|
146
|
+
* - otherwise the target is in agent mode and every persona is live.
|
|
147
|
+
*
|
|
148
|
+
* In profile mode only the live persona's artefacts and workspace resources are
|
|
149
|
+
* returned, so `materialise` and the containment gate cannot emit or accept
|
|
150
|
+
* another persona's resources: the isolation is structural, not a filter applied
|
|
151
|
+
* later. Every persona is still resolved, so a broken declaration anywhere in
|
|
152
|
+
* the source is reported; only emission is scoped to the live persona.
|
|
153
|
+
*/
|
|
154
|
+
export declare function resolveSource(source: SourceTree, config: Config, selection?: SourceSelection): ResolvedSource;
|