@aryasaatvik/scratchpad 0.0.0-tegami-trusted-publish-setup → 0.2.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 +55 -0
- package/LICENSE +21 -0
- package/README.md +278 -6
- package/SECURITY.md +19 -0
- package/dist/scratchpad.js +51912 -0
- package/docs/adr/0001-markdown-projection.md +27 -0
- package/docs/adr/0002-bun-effect-sqlite.md +29 -0
- package/docs/adr/0003-github-provider-seam.md +50 -0
- package/docs/adr/0004-frontmatter-identity-conflicts.md +42 -0
- package/docs/adr/0005-closed-object-archive.md +51 -0
- package/docs/adr/0006-octokit-graphql-and-rest.md +60 -0
- package/docs/adr/0007-explicit-remote-delete.md +61 -0
- package/docs/adr/0008-cli-decision-model.md +57 -0
- package/docs/adr/README.md +13 -0
- package/docs/release.md +101 -0
- package/package.json +117 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 0001 — Markdown projection, materialized tree
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Agents and humans need a project-management surface that is easy to inspect,
|
|
8
|
+
edit, diff, and reason about. A custom UI or a database-only store is opaque to
|
|
9
|
+
agents. A kernel-facing filesystem (FUSE/NFS) adds operational risk before the
|
|
10
|
+
core contracts (provider mapping, sync, conflicts) are stable.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
Project issues and milestones into normal Markdown files with typed YAML front
|
|
15
|
+
matter. Materialize real files on disk and synchronize with explicit `pull` /
|
|
16
|
+
`push` / `sync` (and a `watch` daemon) — no FUSE/NFS/Rust mount in v1.
|
|
17
|
+
|
|
18
|
+
Front matter is the structural API boundary; the Markdown body stays
|
|
19
|
+
human-authored prose and is never parsed as a machine contract.
|
|
20
|
+
|
|
21
|
+
## Consequences
|
|
22
|
+
|
|
23
|
+
- Parse front matter with Effect Schema, not prose scraping.
|
|
24
|
+
- `init`, `pull`, `push`, `sync`, `watch`, `repair` are the core primitives.
|
|
25
|
+
- A mount maps a provider to an `issues` and a `milestones` directory.
|
|
26
|
+
- A FUSE/NFS sidecar remains possible later if materialized files prove
|
|
27
|
+
insufficient.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 0002 — Bun + Effect; SQLite as local durability
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
The tool runs locally, not in a constrained serverless environment, so it can
|
|
8
|
+
use a full runtime. Synchronization must be reliable and idempotent across
|
|
9
|
+
process restarts, which needs durable local state — but that state must not
|
|
10
|
+
become a second source of truth competing with the files and the provider.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
Build on Bun + Effect v4, using Effect primitives directly (`Context.Service`,
|
|
15
|
+
`Layer`, `Schema`, `Effect.fn`, `effect/unstable/cli`). Use SQLite — drizzle-orm
|
|
16
|
+
rc.4's native `effect-sqlite-bun` integration layered on `@effect/sql-sqlite-bun`'s
|
|
17
|
+
`SqliteClient` — for local durability only: object mappings, sync cursors, the
|
|
18
|
+
outbox, and conflict records.
|
|
19
|
+
|
|
20
|
+
## Consequences
|
|
21
|
+
|
|
22
|
+
- Services are domain nouns: `Provider`, `Database`, `ProjectionStore`,
|
|
23
|
+
`SyncEngine`, `Watcher`. `Database` is the SQLite client; `ProjectionStore`
|
|
24
|
+
owns projection/sync persistence.
|
|
25
|
+
- `Database.layer(filename)` is a factory; tests pass `":memory:"`. No project
|
|
26
|
+
helper frameworks wrap Effect control flow.
|
|
27
|
+
- The Markdown files and the provider are the system of record; SQLite is a
|
|
28
|
+
rebuildable cache/outbox.
|
|
29
|
+
- The store SQLite path lives under `$XDG_STATE_HOME`, never in the repo.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# 0003 — Provider seam and GitHub implementation boundary
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
The sync engine reconciles provider-backed project-management objects with
|
|
8
|
+
Markdown files. It needs a provider boundary that is stable enough for tests,
|
|
9
|
+
future providers, and local workflows, while keeping GitHub wire concerns out of
|
|
10
|
+
the neutral sync code.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
`packages/core` owns a neutral `Provider` service that speaks
|
|
15
|
+
`IssueDocument`/`MilestoneDocument` values. The provider seam exposes the object
|
|
16
|
+
lifecycle the sync engine needs:
|
|
17
|
+
|
|
18
|
+
- list issues and milestones
|
|
19
|
+
- create and update issues and milestones
|
|
20
|
+
- close issues and milestones for normal file-removal semantics
|
|
21
|
+
- delete issues and milestones for explicit destructive remote deletes
|
|
22
|
+
|
|
23
|
+
The repo ships two implementations:
|
|
24
|
+
|
|
25
|
+
- `Provider.layerMemory` lives in `provider.ts`. It is deterministic,
|
|
26
|
+
dependency-free beyond Effect, and used by tests and sandbox flows.
|
|
27
|
+
- `github/provider.ts` exports `layer`, imported as `GithubProvider.layer`. It
|
|
28
|
+
is separate because it depends on `GithubClient` and Octokit.
|
|
29
|
+
|
|
30
|
+
`GithubClient` is the wire edge. It decodes GitHub API responses and returns
|
|
31
|
+
domain documents; GitHub DTOs do not cross the `GithubClientShape` or
|
|
32
|
+
`ProviderService` interfaces. `github/provider.ts` shapes provider-neutral
|
|
33
|
+
documents into GitHub requests, resolves milestone slug-to-number linking, and
|
|
34
|
+
maps GitHub failures to `ProviderError`.
|
|
35
|
+
|
|
36
|
+
Repo identity comes from `scratchpad.config.ts` (`owner/name`), not from git
|
|
37
|
+
remotes. Auth resolves `GITHUB_TOKEN` / `GH_TOKEN`, then `gh auth token`.
|
|
38
|
+
Transport details are documented in
|
|
39
|
+
[0006 — GitHub transport](0006-octokit-graphql-and-rest.md).
|
|
40
|
+
|
|
41
|
+
## Consequences
|
|
42
|
+
|
|
43
|
+
- Sync, watch, repair, and delete flows depend on `Provider`, not GitHub wire
|
|
44
|
+
types.
|
|
45
|
+
- Tests can exercise full sync behavior against `Provider.layerMemory` without
|
|
46
|
+
network access or GitHub fixtures.
|
|
47
|
+
- GitHub-specific requirements, such as issue GraphQL node IDs for deletion,
|
|
48
|
+
are validated before crossing the provider boundary where possible.
|
|
49
|
+
- Adding another provider should require a new adapter that satisfies
|
|
50
|
+
`ProviderService`, not changes to sync engine semantics.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 0004 — Front matter, slug identity, deletes, conflicts
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
The projection needs a stable local identity that survives provider numbering,
|
|
8
|
+
local-first creation (before any push), and round-tripping through files,
|
|
9
|
+
SQLite, and the provider — plus clear semantics for deletes and for divergent
|
|
10
|
+
local/remote edits.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
**Identity.** Each object's local identity is a branded `Slug`, derived once from
|
|
15
|
+
the title and used as the filename stem (`<slug>.md`). The file is never renamed;
|
|
16
|
+
the provider number lives only in front matter `providerRef`. SQLite maps
|
|
17
|
+
`slug ↔ externalId`.
|
|
18
|
+
|
|
19
|
+
**Front matter.** Typed via Effect Schema. `providerRef` and `sync` are optional
|
|
20
|
+
(local-first). Datetimes are `Date` in the domain via `Schema.DateFromString` —
|
|
21
|
+
ISO only on the YAML/SQLite/provider wire. A `contentHash` (excluding the
|
|
22
|
+
tool-managed `sync` block) drives local-dirty detection, so writing sync
|
|
23
|
+
metadata never marks a file dirty.
|
|
24
|
+
|
|
25
|
+
**Deletes.** Removing a projected backlog file closes the issue / archives the
|
|
26
|
+
milestone (close-on-delete). Hard remote delete is a separate explicit command,
|
|
27
|
+
never an inference from filesystem removal. See
|
|
28
|
+
[0007 — Explicit remote delete](0007-explicit-remote-delete.md).
|
|
29
|
+
|
|
30
|
+
**Conflicts.** A conflict is local-dirty AND remote-changed since last sync. It
|
|
31
|
+
is recorded in SQLite and surfaced by `status`; `pull` does not overwrite. The
|
|
32
|
+
engine stays non-interactive (`listConflicts` / `resolveConflict`); the `repair`
|
|
33
|
+
command is interactive by default, with `--take-local` / `--take-remote`
|
|
34
|
+
(`--all` / `--file`) as a non-interactive escape hatch so `watch`/CI never hang.
|
|
35
|
+
|
|
36
|
+
## Consequences
|
|
37
|
+
|
|
38
|
+
- `parse*`/`render*` front matter codecs are pure module functions (no service).
|
|
39
|
+
- The outbox carries the rendered file as the push payload for create/update;
|
|
40
|
+
close/archive resolve the external id from the mapping instead.
|
|
41
|
+
- Stable slugs mean no rename churn on sync, at the cost of slug/title drift if a
|
|
42
|
+
title changes after creation (accepted for v1).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 0005 — Closed-object archive projection
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
The backlog mount projects open work. ADR 0004 made removing a file close the
|
|
8
|
+
remote object (close-on-delete); `pull` skips closed objects and tombstones
|
|
9
|
+
their mappings so the backlog stays open-only and a deleted-then-closed file is
|
|
10
|
+
never resurrected. But closed work still has value for a while — "what did we
|
|
11
|
+
finish recently?" — and dropping it from the tree entirely loses that.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
**Archive mount.** A mount may declare an optional, read-only `archive`
|
|
16
|
+
(`{ issues, milestones, closedWithinDays }`) with directories distinct from the
|
|
17
|
+
backlog. On `pull`, an object whose `closedAt` falls within `closedWithinDays`
|
|
18
|
+
materializes to the archive instead of merely being skipped; objects closed
|
|
19
|
+
longer ago project nowhere.
|
|
20
|
+
|
|
21
|
+
**`closedAt`.** Captured from GitHub `closed_at` into an optional front matter
|
|
22
|
+
field (`Schema.DateFromString`), so the close time is visible in the archived
|
|
23
|
+
file and drives the recency window. Open objects carry none.
|
|
24
|
+
|
|
25
|
+
**One-way and idempotent.** Archive writes are keyed by an archive object
|
|
26
|
+
mapping plus the content hash, so repeated pulls don't rewrite an unchanged
|
|
27
|
+
archive file.
|
|
28
|
+
|
|
29
|
+
**Prune is housekeeping.** Each pull scans existing archive mappings and removes
|
|
30
|
+
files whose `closedAt` has aged out of the window — independent of the
|
|
31
|
+
incremental `since` results, since an aged-out object won't reappear in them.
|
|
32
|
+
|
|
33
|
+
**Read-only.** The archive lives in its own directories, which `push` reconcile
|
|
34
|
+
and the watcher never read (they only touch `mount.issues` / `mount.milestones`).
|
|
35
|
+
Editing or deleting an archived file therefore does nothing — no update, no
|
|
36
|
+
close, no remote delete. Removing a remote object is only ever an explicit,
|
|
37
|
+
opt-in action against an active backlog mapping.
|
|
38
|
+
|
|
39
|
+
## Consequences
|
|
40
|
+
|
|
41
|
+
- Backlog = open-only; archive = recently-closed; older closures = absent. The
|
|
42
|
+
three states are disjoint and the split is structural, not policy enforced at
|
|
43
|
+
each call site.
|
|
44
|
+
- `closedAt` joins the hashed front matter, but only closed objects carry it, so
|
|
45
|
+
open-object dirty detection is unaffected.
|
|
46
|
+
- The window is wall-clock relative (`Date.now()`), so the archive contents
|
|
47
|
+
shift over time even without remote changes; the prune pass is what realizes
|
|
48
|
+
that drift on disk.
|
|
49
|
+
- Explicit remote delete layers on top without changing this lifecycle: archive
|
|
50
|
+
files remain read-only projection output, and only active backlog mappings are
|
|
51
|
+
eligible for provider deletion.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 0006 — GitHub transport: Octokit, GraphQL for issues, REST for milestones
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
The GitHub adapter needs cursor pagination, rate-limit behavior, typed response
|
|
8
|
+
decoding, and access to both issue and milestone APIs. GitHub does not expose one
|
|
9
|
+
complete API surface for all of those operations:
|
|
10
|
+
|
|
11
|
+
- Issues can be listed and deleted through GraphQL. The GraphQL `issues`
|
|
12
|
+
connection supports cursor pagination, `since`, and excludes pull requests.
|
|
13
|
+
- Issue create/update payloads are simpler through REST because labels,
|
|
14
|
+
assignees, and milestones can be addressed with the names/numbers Scratchpad
|
|
15
|
+
already stores.
|
|
16
|
+
- Milestones have no GraphQL mutations. Create, update, close, and delete
|
|
17
|
+
milestone operations must use REST.
|
|
18
|
+
|
|
19
|
+
## Decision
|
|
20
|
+
|
|
21
|
+
Use the `octokit` package for GitHub transport. Keep GraphQL and REST where each
|
|
22
|
+
surface is strongest:
|
|
23
|
+
|
|
24
|
+
- `listIssues` uses `octokit.graphql()` with cursor pagination, `filterBy:
|
|
25
|
+
{ since }`, and `orderBy: { field: UPDATED_AT, direction: ASC }`.
|
|
26
|
+
- `deleteIssue` uses the GraphQL `deleteIssue` mutation and therefore requires
|
|
27
|
+
the issue's GraphQL node id.
|
|
28
|
+
- `createIssue`, `updateIssue`, and `closeIssue` use
|
|
29
|
+
`octokit.rest.issues.*`.
|
|
30
|
+
- All milestone operations use REST, including hard delete via
|
|
31
|
+
`octokit.rest.issues.deleteMilestone`.
|
|
32
|
+
- `listMilestones` uses REST pagination over all milestones.
|
|
33
|
+
|
|
34
|
+
`github/client.ts` owns GitHub wire schemas and mappers:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
GithubClient
|
|
38
|
+
-> RemoteIssue / RemoteIssueNode / RemoteMilestone schemas
|
|
39
|
+
-> decode GitHub responses
|
|
40
|
+
-> return IssueDocument / MilestoneDocument
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
GraphQL and REST keep their honest wire shapes. `RemoteIssueNode` models the
|
|
44
|
+
GraphQL issue node; `RemoteIssue` and `RemoteMilestone` model REST responses.
|
|
45
|
+
Each method decodes at the wire edge and maps directly to the domain document,
|
|
46
|
+
so callers past `GithubClientShape` never handle raw GitHub JSON.
|
|
47
|
+
|
|
48
|
+
## Consequences
|
|
49
|
+
|
|
50
|
+
- `Provider` and `SyncEngine` stay transport-independent.
|
|
51
|
+
- GitHub issue deletion depends on stored `providerRef.nodeId`; explicit remote
|
|
52
|
+
delete validates that before calling the provider.
|
|
53
|
+
- GitHub milestone delete depends on the milestone number (`externalId`).
|
|
54
|
+
- Octokit's bundled retry/throttling support handles retryable REST behavior
|
|
55
|
+
before errors reach Scratchpad. `GithubApiError` and `RateLimitError` are the
|
|
56
|
+
adapter's last-resort classification of exhausted REST errors and GraphQL
|
|
57
|
+
response errors.
|
|
58
|
+
- The GitHub adapter has one wire boundary file (`github/client.ts`), while the
|
|
59
|
+
provider seam adapter (`github/provider.ts`) stays focused on provider-neutral
|
|
60
|
+
request shaping and error mapping.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 0007 — Explicit remote delete
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Scratchpad's normal filesystem semantics are intentionally conservative:
|
|
8
|
+
removing a tracked backlog file closes the issue or archives the milestone. That
|
|
9
|
+
keeps ordinary editor/file-manager actions reversible through provider history
|
|
10
|
+
and avoids treating accidental local deletion as provider-side destruction.
|
|
11
|
+
|
|
12
|
+
There are still valid cases where a user wants to remove the provider object
|
|
13
|
+
itself: duplicate issues, mistakenly-created milestones, or cleanup of test
|
|
14
|
+
objects. That operation needs to be intentional, auditable, and separate from
|
|
15
|
+
watcher/push reconciliation.
|
|
16
|
+
|
|
17
|
+
## Decision
|
|
18
|
+
|
|
19
|
+
Hard remote deletion is exposed only through:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
scratchpad delete --file <path> --remote
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The command is scoped to active backlog files. It rejects archive files, files
|
|
26
|
+
outside configured mounts, local-only files, already-closed/archive mappings,
|
|
27
|
+
objects with pending outbox work, and objects with open conflicts. Live deletes
|
|
28
|
+
require `--yes` or an interactive TTY confirmation. `--dry-run` reports the
|
|
29
|
+
planned `delete` action without touching GitHub, the file, or the local store.
|
|
30
|
+
|
|
31
|
+
The sync engine owns the operation:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
CLI delete command
|
|
35
|
+
-> SyncEngine.deleteRemote(filePath, { dryRun })
|
|
36
|
+
-> locate active mount + kind + slug
|
|
37
|
+
-> validate mapping and sync state
|
|
38
|
+
-> Provider.deleteIssue(ref) or Provider.deleteMilestone(ref)
|
|
39
|
+
-> tombstone mapping, remove local file, delete mapping
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Provider delete methods take a `ProviderRef`, not only an external id. GitHub
|
|
43
|
+
issue deletion requires the GraphQL node id; GitHub milestone deletion uses the
|
|
44
|
+
milestone number (`externalId`).
|
|
45
|
+
|
|
46
|
+
After the provider delete succeeds, the engine tombstones the mapping before
|
|
47
|
+
removing the local file and deleting the mapping row. That ordering prevents a
|
|
48
|
+
failed final cleanup write from leaving an active mapping that later `push` /
|
|
49
|
+
`sync` would interpret as a missing-file close/archive operation against an
|
|
50
|
+
already-deleted remote.
|
|
51
|
+
|
|
52
|
+
## Consequences
|
|
53
|
+
|
|
54
|
+
- Filesystem deletion and provider deletion remain distinct user intents.
|
|
55
|
+
- Existing close/archive-on-delete behavior is unchanged.
|
|
56
|
+
- Destructive remote deletion is guarded by sync-state preflight checks and a
|
|
57
|
+
CLI confirmation boundary.
|
|
58
|
+
- GitHub issue mappings without `nodeId` cannot be explicitly deleted until a
|
|
59
|
+
pull refresh records the node id.
|
|
60
|
+
- The operation is represented in `SyncReport` as `op: "delete"`, so human and
|
|
61
|
+
JSON output share the same reporting shape as pull/push/sync plans.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 0008 — The CLI classifies notes with an optional decision model
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Agents write instruction feedback and working notes into Scratchpad, then someone has to sort
|
|
8
|
+
them: which instruction layer a correction belongs to (this project, the global rules, or a tool),
|
|
9
|
+
what kind of friction it records, and whether a note is research, a plan, or a handoff. Agents did
|
|
10
|
+
this by hand from prose guidance, inconsistently, and every session re-derived the same judgment.
|
|
11
|
+
|
|
12
|
+
The codemap work recorded the opposite rule: the CLI does not invoke or configure a model, and all
|
|
13
|
+
judgment stays with the calling agent. That kept the CLI deterministic and offline. Classification
|
|
14
|
+
is the exception worth making: it is a bounded, schema-shaped decision over short text. An Effect
|
|
15
|
+
`DecisionModel` answers it with typed choices and calibrated confidence rather than free text, and
|
|
16
|
+
it runs cheaply enough to use on every write.
|
|
17
|
+
|
|
18
|
+
## Decision
|
|
19
|
+
|
|
20
|
+
The CLI owns a `Classifier` service over Effect's `DecisionModel`:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
feedback new / route / feedback review
|
|
24
|
+
-> redact(text) # tokens, keys, private keys, emails never leave the process
|
|
25
|
+
-> Classifier.classifyFeedback # Decision.make: scope, kind, actionable
|
|
26
|
+
-> confidence >= 0.7 ? classified : review bucket
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **Optional and off by default without a key.** The model comes from `SCRATCHPAD_CLASSIFIER`, then
|
|
30
|
+
`classifier.model` in `scratchpad.config.ts`, then a pinned default (`jev-1.13.0`, TypeSafe's Jev
|
|
31
|
+
over the direct TypeSafe API with `TYPESAFE_API_KEY`). `none` or a missing key selects
|
|
32
|
+
`Classifier.none`, and every command still works.
|
|
33
|
+
- **A write never depends on the classifier.** Files are written first. Classification then
|
|
34
|
+
annotates the frontmatter. A timeout, provider error, or low confidence yields a warning or the
|
|
35
|
+
review bucket, never a failed command.
|
|
36
|
+
- **Pinned model.** The default names an exact model version, and every classification records the
|
|
37
|
+
version that answered, so a model change is visible in the files it touched.
|
|
38
|
+
- **Deterministic tests.** Tests provide a `DecisionModel.make` layer with fixed answers; no test
|
|
39
|
+
reaches the network.
|
|
40
|
+
|
|
41
|
+
## Consequences
|
|
42
|
+
|
|
43
|
+
- The CLI now has a network dependency on one opt-in path. `doctor` reports the selected model and
|
|
44
|
+
whether it is enabled.
|
|
45
|
+
- Redaction is best-effort pattern matching, biased toward over-redacting: a quoted phrase after a
|
|
46
|
+
credential key word is removed even when it is not a secret. It covers known credential shapes and
|
|
47
|
+
email addresses, not arbitrary sensitive prose, so feedback text should not contain customer data.
|
|
48
|
+
- Adding another provider means another `Classifier` layer over `DecisionModel`; callers do not
|
|
49
|
+
change.
|
|
50
|
+
|
|
51
|
+
## Alternatives
|
|
52
|
+
|
|
53
|
+
- **Keep all classification in the agent.** Rejected: it repeats the same judgment in every
|
|
54
|
+
session and drifts between agents.
|
|
55
|
+
- **Free-text LLM calls.** Rejected: untyped output would need parsing and validation that
|
|
56
|
+
`Decision` schemas already give.
|
|
57
|
+
- **Provider registry from day one.** Deferred until a second provider has a user.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Architecture Decision Records
|
|
2
|
+
|
|
3
|
+
Durable record of the decisions behind Scratchpad. Active planning lives in
|
|
4
|
+
`.scratchpad/` (untracked); decisions promoted here are stable.
|
|
5
|
+
|
|
6
|
+
- [0001 — Markdown projection, materialized tree](0001-markdown-projection.md)
|
|
7
|
+
- [0002 — Bun + Effect; SQLite as local durability](0002-bun-effect-sqlite.md)
|
|
8
|
+
- [0003 — Provider seam and GitHub implementation boundary](0003-github-provider-seam.md)
|
|
9
|
+
- [0004 — Front matter, slug identity, deletes, conflicts](0004-frontmatter-identity-conflicts.md)
|
|
10
|
+
- [0005 — Closed-object archive projection](0005-closed-object-archive.md)
|
|
11
|
+
- [0006 — GitHub transport: Octokit, GraphQL for issues, REST for milestones](0006-octokit-graphql-and-rest.md)
|
|
12
|
+
- [0007 — Explicit remote delete](0007-explicit-remote-delete.md)
|
|
13
|
+
- [0008 — The CLI classifies notes with an optional decision model](0008-cli-decision-model.md)
|
package/docs/release.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Release
|
|
2
|
+
|
|
3
|
+
Scratchpad 0.1.0 is prepared as a public GitHub repository and a Bun-first npm
|
|
4
|
+
package named `@aryasaatvik/scratchpad`.
|
|
5
|
+
|
|
6
|
+
## Preflight and dry-run
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
bun install
|
|
10
|
+
bun run dev:prepare
|
|
11
|
+
bun run check
|
|
12
|
+
bun run release:dry-run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package build emits `dist/scratchpad.js`. SQLite migrations are embedded in
|
|
16
|
+
the bundle as text (no `dist/migrations/` copy), so the CLI carries its own
|
|
17
|
+
schema. The published npm CLI expects Bun on `PATH`.
|
|
18
|
+
|
|
19
|
+
## Compiled Binaries
|
|
20
|
+
|
|
21
|
+
Standalone, Bun-free executables are built with `bun build --compile` per platform. Release archives
|
|
22
|
+
use fixed tar metadata and Bun-native gzip, so the same inputs produce the same bytes:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
bun run build:artifacts # all targets → dist/release/*.tar.gz + SHA256SUMS
|
|
26
|
+
bun run build:artifacts linux-x64 # a subset by label
|
|
27
|
+
bun run release:smoke # host target only: compile + `--help` + hermetic `init`
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Targets: `darwin-arm64`, `darwin-x64`, `linux-x64` (baseline), `linux-arm64`.
|
|
31
|
+
Each `dist/release/scratchpad-v<version>-<label>.tar.gz` contains the executable and a `README.txt`;
|
|
32
|
+
`SHA256SUMS` covers all four archives and `install.sh`. The build smoke-tests the host-matching
|
|
33
|
+
binary. The compiled binaries and npm `dist/scratchpad.js` remain independent supported outputs.
|
|
34
|
+
|
|
35
|
+
## GitHub Metadata
|
|
36
|
+
|
|
37
|
+
Recommended repository description:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
Local-first GitHub issue and milestone tracking through Markdown files.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Recommended topics:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
github, issues, milestones, markdown, cli, bun, effect-ts, sqlite, local-first, developer-tools, project-management
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Tegami release flow
|
|
50
|
+
|
|
51
|
+
Tegami owns changelog previews, the version-package PR, npm publishing, the `v<version>` tag, and
|
|
52
|
+
GitHub Release creation. Releases run in GitHub Actions and publish to npm through OIDC trusted
|
|
53
|
+
publishing, so no npm token is stored anywhere. `publish.yml` is the only workflow: PRs are gated
|
|
54
|
+
locally with `bun run check`, and Greptile and Socket review them.
|
|
55
|
+
|
|
56
|
+
- **Pull requests.** Add a changelog entry under `.tegami/` with `bun run tegami` for user-facing
|
|
57
|
+
changes; `GITHUB_TOKEN=$(gh auth token) bun run tegami pr preview --number <pr>` shows the release it
|
|
58
|
+
produces.
|
|
59
|
+
- **Push to `main`.** `publish.yml` runs `bun run tegami ci`. With pending `.tegami/` entries it
|
|
60
|
+
opens or updates the `tegami/version-packages` PR. When that PR merges, the same workflow runs the
|
|
61
|
+
release gate (`bun run check`), builds and verifies the four standalone archives, publishes to
|
|
62
|
+
npm, pushes the `v<version>` tag, creates the GitHub Release, and attaches the archives,
|
|
63
|
+
`install.sh`, and `SHA256SUMS`.
|
|
64
|
+
|
|
65
|
+
Opening the version PR needs the repository setting that lets GitHub Actions create pull requests
|
|
66
|
+
(Settings → Actions → General → Workflow permissions).
|
|
67
|
+
|
|
68
|
+
Trusted publishing is configured on an existing npm package, so a package's first release needs one
|
|
69
|
+
local step. On the version PR branch, with `npm login` done:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
bun run tegami npm pretrust --dry-run
|
|
73
|
+
bun run tegami npm pretrust
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`pretrust` publishes an empty `0.0.0-tegami-trusted-publish-setup` placeholder under the `temp`
|
|
77
|
+
dist-tag and registers `publish.yml` as the package's trusted publisher. Merging the version PR then
|
|
78
|
+
publishes the real version from CI.
|
|
79
|
+
|
|
80
|
+
npm generates provenance attestations only for public repositories; while this repository is
|
|
81
|
+
private, trusted publishing still works but releases carry no provenance.
|
|
82
|
+
|
|
83
|
+
## Public Repository
|
|
84
|
+
|
|
85
|
+
Run only when ready to expose the repository and its history:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
gh repo edit aryasaatvik/scratchpad \
|
|
89
|
+
--visibility public \
|
|
90
|
+
--accept-visibility-change-consequences
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Installer
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
curl -fsSL https://github.com/aryasaatvik/scratchpad/releases/latest/download/install.sh | sh
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Set `SCRATCHPAD_VERSION` to install a specific release and `SCRATCHPAD_INSTALL_DIR` to override
|
|
100
|
+
`~/.local/bin`. The installer downloads `SHA256SUMS` first and verifies the platform archive before
|
|
101
|
+
extracting it.
|
package/package.json
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryasaatvik/scratchpad",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"bun",
|
|
7
|
+
"cli",
|
|
8
|
+
"developer-tools",
|
|
9
|
+
"effect",
|
|
10
|
+
"effect-ts",
|
|
11
|
+
"github",
|
|
12
|
+
"issues",
|
|
13
|
+
"local-first",
|
|
14
|
+
"markdown",
|
|
15
|
+
"milestones",
|
|
16
|
+
"project-management",
|
|
17
|
+
"sqlite"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/aryasaatvik/scratchpad#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/aryasaatvik/scratchpad/issues"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Saatvik Arya",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/aryasaatvik/scratchpad.git"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"scratchpad": "./dist/scratchpad.js"
|
|
31
|
+
},
|
|
32
|
+
"workspaces": [
|
|
33
|
+
"apps/*",
|
|
34
|
+
"packages/*",
|
|
35
|
+
"examples/*"
|
|
36
|
+
],
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/scratchpad.js",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE",
|
|
41
|
+
"CHANGELOG.md",
|
|
42
|
+
"SECURITY.md",
|
|
43
|
+
"docs/adr",
|
|
44
|
+
"docs/release.md"
|
|
45
|
+
],
|
|
46
|
+
"type": "module",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "bun run scripts/build-package.ts",
|
|
52
|
+
"build:codemap-viewer": "bun run scripts/build-codemap-viewer.ts",
|
|
53
|
+
"build:artifacts": "bun run scripts/build-release-artifacts.ts",
|
|
54
|
+
"dev:prepare": "effect-language-service patch && effect-tsgo patch",
|
|
55
|
+
"prepack": "bun run build",
|
|
56
|
+
"package:smoke": "bun run build && bun pm pack --dry-run",
|
|
57
|
+
"release:smoke": "bun run scripts/build-release-artifacts.ts --host-only",
|
|
58
|
+
"tegami": "bun scripts/tegami.mts",
|
|
59
|
+
"release:dry-run": "bun run scripts/release-dry-run.ts",
|
|
60
|
+
"version:packages": "bun run tegami version",
|
|
61
|
+
"release": "bun run tegami publish",
|
|
62
|
+
"check": "bun run format:check && bun run lint && bun run typecheck && bun run test",
|
|
63
|
+
"format": "oxfmt",
|
|
64
|
+
"format:check": "oxfmt --check",
|
|
65
|
+
"lint": "oxlint .",
|
|
66
|
+
"lint:fix": "oxlint --fix .",
|
|
67
|
+
"test": "bun --bun run vitest run",
|
|
68
|
+
"test:unit": "bun --bun run vitest run packages/core/src packages/cli/src apps/worker/src",
|
|
69
|
+
"test:watch": "bun --bun run vitest",
|
|
70
|
+
"typecheck": "tsgo --noEmit",
|
|
71
|
+
"cli": "bun run packages/cli/src/main.ts",
|
|
72
|
+
"worker:dev": "bun run --cwd apps/worker dev",
|
|
73
|
+
"worker:dev:html": "bun run --cwd apps/worker dev:html",
|
|
74
|
+
"worker:build": "bun run --cwd apps/worker build",
|
|
75
|
+
"worker:types": "bun run --cwd apps/worker types",
|
|
76
|
+
"deploy": "bun run --cwd apps/worker deploy",
|
|
77
|
+
"deploy:dry-run": "bun run --cwd apps/worker deploy:dry-run",
|
|
78
|
+
"test:integration": "bun run scripts/test-integration.ts",
|
|
79
|
+
"test:worker-integration": "bun run scripts/test-worker-integration.ts"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@effect/language-service": "^0.86.2",
|
|
83
|
+
"@effect/tsgo": "^0.13.2",
|
|
84
|
+
"@tsconfig/bun": "1.0.10",
|
|
85
|
+
"@types/bun": "^1.3.14",
|
|
86
|
+
"@types/node": "^25.9.1",
|
|
87
|
+
"@typescript/native-preview": "7.0.0-dev.20260604.1",
|
|
88
|
+
"oxfmt": "^0.56.0",
|
|
89
|
+
"oxlint": "^1.71.0",
|
|
90
|
+
"playwright-core": "^1.55.0",
|
|
91
|
+
"tegami": "^1.1.2",
|
|
92
|
+
"typescript": "^6.0.3",
|
|
93
|
+
"vitest": "^5.0.2"
|
|
94
|
+
},
|
|
95
|
+
"engines": {
|
|
96
|
+
"bun": ">=1.3.2"
|
|
97
|
+
},
|
|
98
|
+
"packageManager": "bun@1.4.2",
|
|
99
|
+
"catalog": {
|
|
100
|
+
"@tsconfig/bun": "1.0.10",
|
|
101
|
+
"@types/bun": "^1.3.14",
|
|
102
|
+
"@types/node": "^25.9.1",
|
|
103
|
+
"@typescript/native-preview": "7.0.0-dev.20260604.1",
|
|
104
|
+
"drizzle-orm": "1.0.0-rc.4",
|
|
105
|
+
"typescript": "^6.0.3",
|
|
106
|
+
"vitest": "^5.0.2"
|
|
107
|
+
},
|
|
108
|
+
"catalogs": {
|
|
109
|
+
"effect": {
|
|
110
|
+
"@effect/ai-typesafe": "4.0.0-rc.117",
|
|
111
|
+
"@effect/platform-bun": "4.0.0-rc.117",
|
|
112
|
+
"@effect/sql-sqlite-bun": "4.0.0-rc.117",
|
|
113
|
+
"effect": "4.0.0-rc.117",
|
|
114
|
+
"@effect/vitest": "4.0.0-rc.117"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"patchedDependencies": {
|
|
118
|
+
"beautiful-mermaid@1.1.3": "patches/beautiful-mermaid@1.1.3.patch"
|
|
119
|
+
}
|
|
5
120
|
}
|