@taptap/maker 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/maker.js +64 -35
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -29369,6 +29369,7 @@ var MakerGitError = class extends Error {
|
|
|
29369
29369
|
}
|
|
29370
29370
|
};
|
|
29371
29371
|
var MAKER_FIRST_CLONE_WAIT_MESSAGE = "First Maker clone/fetch can take 20+ seconds while the server prepares the repository. Please keep this running; transient 503/5xx errors are retried automatically.";
|
|
29372
|
+
var MAKER_GIT_SHALLOW_DEPTH = 1;
|
|
29372
29373
|
function getConfiguredMakerApiBase() {
|
|
29373
29374
|
return getMakerEndpoints().apiBase;
|
|
29374
29375
|
}
|
|
@@ -29558,9 +29559,9 @@ async function cloneMakerProject(options) {
|
|
|
29558
29559
|
progress: 10,
|
|
29559
29560
|
total: 100,
|
|
29560
29561
|
phase: "clone",
|
|
29561
|
-
message: `
|
|
29562
|
+
message: `Checking out Maker project ${options.appId}`
|
|
29562
29563
|
});
|
|
29563
|
-
transientRetries += await
|
|
29564
|
+
transientRetries += await fetchAndCheckoutTarget(
|
|
29564
29565
|
target,
|
|
29565
29566
|
authUrl,
|
|
29566
29567
|
pat.token,
|
|
@@ -29581,9 +29582,9 @@ async function cloneMakerProject(options) {
|
|
|
29581
29582
|
progress: 10,
|
|
29582
29583
|
total: 100,
|
|
29583
29584
|
phase: "clone",
|
|
29584
|
-
message: `Retrying
|
|
29585
|
+
message: `Retrying Maker project checkout ${options.appId} with refreshed PAT`
|
|
29585
29586
|
});
|
|
29586
|
-
transientRetries += await
|
|
29587
|
+
transientRetries += await fetchAndCheckoutTarget(
|
|
29587
29588
|
target,
|
|
29588
29589
|
authUrl,
|
|
29589
29590
|
pat.token,
|
|
@@ -29608,7 +29609,7 @@ async function cloneMakerProject(options) {
|
|
|
29608
29609
|
progress: 100,
|
|
29609
29610
|
total: 100,
|
|
29610
29611
|
phase: "done",
|
|
29611
|
-
message: "Maker project
|
|
29612
|
+
message: "Maker project checkout completed"
|
|
29612
29613
|
});
|
|
29613
29614
|
return {
|
|
29614
29615
|
appId: options.appId,
|
|
@@ -30258,7 +30259,7 @@ async function ensureAuthenticatedOrigin(options) {
|
|
|
30258
30259
|
function makeAuthenticatedGitUrl(gitUrl, pat) {
|
|
30259
30260
|
return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
|
|
30260
30261
|
}
|
|
30261
|
-
async function
|
|
30262
|
+
async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
|
|
30262
30263
|
if (fs4.existsSync(target) && hasDirectoryEntries(target)) {
|
|
30263
30264
|
onProgress == null ? void 0 : onProgress({
|
|
30264
30265
|
progress: 10,
|
|
@@ -30266,38 +30267,36 @@ async function cloneOrInitializeTarget(target, authUrl, pat, onProgress) {
|
|
|
30266
30267
|
phase: "clone",
|
|
30267
30268
|
message: "Target directory is not empty; initializing git repository in place and keeping existing untracked files unless they conflict with Maker project files."
|
|
30268
30269
|
});
|
|
30269
|
-
let transientRetries = 0;
|
|
30270
|
-
emitFirstCloneWaitNotice(onProgress, "fetch");
|
|
30271
|
-
transientRetries += await runGitCaptureWithTransientRetry(["init", target], {
|
|
30272
|
-
sanitize: pat,
|
|
30273
|
-
onProgress
|
|
30274
|
-
});
|
|
30275
|
-
await setOrigin(target, authUrl);
|
|
30276
|
-
transientRetries += await runGitWithTransientRetry(["fetch", "--progress", "origin"], {
|
|
30277
|
-
cwd: target,
|
|
30278
|
-
onProgress
|
|
30279
|
-
});
|
|
30280
|
-
const branch = await resolveRemoteDefaultBranch(target);
|
|
30281
|
-
await assertNoCheckoutFileConflicts(target, branch);
|
|
30282
|
-
try {
|
|
30283
|
-
transientRetries += await runGitCaptureWithTransientRetry(
|
|
30284
|
-
["checkout", "-B", branch, `origin/${branch}`],
|
|
30285
|
-
{
|
|
30286
|
-
cwd: target,
|
|
30287
|
-
sanitize: pat,
|
|
30288
|
-
onProgress
|
|
30289
|
-
}
|
|
30290
|
-
);
|
|
30291
|
-
} catch (error2) {
|
|
30292
|
-
throw enhanceCheckoutConflictError(error2, target);
|
|
30293
|
-
}
|
|
30294
|
-
return transientRetries;
|
|
30295
30270
|
}
|
|
30296
|
-
|
|
30297
|
-
|
|
30271
|
+
let transientRetries = 0;
|
|
30272
|
+
emitFirstCloneWaitNotice(onProgress, "fetch");
|
|
30273
|
+
transientRetries += await runGitCaptureWithTransientRetry(["init", target], {
|
|
30298
30274
|
sanitize: pat,
|
|
30299
30275
|
onProgress
|
|
30300
30276
|
});
|
|
30277
|
+
await setOrigin(target, authUrl);
|
|
30278
|
+
transientRetries += await runGitWithTransientRetry(createShallowFetchArgs(), {
|
|
30279
|
+
cwd: target,
|
|
30280
|
+
onProgress
|
|
30281
|
+
});
|
|
30282
|
+
const branch = await resolveRemoteDefaultBranch(target);
|
|
30283
|
+
await assertNoCheckoutFileConflicts(target, branch);
|
|
30284
|
+
try {
|
|
30285
|
+
transientRetries += await runGitCaptureWithTransientRetry(
|
|
30286
|
+
["checkout", "-B", branch, `origin/${branch}`],
|
|
30287
|
+
{
|
|
30288
|
+
cwd: target,
|
|
30289
|
+
sanitize: pat,
|
|
30290
|
+
onProgress
|
|
30291
|
+
}
|
|
30292
|
+
);
|
|
30293
|
+
} catch (error2) {
|
|
30294
|
+
throw enhanceCheckoutConflictError(error2, target);
|
|
30295
|
+
}
|
|
30296
|
+
return transientRetries;
|
|
30297
|
+
}
|
|
30298
|
+
function createShallowFetchArgs() {
|
|
30299
|
+
return ["fetch", "--progress", `--depth=${String(MAKER_GIT_SHALLOW_DEPTH)}`, "origin"];
|
|
30301
30300
|
}
|
|
30302
30301
|
function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
30303
30302
|
onProgress == null ? void 0 : onProgress({
|
|
@@ -31850,7 +31849,7 @@ function extensionFromUrl(url2) {
|
|
|
31850
31849
|
}
|
|
31851
31850
|
|
|
31852
31851
|
// src/maker/server/mcp.ts
|
|
31853
|
-
var VERSION = true ? "0.0.
|
|
31852
|
+
var VERSION = true ? "0.0.11" : "dev";
|
|
31854
31853
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31855
31854
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
31856
31855
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -33712,10 +33711,12 @@ async function runInit(parsed, ctx) {
|
|
|
33712
33711
|
kid: mask(tapAuth.kid),
|
|
33713
33712
|
saved: getTapAuthPath()
|
|
33714
33713
|
});
|
|
33714
|
+
const existingProjectConfig = loadProjectConfig(targetDir);
|
|
33715
33715
|
const projects = await listMakerProjects({ pat }).catch((error2) => {
|
|
33716
33716
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33717
33717
|
});
|
|
33718
33718
|
const selected = await resolveProjectSelection(parsed, projects, {
|
|
33719
|
+
existingProjectConfig,
|
|
33719
33720
|
skipConfirm
|
|
33720
33721
|
});
|
|
33721
33722
|
emit(ctx, "app", "Maker app selected", {
|
|
@@ -33723,6 +33724,12 @@ async function runInit(parsed, ctx) {
|
|
|
33723
33724
|
name: selected.name,
|
|
33724
33725
|
user_id: selected.user_id
|
|
33725
33726
|
});
|
|
33727
|
+
ensureInitTargetCanRecordProject(targetDir, existingProjectConfig == null ? void 0 : existingProjectConfig.project_id, selected.id);
|
|
33728
|
+
saveProjectConfig(targetDir, {
|
|
33729
|
+
project_id: selected.id,
|
|
33730
|
+
user_id: selected.user_id || (existingProjectConfig == null ? void 0 : existingProjectConfig.user_id),
|
|
33731
|
+
sce_endpoint: selected.sce_endpoint || (existingProjectConfig == null ? void 0 : existingProjectConfig.sce_endpoint)
|
|
33732
|
+
});
|
|
33726
33733
|
saveInitState(targetDir, {
|
|
33727
33734
|
status: "app_selected",
|
|
33728
33735
|
target_dir: targetDir,
|
|
@@ -34123,10 +34130,19 @@ async function resolvePat(parsed, ctx) {
|
|
|
34123
34130
|
return pat;
|
|
34124
34131
|
}
|
|
34125
34132
|
async function resolveProjectSelection(parsed, projects, options) {
|
|
34133
|
+
var _a3;
|
|
34126
34134
|
const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
|
|
34127
34135
|
if (appId) {
|
|
34128
34136
|
return projects.find((project) => project.id === appId) || { id: appId };
|
|
34129
34137
|
}
|
|
34138
|
+
if ((_a3 = options.existingProjectConfig) == null ? void 0 : _a3.project_id) {
|
|
34139
|
+
const projectId = options.existingProjectConfig.project_id;
|
|
34140
|
+
return projects.find((project) => project.id === projectId) || {
|
|
34141
|
+
id: projectId,
|
|
34142
|
+
user_id: options.existingProjectConfig.user_id,
|
|
34143
|
+
sce_endpoint: options.existingProjectConfig.sce_endpoint
|
|
34144
|
+
};
|
|
34145
|
+
}
|
|
34130
34146
|
if (projects.length === 0) {
|
|
34131
34147
|
throw new Error("No Maker apps found for this PAT.");
|
|
34132
34148
|
}
|
|
@@ -34160,6 +34176,19 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
34160
34176
|
return selected;
|
|
34161
34177
|
}
|
|
34162
34178
|
}
|
|
34179
|
+
function ensureInitTargetCanRecordProject(targetDir, existingProjectId, selectedProjectId) {
|
|
34180
|
+
if (!existingProjectId || existingProjectId === selectedProjectId) {
|
|
34181
|
+
return;
|
|
34182
|
+
}
|
|
34183
|
+
throw new Error(
|
|
34184
|
+
[
|
|
34185
|
+
`${targetDir} is already bound to Maker project ${existingProjectId}.`,
|
|
34186
|
+
`You are trying to initialize Maker project ${selectedProjectId} into the same directory.`,
|
|
34187
|
+
"A Maker workspace directory can only be bound to one project at a time.",
|
|
34188
|
+
"Please switch to the directory for the existing project, or create/open a new empty directory for the new project."
|
|
34189
|
+
].join("\n")
|
|
34190
|
+
);
|
|
34191
|
+
}
|
|
34163
34192
|
async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
34164
34193
|
const before = inspectAiDevKit(targetDir);
|
|
34165
34194
|
if (before.ready && !options.forceInstall) {
|