@harness-nexus/cli 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +38 -0
- package/dist/config.js.map +1 -0
- package/dist/daemon/acp/adapters.d.ts +7 -0
- package/dist/daemon/acp/adapters.d.ts.map +1 -0
- package/dist/daemon/acp/adapters.js +34 -0
- package/dist/daemon/acp/adapters.js.map +1 -0
- package/dist/daemon/acp/agent-connection.d.ts +45 -0
- package/dist/daemon/acp/agent-connection.d.ts.map +1 -0
- package/dist/daemon/acp/agent-connection.js +158 -0
- package/dist/daemon/acp/agent-connection.js.map +1 -0
- package/dist/daemon/chat.d.ts +22 -0
- package/dist/daemon/chat.d.ts.map +1 -0
- package/dist/daemon/chat.js +280 -0
- package/dist/daemon/chat.js.map +1 -0
- package/dist/daemon/client.d.ts +23 -0
- package/dist/daemon/client.d.ts.map +1 -0
- package/dist/daemon/client.js +117 -0
- package/dist/daemon/client.js.map +1 -0
- package/dist/daemon/jobs.d.ts +19 -0
- package/dist/daemon/jobs.d.ts.map +1 -0
- package/dist/daemon/jobs.js +65 -0
- package/dist/daemon/jobs.js.map +1 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +481 -0
- package/dist/index.js.map +1 -0
- package/dist/install/adapter-factory.d.ts +24 -0
- package/dist/install/adapter-factory.d.ts.map +1 -0
- package/dist/install/adapter-factory.js +80 -0
- package/dist/install/adapter-factory.js.map +1 -0
- package/dist/install/adapters/codex.d.ts +16 -0
- package/dist/install/adapters/codex.d.ts.map +1 -0
- package/dist/install/adapters/codex.js +172 -0
- package/dist/install/adapters/codex.js.map +1 -0
- package/dist/install/adapters/deepseek.d.ts +26 -0
- package/dist/install/adapters/deepseek.d.ts.map +1 -0
- package/dist/install/adapters/deepseek.js +246 -0
- package/dist/install/adapters/deepseek.js.map +1 -0
- package/dist/install/adapters/hermes.d.ts +16 -0
- package/dist/install/adapters/hermes.d.ts.map +1 -0
- package/dist/install/adapters/hermes.js +267 -0
- package/dist/install/adapters/hermes.js.map +1 -0
- package/dist/install/adapters/stub.d.ts +2 -0
- package/dist/install/adapters/stub.d.ts.map +1 -0
- package/dist/install/adapters/stub.js +22 -0
- package/dist/install/adapters/stub.js.map +1 -0
- package/dist/install/install-state.d.ts +31 -0
- package/dist/install/install-state.d.ts.map +1 -0
- package/dist/install/install-state.js +29 -0
- package/dist/install/install-state.js.map +1 -0
- package/dist/install/installer.d.ts +16 -0
- package/dist/install/installer.d.ts.map +1 -0
- package/dist/install/installer.js +96 -0
- package/dist/install/installer.js.map +1 -0
- package/dist/install/planner.d.ts +26 -0
- package/dist/install/planner.d.ts.map +1 -0
- package/dist/install/planner.js +25 -0
- package/dist/install/planner.js.map +1 -0
- package/dist/install/registry.d.ts +21 -0
- package/dist/install/registry.d.ts.map +1 -0
- package/dist/install/registry.js +31 -0
- package/dist/install/registry.js.map +1 -0
- package/dist/install/resolver.d.ts +15 -0
- package/dist/install/resolver.d.ts.map +1 -0
- package/dist/install/resolver.js +57 -0
- package/dist/install/resolver.js.map +1 -0
- package/dist/install/types.d.ts +93 -0
- package/dist/install/types.d.ts.map +1 -0
- package/dist/install/types.js +2 -0
- package/dist/install/types.js.map +1 -0
- package/dist/install/uninstaller.d.ts +29 -0
- package/dist/install/uninstaller.d.ts.map +1 -0
- package/dist/install/uninstaller.js +107 -0
- package/dist/install/uninstaller.js.map +1 -0
- package/dist/inventory/common.d.ts +86 -0
- package/dist/inventory/common.d.ts.map +1 -0
- package/dist/inventory/common.js +137 -0
- package/dist/inventory/common.js.map +1 -0
- package/dist/inventory/scan.d.ts +23 -0
- package/dist/inventory/scan.d.ts.map +1 -0
- package/dist/inventory/scan.js +117 -0
- package/dist/inventory/scan.js.map +1 -0
- package/dist/inventory/scanners/claude-code.d.ts +3 -0
- package/dist/inventory/scanners/claude-code.d.ts.map +1 -0
- package/dist/inventory/scanners/claude-code.js +191 -0
- package/dist/inventory/scanners/claude-code.js.map +1 -0
- package/dist/inventory/scanners/codex.d.ts +14 -0
- package/dist/inventory/scanners/codex.d.ts.map +1 -0
- package/dist/inventory/scanners/codex.js +201 -0
- package/dist/inventory/scanners/codex.js.map +1 -0
- package/dist/inventory/scanners/deepseek.d.ts +9 -0
- package/dist/inventory/scanners/deepseek.d.ts.map +1 -0
- package/dist/inventory/scanners/deepseek.js +200 -0
- package/dist/inventory/scanners/deepseek.js.map +1 -0
- package/dist/inventory/scanners/hermes.d.ts +3 -0
- package/dist/inventory/scanners/hermes.d.ts.map +1 -0
- package/dist/inventory/scanners/hermes.js +194 -0
- package/dist/inventory/scanners/hermes.js.map +1 -0
- package/dist/inventory/types.d.ts +33 -0
- package/dist/inventory/types.d.ts.map +1 -0
- package/dist/inventory/types.js +2 -0
- package/dist/inventory/types.js.map +1 -0
- package/dist/mcp/serve.d.ts +8 -0
- package/dist/mcp/serve.d.ts.map +1 -0
- package/dist/mcp/serve.js +118 -0
- package/dist/mcp/serve.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex target adapter (Phase 8 C2 — lands here as the "trivial case" of the
|
|
3
|
+
* stdio shim unification; absorbs roadmap 3.6).
|
|
4
|
+
*
|
|
5
|
+
* Codex layout (ground truth: `docs/research/phase-3-ecc-install-patterns.md`
|
|
6
|
+
* § "Codex — concrete format"):
|
|
7
|
+
* A. skills → `~/.codex/skills/<name>/SKILL.md` (+ bundle files)
|
|
8
|
+
* B. commands → `~/.codex/prompts/<name>.md` (YAML frontmatter stripped)
|
|
9
|
+
* C. MCP → TOML `~/.codex/config.toml` `[mcp_servers.*]` sections —
|
|
10
|
+
* **stdio-only** (Codex refuses `url` keys), which is exactly
|
|
11
|
+
* what the `hnx mcp serve` shim entry is.
|
|
12
|
+
*
|
|
13
|
+
* Deferred (unverified home-install shapes): rules (Codex wants AGENTS.md at a
|
|
14
|
+
* PROJECT root; a global write is not established), sub_agents, hooks — all
|
|
15
|
+
* surface as skipped warnings.
|
|
16
|
+
*
|
|
17
|
+
* The TOML merge is add/overwrite-only text surgery (like ECC's
|
|
18
|
+
* merge-mcp-config.js): our `[mcp_servers.harness-nexus-<slug>]` section is
|
|
19
|
+
* replaced idempotently; every other byte of the user's config is preserved.
|
|
20
|
+
*/
|
|
21
|
+
import fs from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { createTargetAdapter } from '../adapter-factory.js';
|
|
24
|
+
import { hnxExecutablePath } from '../../config.js';
|
|
25
|
+
/** The install-state ledger filename inside the Codex home. */
|
|
26
|
+
const INSTALL_STATE_FILENAME = 'harness-nexus-install-state.json';
|
|
27
|
+
/** A resource kind this adapter cannot emit (yet). */
|
|
28
|
+
const SKIPPED_KINDS = new Set(['rule', 'sub_agent', 'hook']);
|
|
29
|
+
const SKIP_REASONS = {
|
|
30
|
+
rule: 'Codex rules live in a project-root AGENTS.md — global install shape unverified',
|
|
31
|
+
sub_agent: 'Codex has no file-based sub-agent format',
|
|
32
|
+
hook: 'Codex has no declarative hooks format',
|
|
33
|
+
};
|
|
34
|
+
function slugify(name) {
|
|
35
|
+
return (name
|
|
36
|
+
.toLowerCase()
|
|
37
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
38
|
+
.replace(/^-+|-+$/g, '')
|
|
39
|
+
.slice(0, 64) || 'harness-nexus-profile');
|
|
40
|
+
}
|
|
41
|
+
// ---- TOML text surgery (no TOML parser dependency — our payload is plain) ----
|
|
42
|
+
/** JSON string escaping is valid TOML basic-string escaping for our charset. */
|
|
43
|
+
function tomlString(value) {
|
|
44
|
+
return JSON.stringify(value);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Replace (or append) one `[section]` in a TOML document, preserving every
|
|
48
|
+
* other line. Re-running with the same section is idempotent — an overwrite,
|
|
49
|
+
* unlike ECC's strictly add-only merge, matching our "plans are idempotent
|
|
50
|
+
* overwrites" upgrade semantics.
|
|
51
|
+
*/
|
|
52
|
+
export function mergeTomlSection(existing, section, body) {
|
|
53
|
+
const headerRe = /^\s*\[[^\]]+\]\s*$/;
|
|
54
|
+
const target = `[${section}]`;
|
|
55
|
+
const kept = [];
|
|
56
|
+
let skipping = false;
|
|
57
|
+
for (const line of existing.split('\n')) {
|
|
58
|
+
if (headerRe.test(line))
|
|
59
|
+
skipping = line.trim() === target;
|
|
60
|
+
if (!skipping)
|
|
61
|
+
kept.push(line);
|
|
62
|
+
}
|
|
63
|
+
const base = kept.join('\n').replace(/\s+$/, '');
|
|
64
|
+
return `${base}${base.length > 0 ? '\n\n' : ''}${target}\n${body}`;
|
|
65
|
+
}
|
|
66
|
+
/** Serialize the shim entry's `[mcp_servers.<key>]` body. */
|
|
67
|
+
function shimSectionBody(resolved, serverBase) {
|
|
68
|
+
const args = ['mcp', 'serve', '--profile', resolved.profile.id, '--server', serverBase];
|
|
69
|
+
return [
|
|
70
|
+
`command = ${tomlString(hnxExecutablePath())}`,
|
|
71
|
+
`args = [${args.map(tomlString).join(', ')}]`,
|
|
72
|
+
].join('\n');
|
|
73
|
+
}
|
|
74
|
+
/** Strip a leading YAML frontmatter block (Codex prompts are plain markdown). */
|
|
75
|
+
function stripFrontmatter(content) {
|
|
76
|
+
if (!content.startsWith('---\n'))
|
|
77
|
+
return content;
|
|
78
|
+
const end = content.indexOf('\n---\n', 4);
|
|
79
|
+
if (end === -1)
|
|
80
|
+
return content;
|
|
81
|
+
return content.slice(end + 5);
|
|
82
|
+
}
|
|
83
|
+
/** Extract a Resource's inline file set (same policy as the Hermes adapter). */
|
|
84
|
+
function resourceFiles(artifact) {
|
|
85
|
+
if (artifact.kind === 'mcp')
|
|
86
|
+
return [];
|
|
87
|
+
const src = artifact.resource.source;
|
|
88
|
+
if (src.type === 'inline') {
|
|
89
|
+
return [{ relativePath: 'SKILL.md', content: src.content }];
|
|
90
|
+
}
|
|
91
|
+
if (src.type === 'inline-bundle') {
|
|
92
|
+
return Object.entries(src.files).map(([rel, content]) => ({ relativePath: rel, content }));
|
|
93
|
+
}
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
export const codexAdapter = createTargetAdapter({
|
|
97
|
+
id: 'codex-home',
|
|
98
|
+
target: 'codex',
|
|
99
|
+
kind: 'home',
|
|
100
|
+
rootSegments: ['.codex'],
|
|
101
|
+
planOperations(resolved, input, adapter) {
|
|
102
|
+
const root = adapter.resolveRoot(input);
|
|
103
|
+
const slug = slugify(resolved.profile.name);
|
|
104
|
+
const operations = [];
|
|
105
|
+
const skipped = [];
|
|
106
|
+
// ---- A. skills → ~/.codex/skills/<name>/ ----
|
|
107
|
+
for (const a of resolved.artifacts) {
|
|
108
|
+
if (a.kind !== 'skill')
|
|
109
|
+
continue;
|
|
110
|
+
const files = resourceFiles(a);
|
|
111
|
+
if (files.length === 0) {
|
|
112
|
+
skipped.push(`skill:${a.resource.key} (non-inline source not fetchable by CLI)`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const f of files) {
|
|
116
|
+
operations.push({
|
|
117
|
+
kind: 'write-file',
|
|
118
|
+
content: f.content,
|
|
119
|
+
destinationPath: path.join(root, 'skills', a.resource.name, f.relativePath),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// ---- B. commands → ~/.codex/prompts/<name>.md ----
|
|
124
|
+
for (const a of resolved.artifacts) {
|
|
125
|
+
if (a.kind !== 'command')
|
|
126
|
+
continue;
|
|
127
|
+
const files = resourceFiles(a);
|
|
128
|
+
const content = files[0]?.content;
|
|
129
|
+
if (content === undefined) {
|
|
130
|
+
skipped.push(`command:${a.resource.key} (non-inline source not fetchable by CLI)`);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
operations.push({
|
|
134
|
+
kind: 'write-file',
|
|
135
|
+
content: stripFrontmatter(content),
|
|
136
|
+
destinationPath: path.join(root, 'prompts', `${a.resource.name}.md`),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// ---- C. MCP → config.toml [mcp_servers.harness-nexus-<slug>] ----
|
|
140
|
+
const serverBase = process.env.HN_SERVER ?? 'https://harness-nexus.example.com';
|
|
141
|
+
const hasMcp = resolved.artifacts.some((a) => a.kind === 'mcp');
|
|
142
|
+
let needsHnx = false;
|
|
143
|
+
if (hasMcp) {
|
|
144
|
+
const cfgPath = path.join(root, 'config.toml');
|
|
145
|
+
const existing = fs.existsSync(cfgPath) ? fs.readFileSync(cfgPath, 'utf8') : '';
|
|
146
|
+
const merged = mergeTomlSection(existing, `mcp_servers.harness-nexus-${slug}`, shimSectionBody(resolved, serverBase));
|
|
147
|
+
operations.push({ kind: 'write-file', content: merged, destinationPath: cfgPath });
|
|
148
|
+
needsHnx = true;
|
|
149
|
+
}
|
|
150
|
+
// ---- skipped kinds ----
|
|
151
|
+
for (const a of resolved.artifacts) {
|
|
152
|
+
if (a.kind === 'mcp')
|
|
153
|
+
continue;
|
|
154
|
+
if (SKIPPED_KINDS.has(a.kind)) {
|
|
155
|
+
skipped.push(`${a.kind}:${a.resource.key} (${SKIP_REASONS[a.kind]})`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
lastPlanWarnings = { skipped, needsHnx };
|
|
159
|
+
return {
|
|
160
|
+
adapter: { id: adapter.id, target: adapter.target, kind: adapter.kind },
|
|
161
|
+
targetRoot: root,
|
|
162
|
+
installStatePath: path.join(root, INSTALL_STATE_FILENAME),
|
|
163
|
+
operations,
|
|
164
|
+
sensitive: false,
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
let lastPlanWarnings = { skipped: [], needsHnx: false };
|
|
169
|
+
export function getCodexPlanWarnings() {
|
|
170
|
+
return lastPlanWarnings;
|
|
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AQ,EAAE,CAAC;QAEzC,OAAO;YACL,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;YACvE,UAAU,EAAE,IAAI;YAChB,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,sBAAsB,CAAC;YACzD,UAAU;YACV,SAAS,EAAE,KAAK;SACjB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAOH,IAAI,gBAAgB,GAAsB,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC3E,MAAM,UAAU,oBAAoB;IAClC,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResolvedProfile, TargetAdapter } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Guarantee the frontmatter dsh requires. Existing frontmatter lines are kept
|
|
4
|
+
* verbatim (dsh tolerates extra metadata keys); only `name` (must be kebab)
|
|
5
|
+
* and `description` (non-empty) are completed or corrected. JSON string
|
|
6
|
+
* quoting is valid YAML 1.2 double-quoting — the escape hatch for arbitrary
|
|
7
|
+
* description text.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureDshFrontmatter(content: string, slug: string, description: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Replace (or append) this profile's managed region in the home patch,
|
|
12
|
+
* preserving every other byte — including other profiles' regions. Re-running
|
|
13
|
+
* with the same slug is idempotent, matching "plans are idempotent
|
|
14
|
+
* overwrites" upgrade semantics.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeManagedPatchRegion(existing: string, slug: string, block: string): string;
|
|
17
|
+
/** Serialize this profile's `- insert:` block for the home patch. */
|
|
18
|
+
export declare function managedPatchBlock(resolved: ResolvedProfile, serverBase: string): string;
|
|
19
|
+
export declare const deepseekAdapter: TargetAdapter;
|
|
20
|
+
/** Warnings from the most recent deepseek plan (read by the CLI for output). */
|
|
21
|
+
export interface DeepseekPlanWarnings {
|
|
22
|
+
skipped: string[];
|
|
23
|
+
needsHnx: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function getDeepseekPlanWarnings(): DeepseekPlanWarnings;
|
|
26
|
+
//# sourceMappingURL=deepseek.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepseek.d.ts","sourceRoot":"","sources":["../../../src/install/adapters/deepseek.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAA+B,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuD/F;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAyB/F;AAOD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAa7F;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAevF;AAeD,eAAO,MAAM,eAAe,EAAE,aAyF5B,CAAC;AAEH,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,CAE9D"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeepSeek Harness (dsh) target adapter (Phase 8 T1).
|
|
3
|
+
*
|
|
4
|
+
* dsh layout (ground truth: `docs/research/phase-8-t1-deepseek-harness.md`,
|
|
5
|
+
* pinned to dsh v0.1.2-rc.1):
|
|
6
|
+
* A. skills → `~/.dsh/skills/<name>/SKILL.md` (+ bundle files) — the Agent
|
|
7
|
+
* Skills format, but dsh REQUIRES YAML frontmatter
|
|
8
|
+
* `name` + `description` (files without it are ignored) and
|
|
9
|
+
* kebab-case names `^[a-z0-9]+(?:-[a-z0-9]+)*$`; the adapter
|
|
10
|
+
* guarantees both (frontmatter synthesis).
|
|
11
|
+
* B. commands → flat `~/.dsh/skills/<name>.md` — dsh's slash-command
|
|
12
|
+
* surface IS the skill surface (`/name`); frontmatter is kept
|
|
13
|
+
* and completed, unlike the Codex adapter which strips it.
|
|
14
|
+
* C. MCP → home-level `~/.dsh/cordis.patch.yml` — a managed
|
|
15
|
+
* `- insert:` row per profile mounting
|
|
16
|
+
* `'@deepseek-ai/dsh-mcp-client'` with the stdio
|
|
17
|
+
* `hnx mcp serve` shim. The row sits between per-profile
|
|
18
|
+
* marker comments; re-planning replaces only THIS profile's
|
|
19
|
+
* marked region (idempotent overwrite — other profiles'
|
|
20
|
+
* regions and user rows stay byte-for-byte), and dsh
|
|
21
|
+
* hot-reloads the home patch without a restart.
|
|
22
|
+
*
|
|
23
|
+
* Deferred (no verified declarative shape — see research): rules (the dsh
|
|
24
|
+
* persona is a config row; overwriting a user's is destructive), sub_agents
|
|
25
|
+
* (programmatic provider registry), hooks (CC/Codex bridges are opt-in
|
|
26
|
+
* packages) — all surface as skipped warnings.
|
|
27
|
+
*/
|
|
28
|
+
import fs from 'node:fs';
|
|
29
|
+
import path from 'node:path';
|
|
30
|
+
import { createTargetAdapter } from '../adapter-factory.js';
|
|
31
|
+
import { hnxExecutablePath } from '../../config.js';
|
|
32
|
+
/** The install-state ledger filename inside the dsh home. */
|
|
33
|
+
const INSTALL_STATE_FILENAME = 'harness-nexus-install-state.json';
|
|
34
|
+
/** dsh home patch file — applied to EVERY profile and hot-reloaded live. */
|
|
35
|
+
const PATCH_FILENAME = 'cordis.patch.yml';
|
|
36
|
+
/** dsh `serverName` constraint: `[A-Za-z0-9_-]{1,32}`. */
|
|
37
|
+
const MAX_SERVER_NAME = 32;
|
|
38
|
+
const SERVER_NAME_PREFIX = 'harness-nexus';
|
|
39
|
+
/** A resource kind this adapter cannot emit (yet). */
|
|
40
|
+
const SKIPPED_KINDS = new Set(['rule', 'sub_agent', 'hook']);
|
|
41
|
+
const SKIP_REASONS = {
|
|
42
|
+
rule: 'dsh has no user-scope rules file — the persona is a config row hnx will not overwrite',
|
|
43
|
+
sub_agent: 'dsh sub-agents are programmatic providers, not files',
|
|
44
|
+
hook: 'dsh hook bridges are opt-in per-profile packages an install cannot wire',
|
|
45
|
+
};
|
|
46
|
+
/** dsh skill names are kebab-case `^[a-z0-9]+(?:-[a-z0-9]+)*$`. */
|
|
47
|
+
const KEBAB_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
48
|
+
function slugify(name) {
|
|
49
|
+
const slug = name
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
52
|
+
.replace(/^-+|-+$/g, '')
|
|
53
|
+
.replace(/-{2,}/g, '-')
|
|
54
|
+
.slice(0, 64);
|
|
55
|
+
return slug === '' ? 'harness-nexus' : slug;
|
|
56
|
+
}
|
|
57
|
+
/** Cap a `harness-nexus-<slug>` server name to dsh's 32-char constraint. */
|
|
58
|
+
function serverNameFor(slug) {
|
|
59
|
+
return `${SERVER_NAME_PREFIX}-${slug}`.slice(0, MAX_SERVER_NAME);
|
|
60
|
+
}
|
|
61
|
+
// ---- frontmatter (dsh ignores skill files without name + description) ----
|
|
62
|
+
function splitFrontmatter(content) {
|
|
63
|
+
const lines = content.split('\n');
|
|
64
|
+
if (lines[0] === undefined || lines[0].trim() !== '---')
|
|
65
|
+
return null;
|
|
66
|
+
const end = lines.findIndex((l, i) => i > 0 && l.trim() === '---');
|
|
67
|
+
if (end === -1)
|
|
68
|
+
return null;
|
|
69
|
+
return { lines: lines.slice(1, end), body: lines.slice(end + 1).join('\n') };
|
|
70
|
+
}
|
|
71
|
+
/** Value of a `key: value` scalar line, surrounding quotes stripped. */
|
|
72
|
+
function scalarValue(line, key) {
|
|
73
|
+
const v = line.slice(key.length + 1).trim();
|
|
74
|
+
return v.replace(/^['"]|['"]$/g, '');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Guarantee the frontmatter dsh requires. Existing frontmatter lines are kept
|
|
78
|
+
* verbatim (dsh tolerates extra metadata keys); only `name` (must be kebab)
|
|
79
|
+
* and `description` (non-empty) are completed or corrected. JSON string
|
|
80
|
+
* quoting is valid YAML 1.2 double-quoting — the escape hatch for arbitrary
|
|
81
|
+
* description text.
|
|
82
|
+
*/
|
|
83
|
+
export function ensureDshFrontmatter(content, slug, description) {
|
|
84
|
+
const fallback = JSON.stringify(description.trim().split('\n')[0] || slug);
|
|
85
|
+
const fm = splitFrontmatter(content);
|
|
86
|
+
if (fm === null) {
|
|
87
|
+
return `---\nname: ${slug}\ndescription: ${fallback}\n---\n\n${content}`;
|
|
88
|
+
}
|
|
89
|
+
const lines = [...fm.lines];
|
|
90
|
+
const nameIdx = lines.findIndex((l) => /^name:/.test(l));
|
|
91
|
+
if (nameIdx === -1) {
|
|
92
|
+
lines.unshift(`name: ${slug}`);
|
|
93
|
+
}
|
|
94
|
+
else if (!KEBAB_NAME.test(scalarValue(lines[nameIdx], 'name'))) {
|
|
95
|
+
lines[nameIdx] = `name: ${slug}`;
|
|
96
|
+
}
|
|
97
|
+
const descIdx = lines.findIndex((l) => /^description:/.test(l));
|
|
98
|
+
if (descIdx === -1) {
|
|
99
|
+
const afterName = lines.findIndex((l) => /^name:/.test(l)) + 1;
|
|
100
|
+
lines.splice(afterName, 0, `description: ${fallback}`);
|
|
101
|
+
}
|
|
102
|
+
else if (scalarValue(lines[descIdx], 'description') === '') {
|
|
103
|
+
// Block indicators (`>-`, `|`) count as present — only truly empty loses.
|
|
104
|
+
lines[descIdx] = `description: ${fallback}`;
|
|
105
|
+
}
|
|
106
|
+
return `---\n${lines.join('\n')}\n---\n${fm.body}`;
|
|
107
|
+
}
|
|
108
|
+
// ---- cordis patch surgery (per-profile managed region, no YAML parser) ----
|
|
109
|
+
const beginMarker = (slug) => `# BEGIN harness-nexus:${slug} (managed)`;
|
|
110
|
+
const endMarker = (slug) => `# END harness-nexus:${slug} (managed)`;
|
|
111
|
+
/**
|
|
112
|
+
* Replace (or append) this profile's managed region in the home patch,
|
|
113
|
+
* preserving every other byte — including other profiles' regions. Re-running
|
|
114
|
+
* with the same slug is idempotent, matching "plans are idempotent
|
|
115
|
+
* overwrites" upgrade semantics.
|
|
116
|
+
*/
|
|
117
|
+
export function mergeManagedPatchRegion(existing, slug, block) {
|
|
118
|
+
const begin = beginMarker(slug);
|
|
119
|
+
const end = endMarker(slug);
|
|
120
|
+
let base = existing;
|
|
121
|
+
const b = base.indexOf(begin);
|
|
122
|
+
if (b !== -1) {
|
|
123
|
+
const e = base.indexOf(end, b);
|
|
124
|
+
if (e !== -1) {
|
|
125
|
+
base = base.slice(0, b) + base.slice(e + end.length).replace(/^\n+/, '');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
base = base.replace(/\s+$/, '');
|
|
129
|
+
return `${base}${base.length > 0 ? '\n\n' : ''}${block}\n`;
|
|
130
|
+
}
|
|
131
|
+
/** Serialize this profile's `- insert:` block for the home patch. */
|
|
132
|
+
export function managedPatchBlock(resolved, serverBase) {
|
|
133
|
+
const slug = slugify(resolved.profile.name);
|
|
134
|
+
const args = ['mcp', 'serve', '--profile', resolved.profile.id, '--server', serverBase];
|
|
135
|
+
return [
|
|
136
|
+
`${beginMarker(slug)} — rewritten by hnx; keep edits outside the markers`,
|
|
137
|
+
`- insert:`,
|
|
138
|
+
` - id: hnx-mcp-${slug}`,
|
|
139
|
+
` name: '@deepseek-ai/dsh-mcp-client'`,
|
|
140
|
+
` config:`,
|
|
141
|
+
` serverName: ${serverNameFor(slug)}`,
|
|
142
|
+
` transport: stdio`,
|
|
143
|
+
` command: ${JSON.stringify(hnxExecutablePath())}`,
|
|
144
|
+
` args: [${args.map((a) => JSON.stringify(a)).join(', ')}]`,
|
|
145
|
+
endMarker(slug),
|
|
146
|
+
].join('\n');
|
|
147
|
+
}
|
|
148
|
+
/** Extract a Resource's inline file set (same policy as the other adapters). */
|
|
149
|
+
function resourceFiles(artifact) {
|
|
150
|
+
if (artifact.kind === 'mcp')
|
|
151
|
+
return [];
|
|
152
|
+
const src = artifact.resource.source;
|
|
153
|
+
if (src.type === 'inline') {
|
|
154
|
+
return [{ relativePath: 'SKILL.md', content: src.content }];
|
|
155
|
+
}
|
|
156
|
+
if (src.type === 'inline-bundle') {
|
|
157
|
+
return Object.entries(src.files).map(([rel, content]) => ({ relativePath: rel, content }));
|
|
158
|
+
}
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
export const deepseekAdapter = createTargetAdapter({
|
|
162
|
+
id: 'deepseek-home',
|
|
163
|
+
target: 'deepseek',
|
|
164
|
+
kind: 'home',
|
|
165
|
+
rootSegments: ['.dsh'],
|
|
166
|
+
planOperations(resolved, input, adapter) {
|
|
167
|
+
const root = adapter.resolveRoot(input);
|
|
168
|
+
const operations = [];
|
|
169
|
+
const skipped = [];
|
|
170
|
+
// ---- A. skills → ~/.dsh/skills/<name>/ (+ bundle files) ----
|
|
171
|
+
for (const a of resolved.artifacts) {
|
|
172
|
+
if (a.kind !== 'skill')
|
|
173
|
+
continue;
|
|
174
|
+
const files = resourceFiles(a);
|
|
175
|
+
if (files.length === 0) {
|
|
176
|
+
skipped.push(`skill:${a.resource.key} (non-inline source not fetchable by CLI)`);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const slug = slugify(a.resource.name);
|
|
180
|
+
const description = a.resource.description ?? a.resource.name;
|
|
181
|
+
if (!files.some((f) => f.relativePath === 'SKILL.md')) {
|
|
182
|
+
skipped.push(`skill:${a.resource.key} (bundle has no SKILL.md at root)`);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
for (const f of files) {
|
|
186
|
+
const content = f.relativePath === 'SKILL.md'
|
|
187
|
+
? ensureDshFrontmatter(f.content, slug, description)
|
|
188
|
+
: f.content;
|
|
189
|
+
operations.push({
|
|
190
|
+
kind: 'write-file',
|
|
191
|
+
content,
|
|
192
|
+
destinationPath: path.join(root, 'skills', slug, f.relativePath),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// ---- B. commands → flat ~/.dsh/skills/<name>.md (the /name surface) ----
|
|
197
|
+
for (const a of resolved.artifacts) {
|
|
198
|
+
if (a.kind !== 'command')
|
|
199
|
+
continue;
|
|
200
|
+
const files = resourceFiles(a);
|
|
201
|
+
const content = files[0]?.content;
|
|
202
|
+
if (content === undefined) {
|
|
203
|
+
skipped.push(`command:${a.resource.key} (non-inline source not fetchable by CLI)`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const slug = slugify(a.resource.name);
|
|
207
|
+
operations.push({
|
|
208
|
+
kind: 'write-file',
|
|
209
|
+
content: ensureDshFrontmatter(content, slug, a.resource.description ?? a.resource.name),
|
|
210
|
+
destinationPath: path.join(root, 'skills', `${slug}.md`),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
// ---- C. MCP → home cordis.patch.yml managed region ----
|
|
214
|
+
const serverBase = process.env.HN_SERVER ?? 'https://harness-nexus.example.com';
|
|
215
|
+
const hasMcp = resolved.artifacts.some((a) => a.kind === 'mcp');
|
|
216
|
+
let needsHnx = false;
|
|
217
|
+
if (hasMcp) {
|
|
218
|
+
const patchPath = path.join(root, PATCH_FILENAME);
|
|
219
|
+
const existing = fs.existsSync(patchPath) ? fs.readFileSync(patchPath, 'utf8') : '';
|
|
220
|
+
const merged = mergeManagedPatchRegion(existing, slugify(resolved.profile.name), managedPatchBlock(resolved, serverBase));
|
|
221
|
+
operations.push({ kind: 'write-file', content: merged, destinationPath: patchPath });
|
|
222
|
+
needsHnx = true;
|
|
223
|
+
}
|
|
224
|
+
// ---- skipped kinds ----
|
|
225
|
+
for (const a of resolved.artifacts) {
|
|
226
|
+
if (a.kind === 'mcp')
|
|
227
|
+
continue;
|
|
228
|
+
if (SKIPPED_KINDS.has(a.kind)) {
|
|
229
|
+
skipped.push(`${a.kind}:${a.resource.key} (${SKIP_REASONS[a.kind]})`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
lastPlanWarnings = { skipped, needsHnx };
|
|
233
|
+
return {
|
|
234
|
+
adapter: { id: adapter.id, target: adapter.target, kind: adapter.kind },
|
|
235
|
+
targetRoot: root,
|
|
236
|
+
installStatePath: path.join(root, INSTALL_STATE_FILENAME),
|
|
237
|
+
operations,
|
|
238
|
+
sensitive: false,
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
let lastPlanWarnings = { skipped: [], needsHnx: false };
|
|
243
|
+
export function getDeepseekPlanWarnings() {
|
|
244
|
+
return lastPlanWarnings;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=deepseek.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepseek.js","sourceRoot":"","sources":["../../../src/install/adapters/deepseek.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,6DAA6D;AAC7D,MAAM,sBAAsB,GAAG,kCAAkC,CAAC;AAElE,4EAA4E;AAC5E,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,0DAA0D;AAC1D,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C,sDAAsD;AACtD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7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adapter. Overrides `planOperations` to emit the plugin bundle,
|
|
4
|
+
* the config.yaml MCP merge, and the AGENTS.md rule file.
|
|
5
|
+
*/
|
|
6
|
+
export declare const hermesAdapter: TargetAdapter;
|
|
7
|
+
/** Warnings from the most recent hermes planInstall (read by the CLI for output). */
|
|
8
|
+
export interface HermesPlanWarnings {
|
|
9
|
+
skipped: string[];
|
|
10
|
+
/** True when the plan carries a `hnx mcp serve` shim entry. */
|
|
11
|
+
needsHnx: boolean;
|
|
12
|
+
pluginSlug: string;
|
|
13
|
+
needsPluginEnable: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getHermesPlanWarnings(): HermesPlanWarnings;
|
|
16
|
+
//# sourceMappingURL=hermes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../src/install/adapters/hermes.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAMV,aAAa,EACd,MAAM,aAAa,CAAC;AAsIrB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,aAuH1B,CAAC;AAEH,qFAAqF;AACrF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,+DAA+D;IAC/D,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAOD,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D"}
|