Initial commit of OpenClaw agent Chloe

This commit is contained in:
Chloe Bot
2026-03-02 20:22:49 +00:00
commit 80e697f8d9
67 changed files with 16100 additions and 0 deletions

21
skills/x-api/scripts/package-lock.json generated Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "x-api-scripts",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "x-api-scripts",
"version": "0.1.0",
"dependencies": {
"twitter-api-v2": "^1.18.2"
}
},
"node_modules/twitter-api-v2": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/twitter-api-v2/-/twitter-api-v2-1.29.0.tgz",
"integrity": "sha512-v473q5bwme4N+DWSg6qY+JCvfg1nSJRWwui3HUALafxfqCvVkKiYmS/5x/pVeJwTmyeBxexMbzHwnzrH4h6oYQ==",
"license": "Apache-2.0"
}
}
}

View File

@@ -0,0 +1 @@
{"name":"x-api-scripts","version":"0.1.0","type":"module","dependencies":{"twitter-api-v2":"^1.18.2"}}

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env node
import { TwitterApi } from 'twitter-api-v2';
import { readFileSync, existsSync } from 'fs';
import { join } from 'path';
import { homedir } from 'os';
function getCredentials() {
if (process.env.X_API_KEY && process.env.X_API_SECRET &&
process.env.X_ACCESS_TOKEN && process.env.X_ACCESS_SECRET) {
return {
appKey: process.env.X_API_KEY,
appSecret: process.env.X_API_SECRET,
accessToken: process.env.X_ACCESS_TOKEN,
accessSecret: process.env.X_ACCESS_SECRET,
};
}
const configPath = join(homedir(), '.clawdbot', 'secrets', 'x-api.json');
if (existsSync(configPath)) {
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
return {
appKey: config.consumerKey,
appSecret: config.consumerSecret,
accessToken: config.accessToken,
accessSecret: config.accessTokenSecret,
};
}
console.error('No credentials found.');
process.exit(1);
}
const text = process.argv.slice(2).join(' ');
if (!text) { console.error('Usage: x-post "text"'); process.exit(1); }
const creds = getCredentials();
const client = new TwitterApi({
appKey: creds.appKey,
appSecret: creds.appSecret,
accessToken: creds.accessToken,
accessSecret: creds.accessSecret,
});
try {
const { data } = await client.v2.tweet(text);
console.log(`✅ Posted: https://x.com/i/status/${data.id}`);
} catch (err) {
console.error('❌ Error:', err.data || err.message || err);
process.exit(1);
}