@morphllm/morphsdk 0.2.195 → 0.2.197
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/ai-sdk/index.cjs.map +1 -1
- package/dist/ai-sdk/index.d.ts +1 -1
- package/dist/ai-sdk/index.js.map +1 -1
- package/dist/{chunk-XUMLQ7AJ.js → chunk-2BT4UGKH.js} +2 -2
- package/dist/{chunk-FNN5776O.js → chunk-2HXELZI5.js} +2 -2
- package/dist/{chunk-JGC6S5SB.js → chunk-2XDSHAB5.js} +2 -2
- package/dist/{chunk-LOXY4VVO.js → chunk-4FWK3CEH.js} +31 -37
- package/dist/{chunk-LOXY4VVO.js.map → chunk-4FWK3CEH.js.map} +1 -1
- package/dist/{chunk-LNXRPEMK.js → chunk-6YZCPCAY.js} +4 -4
- package/dist/{chunk-KDVOJBKE.js → chunk-7QOGUY4A.js} +3 -3
- package/dist/{chunk-H353ZTXC.js → chunk-BECYWCEZ.js} +4 -4
- package/dist/{chunk-MUK6LFVY.js → chunk-DHGXGVHC.js} +7 -7
- package/dist/{chunk-FC3HXR2Q.js → chunk-DNL4DMMS.js} +2 -2
- package/dist/{chunk-QGR6OVVY.js → chunk-DW6ZIVCM.js} +3 -3
- package/dist/{chunk-MPTEH2CO.js → chunk-EGI642TV.js} +3 -9
- package/dist/chunk-EGI642TV.js.map +1 -0
- package/dist/{chunk-35U2MW77.js → chunk-FLWBVHDC.js} +4 -4
- package/dist/{chunk-PSFKWZKR.js → chunk-GE5MNVT7.js} +2 -2
- package/dist/{chunk-O3GWJKDO.js → chunk-JU6TCHVI.js} +2 -2
- package/dist/{chunk-R5XYEQV6.js → chunk-JZJY2XFQ.js} +2 -2
- package/dist/{chunk-DUPKDVNP.js → chunk-LRHJVSSD.js} +2 -2
- package/dist/{chunk-HLSOQ7MP.js → chunk-NKFAMQF2.js} +3 -3
- package/dist/{chunk-VLZ6PNAD.js → chunk-OPNTDMHH.js} +4 -4
- package/dist/{chunk-L7U5WS4B.js → chunk-PQCOBN7L.js} +4 -4
- package/dist/{chunk-6FVLHSQ6.js → chunk-SVD3YRWM.js} +2 -2
- package/dist/{chunk-LXRSNY7W.js → chunk-TJUZAO7T.js} +2 -2
- package/dist/{chunk-BSJVZEHN.js → chunk-UOS3XKJD.js} +2 -2
- package/dist/{chunk-SFLWBHK2.js → chunk-UZA2ODNU.js} +2 -2
- package/dist/{chunk-H2YBEXR4.js → chunk-VGCPVDFP.js} +2 -2
- package/dist/{chunk-K75R3X5V.js → chunk-VJD6MF3M.js} +3 -3
- package/dist/{chunk-6P4KCGAG.js → chunk-W34BUTVR.js} +2 -2
- package/dist/{chunk-ORDOOXPQ.js → chunk-WDLDKJHT.js} +6 -6
- package/dist/{chunk-HHKAZTGY.js → chunk-WFOGTZF6.js} +2 -2
- package/dist/{chunk-2YOE44FF.js → chunk-WN6YLBEH.js} +3 -3
- package/dist/{chunk-GWFZGS3Z.js → chunk-YVKRPVOM.js} +4 -4
- package/dist/{chunk-4YWADZPB.js → chunk-ZA3UJRSE.js} +2 -2
- package/dist/{client-Rn1zymAl.d.ts → client-B3fWTCcL.d.ts} +0 -3
- package/dist/client.cjs +4 -567
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -5
- package/dist/client.js +32 -34
- package/dist/core/client.cjs +2 -8
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -8
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -8
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/edge.cjs +2 -8
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/index.cjs +4 -569
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +38 -43
- package/dist/modelrouter/core.cjs +2 -8
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +5 -5
- package/dist/modelrouter/index.cjs +2 -8
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +5 -5
- package/dist/subagents/anthropic.cjs +2 -8
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +11 -11
- package/dist/subagents/vercel.cjs +2 -8
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +11 -11
- package/dist/tools/browser/anthropic.cjs +2 -8
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -7
- package/dist/tools/browser/core.cjs +2 -8
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +6 -6
- package/dist/tools/browser/index.cjs +2 -8
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +11 -11
- package/dist/tools/browser/openai.cjs +2 -8
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -7
- package/dist/tools/browser/profiles/core.cjs +2 -8
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.js +3 -3
- package/dist/tools/browser/profiles/index.cjs +2 -8
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.js +3 -3
- package/dist/tools/browser/vercel.cjs +2 -8
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +7 -7
- package/dist/tools/codebase_search/anthropic.cjs +2 -8
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +6 -6
- package/dist/tools/codebase_search/core.cjs +2 -8
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +5 -5
- package/dist/tools/codebase_search/index.cjs +2 -8
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +10 -10
- package/dist/tools/codebase_search/openai.cjs +2 -8
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +6 -6
- package/dist/tools/codebase_search/vercel.cjs +2 -8
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +6 -6
- package/dist/tools/compact/core.cjs +2 -8
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +5 -5
- package/dist/tools/compact/index.cjs +2 -8
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +2 -8
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +7 -7
- package/dist/tools/fastapply/apply.cjs +2 -8
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -8
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +6 -6
- package/dist/tools/fastapply/index.cjs +2 -8
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +13 -13
- package/dist/tools/fastapply/openai.cjs +2 -8
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +7 -7
- package/dist/tools/fastapply/vercel.cjs +2 -8
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +7 -7
- package/dist/tools/index.cjs +2 -8
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +13 -13
- package/dist/tools/reflex/core.cjs +2 -8
- package/dist/tools/reflex/core.cjs.map +1 -1
- package/dist/tools/reflex/core.js +5 -5
- package/dist/tools/reflex/index.cjs +2 -8
- package/dist/tools/reflex/index.cjs.map +1 -1
- package/dist/tools/reflex/index.js +5 -5
- package/dist/tools/utils/resilience.cjs +2 -8
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +2 -8
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +2 -8
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +11 -11
- package/dist/tools/warp_grep/client.cjs +2 -8
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +10 -10
- package/dist/tools/warp_grep/gemini.cjs +2 -8
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +10 -10
- package/dist/tools/warp_grep/harness.js +6 -6
- package/dist/tools/warp_grep/index.cjs +2 -8
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +14 -14
- package/dist/tools/warp_grep/openai.cjs +2 -8
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +11 -11
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +2 -8
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +11 -11
- package/dist/version.cjs +2 -8
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -8
- package/dist/chunk-GZMUGMOZ.js +0 -9
- package/dist/chunk-GZMUGMOZ.js.map +0 -1
- package/dist/chunk-MPTEH2CO.js.map +0 -1
- package/dist/chunk-QSMGHCAG.js +0 -561
- package/dist/chunk-QSMGHCAG.js.map +0 -1
- package/dist/git/client.cjs +0 -1123
- package/dist/git/client.cjs.map +0 -1
- package/dist/git/client.d.ts +0 -290
- package/dist/git/client.js +0 -14
- package/dist/git/client.js.map +0 -1
- package/dist/git/config.cjs +0 -41
- package/dist/git/config.cjs.map +0 -1
- package/dist/git/config.d.ts +0 -11
- package/dist/git/config.js +0 -17
- package/dist/git/config.js.map +0 -1
- package/dist/git/index.cjs +0 -1133
- package/dist/git/index.cjs.map +0 -1
- package/dist/git/index.d.ts +0 -7
- package/dist/git/index.js +0 -20
- package/dist/git/index.js.map +0 -1
- package/dist/git/types.cjs +0 -19
- package/dist/git/types.cjs.map +0 -1
- package/dist/git/types.d.ts +0 -133
- package/dist/git/types.js +0 -1
- package/dist/git/types.js.map +0 -1
- /package/dist/{chunk-XUMLQ7AJ.js.map → chunk-2BT4UGKH.js.map} +0 -0
- /package/dist/{chunk-FNN5776O.js.map → chunk-2HXELZI5.js.map} +0 -0
- /package/dist/{chunk-JGC6S5SB.js.map → chunk-2XDSHAB5.js.map} +0 -0
- /package/dist/{chunk-LNXRPEMK.js.map → chunk-6YZCPCAY.js.map} +0 -0
- /package/dist/{chunk-KDVOJBKE.js.map → chunk-7QOGUY4A.js.map} +0 -0
- /package/dist/{chunk-H353ZTXC.js.map → chunk-BECYWCEZ.js.map} +0 -0
- /package/dist/{chunk-MUK6LFVY.js.map → chunk-DHGXGVHC.js.map} +0 -0
- /package/dist/{chunk-FC3HXR2Q.js.map → chunk-DNL4DMMS.js.map} +0 -0
- /package/dist/{chunk-QGR6OVVY.js.map → chunk-DW6ZIVCM.js.map} +0 -0
- /package/dist/{chunk-35U2MW77.js.map → chunk-FLWBVHDC.js.map} +0 -0
- /package/dist/{chunk-PSFKWZKR.js.map → chunk-GE5MNVT7.js.map} +0 -0
- /package/dist/{chunk-O3GWJKDO.js.map → chunk-JU6TCHVI.js.map} +0 -0
- /package/dist/{chunk-R5XYEQV6.js.map → chunk-JZJY2XFQ.js.map} +0 -0
- /package/dist/{chunk-DUPKDVNP.js.map → chunk-LRHJVSSD.js.map} +0 -0
- /package/dist/{chunk-HLSOQ7MP.js.map → chunk-NKFAMQF2.js.map} +0 -0
- /package/dist/{chunk-VLZ6PNAD.js.map → chunk-OPNTDMHH.js.map} +0 -0
- /package/dist/{chunk-L7U5WS4B.js.map → chunk-PQCOBN7L.js.map} +0 -0
- /package/dist/{chunk-6FVLHSQ6.js.map → chunk-SVD3YRWM.js.map} +0 -0
- /package/dist/{chunk-LXRSNY7W.js.map → chunk-TJUZAO7T.js.map} +0 -0
- /package/dist/{chunk-BSJVZEHN.js.map → chunk-UOS3XKJD.js.map} +0 -0
- /package/dist/{chunk-SFLWBHK2.js.map → chunk-UZA2ODNU.js.map} +0 -0
- /package/dist/{chunk-H2YBEXR4.js.map → chunk-VGCPVDFP.js.map} +0 -0
- /package/dist/{chunk-K75R3X5V.js.map → chunk-VJD6MF3M.js.map} +0 -0
- /package/dist/{chunk-6P4KCGAG.js.map → chunk-W34BUTVR.js.map} +0 -0
- /package/dist/{chunk-ORDOOXPQ.js.map → chunk-WDLDKJHT.js.map} +0 -0
- /package/dist/{chunk-HHKAZTGY.js.map → chunk-WFOGTZF6.js.map} +0 -0
- /package/dist/{chunk-2YOE44FF.js.map → chunk-WN6YLBEH.js.map} +0 -0
- /package/dist/{chunk-GWFZGS3Z.js.map → chunk-YVKRPVOM.js.map} +0 -0
- /package/dist/{chunk-4YWADZPB.js.map → chunk-ZA3UJRSE.js.map} +0 -0
package/dist/git/index.cjs
DELETED
|
@@ -1,1133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// git/index.ts
|
|
31
|
-
var git_exports = {};
|
|
32
|
-
__export(git_exports, {
|
|
33
|
-
MorphGit: () => MorphGit,
|
|
34
|
-
git: () => import_isomorphic_git2.default,
|
|
35
|
-
http: () => import_node2.default
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(git_exports);
|
|
38
|
-
|
|
39
|
-
// git/client.ts
|
|
40
|
-
var import_isomorphic_git = __toESM(require("isomorphic-git"), 1);
|
|
41
|
-
var import_node = __toESM(require("isomorphic-git/http/node"), 1);
|
|
42
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
43
|
-
|
|
44
|
-
// package.json
|
|
45
|
-
var package_default = {
|
|
46
|
-
name: "@morphllm/morphsdk",
|
|
47
|
-
version: "0.2.195",
|
|
48
|
-
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
49
|
-
type: "module",
|
|
50
|
-
main: "./dist/index.cjs",
|
|
51
|
-
module: "./dist/index.js",
|
|
52
|
-
types: "./dist/index.d.ts",
|
|
53
|
-
exports: {
|
|
54
|
-
".": {
|
|
55
|
-
types: "./dist/index.d.ts",
|
|
56
|
-
import: "./dist/index.js",
|
|
57
|
-
require: "./dist/index.cjs"
|
|
58
|
-
},
|
|
59
|
-
"./logger": {
|
|
60
|
-
types: "./dist/logger.d.ts",
|
|
61
|
-
import: "./dist/logger.js",
|
|
62
|
-
require: "./dist/logger.cjs"
|
|
63
|
-
},
|
|
64
|
-
"./edge": {
|
|
65
|
-
types: "./dist/edge.d.ts",
|
|
66
|
-
import: "./dist/edge.js",
|
|
67
|
-
require: "./dist/edge.cjs"
|
|
68
|
-
},
|
|
69
|
-
"./tools/warp-grep": {
|
|
70
|
-
types: "./dist/tools/warp_grep/index.d.ts",
|
|
71
|
-
import: "./dist/tools/warp_grep/index.js",
|
|
72
|
-
require: "./dist/tools/warp_grep/index.cjs"
|
|
73
|
-
},
|
|
74
|
-
"./tools/warp-grep/openai": {
|
|
75
|
-
types: "./dist/tools/warp_grep/openai.d.ts",
|
|
76
|
-
import: "./dist/tools/warp_grep/openai.js",
|
|
77
|
-
require: "./dist/tools/warp_grep/openai.cjs"
|
|
78
|
-
},
|
|
79
|
-
"./tools/warp-grep/anthropic": {
|
|
80
|
-
types: "./dist/tools/warp_grep/anthropic.d.ts",
|
|
81
|
-
import: "./dist/tools/warp_grep/anthropic.js",
|
|
82
|
-
require: "./dist/tools/warp_grep/anthropic.cjs"
|
|
83
|
-
},
|
|
84
|
-
"./tools/warp-grep/vercel": {
|
|
85
|
-
types: "./dist/tools/warp_grep/vercel.d.ts",
|
|
86
|
-
import: "./dist/tools/warp_grep/vercel.js",
|
|
87
|
-
require: "./dist/tools/warp_grep/vercel.cjs"
|
|
88
|
-
},
|
|
89
|
-
"./tools/warp-grep/client": {
|
|
90
|
-
types: "./dist/tools/warp_grep/client.d.ts",
|
|
91
|
-
import: "./dist/tools/warp_grep/client.js",
|
|
92
|
-
require: "./dist/tools/warp_grep/client.cjs"
|
|
93
|
-
},
|
|
94
|
-
"./tools/warp-grep/gemini": {
|
|
95
|
-
types: "./dist/tools/warp_grep/gemini.d.ts",
|
|
96
|
-
import: "./dist/tools/warp_grep/gemini.js",
|
|
97
|
-
require: "./dist/tools/warp_grep/gemini.cjs"
|
|
98
|
-
},
|
|
99
|
-
"./tools/warp-grep/harness": {
|
|
100
|
-
types: "./dist/tools/warp_grep/harness.d.ts",
|
|
101
|
-
import: "./dist/tools/warp_grep/harness.js",
|
|
102
|
-
require: "./dist/tools/warp_grep/harness.cjs"
|
|
103
|
-
},
|
|
104
|
-
"./tracing": {
|
|
105
|
-
types: "./dist/tracing/index.d.ts",
|
|
106
|
-
import: "./dist/tracing/index.js",
|
|
107
|
-
require: "./dist/tracing/index.cjs"
|
|
108
|
-
},
|
|
109
|
-
"./tracing/otel": {
|
|
110
|
-
types: "./dist/tracing/otel.d.ts",
|
|
111
|
-
import: "./dist/tracing/otel.js",
|
|
112
|
-
require: "./dist/tracing/otel.cjs"
|
|
113
|
-
},
|
|
114
|
-
"./tools/fastapply": {
|
|
115
|
-
types: "./dist/tools/fastapply/index.d.ts",
|
|
116
|
-
import: "./dist/tools/fastapply/index.js",
|
|
117
|
-
require: "./dist/tools/fastapply/index.cjs"
|
|
118
|
-
},
|
|
119
|
-
"./tools/fastapply/anthropic": {
|
|
120
|
-
types: "./dist/tools/fastapply/anthropic.d.ts",
|
|
121
|
-
import: "./dist/tools/fastapply/anthropic.js",
|
|
122
|
-
require: "./dist/tools/fastapply/anthropic.cjs"
|
|
123
|
-
},
|
|
124
|
-
"./tools/fastapply/openai": {
|
|
125
|
-
types: "./dist/tools/fastapply/openai.d.ts",
|
|
126
|
-
import: "./dist/tools/fastapply/openai.js",
|
|
127
|
-
require: "./dist/tools/fastapply/openai.cjs"
|
|
128
|
-
},
|
|
129
|
-
"./tools/fastapply/vercel": {
|
|
130
|
-
types: "./dist/tools/fastapply/vercel.d.ts",
|
|
131
|
-
import: "./dist/tools/fastapply/vercel.js",
|
|
132
|
-
require: "./dist/tools/fastapply/vercel.cjs"
|
|
133
|
-
},
|
|
134
|
-
"./tools/codebase-search": {
|
|
135
|
-
types: "./dist/tools/codebase_search/index.d.ts",
|
|
136
|
-
import: "./dist/tools/codebase_search/index.js",
|
|
137
|
-
require: "./dist/tools/codebase_search/index.cjs"
|
|
138
|
-
},
|
|
139
|
-
"./tools/codebase-search/anthropic": {
|
|
140
|
-
types: "./dist/tools/codebase_search/anthropic.d.ts",
|
|
141
|
-
import: "./dist/tools/codebase_search/anthropic.js",
|
|
142
|
-
require: "./dist/tools/codebase_search/anthropic.cjs"
|
|
143
|
-
},
|
|
144
|
-
"./tools/codebase-search/openai": {
|
|
145
|
-
types: "./dist/tools/codebase_search/openai.d.ts",
|
|
146
|
-
import: "./dist/tools/codebase_search/openai.js",
|
|
147
|
-
require: "./dist/tools/codebase_search/openai.cjs"
|
|
148
|
-
},
|
|
149
|
-
"./tools/codebase-search/vercel": {
|
|
150
|
-
types: "./dist/tools/codebase_search/vercel.d.ts",
|
|
151
|
-
import: "./dist/tools/codebase_search/vercel.js",
|
|
152
|
-
require: "./dist/tools/codebase_search/vercel.cjs"
|
|
153
|
-
},
|
|
154
|
-
"./tools/git": {
|
|
155
|
-
types: "./dist/git/index.d.ts",
|
|
156
|
-
import: "./dist/git/index.js",
|
|
157
|
-
require: "./dist/git/index.cjs"
|
|
158
|
-
},
|
|
159
|
-
"./tools/browser": {
|
|
160
|
-
types: "./dist/tools/browser/index.d.ts",
|
|
161
|
-
import: "./dist/tools/browser/index.js",
|
|
162
|
-
require: "./dist/tools/browser/index.cjs"
|
|
163
|
-
},
|
|
164
|
-
"./tools/browser/anthropic": {
|
|
165
|
-
types: "./dist/tools/browser/anthropic.d.ts",
|
|
166
|
-
import: "./dist/tools/browser/anthropic.js",
|
|
167
|
-
require: "./dist/tools/browser/anthropic.cjs"
|
|
168
|
-
},
|
|
169
|
-
"./tools/browser/openai": {
|
|
170
|
-
types: "./dist/tools/browser/openai.d.ts",
|
|
171
|
-
import: "./dist/tools/browser/openai.js",
|
|
172
|
-
require: "./dist/tools/browser/openai.cjs"
|
|
173
|
-
},
|
|
174
|
-
"./tools/browser/vercel": {
|
|
175
|
-
types: "./dist/tools/browser/vercel.d.ts",
|
|
176
|
-
import: "./dist/tools/browser/vercel.js",
|
|
177
|
-
require: "./dist/tools/browser/vercel.cjs"
|
|
178
|
-
},
|
|
179
|
-
"./tools/browser/profiles": {
|
|
180
|
-
types: "./dist/tools/browser/profiles/index.d.ts",
|
|
181
|
-
import: "./dist/tools/browser/profiles/index.js",
|
|
182
|
-
require: "./dist/tools/browser/profiles/index.cjs"
|
|
183
|
-
},
|
|
184
|
-
"./modelrouter": {
|
|
185
|
-
types: "./dist/modelrouter/index.d.ts",
|
|
186
|
-
import: "./dist/modelrouter/index.js",
|
|
187
|
-
require: "./dist/modelrouter/index.cjs"
|
|
188
|
-
},
|
|
189
|
-
"./tools/compact": {
|
|
190
|
-
types: "./dist/tools/compact/index.d.ts",
|
|
191
|
-
import: "./dist/tools/compact/index.js",
|
|
192
|
-
require: "./dist/tools/compact/index.cjs"
|
|
193
|
-
},
|
|
194
|
-
"./tools/reflex": {
|
|
195
|
-
types: "./dist/tools/reflex/index.d.ts",
|
|
196
|
-
import: "./dist/tools/reflex/index.js",
|
|
197
|
-
require: "./dist/tools/reflex/index.cjs"
|
|
198
|
-
},
|
|
199
|
-
"./tools/traces": {
|
|
200
|
-
types: "./dist/tools/traces/index.d.ts",
|
|
201
|
-
import: "./dist/tools/traces/index.js",
|
|
202
|
-
require: "./dist/tools/traces/index.cjs"
|
|
203
|
-
},
|
|
204
|
-
"./subagents": {
|
|
205
|
-
types: "./dist/subagents/index.d.ts",
|
|
206
|
-
import: "./dist/subagents/index.js",
|
|
207
|
-
require: "./dist/subagents/index.cjs"
|
|
208
|
-
},
|
|
209
|
-
"./subagents/vercel": {
|
|
210
|
-
types: "./dist/subagents/vercel.d.ts",
|
|
211
|
-
import: "./dist/subagents/vercel.js",
|
|
212
|
-
require: "./dist/subagents/vercel.cjs"
|
|
213
|
-
},
|
|
214
|
-
"./subagents/anthropic": {
|
|
215
|
-
types: "./dist/subagents/anthropic.d.ts",
|
|
216
|
-
import: "./dist/subagents/anthropic.js",
|
|
217
|
-
require: "./dist/subagents/anthropic.cjs"
|
|
218
|
-
},
|
|
219
|
-
"./ai-sdk": {
|
|
220
|
-
types: "./dist/ai-sdk/index.d.ts",
|
|
221
|
-
import: "./dist/ai-sdk/index.js",
|
|
222
|
-
require: "./dist/ai-sdk/index.cjs"
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
files: [
|
|
226
|
-
"dist/**/*.js",
|
|
227
|
-
"dist/**/*.cjs",
|
|
228
|
-
"dist/**/*.d.ts",
|
|
229
|
-
"dist/**/*.map",
|
|
230
|
-
"!dist/**/__tests__/**",
|
|
231
|
-
"!dist/**/*.test.*"
|
|
232
|
-
],
|
|
233
|
-
scripts: {
|
|
234
|
-
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/traces/index.ts tools/traces/core.ts tools/traces/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve && tsup ai-sdk/index.ts --format esm,cjs --sourcemap --dts --no-clean --out-dir dist/ai-sdk",
|
|
235
|
-
prepare: "npm run build",
|
|
236
|
-
typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
|
|
237
|
-
lint: "eslint .",
|
|
238
|
-
test: "vitest run",
|
|
239
|
-
"test:watch": "vitest watch",
|
|
240
|
-
"test:anthropic": "vitest run anthropic",
|
|
241
|
-
"test:openai": "vitest run openai",
|
|
242
|
-
"test:vercel": "vitest run vercel",
|
|
243
|
-
"test:git": "vitest run git",
|
|
244
|
-
"test:browser": "vitest run browser",
|
|
245
|
-
"test:agent": "npx tsx tests/fullAgentTest.ts",
|
|
246
|
-
"test:integration": "npx tsx tests/fullIntegrationTest.ts",
|
|
247
|
-
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
248
|
-
"release:patch": "npm version patch && npm publish",
|
|
249
|
-
"release:minor": "npm version minor && npm publish",
|
|
250
|
-
"release:major": "npm version major && npm publish"
|
|
251
|
-
},
|
|
252
|
-
keywords: [
|
|
253
|
-
"morph",
|
|
254
|
-
"fast-apply",
|
|
255
|
-
"cli",
|
|
256
|
-
"sdk",
|
|
257
|
-
"edit-file"
|
|
258
|
-
],
|
|
259
|
-
engines: {
|
|
260
|
-
node: ">=18"
|
|
261
|
-
},
|
|
262
|
-
license: "MIT",
|
|
263
|
-
dependencies: {
|
|
264
|
-
"@opentelemetry/api": "^1.9.0",
|
|
265
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
|
|
266
|
-
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
267
|
-
"@traceloop/node-server-sdk": "^0.27.0",
|
|
268
|
-
"@vscode/ripgrep": "^1.17.0",
|
|
269
|
-
ai: ">=5.0.0",
|
|
270
|
-
diff: "^7.0.0",
|
|
271
|
-
"isomorphic-git": "^1.25.10",
|
|
272
|
-
openai: "^4.52.7",
|
|
273
|
-
zod: ">=3.23.0"
|
|
274
|
-
},
|
|
275
|
-
devDependencies: {
|
|
276
|
-
"@ai-sdk/anthropic": "^2.0.70",
|
|
277
|
-
"@ai-sdk/openai": "^2.0.35",
|
|
278
|
-
"@anthropic-ai/sdk": "^0.30.1",
|
|
279
|
-
"@google/generative-ai": "^0.24.1",
|
|
280
|
-
"@types/diff": "^7.0.2",
|
|
281
|
-
"@types/node": "^20.14.10",
|
|
282
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
283
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
284
|
-
dotenv: "^16.4.5",
|
|
285
|
-
eslint: "^8.57.0",
|
|
286
|
-
shx: "^0.3.4",
|
|
287
|
-
tsup: "^8.5.0",
|
|
288
|
-
tsx: "^4.16.2",
|
|
289
|
-
typescript: "^5.5.4",
|
|
290
|
-
vitest: "^2.1.6"
|
|
291
|
-
},
|
|
292
|
-
peerDependencies: {
|
|
293
|
-
"@ai-sdk/openai-compatible": ">=2.0.74 <4",
|
|
294
|
-
"@anthropic-ai/sdk": ">=0.25.0",
|
|
295
|
-
"@google/generative-ai": ">=0.21.0",
|
|
296
|
-
ai: ">=5.0.0",
|
|
297
|
-
zod: ">=3.23.0"
|
|
298
|
-
},
|
|
299
|
-
peerDependenciesMeta: {
|
|
300
|
-
"@anthropic-ai/sdk": {
|
|
301
|
-
optional: true
|
|
302
|
-
},
|
|
303
|
-
"@google/generative-ai": {
|
|
304
|
-
optional: true
|
|
305
|
-
},
|
|
306
|
-
ai: {
|
|
307
|
-
optional: true
|
|
308
|
-
},
|
|
309
|
-
zod: {
|
|
310
|
-
optional: true
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
publishConfig: {
|
|
314
|
-
access: "public"
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// version.ts
|
|
319
|
-
var SDK_VERSION = package_default.version;
|
|
320
|
-
|
|
321
|
-
// tools/utils/resilience.ts
|
|
322
|
-
var DEFAULT_RETRY_CONFIG = {
|
|
323
|
-
maxRetries: 3,
|
|
324
|
-
initialDelay: 1e3,
|
|
325
|
-
maxDelay: 3e4,
|
|
326
|
-
backoffMultiplier: 2,
|
|
327
|
-
retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
|
|
328
|
-
};
|
|
329
|
-
async function fetchWithRetry(url, options, retryConfig = {}) {
|
|
330
|
-
const {
|
|
331
|
-
maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
|
|
332
|
-
initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
|
|
333
|
-
maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
|
|
334
|
-
backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
|
|
335
|
-
retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
336
|
-
onRetry
|
|
337
|
-
} = retryConfig;
|
|
338
|
-
let lastError = null;
|
|
339
|
-
let delay = initialDelay;
|
|
340
|
-
options = { ...options, headers: { "X-Morph-SDK-Version": SDK_VERSION, ...options.headers } };
|
|
341
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
342
|
-
try {
|
|
343
|
-
const response = await fetch(url, options);
|
|
344
|
-
if (response.status === 429 || response.status === 503) {
|
|
345
|
-
if (attempt < maxRetries) {
|
|
346
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
347
|
-
const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
|
|
348
|
-
const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
|
|
349
|
-
if (onRetry) {
|
|
350
|
-
onRetry(attempt + 1, error);
|
|
351
|
-
}
|
|
352
|
-
await sleep(waitTime);
|
|
353
|
-
delay *= backoffMultiplier;
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return response;
|
|
358
|
-
} catch (error) {
|
|
359
|
-
lastError = error;
|
|
360
|
-
const isRetryable = retryableErrors.some(
|
|
361
|
-
(errType) => lastError?.message?.includes(errType)
|
|
362
|
-
);
|
|
363
|
-
if (!isRetryable || attempt === maxRetries) {
|
|
364
|
-
throw lastError;
|
|
365
|
-
}
|
|
366
|
-
const waitTime = Math.min(delay, maxDelay);
|
|
367
|
-
if (onRetry) {
|
|
368
|
-
onRetry(attempt + 1, lastError);
|
|
369
|
-
}
|
|
370
|
-
await sleep(waitTime);
|
|
371
|
-
delay *= backoffMultiplier;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
throw lastError || new Error("Max retries exceeded");
|
|
375
|
-
}
|
|
376
|
-
async function withTimeout(promise, timeoutMs, errorMessage) {
|
|
377
|
-
let timeoutId;
|
|
378
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
379
|
-
timeoutId = setTimeout(() => {
|
|
380
|
-
reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
|
|
381
|
-
}, timeoutMs);
|
|
382
|
-
});
|
|
383
|
-
try {
|
|
384
|
-
const result = await Promise.race([promise, timeoutPromise]);
|
|
385
|
-
clearTimeout(timeoutId);
|
|
386
|
-
return result;
|
|
387
|
-
} catch (error) {
|
|
388
|
-
clearTimeout(timeoutId);
|
|
389
|
-
throw error;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
function sleep(ms) {
|
|
393
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
394
|
-
}
|
|
395
|
-
var MorphError = class extends Error {
|
|
396
|
-
constructor(message, code, statusCode, retryable = false) {
|
|
397
|
-
super(message);
|
|
398
|
-
this.code = code;
|
|
399
|
-
this.statusCode = statusCode;
|
|
400
|
-
this.retryable = retryable;
|
|
401
|
-
this.name = "MorphError";
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
// logger.ts
|
|
406
|
-
var MorphLogger = class {
|
|
407
|
-
enabled;
|
|
408
|
-
fileStream;
|
|
409
|
-
/** Resolves once the file stream is initialized (or immediately if no file logging). */
|
|
410
|
-
ready;
|
|
411
|
-
constructor() {
|
|
412
|
-
this.enabled = typeof process !== "undefined" && (process.env.MORPH_DEBUG === "1" || !!process.env.MORPH_LOG_FILE);
|
|
413
|
-
this.fileStream = null;
|
|
414
|
-
const f = typeof process !== "undefined" ? process.env.MORPH_LOG_FILE : void 0;
|
|
415
|
-
if (f) {
|
|
416
|
-
this.ready = import("fs").then((fs2) => {
|
|
417
|
-
this.fileStream = fs2.createWriteStream(f, { flags: "a" });
|
|
418
|
-
}).catch(() => {
|
|
419
|
-
});
|
|
420
|
-
} else {
|
|
421
|
-
this.ready = Promise.resolve();
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
debug(component, msg, data) {
|
|
425
|
-
this._log("debug", component, msg, data);
|
|
426
|
-
}
|
|
427
|
-
info(component, msg, data) {
|
|
428
|
-
this._log("info", component, msg, data);
|
|
429
|
-
}
|
|
430
|
-
warn(component, msg, data) {
|
|
431
|
-
this._log("warn", component, msg, data);
|
|
432
|
-
}
|
|
433
|
-
error(component, msg, data) {
|
|
434
|
-
this._log("error", component, msg, data);
|
|
435
|
-
}
|
|
436
|
-
enable() {
|
|
437
|
-
this.enabled = true;
|
|
438
|
-
}
|
|
439
|
-
get isEnabled() {
|
|
440
|
-
return this.enabled;
|
|
441
|
-
}
|
|
442
|
-
_log(level, component, msg, data) {
|
|
443
|
-
if (level !== "error" && !this.enabled) return;
|
|
444
|
-
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
445
|
-
const prefix = `[${ts}] [${level.toUpperCase()}] [${component}]`;
|
|
446
|
-
console.error(data ? `${prefix} ${msg} ${JSON.stringify(data)}` : `${prefix} ${msg}`);
|
|
447
|
-
this.fileStream?.write(JSON.stringify({ ts, level, component, msg, ...data && { data } }) + "\n");
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
var logger = new MorphLogger();
|
|
451
|
-
|
|
452
|
-
// core/error.ts
|
|
453
|
-
async function toMorphError(response) {
|
|
454
|
-
let message = `Morph API request failed (${response.status})`;
|
|
455
|
-
let code = "api_error";
|
|
456
|
-
try {
|
|
457
|
-
const body = await response.json();
|
|
458
|
-
message = body.error?.message ?? body.message ?? message;
|
|
459
|
-
code = body.error?.code ?? body.error?.type ?? code;
|
|
460
|
-
} catch {
|
|
461
|
-
}
|
|
462
|
-
if (response.status === 401) code = "authentication_error";
|
|
463
|
-
if (response.status === 429) code = "rate_limit_exceeded";
|
|
464
|
-
const retryable = response.status === 429 || response.status === 503;
|
|
465
|
-
return new MorphError(message, code, response.status, retryable);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// core/client.ts
|
|
469
|
-
var DEFAULT_BASE_URL = "https://api.morphllm.com";
|
|
470
|
-
var DEFAULT_REPOS_URL = "https://repos.morphllm.com";
|
|
471
|
-
var DEFAULT_BROWSER_URL = "https://browser.morphllm.com";
|
|
472
|
-
var DEFAULT_TIMEOUT = 6e4;
|
|
473
|
-
var env = (name) => typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
474
|
-
var stripTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
475
|
-
var MorphAPIClient = class {
|
|
476
|
-
/** Explicit key as provided; resolved against env at request time. */
|
|
477
|
-
apiKey;
|
|
478
|
-
baseURL;
|
|
479
|
-
reposURL;
|
|
480
|
-
browserURL;
|
|
481
|
-
/** Explicit default timeout (ms), if set. The request default is applied lazily so
|
|
482
|
-
* resources can read an undefined value and supply their own fallback. */
|
|
483
|
-
timeout;
|
|
484
|
-
retryConfig;
|
|
485
|
-
debug;
|
|
486
|
-
constructor(options = {}) {
|
|
487
|
-
this.apiKey = options.apiKey;
|
|
488
|
-
this.baseURL = stripTrailingSlash(options.baseURL ?? DEFAULT_BASE_URL);
|
|
489
|
-
this.reposURL = stripTrailingSlash(options.reposURL ?? env("MORPH_SEARCH_URL") ?? DEFAULT_REPOS_URL);
|
|
490
|
-
this.browserURL = stripTrailingSlash(
|
|
491
|
-
options.browserURL ?? (env("MORPH_ENVIRONMENT") === "DEV" ? "http://localhost:8000" : DEFAULT_BROWSER_URL)
|
|
492
|
-
);
|
|
493
|
-
this.timeout = options.timeout;
|
|
494
|
-
this.retryConfig = options.retryConfig;
|
|
495
|
-
this.debug = options.debug ?? false;
|
|
496
|
-
if (this.debug) logger.enable();
|
|
497
|
-
}
|
|
498
|
-
/** The key actually used for requests: explicit, else `MORPH_API_KEY`. */
|
|
499
|
-
resolveApiKey() {
|
|
500
|
-
return this.apiKey ?? env("MORPH_API_KEY");
|
|
501
|
-
}
|
|
502
|
-
/** Headers shared with tools that bring their own HTTP client (FastApply/WarpGrep via the `openai` package). */
|
|
503
|
-
defaultHeaders() {
|
|
504
|
-
return { "X-Morph-SDK-Version": SDK_VERSION };
|
|
505
|
-
}
|
|
506
|
-
buildURL(path, baseURL) {
|
|
507
|
-
if (/^https?:\/\//i.test(path)) return path;
|
|
508
|
-
const base = stripTrailingSlash(baseURL ?? this.baseURL);
|
|
509
|
-
return `${base}${path.startsWith("/") ? "" : "/"}${path}`;
|
|
510
|
-
}
|
|
511
|
-
buildHeaders(apiKey, extra) {
|
|
512
|
-
return {
|
|
513
|
-
"Content-Type": "application/json",
|
|
514
|
-
"X-Morph-SDK-Version": SDK_VERSION,
|
|
515
|
-
Authorization: `Bearer ${apiKey}`,
|
|
516
|
-
...extra
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
applyQuery(url, query) {
|
|
520
|
-
if (!query) return url;
|
|
521
|
-
const params = new URLSearchParams();
|
|
522
|
-
for (const [key, value] of Object.entries(query)) {
|
|
523
|
-
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
524
|
-
}
|
|
525
|
-
const qs = params.toString();
|
|
526
|
-
return qs ? `${url}${url.includes("?") ? "&" : "?"}${qs}` : url;
|
|
527
|
-
}
|
|
528
|
-
async request(method, path, opts = {}) {
|
|
529
|
-
const apiKey = this.resolveApiKey();
|
|
530
|
-
if (!apiKey) {
|
|
531
|
-
throw new MorphError(
|
|
532
|
-
"Morph API key not found. Set the MORPH_API_KEY environment variable or pass apiKey in config.",
|
|
533
|
-
"missing_api_key",
|
|
534
|
-
401
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
const url = this.applyQuery(this.buildURL(path, opts.baseURL), opts.query);
|
|
538
|
-
const timeout = opts.timeout ?? this.timeout ?? DEFAULT_TIMEOUT;
|
|
539
|
-
const init = {
|
|
540
|
-
method,
|
|
541
|
-
headers: this.buildHeaders(apiKey, opts.headers),
|
|
542
|
-
...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {},
|
|
543
|
-
...opts.signal ? { signal: opts.signal } : {}
|
|
544
|
-
};
|
|
545
|
-
logger.debug("MorphAPIClient", "request", { method, url });
|
|
546
|
-
const response = await withTimeout(
|
|
547
|
-
fetchWithRetry(url, init, this.retryConfig ?? {}),
|
|
548
|
-
timeout,
|
|
549
|
-
`Morph request to ${url} timed out after ${timeout}ms`
|
|
550
|
-
);
|
|
551
|
-
if (opts.raw) return response;
|
|
552
|
-
if (!response.ok) throw await toMorphError(response);
|
|
553
|
-
if (opts.stream) return response;
|
|
554
|
-
if (response.status === 204) return void 0;
|
|
555
|
-
const text = await response.text();
|
|
556
|
-
return text ? JSON.parse(text) : void 0;
|
|
557
|
-
}
|
|
558
|
-
get(path, opts) {
|
|
559
|
-
return this.request("GET", path, opts);
|
|
560
|
-
}
|
|
561
|
-
post(path, opts) {
|
|
562
|
-
return this.request("POST", path, opts);
|
|
563
|
-
}
|
|
564
|
-
delete(path, opts) {
|
|
565
|
-
return this.request("DELETE", path, opts);
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
// core/resource.ts
|
|
570
|
-
var APIResource = class {
|
|
571
|
-
_client;
|
|
572
|
-
constructor(client) {
|
|
573
|
-
this._client = client;
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
// git/client.ts
|
|
578
|
-
var DEFAULT_PROXY_URL = "https://repos.morphllm.com";
|
|
579
|
-
var MorphGit = class extends APIResource {
|
|
580
|
-
apiKey;
|
|
581
|
-
proxyUrl;
|
|
582
|
-
constructor(clientOrConfig) {
|
|
583
|
-
const isClient = clientOrConfig instanceof MorphAPIClient;
|
|
584
|
-
if (!isClient) {
|
|
585
|
-
if (!clientOrConfig.apiKey) {
|
|
586
|
-
throw new Error("API key is required. Get one at https://morphllm.com/dashboard");
|
|
587
|
-
}
|
|
588
|
-
if (!clientOrConfig.apiKey.startsWith("sk-") && !clientOrConfig.apiKey.startsWith("morph-")) {
|
|
589
|
-
throw new Error("Invalid API key format. Expected: sk-... or morph-...");
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
super(
|
|
593
|
-
isClient ? clientOrConfig : new MorphAPIClient({
|
|
594
|
-
apiKey: clientOrConfig.apiKey,
|
|
595
|
-
reposURL: clientOrConfig.proxyUrl,
|
|
596
|
-
retryConfig: clientOrConfig.retryConfig
|
|
597
|
-
})
|
|
598
|
-
);
|
|
599
|
-
this.apiKey = this._client.resolveApiKey() ?? "";
|
|
600
|
-
this.proxyUrl = isClient ? this._client.reposURL : clientOrConfig.proxyUrl || DEFAULT_PROXY_URL;
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Get auth callback for isomorphic-git operations
|
|
604
|
-
* @private
|
|
605
|
-
*/
|
|
606
|
-
getAuthCallback() {
|
|
607
|
-
return () => ({
|
|
608
|
-
username: "morph",
|
|
609
|
-
password: this.apiKey
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* Initialize a new repository
|
|
614
|
-
* Creates the repo in the database and in the git provider
|
|
615
|
-
*
|
|
616
|
-
* @example
|
|
617
|
-
* ```ts
|
|
618
|
-
* await morphGit.init({
|
|
619
|
-
* repoId: 'my-project',
|
|
620
|
-
* dir: './my-project',
|
|
621
|
-
* defaultBranch: 'main'
|
|
622
|
-
* });
|
|
623
|
-
* ```
|
|
624
|
-
*/
|
|
625
|
-
async init(options) {
|
|
626
|
-
const { repoId, dir, defaultBranch = "main" } = options;
|
|
627
|
-
const response = await fetch(`${this.proxyUrl}/v1/repos`, {
|
|
628
|
-
method: "POST",
|
|
629
|
-
headers: {
|
|
630
|
-
"Authorization": `Bearer ${this.apiKey}`,
|
|
631
|
-
"Content-Type": "application/json"
|
|
632
|
-
},
|
|
633
|
-
body: JSON.stringify({
|
|
634
|
-
repoId,
|
|
635
|
-
name: repoId,
|
|
636
|
-
defaultBranch
|
|
637
|
-
})
|
|
638
|
-
});
|
|
639
|
-
if (!response.ok) {
|
|
640
|
-
const error = await response.text();
|
|
641
|
-
throw new Error(`Failed to create repository: ${error}`);
|
|
642
|
-
}
|
|
643
|
-
await import_isomorphic_git.default.init({
|
|
644
|
-
fs: import_fs.default,
|
|
645
|
-
dir,
|
|
646
|
-
defaultBranch
|
|
647
|
-
});
|
|
648
|
-
await import_isomorphic_git.default.addRemote({
|
|
649
|
-
fs: import_fs.default,
|
|
650
|
-
dir,
|
|
651
|
-
remote: "origin",
|
|
652
|
-
url: `${this.proxyUrl}/v1/repos/${repoId}`
|
|
653
|
-
});
|
|
654
|
-
console.log(`\u2713 Repository '${repoId}' initialized`);
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Clone a repository from Morph repos
|
|
658
|
-
*
|
|
659
|
-
* @example
|
|
660
|
-
* ```ts
|
|
661
|
-
* await morphGit.clone({
|
|
662
|
-
* repoId: 'my-project',
|
|
663
|
-
* dir: './my-project'
|
|
664
|
-
* });
|
|
665
|
-
* ```
|
|
666
|
-
*/
|
|
667
|
-
async clone(options) {
|
|
668
|
-
const { repoId, dir, branch = "main", depth, singleBranch = true } = options;
|
|
669
|
-
await import_isomorphic_git.default.clone({
|
|
670
|
-
fs: import_fs.default,
|
|
671
|
-
http: import_node.default,
|
|
672
|
-
dir,
|
|
673
|
-
url: `${this.proxyUrl}/v1/repos/${repoId}`,
|
|
674
|
-
ref: branch,
|
|
675
|
-
singleBranch,
|
|
676
|
-
depth,
|
|
677
|
-
onAuth: this.getAuthCallback()
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Push changes to remote repository
|
|
682
|
-
*
|
|
683
|
-
* @example
|
|
684
|
-
* ```ts
|
|
685
|
-
* await morphGit.push({
|
|
686
|
-
* dir: './my-project',
|
|
687
|
-
* branch: 'main', // Required: explicit branch name
|
|
688
|
-
* index: true // Optional: generate embeddings for semantic search
|
|
689
|
-
* });
|
|
690
|
-
* ```
|
|
691
|
-
*/
|
|
692
|
-
async push(options) {
|
|
693
|
-
const { dir, remote = "origin", branch, waitForEmbeddings, index = false } = options;
|
|
694
|
-
if (!branch) {
|
|
695
|
-
throw new Error(
|
|
696
|
-
'branch is required for push operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
|
|
697
|
-
);
|
|
698
|
-
}
|
|
699
|
-
const commitHash = await import_isomorphic_git.default.resolveRef({ fs: import_fs.default, dir, ref: "HEAD" });
|
|
700
|
-
let repoId;
|
|
701
|
-
const remotes = await import_isomorphic_git.default.listRemotes({ fs: import_fs.default, dir });
|
|
702
|
-
const originRemote = remotes.find((r) => r.remote === remote);
|
|
703
|
-
if (originRemote) {
|
|
704
|
-
const match = originRemote.url.match(/\/repos\/([^\/]+)$/);
|
|
705
|
-
if (match) {
|
|
706
|
-
repoId = match[1];
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
await import_isomorphic_git.default.push({
|
|
710
|
-
fs: import_fs.default,
|
|
711
|
-
http: import_node.default,
|
|
712
|
-
dir,
|
|
713
|
-
remote,
|
|
714
|
-
ref: branch,
|
|
715
|
-
onAuth: this.getAuthCallback()
|
|
716
|
-
});
|
|
717
|
-
if (repoId && commitHash) {
|
|
718
|
-
await this.configureCommit({ repoId, commitHash, branch, index });
|
|
719
|
-
}
|
|
720
|
-
if (waitForEmbeddings && repoId && commitHash && index) {
|
|
721
|
-
await this.waitForEmbeddings({ repoId, commitHash });
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Configure commit settings on the backend after push.
|
|
726
|
-
* Sets the index flag to control embedding generation.
|
|
727
|
-
* @private
|
|
728
|
-
*/
|
|
729
|
-
async configureCommit(options) {
|
|
730
|
-
const { repoId, commitHash, branch, index } = options;
|
|
731
|
-
const response = await fetch(
|
|
732
|
-
`${this.proxyUrl}/v1/repos/${repoId}/commits/${commitHash}/config`,
|
|
733
|
-
{
|
|
734
|
-
method: "POST",
|
|
735
|
-
headers: {
|
|
736
|
-
"Authorization": `Bearer ${this.apiKey}`,
|
|
737
|
-
"Content-Type": "application/json"
|
|
738
|
-
},
|
|
739
|
-
body: JSON.stringify({ index, branch })
|
|
740
|
-
}
|
|
741
|
-
);
|
|
742
|
-
if (!response.ok) {
|
|
743
|
-
console.warn(`Failed to configure commit: ${response.status}`);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Pull changes from remote repository
|
|
748
|
-
*
|
|
749
|
-
* @example
|
|
750
|
-
* ```ts
|
|
751
|
-
* await morphGit.pull({
|
|
752
|
-
* dir: './my-project',
|
|
753
|
-
* branch: 'main' // Required: explicit branch name
|
|
754
|
-
* });
|
|
755
|
-
* ```
|
|
756
|
-
*/
|
|
757
|
-
async pull(options) {
|
|
758
|
-
const { dir, remote = "origin", branch } = options;
|
|
759
|
-
if (!branch) {
|
|
760
|
-
throw new Error(
|
|
761
|
-
'branch is required for pull operations. Specify the branch explicitly: { dir: "./my-project", branch: "main" }'
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
await import_isomorphic_git.default.pull({
|
|
765
|
-
fs: import_fs.default,
|
|
766
|
-
http: import_node.default,
|
|
767
|
-
dir,
|
|
768
|
-
remote,
|
|
769
|
-
ref: branch,
|
|
770
|
-
onAuth: this.getAuthCallback(),
|
|
771
|
-
author: {
|
|
772
|
-
name: "Morph Agent",
|
|
773
|
-
email: "agent@morph.com"
|
|
774
|
-
}
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Wait for embeddings to complete after push.
|
|
779
|
-
* Polls status endpoint until embeddings are done.
|
|
780
|
-
*
|
|
781
|
-
* @example
|
|
782
|
-
* ```ts
|
|
783
|
-
* await morphGit.push({ dir: './my-project', branch: 'main' });
|
|
784
|
-
* await morphGit.waitForEmbeddings({
|
|
785
|
-
* repoId: 'my-project',
|
|
786
|
-
* onProgress: (p) => console.log(`${p.filesProcessed}/${p.totalFiles}`)
|
|
787
|
-
* });
|
|
788
|
-
* ```
|
|
789
|
-
*/
|
|
790
|
-
async waitForEmbeddings(options) {
|
|
791
|
-
const { repoId, commitHash, timeout = 12e4, onProgress } = options;
|
|
792
|
-
const startTime = Date.now();
|
|
793
|
-
const pollInterval = 1e3;
|
|
794
|
-
while (Date.now() - startTime < timeout) {
|
|
795
|
-
const statusUrl = `${this.proxyUrl}/v1/repos/${repoId}/embedding-status` + (commitHash ? `?commit_hash=${commitHash}` : "");
|
|
796
|
-
const response = await fetch(statusUrl, {
|
|
797
|
-
headers: { "Authorization": `Bearer ${this.apiKey}` }
|
|
798
|
-
});
|
|
799
|
-
if (response.status === 404) {
|
|
800
|
-
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
801
|
-
continue;
|
|
802
|
-
}
|
|
803
|
-
if (!response.ok) {
|
|
804
|
-
throw new Error(`Failed to get embedding status: ${response.status}`);
|
|
805
|
-
}
|
|
806
|
-
const status = await response.json();
|
|
807
|
-
if (onProgress && status.progress) {
|
|
808
|
-
onProgress(status.progress);
|
|
809
|
-
}
|
|
810
|
-
if (status.status === "completed") {
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
if (status.status === "failed") {
|
|
814
|
-
throw new Error(`Embeddings failed: ${status.error || "Unknown error"}`);
|
|
815
|
-
}
|
|
816
|
-
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
817
|
-
}
|
|
818
|
-
throw new Error(`Embeddings timed out after ${timeout}ms`);
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Stage a file for commit
|
|
822
|
-
*
|
|
823
|
-
* @example
|
|
824
|
-
* ```ts
|
|
825
|
-
* await morphGit.add({
|
|
826
|
-
* dir: './my-project',
|
|
827
|
-
* filepath: 'src/app.ts'
|
|
828
|
-
* });
|
|
829
|
-
* ```
|
|
830
|
-
*/
|
|
831
|
-
async add(options) {
|
|
832
|
-
const { dir, filepath } = options;
|
|
833
|
-
await import_isomorphic_git.default.add({
|
|
834
|
-
fs: import_fs.default,
|
|
835
|
-
dir,
|
|
836
|
-
filepath
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Remove a file from staging
|
|
841
|
-
*
|
|
842
|
-
* @example
|
|
843
|
-
* ```ts
|
|
844
|
-
* await morphGit.remove({
|
|
845
|
-
* dir: './my-project',
|
|
846
|
-
* filepath: 'src/old-file.ts'
|
|
847
|
-
* });
|
|
848
|
-
* ```
|
|
849
|
-
*/
|
|
850
|
-
async remove(options) {
|
|
851
|
-
const { dir, filepath } = options;
|
|
852
|
-
await import_isomorphic_git.default.remove({
|
|
853
|
-
fs: import_fs.default,
|
|
854
|
-
dir,
|
|
855
|
-
filepath
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
/**
|
|
859
|
-
* Commit staged changes
|
|
860
|
-
*
|
|
861
|
-
* @example
|
|
862
|
-
* ```ts
|
|
863
|
-
* await morphGit.commit({
|
|
864
|
-
* dir: './my-project',
|
|
865
|
-
* message: 'Add new feature',
|
|
866
|
-
* author: {
|
|
867
|
-
* name: 'AI Agent',
|
|
868
|
-
* email: 'ai@example.com'
|
|
869
|
-
* },
|
|
870
|
-
* metadata: { issueId: 'PROJ-123', source: 'agent' },
|
|
871
|
-
* chatHistory: [
|
|
872
|
-
* { role: 'user', content: 'Please add a new feature' },
|
|
873
|
-
* { role: 'assistant', content: 'I will add that feature' }
|
|
874
|
-
* ],
|
|
875
|
-
* recordingId: 'rec_123'
|
|
876
|
-
* });
|
|
877
|
-
* ```
|
|
878
|
-
*/
|
|
879
|
-
async commit(options) {
|
|
880
|
-
const { dir, message, author, metadata, chatHistory, recordingId } = options;
|
|
881
|
-
const commitAuthor = author || {
|
|
882
|
-
name: "Morph SDK",
|
|
883
|
-
email: "sdk@morphllm.com"
|
|
884
|
-
};
|
|
885
|
-
const sha = await import_isomorphic_git.default.commit({
|
|
886
|
-
fs: import_fs.default,
|
|
887
|
-
dir,
|
|
888
|
-
message,
|
|
889
|
-
author: commitAuthor
|
|
890
|
-
});
|
|
891
|
-
if (metadata || chatHistory || recordingId) {
|
|
892
|
-
const notes = {
|
|
893
|
-
metadata,
|
|
894
|
-
chatHistory,
|
|
895
|
-
recordingId,
|
|
896
|
-
_version: 1
|
|
897
|
-
};
|
|
898
|
-
await import_isomorphic_git.default.addNote({
|
|
899
|
-
fs: import_fs.default,
|
|
900
|
-
dir,
|
|
901
|
-
ref: "refs/notes/morph-metadata",
|
|
902
|
-
oid: sha,
|
|
903
|
-
note: JSON.stringify(notes, null, 2),
|
|
904
|
-
author: commitAuthor
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
return sha;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Get status of a file
|
|
911
|
-
*
|
|
912
|
-
* @example
|
|
913
|
-
* ```ts
|
|
914
|
-
* const status = await morphGit.status({
|
|
915
|
-
* dir: './my-project',
|
|
916
|
-
* filepath: 'src/app.ts'
|
|
917
|
-
* });
|
|
918
|
-
* console.log(status); // 'modified', '*added', etc.
|
|
919
|
-
* ```
|
|
920
|
-
*/
|
|
921
|
-
async status(options) {
|
|
922
|
-
const { dir, filepath } = options;
|
|
923
|
-
if (!filepath) {
|
|
924
|
-
throw new Error("filepath is required for status check");
|
|
925
|
-
}
|
|
926
|
-
const status = await import_isomorphic_git.default.status({
|
|
927
|
-
fs: import_fs.default,
|
|
928
|
-
dir,
|
|
929
|
-
filepath
|
|
930
|
-
});
|
|
931
|
-
return status;
|
|
932
|
-
}
|
|
933
|
-
/**
|
|
934
|
-
* Get commit history
|
|
935
|
-
*
|
|
936
|
-
* @example
|
|
937
|
-
* ```ts
|
|
938
|
-
* const commits = await morphGit.log({
|
|
939
|
-
* dir: './my-project',
|
|
940
|
-
* depth: 10
|
|
941
|
-
* });
|
|
942
|
-
* ```
|
|
943
|
-
*/
|
|
944
|
-
async log(options) {
|
|
945
|
-
const { dir, depth, ref } = options;
|
|
946
|
-
const commits = await import_isomorphic_git.default.log({
|
|
947
|
-
fs: import_fs.default,
|
|
948
|
-
dir,
|
|
949
|
-
depth,
|
|
950
|
-
ref
|
|
951
|
-
});
|
|
952
|
-
return commits;
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Checkout a branch or commit
|
|
956
|
-
*
|
|
957
|
-
* @example
|
|
958
|
-
* ```ts
|
|
959
|
-
* await morphGit.checkout({
|
|
960
|
-
* dir: './my-project',
|
|
961
|
-
* ref: 'feature-branch'
|
|
962
|
-
* });
|
|
963
|
-
* ```
|
|
964
|
-
*/
|
|
965
|
-
async checkout(options) {
|
|
966
|
-
const { dir, ref } = options;
|
|
967
|
-
await import_isomorphic_git.default.checkout({
|
|
968
|
-
fs: import_fs.default,
|
|
969
|
-
dir,
|
|
970
|
-
ref
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Create a new branch
|
|
975
|
-
*
|
|
976
|
-
* @example
|
|
977
|
-
* ```ts
|
|
978
|
-
* await morphGit.branch({
|
|
979
|
-
* dir: './my-project',
|
|
980
|
-
* name: 'feature-branch',
|
|
981
|
-
* checkout: true
|
|
982
|
-
* });
|
|
983
|
-
* ```
|
|
984
|
-
*/
|
|
985
|
-
async branch(options) {
|
|
986
|
-
const { dir, name, checkout = false } = options;
|
|
987
|
-
await import_isomorphic_git.default.branch({
|
|
988
|
-
fs: import_fs.default,
|
|
989
|
-
dir,
|
|
990
|
-
ref: name,
|
|
991
|
-
checkout
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* List all branches
|
|
996
|
-
*
|
|
997
|
-
* @example
|
|
998
|
-
* ```ts
|
|
999
|
-
* const branches = await morphGit.listBranches({
|
|
1000
|
-
* dir: './my-project'
|
|
1001
|
-
* });
|
|
1002
|
-
* ```
|
|
1003
|
-
*/
|
|
1004
|
-
async listBranches(options) {
|
|
1005
|
-
const { dir } = options;
|
|
1006
|
-
const branches = await import_isomorphic_git.default.listBranches({
|
|
1007
|
-
fs: import_fs.default,
|
|
1008
|
-
dir
|
|
1009
|
-
});
|
|
1010
|
-
return branches;
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Get the current branch name
|
|
1014
|
-
*
|
|
1015
|
-
* @example
|
|
1016
|
-
* ```ts
|
|
1017
|
-
* const branch = await morphGit.currentBranch({
|
|
1018
|
-
* dir: './my-project'
|
|
1019
|
-
* });
|
|
1020
|
-
* ```
|
|
1021
|
-
*/
|
|
1022
|
-
async currentBranch(options) {
|
|
1023
|
-
const { dir } = options;
|
|
1024
|
-
const branch = await import_isomorphic_git.default.currentBranch({
|
|
1025
|
-
fs: import_fs.default,
|
|
1026
|
-
dir
|
|
1027
|
-
});
|
|
1028
|
-
return branch || void 0;
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* Get list of changed files (similar to git diff --name-only)
|
|
1032
|
-
*
|
|
1033
|
-
* @example
|
|
1034
|
-
* ```ts
|
|
1035
|
-
* const changes = await morphGit.statusMatrix({
|
|
1036
|
-
* dir: './my-project'
|
|
1037
|
-
* });
|
|
1038
|
-
* ```
|
|
1039
|
-
*/
|
|
1040
|
-
async statusMatrix(options) {
|
|
1041
|
-
const { dir } = options;
|
|
1042
|
-
const matrix = await import_isomorphic_git.default.statusMatrix({
|
|
1043
|
-
fs: import_fs.default,
|
|
1044
|
-
dir
|
|
1045
|
-
});
|
|
1046
|
-
return matrix.map(([filepath, HEADStatus, workdirStatus, stageStatus]) => {
|
|
1047
|
-
let status = "unmodified";
|
|
1048
|
-
if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 2) {
|
|
1049
|
-
status = "modified";
|
|
1050
|
-
} else if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 1) {
|
|
1051
|
-
status = "*modified";
|
|
1052
|
-
} else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 2) {
|
|
1053
|
-
status = "added";
|
|
1054
|
-
} else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 0) {
|
|
1055
|
-
status = "*added";
|
|
1056
|
-
} else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 0) {
|
|
1057
|
-
status = "deleted";
|
|
1058
|
-
} else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 1) {
|
|
1059
|
-
status = "*deleted";
|
|
1060
|
-
} else if (HEADStatus === 1 && workdirStatus === 1 && stageStatus === 1) {
|
|
1061
|
-
status = "unmodified";
|
|
1062
|
-
} else if (HEADStatus === 0 && workdirStatus === 0 && stageStatus === 0) {
|
|
1063
|
-
status = "absent";
|
|
1064
|
-
}
|
|
1065
|
-
return {
|
|
1066
|
-
filepath,
|
|
1067
|
-
status
|
|
1068
|
-
};
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
/**
|
|
1072
|
-
* Get the current commit hash
|
|
1073
|
-
*
|
|
1074
|
-
* @example
|
|
1075
|
-
* ```ts
|
|
1076
|
-
* const hash = await morphGit.resolveRef({
|
|
1077
|
-
* dir: './my-project',
|
|
1078
|
-
* ref: 'HEAD'
|
|
1079
|
-
* });
|
|
1080
|
-
* ```
|
|
1081
|
-
*/
|
|
1082
|
-
async resolveRef(options) {
|
|
1083
|
-
const { dir, ref } = options;
|
|
1084
|
-
const oid = await import_isomorphic_git.default.resolveRef({
|
|
1085
|
-
fs: import_fs.default,
|
|
1086
|
-
dir,
|
|
1087
|
-
ref
|
|
1088
|
-
});
|
|
1089
|
-
return oid;
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* Get notes (metadata, chat history, recording ID) attached to a commit
|
|
1093
|
-
*
|
|
1094
|
-
* @example
|
|
1095
|
-
* ```ts
|
|
1096
|
-
* const notes = await morphGit.getCommitMetadata({
|
|
1097
|
-
* dir: './my-project',
|
|
1098
|
-
* commitSha: 'abc123...'
|
|
1099
|
-
* });
|
|
1100
|
-
*
|
|
1101
|
-
* if (notes) {
|
|
1102
|
-
* console.log('Metadata:', notes.metadata);
|
|
1103
|
-
* console.log('Chat history:', notes.chatHistory);
|
|
1104
|
-
* console.log('Recording ID:', notes.recordingId);
|
|
1105
|
-
* }
|
|
1106
|
-
* ```
|
|
1107
|
-
*/
|
|
1108
|
-
async getCommitMetadata(options) {
|
|
1109
|
-
try {
|
|
1110
|
-
const note = await import_isomorphic_git.default.readNote({
|
|
1111
|
-
fs: import_fs.default,
|
|
1112
|
-
dir: options.dir,
|
|
1113
|
-
ref: "refs/notes/morph-metadata",
|
|
1114
|
-
oid: options.commitSha
|
|
1115
|
-
});
|
|
1116
|
-
const notes = JSON.parse(new TextDecoder().decode(note));
|
|
1117
|
-
return notes;
|
|
1118
|
-
} catch (err) {
|
|
1119
|
-
return null;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
};
|
|
1123
|
-
|
|
1124
|
-
// git/index.ts
|
|
1125
|
-
var import_isomorphic_git2 = __toESM(require("isomorphic-git"), 1);
|
|
1126
|
-
var import_node2 = __toESM(require("isomorphic-git/http/node"), 1);
|
|
1127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1128
|
-
0 && (module.exports = {
|
|
1129
|
-
MorphGit,
|
|
1130
|
-
git,
|
|
1131
|
-
http
|
|
1132
|
-
});
|
|
1133
|
-
//# sourceMappingURL=index.cjs.map
|