@aryasaatvik/scratchpad 0.4.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 CHANGED
@@ -1,3 +1,30 @@
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
+
15
+ ## @aryasaatvik/scratchpad@0.5.0
16
+
17
+ ### Understand sync previews and mount failures
18
+
19
+ Dry-run actions now explain why they are planned, including new mappings, changed hashes, queued
20
+ work, missing files, remote changes, and remote closures. Changed hashes show an eight-character stored/current
21
+ comparison, also available in JSON output.
22
+
23
+ Sync commands now print an actionable error when a stored mount cannot be matched to your
24
+ configuration, with a `mount_error` JSON envelope under `--json`. A missing mount directory with
25
+ stored mappings stops sync before it can mistake directory loss for requests to close issues or
26
+ archive milestones. Restore the directory or use `scratchpad repair` to inspect the state.
27
+
1
28
  ## @aryasaatvik/scratchpad@0.4.0
2
29
 
3
30
  ### Clearer archive and upload 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
@@ -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";
@@ -43581,6 +43584,7 @@ var conflicts = sqliteTable("conflicts", {
43581
43584
  // packages/core/src/store/projection-store.ts
43582
43585
  class ProjectionStoreError extends TaggedError3()("ProjectionStoreError", {
43583
43586
  message: String4,
43587
+ reason: optional2(Literal2("mount_alias")),
43584
43588
  cause: optional2(Defect())
43585
43589
  }) {
43586
43590
  }
@@ -43606,6 +43610,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
43606
43610
  for (const { from, to } of aliases) {
43607
43611
  if (from.length === 0 || to.length === 0 || from === to || targets.has(from)) {
43608
43612
  return yield* new ProjectionStoreError({
43613
+ reason: "mount_alias",
43609
43614
  message: `Invalid mount alias ${from} -> ${to}`
43610
43615
  });
43611
43616
  }
@@ -43614,6 +43619,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
43614
43619
  for (const [from, to] of targets) {
43615
43620
  if (targets.has(to)) {
43616
43621
  return yield* new ProjectionStoreError({
43622
+ reason: "mount_alias",
43617
43623
  message: `Chained mount alias ${from} -> ${to}`
43618
43624
  });
43619
43625
  }
@@ -43632,6 +43638,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
43632
43638
  return JSON.stringify(leftFields) === JSON.stringify(rightFields);
43633
43639
  };
43634
43640
  const collision = (table, objectKey) => new ProjectionStoreError({
43641
+ reason: "mount_alias",
43635
43642
  message: `Cannot adopt mount aliases: conflicting ${table} rows for ${objectKey}`
43636
43643
  });
43637
43644
  const mappingGroups = Map.groupBy(mappings, key);
@@ -43822,6 +43829,11 @@ var localizeDependencies = (body, slugForExternalId, fromSlug = "") => rewriteSe
43822
43829
  // packages/core/src/sync/mounts.ts
43823
43830
  import { realpathSync } from "fs";
43824
43831
  import { basename as basename2, dirname as dirname2, join as join6, resolve as resolve5 } from "path";
43832
+ class MountError extends TaggedError3()("MountError", {
43833
+ message: String4,
43834
+ cause: optional2(Defect())
43835
+ }) {
43836
+ }
43825
43837
  function physicalMountPath(directory) {
43826
43838
  let ancestor = resolve5(directory);
43827
43839
  const remaining = [];
@@ -43858,7 +43870,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43858
43870
  const fs = yield* FileSystem;
43859
43871
  const config = yield* try_3({
43860
43872
  try: () => physicalMountConfig(input),
43861
- catch: (cause) => new ProjectionStoreError({ message: "Could not resolve physical mounts", cause })
43873
+ catch: (cause) => new MountError({ message: "Could not resolve physical mounts", cause })
43862
43874
  });
43863
43875
  const targets = config.mounts.flatMap((mount) => [
43864
43876
  { kind: "issue", mount: mount.issues, archive: false },
@@ -43875,7 +43887,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43875
43887
  continue;
43876
43888
  const physical = yield* try_3({
43877
43889
  try: () => physicalMountPath(from),
43878
- catch: (cause) => new ProjectionStoreError({ message: `Could not resolve mount alias: ${from}`, cause })
43890
+ catch: (cause) => new MountError({ message: `Could not resolve mount alias: ${from}`, cause })
43879
43891
  });
43880
43892
  if (configured.has(physical)) {
43881
43893
  aliases.push({ from, to: physical });
@@ -43889,8 +43901,8 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43889
43901
  if (yield* fs.exists(from)) {
43890
43902
  if (archived)
43891
43903
  continue;
43892
- return yield* new ProjectionStoreError({
43893
- message: `Stored mount ${from} resolves outside configured physical mounts; retained sync state unchanged.`
43904
+ return yield* new MountError({
43905
+ message: `Stored mount ${from} resolves outside configured physical mounts; retained sync state unchanged. Restore the stored mount in scratchpad.config.ts or restore its original directory before syncing.`
43894
43906
  });
43895
43907
  }
43896
43908
  let candidates = new Set(configured);
@@ -43904,7 +43916,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43904
43916
  const file = join6(target.mount, `${mapping.slug}.md`);
43905
43917
  if (!(yield* fs.exists(file)))
43906
43918
  continue;
43907
- const text = yield* fs.readFileString(file).pipe(mapError2((cause) => new ProjectionStoreError({
43919
+ const text = yield* fs.readFileString(file).pipe(mapError2((cause) => new MountError({
43908
43920
  message: `Could not inspect mount identity: ${file}`,
43909
43921
  cause
43910
43922
  })));
@@ -43920,13 +43932,16 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43920
43932
  if (archived && candidates.size === 0)
43921
43933
  continue;
43922
43934
  if (candidates.size !== 1) {
43923
- return yield* new ProjectionStoreError({
43935
+ return yield* new MountError({
43924
43936
  message: `Cannot prove mount alias ${from}; retained sync state unchanged. Restore its mount or resolve the alias before syncing.`
43925
43937
  });
43926
43938
  }
43927
43939
  aliases.push({ from, to: [...candidates][0] });
43928
43940
  }
43929
- const projection = yield* store.adoptMountAliases(aliases, dryRun);
43941
+ const projection = yield* store.adoptMountAliases(aliases, dryRun).pipe(mapError2((cause) => cause.reason === "mount_alias" ? new MountError({
43942
+ message: `${cause.message}. Retained sync state unchanged. Restore the original mount configuration and reconcile the conflicting records before syncing.`,
43943
+ cause
43944
+ }) : cause));
43930
43945
  const writableMounts = targets.filter((target) => !target.archive).map((target) => target.mount);
43931
43946
  const writable = new Set(writableMounts);
43932
43947
  const activeState = (row) => writable.has(row.mount);
@@ -43956,6 +43971,31 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
43956
43971
  };
43957
43972
  return { config, store: scopeWrites(view) };
43958
43973
  });
43974
+ var validateMountDirectories = fn2("Sync.validateMountDirectories")(function* (config, store) {
43975
+ const fs = yield* FileSystem;
43976
+ for (const mount of config.mounts) {
43977
+ for (const [kind, directory] of [
43978
+ ["issue", mount.issues],
43979
+ ["milestone", mount.milestones]
43980
+ ]) {
43981
+ const info = yield* fs.stat(directory).pipe(catch_2((cause) => cause.reason._tag === "NotFound" ? succeed6(undefined) : fail6(new MountError({
43982
+ message: `Cannot inspect mount directory ${directory}. Restore access before syncing.`,
43983
+ cause
43984
+ }))));
43985
+ if (info?.type === "Directory")
43986
+ continue;
43987
+ if (info !== undefined)
43988
+ return yield* new MountError({
43989
+ message: `Mount path ${directory} is not a directory. Restore the directory before syncing; refusing to plan closes or archives.`
43990
+ });
43991
+ const mappings = yield* store.listMappings(kind, directory);
43992
+ if (mappings.length > 0)
43993
+ return yield* new MountError({
43994
+ message: `Mount directory ${directory} is missing with ${mappings.length} stored mapping(s). Restore the directory or run scratchpad repair before syncing; refusing to plan closes or archives.`
43995
+ });
43996
+ }
43997
+ }
43998
+ });
43959
43999
 
43960
44000
  // packages/core/src/sync/engine.ts
43961
44001
  class RemoteDeleteError extends TaggedError3()("RemoteDeleteError", {
@@ -43980,7 +44020,21 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
43980
44020
  ...slugValue === undefined ? {} : { issueSlug: slugValue }
43981
44021
  });
43982
44022
  const renderMilestone = (doc) => renderMilestoneFile(doc, frontmatterOptions);
43983
- const listSlugs = (dir) => fs.readDirectory(dir, { recursive: true }).pipe(map6((names) => names.map((name) => name.replaceAll("\\", "/")).filter((name) => name.endsWith(".md")).map((name) => name.slice(0, -3))), orElseSucceed2(() => []));
44023
+ const listSlugs = (dir) => fs.readDirectory(dir, { recursive: true }).pipe(map6((names) => names.map((name) => name.replaceAll("\\", "/")).filter((name) => name.endsWith(".md")).map((name) => name.slice(0, -3))), catch_2((cause) => gen2(function* () {
44024
+ if (cause.reason._tag === "NotFound" && !(yield* fs.exists(dir))) {
44025
+ const mount = path.resolve(dir);
44026
+ const mappings = [
44027
+ ...yield* store.listMappings("issue", mount),
44028
+ ...yield* store.listMappings("milestone", mount)
44029
+ ];
44030
+ if (mappings.length === 0)
44031
+ return [];
44032
+ }
44033
+ return yield* new MountError({
44034
+ message: `Cannot scan mount directory ${dir}. Restore the directory and read access before syncing; refusing to plan closes or archives.`,
44035
+ cause
44036
+ });
44037
+ })));
43984
44038
  const fileStatus = (frontmatter) => {
43985
44039
  if (frontmatter.status !== undefined && classifyStatus(frontmatter.status, frontmatterOptions.closedStatuses) === frontmatter.state) {
43986
44040
  return frontmatter.status;
@@ -44213,7 +44267,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44213
44267
  if (!opts.dryRun)
44214
44268
  yield* store.deleteObjectMapping(opts.kind, mountKey, duplicate.slug);
44215
44269
  if (duplicate.syncStatus !== "closed") {
44216
- actions.push({ kind: opts.kind, slug: duplicate.slug, externalId, op: "retire" });
44270
+ actions.push({
44271
+ kind: opts.kind,
44272
+ slug: duplicate.slug,
44273
+ externalId,
44274
+ op: "retire",
44275
+ reason: "local-missing"
44276
+ });
44217
44277
  }
44218
44278
  });
44219
44279
  let maxUpdated = since;
@@ -44245,7 +44305,8 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44245
44305
  kind: opts.kind,
44246
44306
  slug: priorMapping.slug,
44247
44307
  externalId,
44248
- op: "retire"
44308
+ op: "retire",
44309
+ reason: "remote-closed"
44249
44310
  });
44250
44311
  }
44251
44312
  }
@@ -44274,7 +44335,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44274
44335
  syncStatus: "archived"
44275
44336
  });
44276
44337
  }
44277
- actions.push({ kind: opts.kind, slug: archiveSlug, externalId, op: "write" });
44338
+ actions.push({
44339
+ kind: opts.kind,
44340
+ slug: archiveSlug,
44341
+ externalId,
44342
+ op: "write",
44343
+ reason: "remote-changed"
44344
+ });
44278
44345
  }
44279
44346
  }
44280
44347
  const ru = remote.frontmatter.sync?.remoteUpdatedAt;
@@ -44320,11 +44387,23 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44320
44387
  });
