@dibssoftware/dibs 0.0.0-stage → 0.0.178
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/CHANGELOG.md +577 -0
- package/LICENSE +670 -0
- package/README.md +234 -2
- package/bin/dibs-guard.mjs +7 -0
- package/bin/dibs.mjs +526 -0
- package/docs/benchmarks.md +193 -0
- package/docs/files.md +30 -0
- package/docs/guard.md +91 -0
- package/docs/later.md +43 -0
- package/docs/machines.md +147 -0
- package/docs/questions.md +78 -0
- package/docs/relay.md +196 -0
- package/docs/releasing.md +25 -0
- package/docs/scheduling.md +163 -0
- package/docs/simulators.md +17 -0
- package/package.json +44 -4
- package/skills/dibs/SKILL.md +162 -0
- package/src/acquire.mjs +697 -0
- package/src/admin.mjs +145 -0
- package/src/agents.mjs +145 -0
- package/src/alerts.mjs +437 -0
- package/src/answers.mjs +65 -0
- package/src/board.mjs +202 -0
- package/src/broker.mjs +369 -0
- package/src/commands.mjs +801 -0
- package/src/config.mjs +320 -0
- package/src/connect.mjs +106 -0
- package/src/cool.mjs +160 -0
- package/src/diskwarn.mjs +161 -0
- package/src/events.mjs +94 -0
- package/src/files.mjs +1100 -0
- package/src/guard.mjs +583 -0
- package/src/history.mjs +247 -0
- package/src/hogs.mjs +214 -0
- package/src/later.mjs +487 -0
- package/src/measure.mjs +262 -0
- package/src/nodecheck.mjs +17 -0
- package/src/notices.mjs +121 -0
- package/src/ondemand.mjs +572 -0
- package/src/overlap.mjs +151 -0
- package/src/override.mjs +351 -0
- package/src/owner.mjs +30 -0
- package/src/plain.mjs +467 -0
- package/src/platform.mjs +357 -0
- package/src/preempt.mjs +438 -0
- package/src/primer.mjs +61 -0
- package/src/proc.mjs +98 -0
- package/src/progress.mjs +158 -0
- package/src/qr.mjs +204 -0
- package/src/questions.mjs +389 -0
- package/src/quota.mjs +81 -0
- package/src/reads.mjs +54 -0
- package/src/relay.mjs +779 -0
- package/src/remote.mjs +584 -0
- package/src/reset.mjs +127 -0
- package/src/schedule.mjs +995 -0
- package/src/scratch.mjs +61 -0
- package/src/serve.mjs +736 -0
- package/src/service.mjs +221 -0
- package/src/shard.mjs +59 -0
- package/src/simctl.mjs +42 -0
- package/src/simpool.mjs +258 -0
- package/src/state.mjs +201 -0
- package/src/stats.mjs +328 -0
- package/src/style.mjs +44 -0
- package/src/talk.mjs +523 -0
- package/src/thin.sh +130 -0
- package/src/trust.mjs +152 -0
- package/src/util.mjs +184 -0
- package/src/version.mjs +2 -0
- package/src/web.mjs +1117 -0
- package/src/worker.mjs +318 -0
package/src/scratch.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// dibs setup scratch: a capped APFS volume for build output, so a build that
|
|
2
|
+
// runs away fills its own space instead of the disk every agent shares. Making
|
|
3
|
+
// a volume takes an admin password, so dibs never does it: it prints the
|
|
4
|
+
// commands for a person to run once, and --check says how full the volume is.
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { execFileSync } from 'node:child_process';
|
|
8
|
+
import { OS } from './platform.mjs';
|
|
9
|
+
import { bytes, gb, die } from './util.mjs';
|
|
10
|
+
|
|
11
|
+
const NAME = 'DibsScratch';
|
|
12
|
+
// DIBS_SCRATCH points --check somewhere else, for tests.
|
|
13
|
+
const VOLUME = process.env.DIBS_SCRATCH || `/Volumes/${NAME}`;
|
|
14
|
+
// Room for DerivedData of a few projects plus test output, on a 256 GB Mac.
|
|
15
|
+
const SIZE = '40G';
|
|
16
|
+
|
|
17
|
+
// The APFS container the data volume lives in: the new volume shares its free space.
|
|
18
|
+
function container() {
|
|
19
|
+
try { return execFileSync('diskutil', ['info', '/System/Volumes/Data'], { encoding: 'utf8' }).match(/APFS Container:\s+(disk\d+)/)?.[1] || null; }
|
|
20
|
+
catch { return null; }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function setup(args, o) {
|
|
24
|
+
if (args[0] !== 'scratch') die('setup what? dibs setup scratch [--size 40G] [--check]');
|
|
25
|
+
if (o.check) return check();
|
|
26
|
+
if (OS !== 'macos') die('dibs setup scratch makes an APFS volume with a quota, which only macOS has. Your command did nothing.');
|
|
27
|
+
const quota = `${Math.max(1, Math.round(bytes(o.size || SIZE) / 1024 ** 3))}g`;
|
|
28
|
+
const disk = container() || '<container: see diskutil apfs list>';
|
|
29
|
+
console.log(`A scratch volume capped at ${quota.toUpperCase()}. dibs doesn't run any of this; it needs an admin password once:
|
|
30
|
+
|
|
31
|
+
sudo diskutil apfs addVolume ${disk} APFS ${NAME} -quota ${quota}
|
|
32
|
+
sudo chown "$USER" ${VOLUME}
|
|
33
|
+
touch ${VOLUME}/.metadata_never_index
|
|
34
|
+
mkdir -p ${VOLUME}/DerivedData ${VOLUME}/tmp
|
|
35
|
+
|
|
36
|
+
It shares free space with the rest of ${disk} but stops at ${quota.toUpperCase()}: a runaway build gets "disk full"
|
|
37
|
+
on its own volume instead of filling the disk every agent uses. .metadata_never_index keeps Spotlight off it.
|
|
38
|
+
|
|
39
|
+
Point jobs at it:
|
|
40
|
+
dibs run xcode-build -- xcodebuild ... -derivedDataPath ${VOLUME}/DerivedData
|
|
41
|
+
dibs run test -- env TMPDIR=${VOLUME}/tmp npm test
|
|
42
|
+
A project's first build in a new DerivedData folder is a full rebuild.
|
|
43
|
+
|
|
44
|
+
Check it: dibs setup scratch --check Remove it: sudo diskutil apfs deleteVolume ${NAME}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Exit 1 when there's no volume, so a script can ask "is it set up?".
|
|
48
|
+
function check() {
|
|
49
|
+
let st;
|
|
50
|
+
try { st = fs.statSync(VOLUME); } catch {
|
|
51
|
+
console.log(`no scratch volume at ${VOLUME}. Set one up: dibs setup scratch`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
if (st.dev === fs.statSync(path.dirname(VOLUME)).dev) {
|
|
55
|
+
console.log(`${VOLUME} is a plain folder, not its own volume, so nothing caps it. Set one up: dibs setup scratch`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
const f = fs.statfsSync(VOLUME);
|
|
59
|
+
const total = f.blocks * f.bsize, free = f.bavail * f.bsize;
|
|
60
|
+
console.log(`scratch volume ${VOLUME}: ${gb(total - free)} used of ${gb(total)}, ${gb(free)} free`);
|
|
61
|
+
}
|