@arrislink/axon 1.4.0 → 1.5.0
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/index.js +415 -259
- package/package.json +1 -1
- package/templates/skills/api/rest-crud.md +0 -240
- package/templates/skills/auth/jwt.md +0 -186
- package/templates/skills/database/postgres-schema.md +0 -161
package/dist/index.js
CHANGED
|
@@ -20495,186 +20495,6 @@ var init_recommender = __esm(() => {
|
|
|
20495
20495
|
init_source();
|
|
20496
20496
|
});
|
|
20497
20497
|
|
|
20498
|
-
// src/core/skills/library.ts
|
|
20499
|
-
var exports_library = {};
|
|
20500
|
-
__export(exports_library, {
|
|
20501
|
-
SkillsLibrary: () => SkillsLibrary
|
|
20502
|
-
});
|
|
20503
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync2 } from "fs";
|
|
20504
|
-
import { readdir, readFile, writeFile } from "fs/promises";
|
|
20505
|
-
import { join as join5, basename, dirname as dirname2 } from "path";
|
|
20506
|
-
function parseFrontmatter(content) {
|
|
20507
|
-
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
20508
|
-
if (!match) {
|
|
20509
|
-
return { metadata: {}, body: content };
|
|
20510
|
-
}
|
|
20511
|
-
const [, frontmatter, body] = match;
|
|
20512
|
-
const metadata = {};
|
|
20513
|
-
for (const line of frontmatter.split(`
|
|
20514
|
-
`)) {
|
|
20515
|
-
const colonIndex = line.indexOf(":");
|
|
20516
|
-
if (colonIndex > 0) {
|
|
20517
|
-
const key = line.slice(0, colonIndex).trim();
|
|
20518
|
-
let value = line.slice(colonIndex + 1).trim();
|
|
20519
|
-
if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
|
|
20520
|
-
try {
|
|
20521
|
-
value = JSON.parse(value);
|
|
20522
|
-
} catch {
|
|
20523
|
-
const strValue = value;
|
|
20524
|
-
const inner = strValue.slice(1, -1).trim();
|
|
20525
|
-
if (inner) {
|
|
20526
|
-
value = inner.split(",").map((s) => s.trim());
|
|
20527
|
-
} else {
|
|
20528
|
-
value = [];
|
|
20529
|
-
}
|
|
20530
|
-
}
|
|
20531
|
-
}
|
|
20532
|
-
metadata[key] = value;
|
|
20533
|
-
}
|
|
20534
|
-
}
|
|
20535
|
-
return { metadata, body: body.trim() };
|
|
20536
|
-
}
|
|
20537
|
-
|
|
20538
|
-
class SkillsLibrary {
|
|
20539
|
-
skills = [];
|
|
20540
|
-
indexed = false;
|
|
20541
|
-
paths;
|
|
20542
|
-
constructor(localPath, globalPath) {
|
|
20543
|
-
this.paths = [localPath, globalPath].filter((p) => existsSync4(p));
|
|
20544
|
-
}
|
|
20545
|
-
async index() {
|
|
20546
|
-
this.skills = [];
|
|
20547
|
-
for (const basePath of this.paths) {
|
|
20548
|
-
await this.indexDirectory(basePath);
|
|
20549
|
-
}
|
|
20550
|
-
this.indexed = true;
|
|
20551
|
-
}
|
|
20552
|
-
async indexDirectory(dir) {
|
|
20553
|
-
if (!existsSync4(dir))
|
|
20554
|
-
return;
|
|
20555
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
20556
|
-
for (const entry of entries) {
|
|
20557
|
-
const fullPath = join5(dir, entry.name);
|
|
20558
|
-
if (entry.isDirectory()) {
|
|
20559
|
-
await this.indexDirectory(fullPath);
|
|
20560
|
-
} else if (entry.name.endsWith(".md")) {
|
|
20561
|
-
try {
|
|
20562
|
-
const content = await readFile(fullPath, "utf-8");
|
|
20563
|
-
const { metadata, body } = parseFrontmatter(content);
|
|
20564
|
-
this.skills.push({
|
|
20565
|
-
metadata: {
|
|
20566
|
-
name: metadata["name"] || basename(fullPath, ".md"),
|
|
20567
|
-
description: metadata["description"] || "",
|
|
20568
|
-
tags: metadata["tags"] || [],
|
|
20569
|
-
models: metadata["models"] || [],
|
|
20570
|
-
tokens_avg: Number(metadata["tokens_avg"]) || 2000,
|
|
20571
|
-
difficulty: metadata["difficulty"] || "medium",
|
|
20572
|
-
last_updated: metadata["last_updated"] || new Date().toISOString()
|
|
20573
|
-
},
|
|
20574
|
-
content: body,
|
|
20575
|
-
path: fullPath
|
|
20576
|
-
});
|
|
20577
|
-
} catch {}
|
|
20578
|
-
}
|
|
20579
|
-
}
|
|
20580
|
-
}
|
|
20581
|
-
async search(query, limit = 5) {
|
|
20582
|
-
if (!this.indexed) {
|
|
20583
|
-
await this.index();
|
|
20584
|
-
}
|
|
20585
|
-
const queryLower = query.toLowerCase();
|
|
20586
|
-
const results = [];
|
|
20587
|
-
for (const skill of this.skills) {
|
|
20588
|
-
let score = 0;
|
|
20589
|
-
const matchedOn = [];
|
|
20590
|
-
if (skill.metadata.name.toLowerCase().includes(queryLower)) {
|
|
20591
|
-
score += 100;
|
|
20592
|
-
matchedOn.push("name");
|
|
20593
|
-
}
|
|
20594
|
-
for (const tag of skill.metadata.tags) {
|
|
20595
|
-
if (tag.toLowerCase().includes(queryLower)) {
|
|
20596
|
-
score += 50;
|
|
20597
|
-
if (!matchedOn.includes("tags"))
|
|
20598
|
-
matchedOn.push("tags");
|
|
20599
|
-
}
|
|
20600
|
-
}
|
|
20601
|
-
if (skill.metadata.description.toLowerCase().includes(queryLower)) {
|
|
20602
|
-
score += 30;
|
|
20603
|
-
matchedOn.push("description");
|
|
20604
|
-
}
|
|
20605
|
-
const contentMatches = (skill.content.toLowerCase().match(new RegExp(queryLower, "g")) || []).length;
|
|
20606
|
-
if (contentMatches > 0) {
|
|
20607
|
-
score += contentMatches * 10;
|
|
20608
|
-
matchedOn.push("content");
|
|
20609
|
-
}
|
|
20610
|
-
if (score > 0) {
|
|
20611
|
-
results.push({ skill, score, matchedOn });
|
|
20612
|
-
}
|
|
20613
|
-
}
|
|
20614
|
-
return results.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
20615
|
-
}
|
|
20616
|
-
async getByPath(path) {
|
|
20617
|
-
if (!this.indexed) {
|
|
20618
|
-
await this.index();
|
|
20619
|
-
}
|
|
20620
|
-
return this.skills.find((s) => s.path === path) || null;
|
|
20621
|
-
}
|
|
20622
|
-
async save(skill, targetPath) {
|
|
20623
|
-
const dir = dirname2(targetPath);
|
|
20624
|
-
if (!existsSync4(dir)) {
|
|
20625
|
-
mkdirSync2(dir, { recursive: true });
|
|
20626
|
-
}
|
|
20627
|
-
const frontmatter = [
|
|
20628
|
-
"---",
|
|
20629
|
-
`name: ${skill.metadata.name}`,
|
|
20630
|
-
`description: ${skill.metadata.description}`,
|
|
20631
|
-
`tags: ${JSON.stringify(skill.metadata.tags)}`,
|
|
20632
|
-
`models: ${JSON.stringify(skill.metadata.models)}`,
|
|
20633
|
-
`tokens_avg: ${skill.metadata.tokens_avg}`,
|
|
20634
|
-
`difficulty: ${skill.metadata.difficulty}`,
|
|
20635
|
-
`last_updated: ${new Date().toISOString().split("T")[0]}`,
|
|
20636
|
-
"---",
|
|
20637
|
-
""
|
|
20638
|
-
].join(`
|
|
20639
|
-
`);
|
|
20640
|
-
const content = frontmatter + skill.content;
|
|
20641
|
-
await writeFile(targetPath, content, "utf-8");
|
|
20642
|
-
this.indexed = false;
|
|
20643
|
-
}
|
|
20644
|
-
async list(filter) {
|
|
20645
|
-
if (!this.indexed) {
|
|
20646
|
-
await this.index();
|
|
20647
|
-
}
|
|
20648
|
-
let result = [...this.skills];
|
|
20649
|
-
if (filter?.tags?.length) {
|
|
20650
|
-
result = result.filter((s) => s.metadata.tags.some((t2) => filter.tags?.includes(t2)));
|
|
20651
|
-
}
|
|
20652
|
-
if (filter?.difficulty) {
|
|
20653
|
-
result = result.filter((s) => s.metadata.difficulty === filter.difficulty);
|
|
20654
|
-
}
|
|
20655
|
-
return result;
|
|
20656
|
-
}
|
|
20657
|
-
async getStats() {
|
|
20658
|
-
if (!this.indexed) {
|
|
20659
|
-
await this.index();
|
|
20660
|
-
}
|
|
20661
|
-
const byTag = {};
|
|
20662
|
-
const byDifficulty = {};
|
|
20663
|
-
for (const skill of this.skills) {
|
|
20664
|
-
for (const tag of skill.metadata.tags) {
|
|
20665
|
-
byTag[tag] = (byTag[tag] || 0) + 1;
|
|
20666
|
-
}
|
|
20667
|
-
byDifficulty[skill.metadata.difficulty] = (byDifficulty[skill.metadata.difficulty] || 0) + 1;
|
|
20668
|
-
}
|
|
20669
|
-
return {
|
|
20670
|
-
total: this.skills.length,
|
|
20671
|
-
byTag,
|
|
20672
|
-
byDifficulty
|
|
20673
|
-
};
|
|
20674
|
-
}
|
|
20675
|
-
}
|
|
20676
|
-
var init_library = () => {};
|
|
20677
|
-
|
|
20678
20498
|
// src/utils/prompt.ts
|
|
20679
20499
|
var exports_prompt = {};
|
|
20680
20500
|
__export(exports_prompt, {
|
|
@@ -20863,7 +20683,7 @@ __export(exports_omo_config_reader, {
|
|
|
20863
20683
|
getOMOConfigPaths: () => getOMOConfigPaths,
|
|
20864
20684
|
OMOConfigReader: () => OMOConfigReader
|
|
20865
20685
|
});
|
|
20866
|
-
import { existsSync as
|
|
20686
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
20867
20687
|
import { homedir as homedir2 } from "os";
|
|
20868
20688
|
function resolveProviderType(modelString) {
|
|
20869
20689
|
const [prefix] = (modelString || "").split("/");
|
|
@@ -20886,7 +20706,7 @@ function getOMOConfigPaths() {
|
|
|
20886
20706
|
];
|
|
20887
20707
|
}
|
|
20888
20708
|
function hasOMOConfig() {
|
|
20889
|
-
return getOMOConfigPaths().some((path) =>
|
|
20709
|
+
return getOMOConfigPaths().some((path) => existsSync5(path));
|
|
20890
20710
|
}
|
|
20891
20711
|
|
|
20892
20712
|
class OMOConfigReader {
|
|
@@ -20902,7 +20722,7 @@ class OMOConfigReader {
|
|
|
20902
20722
|
loadConfig() {
|
|
20903
20723
|
const paths = getOMOConfigPaths();
|
|
20904
20724
|
for (const path of paths) {
|
|
20905
|
-
if (
|
|
20725
|
+
if (existsSync5(path)) {
|
|
20906
20726
|
try {
|
|
20907
20727
|
const content = readFileSync3(path, "utf-8");
|
|
20908
20728
|
if (path.endsWith(".yaml") || path.endsWith(".yml")) {
|
|
@@ -20926,7 +20746,7 @@ class OMOConfigReader {
|
|
|
20926
20746
|
loadAntigravityToken() {
|
|
20927
20747
|
try {
|
|
20928
20748
|
const accountsPath = `${homedir2()}/.config/opencode/antigravity-accounts.json`;
|
|
20929
|
-
if (
|
|
20749
|
+
if (existsSync5(accountsPath)) {
|
|
20930
20750
|
const accounts = JSON.parse(readFileSync3(accountsPath, "utf-8"));
|
|
20931
20751
|
if (accounts.accounts?.length > 0) {
|
|
20932
20752
|
const activeIdx = accounts.activeIndex ?? 0;
|
|
@@ -20940,7 +20760,7 @@ class OMOConfigReader {
|
|
|
20940
20760
|
}
|
|
20941
20761
|
mergeOpenCodeProviders() {
|
|
20942
20762
|
const opencodePath = `${homedir2()}/.config/opencode/opencode.json`;
|
|
20943
|
-
if (!
|
|
20763
|
+
if (!existsSync5(opencodePath))
|
|
20944
20764
|
return;
|
|
20945
20765
|
try {
|
|
20946
20766
|
const content = readFileSync3(opencodePath, "utf-8");
|
|
@@ -28870,7 +28690,7 @@ var require_BufferList = __commonJS((exports, module) => {
|
|
|
28870
28690
|
this.head = this.tail = null;
|
|
28871
28691
|
this.length = 0;
|
|
28872
28692
|
};
|
|
28873
|
-
BufferList.prototype.join = function
|
|
28693
|
+
BufferList.prototype.join = function join6(s) {
|
|
28874
28694
|
if (this.length === 0)
|
|
28875
28695
|
return "";
|
|
28876
28696
|
var p = this.head;
|
|
@@ -46881,7 +46701,7 @@ var require_files = __commonJS((exports) => {
|
|
|
46881
46701
|
var fs = __require("fs");
|
|
46882
46702
|
var url = __require("url");
|
|
46883
46703
|
var os2 = __require("os");
|
|
46884
|
-
var
|
|
46704
|
+
var dirname2 = __require("path").dirname;
|
|
46885
46705
|
var resolvePath = __require("path").resolve;
|
|
46886
46706
|
var isAbsolutePath = require_path_is_absolute();
|
|
46887
46707
|
var promises = require_promises();
|
|
@@ -46896,10 +46716,10 @@ var require_files = __commonJS((exports) => {
|
|
|
46896
46716
|
}
|
|
46897
46717
|
};
|
|
46898
46718
|
}
|
|
46899
|
-
var base = options.relativeToFile ?
|
|
46719
|
+
var base = options.relativeToFile ? dirname2(options.relativeToFile) : null;
|
|
46900
46720
|
function read(uri, encoding) {
|
|
46901
46721
|
return resolveUri(uri).then(function(path) {
|
|
46902
|
-
return
|
|
46722
|
+
return readFile(path, encoding).caught(function(error) {
|
|
46903
46723
|
var message = "could not open external image: '" + uri + "' (document directory: '" + base + `')
|
|
46904
46724
|
` + error.message;
|
|
46905
46725
|
return promises.reject(new Error(message));
|
|
@@ -46920,7 +46740,7 @@ var require_files = __commonJS((exports) => {
|
|
|
46920
46740
|
read
|
|
46921
46741
|
};
|
|
46922
46742
|
}
|
|
46923
|
-
var
|
|
46743
|
+
var readFile = promises.promisify(fs.readFile.bind(fs));
|
|
46924
46744
|
function uriToPath(uriString, platform) {
|
|
46925
46745
|
if (!platform) {
|
|
46926
46746
|
platform = os2.platform();
|
|
@@ -49391,10 +49211,10 @@ var require_unzip = __commonJS((exports) => {
|
|
|
49391
49211
|
var promises = require_promises();
|
|
49392
49212
|
var zipfile = require_zipfile();
|
|
49393
49213
|
exports.openZip = openZip;
|
|
49394
|
-
var
|
|
49214
|
+
var readFile = promises.promisify(fs.readFile);
|
|
49395
49215
|
function openZip(options) {
|
|
49396
49216
|
if (options.path) {
|
|
49397
|
-
return
|
|
49217
|
+
return readFile(options.path).then(zipfile.openArrayBuffer);
|
|
49398
49218
|
} else if (options.buffer) {
|
|
49399
49219
|
return promises.resolve(zipfile.openArrayBuffer(options.buffer));
|
|
49400
49220
|
} else if (options.file) {
|
|
@@ -49508,8 +49328,8 @@ var require_lib7 = __commonJS((exports) => {
|
|
|
49508
49328
|
});
|
|
49509
49329
|
|
|
49510
49330
|
// src/core/docs/manager.ts
|
|
49511
|
-
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as
|
|
49512
|
-
import { join as
|
|
49331
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync6, readdirSync, lstatSync } from "fs";
|
|
49332
|
+
import { join as join6, basename as basename2, extname } from "path";
|
|
49513
49333
|
|
|
49514
49334
|
class DocumentManager {
|
|
49515
49335
|
library;
|
|
@@ -49518,12 +49338,12 @@ class DocumentManager {
|
|
|
49518
49338
|
llm;
|
|
49519
49339
|
constructor(projectRoot = process.cwd()) {
|
|
49520
49340
|
this.projectRoot = projectRoot;
|
|
49521
|
-
this.libraryPath =
|
|
49341
|
+
this.libraryPath = join6(projectRoot, ".axon", "docs", "library.json");
|
|
49522
49342
|
this.llm = new AxonLLMClient;
|
|
49523
49343
|
this.library = this.load();
|
|
49524
49344
|
}
|
|
49525
49345
|
load() {
|
|
49526
|
-
if (!
|
|
49346
|
+
if (!existsSync6(this.libraryPath)) {
|
|
49527
49347
|
return {
|
|
49528
49348
|
version: "1.0",
|
|
49529
49349
|
documents: [],
|
|
@@ -49543,10 +49363,10 @@ class DocumentManager {
|
|
|
49543
49363
|
}
|
|
49544
49364
|
}
|
|
49545
49365
|
save() {
|
|
49546
|
-
const dir =
|
|
49547
|
-
if (!
|
|
49548
|
-
const { mkdirSync:
|
|
49549
|
-
|
|
49366
|
+
const dir = join6(this.projectRoot, ".axon", "docs");
|
|
49367
|
+
if (!existsSync6(dir)) {
|
|
49368
|
+
const { mkdirSync: mkdirSync3 } = __require("fs");
|
|
49369
|
+
mkdirSync3(dir, { recursive: true });
|
|
49550
49370
|
}
|
|
49551
49371
|
this.library.indexed_at = new Date().toISOString();
|
|
49552
49372
|
writeFileSync2(this.libraryPath, JSON.stringify(this.library, null, 2), "utf-8");
|
|
@@ -49593,7 +49413,7 @@ class DocumentManager {
|
|
|
49593
49413
|
id,
|
|
49594
49414
|
type,
|
|
49595
49415
|
path: filePath,
|
|
49596
|
-
title: options?.title || enrichedMetadata.title ||
|
|
49416
|
+
title: options?.title || enrichedMetadata.title || basename2(filePath),
|
|
49597
49417
|
content,
|
|
49598
49418
|
metadata: { ...metadata, ...enrichedMetadata },
|
|
49599
49419
|
added_at: new Date().toISOString(),
|
|
@@ -49756,7 +49576,7 @@ ${doc.content?.slice(0, 1e4)}
|
|
|
49756
49576
|
const files = [];
|
|
49757
49577
|
const entries = readdirSync(dirPath);
|
|
49758
49578
|
for (const entry of entries) {
|
|
49759
|
-
const fullPath =
|
|
49579
|
+
const fullPath = join6(dirPath, entry);
|
|
49760
49580
|
const stat = lstatSync(fullPath);
|
|
49761
49581
|
if (stat.isDirectory()) {
|
|
49762
49582
|
if (entry === ".axon" || entry === ".git" || entry === "node_modules")
|
|
@@ -50004,8 +49824,8 @@ var init_collector = __esm(() => {
|
|
|
50004
49824
|
});
|
|
50005
49825
|
|
|
50006
49826
|
// src/core/spec/generator.ts
|
|
50007
|
-
import { existsSync as
|
|
50008
|
-
import { dirname as
|
|
49827
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
49828
|
+
import { dirname as dirname2 } from "path";
|
|
50009
49829
|
|
|
50010
49830
|
class SpecGenerator {
|
|
50011
49831
|
llm = null;
|
|
@@ -50170,9 +49990,9 @@ ${collected.additionalRequirements}` : ""}
|
|
|
50170
49990
|
return names[feature] || feature;
|
|
50171
49991
|
}
|
|
50172
49992
|
async save(content, targetPath) {
|
|
50173
|
-
const dir =
|
|
50174
|
-
if (!
|
|
50175
|
-
|
|
49993
|
+
const dir = dirname2(targetPath);
|
|
49994
|
+
if (!existsSync7(dir)) {
|
|
49995
|
+
mkdirSync3(dir, { recursive: true });
|
|
50176
49996
|
}
|
|
50177
49997
|
writeFileSync3(targetPath, content, "utf-8");
|
|
50178
49998
|
}
|
|
@@ -50262,6 +50082,200 @@ var init_analyzer = __esm(() => {
|
|
|
50262
50082
|
init_i18n();
|
|
50263
50083
|
});
|
|
50264
50084
|
|
|
50085
|
+
// src/core/skills/library.ts
|
|
50086
|
+
var exports_library = {};
|
|
50087
|
+
__export(exports_library, {
|
|
50088
|
+
SkillsLibrary: () => SkillsLibrary
|
|
50089
|
+
});
|
|
50090
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4 } from "fs";
|
|
50091
|
+
import { readdir, readFile, writeFile } from "fs/promises";
|
|
50092
|
+
import { join as join7, basename as basename3, dirname as dirname3 } from "path";
|
|
50093
|
+
function parseFrontmatter(content) {
|
|
50094
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
50095
|
+
if (!match) {
|
|
50096
|
+
return { metadata: {}, body: content };
|
|
50097
|
+
}
|
|
50098
|
+
const [, frontmatter, body] = match;
|
|
50099
|
+
const metadata = {};
|
|
50100
|
+
for (const line of frontmatter.split(`
|
|
50101
|
+
`)) {
|
|
50102
|
+
const colonIndex = line.indexOf(":");
|
|
50103
|
+
if (colonIndex > 0) {
|
|
50104
|
+
const key = line.slice(0, colonIndex).trim();
|
|
50105
|
+
let value = line.slice(colonIndex + 1).trim();
|
|
50106
|
+
if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
|
|
50107
|
+
try {
|
|
50108
|
+
value = JSON.parse(value);
|
|
50109
|
+
} catch {
|
|
50110
|
+
const strValue = value;
|
|
50111
|
+
const inner = strValue.slice(1, -1).trim();
|
|
50112
|
+
if (inner) {
|
|
50113
|
+
value = inner.split(",").map((s) => s.trim());
|
|
50114
|
+
} else {
|
|
50115
|
+
value = [];
|
|
50116
|
+
}
|
|
50117
|
+
}
|
|
50118
|
+
}
|
|
50119
|
+
metadata[key] = value;
|
|
50120
|
+
}
|
|
50121
|
+
}
|
|
50122
|
+
return { metadata, body: body.trim() };
|
|
50123
|
+
}
|
|
50124
|
+
|
|
50125
|
+
class SkillsLibrary {
|
|
50126
|
+
skills = [];
|
|
50127
|
+
indexed = false;
|
|
50128
|
+
paths;
|
|
50129
|
+
constructor(paths) {
|
|
50130
|
+
this.paths = paths.filter((p) => p && existsSync8(p));
|
|
50131
|
+
}
|
|
50132
|
+
addPath(path) {
|
|
50133
|
+
if (path && existsSync8(path) && !this.paths.includes(path)) {
|
|
50134
|
+
this.paths.push(path);
|
|
50135
|
+
this.indexed = false;
|
|
50136
|
+
}
|
|
50137
|
+
}
|
|
50138
|
+
async index() {
|
|
50139
|
+
this.skills = [];
|
|
50140
|
+
for (const basePath of this.paths) {
|
|
50141
|
+
await this.indexDirectory(basePath);
|
|
50142
|
+
}
|
|
50143
|
+
this.indexed = true;
|
|
50144
|
+
}
|
|
50145
|
+
async indexDirectory(dir) {
|
|
50146
|
+
if (!existsSync8(dir))
|
|
50147
|
+
return;
|
|
50148
|
+
const skillMdPath = join7(dir, "SKILL.md");
|
|
50149
|
+
if (existsSync8(skillMdPath)) {
|
|
50150
|
+
await this.loadSkillFile(skillMdPath);
|
|
50151
|
+
return;
|
|
50152
|
+
}
|
|
50153
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
50154
|
+
for (const entry of entries) {
|
|
50155
|
+
const fullPath = join7(dir, entry.name);
|
|
50156
|
+
if (entry.isDirectory()) {
|
|
50157
|
+
await this.indexDirectory(fullPath);
|
|
50158
|
+
} else if (entry.name.endsWith(".md") && entry.name !== "SKILL.md") {
|
|
50159
|
+
await this.loadSkillFile(fullPath);
|
|
50160
|
+
}
|
|
50161
|
+
}
|
|
50162
|
+
}
|
|
50163
|
+
async loadSkillFile(fullPath) {
|
|
50164
|
+
try {
|
|
50165
|
+
const content = await readFile(fullPath, "utf-8");
|
|
50166
|
+
const { metadata, body } = parseFrontmatter(content);
|
|
50167
|
+
this.skills.push({
|
|
50168
|
+
metadata: {
|
|
50169
|
+
name: metadata["name"] || metadata["Skills"] || basename3(fullPath, ".md").replace("SKILL", basename3(dirname3(fullPath))),
|
|
50170
|
+
description: metadata["description"] || "",
|
|
50171
|
+
tags: metadata["tags"] || [],
|
|
50172
|
+
models: metadata["models"] || [],
|
|
50173
|
+
tokens_avg: Number(metadata["tokens_avg"]) || 2000,
|
|
50174
|
+
difficulty: metadata["difficulty"] || "medium",
|
|
50175
|
+
last_updated: metadata["last_updated"] || new Date().toISOString()
|
|
50176
|
+
},
|
|
50177
|
+
content: body,
|
|
50178
|
+
path: fullPath
|
|
50179
|
+
});
|
|
50180
|
+
} catch {}
|
|
50181
|
+
}
|
|
50182
|
+
async search(query, limit = 5) {
|
|
50183
|
+
if (!this.indexed) {
|
|
50184
|
+
await this.index();
|
|
50185
|
+
}
|
|
50186
|
+
const queryLower = query.toLowerCase();
|
|
50187
|
+
const results = [];
|
|
50188
|
+
for (const skill of this.skills) {
|
|
50189
|
+
let score = 0;
|
|
50190
|
+
const matchedOn = [];
|
|
50191
|
+
if (skill.metadata.name.toLowerCase().includes(queryLower)) {
|
|
50192
|
+
score += 100;
|
|
50193
|
+
matchedOn.push("name");
|
|
50194
|
+
}
|
|
50195
|
+
for (const tag of skill.metadata.tags) {
|
|
50196
|
+
if (tag.toLowerCase().includes(queryLower)) {
|
|
50197
|
+
score += 50;
|
|
50198
|
+
if (!matchedOn.includes("tags"))
|
|
50199
|
+
matchedOn.push("tags");
|
|
50200
|
+
}
|
|
50201
|
+
}
|
|
50202
|
+
if (skill.metadata.description.toLowerCase().includes(queryLower)) {
|
|
50203
|
+
score += 30;
|
|
50204
|
+
matchedOn.push("description");
|
|
50205
|
+
}
|
|
50206
|
+
const contentMatches = (skill.content.toLowerCase().match(new RegExp(queryLower, "g")) || []).length;
|
|
50207
|
+
if (contentMatches > 0) {
|
|
50208
|
+
score += contentMatches * 10;
|
|
50209
|
+
matchedOn.push("content");
|
|
50210
|
+
}
|
|
50211
|
+
if (score > 0) {
|
|
50212
|
+
results.push({ skill, score, matchedOn });
|
|
50213
|
+
}
|
|
50214
|
+
}
|
|
50215
|
+
return results.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
50216
|
+
}
|
|
50217
|
+
async getByPath(path) {
|
|
50218
|
+
if (!this.indexed) {
|
|
50219
|
+
await this.index();
|
|
50220
|
+
}
|
|
50221
|
+
return this.skills.find((s) => s.path === path) || null;
|
|
50222
|
+
}
|
|
50223
|
+
async save(skill, targetPath) {
|
|
50224
|
+
const dir = dirname3(targetPath);
|
|
50225
|
+
if (!existsSync8(dir)) {
|
|
50226
|
+
mkdirSync4(dir, { recursive: true });
|
|
50227
|
+
}
|
|
50228
|
+
const frontmatter = [
|
|
50229
|
+
"---",
|
|
50230
|
+
`name: ${skill.metadata.name}`,
|
|
50231
|
+
`description: ${skill.metadata.description}`,
|
|
50232
|
+
`tags: ${JSON.stringify(skill.metadata.tags)}`,
|
|
50233
|
+
`models: ${JSON.stringify(skill.metadata.models)}`,
|
|
50234
|
+
`tokens_avg: ${skill.metadata.tokens_avg}`,
|
|
50235
|
+
`difficulty: ${skill.metadata.difficulty}`,
|
|
50236
|
+
`last_updated: ${new Date().toISOString().split("T")[0]}`,
|
|
50237
|
+
"---",
|
|
50238
|
+
""
|
|
50239
|
+
].join(`
|
|
50240
|
+
`);
|
|
50241
|
+
const content = frontmatter + skill.content;
|
|
50242
|
+
await writeFile(targetPath, content, "utf-8");
|
|
50243
|
+
this.indexed = false;
|
|
50244
|
+
}
|
|
50245
|
+
async list(filter) {
|
|
50246
|
+
if (!this.indexed) {
|
|
50247
|
+
await this.index();
|
|
50248
|
+
}
|
|
50249
|
+
let result = [...this.skills];
|
|
50250
|
+
if (filter?.tags?.length) {
|
|
50251
|
+
result = result.filter((s) => s.metadata.tags.some((t2) => filter.tags?.includes(t2)));
|
|
50252
|
+
}
|
|
50253
|
+
if (filter?.difficulty) {
|
|
50254
|
+
result = result.filter((s) => s.metadata.difficulty === filter.difficulty);
|
|
50255
|
+
}
|
|
50256
|
+
return result;
|
|
50257
|
+
}
|
|
50258
|
+
async getStats() {
|
|
50259
|
+
if (!this.indexed) {
|
|
50260
|
+
await this.index();
|
|
50261
|
+
}
|
|
50262
|
+
const byTag = {};
|
|
50263
|
+
const byDifficulty = {};
|
|
50264
|
+
for (const skill of this.skills) {
|
|
50265
|
+
for (const tag of skill.metadata.tags) {
|
|
50266
|
+
byTag[tag] = (byTag[tag] || 0) + 1;
|
|
50267
|
+
}
|
|
50268
|
+
byDifficulty[skill.metadata.difficulty] = (byDifficulty[skill.metadata.difficulty] || 0) + 1;
|
|
50269
|
+
}
|
|
50270
|
+
return {
|
|
50271
|
+
total: this.skills.length,
|
|
50272
|
+
byTag,
|
|
50273
|
+
byDifficulty
|
|
50274
|
+
};
|
|
50275
|
+
}
|
|
50276
|
+
}
|
|
50277
|
+
var init_library = () => {};
|
|
50278
|
+
|
|
50265
50279
|
// src/core/beads/graph.ts
|
|
50266
50280
|
function createEmptyGraph(_projectName) {
|
|
50267
50281
|
return {
|
|
@@ -50579,7 +50593,7 @@ class AgentOrchestrator {
|
|
|
50579
50593
|
maxTokens: agentConfig.max_tokens
|
|
50580
50594
|
});
|
|
50581
50595
|
const tokensUsed = response.usage.input_tokens + response.usage.output_tokens;
|
|
50582
|
-
const cost = this.costTracker.recordUsage(agentConfig.model, tokensUsed);
|
|
50596
|
+
const cost = this.costTracker.recordUsage(agentConfig.model || "unknown", tokensUsed);
|
|
50583
50597
|
const artifacts = await this.processResponse(response.content);
|
|
50584
50598
|
return {
|
|
50585
50599
|
success: true,
|
|
@@ -50687,17 +50701,25 @@ class BeadsExecutor {
|
|
|
50687
50701
|
graph;
|
|
50688
50702
|
graphPath;
|
|
50689
50703
|
config;
|
|
50704
|
+
projectRoot;
|
|
50690
50705
|
orchestrator;
|
|
50691
50706
|
git;
|
|
50692
50707
|
skillsLibrary;
|
|
50693
50708
|
constructor(config, projectRoot, apiKey) {
|
|
50694
50709
|
this.config = config;
|
|
50710
|
+
this.projectRoot = projectRoot;
|
|
50695
50711
|
this.graphPath = join9(projectRoot, config.tools.beads.path, "graph.json");
|
|
50696
50712
|
this.graph = this.loadGraph();
|
|
50697
50713
|
this.orchestrator = new AgentOrchestrator(config, apiKey);
|
|
50698
50714
|
this.git = new GitOperations(projectRoot);
|
|
50699
|
-
const
|
|
50700
|
-
|
|
50715
|
+
const agentsSkillsPath = join9(this.projectRoot, ".agents", "skills");
|
|
50716
|
+
const agentSkillsPath = join9(this.projectRoot, ".agent", "skills");
|
|
50717
|
+
this.skillsLibrary = new SkillsLibrary([
|
|
50718
|
+
join9(this.projectRoot, this.config.tools.skills.local_path),
|
|
50719
|
+
agentsSkillsPath,
|
|
50720
|
+
agentSkillsPath,
|
|
50721
|
+
this.config.tools.skills.global_path
|
|
50722
|
+
]);
|
|
50701
50723
|
}
|
|
50702
50724
|
loadGraph() {
|
|
50703
50725
|
if (!existsSync10(this.graphPath)) {
|
|
@@ -52730,9 +52752,6 @@ var require_table = __commonJS((exports, module) => {
|
|
|
52730
52752
|
|
|
52731
52753
|
// src/index.ts
|
|
52732
52754
|
init_source();
|
|
52733
|
-
import { readFileSync as readFileSync9 } from "fs";
|
|
52734
|
-
import { dirname as dirname6, join as join14 } from "path";
|
|
52735
|
-
import { fileURLToPath } from "url";
|
|
52736
52755
|
|
|
52737
52756
|
// node_modules/commander/esm.mjs
|
|
52738
52757
|
var import__ = __toESM(require_commander(), 1);
|
|
@@ -52755,8 +52774,8 @@ init_source();
|
|
|
52755
52774
|
init_config();
|
|
52756
52775
|
init_git();
|
|
52757
52776
|
init_logger();
|
|
52758
|
-
import { existsSync as
|
|
52759
|
-
import { join as
|
|
52777
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2 } from "fs";
|
|
52778
|
+
import { join as join5, basename } from "path";
|
|
52760
52779
|
|
|
52761
52780
|
// node_modules/ora/index.js
|
|
52762
52781
|
init_source();
|
|
@@ -53644,8 +53663,8 @@ init_errors2();
|
|
|
53644
53663
|
init_i18n();
|
|
53645
53664
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
53646
53665
|
var initCommand = new Command("init").description(t("Initialize a new Axon project", "\u521D\u59CB\u5316\u65B0\u7684 Axon \u9879\u76EE")).argument("[project-name]", t("Project name", "\u9879\u76EE\u540D\u79F0"), ".").option("-t, --template <name>", t("Use template (web, api, cli)", "\u4F7F\u7528\u6A21\u677F (web, api, cli)"), "default").option("--skip-install", t("Skip dependency installation", "\u8DF3\u8FC7\u4F9D\u8D56\u5B89\u88C5")).option("--skip-git", t("Skip Git initialization", "\u8DF3\u8FC7 Git \u521D\u59CB\u5316")).action(async (projectName, options) => {
|
|
53647
|
-
const projectPath = projectName === "." ? process.cwd() :
|
|
53648
|
-
const name = projectName === "." ?
|
|
53666
|
+
const projectPath = projectName === "." ? process.cwd() : join5(process.cwd(), projectName);
|
|
53667
|
+
const name = projectName === "." ? basename(process.cwd()) : projectName;
|
|
53649
53668
|
logger.title(t("Axon Project Initialization", "Axon \u9879\u76EE\u521D\u59CB\u5316"));
|
|
53650
53669
|
if (ConfigManager.isAxonProject(projectPath)) {
|
|
53651
53670
|
throw new AxonError("\u9879\u76EE\u5DF2\u521D\u59CB\u5316", "INIT_ERROR", [
|
|
@@ -53679,41 +53698,41 @@ var initCommand = new Command("init").description(t("Initialize a new Axon proje
|
|
|
53679
53698
|
if (response.action === "backup") {
|
|
53680
53699
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
53681
53700
|
if (existingConfigs.hasOpenCode) {
|
|
53682
|
-
await Bun.$`mv ${
|
|
53701
|
+
await Bun.$`mv ${join5(projectPath, ".opencode")} ${join5(projectPath, `.opencode.backup.${timestamp}`)}`;
|
|
53683
53702
|
}
|
|
53684
53703
|
if (existingConfigs.hasBeads) {
|
|
53685
|
-
await Bun.$`mv ${
|
|
53704
|
+
await Bun.$`mv ${join5(projectPath, ".beads")} ${join5(projectPath, `.beads.backup.${timestamp}`)}`;
|
|
53686
53705
|
}
|
|
53687
53706
|
logger.success(t("\u2705 Existing configuration backed up", "\u2705 \u5DF2\u5907\u4EFD\u73B0\u6709\u914D\u7F6E"));
|
|
53688
53707
|
}
|
|
53689
53708
|
}
|
|
53690
|
-
if (!
|
|
53709
|
+
if (!existsSync4(projectPath)) {
|
|
53691
53710
|
spinner.start(t(`Creating project directory ${source_default.cyan(name)}`, `\u521B\u5EFA\u9879\u76EE\u76EE\u5F55 ${source_default.cyan(name)}`));
|
|
53692
|
-
|
|
53711
|
+
mkdirSync2(projectPath, { recursive: true });
|
|
53693
53712
|
spinner.succeed();
|
|
53694
53713
|
}
|
|
53695
53714
|
spinner.start(t("Creating Axon directory structure", "\u521B\u5EFA Axon \u76EE\u5F55\u7ED3\u6784"));
|
|
53696
53715
|
for (const dir of DEFAULT_DIRECTORIES) {
|
|
53697
|
-
const fullPath =
|
|
53698
|
-
if (!
|
|
53699
|
-
|
|
53716
|
+
const fullPath = join5(projectPath, dir);
|
|
53717
|
+
if (!existsSync4(fullPath)) {
|
|
53718
|
+
mkdirSync2(fullPath, { recursive: true });
|
|
53700
53719
|
}
|
|
53701
53720
|
}
|
|
53702
53721
|
spinner.succeed();
|
|
53703
53722
|
spinner.start(t("Generating configuration file", "\u751F\u6210\u914D\u7F6E\u6587\u4EF6"));
|
|
53704
53723
|
ConfigManager.initialize(projectPath, name);
|
|
53705
53724
|
spinner.succeed();
|
|
53706
|
-
if (!options.skipReadme && !
|
|
53725
|
+
if (!options.skipReadme && !existsSync4(join5(projectPath, "README.md"))) {
|
|
53707
53726
|
spinner.start(t("Generating README.md", "\u751F\u6210 README.md"));
|
|
53708
53727
|
const readme = generateReadme(name);
|
|
53709
|
-
await Bun.write(
|
|
53728
|
+
await Bun.write(join5(projectPath, "README.md"), readme);
|
|
53710
53729
|
spinner.succeed();
|
|
53711
53730
|
}
|
|
53712
53731
|
spinner.start(t("Generating Quick Start guide", "\u751F\u6210\u5165\u95E8\u6307\u5357"));
|
|
53713
53732
|
const gettingStarted = generateGettingStarted(name);
|
|
53714
|
-
await Bun.write(
|
|
53733
|
+
await Bun.write(join5(projectPath, "GETTING_STARTED.md"), gettingStarted);
|
|
53715
53734
|
spinner.succeed();
|
|
53716
|
-
if (!
|
|
53735
|
+
if (!existsSync4(join5(projectPath, ".openspec", "spec.md"))) {
|
|
53717
53736
|
spinner.start(t("Creating specification template", "\u521B\u5EFA\u89C4\u683C\u6A21\u677F"));
|
|
53718
53737
|
const specContent = t(`# ${name} Specification
|
|
53719
53738
|
|
|
@@ -53722,7 +53741,7 @@ var initCommand = new Command("init").description(t("Initialize a new Axon proje
|
|
|
53722
53741
|
|
|
53723
53742
|
(\u5F85\u586B\u5199)
|
|
53724
53743
|
`);
|
|
53725
|
-
await Bun.write(
|
|
53744
|
+
await Bun.write(join5(projectPath, ".openspec", "spec.md"), specContent);
|
|
53726
53745
|
spinner.succeed();
|
|
53727
53746
|
}
|
|
53728
53747
|
if (!options.skipGit) {
|
|
@@ -53756,17 +53775,23 @@ var initCommand = new Command("init").description(t("Initialize a new Axon proje
|
|
|
53756
53775
|
hint: t("- Space to select, Enter to confirm", "- \u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4")
|
|
53757
53776
|
});
|
|
53758
53777
|
if (response.skills && response.skills.length > 0) {
|
|
53759
|
-
|
|
53760
|
-
|
|
53761
|
-
|
|
53762
|
-
|
|
53763
|
-
|
|
53764
|
-
const
|
|
53765
|
-
|
|
53766
|
-
|
|
53767
|
-
|
|
53768
|
-
|
|
53769
|
-
|
|
53778
|
+
if (response.skills && response.skills.length > 0) {
|
|
53779
|
+
const { spawnSync } = await import("child_process");
|
|
53780
|
+
const packageSource = "arrislink/axon-skills";
|
|
53781
|
+
spinner.start(t("Installing recommended skills...", "\u6B63\u5728\u5B89\u88C5\u63A8\u8350\u6280\u80FD..."));
|
|
53782
|
+
const args = ["skills", "add", packageSource, "--yes"];
|
|
53783
|
+
for (const name2 of response.skills) {
|
|
53784
|
+
args.push("--skill", name2);
|
|
53785
|
+
}
|
|
53786
|
+
try {
|
|
53787
|
+
const result = spawnSync("npx", args, { stdio: "inherit", cwd: projectPath });
|
|
53788
|
+
if (result.status === 0) {
|
|
53789
|
+
spinner.succeed(t("Skills installed successfully", "\u6280\u80FD\u5B89\u88C5\u6210\u529F"));
|
|
53790
|
+
} else {
|
|
53791
|
+
spinner.warn(t("Failed to install some skills. Please try manually with `ax skills install`.", "\u90E8\u5206\u6280\u80FD\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u5C1D\u8BD5\u624B\u52A8\u8FD0\u884C `ax skills install`\u3002"));
|
|
53792
|
+
}
|
|
53793
|
+
} catch (e) {
|
|
53794
|
+
spinner.fail(t("Failed to run npx skills add", "\u65E0\u6CD5\u8FD0\u884C npx skills add"));
|
|
53770
53795
|
}
|
|
53771
53796
|
}
|
|
53772
53797
|
}
|
|
@@ -53938,8 +53963,8 @@ ax work
|
|
|
53938
53963
|
}
|
|
53939
53964
|
function detectExistingConfig(projectPath) {
|
|
53940
53965
|
return {
|
|
53941
|
-
hasOpenCode:
|
|
53942
|
-
hasBeads:
|
|
53966
|
+
hasOpenCode: existsSync4(join5(projectPath, ".opencode")),
|
|
53967
|
+
hasBeads: existsSync4(join5(projectPath, ".beads"))
|
|
53943
53968
|
};
|
|
53944
53969
|
}
|
|
53945
53970
|
// src/commands/spec.ts
|
|
@@ -54094,7 +54119,12 @@ specCommand.command("analyze").description(t("Analyze specification and generate
|
|
|
54094
54119
|
try {
|
|
54095
54120
|
const { SpecAnalyzer: SpecAnalyzer2 } = await Promise.resolve().then(() => (init_analyzer(), exports_analyzer));
|
|
54096
54121
|
const { SkillsLibrary: SkillsLibrary2 } = await Promise.resolve().then(() => (init_library(), exports_library));
|
|
54097
|
-
const
|
|
54122
|
+
const officialLocalPath = join8(projectRoot, ".agents", "skills");
|
|
54123
|
+
const library = new SkillsLibrary2([
|
|
54124
|
+
join8(projectRoot, config.tools.skills.local_path),
|
|
54125
|
+
officialLocalPath,
|
|
54126
|
+
config.tools.skills.global_path
|
|
54127
|
+
]);
|
|
54098
54128
|
const relevantSkills = await library.search("brainsstorm", 2);
|
|
54099
54129
|
const skillContext = relevantSkills.map((s) => `[Skill: ${s.skill.metadata.name}]
|
|
54100
54130
|
${s.skill.content}`).join(`
|
|
@@ -54154,9 +54184,12 @@ var planCommand = new Command("plan").description(t("Generate task graph from sp
|
|
|
54154
54184
|
spinner.start("\u8C03\u7528 AI \u62C6\u89E3\u4EFB\u52A1...");
|
|
54155
54185
|
const generator3 = new BeadsGenerator2(config);
|
|
54156
54186
|
const { SkillsLibrary: SkillsLibrary2 } = await Promise.resolve().then(() => (init_library(), exports_library));
|
|
54157
|
-
const
|
|
54158
|
-
const
|
|
54159
|
-
|
|
54187
|
+
const officialLocalPath = join10(projectRoot, ".agents", "skills");
|
|
54188
|
+
const skillsLibrary = new SkillsLibrary2([
|
|
54189
|
+
join10(projectRoot, config.tools.skills.local_path),
|
|
54190
|
+
officialLocalPath,
|
|
54191
|
+
config.tools.skills.global_path
|
|
54192
|
+
]);
|
|
54160
54193
|
const planningSkills = await skillsLibrary.search("write-plan", 3);
|
|
54161
54194
|
const skillContext = planningSkills.map((s) => `[Skill: ${s.skill.metadata.name}]
|
|
54162
54195
|
${s.skill.content}`).join(`
|
|
@@ -54341,11 +54374,13 @@ init_library();
|
|
|
54341
54374
|
init_errors2();
|
|
54342
54375
|
init_i18n();
|
|
54343
54376
|
init_logger();
|
|
54344
|
-
var skillsCommand = new Command("skills").description(t("Manage skill library", "\u7BA1\u7406\u6280\u80FD\u5E93"));
|
|
54377
|
+
var skillsCommand = new Command("skills").description(t("Manage skill library (v1.5.0 Official Integration)", "\u7BA1\u7406\u6280\u80FD\u5E93 (v1.5.0 \u5B98\u65B9\u96C6\u6210)"));
|
|
54345
54378
|
skillsCommand.command("search <query>").description(t("Search skill templates", "\u641C\u7D22\u6280\u80FD\u6A21\u677F")).option("-l, --limit <n>", t("Number of results to return", "\u8FD4\u56DE\u7ED3\u679C\u6570\u91CF"), "5").action(async (query, options) => {
|
|
54346
54379
|
const projectRoot = process.cwd();
|
|
54347
54380
|
const limit = Number.parseInt(options.limit, 10);
|
|
54348
54381
|
let localPath = join11(projectRoot, ".skills");
|
|
54382
|
+
const officialLocalPath = join11(projectRoot, ".agents", "skills");
|
|
54383
|
+
const agentLocalPath = join11(projectRoot, ".agent", "skills");
|
|
54349
54384
|
let globalPath = join11(process.env["HOME"] || "~", ".axon", "skills");
|
|
54350
54385
|
if (ConfigManager.isAxonProject(projectRoot)) {
|
|
54351
54386
|
const configManager = new ConfigManager(projectRoot);
|
|
@@ -54353,8 +54388,7 @@ skillsCommand.command("search <query>").description(t("Search skill templates",
|
|
|
54353
54388
|
localPath = join11(projectRoot, config.tools.skills.local_path);
|
|
54354
54389
|
globalPath = config.tools.skills.global_path;
|
|
54355
54390
|
}
|
|
54356
|
-
|
|
54357
|
-
const library2 = new SkillsLibrary(localPath, globalPath);
|
|
54391
|
+
const library2 = new SkillsLibrary([localPath, officialLocalPath, agentLocalPath, globalPath]);
|
|
54358
54392
|
const results = await library2.search(query, limit);
|
|
54359
54393
|
spinner.stop();
|
|
54360
54394
|
if (results.length === 0) {
|
|
@@ -54375,9 +54409,18 @@ ${source_default.bold(skill.metadata.name)} ${source_default.dim(`(${score}% \u5
|
|
|
54375
54409
|
}
|
|
54376
54410
|
logger.blank();
|
|
54377
54411
|
});
|
|
54412
|
+
skillsCommand.command("find [query]").description(t("Find official skills from skills.sh", "\u4ECE skills.sh \u67E5\u627E\u5B98\u65B9\u6280\u80FD")).action(async (query) => {
|
|
54413
|
+
const { spawnSync } = await import("child_process");
|
|
54414
|
+
const args = ["skills", "find"];
|
|
54415
|
+
if (query)
|
|
54416
|
+
args.push(query);
|
|
54417
|
+
spawnSync("npx", args, { stdio: "inherit" });
|
|
54418
|
+
});
|
|
54378
54419
|
skillsCommand.command("list").description(t("List all skills", "\u5217\u51FA\u6240\u6709\u6280\u80FD")).option("-t, --tags <tags>", t("Filter by tags (comma-separated)", "\u6309\u6807\u7B7E\u8FC7\u6EE4 (\u9017\u53F7\u5206\u9694)")).option("-d, --difficulty <level>", t("Filter by difficulty (easy/medium/hard)", "\u6309\u96BE\u5EA6\u8FC7\u6EE4 (easy/medium/hard)")).action(async (options) => {
|
|
54379
54420
|
const projectRoot = process.cwd();
|
|
54380
54421
|
let localPath = join11(projectRoot, ".skills");
|
|
54422
|
+
const officialLocalPath = join11(projectRoot, ".agents", "skills");
|
|
54423
|
+
const agentLocalPath = join11(projectRoot, ".agent", "skills");
|
|
54381
54424
|
let globalPath = join11(process.env["HOME"] || "~", ".axon", "skills");
|
|
54382
54425
|
if (ConfigManager.isAxonProject(projectRoot)) {
|
|
54383
54426
|
const configManager = new ConfigManager(projectRoot);
|
|
@@ -54385,8 +54428,7 @@ skillsCommand.command("list").description(t("List all skills", "\u5217\u51FA\u62
|
|
|
54385
54428
|
localPath = join11(projectRoot, config.tools.skills.local_path);
|
|
54386
54429
|
globalPath = config.tools.skills.global_path;
|
|
54387
54430
|
}
|
|
54388
|
-
|
|
54389
|
-
const library2 = new SkillsLibrary(localPath, globalPath);
|
|
54431
|
+
const library2 = new SkillsLibrary([localPath, officialLocalPath, agentLocalPath, globalPath]);
|
|
54390
54432
|
const filter = {};
|
|
54391
54433
|
if (options.tags) {
|
|
54392
54434
|
filter.tags = options.tags.split(",").map((t2) => t2.trim());
|
|
@@ -54431,7 +54473,10 @@ skillsCommand.command("save <path>").description(t("Save file as skill template"
|
|
|
54431
54473
|
}
|
|
54432
54474
|
const configManager = new ConfigManager(projectRoot);
|
|
54433
54475
|
const config = configManager.get();
|
|
54434
|
-
const library2 = new SkillsLibrary(
|
|
54476
|
+
const library2 = new SkillsLibrary([
|
|
54477
|
+
join11(projectRoot, config.tools.skills.local_path),
|
|
54478
|
+
config.tools.skills.global_path
|
|
54479
|
+
]);
|
|
54435
54480
|
const content = await Bun.file(filePath).text();
|
|
54436
54481
|
const name = options.name || basename4(filePath).replace(/\.[^.]+$/, "");
|
|
54437
54482
|
const tags = options.tags ? options.tags.split(",").map((t2) => t2.trim()) : ["custom"];
|
|
@@ -54452,7 +54497,7 @@ skillsCommand.command("save <path>").description(t("Save file as skill template"
|
|
|
54452
54497
|
await library2.save(skill, targetPath);
|
|
54453
54498
|
logger.success(`\u6280\u80FD\u5DF2\u4FDD\u5B58: ${targetPath}`);
|
|
54454
54499
|
});
|
|
54455
|
-
skillsCommand.command("install <name>").description(t("Install a skill from global library", "\u4ECE\u5168\u5C40\u5E93\u5B89\u88C5\u6280\u80FD\u5230\u5F53\u524D\u9879\u76EE")).option("--symlink", t("Create a symbolic link instead of copying", "\u521B\u5EFA\u7B26\u53F7\u94FE\u63A5\u800C\u4E0D\u662F\u76F4\u63A5\u590D\u5236")).option("--path <dir>", t("Custom local skills directory", "\u81EA\u5B9A\u4E49\u672C\u5730\u6280\u80FD\u76EE\u5F55")).action(async (name, options) => {
|
|
54500
|
+
skillsCommand.command("install <name>").description(t("Install a skill from global library", "\u4ECE\u5168\u5C40\u5E93\u5B89\u88C5\u6280\u80FD\u5230\u5F53\u524D\u9879\u76EE")).option("--symlink", t("Create a symbolic link instead of copying", "\u521B\u5EFA\u7B26\u53F7\u94FE\u63A5\u800C\u4E0D\u662F\u76F4\u63A5\u590D\u5236")).option("--path <dir>", t("Custom local skills directory", "\u81EA\u5B9A\u4E49\u672C\u5730\u6280\u80FD\u76EE\u5F55")).option("--all", t("Install all skills in the package", "\u5B89\u88C5\u5305\u4E2D\u7684\u6240\u6709\u6280\u80FD")).option("-s, --skill <skills>", t("Specific skills to install", "\u5B89\u88C5\u6307\u5B9A\u6280\u80FD")).option("-a, --agent <agents>", t("Target agents", "\u76EE\u6807 Agent")).option("-y, --yes", t("Skip confirmation prompts", "\u786E\u8BA4\u6240\u6709\u63D0\u793A")).action(async (name, options) => {
|
|
54456
54501
|
const projectRoot = process.cwd();
|
|
54457
54502
|
if (!ConfigManager.isAxonProject(projectRoot)) {
|
|
54458
54503
|
throw new AxonError("\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Axon \u9879\u76EE", "SKILLS_ERROR", [
|
|
@@ -54463,7 +54508,32 @@ skillsCommand.command("install <name>").description(t("Install a skill from glob
|
|
|
54463
54508
|
const config = configManager.get();
|
|
54464
54509
|
const localPath = options.path ? join11(projectRoot, options.path) : join11(projectRoot, config.tools.skills.local_path);
|
|
54465
54510
|
const globalPath = config.tools.skills.global_path;
|
|
54466
|
-
const library2 = new SkillsLibrary(
|
|
54511
|
+
const library2 = new SkillsLibrary([
|
|
54512
|
+
localPath,
|
|
54513
|
+
join11(projectRoot, ".agents", "skills"),
|
|
54514
|
+
join11(projectRoot, ".agent", "skills"),
|
|
54515
|
+
globalPath
|
|
54516
|
+
]);
|
|
54517
|
+
if (name.includes("/") || name.startsWith("http")) {
|
|
54518
|
+
spinner.info(t(`Detecting official skill package: ${name}...`, `\u68C0\u6D4B\u5230\u5B98\u65B9\u6280\u80FD\u5305: ${name}...`));
|
|
54519
|
+
const { spawnSync } = await import("child_process");
|
|
54520
|
+
const args = ["skills", "add", name];
|
|
54521
|
+
if (options.symlink)
|
|
54522
|
+
args.push("--symlink");
|
|
54523
|
+
if (options.all)
|
|
54524
|
+
args.push("--all");
|
|
54525
|
+
if (options.skill)
|
|
54526
|
+
args.push("--skill", options.skill);
|
|
54527
|
+
if (options.agent)
|
|
54528
|
+
args.push("--agent", options.agent);
|
|
54529
|
+
if (options.yes)
|
|
54530
|
+
args.push("--yes");
|
|
54531
|
+
const result = spawnSync("npx", args, { stdio: "inherit" });
|
|
54532
|
+
if (result.status === 0) {
|
|
54533
|
+
logger.success(t(`Successfully installed official package: ${name}`, `\u6210\u529F\u5B89\u88C5\u5B98\u65B9\u6280\u80FD\u5305: ${name}`));
|
|
54534
|
+
}
|
|
54535
|
+
return;
|
|
54536
|
+
}
|
|
54467
54537
|
spinner.start(t(`Finding skill: ${name}...`, `\u6B63\u5728\u67E5\u627E\u6280\u80FD: ${name}...`));
|
|
54468
54538
|
const results = await library2.search(name, 1);
|
|
54469
54539
|
if (results.length === 0 || results[0].skill.metadata.name.toLowerCase() !== name.toLowerCase()) {
|
|
@@ -54491,6 +54561,8 @@ skillsCommand.command("install <name>").description(t("Install a skill from glob
|
|
|
54491
54561
|
skillsCommand.command("stats").description(t("Show skill library statistics", "\u663E\u793A\u6280\u80FD\u5E93\u7EDF\u8BA1")).action(async () => {
|
|
54492
54562
|
const projectRoot = process.cwd();
|
|
54493
54563
|
let localPath = join11(projectRoot, ".skills");
|
|
54564
|
+
const officialLocalPath = join11(projectRoot, ".agents", "skills");
|
|
54565
|
+
const agentLocalPath = join11(projectRoot, ".agent", "skills");
|
|
54494
54566
|
let globalPath = join11(process.env["HOME"] || "~", ".axon", "skills");
|
|
54495
54567
|
if (ConfigManager.isAxonProject(projectRoot)) {
|
|
54496
54568
|
const configManager = new ConfigManager(projectRoot);
|
|
@@ -54499,7 +54571,7 @@ skillsCommand.command("stats").description(t("Show skill library statistics", "\
|
|
|
54499
54571
|
globalPath = config.tools.skills.global_path;
|
|
54500
54572
|
}
|
|
54501
54573
|
spinner.start("\u5206\u6790\u6280\u80FD\u5E93...");
|
|
54502
|
-
const library2 = new SkillsLibrary(localPath, globalPath);
|
|
54574
|
+
const library2 = new SkillsLibrary([localPath, officialLocalPath, agentLocalPath, globalPath]);
|
|
54503
54575
|
const stats = await library2.getStats();
|
|
54504
54576
|
spinner.stop();
|
|
54505
54577
|
logger.title("\u6280\u80FD\u5E93\u7EDF\u8BA1");
|
|
@@ -54520,6 +54592,11 @@ ${source_default.bold("\u6309\u96BE\u5EA6:")}`);
|
|
|
54520
54592
|
}
|
|
54521
54593
|
logger.blank();
|
|
54522
54594
|
});
|
|
54595
|
+
skillsCommand.command("update").description(t("Update all skills to latest versions", "\u66F4\u65B0\u6240\u6709\u6280\u80FD\u5230\u6700\u65B0\u7248\u672C")).action(async () => {
|
|
54596
|
+
const { spawnSync } = await import("child_process");
|
|
54597
|
+
logger.info(t("Checking for skill updates...", "\u6B63\u5728\u68C0\u67E5\u6280\u80FD\u66F4\u65B0..."));
|
|
54598
|
+
spawnSync("npx", ["skills", "update"], { stdio: "inherit" });
|
|
54599
|
+
});
|
|
54523
54600
|
// src/commands/status.ts
|
|
54524
54601
|
init_source();
|
|
54525
54602
|
import { existsSync as existsSync13, readFileSync as readFileSync8 } from "fs";
|
|
@@ -55151,10 +55228,89 @@ ${t("Content", "\u5185\u5BB9")}:`);
|
|
|
55151
55228
|
});
|
|
55152
55229
|
// src/index.ts
|
|
55153
55230
|
init_errors2();
|
|
55154
|
-
|
|
55155
|
-
var
|
|
55156
|
-
|
|
55157
|
-
|
|
55231
|
+
// package.json
|
|
55232
|
+
var package_default = {
|
|
55233
|
+
name: "@arrislink/axon",
|
|
55234
|
+
version: "1.5.0",
|
|
55235
|
+
description: "AI-Powered Development Operating System with unified LLM provider support",
|
|
55236
|
+
type: "module",
|
|
55237
|
+
main: "dist/index.js",
|
|
55238
|
+
bin: {
|
|
55239
|
+
ax: "dist/index.js"
|
|
55240
|
+
},
|
|
55241
|
+
publishConfig: {
|
|
55242
|
+
access: "public",
|
|
55243
|
+
registry: "https://registry.npmjs.org/"
|
|
55244
|
+
},
|
|
55245
|
+
files: [
|
|
55246
|
+
"dist/index.js",
|
|
55247
|
+
"templates",
|
|
55248
|
+
"README.md",
|
|
55249
|
+
"README.zh-CN.md",
|
|
55250
|
+
"LICENSE"
|
|
55251
|
+
],
|
|
55252
|
+
scripts: {
|
|
55253
|
+
dev: "bun run --watch src/index.ts",
|
|
55254
|
+
build: "bun build --compile --minify src/index.ts --outfile dist/ax",
|
|
55255
|
+
"build:js": "bun build src/index.ts --outdir dist --target bun",
|
|
55256
|
+
test: "bun test",
|
|
55257
|
+
lint: "bunx @biomejs/biome check --write .",
|
|
55258
|
+
format: "bunx @biomejs/biome format --write .",
|
|
55259
|
+
"type-check": "tsc --noEmit",
|
|
55260
|
+
clean: "rm -rf dist",
|
|
55261
|
+
prepublishOnly: "npm run clean && npm run build:js"
|
|
55262
|
+
},
|
|
55263
|
+
keywords: [
|
|
55264
|
+
"ai",
|
|
55265
|
+
"cli",
|
|
55266
|
+
"axon",
|
|
55267
|
+
"development",
|
|
55268
|
+
"automation",
|
|
55269
|
+
"openspec",
|
|
55270
|
+
"opencode",
|
|
55271
|
+
"oh-my-opencode",
|
|
55272
|
+
"omo",
|
|
55273
|
+
"beads",
|
|
55274
|
+
"skills",
|
|
55275
|
+
"findskills",
|
|
55276
|
+
"llm",
|
|
55277
|
+
"anthropic",
|
|
55278
|
+
"bun"
|
|
55279
|
+
],
|
|
55280
|
+
author: "Axon Team",
|
|
55281
|
+
license: "MIT",
|
|
55282
|
+
repository: {
|
|
55283
|
+
type: "git",
|
|
55284
|
+
url: "git+https://github.com/arrislink/axon.git"
|
|
55285
|
+
},
|
|
55286
|
+
bugs: {
|
|
55287
|
+
url: "https://github.com/arrislink/axon/issues"
|
|
55288
|
+
},
|
|
55289
|
+
homepage: "https://github.com/arrislink/axon#readme",
|
|
55290
|
+
dependencies: {
|
|
55291
|
+
chalk: "^5.3.0",
|
|
55292
|
+
"cli-table3": "^0.6.5",
|
|
55293
|
+
commander: "^12.0.0",
|
|
55294
|
+
mammoth: "^1.11.0",
|
|
55295
|
+
ora: "^8.0.0",
|
|
55296
|
+
prompts: "^2.4.2",
|
|
55297
|
+
yaml: "^2.3.4",
|
|
55298
|
+
zod: "^3.22.4"
|
|
55299
|
+
},
|
|
55300
|
+
devDependencies: {
|
|
55301
|
+
"@biomejs/biome": "^1.5.0",
|
|
55302
|
+
"@types/bun": "latest",
|
|
55303
|
+
"@types/prompts": "^2.4.9",
|
|
55304
|
+
typescript: "^5.3.0"
|
|
55305
|
+
},
|
|
55306
|
+
engines: {
|
|
55307
|
+
bun: ">=1.1.0",
|
|
55308
|
+
node: ">=18.0.0"
|
|
55309
|
+
}
|
|
55310
|
+
};
|
|
55311
|
+
|
|
55312
|
+
// src/index.ts
|
|
55313
|
+
var VERSION = package_default.version || "1.5.0";
|
|
55158
55314
|
var program2 = new Command;
|
|
55159
55315
|
program2.name("ax").description(`${source_default.green("\uD83E\uDDE0")} ${source_default.bold("Axon")} - AI-Powered Development Operating System (v${VERSION})
|
|
55160
55316
|
|