agent-config-detect 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/cjs/errors.js +105 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +89 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/platform/Platform.js +13 -0
- package/dist/cjs/platform/Platform.js.map +1 -0
- package/dist/cjs/platform/TestPlatform.js +65 -0
- package/dist/cjs/platform/TestPlatform.js.map +1 -0
- package/dist/cjs/platform/index.js +118 -0
- package/dist/cjs/platform/index.js.map +1 -0
- package/dist/cjs/platform/internal/common.js +40 -0
- package/dist/cjs/platform/internal/common.js.map +1 -0
- package/dist/cjs/platform/internal/darwin.js +40 -0
- package/dist/cjs/platform/internal/darwin.js.map +1 -0
- package/dist/cjs/platform/internal/linux.js +69 -0
- package/dist/cjs/platform/internal/linux.js.map +1 -0
- package/dist/cjs/platform/internal/testUtils.js +79 -0
- package/dist/cjs/platform/internal/testUtils.js.map +1 -0
- package/dist/cjs/platform/internal/windows.js +61 -0
- package/dist/cjs/platform/internal/windows.js.map +1 -0
- package/dist/cjs/types/ConfigResource.js +44 -0
- package/dist/cjs/types/ConfigResource.js.map +1 -0
- package/dist/cjs/types/DirectoryResource.js +42 -0
- package/dist/cjs/types/DirectoryResource.js.map +1 -0
- package/dist/cjs/types/DirectoryStructure.js +56 -0
- package/dist/cjs/types/DirectoryStructure.js.map +1 -0
- package/dist/cjs/types/EnvValue.js +199 -0
- package/dist/cjs/types/EnvValue.js.map +1 -0
- package/dist/cjs/types/FileFormat.js +25 -0
- package/dist/cjs/types/FileFormat.js.map +1 -0
- package/dist/cjs/types/HarnessKind.js +130 -0
- package/dist/cjs/types/HarnessKind.js.map +1 -0
- package/dist/cjs/types/InstallationStatus.js +119 -0
- package/dist/cjs/types/InstallationStatus.js.map +1 -0
- package/dist/cjs/types/PathType.js +25 -0
- package/dist/cjs/types/PathType.js.map +1 -0
- package/dist/cjs/types/ResourceKind.js +26 -0
- package/dist/cjs/types/ResourceKind.js.map +1 -0
- package/dist/cjs/types/Scope.js +59 -0
- package/dist/cjs/types/Scope.js.map +1 -0
- package/dist/cjs/types/index.js +116 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/dts/errors.d.ts +125 -0
- package/dist/dts/errors.d.ts.map +1 -0
- package/dist/dts/index.d.ts +11 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/platform/Platform.d.ts +61 -0
- package/dist/dts/platform/Platform.d.ts.map +1 -0
- package/dist/dts/platform/TestPlatform.d.ts +52 -0
- package/dist/dts/platform/TestPlatform.d.ts.map +1 -0
- package/dist/dts/platform/index.d.ts +20 -0
- package/dist/dts/platform/index.d.ts.map +1 -0
- package/dist/dts/platform/internal/common.d.ts +20 -0
- package/dist/dts/platform/internal/common.d.ts.map +1 -0
- package/dist/dts/platform/internal/darwin.d.ts +33 -0
- package/dist/dts/platform/internal/darwin.d.ts.map +1 -0
- package/dist/dts/platform/internal/linux.d.ts +29 -0
- package/dist/dts/platform/internal/linux.d.ts.map +1 -0
- package/dist/dts/platform/internal/testUtils.d.ts +32 -0
- package/dist/dts/platform/internal/testUtils.d.ts.map +1 -0
- package/dist/dts/platform/internal/windows.d.ts +38 -0
- package/dist/dts/platform/internal/windows.d.ts.map +1 -0
- package/dist/dts/types/ConfigResource.d.ts +34 -0
- package/dist/dts/types/ConfigResource.d.ts.map +1 -0
- package/dist/dts/types/DirectoryResource.d.ts +33 -0
- package/dist/dts/types/DirectoryResource.d.ts.map +1 -0
- package/dist/dts/types/DirectoryStructure.d.ts +61 -0
- package/dist/dts/types/DirectoryStructure.d.ts.map +1 -0
- package/dist/dts/types/EnvValue.d.ts +102 -0
- package/dist/dts/types/EnvValue.d.ts.map +1 -0
- package/dist/dts/types/FileFormat.d.ts +22 -0
- package/dist/dts/types/FileFormat.d.ts.map +1 -0
- package/dist/dts/types/HarnessKind.d.ts +45 -0
- package/dist/dts/types/HarnessKind.d.ts.map +1 -0
- package/dist/dts/types/InstallationStatus.d.ts +89 -0
- package/dist/dts/types/InstallationStatus.d.ts.map +1 -0
- package/dist/dts/types/PathType.d.ts +22 -0
- package/dist/dts/types/PathType.d.ts.map +1 -0
- package/dist/dts/types/ResourceKind.d.ts +23 -0
- package/dist/dts/types/ResourceKind.d.ts.map +1 -0
- package/dist/dts/types/Scope.d.ts +59 -0
- package/dist/dts/types/Scope.d.ts.map +1 -0
- package/dist/dts/types/index.d.ts +16 -0
- package/dist/dts/types/index.d.ts.map +1 -0
- package/dist/esm/errors.js +87 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/platform/Platform.js +6 -0
- package/dist/esm/platform/Platform.js.map +1 -0
- package/dist/esm/platform/TestPlatform.js +54 -0
- package/dist/esm/platform/TestPlatform.js.map +1 -0
- package/dist/esm/platform/index.js +68 -0
- package/dist/esm/platform/index.js.map +1 -0
- package/dist/esm/platform/internal/common.js +30 -0
- package/dist/esm/platform/internal/common.js.map +1 -0
- package/dist/esm/platform/internal/darwin.js +33 -0
- package/dist/esm/platform/internal/darwin.js.map +1 -0
- package/dist/esm/platform/internal/linux.js +62 -0
- package/dist/esm/platform/internal/linux.js.map +1 -0
- package/dist/esm/platform/internal/testUtils.js +70 -0
- package/dist/esm/platform/internal/testUtils.js.map +1 -0
- package/dist/esm/platform/internal/windows.js +54 -0
- package/dist/esm/platform/internal/windows.js.map +1 -0
- package/dist/esm/types/ConfigResource.js +36 -0
- package/dist/esm/types/ConfigResource.js.map +1 -0
- package/dist/esm/types/DirectoryResource.js +34 -0
- package/dist/esm/types/DirectoryResource.js.map +1 -0
- package/dist/esm/types/DirectoryStructure.js +45 -0
- package/dist/esm/types/DirectoryStructure.js.map +1 -0
- package/dist/esm/types/EnvValue.js +182 -0
- package/dist/esm/types/EnvValue.js.map +1 -0
- package/dist/esm/types/FileFormat.js +18 -0
- package/dist/esm/types/FileFormat.js.map +1 -0
- package/dist/esm/types/HarnessKind.js +120 -0
- package/dist/esm/types/HarnessKind.js.map +1 -0
- package/dist/esm/types/InstallationStatus.js +101 -0
- package/dist/esm/types/InstallationStatus.js.map +1 -0
- package/dist/esm/types/PathType.js +18 -0
- package/dist/esm/types/PathType.js.map +1 -0
- package/dist/esm/types/ResourceKind.js +19 -0
- package/dist/esm/types/ResourceKind.js.map +1 -0
- package/dist/esm/types/Scope.js +46 -0
- package/dist/esm/types/Scope.js.map +1 -0
- package/dist/esm/types/index.js +17 -0
- package/dist/esm/types/index.js.map +1 -0
- package/errors/package.json +6 -0
- package/package.json +135 -0
- package/platform/Platform/package.json +6 -0
- package/platform/TestPlatform/package.json +6 -0
- package/src/errors.ts +135 -0
- package/src/index.ts +27 -0
- package/src/platform/Platform.ts +64 -0
- package/src/platform/TestPlatform.ts +93 -0
- package/src/platform/index.ts +72 -0
- package/src/platform/internal/common.ts +30 -0
- package/src/platform/internal/darwin.ts +43 -0
- package/src/platform/internal/linux.ts +66 -0
- package/src/platform/internal/testUtils.ts +82 -0
- package/src/platform/internal/windows.ts +58 -0
- package/src/types/ConfigResource.ts +48 -0
- package/src/types/DirectoryResource.ts +45 -0
- package/src/types/DirectoryStructure.ts +64 -0
- package/src/types/EnvValue.ts +189 -0
- package/src/types/FileFormat.ts +36 -0
- package/src/types/HarnessKind.ts +150 -0
- package/src/types/InstallationStatus.ts +119 -0
- package/src/types/PathType.ts +24 -0
- package/src/types/ResourceKind.ts +27 -0
- package/src/types/Scope.ts +57 -0
- package/src/types/index.ts +17 -0
- package/types/ConfigResource/package.json +6 -0
- package/types/DirectoryResource/package.json +6 -0
- package/types/DirectoryStructure/package.json +6 -0
- package/types/EnvValue/package.json +6 -0
- package/types/FileFormat/package.json +6 -0
- package/types/HarnessKind/package.json +6 -0
- package/types/InstallationStatus/package.json +6 -0
- package/types/PathType/package.json +6 -0
- package/types/ResourceKind/package.json +6 -0
- package/types/Scope/package.json +6 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withoutEnv = exports.withEnv = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
/**
|
|
9
|
+
* Test utilities for platform testing.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Runs an effect with mocked environment variables.
|
|
16
|
+
*
|
|
17
|
+
* The original environment is restored after the effect completes,
|
|
18
|
+
* regardless of success or failure.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const result = await Effect.runPromise(
|
|
23
|
+
* withEnv({ XDG_CONFIG_HOME: "/custom/config" }, myEffect)
|
|
24
|
+
* )
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
const withEnv = (vars, effect) => {
|
|
28
|
+
const states = [];
|
|
29
|
+
return _effect.Effect.acquireUseRelease(
|
|
30
|
+
// Acquire: save original values and set new ones
|
|
31
|
+
_effect.Effect.sync(() => {
|
|
32
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
33
|
+
states.push({
|
|
34
|
+
key,
|
|
35
|
+
originalValue: process.env[key]
|
|
36
|
+
});
|
|
37
|
+
if (value === undefined) {
|
|
38
|
+
delete process.env[key];
|
|
39
|
+
} else {
|
|
40
|
+
process.env[key] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
// Use: run the effect
|
|
45
|
+
() => effect,
|
|
46
|
+
// Release: restore original values
|
|
47
|
+
() => _effect.Effect.sync(() => {
|
|
48
|
+
for (const {
|
|
49
|
+
key,
|
|
50
|
+
originalValue
|
|
51
|
+
} of states) {
|
|
52
|
+
if (originalValue === undefined) {
|
|
53
|
+
delete process.env[key];
|
|
54
|
+
} else {
|
|
55
|
+
process.env[key] = originalValue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Removes environment variables for the duration of an effect.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const result = await Effect.runPromise(
|
|
66
|
+
* withoutEnv(["XDG_CONFIG_HOME", "XDG_DATA_HOME"], myEffect)
|
|
67
|
+
* )
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
exports.withEnv = withEnv;
|
|
71
|
+
const withoutEnv = (keys, effect) => {
|
|
72
|
+
const vars = {};
|
|
73
|
+
for (const key of keys) {
|
|
74
|
+
vars[key] = undefined;
|
|
75
|
+
}
|
|
76
|
+
return withEnv(vars, effect);
|
|
77
|
+
};
|
|
78
|
+
exports.withoutEnv = withoutEnv;
|
|
79
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","names":["_effect","require","withEnv","vars","effect","states","Effect","acquireUseRelease","sync","key","value","Object","entries","push","originalValue","process","env","undefined","exports","withoutEnv","keys"],"sources":["../../../../src/platform/internal/testUtils.ts"],"sourcesContent":[null],"mappings":";;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AALA;;;;;;AAeA;;;;;;;;;;;;;AAaO,MAAMC,OAAO,GAAGA,CACrBC,IAAwC,EACxCC,MAA8B,KACJ;EAC1B,MAAMC,MAAM,GAAoB,EAAE;EAElC,OAAOC,cAAM,CAACC,iBAAiB;EAC7B;EACAD,cAAM,CAACE,IAAI,CAAC,MAAK;IACf,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,IAAI,CAAC,EAAE;MAC/CE,MAAM,CAACQ,IAAI,CAAC;QAAEJ,GAAG;QAAEK,aAAa,EAAEC,OAAO,CAACC,GAAG,CAACP,GAAG;MAAC,CAAE,CAAC;MACrD,IAAIC,KAAK,KAAKO,SAAS,EAAE;QACvB,OAAOF,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC;MACzB,CAAC,MAAM;QACLM,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC,GAAGC,KAAK;MAC1B;IACF;EACF,CAAC,CAAC;EACF;EACA,MAAMN,MAAM;EACZ;EACA,MACEE,cAAM,CAACE,IAAI,CAAC,MAAK;IACf,KAAK,MAAM;MAAEC,GAAG;MAAEK;IAAa,CAAE,IAAIT,MAAM,EAAE;MAC3C,IAAIS,aAAa,KAAKG,SAAS,EAAE;QAC/B,OAAOF,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC;MACzB,CAAC,MAAM;QACLM,OAAO,CAACC,GAAG,CAACP,GAAG,CAAC,GAAGK,aAAa;MAClC;IACF;EACF,CAAC,CAAC,CACL;AACH,CAAC;AAED;;;;;;;;;;AAAAI,OAAA,CAAAhB,OAAA,GAAAA,OAAA;AAUO,MAAMiB,UAAU,GAAGA,CACxBC,IAA2B,EAC3BhB,MAA8B,KACJ;EAC1B,MAAMD,IAAI,GAA8B,EAAE;EAC1C,KAAK,MAAMM,GAAG,IAAIW,IAAI,EAAE;IACtBjB,IAAI,CAACM,GAAG,CAAC,GAAGQ,SAAS;EACvB;EACA,OAAOf,OAAO,CAACC,IAAI,EAAEC,MAAM,CAAC;AAC9B,CAAC;AAAAc,OAAA,CAAAC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.roamingAppDataDir = exports.localAppDataDir = exports.dataDir = exports.configDir = exports.cacheDir = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
var _errors = require("../../errors.js");
|
|
9
|
+
/**
|
|
10
|
+
* Windows-specific path resolution.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns the user's config directory on Windows.
|
|
17
|
+
*
|
|
18
|
+
* Returns `%APPDATA%` which is typically `C:\Users\<user>\AppData\Roaming`.
|
|
19
|
+
*/
|
|
20
|
+
const configDir = exports.configDir = /*#__PURE__*/_effect.Effect.suspend(() => {
|
|
21
|
+
const appdata = process.env.APPDATA;
|
|
22
|
+
if (!appdata) {
|
|
23
|
+
return _effect.Effect.fail(new _errors.EnvVarError({
|
|
24
|
+
cause: new Error("APPDATA environment variable not set")
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
return _effect.Effect.succeed(appdata);
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Returns the user's data directory on Windows.
|
|
31
|
+
*
|
|
32
|
+
* Returns `%LOCALAPPDATA%` which is typically `C:\Users\<user>\AppData\Local`.
|
|
33
|
+
*/
|
|
34
|
+
const dataDir = exports.dataDir = /*#__PURE__*/_effect.Effect.suspend(() => {
|
|
35
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
36
|
+
if (!localAppData) {
|
|
37
|
+
return _effect.Effect.fail(new _errors.EnvVarError({
|
|
38
|
+
cause: new Error("LOCALAPPDATA environment variable not set")
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
return _effect.Effect.succeed(localAppData);
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Returns the roaming app data directory on Windows.
|
|
45
|
+
*
|
|
46
|
+
* This is `%APPDATA%`, used for settings that should roam with the user.
|
|
47
|
+
*/
|
|
48
|
+
const roamingAppDataDir = exports.roamingAppDataDir = configDir;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the local app data directory on Windows.
|
|
51
|
+
*
|
|
52
|
+
* This is `%LOCALAPPDATA%`, used for data that should stay on the local machine.
|
|
53
|
+
*/
|
|
54
|
+
const localAppDataDir = exports.localAppDataDir = dataDir;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the cache directory on Windows.
|
|
57
|
+
*
|
|
58
|
+
* On Windows, we use the local app data directory.
|
|
59
|
+
*/
|
|
60
|
+
const cacheDir = exports.cacheDir = dataDir;
|
|
61
|
+
//# sourceMappingURL=windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows.js","names":["_effect","require","_errors","configDir","exports","Effect","suspend","appdata","process","env","APPDATA","fail","EnvVarError","cause","Error","succeed","dataDir","localAppData","LOCALAPPDATA","roamingAppDataDir","localAppDataDir","cacheDir"],"sources":["../../../../src/platform/internal/windows.ts"],"sourcesContent":[null],"mappings":";;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AANA;;;;;;AAQA;;;;;AAKO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,gBAAyCE,cAAM,CAACC,OAAO,CAAC,MAAK;EACjF,MAAMC,OAAO,GAAGC,OAAO,CAACC,GAAG,CAACC,OAAO;EACnC,IAAI,CAACH,OAAO,EAAE;IACZ,OAAOF,cAAM,CAACM,IAAI,CAChB,IAAIC,mBAAW,CAAC;MAAEC,KAAK,EAAE,IAAIC,KAAK,CAAC,sCAAsC;IAAC,CAAE,CAAC,CAC9E;EACH;EACA,OAAOT,cAAM,CAACU,OAAO,CAACR,OAAO,CAAC;AAChC,CAAC,CAAC;AAEF;;;;;AAKO,MAAMS,OAAO,GAAAZ,OAAA,CAAAY,OAAA,gBAAyCX,cAAM,CAACC,OAAO,CAAC,MAAK;EAC/E,MAAMW,YAAY,GAAGT,OAAO,CAACC,GAAG,CAACS,YAAY;EAC7C,IAAI,CAACD,YAAY,EAAE;IACjB,OAAOZ,cAAM,CAACM,IAAI,CAChB,IAAIC,mBAAW,CAAC;MAAEC,KAAK,EAAE,IAAIC,KAAK,CAAC,2CAA2C;IAAC,CAAE,CAAC,CACnF;EACH;EACA,OAAOT,cAAM,CAACU,OAAO,CAACE,YAAY,CAAC;AACrC,CAAC,CAAC;AAEF;;;;;AAKO,MAAME,iBAAiB,GAAAf,OAAA,CAAAe,iBAAA,GAAyChB,SAAS;AAEhF;;;;;AAKO,MAAMiB,eAAe,GAAAhB,OAAA,CAAAgB,eAAA,GAAyCJ,OAAO;AAE5E;;;;;AAKO,MAAMK,QAAQ,GAAAjB,OAAA,CAAAiB,QAAA,GAAyCL,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.makeConfigResource = exports.ConfigResource = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
var _FileFormat = require("./FileFormat.js");
|
|
9
|
+
/**
|
|
10
|
+
* A configuration file resource location.
|
|
11
|
+
*
|
|
12
|
+
* Represents a single configuration file that may contain
|
|
13
|
+
* multiple configuration entries, accessed via a key path.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Config resource schema.
|
|
20
|
+
*/
|
|
21
|
+
const ConfigResource = exports.ConfigResource = /*#__PURE__*/_effect.Schema.Struct({
|
|
22
|
+
/** Path to the configuration file. */
|
|
23
|
+
file: _effect.Schema.String,
|
|
24
|
+
/** Whether the file currently exists on the filesystem. */
|
|
25
|
+
fileExists: _effect.Schema.Boolean,
|
|
26
|
+
/** JSON pointer path to the relevant section (e.g., `"/mcpServers"`). */
|
|
27
|
+
keyPath: _effect.Schema.String,
|
|
28
|
+
/** Format of the configuration file. */
|
|
29
|
+
format: _FileFormat.FileFormat,
|
|
30
|
+
/** Optional JSON Schema URL for validation. */
|
|
31
|
+
schemaUrl: /*#__PURE__*/_effect.Schema.OptionFromNullOr(_effect.Schema.String)
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Creates a config resource.
|
|
35
|
+
*/
|
|
36
|
+
const makeConfigResource = (file, fileExists, keyPath, format, schemaUrl) => ({
|
|
37
|
+
file,
|
|
38
|
+
fileExists,
|
|
39
|
+
keyPath,
|
|
40
|
+
format,
|
|
41
|
+
schemaUrl: schemaUrl !== undefined ? _effect.Option.some(schemaUrl) : _effect.Option.none()
|
|
42
|
+
});
|
|
43
|
+
exports.makeConfigResource = makeConfigResource;
|
|
44
|
+
//# sourceMappingURL=ConfigResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigResource.js","names":["_effect","require","_FileFormat","ConfigResource","exports","Schema","Struct","file","String","fileExists","Boolean","keyPath","format","FileFormat","schemaUrl","OptionFromNullOr","makeConfigResource","undefined","Option","some","none"],"sources":["../../../src/types/ConfigResource.ts"],"sourcesContent":[null],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AATA;;;;;;;;;AAWA;;;AAGO,MAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,gBAAGE,cAAM,CAACC,MAAM,CAAC;EAC1C;EACAC,IAAI,EAAEF,cAAM,CAACG,MAAM;EACnB;EACAC,UAAU,EAAEJ,cAAM,CAACK,OAAO;EAC1B;EACAC,OAAO,EAAEN,cAAM,CAACG,MAAM;EACtB;EACAI,MAAM,EAAEC,sBAAU;EAClB;EACAC,SAAS,eAAET,cAAM,CAACU,gBAAgB,CAACV,cAAM,CAACG,MAAM;CACjD,CAAC;AAOF;;;AAGO,MAAMQ,kBAAkB,GAAGA,CAChCT,IAAY,EACZE,UAAmB,EACnBE,OAAe,EACfC,MAAsB,EACtBE,SAAkB,MACE;EACpBP,IAAI;EACJE,UAAU;EACVE,OAAO;EACPC,MAAM;EACNE,SAAS,EAAEA,SAAS,KAAKG,SAAS,GAAGC,cAAM,CAACC,IAAI,CAACL,SAAS,CAAC,GAAGI,cAAM,CAACE,IAAI;CAC1E,CAAC;AAAAhB,OAAA,CAAAY,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.makeDirectoryResource = exports.DirectoryResource = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
var _DirectoryStructure = require("./DirectoryStructure.js");
|
|
9
|
+
var _FileFormat = require("./FileFormat.js");
|
|
10
|
+
/**
|
|
11
|
+
* A directory-based resource location.
|
|
12
|
+
*
|
|
13
|
+
* Represents a directory that contains multiple resource files,
|
|
14
|
+
* such as commands or skills directories.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Directory resource schema.
|
|
21
|
+
*/
|
|
22
|
+
const DirectoryResource = exports.DirectoryResource = /*#__PURE__*/_effect.Schema.Struct({
|
|
23
|
+
/** Path to the directory. */
|
|
24
|
+
path: _effect.Schema.String,
|
|
25
|
+
/** Whether the directory currently exists on the filesystem. */
|
|
26
|
+
exists: _effect.Schema.Boolean,
|
|
27
|
+
/** How resources are organized within the directory. */
|
|
28
|
+
structure: _DirectoryStructure.DirectoryStructure,
|
|
29
|
+
/** Format of files within the directory. */
|
|
30
|
+
fileFormat: _FileFormat.FileFormat
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Creates a directory resource.
|
|
34
|
+
*/
|
|
35
|
+
const makeDirectoryResource = (path, exists, structure, fileFormat) => ({
|
|
36
|
+
path,
|
|
37
|
+
exists,
|
|
38
|
+
structure,
|
|
39
|
+
fileFormat
|
|
40
|
+
});
|
|
41
|
+
exports.makeDirectoryResource = makeDirectoryResource;
|
|
42
|
+
//# sourceMappingURL=DirectoryResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectoryResource.js","names":["_effect","require","_DirectoryStructure","_FileFormat","DirectoryResource","exports","Schema","Struct","path","String","exists","Boolean","structure","DirectoryStructure","fileFormat","FileFormat","makeDirectoryResource"],"sources":["../../../src/types/DirectoryResource.ts"],"sourcesContent":[null],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAVA;;;;;;;;;AAYA;;;AAGO,MAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,gBAAGE,cAAM,CAACC,MAAM,CAAC;EAC7C;EACAC,IAAI,EAAEF,cAAM,CAACG,MAAM;EACnB;EACAC,MAAM,EAAEJ,cAAM,CAACK,OAAO;EACtB;EACAC,SAAS,EAAEC,sCAAkB;EAC7B;EACAC,UAAU,EAAEC;CACb,CAAC;AAOF;;;AAGO,MAAMC,qBAAqB,GAAGA,CACnCR,IAAY,EACZE,MAAe,EACfE,SAAiC,EACjCE,UAA0B,MACH;EACvBN,IAAI;EACJE,MAAM;EACNE,SAAS;EACTE;CACD,CAAC;AAAAT,OAAA,CAAAW,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nested = exports.flat = exports.Nested = exports.Flat = exports.DirectoryStructure = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
/**
|
|
9
|
+
* Directory layout structure for resource directories.
|
|
10
|
+
*
|
|
11
|
+
* Harnesses organize their resources in different ways:
|
|
12
|
+
* - Flat: Files directly in the directory (e.g., `commands/foo.md`)
|
|
13
|
+
* - Nested: Subdirectory per resource (e.g., `skills/foo/SKILL.md`)
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Files directly in the directory.
|
|
20
|
+
*
|
|
21
|
+
* Example: `commands/foo.md`, `commands/bar.md`
|
|
22
|
+
*/
|
|
23
|
+
class Flat extends /*#__PURE__*/_effect.Data.TaggedClass("Flat") {}
|
|
24
|
+
/**
|
|
25
|
+
* Subdirectory per resource with a fixed filename inside.
|
|
26
|
+
*
|
|
27
|
+
* Example: `skills/foo/SKILL.md`, `skills/bar/SKILL.md`
|
|
28
|
+
*/
|
|
29
|
+
exports.Flat = Flat;
|
|
30
|
+
class Nested extends /*#__PURE__*/_effect.Data.TaggedClass("Nested") {}
|
|
31
|
+
/**
|
|
32
|
+
* Directory structure schema for serialization.
|
|
33
|
+
*/
|
|
34
|
+
exports.Nested = Nested;
|
|
35
|
+
const DirectoryStructure = exports.DirectoryStructure = /*#__PURE__*/_effect.Schema.Union(/*#__PURE__*/_effect.Schema.TaggedStruct("Flat", {
|
|
36
|
+
filePattern: _effect.Schema.String
|
|
37
|
+
}), /*#__PURE__*/_effect.Schema.TaggedStruct("Nested", {
|
|
38
|
+
subdirPattern: _effect.Schema.String,
|
|
39
|
+
fileName: _effect.Schema.String
|
|
40
|
+
}));
|
|
41
|
+
/**
|
|
42
|
+
* Creates a flat directory structure.
|
|
43
|
+
*/
|
|
44
|
+
const flat = filePattern => new Flat({
|
|
45
|
+
filePattern
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Creates a nested directory structure.
|
|
49
|
+
*/
|
|
50
|
+
exports.flat = flat;
|
|
51
|
+
const nested = (subdirPattern, fileName) => new Nested({
|
|
52
|
+
subdirPattern,
|
|
53
|
+
fileName
|
|
54
|
+
});
|
|
55
|
+
exports.nested = nested;
|
|
56
|
+
//# sourceMappingURL=DirectoryStructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectoryStructure.js","names":["_effect","require","Flat","Data","TaggedClass","exports","Nested","DirectoryStructure","Schema","Union","TaggedStruct","filePattern","String","subdirPattern","fileName","flat","nested"],"sources":["../../../src/types/DirectoryStructure.ts"],"sourcesContent":[null],"mappings":";;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AATA;;;;;;;;;;AAWA;;;;;AAKM,MAAOC,IAAK,sBAAQC,YAAI,CAACC,WAAW,CAAC,MAAM,CAG/C;AAEF;;;;;AAAAC,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAKM,MAAOI,MAAO,sBAAQH,YAAI,CAACC,WAAW,CAAC,QAAQ,CAUnD;AAOF;;;AAAAC,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAGO,MAAMC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,gBAAsCC,cAAM,CAACC,KAAK,cAC/ED,cAAM,CAACE,YAAY,CAAC,MAAM,EAAE;EAAEC,WAAW,EAAEH,cAAM,CAACI;AAAM,CAAE,CAAC,eAC3DJ,cAAM,CAACE,YAAY,CAAC,QAAQ,EAAE;EAC5BG,aAAa,EAAEL,cAAM,CAACI,MAAM;EAC5BE,QAAQ,EAAEN,cAAM,CAACI;CAClB,CAAC,CACkC;AAEtC;;;AAGO,MAAMG,IAAI,GAAIJ,WAAmB,IAAyB,IAAIT,IAAI,CAAC;EAAES;AAAW,CAAE,CAAC;AAE1F;;;AAAAN,OAAA,CAAAU,IAAA,GAAAA,IAAA;AAGO,MAAMC,MAAM,GAAGA,CAACH,aAAqB,EAAEC,QAAgB,KAC5D,IAAIR,MAAM,CAAC;EAAEO,aAAa;EAAEC;AAAQ,CAAE,CAAC;AAAAT,OAAA,CAAAW,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tryToNative = exports.toNative = exports.resolve = exports.plain = exports.isPlain = exports.isEnvRef = exports.fromNative = exports.env = exports.Plain = exports.EnvValue = exports.EnvRef = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
var _errors = require("../errors.js");
|
|
9
|
+
/**
|
|
10
|
+
* A value that may be a plain string or a reference to an environment variable.
|
|
11
|
+
*
|
|
12
|
+
* This type handles the different syntax each harness uses for environment
|
|
13
|
+
* variable references:
|
|
14
|
+
* - Claude Code: `${VAR}`
|
|
15
|
+
* - OpenCode: `{env:VAR}`
|
|
16
|
+
* - Goose: Uses `env_keys` array, values resolved at runtime
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A plain string value.
|
|
23
|
+
*/
|
|
24
|
+
class Plain extends /*#__PURE__*/_effect.Data.TaggedClass("Plain") {}
|
|
25
|
+
/**
|
|
26
|
+
* A reference to an environment variable.
|
|
27
|
+
*/
|
|
28
|
+
exports.Plain = Plain;
|
|
29
|
+
class EnvRef extends /*#__PURE__*/_effect.Data.TaggedClass("EnvRef") {}
|
|
30
|
+
/**
|
|
31
|
+
* EnvValue schema for JSON serialization.
|
|
32
|
+
* Uses untagged representation:
|
|
33
|
+
* - Plain string: `"hello"` deserializes to `Plain("hello")`
|
|
34
|
+
* - Object with env key: `{"env": "VAR"}` deserializes to `EnvRef { env: "VAR" }`
|
|
35
|
+
*/
|
|
36
|
+
exports.EnvRef = EnvRef;
|
|
37
|
+
const EnvValue = exports.EnvValue = /*#__PURE__*/_effect.Schema.Union(/*#__PURE__*/_effect.Schema.transform(_effect.Schema.String, /*#__PURE__*/_effect.Schema.instanceOf(Plain), {
|
|
38
|
+
strict: true,
|
|
39
|
+
decode: value => new Plain({
|
|
40
|
+
value
|
|
41
|
+
}),
|
|
42
|
+
encode: plain => plain.value
|
|
43
|
+
}), /*#__PURE__*/_effect.Schema.transform(/*#__PURE__*/_effect.Schema.Struct({
|
|
44
|
+
env: _effect.Schema.String
|
|
45
|
+
}), /*#__PURE__*/_effect.Schema.instanceOf(EnvRef), {
|
|
46
|
+
strict: true,
|
|
47
|
+
decode: ({
|
|
48
|
+
env
|
|
49
|
+
}) => new EnvRef({
|
|
50
|
+
env
|
|
51
|
+
}),
|
|
52
|
+
encode: envRef => ({
|
|
53
|
+
env: envRef.env
|
|
54
|
+
})
|
|
55
|
+
}));
|
|
56
|
+
/**
|
|
57
|
+
* Creates a plain string value.
|
|
58
|
+
*/
|
|
59
|
+
const plain = value => new Plain({
|
|
60
|
+
value
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Creates an environment variable reference.
|
|
64
|
+
*/
|
|
65
|
+
exports.plain = plain;
|
|
66
|
+
const env = varName => new EnvRef({
|
|
67
|
+
env: varName
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Returns `true` if this is a plain string value.
|
|
71
|
+
*/
|
|
72
|
+
exports.env = env;
|
|
73
|
+
const isPlain = value => value._tag === "Plain";
|
|
74
|
+
/**
|
|
75
|
+
* Returns `true` if this is an environment variable reference.
|
|
76
|
+
*/
|
|
77
|
+
exports.isPlain = isPlain;
|
|
78
|
+
const isEnvRef = value => value._tag === "EnvRef";
|
|
79
|
+
/**
|
|
80
|
+
* Converts to the harness-specific native string format.
|
|
81
|
+
*
|
|
82
|
+
* - For `Plain`: Returns the string as-is
|
|
83
|
+
* - For `EnvRef` with Claude Code/AmpCode/CopilotCli: Returns `${VAR}`
|
|
84
|
+
* - For `EnvRef` with OpenCode: Returns `{env:VAR}`
|
|
85
|
+
* - For `EnvRef` with Goose: Resolves the env var immediately (returns empty string if not set)
|
|
86
|
+
*/
|
|
87
|
+
exports.isEnvRef = isEnvRef;
|
|
88
|
+
const toNative = (value, kind) => {
|
|
89
|
+
if (value._tag === "Plain") {
|
|
90
|
+
return value.value;
|
|
91
|
+
}
|
|
92
|
+
switch (kind) {
|
|
93
|
+
case "ClaudeCode":
|
|
94
|
+
case "AmpCode":
|
|
95
|
+
case "CopilotCli":
|
|
96
|
+
return `\${${value.env}}`;
|
|
97
|
+
case "OpenCode":
|
|
98
|
+
return `{env:${value.env}}`;
|
|
99
|
+
case "Goose":
|
|
100
|
+
return process.env[value.env] ?? "";
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Fallible version of `toNative` that returns an error when an environment
|
|
105
|
+
* variable reference cannot be resolved.
|
|
106
|
+
*
|
|
107
|
+
* For Goose harness, this validates that the referenced environment variable
|
|
108
|
+
* is actually set, returning an error if not.
|
|
109
|
+
*
|
|
110
|
+
* For other harnesses that use template syntax (Claude Code, OpenCode, AmpCode),
|
|
111
|
+
* this behaves identically to `toNative` since the variable is not resolved
|
|
112
|
+
* at conversion time.
|
|
113
|
+
*/
|
|
114
|
+
exports.toNative = toNative;
|
|
115
|
+
const tryToNative = (value, kind) => {
|
|
116
|
+
if (value._tag === "Plain") {
|
|
117
|
+
return _effect.Effect.succeed(value.value);
|
|
118
|
+
}
|
|
119
|
+
switch (kind) {
|
|
120
|
+
case "ClaudeCode":
|
|
121
|
+
case "AmpCode":
|
|
122
|
+
case "CopilotCli":
|
|
123
|
+
return _effect.Effect.succeed(`\${${value.env}}`);
|
|
124
|
+
case "OpenCode":
|
|
125
|
+
return _effect.Effect.succeed(`{env:${value.env}}`);
|
|
126
|
+
case "Goose":
|
|
127
|
+
{
|
|
128
|
+
const envVal = process.env[value.env];
|
|
129
|
+
if (envVal === undefined) {
|
|
130
|
+
return _effect.Effect.fail(new _errors.MissingEnvVarError({
|
|
131
|
+
name: value.env
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
return _effect.Effect.succeed(envVal);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Parses a harness-specific native string format into an `EnvValue`.
|
|
140
|
+
*
|
|
141
|
+
* - For Claude Code/AmpCode/CopilotCli: Parses `${VAR}` pattern
|
|
142
|
+
* - For OpenCode: Parses `{env:VAR}` pattern
|
|
143
|
+
* - For Goose: Always returns `Plain` (Goose doesn't use inline syntax)
|
|
144
|
+
* - If no pattern matches, returns `Plain`
|
|
145
|
+
*/
|
|
146
|
+
exports.tryToNative = tryToNative;
|
|
147
|
+
const fromNative = (s, kind) => {
|
|
148
|
+
switch (kind) {
|
|
149
|
+
case "ClaudeCode":
|
|
150
|
+
case "AmpCode":
|
|
151
|
+
case "CopilotCli":
|
|
152
|
+
{
|
|
153
|
+
// Parse ${VAR} pattern
|
|
154
|
+
if (s.startsWith("${") && s.endsWith("}")) {
|
|
155
|
+
const varName = s.slice(2, -1);
|
|
156
|
+
return new EnvRef({
|
|
157
|
+
env: varName
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return new Plain({
|
|
161
|
+
value: s
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
case "OpenCode":
|
|
165
|
+
{
|
|
166
|
+
// Parse {env:VAR} pattern
|
|
167
|
+
if (s.startsWith("{env:") && s.endsWith("}")) {
|
|
168
|
+
const varName = s.slice(5, -1);
|
|
169
|
+
return new EnvRef({
|
|
170
|
+
env: varName
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return new Plain({
|
|
174
|
+
value: s
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
case "Goose":
|
|
178
|
+
// Goose doesn't use inline env var syntax; values are always plain
|
|
179
|
+
return new Plain({
|
|
180
|
+
value: s
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Resolves the value, looking up environment variables if needed.
|
|
186
|
+
*
|
|
187
|
+
* - For `Plain`: Returns `Some(value)`
|
|
188
|
+
* - For `EnvRef`: Returns `Some(value)` if the env var is set, `None` otherwise
|
|
189
|
+
*/
|
|
190
|
+
exports.fromNative = fromNative;
|
|
191
|
+
const resolve = value => {
|
|
192
|
+
if (value._tag === "Plain") {
|
|
193
|
+
return _effect.Option.some(value.value);
|
|
194
|
+
}
|
|
195
|
+
const envVal = process.env[value.env];
|
|
196
|
+
return envVal !== undefined ? _effect.Option.some(envVal) : _effect.Option.none();
|
|
197
|
+
};
|
|
198
|
+
exports.resolve = resolve;
|
|
199
|
+
//# sourceMappingURL=EnvValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvValue.js","names":["_effect","require","_errors","Plain","Data","TaggedClass","exports","EnvRef","EnvValue","Schema","Union","transform","String","instanceOf","strict","decode","value","encode","plain","Struct","env","envRef","varName","isPlain","_tag","isEnvRef","toNative","kind","process","tryToNative","Effect","succeed","envVal","undefined","fail","MissingEnvVarError","name","fromNative","s","startsWith","endsWith","slice","resolve","Option","some","none"],"sources":["../../../src/types/EnvValue.ts"],"sourcesContent":[null],"mappings":";;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAZA;;;;;;;;;;;;AAeA;;;AAGM,MAAOE,KAAM,sBAAQC,YAAI,CAACC,WAAW,CAAC,OAAO,CAEjD;AAEF;;;AAAAC,OAAA,CAAAH,KAAA,GAAAA,KAAA;AAGM,MAAOI,MAAO,sBAAQH,YAAI,CAACC,WAAW,CAAC,QAAQ,CAEnD;AAOF;;;;;;AAAAC,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAMO,MAAMC,QAAQ,GAAAF,OAAA,CAAAE,QAAA,gBAA+DC,cAAM,CAACC,KAAK,cAC9FD,cAAM,CAACE,SAAS,CACdF,cAAM,CAACG,MAAM,eACbH,cAAM,CAACI,UAAU,CAACV,KAAK,CAAC,EACxB;EACEW,MAAM,EAAE,IAAI;EACZC,MAAM,EAAGC,KAAK,IAAK,IAAIb,KAAK,CAAC;IAAEa;EAAK,CAAE,CAAC;EACvCC,MAAM,EAAGC,KAAK,IAAKA,KAAK,CAACF;CAC1B,CACF,eACDP,cAAM,CAACE,SAAS,cACdF,cAAM,CAACU,MAAM,CAAC;EAAEC,GAAG,EAAEX,cAAM,CAACG;AAAM,CAAE,CAAC,eACrCH,cAAM,CAACI,UAAU,CAACN,MAAM,CAAC,EACzB;EACEO,MAAM,EAAE,IAAI;EACZC,MAAM,EAAEA,CAAC;IAAEK;EAAG,CAAE,KAAK,IAAIb,MAAM,CAAC;IAAEa;EAAG,CAAE,CAAC;EACxCH,MAAM,EAAGI,MAAM,KAAM;IAAED,GAAG,EAAEC,MAAM,CAACD;EAAG,CAAE;CACzC,CACF,CACF;AAED;;;AAGO,MAAMF,KAAK,GAAIF,KAAa,IAAe,IAAIb,KAAK,CAAC;EAAEa;AAAK,CAAE,CAAC;AAEtE;;;AAAAV,OAAA,CAAAY,KAAA,GAAAA,KAAA;AAGO,MAAME,GAAG,GAAIE,OAAe,IAAe,IAAIf,MAAM,CAAC;EAAEa,GAAG,EAAEE;AAAO,CAAE,CAAC;AAE9E;;;AAAAhB,OAAA,CAAAc,GAAA,GAAAA,GAAA;AAGO,MAAMG,OAAO,GAAIP,KAAe,IAAqBA,KAAK,CAACQ,IAAI,KAAK,OAAO;AAElF;;;AAAAlB,OAAA,CAAAiB,OAAA,GAAAA,OAAA;AAGO,MAAME,QAAQ,GAAIT,KAAe,IAAsBA,KAAK,CAACQ,IAAI,KAAK,QAAQ;AAErF;;;;;;;;AAAAlB,OAAA,CAAAmB,QAAA,GAAAA,QAAA;AAQO,MAAMC,QAAQ,GAAGA,CAACV,KAAe,EAAEW,IAAiB,KAAY;EACrE,IAAIX,KAAK,CAACQ,IAAI,KAAK,OAAO,EAAE;IAC1B,OAAOR,KAAK,CAACA,KAAK;EACpB;EAEA,QAAQW,IAAI;IACV,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,YAAY;MACf,OAAO,MAAMX,KAAK,CAACI,GAAG,GAAG;IAC3B,KAAK,UAAU;MACb,OAAO,QAAQJ,KAAK,CAACI,GAAG,GAAG;IAC7B,KAAK,OAAO;MACV,OAAOQ,OAAO,CAACR,GAAG,CAACJ,KAAK,CAACI,GAAG,CAAC,IAAI,EAAE;EACvC;AACF,CAAC;AAED;;;;;;;;;;;AAAAd,OAAA,CAAAoB,QAAA,GAAAA,QAAA;AAWO,MAAMG,WAAW,GAAGA,CACzBb,KAAe,EACfW,IAAiB,KAC4B;EAC7C,IAAIX,KAAK,CAACQ,IAAI,KAAK,OAAO,EAAE;IAC1B,OAAOM,cAAM,CAACC,OAAO,CAACf,KAAK,CAACA,KAAK,CAAC;EACpC;EAEA,QAAQW,IAAI;IACV,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,YAAY;MACf,OAAOG,cAAM,CAACC,OAAO,CAAC,MAAMf,KAAK,CAACI,GAAG,GAAG,CAAC;IAC3C,KAAK,UAAU;MACb,OAAOU,cAAM,CAACC,OAAO,CAAC,QAAQf,KAAK,CAACI,GAAG,GAAG,CAAC;IAC7C,KAAK,OAAO;MAAE;QACZ,MAAMY,MAAM,GAAGJ,OAAO,CAACR,GAAG,CAACJ,KAAK,CAACI,GAAG,CAAC;QACrC,IAAIY,MAAM,KAAKC,SAAS,EAAE;UACxB,OAAOH,cAAM,CAACI,IAAI,CAAC,IAAIC,0BAAkB,CAAC;YAAEC,IAAI,EAAEpB,KAAK,CAACI;UAAG,CAAE,CAAC,CAAC;QACjE;QACA,OAAOU,cAAM,CAACC,OAAO,CAACC,MAAM,CAAC;MAC/B;EACF;AACF,CAAC;AAED;;;;;;;;AAAA1B,OAAA,CAAAuB,WAAA,GAAAA,WAAA;AAQO,MAAMQ,UAAU,GAAGA,CAACC,CAAS,EAAEX,IAAiB,KAAc;EACnE,QAAQA,IAAI;IACV,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,YAAY;MAAE;QACjB;QACA,IAAIW,CAAC,CAACC,UAAU,CAAC,IAAI,CAAC,IAAID,CAAC,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;UACzC,MAAMlB,OAAO,GAAGgB,CAAC,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;UAC9B,OAAO,IAAIlC,MAAM,CAAC;YAAEa,GAAG,EAAEE;UAAO,CAAE,CAAC;QACrC;QACA,OAAO,IAAInB,KAAK,CAAC;UAAEa,KAAK,EAAEsB;QAAC,CAAE,CAAC;MAChC;IACA,KAAK,UAAU;MAAE;QACf;QACA,IAAIA,CAAC,CAACC,UAAU,CAAC,OAAO,CAAC,IAAID,CAAC,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;UAC5C,MAAMlB,OAAO,GAAGgB,CAAC,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;UAC9B,OAAO,IAAIlC,MAAM,CAAC;YAAEa,GAAG,EAAEE;UAAO,CAAE,CAAC;QACrC;QACA,OAAO,IAAInB,KAAK,CAAC;UAAEa,KAAK,EAAEsB;QAAC,CAAE,CAAC;MAChC;IACA,KAAK,OAAO;MACV;MACA,OAAO,IAAInC,KAAK,CAAC;QAAEa,KAAK,EAAEsB;MAAC,CAAE,CAAC;EAClC;AACF,CAAC;AAED;;;;;;AAAAhC,OAAA,CAAA+B,UAAA,GAAAA,UAAA;AAMO,MAAMK,OAAO,GAAI1B,KAAe,IAA2B;EAChE,IAAIA,KAAK,CAACQ,IAAI,KAAK,OAAO,EAAE;IAC1B,OAAOmB,cAAM,CAACC,IAAI,CAAC5B,KAAK,CAACA,KAAK,CAAC;EACjC;EACA,MAAMgB,MAAM,GAAGJ,OAAO,CAACR,GAAG,CAACJ,KAAK,CAACI,GAAG,CAAC;EACrC,OAAOY,MAAM,KAAKC,SAAS,GAAGU,cAAM,CAACC,IAAI,CAACZ,MAAM,CAAC,GAAGW,cAAM,CAACE,IAAI,EAAE;AACnE,CAAC;AAAAvC,OAAA,CAAAoC,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FileFormatAll = exports.FileFormat = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
/**
|
|
9
|
+
* File formats used by harness configuration files.
|
|
10
|
+
*
|
|
11
|
+
* Different harnesses use different formats for their configuration,
|
|
12
|
+
* commands, and other resources.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* File format schema.
|
|
19
|
+
*/
|
|
20
|
+
const FileFormat = exports.FileFormat = /*#__PURE__*/_effect.Schema.Literal("Json", "Jsonc", "Yaml", "Markdown", "MarkdownWithFrontmatter");
|
|
21
|
+
/**
|
|
22
|
+
* All supported file formats.
|
|
23
|
+
*/
|
|
24
|
+
const FileFormatAll = exports.FileFormatAll = ["Json", "Jsonc", "Yaml", "Markdown", "MarkdownWithFrontmatter"];
|
|
25
|
+
//# sourceMappingURL=FileFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileFormat.js","names":["_effect","require","FileFormat","exports","Schema","Literal","FileFormatAll"],"sources":["../../../src/types/FileFormat.ts"],"sourcesContent":[null],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AARA;;;;;;;;;AAUA;;;AAGO,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,gBAAGE,cAAM,CAACC,OAAO,CACtC,MAAM,EACN,OAAO,EACP,MAAM,EACN,UAAU,EACV,yBAAyB,CAC1B;AAOD;;;AAGO,MAAMC,aAAa,GAAAH,OAAA,CAAAG,aAAA,GAAG,CAC3B,MAAM,EACN,OAAO,EACP,MAAM,EACN,UAAU,EACV,yBAAyB,CACmB","ignoreList":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.directoryNames = exports.binaryNames = exports.asStr = exports.HarnessKindAll = exports.HarnessKind = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
/**
|
|
9
|
+
* Supported AI coding harnesses.
|
|
10
|
+
*
|
|
11
|
+
* This module provides the HarnessKind type representing the different
|
|
12
|
+
* AI coding assistants whose configuration paths can be discovered.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Harness kind schema - represents the different AI coding assistants.
|
|
19
|
+
*/
|
|
20
|
+
const HarnessKind = exports.HarnessKind = /*#__PURE__*/_effect.Schema.Literal("ClaudeCode", "OpenCode", "Goose", "AmpCode", "CopilotCli");
|
|
21
|
+
/**
|
|
22
|
+
* All supported harness kinds.
|
|
23
|
+
*/
|
|
24
|
+
const HarnessKindAll = exports.HarnessKindAll = ["ClaudeCode", "OpenCode", "Goose", "AmpCode", "CopilotCli"];
|
|
25
|
+
/**
|
|
26
|
+
* Returns the display name of this harness kind.
|
|
27
|
+
*/
|
|
28
|
+
const asStr = kind => {
|
|
29
|
+
switch (kind) {
|
|
30
|
+
case "ClaudeCode":
|
|
31
|
+
return "Claude Code";
|
|
32
|
+
case "OpenCode":
|
|
33
|
+
return "OpenCode";
|
|
34
|
+
case "Goose":
|
|
35
|
+
return "Goose";
|
|
36
|
+
case "AmpCode":
|
|
37
|
+
return "AMP Code";
|
|
38
|
+
case "CopilotCli":
|
|
39
|
+
return "Copilot CLI";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Returns the known CLI binary names for this harness.
|
|
44
|
+
*
|
|
45
|
+
* These are the executable names that indicate the harness is installed
|
|
46
|
+
* and available in PATH.
|
|
47
|
+
*/
|
|
48
|
+
exports.asStr = asStr;
|
|
49
|
+
const binaryNames = kind => {
|
|
50
|
+
switch (kind) {
|
|
51
|
+
case "ClaudeCode":
|
|
52
|
+
return ["claude"];
|
|
53
|
+
case "OpenCode":
|
|
54
|
+
return ["opencode"];
|
|
55
|
+
case "Goose":
|
|
56
|
+
return ["goose"];
|
|
57
|
+
case "AmpCode":
|
|
58
|
+
return ["amp"];
|
|
59
|
+
case "CopilotCli":
|
|
60
|
+
return ["copilot"];
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Returns the expected directory name(s) for a resource kind.
|
|
65
|
+
*
|
|
66
|
+
* Different harnesses use different naming conventions:
|
|
67
|
+
* - OpenCode uses singular names (`skill`, `command`)
|
|
68
|
+
* - Other harnesses use plural names (`skills`, `commands`)
|
|
69
|
+
*
|
|
70
|
+
* Returns `undefined` if the harness doesn't support that resource type.
|
|
71
|
+
* When multiple names are returned, index 0 is the canonical name.
|
|
72
|
+
*/
|
|
73
|
+
exports.binaryNames = binaryNames;
|
|
74
|
+
const directoryNames = (kind, resource) => {
|
|
75
|
+
switch (kind) {
|
|
76
|
+
case "OpenCode":
|
|
77
|
+
switch (resource) {
|
|
78
|
+
case "Skills":
|
|
79
|
+
return ["skill"];
|
|
80
|
+
case "Commands":
|
|
81
|
+
return ["command"];
|
|
82
|
+
case "Agents":
|
|
83
|
+
return ["agent"];
|
|
84
|
+
case "Plugins":
|
|
85
|
+
return ["plugin"];
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "ClaudeCode":
|
|
89
|
+
switch (resource) {
|
|
90
|
+
case "Skills":
|
|
91
|
+
return ["skills"];
|
|
92
|
+
case "Commands":
|
|
93
|
+
return ["commands"];
|
|
94
|
+
case "Agents":
|
|
95
|
+
return ["agents"];
|
|
96
|
+
case "Plugins":
|
|
97
|
+
return ["plugins"];
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "Goose":
|
|
101
|
+
switch (resource) {
|
|
102
|
+
case "Skills":
|
|
103
|
+
return ["skills"];
|
|
104
|
+
default:
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
case "AmpCode":
|
|
108
|
+
switch (resource) {
|
|
109
|
+
case "Skills":
|
|
110
|
+
return ["skills"];
|
|
111
|
+
case "Commands":
|
|
112
|
+
return ["commands"];
|
|
113
|
+
default:
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
case "CopilotCli":
|
|
117
|
+
switch (resource) {
|
|
118
|
+
case "Skills":
|
|
119
|
+
return ["skills"];
|
|
120
|
+
case "Agents":
|
|
121
|
+
return ["agents"];
|
|
122
|
+
default:
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.directoryNames = directoryNames;
|
|
130
|
+
//# sourceMappingURL=HarnessKind.js.map
|