@aryasaatvik/scratchpad 0.5.0 → 0.5.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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/scratchpad.js +107 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## @aryasaatvik/scratchpad@0.5.1
|
|
2
|
+
|
|
3
|
+
### Archive directories and run from inside `.scratchpad`
|
|
4
|
+
|
|
5
|
+
`scratchpad archive` now moves whole directories into the dated archive folder, and the bundle
|
|
6
|
+
`README.md` lists every archived path. It still refuses the notes root, the archive folder itself,
|
|
7
|
+
and directories containing a configured sync mount.
|
|
8
|
+
|
|
9
|
+
Commands run with the working directory inside a checkout's `.scratchpad/` now resolve the same
|
|
10
|
+
notes root as from the repository root, including when `.scratchpad` is its own Git repository, the checkout is
|
|
11
|
+
not a Git repository, or `.scratchpad` is a symlink out of the checkout into the shared store (the
|
|
12
|
+
shell's `PWD` identifies the checkout). Previously they fell back to a nonexistent shared XDG path
|
|
13
|
+
and failed with a `realPath` NotFound error.
|
|
14
|
+
|
|
1
15
|
## @aryasaatvik/scratchpad@0.5.0
|
|
2
16
|
|
|
3
17
|
### Understand sync previews and mount failures
|
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ scratchpad feedback review [--global] [--classify] [--json]
|
|
|
145
145
|
scratchpad feedback list [--global] [--status <s>] [--disposition <d>]... [--all]
|
|
146
146
|
scratchpad feedback resolve <id|file|path> --disposition <d> --review <name|path> [--evidence <e>]...
|
|
147
147
|
scratchpad route "<correction>" [--write] [--json]
|
|
148
|
-
scratchpad archive <paths...> --reason "<why>" # move into archive/<date>-<reason>/
|
|
148
|
+
scratchpad archive <paths...> --reason "<why>" # move files or directories into archive/<date>-<reason>/
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
`scratchpad skills get scratchpad` prints the agent skill that drives these commands; its source is
|
package/dist/scratchpad.js
CHANGED
|
@@ -28514,6 +28514,9 @@ var runWith2 = (command, config) => {
|
|
|
28514
28514
|
yield* provideContext2(program, services);
|
|
28515
28515
|
}, catchFilter2((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed2(error) : fail2(error), (error) => andThen2(showHelp(command, error, config.renderErrors !== false), fail6(error))), catchFilter2((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed2(error) : fail2(error), (error) => andThen2(showUserError(error), fail6(error))), catchFilter2((e) => isQuitError(e) ? succeed2(e) : fail2(e), (_) => interrupt2));
|
|
28516
28516
|
};
|
|
28517
|
+
// packages/cli/src/commands/archive.ts
|
|
28518
|
+
import { rmdir } from "fs/promises";
|
|
28519
|
+
|
|
28517
28520
|
// packages/cli/src/runtime/paths.ts
|
|
28518
28521
|
import { createHash as createHash4 } from "crypto";
|
|
28519
28522
|
import { join as join8, resolve as resolve8 } from "path";
|
|
@@ -47147,6 +47150,10 @@ var globalNotesHome = () => {
|
|
|
47147
47150
|
return override !== undefined && override !== "" ? override : join7(homeDirectory(), ".scratchpad");
|
|
47148
47151
|
};
|
|
47149
47152
|
var cwd = () => process.cwd();
|
|
47153
|
+
var logicalCwd = () => {
|
|
47154
|
+
const pwd = process.env["PWD"];
|
|
47155
|
+
return pwd !== undefined && isAbsolute2(pwd) ? pwd : undefined;
|
|
47156
|
+
};
|
|
47150
47157
|
var classifierModelEnv = () => {
|
|
47151
47158
|
const model = process.env["SCRATCHPAD_CLASSIFIER"];
|
|
47152
47159
|
return model !== undefined && model !== "" ? model : undefined;
|
|
@@ -47183,7 +47190,7 @@ ${mounts.flatMap((mount) => [mount.issues, mount.milestones]).map((directory) =>
|
|
|
47183
47190
|
}
|
|
47184
47191
|
|
|
47185
47192
|
// packages/cli/src/runtime/project.ts
|
|
47186
|
-
import { join as join9 } from "path";
|
|
47193
|
+
import { basename as basename4, dirname as dirname4, join as join9 } from "path";
|
|
47187
47194
|
class ProjectError extends TaggedError3()("ProjectError", {
|
|
47188
47195
|
message: String4,
|
|
47189
47196
|
cause: optional2(Defect())
|
|
@@ -47192,8 +47199,11 @@ class ProjectError extends TaggedError3()("ProjectError", {
|
|
|
47192
47199
|
|
|
47193
47200
|
class Project extends Service()("@scratchpad/cli/Project") {
|
|
47194
47201
|
static layer = effect(Project, gen2(function* () {
|
|
47195
|
-
const start = cwd();
|
|
47196
47202
|
const fs = yield* FileSystem;
|
|
47203
|
+
const start = yield* checkoutStart(cwd(), logicalCwd(), {
|
|
47204
|
+
realPath: (candidate) => fs.realPath(candidate).pipe(catch_2(() => succeed6(candidate))),
|
|
47205
|
+
exists: (candidate) => fs.exists(candidate).pipe(catch_2(() => succeed6(false)))
|
|
47206
|
+
});
|
|
47197
47207
|
const rootResult = yield* runGit(start, ["rev-parse", "--show-toplevel"]);
|
|
47198
47208
|
if (rootResult.code === 128 && /not a git repository/i.test(rootResult.stderr)) {
|
|
47199
47209
|
const toplevel2 = yield* fs.realPath(start).pipe(mapError2((cause) => new ProjectError({ message: "Could not resolve the working directory", cause })));
|
|
@@ -47237,6 +47247,40 @@ class Project extends Service()("@scratchpad/cli/Project") {
|
|
|
47237
47247
|
return { toplevel, primary, projectId, ...notes };
|
|
47238
47248
|
}));
|
|
47239
47249
|
}
|
|
47250
|
+
var checkoutStart = (directory, logical, io) => gen2(function* () {
|
|
47251
|
+
const physical = yield* io.realPath(directory);
|
|
47252
|
+
let git;
|
|
47253
|
+
for (let current = physical;; current = dirname4(current)) {
|
|
47254
|
+
if (basename4(current) === ".scratchpad")
|
|
47255
|
+
return dirname4(current);
|
|
47256
|
+
if (yield* io.exists(join9(current, ".git"))) {
|
|
47257
|
+
git = current;
|
|
47258
|
+
break;
|
|
47259
|
+
}
|
|
47260
|
+
if (dirname4(current) === current)
|
|
47261
|
+
break;
|
|
47262
|
+
}
|
|
47263
|
+
if (logical === undefined || (yield* io.realPath(logical)) !== physical)
|
|
47264
|
+
return directory;
|
|
47265
|
+
for (let notes = logical;; notes = dirname4(notes)) {
|
|
47266
|
+
const real = yield* io.realPath(notes);
|
|
47267
|
+
if (basename4(notes) === ".scratchpad" || basename4(real) === ".scratchpad") {
|
|
47268
|
+
if (git !== undefined && (yield* owner(real, io.exists)) !== git)
|
|
47269
|
+
return directory;
|
|
47270
|
+
return dirname4(basename4(notes) === ".scratchpad" ? notes : real);
|
|
47271
|
+
}
|
|
47272
|
+
if (dirname4(notes) === notes)
|
|
47273
|
+
return directory;
|
|
47274
|
+
}
|
|
47275
|
+
});
|
|
47276
|
+
var owner = (path, exists) => gen2(function* () {
|
|
47277
|
+
for (let current = path;; current = dirname4(current)) {
|
|
47278
|
+
if (yield* exists(join9(current, ".git")))
|
|
47279
|
+
return current;
|
|
47280
|
+
if (dirname4(current) === current)
|
|
47281
|
+
return;
|
|
47282
|
+
}
|
|
47283
|
+
});
|
|
47240
47284
|
var resolveNotesRoot = (input) => gen2(function* () {
|
|
47241
47285
|
const worktreeNotes = join9(input.toplevel, ".scratchpad");
|
|
47242
47286
|
if (yield* input.isDir(worktreeNotes)) {
|
|
@@ -47350,6 +47394,7 @@ var isWithin = (path, root, candidate) => {
|
|
|
47350
47394
|
const relative = path.relative(root, candidate);
|
|
47351
47395
|
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
47352
47396
|
};
|
|
47397
|
+
var removeCreated = (created) => forEach2([...created].sort((left, right) => right.length - left.length), (directory) => tryPromise2(() => rmdir(directory)).pipe(ignore2), { discard: true });
|
|
47353
47398
|
var archiveFiles = (input) => gen2(function* () {
|
|
47354
47399
|
const fs = yield* FileSystem;
|
|
47355
47400
|
const path = yield* Path;
|
|
@@ -47404,14 +47449,21 @@ var archiveFiles = (input) => gen2(function* () {
|
|
|
47404
47449
|
}));
|
|
47405
47450
|
}
|
|
47406
47451
|
const info = yield* fs.stat(source);
|
|
47407
|
-
if (info.type !== "File") {
|
|
47452
|
+
if (info.type !== "File" && info.type !== "Directory") {
|
|
47408
47453
|
return yield* fail6(new NotesCommandError({
|
|
47409
47454
|
reason: "invalid",
|
|
47410
|
-
message: `Archive path is not a file: ${argument}`
|
|
47455
|
+
message: `Archive path is not a file or directory: ${argument}`
|
|
47456
|
+
}));
|
|
47457
|
+
}
|
|
47458
|
+
const directory = info.type === "Directory";
|
|
47459
|
+
if (directory && (isWithin(path, source, archiveRoot) || isWithin(path, source, root))) {
|
|
47460
|
+
return yield* fail6(new NotesCommandError({
|
|
47461
|
+
reason: "invalid",
|
|
47462
|
+
message: `Refusing to archive ${source}: it contains the notes root or the archive folder`
|
|
47411
47463
|
}));
|
|
47412
47464
|
}
|
|
47413
47465
|
for (const mount of canonicalMounts) {
|
|
47414
|
-
if (isWithin(path, mount.canonical, canonical) || isWithin(path, mount.configured, source)) {
|
|
47466
|
+
if (isWithin(path, mount.canonical, canonical) || isWithin(path, mount.configured, source) || directory && (isWithin(path, canonical, mount.canonical) || isWithin(path, source, mount.configured))) {
|
|
47415
47467
|
return yield* fail6(new NotesCommandError({
|
|
47416
47468
|
reason: "conflict",
|
|
47417
47469
|
message: `Refusing to archive mounted path ${source}; close it through the backlog/sync flow instead`
|
|
@@ -47425,6 +47477,18 @@ var archiveFiles = (input) => gen2(function* () {
|
|
|
47425
47477
|
message: `Refusing to archive notes root README.md: ${source}`
|
|
47426
47478
|
}));
|
|
47427
47479
|
}
|
|
47480
|
+
if (sources.some((entry) => entry.directory && isWithin(path, entry.source, source))) {
|
|
47481
|
+
continue;
|
|
47482
|
+
}
|
|
47483
|
+
if (directory) {
|
|
47484
|
+
for (let index = sources.length - 1;index >= 0; index -= 1) {
|
|
47485
|
+
const entry = sources[index];
|
|
47486
|
+
if (isWithin(path, source, entry.source)) {
|
|
47487
|
+
destinations.delete(entry.destination);
|
|
47488
|
+
sources.splice(index, 1);
|
|
47489
|
+
}
|
|
47490
|
+
}
|
|
47491
|
+
}
|
|
47428
47492
|
const destination = path.join(archiveRoot, relative);
|
|
47429
47493
|
if (yield* fs.exists(destination)) {
|
|
47430
47494
|
return yield* fail6(new NotesCommandError({
|
|
@@ -47439,13 +47503,22 @@ var archiveFiles = (input) => gen2(function* () {
|
|
|
47439
47503
|
}));
|
|
47440
47504
|
}
|
|
47441
47505
|
destinations.add(destination);
|
|
47442
|
-
sources.push({ source, relative, destination });
|
|
47506
|
+
sources.push({ source, relative, destination, directory });
|
|
47443
47507
|
}
|
|
47508
|
+
const created = [];
|
|
47509
|
+
if (!(yield* fs.exists(archiveRoot)))
|
|
47510
|
+
created.push(archiveRoot);
|
|
47444
47511
|
yield* fs.makeDirectory(archiveRoot, { recursive: true });
|
|
47445
47512
|
const moved = [];
|
|
47446
47513
|
for (const { source, destination } of sources) {
|
|
47447
47514
|
const result = yield* gen2(function* () {
|
|
47515
|
+
const parents = [];
|
|
47516
|
+
for (let parent = path.dirname(destination);parent !== archiveRoot && isWithin(path, archiveRoot, parent); parent = path.dirname(parent)) {
|
|
47517
|
+
if (!(yield* fs.exists(parent)))
|
|
47518
|
+
parents.push(parent);
|
|
47519
|
+
}
|
|
47448
47520
|
yield* fs.makeDirectory(path.dirname(destination), { recursive: true });
|
|
47521
|
+
created.push(...parents);
|
|
47449
47522
|
yield* fs.rename(source, destination);
|
|
47450
47523
|
}).pipe(match6({
|
|
47451
47524
|
onFailure: (error) => ({ ok: false, error }),
|
|
@@ -47454,6 +47527,7 @@ var archiveFiles = (input) => gen2(function* () {
|
|
|
47454
47527
|
if (!result.ok) {
|
|
47455
47528
|
for (const completed of moved.reverse())
|
|
47456
47529
|
yield* fs.rename(completed.destination, completed.source);
|
|
47530
|
+
yield* removeCreated(created);
|
|
47457
47531
|
return yield* fail6(result.error);
|
|
47458
47532
|
}
|
|
47459
47533
|
moved.push({ source, destination });
|
|
@@ -47463,14 +47537,16 @@ var archiveFiles = (input) => gen2(function* () {
|
|
|
47463
47537
|
const separator = previous.length === 0 || previous.endsWith(`
|
|
47464
47538
|
`) ? "" : `
|
|
47465
47539
|
`;
|
|
47540
|
+
const listing = sources.map(({ relative, directory }) => ` - ${relative}${directory ? "/" : ""}
|
|
47541
|
+
`).join("");
|
|
47466
47542
|
yield* fs.writeFileString(readme, `${previous}${separator}- ${date}: ${input.reason}
|
|
47467
|
-
`);
|
|
47543
|
+
${listing}`);
|
|
47468
47544
|
return archiveRoot;
|
|
47469
47545
|
});
|
|
47470
47546
|
var archive2 = make36("archive", {
|
|
47471
|
-
paths: String8("paths").pipe(withDescription2("File paths relative to the notes root (omit the .scratchpad/ prefix)"), variadic2({ min: 1 })),
|
|
47472
|
-
reason: String9("reason").pipe(withDescription3("Why the
|
|
47473
|
-
}, ({ paths, reason }) => archiveFiles({ paths, reason }).pipe(flatMap3(log2), provide4(Project.layer), provideService2(MinimumLogLevel2, "None"))).pipe(withDescription4("Move notes-root files into a dated archive folder"));
|
|
47547
|
+
paths: String8("paths").pipe(withDescription2("File or directory paths relative to the notes root (omit the .scratchpad/ prefix)"), variadic2({ min: 1 })),
|
|
47548
|
+
reason: String9("reason").pipe(withDescription3("Why the paths are archived; becomes the folder suffix"))
|
|
47549
|
+
}, ({ paths, reason }) => archiveFiles({ paths, reason }).pipe(flatMap3(log2), provide4(Project.layer), provideService2(MinimumLogLevel2, "None"))).pipe(withDescription4("Move notes-root files and directories into a dated archive folder"));
|
|
47474
47550
|
|
|
47475
47551
|
// packages/cli/src/output.ts
|
|
47476
47552
|
var styled = (open, close) => (text) => Bun.enableANSIColors ? `\x1B[${open}m${text}\x1B[${close}m` : text;
|
|
@@ -47520,7 +47596,7 @@ function formatReport(name, report) {
|
|
|
47520
47596
|
|
|
47521
47597
|
// packages/cli/src/commands/artifact/config.ts
|
|
47522
47598
|
import { chmod as chmod3, mkdir as mkdir2, readFile as readFile4, rename as rename3, writeFile as writeFile3 } from "fs/promises";
|
|
47523
|
-
import { dirname as
|
|
47599
|
+
import { dirname as dirname5, join as join10 } from "path";
|
|
47524
47600
|
var DeploymentUrl = URLFromString.check(makeFilter2((url) => url.protocol === "http:" || url.protocol === "https:" ? undefined : "deployment URL must use HTTP or HTTPS"));
|
|
47525
47601
|
var DeploymentProfile = Struct({
|
|
47526
47602
|
url: DeploymentUrl,
|
|
@@ -47555,7 +47631,7 @@ var readProfiles = async (allowMissing = false) => {
|
|
|
47555
47631
|
var writeProfiles = async (profiles) => {
|
|
47556
47632
|
const path = artifactProfilesPath();
|
|
47557
47633
|
const temporary = `${path}.tmp-${process.pid}-${crypto.randomUUID()}`;
|
|
47558
|
-
await mkdir2(
|
|
47634
|
+
await mkdir2(dirname5(path), { recursive: true });
|
|
47559
47635
|
await writeFile3(temporary, `${JSON.stringify(profiles, null, 2)}
|
|
47560
47636
|
`, {
|
|
47561
47637
|
encoding: "utf8",
|
|
@@ -47639,7 +47715,7 @@ class ArtifactCommandError extends TaggedError3()("ArtifactCommandError", { mess
|
|
|
47639
47715
|
var artifactError = (error) => new ArtifactCommandError({ message: error instanceof Error ? error.message : String(error) });
|
|
47640
47716
|
|
|
47641
47717
|
// packages/cli/src/commands/artifact/shared.ts
|
|
47642
|
-
import { basename as
|
|
47718
|
+
import { basename as basename5, isAbsolute as isAbsolute3, relative as relative3, sep as sep3 } from "path";
|
|
47643
47719
|
var clientForProfile = (profile) => new ArtifactClient({
|
|
47644
47720
|
baseUrl: profile.url.toString().replace(/\/$/, ""),
|
|
47645
47721
|
...profile.accessClientId && profile.accessClientSecret ? { access: { clientId: profile.accessClientId, clientSecret: profile.accessClientSecret } } : {}
|
|
@@ -47670,10 +47746,10 @@ var gitMetadata = async (cwd) => ({
|
|
|
47670
47746
|
});
|
|
47671
47747
|
var portableSourcePath = (absolutePath, gitRoot) => {
|
|
47672
47748
|
if (!gitRoot)
|
|
47673
|
-
return
|
|
47749
|
+
return basename5(absolutePath);
|
|
47674
47750
|
const fromRoot = relative3(gitRoot, absolutePath);
|
|
47675
47751
|
if (fromRoot === ".." || fromRoot.startsWith(`..${sep3}`) || isAbsolute3(fromRoot)) {
|
|
47676
|
-
return
|
|
47752
|
+
return basename5(absolutePath);
|
|
47677
47753
|
}
|
|
47678
47754
|
return fromRoot.split(sep3).join("/");
|
|
47679
47755
|
};
|
|
@@ -47764,7 +47840,7 @@ var artifactResolveCommand = make36("resolve", {
|
|
|
47764
47840
|
// packages/cli/src/commands/artifact/archive.ts
|
|
47765
47841
|
import { createHash as createHash5 } from "crypto";
|
|
47766
47842
|
import { mkdir as mkdir3, readFile as readFile5, rename as rename4, rm as rm2, writeFile as writeFile4 } from "fs/promises";
|
|
47767
|
-
import { dirname as
|
|
47843
|
+
import { dirname as dirname6, resolve as resolve9 } from "path";
|
|
47768
47844
|
|
|
47769
47845
|
// packages/cli/src/commands/artifact/archive-zip.ts
|
|
47770
47846
|
var encoder4 = new TextEncoder;
|
|
@@ -48001,7 +48077,7 @@ var exportArtifactArchive = async (options) => {
|
|
|
48001
48077
|
};
|
|
48002
48078
|
entries.set("manifest.json", encoder5.encode(`${JSON.stringify(manifest, null, 2)}
|
|
48003
48079
|
`));
|
|
48004
|
-
await mkdir3(
|
|
48080
|
+
await mkdir3(dirname6(output), { recursive: true });
|
|
48005
48081
|
await writeFile4(temporary, createDeterministicZip(entries), { flag: "wx" });
|
|
48006
48082
|
await rename4(temporary, output);
|
|
48007
48083
|
return {
|
|
@@ -48315,7 +48391,7 @@ var artifactProfileCommand = make36("profile").pipe(withDescription4("Manage art
|
|
|
48315
48391
|
// packages/cli/src/commands/artifact/pull.ts
|
|
48316
48392
|
import { createHash as createHash6 } from "crypto";
|
|
48317
48393
|
import { lstat, mkdir as mkdir4, writeFile as writeFile5 } from "fs/promises";
|
|
48318
|
-
import { dirname as
|
|
48394
|
+
import { dirname as dirname7, isAbsolute as isAbsolute4, relative as relative4, resolve as resolve10, sep as sep4 } from "path";
|
|
48319
48395
|
var inside2 = (root, path) => {
|
|
48320
48396
|
const fromRoot = relative4(root, path);
|
|
48321
48397
|
return fromRoot === "" || !fromRoot.startsWith(`..${sep4}`) && fromRoot !== ".." && !isAbsolute4(fromRoot);
|
|
@@ -48330,7 +48406,7 @@ var existing = async (path) => {
|
|
|
48330
48406
|
}
|
|
48331
48407
|
};
|
|
48332
48408
|
var assertSafeParents = async (root, target) => {
|
|
48333
|
-
const segments = relative4(root,
|
|
48409
|
+
const segments = relative4(root, dirname7(target)).split(sep4).filter(Boolean);
|
|
48334
48410
|
let current = root;
|
|
48335
48411
|
const parents = [];
|
|
48336
48412
|
for (const segment of segments) {
|
|
@@ -48378,7 +48454,7 @@ var pullArtifact = async (slug, options) => {
|
|
|
48378
48454
|
{ path: sourceTarget, bytes: decoded(result.contentBase64, result.contentHash) },
|
|
48379
48455
|
...result.assets.map((asset) => {
|
|
48380
48456
|
const source = safeArtifactAssetPath(asset.source);
|
|
48381
|
-
const path = resolve10(
|
|
48457
|
+
const path = resolve10(dirname7(sourceTarget), source);
|
|
48382
48458
|
if (!inside2(root, path))
|
|
48383
48459
|
throw new Error(`asset '${asset.source}' escapes the output directory`);
|
|
48384
48460
|
return { path, bytes: decoded(asset.contentBase64, asset.hash) };
|
|
@@ -48397,7 +48473,7 @@ var pullArtifact = async (slug, options) => {
|
|
|
48397
48473
|
throw new Error(`output file is a directory: ${file.path}`);
|
|
48398
48474
|
}));
|
|
48399
48475
|
await Promise.all(files.map(async (file) => {
|
|
48400
|
-
await mkdir4(
|
|
48476
|
+
await mkdir4(dirname7(file.path), { recursive: true });
|
|
48401
48477
|
await writeFile5(file.path, file.bytes, { flag: options.overwrite ? "w" : "wx" });
|
|
48402
48478
|
}));
|
|
48403
48479
|
return {
|
|
@@ -48523,7 +48599,7 @@ var bundleHtml = async (options) => {
|
|
|
48523
48599
|
// package.json
|
|
48524
48600
|
var package_default = {
|
|
48525
48601
|
name: "@aryasaatvik/scratchpad",
|
|
48526
|
-
version: "0.5.
|
|
48602
|
+
version: "0.5.1",
|
|
48527
48603
|
description: "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
|
|
48528
48604
|
keywords: [
|
|
48529
48605
|
"bun",
|
|
@@ -49895,7 +49971,7 @@ var codemapFreshness = async (root, recorded) => compareRepositoryState(recorded
|
|
|
49895
49971
|
|
|
49896
49972
|
// packages/cli/src/codemap/root.ts
|
|
49897
49973
|
import { access as access3 } from "fs/promises";
|
|
49898
|
-
import { dirname as
|
|
49974
|
+
import { dirname as dirname8, resolve as resolve13 } from "path";
|
|
49899
49975
|
var gitRoot = async (start) => {
|
|
49900
49976
|
const child = Bun.spawn(["git", "-C", start, "rev-parse", "--show-toplevel"], {
|
|
49901
49977
|
stdout: "pipe",
|
|
@@ -49911,7 +49987,7 @@ var configRoot = async (start) => {
|
|
|
49911
49987
|
await access3(resolve13(current, CONFIG_FILENAME));
|
|
49912
49988
|
return current;
|
|
49913
49989
|
} catch {
|
|
49914
|
-
const parent =
|
|
49990
|
+
const parent = dirname8(current);
|
|
49915
49991
|
if (parent === current)
|
|
49916
49992
|
return;
|
|
49917
49993
|
current = parent;
|
|
@@ -51191,9 +51267,9 @@ var feedback = make36("feedback").pipe(withSubcommands([
|
|
|
51191
51267
|
|
|
51192
51268
|
// packages/cli/src/runtime/store.ts
|
|
51193
51269
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
51194
|
-
import { dirname as
|
|
51270
|
+
import { dirname as dirname9 } from "path";
|
|
51195
51271
|
var projectionStoreLayer = (statePath) => {
|
|
51196
|
-
mkdirSync2(
|
|
51272
|
+
mkdirSync2(dirname9(statePath), { recursive: true });
|
|
51197
51273
|
return ProjectionStore.layer.pipe(provide2(Database2.layer(statePath)));
|
|
51198
51274
|
};
|
|
51199
51275
|
|
|
@@ -51274,12 +51350,12 @@ var path = make36("path", {
|
|
|
51274
51350
|
}).pipe(withDescription4("Print the resolved project notes root"));
|
|
51275
51351
|
|
|
51276
51352
|
// packages/cli/src/commands/repair.ts
|
|
51277
|
-
import { basename as
|
|
51353
|
+
import { basename as basename6 } from "path";
|
|
51278
51354
|
class RepairUsageError extends TaggedError3()("RepairUsageError", {
|
|
51279
51355
|
message: String4
|
|
51280
51356
|
}) {
|
|
51281
51357
|
}
|
|
51282
|
-
var selectConflicts = (conflicts, file) => isSome2(file) ? conflicts.filter((conflict) => conflict.slug ===
|
|
51358
|
+
var selectConflicts = (conflicts, file) => isSome2(file) ? conflicts.filter((conflict) => conflict.slug === basename6(file.value, ".md")) : conflicts;
|
|
51283
51359
|
var applyResolution = fn2("cli.applyResolution")(function* (targets, resolution) {
|
|
51284
51360
|
const engine = yield* SyncEngine;
|
|
51285
51361
|
for (const conflict of targets)
|
|
@@ -51332,7 +51408,7 @@ var repair = make36("repair", {
|
|
|
51332
51408
|
const walk = selectConflicts(conflicts, file);
|
|
51333
51409
|
if (isSome2(file) && walk.length === 0) {
|
|
51334
51410
|
return yield* new RepairUsageError({
|
|
51335
|
-
message: `no open conflict matches --file ${
|
|
51411
|
+
message: `no open conflict matches --file ${basename6(file.value, ".md")}`
|
|
51336
51412
|
});
|
|
51337
51413
|
}
|
|
51338
51414
|
for (const conflict of walk) {
|
|
@@ -52619,7 +52695,7 @@ var status = make36("status", {
|
|
|
52619
52695
|
// packages/cli/src/commands/upload.ts
|
|
52620
52696
|
import { createHash as createHash10 } from "crypto";
|
|
52621
52697
|
import { stat as stat6 } from "fs/promises";
|
|
52622
|
-
import { basename as
|
|
52698
|
+
import { basename as basename7, resolve as resolve16 } from "path";
|
|
52623
52699
|
var uploadContentTypes = {
|
|
52624
52700
|
png: "image/png",
|
|
52625
52701
|
jpg: "image/jpeg",
|
|
@@ -52665,7 +52741,7 @@ var uploadFiles = async (options) => {
|
|
|
52665
52741
|
throw new Error(`${absolute} is empty`);
|
|
52666
52742
|
if (info.size > MAX_MULTIPART_UPLOAD_BYTES)
|
|
52667
52743
|
throw new Error(`${absolute} exceeds the ${MAX_MULTIPART_UPLOAD_BYTES} byte upload limit`);
|
|
52668
|
-
const filename = options.name ??
|
|
52744
|
+
const filename = options.name ?? basename7(absolute);
|
|
52669
52745
|
const contentType = options.contentType ?? inferContentType(filename);
|
|
52670
52746
|
const contentHash = await hashFile(absolute);
|
|
52671
52747
|
const input = {
|
package/package.json
CHANGED