44321
44388
  }
44322
44389
  conflicted = true;
44323
- actions.push({ kind: opts.kind, slug: slugValue, externalId, op: "conflict" });
44390
+ actions.push({
44391
+ kind: opts.kind,
44392
+ slug: slugValue,
44393
+ externalId,
44394
+ op: "conflict",
44395
+ reason: "conflict"
44396
+ });
44324
44397
  } else if (remoteChanged) {
44325
44398
  if (!opts.dryRun)
44326
44399
  yield* writeDoc(absPath, renderRemote(remote, current, slugValue));
44327
- actions.push({ kind: opts.kind, slug: slugValue, externalId, op: "write" });
44400
+ actions.push({
44401
+ kind: opts.kind,
44402
+ slug: slugValue,
44403
+ externalId,
44404
+ op: "write",
44405
+ reason: "remote-changed"
44406
+ });
44328
44407
  }
44329
44408
  } else {
44330
44409
  if (fileExists && opts.preserveLocal !== undefined) {
@@ -44332,7 +44411,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44332
44411
  }
44333
44412
  if (!opts.dryRun)
44334
44413
  yield* writeDoc(absPath, renderRemote(remote, current, slugValue));
44335
- actions.push({ kind: opts.kind, slug: slugValue, externalId, op: "write" });
44414
+ actions.push({
44415
+ kind: opts.kind,
44416
+ slug: slugValue,
44417
+ externalId,
44418
+ op: "write",
44419
+ reason: fileExists ? "remote-changed" : "new-file"
44420
+ });
44336
44421
  }
