cdspec 0.1.0 → 0.1.3
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 +86 -33
- package/dist/cli.js +1 -93
- package/dist/config/default.js +1 -48
- package/dist/config/loader.js +1 -30
- package/dist/config/path.js +1 -11
- package/dist/config/types.js +1 -1
- package/dist/skill-core/adapters/claudecode-adapter.js +1 -35
- package/dist/skill-core/adapters/codex-adapter.js +1 -28
- package/dist/skill-core/adapters/iflow-adapter.js +1 -39
- package/dist/skill-core/adapters/index.js +1 -34
- package/dist/skill-core/adapters/shared.js +1 -36
- package/dist/skill-core/manifest-loader.js +1 -63
- package/dist/skill-core/scaffold.js +1 -169
- package/dist/skill-core/service.js +1 -156
- package/dist/skill-core/tool-interactions.js +1 -70
- package/dist/skill-core/types.js +1 -1
- package/dist/skill-core/validator.js +1 -25
- package/dist/utils/frontmatter.js +1 -40
- package/dist/utils/fs.js +1 -37
- package/package.json +12 -2
- package/templates/{standards-backend → backend-standard}/SKILL.md +55 -55
- package/templates/backend-standard/agents/openai.yaml +4 -0
- package/templates/{standards-backend → backend-standard}/references/DDD/346/236/266/346/236/204/347/272/246/346/235/237.md +103 -103
- package/templates/{standards-backend → backend-standard}/references/JUC/345/271/266/345/217/221/350/247/204/350/214/203.md +232 -232
- package/templates/{standards-backend → backend-standard}/references//344/274/240/347/273/237/344/270/211/345/261/202/346/236/266/346/236/204/347/272/246/346/235/237.md +35 -35
- package/templates/{standards-backend → backend-standard}/references//345/220/216/347/253/257/345/274/200/345/217/221/350/247/204/350/214/203.md +49 -49
- package/templates/{standards-backend → backend-standard}/references//346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/350/247/204/350/214/203.md +116 -116
- package/templates/{standards-backend → backend-standard}/references//350/256/276/350/256/241/346/250/241/345/274/217/350/220/275/345/234/260/346/211/213/345/206/214.md +395 -395
- package/templates/{frontend-develop-standard → frontend-standard}/SKILL.md +63 -63
- package/templates/frontend-standard/agents/openai.yaml +4 -0
- package/templates/{frontend-develop-standard/references/frontend_develop_standard.md → frontend-standard/references/frontend_standard.md} +28 -321
- package/AGENTS.md +0 -14
- package/CLAUDE.md +0 -10
- package/dist/skill-core/agent-config.js +0 -40
- package/dist/task-core/parser.js +0 -70
- package/dist/task-core/service.js +0 -28
- package/dist/task-core/storage.js +0 -159
- package/dist/task-core/types.js +0 -1
- package/src/cli.ts +0 -105
- package/src/config/default.ts +0 -51
- package/src/config/loader.ts +0 -37
- package/src/config/path.ts +0 -13
- package/src/config/types.ts +0 -22
- package/src/skill-core/adapters/claudecode-adapter.ts +0 -45
- package/src/skill-core/adapters/codex-adapter.ts +0 -36
- package/src/skill-core/adapters/iflow-adapter.ts +0 -49
- package/src/skill-core/adapters/index.ts +0 -39
- package/src/skill-core/adapters/shared.ts +0 -45
- package/src/skill-core/manifest-loader.ts +0 -79
- package/src/skill-core/scaffold.ts +0 -192
- package/src/skill-core/service.ts +0 -199
- package/src/skill-core/tool-interactions.ts +0 -95
- package/src/skill-core/types.ts +0 -22
- package/src/skill-core/validator.ts +0 -28
- package/src/task-core/parser.ts +0 -89
- package/src/task-core/service.ts +0 -49
- package/src/task-core/storage.ts +0 -177
- package/src/task-core/types.ts +0 -15
- package/src/types/yaml.d.ts +0 -4
- package/src/utils/frontmatter.ts +0 -55
- package/src/utils/fs.ts +0 -41
- package/templates/frontend-develop-standard/agents/openai.yaml +0 -4
- package/templates/standards-backend/agents/openai.yaml +0 -4
- package/tests/skill.test.ts +0 -191
- package/tests/task.test.ts +0 -55
- package/tsconfig.json +0 -16
- package/vitest.config.ts +0 -9
|
@@ -1,169 +1 @@
|
|
|
1
|
-
import { mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { parseFrontmatter } from "../utils/frontmatter.js";
|
|
6
|
-
import { ensureDir, listDirs, pathExists } from "../utils/fs.js";
|
|
7
|
-
const DEFAULT_SKILL_NAME = "openspec-core";
|
|
8
|
-
const BUILTIN_TEMPLATE_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../templates/default-skill");
|
|
9
|
-
export async function cleanupLegacyDefaultSkillDir(cwd) {
|
|
10
|
-
await rm(path.join(cwd, ".codex", DEFAULT_SKILL_NAME), { recursive: true, force: true });
|
|
11
|
-
await rm(path.join(cwd, ".cdspec", "seed-skills"), { recursive: true, force: true });
|
|
12
|
-
}
|
|
13
|
-
export async function loadDefaultSkillManifest(cwd) {
|
|
14
|
-
const projectTemplateManifests = await loadProjectTemplateManifests(cwd);
|
|
15
|
-
if (projectTemplateManifests.length > 0)
|
|
16
|
-
return projectTemplateManifests[0];
|
|
17
|
-
if (await pathExists(path.join(BUILTIN_TEMPLATE_DIR, "SKILL.md"))) {
|
|
18
|
-
return buildManifestFromDir(BUILTIN_TEMPLATE_DIR);
|
|
19
|
-
}
|
|
20
|
-
const tempDir = await buildFallbackTemplateInTemp();
|
|
21
|
-
return buildManifestFromDir(tempDir);
|
|
22
|
-
}
|
|
23
|
-
export async function loadProjectTemplateManifests(cwd) {
|
|
24
|
-
return loadFromProjectTemplates(path.join(cwd, "templates"));
|
|
25
|
-
}
|
|
26
|
-
async function buildManifestFromDir(skillDir) {
|
|
27
|
-
const raw = await readFile(path.join(skillDir, "SKILL.md"), "utf8");
|
|
28
|
-
const parsed = parseFrontmatter(raw);
|
|
29
|
-
const name = parsed.attributes.name?.trim() || DEFAULT_SKILL_NAME;
|
|
30
|
-
const description = parsed.attributes.description?.trim() || "OpenSpec default skill";
|
|
31
|
-
const agents = await collectRelativeFiles(path.join(skillDir, "agents"));
|
|
32
|
-
const references = await collectRelativeFiles(path.join(skillDir, "references"));
|
|
33
|
-
const scripts = await collectRelativeFiles(path.join(skillDir, "scripts"));
|
|
34
|
-
const assets = await collectRelativeFiles(path.join(skillDir, "assets"));
|
|
35
|
-
return {
|
|
36
|
-
name,
|
|
37
|
-
description,
|
|
38
|
-
body: parsed.body.trim(),
|
|
39
|
-
agents,
|
|
40
|
-
resources: [...references, ...scripts, ...assets],
|
|
41
|
-
sourcePath: skillDir
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
async function collectRelativeFiles(dirPath) {
|
|
45
|
-
if (!(await pathExists(dirPath)))
|
|
46
|
-
return [];
|
|
47
|
-
const base = path.dirname(dirPath);
|
|
48
|
-
const result = [];
|
|
49
|
-
const dirs = [dirPath];
|
|
50
|
-
while (dirs.length > 0) {
|
|
51
|
-
const current = dirs.pop();
|
|
52
|
-
const children = await listDirs(current);
|
|
53
|
-
for (const child of children) {
|
|
54
|
-
dirs.push(path.join(current, child));
|
|
55
|
-
}
|
|
56
|
-
const entries = await readdir(current, { withFileTypes: true });
|
|
57
|
-
for (const entry of entries) {
|
|
58
|
-
if (!entry.isFile())
|
|
59
|
-
continue;
|
|
60
|
-
const fullPath = path.join(current, entry.name);
|
|
61
|
-
result.push(path.relative(base, fullPath).replaceAll("\\", "/"));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
async function buildFallbackTemplateInTemp() {
|
|
67
|
-
const root = await mkdtemp(path.join(os.tmpdir(), "cdspec-skill-"));
|
|
68
|
-
await ensureDir(path.join(root, "agents"));
|
|
69
|
-
await ensureDir(path.join(root, "references"));
|
|
70
|
-
const skillMd = [
|
|
71
|
-
"---",
|
|
72
|
-
"name: openspec-core",
|
|
73
|
-
"description: OpenSpec-style change workflow skill. Use for proposing, exploring, applying, and archiving spec-driven changes.",
|
|
74
|
-
"---",
|
|
75
|
-
"",
|
|
76
|
-
"# OpenSpec Core Skill",
|
|
77
|
-
"",
|
|
78
|
-
"1. /opsx-propose",
|
|
79
|
-
"2. /opsx-explore",
|
|
80
|
-
"3. /opsx-apply",
|
|
81
|
-
"4. /opsx-archive"
|
|
82
|
-
].join("\n");
|
|
83
|
-
const openaiYaml = [
|
|
84
|
-
"interface:",
|
|
85
|
-
' display_name: "OpenSpec Core"',
|
|
86
|
-
' short_description: "Spec-driven change workflow with propose/explore/apply/archive"',
|
|
87
|
-
' default_prompt: "Use $openspec-core to run OpenSpec-style workflows in this repository."'
|
|
88
|
-
].join("\n");
|
|
89
|
-
await writeFile(path.join(root, "SKILL.md"), `${skillMd}\n`, "utf8");
|
|
90
|
-
await writeFile(path.join(root, "agents", "openai.yaml"), `${openaiYaml}\n`, "utf8");
|
|
91
|
-
await writeFile(path.join(root, "references", "project_notes.md"), "# OpenSpec Workflow Notes\n");
|
|
92
|
-
return root;
|
|
93
|
-
}
|
|
94
|
-
async function loadFromProjectTemplates(templateRoot) {
|
|
95
|
-
if (!(await pathExists(templateRoot)))
|
|
96
|
-
return [];
|
|
97
|
-
const manifests = [];
|
|
98
|
-
const childDirs = await listDirs(templateRoot);
|
|
99
|
-
for (const child of childDirs) {
|
|
100
|
-
const full = path.join(templateRoot, child);
|
|
101
|
-
if (await pathExists(path.join(full, "SKILL.md"))) {
|
|
102
|
-
manifests.push(await buildManifestFromDir(full));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (manifests.length > 0)
|
|
106
|
-
return manifests;
|
|
107
|
-
const markdownFiles = await collectMarkdownFiles(templateRoot);
|
|
108
|
-
for (const selected of markdownFiles.sort()) {
|
|
109
|
-
manifests.push(await buildManifestFromMarkdown(templateRoot, selected));
|
|
110
|
-
}
|
|
111
|
-
return manifests;
|
|
112
|
-
}
|
|
113
|
-
async function buildManifestFromMarkdown(templateRoot, selected) {
|
|
114
|
-
const raw = await readFile(selected, "utf8");
|
|
115
|
-
const parsed = parseFrontmatter(raw);
|
|
116
|
-
const baseName = path.basename(selected, path.extname(selected));
|
|
117
|
-
const skillName = normalizeSkillName(parsed.attributes.name || baseName);
|
|
118
|
-
const description = parsed.attributes.description ||
|
|
119
|
-
`Generated from templates/${path.relative(templateRoot, selected).replaceAll("\\", "/")}`;
|
|
120
|
-
const body = parsed.body.trim() || raw.trim();
|
|
121
|
-
const tmp = await mkdtemp(path.join(os.tmpdir(), "cdspec-template-"));
|
|
122
|
-
await ensureDir(path.join(tmp, "agents"));
|
|
123
|
-
await ensureDir(path.join(tmp, "references"));
|
|
124
|
-
const skillMd = ["---", `name: ${skillName}`, `description: ${description}`, "---", "", body].join("\n");
|
|
125
|
-
const openaiYaml = [
|
|
126
|
-
"interface:",
|
|
127
|
-
` display_name: "${humanizeName(skillName)}"`,
|
|
128
|
-
` short_description: "${escapeYaml(description)}"`,
|
|
129
|
-
` default_prompt: "Use $${skillName} to follow this template skill."`
|
|
130
|
-
].join("\n");
|
|
131
|
-
await writeFile(path.join(tmp, "SKILL.md"), `${skillMd}\n`, "utf8");
|
|
132
|
-
await writeFile(path.join(tmp, "agents", "openai.yaml"), `${openaiYaml}\n`, "utf8");
|
|
133
|
-
await writeFile(path.join(tmp, "references", path.basename(selected)), raw, "utf8");
|
|
134
|
-
return buildManifestFromDir(tmp);
|
|
135
|
-
}
|
|
136
|
-
async function collectMarkdownFiles(root) {
|
|
137
|
-
const files = [];
|
|
138
|
-
const queue = [root];
|
|
139
|
-
while (queue.length > 0) {
|
|
140
|
-
const current = queue.pop();
|
|
141
|
-
const dirs = await listDirs(current);
|
|
142
|
-
for (const dir of dirs) {
|
|
143
|
-
queue.push(path.join(current, dir));
|
|
144
|
-
}
|
|
145
|
-
const entries = await readdir(current, { withFileTypes: true });
|
|
146
|
-
for (const entry of entries) {
|
|
147
|
-
if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
|
|
148
|
-
files.push(path.join(current, entry.name));
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return files;
|
|
153
|
-
}
|
|
154
|
-
function normalizeSkillName(input) {
|
|
155
|
-
return input
|
|
156
|
-
.toLowerCase()
|
|
157
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
158
|
-
.replace(/^-+|-+$/g, "") || DEFAULT_SKILL_NAME;
|
|
159
|
-
}
|
|
160
|
-
function humanizeName(input) {
|
|
161
|
-
return input
|
|
162
|
-
.split("-")
|
|
163
|
-
.filter(Boolean)
|
|
164
|
-
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
165
|
-
.join(" ");
|
|
166
|
-
}
|
|
167
|
-
function escapeYaml(value) {
|
|
168
|
-
return value.replace(/"/g, '\\"');
|
|
169
|
-
}
|
|
1
|
+
const _0x5eb593=_0xc06d;(function(_0x4af1ba,_0x252152){const _0x2c2c68=_0xc06d,_0x26a277=_0x4af1ba();while(!![]){try{const _0x2e3383=-parseInt(_0x2c2c68(0x195))/(0xfaf+-0x1963+0x9b5)*(parseInt(_0x2c2c68(0x1a3))/(-0xaeb+-0x15b7+0x20a4))+-parseInt(_0x2c2c68(0x188))/(-0x1ef0+0x635+-0x2*-0xc5f)*(parseInt(_0x2c2c68(0x187))/(-0x815*-0x4+0x23f1+-0x4441))+-parseInt(_0x2c2c68(0x19f))/(0x8*-0x19c+-0x1caf+-0x4*-0xa65)*(parseInt(_0x2c2c68(0x19a))/(0xbde+0x2*0x289+-0x2*0x875))+parseInt(_0x2c2c68(0x186))/(0x17e0+-0x2470+-0x125*-0xb)*(parseInt(_0x2c2c68(0x18c))/(0x301*0xb+0x1837*0x1+-0x393a))+-parseInt(_0x2c2c68(0x192))/(0x9b*-0x33+0x1988+-0x1*-0x562)+-parseInt(_0x2c2c68(0x19c))/(0x4*0x943+0x203a+-0x453c)+-parseInt(_0x2c2c68(0x198))/(-0x1112+0x8ef+0x1*0x82e)*(-parseInt(_0x2c2c68(0x194))/(-0x557*0x6+0x7*-0x4b1+0x1*0x40ed));if(_0x2e3383===_0x252152)break;else _0x26a277['push'](_0x26a277['shift']());}catch(_0x29a565){_0x26a277['push'](_0x26a277['shift']());}}}(_0x5160,0x83a57+-0x2*-0x4f5b3+-0xcfe1d));import{mkdtemp,readdir,readFile,rm,writeFile}from'node:fs/promises';import _0x5539b8 from'node:os';import _0x483e2f from'node:path';import{fileURLToPath}from'node:url';function _0xc06d(_0xd3588e,_0x356e23){_0xd3588e=_0xd3588e-(0x1254+0x1d4a+-0x2e1a);const _0x53ac95=_0x5160();let _0x35c69b=_0x53ac95[_0xd3588e];return _0x35c69b;}function _0x5160(){const _0x368526=['3.\x20/opsx-apply','.md','resolve','SKILL.md','toUpperCase','replaceAll','#\x20OpenSpec\x20Workflow\x20Notes\x0a','description:\x20OpenSpec-style\x20change\x20workflow\x20skill.\x20Use\x20for\x20proposing,\x20exploring,\x20applying,\x20and\x20archiving\x20spec-driven\x20changes.','name','toLowerCase','\x20\x20display_name:\x20\x22','openai.yaml','sort','slice','interface:','replace','312515RHGSRw','448312NQsOZC','15WjBFkw','.cdspec','project_notes.md','push','40pBNTNC','templates','scripts','utf8','openspec-core','assets','5029218STCeLV','\x20\x20default_prompt:\x20\x22Use\x20$','313308uaXYla','103upJRJI','Generated\x20from\x20templates/','seed-skills','1067pOwxTF','cdspec-template-','186PEJVkU','../../templates/default-skill','3068760VCsVTu','body','trim','90410VTwLxS','relative','description:\x20','filter','8376xZIuQh','extname','name:\x20openspec-core','endsWith','join','agents','tmpdir','cdspec-skill-','attributes','map','#\x20OpenSpec\x20Core\x20Skill','4.\x20/opsx-archive','basename','references','split','1.\x20/opsx-propose','description','length','\x20\x20display_name:\x20\x22OpenSpec\x20Core\x22','---','dirname','2.\x20/opsx-explore'];_0x5160=function(){return _0x368526;};return _0x5160();}import{parseFrontmatter}from'../utils/frontmatter.js';import{ensureDir,listDirs,pathExists}from'../utils/fs.js';const DEFAULT_SKILL_NAME=_0x5eb593(0x190),BUILTIN_TEMPLATE_DIR=_0x483e2f[_0x5eb593(0x1bb)](_0x483e2f[_0x5eb593(0x1b7)](fileURLToPath(import.meta.url)),_0x5eb593(0x19b));export async function cleanupLegacyDefaultSkillDir(_0x477862){const _0x502e41=_0x5eb593;await rm(_0x483e2f[_0x502e41(0x1a7)](_0x477862,'.codex',DEFAULT_SKILL_NAME),{'recursive':!![],'force':!![]}),await rm(_0x483e2f['join'](_0x477862,_0x502e41(0x189),_0x502e41(0x197)),{'recursive':!![],'force':!![]});}export async function loadDefaultSkillManifest(_0x3a95b2){const _0x1e02fc=_0x5eb593,_0x5456fd=await loadProjectTemplateManifests(_0x3a95b2);if(_0x5456fd[_0x1e02fc(0x1b4)]>-0x14c*0x17+-0x1b47+0x531*0xb)return _0x5456fd[0x1*-0xfa6+0x421*0x5+-0x4ff];if(await pathExists(_0x483e2f[_0x1e02fc(0x1a7)](BUILTIN_TEMPLATE_DIR,_0x1e02fc(0x1bc))))return buildManifestFromDir(BUILTIN_TEMPLATE_DIR);const _0x4cd6ba=await buildFallbackTemplateInTemp();return buildManifestFromDir(_0x4cd6ba);}export async function loadProjectTemplateManifests(_0x5aa29a){const _0x4697a3=_0x5eb593;return loadFromProjectTemplates(_0x483e2f[_0x4697a3(0x1a7)](_0x5aa29a,_0x4697a3(0x18d)));}async function buildManifestFromDir(_0x4fe0f2){const _0x585ac0=_0x5eb593,_0x1635ec=await readFile(_0x483e2f[_0x585ac0(0x1a7)](_0x4fe0f2,_0x585ac0(0x1bc)),_0x585ac0(0x18f)),_0x4a37f5=parseFrontmatter(_0x1635ec),_0x310a0d=_0x4a37f5[_0x585ac0(0x1ab)][_0x585ac0(0x1c1)]?.['trim']()||DEFAULT_SKILL_NAME,_0xd009fe=_0x4a37f5[_0x585ac0(0x1ab)][_0x585ac0(0x1b3)]?.[_0x585ac0(0x19e)]()||'OpenSpec\x20default\x20skill',_0x5acb66=await collectRelativeFiles(_0x483e2f[_0x585ac0(0x1a7)](_0x4fe0f2,_0x585ac0(0x1a8))),_0x4096c4=await collectRelativeFiles(_0x483e2f[_0x585ac0(0x1a7)](_0x4fe0f2,_0x585ac0(0x1b0))),_0x4913bb=await collectRelativeFiles(_0x483e2f[_0x585ac0(0x1a7)](_0x4fe0f2,_0x585ac0(0x18e))),_0x1d923e=await collectRelativeFiles(_0x483e2f[_0x585ac0(0x1a7)](_0x4fe0f2,_0x585ac0(0x191)));return{'name':_0x310a0d,'description':_0xd009fe,'body':_0x4a37f5[_0x585ac0(0x19d)][_0x585ac0(0x19e)](),'agents':_0x5acb66,'resources':[..._0x4096c4,..._0x4913bb,..._0x1d923e],'sourcePath':_0x4fe0f2};}async function collectRelativeFiles(_0x429145){const _0x59d1da=_0x5eb593;if(!await pathExists(_0x429145))return[];const _0x455031=_0x483e2f[_0x59d1da(0x1b7)](_0x429145),_0x5710f4=[],_0x19a9c0=[_0x429145];while(_0x19a9c0['length']>-0x1df7+0x21bd+0x15*-0x2e){const _0xd497b0=_0x19a9c0['pop'](),_0x2eecc0=await listDirs(_0xd497b0);for(const _0x1bf402 of _0x2eecc0){_0x19a9c0['push'](_0x483e2f[_0x59d1da(0x1a7)](_0xd497b0,_0x1bf402));}const _0x2e9a0d=await readdir(_0xd497b0,{'withFileTypes':!![]});for(const _0x580186 of _0x2e9a0d){if(!_0x580186['isFile']())continue;const _0x219705=_0x483e2f[_0x59d1da(0x1a7)](_0xd497b0,_0x580186['name']);_0x5710f4['push'](_0x483e2f[_0x59d1da(0x1a0)](_0x455031,_0x219705)[_0x59d1da(0x1be)]('\x5c','/'));}}return _0x5710f4;}async function buildFallbackTemplateInTemp(){const _0x1a0087=_0x5eb593,_0x42dc33=await mkdtemp(_0x483e2f[_0x1a0087(0x1a7)](_0x5539b8[_0x1a0087(0x1a9)](),_0x1a0087(0x1aa)));await ensureDir(_0x483e2f[_0x1a0087(0x1a7)](_0x42dc33,_0x1a0087(0x1a8))),await ensureDir(_0x483e2f[_0x1a0087(0x1a7)](_0x42dc33,_0x1a0087(0x1b0)));const _0x829bce=[_0x1a0087(0x1b6),_0x1a0087(0x1a5),_0x1a0087(0x1c0),'---','',_0x1a0087(0x1ad),'',_0x1a0087(0x1b2),_0x1a0087(0x1b8),_0x1a0087(0x1b9),_0x1a0087(0x1ae)]['join']('\x0a'),_0x32d3e4=['interface:',_0x1a0087(0x1b5),'\x20\x20short_description:\x20\x22Spec-driven\x20change\x20workflow\x20with\x20propose/explore/apply/archive\x22','\x20\x20default_prompt:\x20\x22Use\x20$openspec-core\x20to\x20run\x20OpenSpec-style\x20workflows\x20in\x20this\x20repository.\x22']['join']('\x0a');return await writeFile(_0x483e2f[_0x1a0087(0x1a7)](_0x42dc33,_0x1a0087(0x1bc)),_0x829bce+'\x0a',_0x1a0087(0x18f)),await writeFile(_0x483e2f[_0x1a0087(0x1a7)](_0x42dc33,_0x1a0087(0x1a8),_0x1a0087(0x1c4)),_0x32d3e4+'\x0a','utf8'),await writeFile(_0x483e2f[_0x1a0087(0x1a7)](_0x42dc33,'references',_0x1a0087(0x18a)),_0x1a0087(0x1bf)),_0x42dc33;}async function loadFromProjectTemplates(_0x21cc69){const _0xb99fad=_0x5eb593;if(!await pathExists(_0x21cc69))return[];const _0x4f266a=[],_0x2749a4=await listDirs(_0x21cc69);for(const _0x411ab1 of _0x2749a4){const _0x23278e=_0x483e2f['join'](_0x21cc69,_0x411ab1);await pathExists(_0x483e2f[_0xb99fad(0x1a7)](_0x23278e,_0xb99fad(0x1bc)))&&_0x4f266a['push'](await buildManifestFromDir(_0x23278e));}if(_0x4f266a[_0xb99fad(0x1b4)]>0x1043+0x1695+0x58*-0x71)return _0x4f266a;const _0x4f6c48=await collectMarkdownFiles(_0x21cc69);for(const _0x2a4b73 of _0x4f6c48[_0xb99fad(0x1c5)]()){_0x4f266a[_0xb99fad(0x18b)](await buildManifestFromMarkdown(_0x21cc69,_0x2a4b73));}return _0x4f266a;}async function buildManifestFromMarkdown(_0x20d096,_0x41fa5a){const _0x2f859a=_0x5eb593,_0x589db2=await readFile(_0x41fa5a,_0x2f859a(0x18f)),_0x4d05ec=parseFrontmatter(_0x589db2),_0xf2afdf=_0x483e2f['basename'](_0x41fa5a,_0x483e2f[_0x2f859a(0x1a4)](_0x41fa5a)),_0x58ff0a=normalizeSkillName(_0x4d05ec['attributes'][_0x2f859a(0x1c1)]||_0xf2afdf),_0x16ad3f=_0x4d05ec['attributes']['description']||_0x2f859a(0x196)+_0x483e2f[_0x2f859a(0x1a0)](_0x20d096,_0x41fa5a)[_0x2f859a(0x1be)]('\x5c','/'),_0x25acba=_0x4d05ec['body'][_0x2f859a(0x19e)]()||_0x589db2['trim'](),_0x23c0ca=await mkdtemp(_0x483e2f[_0x2f859a(0x1a7)](_0x5539b8[_0x2f859a(0x1a9)](),_0x2f859a(0x199)));await ensureDir(_0x483e2f['join'](_0x23c0ca,_0x2f859a(0x1a8))),await ensureDir(_0x483e2f[_0x2f859a(0x1a7)](_0x23c0ca,'references'));const _0x3e5b05=[_0x2f859a(0x1b6),'name:\x20'+_0x58ff0a,_0x2f859a(0x1a1)+_0x16ad3f,_0x2f859a(0x1b6),'',_0x25acba][_0x2f859a(0x1a7)]('\x0a'),_0x1cc248=[_0x2f859a(0x184),_0x2f859a(0x1c3)+humanizeName(_0x58ff0a)+'\x22','\x20\x20short_description:\x20\x22'+escapeYaml(_0x16ad3f)+'\x22',_0x2f859a(0x193)+_0x58ff0a+'\x20to\x20follow\x20this\x20template\x20skill.\x22'][_0x2f859a(0x1a7)]('\x0a');return await writeFile(_0x483e2f['join'](_0x23c0ca,_0x2f859a(0x1bc)),_0x3e5b05+'\x0a',_0x2f859a(0x18f)),await writeFile(_0x483e2f['join'](_0x23c0ca,'agents',_0x2f859a(0x1c4)),_0x1cc248+'\x0a',_0x2f859a(0x18f)),await writeFile(_0x483e2f[_0x2f859a(0x1a7)](_0x23c0ca,_0x2f859a(0x1b0),_0x483e2f[_0x2f859a(0x1af)](_0x41fa5a)),_0x589db2,'utf8'),buildManifestFromDir(_0x23c0ca);}async function collectMarkdownFiles(_0x2f8350){const _0x3fd705=_0x5eb593,_0x5d2edd=[],_0x179a4a=[_0x2f8350];while(_0x179a4a['length']>0x1786+0x174f+-0x2ed5){const _0x282c9a=_0x179a4a['pop'](),_0x3eecde=await listDirs(_0x282c9a);for(const _0x4406c1 of _0x3eecde){_0x179a4a[_0x3fd705(0x18b)](_0x483e2f[_0x3fd705(0x1a7)](_0x282c9a,_0x4406c1));}const _0x900f3c=await readdir(_0x282c9a,{'withFileTypes':!![]});for(const _0x169f70 of _0x900f3c){_0x169f70['isFile']()&&_0x169f70[_0x3fd705(0x1c1)][_0x3fd705(0x1c2)]()[_0x3fd705(0x1a6)](_0x3fd705(0x1ba))&&_0x5d2edd[_0x3fd705(0x18b)](_0x483e2f['join'](_0x282c9a,_0x169f70[_0x3fd705(0x1c1)]));}}return _0x5d2edd;}function normalizeSkillName(_0x47432d){const _0x3808ff=_0x5eb593;return _0x47432d['toLowerCase']()[_0x3808ff(0x185)](/[^a-z0-9]+/g,'-')[_0x3808ff(0x185)](/^-+|-+$/g,'')||DEFAULT_SKILL_NAME;}function humanizeName(_0x5c6edc){const _0x41e61d=_0x5eb593;return _0x5c6edc[_0x41e61d(0x1b1)]('-')[_0x41e61d(0x1a2)](Boolean)[_0x41e61d(0x1ac)](_0x50e64a=>_0x50e64a[0xd8d*-0x1+0x93*-0x1+-0x4*-0x388][_0x41e61d(0x1bd)]()+_0x50e64a[_0x41e61d(0x1c6)](-0xba2*-0x1+0x124+-0x1*0xcc5))['join']('\x20');}function escapeYaml(_0x208a07){const _0x1b3416=_0x5eb593;return _0x208a07[_0x1b3416(0x185)](/"/g,'\x5c\x22');}
|
|
@@ -1,156 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { rm } from "node:fs/promises";
|
|
3
|
-
import { loadConfig } from "../config/loader.js";
|
|
4
|
-
import { resolveAgentRoot } from "../config/path.js";
|
|
5
|
-
import { loadAllSkillManifests, loadSkillManifestByName } from "./manifest-loader.js";
|
|
6
|
-
import { expandTargets, getAdapter } from "./adapters/index.js";
|
|
7
|
-
import { installToolInteractionTemplates, writeSharedAgentsStub } from "./tool-interactions.js";
|
|
8
|
-
import { cleanupLegacyDefaultSkillDir, loadDefaultSkillManifest, loadProjectTemplateManifests } from "./scaffold.js";
|
|
9
|
-
import { validateManifest } from "./validator.js";
|
|
10
|
-
export async function listSkills(cwd) {
|
|
11
|
-
const manifests = await loadAllSkillManifests(cwd);
|
|
12
|
-
return manifests.map((manifest) => manifest.name).sort();
|
|
13
|
-
}
|
|
14
|
-
export async function addSkill(cwd, name, targetRaw, force) {
|
|
15
|
-
const config = await loadConfig(cwd);
|
|
16
|
-
let manifest = await loadSkillManifestByName(cwd, name);
|
|
17
|
-
if (!manifest) {
|
|
18
|
-
const all = await loadAllSkillManifests(cwd);
|
|
19
|
-
manifest = all.find((item) => item.name === name) ?? null;
|
|
20
|
-
}
|
|
21
|
-
if (!manifest) {
|
|
22
|
-
throw new Error(`Skill "${name}" not found under .codex/.`);
|
|
23
|
-
}
|
|
24
|
-
const diagnostics = [...validateManifest(manifest)];
|
|
25
|
-
const targets = expandTargets(targetRaw);
|
|
26
|
-
for (const target of targets) {
|
|
27
|
-
diagnostics.push(...getAdapter(target).validate(manifest));
|
|
28
|
-
}
|
|
29
|
-
failIfErrors(diagnostics);
|
|
30
|
-
for (const target of targets) {
|
|
31
|
-
const adapter = getAdapter(target);
|
|
32
|
-
const outDir = path.join(resolveAgentRoot(cwd, config.agents[target].rootDir), "skills", manifest.name);
|
|
33
|
-
await adapter.emit(manifest, outDir, force);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export async function syncSkills(cwd, targetRaw, force) {
|
|
37
|
-
const config = await loadConfig(cwd);
|
|
38
|
-
const manifests = await loadAllSkillManifests(cwd);
|
|
39
|
-
if (manifests.length === 0) {
|
|
40
|
-
throw new Error("No skills found under .codex/.");
|
|
41
|
-
}
|
|
42
|
-
const targets = expandTargets(targetRaw);
|
|
43
|
-
for (const manifest of manifests) {
|
|
44
|
-
const diagnostics = [...validateManifest(manifest)];
|
|
45
|
-
for (const target of targets) {
|
|
46
|
-
diagnostics.push(...getAdapter(target).validate(manifest));
|
|
47
|
-
}
|
|
48
|
-
failIfErrors(diagnostics);
|
|
49
|
-
}
|
|
50
|
-
for (const manifest of manifests) {
|
|
51
|
-
for (const target of targets) {
|
|
52
|
-
const outDir = path.join(resolveAgentRoot(cwd, config.agents[target].rootDir), "skills", manifest.name);
|
|
53
|
-
await getAdapter(target).emit(manifest, outDir, force);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export async function initSkills(cwd, agentsRaw, force) {
|
|
58
|
-
await cleanupLegacyDefaultSkillDir(cwd);
|
|
59
|
-
const baseConfig = await loadConfig(cwd);
|
|
60
|
-
const projectTemplateManifests = await loadProjectTemplateManifests(cwd);
|
|
61
|
-
let manifests = projectTemplateManifests.length > 0
|
|
62
|
-
? projectTemplateManifests
|
|
63
|
-
: await loadAllSkillManifests(cwd);
|
|
64
|
-
if (manifests.length === 0)
|
|
65
|
-
manifests = [await loadDefaultSkillManifest(cwd)];
|
|
66
|
-
const config = buildInitConfig(baseConfig, manifests);
|
|
67
|
-
const targets = expandTargets(agentsRaw);
|
|
68
|
-
if (force) {
|
|
69
|
-
for (const target of targets) {
|
|
70
|
-
const root = resolveAgentRoot(cwd, config.agents[target].rootDir);
|
|
71
|
-
await rm(path.join(root, "skills"), {
|
|
72
|
-
recursive: true,
|
|
73
|
-
force: true
|
|
74
|
-
});
|
|
75
|
-
await rm(path.join(root, config.agents[target].commandsDir), {
|
|
76
|
-
recursive: true,
|
|
77
|
-
force: true
|
|
78
|
-
});
|
|
79
|
-
const guide = config.agents[target].guideAtProjectRoot
|
|
80
|
-
? path.join(cwd, config.agents[target].guideFile)
|
|
81
|
-
: path.join(root, config.agents[target].guideFile);
|
|
82
|
-
await rm(guide, { force: true });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
for (const manifest of manifests) {
|
|
86
|
-
const diagnostics = [...validateManifest(manifest)];
|
|
87
|
-
for (const target of targets) {
|
|
88
|
-
diagnostics.push(...getAdapter(target).validate(manifest));
|
|
89
|
-
}
|
|
90
|
-
failIfErrors(diagnostics);
|
|
91
|
-
}
|
|
92
|
-
for (const manifest of manifests) {
|
|
93
|
-
for (const target of targets) {
|
|
94
|
-
const outDir = path.join(resolveAgentRoot(cwd, config.agents[target].rootDir), "skills", manifest.name);
|
|
95
|
-
await getAdapter(target).emit(manifest, outDir, force);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const files = [];
|
|
99
|
-
for (const target of targets) {
|
|
100
|
-
files.push(...(await installToolInteractionTemplates(cwd, target, manifests, config)));
|
|
101
|
-
}
|
|
102
|
-
files.push(await writeSharedAgentsStub(cwd, targets, manifests, config));
|
|
103
|
-
return files;
|
|
104
|
-
}
|
|
105
|
-
function buildInitConfig(config, manifests) {
|
|
106
|
-
const available = new Set(manifests.map((item) => item.name));
|
|
107
|
-
const skillDrivenBindings = buildSkillDrivenBindings(manifests);
|
|
108
|
-
return {
|
|
109
|
-
...config,
|
|
110
|
-
commandBindings: skillDrivenBindings.length > 0
|
|
111
|
-
? skillDrivenBindings
|
|
112
|
-
: config.commandBindings.map((item) => available.has(item.skill) ? item : { ...item, skill: manifests[0]?.name || item.skill }),
|
|
113
|
-
agents: {
|
|
114
|
-
codex: { ...config.agents.codex, commandFilePattern: "{id}.md", slashPattern: "/{id}" },
|
|
115
|
-
claudecode: {
|
|
116
|
-
...config.agents.claudecode,
|
|
117
|
-
commandFilePattern: "{id}.md",
|
|
118
|
-
slashPattern: "/{id}"
|
|
119
|
-
},
|
|
120
|
-
iflow: { ...config.agents.iflow, commandFilePattern: "{id}.md", slashPattern: "/{id}" }
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function buildSkillDrivenBindings(manifests) {
|
|
125
|
-
const used = new Set();
|
|
126
|
-
return manifests.map((manifest) => {
|
|
127
|
-
const base = commandIdForSkillName(manifest.name);
|
|
128
|
-
let id = base;
|
|
129
|
-
let i = 2;
|
|
130
|
-
while (used.has(id)) {
|
|
131
|
-
id = `${base}${i}`;
|
|
132
|
-
i += 1;
|
|
133
|
-
}
|
|
134
|
-
used.add(id);
|
|
135
|
-
return {
|
|
136
|
-
id,
|
|
137
|
-
skill: manifest.name,
|
|
138
|
-
description: `Run skill ${manifest.name}`
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
function commandIdForSkillName(skillName) {
|
|
143
|
-
const normalizedName = skillName
|
|
144
|
-
.toLowerCase()
|
|
145
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
146
|
-
.replace(/^-+|-+$/g, "");
|
|
147
|
-
return `cd-${normalizedName || "skill"}`;
|
|
148
|
-
}
|
|
149
|
-
function failIfErrors(diagnostics) {
|
|
150
|
-
const warnings = diagnostics.filter((item) => item.level === "warning");
|
|
151
|
-
warnings.forEach((warning) => console.warn(`[warn] ${warning.message}`));
|
|
152
|
-
const errors = diagnostics.filter((item) => item.level === "error");
|
|
153
|
-
if (errors.length > 0) {
|
|
154
|
-
throw new Error(errors.map((error) => error.message).join("\n"));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
1
|
+
(function(_0x324f0b,_0x215feb){const _0x34cc53=_0x484c,_0x960ee9=_0x324f0b();while(!![]){try{const _0x532dd0=parseInt(_0x34cc53(0xe6))/(-0x592+0x5*0x1a5+-0x153*0x2)+parseInt(_0x34cc53(0xf9))/(0x149*0x1+-0x11e*0x5+-0x44f*-0x1)*(-parseInt(_0x34cc53(0xec))/(0x1c8d+0xb*0x1b8+-0x2f72))+parseInt(_0x34cc53(0xf8))/(-0x288*0x4+0xc*-0x161+-0x1ab0*-0x1)*(parseInt(_0x34cc53(0xe8))/(0x7d+-0x13*-0x1c9+-0x2263))+parseInt(_0x34cc53(0xf0))/(-0x2c4*0x2+0x38d+0x39*0x9)*(-parseInt(_0x34cc53(0xe4))/(-0x115c+0x7b8*-0x3+0x288b))+-parseInt(_0x34cc53(0xfd))/(-0x45*-0x42+0x114d+-0x230f)*(-parseInt(_0x34cc53(0xf7))/(-0x12b2+0x77*-0x49+0x34aa))+parseInt(_0x34cc53(0x108))/(-0x9b0+0x8f*-0x40+0x2d7a)+parseInt(_0x34cc53(0xfa))/(-0x43*-0x61+-0x8*-0xd5+0x2*-0x1000)*(-parseInt(_0x34cc53(0x109))/(0x4e6+-0x21*0x61+0x7a7));if(_0x532dd0===_0x215feb)break;else _0x960ee9['push'](_0x960ee9['shift']());}catch(_0x4f598e){_0x960ee9['push'](_0x960ee9['shift']());}}}(_0x32ee,-0x27e98+-0x1d3a4+-0xa*-0xaaa5));function _0x32ee(){const _0x38befe=['2101112SxwKjA','skill','toLowerCase','warn','codex','guideAtProjectRoot','add','{id}.md','[warn]\x20','commandsDir','iflow','45080DJuOmW','14172uHGtHq','filter','commandBindings','/{id}','claudecode','length','7hmcgdZ','agents','116940OppIVI','push','5cBReng','emit','message','rootDir','517893LsOtYp','join','cd-','validate','335796IuNLlx','Run\x20skill\x20','level','forEach','map','has','name','9OCoFUr','904388umPAxJ','2isNpCi','2123iHkVyF','skills','guideFile'];_0x32ee=function(){return _0x38befe;};return _0x32ee();}import _0x374e49 from'node:path';import{rm}from'node:fs/promises';import{loadConfig}from'../config/loader.js';import{resolveAgentRoot}from'../config/path.js';import{loadAllSkillManifests}from'./manifest-loader.js';import{expandTargets,getAdapter}from'./adapters/index.js';import{installToolInteractionTemplates,writeSharedAgentsStub}from'./tool-interactions.js';import{cleanupLegacyDefaultSkillDir,loadDefaultSkillManifest,loadProjectTemplateManifests}from'./scaffold.js';import{validateManifest}from'./validator.js';export async function initSkills(_0x1964a9,_0x468edb,_0x248790){const _0x47265c=_0x484c;await cleanupLegacyDefaultSkillDir(_0x1964a9);const _0x22300f=await loadConfig(_0x1964a9),_0x305746=await loadProjectTemplateManifests(_0x1964a9);let _0x4e94a8=_0x305746[_0x47265c(0xe3)]>-0x2281+0x1f3d*0x1+-0x4*-0xd1?_0x305746:await loadAllSkillManifests(_0x1964a9);if(_0x4e94a8[_0x47265c(0xe3)]===-0x109c+0x208f+-0xff3*0x1)_0x4e94a8=[await loadDefaultSkillManifest(_0x1964a9)];const _0x3ea31f=buildInitConfig(_0x22300f,_0x4e94a8),_0x143457=expandTargets(_0x468edb);if(_0x248790)for(const _0x1cccc4 of _0x143457){const _0x35277a=resolveAgentRoot(_0x1964a9,_0x3ea31f['agents'][_0x1cccc4][_0x47265c(0xeb)]);await rm(_0x374e49[_0x47265c(0xed)](_0x35277a,_0x47265c(0xfb)),{'recursive':!![],'force':!![]}),await rm(_0x374e49['join'](_0x35277a,_0x3ea31f[_0x47265c(0xe5)][_0x1cccc4][_0x47265c(0x106)]),{'recursive':!![],'force':!![]});const _0x32daff=_0x3ea31f[_0x47265c(0xe5)][_0x1cccc4][_0x47265c(0x102)]?_0x374e49[_0x47265c(0xed)](_0x1964a9,_0x3ea31f[_0x47265c(0xe5)][_0x1cccc4][_0x47265c(0xfc)]):_0x374e49[_0x47265c(0xed)](_0x35277a,_0x3ea31f[_0x47265c(0xe5)][_0x1cccc4][_0x47265c(0xfc)]);await rm(_0x32daff,{'force':!![]});}for(const _0x4a4ffd of _0x4e94a8){const _0x47dba5=[...validateManifest(_0x4a4ffd)];for(const _0x52c2e4 of _0x143457){_0x47dba5[_0x47265c(0xe7)](...getAdapter(_0x52c2e4)[_0x47265c(0xef)](_0x4a4ffd));}failIfErrors(_0x47dba5);}for(const _0x1a91de of _0x4e94a8){for(const _0x1e0b8d of _0x143457){const _0x38f933=_0x374e49['join'](resolveAgentRoot(_0x1964a9,_0x3ea31f['agents'][_0x1e0b8d][_0x47265c(0xeb)]),_0x47265c(0xfb),_0x1a91de[_0x47265c(0xf6)]);await getAdapter(_0x1e0b8d)[_0x47265c(0xe9)](_0x1a91de,_0x38f933,_0x248790);}}const _0x5edbf8=[];for(const _0x2a9436 of _0x143457){_0x5edbf8['push'](...await installToolInteractionTemplates(_0x1964a9,_0x2a9436,_0x4e94a8,_0x3ea31f));}return _0x5edbf8[_0x47265c(0xe7)](await writeSharedAgentsStub(_0x1964a9,_0x143457,_0x4e94a8,_0x3ea31f)),_0x5edbf8;}function buildInitConfig(_0x33e46b,_0xd8415f){const _0x23cda8=_0x484c,_0x52da74=new Set(_0xd8415f[_0x23cda8(0xf4)](_0x5022a3=>_0x5022a3[_0x23cda8(0xf6)])),_0x3eb19a=buildSkillDrivenBindings(_0xd8415f);return{..._0x33e46b,'commandBindings':_0x3eb19a[_0x23cda8(0xe3)]>-0xaaf+-0x261a+0x30c9?_0x3eb19a:_0x33e46b[_0x23cda8(0xe0)][_0x23cda8(0xf4)](_0x456b09=>_0x52da74[_0x23cda8(0xf5)](_0x456b09[_0x23cda8(0xfe)])?_0x456b09:{..._0x456b09,'skill':_0xd8415f[0x65*-0x1d+0x2401*-0x1+0x2f72]?.[_0x23cda8(0xf6)]||_0x456b09[_0x23cda8(0xfe)]}),'agents':{'codex':{..._0x33e46b[_0x23cda8(0xe5)][_0x23cda8(0x101)],'commandFilePattern':_0x23cda8(0x104),'slashPattern':_0x23cda8(0xe1)},'claudecode':{..._0x33e46b[_0x23cda8(0xe5)][_0x23cda8(0xe2)],'commandFilePattern':_0x23cda8(0x104),'slashPattern':_0x23cda8(0xe1)},'iflow':{..._0x33e46b[_0x23cda8(0xe5)][_0x23cda8(0x107)],'commandFilePattern':'{id}.md','slashPattern':_0x23cda8(0xe1)}}};}function _0x484c(_0x3cada5,_0x58ab75){_0x3cada5=_0x3cada5-(0x293*0xe+-0x23b2+0x87);const _0x46cdd0=_0x32ee();let _0x22b40e=_0x46cdd0[_0x3cada5];return _0x22b40e;}function buildSkillDrivenBindings(_0x25610b){const _0x885537=_0x484c,_0x30a30c=new Set();return _0x25610b[_0x885537(0xf4)](_0x5bffae=>{const _0x526f5b=_0x885537,_0x3f6bdf=commandIdForSkillName(_0x5bffae[_0x526f5b(0xf6)]);let _0x1f6605=_0x3f6bdf,_0x18ce8e=0x53b*0x4+-0x2*-0x8b5+-0x2654;while(_0x30a30c['has'](_0x1f6605)){_0x1f6605=''+_0x3f6bdf+_0x18ce8e,_0x18ce8e+=0x241*0x2+-0x2111+0x1c9*0x10;}return _0x30a30c[_0x526f5b(0x103)](_0x1f6605),{'id':_0x1f6605,'skill':_0x5bffae[_0x526f5b(0xf6)],'description':_0x526f5b(0xf1)+_0x5bffae[_0x526f5b(0xf6)]};});}function commandIdForSkillName(_0x5ae779){const _0x1452d3=_0x484c,_0x4eef21=_0x5ae779[_0x1452d3(0xff)]()['replace'](/[^a-z0-9]+/g,'-')['replace'](/^-+|-+$/g,'');return _0x1452d3(0xee)+(_0x4eef21||'skill');}function failIfErrors(_0x1c4123){const _0x114cba=_0x484c,_0x223f84=_0x1c4123['filter'](_0x44dc18=>_0x44dc18[_0x114cba(0xf2)]==='warning');_0x223f84[_0x114cba(0xf3)](_0x3be587=>console[_0x114cba(0x100)](_0x114cba(0x105)+_0x3be587[_0x114cba(0xea)]));const _0x2f5e9f=_0x1c4123[_0x114cba(0xdf)](_0x1a2aea=>_0x1a2aea[_0x114cba(0xf2)]==='error');if(_0x2f5e9f[_0x114cba(0xe3)]>0x2586*0x1+-0x1662+0x792*-0x2)throw new Error(_0x2f5e9f[_0x114cba(0xf4)](_0x495fc0=>_0x495fc0[_0x114cba(0xea)])[_0x114cba(0xed)]('\x0a'));}
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { resolveAgentRoot } from "../config/path.js";
|
|
4
|
-
import { ensureDir } from "../utils/fs.js";
|
|
5
|
-
export async function installToolInteractionTemplates(cwd, target, skills, config) {
|
|
6
|
-
const agent = config.agents[target];
|
|
7
|
-
const root = resolveAgentRoot(cwd, agent.rootDir);
|
|
8
|
-
const commandsDir = path.join(root, agent.commandsDir);
|
|
9
|
-
await ensureDir(commandsDir);
|
|
10
|
-
const created = [];
|
|
11
|
-
for (const binding of config.commandBindings) {
|
|
12
|
-
const fileName = agent.commandFilePattern.replace("{id}", binding.id);
|
|
13
|
-
const file = path.join(commandsDir, fileName);
|
|
14
|
-
await writeFile(file, renderCommandTemplate(target, binding.id, binding.skill, binding.description), "utf8");
|
|
15
|
-
created.push(file);
|
|
16
|
-
}
|
|
17
|
-
const guidePath = agent.guideAtProjectRoot
|
|
18
|
-
? path.join(cwd, agent.guideFile)
|
|
19
|
-
: path.join(root, agent.guideFile);
|
|
20
|
-
await writeFile(guidePath, renderGuide(target, skills, config), "utf8");
|
|
21
|
-
created.push(guidePath);
|
|
22
|
-
return created;
|
|
23
|
-
}
|
|
24
|
-
export async function writeSharedAgentsStub(cwd, targets, skills, config) {
|
|
25
|
-
const file = path.join(cwd, "AGENTS.md");
|
|
26
|
-
const lines = [
|
|
27
|
-
"# AGENTS instructions",
|
|
28
|
-
"",
|
|
29
|
-
"<INSTRUCTIONS>",
|
|
30
|
-
"## OpenSpec Setup",
|
|
31
|
-
`Enabled targets: ${targets.join(", ")}`,
|
|
32
|
-
"### Skills",
|
|
33
|
-
...skills.map((skill) => `- ${skill.name}: ${skill.description || "No description"}`),
|
|
34
|
-
"### Command Bindings",
|
|
35
|
-
...config.commandBindings.map((binding) => `- ${binding.id} -> ${binding.skill}`),
|
|
36
|
-
"</INSTRUCTIONS>",
|
|
37
|
-
""
|
|
38
|
-
];
|
|
39
|
-
await writeFile(file, lines.join("\n"), "utf8");
|
|
40
|
-
return file;
|
|
41
|
-
}
|
|
42
|
-
function renderCommandTemplate(target, commandId, skillName, description) {
|
|
43
|
-
return [
|
|
44
|
-
`# ${commandId} (${target})`,
|
|
45
|
-
"",
|
|
46
|
-
description,
|
|
47
|
-
"",
|
|
48
|
-
"## Skill binding",
|
|
49
|
-
`- skill: ${skillName}`,
|
|
50
|
-
"",
|
|
51
|
-
"## Required output",
|
|
52
|
-
"- Change ID",
|
|
53
|
-
"- Updated files",
|
|
54
|
-
"- Validation summary"
|
|
55
|
-
].join("\n");
|
|
56
|
-
}
|
|
57
|
-
function renderGuide(target, skills, config) {
|
|
58
|
-
const agent = config.agents[target];
|
|
59
|
-
const commandList = config.commandBindings.map((binding) => `- ${agent.slashPattern.replace("{id}", binding.id)} -> ${binding.skill}`);
|
|
60
|
-
return [
|
|
61
|
-
`# ${target} OpenSpec-style setup`,
|
|
62
|
-
"",
|
|
63
|
-
"## Installed skills",
|
|
64
|
-
...skills.map((skill) => `- ${skill.name}: ${skill.description || "No description"}`),
|
|
65
|
-
"",
|
|
66
|
-
"## Commands",
|
|
67
|
-
...commandList,
|
|
68
|
-
""
|
|
69
|
-
].join("\n");
|
|
70
|
-
}
|
|
1
|
+
(function(_0x546dd8,_0x4301c6){const _0x5bddbd=_0x2eb8,_0x1403c0=_0x546dd8();while(!![]){try{const _0x2afa13=parseInt(_0x5bddbd(0xe4))/(-0x17*0x6+-0x26d1+-0xb*-0x394)*(-parseInt(_0x5bddbd(0xdc))/(0x1899+-0x101*-0x17+-0x2fae))+parseInt(_0x5bddbd(0xcb))/(-0xceb*0x1+-0xcdc*-0x1+-0x3*-0x6)+-parseInt(_0x5bddbd(0xd1))/(-0x1*-0x327+-0x2550+0x222d)+parseInt(_0x5bddbd(0xce))/(-0x2108+-0x1b*-0x5a+0x178f)*(-parseInt(_0x5bddbd(0xd4))/(0x377*0x4+0x9d9*0x1+-0x17af))+parseInt(_0x5bddbd(0xcc))/(0xe34+-0x4*-0x6b2+-0x28f5)+-parseInt(_0x5bddbd(0xd7))/(0xb*0x241+-0x1175+-0xa*0xbb)+-parseInt(_0x5bddbd(0xdf))/(0x633+-0x3*0x46f+0x723)*(-parseInt(_0x5bddbd(0xdd))/(-0x2f*0xf+0x3a0+-0xd5));if(_0x2afa13===_0x4301c6)break;else _0x1403c0['push'](_0x1403c0['shift']());}catch(_0x519bff){_0x1403c0['push'](_0x1403c0['shift']());}}}(_0x2d1b,0x27e10*0x7+-0x31fe3+-0x1*0x402ca));import{writeFile}from'node:fs/promises';import _0x2001c9 from'node:path';import{resolveAgentRoot}from'../config/path.js';import{ensureDir}from'../utils/fs.js';function _0x2eb8(_0x3ef28d,_0x320fdf){_0x3ef28d=_0x3ef28d-(-0x56e+0x12a8+0x63a*-0x2);const _0x1a63dd=_0x2d1b();let _0x4814e6=_0x1a63dd[_0x3ef28d];return _0x4814e6;}function _0x2d1b(){const _0x391783=['-\x20Updated\x20files','427016grsIKE','\x20->\x20','guideFile','192618oEvVtV','skill','##\x20OpenSpec\x20Setup','4926104uGuHLK','name','-\x20skill:\x20','map','No\x20description','3478waANAF','7010KFiLFW','agents','4041BMaUIO','replace','##\x20Installed\x20skills','###\x20Skills','utf8','313aaMlgZ','push','-\x20Validation\x20summary','##\x20Skill\x20binding','description','<INSTRUCTIONS>','##\x20Required\x20output','join','Enabled\x20targets:\x20','{id}','commandsDir','##\x20Commands','3263370yMRbxc','4229890tICLGa','commandFilePattern','10KwyUyx','###\x20Command\x20Bindings'];_0x2d1b=function(){return _0x391783;};return _0x2d1b();}export async function installToolInteractionTemplates(_0x4329f6,_0x43d45d,_0x154038,_0x4fc60a){const _0x224e11=_0x2eb8,_0x121e47=_0x4fc60a[_0x224e11(0xde)][_0x43d45d],_0xbbac10=resolveAgentRoot(_0x4329f6,_0x121e47['rootDir']),_0x537b98=_0x2001c9[_0x224e11(0xc6)](_0xbbac10,_0x121e47[_0x224e11(0xc9)]);await ensureDir(_0x537b98);const _0x53c7c1=[];for(const _0x30bc63 of _0x4fc60a['commandBindings']){const _0x5d74c3=_0x121e47[_0x224e11(0xcd)][_0x224e11(0xe0)](_0x224e11(0xc8),_0x30bc63['id']),_0x467301=_0x2001c9[_0x224e11(0xc6)](_0x537b98,_0x5d74c3);await writeFile(_0x467301,renderCommandTemplate(_0x43d45d,_0x30bc63['id'],_0x30bc63['skill'],_0x30bc63['description']),_0x224e11(0xe3)),_0x53c7c1[_0x224e11(0xe5)](_0x467301);}const _0x5d351b=_0x121e47['guideAtProjectRoot']?_0x2001c9['join'](_0x4329f6,_0x121e47[_0x224e11(0xd3)]):_0x2001c9[_0x224e11(0xc6)](_0xbbac10,_0x121e47[_0x224e11(0xd3)]);return await writeFile(_0x5d351b,renderGuide(_0x43d45d,_0x154038,_0x4fc60a),_0x224e11(0xe3)),_0x53c7c1[_0x224e11(0xe5)](_0x5d351b),_0x53c7c1;}export async function writeSharedAgentsStub(_0x115f91,_0x29e957,_0x54ad1d,_0x18a41c){const _0x1d98bc=_0x2eb8,_0x31b856=_0x2001c9[_0x1d98bc(0xc6)](_0x115f91,'AGENTS.md'),_0x5a8b76=['#\x20AGENTS\x20instructions','',_0x1d98bc(0xe9),_0x1d98bc(0xd6),_0x1d98bc(0xc7)+_0x29e957[_0x1d98bc(0xc6)](',\x20'),_0x1d98bc(0xe2),..._0x54ad1d[_0x1d98bc(0xda)](_0xd6df91=>'-\x20'+_0xd6df91[_0x1d98bc(0xd8)]+':\x20'+(_0xd6df91['description']||_0x1d98bc(0xdb))),_0x1d98bc(0xcf),..._0x18a41c['commandBindings'][_0x1d98bc(0xda)](_0x1cce62=>'-\x20'+_0x1cce62['id']+_0x1d98bc(0xd2)+_0x1cce62[_0x1d98bc(0xd5)]),'</INSTRUCTIONS>',''];return await writeFile(_0x31b856,_0x5a8b76[_0x1d98bc(0xc6)]('\x0a'),_0x1d98bc(0xe3)),_0x31b856;}function renderCommandTemplate(_0x114846,_0x51de58,_0x4612f7,_0x8b1058){const _0x386ccb=_0x2eb8;return['#\x20'+_0x51de58+'\x20('+_0x114846+')','',_0x8b1058,'',_0x386ccb(0xe7),_0x386ccb(0xd9)+_0x4612f7,'',_0x386ccb(0xea),'-\x20Change\x20ID',_0x386ccb(0xd0),_0x386ccb(0xe6)][_0x386ccb(0xc6)]('\x0a');}function renderGuide(_0x453a02,_0x4719f9,_0x28950b){const _0x273053=_0x2eb8,_0x53da1d=_0x28950b[_0x273053(0xde)][_0x453a02],_0x203ec2=_0x28950b['commandBindings'][_0x273053(0xda)](_0x4378b9=>'-\x20'+_0x53da1d['slashPattern'][_0x273053(0xe0)](_0x273053(0xc8),_0x4378b9['id'])+_0x273053(0xd2)+_0x4378b9[_0x273053(0xd5)]);return['#\x20'+_0x453a02+'\x20OpenSpec-style\x20setup','',_0x273053(0xe1),..._0x4719f9[_0x273053(0xda)](_0x3c4deb=>'-\x20'+_0x3c4deb['name']+':\x20'+(_0x3c4deb[_0x273053(0xe8)]||'No\x20description')),'',_0x273053(0xca),..._0x203ec2,''][_0x273053(0xc6)]('\x0a');}
|
package/dist/skill-core/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
export function validateManifest(
|
|
2
|
-
const diagnostics = [];
|
|
3
|
-
if (!manifest.name) {
|
|
4
|
-
diagnostics.push({ level: "error", message: "Skill name is required." });
|
|
5
|
-
}
|
|
6
|
-
if (!manifest.description) {
|
|
7
|
-
diagnostics.push({
|
|
8
|
-
level: "error",
|
|
9
|
-
message: `Skill "${manifest.name}" is missing frontmatter description.`
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
if (!manifest.body) {
|
|
13
|
-
diagnostics.push({
|
|
14
|
-
level: "warning",
|
|
15
|
-
message: `Skill "${manifest.name}" has empty SKILL.md body.`
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
if (!/^[a-z0-9-]+$/.test(manifest.name)) {
|
|
19
|
-
diagnostics.push({
|
|
20
|
-
level: "warning",
|
|
21
|
-
message: `Skill "${manifest.name}" should use lowercase letters, numbers, and hyphens.`
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return diagnostics;
|
|
25
|
-
}
|
|
1
|
+
function _0x349c(_0x1abc75,_0x4f31bf){_0x1abc75=_0x1abc75-(-0x98f+0x47*0x19+-0x102*-0x3);const _0x1e76cc=_0x15f7();let _0x454d80=_0x1e76cc[_0x1abc75];return _0x454d80;}function _0x15f7(){const _0x5e9332=['16542fcuFyB','body','106400ZKtjhb','243KgNeyd','15415598efDSlf','30MfIOqR','\x22\x20has\x20empty\x20SKILL.md\x20body.','82512WXgNqp','340EaOLjH','name','Skill\x20name\x20is\x20required.','warning','484siVKgM','description','error','Skill\x20\x22','4699210oGYJIl','\x22\x20is\x20missing\x20frontmatter\x20description.','614YxwJry','463043vQctTK','push','\x22\x20should\x20use\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens.'];_0x15f7=function(){return _0x5e9332;};return _0x15f7();}(function(_0x560764,_0x5cbed2){const _0x2e4b45=_0x349c,_0xd7bc7f=_0x560764();while(!![]){try{const _0x7b726c=parseInt(_0x2e4b45(0x79))/(-0x147b+0x14f6+0x2*-0x3d)*(-parseInt(_0x2e4b45(0x69))/(-0x2*0x26a+0x1*0x5a2+-0xcc))+-parseInt(_0x2e4b45(0x6d))/(0xc*-0x7f+-0xf5d+0x38e*0x6)*(parseInt(_0x2e4b45(0x75))/(-0x2d0+0x2*0x6e3+-0x6*0x1d3))+-parseInt(_0x2e4b45(0x6f))/(-0x1e9c*0x1+-0x935+0x27d6)+-parseInt(_0x2e4b45(0x72))/(0xabf*0x1+-0x1061+-0x16a*-0x4)*(-parseInt(_0x2e4b45(0x6a))/(0xcaf*0x1+0x3*0xc1+-0xeeb))+-parseInt(_0x2e4b45(0x74))/(-0x3b*-0x3c+0x2210+-0x2fdc)*(parseInt(_0x2e4b45(0x70))/(-0x13c0+0xd8d+0x72*0xe))+-parseInt(_0x2e4b45(0x67))/(0x1398+-0x1974+-0x97*-0xa)+parseInt(_0x2e4b45(0x71))/(-0xc7a+-0x1b09+0x278e);if(_0x7b726c===_0x5cbed2)break;else _0xd7bc7f['push'](_0xd7bc7f['shift']());}catch(_0x33139b){_0xd7bc7f['push'](_0xd7bc7f['shift']());}}}(_0x15f7,0x81803+-0x64700+0x37373));export function validateManifest(_0x454d80){const _0x975be7=_0x349c,_0x347148=[];return!_0x454d80[_0x975be7(0x76)]&&_0x347148[_0x975be7(0x6b)]({'level':'error','message':_0x975be7(0x77)}),!_0x454d80[_0x975be7(0x7a)]&&_0x347148[_0x975be7(0x6b)]({'level':_0x975be7(0x7b),'message':_0x975be7(0x66)+_0x454d80[_0x975be7(0x76)]+_0x975be7(0x68)}),!_0x454d80[_0x975be7(0x6e)]&&_0x347148[_0x975be7(0x6b)]({'level':_0x975be7(0x78),'message':_0x975be7(0x66)+_0x454d80['name']+_0x975be7(0x73)}),!/^[a-z0-9-]+$/['test'](_0x454d80[_0x975be7(0x76)])&&_0x347148['push']({'level':'warning','message':_0x975be7(0x66)+_0x454d80[_0x975be7(0x76)]+_0x975be7(0x6c)}),_0x347148;}
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
export function parseFrontmatter(
|
|
2
|
-
const normalized = content.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n");
|
|
3
|
-
if (!normalized.startsWith("---\n")) {
|
|
4
|
-
return { attributes: {}, body: normalized };
|
|
5
|
-
}
|
|
6
|
-
const endIndex = normalized.indexOf("\n---\n", 4);
|
|
7
|
-
if (endIndex === -1) {
|
|
8
|
-
return { attributes: {}, body: normalized };
|
|
9
|
-
}
|
|
10
|
-
const header = normalized.slice(4, endIndex);
|
|
11
|
-
const body = normalized.slice(endIndex + 5);
|
|
12
|
-
const attributes = {};
|
|
13
|
-
for (const rawLine of header.split("\n")) {
|
|
14
|
-
const line = rawLine.trim();
|
|
15
|
-
if (!line || line.startsWith("#"))
|
|
16
|
-
continue;
|
|
17
|
-
const idx = line.indexOf(":");
|
|
18
|
-
if (idx <= 0)
|
|
19
|
-
continue;
|
|
20
|
-
const key = line.slice(0, idx).trim();
|
|
21
|
-
let value = line.slice(idx + 1).trim();
|
|
22
|
-
value = stripQuotes(value);
|
|
23
|
-
attributes[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return { attributes, body };
|
|
26
|
-
}
|
|
27
|
-
export function stringifyFrontmatter(attributes, body) {
|
|
28
|
-
const lines = Object.entries(attributes).map(([key, value]) => {
|
|
29
|
-
const escaped = value.replace(/"/g, '\\"');
|
|
30
|
-
return `${key}: "${escaped}"`;
|
|
31
|
-
});
|
|
32
|
-
return `---\n${lines.join("\n")}\n---\n\n${body.trimEnd()}\n`;
|
|
33
|
-
}
|
|
34
|
-
function stripQuotes(value) {
|
|
35
|
-
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
36
|
-
(value.startsWith("'") && value.endsWith("'"))) {
|
|
37
|
-
return value.slice(1, -1);
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
1
|
+
(function(_0x3539f9,_0x5ad08f){const _0xc76583=_0x312d,_0x571d92=_0x3539f9();while(!![]){try{const _0x5b6174=-parseInt(_0xc76583(0x12f))/(-0x261a+0x1*0x886+0x1d95)+-parseInt(_0xc76583(0x11e))/(0x269e+0x1*0x167b+-0x3d17)*(-parseInt(_0xc76583(0x12a))/(0x64*0x3c+0x1045+-0x2*0x13d9))+-parseInt(_0xc76583(0x12e))/(-0x19ad*-0x1+0x97*-0x39+0x2*0x3fb)+-parseInt(_0xc76583(0x11a))/(-0x108f*-0x2+-0x1862+-0x8b7)+parseInt(_0xc76583(0x11f))/(0x6be*-0x2+-0x87a+-0x2a*-0x86)+-parseInt(_0xc76583(0x12d))/(-0x1*0xda9+0x9*0x26e+-0x82e)*(-parseInt(_0xc76583(0x127))/(0x3*0xb91+-0x14cc+0xddf*-0x1))+-parseInt(_0xc76583(0x121))/(-0x9c9+-0x2350+0x2d22)*(-parseInt(_0xc76583(0x11d))/(0x476+-0x3db+-0x91));if(_0x5b6174===_0x5ad08f)break;else _0x571d92['push'](_0x571d92['shift']());}catch(_0x49424c){_0x571d92['push'](_0x571d92['shift']());}}}(_0x28ec,-0x53ca2+0xd*0xbd93+0x75cba));function _0x312d(_0x4f7e15,_0x35afd8){_0x4f7e15=_0x4f7e15-(-0x253c+0x7*0x1f3+0x18b0);const _0xefa204=_0x28ec();let _0x46bf8c=_0xefa204[_0x4f7e15];return _0x46bf8c;}function _0x28ec(){const _0x485c41=['join','entries','startsWith','8CXHbwh','split','trim','6pICIvc','slice','endsWith','4514223iHYjuj','5391392aASjfS','687826zmVmuY','---\x0a','2640855AuyMQW',':\x20\x22','\x0a---\x0a\x0a','8620KpILyV','892298DSJRqC','23334aIrbVu','replace','18720SgIaEm','map','indexOf'];_0x28ec=function(){return _0x485c41;};return _0x28ec();}export function parseFrontmatter(_0xeeeccd){const _0x595bf6=_0x312d,_0x15bc25=_0xeeeccd[_0x595bf6(0x120)](/^\uFEFF/,'')['replace'](/\r\n/g,'\x0a');if(!_0x15bc25['startsWith'](_0x595bf6(0x119)))return{'attributes':{},'body':_0x15bc25};const _0x2728f1=_0x15bc25[_0x595bf6(0x123)]('\x0a---\x0a',0x51e+-0x2b*-0x3d+0x1*-0xf59);if(_0x2728f1===-(-0x4ca+0x1*-0x236d+0x138*0x21))return{'attributes':{},'body':_0x15bc25};const _0x128ae0=_0x15bc25['slice'](-0x1884+-0x147+0x19cf,_0x2728f1),_0x399e5b=_0x15bc25['slice'](_0x2728f1+(-0x1f6a+0x31*0x90+0x3df*0x1)),_0x16be53={};for(const _0x30ed5e of _0x128ae0[_0x595bf6(0x128)]('\x0a')){const _0x442cf9=_0x30ed5e[_0x595bf6(0x129)]();if(!_0x442cf9||_0x442cf9[_0x595bf6(0x126)]('#'))continue;const _0x4ac1be=_0x442cf9['indexOf'](':');if(_0x4ac1be<=0x1a11+0x1712+-0x3123)continue;const _0x2bc592=_0x442cf9[_0x595bf6(0x12b)](-0x1613+-0x2622+0x3c35,_0x4ac1be)[_0x595bf6(0x129)]();let _0x134254=_0x442cf9[_0x595bf6(0x12b)](_0x4ac1be+(0x2253+-0x21f1+-0x61*0x1))[_0x595bf6(0x129)]();_0x134254=stripQuotes(_0x134254),_0x16be53[_0x2bc592]=_0x134254;}return{'attributes':_0x16be53,'body':_0x399e5b};}export function stringifyFrontmatter(_0x1f7d6c,_0x107af3){const _0x5aba23=_0x312d,_0x1a7def=Object[_0x5aba23(0x125)](_0x1f7d6c)[_0x5aba23(0x122)](([_0x15be05,_0x5dccde])=>{const _0x1e6bad=_0x5aba23,_0x38813c=_0x5dccde['replace'](/"/g,'\x5c\x22');return _0x15be05+_0x1e6bad(0x11b)+_0x38813c+'\x22';});return _0x5aba23(0x119)+_0x1a7def[_0x5aba23(0x124)]('\x0a')+_0x5aba23(0x11c)+_0x107af3['trimEnd']()+'\x0a';}function stripQuotes(_0x3306d8){const _0x22fd75=_0x312d;if(_0x3306d8[_0x22fd75(0x126)]('\x22')&&_0x3306d8[_0x22fd75(0x12c)]('\x22')||_0x3306d8[_0x22fd75(0x126)]('\x27')&&_0x3306d8[_0x22fd75(0x12c)]('\x27'))return _0x3306d8['slice'](0x1b5*-0x14+0x1866+0x5*0x1f3,-(0x3*-0x221+-0x1d1f+0x2383));return _0x3306d8;}
|
package/dist/utils/fs.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
export async function ensureDir(dirPath) {
|
|
4
|
-
await mkdir(dirPath, { recursive: true });
|
|
5
|
-
}
|
|
6
|
-
export async function pathExists(target) {
|
|
7
|
-
try {
|
|
8
|
-
await stat(target);
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export async function emptyDir(dirPath) {
|
|
16
|
-
await rm(dirPath, { recursive: true, force: true });
|
|
17
|
-
await mkdir(dirPath, { recursive: true });
|
|
18
|
-
}
|
|
19
|
-
export async function copyDir(srcDir, dstDir) {
|
|
20
|
-
await ensureDir(dstDir);
|
|
21
|
-
const entries = await readdir(srcDir, { withFileTypes: true });
|
|
22
|
-
for (const entry of entries) {
|
|
23
|
-
const srcPath = path.join(srcDir, entry.name);
|
|
24
|
-
const dstPath = path.join(dstDir, entry.name);
|
|
25
|
-
if (entry.isDirectory()) {
|
|
26
|
-
await copyDir(srcPath, dstPath);
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
await copyFile(srcPath, dstPath);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export async function listDirs(dirPath) {
|
|
33
|
-
if (!(await pathExists(dirPath)))
|
|
34
|
-
return [];
|
|
35
|
-
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
36
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
37
|
-
}
|
|
1
|
+
(function(_0x10009d,_0x3e2e32){const _0x3fa788=_0x2d93,_0x244326=_0x10009d();while(!![]){try{const _0x2cd429=parseInt(_0x3fa788(0xb9))/(-0x19c9+0x1121+0x1*0x8a9)+parseInt(_0x3fa788(0xae))/(-0x155e+0x1686+0x1*-0x126)+-parseInt(_0x3fa788(0xb2))/(0x18d*-0x1+0x1704+-0x1574)+-parseInt(_0x3fa788(0xb6))/(0x1d56*-0x1+0x5ab*0x1+0x17af)+parseInt(_0x3fa788(0xb1))/(-0x2e5+0x2*-0x11f9+0x26dc)+-parseInt(_0x3fa788(0xb5))/(0x29e*0x1+-0x102e+0xd96)*(parseInt(_0x3fa788(0xb7))/(0x983*-0x1+0x2*0x441+-0x84*-0x2))+parseInt(_0x3fa788(0xb3))/(0x242a+0x12db+-0x36fd)*(parseInt(_0x3fa788(0xb4))/(0xa*-0x19+0x19b6*-0x1+0x1ab9));if(_0x2cd429===_0x3e2e32)break;else _0x244326['push'](_0x244326['shift']());}catch(_0x11db59){_0x244326['push'](_0x244326['shift']());}}}(_0x57a3,0xd7c5+0x994*0x8b+0x67*-0x35f));import{mkdir,readdir,rm,stat,copyFile}from'node:fs/promises';function _0x2d93(_0x9e7978,_0x4e2cf5){_0x9e7978=_0x9e7978-(-0x1*-0x1bfc+-0x12b9*0x1+0x1*-0x897);const _0x18c282=_0x57a3();let _0x15a66f=_0x18c282[_0x9e7978];return _0x15a66f;}import _0x18c282 from'node:path';function _0x57a3(){const _0xf01aa7=['name','697218lTwORA','map','filter','2131095EInSdl','620664VsZIcV','656gEJmeH','38601Sjbflj','1206qflTBx','1423416BPkOaa','16149galUJw','isDirectory','207099hUrgbb','join'];_0x57a3=function(){return _0xf01aa7;};return _0x57a3();}export async function ensureDir(_0x15a66f){await mkdir(_0x15a66f,{'recursive':!![]});}export async function pathExists(_0x5d6470){try{return await stat(_0x5d6470),!![];}catch{return![];}}export async function emptyDir(_0xc2d6fa){await rm(_0xc2d6fa,{'recursive':!![],'force':!![]}),await mkdir(_0xc2d6fa,{'recursive':!![]});}export async function copyDir(_0x4f4d23,_0x2b7060){const _0x4b2e9b=_0x2d93;await ensureDir(_0x2b7060);const _0x555b51=await readdir(_0x4f4d23,{'withFileTypes':!![]});for(const _0x238ee7 of _0x555b51){const _0x2e7ca8=_0x18c282[_0x4b2e9b(0xac)](_0x4f4d23,_0x238ee7[_0x4b2e9b(0xad)]),_0x40c57c=_0x18c282['join'](_0x2b7060,_0x238ee7[_0x4b2e9b(0xad)]);if(_0x238ee7['isDirectory']()){await copyDir(_0x2e7ca8,_0x40c57c);continue;}await copyFile(_0x2e7ca8,_0x40c57c);}}export async function listDirs(_0x4c0094){const _0x3ed7a9=_0x2d93;if(!await pathExists(_0x4c0094))return[];const _0x4d2d29=await readdir(_0x4c0094,{'withFileTypes':!![]});return _0x4d2d29[_0x3ed7a9(0xb0)](_0x69f15e=>_0x69f15e[_0x3ed7a9(0xb8)]())[_0x3ed7a9(0xaf)](_0x12ab61=>_0x12ab61[_0x3ed7a9(0xad)]);}
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdspec",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"author": "liyanwei",
|
|
4
5
|
"description": "CDSpec CLI for skill sync and task split/archive workflow",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"bin": {
|
|
7
8
|
"cdspec": "dist/cli.js"
|
|
8
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates",
|
|
13
|
+
"README.md",
|
|
14
|
+
"cdspec.config.yaml"
|
|
15
|
+
],
|
|
9
16
|
"scripts": {
|
|
10
|
-
"build": "
|
|
17
|
+
"build": "node scripts/build.mjs",
|
|
18
|
+
"build:raw": "tsc -p tsconfig.json",
|
|
19
|
+
"prepack": "npm run build",
|
|
11
20
|
"dev": "tsx src/cli.ts",
|
|
12
21
|
"test": "vitest run",
|
|
13
22
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
@@ -22,6 +31,7 @@
|
|
|
22
31
|
},
|
|
23
32
|
"devDependencies": {
|
|
24
33
|
"@types/node": "^24.0.0",
|
|
34
|
+
"javascript-obfuscator": "^4.1.1",
|
|
25
35
|
"tsx": "^4.20.3",
|
|
26
36
|
"typescript": "^5.9.3",
|
|
27
37
|
"vitest": "^3.2.4"
|