sidediff 0.3.0 → 0.3.1
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/README.md +1 -1
- package/dist/git.js +0 -1
- package/dist/repo.js +5 -3
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ sidediff note clear [--file src/app.ts]
|
|
|
49
49
|
|
|
50
50
|
`--new-line` targets the new side of the diff, `--old-line` the old side. The batch format matches Hunk's `session comment apply`, so existing agent tooling can target either.
|
|
51
51
|
|
|
52
|
-
Notes are stored one file per note
|
|
52
|
+
Notes, review threads and the running server's address are stored per worktree under `$XDG_STATE_HOME/sidediff/<worktree>/` (`~/.local/state/sidediff/<worktree>/` by default), one file per note, so concurrent writers never collide, nothing is committed to the repository, worktrees of the same repository never see each other's notes, and a review's annotations and threads come back when its server restarts. Versions before 0.3.1 kept them in the repository's shared `<git dir>/sidediff`; those files are left where they are.
|
|
53
53
|
|
|
54
54
|
## Review threads
|
|
55
55
|
|
package/dist/git.js
CHANGED
|
@@ -32,7 +32,6 @@ export class Git extends Context.Service()('sidediff/Git') {
|
|
|
32
32
|
return {
|
|
33
33
|
run,
|
|
34
34
|
repoRoot: (cwd) => trimmed(cwd, ['rev-parse', '--show-toplevel']),
|
|
35
|
-
commonDir: (cwd) => trimmed(cwd, ['rev-parse', '--path-format=absolute', '--git-common-dir']),
|
|
36
35
|
branch: (cwd) => trimmed(cwd, ['rev-parse', '--abbrev-ref', 'HEAD']).pipe(Effect.orElseSucceed(() => 'HEAD')),
|
|
37
36
|
diff: (cwd, range) => run(cwd, ['-c', 'core.quotepath=false', 'diff', '--no-color', '--no-ext-diff', '--find-renames', ...range]),
|
|
38
37
|
sides,
|
package/dist/repo.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Path } from 'effect';
|
|
1
|
+
import { Config, Context, Effect, Layer, Path } from 'effect';
|
|
2
2
|
import { Git } from './git.js';
|
|
3
|
+
const worktreeKey = (root) => root.replace(/^\/+/, '').replaceAll('/', '-');
|
|
3
4
|
export class Repo extends Context.Service()('sidediff/Repo') {
|
|
4
5
|
static layer = Layer.effect(Repo, Effect.gen(function* () {
|
|
5
6
|
const git = yield* Git;
|
|
6
7
|
const path = yield* Path.Path;
|
|
7
8
|
const root = yield* git.repoRoot(process.cwd());
|
|
8
|
-
const
|
|
9
|
-
const
|
|
9
|
+
const home = yield* Effect.orDie(Config.String('HOME'));
|
|
10
|
+
const stateHome = yield* Effect.orDie(Config.NonEmptyString('XDG_STATE_HOME').pipe(Config.withDefault(path.join(home, '.local', 'state'))));
|
|
11
|
+
const state = path.join(stateHome, 'sidediff', worktreeKey(root));
|
|
10
12
|
return { root, notes: path.join(state, 'notes'), state, serverFile: path.join(state, 'server.json') };
|
|
11
13
|
}));
|
|
12
14
|
}
|
package/dist/server.js
CHANGED
|
@@ -198,7 +198,7 @@ const Announce = Layer.effectDiscard(Effect.gen(function* () {
|
|
|
198
198
|
const repo = yield* Repo;
|
|
199
199
|
const options = yield* ServeOptions;
|
|
200
200
|
const info = { port: options.port, host: options.host, pid: process.pid };
|
|
201
|
-
yield* Effect.acquireRelease(fs.writeFileString(repo.serverFile, JSON.stringify(Schema.encodeSync(ServerInfo)(info))), () => fs.readFileString(repo.serverFile).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(ServerInfo))), Effect.flatMap((current) => current.pid === info.pid ? fs.remove(repo.serverFile, { force: true }) : Effect.void), Effect.ignore));
|
|
201
|
+
yield* Effect.acquireRelease(fs.makeDirectory(repo.state, { recursive: true }).pipe(Effect.andThen(fs.writeFileString(repo.serverFile, JSON.stringify(Schema.encodeSync(ServerInfo)(info))))), () => fs.readFileString(repo.serverFile).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(ServerInfo))), Effect.flatMap((current) => current.pid === info.pid ? fs.remove(repo.serverFile, { force: true }) : Effect.void), Effect.ignore));
|
|
202
202
|
}));
|
|
203
203
|
export const serverLayer = (options) => HttpRouter.serve(Layer.mergeAll(RpcRoute, StaticFiles), { disableListenLog: true, disableLogger: true }).pipe(Layer.provide(Review.layer), Layer.merge(Announce), Layer.provide(NodeHttpServer.layer(createServer, {
|
|
204
204
|
port: options.port,
|