Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ npm install -g dimcode-alpha@alpha
dima
```

For the independent nightly build on macOS or GNU/Linux, use the [curl installer](docs/release/README.md#nightly-curl-channel) and run `dim-nightly`. Rerun the installer to upgrade without changing your npm alpha installation.
For the independent nightly build on macOS or GNU/Linux, use the [curl installer](docs/release/README.md#nightly-curl-channel) and run `dim-nightly` (or `dimn` if the shortcut is available). Rerun the installer to upgrade without changing your npm alpha installation.

Add a provider with `/connect` (or `/provider`), sign in to DimAgent with `/login`, or select a configured model with `/models`. Type `ls` in the chat and press Enter. In this session Dim asks to run `ls -la` in `runtime/plugins`. Choosing **Allow once** lets it list the three plugin directories.

Expand Down
2 changes: 1 addition & 1 deletion docs/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Install or upgrade the standalone `dim-nightly` on macOS or GNU/Linux (arm64 or
curl -fsSL https://raw.githubusercontent.com/arcships/dim/main/scripts/install-nightly.sh | sh
```

The entry point is `~/.local/bin/dim-nightly`. The installer leaves npm installations alone and keeps each payload under `${XDG_DATA_HOME:-~/.local/share}/dim-nightly`. The CLI defaults to `~/.dimcode-nightly`. The release environment needs the same build-time account settings as the alpha native builds. Restrict nightly tag creation and manual publication to trusted maintainers. If deployment filters are enabled, allow both `main` and the nightly tag pattern in `release-build`. Rolling assets require a mutable GitHub prerelease.
Run `dim-nightly` from `~/.local/bin`. Installation and upgrades also offer `dimn` as a shortcut. If the shortcut is unavailable or its name is already taken, the installer leaves it alone and `dim-nightly` remains ready to use. The installer leaves npm installations alone and keeps each payload under `${XDG_DATA_HOME:-~/.local/share}/dim-nightly`. The CLI defaults to `~/.dimcode-nightly`. The release environment needs the same build-time account settings as the alpha native builds. Restrict nightly tag creation and manual publication to trusted maintainers. If deployment filters are enabled, allow both `main` and the nightly tag pattern in `release-build`. Rolling assets require a mutable GitHub prerelease.

Nightly (`X.Y.Z-nightly.N`) and npm alpha (`X.Y.Z-alpha.N`) number releases independently. Start a nightly without a version PR in either of two ways:

Expand Down
11 changes: 11 additions & 0 deletions scripts/install-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ install_nightly() (
ln -s "$dest/bin/dimcode" "$linkdir/dim-nightly"
mv -f "$linkdir/dim-nightly" "$entry"
printf 'Installed dim-nightly %s at %s\n' "$version" "$entry"
short=$bin/dimn
if [ ! -e "$short" ] && [ ! -L "$short" ]; then
{ ln -s dim-nightly "$linkdir/dimn" && ln -P "$linkdir/dimn" "$bin/"; } || :
fi
if [ -L "$short" ] && [ "$(readlink "$short")" = dim-nightly ]; then
printf 'Run dimn or dim-nightly to start Nightly.\n'
elif [ -e "$short" ] || [ -L "$short" ]; then
printf 'Keeping existing %s; use dim-nightly to start Nightly.\n' "$short" >&2
else
printf 'Shortcut unavailable; use dim-nightly to start Nightly.\n' >&2
fi
case :$PATH: in *:"$bin":*) :;; *) printf 'Add %s to PATH to run dim-nightly.\n' "$bin";; esac
)

Expand Down
36 changes: 34 additions & 2 deletions scripts/nightly.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import { execFileSync, spawnSync } from 'node:child_process';
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import test from 'node:test';
Expand Down Expand Up @@ -41,11 +41,16 @@ esac\n`, { mode: 0o755 });
assert.equal(run.status === 0, ok, run.stderr);
}
const install = () => spawnSync('sh', [path.join(import.meta.dirname, 'install-nightly.sh')], { env, encoding: 'utf8' });
const installed = () => execFileSync(file('.local/bin/dim-nightly'), ['--version'], { env, encoding: 'utf8' }).trim();
const installed = (command = 'dim-nightly') => execFileSync(file('.local/bin', command), ['--version'], { env, encoding: 'utf8' }).trim();
const shortcut = file('.local/bin/dimn');
const release = () => JSON.parse(readFileSync(file('release'))).name;
publish(8);
assert.equal(install().status, 0);
assert.equal(installed(), 'dimcode 1.2.3-nightly.8');
assert.equal(installed('dimn'), 'dimcode 1.2.3-nightly.8');
rmSync(shortcut);
assert.equal(install().status, 0);
assert.equal(installed('dimn'), 'dimcode 1.2.3-nightly.8');
writeFileSync(file('.local/bin/dima'), 'npm installation');
writeFileSync(file('assets/unrelated.txt'), 'keep');
writeFileSync(file('interrupt'), '');
Expand All @@ -68,6 +73,33 @@ esac\n`, { mode: 0o755 });
const run = install();
assert.equal(run.status, 0, run.stderr);
assert.equal(installed(), 'dimcode 1.2.3-nightly.11');
assert.equal(installed('dimn'), 'dimcode 1.2.3-nightly.11');
}
rmSync(shortcut);
symlinkSync('unrelated-command', shortcut);
const conflict = install();
assert.equal(conflict.status, 0, conflict.stderr);
assert.match(conflict.stderr, /Keeping existing .*dimn/);
assert.equal(readlinkSync(shortcut), 'unrelated-command');
assert.equal(installed(), 'dimcode 1.2.3-nightly.11');
rmSync(shortcut);
writeFileSync(file('ln'), `#!/bin/sh
set -eu
case "$*" in *dimn*)
if [ ! -e "$HOME/.local/bin/dimn" ]; then
if [ -f "$HOME/race-directory" ]; then mkdir "$HOME/.local/bin/dimn"; else echo foreign >"$HOME/.local/bin/dimn"; fi
fi;;
esac
exec /bin/ln "$@"\n`, { mode: 0o755 });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional P3: the fake ln falls back to the hardcoded /bin/ln. On a system without /bin/ln (NixOS, for example, which provides /bin/sh but not /bin/ln), every ln call after the fake is installed fails with 127, the collision install at scripts/nightly.test.mjs:96 exits nonzero, and the test fails at :97 for a reason unrelated to this change. Fix: resolve the real ln in the test process before the installer environment shadows PATH, for example const ln = execFileSync('sh', ['-c', 'command -v ln'], { encoding: 'utf8' }).trim(), and embed that absolute path in the fake script.

for (const directory of [false, true]) {
if (directory) writeFileSync(file('race-directory'), '');
const collision = install();
assert.equal(collision.status, 0, collision.stderr);
assert.match(collision.stderr, /Keeping existing .*dimn/);
if (directory) assert.deepEqual(readdirSync(shortcut), []);
else assert.equal(readFileSync(shortcut, 'utf8'), 'foreign\n');
rmSync(shortcut, { recursive: true });
}
assert.equal(installed(), 'dimcode 1.2.3-nightly.11');
assert.equal(readFileSync(file('.local/bin/dima'), 'utf8'), 'npm installation');
});