harness-config-manager 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/LICENSE +21 -0
- package/README.md +1547 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +584 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.js +49 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/context.d.ts +24 -0
- package/dist/commands/context.js +329 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/export.d.ts +19 -0
- package/dist/commands/export.js +116 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +33 -0
- package/dist/commands/import.js +81 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/info.d.ts +19 -0
- package/dist/commands/info.js +235 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +116 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +119 -0
- package/dist/commands/install.js +533 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.js +102 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/params.d.ts +58 -0
- package/dist/commands/params.js +366 -0
- package/dist/commands/params.js.map +1 -0
- package/dist/commands/refs.d.ts +60 -0
- package/dist/commands/refs.js +329 -0
- package/dist/commands/refs.js.map +1 -0
- package/dist/commands/registry.d.ts +18 -0
- package/dist/commands/registry.js +173 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.js +83 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/targets.d.ts +8 -0
- package/dist/commands/targets.js +61 -0
- package/dist/commands/targets.js.map +1 -0
- package/dist/commands/uninstall.d.ts +71 -0
- package/dist/commands/uninstall.js +322 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +66 -0
- package/dist/commands/update.js +384 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.js +38 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/bundle.d.ts +49 -0
- package/dist/core/bundle.js +326 -0
- package/dist/core/bundle.js.map +1 -0
- package/dist/core/config.d.ts +65 -0
- package/dist/core/config.js +112 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/conflicts.d.ts +67 -0
- package/dist/core/conflicts.js +300 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/context.d.ts +139 -0
- package/dist/core/context.js +432 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/deps.d.ts +62 -0
- package/dist/core/deps.js +339 -0
- package/dist/core/deps.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +26 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/executor.d.ts +9 -0
- package/dist/core/executor.js +139 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/flavors.d.ts +128 -0
- package/dist/core/flavors.js +386 -0
- package/dist/core/flavors.js.map +1 -0
- package/dist/core/frontmatter.d.ts +6 -0
- package/dist/core/frontmatter.js +20 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/fsx.d.ts +40 -0
- package/dist/core/fsx.js +180 -0
- package/dist/core/fsx.js.map +1 -0
- package/dist/core/github.d.ts +37 -0
- package/dist/core/github.js +157 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/harnesses.d.ts +142 -0
- package/dist/core/harnesses.js +215 -0
- package/dist/core/harnesses.js.map +1 -0
- package/dist/core/hash.d.ts +12 -0
- package/dist/core/hash.js +34 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/logger.d.ts +16 -0
- package/dist/core/logger.js +36 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/overlap.d.ts +79 -0
- package/dist/core/overlap.js +155 -0
- package/dist/core/overlap.js.map +1 -0
- package/dist/core/parameters.d.ts +249 -0
- package/dist/core/parameters.js +944 -0
- package/dist/core/parameters.js.map +1 -0
- package/dist/core/paths.d.ts +20 -0
- package/dist/core/paths.js +35 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/planner.d.ts +36 -0
- package/dist/core/planner.js +364 -0
- package/dist/core/planner.js.map +1 -0
- package/dist/core/prompt.d.ts +52 -0
- package/dist/core/prompt.js +197 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/refmap.d.ts +91 -0
- package/dist/core/refmap.js +331 -0
- package/dist/core/refmap.js.map +1 -0
- package/dist/core/refs.d.ts +297 -0
- package/dist/core/refs.js +801 -0
- package/dist/core/refs.js.map +1 -0
- package/dist/core/registry.d.ts +119 -0
- package/dist/core/registry.js +363 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/rename.d.ts +36 -0
- package/dist/core/rename.js +74 -0
- package/dist/core/rename.js.map +1 -0
- package/dist/core/rollback.d.ts +38 -0
- package/dist/core/rollback.js +226 -0
- package/dist/core/rollback.js.map +1 -0
- package/dist/core/semver.d.ts +56 -0
- package/dist/core/semver.js +214 -0
- package/dist/core/semver.js.map +1 -0
- package/dist/core/state.d.ts +99 -0
- package/dist/core/state.js +196 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/store.d.ts +30 -0
- package/dist/core/store.js +54 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +515 -0
- package/dist/core/types.js +49 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/merge/blocks.d.ts +48 -0
- package/dist/merge/blocks.js +0 -0
- package/dist/merge/blocks.js.map +1 -0
- package/dist/merge/json-merge.d.ts +66 -0
- package/dist/merge/json-merge.js +176 -0
- package/dist/merge/json-merge.js.map +1 -0
- package/dist/merge/toml.d.ts +48 -0
- package/dist/merge/toml.js +118 -0
- package/dist/merge/toml.js.map +1 -0
- package/dist/targets/claude-code.d.ts +11 -0
- package/dist/targets/claude-code.js +94 -0
- package/dist/targets/claude-code.js.map +1 -0
- package/dist/targets/copilot.d.ts +13 -0
- package/dist/targets/copilot.js +126 -0
- package/dist/targets/copilot.js.map +1 -0
- package/dist/targets/index.d.ts +20 -0
- package/dist/targets/index.js +60 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/opencode.d.ts +32 -0
- package/dist/targets/opencode.js +172 -0
- package/dist/targets/opencode.js.map +1 -0
- package/dist/targets/pi.d.ts +42 -0
- package/dist/targets/pi.js +134 -0
- package/dist/targets/pi.js.map +1 -0
- package/dist/targets/reasonix.d.ts +27 -0
- package/dist/targets/reasonix.js +192 -0
- package/dist/targets/reasonix.js.map +1 -0
- package/dist/targets/shared.d.ts +33 -0
- package/dist/targets/shared.js +109 -0
- package/dist/targets/shared.js.map +1 -0
- package/dist/targets/types.d.ts +40 -0
- package/dist/targets/types.js +17 -0
- package/dist/targets/types.js.map +1 -0
- package/docs/authoring-bundles.md +828 -0
- package/package.json +74 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { blockId } from '../merge/blocks.js';
|
|
4
|
+
import { renderArrayOfTables, renderToml } from '../merge/toml.js';
|
|
5
|
+
import { appliesToPrefix, assetFile, instructionBlock, markdownFile, skillFiles } from './shared.js';
|
|
6
|
+
import { toList } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Reasonix.
|
|
9
|
+
* https://github.com/esengine/DeepSeek-Reasonix/blob/main-v2/docs/GUIDE.md
|
|
10
|
+
* Config schema: docs/SPEC.md section 5 (Configuration TOML).
|
|
11
|
+
* Paths: docs/CONFIG_PATHS.md. Subagents: docs/SUBAGENT_PROFILES.md.
|
|
12
|
+
*
|
|
13
|
+
* .reasonix/skills/<name>/** REASONIX.md -> marker block (context, rules)
|
|
14
|
+
* .reasonix/commands/<name>.md reasonix.toml -> [[plugins]] (MCP)
|
|
15
|
+
* reasonix.toml -> [tables] (settings)
|
|
16
|
+
*
|
|
17
|
+
* Two things differ from the other harnesses:
|
|
18
|
+
*
|
|
19
|
+
* - There is no agents directory. A subagent is a Skill carrying
|
|
20
|
+
* `runAs: subagent`, so subagents and skills share `skills/`.
|
|
21
|
+
* - There is no per-file rule format either -- standing instructions are the
|
|
22
|
+
* REASONIX.md hierarchy -- so rules join context in REASONIX.md.
|
|
23
|
+
*
|
|
24
|
+
* Reasonix keeps its config in TOML, which has comments -- so unlike the JSON
|
|
25
|
+
* targets we write marker-delimited blocks and never rewrite the whole file.
|
|
26
|
+
*/
|
|
27
|
+
export const reasonix = {
|
|
28
|
+
id: 'reasonix',
|
|
29
|
+
title: 'Reasonix',
|
|
30
|
+
docs: 'https://github.com/esengine/DeepSeek-Reasonix/blob/main-v2/docs/GUIDE.md',
|
|
31
|
+
supports: ['subagent', 'skill', 'command', 'rule', 'context', 'mcp', 'settings', 'asset'],
|
|
32
|
+
scopeRoot(scope, cwd) {
|
|
33
|
+
return scope === 'user' ? reasonixHome() : cwd;
|
|
34
|
+
},
|
|
35
|
+
markers(scope) {
|
|
36
|
+
return scope === 'user' ? ['.'] : ['.reasonix', 'REASONIX.md', 'reasonix.toml'];
|
|
37
|
+
},
|
|
38
|
+
actions(resource, ctx) {
|
|
39
|
+
// At user scope the root is already the Reasonix home directory.
|
|
40
|
+
const base = ctx.scope === 'user' ? '' : '.reasonix/';
|
|
41
|
+
const configFile = ctx.scope === 'user' ? 'config.toml' : 'reasonix.toml';
|
|
42
|
+
switch (resource.kind) {
|
|
43
|
+
// A subagent profile is a Skill with `runAs: subagent` -- same directory,
|
|
44
|
+
// same file format, distinguished only by frontmatter. `invocation: manual`
|
|
45
|
+
// keeps it out of the pinned Skill index so it is only ever called by name.
|
|
46
|
+
case 'subagent':
|
|
47
|
+
return [
|
|
48
|
+
markdownFile(`${base}skills/${resource.name}/SKILL.md`, resource, {
|
|
49
|
+
name: resource.name,
|
|
50
|
+
description: resource.frontmatter.description,
|
|
51
|
+
color: resource.frontmatter.color,
|
|
52
|
+
invocation: 'manual',
|
|
53
|
+
runAs: 'subagent',
|
|
54
|
+
model: resource.frontmatter.model,
|
|
55
|
+
effort: resource.frontmatter.effort,
|
|
56
|
+
'read-only': resource.frontmatter.readOnly ?? resource.frontmatter['read-only'],
|
|
57
|
+
// A profile-level allowlist, written as a YAML list.
|
|
58
|
+
'allowed-tools': listOrUndefined(resource.frontmatter.tools),
|
|
59
|
+
}),
|
|
60
|
+
];
|
|
61
|
+
case 'skill':
|
|
62
|
+
return skillFiles(resource, `${base}skills/${resource.name}`);
|
|
63
|
+
case 'command':
|
|
64
|
+
return [
|
|
65
|
+
markdownFile(`${base}commands/${resource.name}.md`, resource, {
|
|
66
|
+
description: resource.frontmatter.description,
|
|
67
|
+
'argument-hint': resource.frontmatter.argumentHint ?? resource.frontmatter['argument-hint'],
|
|
68
|
+
}),
|
|
69
|
+
];
|
|
70
|
+
// Reasonix has no glob-scoped rule files: standing instructions are the
|
|
71
|
+
// REASONIX.md hierarchy, scoped by directory. So a rule becomes a block in
|
|
72
|
+
// REASONIX.md whose globs are stated in the text for the model to honour.
|
|
73
|
+
case 'rule':
|
|
74
|
+
return [
|
|
75
|
+
instructionBlock('REASONIX.md', ctx, `rules/${resource.name}`, resource.name, appliesToPrefix(resource) + (resource.body ?? '')),
|
|
76
|
+
];
|
|
77
|
+
case 'context':
|
|
78
|
+
return [
|
|
79
|
+
instructionBlock('REASONIX.md', ctx, resource.name, resource.name, resource.body ?? ''),
|
|
80
|
+
];
|
|
81
|
+
case 'mcp':
|
|
82
|
+
return [
|
|
83
|
+
{
|
|
84
|
+
path: configFile,
|
|
85
|
+
describe: `[[plugins]] ${resource.name}`,
|
|
86
|
+
payload: {
|
|
87
|
+
kind: 'block',
|
|
88
|
+
blockId: blockId(ctx.bundle, `plugins/${resource.name}`),
|
|
89
|
+
syntax: 'toml',
|
|
90
|
+
body: renderArrayOfTables('plugins', toPlugin(resource.name, resource.data)),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
case 'settings':
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
path: configFile,
|
|
98
|
+
describe: `[${Object.keys(asRecord(resource.data)).join('], [')}]`,
|
|
99
|
+
payload: {
|
|
100
|
+
kind: 'block',
|
|
101
|
+
blockId: blockId(ctx.bundle, `settings/${resource.name}`),
|
|
102
|
+
syntax: 'toml',
|
|
103
|
+
body: renderToml(asRecord(resource.data)),
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
case 'asset':
|
|
108
|
+
return [assetFile(resource, `${base}assets/${resource.name}`)];
|
|
109
|
+
default:
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Reasonix home: %AppData%\reasonix on Windows, ~/.reasonix elsewhere,
|
|
116
|
+
* overridden by REASONIX_HOME (docs/CONFIG_PATHS.md).
|
|
117
|
+
*/
|
|
118
|
+
export function reasonixHome() {
|
|
119
|
+
if (process.env.REASONIX_HOME)
|
|
120
|
+
return process.env.REASONIX_HOME;
|
|
121
|
+
if (process.platform === 'win32' && process.env.APPDATA) {
|
|
122
|
+
return path.join(process.env.APPDATA, 'reasonix');
|
|
123
|
+
}
|
|
124
|
+
return path.join(os.homedir(), '.reasonix');
|
|
125
|
+
}
|
|
126
|
+
function listOrUndefined(value) {
|
|
127
|
+
const list = toList(value);
|
|
128
|
+
return list.length ? list : undefined;
|
|
129
|
+
}
|
|
130
|
+
function asRecord(value) {
|
|
131
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
132
|
+
? value
|
|
133
|
+
: {};
|
|
134
|
+
}
|
|
135
|
+
/** Read a canonical field written in either camelCase or snake_case. */
|
|
136
|
+
function field(server, camel, snake) {
|
|
137
|
+
return server[camel] ?? server[snake];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Map a canonical MCP server definition onto a Reasonix `[[plugins]]` entry,
|
|
141
|
+
* per docs/SPEC.md section 5:
|
|
142
|
+
*
|
|
143
|
+
* [[plugins]]
|
|
144
|
+
* name = "example"
|
|
145
|
+
* command = "reasonix-plugin-example"
|
|
146
|
+
* args = []
|
|
147
|
+
* env = { FOO = "bar" }
|
|
148
|
+
* type = "stdio" # stdio (default) | http | sse
|
|
149
|
+
* url = "https://mcp.stripe.com"
|
|
150
|
+
* headers = { Authorization = "Bearer ${STRIPE_KEY}" }
|
|
151
|
+
* startup_timeout_seconds = 60
|
|
152
|
+
* call_timeout_seconds = 600
|
|
153
|
+
* tool_timeout_seconds = { generate_video = 1800 }
|
|
154
|
+
*
|
|
155
|
+
* `${VAR}` expansion is Reasonix's job, so values pass through untouched.
|
|
156
|
+
* TOML has no null, so absent values are omitted rather than emitted empty.
|
|
157
|
+
*/
|
|
158
|
+
function toPlugin(name, data) {
|
|
159
|
+
const server = asRecord(data);
|
|
160
|
+
const plugin = { name };
|
|
161
|
+
// Transport. stdio is the documented default, so it is left implicit; http
|
|
162
|
+
// and sse must be stated or Reasonix would try to spawn a command.
|
|
163
|
+
const declared = server.type;
|
|
164
|
+
const type = typeof declared === 'string' ? declared : typeof server.url === 'string' ? 'http' : 'stdio';
|
|
165
|
+
if (type !== 'stdio')
|
|
166
|
+
plugin.type = type;
|
|
167
|
+
if (typeof server.command === 'string')
|
|
168
|
+
plugin.command = server.command;
|
|
169
|
+
if (Array.isArray(server.args))
|
|
170
|
+
plugin.args = server.args;
|
|
171
|
+
if (typeof server.url === 'string')
|
|
172
|
+
plugin.url = server.url;
|
|
173
|
+
const env = server.env;
|
|
174
|
+
if (env && typeof env === 'object' && !Array.isArray(env))
|
|
175
|
+
plugin.env = env;
|
|
176
|
+
const headers = server.headers;
|
|
177
|
+
if (headers && typeof headers === 'object' && !Array.isArray(headers))
|
|
178
|
+
plugin.headers = headers;
|
|
179
|
+
const startup = field(server, 'startupTimeoutSeconds', 'startup_timeout_seconds');
|
|
180
|
+
if (typeof startup === 'number')
|
|
181
|
+
plugin.startup_timeout_seconds = startup;
|
|
182
|
+
const call = field(server, 'callTimeoutSeconds', 'call_timeout_seconds');
|
|
183
|
+
if (typeof call === 'number')
|
|
184
|
+
plugin.call_timeout_seconds = call;
|
|
185
|
+
// Per-tool overrides, e.g. { generate_video = 1800 }.
|
|
186
|
+
const toolTimeouts = field(server, 'toolTimeoutSeconds', 'tool_timeout_seconds');
|
|
187
|
+
if (toolTimeouts && typeof toolTimeouts === 'object' && !Array.isArray(toolTimeouts)) {
|
|
188
|
+
plugin.tool_timeout_seconds = toolTimeouts;
|
|
189
|
+
}
|
|
190
|
+
return plugin;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=reasonix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasonix.js","sourceRoot":"","sources":["../../src/targets/reasonix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW;IAC9B,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,0EAA0E;IAChF,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC;IAEzF,SAAS,CAAC,KAAY,EAAE,GAAW;QACjC,OAAO,KAAK,KAAK,MAAM,CA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G,MAAM,CAAC,GAAG,CAAC;IACvB,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;IAE5E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAEhG,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,uBAAuB,EAAE,yBAAyB,CAAC,CAAC;IAClF,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,MAAM,CAAC,uBAAuB,GAAG,OAAO,CAAC;IAE1E,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IACzE,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAEjE,sDAAsD;IACtD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAAE,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IACjF,IAAI,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACrF,MAAM,CAAC,oBAAoB,GAAG,YAAY,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BundleResource, PlanAction } from '../core/types.js';
|
|
2
|
+
import type { TargetContext } from './types.js';
|
|
3
|
+
/** Claude Code and Copilot both want a comma-separated tools string. */
|
|
4
|
+
export declare function joinTools(value: unknown): string | undefined;
|
|
5
|
+
export declare function readBytes(target: string): Buffer;
|
|
6
|
+
export declare function omit(source: Record<string, unknown>, keys: string[]): Record<string, unknown>;
|
|
7
|
+
/** A markdown resource rendered with target-specific frontmatter. */
|
|
8
|
+
export declare function markdownFile(targetPath: string, resource: BundleResource, frontmatter: Record<string, unknown>): PlanAction;
|
|
9
|
+
/**
|
|
10
|
+
* Skills copy their whole directory: SKILL.md is re-rendered so its frontmatter
|
|
11
|
+
* matches the target, supporting files are copied byte-for-byte.
|
|
12
|
+
*/
|
|
13
|
+
export declare function skillFiles(resource: BundleResource, targetDir: string): PlanAction[];
|
|
14
|
+
/**
|
|
15
|
+
* One bundle's contribution to a harness's standing-instruction file --
|
|
16
|
+
* `CLAUDE.md`, `AGENTS.md`, `REASONIX.md`. Written as a marker block so
|
|
17
|
+
* uninstall removes exactly this section and leaves the rest of the file,
|
|
18
|
+
* including anything hand-written, alone.
|
|
19
|
+
*/
|
|
20
|
+
export declare function instructionBlock(file: string, ctx: TargetContext, id: string, name: string, body: string): PlanAction;
|
|
21
|
+
/**
|
|
22
|
+
* For harnesses with no glob-scoped rule format, the globs cannot be enforced
|
|
23
|
+
* by the loader -- so state them in prose above the rule for the model to
|
|
24
|
+
* honour. Empty when the rule applies everywhere.
|
|
25
|
+
*/
|
|
26
|
+
export declare function appliesToPrefix(resource: BundleResource): string;
|
|
27
|
+
export declare function assetFile(resource: BundleResource, targetPath: string): PlanAction;
|
|
28
|
+
/**
|
|
29
|
+
* A settings fragment becomes one receipt per leaf, so two bundles can each own
|
|
30
|
+
* different keys in the same settings.json and uninstall independently.
|
|
31
|
+
* Arrays are appended to rather than replaced -- what permission allow-lists need.
|
|
32
|
+
*/
|
|
33
|
+
export declare function settingsActions(resource: BundleResource, targetPath: string): PlanAction[];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import fsSync from 'node:fs';
|
|
2
|
+
import { renderMarkdown } from '../core/frontmatter.js';
|
|
3
|
+
import { blockId } from '../merge/blocks.js';
|
|
4
|
+
import { flattenLeaves } from '../merge/json-merge.js';
|
|
5
|
+
import { compact, toList } from './types.js';
|
|
6
|
+
/** Claude Code and Copilot both want a comma-separated tools string. */
|
|
7
|
+
export function joinTools(value) {
|
|
8
|
+
const list = toList(value);
|
|
9
|
+
return list.length ? list.join(', ') : undefined;
|
|
10
|
+
}
|
|
11
|
+
export function readBytes(target) {
|
|
12
|
+
return fsSync.readFileSync(target);
|
|
13
|
+
}
|
|
14
|
+
export function omit(source, keys) {
|
|
15
|
+
return Object.fromEntries(Object.entries(source).filter(([key]) => !keys.includes(key)));
|
|
16
|
+
}
|
|
17
|
+
/** A markdown resource rendered with target-specific frontmatter. */
|
|
18
|
+
export function markdownFile(targetPath, resource, frontmatter) {
|
|
19
|
+
return {
|
|
20
|
+
path: targetPath,
|
|
21
|
+
describe: targetPath,
|
|
22
|
+
payload: { kind: 'file', contents: renderMarkdown(compact(frontmatter), resource.body ?? '') },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Skills copy their whole directory: SKILL.md is re-rendered so its frontmatter
|
|
27
|
+
* matches the target, supporting files are copied byte-for-byte.
|
|
28
|
+
*/
|
|
29
|
+
export function skillFiles(resource, targetDir) {
|
|
30
|
+
return resource.files.map((file) => {
|
|
31
|
+
const targetPath = `${targetDir}/${file.relativePath}`;
|
|
32
|
+
if (file.relativePath === 'SKILL.md') {
|
|
33
|
+
return {
|
|
34
|
+
path: targetPath,
|
|
35
|
+
describe: targetPath,
|
|
36
|
+
payload: {
|
|
37
|
+
kind: 'file',
|
|
38
|
+
contents: renderMarkdown(compact({
|
|
39
|
+
name: resource.name,
|
|
40
|
+
description: resource.frontmatter.description,
|
|
41
|
+
...omit(resource.frontmatter, ['name', 'description']),
|
|
42
|
+
}), resource.body ?? ''),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
path: targetPath,
|
|
48
|
+
describe: targetPath,
|
|
49
|
+
payload: { kind: 'file', contents: readBytes(file.absolutePath) },
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One bundle's contribution to a harness's standing-instruction file --
|
|
55
|
+
* `CLAUDE.md`, `AGENTS.md`, `REASONIX.md`. Written as a marker block so
|
|
56
|
+
* uninstall removes exactly this section and leaves the rest of the file,
|
|
57
|
+
* including anything hand-written, alone.
|
|
58
|
+
*/
|
|
59
|
+
export function instructionBlock(file, ctx, id, name, body) {
|
|
60
|
+
return {
|
|
61
|
+
path: file,
|
|
62
|
+
describe: `${file} ← ${name}`,
|
|
63
|
+
payload: {
|
|
64
|
+
kind: 'block',
|
|
65
|
+
blockId: blockId(ctx.bundle, id),
|
|
66
|
+
syntax: 'markdown',
|
|
67
|
+
body,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* For harnesses with no glob-scoped rule format, the globs cannot be enforced
|
|
73
|
+
* by the loader -- so state them in prose above the rule for the model to
|
|
74
|
+
* honour. Empty when the rule applies everywhere.
|
|
75
|
+
*/
|
|
76
|
+
export function appliesToPrefix(resource) {
|
|
77
|
+
const paths = toList(resource.frontmatter.appliesTo ?? resource.frontmatter.paths);
|
|
78
|
+
return paths.length ? `**Applies to:** ${paths.map((p) => `\`${p}\``).join(', ')}\n\n` : '';
|
|
79
|
+
}
|
|
80
|
+
export function assetFile(resource, targetPath) {
|
|
81
|
+
return {
|
|
82
|
+
path: targetPath,
|
|
83
|
+
describe: targetPath,
|
|
84
|
+
payload: { kind: 'file', contents: readBytes(resource.primaryFile) },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A settings fragment becomes one receipt per leaf, so two bundles can each own
|
|
89
|
+
* different keys in the same settings.json and uninstall independently.
|
|
90
|
+
* Arrays are appended to rather than replaced -- what permission allow-lists need.
|
|
91
|
+
*/
|
|
92
|
+
export function settingsActions(resource, targetPath) {
|
|
93
|
+
return flattenLeaves(resource.data).map((leaf) => {
|
|
94
|
+
const label = leaf.pointer.join('.');
|
|
95
|
+
if (Array.isArray(leaf.value)) {
|
|
96
|
+
return {
|
|
97
|
+
path: targetPath,
|
|
98
|
+
describe: `${label}[] +${leaf.value.length}`,
|
|
99
|
+
payload: { kind: 'json-array-item', pointer: leaf.pointer, items: leaf.value },
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
path: targetPath,
|
|
104
|
+
describe: label,
|
|
105
|
+
payload: { kind: 'json-value', pointer: leaf.pointer, value: leaf.value },
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/targets/shared.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE7C,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,MAA+B,EAAE,IAAc;IAClE,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG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C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,iBAA0B,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;aACxF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,YAAqB,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACnF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BundleResource, PlanAction, ResourceKind, Scope, TargetId, TargetOptions } from '../core/types.js';
|
|
2
|
+
export type { TargetOptions };
|
|
3
|
+
export interface TargetContext {
|
|
4
|
+
/** Bundle name, used for block ids and conflict messages. */
|
|
5
|
+
bundle: string;
|
|
6
|
+
scope: Scope;
|
|
7
|
+
/** What is installed on this machine; see `TargetOptions`. */
|
|
8
|
+
options: TargetOptions;
|
|
9
|
+
}
|
|
10
|
+
export interface Target {
|
|
11
|
+
id: TargetId;
|
|
12
|
+
title: string;
|
|
13
|
+
docs: string;
|
|
14
|
+
/** Absolute directory that plan paths are relative to. */
|
|
15
|
+
scopeRoot(scope: Scope, cwd: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Paths under `scopeRoot`, any one of which means this harness is set up
|
|
18
|
+
* here. `.` means the scope root itself -- which is what identifies a harness
|
|
19
|
+
* whose user-scope root *is* its own config directory.
|
|
20
|
+
*
|
|
21
|
+
* Only unambiguous evidence belongs here. `.mcp.json` and `AGENTS.md` are
|
|
22
|
+
* written by more than one harness, so finding one says nothing about which
|
|
23
|
+
* harness put it there; see `core/overlap.ts` for what that costs elsewhere.
|
|
24
|
+
*/
|
|
25
|
+
markers(scope: Scope): string[];
|
|
26
|
+
/** Kinds this target knows how to install. */
|
|
27
|
+
supports: ResourceKind[];
|
|
28
|
+
/** Anything about this harness a user should know before installing into it. */
|
|
29
|
+
notes?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Map one canonical resource to the writes it implies.
|
|
32
|
+
* Returning `[]` means "nothing to do"; unsupported kinds are filtered out
|
|
33
|
+
* by the planner before this is called.
|
|
34
|
+
*/
|
|
35
|
+
actions(resource: BundleResource, ctx: TargetContext): PlanAction[];
|
|
36
|
+
}
|
|
37
|
+
/** Normalise a frontmatter value that may be a string or list into a list. */
|
|
38
|
+
export declare function toList(value: unknown): string[];
|
|
39
|
+
/** Drop undefined entries so they never reach the rendered frontmatter. */
|
|
40
|
+
export declare function compact(input: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Normalise a frontmatter value that may be a string or list into a list. */
|
|
2
|
+
export function toList(value) {
|
|
3
|
+
if (Array.isArray(value))
|
|
4
|
+
return value.map(String);
|
|
5
|
+
if (typeof value === 'string') {
|
|
6
|
+
return value
|
|
7
|
+
.split(',')
|
|
8
|
+
.map((part) => part.trim())
|
|
9
|
+
.filter(Boolean);
|
|
10
|
+
}
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
/** Drop undefined entries so they never reach the rendered frontmatter. */
|
|
14
|
+
export function compact(input) {
|
|
15
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/targets/types.ts"],"names":[],"mappings":"AA+CA,8EAA8E;AAC9E,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK;aACT,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,OAAO,CAAC,KAA8B;IACpD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;AAC9F,CAAC"}
|