poe-code 3.0.4 → 3.0.6
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/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/shared.d.ts +2 -2
- package/dist/cli/service-registry.d.ts +10 -1
- package/dist/cli/service-registry.js.map +1 -1
- package/dist/providers/claude-code.js +18 -17
- package/dist/providers/claude-code.js.map +1 -1
- package/dist/providers/codex.js +21 -23
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/create-provider.d.ts +9 -6
- package/dist/providers/create-provider.js +44 -31
- package/dist/providers/create-provider.js.map +1 -1
- package/dist/providers/kimi.js +13 -17
- package/dist/providers/kimi.js.map +1 -1
- package/dist/providers/mcp-config.d.ts +5 -9
- package/dist/providers/mcp-config.js +16 -32
- package/dist/providers/mcp-config.js.map +1 -1
- package/dist/providers/opencode.d.ts +1 -1
- package/dist/providers/opencode.js +17 -29
- package/dist/providers/opencode.js.map +1 -1
- package/dist/services/mutation-events.d.ts +3 -3
- package/dist/services/mutation-events.js.map +1 -1
- package/dist/utils/templates.d.ts +1 -0
- package/dist/utils/templates.js +1 -1
- package/dist/utils/templates.js.map +1 -1
- package/package.json +1 -1
- package/dist/providers/provider-helpers.d.ts +0 -10
- package/dist/providers/provider-helpers.js +0 -73
- package/dist/providers/provider-helpers.js.map +0 -1
- package/dist/services/service-manifest.d.ts +0 -200
- package/dist/services/service-manifest.js +0 -717
- package/dist/services/service-manifest.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../../src/providers/mcp-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../../src/providers/mcp-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,0BAA0B,EAC1B,kB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C,OAAO,CAAC,EAAE;YACtB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YAC5B,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,SAAS,EAAE;gBACT,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;oBACnB,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;wBACpB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;oBAChE,CAAC;gBACH,CAAC;gBACD,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;oBAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;wBACxC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ServiceInstallDefinition } from "../services/service-install.js";
|
|
2
2
|
export declare const OPEN_CODE_INSTALL_DEFINITION: ServiceInstallDefinition;
|
|
3
|
-
export declare const openCodeService: import("../cli/service-registry.js").ProviderService<
|
|
3
|
+
export declare const openCodeService: import("../cli/service-registry.js").ProviderService<any, any, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_FRONTIER_MODEL, FRONTIER_MODELS, PROVIDER_NAME } from "../cli/constants.js";
|
|
2
2
|
import { createBinaryExistsCheck, createCommandExpectationCheck } from "../utils/command-checks.js";
|
|
3
|
-
import {
|
|
3
|
+
import { configMutation, fileMutation } from "@poe-code/config-mutations";
|
|
4
4
|
import { createProvider } from "./create-provider.js";
|
|
5
5
|
import { openCodeAgent } from "@poe-code/agent-defs";
|
|
6
6
|
function providerModel(model) {
|
|
@@ -61,14 +61,11 @@ export const openCodeService = createProvider({
|
|
|
61
61
|
},
|
|
62
62
|
manifest: {
|
|
63
63
|
configure: [
|
|
64
|
-
ensureDirectory({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
targetFile: "config.json",
|
|
70
|
-
value: ({ options }) => {
|
|
71
|
-
const { model } = (options ?? {});
|
|
64
|
+
fileMutation.ensureDirectory({ path: "~/.config/opencode" }),
|
|
65
|
+
configMutation.merge({
|
|
66
|
+
target: "~/.config/opencode/config.json",
|
|
67
|
+
value: (ctx) => {
|
|
68
|
+
const { model } = (ctx ?? {});
|
|
72
69
|
return {
|
|
73
70
|
$schema: "https://opencode.ai/config.json",
|
|
74
71
|
model: providerModel(model),
|
|
@@ -76,14 +73,11 @@ export const openCodeService = createProvider({
|
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
75
|
}),
|
|
79
|
-
ensureDirectory({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
targetFile: "auth.json",
|
|
85
|
-
value: ({ options }) => {
|
|
86
|
-
const { apiKey } = (options ?? {});
|
|
76
|
+
fileMutation.ensureDirectory({ path: "~/.opencode-data" }),
|
|
77
|
+
configMutation.merge({
|
|
78
|
+
target: "~/.opencode-data/auth.json",
|
|
79
|
+
value: (ctx) => {
|
|
80
|
+
const { apiKey } = (ctx ?? {});
|
|
87
81
|
return {
|
|
88
82
|
[PROVIDER_NAME]: {
|
|
89
83
|
type: "api",
|
|
@@ -94,19 +88,13 @@ export const openCodeService = createProvider({
|
|
|
94
88
|
})
|
|
95
89
|
],
|
|
96
90
|
unconfigure: [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
shape: () => ({
|
|
101
|
-
enabled_providers: true
|
|
102
|
-
})
|
|
91
|
+
configMutation.prune({
|
|
92
|
+
target: "~/.config/opencode/config.json",
|
|
93
|
+
shape: { enabled_providers: true }
|
|
103
94
|
}),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
shape: () => ({
|
|
108
|
-
[PROVIDER_NAME]: true
|
|
109
|
-
})
|
|
95
|
+
configMutation.prune({
|
|
96
|
+
target: "~/.opencode-data/auth.json",
|
|
97
|
+
shape: { [PROVIDER_NAME]: true }
|
|
110
98
|
})
|
|
111
99
|
]
|
|
112
100
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/providers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/providers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,SAAS,aAAa,CAAC,KAAc;IACnC,MAAM,KAAK,GAAG,KAAK,IAAI,sBAAsB,CAAC;IAC9C,MAAM,MAAM,GAAG,GAAG,aAAa,GAAG,CAAC;IACnC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAA6B;IACpE,EAAE,EAAE,UAAU;IACd,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,uBAAuB,CAC5B,UAAU,EACV,q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AAO,CAAC,QAAQ,CACrB,6BAA6B,CAAC;YAC5B,EAAE,EAAE,qBAAqB;YACzB,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE;gBACJ,GAAG,YAAY,CAAC,sBAAsB,CAAC;gBACvC,KAAK;gBACL,8BAA8B;aAC/B;YACD,cAAc,EAAE,cAAc;SAC/B,CAAC,CACH,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,OAAO,EAAE,OAAO;QACpB,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,CAAyB,CAAC;QACrD,MAAM,IAAI,GAAG;YACX,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;YAC3B,KAAK;YACL,IAAI,CAAC,MAAM;YACX,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SACrB,CAAC;QACF,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE;gBAC3E,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/E,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ScopedLogger } from "../cli/logger.js";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function createMutationReporter(logger: ScopedLogger):
|
|
4
|
-
export declare function combineMutationObservers(...observers: Array<
|
|
2
|
+
import type { MutationObservers } from "@poe-code/config-mutations";
|
|
3
|
+
export declare function createMutationReporter(logger: ScopedLogger): MutationObservers;
|
|
4
|
+
export declare function combineMutationObservers(...observers: Array<MutationObservers | undefined>): MutationObservers | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-events.js","sourceRoot":"","sources":["../../src/services/mutation-events.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,sBAAsB,CACpC,MAAoB;IAEpB,OAAO;QACL,UAAU,CAAC,OAAO,EAAE,OAAO;YACzB,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,OAAO,EAAE,KAAK;YACpB,MAAM,CAAC,KAAK,CACV,GAAG,OAAO,CAAC,KAAK,YAAY,aAAa,CAAC,KAAK,CAAC,EAAE,CACnD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,GAAG,
|
|
1
|
+
{"version":3,"file":"mutation-events.js","sourceRoot":"","sources":["../../src/services/mutation-events.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,sBAAsB,CACpC,MAAoB;IAEpB,OAAO;QACL,UAAU,CAAC,OAAO,EAAE,OAAO;YACzB,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,OAAO,EAAE,KAAK;YACpB,MAAM,CAAC,KAAK,CACV,GAAG,OAAO,CAAC,KAAK,YAAY,aAAa,CAAC,KAAK,CAAC,EAAE,CACnD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,GAAG,SAA+C;IAElD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAC7B,CAAC,QAAQ,EAAiC,EAAE,CAAC,QAAQ,IAAI,IAAI,CAC9D,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO;QACL,OAAO,CAAC,OAAO;YACb,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QACD,UAAU,CAAC,OAAO,EAAE,OAAO;YACzB,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAC9B,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,OAAO,CAAC,OAAO,EAAE,KAAK;YACpB,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAC5B,OAAwB,EACxB,OAAwB;IAExB,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,GAAG,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,eAAe,CAAC,OAAwB;IAC/C,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAChD,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
type TemplateLoader = (relativePath: string) => Promise<string>;
|
|
2
2
|
export declare function renderTemplate(relativePath: string, context: Record<string, unknown>): Promise<string>;
|
|
3
3
|
export declare function setTemplateLoader(loader: TemplateLoader | null): void;
|
|
4
|
+
export declare function loadTemplate(relativePath: string): Promise<string>;
|
|
4
5
|
export {};
|
package/dist/utils/templates.js
CHANGED
|
@@ -11,7 +11,7 @@ export async function renderTemplate(relativePath, context) {
|
|
|
11
11
|
export function setTemplateLoader(loader) {
|
|
12
12
|
customLoader = loader;
|
|
13
13
|
}
|
|
14
|
-
async function loadTemplate(relativePath) {
|
|
14
|
+
export async function loadTemplate(relativePath) {
|
|
15
15
|
if (customLoader) {
|
|
16
16
|
return customLoader(relativePath);
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/utils/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAI7E,IAAI,YAAY,GAA0B,IAAI,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,YAAoB,EACpB,OAAgC;IAEhC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,YAAoB;
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/utils/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAI7E,IAAI,YAAY,GAA0B,IAAI,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,YAAoB,EACpB,OAAgC;IAEhC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,YAAoB;IACrD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC3D,OAAO,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ServiceMutation } from "../services/service-manifest.js";
|
|
2
|
-
type TargetResolver<Options> = string | ((context: {
|
|
3
|
-
options: Options;
|
|
4
|
-
}) => string);
|
|
5
|
-
export declare function makeExecutableMutation<Options>(config: {
|
|
6
|
-
target: TargetResolver<Options>;
|
|
7
|
-
mode?: number;
|
|
8
|
-
}): ServiceMutation<Options>;
|
|
9
|
-
export declare function quoteSinglePath(targetPath: string): string;
|
|
10
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
export function makeExecutableMutation(config) {
|
|
3
|
-
const mode = config.mode ?? 0o700;
|
|
4
|
-
const resolver = toResolver(config.target);
|
|
5
|
-
const target = toManifestTarget(config.target);
|
|
6
|
-
return {
|
|
7
|
-
kind: "transformFile",
|
|
8
|
-
target,
|
|
9
|
-
label: (context) => `Make file executable ${resolveTargetPath(resolver, context)}`,
|
|
10
|
-
async transform({ content, context }) {
|
|
11
|
-
if (typeof context.fs.chmod === "function" && content != null) {
|
|
12
|
-
const targetPath = resolveTargetPath(resolver, context);
|
|
13
|
-
await context.fs.chmod(targetPath, mode);
|
|
14
|
-
}
|
|
15
|
-
return { content, changed: false };
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export function quoteSinglePath(targetPath) {
|
|
20
|
-
const escaped = targetPath.replace(/'/g, `'\\''`);
|
|
21
|
-
return `'${escaped}'`;
|
|
22
|
-
}
|
|
23
|
-
function toResolver(input) {
|
|
24
|
-
if (typeof input === "function") {
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
27
|
-
return () => input;
|
|
28
|
-
}
|
|
29
|
-
function toManifestTarget(input) {
|
|
30
|
-
if (typeof input === "function") {
|
|
31
|
-
return {
|
|
32
|
-
target: (context) => input({ options: context.options })
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
target: input
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function resolveTargetPath(resolver, context) {
|
|
40
|
-
const raw = resolver(context);
|
|
41
|
-
if (!raw.startsWith("~")) {
|
|
42
|
-
return raw;
|
|
43
|
-
}
|
|
44
|
-
let targetPath = raw;
|
|
45
|
-
if (targetPath.startsWith("~./")) {
|
|
46
|
-
targetPath = `~/.${targetPath.slice(3)}`;
|
|
47
|
-
}
|
|
48
|
-
const homeDir = context.env?.homeDir ??
|
|
49
|
-
context.options.env?.homeDir ??
|
|
50
|
-
process.env.HOME ??
|
|
51
|
-
process.env.USERPROFILE;
|
|
52
|
-
if (!homeDir) {
|
|
53
|
-
return targetPath;
|
|
54
|
-
}
|
|
55
|
-
let remainder = targetPath.slice(1);
|
|
56
|
-
if (remainder.startsWith("/")) {
|
|
57
|
-
remainder = remainder.slice(1);
|
|
58
|
-
}
|
|
59
|
-
else if (remainder.startsWith("\\")) {
|
|
60
|
-
remainder = remainder.slice(1);
|
|
61
|
-
}
|
|
62
|
-
else if (remainder.startsWith(".")) {
|
|
63
|
-
remainder = remainder.slice(1);
|
|
64
|
-
if (remainder.startsWith("/")) {
|
|
65
|
-
remainder = remainder.slice(1);
|
|
66
|
-
}
|
|
67
|
-
else if (remainder.startsWith("\\")) {
|
|
68
|
-
remainder = remainder.slice(1);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return remainder.length === 0 ? homeDir : path.join(homeDir, remainder);
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=provider-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-helpers.js","sourceRoot":"","sources":["../../src/providers/provider-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B,MAAM,UAAU,sBAAsB,CAAU,MAG/C;IACC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC;IAClC,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,MAAM;QACN,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,wBAAwB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;QAClF,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE;YAClC,IAAI,OAAO,OAAO,CAAC,EAAE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,0 @@
|
|
|
1
|
-
import type { CliEnvironment } from "../cli/environment.js";
|
|
2
|
-
import type { CommandContext } from "../cli/context.js";
|
|
3
|
-
import type { FileSystem } from "../utils/file-system.js";
|
|
4
|
-
import { type JsonObject } from "../utils/json.js";
|
|
5
|
-
import { type TomlTable, type TomlMergeOptions } from "../utils/toml.js";
|
|
6
|
-
type ValueResolver<Options, Value> = Value | ((context: MutationContext<Options>) => Value);
|
|
7
|
-
type TargetPathResolver<Options> = ValueResolver<Options, string>;
|
|
8
|
-
type TargetDirectoryResolver<Options> = ValueResolver<Options, string>;
|
|
9
|
-
type TargetFileResolver<Options> = ValueResolver<Options, string>;
|
|
10
|
-
export type TargetLocation<Options> = {
|
|
11
|
-
target: TargetPathResolver<Options>;
|
|
12
|
-
targetDirectory?: never;
|
|
13
|
-
targetFile?: never;
|
|
14
|
-
} | {
|
|
15
|
-
target?: never;
|
|
16
|
-
targetDirectory: TargetDirectoryResolver<Options>;
|
|
17
|
-
targetFile?: TargetFileResolver<Options>;
|
|
18
|
-
};
|
|
19
|
-
interface MutationContext<Options> {
|
|
20
|
-
options: Options;
|
|
21
|
-
fs: FileSystem;
|
|
22
|
-
env: CliEnvironment;
|
|
23
|
-
}
|
|
24
|
-
export interface ServiceManifestPathMapper {
|
|
25
|
-
mapTargetDirectory: (input: {
|
|
26
|
-
targetDirectory: string;
|
|
27
|
-
env: CliEnvironment;
|
|
28
|
-
}) => string;
|
|
29
|
-
}
|
|
30
|
-
interface TransformResult {
|
|
31
|
-
content: string | null;
|
|
32
|
-
changed: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface TransformFileMutation<Options> {
|
|
35
|
-
kind: "transformFile";
|
|
36
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
37
|
-
target: TargetLocation<Options>;
|
|
38
|
-
transform(input: {
|
|
39
|
-
content: string | null;
|
|
40
|
-
context: MutationContext<Options>;
|
|
41
|
-
}): Promise<TransformResult> | TransformResult;
|
|
42
|
-
}
|
|
43
|
-
interface EnsureDirectoryMutation<Options> {
|
|
44
|
-
kind: "ensureDirectory";
|
|
45
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
46
|
-
targetDirectory: TargetDirectoryResolver<Options>;
|
|
47
|
-
}
|
|
48
|
-
interface CreateBackupMutation<Options> {
|
|
49
|
-
kind: "createBackup";
|
|
50
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
51
|
-
target: TargetLocation<Options>;
|
|
52
|
-
timestamp?: ValueResolver<Options, (() => string) | undefined>;
|
|
53
|
-
}
|
|
54
|
-
interface WriteTemplateMutation<Options> {
|
|
55
|
-
kind: "writeTemplate";
|
|
56
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
57
|
-
target: TargetLocation<Options>;
|
|
58
|
-
templateId: string;
|
|
59
|
-
context?: ValueResolver<Options, JsonObject | undefined>;
|
|
60
|
-
}
|
|
61
|
-
interface RemoveFileMutation<Options> {
|
|
62
|
-
kind: "removeFile";
|
|
63
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
64
|
-
target: TargetLocation<Options>;
|
|
65
|
-
whenEmpty?: boolean;
|
|
66
|
-
whenContentMatches?: RegExp;
|
|
67
|
-
}
|
|
68
|
-
interface ChmodMutation<Options> {
|
|
69
|
-
kind: "chmod";
|
|
70
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
71
|
-
target: TargetLocation<Options>;
|
|
72
|
-
mode: number;
|
|
73
|
-
}
|
|
74
|
-
export type ServiceMutation<Options> = TransformFileMutation<Options> | EnsureDirectoryMutation<Options> | CreateBackupMutation<Options> | WriteTemplateMutation<Options> | RemoveFileMutation<Options> | ChmodMutation<Options>;
|
|
75
|
-
export interface ServiceManifestDefinition<ConfigureOptions, UnconfigureOptions = ConfigureOptions> {
|
|
76
|
-
id: string;
|
|
77
|
-
summary: string;
|
|
78
|
-
configure: ServiceMutation<ConfigureOptions>[];
|
|
79
|
-
unconfigure?: ServiceMutation<UnconfigureOptions>[];
|
|
80
|
-
}
|
|
81
|
-
export interface ServiceManifest<ConfigureOptions, UnconfigureOptions = ConfigureOptions> {
|
|
82
|
-
id: string;
|
|
83
|
-
summary: string;
|
|
84
|
-
configureMutations: ServiceMutation<ConfigureOptions>[];
|
|
85
|
-
unconfigureMutations?: ServiceMutation<UnconfigureOptions>[];
|
|
86
|
-
configure(context: ServiceExecutionContext<ConfigureOptions>, runOptions?: ServiceRunOptions): Promise<void>;
|
|
87
|
-
unconfigure: (context: ServiceExecutionContext<UnconfigureOptions>, runOptions?: ServiceRunOptions) => Promise<boolean>;
|
|
88
|
-
}
|
|
89
|
-
export interface ServiceExecutionContext<Options> {
|
|
90
|
-
fs: FileSystem;
|
|
91
|
-
env: CliEnvironment;
|
|
92
|
-
command: CommandContext;
|
|
93
|
-
options: Options;
|
|
94
|
-
pathMapper?: ServiceManifestPathMapper;
|
|
95
|
-
}
|
|
96
|
-
export interface MutationLogDetails {
|
|
97
|
-
manifestId: string;
|
|
98
|
-
kind: ServiceMutationKind;
|
|
99
|
-
label: string;
|
|
100
|
-
targetPath?: string;
|
|
101
|
-
}
|
|
102
|
-
export type MutationDetail = "create" | "update" | "delete" | "noop" | "backup";
|
|
103
|
-
export interface ServiceMutationOutcome {
|
|
104
|
-
changed: boolean;
|
|
105
|
-
effect: MutationEffect;
|
|
106
|
-
detail?: MutationDetail;
|
|
107
|
-
}
|
|
108
|
-
export type MutationEffect = "none" | "mkdir" | "copy" | "write" | "delete" | "chmod";
|
|
109
|
-
export interface ServiceMutationObservers {
|
|
110
|
-
onStart?(details: MutationLogDetails): void;
|
|
111
|
-
onComplete?(details: MutationLogDetails, outcome: ServiceMutationOutcome): void;
|
|
112
|
-
onError?(details: MutationLogDetails, error: unknown): void;
|
|
113
|
-
}
|
|
114
|
-
export declare function ensureDirectory<Options>(config: {
|
|
115
|
-
path?: ValueResolver<Options, string>;
|
|
116
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
117
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
118
|
-
}): ServiceMutation<Options>;
|
|
119
|
-
export declare function createBackupMutation<Options>(config: {
|
|
120
|
-
target?: ValueResolver<Options, string>;
|
|
121
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
122
|
-
targetFile?: ValueResolver<Options, string>;
|
|
123
|
-
timestamp?: ValueResolver<Options, (() => string) | undefined>;
|
|
124
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
125
|
-
}): ServiceMutation<Options>;
|
|
126
|
-
export declare function writeTemplateMutation<Options>(config: {
|
|
127
|
-
target?: ValueResolver<Options, string>;
|
|
128
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
129
|
-
targetFile?: ValueResolver<Options, string>;
|
|
130
|
-
templateId: string;
|
|
131
|
-
context?: ValueResolver<Options, JsonObject | undefined>;
|
|
132
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
133
|
-
}): ServiceMutation<Options>;
|
|
134
|
-
export declare function chmodMutation<Options>(config: {
|
|
135
|
-
target?: ValueResolver<Options, string>;
|
|
136
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
137
|
-
targetFile?: ValueResolver<Options, string>;
|
|
138
|
-
mode: number;
|
|
139
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
140
|
-
}): ServiceMutation<Options>;
|
|
141
|
-
export declare function jsonMergeMutation<Options>(config: {
|
|
142
|
-
target?: ValueResolver<Options, string>;
|
|
143
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
144
|
-
targetFile?: ValueResolver<Options, string>;
|
|
145
|
-
value: ValueResolver<Options, JsonObject>;
|
|
146
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
147
|
-
}): ServiceMutation<Options>;
|
|
148
|
-
export declare function jsonPruneMutation<Options>(config: {
|
|
149
|
-
target?: ValueResolver<Options, string>;
|
|
150
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
151
|
-
targetFile?: ValueResolver<Options, string>;
|
|
152
|
-
shape: ValueResolver<Options, JsonObject>;
|
|
153
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
154
|
-
}): ServiceMutation<Options>;
|
|
155
|
-
export declare function tomlMergeMutation<Options>(config: {
|
|
156
|
-
target?: ValueResolver<Options, string>;
|
|
157
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
158
|
-
targetFile?: ValueResolver<Options, string>;
|
|
159
|
-
value: ValueResolver<Options, TomlTable>;
|
|
160
|
-
pruneByPrefix?: TomlMergeOptions["pruneByPrefix"];
|
|
161
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
162
|
-
}): ServiceMutation<Options>;
|
|
163
|
-
export declare function tomlPruneMutation<Options>(config: {
|
|
164
|
-
target?: ValueResolver<Options, string>;
|
|
165
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
166
|
-
targetFile?: ValueResolver<Options, string>;
|
|
167
|
-
prune: (document: TomlTable, context: MutationContext<Options>) => {
|
|
168
|
-
changed: boolean;
|
|
169
|
-
result: TomlTable | null;
|
|
170
|
-
};
|
|
171
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
172
|
-
}): ServiceMutation<Options>;
|
|
173
|
-
export declare function tomlTemplateMergeMutation<Options>(config: {
|
|
174
|
-
target?: ValueResolver<Options, string>;
|
|
175
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
176
|
-
targetFile?: ValueResolver<Options, string>;
|
|
177
|
-
templateId: string;
|
|
178
|
-
context?: ValueResolver<Options, JsonObject | undefined>;
|
|
179
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
180
|
-
}): ServiceMutation<Options>;
|
|
181
|
-
export declare function removePatternMutation<Options>(config: {
|
|
182
|
-
target: ValueResolver<Options, string>;
|
|
183
|
-
pattern: RegExp;
|
|
184
|
-
replacement?: string | ((match: string, context: MutationContext<Options>) => string);
|
|
185
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
186
|
-
}): ServiceMutation<Options>;
|
|
187
|
-
export declare function removeFileMutation<Options>(config: {
|
|
188
|
-
target?: ValueResolver<Options, string>;
|
|
189
|
-
targetDirectory?: ValueResolver<Options, string>;
|
|
190
|
-
targetFile?: ValueResolver<Options, string>;
|
|
191
|
-
whenEmpty?: boolean;
|
|
192
|
-
whenContentMatches?: RegExp;
|
|
193
|
-
label?: ValueResolver<Options, string | undefined>;
|
|
194
|
-
}): ServiceMutation<Options>;
|
|
195
|
-
export declare function createServiceManifest<ConfigureOptions, UnconfigureOptions = ConfigureOptions>(definition: ServiceManifestDefinition<ConfigureOptions, UnconfigureOptions>): ServiceManifest<ConfigureOptions, UnconfigureOptions>;
|
|
196
|
-
export interface ServiceRunOptions {
|
|
197
|
-
observers?: ServiceMutationObservers;
|
|
198
|
-
}
|
|
199
|
-
export type ServiceMutationKind = ServiceMutation<unknown>["kind"];
|
|
200
|
-
export {};
|