atris 3.15.13 → 3.15.14
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/commands/push.js +39 -2
- package/package.json +1 -1
package/commands/push.js
CHANGED
|
@@ -104,11 +104,40 @@ function isMassDeletePlan({ deletedPaths = [], filesToPush = [], unchangedCount
|
|
|
104
104
|
return deleteCount >= 10 && deleteCount > survivingCount;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
function parsePushTimeoutSec(argv = process.argv, defaultSec = 120) {
|
|
108
|
+
let raw = null;
|
|
109
|
+
const eqArg = argv.find(a => a.startsWith('--timeout='));
|
|
110
|
+
if (eqArg) raw = eqArg.slice('--timeout='.length);
|
|
111
|
+
else {
|
|
112
|
+
const idx = argv.indexOf('--timeout');
|
|
113
|
+
if (idx !== -1 && argv[idx + 1]) raw = argv[idx + 1];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const parsed = raw == null ? defaultSec : Number.parseInt(raw, 10);
|
|
117
|
+
if (!Number.isFinite(parsed)) return defaultSec;
|
|
118
|
+
return Math.max(5, Math.min(300, parsed));
|
|
119
|
+
}
|
|
120
|
+
|
|
107
121
|
async function pushAtris() {
|
|
108
122
|
const elapsedMs = startTimer();
|
|
109
123
|
let slug = process.argv[3];
|
|
110
124
|
let _coldWake = false;
|
|
111
125
|
|
|
126
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
127
|
+
console.log('Usage: atris push [business] [--from <path>] [--only <prefix>] [--force] [--delete] [--delete-all]');
|
|
128
|
+
console.log('');
|
|
129
|
+
console.log(' Push requires a fresh pull. If cloud has changed since your last pull,');
|
|
130
|
+
console.log(' the push will be blocked until you run `atris pull`. Use --force to override.');
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log(' atris push Push from current folder (auto-detect business)');
|
|
133
|
+
console.log(' atris push pallet Push pallet/ or atris/pallet/');
|
|
134
|
+
console.log(' atris push pallet --only team/nate Only push files in team/nate/');
|
|
135
|
+
console.log(' atris push --force Bypass freshness check (force-push, may overwrite cloud changes)');
|
|
136
|
+
console.log(' atris push --delete Allow small cloud deletes shown by --dry-run');
|
|
137
|
+
console.log(' atris push --delete-all Extra confirmation for mass-delete recovery');
|
|
138
|
+
process.exit(0);
|
|
139
|
+
}
|
|
140
|
+
|
|
112
141
|
// Auto-detect business from .atris/business.json in current dir
|
|
113
142
|
if (!slug || slug.startsWith('-')) {
|
|
114
143
|
const bizFile = path.join(process.cwd(), '.atris', 'business.json');
|
|
@@ -141,6 +170,7 @@ async function pushAtris() {
|
|
|
141
170
|
const allowDelete = process.argv.includes('--delete');
|
|
142
171
|
const allowMassDelete = process.argv.includes('--delete-all');
|
|
143
172
|
const allowCrossRootManifest = process.argv.includes('--allow-cross-root-manifest');
|
|
173
|
+
const timeoutSec = parsePushTimeoutSec(process.argv);
|
|
144
174
|
|
|
145
175
|
// Parse --only
|
|
146
176
|
let onlyRaw = null;
|
|
@@ -447,8 +477,14 @@ async function pushAtris() {
|
|
|
447
477
|
};
|
|
448
478
|
const wireFiles = (files) => files.map((f) => ({ path: toWirePath(f.path), content: f.content }));
|
|
449
479
|
const syncFiles = (files) => apiRequestJson(
|
|
450
|
-
`/business/${businessId}/workspaces/${workspaceId}/sync`,
|
|
451
|
-
{
|
|
480
|
+
`/business/${businessId}/workspaces/${workspaceId}/sync?timeout=${timeoutSec}`,
|
|
481
|
+
{
|
|
482
|
+
method: 'POST',
|
|
483
|
+
token: creds.token,
|
|
484
|
+
body: { files: wireFiles(files) },
|
|
485
|
+
headers: { 'X-Atris-Actor-Source': 'cli' },
|
|
486
|
+
timeoutMs: (timeoutSec + 15) * 1000,
|
|
487
|
+
}
|
|
452
488
|
);
|
|
453
489
|
|
|
454
490
|
// Inspect per-file results from a /sync response. Treat "written" and
|
|
@@ -712,4 +748,5 @@ module.exports = {
|
|
|
712
748
|
basenameOfManifestPath,
|
|
713
749
|
isBusinessWorkspaceRoot,
|
|
714
750
|
isMassDeletePlan,
|
|
751
|
+
parsePushTimeoutSec,
|
|
715
752
|
};
|