@rewrlution/papyrus-cli 0.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.
- package/README.md +699 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth/index.d.ts +2 -0
- package/dist/commands/auth/index.js +18 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/login.d.ts +1 -0
- package/dist/commands/auth/login.js +8 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +1 -0
- package/dist/commands/auth/logout.js +5 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/register.d.ts +1 -0
- package/dist/commands/auth/register.js +8 -0
- package/dist/commands/auth/register.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/journal/add.d.ts +2 -0
- package/dist/commands/journal/add.js +5 -0
- package/dist/commands/journal/add.js.map +1 -0
- package/dist/commands/journal/amend.d.ts +2 -0
- package/dist/commands/journal/amend.js +5 -0
- package/dist/commands/journal/amend.js.map +1 -0
- package/dist/commands/journal/edit.d.ts +6 -0
- package/dist/commands/journal/edit.js +60 -0
- package/dist/commands/journal/edit.js.map +1 -0
- package/dist/commands/journal/index.d.ts +2 -0
- package/dist/commands/journal/index.js +32 -0
- package/dist/commands/journal/index.js.map +1 -0
- package/dist/commands/journal/list.d.ts +1 -0
- package/dist/commands/journal/list.js +20 -0
- package/dist/commands/journal/list.js.map +1 -0
- package/dist/commands/journal/show.d.ts +2 -0
- package/dist/commands/journal/show.js +35 -0
- package/dist/commands/journal/show.js.map +1 -0
- package/dist/commands/journal/sync.d.ts +1 -0
- package/dist/commands/journal/sync.js +9 -0
- package/dist/commands/journal/sync.js.map +1 -0
- package/dist/commands/types.d.ts +9 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/components/Browser.d.ts +29 -0
- package/dist/components/Browser.js +124 -0
- package/dist/components/Browser.js.map +1 -0
- package/dist/components/BrowserFooter.d.ts +6 -0
- package/dist/components/BrowserFooter.js +6 -0
- package/dist/components/BrowserFooter.js.map +1 -0
- package/dist/components/BrowserHeader.d.ts +6 -0
- package/dist/components/BrowserHeader.js +6 -0
- package/dist/components/BrowserHeader.js.map +1 -0
- package/dist/components/ColdStart.d.ts +6 -0
- package/dist/components/ColdStart.js +24 -0
- package/dist/components/ColdStart.js.map +1 -0
- package/dist/components/FormInput.d.ts +10 -0
- package/dist/components/FormInput.js +7 -0
- package/dist/components/FormInput.js.map +1 -0
- package/dist/components/JournalListView.d.ts +10 -0
- package/dist/components/JournalListView.js +40 -0
- package/dist/components/JournalListView.js.map +1 -0
- package/dist/components/JournalViewer.d.ts +32 -0
- package/dist/components/JournalViewer.js +146 -0
- package/dist/components/JournalViewer.js.map +1 -0
- package/dist/components/LoginForm.d.ts +1 -0
- package/dist/components/LoginForm.js +68 -0
- package/dist/components/LoginForm.js.map +1 -0
- package/dist/components/Logo.d.ts +1 -0
- package/dist/components/Logo.js +57 -0
- package/dist/components/Logo.js.map +1 -0
- package/dist/components/RegisterForm.d.ts +1 -0
- package/dist/components/RegisterForm.js +72 -0
- package/dist/components/RegisterForm.js.map +1 -0
- package/dist/components/StatusMessage.d.ts +7 -0
- package/dist/components/StatusMessage.js +19 -0
- package/dist/components/StatusMessage.js.map +1 -0
- package/dist/components/SyncProgress.d.ts +1 -0
- package/dist/components/SyncProgress.js +46 -0
- package/dist/components/SyncProgress.js.map +1 -0
- package/dist/lib/api/api-client.d.ts +23 -0
- package/dist/lib/api/api-client.js +111 -0
- package/dist/lib/api/api-client.js.map +1 -0
- package/dist/lib/api/index.d.ts +3 -0
- package/dist/lib/api/index.js +6 -0
- package/dist/lib/api/index.js.map +1 -0
- package/dist/lib/auth/index.d.ts +1 -0
- package/dist/lib/auth/index.js +2 -0
- package/dist/lib/auth/index.js.map +1 -0
- package/dist/lib/auth/require-auth.d.ts +67 -0
- package/dist/lib/auth/require-auth.js +107 -0
- package/dist/lib/auth/require-auth.js.map +1 -0
- package/dist/lib/storage/base-storage.d.ts +50 -0
- package/dist/lib/storage/base-storage.js +91 -0
- package/dist/lib/storage/base-storage.js.map +1 -0
- package/dist/lib/storage/config-store.d.ts +40 -0
- package/dist/lib/storage/config-store.js +63 -0
- package/dist/lib/storage/config-store.js.map +1 -0
- package/dist/lib/storage/index.d.ts +12 -0
- package/dist/lib/storage/index.js +13 -0
- package/dist/lib/storage/index.js.map +1 -0
- package/dist/lib/storage/journal-storage.d.ts +46 -0
- package/dist/lib/storage/journal-storage.js +78 -0
- package/dist/lib/storage/journal-storage.js.map +1 -0
- package/dist/lib/storage/sync-meta-store.d.ts +37 -0
- package/dist/lib/storage/sync-meta-store.js +50 -0
- package/dist/lib/storage/sync-meta-store.js.map +1 -0
- package/dist/lib/storage/token-store.d.ts +25 -0
- package/dist/lib/storage/token-store.js +40 -0
- package/dist/lib/storage/token-store.js.map +1 -0
- package/dist/lib/sync/sync-engine.d.ts +13 -0
- package/dist/lib/sync/sync-engine.js +96 -0
- package/dist/lib/sync/sync-engine.js.map +1 -0
- package/dist/utils/date.d.ts +58 -0
- package/dist/utils/date.js +117 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/editor.d.ts +2 -0
- package/dist/utils/editor.js +81 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/template.d.ts +2 -0
- package/dist/utils/template.js +17 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/token.d.ts +20 -0
- package/dist/utils/token.js +64 -0
- package/dist/utils/token.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;CAQ9B,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,OAAO;SACX,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;SACnD,IAAI,CAAC,IAAI,CAAC;SACV,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes JWT token and returns expiration date
|
|
3
|
+
* @param token - jwt token
|
|
4
|
+
* @returns expiration date in milliseconds
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTokenExpiration(token: string): Date | null;
|
|
7
|
+
export declare function isTokenExpired(token: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if token will expire within the given threshold
|
|
10
|
+
* @param token - access token
|
|
11
|
+
* @param thresholdHours - hours before expiration to consider "expiring soon"
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function isTokenExpiringSoon(token: string, thresholdHours?: number): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Get time until token expiration in a human-readable format
|
|
17
|
+
* @param token - JWT token string
|
|
18
|
+
* @returns Human-readable time string or null if invalid/expired
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTimeUntilExpiration(token: string): string | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jwtDecode } from 'jwt-decode';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes JWT token and returns expiration date
|
|
4
|
+
* @param token - jwt token
|
|
5
|
+
* @returns expiration date in milliseconds
|
|
6
|
+
*/
|
|
7
|
+
export function getTokenExpiration(token) {
|
|
8
|
+
try {
|
|
9
|
+
const decoded = jwtDecode(token);
|
|
10
|
+
return new Date(decoded.exp * 1000); // convert seconds to milliseconds
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null; // invalid token
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function isTokenExpired(token) {
|
|
17
|
+
const expiration = getTokenExpiration(token);
|
|
18
|
+
if (!expiration)
|
|
19
|
+
return true; // treat invalid token as expired
|
|
20
|
+
return Date.now() >= expiration.getTime();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check if token will expire within the given threshold
|
|
24
|
+
* @param token - access token
|
|
25
|
+
* @param thresholdHours - hours before expiration to consider "expiring soon"
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export function isTokenExpiringSoon(token, thresholdHours = 24) {
|
|
29
|
+
const expiration = getTokenExpiration(token);
|
|
30
|
+
if (!expiration)
|
|
31
|
+
return false;
|
|
32
|
+
const thresholdMs = thresholdHours * 60 * 60 * 1000; // milliseconds
|
|
33
|
+
const timeUntilExpiry = expiration.getTime() - Date.now();
|
|
34
|
+
return timeUntilExpiry > 0 && timeUntilExpiry <= thresholdMs;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get time until token expiration in a human-readable format
|
|
38
|
+
* @param token - JWT token string
|
|
39
|
+
* @returns Human-readable time string or null if invalid/expired
|
|
40
|
+
*/
|
|
41
|
+
export function getTimeUntilExpiration(token) {
|
|
42
|
+
const expiration = getTokenExpiration(token);
|
|
43
|
+
if (!expiration) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const now = Date.now();
|
|
47
|
+
const timeUntilExpiration = expiration.getTime() - now;
|
|
48
|
+
if (timeUntilExpiration <= 0) {
|
|
49
|
+
return 'expired';
|
|
50
|
+
}
|
|
51
|
+
const hours = Math.floor(timeUntilExpiration / (1000 * 60 * 60));
|
|
52
|
+
const minutes = Math.floor((timeUntilExpiration % (1000 * 60 * 60)) / (1000 * 60));
|
|
53
|
+
if (hours > 24) {
|
|
54
|
+
const days = Math.floor(hours / 24);
|
|
55
|
+
return `${days} day${days > 1 ? 's' : ''}`;
|
|
56
|
+
}
|
|
57
|
+
else if (hours > 0) {
|
|
58
|
+
return `${hours} hour${hours > 1 ? 's' : ''}`;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return `${minutes} minute${minutes > 1 ? 's' : ''}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/utils/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAOvC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,SAAS,CAAa,KAAK,CAAC,CAAC;QAC7C,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,kCAAkC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,CAAC,gBAAgB;IAC/B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC,CAAC,iCAAiC;IAC/D,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,iBAAyB,EAAE;IAE3B,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE9B,MAAM,WAAW,GAAG,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,eAAe;IACpE,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE1D,OAAO,eAAe,GAAG,CAAC,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IACtD,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rewrlution/papyrus-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "AI-powered developer journaling CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"journal",
|
|
7
|
+
"productivity"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "rewrlution@gmail.com",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"pp": "./dist/cli.js",
|
|
17
|
+
"paper": "./dist/cli.js",
|
|
18
|
+
"papyrus": "./dist/cli.js"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "rimraf dist tsconfig.tsbuildinfo && tsc --build",
|
|
29
|
+
"dev": "tsx watch src/cli.tsx",
|
|
30
|
+
"start": "node dist/cli.js",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"prepublishOnly": "npm run build && npm run test"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@rewrlution/papyrus-shared": "workspace:*",
|
|
36
|
+
"axios": "^1.13.2",
|
|
37
|
+
"chalk": "^5.6.2",
|
|
38
|
+
"commander": "^14.0.2",
|
|
39
|
+
"date-fns": "^4.1.0",
|
|
40
|
+
"env-paths": "^3.0.0",
|
|
41
|
+
"gray-matter": "^4.0.3",
|
|
42
|
+
"ink": "^6.6.0",
|
|
43
|
+
"ink-spinner": "^5.0.0",
|
|
44
|
+
"ink-text-input": "^6.0.0",
|
|
45
|
+
"jwt-decode": "^4.0.0",
|
|
46
|
+
"react": "^19.2.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^25.0.3",
|
|
50
|
+
"@types/react": "^19.2.7",
|
|
51
|
+
"tsx": "^4.21.0"
|
|
52
|
+
}
|
|
53
|
+
}
|