@agpm/core 0.0.2 → 0.1.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/dist/cache.d.ts +38 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +118 -0
- package/dist/cache.js.map +1 -0
- package/dist/config.d.ts +46 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +37 -1
- package/dist/config.js.map +1 -1
- package/dist/discovery.d.ts +63 -11
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +189 -77
- package/dist/discovery.js.map +1 -1
- package/dist/git.d.ts +25 -23
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +130 -42
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/targets.d.ts +46 -0
- package/dist/targets.d.ts.map +1 -0
- package/dist/targets.js +84 -0
- package/dist/targets.js.map +1 -0
- package/package.json +11 -1
package/dist/discovery.js
CHANGED
|
@@ -6,6 +6,7 @@ import { parse as parseYaml } from "yaml";
|
|
|
6
6
|
// ============================================================================
|
|
7
7
|
/**
|
|
8
8
|
* Detect the format of a repository.
|
|
9
|
+
* Checks in order of specificity: marketplace > plugin > simple
|
|
9
10
|
*/
|
|
10
11
|
export async function detectFormat(repoPath) {
|
|
11
12
|
// Check for Claude marketplace format (.claude-plugin/marketplace.json)
|
|
@@ -16,6 +17,14 @@ export async function detectFormat(repoPath) {
|
|
|
16
17
|
catch {
|
|
17
18
|
// Not claude-marketplace format
|
|
18
19
|
}
|
|
20
|
+
// Check for Claude plugin format (.claude-plugin/plugin.json)
|
|
21
|
+
try {
|
|
22
|
+
await stat(join(repoPath, ".claude-plugin", "plugin.json"));
|
|
23
|
+
return "claude-plugin";
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Not claude-plugin format
|
|
27
|
+
}
|
|
19
28
|
// Check for simple format (skills/ directory)
|
|
20
29
|
try {
|
|
21
30
|
const skillsStat = await stat(join(repoPath, "skills"));
|
|
@@ -28,18 +37,93 @@ export async function detectFormat(repoPath) {
|
|
|
28
37
|
}
|
|
29
38
|
return "unknown";
|
|
30
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Discover skills from explicit paths (used by marketplace when skills array is defined).
|
|
42
|
+
*/
|
|
43
|
+
async function discoverSkillsFromPaths(repoPath, skillPaths, seenPaths, fallbackDescription) {
|
|
44
|
+
const skills = [];
|
|
45
|
+
for (const skillPath of skillPaths) {
|
|
46
|
+
const normalizedPath = skillPath.replace(/^\.\//, "");
|
|
47
|
+
if (seenPaths.has(normalizedPath))
|
|
48
|
+
continue;
|
|
49
|
+
seenPaths.add(normalizedPath);
|
|
50
|
+
const absolutePath = join(repoPath, normalizedPath);
|
|
51
|
+
const metadata = await parseSkillMd(absolutePath);
|
|
52
|
+
skills.push({
|
|
53
|
+
name: metadata?.name ?? basename(normalizedPath),
|
|
54
|
+
description: metadata?.description ?? fallbackDescription,
|
|
55
|
+
path: normalizedPath,
|
|
56
|
+
absolutePath,
|
|
57
|
+
metadata: metadata,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return skills;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Discover all skills within a directory (used by plugin.json and marketplace fallback).
|
|
64
|
+
*/
|
|
65
|
+
async function discoverSkillsFromDirectory(repoPath, skillsDir, seenPaths, fallbackDescription) {
|
|
66
|
+
const skills = [];
|
|
67
|
+
try {
|
|
68
|
+
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
71
|
+
continue;
|
|
72
|
+
const skillPath = join(skillsDir, entry.name);
|
|
73
|
+
const relativePath = relative(repoPath, skillPath);
|
|
74
|
+
if (seenPaths.has(relativePath))
|
|
75
|
+
continue;
|
|
76
|
+
seenPaths.add(relativePath);
|
|
77
|
+
const metadata = await parseSkillMd(skillPath);
|
|
78
|
+
skills.push({
|
|
79
|
+
name: metadata?.name ?? entry.name,
|
|
80
|
+
description: metadata?.description ?? fallbackDescription,
|
|
81
|
+
path: relativePath,
|
|
82
|
+
absolutePath: skillPath,
|
|
83
|
+
metadata: metadata,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Directory doesn't exist or can't be read
|
|
89
|
+
}
|
|
90
|
+
return skills;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Convert discovered skills to artifacts with format tag.
|
|
94
|
+
*/
|
|
95
|
+
function skillsToArtifacts(skills, format) {
|
|
96
|
+
return skills.map((skill) => ({
|
|
97
|
+
name: skill.name,
|
|
98
|
+
description: skill.description,
|
|
99
|
+
type: "skill",
|
|
100
|
+
path: skill.path,
|
|
101
|
+
absolutePath: skill.absolutePath,
|
|
102
|
+
format,
|
|
103
|
+
metadata: skill.metadata,
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
31
106
|
// ============================================================================
|
|
32
107
|
// Discovery
|
|
33
108
|
// ============================================================================
|
|
34
109
|
/**
|
|
35
|
-
* Discover all artifacts in a repository.
|
|
110
|
+
* Discover all artifacts and collections in a repository.
|
|
111
|
+
*
|
|
112
|
+
* @param repoPath - Path to the repository
|
|
113
|
+
* @param subdir - Optional subdirectory to search within
|
|
114
|
+
* @param explicitFormat - If provided, use this format instead of auto-detecting
|
|
36
115
|
*/
|
|
37
|
-
export async function
|
|
38
|
-
const searchPath =
|
|
39
|
-
|
|
116
|
+
export async function discover(repoPath, subdir, explicitFormat) {
|
|
117
|
+
const searchPath = subdir ? join(repoPath, subdir) : repoPath;
|
|
118
|
+
// Use explicit format if provided and not "auto", otherwise detect
|
|
119
|
+
const format = (explicitFormat && explicitFormat !== "auto")
|
|
120
|
+
? explicitFormat
|
|
121
|
+
: await detectFormat(searchPath);
|
|
40
122
|
switch (format) {
|
|
41
123
|
case "claude-marketplace":
|
|
42
124
|
return discoverClaudeMarketplace(searchPath);
|
|
125
|
+
case "claude-plugin":
|
|
126
|
+
return discoverClaudePlugin(searchPath);
|
|
43
127
|
case "simple":
|
|
44
128
|
return discoverSimpleFormat(searchPath);
|
|
45
129
|
default:
|
|
@@ -48,82 +132,113 @@ export async function discoverArtifacts(repoPath, subpath) {
|
|
|
48
132
|
}
|
|
49
133
|
}
|
|
50
134
|
/**
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
135
|
+
* @deprecated Use `discover` instead. This is kept for backwards compatibility.
|
|
136
|
+
*/
|
|
137
|
+
export async function discoverArtifacts(repoPath, subdir, explicitFormat) {
|
|
138
|
+
const result = await discover(repoPath, subdir, explicitFormat);
|
|
139
|
+
return result.artifacts;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Discover artifacts from Claude marketplace manifest.
|
|
58
143
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
144
|
+
* Marketplace format (.claude-plugin/marketplace.json):
|
|
145
|
+
* - Contains `plugins` array with plugin entries
|
|
146
|
+
* - If plugin has explicit `skills` array → use only those
|
|
147
|
+
* - Otherwise discover from `source/skills/` directory
|
|
148
|
+
* - Each plugin becomes a collection containing its artifacts
|
|
61
149
|
*/
|
|
62
150
|
async function discoverClaudeMarketplace(repoPath) {
|
|
63
151
|
const manifestPath = join(repoPath, ".claude-plugin", "marketplace.json");
|
|
64
|
-
const artifacts = [];
|
|
65
|
-
const seenPaths = new Set();
|
|
66
152
|
const content = await readFile(manifestPath, "utf-8");
|
|
67
153
|
const manifest = JSON.parse(content);
|
|
154
|
+
const allArtifacts = [];
|
|
155
|
+
const collections = [];
|
|
156
|
+
const seenPaths = new Set();
|
|
68
157
|
for (const plugin of manifest.plugins) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
158
|
+
const sourcePath = (typeof plugin.source === "string" ? plugin.source : "").replace(/^\.\//, "");
|
|
159
|
+
let skills = [];
|
|
160
|
+
// If plugin has explicit skills array, use ONLY those
|
|
161
|
+
if (plugin.skills && Array.isArray(plugin.skills) && plugin.skills.length > 0) {
|
|
162
|
+
skills = await discoverSkillsFromPaths(repoPath, plugin.skills, seenPaths, plugin.description);
|
|
163
|
+
}
|
|
164
|
+
else if (plugin.source) {
|
|
165
|
+
// No explicit skills - discover from source/skills/ directory
|
|
72
166
|
const pluginDir = sourcePath ? join(repoPath, sourcePath) : repoPath;
|
|
73
167
|
const skillsDir = join(pluginDir, "skills");
|
|
74
|
-
|
|
75
|
-
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
76
|
-
for (const entry of entries) {
|
|
77
|
-
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
78
|
-
continue;
|
|
79
|
-
const skillPath = join(skillsDir, entry.name);
|
|
80
|
-
const relativePath = relative(repoPath, skillPath);
|
|
81
|
-
// Skip duplicates (multiple plugins may point to same skills dir)
|
|
82
|
-
if (seenPaths.has(relativePath))
|
|
83
|
-
continue;
|
|
84
|
-
seenPaths.add(relativePath);
|
|
85
|
-
const metadata = await parseSkillMd(skillPath);
|
|
86
|
-
artifacts.push({
|
|
87
|
-
name: metadata?.name ?? entry.name,
|
|
88
|
-
description: metadata?.description ?? plugin.description,
|
|
89
|
-
type: "skill",
|
|
90
|
-
path: relativePath,
|
|
91
|
-
absolutePath: skillPath,
|
|
92
|
-
format: "claude-marketplace",
|
|
93
|
-
metadata: metadata,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
// skills/ directory doesn't exist in plugin source dir
|
|
99
|
-
}
|
|
168
|
+
skills = await discoverSkillsFromDirectory(repoPath, skillsDir, seenPaths, plugin.description);
|
|
100
169
|
}
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
absolutePath,
|
|
117
|
-
format: "claude-marketplace",
|
|
118
|
-
metadata: metadata,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
170
|
+
// Add to artifacts
|
|
171
|
+
const artifacts = skillsToArtifacts(skills, "claude-marketplace");
|
|
172
|
+
allArtifacts.push(...artifacts);
|
|
173
|
+
// Create collection for this plugin
|
|
174
|
+
if (skills.length > 0) {
|
|
175
|
+
collections.push({
|
|
176
|
+
name: plugin.name,
|
|
177
|
+
description: plugin.description,
|
|
178
|
+
artifacts: skills.map((s) => s.name),
|
|
179
|
+
path: sourcePath || ".",
|
|
180
|
+
metadata: {
|
|
181
|
+
version: plugin.version,
|
|
182
|
+
author: plugin.author,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
121
185
|
}
|
|
122
186
|
}
|
|
123
|
-
return artifacts;
|
|
187
|
+
return { artifacts: allArtifacts, collections, format: "claude-marketplace" };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Discover artifacts from Claude plugin manifest.
|
|
191
|
+
*
|
|
192
|
+
* Plugin format (.claude-plugin/plugin.json):
|
|
193
|
+
* - `skills` field is path(s) to directories CONTAINING skills
|
|
194
|
+
* - Default `skills/` directory is always searched
|
|
195
|
+
* - The plugin itself is the collection containing all artifacts
|
|
196
|
+
*/
|
|
197
|
+
async function discoverClaudePlugin(repoPath) {
|
|
198
|
+
const manifestPath = join(repoPath, ".claude-plugin", "plugin.json");
|
|
199
|
+
const content = await readFile(manifestPath, "utf-8");
|
|
200
|
+
const manifest = JSON.parse(content);
|
|
201
|
+
const seenPaths = new Set();
|
|
202
|
+
const allSkills = [];
|
|
203
|
+
// Collect skill directories to search
|
|
204
|
+
const skillsDirs = [];
|
|
205
|
+
// Add custom skills paths from manifest (these are directory paths, not individual skills)
|
|
206
|
+
if (manifest.skills) {
|
|
207
|
+
const paths = Array.isArray(manifest.skills) ? manifest.skills : [manifest.skills];
|
|
208
|
+
for (const p of paths) {
|
|
209
|
+
const normalized = p.replace(/^\.\//, "");
|
|
210
|
+
skillsDirs.push(join(repoPath, normalized));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Always add default skills/ directory
|
|
214
|
+
skillsDirs.push(join(repoPath, "skills"));
|
|
215
|
+
// Discover skills from each directory
|
|
216
|
+
for (const skillsDir of skillsDirs) {
|
|
217
|
+
const skills = await discoverSkillsFromDirectory(repoPath, skillsDir, seenPaths, manifest.description);
|
|
218
|
+
allSkills.push(...skills);
|
|
219
|
+
}
|
|
220
|
+
const artifacts = skillsToArtifacts(allSkills, "claude-plugin");
|
|
221
|
+
// The plugin itself is the single collection
|
|
222
|
+
const collection = {
|
|
223
|
+
name: manifest.name,
|
|
224
|
+
description: manifest.description,
|
|
225
|
+
artifacts: allSkills.map((s) => s.name),
|
|
226
|
+
path: ".",
|
|
227
|
+
metadata: {
|
|
228
|
+
version: manifest.version,
|
|
229
|
+
author: manifest.author,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
artifacts,
|
|
234
|
+
collections: artifacts.length > 0 ? [collection] : [],
|
|
235
|
+
format: "claude-plugin",
|
|
236
|
+
};
|
|
124
237
|
}
|
|
125
238
|
/**
|
|
126
239
|
* Discover artifacts from simple format (skills/ directory).
|
|
240
|
+
* Simple format uses metadata.json, not Claude's SKILL.md structure.
|
|
241
|
+
* Simple format has no collections - just raw artifacts.
|
|
127
242
|
*/
|
|
128
243
|
async function discoverSimpleFormat(repoPath) {
|
|
129
244
|
const skillsDir = join(repoPath, "skills");
|
|
@@ -136,20 +251,17 @@ async function discoverSimpleFormat(repoPath) {
|
|
|
136
251
|
if (entry.name.startsWith("."))
|
|
137
252
|
continue;
|
|
138
253
|
const skillPath = join(skillsDir, entry.name);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
let jsonMetadata = null;
|
|
254
|
+
// Simple format uses metadata.json
|
|
255
|
+
let metadata = {};
|
|
142
256
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
257
|
+
const content = await readFile(join(skillPath, "metadata.json"), "utf-8");
|
|
258
|
+
metadata = JSON.parse(content);
|
|
145
259
|
}
|
|
146
260
|
catch {
|
|
147
261
|
// No metadata.json
|
|
148
262
|
}
|
|
149
|
-
const name = metadata
|
|
150
|
-
const description = metadata
|
|
151
|
-
jsonMetadata?.abstract ??
|
|
152
|
-
jsonMetadata?.description;
|
|
263
|
+
const name = metadata.name ?? entry.name;
|
|
264
|
+
const description = metadata.description ?? metadata.abstract;
|
|
153
265
|
artifacts.push({
|
|
154
266
|
name,
|
|
155
267
|
description,
|
|
@@ -157,17 +269,17 @@ async function discoverSimpleFormat(repoPath) {
|
|
|
157
269
|
path: relative(repoPath, skillPath),
|
|
158
270
|
absolutePath: skillPath,
|
|
159
271
|
format: "simple",
|
|
160
|
-
metadata
|
|
272
|
+
metadata,
|
|
161
273
|
});
|
|
162
274
|
}
|
|
163
275
|
}
|
|
164
276
|
catch {
|
|
165
277
|
// skills/ directory doesn't exist or can't be read
|
|
166
278
|
}
|
|
167
|
-
return artifacts;
|
|
279
|
+
return { artifacts, collections: [], format: "simple" };
|
|
168
280
|
}
|
|
169
281
|
/**
|
|
170
|
-
* Parse SKILL.md or AGENTS.md YAML frontmatter.
|
|
282
|
+
* Parse Claude Code skill metadata from SKILL.md or AGENTS.md YAML frontmatter.
|
|
171
283
|
*/
|
|
172
284
|
async function parseSkillMd(dirPath) {
|
|
173
285
|
for (const filename of ["SKILL.md", "AGENTS.md"]) {
|
package/dist/discovery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE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AAK,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACrD,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAA4B,CAAC;gBAC5D,OAAO;oBACL,IAAI,EAAG,IAAI,CAAC,IAAe,IAAI,QAAQ,CAAC,OAAO,CAAC;oBAChD,WAAW,EAAE,IAAI,CAAC,WAAiC;oBACnD,GAAG,IAAI;iBACR,CAAC;YACJ,CAAC;YAED,qCAAqC;YACrC,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;aACxB,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,qBAAqB;QACvB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/git.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** Full git URL for cloning */
|
|
3
|
-
url: string;
|
|
4
|
-
/** GitHub owner (if GitHub) */
|
|
5
|
-
owner?: string;
|
|
6
|
-
/** Repository name */
|
|
7
|
-
repo?: string;
|
|
8
|
-
/** Git ref (branch, tag, SHA) */
|
|
9
|
-
ref?: string;
|
|
10
|
-
/** Subpath within repo (after #) */
|
|
11
|
-
subpath?: string;
|
|
12
|
-
/** Original source string */
|
|
13
|
-
original: string;
|
|
14
|
-
}
|
|
1
|
+
import type { Source } from "./config.js";
|
|
15
2
|
export interface RepoInfo {
|
|
16
3
|
/** Path to the cloned repo */
|
|
17
4
|
path: string;
|
|
@@ -19,29 +6,33 @@ export interface RepoInfo {
|
|
|
19
6
|
sha: string;
|
|
20
7
|
}
|
|
21
8
|
/**
|
|
22
|
-
* Parse a source string into
|
|
9
|
+
* Parse a CLI source shorthand string into a normalized Source object.
|
|
23
10
|
*
|
|
24
11
|
* Supported formats:
|
|
25
|
-
* - owner/repo
|
|
26
|
-
* - owner/repo#
|
|
12
|
+
* - owner/repo (GitHub shorthand)
|
|
13
|
+
* - owner/repo#subdir
|
|
27
14
|
* - https://github.com/owner/repo
|
|
28
|
-
* -
|
|
29
|
-
* -
|
|
15
|
+
* - git://github.com/owner/repo
|
|
16
|
+
* - git+ssh://git@github.com/owner/repo
|
|
17
|
+
* - git@github.com:owner/repo
|
|
18
|
+
* - Any of the above with #subdir suffix
|
|
19
|
+
*
|
|
20
|
+
* Returns a Source object suitable for storing in agpm.json.
|
|
30
21
|
*/
|
|
31
|
-
export declare function
|
|
22
|
+
export declare function parseSourceString(input: string): Source;
|
|
32
23
|
/**
|
|
33
24
|
* Get the global agpm directory path.
|
|
34
25
|
*/
|
|
35
26
|
export declare function getAgpmDir(): string;
|
|
36
27
|
/**
|
|
37
|
-
* Get the path where a repo should be stored.
|
|
28
|
+
* Get the path where a repo should be stored based on its URL.
|
|
38
29
|
*/
|
|
39
|
-
export declare function getRepoPath(source:
|
|
30
|
+
export declare function getRepoPath(source: Source): string;
|
|
40
31
|
/**
|
|
41
32
|
* Clone or fetch a repository.
|
|
42
33
|
* Returns the path to the repo and the current HEAD SHA.
|
|
43
34
|
*/
|
|
44
|
-
export declare function ensureRepo(source:
|
|
35
|
+
export declare function ensureRepo(source: Source): Promise<RepoInfo>;
|
|
45
36
|
/**
|
|
46
37
|
* Checkout a specific ref (branch, tag, or SHA) in a repo.
|
|
47
38
|
*/
|
|
@@ -50,4 +41,15 @@ export declare function checkoutRef(repoPath: string, ref: string): Promise<stri
|
|
|
50
41
|
* Resolve a ref to a full SHA.
|
|
51
42
|
*/
|
|
52
43
|
export declare function resolveRef(repoPath: string, ref?: string): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Checkout a ref and cache the repo at that SHA.
|
|
46
|
+
*
|
|
47
|
+
* 1. Resolves the ref to a full SHA
|
|
48
|
+
* 2. If not already cached, checkouts the repo at that SHA and caches it
|
|
49
|
+
* 3. Returns the SHA and path to the cached repo
|
|
50
|
+
*/
|
|
51
|
+
export declare function checkoutToCache(repoPath: string, ref?: string): Promise<{
|
|
52
|
+
sha: string;
|
|
53
|
+
cachePath: string;
|
|
54
|
+
}>;
|
|
53
55
|
//# sourceMappingURL=git.d.ts.map
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C,MAAM,WAAW,QAAQ;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AA8DD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkDvD;AAMD;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAgClD;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0BlE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhF;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAIxF;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,MAAe,GACnB,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB7C"}
|