@a5c-ai/extension-mux 5.0.1-staging.04ca6ab00d21
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/README.md +58 -0
- package/dist/binTemplates.d.ts +7 -0
- package/dist/binTemplates.d.ts.map +1 -0
- package/dist/binTemplates.js +292 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +299 -0
- package/dist/compiler.d.ts +15 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +118 -0
- package/dist/diff.d.ts +9 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +183 -0
- package/dist/emit.d.ts +3 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/emit.js +42 -0
- package/dist/hookRegistration.d.ts +8 -0
- package/dist/hookRegistration.d.ts.map +1 -0
- package/dist/hookRegistration.js +9 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/init.d.ts +17 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +200 -0
- package/dist/installInstructions.d.ts +3 -0
- package/dist/installInstructions.d.ts.map +1 -0
- package/dist/installInstructions.js +150 -0
- package/dist/installSharedGenerator.d.ts +3 -0
- package/dist/installSharedGenerator.d.ts.map +1 -0
- package/dist/installSharedGenerator.js +229 -0
- package/dist/manifestGenerators.d.ts +10 -0
- package/dist/manifestGenerators.d.ts.map +1 -0
- package/dist/manifestGenerators.js +11 -0
- package/dist/marketplaceGenerator.d.ts +3 -0
- package/dist/marketplaceGenerator.d.ts.map +1 -0
- package/dist/marketplaceGenerator.js +46 -0
- package/dist/proxiedHookTemplates.d.ts +10 -0
- package/dist/proxiedHookTemplates.d.ts.map +1 -0
- package/dist/proxiedHookTemplates.js +122 -0
- package/dist/resolve.d.ts +3 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +106 -0
- package/dist/schema.d.ts +231 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +340 -0
- package/dist/sdkConfig.d.ts +20 -0
- package/dist/sdkConfig.d.ts.map +1 -0
- package/dist/sdkConfig.js +41 -0
- package/dist/targets/adapters/base.d.ts +10 -0
- package/dist/targets/adapters/base.d.ts.map +1 -0
- package/dist/targets/adapters/base.js +16 -0
- package/dist/targets/adapters/claude-code.d.ts +9 -0
- package/dist/targets/adapters/claude-code.d.ts.map +1 -0
- package/dist/targets/adapters/claude-code.js +83 -0
- package/dist/targets/adapters/codex.d.ts +13 -0
- package/dist/targets/adapters/codex.d.ts.map +1 -0
- package/dist/targets/adapters/codex.js +103 -0
- package/dist/targets/adapters/cursor.d.ts +9 -0
- package/dist/targets/adapters/cursor.d.ts.map +1 -0
- package/dist/targets/adapters/cursor.js +57 -0
- package/dist/targets/adapters/gemini.d.ts +9 -0
- package/dist/targets/adapters/gemini.d.ts.map +1 -0
- package/dist/targets/adapters/gemini.js +86 -0
- package/dist/targets/adapters/github-copilot.d.ts +9 -0
- package/dist/targets/adapters/github-copilot.d.ts.map +1 -0
- package/dist/targets/adapters/github-copilot.js +61 -0
- package/dist/targets/adapters/hermes.d.ts +13 -0
- package/dist/targets/adapters/hermes.d.ts.map +1 -0
- package/dist/targets/adapters/hermes.js +96 -0
- package/dist/targets/adapters/hooks-utils.d.ts +12 -0
- package/dist/targets/adapters/hooks-utils.d.ts.map +1 -0
- package/dist/targets/adapters/hooks-utils.js +60 -0
- package/dist/targets/adapters/index.d.ts +27 -0
- package/dist/targets/adapters/index.d.ts.map +1 -0
- package/dist/targets/adapters/index.js +64 -0
- package/dist/targets/adapters/interface.d.ts +8 -0
- package/dist/targets/adapters/interface.d.ts.map +1 -0
- package/dist/targets/adapters/interface.js +2 -0
- package/dist/targets/adapters/oh-my-pi.d.ts +11 -0
- package/dist/targets/adapters/oh-my-pi.d.ts.map +1 -0
- package/dist/targets/adapters/oh-my-pi.js +88 -0
- package/dist/targets/adapters/openclaw.d.ts +14 -0
- package/dist/targets/adapters/openclaw.d.ts.map +1 -0
- package/dist/targets/adapters/openclaw.js +165 -0
- package/dist/targets/adapters/opencode.d.ts +10 -0
- package/dist/targets/adapters/opencode.d.ts.map +1 -0
- package/dist/targets/adapters/opencode.js +93 -0
- package/dist/targets/adapters/pi.d.ts +11 -0
- package/dist/targets/adapters/pi.d.ts.map +1 -0
- package/dist/targets/adapters/pi.js +90 -0
- package/dist/targets/index.d.ts +7 -0
- package/dist/targets/index.d.ts.map +1 -0
- package/dist/targets/index.js +77 -0
- package/dist/transform.d.ts +4 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +243 -0
- package/dist/transformEmitters.d.ts +8 -0
- package/dist/transformEmitters.d.ts.map +1 -0
- package/dist/transformEmitters.js +340 -0
- package/dist/transformHelpers.d.ts +13 -0
- package/dist/transformHelpers.d.ts.map +1 -0
- package/dist/transformHelpers.js +239 -0
- package/dist/types.d.ts +204 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +42 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +187 -0
- package/dist/validate.d.ts +3 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +188 -0
- package/dist/verify.d.ts +6 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +294 -0
- package/package.json +68 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Hermes harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { iterateHooks, slugify, resolveCmd, getPattern, resolveSdkConfig, } from './hooks-utils.js';
|
|
4
|
+
import { resolveTargetCliName, resolveTargetNpmPackageName, } from '../../sdkConfig.js';
|
|
5
|
+
import { generateHarnessManifest } from '../../transformHelpers.js';
|
|
6
|
+
export class HermesAdapter extends BaseHarnessOutputAdapter {
|
|
7
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
8
|
+
const content = generateHermesHooksJson(manifest, targetProfile);
|
|
9
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks.json', content };
|
|
10
|
+
}
|
|
11
|
+
generateManifestFiles(_sourceDir, manifest, targetProfile, _diagnostics, rawManifest) {
|
|
12
|
+
const files = [];
|
|
13
|
+
const hermesPkg = generateHermesManifest(manifest, this.targetName);
|
|
14
|
+
files.push({ path: 'package.json', content: hermesPkg });
|
|
15
|
+
if (targetProfile.harnessManifestPath) {
|
|
16
|
+
files.push({ path: targetProfile.harnessManifestPath, content: generateHarnessManifest(rawManifest || manifest, targetProfile) });
|
|
17
|
+
}
|
|
18
|
+
files.push({ path: '.app.json', content: JSON.stringify({ apps: {} }, null, 2) + '\n' });
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function buildNpmRepository(manifest, npmPackageName) {
|
|
23
|
+
if (!manifest.repository)
|
|
24
|
+
return undefined;
|
|
25
|
+
let url = typeof manifest.repository === 'string'
|
|
26
|
+
? manifest.repository
|
|
27
|
+
: manifest.repository.url;
|
|
28
|
+
if (!url.startsWith('git+'))
|
|
29
|
+
url = `git+${url}`;
|
|
30
|
+
if (!url.endsWith('.git'))
|
|
31
|
+
url = `${url}.git`;
|
|
32
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
33
|
+
return { type: 'git', url, directory };
|
|
34
|
+
}
|
|
35
|
+
function buildNpmHomepage(manifest, npmPackageName) {
|
|
36
|
+
if (!manifest.repository)
|
|
37
|
+
return undefined;
|
|
38
|
+
const url = typeof manifest.repository === 'string'
|
|
39
|
+
? manifest.repository
|
|
40
|
+
: manifest.repository.url;
|
|
41
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
42
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
43
|
+
return `${base}/tree/main/${directory}#readme`;
|
|
44
|
+
}
|
|
45
|
+
function buildNpmBugs(manifest) {
|
|
46
|
+
if (!manifest.repository)
|
|
47
|
+
return undefined;
|
|
48
|
+
const url = typeof manifest.repository === 'string'
|
|
49
|
+
? manifest.repository
|
|
50
|
+
: manifest.repository.url;
|
|
51
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
52
|
+
return { url: `${base}/issues` };
|
|
53
|
+
}
|
|
54
|
+
export function generateHermesManifest(manifest, targetName = 'hermes') {
|
|
55
|
+
const target = { name: targetName };
|
|
56
|
+
const packageJson = {
|
|
57
|
+
name: resolveTargetNpmPackageName(manifest, target),
|
|
58
|
+
version: manifest.version,
|
|
59
|
+
description: manifest.description,
|
|
60
|
+
scripts: {
|
|
61
|
+
test: 'npm run validate:ci',
|
|
62
|
+
'test:integration': 'node test/integration.test.js',
|
|
63
|
+
'test:packaged-install': 'node test/packaged-install.test.js',
|
|
64
|
+
'validate:ci': 'npm run test:integration && npm run test:packaged-install',
|
|
65
|
+
'team:install': 'node scripts/team-install.js',
|
|
66
|
+
},
|
|
67
|
+
bin: { [resolveTargetCliName(manifest, target)]: 'bin/cli.js' },
|
|
68
|
+
files: [
|
|
69
|
+
'hooks/',
|
|
70
|
+
'hooks.json',
|
|
71
|
+
'skills/',
|
|
72
|
+
'bin/',
|
|
73
|
+
'scripts/',
|
|
74
|
+
'README.md',
|
|
75
|
+
],
|
|
76
|
+
keywords: [manifest.name, targetName, 'orchestration'],
|
|
77
|
+
author: typeof manifest.author === 'string' ? manifest.author : manifest.author.name,
|
|
78
|
+
license: manifest.license,
|
|
79
|
+
};
|
|
80
|
+
const pkgName = resolveTargetNpmPackageName(manifest, target);
|
|
81
|
+
packageJson.repository = buildNpmRepository(manifest, pkgName);
|
|
82
|
+
packageJson.homepage = buildNpmHomepage(manifest, pkgName);
|
|
83
|
+
packageJson.bugs = buildNpmBugs(manifest);
|
|
84
|
+
return JSON.stringify(packageJson, null, 2) + '\n';
|
|
85
|
+
}
|
|
86
|
+
export function generateHermesHooksJson(manifest, targetProfile) {
|
|
87
|
+
const hooks = {};
|
|
88
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
89
|
+
const sdk = resolveSdkConfig(manifest);
|
|
90
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
91
|
+
const slug = slugify(canonical);
|
|
92
|
+
const cmd = resolveCmd(handler, slug, targetProfile.adapterName, '.', manifest.name, native, sdk.proxyPackage, sdk.proxyBinary, pat);
|
|
93
|
+
hooks[native] = [{ matcher: '.*', hooks: [{ type: 'command', command: cmd }] }];
|
|
94
|
+
});
|
|
95
|
+
return JSON.stringify({ hooks }, null, 2) + '\n';
|
|
96
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile } from '../../types.js';
|
|
2
|
+
import { slugify } from '../../utils.js';
|
|
3
|
+
import { resolveSdkConfig } from '../../sdkConfig.js';
|
|
4
|
+
export { slugify };
|
|
5
|
+
export { resolveSdkConfig };
|
|
6
|
+
export declare function applyPattern(pattern: string, pluginName: string, hookSlug: string, nativeHook: string): string;
|
|
7
|
+
export declare function resolveHookPath(handlerValue: string | boolean, hookSlug: string, pluginName: string, nativeHook: string, hookFilePattern?: string): string | null;
|
|
8
|
+
export declare function resolveCmd(handlerValue: string | boolean, hookSlug: string, adapter: string, rootRef: string, pluginName: string, nativeHook: string, proxyPkg: string, proxyBin: string, pattern?: string): string;
|
|
9
|
+
export declare function getPattern(manifest: A5cPluginManifest, targetName: string): string | undefined;
|
|
10
|
+
export declare function getJsPattern(manifest: A5cPluginManifest, targetName: string): string | undefined;
|
|
11
|
+
export declare function iterateHooks(manifest: A5cPluginManifest, targetProfile: TargetProfile, cb: (canonical: string, native: string, handler: string | boolean) => void): void;
|
|
12
|
+
//# sourceMappingURL=hooks-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks-utils.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/hooks-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAMR;AAED,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,GAAG,OAAO,EAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,UAAU,CACxB,YAAY,EAAE,MAAM,GAAG,OAAO,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAUR;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK9F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMhG;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,GACzE,IAAI,CAQN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Shared hook utility functions used across multiple adapters
|
|
2
|
+
import { slugify } from '../../utils.js';
|
|
3
|
+
import { resolveSdkConfig } from '../../sdkConfig.js';
|
|
4
|
+
export { slugify };
|
|
5
|
+
export { resolveSdkConfig };
|
|
6
|
+
export function applyPattern(pattern, pluginName, hookSlug, nativeHook) {
|
|
7
|
+
const nativeSlug = nativeHook.replace(/[._]/g, '-').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
8
|
+
return 'hooks/' + pattern
|
|
9
|
+
.replace(/\{\{name\}\}/g, pluginName)
|
|
10
|
+
.replace(/\{\{slug\}\}/g, hookSlug)
|
|
11
|
+
.replace(/\{\{native\}\}/g, nativeSlug);
|
|
12
|
+
}
|
|
13
|
+
export function resolveHookPath(handlerValue, hookSlug, pluginName, nativeHook, hookFilePattern) {
|
|
14
|
+
if (typeof handlerValue !== 'string' || handlerValue === 'proxy')
|
|
15
|
+
return null;
|
|
16
|
+
if (hookFilePattern) {
|
|
17
|
+
return applyPattern(hookFilePattern, pluginName, hookSlug, nativeHook);
|
|
18
|
+
}
|
|
19
|
+
return handlerValue;
|
|
20
|
+
}
|
|
21
|
+
export function resolveCmd(handlerValue, hookSlug, adapter, rootRef, pluginName, nativeHook, proxyPkg, proxyBin, pattern) {
|
|
22
|
+
if (handlerValue === 'proxy') {
|
|
23
|
+
return `${proxyBin} invoke --adapter ${adapter} --json`;
|
|
24
|
+
}
|
|
25
|
+
const p = resolveHookPath(handlerValue, hookSlug, pluginName, nativeHook, pattern);
|
|
26
|
+
if (p) {
|
|
27
|
+
const scriptRef = `${rootRef}/${p}`;
|
|
28
|
+
return `${proxyBin} invoke --adapter ${adapter} --handler "bash ${scriptRef}" --json`;
|
|
29
|
+
}
|
|
30
|
+
return `echo '{}'`;
|
|
31
|
+
}
|
|
32
|
+
export function getPattern(manifest, targetName) {
|
|
33
|
+
const override = manifest.targets?.[targetName]?.hookFilePattern;
|
|
34
|
+
if (typeof override === 'string')
|
|
35
|
+
return override;
|
|
36
|
+
if (typeof manifest.hookFilePattern === 'string')
|
|
37
|
+
return manifest.hookFilePattern;
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
export function getJsPattern(manifest, targetName) {
|
|
41
|
+
const override = manifest.targets?.[targetName]?.hookJsPattern;
|
|
42
|
+
if (typeof override === 'string')
|
|
43
|
+
return override;
|
|
44
|
+
// Derive JS pattern from global hookFilePattern by swapping extension
|
|
45
|
+
if (typeof manifest.hookFilePattern === 'string')
|
|
46
|
+
return manifest.hookFilePattern.replace(/\.sh$/, '.js');
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
export function iterateHooks(manifest, targetProfile, cb) {
|
|
50
|
+
if (!manifest.hooks)
|
|
51
|
+
return;
|
|
52
|
+
for (const [canonical, handler] of Object.entries(manifest.hooks)) {
|
|
53
|
+
if (handler === null)
|
|
54
|
+
continue;
|
|
55
|
+
const native = targetProfile.supportedHooks.get(canonical);
|
|
56
|
+
if (!native)
|
|
57
|
+
continue;
|
|
58
|
+
cb(canonical, native, handler);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type { HarnessOutputAdapter } from './interface.js';
|
|
2
|
+
export { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import type { HarnessOutputAdapter } from './interface.js';
|
|
4
|
+
export { ClaudeCodeAdapter } from './claude-code.js';
|
|
5
|
+
export { CodexAdapter } from './codex.js';
|
|
6
|
+
export { CursorAdapter } from './cursor.js';
|
|
7
|
+
export { GeminiAdapter } from './gemini.js';
|
|
8
|
+
export { GithubCopilotAdapter } from './github-copilot.js';
|
|
9
|
+
export { HermesAdapter } from './hermes.js';
|
|
10
|
+
export { OpenCodeAdapter } from './opencode.js';
|
|
11
|
+
export { OpenClawAdapter } from './openclaw.js';
|
|
12
|
+
export { PiAdapter } from './pi.js';
|
|
13
|
+
export { OhMyPiAdapter } from './oh-my-pi.js';
|
|
14
|
+
export { generateClaudeCodeHooksJson, generateClaudeCodeManifest } from './claude-code.js';
|
|
15
|
+
export { generateCodexHooksJson, generateCodexManifest } from './codex.js';
|
|
16
|
+
export { generateCursorHooksJson, generateCursorManifest } from './cursor.js';
|
|
17
|
+
export { generateHermesHooksJson, generateHermesManifest } from './hermes.js';
|
|
18
|
+
export { generateGeminiHooksJson, generateGeminiManifest } from './gemini.js';
|
|
19
|
+
export { generateGithubCopilotHooksJson, generateGithubCopilotManifest } from './github-copilot.js';
|
|
20
|
+
export { generateOpenCodeHooksJson, generateOpenCodeManifest } from './opencode.js';
|
|
21
|
+
export { generateOpenClawHooksJson, generateOpenClawManifest, generateOpenClawPackageManifest } from './openclaw.js';
|
|
22
|
+
export { generatePiManifest } from './pi.js';
|
|
23
|
+
export { generateOhMyPiManifest } from './oh-my-pi.js';
|
|
24
|
+
declare const ADAPTER_REGISTRY: Record<string, HarnessOutputAdapter>;
|
|
25
|
+
export declare function getAdapter(targetName: string): HarnessOutputAdapter | undefined;
|
|
26
|
+
export { ADAPTER_REGISTRY };
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAa3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAqBvD,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAM,CAAC;AASlE,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE/E;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Adapter registry — built dynamically from the agent-catalog graph
|
|
2
|
+
export { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { listPluginTargetDescriptors } from '@a5c-ai/agent-catalog';
|
|
4
|
+
import { ClaudeCodeAdapter } from './claude-code.js';
|
|
5
|
+
import { CodexAdapter } from './codex.js';
|
|
6
|
+
import { CursorAdapter } from './cursor.js';
|
|
7
|
+
import { GeminiAdapter } from './gemini.js';
|
|
8
|
+
import { GithubCopilotAdapter } from './github-copilot.js';
|
|
9
|
+
import { HermesAdapter } from './hermes.js';
|
|
10
|
+
import { OpenCodeAdapter } from './opencode.js';
|
|
11
|
+
import { OpenClawAdapter } from './openclaw.js';
|
|
12
|
+
import { PiAdapter } from './pi.js';
|
|
13
|
+
import { OhMyPiAdapter } from './oh-my-pi.js';
|
|
14
|
+
// Re-export individual adapter classes
|
|
15
|
+
export { ClaudeCodeAdapter } from './claude-code.js';
|
|
16
|
+
export { CodexAdapter } from './codex.js';
|
|
17
|
+
export { CursorAdapter } from './cursor.js';
|
|
18
|
+
export { GeminiAdapter } from './gemini.js';
|
|
19
|
+
export { GithubCopilotAdapter } from './github-copilot.js';
|
|
20
|
+
export { HermesAdapter } from './hermes.js';
|
|
21
|
+
export { OpenCodeAdapter } from './opencode.js';
|
|
22
|
+
export { OpenClawAdapter } from './openclaw.js';
|
|
23
|
+
export { PiAdapter } from './pi.js';
|
|
24
|
+
export { OhMyPiAdapter } from './oh-my-pi.js';
|
|
25
|
+
// Re-export hook/manifest generators for backward compatibility
|
|
26
|
+
export { generateClaudeCodeHooksJson, generateClaudeCodeManifest } from './claude-code.js';
|
|
27
|
+
export { generateCodexHooksJson, generateCodexManifest } from './codex.js';
|
|
28
|
+
export { generateCursorHooksJson, generateCursorManifest } from './cursor.js';
|
|
29
|
+
export { generateHermesHooksJson, generateHermesManifest } from './hermes.js';
|
|
30
|
+
export { generateGeminiHooksJson, generateGeminiManifest } from './gemini.js';
|
|
31
|
+
export { generateGithubCopilotHooksJson, generateGithubCopilotManifest } from './github-copilot.js';
|
|
32
|
+
export { generateOpenCodeHooksJson, generateOpenCodeManifest } from './opencode.js';
|
|
33
|
+
export { generateOpenClawHooksJson, generateOpenClawManifest, generateOpenClawPackageManifest } from './openclaw.js';
|
|
34
|
+
export { generatePiManifest } from './pi.js';
|
|
35
|
+
export { generateOhMyPiManifest } from './oh-my-pi.js';
|
|
36
|
+
// Map hookRegistrationFormat → adapter constructor.
|
|
37
|
+
// The adapter receives its targetId from the catalog at construction time.
|
|
38
|
+
const ADAPTER_CLASS_BY_FORMAT = {
|
|
39
|
+
'claude-code': ClaudeCodeAdapter,
|
|
40
|
+
'codex': CodexAdapter,
|
|
41
|
+
'cursor': CursorAdapter,
|
|
42
|
+
'gemini': GeminiAdapter,
|
|
43
|
+
'github-copilot': GithubCopilotAdapter,
|
|
44
|
+
'hermes': HermesAdapter,
|
|
45
|
+
'opencode': OpenCodeAdapter,
|
|
46
|
+
'openclaw': OpenClawAdapter,
|
|
47
|
+
};
|
|
48
|
+
const ADAPTER_CLASS_BY_TARGET = {
|
|
49
|
+
'pi': PiAdapter,
|
|
50
|
+
'oh-my-pi': OhMyPiAdapter,
|
|
51
|
+
};
|
|
52
|
+
// Build registry dynamically from the catalog graph — adapter names come from Atlas
|
|
53
|
+
const ADAPTER_REGISTRY = {};
|
|
54
|
+
for (const descriptor of listPluginTargetDescriptors()) {
|
|
55
|
+
const format = descriptor.hookRegistrationFormat;
|
|
56
|
+
const AdapterClass = (format && ADAPTER_CLASS_BY_FORMAT[format]) || ADAPTER_CLASS_BY_TARGET[descriptor.targetId];
|
|
57
|
+
if (AdapterClass) {
|
|
58
|
+
ADAPTER_REGISTRY[descriptor.targetId] = new AdapterClass(descriptor.targetId);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function getAdapter(targetName) {
|
|
62
|
+
return ADAPTER_REGISTRY[targetName];
|
|
63
|
+
}
|
|
64
|
+
export { ADAPTER_REGISTRY };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
export interface HarnessOutputAdapter {
|
|
3
|
+
readonly targetName: string;
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, diagnostics: Diagnostic[], rawManifest?: A5cPluginManifest): TransformedFile[];
|
|
6
|
+
generateExtraTargetFiles(sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, diagnostics: Diagnostic[]): TransformedFile[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/interface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,eAAe,GAAG,IAAI,CAAC;IACvI,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,eAAe,EAAE,CAAC;IACnL,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;CACtJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class OhMyPiAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile[];
|
|
5
|
+
}
|
|
6
|
+
type ResolvedManifest = A5cPluginManifest & {
|
|
7
|
+
npmPackageName?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function generateOhMyPiManifest(manifest: ResolvedManifest, targetName?: string): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=oh-my-pi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oh-my-pi.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/oh-my-pi.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAMrD,qBAAa,aAAc,SAAQ,wBAAwB;IAIzD,qBAAqB,CACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CAQrB;AAED,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAwCF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,UAAU,SAAa,GAAG,MAAM,CA4ClG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// oh-my-pi harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { resolveTargetCliName, resolveTargetNpmPackageName, } from '../../sdkConfig.js';
|
|
4
|
+
export class OhMyPiAdapter extends BaseHarnessOutputAdapter {
|
|
5
|
+
generateManifestFiles(_sourceDir, manifest, _targetProfile, _diagnostics) {
|
|
6
|
+
const files = [];
|
|
7
|
+
files.push({
|
|
8
|
+
path: 'package.json',
|
|
9
|
+
content: generateOhMyPiManifest(manifest, this.targetName),
|
|
10
|
+
});
|
|
11
|
+
return files;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function buildNpmRepository(manifest, npmPackageName) {
|
|
15
|
+
if (!manifest.repository)
|
|
16
|
+
return undefined;
|
|
17
|
+
let url = typeof manifest.repository === 'string'
|
|
18
|
+
? manifest.repository
|
|
19
|
+
: manifest.repository.url;
|
|
20
|
+
if (!url.startsWith('git+'))
|
|
21
|
+
url = `git+${url}`;
|
|
22
|
+
if (!url.endsWith('.git'))
|
|
23
|
+
url = `${url}.git`;
|
|
24
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
25
|
+
return { type: 'git', url, directory };
|
|
26
|
+
}
|
|
27
|
+
function buildNpmHomepage(manifest, npmPackageName) {
|
|
28
|
+
if (!manifest.repository)
|
|
29
|
+
return undefined;
|
|
30
|
+
const url = typeof manifest.repository === 'string'
|
|
31
|
+
? manifest.repository
|
|
32
|
+
: manifest.repository.url;
|
|
33
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
34
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
35
|
+
return `${base}/tree/main/${directory}#readme`;
|
|
36
|
+
}
|
|
37
|
+
function buildNpmBugs(manifest) {
|
|
38
|
+
if (!manifest.repository)
|
|
39
|
+
return undefined;
|
|
40
|
+
const url = typeof manifest.repository === 'string'
|
|
41
|
+
? manifest.repository
|
|
42
|
+
: manifest.repository.url;
|
|
43
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
44
|
+
return { url: `${base}/issues` };
|
|
45
|
+
}
|
|
46
|
+
export function generateOhMyPiManifest(manifest, targetName = 'oh-my-pi') {
|
|
47
|
+
const target = { name: targetName };
|
|
48
|
+
const packageJson = {
|
|
49
|
+
name: resolveTargetNpmPackageName(manifest, target),
|
|
50
|
+
version: manifest.version,
|
|
51
|
+
type: 'module',
|
|
52
|
+
description: `${manifest.description} — ${targetName}`,
|
|
53
|
+
keywords: [targetName, manifest.name, 'orchestration'],
|
|
54
|
+
omp: {
|
|
55
|
+
extensions: ['./extensions'],
|
|
56
|
+
skills: ['./skills'],
|
|
57
|
+
},
|
|
58
|
+
peerDependencies: {
|
|
59
|
+
'@oh-my-pi/pi-coding-agent': '*',
|
|
60
|
+
},
|
|
61
|
+
scripts: {
|
|
62
|
+
test: 'node --test test/integration.test.js && node test/packaged-install.test.cjs',
|
|
63
|
+
'validate:ci': 'npm test',
|
|
64
|
+
deploy: 'npm publish --access public',
|
|
65
|
+
'deploy:staging': 'npm publish --access public --tag staging',
|
|
66
|
+
},
|
|
67
|
+
bin: { [resolveTargetCliName(manifest, target)]: 'bin/cli.cjs' },
|
|
68
|
+
files: [
|
|
69
|
+
'bin/',
|
|
70
|
+
'package.json',
|
|
71
|
+
'versions.json',
|
|
72
|
+
'README.md',
|
|
73
|
+
'AGENTS.md',
|
|
74
|
+
'extensions/',
|
|
75
|
+
'skills/',
|
|
76
|
+
'commands/',
|
|
77
|
+
'scripts/',
|
|
78
|
+
],
|
|
79
|
+
author: typeof manifest.author === 'string' ? manifest.author : manifest.author.name,
|
|
80
|
+
license: manifest.license,
|
|
81
|
+
publishConfig: { access: 'public' },
|
|
82
|
+
};
|
|
83
|
+
const ompPkgName = packageJson.name;
|
|
84
|
+
packageJson.repository = buildNpmRepository(manifest, ompPkgName);
|
|
85
|
+
packageJson.homepage = buildNpmHomepage(manifest, ompPkgName);
|
|
86
|
+
packageJson.bugs = buildNpmBugs(manifest);
|
|
87
|
+
return JSON.stringify(packageJson, null, 2) + '\n';
|
|
88
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class OpenClawAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile[];
|
|
6
|
+
}
|
|
7
|
+
type ResolvedManifest = A5cPluginManifest & {
|
|
8
|
+
npmPackageName?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function generateOpenClawPackageManifest(manifest: ResolvedManifest, targetName?: string): string;
|
|
11
|
+
export declare function generateOpenClawManifest(manifest: A5cPluginManifest): string;
|
|
12
|
+
export declare function generateOpenClawHooksJson(manifest: A5cPluginManifest, _targetProfile: TargetProfile, targetName?: string): string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=openclaw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/openclaw.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAcrD,qBAAa,eAAgB,SAAQ,wBAAwB;IAI3D,wBAAwB,CACtB,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,GAAG,IAAI;IAQzB,qBAAqB,CACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CA4BrB;AAED,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAwCF,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,UAAU,SAAa,GAAG,MAAM,CA2D3G;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAqB5E;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,aAAa,EAC7B,UAAU,SAAa,GACtB,MAAM,CA8BR"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// OpenClaw harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { slugify, applyPattern, getPattern, resolveSdkConfig, } from './hooks-utils.js';
|
|
4
|
+
import { resolveTargetCliName, resolveTargetNpmPackageName, } from '../../sdkConfig.js';
|
|
5
|
+
import { generateOpenClawNativeHooksSection } from '../../transformHelpers.js';
|
|
6
|
+
export class OpenClawAdapter extends BaseHarnessOutputAdapter {
|
|
7
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
8
|
+
const content = JSON.stringify({
|
|
9
|
+
description: `${manifest.name} plugin hooks for OpenClaw`,
|
|
10
|
+
hooks: {},
|
|
11
|
+
}, null, 2) + '\n';
|
|
12
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks.json', content };
|
|
13
|
+
}
|
|
14
|
+
generateManifestFiles(_sourceDir, manifest, targetProfile, _diagnostics) {
|
|
15
|
+
const files = [];
|
|
16
|
+
files.push({
|
|
17
|
+
path: 'package.json',
|
|
18
|
+
content: generateOpenClawPackageManifest(manifest, this.targetName),
|
|
19
|
+
});
|
|
20
|
+
files.push({
|
|
21
|
+
path: 'plugin.json',
|
|
22
|
+
content: generateOpenClawManifest(manifest),
|
|
23
|
+
});
|
|
24
|
+
const nativePluginManifest = targetProfile.requiredSurfaceFile || `${this.targetName}.plugin.json`;
|
|
25
|
+
files.push({
|
|
26
|
+
path: nativePluginManifest,
|
|
27
|
+
content: JSON.stringify({
|
|
28
|
+
name: manifest.name,
|
|
29
|
+
version: manifest.version,
|
|
30
|
+
description: manifest.description,
|
|
31
|
+
entrypoint: 'extensions/index.ts',
|
|
32
|
+
hooks: generateOpenClawNativeHooksSection(manifest, targetProfile),
|
|
33
|
+
capabilities: ['orchestration', 'process-management', 'human-in-the-loop'],
|
|
34
|
+
}, null, 2) + '\n',
|
|
35
|
+
});
|
|
36
|
+
return files;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function buildNpmRepository(manifest, npmPackageName) {
|
|
40
|
+
if (!manifest.repository)
|
|
41
|
+
return undefined;
|
|
42
|
+
let url = typeof manifest.repository === 'string'
|
|
43
|
+
? manifest.repository
|
|
44
|
+
: manifest.repository.url;
|
|
45
|
+
if (!url.startsWith('git+'))
|
|
46
|
+
url = `git+${url}`;
|
|
47
|
+
if (!url.endsWith('.git'))
|
|
48
|
+
url = `${url}.git`;
|
|
49
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
50
|
+
return { type: 'git', url, directory };
|
|
51
|
+
}
|
|
52
|
+
function buildNpmHomepage(manifest, npmPackageName) {
|
|
53
|
+
if (!manifest.repository)
|
|
54
|
+
return undefined;
|
|
55
|
+
const url = typeof manifest.repository === 'string'
|
|
56
|
+
? manifest.repository
|
|
57
|
+
: manifest.repository.url;
|
|
58
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
59
|
+
const directory = `plugins/${npmPackageName.split('/').pop()}`;
|
|
60
|
+
return `${base}/tree/main/${directory}#readme`;
|
|
61
|
+
}
|
|
62
|
+
function buildNpmBugs(manifest) {
|
|
63
|
+
if (!manifest.repository)
|
|
64
|
+
return undefined;
|
|
65
|
+
const url = typeof manifest.repository === 'string'
|
|
66
|
+
? manifest.repository
|
|
67
|
+
: manifest.repository.url;
|
|
68
|
+
const base = url.replace(/\.git$/, '').replace(/^git\+/, '');
|
|
69
|
+
return { url: `${base}/issues` };
|
|
70
|
+
}
|
|
71
|
+
export function generateOpenClawPackageManifest(manifest, targetName = 'openclaw') {
|
|
72
|
+
const target = { name: targetName };
|
|
73
|
+
const packageName = resolveTargetNpmPackageName(manifest, target);
|
|
74
|
+
const packageJson = {
|
|
75
|
+
name: packageName,
|
|
76
|
+
version: manifest.version,
|
|
77
|
+
type: 'module',
|
|
78
|
+
description: manifest.description,
|
|
79
|
+
openclaw: {
|
|
80
|
+
extensions: ['./extensions'],
|
|
81
|
+
compat: {
|
|
82
|
+
minVersion: '0.1.0',
|
|
83
|
+
},
|
|
84
|
+
build: {
|
|
85
|
+
hooks: 'extensions/index.ts',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
keywords: ['babysitter', targetName, 'orchestration', 'ai-agent', 'sdk-integration'],
|
|
89
|
+
dependencies: {
|
|
90
|
+
[resolveSdkConfig(manifest).package]: manifest.version,
|
|
91
|
+
},
|
|
92
|
+
peerDependencies: {
|
|
93
|
+
[targetName]: '*',
|
|
94
|
+
},
|
|
95
|
+
scripts: {
|
|
96
|
+
'plugin:install': 'node bin/install.cjs --global',
|
|
97
|
+
'plugin:uninstall': 'node bin/uninstall.cjs --global',
|
|
98
|
+
test: 'node --test test/integration.test.js',
|
|
99
|
+
'test:integration': 'node --test test/integration.test.js',
|
|
100
|
+
'test:packaged-install': 'node test/packaged-install.test.cjs',
|
|
101
|
+
deploy: 'npm publish --access public',
|
|
102
|
+
'deploy:staging': 'npm publish --access public --tag staging',
|
|
103
|
+
},
|
|
104
|
+
bin: { [resolveTargetCliName(manifest, target)]: 'bin/cli.cjs' },
|
|
105
|
+
files: [
|
|
106
|
+
'bin/',
|
|
107
|
+
'package.json',
|
|
108
|
+
'versions.json',
|
|
109
|
+
'plugin.json',
|
|
110
|
+
`${targetName}.plugin.json`,
|
|
111
|
+
'hooks/',
|
|
112
|
+
'hooks.json',
|
|
113
|
+
'extensions/',
|
|
114
|
+
'skills/',
|
|
115
|
+
'commands/',
|
|
116
|
+
'scripts/',
|
|
117
|
+
'README.md',
|
|
118
|
+
],
|
|
119
|
+
author: typeof manifest.author === 'string' ? manifest.author : manifest.author.name,
|
|
120
|
+
license: manifest.license,
|
|
121
|
+
publishConfig: { access: 'public' },
|
|
122
|
+
};
|
|
123
|
+
const clawPkgName = packageName;
|
|
124
|
+
packageJson.repository = buildNpmRepository(manifest, clawPkgName);
|
|
125
|
+
packageJson.homepage = buildNpmHomepage(manifest, clawPkgName);
|
|
126
|
+
packageJson.bugs = buildNpmBugs(manifest);
|
|
127
|
+
return JSON.stringify(packageJson, null, 2) + '\n';
|
|
128
|
+
}
|
|
129
|
+
export function generateOpenClawManifest(manifest) {
|
|
130
|
+
const pluginJson = {
|
|
131
|
+
name: manifest.name,
|
|
132
|
+
version: manifest.version,
|
|
133
|
+
description: manifest.description,
|
|
134
|
+
author: manifest.author,
|
|
135
|
+
license: manifest.license,
|
|
136
|
+
hooks: 'hooks.json',
|
|
137
|
+
commands: 'commands/',
|
|
138
|
+
skills: 'skills/',
|
|
139
|
+
};
|
|
140
|
+
if (manifest.repository) {
|
|
141
|
+
pluginJson.repository = manifest.repository;
|
|
142
|
+
}
|
|
143
|
+
if (manifest.keywords) {
|
|
144
|
+
pluginJson.keywords = manifest.keywords;
|
|
145
|
+
}
|
|
146
|
+
return JSON.stringify(pluginJson, null, 2) + '\n';
|
|
147
|
+
}
|
|
148
|
+
export function generateOpenClawHooksJson(manifest, _targetProfile, targetName = 'openclaw') {
|
|
149
|
+
const hooks = {};
|
|
150
|
+
const pat = getPattern(manifest, targetName);
|
|
151
|
+
const sessionStartHandler = manifest.hooks?.SessionStart;
|
|
152
|
+
if (typeof sessionStartHandler === 'string') {
|
|
153
|
+
const cmd = `./${applyPattern(pat || '{{name}}-proxied-{{native}}.sh', manifest.name, slugify('SessionStart'), 'session-start')}`;
|
|
154
|
+
hooks.SessionStart = [{ matcher: '*', hooks: [{ type: 'command', command: cmd }] }];
|
|
155
|
+
}
|
|
156
|
+
const stopHandler = manifest.hooks?.Stop;
|
|
157
|
+
if (typeof stopHandler === 'string') {
|
|
158
|
+
const cmd = `./${applyPattern(pat || '{{name}}-proxied-{{native}}.sh', manifest.name, slugify('Stop'), 'stop-hook')}`;
|
|
159
|
+
hooks.Stop = [{ matcher: '*', hooks: [{ type: 'command', command: cmd }] }];
|
|
160
|
+
}
|
|
161
|
+
return JSON.stringify({
|
|
162
|
+
description: `${manifest.name} plugin hooks for OpenClaw`,
|
|
163
|
+
hooks,
|
|
164
|
+
}, null, 2) + '\n';
|
|
165
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class OpenCodeAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile[];
|
|
6
|
+
generateExtraTargetFiles(_sourceDir: string, manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile[];
|
|
7
|
+
}
|
|
8
|
+
export declare function generateOpenCodeManifest(manifest: A5cPluginManifest, targetName?: string): string;
|
|
9
|
+
export declare function generateOpenCodeHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
10
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/opencode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAYrD,qBAAa,eAAgB,SAAQ,wBAAwB;IAI3D,wBAAwB,CACtB,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,GAAG,IAAI;IAKzB,qBAAqB,CACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;IASpB,wBAAwB,CACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CAQrB;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,UAAU,SAAa,GAAG,MAAM,CAsBrG;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CA6CR"}
|