44337
44422
  if (!opts.dryRun) {
44338
44423
  yield* store.putObjectMapping({
@@ -44379,6 +44464,7 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44379
44464
  kind: opts.kind,
44380
44465
  slug: mapping.slug,
44381
44466
  op: "prune",
44467
+ reason: exists ? "archive-expired" : "local-missing",
44382
44468
  ...mapping.externalId === null ? {} : { externalId: mapping.externalId }
44383
44469
  });
44384
44470
  }
@@ -44470,6 +44556,11 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44470
44556
  kind: opts.kind,
44471
44557
  slug: slugValue,
44472
44558
  op,
44559
+ reason: mapping === undefined ? "no-mapping" : "hash-changed",
44560
+ ...opts.dryRun && mapping !== undefined ? {
44561
+ ...mapping.contentHash === null ? {} : { storedHash: mapping.contentHash.slice(0, 8) },
44562
+ currentHash: hash.slice(0, 8)
44563
+ } : {},
44473
44564
  ...externalId === undefined ? {} : { externalId }
44474
44565
  });
44475
44566
  }
@@ -44498,7 +44589,8 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44498
44589
  kind: opts.kind,
44499
44590
  slug: mapping.slug,
44500
44591
  externalId: mapping.externalId,
44501
- op
44592
+ op,
44593
+ reason: "local-missing"
44502
44594
  });
44503
44595
  }
44504
44596
  return actions;
@@ -44708,6 +44800,7 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44708
44800
  kind: row.kind === "milestone" ? "milestone" : "issue",
44709
44801
  slug: row.slug,
44710
44802
  op: row.op,
44803
+ reason: "queued",
44711
44804
  ...externalId === undefined ? {} : { externalId }
44712
44805
  };
44713
44806
  }));
