@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 @@
|
|
|
1
|
+
{"version":3,"file":"sdkConfig.d.ts","sourceRoot":"","sources":["../src/sdkConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5E,KAAK,oBAAoB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,SAAS,CAQ7D,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAWvE;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,oBAAoB,GAClC,MAAM,CAgBR;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,oBAAoB,GAClC,MAAM,CAGR"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// SDK configuration resolver — omitted sdk config always falls back to the
|
|
2
|
+
// shared Babysitter SDK contract.
|
|
3
|
+
export const BABYSITTER_DEFAULT_SDK_CONFIG = {
|
|
4
|
+
package: '@a5c-ai/babysitter-sdk',
|
|
5
|
+
cli: 'babysitter',
|
|
6
|
+
proxyPackage: '@a5c-ai/hooks-mux-cli',
|
|
7
|
+
proxyBinary: 'a5c-hooks-mux',
|
|
8
|
+
scope: '@a5c-ai',
|
|
9
|
+
envPrefix: 'BABYSITTER',
|
|
10
|
+
stateDir: '.a5c',
|
|
11
|
+
};
|
|
12
|
+
export function resolveSdkConfig(manifest) {
|
|
13
|
+
const sdk = manifest.sdk ?? {};
|
|
14
|
+
return {
|
|
15
|
+
package: sdk.package || BABYSITTER_DEFAULT_SDK_CONFIG.package,
|
|
16
|
+
cli: sdk.cli || BABYSITTER_DEFAULT_SDK_CONFIG.cli,
|
|
17
|
+
proxyPackage: sdk.proxyPackage || BABYSITTER_DEFAULT_SDK_CONFIG.proxyPackage,
|
|
18
|
+
proxyBinary: sdk.proxyBinary || BABYSITTER_DEFAULT_SDK_CONFIG.proxyBinary,
|
|
19
|
+
scope: sdk.scope || BABYSITTER_DEFAULT_SDK_CONFIG.scope,
|
|
20
|
+
envPrefix: sdk.envPrefix || BABYSITTER_DEFAULT_SDK_CONFIG.envPrefix,
|
|
21
|
+
stateDir: sdk.stateDir || BABYSITTER_DEFAULT_SDK_CONFIG.stateDir,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function resolveTargetNpmPackageName(manifest, targetProfile) {
|
|
25
|
+
if (typeof manifest.npmPackageName === 'string' && manifest.npmPackageName.length > 0) {
|
|
26
|
+
return manifest.npmPackageName;
|
|
27
|
+
}
|
|
28
|
+
const override = manifest.targets?.[targetProfile.name]?.npmPackageName;
|
|
29
|
+
if (typeof override === 'string' && override.length > 0) {
|
|
30
|
+
return override;
|
|
31
|
+
}
|
|
32
|
+
if (typeof targetProfile.npmPackageName === 'string' && targetProfile.npmPackageName.length > 0) {
|
|
33
|
+
return targetProfile.npmPackageName;
|
|
34
|
+
}
|
|
35
|
+
const sdk = resolveSdkConfig(manifest);
|
|
36
|
+
return `${sdk.scope}/${manifest.name}-${targetProfile.name}`;
|
|
37
|
+
}
|
|
38
|
+
export function resolveTargetCliName(manifest, targetProfile) {
|
|
39
|
+
return resolveTargetNpmPackageName(manifest, targetProfile).split('/').pop()
|
|
40
|
+
|| `${manifest.name}-${targetProfile.name}`;
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import type { HarnessOutputAdapter } from './interface.js';
|
|
3
|
+
export declare class BaseHarnessOutputAdapter implements HarnessOutputAdapter {
|
|
4
|
+
readonly targetName: string;
|
|
5
|
+
constructor(targetName: string);
|
|
6
|
+
generateHookRegistration(_manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
7
|
+
generateManifestFiles(_sourceDir: string, _manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[], _rawManifest?: A5cPluginManifest): TransformedFile[];
|
|
8
|
+
generateExtraTargetFiles(_sourceDir: string, _manifest: A5cPluginManifest, _targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,wBAAyB,YAAW,oBAAoB;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,MAAM;IAI9B,wBAAwB,CACtB,SAAS,EAAE,iBAAiB,EAC5B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,GAAG,IAAI;IAIzB,qBAAqB,CACnB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,iBAAiB,EAC5B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,EAC1B,YAAY,CAAC,EAAE,iBAAiB,GAC/B,eAAe,EAAE;IAIpB,wBAAwB,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,iBAAiB,EAC5B,cAAc,EAAE,aAAa,EAC7B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CAGrB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Base adapter class with default no-op implementations
|
|
2
|
+
export class BaseHarnessOutputAdapter {
|
|
3
|
+
targetName;
|
|
4
|
+
constructor(targetName) {
|
|
5
|
+
this.targetName = targetName;
|
|
6
|
+
}
|
|
7
|
+
generateHookRegistration(_manifest, _targetProfile, _diagnostics) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
generateManifestFiles(_sourceDir, _manifest, _targetProfile, _diagnostics, _rawManifest) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
generateExtraTargetFiles(_sourceDir, _manifest, _targetProfile, _diagnostics) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class ClaudeCodeAdapter 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
|
+
export declare function generateClaudeCodeManifest(manifest: A5cPluginManifest): string;
|
|
8
|
+
export declare function generateClaudeCodeHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
9
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/claude-code.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;AASrD,qBAAa,iBAAkB,SAAQ,wBAAwB;IAI7D,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,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CAgBrB;AAQD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAuC9E;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CAqBR"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Claude Code harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { iterateHooks, slugify, resolveCmd, getPattern, resolveSdkConfig, } from './hooks-utils.js';
|
|
4
|
+
export class ClaudeCodeAdapter extends BaseHarnessOutputAdapter {
|
|
5
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
6
|
+
const content = generateClaudeCodeHooksJson(manifest, targetProfile);
|
|
7
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks/hooks.json', content };
|
|
8
|
+
}
|
|
9
|
+
generateManifestFiles(_sourceDir, manifest, targetProfile, _diagnostics) {
|
|
10
|
+
const files = [];
|
|
11
|
+
const ccManifest = generateClaudeCodeManifest(manifest);
|
|
12
|
+
files.push({ path: 'plugin.json', content: ccManifest });
|
|
13
|
+
const author = typeof manifest.author === 'string'
|
|
14
|
+
? { name: manifest.author }
|
|
15
|
+
: manifest.author;
|
|
16
|
+
const harnessManifestPath = targetProfile.harnessManifestPath || `.${this.targetName}-plugin/plugin.json`;
|
|
17
|
+
files.push({ path: harnessManifestPath, content: JSON.stringify({
|
|
18
|
+
name: manifest.name,
|
|
19
|
+
version: manifest.version,
|
|
20
|
+
description: manifest.description,
|
|
21
|
+
author,
|
|
22
|
+
}, null, 2) + '\n' });
|
|
23
|
+
return files;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function normalizeAuthorObject(manifest) {
|
|
27
|
+
return typeof manifest.author === 'string'
|
|
28
|
+
? { name: manifest.author }
|
|
29
|
+
: manifest.author;
|
|
30
|
+
}
|
|
31
|
+
export function generateClaudeCodeManifest(manifest) {
|
|
32
|
+
const author = normalizeAuthorObject(manifest);
|
|
33
|
+
const pluginJson = {
|
|
34
|
+
name: manifest.name,
|
|
35
|
+
version: manifest.version,
|
|
36
|
+
description: manifest.description,
|
|
37
|
+
author,
|
|
38
|
+
license: manifest.license,
|
|
39
|
+
};
|
|
40
|
+
if (manifest.repository) {
|
|
41
|
+
pluginJson.repository = manifest.repository;
|
|
42
|
+
}
|
|
43
|
+
if (manifest.homepage) {
|
|
44
|
+
pluginJson.homepage = manifest.homepage;
|
|
45
|
+
}
|
|
46
|
+
if (manifest.keywords) {
|
|
47
|
+
pluginJson.keywords = manifest.keywords;
|
|
48
|
+
}
|
|
49
|
+
if (manifest.hooks) {
|
|
50
|
+
const hooksObj = {};
|
|
51
|
+
for (const [canonicalHook, handlerValue] of Object.entries(manifest.hooks)) {
|
|
52
|
+
if (handlerValue) {
|
|
53
|
+
hooksObj[canonicalHook] = handlerValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
pluginJson.hooks = hooksObj;
|
|
57
|
+
}
|
|
58
|
+
pluginJson.commands = [];
|
|
59
|
+
if (manifest.skills) {
|
|
60
|
+
pluginJson.skills = manifest.skills;
|
|
61
|
+
}
|
|
62
|
+
return JSON.stringify(pluginJson, null, 2) + '\n';
|
|
63
|
+
}
|
|
64
|
+
export function generateClaudeCodeHooksJson(manifest, targetProfile) {
|
|
65
|
+
const hooks = {};
|
|
66
|
+
const rootRef = targetProfile.pluginRootEnvVar
|
|
67
|
+
? `\${${targetProfile.pluginRootEnvVar}}`
|
|
68
|
+
: '$(cd "$(dirname "$0")/.." && pwd)';
|
|
69
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
70
|
+
const sdk = resolveSdkConfig(manifest);
|
|
71
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
72
|
+
const slug = slugify(canonical);
|
|
73
|
+
const cmd = resolveCmd(handler, slug, targetProfile.adapterName, rootRef, manifest.name, native, sdk.proxyPackage, sdk.proxyBinary, pat);
|
|
74
|
+
const entry = {
|
|
75
|
+
hooks: [{ type: 'command', command: cmd }],
|
|
76
|
+
};
|
|
77
|
+
if (manifest.hookConfig?.matchers?.[canonical]) {
|
|
78
|
+
entry.matcher = manifest.hookConfig.matchers[canonical];
|
|
79
|
+
}
|
|
80
|
+
hooks[native] = [entry];
|
|
81
|
+
});
|
|
82
|
+
return JSON.stringify({ description: `${manifest.name} plugin hooks`, hooks }, null, 2) + '\n';
|
|
83
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class CodexAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[], rawManifest?: A5cPluginManifest): TransformedFile[];
|
|
6
|
+
}
|
|
7
|
+
type ResolvedManifest = A5cPluginManifest & {
|
|
8
|
+
npmPackageName?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function generateCodexManifest(manifest: ResolvedManifest, targetName?: string): string;
|
|
11
|
+
export declare function generateCodexHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/codex.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,YAAa,SAAQ,wBAAwB;IAIxD,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,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,EAC1B,WAAW,CAAC,EAAE,iBAAiB,GAC9B,eAAe,EAAE;CAUrB;AAED,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAwCF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,UAAU,SAAU,GAAG,MAAM,CAwC9F;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CAYR"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Codex 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 CodexAdapter extends BaseHarnessOutputAdapter {
|
|
7
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
8
|
+
const content = generateCodexHooksJson(manifest, targetProfile);
|
|
9
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks.json', content };
|
|
10
|
+
}
|
|
11
|
+
generateManifestFiles(_sourceDir, manifest, targetProfile, _diagnostics, rawManifest) {
|
|
12
|
+
const files = [];
|
|
13
|
+
const codexPkg = generateCodexManifest(manifest, this.targetName);
|
|
14
|
+
files.push({ path: 'package.json', content: codexPkg });
|
|
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 generateCodexManifest(manifest, targetName = 'codex') {
|
|
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
|
+
deploy: 'npm publish --access public',
|
|
67
|
+
'deploy:staging': 'npm publish --access public --tag staging',
|
|
68
|
+
},
|
|
69
|
+
bin: { [resolveTargetCliName(manifest, target)]: 'bin/cli.js' },
|
|
70
|
+
files: [
|
|
71
|
+
`.${targetName}-plugin/`,
|
|
72
|
+
'assets/',
|
|
73
|
+
'hooks/',
|
|
74
|
+
'hooks.json',
|
|
75
|
+
'skills/',
|
|
76
|
+
'.app.json',
|
|
77
|
+
'bin/',
|
|
78
|
+
'scripts/',
|
|
79
|
+
'plugin.lock.json',
|
|
80
|
+
'README.md',
|
|
81
|
+
],
|
|
82
|
+
keywords: [manifest.name, targetName, 'orchestration'],
|
|
83
|
+
author: typeof manifest.author === 'string' ? manifest.author : manifest.author.name,
|
|
84
|
+
license: manifest.license,
|
|
85
|
+
publishConfig: { access: 'public' },
|
|
86
|
+
};
|
|
87
|
+
const pkgName = resolveTargetNpmPackageName(manifest, target);
|
|
88
|
+
packageJson.repository = buildNpmRepository(manifest, pkgName);
|
|
89
|
+
packageJson.homepage = buildNpmHomepage(manifest, pkgName);
|
|
90
|
+
packageJson.bugs = buildNpmBugs(manifest);
|
|
91
|
+
return JSON.stringify(packageJson, null, 2) + '\n';
|
|
92
|
+
}
|
|
93
|
+
export function generateCodexHooksJson(manifest, targetProfile) {
|
|
94
|
+
const hooks = {};
|
|
95
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
96
|
+
const sdk = resolveSdkConfig(manifest);
|
|
97
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
98
|
+
const slug = slugify(canonical);
|
|
99
|
+
const cmd = resolveCmd(handler, slug, targetProfile.adapterName, '.codex', manifest.name, native, sdk.proxyPackage, sdk.proxyBinary, pat);
|
|
100
|
+
hooks[native] = [{ matcher: '.*', hooks: [{ type: 'command', command: cmd }] }];
|
|
101
|
+
});
|
|
102
|
+
return JSON.stringify({ hooks }, null, 2) + '\n';
|
|
103
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class CursorAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[], rawManifest?: A5cPluginManifest): TransformedFile[];
|
|
6
|
+
}
|
|
7
|
+
export declare function generateCursorManifest(manifest: A5cPluginManifest): string;
|
|
8
|
+
export declare function generateCursorHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
9
|
+
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/cursor.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;AASrD,qBAAa,aAAc,SAAQ,wBAAwB;IAIzD,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,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,EAC1B,WAAW,CAAC,EAAE,iBAAiB,GAC9B,eAAe,EAAE;CASrB;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAqB1E;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CAoBR"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Cursor harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { iterateHooks, slugify, resolveHookPath, getPattern, } from './hooks-utils.js';
|
|
4
|
+
import { generateHarnessManifest } from '../../transformHelpers.js';
|
|
5
|
+
export class CursorAdapter extends BaseHarnessOutputAdapter {
|
|
6
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
7
|
+
const content = generateCursorHooksJson(manifest, targetProfile);
|
|
8
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks.json', content };
|
|
9
|
+
}
|
|
10
|
+
generateManifestFiles(_sourceDir, manifest, targetProfile, _diagnostics, rawManifest) {
|
|
11
|
+
const files = [];
|
|
12
|
+
const cursorManifest = generateCursorManifest(manifest);
|
|
13
|
+
files.push({ path: 'plugin.json', content: cursorManifest });
|
|
14
|
+
if (targetProfile.harnessManifestPath) {
|
|
15
|
+
files.push({ path: targetProfile.harnessManifestPath, content: generateHarnessManifest(rawManifest || manifest, targetProfile) });
|
|
16
|
+
}
|
|
17
|
+
return files;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function generateCursorManifest(manifest) {
|
|
21
|
+
const pluginJson = {
|
|
22
|
+
name: manifest.name,
|
|
23
|
+
version: manifest.version,
|
|
24
|
+
description: manifest.description,
|
|
25
|
+
author: manifest.author,
|
|
26
|
+
license: manifest.license,
|
|
27
|
+
hooks: 'hooks.json',
|
|
28
|
+
commands: 'commands/',
|
|
29
|
+
skills: 'skills/',
|
|
30
|
+
};
|
|
31
|
+
if (manifest.repository) {
|
|
32
|
+
pluginJson.repository = manifest.repository;
|
|
33
|
+
}
|
|
34
|
+
if (manifest.keywords) {
|
|
35
|
+
pluginJson.keywords = manifest.keywords;
|
|
36
|
+
}
|
|
37
|
+
return JSON.stringify(pluginJson, null, 2) + '\n';
|
|
38
|
+
}
|
|
39
|
+
export function generateCursorHooksJson(manifest, targetProfile) {
|
|
40
|
+
const hooks = {};
|
|
41
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
42
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
43
|
+
const slug = slugify(canonical);
|
|
44
|
+
const p = resolveHookPath(handler, slug, manifest.name, native, pat);
|
|
45
|
+
const bashCmd = p ? `bash "./${p}"` : `echo '{}'`;
|
|
46
|
+
const psCmd = p
|
|
47
|
+
? `powershell -NoProfile -ExecutionPolicy Bypass -File "./${p.replace(/\.sh$/, '.ps1')}"`
|
|
48
|
+
: `Write-Output '{}'`;
|
|
49
|
+
const entry = { type: 'command', bash: bashCmd, powershell: psCmd, timeoutSec: 30 };
|
|
50
|
+
if (canonical === 'Stop') {
|
|
51
|
+
entry.loop_limit = null;
|
|
52
|
+
delete entry.timeoutSec;
|
|
53
|
+
}
|
|
54
|
+
hooks[native] = [entry];
|
|
55
|
+
});
|
|
56
|
+
return JSON.stringify({ version: 1, hooks }, null, 2) + '\n';
|
|
57
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class GeminiAdapter 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
|
+
export declare function generateGeminiManifest(manifest: A5cPluginManifest, commandPaths?: string[], targetName?: string): string;
|
|
8
|
+
export declare function generateGeminiHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
9
|
+
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/gemini.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;AAUrD,qBAAa,aAAc,SAAQ,wBAAwB;IAIzD,wBAAwB,CACtB,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,GAAG,IAAI;IAKzB,qBAAqB,CACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,GACzB,eAAe,EAAE;CAwBrB;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,GAAE,MAAM,EAAO,EAC3B,UAAU,SAAW,GACpB,MAAM,CAkCR;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CA0BR"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Gemini harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { iterateHooks, slugify, resolveCmd, getPattern, resolveSdkConfig, } from './hooks-utils.js';
|
|
4
|
+
import { getCommandPaths } from '../../utils.js';
|
|
5
|
+
export class GeminiAdapter extends BaseHarnessOutputAdapter {
|
|
6
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
7
|
+
const content = generateGeminiHooksJson(manifest, targetProfile);
|
|
8
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks/hooks.json', content };
|
|
9
|
+
}
|
|
10
|
+
generateManifestFiles(sourceDir, manifest, targetProfile, _diagnostics) {
|
|
11
|
+
const files = [];
|
|
12
|
+
const commandPaths = getCommandPaths(sourceDir, manifest);
|
|
13
|
+
files.push({
|
|
14
|
+
path: 'plugin.json',
|
|
15
|
+
content: generateGeminiManifest(manifest, commandPaths),
|
|
16
|
+
});
|
|
17
|
+
const extensionManifestPath = targetProfile.harnessManifestPath || 'gemini-extension.json';
|
|
18
|
+
files.push({
|
|
19
|
+
path: extensionManifestPath,
|
|
20
|
+
content: JSON.stringify({
|
|
21
|
+
name: manifest.name,
|
|
22
|
+
version: manifest.version,
|
|
23
|
+
description: manifest.description,
|
|
24
|
+
contextFileName: 'GEMINI.md',
|
|
25
|
+
settings: [],
|
|
26
|
+
}, null, 2) + '\n',
|
|
27
|
+
});
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function generateGeminiManifest(manifest, commandPaths = [], targetName = 'gemini') {
|
|
32
|
+
const pluginJson = {
|
|
33
|
+
name: manifest.name,
|
|
34
|
+
version: manifest.version,
|
|
35
|
+
description: manifest.description,
|
|
36
|
+
author: manifest.author,
|
|
37
|
+
license: manifest.license,
|
|
38
|
+
harness: 'gemini-cli',
|
|
39
|
+
hooks: {},
|
|
40
|
+
commands: commandPaths.map((cmdPath) => `commands/${cmdPath.split(/[\\/]/).pop()?.replace(/\.md$/, '.toml')}`),
|
|
41
|
+
skills: [],
|
|
42
|
+
contextFileName: 'GEMINI.md',
|
|
43
|
+
extensionManifest: 'gemini-extension.json',
|
|
44
|
+
};
|
|
45
|
+
if (manifest.hooks) {
|
|
46
|
+
const hooksObj = {};
|
|
47
|
+
for (const [canonicalHook, handlerValue] of Object.entries(manifest.hooks)) {
|
|
48
|
+
if (handlerValue) {
|
|
49
|
+
hooksObj[canonicalHook] = handlerValue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
pluginJson.hooks = hooksObj;
|
|
53
|
+
}
|
|
54
|
+
if (manifest.repository) {
|
|
55
|
+
pluginJson.repository = manifest.repository;
|
|
56
|
+
}
|
|
57
|
+
if (manifest.keywords) {
|
|
58
|
+
pluginJson.keywords = manifest.keywords;
|
|
59
|
+
}
|
|
60
|
+
return JSON.stringify(pluginJson, null, 2) + '\n';
|
|
61
|
+
}
|
|
62
|
+
export function generateGeminiHooksJson(manifest, targetProfile) {
|
|
63
|
+
const hooks = {};
|
|
64
|
+
const rootRef = targetProfile.pluginRootEnvVar
|
|
65
|
+
? `\${${targetProfile.pluginRootEnvVar}}`
|
|
66
|
+
: '${extensionPath}';
|
|
67
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
68
|
+
const sdk = resolveSdkConfig(manifest);
|
|
69
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
70
|
+
const slug = slugify(canonical);
|
|
71
|
+
const cmd = resolveCmd(handler, slug, targetProfile.adapterName, rootRef, manifest.name, native, sdk.proxyPackage, sdk.proxyBinary, pat);
|
|
72
|
+
hooks[native] = [{
|
|
73
|
+
hooks: [{
|
|
74
|
+
name: `${manifest.name}-${slug}`,
|
|
75
|
+
type: 'command',
|
|
76
|
+
command: cmd,
|
|
77
|
+
timeout: 30000,
|
|
78
|
+
description: `${manifest.name} ${canonical} hook`,
|
|
79
|
+
}],
|
|
80
|
+
}];
|
|
81
|
+
});
|
|
82
|
+
return JSON.stringify({
|
|
83
|
+
description: `${manifest.name} plugin hooks for Gemini CLI`,
|
|
84
|
+
hooks,
|
|
85
|
+
}, null, 2) + '\n';
|
|
86
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class GithubCopilotAdapter 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
|
+
export declare function generateGithubCopilotManifest(manifest: A5cPluginManifest): string;
|
|
8
|
+
export declare function generateGithubCopilotHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
9
|
+
//# sourceMappingURL=github-copilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/github-copilot.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;AAQrD,qBAAa,oBAAqB,SAAQ,wBAAwB;IAIhE,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;CAarB;AAQD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAsBjF;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CAeR"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// GitHub Copilot harness output adapter
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
import { iterateHooks, slugify, resolveHookPath, getPattern, } from './hooks-utils.js';
|
|
4
|
+
export class GithubCopilotAdapter extends BaseHarnessOutputAdapter {
|
|
5
|
+
generateHookRegistration(manifest, targetProfile, _diagnostics) {
|
|
6
|
+
const content = generateGithubCopilotHooksJson(manifest, targetProfile);
|
|
7
|
+
return { path: targetProfile.hookRegistrationOutputPath || 'hooks.json', content };
|
|
8
|
+
}
|
|
9
|
+
generateManifestFiles(_sourceDir, manifest, _targetProfile, _diagnostics) {
|
|
10
|
+
const files = [];
|
|
11
|
+
const copilotManifest = generateGithubCopilotManifest(manifest);
|
|
12
|
+
files.push({
|
|
13
|
+
path: 'plugin.json',
|
|
14
|
+
content: copilotManifest,
|
|
15
|
+
});
|
|
16
|
+
files.push({
|
|
17
|
+
path: '.github/plugin.json',
|
|
18
|
+
content: copilotManifest,
|
|
19
|
+
});
|
|
20
|
+
return files;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function normalizeAuthorObject(manifest) {
|
|
24
|
+
return typeof manifest.author === 'string'
|
|
25
|
+
? { name: manifest.author }
|
|
26
|
+
: manifest.author;
|
|
27
|
+
}
|
|
28
|
+
export function generateGithubCopilotManifest(manifest) {
|
|
29
|
+
const pluginJson = {
|
|
30
|
+
name: manifest.name,
|
|
31
|
+
version: manifest.version,
|
|
32
|
+
description: manifest.description,
|
|
33
|
+
author: normalizeAuthorObject(manifest),
|
|
34
|
+
license: manifest.license,
|
|
35
|
+
skills: 'skills/',
|
|
36
|
+
hooks: 'hooks.json',
|
|
37
|
+
commands: 'commands/',
|
|
38
|
+
agents: 'AGENTS.md',
|
|
39
|
+
};
|
|
40
|
+
if (manifest.repository) {
|
|
41
|
+
pluginJson.repository = manifest.repository;
|
|
42
|
+
}
|
|
43
|
+
if (manifest.keywords) {
|
|
44
|
+
pluginJson.keywords = manifest.keywords;
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify(pluginJson, null, 2) + '\n';
|
|
47
|
+
}
|
|
48
|
+
export function generateGithubCopilotHooksJson(manifest, targetProfile) {
|
|
49
|
+
const hooks = {};
|
|
50
|
+
const pat = getPattern(manifest, targetProfile.name);
|
|
51
|
+
iterateHooks(manifest, targetProfile, (canonical, native, handler) => {
|
|
52
|
+
const slug = slugify(canonical);
|
|
53
|
+
const p = resolveHookPath(handler, slug, manifest.name, native, pat);
|
|
54
|
+
const bashCmd = p ? `./${p}` : `echo '{}'`;
|
|
55
|
+
const psCmd = p ? `./${p.replace(/\.sh$/, '.ps1')}` : `Write-Output '{}'`;
|
|
56
|
+
const timeout = canonical === 'UserPromptSubmit' ? 15 : 30;
|
|
57
|
+
const hookName = native === 'SessionStart' ? 'sessionStart' : native === 'SessionEnd' ? 'sessionEnd' : native;
|
|
58
|
+
hooks[hookName] = [{ type: 'command', bash: bashCmd, powershell: psCmd, timeoutSec: timeout }];
|
|
59
|
+
});
|
|
60
|
+
return JSON.stringify({ version: 1, hooks }, null, 2) + '\n';
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { A5cPluginManifest, TargetProfile, TransformedFile, Diagnostic } from '../../types.js';
|
|
2
|
+
import { BaseHarnessOutputAdapter } from './base.js';
|
|
3
|
+
export declare class HermesAdapter extends BaseHarnessOutputAdapter {
|
|
4
|
+
generateHookRegistration(manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[]): TransformedFile | null;
|
|
5
|
+
generateManifestFiles(_sourceDir: string, manifest: A5cPluginManifest, targetProfile: TargetProfile, _diagnostics: Diagnostic[], rawManifest?: A5cPluginManifest): TransformedFile[];
|
|
6
|
+
}
|
|
7
|
+
type ResolvedManifest = A5cPluginManifest & {
|
|
8
|
+
npmPackageName?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function generateHermesManifest(manifest: ResolvedManifest, targetName?: string): string;
|
|
11
|
+
export declare function generateHermesHooksJson(manifest: A5cPluginManifest, targetProfile: TargetProfile): string;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=hermes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../../src/targets/adapters/hermes.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,aAAc,SAAQ,wBAAwB;IAIzD,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,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,UAAU,EAAE,EAC1B,WAAW,CAAC,EAAE,iBAAiB,GAC9B,eAAe,EAAE;CAUrB;AAED,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAwCF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,UAAU,SAAW,GAAG,MAAM,CAiChG;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,aAAa,GAC3B,MAAM,CAYR"}
|