@anvil-works/anvil-cli 0.7.0-canary.4 → 0.7.0-canary.5
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/WatchSession.d.ts +14 -4
- package/dist/WatchSession.d.ts.map +1 -1
- package/dist/api.d.ts +2 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/cli.js +236 -24
- package/dist/commands/watch.d.ts +2 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/index.js +229 -19
- package/dist/watch/SaveProcessor.d.ts +7 -4
- package/dist/watch/SaveProcessor.d.ts.map +1 -1
- package/dist/watch/diagnostics.d.ts +30 -0
- package/dist/watch/diagnostics.d.ts.map +1 -0
- package/dist/watch/index.d.ts +1 -0
- package/dist/watch/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/WatchSession.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Emitter } from "./Emitter";
|
|
2
2
|
import { type FileChange } from "./watch";
|
|
3
|
+
import { type WatchDiagnostic } from "./watch/diagnostics";
|
|
3
4
|
export interface WatchSessionEvents {
|
|
4
5
|
"branch-changed": {
|
|
5
6
|
oldBranch: string;
|
|
@@ -9,15 +10,20 @@ export interface WatchSessionEvents {
|
|
|
9
10
|
retryAttempt: number;
|
|
10
11
|
maxRetries: number;
|
|
11
12
|
reason: string;
|
|
12
|
-
};
|
|
13
|
+
} & WatchDiagnostic;
|
|
13
14
|
"remote-update": {
|
|
14
15
|
branch: string;
|
|
15
16
|
commitHash: string;
|
|
16
17
|
};
|
|
18
|
+
"remote-sync-failed": {
|
|
19
|
+
branch: string;
|
|
20
|
+
commitHash: string;
|
|
21
|
+
error: string;
|
|
22
|
+
} & WatchDiagnostic;
|
|
17
23
|
"validation-failed": {
|
|
18
24
|
reason: string;
|
|
19
25
|
currentBranch: string;
|
|
20
|
-
};
|
|
26
|
+
} & WatchDiagnostic;
|
|
21
27
|
"save-complete": {
|
|
22
28
|
newCommitId: string;
|
|
23
29
|
fileCount: number;
|
|
@@ -32,11 +38,14 @@ export interface WatchSessionEvents {
|
|
|
32
38
|
"save-failed": {
|
|
33
39
|
error: string;
|
|
34
40
|
fileCount: number;
|
|
35
|
-
};
|
|
41
|
+
} & WatchDiagnostic;
|
|
36
42
|
"max-retries-exceeded": {
|
|
37
43
|
retries: number;
|
|
38
|
-
|
|
44
|
+
reason: string;
|
|
45
|
+
} & WatchDiagnostic;
|
|
39
46
|
}
|
|
47
|
+
export type WatchDiagnosticEventName = "save-failed" | "validation-failed" | "max-retries-exceeded" | "remote-sync-failed" | "sync-conflict";
|
|
48
|
+
export type WatchDiagnosticEventPayload = WatchSessionEvents[WatchDiagnosticEventName];
|
|
40
49
|
export declare class WatchSession extends Emitter<WatchSessionEvents> {
|
|
41
50
|
private sessionId;
|
|
42
51
|
private repoPath;
|
|
@@ -84,6 +93,7 @@ export declare class WatchSession extends Emitter<WatchSessionEvents> {
|
|
|
84
93
|
initialize(): Promise<void>;
|
|
85
94
|
private initializeProcessors;
|
|
86
95
|
private connectWebSocket;
|
|
96
|
+
private emitRemoteSyncFailed;
|
|
87
97
|
/**
|
|
88
98
|
* Sync remote changes from Anvil.
|
|
89
99
|
* @throws {AuthError | GitError} on failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WatchSession.d.ts","sourceRoot":"","sources":["../src/WatchSession.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAA4D,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"WatchSession.d.ts","sourceRoot":"","sources":["../src/WatchSession.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAA4D,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;A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a,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB;IAmBE,aAAa,IAAI,MAAM;IAIvB,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAK7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAajC,OAAO,CAAC,oBAAoB;YA6Dd,gBAAgB;IAwC9B,OAAO,CAAC,oBAAoB;IAgB5B;;;OAGG;IACU,iBAAiB,CAC1B,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAChC,OAAO,CAAC;QAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;QAAC,SAAS,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAIvE,OAAO,IAAI,IAAI;IAwBT,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCpC,yBAAyB,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;YAOrD,gCAAgC;IAa9C,OAAO,CAAC,+BAA+B;YAUzB,yBAAyB;IA6BvC,OAAO,CAAC,yBAAyB;YAgBnB,gBAAgB;IAsB9B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,sBAAsB;IAI9B;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;YAOlB,iBAAiB;YAajB,qBAAqB;CAsCtC"}
|
package/dist/api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { WatchSession } from "./WatchSession";
|
|
|
2
2
|
import { AuthError, GitError } from "./errors";
|
|
3
3
|
import { ValidationServiceError } from "./services/validation";
|
|
4
4
|
export { WatchSession };
|
|
5
|
-
export type { WatchSessionEvents } from "./WatchSession";
|
|
5
|
+
export type { WatchDiagnosticEventName, WatchDiagnosticEventPayload, WatchSessionEvents } from "./WatchSession";
|
|
6
6
|
export { AppIdCandidate, AppIdWithContext, CheckoutAppListItem, detectAppIdsByCommitLookup, detectAppIdsFromAllRemotes, filterCandidates, formatCandidateLabel, getGitFetchUrl, getGitPushUrl, getLatestVersion, getWebSocketUrl, listAppsForCheckout, lookupRemoteInfoForAppId, lookupByCommit, saveUpdates, ValidateAppIdResponse, validateAppId, } from "./services/anvil-api";
|
|
7
7
|
export { ANVIL_SYNC_CLIENT_ID, getAccountsForUrl, getAvailableAnvilUrls, getTokensForUrl, getValidAuthToken, hasTokensForUrl, login, LoginResult, LogoutResult, logout, StoredTokens, TokenData, verifyAuth, } from "./services/auth";
|
|
8
8
|
export { DeviceAuthorizationResponse, OAuthTokenResponse, pollDeviceAuthorization, requestDeviceAuthorization, } from "./services/oauth-login";
|
|
@@ -11,6 +11,7 @@ export { executeGitCredentialOperation } from "./commands/gitCredential";
|
|
|
11
11
|
export { deleteConfig, getAllConfig, getConfig, getInstalledPreferredEditors, getPreferredEditorCommand, getSettableConfigKeys, isCommandAvailable, normalizeAnvilUrl, parseConfigSetValue, preferredEditors, PreferredEditor, resetConfig, resolveAnvilUrl, setAuthTokensForAccount, setConfig, SettableConfigKey, } from "./config";
|
|
12
12
|
export { BranchSyncStatus, ValidateBranchSyncStatusOptions, validateAnvilApp, validateBranchSyncStatus, } from "./services/validation";
|
|
13
13
|
export { AnvilYamlValidationResult, FormTemplateValidationResult, ValidatePathResult, ValidationTarget, ValidationIssue, formatValidationPath, validatePath, validateAnvilYaml, validateFormTemplate, } from "./validators";
|
|
14
|
+
export { createWatchDiagnostic, createWatchDiagnosticFromMessage, type WatchDiagnostic, type WatchDiagnosticContext, type WatchRecoverability, } from "./watch/diagnostics";
|
|
14
15
|
export interface UncommittedChanges {
|
|
15
16
|
hasChanges: boolean;
|
|
16
17
|
modified: string[];
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,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Aa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsB3F;AAMD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBjH;AAMD;;;GAGG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoG9G"}
|
package/dist/cli.js
CHANGED
|
@@ -16503,6 +16503,142 @@ var __webpack_exports__ = {};
|
|
|
16503
16503
|
}
|
|
16504
16504
|
return changes;
|
|
16505
16505
|
}
|
|
16506
|
+
function createWatchDiagnostic(error, context = {}) {
|
|
16507
|
+
const base = diagnosticDefaults(error);
|
|
16508
|
+
return {
|
|
16509
|
+
...base,
|
|
16510
|
+
message: errors_getErrorMessage(error),
|
|
16511
|
+
recoverability: context.recoverability ?? base.recoverability,
|
|
16512
|
+
requiresUserAction: context.requiresUserAction ?? base.requiresUserAction,
|
|
16513
|
+
suggestedAction: context.suggestedAction ?? base.suggestedAction,
|
|
16514
|
+
branch: context.branch ?? base.branch,
|
|
16515
|
+
fileCount: context.fileCount,
|
|
16516
|
+
retryAttempt: context.retryAttempt,
|
|
16517
|
+
maxRetries: context.maxRetries,
|
|
16518
|
+
status: context.status ?? base.status,
|
|
16519
|
+
gitCommand: context.gitCommand ?? base.gitCommand,
|
|
16520
|
+
latestVersion: context.latestVersion ?? base.latestVersion
|
|
16521
|
+
};
|
|
16522
|
+
}
|
|
16523
|
+
function diagnosticDefaults(error) {
|
|
16524
|
+
if (!isAnvilError(error)) return {
|
|
16525
|
+
code: error instanceof Error ? "unknown_error" : "unknown_non_error",
|
|
16526
|
+
recoverability: "requires_user_action",
|
|
16527
|
+
requiresUserAction: true,
|
|
16528
|
+
suggestedAction: "Review the error details and retry once the underlying issue is resolved."
|
|
16529
|
+
};
|
|
16530
|
+
switch(error.type){
|
|
16531
|
+
case "auth_required":
|
|
16532
|
+
case "auth_expired":
|
|
16533
|
+
case "auth_invalid":
|
|
16534
|
+
case "token_refresh_failed":
|
|
16535
|
+
return authDiagnostic(error);
|
|
16536
|
+
case "git_not_initialized":
|
|
16537
|
+
case "git_command_failed":
|
|
16538
|
+
case "git_fetch_failed":
|
|
16539
|
+
return gitDiagnostic(error);
|
|
16540
|
+
case "network_error":
|
|
16541
|
+
case "server_error":
|
|
16542
|
+
case "timeout":
|
|
16543
|
+
return networkDiagnostic(error);
|
|
16544
|
+
case "save_conflict":
|
|
16545
|
+
case "save_validation_failed":
|
|
16546
|
+
case "no_sync_callback":
|
|
16547
|
+
case "max_retries_exceeded":
|
|
16548
|
+
return saveDiagnostic(error);
|
|
16549
|
+
case "branch_not_found":
|
|
16550
|
+
case "branch_diverged":
|
|
16551
|
+
case "branch_behind":
|
|
16552
|
+
case "branch_ahead":
|
|
16553
|
+
case "sync_conflict":
|
|
16554
|
+
case "detached_head":
|
|
16555
|
+
case "uncommitted_changes":
|
|
16556
|
+
return {
|
|
16557
|
+
code: error.type,
|
|
16558
|
+
recoverability: "requires_user_action",
|
|
16559
|
+
requiresUserAction: true,
|
|
16560
|
+
suggestedAction: "Resolve the branch sync state, then restart or retry the watch session."
|
|
16561
|
+
};
|
|
16562
|
+
case "app_not_found":
|
|
16563
|
+
case "app_access_denied":
|
|
16564
|
+
case "app_invalid":
|
|
16565
|
+
return {
|
|
16566
|
+
code: error.type,
|
|
16567
|
+
recoverability: "requires_user_action",
|
|
16568
|
+
requiresUserAction: true,
|
|
16569
|
+
suggestedAction: "Check the app ID, account, and permissions before retrying."
|
|
16570
|
+
};
|
|
16571
|
+
case "invalid_anvil_app":
|
|
16572
|
+
case "missing_anvil_yaml":
|
|
16573
|
+
case "invalid_yaml":
|
|
16574
|
+
return {
|
|
16575
|
+
code: error.type,
|
|
16576
|
+
recoverability: "requires_user_action",
|
|
16577
|
+
requiresUserAction: true,
|
|
16578
|
+
suggestedAction: "Fix the local app metadata or YAML validation error before retrying."
|
|
16579
|
+
};
|
|
16580
|
+
}
|
|
16581
|
+
}
|
|
16582
|
+
function authDiagnostic(error) {
|
|
16583
|
+
return {
|
|
16584
|
+
code: error.type,
|
|
16585
|
+
recoverability: "requires_user_action",
|
|
16586
|
+
requiresUserAction: true,
|
|
16587
|
+
suggestedAction: "Refresh authentication or run anvil login for the target Anvil account, then retry."
|
|
16588
|
+
};
|
|
16589
|
+
}
|
|
16590
|
+
function gitDiagnostic(error) {
|
|
16591
|
+
return {
|
|
16592
|
+
code: error.type,
|
|
16593
|
+
recoverability: "requires_user_action",
|
|
16594
|
+
requiresUserAction: true,
|
|
16595
|
+
suggestedAction: "Inspect the repository state and resolve the Git error before retrying.",
|
|
16596
|
+
gitCommand: "git_command_failed" === error.type ? error.command : void 0
|
|
16597
|
+
};
|
|
16598
|
+
}
|
|
16599
|
+
function networkDiagnostic(error) {
|
|
16600
|
+
return {
|
|
16601
|
+
code: error.type,
|
|
16602
|
+
recoverability: "server_error" === error.type ? "requires_user_action" : "recoverable",
|
|
16603
|
+
requiresUserAction: "server_error" === error.type,
|
|
16604
|
+
suggestedAction: "server_error" === error.type ? "Check the server response and retry after the service-side issue is resolved." : "Retry after network connectivity is restored.",
|
|
16605
|
+
status: "server_error" === error.type ? error.status : void 0
|
|
16606
|
+
};
|
|
16607
|
+
}
|
|
16608
|
+
function saveDiagnostic(error) {
|
|
16609
|
+
switch(error.type){
|
|
16610
|
+
case "save_conflict":
|
|
16611
|
+
return {
|
|
16612
|
+
code: error.type,
|
|
16613
|
+
recoverability: "retrying",
|
|
16614
|
+
requiresUserAction: false,
|
|
16615
|
+
suggestedAction: "Wait for the watch session to sync the latest version and retry the save.",
|
|
16616
|
+
latestVersion: error.latestVersion
|
|
16617
|
+
};
|
|
16618
|
+
case "save_validation_failed":
|
|
16619
|
+
return {
|
|
16620
|
+
code: error.type,
|
|
16621
|
+
recoverability: "requires_user_action",
|
|
16622
|
+
requiresUserAction: true,
|
|
16623
|
+
suggestedAction: "Restart the watch session on the current validated branch before continuing.",
|
|
16624
|
+
branch: error.currentBranch
|
|
16625
|
+
};
|
|
16626
|
+
case "no_sync_callback":
|
|
16627
|
+
return {
|
|
16628
|
+
code: error.type,
|
|
16629
|
+
recoverability: "fatal",
|
|
16630
|
+
requiresUserAction: true,
|
|
16631
|
+
suggestedAction: "Restart the watch session; conflict recovery is not configured."
|
|
16632
|
+
};
|
|
16633
|
+
case "max_retries_exceeded":
|
|
16634
|
+
return {
|
|
16635
|
+
code: error.type,
|
|
16636
|
+
recoverability: "requires_user_action",
|
|
16637
|
+
requiresUserAction: true,
|
|
16638
|
+
suggestedAction: "Sync or resolve conflicting changes manually, then restart the watch session."
|
|
16639
|
+
};
|
|
16640
|
+
}
|
|
16641
|
+
}
|
|
16506
16642
|
class SaveProcessor extends Emitter {
|
|
16507
16643
|
hasPendingChanges = false;
|
|
16508
16644
|
debounceTimer = null;
|
|
@@ -16578,10 +16714,15 @@ var __webpack_exports__ = {};
|
|
|
16578
16714
|
finalMessage = result.skipped ? void 0 : await this.getSuccessMessage();
|
|
16579
16715
|
logger_logger.progressEnd("sync", finalMessage);
|
|
16580
16716
|
} catch (e) {
|
|
16581
|
-
|
|
16582
|
-
|
|
16717
|
+
const diagnostic = createWatchDiagnostic(e, {
|
|
16718
|
+
branch: this.config.getCurrentBranch(),
|
|
16583
16719
|
fileCount
|
|
16584
16720
|
});
|
|
16721
|
+
this.emit("save-failed", {
|
|
16722
|
+
error: diagnostic.message,
|
|
16723
|
+
fileCount,
|
|
16724
|
+
...diagnostic
|
|
16725
|
+
});
|
|
16585
16726
|
this.emit("save-complete", {
|
|
16586
16727
|
newCommitId: this.config.getCommitId(),
|
|
16587
16728
|
fileCount
|
|
@@ -16842,21 +16983,29 @@ var __webpack_exports__ = {};
|
|
|
16842
16983
|
if (branchFromGit !== currentBranch) {
|
|
16843
16984
|
const reason = `Branch ${branchFromGit} not validated`;
|
|
16844
16985
|
logger_logger.error(external_chalk_default().red(`Cannot sync - ${reason}`));
|
|
16986
|
+
const error = createSaveError.validationFailed(reason, branchFromGit);
|
|
16845
16987
|
this.emit("validation-failed", {
|
|
16846
16988
|
reason,
|
|
16847
|
-
currentBranch: branchFromGit
|
|
16989
|
+
currentBranch: branchFromGit,
|
|
16990
|
+
...createWatchDiagnostic(error, {
|
|
16991
|
+
branch: branchFromGit
|
|
16992
|
+
})
|
|
16848
16993
|
});
|
|
16849
|
-
throw
|
|
16994
|
+
throw error;
|
|
16850
16995
|
}
|
|
16851
16996
|
} catch (e) {
|
|
16852
16997
|
if ("save_validation_failed" === e.type) throw e;
|
|
16853
16998
|
const reason = "Branch unknown not validated";
|
|
16854
16999
|
logger_logger.error(external_chalk_default().red(`Cannot sync - ${reason}`));
|
|
17000
|
+
const error = createSaveError.validationFailed(reason, "unknown");
|
|
16855
17001
|
this.emit("validation-failed", {
|
|
16856
17002
|
reason,
|
|
16857
|
-
currentBranch: "unknown"
|
|
17003
|
+
currentBranch: "unknown",
|
|
17004
|
+
...createWatchDiagnostic(error, {
|
|
17005
|
+
branch: "unknown"
|
|
17006
|
+
})
|
|
16858
17007
|
});
|
|
16859
|
-
throw
|
|
17008
|
+
throw error;
|
|
16860
17009
|
}
|
|
16861
17010
|
const validToken = await auth_getValidAuthToken(this.config.anvilUrl, this.config.username);
|
|
16862
17011
|
this.config.setAuthToken(validToken);
|
|
@@ -16918,29 +17067,41 @@ var __webpack_exports__ = {};
|
|
|
16918
17067
|
throw errors_createAuthError.invalid(detailedMsg);
|
|
16919
17068
|
}
|
|
16920
17069
|
async handleConflict(json_resp, originalFilePaths, retryCount) {
|
|
17070
|
+
const conflict = this.getConflictDiagnosticInfo(json_resp);
|
|
16921
17071
|
if (retryCount >= this.MAX_RETRIES) {
|
|
16922
17072
|
logger_logger.error(`Save failed after ${this.MAX_RETRIES} retries due to version conflicts.`);
|
|
16923
17073
|
logger_logger.warn("This usually means someone else is editing the app at the same time.");
|
|
17074
|
+
const error = createSaveError.maxRetriesExceeded(this.MAX_RETRIES);
|
|
16924
17075
|
this.emit("max-retries-exceeded", {
|
|
16925
|
-
retries: this.MAX_RETRIES
|
|
17076
|
+
retries: this.MAX_RETRIES,
|
|
17077
|
+
reason: conflict.reason,
|
|
17078
|
+
...createWatchDiagnostic(error, {
|
|
17079
|
+
branch: this.config.getCurrentBranch(),
|
|
17080
|
+
maxRetries: this.MAX_RETRIES,
|
|
17081
|
+
latestVersion: conflict.latestVersion
|
|
17082
|
+
})
|
|
16926
17083
|
});
|
|
16927
|
-
throw
|
|
16928
|
-
}
|
|
16929
|
-
|
|
16930
|
-
if (json_resp.
|
|
16931
|
-
|
|
16932
|
-
logger_logger.warn(`${conflictReason}, fetching latest and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
16933
|
-
} else if (json_resp.latest_version) {
|
|
16934
|
-
conflictReason = `Version conflict (latest: ${json_resp.latest_version.substring(0, 8)})`;
|
|
16935
|
-
logger_logger.warn(`Version conflict detected, syncing to ${json_resp.latest_version.substring(0, 8)} and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
16936
|
-
} else {
|
|
17084
|
+
throw error;
|
|
17085
|
+
}
|
|
17086
|
+
if (json_resp.overtaken) logger_logger.warn(`${conflict.reason}, fetching latest and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
17087
|
+
else if (json_resp.latest_version) logger_logger.warn(`Version conflict detected, syncing to ${json_resp.latest_version.substring(0, 8)} and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
17088
|
+
else {
|
|
16937
17089
|
logger_logger.error("Save failed with 409 but no conflict info provided");
|
|
16938
17090
|
throw createSaveError.conflict();
|
|
16939
17091
|
}
|
|
16940
17092
|
this.emit("sync-conflict", {
|
|
16941
17093
|
retryAttempt: retryCount + 1,
|
|
16942
17094
|
maxRetries: this.MAX_RETRIES,
|
|
16943
|
-
reason:
|
|
17095
|
+
reason: conflict.reason,
|
|
17096
|
+
...createWatchDiagnostic(createSaveError.conflict(conflict.latestVersion, json_resp.overtaken), {
|
|
17097
|
+
branch: this.config.getCurrentBranch(),
|
|
17098
|
+
retryAttempt: retryCount + 1,
|
|
17099
|
+
maxRetries: this.MAX_RETRIES,
|
|
17100
|
+
latestVersion: conflict.latestVersion,
|
|
17101
|
+
recoverability: "retrying",
|
|
17102
|
+
requiresUserAction: false,
|
|
17103
|
+
suggestedAction: "Wait for the watch session to sync the latest version and retry the save."
|
|
17104
|
+
})
|
|
16944
17105
|
});
|
|
16945
17106
|
if (!this.syncCallback) throw createSaveError.noSyncCallback();
|
|
16946
17107
|
logger_logger.progressUpdate("sync", "Syncing back");
|
|
@@ -16955,6 +17116,18 @@ var __webpack_exports__ = {};
|
|
|
16955
17116
|
if (0 === newSaveArray.length) return;
|
|
16956
17117
|
await this.sendSavesToAnvil(newSaveArray, newFilePaths, retryCount + 1);
|
|
16957
17118
|
}
|
|
17119
|
+
getConflictDiagnosticInfo(json_resp) {
|
|
17120
|
+
if (json_resp.overtaken) return {
|
|
17121
|
+
reason: "Save overtaken by another operation"
|
|
17122
|
+
};
|
|
17123
|
+
if (json_resp.latest_version) return {
|
|
17124
|
+
reason: `Version conflict (latest: ${json_resp.latest_version.substring(0, 8)})`,
|
|
17125
|
+
latestVersion: json_resp.latest_version
|
|
17126
|
+
};
|
|
17127
|
+
return {
|
|
17128
|
+
reason: "Unknown conflict"
|
|
17129
|
+
};
|
|
17130
|
+
}
|
|
16958
17131
|
async handleSuccess(json_resp) {
|
|
16959
17132
|
const version = json_resp.version;
|
|
16960
17133
|
this.config.setCommitId(version);
|
|
@@ -17313,11 +17486,26 @@ var __webpack_exports__ = {};
|
|
|
17313
17486
|
logger_logger.progressEnd("remote-sync", message);
|
|
17314
17487
|
} catch (e) {
|
|
17315
17488
|
logger_logger.progressEnd("remote-sync", "Sync failed");
|
|
17489
|
+
this.emitRemoteSyncFailed(e, this.currentBranch, commitHash);
|
|
17316
17490
|
logger_logger.error(`Failed to sync remote changes: ${errors_getErrorMessage(e)}`);
|
|
17317
17491
|
}
|
|
17318
17492
|
});
|
|
17319
17493
|
await this.wsClient.connect();
|
|
17320
17494
|
}
|
|
17495
|
+
emitRemoteSyncFailed(error, branch, commitHash) {
|
|
17496
|
+
const diagnostic = createWatchDiagnostic(error, {
|
|
17497
|
+
branch,
|
|
17498
|
+
recoverability: "requires_user_action",
|
|
17499
|
+
requiresUserAction: true,
|
|
17500
|
+
suggestedAction: "Inspect the remote sync failure, resolve any repository or authentication issue, then retry syncing."
|
|
17501
|
+
});
|
|
17502
|
+
this.emit("remote-sync-failed", {
|
|
17503
|
+
branch,
|
|
17504
|
+
commitHash,
|
|
17505
|
+
error: diagnostic.message,
|
|
17506
|
+
...diagnostic
|
|
17507
|
+
});
|
|
17508
|
+
}
|
|
17321
17509
|
async syncRemoteChanges(knownLocalChanges) {
|
|
17322
17510
|
return this.syncManager.syncRemoteChanges(knownLocalChanges);
|
|
17323
17511
|
}
|
|
@@ -19866,14 +20054,23 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get")).catch((
|
|
|
19866
20054
|
process.exit(1);
|
|
19867
20055
|
}
|
|
19868
20056
|
});
|
|
19869
|
-
session.on("validation-failed", (
|
|
19870
|
-
logger_logger.error(external_chalk_default().red(`Validation failed: ${reason}`));
|
|
19871
|
-
logger_logger.verbose(external_chalk_default().yellow(`
|
|
19872
|
-
logger_logger.verbose(external_chalk_default().yellow(
|
|
20057
|
+
session.on("validation-failed", (event)=>{
|
|
20058
|
+
logger_logger.error(external_chalk_default().red(`Validation failed: ${event.reason}`));
|
|
20059
|
+
if (event.code) logger_logger.verbose(external_chalk_default().yellow(` Code: ${event.code}`));
|
|
20060
|
+
logger_logger.verbose(external_chalk_default().yellow(` Current branch: ${event.currentBranch}`));
|
|
20061
|
+
logger_logger.verbose(external_chalk_default().yellow(` ${event.suggestedAction ?? "Please restart anvil to re-validate the branch."}`));
|
|
19873
20062
|
session.cleanup();
|
|
19874
20063
|
process.exit(1);
|
|
19875
20064
|
});
|
|
19876
|
-
session.on("
|
|
20065
|
+
session.on("remote-sync-failed", (event)=>{
|
|
20066
|
+
const shortHash = event.commitHash.substring(0, 8);
|
|
20067
|
+
logger_logger.error(formatDiagnosticMessage(`Remote sync failed on ${event.branch} at ${shortHash}`, event, event.error));
|
|
20068
|
+
logSuggestedAction(event);
|
|
20069
|
+
});
|
|
20070
|
+
session.on("max-retries-exceeded", async (event)=>{
|
|
20071
|
+
logger_logger.warn(`Save conflict retry limit reached after ${event.retries} retries${event.reason ? `: ${event.reason}` : ""}.`);
|
|
20072
|
+
if (event.code) logger_logger.verbose(external_chalk_default().yellow(` Code: ${event.code}`));
|
|
20073
|
+
logSuggestedAction(event);
|
|
19877
20074
|
if (autoMode) {
|
|
19878
20075
|
logger_logger.info(external_chalk_default().cyan("→ Auto-restarting watch session..."));
|
|
19879
20076
|
session.cleanup();
|
|
@@ -19903,11 +20100,26 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get")).catch((
|
|
|
19903
20100
|
logger_logger.progressEnd("save");
|
|
19904
20101
|
} catch (e) {
|
|
19905
20102
|
logger_logger.progressEnd("save", "Failed");
|
|
19906
|
-
logger_logger.error(
|
|
20103
|
+
logger_logger.error(formatDiagnosticMessage("Failed to save", e, errors_getErrorMessage(e)));
|
|
20104
|
+
logSuggestedAction(e);
|
|
19907
20105
|
}
|
|
19908
20106
|
}
|
|
19909
20107
|
await session.startWatching();
|
|
19910
20108
|
}
|
|
20109
|
+
function formatDiagnosticMessage(prefix, error, fallbackMessage) {
|
|
20110
|
+
const code = getDiagnosticCode(error);
|
|
20111
|
+
return code ? `${prefix} [${code}]: ${fallbackMessage}` : `${prefix}: ${fallbackMessage}`;
|
|
20112
|
+
}
|
|
20113
|
+
function getDiagnosticCode(error) {
|
|
20114
|
+
if ("object" != typeof error || null === error) return;
|
|
20115
|
+
const code = error.code;
|
|
20116
|
+
return "string" == typeof code && code.length > 0 ? code : void 0;
|
|
20117
|
+
}
|
|
20118
|
+
function logSuggestedAction(error) {
|
|
20119
|
+
if ("object" != typeof error || null === error) return;
|
|
20120
|
+
const suggestedAction = error.suggestedAction;
|
|
20121
|
+
if ("string" == typeof suggestedAction && suggestedAction.length > 0) logger_logger.warn(suggestedAction);
|
|
20122
|
+
}
|
|
19911
20123
|
async function handleWatchCommand(options) {
|
|
19912
20124
|
const invoked = process.argv[2];
|
|
19913
20125
|
if ("sync" === invoked) {
|
package/dist/commands/watch.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ interface SyncStartDeps {
|
|
|
40
40
|
recheckSyncStatus: typeof recheckSyncStatus;
|
|
41
41
|
startWatchingWithEventHandlers: typeof startWatchingWithEventHandlers;
|
|
42
42
|
}
|
|
43
|
+
type WatchSessionHandlerTarget = Pick<WatchSession, "hasUncommittedChanges" | "on" | "forceSave" | "startWatching" | "cleanup">;
|
|
43
44
|
export declare function resolveWatchOpenPath(repoPath: string): string;
|
|
44
45
|
export declare function openWatchPath(targetPath: string, deps?: OpenPathDeps): Promise<void>;
|
|
45
46
|
export declare function configureWatchGitAuth(options: {
|
|
@@ -86,7 +87,7 @@ export declare function checkSyncStatusAndStart(session: Pick<WatchSession, "syn
|
|
|
86
87
|
stagedOnly: boolean;
|
|
87
88
|
username?: string;
|
|
88
89
|
}, deps?: SyncStartDeps): Promise<boolean>;
|
|
89
|
-
declare function startWatchingWithEventHandlers(session:
|
|
90
|
+
export declare function startWatchingWithEventHandlers(session: WatchSessionHandlerTarget, options: {
|
|
90
91
|
autoMode: boolean;
|
|
91
92
|
repoPath: string;
|
|
92
93
|
appId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAKlD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACH,gBAAgB,EASnB,MAAM,QAAQ,CAAC;AAMhB,OAAO,EAAE,+BAA+B,EAAqB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE7G,OAAO,EAAE,YAAY,EAA6B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAKlD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACH,gBAAgB,EASnB,MAAM,QAAQ,CAAC;AAMhB,OAAO,EAAE,+BAA+B,EAAqB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE7G,OAAO,EAAE,YAAY,EAA6B,MAAM,uBAAuB,CAAC;AAGhF,KAAK,mBAAmB,GAClB;IAAE,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvD,KAAK,gBAAgB,GACf;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA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BAAuB,CACzC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,uBAAuB,GAAG,eAAe,GAAG,SAAS,CAAC,EACjG,OAAO,EAAE;IACL,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,IAAI,GAAE,aAAoC,GAC3C,OAAO,CAAC,OAAO,CAAC,CA+QlB;AAED,wBAAsB,8BAA8B,CAChD,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE;IACL,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,GACF,OAAO,CAAC,IAAI,CAAC,CA0Gf;AAySD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CA+C9D"}
|
package/dist/index.js
CHANGED
|
@@ -7388,8 +7388,9 @@ var __webpack_exports__ = {};
|
|
|
7388
7388
|
login: ()=>auth_login,
|
|
7389
7389
|
resetConfig: ()=>resetConfig,
|
|
7390
7390
|
FormTemplateValidationResult: ()=>validators_namespaceObject.FormTemplateValidationResult,
|
|
7391
|
-
|
|
7391
|
+
createWatchDiagnostic: ()=>createWatchDiagnostic,
|
|
7392
7392
|
ValidationTarget: ()=>validators_namespaceObject.ValidationTarget,
|
|
7393
|
+
detectAppIdsByCommitLookup: ()=>anvil_api_detectAppIdsByCommitLookup,
|
|
7393
7394
|
sanitizeDirectoryName: ()=>sanitizeDirectoryName,
|
|
7394
7395
|
validatePath: ()=>validatePath,
|
|
7395
7396
|
LoginResult: ()=>auth_namespaceObject.LoginResult,
|
|
@@ -7406,6 +7407,7 @@ var __webpack_exports__ = {};
|
|
|
7406
7407
|
filterCandidates: ()=>anvil_api_filterCandidates,
|
|
7407
7408
|
CheckoutOptions: ()=>checkout_namespaceObject.CheckoutOptions,
|
|
7408
7409
|
isPathInsideGitRepo: ()=>isPathInsideGitRepo,
|
|
7410
|
+
createWatchDiagnosticFromMessage: ()=>createWatchDiagnosticFromMessage,
|
|
7409
7411
|
normalizeAnvilUrl: ()=>config_normalizeAnvilUrl,
|
|
7410
7412
|
ValidationIssue: ()=>validators_namespaceObject.ValidationIssue,
|
|
7411
7413
|
getTokensForUrl: ()=>getTokensForUrl,
|
|
@@ -16522,6 +16524,158 @@ var __webpack_exports__ = {};
|
|
|
16522
16524
|
}
|
|
16523
16525
|
return changes;
|
|
16524
16526
|
}
|
|
16527
|
+
function createWatchDiagnostic(error, context = {}) {
|
|
16528
|
+
const base = diagnosticDefaults(error);
|
|
16529
|
+
return {
|
|
16530
|
+
...base,
|
|
16531
|
+
message: errors_getErrorMessage(error),
|
|
16532
|
+
recoverability: context.recoverability ?? base.recoverability,
|
|
16533
|
+
requiresUserAction: context.requiresUserAction ?? base.requiresUserAction,
|
|
16534
|
+
suggestedAction: context.suggestedAction ?? base.suggestedAction,
|
|
16535
|
+
branch: context.branch ?? base.branch,
|
|
16536
|
+
fileCount: context.fileCount,
|
|
16537
|
+
retryAttempt: context.retryAttempt,
|
|
16538
|
+
maxRetries: context.maxRetries,
|
|
16539
|
+
status: context.status ?? base.status,
|
|
16540
|
+
gitCommand: context.gitCommand ?? base.gitCommand,
|
|
16541
|
+
latestVersion: context.latestVersion ?? base.latestVersion
|
|
16542
|
+
};
|
|
16543
|
+
}
|
|
16544
|
+
function createWatchDiagnosticFromMessage(code, message, context = {}) {
|
|
16545
|
+
return {
|
|
16546
|
+
code,
|
|
16547
|
+
message,
|
|
16548
|
+
recoverability: context.recoverability ?? "requires_user_action",
|
|
16549
|
+
requiresUserAction: context.requiresUserAction ?? true,
|
|
16550
|
+
suggestedAction: context.suggestedAction ?? "Review the watch error and intervene before continuing.",
|
|
16551
|
+
branch: context.branch,
|
|
16552
|
+
fileCount: context.fileCount,
|
|
16553
|
+
retryAttempt: context.retryAttempt,
|
|
16554
|
+
maxRetries: context.maxRetries,
|
|
16555
|
+
status: context.status,
|
|
16556
|
+
gitCommand: context.gitCommand,
|
|
16557
|
+
latestVersion: context.latestVersion
|
|
16558
|
+
};
|
|
16559
|
+
}
|
|
16560
|
+
function diagnosticDefaults(error) {
|
|
16561
|
+
if (!errors_isAnvilError(error)) return {
|
|
16562
|
+
code: error instanceof Error ? "unknown_error" : "unknown_non_error",
|
|
16563
|
+
recoverability: "requires_user_action",
|
|
16564
|
+
requiresUserAction: true,
|
|
16565
|
+
suggestedAction: "Review the error details and retry once the underlying issue is resolved."
|
|
16566
|
+
};
|
|
16567
|
+
switch(error.type){
|
|
16568
|
+
case "auth_required":
|
|
16569
|
+
case "auth_expired":
|
|
16570
|
+
case "auth_invalid":
|
|
16571
|
+
case "token_refresh_failed":
|
|
16572
|
+
return authDiagnostic(error);
|
|
16573
|
+
case "git_not_initialized":
|
|
16574
|
+
case "git_command_failed":
|
|
16575
|
+
case "git_fetch_failed":
|
|
16576
|
+
return gitDiagnostic(error);
|
|
16577
|
+
case "network_error":
|
|
16578
|
+
case "server_error":
|
|
16579
|
+
case "timeout":
|
|
16580
|
+
return networkDiagnostic(error);
|
|
16581
|
+
case "save_conflict":
|
|
16582
|
+
case "save_validation_failed":
|
|
16583
|
+
case "no_sync_callback":
|
|
16584
|
+
case "max_retries_exceeded":
|
|
16585
|
+
return saveDiagnostic(error);
|
|
16586
|
+
case "branch_not_found":
|
|
16587
|
+
case "branch_diverged":
|
|
16588
|
+
case "branch_behind":
|
|
16589
|
+
case "branch_ahead":
|
|
16590
|
+
case "sync_conflict":
|
|
16591
|
+
case "detached_head":
|
|
16592
|
+
case "uncommitted_changes":
|
|
16593
|
+
return {
|
|
16594
|
+
code: error.type,
|
|
16595
|
+
recoverability: "requires_user_action",
|
|
16596
|
+
requiresUserAction: true,
|
|
16597
|
+
suggestedAction: "Resolve the branch sync state, then restart or retry the watch session."
|
|
16598
|
+
};
|
|
16599
|
+
case "app_not_found":
|
|
16600
|
+
case "app_access_denied":
|
|
16601
|
+
case "app_invalid":
|
|
16602
|
+
return {
|
|
16603
|
+
code: error.type,
|
|
16604
|
+
recoverability: "requires_user_action",
|
|
16605
|
+
requiresUserAction: true,
|
|
16606
|
+
suggestedAction: "Check the app ID, account, and permissions before retrying."
|
|
16607
|
+
};
|
|
16608
|
+
case "invalid_anvil_app":
|
|
16609
|
+
case "missing_anvil_yaml":
|
|
16610
|
+
case "invalid_yaml":
|
|
16611
|
+
return {
|
|
16612
|
+
code: error.type,
|
|
16613
|
+
recoverability: "requires_user_action",
|
|
16614
|
+
requiresUserAction: true,
|
|
16615
|
+
suggestedAction: "Fix the local app metadata or YAML validation error before retrying."
|
|
16616
|
+
};
|
|
16617
|
+
}
|
|
16618
|
+
}
|
|
16619
|
+
function authDiagnostic(error) {
|
|
16620
|
+
return {
|
|
16621
|
+
code: error.type,
|
|
16622
|
+
recoverability: "requires_user_action",
|
|
16623
|
+
requiresUserAction: true,
|
|
16624
|
+
suggestedAction: "Refresh authentication or run anvil login for the target Anvil account, then retry."
|
|
16625
|
+
};
|
|
16626
|
+
}
|
|
16627
|
+
function gitDiagnostic(error) {
|
|
16628
|
+
return {
|
|
16629
|
+
code: error.type,
|
|
16630
|
+
recoverability: "requires_user_action",
|
|
16631
|
+
requiresUserAction: true,
|
|
16632
|
+
suggestedAction: "Inspect the repository state and resolve the Git error before retrying.",
|
|
16633
|
+
gitCommand: "git_command_failed" === error.type ? error.command : void 0
|
|
16634
|
+
};
|
|
16635
|
+
}
|
|
16636
|
+
function networkDiagnostic(error) {
|
|
16637
|
+
return {
|
|
16638
|
+
code: error.type,
|
|
16639
|
+
recoverability: "server_error" === error.type ? "requires_user_action" : "recoverable",
|
|
16640
|
+
requiresUserAction: "server_error" === error.type,
|
|
16641
|
+
suggestedAction: "server_error" === error.type ? "Check the server response and retry after the service-side issue is resolved." : "Retry after network connectivity is restored.",
|
|
16642
|
+
status: "server_error" === error.type ? error.status : void 0
|
|
16643
|
+
};
|
|
16644
|
+
}
|
|
16645
|
+
function saveDiagnostic(error) {
|
|
16646
|
+
switch(error.type){
|
|
16647
|
+
case "save_conflict":
|
|
16648
|
+
return {
|
|
16649
|
+
code: error.type,
|
|
16650
|
+
recoverability: "retrying",
|
|
16651
|
+
requiresUserAction: false,
|
|
16652
|
+
suggestedAction: "Wait for the watch session to sync the latest version and retry the save.",
|
|
16653
|
+
latestVersion: error.latestVersion
|
|
16654
|
+
};
|
|
16655
|
+
case "save_validation_failed":
|
|
16656
|
+
return {
|
|
16657
|
+
code: error.type,
|
|
16658
|
+
recoverability: "requires_user_action",
|
|
16659
|
+
requiresUserAction: true,
|
|
16660
|
+
suggestedAction: "Restart the watch session on the current validated branch before continuing.",
|
|
16661
|
+
branch: error.currentBranch
|
|
16662
|
+
};
|
|
16663
|
+
case "no_sync_callback":
|
|
16664
|
+
return {
|
|
16665
|
+
code: error.type,
|
|
16666
|
+
recoverability: "fatal",
|
|
16667
|
+
requiresUserAction: true,
|
|
16668
|
+
suggestedAction: "Restart the watch session; conflict recovery is not configured."
|
|
16669
|
+
};
|
|
16670
|
+
case "max_retries_exceeded":
|
|
16671
|
+
return {
|
|
16672
|
+
code: error.type,
|
|
16673
|
+
recoverability: "requires_user_action",
|
|
16674
|
+
requiresUserAction: true,
|
|
16675
|
+
suggestedAction: "Sync or resolve conflicting changes manually, then restart the watch session."
|
|
16676
|
+
};
|
|
16677
|
+
}
|
|
16678
|
+
}
|
|
16525
16679
|
class SaveProcessor extends Emitter {
|
|
16526
16680
|
hasPendingChanges = false;
|
|
16527
16681
|
debounceTimer = null;
|
|
@@ -16597,10 +16751,15 @@ var __webpack_exports__ = {};
|
|
|
16597
16751
|
finalMessage = result.skipped ? void 0 : await this.getSuccessMessage();
|
|
16598
16752
|
logger_logger.progressEnd("sync", finalMessage);
|
|
16599
16753
|
} catch (e) {
|
|
16600
|
-
|
|
16601
|
-
|
|
16754
|
+
const diagnostic = createWatchDiagnostic(e, {
|
|
16755
|
+
branch: this.config.getCurrentBranch(),
|
|
16602
16756
|
fileCount
|
|
16603
16757
|
});
|
|
16758
|
+
this.emit("save-failed", {
|
|
16759
|
+
error: diagnostic.message,
|
|
16760
|
+
fileCount,
|
|
16761
|
+
...diagnostic
|
|
16762
|
+
});
|
|
16604
16763
|
this.emit("save-complete", {
|
|
16605
16764
|
newCommitId: this.config.getCommitId(),
|
|
16606
16765
|
fileCount
|
|
@@ -16861,21 +17020,29 @@ var __webpack_exports__ = {};
|
|
|
16861
17020
|
if (branchFromGit !== currentBranch) {
|
|
16862
17021
|
const reason = `Branch ${branchFromGit} not validated`;
|
|
16863
17022
|
logger_logger.error(external_chalk_default().red(`Cannot sync - ${reason}`));
|
|
17023
|
+
const error = createSaveError.validationFailed(reason, branchFromGit);
|
|
16864
17024
|
this.emit("validation-failed", {
|
|
16865
17025
|
reason,
|
|
16866
|
-
currentBranch: branchFromGit
|
|
17026
|
+
currentBranch: branchFromGit,
|
|
17027
|
+
...createWatchDiagnostic(error, {
|
|
17028
|
+
branch: branchFromGit
|
|
17029
|
+
})
|
|
16867
17030
|
});
|
|
16868
|
-
throw
|
|
17031
|
+
throw error;
|
|
16869
17032
|
}
|
|
16870
17033
|
} catch (e) {
|
|
16871
17034
|
if ("save_validation_failed" === e.type) throw e;
|
|
16872
17035
|
const reason = "Branch unknown not validated";
|
|
16873
17036
|
logger_logger.error(external_chalk_default().red(`Cannot sync - ${reason}`));
|
|
17037
|
+
const error = createSaveError.validationFailed(reason, "unknown");
|
|
16874
17038
|
this.emit("validation-failed", {
|
|
16875
17039
|
reason,
|
|
16876
|
-
currentBranch: "unknown"
|
|
17040
|
+
currentBranch: "unknown",
|
|
17041
|
+
...createWatchDiagnostic(error, {
|
|
17042
|
+
branch: "unknown"
|
|
17043
|
+
})
|
|
16877
17044
|
});
|
|
16878
|
-
throw
|
|
17045
|
+
throw error;
|
|
16879
17046
|
}
|
|
16880
17047
|
const validToken = await auth_getValidAuthToken(this.config.anvilUrl, this.config.username);
|
|
16881
17048
|
this.config.setAuthToken(validToken);
|
|
@@ -16937,29 +17104,41 @@ var __webpack_exports__ = {};
|
|
|
16937
17104
|
throw createAuthError.invalid(detailedMsg);
|
|
16938
17105
|
}
|
|
16939
17106
|
async handleConflict(json_resp, originalFilePaths, retryCount) {
|
|
17107
|
+
const conflict = this.getConflictDiagnosticInfo(json_resp);
|
|
16940
17108
|
if (retryCount >= this.MAX_RETRIES) {
|
|
16941
17109
|
logger_logger.error(`Save failed after ${this.MAX_RETRIES} retries due to version conflicts.`);
|
|
16942
17110
|
logger_logger.warn("This usually means someone else is editing the app at the same time.");
|
|
17111
|
+
const error = createSaveError.maxRetriesExceeded(this.MAX_RETRIES);
|
|
16943
17112
|
this.emit("max-retries-exceeded", {
|
|
16944
|
-
retries: this.MAX_RETRIES
|
|
17113
|
+
retries: this.MAX_RETRIES,
|
|
17114
|
+
reason: conflict.reason,
|
|
17115
|
+
...createWatchDiagnostic(error, {
|
|
17116
|
+
branch: this.config.getCurrentBranch(),
|
|
17117
|
+
maxRetries: this.MAX_RETRIES,
|
|
17118
|
+
latestVersion: conflict.latestVersion
|
|
17119
|
+
})
|
|
16945
17120
|
});
|
|
16946
|
-
throw
|
|
16947
|
-
}
|
|
16948
|
-
|
|
16949
|
-
if (json_resp.
|
|
16950
|
-
|
|
16951
|
-
logger_logger.warn(`${conflictReason}, fetching latest and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
16952
|
-
} else if (json_resp.latest_version) {
|
|
16953
|
-
conflictReason = `Version conflict (latest: ${json_resp.latest_version.substring(0, 8)})`;
|
|
16954
|
-
logger_logger.warn(`Version conflict detected, syncing to ${json_resp.latest_version.substring(0, 8)} and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
16955
|
-
} else {
|
|
17121
|
+
throw error;
|
|
17122
|
+
}
|
|
17123
|
+
if (json_resp.overtaken) logger_logger.warn(`${conflict.reason}, fetching latest and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
17124
|
+
else if (json_resp.latest_version) logger_logger.warn(`Version conflict detected, syncing to ${json_resp.latest_version.substring(0, 8)} and retrying (attempt ${retryCount + 1}/${this.MAX_RETRIES})`);
|
|
17125
|
+
else {
|
|
16956
17126
|
logger_logger.error("Save failed with 409 but no conflict info provided");
|
|
16957
17127
|
throw createSaveError.conflict();
|
|
16958
17128
|
}
|
|
16959
17129
|
this.emit("sync-conflict", {
|
|
16960
17130
|
retryAttempt: retryCount + 1,
|
|
16961
17131
|
maxRetries: this.MAX_RETRIES,
|
|
16962
|
-
reason:
|
|
17132
|
+
reason: conflict.reason,
|
|
17133
|
+
...createWatchDiagnostic(createSaveError.conflict(conflict.latestVersion, json_resp.overtaken), {
|
|
17134
|
+
branch: this.config.getCurrentBranch(),
|
|
17135
|
+
retryAttempt: retryCount + 1,
|
|
17136
|
+
maxRetries: this.MAX_RETRIES,
|
|
17137
|
+
latestVersion: conflict.latestVersion,
|
|
17138
|
+
recoverability: "retrying",
|
|
17139
|
+
requiresUserAction: false,
|
|
17140
|
+
suggestedAction: "Wait for the watch session to sync the latest version and retry the save."
|
|
17141
|
+
})
|
|
16963
17142
|
});
|
|
16964
17143
|
if (!this.syncCallback) throw createSaveError.noSyncCallback();
|
|
16965
17144
|
logger_logger.progressUpdate("sync", "Syncing back");
|
|
@@ -16974,6 +17153,18 @@ var __webpack_exports__ = {};
|
|
|
16974
17153
|
if (0 === newSaveArray.length) return;
|
|
16975
17154
|
await this.sendSavesToAnvil(newSaveArray, newFilePaths, retryCount + 1);
|
|
16976
17155
|
}
|
|
17156
|
+
getConflictDiagnosticInfo(json_resp) {
|
|
17157
|
+
if (json_resp.overtaken) return {
|
|
17158
|
+
reason: "Save overtaken by another operation"
|
|
17159
|
+
};
|
|
17160
|
+
if (json_resp.latest_version) return {
|
|
17161
|
+
reason: `Version conflict (latest: ${json_resp.latest_version.substring(0, 8)})`,
|
|
17162
|
+
latestVersion: json_resp.latest_version
|
|
17163
|
+
};
|
|
17164
|
+
return {
|
|
17165
|
+
reason: "Unknown conflict"
|
|
17166
|
+
};
|
|
17167
|
+
}
|
|
16977
17168
|
async handleSuccess(json_resp) {
|
|
16978
17169
|
const version = json_resp.version;
|
|
16979
17170
|
this.config.setCommitId(version);
|
|
@@ -17332,11 +17523,26 @@ var __webpack_exports__ = {};
|
|
|
17332
17523
|
logger_logger.progressEnd("remote-sync", message);
|
|
17333
17524
|
} catch (e) {
|
|
17334
17525
|
logger_logger.progressEnd("remote-sync", "Sync failed");
|
|
17526
|
+
this.emitRemoteSyncFailed(e, this.currentBranch, commitHash);
|
|
17335
17527
|
logger_logger.error(`Failed to sync remote changes: ${errors_getErrorMessage(e)}`);
|
|
17336
17528
|
}
|
|
17337
17529
|
});
|
|
17338
17530
|
await this.wsClient.connect();
|
|
17339
17531
|
}
|
|
17532
|
+
emitRemoteSyncFailed(error, branch, commitHash) {
|
|
17533
|
+
const diagnostic = createWatchDiagnostic(error, {
|
|
17534
|
+
branch,
|
|
17535
|
+
recoverability: "requires_user_action",
|
|
17536
|
+
requiresUserAction: true,
|
|
17537
|
+
suggestedAction: "Inspect the remote sync failure, resolve any repository or authentication issue, then retry syncing."
|
|
17538
|
+
});
|
|
17539
|
+
this.emit("remote-sync-failed", {
|
|
17540
|
+
branch,
|
|
17541
|
+
commitHash,
|
|
17542
|
+
error: diagnostic.message,
|
|
17543
|
+
...diagnostic
|
|
17544
|
+
});
|
|
17545
|
+
}
|
|
17340
17546
|
async syncRemoteChanges(knownLocalChanges) {
|
|
17341
17547
|
return this.syncManager.syncRemoteChanges(knownLocalChanges);
|
|
17342
17548
|
}
|
|
@@ -18341,6 +18547,8 @@ exports.ValidationIssue = __webpack_exports__.ValidationIssue;
|
|
|
18341
18547
|
exports.ValidationTarget = __webpack_exports__.ValidationTarget;
|
|
18342
18548
|
exports.WatchSession = __webpack_exports__.WatchSession;
|
|
18343
18549
|
exports.checkUncommittedChanges = __webpack_exports__.checkUncommittedChanges;
|
|
18550
|
+
exports.createWatchDiagnostic = __webpack_exports__.createWatchDiagnostic;
|
|
18551
|
+
exports.createWatchDiagnosticFromMessage = __webpack_exports__.createWatchDiagnosticFromMessage;
|
|
18344
18552
|
exports.deleteConfig = __webpack_exports__.deleteConfig;
|
|
18345
18553
|
exports.detectAppIdsByCommitLookup = __webpack_exports__.detectAppIdsByCommitLookup;
|
|
18346
18554
|
exports.detectAppIdsFromAllRemotes = __webpack_exports__.detectAppIdsFromAllRemotes;
|
|
@@ -18422,6 +18630,8 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
18422
18630
|
"ValidationTarget",
|
|
18423
18631
|
"WatchSession",
|
|
18424
18632
|
"checkUncommittedChanges",
|
|
18633
|
+
"createWatchDiagnostic",
|
|
18634
|
+
"createWatchDiagnosticFromMessage",
|
|
18425
18635
|
"deleteConfig",
|
|
18426
18636
|
"detectAppIdsByCommitLookup",
|
|
18427
18637
|
"detectAppIdsFromAllRemotes",
|
|
@@ -2,6 +2,7 @@ import type { EditorYamlManager } from "../EditorYaml";
|
|
|
2
2
|
import { Emitter } from "../Emitter";
|
|
3
3
|
import { GitService } from "../services/git";
|
|
4
4
|
import type { FileChange } from "./ConflictResolver";
|
|
5
|
+
import { type WatchDiagnostic } from "./diagnostics";
|
|
5
6
|
export interface SaveProcessorEvents {
|
|
6
7
|
"save-started": {
|
|
7
8
|
fileCount: number;
|
|
@@ -13,7 +14,7 @@ export interface SaveProcessorEvents {
|
|
|
13
14
|
"save-failed": {
|
|
14
15
|
error: string;
|
|
15
16
|
fileCount: number;
|
|
16
|
-
};
|
|
17
|
+
} & WatchDiagnostic;
|
|
17
18
|
"save-complete": {
|
|
18
19
|
newCommitId: string;
|
|
19
20
|
fileCount: number;
|
|
@@ -21,15 +22,16 @@ export interface SaveProcessorEvents {
|
|
|
21
22
|
"validation-failed": {
|
|
22
23
|
reason: string;
|
|
23
24
|
currentBranch: string;
|
|
24
|
-
};
|
|
25
|
+
} & WatchDiagnostic;
|
|
25
26
|
"sync-conflict": {
|
|
26
27
|
retryAttempt: number;
|
|
27
28
|
maxRetries: number;
|
|
28
29
|
reason: string;
|
|
29
|
-
};
|
|
30
|
+
} & WatchDiagnostic;
|
|
30
31
|
"max-retries-exceeded": {
|
|
31
32
|
retries: number;
|
|
32
|
-
|
|
33
|
+
reason: string;
|
|
34
|
+
} & WatchDiagnostic;
|
|
33
35
|
}
|
|
34
36
|
export interface SaveProcessorConfig {
|
|
35
37
|
repoPath: string;
|
|
@@ -87,6 +89,7 @@ export declare class SaveProcessor extends Emitter<SaveProcessorEvents> {
|
|
|
87
89
|
private sanitizePayload;
|
|
88
90
|
private handleAuthError;
|
|
89
91
|
private handleConflict;
|
|
92
|
+
private getConflictDiagnosticInfo;
|
|
90
93
|
private handleSuccess;
|
|
91
94
|
rerouteChanges(changes: FileChange[]): Promise<{
|
|
92
95
|
newSaveArray: Array<[any[], any]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveProcessor.d.ts","sourceRoot":"","sources":["../../src/watch/SaveProcessor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAarC,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveProcessor.d.ts","sourceRoot":"","sources":["../../src/watch/SaveProcessor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAarC,OAAO,EAAE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gBAAgB;YA2BhB,qBAAqB;IAyDnC,OAAO,CAAC,aAAa;YAoBP,gBAAgB;IAoF9B,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,eAAe;YAcT,cAAc;IA2E5B,OAAO,CAAC,yBAAyB;YAanB,aAAa;IAUrB,cAAc,CAChB,OAAO,EAAE,UAAU,EAAE,GACtB,OAAO,CAAC;QAAE,YAAY,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAiC5E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type WatchRecoverability = "retrying" | "recoverable" | "requires_user_action" | "fatal";
|
|
2
|
+
export interface WatchDiagnostic {
|
|
3
|
+
code: string;
|
|
4
|
+
message: string;
|
|
5
|
+
recoverability: WatchRecoverability;
|
|
6
|
+
requiresUserAction: boolean;
|
|
7
|
+
suggestedAction: string;
|
|
8
|
+
branch?: string;
|
|
9
|
+
fileCount?: number;
|
|
10
|
+
retryAttempt?: number;
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
status?: number;
|
|
13
|
+
gitCommand?: string;
|
|
14
|
+
latestVersion?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface WatchDiagnosticContext {
|
|
17
|
+
branch?: string;
|
|
18
|
+
fileCount?: number;
|
|
19
|
+
retryAttempt?: number;
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
status?: number;
|
|
22
|
+
gitCommand?: string;
|
|
23
|
+
latestVersion?: string;
|
|
24
|
+
recoverability?: WatchRecoverability;
|
|
25
|
+
requiresUserAction?: boolean;
|
|
26
|
+
suggestedAction?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function createWatchDiagnostic(error: unknown, context?: WatchDiagnosticContext): WatchDiagnostic;
|
|
29
|
+
export declare function createWatchDiagnosticFromMessage(code: string, message: string, context?: WatchDiagnosticContext): WatchDiagnostic;
|
|
30
|
+
//# sour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GAAE,sBAA2B,GACrC,eAAe,CAejB"}
|
package/dist/watch/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/watch/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/watch/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|