tolingcode 1.0.1 → 1.0.3

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
@@ -10,7 +10,7 @@ const path = require('path');
10
10
  const { execSync } = require('child_process');
11
11
 
12
12
  const program = new Command();
13
- const REGISTRY_URL = 'https://toling.me/api/registry';
13
+ const REGISTRY_URL = process.env.TOLINGCODE_REGISTRY || 'https://toling.me/api/registry';
14
14
 
15
15
  program
16
16
  .name('tolingcode')
@@ -71,12 +71,19 @@ program
71
71
  console.log(chalk.green('✓ Downloaded'));
72
72
 
73
73
  const extractSpinner = ora('Installing...').start();
74
+
75
+ // Create package directory
76
+ const pkgDir = path.join(installPath, name);
77
+ if (!fs.existsSync(pkgDir)) {
78
+ fs.mkdirSync(pkgDir, { recursive: true });
79
+ }
80
+
74
81
  await new Promise((resolve, reject) => {
75
82
  tarballResponse.data
76
- .pipe(tar.x({ C: installPath, strip: 1 }))
83
+ .pipe(tar.x({ C: pkgDir, strip: 1 }))
77
84
  .on('end', () => {
78
85
  extractSpinner.stop();
79
- console.log(chalk.green(`✓ Installed to: ${installPath}`));
86
+ console.log(chalk.green(`✓ Installed to: ${pkgDir}`));
80
87
  resolve();
81
88
  })
82
89
  .on('error', (err) => {
@@ -116,6 +123,15 @@ program
116
123
  });
117
124
 
118
125
  const packages = response.data;
126
+
127
+ // Handle case where API returns error object or non-array
128
+ if (!Array.isArray(packages)) {
129
+ console.log(chalk.yellow(' Registry not available yet.'));
130
+ console.log(chalk.gray(' The toling.me registry server is not deployed.'));
131
+ console.log(chalk.gray(' See: QUICKSTART.md for deployment instructions.'));
132
+ return;
133
+ }
134
+
119
135
  if (packages.length === 0) {
120
136
  console.log(chalk.yellow(' No packages found.'));
121
137
  return;
@@ -128,7 +144,13 @@ program
128
144
  });
129
145
 
130
146
  } catch (error) {
131
- console.log(chalk.red(`✗ Error: ${error.message}`));
147
+ if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
148
+ console.log(chalk.yellow(' Cannot connect to registry.'));
149
+ console.log(chalk.gray(' The toling.me registry server is not deployed yet.'));
150
+ console.log(chalk.gray(' See: QUICKSTART.md for deployment instructions.'));
151
+ } else {
152
+ console.log(chalk.red(`✗ Error: ${error.message}`));
153
+ }
132
154
  process.exit(1);
133
155
  }
134
156
  });
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "tolingcode",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "TolingCode CLI - Install skills and apps from toling.me",
5
5
  "main": "bin/tolingcode.js",
6
6
  "bin": {
7
7
  "tolingcode": "bin/tolingcode.js",
8
8
  "tlc": "bin/tolingcode.js"
9
9
  },
10
- "scripts": {
11
- "test": "echo \"Error: no test specified\" && exit 1",
12
- "publish": "npm publish"
13
- },
14
10
  "keywords": [
15
11
  "tolingcode",
16
12
  "openclaw",
@@ -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