@codeyam-editor/codeyam-editor 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm/cli.js +5 -1
- package/npm/cloud-branch-switch.js +1 -1
- package/npm/cloud.js +3166 -150
- package/npm/codesign-plan.js +68 -0
- package/npm/container.js +3 -0
- package/npm/disk-pressure.js +78 -0
- package/npm/editor-dev.js +96 -15
- package/npm/editor.js +85 -37
- package/npm/empty-project-dir.js +92 -7
- package/npm/fleet-add-failure.js +252 -0
- package/npm/fleet-asset-version.js +37 -0
- package/npm/fleet-auth-health.js +213 -0
- package/npm/fleet-auth.js +6 -1
- package/npm/fleet-build-data.js +109 -5
- package/npm/fleet-cleanup.js +232 -16
- package/npm/fleet-destroy-safety.js +272 -0
- package/npm/fleet-early-roster.js +87 -0
- package/npm/fleet-effect-poll.js +110 -0
- package/npm/fleet-effect-status.js +33 -32
- package/npm/fleet-env.js +86 -0
- package/npm/fleet-ghcr-secret.js +129 -0
- package/npm/fleet-git-maintenance.js +142 -0
- package/npm/fleet-host-op-limiter.js +68 -0
- package/npm/fleet-host.js +74 -0
- package/npm/fleet-iap-token.js +165 -0
- package/npm/fleet-job-badge.js +1 -1
- package/npm/fleet-launchd.js +171 -0
- package/npm/fleet-live-status.js +155 -0
- package/npm/fleet-memory.js +245 -9
- package/npm/fleet-plans.js +233 -4
- package/npm/fleet-pool.js +75 -16
- package/npm/fleet-prewarm.js +241 -0
- package/npm/fleet-project-drift.js +58 -0
- package/npm/fleet-public-url.js +394 -0
- package/npm/fleet-queue.js +95 -1
- package/npm/fleet-reachability-debounce.js +69 -0
- package/npm/fleet-reachability.js +80 -0
- package/npm/fleet-reconcile.js +43 -1
- package/npm/fleet-reset.js +330 -13
- package/npm/fleet-roster.js +6 -8
- package/npm/fleet-running-plan.js +85 -0
- package/npm/fleet-self-update.js +142 -0
- package/npm/fleet-session-token-cache.js +65 -0
- package/npm/fleet-setup-steps.js +112 -0
- package/npm/fleet-sleep-status.js +33 -0
- package/npm/fleet-status-refs.js +96 -0
- package/npm/fleet-strand.js +181 -0
- package/npm/fleet-stuck-status.js +117 -0
- package/npm/fleet-vm-access.js +404 -0
- package/npm/fleet-vm-probe-target.js +282 -0
- package/npm/fleet-vm-readiness.js +237 -0
- package/npm/fleet-vm-slugs.js +116 -0
- package/npm/google-ingress.js +226 -0
- package/npm/ingress-invoke.js +770 -0
- package/npm/launch-config.js +386 -9
- package/npm/scenario-check.js +880 -37
- package/npm/scenario-handlers.js +154 -30
- package/npm/scenario-interactivity.js +145 -6
- package/npm/scenario-issues.js +13 -1
- package/npm/scenario-metrics.js +116 -1
- package/npm/scenario-mocks.js +144 -21
- package/npm/scenario-playwright.js +649 -38
- package/npm/script-drift.js +152 -0
- package/npm/utils.js +365 -52
- package/npm/vm-urls.js +69 -8
- package/package.json +5 -5
- package/ui/dist/assets/ContainerInspector-DgM0pTAx.js +2 -0
- package/ui/dist/assets/EditorShell-B7Q06uJ_.js +252 -0
- package/ui/dist/assets/EditorShell-DP5UY20G.css +1 -0
- package/ui/dist/assets/{Markdown-BHBqz-Mj.js → Markdown-Chgdf3PW.js} +1 -1
- package/ui/dist/assets/ProjectLauncherScreen-BRrEr8Ng.js +1 -0
- package/ui/dist/assets/ScenarioDataPanel-BeQfa28g.js +9 -0
- package/ui/dist/assets/{ScenarioDataPanel-DYP7pi_n.css → ScenarioDataPanel-C1LukYI6.css} +1 -1
- package/ui/dist/assets/ScenarioDataPanelFullPage-BLqRCxQX.js +1 -0
- package/ui/dist/assets/ScenarioRenderer-CIAxfHPh.js +21 -0
- package/ui/dist/assets/StepsSimulator-CymGgfbu.js +1 -0
- package/ui/dist/assets/index-BygCiJSb.css +1 -0
- package/ui/dist/assets/{index-BuK0lizt.js → index-DCHqRrwO.js} +9 -9
- package/ui/dist/assets/{markdown-v0F0UEt3.js → markdown-C9tbsVHX.js} +1 -1
- package/ui/dist/assets/react-nrLBr15I.js +28 -0
- package/ui/dist/assets/useEvents-S3Qk1Y_d.js +1 -0
- package/ui/dist/assets/useServerIdentity-B7rI0u3O.js +1 -0
- package/ui/dist/codeyam-mark.svg +4 -0
- package/ui/dist/codeyam-wordmark.svg +5 -0
- package/ui/dist/index.html +4 -4
- package/ui/dist/open-source/codeyam-counter.png +0 -0
- package/ui/dist/open-source/el-carot.png +0 -0
- package/ui/dist/open-source/tabcommand.png +0 -0
- package/ui/dist/assets/ContainerInspector-C8EkH4PP.js +0 -2
- package/ui/dist/assets/EditorShell-tMMdarZD.js +0 -187
- package/ui/dist/assets/ScenarioDataPanel-xWYGZOpo.js +0 -5
- package/ui/dist/assets/ScenarioDataPanelFullPage-5G6KuZgw.js +0 -1
- package/ui/dist/assets/ScenarioRenderer-CSdhX1Ak.js +0 -1
- package/ui/dist/assets/StepsSimulator-CRtmlyNZ.js +0 -1
- package/ui/dist/assets/index-BGqairFV.css +0 -1
- package/ui/dist/assets/react-CSS0HapR.js +0 -28
- package/ui/dist/assets/useEvents-DggWrtHe.js +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Given a list of files with their hash values, decide if there is any script drift.
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {Array<Object>} options.files
|
|
7
|
+
* Each file entry has:
|
|
8
|
+
* {
|
|
9
|
+
* path: string,
|
|
10
|
+
* localHash: string,
|
|
11
|
+
* remoteHash: string | null, // null indicates fetch/hash failure
|
|
12
|
+
* baseHash: string | null,
|
|
13
|
+
* dirty: boolean
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* Returns:
|
|
17
|
+
* {
|
|
18
|
+
* verdict: 'clean' | 'local-ahead' | 'stale' | 'diverged',
|
|
19
|
+
* staleFiles: string[] // List of paths that are stale/diverged
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
function classifyScriptDrift({ files }) {
|
|
23
|
+
if (!files || files.length === 0) {
|
|
24
|
+
return { verdict: 'clean', staleFiles: [] };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let hasStale = false;
|
|
28
|
+
let hasDiverged = false;
|
|
29
|
+
let hasLocalAhead = false;
|
|
30
|
+
const staleFiles = [];
|
|
31
|
+
|
|
32
|
+
for (const f of files) {
|
|
33
|
+
// If remoteHash or baseHash is missing/null/undefined, we treat it as fetch/hash failure.
|
|
34
|
+
// In that case, we cannot safely declare the file stale/diverged, so we pass through.
|
|
35
|
+
if (f.remoteHash === null || f.baseHash === null || f.remoteHash === undefined || f.baseHash === undefined) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const localHash = f.localHash;
|
|
40
|
+
const remoteHash = f.remoteHash;
|
|
41
|
+
const baseHash = f.baseHash;
|
|
42
|
+
const dirty = !!f.dirty;
|
|
43
|
+
|
|
44
|
+
// 1. Identical local and remote, and not dirty locally -> clean
|
|
45
|
+
if (localHash === remoteHash && !dirty) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 2. Remote hasn't changed from base, but local has changed (or is dirty)
|
|
50
|
+
if (remoteHash === baseHash) {
|
|
51
|
+
if (localHash !== baseHash || dirty) {
|
|
52
|
+
hasLocalAhead = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 3. Local hasn't changed from base, but remote has changed from base
|
|
56
|
+
else if (localHash === baseHash && !dirty) {
|
|
57
|
+
hasStale = true;
|
|
58
|
+
staleFiles.push(f.path);
|
|
59
|
+
}
|
|
60
|
+
// 4. Both local and remote have changed from base and they differ from each other
|
|
61
|
+
else {
|
|
62
|
+
hasDiverged = true;
|
|
63
|
+
staleFiles.push(f.path);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (hasDiverged) {
|
|
68
|
+
return { verdict: 'diverged', staleFiles };
|
|
69
|
+
}
|
|
70
|
+
if (hasStale) {
|
|
71
|
+
return { verdict: 'stale', staleFiles };
|
|
72
|
+
}
|
|
73
|
+
if (hasLocalAhead) {
|
|
74
|
+
return { verdict: 'local-ahead', staleFiles: [] };
|
|
75
|
+
}
|
|
76
|
+
return { verdict: 'clean', staleFiles: [] };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Decide, for one streamed provisioning script, whether the VM should receive the
|
|
81
|
+
* canonical remote-tip bytes or the local on-disk copy. The remote tip is the
|
|
82
|
+
* reviewed, canonical source: a checkout that is merely *behind* origin (a normal,
|
|
83
|
+
* expected consequence of an active fleet landing commits to these scripts) then
|
|
84
|
+
* streams exactly the bytes the drift guard expects — never stale on-disk bytes,
|
|
85
|
+
* never a false STALE abort. The local copy wins only when the operator authored
|
|
86
|
+
* content the remote tip does not have — an uncommitted (dirty) edit or a committed
|
|
87
|
+
* local-ahead change (developer mode / diverged) — or when the remote facts are
|
|
88
|
+
* unavailable (offline fallback, so an offline operator can still provision).
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} file
|
|
91
|
+
* @param {string|null} file.localHash
|
|
92
|
+
* @param {string|null} file.remoteHash null/undefined ⇒ remote unreachable
|
|
93
|
+
* @param {string|null} file.baseHash
|
|
94
|
+
* @param {boolean} file.dirty
|
|
95
|
+
* @returns {'remote' | 'local'}
|
|
96
|
+
*/
|
|
97
|
+
function streamedScriptSource({ localHash, remoteHash, baseHash, dirty }) {
|
|
98
|
+
// Remote unreachable / ref missing → the only bytes we have are on disk.
|
|
99
|
+
if (remoteHash === null || remoteHash === undefined) {
|
|
100
|
+
return 'local';
|
|
101
|
+
}
|
|
102
|
+
// Uncommitted local edit → the operator is provisioning unreviewed bytes on
|
|
103
|
+
// purpose (developer mode, or an explicit CODEYAM_SKIP_SCRIPT_DRIFT_CHECK bypass).
|
|
104
|
+
if (dirty) {
|
|
105
|
+
return 'local';
|
|
106
|
+
}
|
|
107
|
+
// Local content the remote tip does not have (committed local-ahead, or a genuine
|
|
108
|
+
// divergence): local differs from the remote tip AND from the merge base → honor
|
|
109
|
+
// the local commit rather than silently overwriting it with the remote tip.
|
|
110
|
+
if (localHash !== remoteHash && localHash !== baseHash) {
|
|
111
|
+
return 'local';
|
|
112
|
+
}
|
|
113
|
+
// Clean, or merely behind the remote tip → stream the canonical remote-tip bytes.
|
|
114
|
+
return 'remote';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Decide what the streamed-script drift preflight should do, from the classifier
|
|
119
|
+
* verdict plus which streamed files carry uncommitted edits. A checkout that is
|
|
120
|
+
* merely *behind* origin (verdict 'stale') is benign — the add streams the
|
|
121
|
+
* canonical remote-tip bytes (see streamedScriptSource), so it never blocks. The
|
|
122
|
+
* guard fires ('block') only for local content the remote tip does not have: an
|
|
123
|
+
* uncommitted (dirty) edit, or a genuine divergence. A committed local-ahead
|
|
124
|
+
* change is developer mode — warn, don't block.
|
|
125
|
+
*
|
|
126
|
+
* @param {Object} o
|
|
127
|
+
* @param {string} o.verdict classifyScriptDrift verdict
|
|
128
|
+
* @param {string[]} [o.staleFiles] files the classifier flagged (the diverged set)
|
|
129
|
+
* @param {string[]} [o.dirtyFiles] streamed files with uncommitted local edits
|
|
130
|
+
* @returns {{ block: boolean, reason: 'clean'|'behind'|'local-ahead'|'dirty'|'diverged', blockedFiles: string[] }}
|
|
131
|
+
*/
|
|
132
|
+
function scriptDriftGuardAction({ verdict, staleFiles = [], dirtyFiles = [] }) {
|
|
133
|
+
if (verdict === 'diverged') {
|
|
134
|
+
return { block: true, reason: 'diverged', blockedFiles: staleFiles };
|
|
135
|
+
}
|
|
136
|
+
if (dirtyFiles.length > 0) {
|
|
137
|
+
return { block: true, reason: 'dirty', blockedFiles: dirtyFiles };
|
|
138
|
+
}
|
|
139
|
+
if (verdict === 'stale') {
|
|
140
|
+
return { block: false, reason: 'behind', blockedFiles: [] };
|
|
141
|
+
}
|
|
142
|
+
if (verdict === 'local-ahead') {
|
|
143
|
+
return { block: false, reason: 'local-ahead', blockedFiles: [] };
|
|
144
|
+
}
|
|
145
|
+
return { block: false, reason: 'clean', blockedFiles: [] };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module.exports = {
|
|
149
|
+
classifyScriptDrift,
|
|
150
|
+
streamedScriptSource,
|
|
151
|
+
scriptDriftGuardAction
|
|
152
|
+
};
|