freshjots 0.4.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +47 -43
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,49 +1,8 @@
1
- # freshjots — JS, TS, Windows CLI
1
+ # freshjots — JS, TS, Windows CLI
2
2
 
3
3
  Tiny JavaScript client for the [Fresh Jots](https://freshjots.com) API.
4
4
  One file, zero dependencies (uses Node 18's global `fetch`).
5
5
 
6
- ## Install
7
-
8
- ```sh
9
- npm install freshjots
10
- ```
11
-
12
- (Or `pnpm add freshjots`, `yarn add freshjots`, `bun add freshjots`.)
13
-
14
- ## Use
15
-
16
- ```js
17
- import { Client } from "freshjots";
18
-
19
- // Reads FRESHJOTS_TOKEN from the environment by default.
20
- const client = new Client();
21
-
22
- // Append text to a note (creates it if missing).
23
- await client.append("cron-jobs-prod", "backup ok");
24
-
25
- // Read a note's body.
26
- const note = await client.note("cron-jobs-prod");
27
- console.log(note.plain_body);
28
-
29
- // List your notes (most recent activity first). Pass options to sort/filter:
30
- const notes = await client.notes({ sort: "created", folderId: 3, limit: 20 });
31
- for (const n of notes) console.log(`${n.id}\t${n.filename}\t${n.title}`);
32
-
33
- // Create a note. The API derives the filename from the title — for a
34
- // note addressable by an exact filename, use append() instead.
35
- const created = await client.create({ title: "Research 2026 Q2", body: "Initial outline." });
36
- console.log(created.filename); // server-derived stream name
37
- ```
38
-
39
- Client methods: `notes({ sort, folderId, limit, offset })`,
40
- `note(filename)`, `noteById(id)`, `create({ title, body })`,
41
- `append(filename, text)`, `remove(id)`, `move(id, folderId)`, and
42
- `folders()`. `note()`/`noteById()`/`create()` return the note object
43
- directly (no `{ note: … }` wrapper); `notes()` and `folders()` return
44
- arrays. For `notes()`, `sort` is `created|updated|appended` and
45
- `folderId` may be a folder id or `"none"` (un-foldered only).
46
-
47
6
  ## CLI
48
7
 
49
8
  Installing the package globally puts a `freshjots` command on your
@@ -54,7 +13,10 @@ automatically.
54
13
 
55
14
  ```sh
56
15
  npm install -g freshjots
57
- export FRESHJOTS_TOKEN=mn_… # PowerShell: $env:FRESHJOTS_TOKEN = "mn_…"
16
+
17
+ # Persist the token for every new shell (macOS defaults to zsh; use ~/.bashrc on bash):
18
+ echo 'export FRESHJOTS_TOKEN=mn_…' >> ~/.zshrc && source ~/.zshrc
19
+ # Windows PowerShell: [Environment]::SetEnvironmentVariable("FRESHJOTS_TOKEN", "mn_…", "User")
58
20
  ```
59
21
 
60
22
  The CLI covers reading, writing, and organizing notes:
@@ -71,6 +33,7 @@ freshjots append cron-jobs-prod "ok" # text may also be piped on stdin
71
33
  freshjots rm cron-jobs-prod # delete by id or filename
72
34
  freshjots mv cron-jobs-prod Work # move into a folder (id or name); --root to un-folder
73
35
  freshjots folders # prints "<id>\t<name>" per row
36
+ freshjots --version # print version (--help for full usage)
74
37
  ```
75
38
 
76
39
  Both `create` and `append` read from stdin when the body or text isn't
@@ -92,6 +55,47 @@ Exit codes: `0` on success, `1` on runtime errors (missing token,
92
55
  network failure, non-2xx API response — printed as `Error: HTTP <status>
93
56
  <code>: <message>`), `2` on usage errors.
94
57
 
58
+ ## Install
59
+
60
+ ```sh
61
+ npm install freshjots
62
+ ```
63
+
64
+ (Or `pnpm add freshjots`, `yarn add freshjots`, `bun add freshjots`.)
65
+
66
+ ## Use
67
+
68
+ ```js
69
+ import { Client } from "freshjots";
70
+
71
+ // Reads FRESHJOTS_TOKEN from the environment by default.
72
+ const client = new Client();
73
+
74
+ // Append text to a note (creates it if missing).
75
+ await client.append("cron-jobs-prod", "backup ok");
76
+
77
+ // Read a note's body.
78
+ const note = await client.note("cron-jobs-prod");
79
+ console.log(note.plain_body);
80
+
81
+ // List your notes (most recent activity first). Pass options to sort/filter:
82
+ const notes = await client.notes({ sort: "created", folderId: 3, limit: 20 });
83
+ for (const n of notes) console.log(`${n.id}\t${n.filename}\t${n.title}`);
84
+
85
+ // Create a note. The API derives the filename from the title — for a
86
+ // note addressable by an exact filename, use append() instead.
87
+ const created = await client.create({ title: "Research 2026 Q2", body: "Initial outline." });
88
+ console.log(created.filename); // server-derived stream name
89
+ ```
90
+
91
+ Client methods: `notes({ sort, folderId, limit, offset })`,
92
+ `note(filename)`, `noteById(id)`, `create({ title, body })`,
93
+ `append(filename, text)`, `remove(id)`, `move(id, folderId)`, and
94
+ `folders()`. `note()`/`noteById()`/`create()` return the note object
95
+ directly (no `{ note: … }` wrapper); `notes()` and `folders()` return
96
+ arrays. For `notes()`, `sort` is `created|updated|appended` and
97
+ `folderId` may be a folder id or `"none"` (un-foldered only).
98
+
95
99
  ## TypeScript
96
100
 
97
101
  Types ship with the package — no `@types/freshjots` needed, no `.d.ts`
package/index.js CHANGED
@@ -18,7 +18,7 @@
18
18
  // payload ({ "notes": [...] }). show / show-by-filename / create return
19
19
  // the note object at the TOP LEVEL — there is no { "note": ... } wrapper.
20
20
 
21
- export const VERSION = "0.4.0";
21
+ export const VERSION = "1.0.1";
22
22
  const DEFAULT_BASE_URL = "https://freshjots.com/api/v1";
23
23
 
24
24
  export class ApiError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freshjots",
3
- "version": "0.4.0",
3
+ "version": "1.0.1",
4
4
  "description": "Tiny JavaScript client for the Fresh Jots API. Append-only notebooks for cron jobs, deploy scripts, and bots.",
5
5
  "type": "module",
6
6
  "main": "index.js",