@@ -44843,15 +44936,15 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44843
44936
  return SyncEngine.of({
44844
44937
  pull: (opts) => {
44845
44938
  const dryRun = opts?.dryRun ?? false;
44846
- return pull(dryRun, opts?.full ?? false).pipe(map6(report(dryRun)), orDie2);
44939
+ return pull(dryRun, opts?.full ?? false).pipe(map6(report(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
44847
44940
  },
44848
44941
  push: (opts) => {
44849
44942
  const dryRun = opts?.dryRun ?? false;
44850
- return push(dryRun).pipe(map6(reportWith(dryRun)), orDie2);
44943
+ return push(dryRun).pipe(map6(reportWith(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
44851
44944
  },
44852
44945
  sync: (opts) => {
44853
44946
  const dryRun = opts?.dryRun ?? false;
44854
- return sync(dryRun, opts?.full ?? false).pipe(map6(reportWith(dryRun)), orDie2);
44947
+ return sync(dryRun, opts?.full ?? false).pipe(map6(reportWith(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
44855
44948
  },
44856
44949
  deleteRemote: (filePath, opts) => {
44857
44950
  const dryRun = opts?.dryRun ?? false;
@@ -44867,14 +44960,14 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
44867
44960
  const config = yield* ProjectConfig;
44868
44961
  const fs = yield* FileSystem;
44869
44962
  const path = yield* Path;
44870
- const build = (dryRun) => prepareMounts(config, store, dryRun).pipe(provideService2(FileSystem, fs), flatMap3((prepared) => SyncEngine.make.pipe(provideService2(Provider, provider), provideService2(ProjectionStore, prepared.store), provideService2(ProjectConfig, prepared.config), provideService2(FileSystem, fs), provideService2(Path, path))));
44963
+ const build = (dryRun, validateDirectories = false) => prepareMounts(config, store, dryRun).pipe(provideService2(FileSystem, fs), flatMap3((prepared) => SyncEngine.make.pipe(tap2(() => validateDirectories ? validateMountDirectories(prepared.config, prepared.store).pipe(provideService2(FileSystem, fs)) : void_3), provideService2(Provider, provider), provideService2(ProjectionStore, prepared.store), provideService2(ProjectConfig, prepared.config), provideService2(FileSystem, fs), provideService2(Path, path))));
44871
44964
  return SyncEngine.of({
44872
- pull: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.pull(opts)), orDie2),
44873
- push: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.push(opts)), orDie2),
44874
- sync: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.sync(opts)), orDie2),
44965
+ pull: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.pull(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
44966
+ push: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.push(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
44967
+ sync: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.sync(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
44875
44968
  deleteRemote: (file, opts) => build(opts?.dryRun ?? false).pipe(mapError2((cause) => new RemoteDeleteError({ message: cause.message, cause })), flatMap3((engine) => engine.deleteRemote(file, opts))),
44876
- listConflicts: build(true).pipe(flatMap3((engine) => engine.listConflicts), orDie2),
44877
- resolveConflict: (id, resolution) => build(false).pipe(flatMap3((engine) => engine.resolveConflict(id, resolution)), orDie2)
44969
+ listConflicts: build(true).pipe(flatMap3((engine) => engine.listConflicts), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
44970
+ resolveConflict: (id, resolution) => build(false).pipe(flatMap3((engine) => engine.resolveConflict(id, resolution)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)))
44878
44971
  });
44879
44972
  }));
44880
44973
  }
@@ -47057,6 +47150,10 @@ var globalNotesHome = () => {
47057
47150
  return override !== undefined && override !== "" ? override : join7(homeDirectory(), ".scratchpad");
47058
47151
  };
47059
47152
  var cwd = () => process.cwd();
47153
+ var logicalCwd = () => {
47154
+ const pwd = process.env["PWD"];
47155
+ return pwd !== undefined && isAbsolute2(pwd) ? pwd : undefined;
47156
+ };
47060
47157
  var classifierModelEnv = () => {
47061
47158
  const model = process.env["SCRATCHPAD_CLASSIFIER"];
47062
47159
  return model !== undefined && model !== "" ? model : undefined;
@@ -47093,7 +47190,7 @@ ${mounts.flatMap((mount) => [mount.issues, mount.milestones]).map((directory) =>
47093
47190
  }
47094
47191
 
47095
47192
  // packages/cli/src/runtime/project.ts
47096
- import { join as join9 } from "path";
47193
+ import { basename as basename4, dirname as dirname4, join as join9 } from "path";
47097
47194
  class ProjectError extends TaggedError3()("ProjectError", {
47098
47195
  message: String4,
47099
47196
  cause: optional2(Defect())
@@ -47102,8 +47199,11 @@ class ProjectError extends TaggedError3()("ProjectError", {
47102
47199
 
47103
47200
  class Project extends Service()("@scratchpad/cli/Project") {
47104
47201
  static layer = effect(Project, gen2(function* () {
47105
- const start = cwd();
47106
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
+ });
47107
47207
  const rootResult = yield* runGit(start, ["rev-parse", "--show-toplevel"]);
47108
47208
  if (rootResult.code === 128 && /not a git repository/i.test(rootResult.stderr)) {
47109
47209
  const toplevel2 = yield* fs.realPath(start).pipe(mapError2((cause) => new ProjectError({ message: "Could not resolve the working directory", cause })));
@@ -47147,6 +47247,40 @@ class Project extends Service()("@scratchpad/cli/Project") {
47147
47247
  return { toplevel, primary, projectId, ...notes };
47148
47248
  }));
47149
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
+ });
47150
47284
  var resolveNotesRoot = (input) => gen2(function* () {
47151
47285
  const worktreeNotes = join9(input.toplevel, ".scratchpad");
47152
47286
  if (yield* input.isDir(worktreeNotes)) {
@@ -47260,6 +47394,7 @@ var isWithin = (path, root, candidate) => {
47260
47394
  const relative = path.relative(root, candidate);
47261
47395
  return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
47262
47396
  };
47397
+ var removeCreated = (created) => forEach2([...created].sort((left, right) => right.length - left.length), (directory) => tryPromise2(() => rmdir(directory)).pipe(ignore2), { discard: true });
47263
47398
  var archiveFiles = (input) => gen2(function* () {
47264
47399
  const fs = yield* FileSystem;
47265
47400
  const path = yield* Path;
@@ -47314,14 +47449,21 @@ var archiveFiles = (input) => gen2(function* () {
47314
47449
  }));
47315
47450
  }
47316
47451
  const info = yield* fs.stat(source);
47317
- if (info.type !== "File") {
47452
+ if (info.type !== "File" && info.type !== "Directory") {
47318
47453
  return yield* fail6(new NotesCommandError({
47319
47454
  reason: "invalid",
47320
- 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`
47321
47463
  }));
47322
47464
  }
47323
47465
  for (const mount of canonicalMounts) {
47324
- 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))) {
47325
47467
  return yield* fail6(new NotesCommandError({
47326
47468
  reason: "conflict",
47327
47469
  message: `Refusing to archive mounted path ${source}; close it through the backlog/sync flow instead`
@@ -47335,6 +47477,18 @@ var archiveFiles = (input) => gen2(function* () {
47335
47477
  message: `Refusing to archive notes root README.md: ${source}`
47336
47478
  }));
47337
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
+ }
47338
47492
  const destination = path.join(archiveRoot, relative);
47339
47493
  if (yield* fs.exists(destination)) {
47340
47494
  return yield* fail6(new NotesCommandError({
@@ -47349,13 +47503,22 @@ var archiveFiles = (input) => gen2(function* () {
47349
47503
  }));
47350
47504
  }
47351
47505
  destinations.add(destination);
47352
- sources.push({ source, relative, destination });
47506
+ sources.push({ source, relative, destination, directory });
47353
47507
  }
47508
+ const created = [];
47509
+ if (!(yield* fs.exists(archiveRoot)))
47510
+ created.push(archiveRoot);
47354
47511
  yield* fs.makeDirectory(archiveRoot, { recursive: true });
47355
47512
  const moved = [];
47356
47513
  for (const { source, destination } of sources) {
47357
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
+ }
47358
47520
  yield* fs.makeDirectory(path.dirname(destination), { recursive: true });
47521
+ created.push(...parents);
47359
47522
  yield* fs.rename(source, destination);
47360
47523
  }).pipe(match6({
47361
47524
  onFailure: (error) => ({ ok: false, error }),
@@ -47364,6 +47527,7 @@ var archiveFiles = (input) => gen2(function* () {
47364
47527
  if (!result.ok) {
47365
47528
  for (const completed of moved.reverse())
47366
47529
  yield* fs.rename(completed.destination, completed.source);
47530
+ yield* removeCreated(created);
47367
47531
  return yield* fail6(result.error);
47368
47532
  }
47369
47533
  moved.push({ source, destination });
@@ -47373,14 +47537,16 @@ var archiveFiles = (input) => gen2(function* () {
47373
47537
  const separator = previous.length === 0 || previous.endsWith(`
47374
47538
  `) ? "" : `
47375
47539
  `;
47540
+ const listing = sources.map(({ relative, directory }) => ` - ${relative}${directory ? "/" : ""}
47541
+ `).join("");
47376
47542
  yield* fs.writeFileString(readme, `${previous}${separator}- ${date}: ${input.reason}
47377
- `);
47543
+ ${listing}`);
47378
47544
  return archiveRoot;
47379
47545
  });
47380
47546
  var archive2 = make36("archive", {
47381
- paths: String8("paths").pipe(withDescription2("File paths relative to the notes root (omit the .scratchpad/ prefix)"), variadic2({ min: 1 })),
47382
- reason: String9("reason").pipe(withDescription3("Why the files are archived; becomes the folder suffix"))
47383
- }, ({ 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"));
47384
47550
 
47385
47551
  // packages/cli/src/output.ts
47386
47552
  var styled = (open, close) => (text) => Bun.enableANSIColors ? `\x1B[${open}m${text}\x1B[${close}m` : text;
@@ -47409,7 +47575,9 @@ function formatReport(name, report) {
47409
47575
  const lines = report.actions.length === 0 ? [dim(`${prefix}: no changes`)] : [`${prefix}: ${report.actions.length} action(s)`];
47410
47576
  for (const action of report.actions.slice(0, MAX_ACTIONS)) {
47411
47577
  const ref = action.externalId === undefined ? "" : ` #${action.externalId}`;
47412
- lines.push(` ${bold2(action.op)} ${action.kind} ${action.slug}${dim(ref)}`);
47578
+ const hashes = action.storedHash !== undefined && action.currentHash !== undefined ? `: ${action.storedHash}\u2192${action.currentHash}` : "";
47579
+ const reason = report.dryRun && action.reason !== undefined ? ` (${action.reason}${hashes})` : "";
47580
+ lines.push(` ${bold2(action.op)} ${action.kind} ${action.slug}${dim(ref)}${dim(reason)}`);
47413
47581
  }
47414
47582
  const remaining = report.actions.length - Math.min(report.actions.length, MAX_ACTIONS);
47415
47583
  if (remaining > 0)
@@ -47428,7 +47596,7 @@ function formatReport(name, report) {
47428
47596
 
47429
47597
  // packages/cli/src/commands/artifact/config.ts
47430
47598
  import { chmod as chmod3, mkdir as mkdir2, readFile as readFile4, rename as rename3, writeFile as writeFile3 } from "fs/promises";
47431
- import { dirname as dirname4, join as join10 } from "path";
47599
+ import { dirname as dirname5, join as join10 } from "path";
47432
47600
  var DeploymentUrl = URLFromString.check(makeFilter2((url) => url.protocol === "http:" || url.protocol === "https:" ? undefined : "deployment URL must use HTTP or HTTPS"));
47433
47601
  var DeploymentProfile = Struct({
47434
47602
  url: DeploymentUrl,
@@ -47463,7 +47631,7 @@ var readProfiles = async (allowMissing = false) => {
47463
47631
  var writeProfiles = async (profiles) => {
47464
47632
  const path = artifactProfilesPath();
47465
47633
  const temporary = `${path}.tmp-${process.pid}-${crypto.randomUUID()}`;
47466
- await mkdir2(dirname4(path), { recursive: true });
47634
+ await mkdir2(dirname5(path), { recursive: true });
47467
47635
  await writeFile3(temporary, `${JSON.stringify(profiles, null, 2)}
47468
47636
  `, {
47469
47637
  encoding: "utf8",
@@ -47547,7 +47715,7 @@ class ArtifactCommandError extends TaggedError3()("ArtifactCommandError", { mess
47547
47715
  var artifactError = (error) => new ArtifactCommandError({ message: error instanceof Error ? error.message : String(error) });
47548
47716
 
47549
47717
  // packages/cli/src/commands/artifact/shared.ts
47550
- import { basename as basename4, isAbsolute as isAbsolute3, relative as relative3, sep as sep3 } from "path";
47718
+ import { basename as basename5, isAbsolute as isAbsolute3, relative as relative3, sep as sep3 } from "path";
47551
47719
  var clientForProfile = (profile) => new ArtifactClient({
47552
47720
  baseUrl: profile.url.toString().replace(/\/$/, ""),
47553
47721
  ...profile.accessClientId && profile.accessClientSecret ? { access: { clientId: profile.accessClientId, clientSecret: profile.accessClientSecret } } : {}
@@ -47578,10 +47746,10 @@ var gitMetadata = async (cwd) => ({
47578
47746
  });
47579
47747
  var portableSourcePath = (absolutePath, gitRoot) => {
47580
47748
  if (!gitRoot)
47581
- return basename4(absolutePath);
47749
+ return basename5(absolutePath);
47582
47750
  const fromRoot = relative3(gitRoot, absolutePath);
47583
47751
  if (fromRoot === ".." || fromRoot.startsWith(`..${sep3}`) || isAbsolute3(fromRoot)) {
47584
- return basename4(absolutePath);
47752
+ return basename5(absolutePath);
47585
47753
  }
47586
47754
  return fromRoot.split(sep3).join("/");
47587
47755
  };
@@ -47672,7 +47840,7 @@ var artifactResolveCommand = make36("resolve", {
47672
47840
  // packages/cli/src/commands/artifact/archive.ts
47673
47841
  import { createHash as createHash5 } from "crypto";
47674
47842
  import { mkdir as mkdir3, readFile as readFile5, rename as rename4, rm as rm2, writeFile as writeFile4 } from "fs/promises";
47675
- import { dirname as dirname5, resolve as resolve9 } from "path";
47843
+ import { dirname as dirname6, resolve as resolve9 } from "path";
47676
47844
 
47677
47845
  // packages/cli/src/commands/artifact/archive-zip.ts
47678
47846
  var encoder4 = new TextEncoder;
@@ -47909,7 +48077,7 @@ var exportArtifactArchive = async (options) => {
47909
48077
  };
47910
48078
  entries.set("manifest.json", encoder5.encode(`${JSON.stringify(manifest, null, 2)}
47911
48079
  `));
47912
- await mkdir3(dirname5(output), { recursive: true });
48080
+ await mkdir3(dirname6(output), { recursive: true });
47913
48081
  await writeFile4(temporary, createDeterministicZip(entries), { flag: "wx" });
47914
48082
  await rename4(temporary, output);
47915
48083
  return {
@@ -48223,7 +48391,7 @@ var artifactProfileCommand = make36("profile").pipe(withDescription4("Manage art
48223
48391
  // packages/cli/src/commands/artifact/pull.ts
48224
48392
  import { createHash as createHash6 } from "crypto";
48225
48393
  import { lstat, mkdir as mkdir4, writeFile as writeFile5 } from "fs/promises";
48226
- import { dirname as dirname6, isAbsolute as isAbsolute4, relative as relative4, resolve as resolve10, sep as sep4 } from "path";
48394
+ import { dirname as dirname7, isAbsolute as isAbsolute4, relative as relative4, resolve as resolve10, sep as sep4 } from "path";
48227
48395
  var inside2 = (root, path) => {
48228
48396
  const fromRoot = relative4(root, path);
48229
48397
  return fromRoot === "" || !fromRoot.startsWith(`..${sep4}`) && fromRoot !== ".." && !isAbsolute4(fromRoot);
@@ -48238,7 +48406,7 @@ var existing = async (path) => {
48238
48406
  }
48239
48407
  };
48240
48408
  var assertSafeParents = async (root, target) => {
48241
- const segments = relative4(root, dirname6(target)).split(sep4).filter(Boolean);
48409
+ const segments = relative4(root, dirname7(target)).split(sep4).filter(Boolean);
48242
48410
  let current = root;
48243
48411
  const parents = [];
48244
48412
  for (const segment of segments) {
@@ -48286,7 +48454,7 @@ var pullArtifact = async (slug, options) => {
48286
48454
  { path: sourceTarget, bytes: decoded(result.contentBase64, result.contentHash) },
48287
48455
  ...result.assets.map((asset) => {
48288
48456
  const source = safeArtifactAssetPath(asset.source);
48289
- const path = resolve10(dirname6(sourceTarget), source);
48457
+ const path = resolve10(dirname7(sourceTarget), source);
48290
48458
  if (!inside2(root, path))
48291
48459
  throw new Error(`asset '${asset.source}' escapes the output directory`);
48292
48460
  return { path, bytes: decoded(asset.contentBase64, asset.hash) };
@@ -48305,7 +48473,7 @@ var pullArtifact = async (slug, options) => {
48305
48473
  throw new Error(`output file is a directory: ${file.path}`);
48306
48474
  }));
48307
48475
  await Promise.all(files.map(async (file) => {
48308
- await mkdir4(dirname6(file.path), { recursive: true });
48476
+ await mkdir4(dirname7(file.path), { recursive: true });
48309
48477
  await writeFile5(file.path, file.bytes, { flag: options.overwrite ? "w" : "wx" });
48310
48478
  }));
48311
48479
  return {
@@ -48431,7 +48599,7 @@ var bundleHtml = async (options) => {
48431
48599
  // package.json
48432
48600
  var package_default = {
48433
48601
  name: "@aryasaatvik/scratchpad",
48434
- version: "0.4.0",
48602
+ version: "0.5.1",
48435
48603
  description: "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
48436
48604
  keywords: [
48437
48605
  "bun",
@@ -49803,7 +49971,7 @@ var codemapFreshness = async (root, recorded) => compareRepositoryState(recorded
49803
49971
 
49804
49972
  // packages/cli/src/codemap/root.ts
49805
49973
  import { access as access3 } from "fs/promises";
49806
- import { dirname as dirname7, resolve as resolve13 } from "path";
49974
+ import { dirname as dirname8, resolve as resolve13 } from "path";
49807
49975
  var gitRoot = async (start) => {
49808
49976
  const child = Bun.spawn(["git", "-C", start, "rev-parse", "--show-toplevel"], {
49809
49977
  stdout: "pipe",
@@ -49819,7 +49987,7 @@ var configRoot = async (start) => {
49819
49987
  await access3(resolve13(current, CONFIG_FILENAME));
49820
49988
  return current;
49821
49989
  } catch {
49822
- const parent = dirname7(current);
49990
+ const parent = dirname8(current);
49823
49991
  if (parent === current)
49824
49992
  return;
49825
49993
  current = parent;
@@ -51099,9 +51267,9 @@ var feedback = make36("feedback").pipe(withSubcommands([
51099
51267
 
51100
51268
  // packages/cli/src/runtime/store.ts
51101
51269
  import { mkdirSync as mkdirSync2 } from "fs";
51102
- import { dirname as dirname8 } from "path";
51270
+ import { dirname as dirname9 } from "path";
51103
51271
  var projectionStoreLayer = (statePath) => {
51104
- mkdirSync2(dirname8(statePath), { recursive: true });
51272
+ mkdirSync2(dirname9(statePath), { recursive: true });
51105
51273
  return ProjectionStore.layer.pipe(provide2(Database2.layer(statePath)));
51106
51274
  };
51107
51275
 
@@ -51182,12 +51350,12 @@ var path = make36("path", {
51182
51350
  }).pipe(withDescription4("Print the resolved project notes root"));
51183
51351
 
51184
51352
  // packages/cli/src/commands/repair.ts
51185
- import { basename as basename5 } from "path";
51353
+ import { basename as basename6 } from "path";
51186
51354
  class RepairUsageError extends TaggedError3()("RepairUsageError", {
51187
51355
  message: String4
51188
51356
  }) {
51189
51357
  }
51190
- var selectConflicts = (conflicts, file) => isSome2(file) ? conflicts.filter((conflict) => conflict.slug === basename5(file.value, ".md")) : conflicts;
51358
+ var selectConflicts = (conflicts, file) => isSome2(file) ? conflicts.filter((conflict) => conflict.slug === basename6(file.value, ".md")) : conflicts;
51191
51359
  var applyResolution = fn2("cli.applyResolution")(function* (targets, resolution) {
51192
51360
  const engine = yield* SyncEngine;
51193
51361
  for (const conflict of targets)
@@ -51240,7 +51408,7 @@ var repair = make36("repair", {
51240
51408
  const walk = selectConflicts(conflicts, file);
51241
51409
  if (isSome2(file) && walk.length === 0) {
51242
51410
  return yield* new RepairUsageError({
51243
- message: `no open conflict matches --file ${basename5(file.value, ".md")}`
51411
+ message: `no open conflict matches --file ${basename6(file.value, ".md")}`
51244
51412
  });
51245
51413
  }
51246
51414
  for (const conflict of walk) {
@@ -51873,6 +52041,42 @@ Treat QA sessions as research work units:
51873
52041
  - move actionable findings into backlog issues before archiving the session;
51874
52042
  - keep unacted findings in research rather than silently treating them as complete;
51875
52043
  - link archived sessions to the resulting issues, fixes, or durable documentation.
52044
+
52045
+ ## Sync previews and mount errors
52046
+
52047
+ Use \`scratchpad pull --dry-run\`, \`push --dry-run\`, or \`sync --dry-run\` to preview actions. Each
52048
+ action includes a short reason, for example:
52049
+
52050
+ \`\`\`text
52051
+ update issue foo #12 (hash-changed: a1b2c3d4\u2192e5f6a7b8)
52052
+ \`\`\`
52053
+
52054
+ \`no-mapping\` means the local file has no stored mapping; \`hash-changed\` means its content hash
52055
+ changed (which can include rendering changes); \`queued\` means the operation is already in the
52056
+ outbox; \`local-missing\` means a mapped file is absent. Pull also reports \`new-file\`,
52057
+ \`remote-changed\`, \`remote-closed\`, \`conflict\`, and \`archive-expired\` for its corresponding actions.
52058
+ \`--json\` includes \`reason\` and, for dry-run hash changes with a stored baseline, eight-character
52059
+ \`storedHash\` and \`currentHash\` fields. These hashes describe the comparison, not the cause of an
52060
+ edit.
52061
+
52062
+ A stored mount that cannot be matched to the configured mounts fails with an actionable \`\u2717\`
52063
+ diagnostic and exit 1. With \`--json\`, stdout contains a single
52064
+ \`{"status":"error","reason":"mount_error","message":"\u2026"}\` envelope and stderr keeps the diagnostic.
52065
+ A missing configured directory with stored mappings also refuses sync before planning closes or
52066
+ archives: restore the named directory or inspect \`scratchpad repair\`. Removing one file from an
52067
+ existing directory still plans its normal close or archive.
52068
+
52069
+ A \`retire\` with \`remote-closed\` means the provider reports a closed object: a real pull removes its
52070
+ active backlog file if present and marks its mapping closed, updating the stored remote hash and
52071
+ timestamp. A stale mapping can need this update even when its file is already absent. Archive
52072
+ projection, when configured, is separate. A \`retire\` with \`local-missing\` removes a redundant
52073
+ mapping whose duplicate file is absent; it does not close the remote object.
52074
+
52075
+ A mount path replaced by a file or an unreadable directory scan also stops sync; neither is
52076
+ interpreted as an empty mount. Restore the directory and read access before retrying. Conflicting
52077
+ stored rows during alias adoption produce \`mount_error\` too, while retaining the original state. For
52078
+ an unmatched stored mount, restore its configuration or directory first: \`scratchpad repair\`
52079
+ resolves content conflicts and cannot repair mount aliases.
51876
52080
  `;
51877
52081
 
51878
52082
  // packages/cli/skill-data/scratchpad/references/organization.md
@@ -52491,7 +52695,7 @@ var status = make36("status", {
52491
52695
  // packages/cli/src/commands/upload.ts
52492
52696
  import { createHash as createHash10 } from "crypto";
52493
52697
  import { stat as stat6 } from "fs/promises";
52494
- import { basename as basename6, resolve as resolve16 } from "path";
52698
+ import { basename as basename7, resolve as resolve16 } from "path";
52495
52699
  var uploadContentTypes = {
52496
52700
  png: "image/png",
52497
52701
  jpg: "image/jpeg",
@@ -52537,7 +52741,7 @@ var uploadFiles = async (options) => {
52537
52741
  throw new Error(`${absolute} is empty`);
52538
52742
  if (info.size > MAX_MULTIPART_UPLOAD_BYTES)
52539
52743
  throw new Error(`${absolute} exceeds the ${MAX_MULTIPART_UPLOAD_BYTES} byte upload limit`);
52540
- const filename = options.name ?? basename6(absolute);
52744
+ const filename = options.name ?? basename7(absolute);
52541
52745
  const contentType = options.contentType ?? inferContentType(filename);
52542
52746
  const contentHash = await hashFile(absolute);
52543
52747
  const input = {
@@ -52726,7 +52930,7 @@ var app = make36("scratchpad").pipe(withDescription4("Local-first GitHub issue a
52726
52930
  uploadCommand,
52727
52931
  uploadsCommand
52728
52932
  ]));
52729
- var main = withConsoleBuffer(run5(app, { version: CLI_VERSION }).pipe(provide4(layer13([cliLogger])), provide4(layer12), tapErrorTag2("ConfigError", renderError("config_error")), tapErrorTag2("ProjectError", renderError("project_error")), tapErrorTag2("DeleteUsageError", renderError("usage")), tapErrorTag2("RepairUsageError", renderError("usage")), tapErrorTag2("AuthMissingError", renderError("auth_missing")), tapErrorTag2("GithubApiError", renderError("github_error")), tapErrorTag2("RemoteDeleteError", renderError("delete_failed")), tapErrorTag2("SyncFailedError", renderErrorDiagnostic), tapErrorTag2("PlatformError", renderError("io_error")), tapErrorTag2("ArtifactCommandError", renderError("artifact_error")), tapErrorTag2("CodemapCommandError", (error) => renderError(error.reason)(error)), tapErrorTag2("NotesCommandError", (error) => renderError(error.reason)(error))));
52933
+ var main = withConsoleBuffer(run5(app, { version: CLI_VERSION }).pipe(provide4(layer13([cliLogger])), provide4(layer12), tapErrorTag2("ConfigError", renderError("config_error")), tapErrorTag2("ProjectError", renderError("project_error")), tapErrorTag2("DeleteUsageError", renderError("usage")), tapErrorTag2("RepairUsageError", renderError("usage")), tapErrorTag2("AuthMissingError", renderError("auth_missing")), tapErrorTag2("GithubApiError", renderError("github_error")), tapErrorTag2("MountError", renderError("mount_error")), tapErrorTag2("RemoteDeleteError", renderError("delete_failed")), tapErrorTag2("SyncFailedError", renderErrorDiagnostic), tapErrorTag2("PlatformError", renderError("io_error")), tapErrorTag2("ArtifactCommandError", renderError("artifact_error")), tapErrorTag2("CodemapCommandError", (error) => renderError(error.reason)(error)), tapErrorTag2("NotesCommandError", (error) => renderError(error.reason)(error))));
52730
52934
  runMain2(main, { disableErrorReporting: true });
52731
52935
  export {
52732
52936
  renderCodemapHtml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryasaatvik/scratchpad",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
5
5
  "keywords": [
6
6
  "bun",