@aryasaatvik/scratchpad 0.4.0 → 0.5.0
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 +13 -0
- package/dist/scratchpad.js +155 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## @aryasaatvik/scratchpad@0.5.0
|
|
2
|
+
|
|
3
|
+
### Understand sync previews and mount failures
|
|
4
|
+
|
|
5
|
+
Dry-run actions now explain why they are planned, including new mappings, changed hashes, queued
|
|
6
|
+
work, missing files, remote changes, and remote closures. Changed hashes show an eight-character stored/current
|
|
7
|
+
comparison, also available in JSON output.
|
|
8
|
+
|
|
9
|
+
Sync commands now print an actionable error when a stored mount cannot be matched to your
|
|
10
|
+
configuration, with a `mount_error` JSON envelope under `--json`. A missing mount directory with
|
|
11
|
+
stored mappings stops sync before it can mistake directory loss for requests to close issues or
|
|
12
|
+
archive milestones. Restore the directory or use `scratchpad repair` to inspect the state.
|
|
13
|
+
|
|
1
14
|
## @aryasaatvik/scratchpad@0.4.0
|
|
2
15
|
|
|
3
16
|
### Clearer archive and upload failures
|
package/dist/scratchpad.js
CHANGED
|
@@ -43581,6 +43581,7 @@ var conflicts = sqliteTable("conflicts", {
|
|
|
43581
43581
|
// packages/core/src/store/projection-store.ts
|
|
43582
43582
|
class ProjectionStoreError extends TaggedError3()("ProjectionStoreError", {
|
|
43583
43583
|
message: String4,
|
|
43584
|
+
reason: optional2(Literal2("mount_alias")),
|
|
43584
43585
|
cause: optional2(Defect())
|
|
43585
43586
|
}) {
|
|
43586
43587
|
}
|
|
@@ -43606,6 +43607,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
|
|
|
43606
43607
|
for (const { from, to } of aliases) {
|
|
43607
43608
|
if (from.length === 0 || to.length === 0 || from === to || targets.has(from)) {
|
|
43608
43609
|
return yield* new ProjectionStoreError({
|
|
43610
|
+
reason: "mount_alias",
|
|
43609
43611
|
message: `Invalid mount alias ${from} -> ${to}`
|
|
43610
43612
|
});
|
|
43611
43613
|
}
|
|
@@ -43614,6 +43616,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
|
|
|
43614
43616
|
for (const [from, to] of targets) {
|
|
43615
43617
|
if (targets.has(to)) {
|
|
43616
43618
|
return yield* new ProjectionStoreError({
|
|
43619
|
+
reason: "mount_alias",
|
|
43617
43620
|
message: `Chained mount alias ${from} -> ${to}`
|
|
43618
43621
|
});
|
|
43619
43622
|
}
|
|
@@ -43632,6 +43635,7 @@ class ProjectionStore extends Service()("@scratchpad/ProjectionStore") {
|
|
|
43632
43635
|
return JSON.stringify(leftFields) === JSON.stringify(rightFields);
|
|
43633
43636
|
};
|
|
43634
43637
|
const collision = (table, objectKey) => new ProjectionStoreError({
|
|
43638
|
+
reason: "mount_alias",
|
|
43635
43639
|
message: `Cannot adopt mount aliases: conflicting ${table} rows for ${objectKey}`
|
|
43636
43640
|
});
|
|
43637
43641
|
const mappingGroups = Map.groupBy(mappings, key);
|
|
@@ -43822,6 +43826,11 @@ var localizeDependencies = (body, slugForExternalId, fromSlug = "") => rewriteSe
|
|
|
43822
43826
|
// packages/core/src/sync/mounts.ts
|
|
43823
43827
|
import { realpathSync } from "fs";
|
|
43824
43828
|
import { basename as basename2, dirname as dirname2, join as join6, resolve as resolve5 } from "path";
|
|
43829
|
+
class MountError extends TaggedError3()("MountError", {
|
|
43830
|
+
message: String4,
|
|
43831
|
+
cause: optional2(Defect())
|
|
43832
|
+
}) {
|
|
43833
|
+
}
|
|
43825
43834
|
function physicalMountPath(directory) {
|
|
43826
43835
|
let ancestor = resolve5(directory);
|
|
43827
43836
|
const remaining = [];
|
|
@@ -43858,7 +43867,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43858
43867
|
const fs = yield* FileSystem;
|
|
43859
43868
|
const config = yield* try_3({
|
|
43860
43869
|
try: () => physicalMountConfig(input),
|
|
43861
|
-
catch: (cause) => new
|
|
43870
|
+
catch: (cause) => new MountError({ message: "Could not resolve physical mounts", cause })
|
|
43862
43871
|
});
|
|
43863
43872
|
const targets = config.mounts.flatMap((mount) => [
|
|
43864
43873
|
{ kind: "issue", mount: mount.issues, archive: false },
|
|
@@ -43875,7 +43884,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43875
43884
|
continue;
|
|
43876
43885
|
const physical = yield* try_3({
|
|
43877
43886
|
try: () => physicalMountPath(from),
|
|
43878
|
-
catch: (cause) => new
|
|
43887
|
+
catch: (cause) => new MountError({ message: `Could not resolve mount alias: ${from}`, cause })
|
|
43879
43888
|
});
|
|
43880
43889
|
if (configured.has(physical)) {
|
|
43881
43890
|
aliases.push({ from, to: physical });
|
|
@@ -43889,8 +43898,8 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43889
43898
|
if (yield* fs.exists(from)) {
|
|
43890
43899
|
if (archived)
|
|
43891
43900
|
continue;
|
|
43892
|
-
return yield* new
|
|
43893
|
-
message: `Stored mount ${from} resolves outside configured physical mounts; retained sync state unchanged.`
|
|
43901
|
+
return yield* new MountError({
|
|
43902
|
+
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
43903
|
});
|
|
43895
43904
|
}
|
|
43896
43905
|
let candidates = new Set(configured);
|
|
@@ -43904,7 +43913,7 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43904
43913
|
const file = join6(target.mount, `${mapping.slug}.md`);
|
|
43905
43914
|
if (!(yield* fs.exists(file)))
|
|
43906
43915
|
continue;
|
|
43907
|
-
const text = yield* fs.readFileString(file).pipe(mapError2((cause) => new
|
|
43916
|
+
const text = yield* fs.readFileString(file).pipe(mapError2((cause) => new MountError({
|
|
43908
43917
|
message: `Could not inspect mount identity: ${file}`,
|
|
43909
43918
|
cause
|
|
43910
43919
|
})));
|
|
@@ -43920,13 +43929,16 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43920
43929
|
if (archived && candidates.size === 0)
|
|
43921
43930
|
continue;
|
|
43922
43931
|
if (candidates.size !== 1) {
|
|
43923
|
-
return yield* new
|
|
43932
|
+
return yield* new MountError({
|
|
43924
43933
|
message: `Cannot prove mount alias ${from}; retained sync state unchanged. Restore its mount or resolve the alias before syncing.`
|
|
43925
43934
|
});
|
|
43926
43935
|
}
|
|
43927
43936
|
aliases.push({ from, to: [...candidates][0] });
|
|
43928
43937
|
}
|
|
43929
|
-
const projection = yield* store.adoptMountAliases(aliases, dryRun)
|
|
43938
|
+
const projection = yield* store.adoptMountAliases(aliases, dryRun).pipe(mapError2((cause) => cause.reason === "mount_alias" ? new MountError({
|
|
43939
|
+
message: `${cause.message}. Retained sync state unchanged. Restore the original mount configuration and reconcile the conflicting records before syncing.`,
|
|
43940
|
+
cause
|
|
43941
|
+
}) : cause));
|
|
43930
43942
|
const writableMounts = targets.filter((target) => !target.archive).map((target) => target.mount);
|
|
43931
43943
|
const writable = new Set(writableMounts);
|
|
43932
43944
|
const activeState = (row) => writable.has(row.mount);
|
|
@@ -43956,6 +43968,31 @@ var prepareMounts = fn2("Sync.prepareMounts")(function* (input, store, dryRun) {
|
|
|
43956
43968
|
};
|
|
43957
43969
|
return { config, store: scopeWrites(view) };
|
|
43958
43970
|
});
|
|
43971
|
+
var validateMountDirectories = fn2("Sync.validateMountDirectories")(function* (config, store) {
|
|
43972
|
+
const fs = yield* FileSystem;
|
|
43973
|
+
for (const mount of config.mounts) {
|
|
43974
|
+
for (const [kind, directory] of [
|
|
43975
|
+
["issue", mount.issues],
|
|
43976
|
+
["milestone", mount.milestones]
|
|
43977
|
+
]) {
|
|
43978
|
+
const info = yield* fs.stat(directory).pipe(catch_2((cause) => cause.reason._tag === "NotFound" ? succeed6(undefined) : fail6(new MountError({
|
|
43979
|
+
message: `Cannot inspect mount directory ${directory}. Restore access before syncing.`,
|
|
43980
|
+
cause
|
|
43981
|
+
}))));
|
|
43982
|
+
if (info?.type === "Directory")
|
|
43983
|
+
continue;
|
|
43984
|
+
if (info !== undefined)
|
|
43985
|
+
return yield* new MountError({
|
|
43986
|
+
message: `Mount path ${directory} is not a directory. Restore the directory before syncing; refusing to plan closes or archives.`
|
|
43987
|
+
});
|
|
43988
|
+
const mappings = yield* store.listMappings(kind, directory);
|
|
43989
|
+
if (mappings.length > 0)
|
|
43990
|
+
return yield* new MountError({
|
|
43991
|
+
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.`
|
|
43992
|
+
});
|
|
43993
|
+
}
|
|
43994
|
+
}
|
|
43995
|
+
});
|
|
43959
43996
|
|
|
43960
43997
|
// packages/core/src/sync/engine.ts
|
|
43961
43998
|
class RemoteDeleteError extends TaggedError3()("RemoteDeleteError", {
|
|
@@ -43980,7 +44017,21 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
43980
44017
|
...slugValue === undefined ? {} : { issueSlug: slugValue }
|
|
43981
44018
|
});
|
|
43982
44019
|
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))),
|
|
44020
|
+
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* () {
|
|
44021
|
+
if (cause.reason._tag === "NotFound" && !(yield* fs.exists(dir))) {
|
|
44022
|
+
const mount = path.resolve(dir);
|
|
44023
|
+
const mappings = [
|
|
44024
|
+
...yield* store.listMappings("issue", mount),
|
|
44025
|
+
...yield* store.listMappings("milestone", mount)
|
|
44026
|
+
];
|
|
44027
|
+
if (mappings.length === 0)
|
|
44028
|
+
return [];
|
|
44029
|
+
}
|
|
44030
|
+
return yield* new MountError({
|
|
44031
|
+
message: `Cannot scan mount directory ${dir}. Restore the directory and read access before syncing; refusing to plan closes or archives.`,
|
|
44032
|
+
cause
|
|
44033
|
+
});
|
|
44034
|
+
})));
|
|
43984
44035
|
const fileStatus = (frontmatter) => {
|
|
43985
44036
|
if (frontmatter.status !== undefined && classifyStatus(frontmatter.status, frontmatterOptions.closedStatuses) === frontmatter.state) {
|
|
43986
44037
|
return frontmatter.status;
|
|
@@ -44213,7 +44264,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44213
44264
|
if (!opts.dryRun)
|
|
44214
44265
|
yield* store.deleteObjectMapping(opts.kind, mountKey, duplicate.slug);
|
|
44215
44266
|
if (duplicate.syncStatus !== "closed") {
|
|
44216
|
-
actions.push({
|
|
44267
|
+
actions.push({
|
|
44268
|
+
kind: opts.kind,
|
|
44269
|
+
slug: duplicate.slug,
|
|
44270
|
+
externalId,
|
|
44271
|
+
op: "retire",
|
|
44272
|
+
reason: "local-missing"
|
|
44273
|
+
});
|
|
44217
44274
|
}
|
|
44218
44275
|
});
|
|
44219
44276
|
let maxUpdated = since;
|
|
@@ -44245,7 +44302,8 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44245
44302
|
kind: opts.kind,
|
|
44246
44303
|
slug: priorMapping.slug,
|
|
44247
44304
|
externalId,
|
|
44248
|
-
op: "retire"
|
|
44305
|
+
op: "retire",
|
|
44306
|
+
reason: "remote-closed"
|
|
44249
44307
|
});
|
|
44250
44308
|
}
|
|
44251
44309
|
}
|
|
@@ -44274,7 +44332,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44274
44332
|
syncStatus: "archived"
|
|
44275
44333
|
});
|
|
44276
44334
|
}
|
|
44277
|
-
actions.push({
|
|
44335
|
+
actions.push({
|
|
44336
|
+
kind: opts.kind,
|
|
44337
|
+
slug: archiveSlug,
|
|
44338
|
+
externalId,
|
|
44339
|
+
op: "write",
|
|
44340
|
+
reason: "remote-changed"
|
|
44341
|
+
});
|
|
44278
44342
|
}
|
|
44279
44343
|
}
|
|
44280
44344
|
const ru = remote.frontmatter.sync?.remoteUpdatedAt;
|
|
@@ -44320,11 +44384,23 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44320
44384
|
});
|
|
44321
44385
|
}
|
|
44322
44386
|
conflicted = true;
|
|
44323
|
-
actions.push({
|
|
44387
|
+
actions.push({
|
|
44388
|
+
kind: opts.kind,
|
|
44389
|
+
slug: slugValue,
|
|
44390
|
+
externalId,
|
|
44391
|
+
op: "conflict",
|
|
44392
|
+
reason: "conflict"
|
|
44393
|
+
});
|
|
44324
44394
|
} else if (remoteChanged) {
|
|
44325
44395
|
if (!opts.dryRun)
|
|
44326
44396
|
yield* writeDoc(absPath, renderRemote(remote, current, slugValue));
|
|
44327
|
-
actions.push({
|
|
44397
|
+
actions.push({
|
|
44398
|
+
kind: opts.kind,
|
|
44399
|
+
slug: slugValue,
|
|
44400
|
+
externalId,
|
|
44401
|
+
op: "write",
|
|
44402
|
+
reason: "remote-changed"
|
|
44403
|
+
});
|
|
44328
44404
|
}
|
|
44329
44405
|
} else {
|
|
44330
44406
|
if (fileExists && opts.preserveLocal !== undefined) {
|
|
@@ -44332,7 +44408,13 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44332
44408
|
}
|
|
44333
44409
|
if (!opts.dryRun)
|
|
44334
44410
|
yield* writeDoc(absPath, renderRemote(remote, current, slugValue));
|
|
44335
|
-
actions.push({
|
|
44411
|
+
actions.push({
|
|
44412
|
+
kind: opts.kind,
|
|
44413
|
+
slug: slugValue,
|
|
44414
|
+
externalId,
|
|
44415
|
+
op: "write",
|
|
44416
|
+
reason: fileExists ? "remote-changed" : "new-file"
|
|
44417
|
+
});
|
|
44336
44418
|
}
|
|
44337
44419
|
if (!opts.dryRun) {
|
|
44338
44420
|
yield* store.putObjectMapping({
|
|
@@ -44379,6 +44461,7 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44379
44461
|
kind: opts.kind,
|
|
44380
44462
|
slug: mapping.slug,
|
|
44381
44463
|
op: "prune",
|
|
44464
|
+
reason: exists ? "archive-expired" : "local-missing",
|
|
44382
44465
|
...mapping.externalId === null ? {} : { externalId: mapping.externalId }
|
|
44383
44466
|
});
|
|
44384
44467
|
}
|
|
@@ -44470,6 +44553,11 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44470
44553
|
kind: opts.kind,
|
|
44471
44554
|
slug: slugValue,
|
|
44472
44555
|
op,
|
|
44556
|
+
reason: mapping === undefined ? "no-mapping" : "hash-changed",
|
|
44557
|
+
...opts.dryRun && mapping !== undefined ? {
|
|
44558
|
+
...mapping.contentHash === null ? {} : { storedHash: mapping.contentHash.slice(0, 8) },
|
|
44559
|
+
currentHash: hash.slice(0, 8)
|
|
44560
|
+
} : {},
|
|
44473
44561
|
...externalId === undefined ? {} : { externalId }
|
|
44474
44562
|
});
|
|
44475
44563
|
}
|
|
@@ -44498,7 +44586,8 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44498
44586
|
kind: opts.kind,
|
|
44499
44587
|
slug: mapping.slug,
|
|
44500
44588
|
externalId: mapping.externalId,
|
|
44501
|
-
op
|
|
44589
|
+
op,
|
|
44590
|
+
reason: "local-missing"
|
|
44502
44591
|
});
|
|
44503
44592
|
}
|
|
44504
44593
|
return actions;
|
|
@@ -44708,6 +44797,7 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44708
44797
|
kind: row.kind === "milestone" ? "milestone" : "issue",
|
|
44709
44798
|
slug: row.slug,
|
|
44710
44799
|
op: row.op,
|
|
44800
|
+
reason: "queued",
|
|
44711
44801
|
...externalId === undefined ? {} : { externalId }
|
|
44712
44802
|
};
|
|
44713
44803
|
}));
|
|
@@ -44843,15 +44933,15 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44843
44933
|
return SyncEngine.of({
|
|
44844
44934
|
pull: (opts) => {
|
|
44845
44935
|
const dryRun = opts?.dryRun ?? false;
|
|
44846
|
-
return pull(dryRun, opts?.full ?? false).pipe(map6(report(dryRun)),
|
|
44936
|
+
return pull(dryRun, opts?.full ?? false).pipe(map6(report(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
|
|
44847
44937
|
},
|
|
44848
44938
|
push: (opts) => {
|
|
44849
44939
|
const dryRun = opts?.dryRun ?? false;
|
|
44850
|
-
return push(dryRun).pipe(map6(reportWith(dryRun)),
|
|
44940
|
+
return push(dryRun).pipe(map6(reportWith(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
|
|
44851
44941
|
},
|
|
44852
44942
|
sync: (opts) => {
|
|
44853
44943
|
const dryRun = opts?.dryRun ?? false;
|
|
44854
|
-
return sync(dryRun, opts?.full ?? false).pipe(map6(reportWith(dryRun)),
|
|
44944
|
+
return sync(dryRun, opts?.full ?? false).pipe(map6(reportWith(dryRun)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)));
|
|
44855
44945
|
},
|
|
44856
44946
|
deleteRemote: (filePath, opts) => {
|
|
44857
44947
|
const dryRun = opts?.dryRun ?? false;
|
|
@@ -44867,14 +44957,14 @@ class SyncEngine extends Service()("@scratchpad/SyncEngine") {
|
|
|
44867
44957
|
const config = yield* ProjectConfig;
|
|
44868
44958
|
const fs = yield* FileSystem;
|
|
44869
44959
|
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))));
|
|
44960
|
+
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
44961
|
return SyncEngine.of({
|
|
44872
|
-
pull: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.pull(opts)),
|
|
44873
|
-
push: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.push(opts)),
|
|
44874
|
-
sync: (opts) => build(opts?.dryRun ?? false).pipe(flatMap3((engine) => engine.sync(opts)),
|
|
44962
|
+
pull: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.pull(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
|
|
44963
|
+
push: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.push(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
|
|
44964
|
+
sync: (opts) => build(opts?.dryRun ?? false, true).pipe(flatMap3((engine) => engine.sync(opts)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
|
|
44875
44965
|
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),
|
|
44877
|
-
resolveConflict: (id, resolution) => build(false).pipe(flatMap3((engine) => engine.resolveConflict(id, resolution)),
|
|
44966
|
+
listConflicts: build(true).pipe(flatMap3((engine) => engine.listConflicts), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error))),
|
|
44967
|
+
resolveConflict: (id, resolution) => build(false).pipe(flatMap3((engine) => engine.resolveConflict(id, resolution)), catch_2((error) => error instanceof MountError ? fail6(error) : die3(error)))
|
|
44878
44968
|
});
|
|
44879
44969
|
}));
|
|
44880
44970
|
}
|
|
@@ -47409,7 +47499,9 @@ function formatReport(name, report) {
|
|
|
47409
47499
|
const lines = report.actions.length === 0 ? [dim(`${prefix}: no changes`)] : [`${prefix}: ${report.actions.length} action(s)`];
|
|
47410
47500
|
for (const action of report.actions.slice(0, MAX_ACTIONS)) {
|
|
47411
47501
|
const ref = action.externalId === undefined ? "" : ` #${action.externalId}`;
|
|
47412
|
-
|
|
47502
|
+
const hashes = action.storedHash !== undefined && action.currentHash !== undefined ? `: ${action.storedHash}\u2192${action.currentHash}` : "";
|
|
47503
|
+
const reason = report.dryRun && action.reason !== undefined ? ` (${action.reason}${hashes})` : "";
|
|
47504
|
+
lines.push(` ${bold2(action.op)} ${action.kind} ${action.slug}${dim(ref)}${dim(reason)}`);
|
|
47413
47505
|
}
|
|
47414
47506
|
const remaining = report.actions.length - Math.min(report.actions.length, MAX_ACTIONS);
|
|
47415
47507
|
if (remaining > 0)
|
|
@@ -48431,7 +48523,7 @@ var bundleHtml = async (options) => {
|
|
|
48431
48523
|
// package.json
|
|
48432
48524
|
var package_default = {
|
|
48433
48525
|
name: "@aryasaatvik/scratchpad",
|
|
48434
|
-
version: "0.
|
|
48526
|
+
version: "0.5.0",
|
|
48435
48527
|
description: "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
|
|
48436
48528
|
keywords: [
|
|
48437
48529
|
"bun",
|
|
@@ -51873,6 +51965,42 @@ Treat QA sessions as research work units:
|
|
|
51873
51965
|
- move actionable findings into backlog issues before archiving the session;
|
|
51874
51966
|
- keep unacted findings in research rather than silently treating them as complete;
|
|
51875
51967
|
- link archived sessions to the resulting issues, fixes, or durable documentation.
|
|
51968
|
+
|
|
51969
|
+
## Sync previews and mount errors
|
|
51970
|
+
|
|
51971
|
+
Use \`scratchpad pull --dry-run\`, \`push --dry-run\`, or \`sync --dry-run\` to preview actions. Each
|
|
51972
|
+
action includes a short reason, for example:
|
|
51973
|
+
|
|
51974
|
+
\`\`\`text
|
|
51975
|
+
update issue foo #12 (hash-changed: a1b2c3d4\u2192e5f6a7b8)
|
|
51976
|
+
\`\`\`
|
|
51977
|
+
|
|
51978
|
+
\`no-mapping\` means the local file has no stored mapping; \`hash-changed\` means its content hash
|
|
51979
|
+
changed (which can include rendering changes); \`queued\` means the operation is already in the
|
|
51980
|
+
outbox; \`local-missing\` means a mapped file is absent. Pull also reports \`new-file\`,
|
|
51981
|
+
\`remote-changed\`, \`remote-closed\`, \`conflict\`, and \`archive-expired\` for its corresponding actions.
|
|
51982
|
+
\`--json\` includes \`reason\` and, for dry-run hash changes with a stored baseline, eight-character
|
|
51983
|
+
\`storedHash\` and \`currentHash\` fields. These hashes describe the comparison, not the cause of an
|
|
51984
|
+
edit.
|
|
51985
|
+
|
|
51986
|
+
A stored mount that cannot be matched to the configured mounts fails with an actionable \`\u2717\`
|
|
51987
|
+
diagnostic and exit 1. With \`--json\`, stdout contains a single
|
|
51988
|
+
\`{"status":"error","reason":"mount_error","message":"\u2026"}\` envelope and stderr keeps the diagnostic.
|
|
51989
|
+
A missing configured directory with stored mappings also refuses sync before planning closes or
|
|
51990
|
+
archives: restore the named directory or inspect \`scratchpad repair\`. Removing one file from an
|
|
51991
|
+
existing directory still plans its normal close or archive.
|
|
51992
|
+
|
|
51993
|
+
A \`retire\` with \`remote-closed\` means the provider reports a closed object: a real pull removes its
|
|
51994
|
+
active backlog file if present and marks its mapping closed, updating the stored remote hash and
|
|
51995
|
+
timestamp. A stale mapping can need this update even when its file is already absent. Archive
|
|
51996
|
+
projection, when configured, is separate. A \`retire\` with \`local-missing\` removes a redundant
|
|
51997
|
+
mapping whose duplicate file is absent; it does not close the remote object.
|
|
51998
|
+
|
|
51999
|
+
A mount path replaced by a file or an unreadable directory scan also stops sync; neither is
|
|
52000
|
+
interpreted as an empty mount. Restore the directory and read access before retrying. Conflicting
|
|
52001
|
+
stored rows during alias adoption produce \`mount_error\` too, while retaining the original state. For
|
|
52002
|
+
an unmatched stored mount, restore its configuration or directory first: \`scratchpad repair\`
|
|
52003
|
+
resolves content conflicts and cannot repair mount aliases.
|
|
51876
52004
|
`;
|
|
51877
52005
|
|
|
51878
52006
|
// packages/cli/skill-data/scratchpad/references/organization.md
|
|
@@ -52726,7 +52854,7 @@ var app = make36("scratchpad").pipe(withDescription4("Local-first GitHub issue a
|
|
|
52726
52854
|
uploadCommand,
|
|
52727
52855
|
uploadsCommand
|
|
52728
52856
|
]));
|
|
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))));
|
|
52857
|
+
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
52858
|
runMain2(main, { disableErrorReporting: true });
|
|
52731
52859
|
export {
|
|
52732
52860
|
renderCodemapHtml
|
package/package.json
CHANGED