@usehandout/cli 1.3.0 → 1.4.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/SKILL.md +20 -6
- package/handout.mjs +379 -100
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -86,7 +86,8 @@ Every command takes the global flags `--workspace/-w`, `--host`, `--json`, `--qu
|
|
|
86
86
|
| `versions` | `handout versions list q3-report` | list, `source`, `restore`, `prune --keep <n>`, `diff <slug> <v1> <v2>` |
|
|
87
87
|
| `invite` | `handout invite q3-report --to a@b.com` | a confirmation line |
|
|
88
88
|
| `activity` / `audit` / `acks` | `handout activity q3-report` | views, history, acknowledgments |
|
|
89
|
-
| `list` | `handout list --label
|
|
89
|
+
| `list` | `handout list --label report` | url, audience, type, title per line; `--collection <slug>` filters to one collection |
|
|
90
|
+
| `labels` | `handout labels --json` | the workspace's suggested labels with usage counts |
|
|
90
91
|
| `get` | `handout get q3-report` | a key/value block |
|
|
91
92
|
| `search` | `handout search "quarterly"` | slug, where it matched, title |
|
|
92
93
|
| `source` | `handout source q3-report --out report.md` | the source file |
|
|
@@ -110,6 +111,19 @@ Every command takes the global flags `--workspace/-w`, `--host`, `--json`, `--qu
|
|
|
110
111
|
|
|
111
112
|
`handout --version` prints the installed version. `handout <command> --help` prints that command's flags.
|
|
112
113
|
|
|
114
|
+
## Labels and collections
|
|
115
|
+
|
|
116
|
+
**The rule: a label says what kind of document it is; a collection says what it belongs to.** `plan`, `spec`, `report`, `review`, `guide`, `notes`, `proposal` and `prototype` are labels. A project, a client, a quarter or a team (`handout`, `q3`, `contoso`) is a collection. Never use a status (`draft`, `final`) as a label.
|
|
117
|
+
|
|
118
|
+
Each workspace keeps a short, editable list of suggested labels. Before you label anything:
|
|
119
|
+
|
|
120
|
+
1. Run `handout labels --json`. `suggested` is the list, each entry with the number of documents that carry it; `other` is labels in use that are not suggested.
|
|
121
|
+
2. Pick from `suggested`, one or two per document. Reuse an existing spelling instead of a variant (`Plan` vs `plan`).
|
|
122
|
+
3. If nothing on the list fits, **ask the user before inventing a label**. A free-text label is still accepted, but a guessed one becomes a permanent near-duplicate. When `suggested` is empty and `seedable` is true, the workspace already uses labels and has no list yet: do not invent one; tell the user they can adopt the suggested set on the workspace's settings page.
|
|
123
|
+
4. When two or more documents share a project, client or period, **suggest a collection** (`handout collections create` and `collections add`) instead of a label, and ask before creating it. `handout list --collection <slug>` lists what is in one, and `handout get <slug>` shows the collections a document is in. Never label a document with its collection's name.
|
|
124
|
+
|
|
125
|
+
The user's account `defaultLabels` setting is separate: it stamps labels on every publish, and you never change it unless asked.
|
|
126
|
+
|
|
113
127
|
## Publish what you just generated
|
|
114
128
|
|
|
115
129
|
1. Write the file to disk first; the CLI publishes files, not stdin. Use the extension that matches the content (`.html`, `.md`, `.pdf`) or pass `--content-type`. Word (`.docx`) is not supported: export it as PDF, or convert it to Markdown or HTML first. A document may be up to 20 MB (the account's limit can be lower; the CLI reports it).
|
|
@@ -117,7 +131,7 @@ Every command takes the global flags `--workspace/-w`, `--host`, `--json`, `--qu
|
|
|
117
131
|
3. For rich HTML, run the grep checklist in the HTML authoring section and fix every hit, or publish `--interactive` when the document genuinely needs scripts and the user accepts the audience rule.
|
|
118
132
|
4. Read the account publishing defaults as described above. Explicit audience requests override them: "just for me" is `--exposure private`; "the team" is `--exposure people --people @acme.com`; named people or a domain is `--people a@b.com --people @acme.com` (this implies `people`); "anyone with the link" is `--exposure open`; "with a password" is `--password -` (reads the password from stdin, so it stays out of the process list). Otherwise omit `--exposure` to honor the saved account default, falling back to `private` server-side. Never explicitly select `open` without a user instruction; an existing saved default is applied by the server, not rewritten as a hardcoded flag.
|
|
119
133
|
5. Give it a short, real title: the document's own `<title>` or first heading, or `--title "<short title>"` when it has none (always for a PDF). The link is made from the title plus 8 random characters (`q3-report-k7f2qx9a`), so it reads well and still can't be guessed. Anyone who sees the link sees those title words, whatever the audience, so for a sensitive document ask the user for a neutral title. Leave out `--slug` unless the user asks for a specific link; then pass a short kebab-case one (`--slug q3-report`) and tell them a link like that can be guessed by anyone who knows the workspace, which matters for "anyone with the link" and password documents.
|
|
120
|
-
6. Run `handout publish <file> [--exposure ...] [--title ...] [--label ...] --json` and read `items[0].url`, `slug`, `version` and `warnings`.
|
|
134
|
+
6. Choose labels as described in Labels and collections (`handout labels --json`, pick from `suggested`, ask before inventing one). Run `handout publish <file> [--exposure ...] [--title ...] [--label ...] --json` and read `items[0].url`, `slug`, `version` and `warnings`.
|
|
121
135
|
7. Report the URL to the user verbatim. If `warnings` is not empty, summarise each in one line and offer to fix the file and run `handout update <slug> <file>`.
|
|
122
136
|
8. If the slug came back as 12 random characters (`aB3xY9zQ1pR7`), the document had no usable title. Rename it at once, before the link is shared, since a rename breaks the old link: `handout rename <slug> <kebab-case-title>-<8 random lowercase letters and digits>`. Give later versions a title.
|
|
123
137
|
9. Remember the slug for the rest of the conversation. Later edits are `handout update <slug> <file>` (same link, new version), never a second `publish`, which mints a second link. `handout upsert <file> --slug <slug>` creates or updates in one call when you already know the slug.
|
|
@@ -130,9 +144,9 @@ For retry safety without `upsert`, generate one UUID per logical publish and pas
|
|
|
130
144
|
|
|
131
145
|
Before writing a document from scratch, before answering "where is the ...", and before any command that takes a slug the user did not give verbatim:
|
|
132
146
|
|
|
133
|
-
1. Run `handout search "<two or more words from the request>" --json`. Use `handout list --json` (optionally `--label`) for browse-shaped requests, and `handout library --json` or `handout shared --json` when the user is a reader rather than the publisher.
|
|
147
|
+
1. Run `handout search "<two or more words from the request>" --json`. Use `handout list --json` (optionally `--label` for a kind of document or `--collection` for a project) for browse-shaped requests, and `handout library --json` or `handout shared --json` when the user is a reader rather than the publisher.
|
|
134
148
|
2. Exactly one match: confirm the slug and title with the user in one line, then proceed. Several: present `slug - title (updated)` candidates and ask; never pick the first row silently. None: say so and offer to publish anew (or `collections create` for a collection).
|
|
135
|
-
3. Resolve labels
|
|
149
|
+
3. Resolve labels from `handout labels --json`, not by guessing: reuse the suggested spelling when the requested label is only a case or hyphenation variant (`Report` vs `report`), and when the request names a topic or project (`finance`, `Q3`) treat it as a collection, not a label. If no suggested label fits, ask the user before creating one.
|
|
136
150
|
4. Resolve a collection by `handout collections list --json` and fuzzy-matching the user's words against `name`; confirm before `collections add` or `--collection`.
|
|
137
151
|
5. If the user pasted a Handout link, pass it as the `<ref>` directly; the CLI accepts links and `<handle>/<slug>`.
|
|
138
152
|
6. Ambiguity is always the user's call. A guessed slug is a `404`, and a guessed label is a permanent near-duplicate.
|
|
@@ -149,7 +163,7 @@ Before writing a document from scratch, before answering "where is the ...", and
|
|
|
149
163
|
- `--people` takes email addresses and whole domains (`@contoso.example`), repeatable or comma-separated, at most 200 entries; it implies `--exposure people`. `--invite <email>` (at most 25) also emails the people a link.
|
|
150
164
|
- `--password <secret>` is 4 to 128 characters and implies `--exposure password`. Prefer `--password -` or the `HANDOUT_DOCUMENT_PASSWORD` variable over a literal argument.
|
|
151
165
|
- Link controls: `--expires <when>` (a date, or a duration such as `7d`, `24h`, `30m`), `--max-views <n>`, `--one-time`, and `--revoke` / `--restore` on `manage`.
|
|
152
|
-
- Labels: `--label <name>`, repeatable, at most 10 per document, 1 to 24 characters each.
|
|
166
|
+
- Labels: `--label <name>`, repeatable, at most 10 per document, 1 to 24 characters each. A label says what kind of document it is; pick from `handout labels --json`.
|
|
153
167
|
- Listing: new documents are unlisted (kept off the publisher's public page). Pass `--no-unlisted` ("show on my public page") only when the user asks for that.
|
|
154
168
|
- Other switches: `--unlisted`, `--notify-on-view`, `--request-ack` (not with `--exposure password` or `open`: only signed-in readers of a private or people document can acknowledge), `--allow-source-download`, `--allow-external-images`, and for PDFs `--view-only` and `--watermark`.
|
|
155
169
|
|
|
@@ -263,7 +277,7 @@ An interactive page may only talk to the origins you allow with `--connect-src <
|
|
|
263
277
|
Each line shows the command and its expected output.
|
|
264
278
|
|
|
265
279
|
1. `handout publish report.html` prints `https://handout.app/acme/q3-report-k7f2qx9a` (the link comes from the document's title, `Q3 report`).
|
|
266
|
-
2. `handout publish report.md --exposure open --title "Q3 report" --label
|
|
280
|
+
2. `handout publish report.md --exposure open --title "Q3 report" --label report --json` prints `{"items":[{"file":"report.md","handle":"acme","slug":"...","id":"...","url":"...","exposure":"open","version":1,...}]}`.
|
|
267
281
|
3. `handout publish deck.pdf --people vicki@contoso.example --people @contoso.example --invite vicki@contoso.example` prints the URL (stderr: `published acme/... v1 pdf 2.3 MB people`).
|
|
268
282
|
4. `handout publish spec.html --exposure password --password - < pw.txt` prints the URL.
|
|
269
283
|
5. `handout update q3-report report.md --diff-summary "Added the Q4 numbers."` prints the same URL (stderr: `updated acme/q3-report v2 ...`); returning readers see "What's new in v2: Added the Q4 numbers."
|
package/handout.mjs
CHANGED
|
@@ -19527,10 +19527,180 @@ var Ulid = external_exports.string().regex(ULID_PATTERN, { message: "Expected a
|
|
|
19527
19527
|
var IsoInstant = external_exports.iso.datetime();
|
|
19528
19528
|
var OperatorRole = external_exports.string();
|
|
19529
19529
|
var CanList = external_exports.array(external_exports.string());
|
|
19530
|
+
var ReportReason = external_exports.enum([
|
|
19531
|
+
"spam",
|
|
19532
|
+
"phishing",
|
|
19533
|
+
"malware",
|
|
19534
|
+
"copyright",
|
|
19535
|
+
"illegal",
|
|
19536
|
+
"harassment",
|
|
19537
|
+
"other",
|
|
19538
|
+
"privacy",
|
|
19539
|
+
"intimate_imagery",
|
|
19540
|
+
"child_safety",
|
|
19541
|
+
"imminent_danger",
|
|
19542
|
+
"official_order"
|
|
19543
|
+
]);
|
|
19544
|
+
var standard = {
|
|
19545
|
+
urgent: false,
|
|
19546
|
+
deadline: { businessDays: 1 },
|
|
19547
|
+
restricted: false,
|
|
19548
|
+
noContentView: false,
|
|
19549
|
+
uncapped: false,
|
|
19550
|
+
elevatedLift: false
|
|
19551
|
+
};
|
|
19552
|
+
var REPORT_CATEGORY_POLICY = {
|
|
19553
|
+
spam: standard,
|
|
19554
|
+
harassment: standard,
|
|
19555
|
+
privacy: standard,
|
|
19556
|
+
illegal: standard,
|
|
19557
|
+
other: standard,
|
|
19558
|
+
phishing: { ...standard, urgent: true, deadline: { hours: 24 }, acknowledgeWithinHours: 4 },
|
|
19559
|
+
malware: { ...standard, urgent: true, deadline: { hours: 24 }, acknowledgeWithinHours: 4 },
|
|
19560
|
+
copyright: { ...standard, deadline: { businessDays: 2 } },
|
|
19561
|
+
official_order: {
|
|
19562
|
+
...standard,
|
|
19563
|
+
urgent: true,
|
|
19564
|
+
deadline: { businessDays: 5 },
|
|
19565
|
+
acknowledgeWithinHours: 4,
|
|
19566
|
+
elevatedLift: true
|
|
19567
|
+
},
|
|
19568
|
+
intimate_imagery: {
|
|
19569
|
+
...standard,
|
|
19570
|
+
urgent: true,
|
|
19571
|
+
deadline: { hours: 48 },
|
|
19572
|
+
restricted: true,
|
|
19573
|
+
acknowledgeWithinHours: 4,
|
|
19574
|
+
elevatedLift: true
|
|
19575
|
+
},
|
|
19576
|
+
child_safety: {
|
|
19577
|
+
urgent: true,
|
|
19578
|
+
deadline: { hours: 24 },
|
|
19579
|
+
restricted: true,
|
|
19580
|
+
noContentView: true,
|
|
19581
|
+
uncapped: true,
|
|
19582
|
+
acknowledgeWithinHours: 1,
|
|
19583
|
+
elevatedLift: true
|
|
19584
|
+
},
|
|
19585
|
+
imminent_danger: {
|
|
19586
|
+
...standard,
|
|
19587
|
+
urgent: true,
|
|
19588
|
+
deadline: { hours: 1 },
|
|
19589
|
+
uncapped: true,
|
|
19590
|
+
acknowledgeWithinHours: 1,
|
|
19591
|
+
elevatedLift: true
|
|
19592
|
+
}
|
|
19593
|
+
};
|
|
19594
|
+
var HOUR_MS = 60 * 60 * 1000;
|
|
19595
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
19596
|
+
var ReportDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
19597
|
+
var ReportNotice = external_exports.object({
|
|
19598
|
+
work: external_exports.string().trim().min(1).max(1000).optional(),
|
|
19599
|
+
depicted: external_exports.enum(["self", "representative"]).optional(),
|
|
19600
|
+
authority: external_exports.string().trim().min(1).max(200).optional(),
|
|
19601
|
+
reference: external_exports.string().trim().min(1).max(200).optional(),
|
|
19602
|
+
respondBy: ReportDate.optional(),
|
|
19603
|
+
goodFaith: external_exports.literal(true).optional(),
|
|
19604
|
+
accurate: external_exports.literal(true).optional(),
|
|
19605
|
+
signature: external_exports.string().trim().min(1).max(200).optional()
|
|
19606
|
+
});
|
|
19607
|
+
var ReportPublicStatus = external_exports.enum([
|
|
19608
|
+
"received",
|
|
19609
|
+
"under_review",
|
|
19610
|
+
"closed_actioned",
|
|
19611
|
+
"closed_no_action"
|
|
19612
|
+
]);
|
|
19613
|
+
var ReportStatus = external_exports.enum(["open", "dismissed", "actioned"]);
|
|
19614
|
+
var ReportTargetType = external_exports.enum(["document", "collection"]);
|
|
19615
|
+
var REPORT_DETAILS_MAX_LENGTH = 2000;
|
|
19616
|
+
var EvidenceItem = external_exports.object({
|
|
19617
|
+
id: Ulid,
|
|
19618
|
+
key: external_exports.string(),
|
|
19619
|
+
documentId: Ulid,
|
|
19620
|
+
version: external_exports.number().int().min(1),
|
|
19621
|
+
contentType: external_exports.string(),
|
|
19622
|
+
at: external_exports.string(),
|
|
19623
|
+
by: external_exports.string()
|
|
19624
|
+
});
|
|
19625
|
+
var APPEAL_STATEMENT_MAX_LENGTH = 2000;
|
|
19626
|
+
var APPEAL_NOTE_MAX_LENGTH = 1000;
|
|
19627
|
+
var CounterNotice = external_exports.object({
|
|
19628
|
+
name: external_exports.string().trim().min(1).max(200),
|
|
19629
|
+
address: external_exports.string().trim().min(1).max(500),
|
|
19630
|
+
phone: external_exports.string().trim().min(3).max(50),
|
|
19631
|
+
email: external_exports.email().max(320),
|
|
19632
|
+
material: external_exports.string().trim().min(1).max(1000),
|
|
19633
|
+
mistake: external_exports.literal(true),
|
|
19634
|
+
jurisdiction: external_exports.literal(true),
|
|
19635
|
+
signature: external_exports.string().trim().min(1).max(200)
|
|
19636
|
+
});
|
|
19637
|
+
var AppealKind = external_exports.enum(["appeal", "counter_notice"]);
|
|
19638
|
+
var AppealStatus = external_exports.enum([
|
|
19639
|
+
"open",
|
|
19640
|
+
"upheld",
|
|
19641
|
+
"reversed",
|
|
19642
|
+
"waiting",
|
|
19643
|
+
"restored",
|
|
19644
|
+
"suit_filed"
|
|
19645
|
+
]);
|
|
19646
|
+
var ReportAppeal = external_exports.object({
|
|
19647
|
+
kind: AppealKind,
|
|
19648
|
+
status: AppealStatus,
|
|
19649
|
+
documentId: Ulid,
|
|
19650
|
+
at: external_exports.string(),
|
|
19651
|
+
by: external_exports.string(),
|
|
19652
|
+
statement: external_exports.string().max(APPEAL_STATEMENT_MAX_LENGTH).optional(),
|
|
19653
|
+
counterNotice: CounterNotice.optional(),
|
|
19654
|
+
dueAt: external_exports.string().optional(),
|
|
19655
|
+
escalatedAt: external_exports.string().optional(),
|
|
19656
|
+
forwardedAt: external_exports.string().optional(),
|
|
19657
|
+
forwardedBy: external_exports.string().optional(),
|
|
19658
|
+
restoreAfter: external_exports.string().optional(),
|
|
19659
|
+
restoreBy: external_exports.string().optional(),
|
|
19660
|
+
decidedAt: external_exports.string().optional(),
|
|
19661
|
+
decidedBy: external_exports.string().optional(),
|
|
19662
|
+
note: external_exports.string().max(APPEAL_NOTE_MAX_LENGTH).optional(),
|
|
19663
|
+
sameOperator: external_exports.boolean().optional()
|
|
19664
|
+
});
|
|
19665
|
+
var ReportRecord = external_exports.object({
|
|
19666
|
+
id: Ulid,
|
|
19667
|
+
targetType: external_exports.enum(["document", "collection", "url"]),
|
|
19668
|
+
submittedUrl: external_exports.string().url().max(2048).optional(),
|
|
19669
|
+
documentId: Ulid.optional(),
|
|
19670
|
+
collectionId: Ulid.optional(),
|
|
19671
|
+
workspaceId: Ulid.optional(),
|
|
19672
|
+
handle: external_exports.string(),
|
|
19673
|
+
slug: external_exports.string(),
|
|
19674
|
+
version: external_exports.number().int().min(1).optional(),
|
|
19675
|
+
reason: ReportReason,
|
|
19676
|
+
details: external_exports.string().max(REPORT_DETAILS_MAX_LENGTH).optional(),
|
|
19677
|
+
reporterUid: external_exports.string().optional(),
|
|
19678
|
+
reporterEmail: external_exports.string().optional(),
|
|
19679
|
+
reporterIpHash: external_exports.string().optional(),
|
|
19680
|
+
createdAt: external_exports.string(),
|
|
19681
|
+
status: ReportStatus,
|
|
19682
|
+
resolvedAt: external_exports.string().optional(),
|
|
19683
|
+
resolutionNote: external_exports.string().optional(),
|
|
19684
|
+
alertedAt: external_exports.string().optional(),
|
|
19685
|
+
digestedAt: external_exports.string().optional(),
|
|
19686
|
+
dueAt: external_exports.string().optional(),
|
|
19687
|
+
notice: ReportNotice.optional(),
|
|
19688
|
+
statusTokenHash: external_exports.string().optional(),
|
|
19689
|
+
receiptTo: external_exports.string().optional(),
|
|
19690
|
+
acknowledgedAt: external_exports.string().optional(),
|
|
19691
|
+
acknowledgedBy: external_exports.string().optional(),
|
|
19692
|
+
ackEscalatedAt: external_exports.string().optional(),
|
|
19693
|
+
overdueEscalatedAt: external_exports.string().optional(),
|
|
19694
|
+
evidence: external_exports.array(EvidenceItem).optional(),
|
|
19695
|
+
appeal: ReportAppeal.optional()
|
|
19696
|
+
}).refine((report) => report.targetType === "url" ? report.submittedUrl !== void 0 && report.documentId === void 0 && report.collectionId === void 0 : report.workspaceId !== void 0 && (report.targetType === "document" ? report.documentId !== void 0 && report.collectionId === void 0 : report.collectionId !== void 0 && report.documentId === void 0), {
|
|
19697
|
+
message: "A report names exactly one target: documentId for a document, collectionId for a collection."
|
|
19698
|
+
});
|
|
19530
19699
|
var ContentType = external_exports.enum(["html", "markdown", "pdf"]);
|
|
19531
19700
|
function isBinaryContentType(contentType) {
|
|
19532
19701
|
return contentType === "pdf";
|
|
19533
19702
|
}
|
|
19703
|
+
var MARKDOWN_MAX_BYTES = 2097152;
|
|
19534
19704
|
var CONTENT_TYPE_EXTENSIONS = {
|
|
19535
19705
|
html: "html",
|
|
19536
19706
|
markdown: "md",
|
|
@@ -19600,6 +19770,9 @@ var AllowlistEntry = external_exports.string().trim().max(MAX_ALLOWLIST_ENTRY_LE
|
|
|
19600
19770
|
var DocumentLabel = external_exports.string().trim().min(1).max(24);
|
|
19601
19771
|
var MAX_LABELS_PER_DOCUMENT = 10;
|
|
19602
19772
|
var MAX_LABELS_MESSAGE = "A document can have at most 10 labels.";
|
|
19773
|
+
var MAX_SUGGESTED_LABELS = 30;
|
|
19774
|
+
var MAX_SUGGESTED_LABELS_MESSAGE = `A workspace can have at most ${MAX_SUGGESTED_LABELS} suggested labels.`;
|
|
19775
|
+
var SuggestedLabels = external_exports.array(DocumentLabel).max(MAX_SUGGESTED_LABELS, MAX_SUGGESTED_LABELS_MESSAGE);
|
|
19603
19776
|
var PASSWORD_MIN_LENGTH = 4;
|
|
19604
19777
|
var PASSWORD_MAX_LENGTH = 128;
|
|
19605
19778
|
var TITLE_MAX_LENGTH = 512;
|
|
@@ -19662,7 +19835,19 @@ var DocumentRecord = external_exports.object({
|
|
|
19662
19835
|
sizeBytes: external_exports.number().int().nonnegative(),
|
|
19663
19836
|
expiresAt: external_exports.string().optional(),
|
|
19664
19837
|
revokedAt: external_exports.string().optional(),
|
|
19665
|
-
takedown: external_exports.object({
|
|
19838
|
+
takedown: external_exports.object({
|
|
19839
|
+
at: external_exports.string(),
|
|
19840
|
+
reason: external_exports.string(),
|
|
19841
|
+
reportId: Ulid.optional(),
|
|
19842
|
+
category: ReportReason.optional()
|
|
19843
|
+
}).optional(),
|
|
19844
|
+
legalHold: external_exports.object({
|
|
19845
|
+
at: external_exports.string(),
|
|
19846
|
+
by: external_exports.string(),
|
|
19847
|
+
reason: external_exports.string(),
|
|
19848
|
+
reportId: Ulid.optional(),
|
|
19849
|
+
until: external_exports.string().optional()
|
|
19850
|
+
}).optional(),
|
|
19666
19851
|
passwordHash: external_exports.string().optional(),
|
|
19667
19852
|
branding: DocumentBranding.optional(),
|
|
19668
19853
|
labels: external_exports.array(external_exports.string()).optional(),
|
|
@@ -19900,7 +20085,9 @@ var GrantablePlan = external_exports.enum(["friends", "internal"]);
|
|
|
19900
20085
|
var PlanLimits = external_exports.object({
|
|
19901
20086
|
liveDocuments: external_exports.number(),
|
|
19902
20087
|
maxDocumentBytes: external_exports.number(),
|
|
20088
|
+
storagePoolBytes: external_exports.number(),
|
|
19903
20089
|
versionRetention: external_exports.union([external_exports.number(), external_exports.literal("all")]),
|
|
20090
|
+
versionRestore: external_exports.boolean(),
|
|
19904
20091
|
rungs: external_exports.array(Exposure),
|
|
19905
20092
|
linkControls: external_exports.boolean(),
|
|
19906
20093
|
readerFooter: external_exports.boolean(),
|
|
@@ -19913,7 +20100,9 @@ var PLAN_LIMITS = {
|
|
|
19913
20100
|
free: {
|
|
19914
20101
|
liveDocuments: 10,
|
|
19915
20102
|
maxDocumentBytes: 5242880,
|
|
20103
|
+
storagePoolBytes: 104857600,
|
|
19916
20104
|
versionRetention: 5,
|
|
20105
|
+
versionRestore: false,
|
|
19917
20106
|
rungs: ["private", "open"],
|
|
19918
20107
|
linkControls: false,
|
|
19919
20108
|
readerFooter: true,
|
|
@@ -19925,7 +20114,9 @@ var PLAN_LIMITS = {
|
|
|
19925
20114
|
plus: {
|
|
19926
20115
|
liveDocuments: 500,
|
|
19927
20116
|
maxDocumentBytes: 20971520,
|
|
19928
|
-
|
|
20117
|
+
storagePoolBytes: 5368709120,
|
|
20118
|
+
versionRetention: 100,
|
|
20119
|
+
versionRestore: true,
|
|
19929
20120
|
rungs: ["private", "people", "password", "open"],
|
|
19930
20121
|
linkControls: true,
|
|
19931
20122
|
readerFooter: false,
|
|
@@ -19937,7 +20128,9 @@ var PLAN_LIMITS = {
|
|
|
19937
20128
|
friends: {
|
|
19938
20129
|
liveDocuments: 2000,
|
|
19939
20130
|
maxDocumentBytes: 20971520,
|
|
19940
|
-
|
|
20131
|
+
storagePoolBytes: 26843545600,
|
|
20132
|
+
versionRetention: 100,
|
|
20133
|
+
versionRestore: true,
|
|
19941
20134
|
rungs: ["private", "people", "password", "open"],
|
|
19942
20135
|
linkControls: true,
|
|
19943
20136
|
readerFooter: false,
|
|
@@ -19949,7 +20142,9 @@ var PLAN_LIMITS = {
|
|
|
19949
20142
|
internal: {
|
|
19950
20143
|
liveDocuments: 10000,
|
|
19951
20144
|
maxDocumentBytes: 20971520,
|
|
20145
|
+
storagePoolBytes: 107374182400,
|
|
19952
20146
|
versionRetention: "all",
|
|
20147
|
+
versionRestore: true,
|
|
19953
20148
|
rungs: ["private", "people", "password", "open"],
|
|
19954
20149
|
linkControls: true,
|
|
19955
20150
|
readerFooter: false,
|
|
@@ -19962,6 +20157,7 @@ var PLAN_LIMITS = {
|
|
|
19962
20157
|
var PlanLimitName = external_exports.enum([
|
|
19963
20158
|
"liveDocuments",
|
|
19964
20159
|
"maxDocumentBytes",
|
|
20160
|
+
"storagePoolBytes",
|
|
19965
20161
|
"versionRetention",
|
|
19966
20162
|
"rungs",
|
|
19967
20163
|
"linkControls",
|
|
@@ -20091,6 +20287,8 @@ var WorkspaceRecord = external_exports.object({
|
|
|
20091
20287
|
handle: external_exports.string(),
|
|
20092
20288
|
name: external_exports.string().min(1).max(WORKSPACE_NAME_MAX_LENGTH),
|
|
20093
20289
|
branding: DocumentBranding.optional(),
|
|
20290
|
+
suggestedLabels: external_exports.array(external_exports.string()).optional(),
|
|
20291
|
+
suggestedLabelsOffer: external_exports.boolean().optional(),
|
|
20094
20292
|
createdBy: external_exports.string(),
|
|
20095
20293
|
createdAt: external_exports.string(),
|
|
20096
20294
|
updatedAt: external_exports.string(),
|
|
@@ -20161,42 +20359,6 @@ var SaveRecord = external_exports.preprocess((raw) => {
|
|
|
20161
20359
|
targetId: Ulid,
|
|
20162
20360
|
savedAt: external_exports.string()
|
|
20163
20361
|
}));
|
|
20164
|
-
var ReportReason = external_exports.enum([
|
|
20165
|
-
"spam",
|
|
20166
|
-
"phishing",
|
|
20167
|
-
"malware",
|
|
20168
|
-
"copyright",
|
|
20169
|
-
"illegal",
|
|
20170
|
-
"harassment",
|
|
20171
|
-
"other"
|
|
20172
|
-
]);
|
|
20173
|
-
var ReportStatus = external_exports.enum(["open", "dismissed", "actioned"]);
|
|
20174
|
-
var ReportTargetType = external_exports.enum(["document", "collection"]);
|
|
20175
|
-
var REPORT_DETAILS_MAX_LENGTH = 2000;
|
|
20176
|
-
var ReportRecord = external_exports.object({
|
|
20177
|
-
id: Ulid,
|
|
20178
|
-
targetType: external_exports.enum(["document", "collection", "url"]),
|
|
20179
|
-
submittedUrl: external_exports.string().url().max(2048).optional(),
|
|
20180
|
-
documentId: Ulid.optional(),
|
|
20181
|
-
collectionId: Ulid.optional(),
|
|
20182
|
-
workspaceId: Ulid.optional(),
|
|
20183
|
-
handle: external_exports.string(),
|
|
20184
|
-
slug: external_exports.string(),
|
|
20185
|
-
version: external_exports.number().int().min(1).optional(),
|
|
20186
|
-
reason: ReportReason,
|
|
20187
|
-
details: external_exports.string().max(REPORT_DETAILS_MAX_LENGTH).optional(),
|
|
20188
|
-
reporterUid: external_exports.string().optional(),
|
|
20189
|
-
reporterEmail: external_exports.string().optional(),
|
|
20190
|
-
reporterIpHash: external_exports.string().optional(),
|
|
20191
|
-
createdAt: external_exports.string(),
|
|
20192
|
-
status: ReportStatus,
|
|
20193
|
-
resolvedAt: external_exports.string().optional(),
|
|
20194
|
-
resolutionNote: external_exports.string().optional(),
|
|
20195
|
-
alertedAt: external_exports.string().optional(),
|
|
20196
|
-
digestedAt: external_exports.string().optional()
|
|
20197
|
-
}).refine((report) => report.targetType === "url" ? report.submittedUrl !== void 0 && report.documentId === void 0 && report.collectionId === void 0 : report.workspaceId !== void 0 && (report.targetType === "document" ? report.documentId !== void 0 && report.collectionId === void 0 : report.collectionId !== void 0 && report.documentId === void 0), {
|
|
20198
|
-
message: "A report names exactly one target: documentId for a document, collectionId for a collection."
|
|
20199
|
-
});
|
|
20200
20362
|
var ErrorCode = external_exports.enum([
|
|
20201
20363
|
"validation_failed",
|
|
20202
20364
|
"bad_request",
|
|
@@ -20257,6 +20419,8 @@ var WorkspaceResponse = external_exports.object({
|
|
|
20257
20419
|
name: external_exports.string(),
|
|
20258
20420
|
url: external_exports.string(),
|
|
20259
20421
|
branding: DocumentBranding.optional(),
|
|
20422
|
+
suggestedLabels: external_exports.array(external_exports.string()).optional(),
|
|
20423
|
+
suggestedLabelsSeedable: external_exports.boolean().optional(),
|
|
20260
20424
|
liveDocuments: external_exports.number().int().nonnegative(),
|
|
20261
20425
|
collections: external_exports.number().int().nonnegative(),
|
|
20262
20426
|
createdAt: external_exports.string(),
|
|
@@ -20268,7 +20432,15 @@ var WorkspaceResponse = external_exports.object({
|
|
|
20268
20432
|
var MyWorkspacesResponse = external_exports.object({ items: external_exports.array(WorkspaceResponse) });
|
|
20269
20433
|
var PatchWorkspaceRequest = external_exports.object({
|
|
20270
20434
|
name: WorkspaceName.optional(),
|
|
20271
|
-
branding: DocumentBranding.nullable().optional()
|
|
20435
|
+
branding: DocumentBranding.nullable().optional(),
|
|
20436
|
+
suggestedLabels: SuggestedLabels.optional(),
|
|
20437
|
+
expectedUpdatedAt: IsoInstant.optional()
|
|
20438
|
+
});
|
|
20439
|
+
var LabelUsage = external_exports.object({ label: external_exports.string(), count: external_exports.number().int().nonnegative() });
|
|
20440
|
+
var WorkspaceLabelsResponse = external_exports.object({
|
|
20441
|
+
suggested: external_exports.array(LabelUsage),
|
|
20442
|
+
other: external_exports.array(LabelUsage),
|
|
20443
|
+
seedable: external_exports.boolean().optional()
|
|
20272
20444
|
});
|
|
20273
20445
|
var DeleteWorkspaceResponse = external_exports.object({
|
|
20274
20446
|
id: Ulid,
|
|
@@ -20386,6 +20558,7 @@ var CreateDocumentResponse = external_exports.object({
|
|
|
20386
20558
|
invitesFailed: external_exports.array(external_exports.string()).optional(),
|
|
20387
20559
|
warnings: external_exports.array(HtmlLintWarning).optional()
|
|
20388
20560
|
});
|
|
20561
|
+
var DocumentCollectionRef = external_exports.object({ slug: external_exports.string(), name: external_exports.string() });
|
|
20389
20562
|
var ListDocumentsItem = external_exports.object({
|
|
20390
20563
|
id: Ulid,
|
|
20391
20564
|
can: CanList.optional(),
|
|
@@ -20403,6 +20576,7 @@ var ListDocumentsItem = external_exports.object({
|
|
|
20403
20576
|
takenDown: external_exports.boolean().optional(),
|
|
20404
20577
|
passwordProtected: external_exports.boolean().optional(),
|
|
20405
20578
|
labels: external_exports.array(external_exports.string()).optional(),
|
|
20579
|
+
collections: external_exports.array(DocumentCollectionRef).optional(),
|
|
20406
20580
|
unlisted: external_exports.boolean().optional(),
|
|
20407
20581
|
deletedAt: external_exports.string().optional(),
|
|
20408
20582
|
purgeAt: external_exports.string().optional(),
|
|
@@ -20425,6 +20599,7 @@ var ListDocumentsItem = external_exports.object({
|
|
|
20425
20599
|
var ListDocumentsQuery = Pagination.extend({
|
|
20426
20600
|
filter: external_exports.enum(["live", "trashed"]).default("live"),
|
|
20427
20601
|
label: DocumentLabel.optional(),
|
|
20602
|
+
collection: SlugRef.optional(),
|
|
20428
20603
|
sort: external_exports.enum(["updatedAt", "createdAt", "title"]).default("updatedAt")
|
|
20429
20604
|
});
|
|
20430
20605
|
var ListDocumentsResponse = page(ListDocumentsItem);
|
|
@@ -20468,6 +20643,7 @@ var OwnerDocumentResponse = DocumentRecord.omit({
|
|
|
20468
20643
|
passwordProtected: external_exports.boolean().optional(),
|
|
20469
20644
|
purgeAt: external_exports.string().optional(),
|
|
20470
20645
|
awareness: EditAwareness.optional(),
|
|
20646
|
+
collections: external_exports.array(DocumentCollectionRef).optional(),
|
|
20471
20647
|
followersRemoved: external_exports.number().int().positive().optional()
|
|
20472
20648
|
});
|
|
20473
20649
|
var PatchDocumentRequest = external_exports.object({
|
|
@@ -20704,6 +20880,28 @@ var SearchDocumentsResponse = external_exports.object({
|
|
|
20704
20880
|
query: external_exports.string(),
|
|
20705
20881
|
items: external_exports.array(SearchDocumentsItem)
|
|
20706
20882
|
});
|
|
20883
|
+
var PublisherAppeal = ReportAppeal.pick({
|
|
20884
|
+
kind: true,
|
|
20885
|
+
status: true,
|
|
20886
|
+
at: true,
|
|
20887
|
+
restoreAfter: true,
|
|
20888
|
+
restoreBy: true,
|
|
20889
|
+
decidedAt: true,
|
|
20890
|
+
note: true
|
|
20891
|
+
});
|
|
20892
|
+
var DocumentAppealResponse = external_exports.object({
|
|
20893
|
+
takedown: external_exports.object({ at: external_exports.string(), reason: external_exports.string(), category: ReportReason.optional() }),
|
|
20894
|
+
appeal: PublisherAppeal.optional(),
|
|
20895
|
+
canAppeal: external_exports.boolean(),
|
|
20896
|
+
counterNoticeAllowed: external_exports.boolean()
|
|
20897
|
+
});
|
|
20898
|
+
var FileAppealRequest = external_exports.discriminatedUnion("kind", [
|
|
20899
|
+
external_exports.object({
|
|
20900
|
+
kind: external_exports.literal("appeal"),
|
|
20901
|
+
statement: external_exports.string().trim().min(1).max(APPEAL_STATEMENT_MAX_LENGTH)
|
|
20902
|
+
}),
|
|
20903
|
+
external_exports.object({ kind: external_exports.literal("counter_notice"), counterNotice: CounterNotice })
|
|
20904
|
+
]);
|
|
20707
20905
|
var OwnedSearchItem = SearchDocumentsItem.extend({
|
|
20708
20906
|
handle: external_exports.string(),
|
|
20709
20907
|
workspaceName: external_exports.string()
|
|
@@ -20877,12 +21075,14 @@ var GatedMetaResponse = external_exports.object({
|
|
|
20877
21075
|
function isGatedMeta(meta3) {
|
|
20878
21076
|
return "gate" in meta3;
|
|
20879
21077
|
}
|
|
21078
|
+
var SignedRequestHeaders = external_exports.record(external_exports.string(), external_exports.string());
|
|
20880
21079
|
var PublicContentResponse = external_exports.object({
|
|
20881
21080
|
contentType: ContentType,
|
|
20882
21081
|
version: external_exports.number().int().min(1),
|
|
20883
21082
|
html: external_exports.string().optional(),
|
|
20884
21083
|
data: external_exports.string().optional(),
|
|
20885
21084
|
dataUrl: external_exports.string().optional(),
|
|
21085
|
+
dataHeaders: SignedRequestHeaders.optional(),
|
|
20886
21086
|
mediaType: external_exports.string().optional(),
|
|
20887
21087
|
viewOnly: external_exports.boolean().optional(),
|
|
20888
21088
|
watermark: external_exports.boolean().optional(),
|
|
@@ -20938,6 +21138,7 @@ var InteractiveContentUrlResponse = external_exports.object({
|
|
|
20938
21138
|
});
|
|
20939
21139
|
var SourceDownloadResponse = external_exports.object({
|
|
20940
21140
|
url: external_exports.string(),
|
|
21141
|
+
headers: SignedRequestHeaders.optional(),
|
|
20941
21142
|
filename: external_exports.string(),
|
|
20942
21143
|
expiresAt: external_exports.string()
|
|
20943
21144
|
});
|
|
@@ -21130,7 +21331,9 @@ var MeResponse = external_exports.object({
|
|
|
21130
21331
|
plan: PlanId,
|
|
21131
21332
|
pool: external_exports.object({
|
|
21132
21333
|
liveDocuments: external_exports.number().int().nonnegative(),
|
|
21133
|
-
limit: external_exports.number().int().positive()
|
|
21334
|
+
limit: external_exports.number().int().positive(),
|
|
21335
|
+
storageBytes: external_exports.number().int().nonnegative().optional(),
|
|
21336
|
+
storageLimit: external_exports.number().int().positive().optional()
|
|
21134
21337
|
}),
|
|
21135
21338
|
settings: SettingsResponse,
|
|
21136
21339
|
workspaces: external_exports.array(WorkspaceResponse),
|
|
@@ -21311,7 +21514,9 @@ var UsageResponse = external_exports.object({
|
|
|
21311
21514
|
limits: PlanLimits,
|
|
21312
21515
|
pool: external_exports.object({
|
|
21313
21516
|
liveDocuments: external_exports.number().int().nonnegative(),
|
|
21314
|
-
limit: external_exports.number().int().positive()
|
|
21517
|
+
limit: external_exports.number().int().positive(),
|
|
21518
|
+
storageBytes: external_exports.number().int().nonnegative().optional(),
|
|
21519
|
+
storageLimit: external_exports.number().int().positive().optional()
|
|
21315
21520
|
}),
|
|
21316
21521
|
totals: external_exports.object({
|
|
21317
21522
|
documents: external_exports.number().int().nonnegative(),
|
|
@@ -21349,7 +21554,11 @@ var CreateReportRequest = external_exports.object({
|
|
|
21349
21554
|
details: external_exports.string().trim().max(2000).optional(),
|
|
21350
21555
|
email: external_exports.email().optional()
|
|
21351
21556
|
});
|
|
21352
|
-
var CreateReportResponse = external_exports.object({
|
|
21557
|
+
var CreateReportResponse = external_exports.object({
|
|
21558
|
+
id: Ulid,
|
|
21559
|
+
createdAt: external_exports.string(),
|
|
21560
|
+
statusUrl: external_exports.string().optional()
|
|
21561
|
+
});
|
|
21353
21562
|
var HealthResponse = external_exports.object({ status: external_exports.literal("ok"), version: external_exports.string().optional() });
|
|
21354
21563
|
var ReadinessCheck = external_exports.enum(["ok", "error"]);
|
|
21355
21564
|
var ReadinessResponse = external_exports.object({
|
|
@@ -21501,8 +21710,8 @@ function plural2(n, word, pluralWord = `${word}s`) {
|
|
|
21501
21710
|
function fields(...parts) {
|
|
21502
21711
|
return parts.filter((p) => typeof p === "string" && p !== "").join(" ");
|
|
21503
21712
|
}
|
|
21504
|
-
function keyValueBlock(
|
|
21505
|
-
return
|
|
21713
|
+
function keyValueBlock(rows2) {
|
|
21714
|
+
return rows2.filter((row2) => row2[1] !== void 0).map(([key, value]) => `${key}: ${value}`).join("\n");
|
|
21506
21715
|
}
|
|
21507
21716
|
function describeAwareness(awareness) {
|
|
21508
21717
|
const parts = [`v${awareness.currentVersion}`];
|
|
@@ -21786,10 +21995,13 @@ async function readContent(path, type, fs = nodePublishFs) {
|
|
|
21786
21995
|
function megabytes(bytes) {
|
|
21787
21996
|
return `${bytes / 1048576} MB`;
|
|
21788
21997
|
}
|
|
21789
|
-
function assertWithinUploadLimit(path, sizeBytes) {
|
|
21998
|
+
function assertWithinUploadLimit(path, sizeBytes, contentType) {
|
|
21790
21999
|
if (sizeBytes > MAX_UPLOAD_BYTES) {
|
|
21791
22000
|
throw fileError(`${path} is too large to upload (${humanizeBytes(sizeBytes)}): the largest document is ${megabytes(MAX_UPLOAD_BYTES)}.`);
|
|
21792
22001
|
}
|
|
22002
|
+
if (contentType === "markdown" && sizeBytes > MARKDOWN_MAX_BYTES) {
|
|
22003
|
+
throw fileError(`${path} is too large to upload (${humanizeBytes(sizeBytes)}): a Markdown document can be at most ${megabytes(MARKDOWN_MAX_BYTES)}. Split it, or publish it as HTML or PDF.`);
|
|
22004
|
+
}
|
|
21793
22005
|
}
|
|
21794
22006
|
var TITLE_MAX = 512;
|
|
21795
22007
|
function decodeEntities(input2) {
|
|
@@ -21842,8 +22054,8 @@ var cachedVersion;
|
|
|
21842
22054
|
function bundledVersion() {
|
|
21843
22055
|
if (cachedVersion !== void 0)
|
|
21844
22056
|
return cachedVersion;
|
|
21845
|
-
if ("1.
|
|
21846
|
-
cachedVersion = "1.
|
|
22057
|
+
if ("1.4.0".length > 0) {
|
|
22058
|
+
cachedVersion = "1.4.0";
|
|
21847
22059
|
return cachedVersion;
|
|
21848
22060
|
}
|
|
21849
22061
|
try {
|
|
@@ -23729,10 +23941,11 @@ function createClient(options) {
|
|
|
23729
23941
|
}
|
|
23730
23942
|
return { status: response.status, data: result2.data, headers: response.headers, requestId };
|
|
23731
23943
|
}
|
|
23732
|
-
async function fetchSigned(url2, what = "source file") {
|
|
23944
|
+
async function fetchSigned(url2, what = "source file", headers = {}) {
|
|
23733
23945
|
let response;
|
|
23734
23946
|
try {
|
|
23735
23947
|
response = await fetchImpl(url2, {
|
|
23948
|
+
headers: { ...headers },
|
|
23736
23949
|
signal: AbortSignal.timeout(TIMEOUT_MS.signed)
|
|
23737
23950
|
});
|
|
23738
23951
|
}
|
|
@@ -23833,6 +24046,12 @@ function createClient(options) {
|
|
|
23833
24046
|
schema: WorkspaceResponse,
|
|
23834
24047
|
context: ws(handle, void 0, "workspace")
|
|
23835
24048
|
}),
|
|
24049
|
+
getWorkspaceLabels: (handle) => call({
|
|
24050
|
+
method: "GET",
|
|
24051
|
+
path: `${W(handle)}/labels`,
|
|
24052
|
+
schema: WorkspaceLabelsResponse,
|
|
24053
|
+
context: ws(handle, void 0, "workspace")
|
|
24054
|
+
}),
|
|
23836
24055
|
patchWorkspace: (handle, body) => call({
|
|
23837
24056
|
method: "PATCH",
|
|
23838
24057
|
path: W(handle),
|
|
@@ -23868,6 +24087,7 @@ function createClient(options) {
|
|
|
23868
24087
|
filter: query?.filter,
|
|
23869
24088
|
sort: query?.sort,
|
|
23870
24089
|
label: query?.label,
|
|
24090
|
+
collection: query?.collection,
|
|
23871
24091
|
...listQuery(query)
|
|
23872
24092
|
},
|
|
23873
24093
|
schema: ListDocumentsResponse,
|
|
@@ -25038,7 +25258,7 @@ async function readTargets(options, fs = nodePublishFs) {
|
|
|
25038
25258
|
assertNotWordDocument(file2);
|
|
25039
25259
|
const contentType = options.contentType ?? inferContentType(file2);
|
|
25040
25260
|
const { content, sizeBytes } = await readContent(file2, contentType, fs);
|
|
25041
|
-
assertWithinUploadLimit(file2, sizeBytes);
|
|
25261
|
+
assertWithinUploadLimit(file2, sizeBytes, contentType);
|
|
25042
25262
|
targets.push({ file: file2, contentType, content, sizeBytes });
|
|
25043
25263
|
}
|
|
25044
25264
|
return targets;
|
|
@@ -25722,18 +25942,23 @@ async function emitBytes(bytes, options) {
|
|
|
25722
25942
|
var USAGE = {
|
|
25723
25943
|
list: buildUsage({
|
|
25724
25944
|
synopsis: [
|
|
25725
|
-
"handout list [--trashed] [--label <name>] [--sort updatedAt|createdAt|title] [--limit <n>] [--cursor <token>] [--all]"
|
|
25945
|
+
"handout list [--trashed] [--label <name>] [--collection <slug>] [--sort updatedAt|createdAt|title] [--limit <n>] [--cursor <token>] [--all]"
|
|
25726
25946
|
],
|
|
25727
25947
|
description: "Lists the documents of the selected workspace.",
|
|
25728
25948
|
flags: [
|
|
25729
25949
|
["--trashed", "List the trash instead of live documents"],
|
|
25730
|
-
["--label <name>", "Only documents carrying this label"],
|
|
25950
|
+
["--label <name>", "Only documents carrying this label (what kind of document it is)"],
|
|
25951
|
+
["--collection <slug>", "Only documents in this collection (what they belong to)"],
|
|
25731
25952
|
["--sort <key>", "updatedAt (default), createdAt or title"],
|
|
25732
25953
|
["--limit <n>", "Page size, 1-200"],
|
|
25733
25954
|
["--cursor <token>", "Continue from a previous page"],
|
|
25734
25955
|
["--all", "Walk every page"]
|
|
25735
25956
|
],
|
|
25736
|
-
examples: [
|
|
25957
|
+
examples: [
|
|
25958
|
+
"handout list --label report",
|
|
25959
|
+
"handout list --collection q3-launch",
|
|
25960
|
+
"handout list --all --json"
|
|
25961
|
+
]
|
|
25737
25962
|
}),
|
|
25738
25963
|
get: buildUsage({
|
|
25739
25964
|
synopsis: ["handout get <ref> [--password <secret>]"],
|
|
@@ -25868,7 +26093,7 @@ async function listDocuments(ctx) {
|
|
|
25868
26093
|
const scanned = scanArgs(ctx.args, {
|
|
25869
26094
|
context,
|
|
25870
26095
|
usage: USAGE.list,
|
|
25871
|
-
values: ["--label", "--sort", "--limit", "--cursor"],
|
|
26096
|
+
values: ["--label", "--collection", "--sort", "--limit", "--cursor"],
|
|
25872
26097
|
booleans: ["--trashed", "--all"]
|
|
25873
26098
|
});
|
|
25874
26099
|
expectPositionals(scanned, context, 0);
|
|
@@ -25887,12 +26112,18 @@ async function listDocuments(ctx) {
|
|
|
25887
26112
|
if (label !== void 0 && !DocumentLabel.safeParse(label).success) {
|
|
25888
26113
|
throw usageError(`--label "${label}" must be 1-24 characters.`);
|
|
25889
26114
|
}
|
|
26115
|
+
const collectionRaw = lastValue(scanned, "--collection")?.trim();
|
|
26116
|
+
const collection = collectionRaw === void 0 || collectionRaw === "" ? void 0 : collectionRaw;
|
|
26117
|
+
if (collection !== void 0 && !SlugRef.safeParse(collection).success) {
|
|
26118
|
+
throw usageError(`--collection "${collection}" is not a collection slug.`);
|
|
26119
|
+
}
|
|
25890
26120
|
const trashed = scanned.seen.has("--trashed");
|
|
25891
26121
|
const handle = await ctx.workspace();
|
|
25892
26122
|
const client = await ctx.client();
|
|
25893
26123
|
const query = {
|
|
25894
26124
|
filter: trashed ? "trashed" : "live",
|
|
25895
26125
|
...label === void 0 ? {} : { label },
|
|
26126
|
+
...collection === void 0 ? {} : { collection },
|
|
25896
26127
|
...sort === void 0 ? {} : { sort }
|
|
25897
26128
|
};
|
|
25898
26129
|
if (all) {
|
|
@@ -25915,7 +26146,7 @@ async function listDocuments(ctx) {
|
|
|
25915
26146
|
});
|
|
25916
26147
|
}
|
|
25917
26148
|
function formatOwnerDocument(doc) {
|
|
25918
|
-
const
|
|
26149
|
+
const rows2 = [
|
|
25919
26150
|
["title", doc.title],
|
|
25920
26151
|
["url", doc.url],
|
|
25921
26152
|
["slug", doc.slug],
|
|
@@ -25928,52 +26159,55 @@ function formatOwnerDocument(doc) {
|
|
|
25928
26159
|
];
|
|
25929
26160
|
const when = (value) => value;
|
|
25930
26161
|
if (doc.allowlist !== void 0 && doc.allowlist.length > 0) {
|
|
25931
|
-
|
|
26162
|
+
rows2.push(["people", String(doc.allowlist.length)]);
|
|
25932
26163
|
}
|
|
25933
26164
|
if (doc.passwordProtected === true)
|
|
25934
|
-
|
|
25935
|
-
|
|
26165
|
+
rows2.push(["password", "set"]);
|
|
26166
|
+
rows2.push(["expires", when(doc.expiresAt)]);
|
|
25936
26167
|
if (doc.maxViews !== void 0)
|
|
25937
|
-
|
|
25938
|
-
|
|
26168
|
+
rows2.push(["max views", `${doc.viewCount ?? 0} of ${doc.maxViews}`]);
|
|
26169
|
+
rows2.push(["revoked", when(doc.revokedAt)]);
|
|
25939
26170
|
if (doc.takedown !== void 0)
|
|
25940
|
-
|
|
26171
|
+
rows2.push(["taken down", `${doc.takedown.at}: ${doc.takedown.reason}`]);
|
|
25941
26172
|
if (doc.deletedAt !== void 0 || doc.trashed === true) {
|
|
25942
|
-
|
|
26173
|
+
rows2.push(["trashed", doc.purgeAt === void 0 ? "yes" : `purge ${doc.purgeAt}`]);
|
|
25943
26174
|
}
|
|
25944
26175
|
if (doc.labels !== void 0 && doc.labels.length > 0)
|
|
25945
|
-
|
|
26176
|
+
rows2.push(["labels", doc.labels.join(", ")]);
|
|
26177
|
+
if (doc.collections !== void 0 && doc.collections.length > 0) {
|
|
26178
|
+
rows2.push(["collections", doc.collections.map((c) => `${c.name} (${c.slug})`).join(", ")]);
|
|
26179
|
+
}
|
|
25946
26180
|
if (doc.unlisted === true)
|
|
25947
|
-
|
|
26181
|
+
rows2.push(["unlisted", "yes"]);
|
|
25948
26182
|
if (doc.interactive === true) {
|
|
25949
26183
|
const connect = doc.interactiveConnectSrc ?? [];
|
|
25950
|
-
|
|
26184
|
+
rows2.push([
|
|
25951
26185
|
"interactive",
|
|
25952
26186
|
connect.length === 0 ? "yes" : `yes (connect-src: ${connect.join(" ")})`
|
|
25953
26187
|
]);
|
|
25954
26188
|
}
|
|
25955
26189
|
if (doc.allowSourceDownload !== void 0) {
|
|
25956
|
-
|
|
26190
|
+
rows2.push(["source download", doc.allowSourceDownload ? "allowed" : "off"]);
|
|
25957
26191
|
}
|
|
25958
26192
|
if (doc.allowExternalImages !== void 0) {
|
|
25959
|
-
|
|
26193
|
+
rows2.push(["external images", doc.allowExternalImages ? "allowed" : "blocked"]);
|
|
25960
26194
|
}
|
|
25961
26195
|
if (doc.requestAcknowledgment === true)
|
|
25962
|
-
|
|
26196
|
+
rows2.push(["request ack", "yes"]);
|
|
25963
26197
|
if (doc.notifyOnView === true)
|
|
25964
|
-
|
|
26198
|
+
rows2.push(["notify on view", "yes"]);
|
|
25965
26199
|
if (doc.retainVersions !== void 0)
|
|
25966
|
-
|
|
26200
|
+
rows2.push(["retain versions", String(doc.retainVersions)]);
|
|
25967
26201
|
if (doc.viewCount !== void 0)
|
|
25968
|
-
|
|
25969
|
-
|
|
26202
|
+
rows2.push(["views", String(doc.viewCount)]);
|
|
26203
|
+
rows2.push(["last viewed", when(doc.lastViewedAt)]);
|
|
25970
26204
|
if (doc.awareness !== void 0)
|
|
25971
|
-
|
|
25972
|
-
return keyValueBlock(
|
|
26205
|
+
rows2.push(["editing", describeAwareness(doc.awareness)]);
|
|
26206
|
+
return keyValueBlock(rows2);
|
|
25973
26207
|
}
|
|
25974
26208
|
function formatReaderDocument(meta3, host) {
|
|
25975
26209
|
const provenance = meta3.provenance;
|
|
25976
|
-
const
|
|
26210
|
+
const rows2 = [
|
|
25977
26211
|
["title", meta3.title],
|
|
25978
26212
|
["url", documentUrl(hostWithoutScheme(host), meta3.handle, meta3.slug)],
|
|
25979
26213
|
[
|
|
@@ -25987,9 +26221,9 @@ function formatReaderDocument(meta3, host) {
|
|
|
25987
26221
|
["updated", provenance?.updatedAt]
|
|
25988
26222
|
];
|
|
25989
26223
|
if (provenance !== void 0 && provenance.appearsIn.length > 0) {
|
|
25990
|
-
|
|
26224
|
+
rows2.push(["appears in", provenance.appearsIn.map((c) => c.name).join(", ")]);
|
|
25991
26225
|
}
|
|
25992
|
-
return keyValueBlock(
|
|
26226
|
+
return keyValueBlock(rows2);
|
|
25993
26227
|
}
|
|
25994
26228
|
registerOutput("doc-get", {
|
|
25995
26229
|
json: (data) => data.response,
|
|
@@ -26071,7 +26305,7 @@ ${SOURCE_HINT(slug)}`, {
|
|
|
26071
26305
|
}
|
|
26072
26306
|
throw err;
|
|
26073
26307
|
}
|
|
26074
|
-
const bytes = await client.fetchSigned(link.url, "source file");
|
|
26308
|
+
const bytes = await client.fetchSigned(link.url, "source file", link.headers);
|
|
26075
26309
|
return emitBytes(bytes, {
|
|
26076
26310
|
out,
|
|
26077
26311
|
fallbackName: link.filename,
|
|
@@ -26116,7 +26350,7 @@ async function readCommand(ctx, writer = nodeWriteFile) {
|
|
|
26116
26350
|
bytes = new Uint8Array(Buffer.from(content.data, "base64"));
|
|
26117
26351
|
}
|
|
26118
26352
|
else if (content.dataUrl !== void 0) {
|
|
26119
|
-
bytes = await client.fetchSigned(content.dataUrl, "document");
|
|
26353
|
+
bytes = await client.fetchSigned(content.dataUrl, "document", content.dataHeaders);
|
|
26120
26354
|
}
|
|
26121
26355
|
else {
|
|
26122
26356
|
bytes = new Uint8Array();
|
|
@@ -26559,7 +26793,7 @@ async function versionsSource(ctx, writer = nodeWriteFile) {
|
|
|
26559
26793
|
const { handle, slug } = await resolveDocumentRef(ctx, ref);
|
|
26560
26794
|
const client = await ctx.client();
|
|
26561
26795
|
const link = await client.getVersionSource(handle, slug, version2);
|
|
26562
|
-
const bytes = await client.fetchSigned(link.url, "version source");
|
|
26796
|
+
const bytes = await client.fetchSigned(link.url, "version source", link.headers);
|
|
26563
26797
|
return emitBytes(bytes, {
|
|
26564
26798
|
out,
|
|
26565
26799
|
fallbackName: link.filename,
|
|
@@ -26616,7 +26850,7 @@ async function versionsDiff(ctx) {
|
|
|
26616
26850
|
const client = await ctx.client();
|
|
26617
26851
|
const [left, right] = await Promise.all([from, to].map(async (version2) => {
|
|
26618
26852
|
const link = await client.getVersionSource(handle, slug, version2);
|
|
26619
|
-
const bytes = await client.fetchSigned(link.url, "version source");
|
|
26853
|
+
const bytes = await client.fetchSigned(link.url, "version source", link.headers);
|
|
26620
26854
|
return { filename: link.filename, bytes };
|
|
26621
26855
|
}));
|
|
26622
26856
|
if (left === void 0 || right === void 0)
|
|
@@ -26693,7 +26927,7 @@ var RESTORE_USAGE = buildUsage({
|
|
|
26693
26927
|
examples: ["handout workspaces restore acme"]
|
|
26694
26928
|
});
|
|
26695
26929
|
var CONTEXT5 = (sub) => `on handout workspaces ${sub}`;
|
|
26696
|
-
var
|
|
26930
|
+
var DAY_MS2 = 86400000;
|
|
26697
26931
|
function parseName2(value, flag = "--name") {
|
|
26698
26932
|
const name = value.trim();
|
|
26699
26933
|
if (name === "")
|
|
@@ -26867,7 +27101,7 @@ async function runDelete2(ctx) {
|
|
|
26867
27101
|
const explicit = scanned.positionals[0];
|
|
26868
27102
|
requireAnswerable(ctx);
|
|
26869
27103
|
const handle = await targetHandle(ctx, explicit);
|
|
26870
|
-
const purgeOn = new Date(ctx.now().getTime() + 30 *
|
|
27104
|
+
const purgeOn = new Date(ctx.now().getTime() + 30 * DAY_MS2).toISOString().slice(0, 10);
|
|
26871
27105
|
const confirmed = await ctx.confirm(`This schedules workspace "${handle}" and every document in it for deletion on ${purgeOn}. Type "y" to confirm: `);
|
|
26872
27106
|
if (!confirmed)
|
|
26873
27107
|
return result("cancelled", { message: "Deletion cancelled." });
|
|
@@ -27734,8 +27968,8 @@ function followingRow(item) {
|
|
|
27734
27968
|
function recentRow(item) {
|
|
27735
27969
|
return fields(item.targetType, item.url, item.title, `updated ${item.updatedAt}`, dormant(item));
|
|
27736
27970
|
}
|
|
27737
|
-
function section(title,
|
|
27738
|
-
return [title, ...
|
|
27971
|
+
function section(title, rows2) {
|
|
27972
|
+
return [title, ...rows2.length === 0 ? [" (none)"] : rows2.map((row2) => ` ${row2}`)];
|
|
27739
27973
|
}
|
|
27740
27974
|
function formatLibrary(response) {
|
|
27741
27975
|
return [
|
|
@@ -27908,12 +28142,54 @@ var commands9 = {
|
|
|
27908
28142
|
follow: { usage: FOLLOW_USAGE, run: runFollow },
|
|
27909
28143
|
unfollow: { usage: UNFOLLOW_USAGE, run: runUnfollow }
|
|
27910
28144
|
};
|
|
28145
|
+
var labels_exports = {};
|
|
28146
|
+
__export(labels_exports, {
|
|
28147
|
+
commands: () => commands10,
|
|
28148
|
+
formatLabels: () => formatLabels
|
|
28149
|
+
});
|
|
28150
|
+
var USAGE_TEXT = buildUsage({
|
|
28151
|
+
synopsis: ["handout labels"],
|
|
28152
|
+
description: "Shows the workspace's suggested labels with how many documents carry each, then any other labels in use. A label says what kind of document it is (plan, spec, report); a collection says what it belongs to. Pick from the suggested list and ask before inventing a label.",
|
|
28153
|
+
examples: ["handout labels", "handout labels --json"]
|
|
28154
|
+
});
|
|
28155
|
+
function rows(items) {
|
|
28156
|
+
const width = Math.max(0, ...items.map((item) => item.label.length));
|
|
28157
|
+
return items.map((item) => ` ${item.label.padEnd(width)} ${plural2(item.count, "document")}`);
|
|
28158
|
+
}
|
|
28159
|
+
function formatLabels(data) {
|
|
28160
|
+
const lines = [];
|
|
28161
|
+
if (data.suggested.length > 0) {
|
|
28162
|
+
lines.push("Suggested labels:", ...rows(data.suggested));
|
|
28163
|
+
}
|
|
28164
|
+
else if (data.seedable === true) {
|
|
28165
|
+
lines.push("No suggested labels yet. This workspace already uses labels, so none were added for you.", "Adopt the suggested set from the workspace's settings page.");
|
|
28166
|
+
}
|
|
28167
|
+
else {
|
|
28168
|
+
lines.push("No suggested labels.");
|
|
28169
|
+
}
|
|
28170
|
+
if (data.other.length > 0) {
|
|
28171
|
+
if (lines.length > 0)
|
|
28172
|
+
lines.push("");
|
|
28173
|
+
lines.push("Other labels in use (not suggested):", ...rows(data.other));
|
|
28174
|
+
}
|
|
28175
|
+
return lines.join("\n");
|
|
28176
|
+
}
|
|
28177
|
+
registerOutput("labels", passthrough(formatLabels));
|
|
28178
|
+
async function runLabels(ctx) {
|
|
28179
|
+
const context = "on handout labels";
|
|
28180
|
+
expectPositionals(scanArgs(ctx.args, { context, usage: USAGE_TEXT }), context, 0);
|
|
28181
|
+
const handle = await ctx.workspace();
|
|
28182
|
+
return result("labels", await (await ctx.client()).getWorkspaceLabels(handle));
|
|
28183
|
+
}
|
|
28184
|
+
var commands10 = {
|
|
28185
|
+
labels: { usage: USAGE_TEXT, run: runLabels }
|
|
28186
|
+
};
|
|
27911
28187
|
var usage_exports = {};
|
|
27912
28188
|
__export(usage_exports, {
|
|
27913
|
-
commands: () =>
|
|
28189
|
+
commands: () => commands11,
|
|
27914
28190
|
formatUsage: () => formatUsage
|
|
27915
28191
|
});
|
|
27916
|
-
var
|
|
28192
|
+
var USAGE_TEXT2 = buildUsage({
|
|
27917
28193
|
synopsis: ["handout usage"],
|
|
27918
28194
|
description: "Shows your account's documents against its limit across all your workspaces, then storage per workspace and per document, biggest documents first.",
|
|
27919
28195
|
examples: ["handout usage", "handout usage --json"]
|
|
@@ -27941,14 +28217,14 @@ function formatUsage(usage) {
|
|
|
27941
28217
|
}
|
|
27942
28218
|
async function runUsage(ctx) {
|
|
27943
28219
|
const context = "on handout usage";
|
|
27944
|
-
expectPositionals(scanArgs(ctx.args, { context, usage:
|
|
28220
|
+
expectPositionals(scanArgs(ctx.args, { context, usage: USAGE_TEXT2 }), context, 0);
|
|
27945
28221
|
if (ctx.global.workspace !== void 0)
|
|
27946
28222
|
throw usageError(WORKSPACE_REFUSED);
|
|
27947
28223
|
return result("usage", await (await ctx.client()).getUsage());
|
|
27948
28224
|
}
|
|
27949
28225
|
registerOutput("usage", { json: (data) => data, text: formatUsage });
|
|
27950
|
-
var
|
|
27951
|
-
usage: { usage:
|
|
28226
|
+
var commands11 = {
|
|
28227
|
+
usage: { usage: USAGE_TEXT2, run: runUsage }
|
|
27952
28228
|
};
|
|
27953
28229
|
var skill_exports = {};
|
|
27954
28230
|
__export(skill_exports, {
|
|
@@ -27956,7 +28232,7 @@ __export(skill_exports, {
|
|
|
27956
28232
|
SKILL_AGENTS: () => SKILL_AGENTS,
|
|
27957
28233
|
SKILL_FOLDER: () => SKILL_FOLDER,
|
|
27958
28234
|
agentSkillsDir: () => agentSkillsDir,
|
|
27959
|
-
commands: () =>
|
|
28235
|
+
commands: () => commands12,
|
|
27960
28236
|
packagedSkillPath: () => packagedSkillPath
|
|
27961
28237
|
});
|
|
27962
28238
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -27993,7 +28269,7 @@ function packagedSkillPath(env, moduleUrl = import.meta.url) {
|
|
|
27993
28269
|
if (override !== void 0 && override !== "")
|
|
27994
28270
|
return resolve(override);
|
|
27995
28271
|
const here = dirname2(fileURLToPath(moduleUrl));
|
|
27996
|
-
const bundled = "1.
|
|
28272
|
+
const bundled = "1.4.0".length > 0;
|
|
27997
28273
|
return bundled ? join4(here, "SKILL.md") : join4(here, "..", "..", "SKILL.md");
|
|
27998
28274
|
}
|
|
27999
28275
|
var INSTALL_USAGE = buildUsage({
|
|
@@ -28129,7 +28405,7 @@ ${INSTALL_USAGE}`);
|
|
|
28129
28405
|
};
|
|
28130
28406
|
return result("skill-install", data);
|
|
28131
28407
|
}
|
|
28132
|
-
var
|
|
28408
|
+
var commands12 = {
|
|
28133
28409
|
"skill install": { usage: INSTALL_USAGE, run: runSkillInstall }
|
|
28134
28410
|
};
|
|
28135
28411
|
import { realpathSync } from "node:fs";
|
|
@@ -28281,6 +28557,7 @@ var COMMAND_TREE = {
|
|
|
28281
28557
|
acks: { modules: ["documents", "manage"], summary: "Show who acknowledged a document" },
|
|
28282
28558
|
list: { modules: ["documents"], summary: "List your documents" },
|
|
28283
28559
|
get: { modules: ["documents"], summary: "Show a document's details" },
|
|
28560
|
+
labels: { modules: ["labels"], summary: "Show the suggested labels and how often each is used" },
|
|
28284
28561
|
search: { modules: ["documents"], summary: "Search your documents" },
|
|
28285
28562
|
source: { modules: ["documents"], summary: "Download a document's source" },
|
|
28286
28563
|
open: { modules: ["documents"], summary: "Print (or open) a document's link" },
|
|
@@ -28362,14 +28639,14 @@ var COMMAND_TREE = {
|
|
|
28362
28639
|
help: { modules: [], summary: "Show help for a command" }
|
|
28363
28640
|
};
|
|
28364
28641
|
function buildGlobalUsage() {
|
|
28365
|
-
const
|
|
28642
|
+
const rows2 = GLOBAL_FLAGS.map((f) => [
|
|
28366
28643
|
`${f.alias === void 0 ? "" : `${f.alias}, `}${f.flag}${f.value === void 0 ? "" : ` ${f.value}`}`,
|
|
28367
28644
|
f.description
|
|
28368
28645
|
]);
|
|
28369
|
-
|
|
28370
|
-
const width = Math.max(...
|
|
28646
|
+
rows2.push(["--version", "Print the CLI version"]);
|
|
28647
|
+
const width = Math.max(...rows2.map(([label]) => label.length));
|
|
28371
28648
|
const lines = ["Usage: handout <command> [subcommand] [args] [flags]", "", "Global flags:"];
|
|
28372
|
-
for (const [label, description] of
|
|
28649
|
+
for (const [label, description] of rows2)
|
|
28373
28650
|
lines.push(` ${label.padEnd(width)} ${description}`);
|
|
28374
28651
|
lines.push("", "Commands:");
|
|
28375
28652
|
const names = Object.entries(COMMAND_TREE).filter(([, entry]) => entry.deferred !== true);
|
|
@@ -28414,6 +28691,8 @@ async function importModule(name) {
|
|
|
28414
28691
|
return Promise.resolve(auth_exports);
|
|
28415
28692
|
case "library":
|
|
28416
28693
|
return Promise.resolve(library_exports);
|
|
28694
|
+
case "labels":
|
|
28695
|
+
return Promise.resolve(labels_exports);
|
|
28417
28696
|
case "usage":
|
|
28418
28697
|
return Promise.resolve(usage_exports);
|
|
28419
28698
|
case "skill":
|
|
@@ -28579,7 +28858,7 @@ function createContext(command, args, global, host, deps) {
|
|
|
28579
28858
|
};
|
|
28580
28859
|
}
|
|
28581
28860
|
async function familyUsage(name, entry, deps) {
|
|
28582
|
-
const
|
|
28861
|
+
const rows2 = [];
|
|
28583
28862
|
for (const moduleName of entry.modules) {
|
|
28584
28863
|
const mod = await loadCommandModule(moduleName, deps);
|
|
28585
28864
|
if (mod === void 0)
|
|
@@ -28588,14 +28867,14 @@ async function familyUsage(name, entry, deps) {
|
|
|
28588
28867
|
if (!key.startsWith(`${name} `))
|
|
28589
28868
|
continue;
|
|
28590
28869
|
const first = def.usage.split("\n")[0]?.replace(/^Usage:\s*/, "") ?? key;
|
|
28591
|
-
|
|
28870
|
+
rows2.push(` ${first}`);
|
|
28592
28871
|
}
|
|
28593
28872
|
}
|
|
28594
28873
|
return [
|
|
28595
28874
|
`Usage: handout ${name} <subcommand> [args] [flags]`,
|
|
28596
28875
|
"",
|
|
28597
28876
|
"Subcommands:",
|
|
28598
|
-
...
|
|
28877
|
+
...rows2,
|
|
28599
28878
|
"",
|
|
28600
28879
|
`Run handout ${name} <subcommand> --help for that subcommand's flags.`
|
|
28601
28880
|
].join("\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usehandout/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The handout command: publish HTML, Markdown and PDF files as Handout links, and the agent skill that lets Claude Code, Codex and other agents do it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"handout",
|