suparank 1.1.0 → 1.2.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/bin/suparank.js +82 -0
- package/mcp-client.js +12 -5
- package/package.json +1 -1
package/bin/suparank.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* npx suparank test - Test API connection
|
|
11
11
|
* npx suparank session - View current session state
|
|
12
12
|
* npx suparank clear - Clear session state
|
|
13
|
+
* npx suparank update - Check for updates and install latest version
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
import * as fs from 'fs'
|
|
@@ -513,6 +514,82 @@ function showVersion() {
|
|
|
513
514
|
log('https://suparank.io', 'dim')
|
|
514
515
|
}
|
|
515
516
|
|
|
517
|
+
async function checkForUpdates(showCurrent = false) {
|
|
518
|
+
const packageJson = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'))
|
|
519
|
+
const currentVersion = packageJson.version
|
|
520
|
+
|
|
521
|
+
if (showCurrent) {
|
|
522
|
+
log(`Current version: ${currentVersion}`, 'dim')
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
try {
|
|
526
|
+
const response = await fetch('https://registry.npmjs.org/suparank/latest')
|
|
527
|
+
if (response.ok) {
|
|
528
|
+
const data = await response.json()
|
|
529
|
+
return { current: currentVersion, latest: data.version }
|
|
530
|
+
}
|
|
531
|
+
} catch (e) {
|
|
532
|
+
// Ignore fetch errors
|
|
533
|
+
}
|
|
534
|
+
return { current: currentVersion, latest: null }
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
async function runUpdate() {
|
|
538
|
+
logHeader('Suparank Update')
|
|
539
|
+
|
|
540
|
+
log('Checking for updates...', 'yellow')
|
|
541
|
+
const { current, latest } = await checkForUpdates(true)
|
|
542
|
+
|
|
543
|
+
if (!latest) {
|
|
544
|
+
log('Could not check for updates. Please try again later.', 'red')
|
|
545
|
+
return
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
log(`Latest version: ${latest}`, 'dim')
|
|
549
|
+
console.log()
|
|
550
|
+
|
|
551
|
+
if (current === latest) {
|
|
552
|
+
log('You are already on the latest version!', 'green')
|
|
553
|
+
return
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Show what will be preserved
|
|
557
|
+
log('Your data is safe:', 'cyan')
|
|
558
|
+
log(' ~/.suparank/config.json (API key, project)', 'dim')
|
|
559
|
+
log(' ~/.suparank/credentials.json (WordPress, Ghost, etc.)', 'dim')
|
|
560
|
+
log(' ~/.suparank/session.json (Current session)', 'dim')
|
|
561
|
+
log(' ~/.suparank/content/ (Saved articles)', 'dim')
|
|
562
|
+
console.log()
|
|
563
|
+
|
|
564
|
+
log(`Updating from v${current} to v${latest}...`, 'yellow')
|
|
565
|
+
console.log()
|
|
566
|
+
|
|
567
|
+
// Clear npx cache and reinstall
|
|
568
|
+
const { execSync } = await import('child_process')
|
|
569
|
+
|
|
570
|
+
try {
|
|
571
|
+
// Clear the npx cache for suparank
|
|
572
|
+
log('Clearing cache...', 'dim')
|
|
573
|
+
execSync('npx clear-npx-cache 2>/dev/null || true', { stdio: 'pipe' })
|
|
574
|
+
|
|
575
|
+
// Force npx to fetch the latest version
|
|
576
|
+
log('Downloading latest version...', 'dim')
|
|
577
|
+
execSync('npm cache clean --force 2>/dev/null || true', { stdio: 'pipe' })
|
|
578
|
+
|
|
579
|
+
console.log()
|
|
580
|
+
log(`Updated to v${latest}!`, 'green')
|
|
581
|
+
console.log()
|
|
582
|
+
log('Run "npx suparank@latest" to use the new version.', 'cyan')
|
|
583
|
+
log('Or restart your AI client to pick up changes.', 'dim')
|
|
584
|
+
} catch (e) {
|
|
585
|
+
log(`Update failed: ${e.message}`, 'red')
|
|
586
|
+
console.log()
|
|
587
|
+
log('Try manually:', 'dim')
|
|
588
|
+
log(' npm cache clean --force', 'cyan')
|
|
589
|
+
log(' npx suparank@latest', 'cyan')
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
516
593
|
function runMCP() {
|
|
517
594
|
const config = loadConfig()
|
|
518
595
|
|
|
@@ -581,6 +658,10 @@ switch (command) {
|
|
|
581
658
|
case 'clear':
|
|
582
659
|
clearSession()
|
|
583
660
|
break
|
|
661
|
+
case 'update':
|
|
662
|
+
case 'upgrade':
|
|
663
|
+
runUpdate()
|
|
664
|
+
break
|
|
584
665
|
case 'version':
|
|
585
666
|
case '-v':
|
|
586
667
|
case '--version':
|
|
@@ -601,6 +682,7 @@ switch (command) {
|
|
|
601
682
|
log(' test Test API connection', 'dim')
|
|
602
683
|
log(' session View current session state', 'dim')
|
|
603
684
|
log(' clear Clear session state', 'dim')
|
|
685
|
+
log(' update Check for updates and install latest', 'dim')
|
|
604
686
|
log(' version Show version', 'dim')
|
|
605
687
|
log(' help Show this help message', 'dim')
|
|
606
688
|
console.log()
|
package/mcp-client.js
CHANGED
|
@@ -3096,21 +3096,28 @@ async function executeSendWebhook(args) {
|
|
|
3096
3096
|
}
|
|
3097
3097
|
|
|
3098
3098
|
/**
|
|
3099
|
-
* Essential tools shown in the tool list
|
|
3100
|
-
*
|
|
3099
|
+
* Essential tools shown in the tool list
|
|
3100
|
+
* MCP protocol requires tools to be listed for clients to call them
|
|
3101
3101
|
*/
|
|
3102
3102
|
const VISIBLE_TOOLS = [
|
|
3103
|
+
// Essential (5) - Main workflow
|
|
3103
3104
|
'create_content', // Main entry point - creates & publishes automatically
|
|
3104
3105
|
'keyword_research', // Research keywords separately (on-demand)
|
|
3105
3106
|
'generate_image', // Generate/regenerate images (on-demand)
|
|
3106
3107
|
'publish_content', // Manual publish trigger (on-demand)
|
|
3107
|
-
'get_session'
|
|
3108
|
+
'get_session', // Check status (on-demand)
|
|
3109
|
+
|
|
3110
|
+
// Session Management (5) - Content lifecycle
|
|
3111
|
+
'save_content', // Save article to session
|
|
3112
|
+
'list_content', // List saved content
|
|
3113
|
+
'load_content', // Load past content into session
|
|
3114
|
+
'remove_article', // Remove article from session
|
|
3115
|
+
'clear_session' // Clear all session content
|
|
3108
3116
|
]
|
|
3109
3117
|
|
|
3110
3118
|
/**
|
|
3111
3119
|
* Get all available tools based on configured credentials
|
|
3112
|
-
*
|
|
3113
|
-
* Hidden tools still work when LLM calls them directly
|
|
3120
|
+
* Shows 10 essential tools (instead of 24) for cleaner UX
|
|
3114
3121
|
*/
|
|
3115
3122
|
function getAvailableTools() {
|
|
3116
3123
|
const tools = []
|
package/package.json
CHANGED