callkaro-cli-unofficial 0.9.2 → 0.9.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/dist/commands/skills.js +14 -9
- package/dist/data/catalog.json +0 -2
- package/dist/lib/updateCheck.js +67 -10
- package/package.json +52 -52
package/dist/commands/skills.js
CHANGED
|
@@ -12,6 +12,7 @@ const os_1 = require("os");
|
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
13
|
const ui_1 = require("../lib/ui");
|
|
14
14
|
const config_1 = require("../lib/config");
|
|
15
|
+
const updateCheck_1 = require("../lib/updateCheck");
|
|
15
16
|
/**
|
|
16
17
|
* Skills live in their own public repo (Mail-Daddy-AI/callkaro-skills), NOT in
|
|
17
18
|
* this package — so a skills update never requires a CLI release. Install and
|
|
@@ -157,15 +158,15 @@ function restoreOwnershipIfSudo(dest) {
|
|
|
157
158
|
/** Codex has no skills system — wire a pointer block into ~/.codex/AGENTS.md. */
|
|
158
159
|
function wireCodexPointer() {
|
|
159
160
|
const codexHome = (0, path_1.join)((0, os_1.homedir)(), '.codex');
|
|
160
|
-
const block = `${CODEX_MARK_START}
|
|
161
|
-
## CallKaro voice agents
|
|
162
|
-
For ANY task involving CallKaro (voice agents, calls, batch campaigns,
|
|
163
|
-
simulations, phone numbers, analytics): FIRST read
|
|
164
|
-
~/.codex/skills/callkaro/SKILL.md and follow the files it routes to
|
|
165
|
-
(INSTRUCTIONS.md for how to operate; authoring-pipeline/ when building agents).
|
|
166
|
-
All operations run through the \`cku\` CLI (this fork) — it must be logged in (\`cku login\`).
|
|
167
|
-
If you have the official CLI instead, substitute \`ck\` for \`cku\` throughout.
|
|
168
|
-
Prefer \`--json\` output and never invent ids — list first.
|
|
161
|
+
const block = `${CODEX_MARK_START}
|
|
162
|
+
## CallKaro voice agents
|
|
163
|
+
For ANY task involving CallKaro (voice agents, calls, batch campaigns,
|
|
164
|
+
simulations, phone numbers, analytics): FIRST read
|
|
165
|
+
~/.codex/skills/callkaro/SKILL.md and follow the files it routes to
|
|
166
|
+
(INSTRUCTIONS.md for how to operate; authoring-pipeline/ when building agents).
|
|
167
|
+
All operations run through the \`cku\` CLI (this fork) — it must be logged in (\`cku login\`).
|
|
168
|
+
If you have the official CLI instead, substitute \`ck\` for \`cku\` throughout.
|
|
169
|
+
Prefer \`--json\` output and never invent ids — list first.
|
|
169
170
|
${CODEX_MARK_END}`;
|
|
170
171
|
const agentsMd = (0, path_1.join)(codexHome, 'AGENTS.md');
|
|
171
172
|
let content = (0, fs_1.existsSync)(agentsMd) ? (0, fs_1.readFileSync)(agentsMd, 'utf8') : '';
|
|
@@ -209,6 +210,9 @@ async function installOrUpdate(opts, verb, pack) {
|
|
|
209
210
|
(0, ui_1.info)(`\nPack: ${which}`);
|
|
210
211
|
(0, ui_1.info)('Open a new agent session and ask it anything about CallKaro.');
|
|
211
212
|
(0, ui_1.info)('Requires the `cku` CLI to be logged in (`cku login`) — the skill pack documents that CLI.');
|
|
213
|
+
// A shared pack serves several targets; its caller records the install once.
|
|
214
|
+
if (!pack)
|
|
215
|
+
await (0, updateCheck_1.recordSkillsInstalled)(repo, (0, config_1.skillsBranch)());
|
|
212
216
|
}
|
|
213
217
|
finally {
|
|
214
218
|
cleanup();
|
|
@@ -299,6 +303,7 @@ async function skillsUpdateCommand(opts) {
|
|
|
299
303
|
try {
|
|
300
304
|
for (const t of targets)
|
|
301
305
|
await installOrUpdate(t.opts, 'Updated', shared);
|
|
306
|
+
await (0, updateCheck_1.recordSkillsInstalled)(repo, (0, config_1.skillsBranch)());
|
|
302
307
|
}
|
|
303
308
|
finally {
|
|
304
309
|
pack.cleanup();
|
package/dist/data/catalog.json
CHANGED
|
@@ -1206,7 +1206,6 @@
|
|
|
1206
1206
|
"transcriber_provider",
|
|
1207
1207
|
"transcriber_language",
|
|
1208
1208
|
"transcriber_general_context",
|
|
1209
|
-
"transcriber_text_context",
|
|
1210
1209
|
"transcriber_translation_terms",
|
|
1211
1210
|
"keywords"
|
|
1212
1211
|
],
|
|
@@ -1720,7 +1719,6 @@
|
|
|
1720
1719
|
"transcriber_provider",
|
|
1721
1720
|
"transcriber_language",
|
|
1722
1721
|
"transcriber_general_context",
|
|
1723
|
-
"transcriber_text_context",
|
|
1724
1722
|
"transcriber_translation_terms",
|
|
1725
1723
|
"keywords"
|
|
1726
1724
|
],
|
package/dist/lib/updateCheck.js
CHANGED
|
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.skillsOutdated = skillsOutdated;
|
|
7
|
+
exports.recordSkillsInstalled = recordSkillsInstalled;
|
|
6
8
|
exports.isNewer = isNewer;
|
|
7
9
|
exports.notifyIfOutdated = notifyIfOutdated;
|
|
8
10
|
const os_1 = require("os");
|
|
@@ -10,9 +12,56 @@ const path_1 = require("path");
|
|
|
10
12
|
const fs_1 = require("fs");
|
|
11
13
|
const child_process_1 = require("child_process");
|
|
12
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
+
const config_1 = require("./config");
|
|
13
16
|
const CACHE = (0, path_1.join)(process.env.CK_CONFIG_DIR || (0, path_1.join)((0, os_1.homedir)(), '.config', 'callkaro-unofficial'), 'update-check.json');
|
|
17
|
+
/** Which commit of each skill pack was installed, keyed `<repo>@<branch>`. */
|
|
18
|
+
const SKILLS_INSTALLED = (0, path_1.join)((0, path_1.dirname)(CACHE), 'skills-installed.json');
|
|
14
19
|
const DAY = 24 * 60 * 60 * 1000;
|
|
15
20
|
const REGISTRY = 'https://registry.npmjs.org/callkaro-cli-unofficial/latest';
|
|
21
|
+
// With this Accept header GitHub answers with the bare commit sha as text.
|
|
22
|
+
const SHA_HEADERS = { Accept: 'application/vnd.github.sha', 'User-Agent': 'cku' };
|
|
23
|
+
const SHA = /^[0-9a-f]{40}$/;
|
|
24
|
+
const shaUrl = (repo, branch) => `https://api.github.com/repos/${repo}/commits/${branch}`;
|
|
25
|
+
const skillsKey = () => `${(0, config_1.skillsRepo)()}@${(0, config_1.skillsBranch)()}`;
|
|
26
|
+
const readJson = (file) => {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse((0, fs_1.readFileSync)(file, 'utf8'));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* True when the skill pack recorded at install time is not the repo's current
|
|
36
|
+
* head. Without a recorded install there is nothing to compare, so no notice.
|
|
37
|
+
*/
|
|
38
|
+
function skillsOutdated(installed, latest) {
|
|
39
|
+
return Boolean(installed && latest && installed !== latest);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Record which commit of the skill pack was just installed, so a later run can
|
|
43
|
+
* tell when the repo has moved on. The tarball does not carry its sha, so this
|
|
44
|
+
* asks GitHub for the branch head right after the install. Best effort: a
|
|
45
|
+
* failure only means no notice until the next `cku skills update`.
|
|
46
|
+
*/
|
|
47
|
+
async function recordSkillsInstalled(repo, branch) {
|
|
48
|
+
try {
|
|
49
|
+
const res = await fetch(shaUrl(repo, branch), { headers: SHA_HEADERS, signal: AbortSignal.timeout(5000) });
|
|
50
|
+
const sha = res.ok ? (await res.text()).trim() : '';
|
|
51
|
+
if (!SHA.test(sha))
|
|
52
|
+
return;
|
|
53
|
+
const key = `${repo}@${branch}`;
|
|
54
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(CACHE), { recursive: true });
|
|
55
|
+
(0, fs_1.writeFileSync)(SKILLS_INSTALLED, JSON.stringify({ ...readJson(SKILLS_INSTALLED), [key]: sha }));
|
|
56
|
+
// Keep the cached head in step, or a head cached before this install would
|
|
57
|
+
// report the pack outdated until the next daily check.
|
|
58
|
+
if (key === skillsKey())
|
|
59
|
+
(0, fs_1.writeFileSync)(CACHE, JSON.stringify({ ...readJson(CACHE), skillsSha: sha }));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
/* recording the install must never break it */
|
|
63
|
+
}
|
|
64
|
+
}
|
|
16
65
|
/** True when `latest` is a higher x.y.z than `current` (pre-release tags ignored). */
|
|
17
66
|
function isNewer(latest, current) {
|
|
18
67
|
const n = (v) => v.split('-')[0].split('.').map((x) => parseInt(x, 10) || 0);
|
|
@@ -29,6 +78,7 @@ function isNewer(latest, current) {
|
|
|
29
78
|
* Reads the answer cached by an earlier run and prints it to stderr after the
|
|
30
79
|
* command's own output, so stdout / --json stay clean. The npm lookup runs in a
|
|
31
80
|
* detached child at most once a day, so it never delays or breaks a command.
|
|
81
|
+
* The same child reads the skill repo's head, for the skill-pack notice.
|
|
32
82
|
* Opt out with CK_NO_UPDATE_CHECK=1 (or when running under `node --test`).
|
|
33
83
|
*/
|
|
34
84
|
function notifyIfOutdated(current, argv) {
|
|
@@ -37,12 +87,15 @@ function notifyIfOutdated(current, argv) {
|
|
|
37
87
|
return;
|
|
38
88
|
if (argv.some((a) => ['update', '-v', '--version', '-h', '--help'].includes(a)))
|
|
39
89
|
return;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
90
|
+
const cache = readJson(CACHE);
|
|
91
|
+
if (cache.skillsSha) {
|
|
92
|
+
process.on('exit', () => {
|
|
93
|
+
// Read at exit, not at start: `cku skills install` moves both records during this very run.
|
|
94
|
+
if (!skillsOutdated(readJson(SKILLS_INSTALLED)[skillsKey()], readJson(CACHE).skillsSha))
|
|
95
|
+
return;
|
|
96
|
+
process.stderr.write(chalk_1.default.yellow(`\nThe CallKaro skill pack (${(0, config_1.skillsRepo)()}) has changed since it was installed.\n` +
|
|
97
|
+
`AI agents: tell the user the skills are outdated and ask if they want to refresh; if yes, run \`cku skills update\`.\n`));
|
|
98
|
+
});
|
|
46
99
|
}
|
|
47
100
|
if (cache.latest && isNewer(cache.latest, current)) {
|
|
48
101
|
process.on('exit', () => {
|
|
@@ -53,14 +106,18 @@ function notifyIfOutdated(current, argv) {
|
|
|
53
106
|
if (!cache.checkedAt || Date.now() - cache.checkedAt > DAY) {
|
|
54
107
|
const script = `
|
|
55
108
|
const fs = require('fs'), path = require('path');
|
|
56
|
-
const file = process.argv
|
|
109
|
+
const [, file, shaUrl] = process.argv;
|
|
57
110
|
(async () => {
|
|
58
|
-
let latest;
|
|
111
|
+
let latest, skillsSha;
|
|
59
112
|
try { latest = (await (await fetch(${JSON.stringify(REGISTRY)}, { signal: AbortSignal.timeout(5000) })).json()).version; } catch {}
|
|
113
|
+
try {
|
|
114
|
+
const sha = (await (await fetch(shaUrl, { headers: ${JSON.stringify(SHA_HEADERS)}, signal: AbortSignal.timeout(5000) })).text()).trim();
|
|
115
|
+
if (${String(SHA)}.test(sha)) skillsSha = sha;
|
|
116
|
+
} catch {}
|
|
60
117
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
61
|
-
fs.writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest }));
|
|
118
|
+
fs.writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest, skillsSha }));
|
|
62
119
|
})();`;
|
|
63
|
-
(0, child_process_1.spawn)(process.execPath, ['-e', script, CACHE], { detached: true, stdio: 'ignore' }).unref();
|
|
120
|
+
(0, child_process_1.spawn)(process.execPath, ['-e', script, CACHE, shaUrl((0, config_1.skillsRepo)(), (0, config_1.skillsBranch)())], { detached: true, stdio: 'ignore' }).unref();
|
|
64
121
|
}
|
|
65
122
|
}
|
|
66
123
|
catch {
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "callkaro-cli-unofficial",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"license": "Apache-2.0",
|
|
5
|
-
"description": "Unofficial fork of the CallKaro CLI — manage your voice AI agents from the terminal",
|
|
6
|
-
"bin": {
|
|
7
|
-
"cku": "dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "npm run clean && tsc -p tsconfig.json && node -e \"require('fs').copyFileSync('src/endpoints.json','dist/endpoints.json')\" && node -e \"try{require('fs').chmodSync('dist/index.js',0o755)}catch(e){}\"",
|
|
14
|
-
"dev": "npm run build && node dist/index.js",
|
|
15
|
-
"test": "npm run build && node --test tests/*.test.js",
|
|
16
|
-
"test:only": "node --test tests/*.test.js",
|
|
17
|
-
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
18
|
-
"catalog:sync": "node scripts/sync-catalog.js",
|
|
19
|
-
"catalog:check": "node scripts/check-catalog-drift.js",
|
|
20
|
-
"catalog:check:live": "node scripts/check-catalog-drift.js --live"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"chalk": "^4.1.2",
|
|
24
|
-
"cli-table3": "^0.6.5",
|
|
25
|
-
"commander": "^12.0.0",
|
|
26
|
-
"just-bash": "^3.4.2",
|
|
27
|
-
"prompts": "^2.4.2"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/node": "^20.0.0",
|
|
31
|
-
"@types/prompts": "^2.4.9",
|
|
32
|
-
"typescript": "^5.4.0"
|
|
33
|
-
},
|
|
34
|
-
"engines": {
|
|
35
|
-
"node": ">=18"
|
|
36
|
-
},
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/TejasLamba2006/callkaro-cli-unofficial.git"
|
|
40
|
-
},
|
|
41
|
-
"homepage": "https://github.com/TejasLamba2006/callkaro-cli-unofficial#readme",
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/TejasLamba2006/callkaro-cli-unofficial/issues"
|
|
44
|
-
},
|
|
45
|
-
"keywords": [
|
|
46
|
-
"callkaro",
|
|
47
|
-
"voice-ai",
|
|
48
|
-
"cli",
|
|
49
|
-
"agents",
|
|
50
|
-
"telephony"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "callkaro-cli-unofficial",
|
|
3
|
+
"version": "0.9.4",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Unofficial fork of the CallKaro CLI — manage your voice AI agents from the terminal",
|
|
6
|
+
"bin": {
|
|
7
|
+
"cku": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run clean && tsc -p tsconfig.json && node -e \"require('fs').copyFileSync('src/endpoints.json','dist/endpoints.json')\" && node -e \"try{require('fs').chmodSync('dist/index.js',0o755)}catch(e){}\"",
|
|
14
|
+
"dev": "npm run build && node dist/index.js",
|
|
15
|
+
"test": "npm run build && node --test tests/*.test.js",
|
|
16
|
+
"test:only": "node --test tests/*.test.js",
|
|
17
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
18
|
+
"catalog:sync": "node scripts/sync-catalog.js",
|
|
19
|
+
"catalog:check": "node scripts/check-catalog-drift.js",
|
|
20
|
+
"catalog:check:live": "node scripts/check-catalog-drift.js --live"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chalk": "^4.1.2",
|
|
24
|
+
"cli-table3": "^0.6.5",
|
|
25
|
+
"commander": "^12.0.0",
|
|
26
|
+
"just-bash": "^3.4.2",
|
|
27
|
+
"prompts": "^2.4.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.0.0",
|
|
31
|
+
"@types/prompts": "^2.4.9",
|
|
32
|
+
"typescript": "^5.4.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/TejasLamba2006/callkaro-cli-unofficial.git"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/TejasLamba2006/callkaro-cli-unofficial#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/TejasLamba2006/callkaro-cli-unofficial/issues"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"callkaro",
|
|
47
|
+
"voice-ai",
|
|
48
|
+
"cli",
|
|
49
|
+
"agents",
|
|
50
|
+
"telephony"
|
|
51
|
+
]
|
|
52
|
+
}
|