askill-cli 0.1.3 → 0.1.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/README.md +6 -0
- package/dist/cli.mjs +361 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,9 @@ You are an AI agent helping a user with askill - a package manager for AI agent
|
|
|
12
12
|
|
|
13
13
|
**Quick Commands:**
|
|
14
14
|
```bash
|
|
15
|
+
# Install a published skill (@author/skill-name)
|
|
16
|
+
askill add @johndoe/awesome-tool -y
|
|
17
|
+
|
|
15
18
|
# Install a skill
|
|
16
19
|
askill add owner/repo@skill-name -y
|
|
17
20
|
|
|
@@ -65,6 +68,9 @@ Every skill on [askill.sh](https://askill.sh) is automatically reviewed by AI ac
|
|
|
65
68
|
# Install
|
|
66
69
|
curl -fsSL https://askill.sh | sh
|
|
67
70
|
|
|
71
|
+
# Install a published skill
|
|
72
|
+
askill add @johndoe/awesome-tool
|
|
73
|
+
|
|
68
74
|
# Install a skill
|
|
69
75
|
askill add owner/repo@skill-name
|
|
70
76
|
|
package/dist/cli.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { homedir } from "os";
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
|
-
var VERSION = "0.1.
|
|
7
|
+
var VERSION = "0.1.4";
|
|
8
8
|
var API_BASE_URL = "https://askill.sh/api/v1";
|
|
9
9
|
var REGISTRY_URL = "https://askill.sh";
|
|
10
10
|
var RESET = "\x1B[0m";
|
|
@@ -788,28 +788,29 @@ async function fetchVersionInfo() {
|
|
|
788
788
|
return null;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
async function
|
|
791
|
+
async function getAvailableUpdate(force = false) {
|
|
792
792
|
if (!force && !await shouldCheckUpdate()) {
|
|
793
|
-
return;
|
|
793
|
+
return null;
|
|
794
794
|
}
|
|
795
795
|
await saveUpdateCheckTime();
|
|
796
796
|
const versionInfo = await fetchVersionInfo();
|
|
797
|
-
if (!versionInfo) return;
|
|
797
|
+
if (!versionInfo) return null;
|
|
798
798
|
const current = VERSION;
|
|
799
|
-
const latest = versionInfo.latest;
|
|
800
|
-
if (semver.lt(current, latest)) {
|
|
801
|
-
console.log();
|
|
802
|
-
console.log(`${YELLOW}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${RESET}`);
|
|
803
|
-
console.log(`${YELLOW}\u2502${RESET} Update available: ${DIM}${current}${RESET} \u2192 ${GREEN}${latest}${RESET} ${YELLOW}\u2502${RESET}`);
|
|
804
|
-
console.log(`${YELLOW}\u2502${RESET} Run ${CYAN}askill upgrade${RESET} to update ${YELLOW}\u2502${RESET}`);
|
|
805
|
-
console.log(`${YELLOW}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${RESET}`);
|
|
806
|
-
console.log();
|
|
807
|
-
}
|
|
808
799
|
if (semver.lt(current, versionInfo.minimum)) {
|
|
809
800
|
console.log(`${RED}Your askill version is too old. Please update to continue.${RESET}`);
|
|
810
801
|
console.log(`Minimum required: ${versionInfo.minimum}`);
|
|
811
802
|
process.exit(1);
|
|
812
803
|
}
|
|
804
|
+
if (!semver.lt(current, versionInfo.latest)) {
|
|
805
|
+
return null;
|
|
806
|
+
}
|
|
807
|
+
return {
|
|
808
|
+
current,
|
|
809
|
+
latest: versionInfo.latest,
|
|
810
|
+
minimum: versionInfo.minimum,
|
|
811
|
+
releaseNotes: versionInfo.releaseNotes,
|
|
812
|
+
releaseUrl: versionInfo.releaseUrl
|
|
813
|
+
};
|
|
813
814
|
}
|
|
814
815
|
async function selfUpdate() {
|
|
815
816
|
console.log(`${CYAN}Checking for updates...${RESET}`);
|
|
@@ -1552,6 +1553,7 @@ ${BOLD}Commands:${RESET}
|
|
|
1552
1553
|
upgrade Update askill CLI to latest version
|
|
1553
1554
|
|
|
1554
1555
|
${BOLD}Skill Source Formats:${RESET}
|
|
1556
|
+
@author/skill-name Published skill from askill registry
|
|
1555
1557
|
owner/repo All skills from a GitHub repo
|
|
1556
1558
|
owner/repo@skill-name Specific skill by name
|
|
1557
1559
|
owner/repo/path/to/skill Specific skill by path
|
|
@@ -1560,6 +1562,7 @@ ${BOLD}Skill Source Formats:${RESET}
|
|
|
1560
1562
|
gh:owner/repo@skill-name Explicit GitHub prefix (optional)
|
|
1561
1563
|
|
|
1562
1564
|
${BOLD}Install Options:${RESET}
|
|
1565
|
+
(default) Install to current project: .agents/skills/
|
|
1563
1566
|
-g, --global Install globally (user-level)
|
|
1564
1567
|
-a, --agent <agents> Install to specific agents
|
|
1565
1568
|
-y, --yes Skip confirmation prompts
|
|
@@ -1570,21 +1573,297 @@ ${BOLD}Install Options:${RESET}
|
|
|
1570
1573
|
${BOLD}Run Options:${RESET}
|
|
1571
1574
|
askill run <skill>:<command> Run a skill's command
|
|
1572
1575
|
|
|
1576
|
+
${BOLD}Search Options:${RESET}
|
|
1577
|
+
--full-desc Show full skill descriptions in find/search
|
|
1578
|
+
|
|
1573
1579
|
${BOLD}Options:${RESET}
|
|
1574
1580
|
--help, -h Show this help message
|
|
1575
1581
|
--version, -v Show version number
|
|
1576
1582
|
|
|
1583
|
+
${BOLD}Per-command Help:${RESET}
|
|
1584
|
+
askill <command> --help
|
|
1585
|
+
askill help <command>
|
|
1586
|
+
|
|
1587
|
+
${BOLD}For Agents:${RESET}
|
|
1588
|
+
Official usage guide: ${CYAN}https://github.com/avibe-bot/askill/tree/main/skills/use-askill${RESET}
|
|
1589
|
+
|
|
1577
1590
|
${BOLD}Examples:${RESET}
|
|
1578
1591
|
${DIM}$${RESET} askill add anthropic/courses@prompt-eng
|
|
1579
1592
|
${DIM}$${RESET} askill add anthropic/courses
|
|
1580
1593
|
${DIM}$${RESET} askill add ./my-skills/custom-skill
|
|
1581
1594
|
${DIM}$${RESET} askill find memory
|
|
1595
|
+
${DIM}$${RESET} askill find memory --full-desc
|
|
1582
1596
|
${DIM}$${RESET} askill list -g
|
|
1583
1597
|
${DIM}$${RESET} askill info gh:anthropic/courses@prompt-eng
|
|
1584
1598
|
|
|
1585
1599
|
${DIM}Browse more at${RESET} ${CYAN}https://askill.sh${RESET}
|
|
1586
1600
|
`);
|
|
1587
1601
|
}
|
|
1602
|
+
function createSpinner(plain) {
|
|
1603
|
+
if (!plain) {
|
|
1604
|
+
return p.spinner();
|
|
1605
|
+
}
|
|
1606
|
+
return {
|
|
1607
|
+
start: () => {
|
|
1608
|
+
},
|
|
1609
|
+
stop: () => {
|
|
1610
|
+
},
|
|
1611
|
+
message: () => {
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
function normalizeCommand(command) {
|
|
1616
|
+
switch (command) {
|
|
1617
|
+
case "install":
|
|
1618
|
+
case "i":
|
|
1619
|
+
return "add";
|
|
1620
|
+
case "search":
|
|
1621
|
+
case "s":
|
|
1622
|
+
return "find";
|
|
1623
|
+
case "ls":
|
|
1624
|
+
return "list";
|
|
1625
|
+
case "rm":
|
|
1626
|
+
case "uninstall":
|
|
1627
|
+
return "remove";
|
|
1628
|
+
case "show":
|
|
1629
|
+
return "info";
|
|
1630
|
+
default:
|
|
1631
|
+
return command;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
function showCommandHelp(commandInput) {
|
|
1635
|
+
const command = normalizeCommand(commandInput);
|
|
1636
|
+
const helps = {
|
|
1637
|
+
add: `${BOLD}askill add${RESET}
|
|
1638
|
+
|
|
1639
|
+
Usage:
|
|
1640
|
+
askill add <source> [options]
|
|
1641
|
+
|
|
1642
|
+
Description:
|
|
1643
|
+
Install skills from published slugs, GitHub, or local directories.
|
|
1644
|
+
|
|
1645
|
+
Sources:
|
|
1646
|
+
@author/skill-name
|
|
1647
|
+
gh:owner/repo@skill-name
|
|
1648
|
+
gh:owner/repo/path/to/skill
|
|
1649
|
+
owner/repo
|
|
1650
|
+
./local/path
|
|
1651
|
+
|
|
1652
|
+
Scope:
|
|
1653
|
+
default: current project (.agents/skills/)
|
|
1654
|
+
-g, --global: user-level install
|
|
1655
|
+
|
|
1656
|
+
Options:
|
|
1657
|
+
-g, --global Install globally
|
|
1658
|
+
-a, --agent <agents...> Install to specific agents
|
|
1659
|
+
-y, --yes Skip confirmation prompts
|
|
1660
|
+
--copy Copy files instead of symlink
|
|
1661
|
+
-l, --list Preview discovered skills only
|
|
1662
|
+
--all Install all discovered skills
|
|
1663
|
+
|
|
1664
|
+
Examples:
|
|
1665
|
+
askill add @johndoe/awesome-tool -y
|
|
1666
|
+
askill add gh:facebook/react@extract-errors
|
|
1667
|
+
askill add owner/repo --all -a claude-code opencode -y
|
|
1668
|
+
|
|
1669
|
+
Guide:
|
|
1670
|
+
https://github.com/avibe-bot/askill/tree/main/skills/use-askill`,
|
|
1671
|
+
remove: `${BOLD}askill remove${RESET}
|
|
1672
|
+
|
|
1673
|
+
Usage:
|
|
1674
|
+
askill remove <skill> [options]
|
|
1675
|
+
|
|
1676
|
+
Description:
|
|
1677
|
+
Remove an installed skill from detected agents.
|
|
1678
|
+
|
|
1679
|
+
Options:
|
|
1680
|
+
-g, --global Remove global installation
|
|
1681
|
+
|
|
1682
|
+
Examples:
|
|
1683
|
+
askill remove memory
|
|
1684
|
+
askill remove memory -g`,
|
|
1685
|
+
list: `${BOLD}askill list${RESET}
|
|
1686
|
+
|
|
1687
|
+
Usage:
|
|
1688
|
+
askill list [options]
|
|
1689
|
+
|
|
1690
|
+
Description:
|
|
1691
|
+
List installed skills and where they are available.
|
|
1692
|
+
|
|
1693
|
+
Options:
|
|
1694
|
+
-g, --global Show global skills only
|
|
1695
|
+
|
|
1696
|
+
Examples:
|
|
1697
|
+
askill list
|
|
1698
|
+
askill list -g`,
|
|
1699
|
+
find: `${BOLD}askill find${RESET}
|
|
1700
|
+
|
|
1701
|
+
Usage:
|
|
1702
|
+
askill find [query] [options]
|
|
1703
|
+
|
|
1704
|
+
Description:
|
|
1705
|
+
Search indexed and published skills on askill.sh.
|
|
1706
|
+
|
|
1707
|
+
Options:
|
|
1708
|
+
--full-desc Show full descriptions
|
|
1709
|
+
|
|
1710
|
+
Examples:
|
|
1711
|
+
askill find memory
|
|
1712
|
+
askill find code review --full-desc`,
|
|
1713
|
+
info: `${BOLD}askill info${RESET}
|
|
1714
|
+
|
|
1715
|
+
Usage:
|
|
1716
|
+
askill info <slug>
|
|
1717
|
+
|
|
1718
|
+
Description:
|
|
1719
|
+
Show detailed metadata and installation info for one skill.
|
|
1720
|
+
|
|
1721
|
+
Examples:
|
|
1722
|
+
askill info @johndoe/awesome-tool
|
|
1723
|
+
askill info gh:facebook/react@extract-errors`,
|
|
1724
|
+
check: `${BOLD}askill check${RESET}
|
|
1725
|
+
|
|
1726
|
+
Usage:
|
|
1727
|
+
askill check [skill]
|
|
1728
|
+
|
|
1729
|
+
Description:
|
|
1730
|
+
Check installed skills for available updates without installing.
|
|
1731
|
+
|
|
1732
|
+
Examples:
|
|
1733
|
+
askill check
|
|
1734
|
+
askill check memory`,
|
|
1735
|
+
update: `${BOLD}askill update${RESET}
|
|
1736
|
+
|
|
1737
|
+
Usage:
|
|
1738
|
+
askill update [skill]
|
|
1739
|
+
|
|
1740
|
+
Description:
|
|
1741
|
+
Update one installed skill or all installed skills.
|
|
1742
|
+
|
|
1743
|
+
Examples:
|
|
1744
|
+
askill update
|
|
1745
|
+
askill update memory`,
|
|
1746
|
+
run: `${BOLD}askill run${RESET}
|
|
1747
|
+
|
|
1748
|
+
Usage:
|
|
1749
|
+
askill run <skill>:<command> [args...]
|
|
1750
|
+
|
|
1751
|
+
Description:
|
|
1752
|
+
Run a command declared in a skill's SKILL.md frontmatter.
|
|
1753
|
+
|
|
1754
|
+
Examples:
|
|
1755
|
+
askill run @anthropic/memory:save --key name --value "Alice"
|
|
1756
|
+
askill run my-skill:_setup`,
|
|
1757
|
+
validate: `${BOLD}askill validate${RESET}
|
|
1758
|
+
|
|
1759
|
+
Usage:
|
|
1760
|
+
askill validate [path]
|
|
1761
|
+
|
|
1762
|
+
Description:
|
|
1763
|
+
Validate SKILL.md frontmatter and command structure.
|
|
1764
|
+
|
|
1765
|
+
Examples:
|
|
1766
|
+
askill validate
|
|
1767
|
+
askill validate ./my-skill/SKILL.md`,
|
|
1768
|
+
init: `${BOLD}askill init${RESET}
|
|
1769
|
+
|
|
1770
|
+
Usage:
|
|
1771
|
+
askill init [dir] [options]
|
|
1772
|
+
|
|
1773
|
+
Description:
|
|
1774
|
+
Generate a new SKILL.md template interactively or non-interactively.
|
|
1775
|
+
|
|
1776
|
+
Options:
|
|
1777
|
+
-y, --yes Use defaults without prompts
|
|
1778
|
+
|
|
1779
|
+
Examples:
|
|
1780
|
+
askill init
|
|
1781
|
+
askill init ./my-skill -y`,
|
|
1782
|
+
submit: `${BOLD}askill submit${RESET}
|
|
1783
|
+
|
|
1784
|
+
Usage:
|
|
1785
|
+
askill submit <github-url>
|
|
1786
|
+
|
|
1787
|
+
Description:
|
|
1788
|
+
Submit a GitHub repository or SKILL.md URL for indexing on askill.sh.
|
|
1789
|
+
|
|
1790
|
+
Examples:
|
|
1791
|
+
askill submit https://github.com/owner/repo
|
|
1792
|
+
askill submit https://github.com/owner/repo/blob/main/skills/foo/SKILL.md`,
|
|
1793
|
+
login: `${BOLD}askill login${RESET}
|
|
1794
|
+
|
|
1795
|
+
Usage:
|
|
1796
|
+
askill login [--token <ask_xxx>]
|
|
1797
|
+
|
|
1798
|
+
Description:
|
|
1799
|
+
Save and verify an askill API token for publishing.
|
|
1800
|
+
|
|
1801
|
+
Examples:
|
|
1802
|
+
askill login
|
|
1803
|
+
askill login --token ask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
|
|
1804
|
+
logout: `${BOLD}askill logout${RESET}
|
|
1805
|
+
|
|
1806
|
+
Usage:
|
|
1807
|
+
askill logout
|
|
1808
|
+
|
|
1809
|
+
Description:
|
|
1810
|
+
Clear saved local credentials.`,
|
|
1811
|
+
whoami: `${BOLD}askill whoami${RESET}
|
|
1812
|
+
|
|
1813
|
+
Usage:
|
|
1814
|
+
askill whoami
|
|
1815
|
+
|
|
1816
|
+
Description:
|
|
1817
|
+
Show current authenticated account and masked token.`,
|
|
1818
|
+
publish: `${BOLD}askill publish${RESET}
|
|
1819
|
+
|
|
1820
|
+
Usage:
|
|
1821
|
+
askill publish [path]
|
|
1822
|
+
askill publish --github <blob-url-to-SKILL.md>
|
|
1823
|
+
|
|
1824
|
+
Description:
|
|
1825
|
+
Publish a skill under your author scope (@author/skill-name).
|
|
1826
|
+
|
|
1827
|
+
Requirements:
|
|
1828
|
+
- Logged in via askill login
|
|
1829
|
+
- SKILL.md contains valid name and semver version
|
|
1830
|
+
|
|
1831
|
+
Examples:
|
|
1832
|
+
askill publish
|
|
1833
|
+
askill publish ./skills/my-skill
|
|
1834
|
+
askill publish --github https://github.com/owner/repo/blob/main/skills/my-skill/SKILL.md`,
|
|
1835
|
+
upgrade: `${BOLD}askill upgrade${RESET}
|
|
1836
|
+
|
|
1837
|
+
Usage:
|
|
1838
|
+
askill upgrade
|
|
1839
|
+
|
|
1840
|
+
Description:
|
|
1841
|
+
Self-update askill CLI to the latest available version.`,
|
|
1842
|
+
help: `${BOLD}askill help${RESET}
|
|
1843
|
+
|
|
1844
|
+
Usage:
|
|
1845
|
+
askill help
|
|
1846
|
+
askill help <command>
|
|
1847
|
+
|
|
1848
|
+
Description:
|
|
1849
|
+
Show global help or detailed help for a specific command.`
|
|
1850
|
+
};
|
|
1851
|
+
const text2 = helps[command];
|
|
1852
|
+
if (!text2) return false;
|
|
1853
|
+
console.log();
|
|
1854
|
+
console.log(text2);
|
|
1855
|
+
console.log();
|
|
1856
|
+
return true;
|
|
1857
|
+
}
|
|
1858
|
+
async function maybeAutoUpgradeOnStartup(commandInput) {
|
|
1859
|
+
const command = normalizeCommand(commandInput);
|
|
1860
|
+
const skipCommands = /* @__PURE__ */ new Set(["upgrade", "help", "version", "--version", "-v", "--help", "-h"]);
|
|
1861
|
+
if (skipCommands.has(command)) return;
|
|
1862
|
+
const available = await getAvailableUpdate(false).catch(() => null);
|
|
1863
|
+
if (!available) return;
|
|
1864
|
+
console.log(`${DIM}Auto-updating askill: ${available.current} -> ${available.latest}${RESET}`);
|
|
1865
|
+
await selfUpdate();
|
|
1866
|
+
}
|
|
1588
1867
|
function parseInstallOptions(args) {
|
|
1589
1868
|
const options = {};
|
|
1590
1869
|
let skillName = "";
|
|
@@ -1716,11 +1995,13 @@ async function resolveSkillsViaApi(parsed, spinner2, options) {
|
|
|
1716
1995
|
}
|
|
1717
1996
|
async function runInstall(args) {
|
|
1718
1997
|
const { skillName, options } = parseInstallOptions(args);
|
|
1998
|
+
const plainMode = Boolean(options.yes) || !process.stdout.isTTY;
|
|
1719
1999
|
if (!skillName) {
|
|
1720
2000
|
console.log(`${RED}Error: Missing skill identifier${RESET}`);
|
|
1721
2001
|
console.log(`Usage: askill add <source>`);
|
|
1722
2002
|
console.log(`
|
|
1723
2003
|
Formats supported:`);
|
|
2004
|
+
console.log(` askill add @author/skill-name ${DIM}# published skill${RESET}`);
|
|
1724
2005
|
console.log(` askill add owner/repo ${DIM}# all skills from repo${RESET}`);
|
|
1725
2006
|
console.log(` askill add owner/repo@skill-name ${DIM}# specific skill${RESET}`);
|
|
1726
2007
|
console.log(` askill add owner/repo/path/to/skill ${DIM}# skill by path${RESET}`);
|
|
@@ -1728,9 +2009,11 @@ Formats supported:`);
|
|
|
1728
2009
|
console.log(` askill add ./local/path ${DIM}# local directory${RESET}`);
|
|
1729
2010
|
process.exit(1);
|
|
1730
2011
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
2012
|
+
if (!plainMode) {
|
|
2013
|
+
console.log();
|
|
2014
|
+
p.intro(pc.bgCyan(pc.black(" askill install ")));
|
|
2015
|
+
}
|
|
2016
|
+
const spinner2 = createSpinner(plainMode);
|
|
1734
2017
|
const { skills: discoveredSkills, parsed: sourceParsed, tempDir } = await resolveSkills(skillName, spinner2, options);
|
|
1735
2018
|
const cleanup = async () => {
|
|
1736
2019
|
if (tempDir) await cleanupTempDir(tempDir).catch(() => {
|
|
@@ -1739,7 +2022,11 @@ Formats supported:`);
|
|
|
1739
2022
|
try {
|
|
1740
2023
|
if (discoveredSkills.length === 0) {
|
|
1741
2024
|
p.log.warning("No skills found");
|
|
1742
|
-
|
|
2025
|
+
if (plainMode) {
|
|
2026
|
+
console.log(`Browse skills at ${pc.cyan("https://askill.sh")}`);
|
|
2027
|
+
} else {
|
|
2028
|
+
p.outro(`Browse skills at ${pc.cyan("https://askill.sh")}`);
|
|
2029
|
+
}
|
|
1743
2030
|
return;
|
|
1744
2031
|
}
|
|
1745
2032
|
if (options.list) {
|
|
@@ -1756,7 +2043,11 @@ Formats supported:`);
|
|
|
1756
2043
|
}
|
|
1757
2044
|
console.log();
|
|
1758
2045
|
}
|
|
1759
|
-
|
|
2046
|
+
if (plainMode) {
|
|
2047
|
+
console.log(`Install with: ${pc.cyan(`askill add ${skillName} --all`)}`);
|
|
2048
|
+
} else {
|
|
2049
|
+
p.outro(`Install with: ${pc.cyan(`askill add ${skillName} --all`)}`);
|
|
2050
|
+
}
|
|
1760
2051
|
return;
|
|
1761
2052
|
}
|
|
1762
2053
|
let skillsToInstall;
|
|
@@ -2011,12 +2302,16 @@ Formats supported:`);
|
|
|
2011
2302
|
}
|
|
2012
2303
|
}
|
|
2013
2304
|
console.log();
|
|
2014
|
-
|
|
2305
|
+
if (plainMode) {
|
|
2306
|
+
console.log(pc.green("Done!"));
|
|
2307
|
+
} else {
|
|
2308
|
+
p.outro(pc.green("Done!"));
|
|
2309
|
+
}
|
|
2015
2310
|
} finally {
|
|
2016
2311
|
await cleanup();
|
|
2017
2312
|
}
|
|
2018
2313
|
}
|
|
2019
|
-
var SEARCH_DESCRIPTION_MAX_LENGTH =
|
|
2314
|
+
var SEARCH_DESCRIPTION_MAX_LENGTH = 500;
|
|
2020
2315
|
function toNumber(value) {
|
|
2021
2316
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2022
2317
|
return null;
|
|
@@ -2128,8 +2423,28 @@ function getAIScoreDimensions(skill) {
|
|
|
2128
2423
|
return a.label.localeCompare(b.label);
|
|
2129
2424
|
});
|
|
2130
2425
|
}
|
|
2426
|
+
function normalizeInfoTarget(input) {
|
|
2427
|
+
const trimmed = input.trim();
|
|
2428
|
+
if (!trimmed) {
|
|
2429
|
+
return trimmed;
|
|
2430
|
+
}
|
|
2431
|
+
const withoutGh = trimmed.replace(/^gh:/i, "");
|
|
2432
|
+
const askillSkillUrl = withoutGh.match(/^https?:\/\/askill\.sh\/skills\/(.+)$/i);
|
|
2433
|
+
if (askillSkillUrl && askillSkillUrl[1]) {
|
|
2434
|
+
return askillSkillUrl[1];
|
|
2435
|
+
}
|
|
2436
|
+
return withoutGh;
|
|
2437
|
+
}
|
|
2438
|
+
function parseSearchOptions(args) {
|
|
2439
|
+
const fullDesc = args.includes("--full-desc");
|
|
2440
|
+
const query = args.filter((arg) => arg !== "--full-desc").join(" ");
|
|
2441
|
+
return {
|
|
2442
|
+
fullDesc,
|
|
2443
|
+
query
|
|
2444
|
+
};
|
|
2445
|
+
}
|
|
2131
2446
|
async function runSearch(args) {
|
|
2132
|
-
const query = args
|
|
2447
|
+
const { fullDesc, query } = parseSearchOptions(args);
|
|
2133
2448
|
console.log();
|
|
2134
2449
|
p.intro(pc.bgCyan(pc.black(" askill search ")));
|
|
2135
2450
|
const spinner2 = p.spinner();
|
|
@@ -2152,7 +2467,11 @@ async function runSearch(args) {
|
|
|
2152
2467
|
console.log(` ${pc.cyan(displayName)} ${pc.dim(`by ${owner}`)}`);
|
|
2153
2468
|
console.log(` ${pc.dim("AI score:")} ${formatScore(aiScore)}`);
|
|
2154
2469
|
if (description) {
|
|
2155
|
-
|
|
2470
|
+
if (fullDesc) {
|
|
2471
|
+
console.log(` ${pc.dim(description)}`);
|
|
2472
|
+
} else {
|
|
2473
|
+
console.log(` ${pc.dim(description.slice(0, SEARCH_DESCRIPTION_MAX_LENGTH))}${description.length > SEARCH_DESCRIPTION_MAX_LENGTH ? "..." : ""}`);
|
|
2474
|
+
}
|
|
2156
2475
|
}
|
|
2157
2476
|
const installCmd = skill.owner && skill.repo ? `gh:${skill.owner}/${skill.repo}@${displayName}` : `gh:${displayName}`;
|
|
2158
2477
|
console.log(` ${pc.dim("askill add")} ${installCmd}`);
|
|
@@ -2236,12 +2555,13 @@ async function runRemove(args) {
|
|
|
2236
2555
|
p.outro(pc.green(`Removed ${skillName} from ${agentsWithSkill.length} agent(s)`));
|
|
2237
2556
|
}
|
|
2238
2557
|
async function runInfo(args) {
|
|
2239
|
-
const
|
|
2240
|
-
if (!
|
|
2558
|
+
const inputTarget = args[0];
|
|
2559
|
+
if (!inputTarget) {
|
|
2241
2560
|
console.log(`${RED}Error: Missing skill name${RESET}`);
|
|
2242
2561
|
console.log(`Usage: askill info <skill-name>`);
|
|
2243
2562
|
process.exit(1);
|
|
2244
2563
|
}
|
|
2564
|
+
const skillName = normalizeInfoTarget(inputTarget);
|
|
2245
2565
|
console.log();
|
|
2246
2566
|
p.intro(pc.bgCyan(pc.black(" askill info ")));
|
|
2247
2567
|
const spinner2 = p.spinner();
|
|
@@ -3078,8 +3398,16 @@ async function runPublish(args) {
|
|
|
3078
3398
|
p.log.error("SKILL.md must include frontmatter name");
|
|
3079
3399
|
process.exit(1);
|
|
3080
3400
|
}
|
|
3081
|
-
if (!version
|
|
3082
|
-
p.log.error(
|
|
3401
|
+
if (!version) {
|
|
3402
|
+
p.log.error('SKILL.md is missing frontmatter field "version".');
|
|
3403
|
+
p.log.info("Add a semver version, for example: version: 0.1.0");
|
|
3404
|
+
p.log.info("Valid examples: 1.0.0, 1.2.3-beta.1, 2.0.0+build.5");
|
|
3405
|
+
process.exit(1);
|
|
3406
|
+
}
|
|
3407
|
+
if (!/^\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?$/.test(version)) {
|
|
3408
|
+
p.log.error(`Invalid semver version in SKILL.md: "${version}"`);
|
|
3409
|
+
p.log.info("Expected format: MAJOR.MINOR.PATCH with optional prerelease/build");
|
|
3410
|
+
p.log.info("Examples: 1.0.0, 1.1.0-beta.1, 2.0.0+build.7");
|
|
3083
3411
|
process.exit(1);
|
|
3084
3412
|
}
|
|
3085
3413
|
console.log();
|
|
@@ -3113,14 +3441,16 @@ function toRawGitHubUrl(url) {
|
|
|
3113
3441
|
}
|
|
3114
3442
|
async function main() {
|
|
3115
3443
|
const args = process.argv.slice(2);
|
|
3116
|
-
checkForUpdates().catch(() => {
|
|
3117
|
-
});
|
|
3118
3444
|
if (args.length === 0) {
|
|
3119
3445
|
showBanner();
|
|
3120
3446
|
return;
|
|
3121
3447
|
}
|
|
3122
3448
|
const command = args[0];
|
|
3123
3449
|
const restArgs = args.slice(1);
|
|
3450
|
+
if ((restArgs.includes("--help") || restArgs.includes("-h")) && showCommandHelp(command)) {
|
|
3451
|
+
return;
|
|
3452
|
+
}
|
|
3453
|
+
await maybeAutoUpgradeOnStartup(command);
|
|
3124
3454
|
switch (command) {
|
|
3125
3455
|
case "install":
|
|
3126
3456
|
case "i":
|
|
@@ -3181,6 +3511,9 @@ async function main() {
|
|
|
3181
3511
|
case "--help":
|
|
3182
3512
|
case "-h":
|
|
3183
3513
|
case "help":
|
|
3514
|
+
if (restArgs[0] && showCommandHelp(restArgs[0])) {
|
|
3515
|
+
break;
|
|
3516
|
+
}
|
|
3184
3517
|
showHelp();
|
|
3185
3518
|
break;
|
|
3186
3519
|
case "--version":
|