@agentpie/skill 0.1.17 → 0.1.18
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/README.md +5 -1
- package/bin/agentpie-skill.mjs +79 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Global creator-facing AgentPie Skill registry helper.
|
|
|
4
4
|
|
|
5
5
|
This package exposes `agentpie-skill` and reuses the XiaShe Skill CLI implementation with AgentPie defaults:
|
|
6
6
|
|
|
7
|
-
- registry base: `https://
|
|
7
|
+
- registry base: `https://agentpie.app`
|
|
8
8
|
- manifest file: `agentpie.skill.json`
|
|
9
9
|
- product name: `AgentPie`
|
|
10
10
|
|
|
@@ -29,3 +29,7 @@ node packages/agentpie-skill-cli/bin/agentpie-skill.mjs prompt . --hub generic
|
|
|
29
29
|
node packages/agentpie-skill-cli/bin/agentpie-skill.mjs snippet . --target js
|
|
30
30
|
node packages/agentpie-skill-cli/bin/agentpie-skill.mjs track . --event skill_invoked --hub coze --dry-run --json
|
|
31
31
|
```
|
|
32
|
+
|
|
33
|
+
When testing from this monorepo after `npm run env:use:dev`, the CLI reads
|
|
34
|
+
`.env.local` and `convex/.env.local` and uses the AgentPie dev Convex
|
|
35
|
+
deployment instead of the production `agentpie.app` Worker.
|
package/bin/agentpie-skill.mjs
CHANGED
|
@@ -1,9 +1,87 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
function parseEnvFile(filePath) {
|
|
8
|
+
if (!existsSync(filePath)) return {};
|
|
9
|
+
const parsed = {};
|
|
10
|
+
const raw = readFileSync(filePath, 'utf8');
|
|
11
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
12
|
+
const trimmed = line.trim();
|
|
13
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
14
|
+
const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
15
|
+
if (!match) continue;
|
|
16
|
+
let value = match[2].trim();
|
|
17
|
+
if (
|
|
18
|
+
(value.startsWith('"') && value.endsWith('"')) ||
|
|
19
|
+
(value.startsWith("'") && value.endsWith("'"))
|
|
20
|
+
) {
|
|
21
|
+
value = value.slice(1, -1);
|
|
22
|
+
}
|
|
23
|
+
parsed[match[1]] = value;
|
|
24
|
+
}
|
|
25
|
+
return parsed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function nearestEnvFiles() {
|
|
29
|
+
const files = [];
|
|
30
|
+
let cursor = process.cwd();
|
|
31
|
+
for (let index = 0; index < 8; index += 1) {
|
|
32
|
+
files.push(path.join(cursor, '.env.local'));
|
|
33
|
+
files.push(path.join(cursor, 'convex', '.env.local'));
|
|
34
|
+
const next = path.dirname(cursor);
|
|
35
|
+
if (next === cursor) break;
|
|
36
|
+
cursor = next;
|
|
37
|
+
}
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function loadLocalEnvDefaults() {
|
|
42
|
+
const cliDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
|
|
43
|
+
const candidates = [
|
|
44
|
+
path.join(cliDir, '.env.local'),
|
|
45
|
+
path.join(cliDir, 'convex', '.env.local'),
|
|
46
|
+
...nearestEnvFiles()
|
|
47
|
+
];
|
|
48
|
+
const env = {};
|
|
49
|
+
for (const filePath of candidates) {
|
|
50
|
+
Object.assign(env, parseEnvFile(filePath));
|
|
51
|
+
}
|
|
52
|
+
return env;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function normalizeBaseUrl(value) {
|
|
56
|
+
const text = String(value || '').trim().replace(/\/+$/, '');
|
|
57
|
+
return /^https?:\/\//i.test(text) ? text : '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const localEnv = loadLocalEnvDefaults();
|
|
61
|
+
const localBaseUrl = normalizeBaseUrl(
|
|
62
|
+
process.env.AGENTPIE_SKILL_DEFAULT_BASE_URL ||
|
|
63
|
+
localEnv.AGENTPIE_SKILL_DEFAULT_BASE_URL ||
|
|
64
|
+
process.env.AGENTPIE_SKILL_REGISTRY_PUBLIC_URL ||
|
|
65
|
+
localEnv.AGENTPIE_SKILL_REGISTRY_PUBLIC_URL ||
|
|
66
|
+
process.env.AGENTPIE_ACTIONS_URL ||
|
|
67
|
+
localEnv.AGENTPIE_ACTIONS_URL ||
|
|
68
|
+
process.env.CREATOR_SKILL_REGISTRY_PUBLIC_URL ||
|
|
69
|
+
localEnv.CREATOR_SKILL_REGISTRY_PUBLIC_URL ||
|
|
70
|
+
process.env.AGENTPIE_MCP_PUBLIC_URL ||
|
|
71
|
+
localEnv.AGENTPIE_MCP_PUBLIC_URL ||
|
|
72
|
+
process.env.PUBLIC_CONVEX_SITE_URL ||
|
|
73
|
+
localEnv.PUBLIC_CONVEX_SITE_URL ||
|
|
74
|
+
process.env.CONVEX_SITE_URL ||
|
|
75
|
+
localEnv.CONVEX_SITE_URL ||
|
|
76
|
+
process.env.EXPO_PUBLIC_CONVEX_SITE_URL ||
|
|
77
|
+
localEnv.EXPO_PUBLIC_CONVEX_SITE_URL
|
|
78
|
+
);
|
|
79
|
+
|
|
3
80
|
process.env.XIASHE_SKILL_CLI_NAME = process.env.XIASHE_SKILL_CLI_NAME || 'agentpie-skill';
|
|
4
81
|
process.env.XIASHE_SKILL_PRODUCT_NAME = process.env.XIASHE_SKILL_PRODUCT_NAME || 'AgentPie';
|
|
5
82
|
process.env.XIASHE_SKILL_REGISTRY_PROVIDER = process.env.XIASHE_SKILL_REGISTRY_PROVIDER || 'agentpie';
|
|
6
|
-
process.env.
|
|
83
|
+
process.env.XIASHE_SKILL_CLI_VERSION = process.env.XIASHE_SKILL_CLI_VERSION || '0.1.18';
|
|
84
|
+
process.env.XIASHE_SKILL_DEFAULT_BASE_URL = process.env.XIASHE_SKILL_DEFAULT_BASE_URL || localBaseUrl || 'https://agentpie.app';
|
|
7
85
|
process.env.XIASHE_SKILL_MANIFEST_FILE = process.env.XIASHE_SKILL_MANIFEST_FILE || 'agentpie.skill.json';
|
|
8
86
|
process.env.XIASHE_SKILL_WORK_DIR = process.env.XIASHE_SKILL_WORK_DIR || '.agentpie';
|
|
9
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentpie/skill",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agentpie-skill": "bin/agentpie-skill.mjs"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xiashe/skill": "0.1.
|
|
13
|
+
"@xiashe/skill": "0.1.22"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=20"
|