tolingcode 1.0.2 → 1.0.4

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/tolingcode.js CHANGED
@@ -9,13 +9,15 @@ const fs = require('fs');
9
9
  const path = require('path');
10
10
  const { execSync } = require('child_process');
11
11
 
12
+ const pkg = require('../package.json');
13
+
12
14
  const program = new Command();
13
- const REGISTRY_URL = 'https://toling.me/api/registry';
15
+ const REGISTRY_URL = process.env.TOLINGCODE_REGISTRY || 'https://toling.me/api/registry';
14
16
 
15
17
  program
16
18
  .name('tolingcode')
17
19
  .description('TolingCode CLI - Install skills and apps from toling.me')
18
- .version('1.0.0');
20
+ .version(pkg.version);
19
21
 
20
22
  // install command
21
23
  program
@@ -71,12 +73,19 @@ program
71
73
  console.log(chalk.green('✓ Downloaded'));
72
74
 
73
75
  const extractSpinner = ora('Installing...').start();
76
+
77
+ // Create package directory
78
+ const pkgDir = path.join(installPath, name);
79
+ if (!fs.existsSync(pkgDir)) {
80
+ fs.mkdirSync(pkgDir, { recursive: true });
81
+ }
82
+
74
83
  await new Promise((resolve, reject) => {
75
84
  tarballResponse.data
76
- .pipe(tar.x({ C: installPath, strip: 1 }))
85
+ .pipe(tar.x({ C: pkgDir, strip: 1 }))
77
86
  .on('end', () => {
78
87
  extractSpinner.stop();
79
- console.log(chalk.green(`✓ Installed to: ${installPath}`));
88
+ console.log(chalk.green(`✓ Installed to: ${pkgDir}`));
80
89
  resolve();
81
90
  })
82
91
  .on('error', (err) => {
@@ -116,6 +125,15 @@ program
116
125
  });
117
126
 
118
127
  const packages = response.data;
128
+
129
+ // Handle case where API returns error object or non-array
130
+ if (!Array.isArray(packages)) {
131
+ console.log(chalk.yellow(' Registry not available yet.'));
132
+ console.log(chalk.gray(' The toling.me registry server is not deployed.'));
133
+ console.log(chalk.gray(' See: QUICKSTART.md for deployment instructions.'));
134
+ return;
135
+ }
136
+
119
137
  if (packages.length === 0) {
120
138
  console.log(chalk.yellow(' No packages found.'));
121
139
  return;
@@ -128,7 +146,13 @@ program
128
146
  });
129
147
 
130
148
  } catch (error) {
131
- console.log(chalk.red(`✗ Error: ${error.message}`));
149
+ if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
150
+ console.log(chalk.yellow(' Cannot connect to registry.'));
151
+ console.log(chalk.gray(' The toling.me registry server is not deployed yet.'));
152
+ console.log(chalk.gray(' See: QUICKSTART.md for deployment instructions.'));
153
+ } else {
154
+ console.log(chalk.red(`✗ Error: ${error.message}`));
155
+ }
132
156
  process.exit(1);
133
157
  }
134
158
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tolingcode",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "TolingCode CLI - Install skills and apps from toling.me",
5
5
  "main": "bin/tolingcode.js",
6
6
  "bin": {
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env pwsh
2
+ # TolingCode Skill Publish Script (PowerShell)
3
+ # Usage: .\publish-skill.ps1 <skill-name> [version]
4
+
5
+ param(
6
+ [Parameter(Mandatory=$true)]
7
+ [string]$SkillName,
8
+
9
+ [string]$Version = (Get-Date -Format "yyyy.MM.dd"),
10
+
11
+ [string]$ServerHost = "iZwz91qi4kjnj5l58gbhj5Z",
12
+ [string]$ServerUser = "root",
13
+ [string]$SkillSource = "C:\Users\Administrator\.openclaw\workspace\skills"
14
+ )
15
+
16
+ Write-Host "📦 Publishing $SkillName@$Version" -ForegroundColor Blue
17
+ Write-Host ""
18
+
19
+ # 1. Check source exists
20
+ $sourcePath = Join-Path $SkillSource $SkillName
21
+ if (!(Test-Path $sourcePath)) {
22
+ Write-Host "❌ Skill not found: $sourcePath" -ForegroundColor Red
23
+ exit 1
24
+ }
25
+
26
+ Write-Host "✓ Source: $sourcePath" -ForegroundColor Green
27
+
28
+ # 2. Create tar.gz
29
+ $tarFile = "$SkillName-$Version.tar.gz"
30
+ Write-Host "📦 Creating $tarFile..." -ForegroundColor Yellow
31
+ tar -czf $tarFile -C $SkillSource $SkillName
32
+
33
+ if (!(Test-Path $tarFile)) {
34
+ Write-Host "❌ Failed to create tarball" -ForegroundColor Red
35
+ exit 1
36
+ }
37
+
38
+ Write-Host "✓ Created: $tarFile ($(Get-Item $tarFile).Length bytes)" -ForegroundColor Green
39
+
40
+ # 3. Upload to server
41
+ Write-Host "📤 Uploading to server..." -ForegroundColor Yellow
42
+ scp $tarFile "${ServerUser}@${ServerHost}:/var/www/toling.me/packages/skills/"
43
+
44
+ if ($LASTEXITCODE -ne 0) {
45
+ Write-Host "❌ Upload failed" -ForegroundColor Red
46
+ exit 1
47
+ }
48
+
49
+ Write-Host "✓ Uploaded to /var/www/toling.me/packages/skills/" -ForegroundColor Green
50
+ Write-Host ""
51
+ Write-Host "📝 Next step: Update registry.json on server" -ForegroundColor Yellow
52
+ Write-Host ""
53
+ Write-Host "SSH to server and run:" -ForegroundColor Gray
54
+ Write-Host @"
55
+ cat >> /var/www/toling.me/registry.json << 'EOF'
56
+ {
57
+ "skills": {
58
+ "$SkillName": {
59
+ "description": "$SkillName skill",
60
+ "latestVersion": "$Version",
61
+ "versions": {
62
+ "$Version": {
63
+ "publishedAt": "$(Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ")"
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "apps": {}
69
+ }
70
+ EOF
71
+ "@
72
+
73
+ Write-Host ""
74
+ Write-Host "🎉 Done!" -ForegroundColor Green