@catafal/notion-cli 5.9.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/LICENSE +21 -0
- package/README.md +552 -0
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +14 -0
- package/bin/run.cmd +3 -0
- package/dist/base-command.d.ts +73 -0
- package/dist/base-command.js +179 -0
- package/dist/base-flags.d.ts +14 -0
- package/dist/base-flags.js +59 -0
- package/dist/cache.d.ts +84 -0
- package/dist/cache.js +351 -0
- package/dist/commands/append.d.ts +37 -0
- package/dist/commands/append.js +120 -0
- package/dist/commands/batch/delete.d.ts +42 -0
- package/dist/commands/batch/delete.js +199 -0
- package/dist/commands/batch/retrieve.d.ts +43 -0
- package/dist/commands/batch/retrieve.js +272 -0
- package/dist/commands/block/append.d.ts +42 -0
- package/dist/commands/block/append.js +219 -0
- package/dist/commands/block/delete.d.ts +30 -0
- package/dist/commands/block/delete.js +97 -0
- package/dist/commands/block/retrieve/children.d.ts +31 -0
- package/dist/commands/block/retrieve/children.js +177 -0
- package/dist/commands/block/retrieve.d.ts +30 -0
- package/dist/commands/block/retrieve.js +101 -0
- package/dist/commands/block/update.d.ts +45 -0
- package/dist/commands/block/update.js +242 -0
- package/dist/commands/bookmark/list.d.ts +30 -0
- package/dist/commands/bookmark/list.js +60 -0
- package/dist/commands/bookmark/remove.d.ts +26 -0
- package/dist/commands/bookmark/remove.js +47 -0
- package/dist/commands/bookmark/set.d.ts +29 -0
- package/dist/commands/bookmark/set.js +96 -0
- package/dist/commands/browse.d.ts +13 -0
- package/dist/commands/browse.js +44 -0
- package/dist/commands/cache/info.d.ts +19 -0
- package/dist/commands/cache/info.js +145 -0
- package/dist/commands/config/set-token.d.ts +22 -0
- package/dist/commands/config/set-token.js +137 -0
- package/dist/commands/daily/index.d.ts +32 -0
- package/dist/commands/daily/index.js +135 -0
- package/dist/commands/daily/setup.d.ts +42 -0
- package/dist/commands/daily/setup.js +149 -0
- package/dist/commands/db/create.d.ts +31 -0
- package/dist/commands/db/create.js +124 -0
- package/dist/commands/db/query.d.ts +41 -0
- package/dist/commands/db/query.js +360 -0
- package/dist/commands/db/retrieve.d.ts +33 -0
- package/dist/commands/db/retrieve.js +134 -0
- package/dist/commands/db/schema.d.ts +32 -0
- package/dist/commands/db/schema.js +308 -0
- package/dist/commands/db/update.d.ts +31 -0
- package/dist/commands/db/update.js +117 -0
- package/dist/commands/doctor.d.ts +50 -0
- package/dist/commands/doctor.js +420 -0
- package/dist/commands/init.d.ts +65 -0
- package/dist/commands/init.js +479 -0
- package/dist/commands/list.d.ts +29 -0
- package/dist/commands/list.js +219 -0
- package/dist/commands/open.d.ts +29 -0
- package/dist/commands/open.js +100 -0
- package/dist/commands/page/create.d.ts +33 -0
- package/dist/commands/page/create.js +261 -0
- package/dist/commands/page/delete.d.ts +36 -0
- package/dist/commands/page/delete.js +107 -0
- package/dist/commands/page/export.d.ts +38 -0
- package/dist/commands/page/export.js +120 -0
- package/dist/commands/page/retrieve/property_item.d.ts +24 -0
- package/dist/commands/page/retrieve/property_item.js +75 -0
- package/dist/commands/page/retrieve.d.ts +36 -0
- package/dist/commands/page/retrieve.js +244 -0
- package/dist/commands/page/update.d.ts +34 -0
- package/dist/commands/page/update.js +184 -0
- package/dist/commands/quick.d.ts +35 -0
- package/dist/commands/quick.js +168 -0
- package/dist/commands/search.d.ts +43 -0
- package/dist/commands/search.js +361 -0
- package/dist/commands/stats.d.ts +35 -0
- package/dist/commands/stats.js +274 -0
- package/dist/commands/sync.d.ts +24 -0
- package/dist/commands/sync.js +183 -0
- package/dist/commands/template/get.d.ts +28 -0
- package/dist/commands/template/get.js +59 -0
- package/dist/commands/template/list.d.ts +32 -0
- package/dist/commands/template/list.js +62 -0
- package/dist/commands/template/remove.d.ts +27 -0
- package/dist/commands/template/remove.js +48 -0
- package/dist/commands/template/save.d.ts +32 -0
- package/dist/commands/template/save.js +92 -0
- package/dist/commands/template/use.d.ts +34 -0
- package/dist/commands/template/use.js +142 -0
- package/dist/commands/user/list.d.ts +27 -0
- package/dist/commands/user/list.js +99 -0
- package/dist/commands/user/retrieve/bot.d.ts +28 -0
- package/dist/commands/user/retrieve/bot.js +96 -0
- package/dist/commands/user/retrieve.d.ts +30 -0
- package/dist/commands/user/retrieve.js +103 -0
- package/dist/commands/whoami.d.ts +19 -0
- package/dist/commands/whoami.js +175 -0
- package/dist/deduplication.d.ts +41 -0
- package/dist/deduplication.js +71 -0
- package/dist/envelope.d.ts +169 -0
- package/dist/envelope.js +257 -0
- package/dist/errors/enhanced-errors.d.ts +168 -0
- package/dist/errors/enhanced-errors.js +567 -0
- package/dist/errors/index.d.ts +18 -0
- package/dist/errors/index.js +33 -0
- package/dist/examples/cache-retry-examples.d.ts +64 -0
- package/dist/examples/cache-retry-examples.js +375 -0
- package/dist/helper.d.ts +102 -0
- package/dist/helper.js +885 -0
- package/dist/http-agent.d.ts +38 -0
- package/dist/http-agent.js +60 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/interface.d.ts +4 -0
- package/dist/interface.js +2 -0
- package/dist/notion.d.ts +144 -0
- package/dist/notion.js +547 -0
- package/dist/retry.d.ts +72 -0
- package/dist/retry.js +381 -0
- package/dist/utils/bookmarks.d.ts +32 -0
- package/dist/utils/bookmarks.js +98 -0
- package/dist/utils/daily-config.d.ts +22 -0
- package/dist/utils/daily-config.js +60 -0
- package/dist/utils/disk-cache.d.ts +80 -0
- package/dist/utils/disk-cache.js +291 -0
- package/dist/utils/fuzzy.d.ts +36 -0
- package/dist/utils/fuzzy.js +69 -0
- package/dist/utils/interactive-navigator.d.ts +63 -0
- package/dist/utils/interactive-navigator.js +123 -0
- package/dist/utils/markdown-to-blocks.d.ts +21 -0
- package/dist/utils/markdown-to-blocks.js +333 -0
- package/dist/utils/notion-resolver.d.ts +49 -0
- package/dist/utils/notion-resolver.js +278 -0
- package/dist/utils/notion-url-parser.d.ts +48 -0
- package/dist/utils/notion-url-parser.js +121 -0
- package/dist/utils/property-expander.d.ts +45 -0
- package/dist/utils/property-expander.js +323 -0
- package/dist/utils/schema-examples.d.ts +40 -0
- package/dist/utils/schema-examples.js +359 -0
- package/dist/utils/schema-extractor.d.ts +65 -0
- package/dist/utils/schema-extractor.js +235 -0
- package/dist/utils/shell-config.d.ts +30 -0
- package/dist/utils/shell-config.js +84 -0
- package/dist/utils/table-formatter.d.ts +36 -0
- package/dist/utils/table-formatter.js +125 -0
- package/dist/utils/templates.d.ts +30 -0
- package/dist/utils/templates.js +82 -0
- package/dist/utils/terminal-banner.d.ts +24 -0
- package/dist/utils/terminal-banner.js +34 -0
- package/dist/utils/token-validator.d.ts +42 -0
- package/dist/utils/token-validator.js +66 -0
- package/dist/utils/update-notifier.d.ts +26 -0
- package/dist/utils/update-notifier.js +54 -0
- package/dist/utils/workspace-cache.d.ts +58 -0
- package/dist/utils/workspace-cache.js +185 -0
- package/oclif.manifest.json +6471 -0
- package/package.json +118 -0
- package/scripts/banner.js +38 -0
- package/scripts/postinstall.js +44 -0
package/package.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@catafal/notion-cli",
|
|
3
|
+
"version": "5.9.0",
|
|
4
|
+
"description": "Unofficial Notion CLI optimized for automation and AI agents. Non-interactive interface for Notion API v5.2.1 with intelligent caching, retry logic, structured error handling, and comprehensive testing.",
|
|
5
|
+
"author": "Jake Schepis <jake@coastalprograms.com>",
|
|
6
|
+
"bin": {
|
|
7
|
+
"notion-cli": "./bin/run"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Catafal/notion-cli#readme",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/Catafal/notion-cli.git"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"/bin",
|
|
18
|
+
"/dist",
|
|
19
|
+
"/scripts",
|
|
20
|
+
"/oclif.manifest.json"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@inquirer/select": "^5.0.7",
|
|
24
|
+
"@notionhq/client": "^5.9.0",
|
|
25
|
+
"@oclif/core": "^4.8.0",
|
|
26
|
+
"@oclif/plugin-help": "^6.2.37",
|
|
27
|
+
"cli-table3": "^0.6.5",
|
|
28
|
+
"dayjs": "^1.11.19",
|
|
29
|
+
"notion-to-md": "^3.1.6",
|
|
30
|
+
"undici": "^7.20.0",
|
|
31
|
+
"update-notifier": "^7.3.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@oclif/test": "^3.2.15",
|
|
35
|
+
"@types/chai": "^4",
|
|
36
|
+
"@types/mocha": "^10.0.10",
|
|
37
|
+
"@types/node": "^22.19.8",
|
|
38
|
+
"@types/sinon": "^21.0.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
41
|
+
"chai": "^4",
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
|
+
"eslint-config-oclif": "^6.0.137",
|
|
44
|
+
"eslint-config-prettier": "^10.1.8",
|
|
45
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
46
|
+
"eslint-plugin-n": "^17.23.2",
|
|
47
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
48
|
+
"globby": "^11",
|
|
49
|
+
"mocha": "^11.7.5",
|
|
50
|
+
"nock": "^13.5.6",
|
|
51
|
+
"node-fetch": "^2.7.0",
|
|
52
|
+
"nyc": "^17.1.0",
|
|
53
|
+
"oclif": "^4.22.73",
|
|
54
|
+
"prettier": "^3.8.1",
|
|
55
|
+
"shx": "^0.4.0",
|
|
56
|
+
"sinon": "^21.0.1",
|
|
57
|
+
"ts-node": "^10.9.2",
|
|
58
|
+
"tslib": "^2.8.1",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"typescript-eslint": "^8.54.0"
|
|
61
|
+
},
|
|
62
|
+
"oclif": {
|
|
63
|
+
"bin": "notion-cli",
|
|
64
|
+
"dirname": "notion-cli",
|
|
65
|
+
"commands": "./dist/commands",
|
|
66
|
+
"plugins": [
|
|
67
|
+
"@oclif/plugin-help"
|
|
68
|
+
],
|
|
69
|
+
"topicSeparator": " ",
|
|
70
|
+
"topics": {
|
|
71
|
+
"hello": {
|
|
72
|
+
"description": "Say hello to the world and others"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -b",
|
|
78
|
+
"lint": "eslint .",
|
|
79
|
+
"postpack": "node -e \"try{require('fs').unlinkSync('oclif.manifest.json')}catch{}\" || true",
|
|
80
|
+
"postinstall": "node scripts/postinstall.js",
|
|
81
|
+
"prepack": "(npm run build && oclif manifest) || true",
|
|
82
|
+
"test": "TS_NODE_PROJECT=tsconfig.test.json mocha --forbid-only \"test/**/*.test.ts\"",
|
|
83
|
+
"readme": "oclif readme --multi --no-aliases && shx sed -i \"s/^_See code:.*$//g\" docs/*.md > /dev/null",
|
|
84
|
+
"test:coverage": "nyc --reporter=lcov --reporter=text npm test"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=22.0.0"
|
|
88
|
+
},
|
|
89
|
+
"overrides": {
|
|
90
|
+
"minimatch": ">=10.2.1"
|
|
91
|
+
},
|
|
92
|
+
"bugs": {
|
|
93
|
+
"url": "https://github.com/Catafal/notion-cli/issues",
|
|
94
|
+
"email": "jake@coastalprograms.com"
|
|
95
|
+
},
|
|
96
|
+
"keywords": [
|
|
97
|
+
"notion",
|
|
98
|
+
"cli",
|
|
99
|
+
"notion-api",
|
|
100
|
+
"notion-cli",
|
|
101
|
+
"ai-agents",
|
|
102
|
+
"automation",
|
|
103
|
+
"productivity",
|
|
104
|
+
"database",
|
|
105
|
+
"workspace",
|
|
106
|
+
"schema-discovery",
|
|
107
|
+
"workspace-cache",
|
|
108
|
+
"database-sync",
|
|
109
|
+
"simple-properties",
|
|
110
|
+
"json-envelope",
|
|
111
|
+
"typescript",
|
|
112
|
+
"oclif",
|
|
113
|
+
"notion-integration",
|
|
114
|
+
"command-line",
|
|
115
|
+
"developer-tools"
|
|
116
|
+
],
|
|
117
|
+
"types": "dist/index.d.ts"
|
|
118
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal banner and color utilities for consistent branding
|
|
3
|
+
* Shared between postinstall script and TypeScript source
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ANSI color codes for cross-platform terminal compatibility
|
|
8
|
+
*/
|
|
9
|
+
const colors = {
|
|
10
|
+
reset: '\x1b[0m',
|
|
11
|
+
bright: '\x1b[1m',
|
|
12
|
+
dim: '\x1b[2m',
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
blue: '\x1b[34m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
gray: '\x1b[90m',
|
|
17
|
+
yellow: '\x1b[33m',
|
|
18
|
+
magenta: '\x1b[35m',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* ASCII art banner for Notion CLI
|
|
23
|
+
* Displayed during install and setup
|
|
24
|
+
* Uses terminal's default color (black/white depending on theme)
|
|
25
|
+
*/
|
|
26
|
+
const ASCII_BANNER = `
|
|
27
|
+
███╗ ██╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗ ██████╗██╗ ██╗
|
|
28
|
+
████╗ ██║██╔═══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║ ██╔════╝██║ ██║
|
|
29
|
+
██╔██╗ ██║██║ ██║ ██║ ██║██║ ██║██╔██╗ ██║ ██║ ██║ ██║
|
|
30
|
+
██║╚██╗██║██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██║ ██║ ██║
|
|
31
|
+
██║ ╚████║╚██████╔╝ ██║ ██║╚██████╔╝██║ ╚████║ ╚██████╗███████╗██║
|
|
32
|
+
╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝
|
|
33
|
+
`
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
colors,
|
|
37
|
+
ASCII_BANNER,
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-install script for @catafal/notion-cli
|
|
5
|
+
* Shows welcome message and next steps after installation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Respect npm's --silent flag
|
|
9
|
+
const isSilent = process.env.npm_config_loglevel === 'silent';
|
|
10
|
+
if (isSilent) {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Import shared banner and colors
|
|
15
|
+
const { colors, ASCII_BANNER } = require('./banner');
|
|
16
|
+
|
|
17
|
+
// Graceful error handling - don't break installation
|
|
18
|
+
try {
|
|
19
|
+
const packageJson = require('../package.json');
|
|
20
|
+
const version = packageJson.version;
|
|
21
|
+
|
|
22
|
+
// Welcome message with banner and clear next steps
|
|
23
|
+
console.log(ASCII_BANNER);
|
|
24
|
+
console.log(`${colors.green}✓${colors.reset} Version ${colors.bright}${version}${colors.reset} installed successfully!\n`);
|
|
25
|
+
console.log(`${colors.blue}Quick Start:${colors.reset}`);
|
|
26
|
+
console.log(` ${colors.cyan}notion-cli init${colors.reset} ${colors.dim}# Interactive setup wizard${colors.reset}`);
|
|
27
|
+
console.log(` ${colors.cyan}notion-cli --help${colors.reset} ${colors.dim}# View all commands${colors.reset}\n`);
|
|
28
|
+
console.log(`${colors.blue}Resources:${colors.reset}`);
|
|
29
|
+
console.log(` ${colors.gray}•${colors.reset} Documentation: ${colors.dim}https://github.com/Catafal/notion-cli${colors.reset}`);
|
|
30
|
+
console.log(` ${colors.gray}•${colors.reset} Get API Token: ${colors.dim}https://developers.notion.com/docs/create-a-notion-integration${colors.reset}`);
|
|
31
|
+
console.log(` ${colors.gray}•${colors.reset} Report Issues: ${colors.dim}https://github.com/Catafal/notion-cli/issues${colors.reset}`);
|
|
32
|
+
console.log('');
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// Fallback to simple message if anything goes wrong
|
|
35
|
+
console.log(`
|
|
36
|
+
Notion CLI installed successfully!
|
|
37
|
+
|
|
38
|
+
Quick Start:
|
|
39
|
+
notion-cli init # Interactive setup wizard
|
|
40
|
+
notion-cli --help # View all commands
|
|
41
|
+
|
|
42
|
+
Get help: https://github.com/Catafal/notion-cli
|
|
43
|
+
`);
|
|
44
|
+
}
|