cdspec 0.1.1 → 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/dist/cli.js +1 -40
- 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 -60
- package/dist/skill-core/scaffold.js +1 -169
- package/dist/skill-core/service.js +1 -109
- 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 +11 -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/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 -44
- 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 -72
- package/src/skill-core/scaffold.ts +0 -192
- package/src/skill-core/service.ts +0 -137
- 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/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/init.test.ts +0 -63
- package/tsconfig.json +0 -16
- package/vitest.config.ts +0 -9
package/dist/cli.js
CHANGED
|
@@ -1,41 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import process from 'node:process';
|
|
6
|
-
import { initSkills } from './skill-core/service.js';
|
|
7
|
-
const program = new Command();
|
|
8
|
-
program.name('cdspec').description('Skill init CLI').version('0.1.0');
|
|
9
|
-
program
|
|
10
|
-
.command('init')
|
|
11
|
-
.description('Initialize skills for selected coding agents')
|
|
12
|
-
.option('--agents <agents>', 'codex|claudecode|iflow|all or comma-separated')
|
|
13
|
-
.action(async (options) => {
|
|
14
|
-
const selected = options.agents ?? (await askAgentsSelection());
|
|
15
|
-
const files = await initSkills(process.cwd(), selected, true);
|
|
16
|
-
console.log(`Initialized setup for "${selected}".`);
|
|
17
|
-
console.log(`Generated files: ${files.map(x => path.relative(process.cwd(), x)).join(', ')}`);
|
|
18
|
-
});
|
|
19
|
-
program.parseAsync(process.argv).catch((error) => {
|
|
20
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
-
console.error(message);
|
|
22
|
-
process.exitCode = 1;
|
|
23
|
-
});
|
|
24
|
-
async function askAgentsSelection() {
|
|
25
|
-
if (!process.stdin.isTTY)
|
|
26
|
-
return 'all';
|
|
27
|
-
const values = await checkbox({
|
|
28
|
-
message: 'Select coding agents',
|
|
29
|
-
choices: [
|
|
30
|
-
{ name: 'codex', value: 'codex', checked: true },
|
|
31
|
-
{ name: 'claudecode', value: 'claudecode' },
|
|
32
|
-
{ name: 'iflow', value: 'iflow' },
|
|
33
|
-
{ name: 'all', value: 'all' }
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
if (values.length === 0)
|
|
37
|
-
return 'all';
|
|
38
|
-
if (values.includes('all'))
|
|
39
|
-
return 'all';
|
|
40
|
-
return values.join(',');
|
|
41
|
-
}
|
|
2
|
+
const _0x4586ae=_0x2ae6;(function(_0x952b63,_0x19c83a){const _0x589d6a=_0x2ae6,_0x4ae186=_0x952b63();while(!![]){try{const _0x44ad2d=parseInt(_0x589d6a(0xf1))/(-0x8f4*0x1+0x25cf*-0x1+0x2ec4)+parseInt(_0x589d6a(0x102))/(-0xd*0x115+-0x1d9*0x4+0x1577)+parseInt(_0x589d6a(0xfd))/(-0x15b1+0x30*-0xc5+0x3aa4)*(parseInt(_0x589d6a(0x103))/(-0xb*0x23d+-0x3*-0x2cf+0x53*0x32))+parseInt(_0x589d6a(0xf2))/(0xbda+-0x1a28+0xc1*0x13)+-parseInt(_0x589d6a(0xfa))/(0x1fec+-0x3a0+0x1*-0x1c46)+-parseInt(_0x589d6a(0xf4))/(0xbc7+-0x230b*-0x1+-0x2ecb)+-parseInt(_0x589d6a(0x100))/(-0x27f*-0x2+0x207a+-0x2570);if(_0x44ad2d===_0x19c83a)break;else _0x4ae186['push'](_0x4ae186['shift']());}catch(_0x26c43b){_0x4ae186['push'](_0x4ae186['shift']());}}}(_0x4cca,-0x1dbe33+0x1584ad*0x1+-0xbb209*-0x2));import _0x18a232 from'@inquirer/checkbox';import{Command}from'commander';import _0x414dbc from'node:path';function _0x4cca(){const _0x13d22e=['command','Initialized\x20setup\x20for\x20\x22','log','join','all','version','iflow','message','name','Select\x20coding\x20agents','error','--agents\x20<agents>','isTTY','codex|claudecode|iflow|all\x20or\x20comma-separated','1440721ofwkIH','4373925AQBeYl','option','9023161UrAXlu','0.1.0','claudecode','stdin','action','catch','6361488VqTaZQ','Initialize\x20skills\x20for\x20selected\x20coding\x20agents','codex','243kdCjWw','init','cwd','10801848dwxeRn','Generated\x20files:\x20','1258762enamVM','86348TxpcQx','includes','argv'];_0x4cca=function(){return _0x13d22e;};return _0x4cca();}function _0x2ae6(_0x3a72c1,_0x4474e6){_0x3a72c1=_0x3a72c1-(-0x23b4+0x20ff+-0x1*-0x397);const _0x52982d=_0x4cca();let _0x5a546f=_0x52982d[_0x3a72c1];return _0x5a546f;}import _0x2cb688 from'node:process';import{initSkills}from'./skill-core/service.js';const program=new Command();program[_0x4586ae(0xeb)]('cdspec')['description']('Skill\x20init\x20CLI')[_0x4586ae(0xe8)](_0x4586ae(0xf5)),program[_0x4586ae(0xe3)](_0x4586ae(0xfe))['description'](_0x4586ae(0xfb))[_0x4586ae(0xf3)](_0x4586ae(0xee),_0x4586ae(0xf0))[_0x4586ae(0xf8)](async _0x2a3372=>{const _0x120f72=_0x4586ae,_0x4dc941=_0x2a3372['agents']??await askAgentsSelection(),_0x4bd56f=await initSkills(_0x2cb688['cwd'](),_0x4dc941,!![]);console[_0x120f72(0xe5)](_0x120f72(0xe4)+_0x4dc941+'\x22.'),console[_0x120f72(0xe5)](_0x120f72(0x101)+_0x4bd56f['map'](_0x1063a1=>_0x414dbc['relative'](_0x2cb688[_0x120f72(0xff)](),_0x1063a1))[_0x120f72(0xe6)](',\x20'));}),program['parseAsync'](_0x2cb688[_0x4586ae(0xe2)])[_0x4586ae(0xf9)](_0x311986=>{const _0x31556b=_0x4586ae,_0xb7ae0f=_0x311986 instanceof Error?_0x311986[_0x31556b(0xea)]:String(_0x311986);console[_0x31556b(0xed)](_0xb7ae0f),_0x2cb688['exitCode']=0x5e3+0x2*0x2dd+0x1*-0xb9c;});async function askAgentsSelection(){const _0x4f55c0=_0x4586ae;if(!_0x2cb688[_0x4f55c0(0xf7)][_0x4f55c0(0xef)])return _0x4f55c0(0xe7);const _0x510c4a=await _0x18a232({'message':_0x4f55c0(0xec),'choices':[{'name':'codex','value':_0x4f55c0(0xfc),'checked':!![]},{'name':_0x4f55c0(0xf6),'value':_0x4f55c0(0xf6)},{'name':_0x4f55c0(0xe9),'value':'iflow'},{'name':'all','value':_0x4f55c0(0xe7)}]});if(_0x510c4a['length']===0x2455+-0x1*-0x85+-0x24da)return _0x4f55c0(0xe7);if(_0x510c4a[_0x4f55c0(0x104)](_0x4f55c0(0xe7)))return _0x4f55c0(0xe7);return _0x510c4a[_0x4f55c0(0xe6)](',');}
|
package/dist/config/default.js
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
commandBindings: [
|
|
3
|
-
{
|
|
4
|
-
id: "propose",
|
|
5
|
-
skill: "openspec-core",
|
|
6
|
-
description: "Create a change proposal with scope and impacted specs."
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
id: "explore",
|
|
10
|
-
skill: "openspec-core",
|
|
11
|
-
description: "Analyze existing specs and produce planned deltas."
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: "apply",
|
|
15
|
-
skill: "openspec-core",
|
|
16
|
-
description: "Implement approved tasks and keep spec updates in sync."
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "archive",
|
|
20
|
-
skill: "openspec-core",
|
|
21
|
-
description: "Archive completed changes and update baseline specs."
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
agents: {
|
|
25
|
-
codex: {
|
|
26
|
-
rootDir: ".codex",
|
|
27
|
-
commandsDir: "prompts",
|
|
28
|
-
commandFilePattern: "opsx-{id}.md",
|
|
29
|
-
slashPattern: "/opsx-{id}",
|
|
30
|
-
guideFile: "AGENTS.md"
|
|
31
|
-
},
|
|
32
|
-
claudecode: {
|
|
33
|
-
rootDir: ".claude",
|
|
34
|
-
commandsDir: "commands/opsx",
|
|
35
|
-
commandFilePattern: "{id}.md",
|
|
36
|
-
slashPattern: "/opsx:{id}",
|
|
37
|
-
guideFile: "CLAUDE.md",
|
|
38
|
-
guideAtProjectRoot: true
|
|
39
|
-
},
|
|
40
|
-
iflow: {
|
|
41
|
-
rootDir: ".iflow",
|
|
42
|
-
commandsDir: "commands",
|
|
43
|
-
commandFilePattern: "opsx-{id}.md",
|
|
44
|
-
slashPattern: "/opsx-{id}",
|
|
45
|
-
guideFile: "IFLOW.md"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
1
|
+
const _0x3ae830=_0x4311;function _0x4311(_0x218500,_0x2547d7){_0x218500=_0x218500-(0x11*0xa9+-0xb*0x114+0x5*0x40);const _0x5a2b7b=_0x3d10();let _0x414fbe=_0x5a2b7b[_0x218500];return _0x414fbe;}(function(_0x2227e2,_0x58b444){const _0x532852=_0x4311,_0x258d5c=_0x2227e2();while(!![]){try{const _0x4f9852=parseInt(_0x532852(0xa2))/(-0x3*0x5c2+0x10c8+-0x7f*-0x1)+-parseInt(_0x532852(0xa5))/(0x1*0x1727+0x2522+-0x1*0x3c47)+parseInt(_0x532852(0xac))/(-0x1d*0x25+0x141f+-0xfeb)+parseInt(_0x532852(0xa1))/(0x1e1+0x18c6+-0x1aa3)+parseInt(_0x532852(0xaf))/(-0x173b*-0x1+-0xcf3+-0xa43)*(parseInt(_0x532852(0x9d))/(0x60+-0x9*0x41+0x1ef))+-parseInt(_0x532852(0xb2))/(0x2*-0xb1b+0xb*-0xfe+0x2127)*(parseInt(_0x532852(0xb1))/(0x38*-0xb2+-0x2*-0x685+0x19ee))+parseInt(_0x532852(0xa7))/(0x8cf+0x1*0x1105+-0x19cb)*(-parseInt(_0x532852(0xa9))/(0x1f88+0xc1b+0x1*-0x2b99));if(_0x4f9852===_0x58b444)break;else _0x258d5c['push'](_0x258d5c['shift']());}catch(_0xb859b7){_0x258d5c['push'](_0x258d5c['shift']());}}}(_0x3d10,0x1ab080+-0x151*0xe83+0x6ec94));function _0x3d10(){const _0x11b532=['2490710AhsFdV','.claude','72ZgNMth','commands/opsx','677460ftTtEq','/opsx-{id}','openspec-core','2552697ArNttS','explore','.iflow','145apVVUm','{id}.md','120aFUvWr','281183gbaswn','Analyze\x20existing\x20specs\x20and\x20produce\x20planned\x20deltas.','.codex','270888etCjcj','Create\x20a\x20change\x20proposal\x20with\x20scope\x20and\x20impacted\x20specs.','archive','Implement\x20approved\x20tasks\x20and\x20keep\x20spec\x20updates\x20in\x20sync.','1910552GYOIVL','702974BnWimk','/opsx:{id}','Archive\x20completed\x20changes\x20and\x20update\x20baseline\x20specs.'];_0x3d10=function(){return _0x11b532;};return _0x3d10();}export const defaultConfig={'commandBindings':[{'id':'propose','skill':_0x3ae830(0xab),'description':_0x3ae830(0x9e)},{'id':_0x3ae830(0xad),'skill':'openspec-core','description':_0x3ae830(0xb3)},{'id':'apply','skill':_0x3ae830(0xab),'description':_0x3ae830(0xa0)},{'id':_0x3ae830(0x9f),'skill':_0x3ae830(0xab),'description':_0x3ae830(0xa4)}],'agents':{'codex':{'rootDir':_0x3ae830(0xb4),'commandsDir':'prompts','commandFilePattern':'opsx-{id}.md','slashPattern':'/opsx-{id}','guideFile':'AGENTS.md'},'claudecode':{'rootDir':_0x3ae830(0xa6),'commandsDir':_0x3ae830(0xa8),'commandFilePattern':_0x3ae830(0xb0),'slashPattern':_0x3ae830(0xa3),'guideFile':'CLAUDE.md','guideAtProjectRoot':!![]},'iflow':{'rootDir':_0x3ae830(0xae),'commandsDir':'commands','commandFilePattern':'opsx-{id}.md','slashPattern':_0x3ae830(0xaa),'guideFile':'IFLOW.md'}}};
|
package/dist/config/loader.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { parse } from "yaml";
|
|
4
|
-
import { pathExists } from "../utils/fs.js";
|
|
5
|
-
import { defaultConfig } from "./default.js";
|
|
6
|
-
const CONFIG_FILE = "cdspec.config.yaml";
|
|
7
|
-
export async function loadConfig(cwd) {
|
|
8
|
-
const configPath = path.join(cwd, CONFIG_FILE);
|
|
9
|
-
if (!(await pathExists(configPath))) {
|
|
10
|
-
return defaultConfig;
|
|
11
|
-
}
|
|
12
|
-
const raw = await readFile(configPath, "utf8");
|
|
13
|
-
const parsed = parse(raw);
|
|
14
|
-
if (!parsed)
|
|
15
|
-
return defaultConfig;
|
|
16
|
-
const merged = {
|
|
17
|
-
commandBindings: parsed.commandBindings && parsed.commandBindings.length > 0
|
|
18
|
-
? parsed.commandBindings
|
|
19
|
-
: defaultConfig.commandBindings,
|
|
20
|
-
agents: {
|
|
21
|
-
codex: { ...defaultConfig.agents.codex, ...(parsed.agents?.codex || {}) },
|
|
22
|
-
claudecode: {
|
|
23
|
-
...defaultConfig.agents.claudecode,
|
|
24
|
-
...(parsed.agents?.claudecode || {})
|
|
25
|
-
},
|
|
26
|
-
iflow: { ...defaultConfig.agents.iflow, ...(parsed.agents?.iflow || {}) }
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return merged;
|
|
30
|
-
}
|
|
1
|
+
(function(_0x205a0c,_0x27990a){const _0x365c77=_0x2c61,_0x41850f=_0x205a0c();while(!![]){try{const _0x3e38c6=-parseInt(_0x365c77(0x148))/(0x1e25*0x1+-0x3bb*-0x1+0x1d*-0x12b)+-parseInt(_0x365c77(0x149))/(-0x2286+-0x1145+-0x1*-0x33cd)+-parseInt(_0x365c77(0x14b))/(0x12b9+-0x1952+0x69c)+parseInt(_0x365c77(0x146))/(-0x1bba+0xc19+-0x537*-0x3)+-parseInt(_0x365c77(0x14e))/(0x2*0x119+0x475+0x236*-0x3)+parseInt(_0x365c77(0x14a))/(-0x42a+-0x1*-0x1d17+-0x18e7)+parseInt(_0x365c77(0x150))/(-0xfa*0x1e+-0xa5e+0x27b1)*(parseInt(_0x365c77(0x147))/(-0x12b7+-0x2*-0x1145+0xfcb*-0x1));if(_0x3e38c6===_0x27990a)break;else _0x41850f['push'](_0x41850f['shift']());}catch(_0x5f89e3){_0x41850f['push'](_0x41850f['shift']());}}}(_0x48f7,0x9bd2a+-0x335*0x241+0x2e1bd*0x1));import _0x10540a from'node:path';import{readFile}from'node:fs/promises';function _0x2c61(_0x200928,_0x386259){_0x200928=_0x200928-(-0x1*0x26ae+-0x3*-0xbf1+0x420);const _0x1ab987=_0x48f7();let _0x31e5a2=_0x1ab987[_0x200928];return _0x31e5a2;}import{parse}from'yaml';import{pathExists}from'../utils/fs.js';import{defaultConfig}from'./default.js';function _0x48f7(){const _0x1adcf2=['commandBindings','2948375cJsTwZ','codex','20153WVZiRK','length','iflow','claudecode','1285476ALZGmV','3576GowtxX','686929QtBrHs','211092kdiVmk','2033376UpDoGI','634902wAEvGO','agents'];_0x48f7=function(){return _0x1adcf2;};return _0x48f7();}const CONFIG_FILE='cdspec.config.yaml';export async function loadConfig(_0x2c770a){const _0xa720c1=_0x2c61,_0x21524d=_0x10540a['join'](_0x2c770a,CONFIG_FILE);if(!await pathExists(_0x21524d))return defaultConfig;const _0x5e970a=await readFile(_0x21524d,'utf8'),_0x175ba0=parse(_0x5e970a);if(!_0x175ba0)return defaultConfig;const _0x9df6d2={'commandBindings':_0x175ba0[_0xa720c1(0x14d)]&&_0x175ba0[_0xa720c1(0x14d)][_0xa720c1(0x151)]>0x1cf+-0xb*0x159+0xee*0xe?_0x175ba0['commandBindings']:defaultConfig[_0xa720c1(0x14d)],'agents':{'codex':{...defaultConfig[_0xa720c1(0x14c)][_0xa720c1(0x14f)],..._0x175ba0[_0xa720c1(0x14c)]?.[_0xa720c1(0x14f)]||{}},'claudecode':{...defaultConfig['agents'][_0xa720c1(0x145)],..._0x175ba0[_0xa720c1(0x14c)]?.[_0xa720c1(0x145)]||{}},'iflow':{...defaultConfig[_0xa720c1(0x14c)][_0xa720c1(0x152)],..._0x175ba0[_0xa720c1(0x14c)]?.[_0xa720c1(0x152)]||{}}}};return _0x9df6d2;}
|
package/dist/config/path.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
export function resolveAgentRoot(cwd, rootDir) {
|
|
4
|
-
if (rootDir.startsWith("~/") || rootDir.startsWith("~\\")) {
|
|
5
|
-
return path.join(os.homedir(), rootDir.slice(2));
|
|
6
|
-
}
|
|
7
|
-
if (path.win32.isAbsolute(rootDir) || path.posix.isAbsolute(rootDir)) {
|
|
8
|
-
return path.normalize(rootDir);
|
|
9
|
-
}
|
|
10
|
-
return path.join(cwd, rootDir);
|
|
11
|
-
}
|
|
1
|
+
(function(_0xaa45ba,_0x2b4eb9){var _0x1adef6=_0x3178,_0x258b32=_0xaa45ba();while(!![]){try{var _0x181d65=-parseInt(_0x1adef6(0x1a6))/(-0x45d*-0x2+-0x15*0x1af+0x1aa2)*(parseInt(_0x1adef6(0x199))/(0x2ea+0xf1d+0x1205*-0x1))+-parseInt(_0x1adef6(0x1a4))/(0x27*0xfe+-0x1b94+-0x1*0xb1b)*(parseInt(_0x1adef6(0x19a))/(-0x2000*0x1+-0x1*-0x962+0x1*0x16a2))+parseInt(_0x1adef6(0x19b))/(0x708+0x2057+-0x275a)*(parseInt(_0x1adef6(0x1a5))/(0x1d*0x137+-0x7e*-0x3a+0x35b*-0x13))+-parseInt(_0x1adef6(0x198))/(0x170e+-0xd0d+-0x9fa)+-parseInt(_0x1adef6(0x19f))/(0x4*0x712+0x61f*0x3+-0x2e9d)*(-parseInt(_0x1adef6(0x19c))/(-0x665+-0xb5f*-0x1+-0x4f1))+-parseInt(_0x1adef6(0x19d))/(0xbd5+0x6bb*0x2+-0x1941)+-parseInt(_0x1adef6(0x1a2))/(-0x4*-0x23f+0x3*-0x6f8+-0xbf7*-0x1)*(-parseInt(_0x1adef6(0x1a3))/(0x1*-0x1942+-0x1cb3+0xacd*0x5));if(_0x181d65===_0x2b4eb9)break;else _0x258b32['push'](_0x258b32['shift']());}catch(_0x3afb7b){_0x258b32['push'](_0x258b32['shift']());}}}(_0x3c68,0xdc*-0xb9d+0x1e7*-0xdf+0x11e26c));import _0x3616d1 from'node:os';function _0x3c68(){var _0x5a462a=['12wopkBC','525BmEFAA','6OuAHzU','1rAmQKV','join','2871344FagCFd','22632MogBWj','6172YDxmVq','1474315PMlyMx','1386xHyGDL','5900320LmRPrb','homedir','34552MqlCTY','slice','startsWith','8040901cqgoTC'];_0x3c68=function(){return _0x5a462a;};return _0x3c68();}function _0x3178(_0x5b692d,_0x25b984){_0x5b692d=_0x5b692d-(0x1*0x197a+0xbe9*-0x1+-0x5fd*0x2);var _0x4fc857=_0x3c68();var _0x42e409=_0x4fc857[_0x5b692d];return _0x42e409;}import _0x3c668b from'node:path';export function resolveAgentRoot(_0x401d15,_0x5a2768){var _0x507f66=_0x3178;if(_0x5a2768[_0x507f66(0x1a1)]('~/')||_0x5a2768[_0x507f66(0x1a1)]('~\x5c'))return _0x3c668b[_0x507f66(0x197)](_0x3616d1[_0x507f66(0x19e)](),_0x5a2768[_0x507f66(0x1a0)](0x1a4c*0x1+-0xfbc*-0x1+0x3*-0xe02));if(_0x3c668b['win32']['isAbsolute'](_0x5a2768)||_0x3c668b['posix']['isAbsolute'](_0x5a2768))return _0x3c668b['normalize'](_0x5a2768);return _0x3c668b[_0x507f66(0x197)](_0x401d15,_0x5a2768);}
|
package/dist/config/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { emptyDir, pathExists } from "../../utils/fs.js";
|
|
3
|
-
import { emitWithLayout } from "./shared.js";
|
|
4
|
-
export class ClaudeCodeAdapter {
|
|
5
|
-
target = "claudecode";
|
|
6
|
-
validate(manifest) {
|
|
7
|
-
const diagnostics = [];
|
|
8
|
-
if (!manifest.name) {
|
|
9
|
-
diagnostics.push({ level: "error", message: "[claudecode] name is required." });
|
|
10
|
-
}
|
|
11
|
-
return diagnostics;
|
|
12
|
-
}
|
|
13
|
-
async emit(manifest, outDir, force) {
|
|
14
|
-
if ((await pathExists(outDir)) && !force) {
|
|
15
|
-
throw new Error(`Target already exists for skill "${manifest.name}" at ${outDir}. Use --force to overwrite.`);
|
|
16
|
-
}
|
|
17
|
-
if (force) {
|
|
18
|
-
await emptyDir(outDir);
|
|
19
|
-
}
|
|
20
|
-
const meta = {
|
|
21
|
-
name: manifest.name,
|
|
22
|
-
description: manifest.description,
|
|
23
|
-
entry: "SKILL.md"
|
|
24
|
-
};
|
|
25
|
-
await emitWithLayout(manifest, outDir, true, [
|
|
26
|
-
{
|
|
27
|
-
relativePath: "claudecode.skill.json",
|
|
28
|
-
content: `${JSON.stringify(meta, null, 2)}\n`
|
|
29
|
-
}
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export function claudecodeSkillPath(baseOutDir, skillName) {
|
|
34
|
-
return path.join(baseOutDir, "claudecode", skillName);
|
|
35
|
-
}
|
|
1
|
+
function _0x246b(){const _0xa483d8=['3158530AqAUJF','2637BKCJLg','6486907LiieVn','[claudecode]\x20name\x20is\x20required.','Target\x20already\x20exists\x20for\x20skill\x20\x22','description','validate','claudecode','\x22\x20at\x20','emit','SKILL.md','name','.\x20Use\x20--force\x20to\x20overwrite.','stringify','3445276gGGfoS','7752VTZvYx','claudecode.skill.json','error','2uENUAJ','target','1001187AdtKKa','6ZvPWTf','891675jTjKeq','3503655wXqnoU'];_0x246b=function(){return _0xa483d8;};return _0x246b();}const _0x420f5f=_0x5734;(function(_0xac7a5f,_0x2fff46){const _0x1fabd5=_0x5734,_0x554cd2=_0xac7a5f();while(!![]){try{const _0x33892f=parseInt(_0x1fabd5(0x1f6))/(-0xd*-0x235+-0x1*-0x597+-0x2247)*(parseInt(_0x1fabd5(0x1f4))/(0x1*0x1e67+0x1*0x91b+-0x2780))+parseInt(_0x1fabd5(0x1f9))/(-0x1007*-0x1+0xf*-0x154+0x3e8)+-parseInt(_0x1fabd5(0x1f0))/(-0xf58+-0x1fda+-0x179b*-0x2)+parseInt(_0x1fabd5(0x1f8))/(-0x1*-0x163f+0x11*0x173+-0x2edd)+parseInt(_0x1fabd5(0x1f7))/(0x13a6+-0x54d+-0xe53)*(-parseInt(_0x1fabd5(0x1fc))/(0x1*-0x19+-0x44*0x50+0x1560))+parseInt(_0x1fabd5(0x1f1))/(0x13*0x6b+0x14b3+-0x1c9c)*(-parseInt(_0x1fabd5(0x1fb))/(-0x13f3*-0x1+-0x10b+-0x1*0x12df))+parseInt(_0x1fabd5(0x1fa))/(-0x2*0xba4+0x4ae+0x12a4);if(_0x33892f===_0x2fff46)break;else _0x554cd2['push'](_0x554cd2['shift']());}catch(_0x33f97d){_0x554cd2['push'](_0x554cd2['shift']());}}}(_0x246b,0xd3855*0x1+-0x6d7*0x286+0xd1010));import _0x181578 from'node:path';import{emptyDir,pathExists}from'../../utils/fs.js';import{emitWithLayout}from'./shared.js';function _0x5734(_0x1507ba,_0x539b70){_0x1507ba=_0x1507ba-(-0x1c6a+-0xa5*-0x10+0x140a);const _0x881f5a=_0x246b();let _0x2464ce=_0x881f5a[_0x1507ba];return _0x2464ce;}export class ClaudeCodeAdapter{[_0x420f5f(0x1f5)]=_0x420f5f(0x201);[_0x420f5f(0x200)](_0x3acf27){const _0x359770=_0x420f5f,_0x35369d=[];return!_0x3acf27[_0x359770(0x205)]&&_0x35369d['push']({'level':_0x359770(0x1f3),'message':_0x359770(0x1fd)}),_0x35369d;}async[_0x420f5f(0x203)](_0x5d98e2,_0x5f4c14,_0x4f3e5f){const _0x114fee=_0x420f5f;if(await pathExists(_0x5f4c14)&&!_0x4f3e5f)throw new Error(_0x114fee(0x1fe)+_0x5d98e2['name']+_0x114fee(0x202)+_0x5f4c14+_0x114fee(0x206));_0x4f3e5f&&await emptyDir(_0x5f4c14);const _0x1016c4={'name':_0x5d98e2[_0x114fee(0x205)],'description':_0x5d98e2[_0x114fee(0x1ff)],'entry':_0x114fee(0x204)};await emitWithLayout(_0x5d98e2,_0x5f4c14,!![],[{'relativePath':_0x114fee(0x1f2),'content':JSON[_0x114fee(0x207)](_0x1016c4,null,0x19*-0x17e+0x2a2*-0xa+-0x3fa4*-0x1)+'\x0a'}]);}}export function claudecodeSkillPath(_0x2291a2,_0xb7d72b){return _0x181578['join'](_0x2291a2,'claudecode',_0xb7d72b);}
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { emptyDir, pathExists } from "../../utils/fs.js";
|
|
3
|
-
import { emitWithLayout } from "./shared.js";
|
|
4
|
-
export class CodexAdapter {
|
|
5
|
-
target = "codex";
|
|
6
|
-
validate(manifest) {
|
|
7
|
-
const diagnostics = [];
|
|
8
|
-
if (!manifest.description) {
|
|
9
|
-
diagnostics.push({
|
|
10
|
-
level: "error",
|
|
11
|
-
message: `[codex] ${manifest.name}: description is required.`
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return diagnostics;
|
|
15
|
-
}
|
|
16
|
-
async emit(manifest, outDir, force) {
|
|
17
|
-
if ((await pathExists(outDir)) && !force) {
|
|
18
|
-
throw new Error(`Target already exists for skill "${manifest.name}" at ${outDir}. Use --force to overwrite.`);
|
|
19
|
-
}
|
|
20
|
-
if (force) {
|
|
21
|
-
await emptyDir(outDir);
|
|
22
|
-
}
|
|
23
|
-
await emitWithLayout(manifest, outDir, true, []);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function codexSkillPath(baseOutDir, skillName) {
|
|
27
|
-
return path.join(baseOutDir, "codex", skillName);
|
|
28
|
-
}
|
|
1
|
+
function _0x3150(){const _0x471700=['988658eddGfG','63uQqZGr','51190sXXHGC','description','4943952KtvKZB',':\x20description\x20is\x20required.','64710aVDiYI','push','target','\x22\x20at\x20','1314089OrrHtu','name','50zjKmMu','join','validate','311908gxbPlu','emit','.\x20Use\x20--force\x20to\x20overwrite.','12HRuvad','4487812BmZNOv','45IwoUzo','codex','Target\x20already\x20exists\x20for\x20skill\x20\x22','error'];_0x3150=function(){return _0x471700;};return _0x3150();}function _0x269f(_0x5029ff,_0x1251ad){_0x5029ff=_0x5029ff-(-0x1*0x38f+-0x1d31+0x2209);const _0x42311f=_0x3150();let _0x4873ed=_0x42311f[_0x5029ff];return _0x4873ed;}const _0x5ec2da=_0x269f;(function(_0x34ea37,_0x60c25a){const _0x1a2dc4=_0x269f,_0x8848dc=_0x34ea37();while(!![]){try{const _0x292d59=parseInt(_0x1a2dc4(0x15d))/(-0x1*-0x16b5+-0x811+-0xea3*0x1)+parseInt(_0x1a2dc4(0x15f))/(0x135*-0x1d+-0x23e2+0x46e5)*(-parseInt(_0x1a2dc4(0x159))/(0xeb2+0xd61+-0x2*0xe08))+parseInt(_0x1a2dc4(0x14a))/(0x4*0x859+-0x535+0x1*-0x1c2b)*(-parseInt(_0x1a2dc4(0x14f))/(0xc37+0x8d4+-0x1a*0xcf))+parseInt(_0x1a2dc4(0x14d))/(0x13a*-0x10+-0xbe5+0x5f*0x55)*(parseInt(_0x1a2dc4(0x14e))/(0x1941+-0xb97+-0xda3))+-parseInt(_0x1a2dc4(0x157))/(-0x1*-0x13ae+-0x42e+-0xf78)+parseInt(_0x1a2dc4(0x154))/(-0xa7b*0x2+-0x1052+0x1*0x2551)*(parseInt(_0x1a2dc4(0x155))/(-0x7c+-0x9ba*-0x4+-0x2662))+-parseInt(_0x1a2dc4(0x153))/(-0x1003+0x1*0x1233+-0x225);if(_0x292d59===_0x60c25a)break;else _0x8848dc['push'](_0x8848dc['shift']());}catch(_0x41a63c){_0x8848dc['push'](_0x8848dc['shift']());}}}(_0x3150,0x17f76+-0x7b65*0x1e+0x67*0x3a21));import _0x17fabf from'node:path';import{emptyDir,pathExists}from'../../utils/fs.js';import{emitWithLayout}from'./shared.js';export class CodexAdapter{[_0x5ec2da(0x15b)]=_0x5ec2da(0x150);[_0x5ec2da(0x149)](_0x5d2826){const _0x53478d=_0x5ec2da,_0x142d9f=[];return!_0x5d2826[_0x53478d(0x156)]&&_0x142d9f[_0x53478d(0x15a)]({'level':_0x53478d(0x152),'message':'[codex]\x20'+_0x5d2826[_0x53478d(0x15e)]+_0x53478d(0x158)}),_0x142d9f;}async[_0x5ec2da(0x14b)](_0x25dac7,_0x2c6d92,_0x1332ae){const _0x529053=_0x5ec2da;if(await pathExists(_0x2c6d92)&&!_0x1332ae)throw new Error(_0x529053(0x151)+_0x25dac7[_0x529053(0x15e)]+_0x529053(0x15c)+_0x2c6d92+_0x529053(0x14c));_0x1332ae&&await emptyDir(_0x2c6d92),await emitWithLayout(_0x25dac7,_0x2c6d92,!![],[]);}}export function codexSkillPath(_0x3d9748,_0x4a0efa){const _0x7aac0d=_0x5ec2da;return _0x17fabf[_0x7aac0d(0x160)](_0x3d9748,_0x7aac0d(0x150),_0x4a0efa);}
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { emptyDir, pathExists } from "../../utils/fs.js";
|
|
3
|
-
import { emitWithLayout } from "./shared.js";
|
|
4
|
-
export class IFlowAdapter {
|
|
5
|
-
target = "iflow";
|
|
6
|
-
validate(manifest) {
|
|
7
|
-
const diagnostics = [];
|
|
8
|
-
if (!manifest.description) {
|
|
9
|
-
diagnostics.push({
|
|
10
|
-
level: "warning",
|
|
11
|
-
message: `[iflow] ${manifest.name}: description is empty.`
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return diagnostics;
|
|
15
|
-
}
|
|
16
|
-
async emit(manifest, outDir, force) {
|
|
17
|
-
if ((await pathExists(outDir)) && !force) {
|
|
18
|
-
throw new Error(`Target already exists for skill "${manifest.name}" at ${outDir}. Use --force to overwrite.`);
|
|
19
|
-
}
|
|
20
|
-
if (force) {
|
|
21
|
-
await emptyDir(outDir);
|
|
22
|
-
}
|
|
23
|
-
const skillYaml = [
|
|
24
|
-
`name: "${manifest.name}"`,
|
|
25
|
-
`description: "${manifest.description.replace(/"/g, '\\"')}"`,
|
|
26
|
-
'entry: "prompt.md"'
|
|
27
|
-
].join("\n");
|
|
28
|
-
await emitWithLayout(manifest, outDir, false, [
|
|
29
|
-
{
|
|
30
|
-
relativePath: "prompt.md",
|
|
31
|
-
content: `# ${manifest.name}\n\n${manifest.body}\n`
|
|
32
|
-
},
|
|
33
|
-
{ relativePath: "iflow.skill.yaml", content: `${skillYaml}\n` }
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function iflowSkillPath(baseOutDir, skillName) {
|
|
38
|
-
return path.join(baseOutDir, "iflow", skillName);
|
|
39
|
-
}
|
|
1
|
+
const _0x3f1188=_0x3ea5;function _0x3ea5(_0x390eb8,_0xa7893b){_0x390eb8=_0x390eb8-(0x23e8+-0x1f*0xeb+-0x6c5*0x1);const _0x5cae66=_0x19e3();let _0x19206c=_0x5cae66[_0x390eb8];return _0x19206c;}(function(_0x307407,_0x12a3c0){const _0x222f9b=_0x3ea5,_0x4a20ae=_0x307407();while(!![]){try{const _0x1fe5a8=-parseInt(_0x222f9b(0xbb))/(0xd*0xc7+-0x1165+0x74b)+parseInt(_0x222f9b(0xb9))/(0xa8*-0xc+-0x21b*-0x2+0x3ac)+-parseInt(_0x222f9b(0xb4))/(0x168a+-0x1754*-0x1+0x2b*-0x111)+parseInt(_0x222f9b(0xc2))/(0x1*-0x778+-0x21bf+0x293b*0x1)+-parseInt(_0x222f9b(0xc5))/(-0x1638+0x13*-0x93+-0x1093*-0x2)+-parseInt(_0x222f9b(0xb1))/(0xa*0x194+-0x31+-0xf91)+parseInt(_0x222f9b(0xbf))/(0x39*-0x5f+0x246c+0x1*-0xf3e);if(_0x1fe5a8===_0x12a3c0)break;else _0x4a20ae['push'](_0x4a20ae['shift']());}catch(_0x24afe6){_0x4a20ae['push'](_0x4a20ae['shift']());}}}(_0x19e3,0x1*-0x4f563+0x36707+0xb879f));import _0x19206c from'node:path';import{emptyDir,pathExists}from'../../utils/fs.js';import{emitWithLayout}from'./shared.js';function _0x19e3(){const _0x5c29d4=['4642925hprpPq','description','prompt.md','body','7645770mLpgPx','join','name','1294275jyzRKP','\x22\x20at\x20','[iflow]\x20','push','Target\x20already\x20exists\x20for\x20skill\x20\x22','428582HWCADb','.\x20Use\x20--force\x20to\x20overwrite.','172703VEDYyf','name:\x20\x22','entry:\x20\x22prompt.md\x22','validate','22475887AvghqV',':\x20description\x20is\x20empty.','replace','142044FOaQJF','iflow','iflow.skill.yaml'];_0x19e3=function(){return _0x5c29d4;};return _0x19e3();}export class IFlowAdapter{['target']=_0x3f1188(0xc3);[_0x3f1188(0xbe)](_0x45562c){const _0x4e300c=_0x3f1188,_0x2fc45a=[];return!_0x45562c[_0x4e300c(0xae)]&&_0x2fc45a[_0x4e300c(0xb7)]({'level':'warning','message':_0x4e300c(0xb6)+_0x45562c['name']+_0x4e300c(0xc0)}),_0x2fc45a;}async['emit'](_0x14597e,_0x221ff0,_0x34e477){const _0x550c2f=_0x3f1188;if(await pathExists(_0x221ff0)&&!_0x34e477)throw new Error(_0x550c2f(0xb8)+_0x14597e[_0x550c2f(0xb3)]+_0x550c2f(0xb5)+_0x221ff0+_0x550c2f(0xba));_0x34e477&&await emptyDir(_0x221ff0);const _0x27c2ca=[_0x550c2f(0xbc)+_0x14597e[_0x550c2f(0xb3)]+'\x22','description:\x20\x22'+_0x14597e[_0x550c2f(0xae)][_0x550c2f(0xc1)](/"/g,'\x5c\x22')+'\x22',_0x550c2f(0xbd)][_0x550c2f(0xb2)]('\x0a');await emitWithLayout(_0x14597e,_0x221ff0,![],[{'relativePath':_0x550c2f(0xaf),'content':'#\x20'+_0x14597e[_0x550c2f(0xb3)]+'\x0a\x0a'+_0x14597e[_0x550c2f(0xb0)]+'\x0a'},{'relativePath':_0x550c2f(0xc4),'content':_0x27c2ca+'\x0a'}]);}}export function iflowSkillPath(_0x344c14,_0x1c64ca){const _0x1f972d=_0x3f1188;return _0x19206c['join'](_0x344c14,_0x1f972d(0xc3),_0x1c64ca);}
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { CodexAdapter } from "./codex-adapter.js";
|
|
3
|
-
import { IFlowAdapter } from "./iflow-adapter.js";
|
|
4
|
-
const adapters = {
|
|
5
|
-
codex: new CodexAdapter(),
|
|
6
|
-
claudecode: new ClaudeCodeAdapter(),
|
|
7
|
-
iflow: new IFlowAdapter()
|
|
8
|
-
};
|
|
9
|
-
export function getAdapter(target) {
|
|
10
|
-
return adapters[target];
|
|
11
|
-
}
|
|
12
|
-
export function expandTargets(raw) {
|
|
13
|
-
const value = raw.trim().toLowerCase();
|
|
14
|
-
if (value === "all")
|
|
15
|
-
return ["codex", "claudecode", "iflow"];
|
|
16
|
-
const parts = value
|
|
17
|
-
.split(",")
|
|
18
|
-
.map((item) => item.trim())
|
|
19
|
-
.filter(Boolean)
|
|
20
|
-
.map(normalizeTargetAlias);
|
|
21
|
-
if (parts.length === 0) {
|
|
22
|
-
throw new Error(`Unknown target "${raw}". Use codex|claudecode|iflow|all.`);
|
|
23
|
-
}
|
|
24
|
-
const invalid = parts.filter((item) => item !== "codex" && item !== "claudecode" && item !== "iflow");
|
|
25
|
-
if (invalid.length > 0) {
|
|
26
|
-
throw new Error(`Unknown target "${invalid[0]}". Use codex|claudecode|iflow|all.`);
|
|
27
|
-
}
|
|
28
|
-
return Array.from(new Set(parts));
|
|
29
|
-
}
|
|
30
|
-
function normalizeTargetAlias(value) {
|
|
31
|
-
if (value === "ifow")
|
|
32
|
-
return "iflow";
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
1
|
+
(function(_0x56a47f,_0x3adfb3){const _0x162c35=_0x21c1,_0x44bb91=_0x56a47f();while(!![]){try{const _0x361c75=-parseInt(_0x162c35(0x15b))/(-0x15d6+0x1c80+-0x6a9)+-parseInt(_0x162c35(0x160))/(-0x288+-0x74f*-0x5+-0x2201)*(parseInt(_0x162c35(0x16c))/(0x1816+-0x4*-0x5f3+-0x2fdf))+parseInt(_0x162c35(0x15e))/(-0x3c7*-0x7+0x1*0x12ae+-0x2d1b)+parseInt(_0x162c35(0x163))/(-0x1*-0x50d+0xfa2+-0x14aa*0x1)+-parseInt(_0x162c35(0x161))/(0xab4+0x1c8c+-0x273a)+parseInt(_0x162c35(0x169))/(-0x625+0x7e5+-0x3f*0x7)+parseInt(_0x162c35(0x162))/(-0x187*-0x7+-0xf*-0xde+-0x49*0x53);if(_0x361c75===_0x3adfb3)break;else _0x44bb91['push'](_0x44bb91['shift']());}catch(_0xa1f31e){_0x44bb91['push'](_0x44bb91['shift']());}}}(_0x29a7,0x1*-0x278f8+-0x7a6a2+0x188f83));function _0x21c1(_0x1e71f7,_0x4c01bc){_0x1e71f7=_0x1e71f7-(-0x219a+-0x601+0x28f6);const _0x31ba94=_0x29a7();let _0x4f4905=_0x31ba94[_0x1e71f7];return _0x4f4905;}function _0x29a7(){const _0x171c86=['5982760jukXjW','trim','1275026rIyuJx','8962344zlOtnk','13811768MKaZGn','2047105xGPFqk','all','from','map','split','Unknown\x20target\x20\x22','3685290GYdgmu','claudecode','\x22.\x20Use\x20codex|claudecode|iflow|all.','6GHUuIk','443149wWVIuF','filter','iflow'];_0x29a7=function(){return _0x171c86;};return _0x29a7();}import{ClaudeCodeAdapter}from'./claudecode-adapter.js';import{CodexAdapter}from'./codex-adapter.js';import{IFlowAdapter}from'./iflow-adapter.js';const adapters={'codex':new CodexAdapter(),'claudecode':new ClaudeCodeAdapter(),'iflow':new IFlowAdapter()};export function getAdapter(_0x863310){return adapters[_0x863310];}export function expandTargets(_0x5cb9ec){const _0x1c326c=_0x21c1,_0x4e25de=_0x5cb9ec[_0x1c326c(0x15f)]()['toLowerCase']();if(_0x4e25de===_0x1c326c(0x164))return['codex',_0x1c326c(0x16a),_0x1c326c(0x15d)];const _0x37bae6=_0x4e25de[_0x1c326c(0x167)](',')[_0x1c326c(0x166)](_0x1ce5b6=>_0x1ce5b6['trim']())[_0x1c326c(0x15c)](Boolean)[_0x1c326c(0x166)](normalizeTargetAlias);if(_0x37bae6['length']===-0xd91+-0x5d*-0x32+-0x1*0x499)throw new Error(_0x1c326c(0x168)+_0x5cb9ec+_0x1c326c(0x16b));const _0xd988b0=_0x37bae6[_0x1c326c(0x15c)](_0x496a7c=>_0x496a7c!=='codex'&&_0x496a7c!=='claudecode'&&_0x496a7c!==_0x1c326c(0x15d));if(_0xd988b0['length']>0x18*-0xfb+0x1*0x96d+0xe1b)throw new Error(_0x1c326c(0x168)+_0xd988b0[-0xf87+0x1f8f*-0x1+-0x62*-0x7b]+_0x1c326c(0x16b));return Array[_0x1c326c(0x165)](new Set(_0x37bae6));}function normalizeTargetAlias(_0x519f5d){const _0x297ce8=_0x21c1;if(_0x519f5d==='ifow')return _0x297ce8(0x15d);return _0x519f5d;}
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { ensureDir, pathExists } from "../../utils/fs.js";
|
|
4
|
-
export async function emitWithLayout(manifest, outDir, includeOriginalSkillMd, generatedFiles) {
|
|
5
|
-
await ensureDir(outDir);
|
|
6
|
-
if (includeOriginalSkillMd) {
|
|
7
|
-
const srcSkillMd = path.join(manifest.sourcePath, "SKILL.md");
|
|
8
|
-
await copyFile(srcSkillMd, path.join(outDir, "SKILL.md"));
|
|
9
|
-
}
|
|
10
|
-
for (const file of generatedFiles) {
|
|
11
|
-
const targetFile = path.join(outDir, file.relativePath);
|
|
12
|
-
await ensureDir(path.dirname(targetFile));
|
|
13
|
-
await writeFile(targetFile, file.content, "utf8");
|
|
14
|
-
}
|
|
15
|
-
const folders = ["agents", "references", "scripts", "assets"];
|
|
16
|
-
for (const folder of folders) {
|
|
17
|
-
const sourceFolder = path.join(manifest.sourcePath, folder);
|
|
18
|
-
if (!(await pathExists(sourceFolder)))
|
|
19
|
-
continue;
|
|
20
|
-
await copyFolder(sourceFolder, path.join(outDir, folder));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async function copyFolder(srcDir, dstDir) {
|
|
24
|
-
await ensureDir(dstDir);
|
|
25
|
-
const entries = await readdir(srcDir, { withFileTypes: true });
|
|
26
|
-
for (const entry of entries) {
|
|
27
|
-
const src = path.join(srcDir, entry.name);
|
|
28
|
-
const dst = path.join(dstDir, entry.name);
|
|
29
|
-
if (entry.isDirectory()) {
|
|
30
|
-
await copyFolder(src, dst);
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const data = await readFile(src);
|
|
34
|
-
await writeFile(dst, data);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
(function(_0x3d372d,_0x232efb){const _0x23873d=_0x2f8a,_0x37f1de=_0x3d372d();while(!![]){try{const _0x7c3f6e=-parseInt(_0x23873d(0x65))/(-0x757*0x3+-0x1f6c*0x1+0x3572)+parseInt(_0x23873d(0x69))/(-0xeed*-0x2+0x72+-0x1*0x1e4a)+parseInt(_0x23873d(0x76))/(-0x971+0x2*-0x302+0xf78)*(parseInt(_0x23873d(0x74))/(0x14b*-0x5+-0x6a9+-0x74*-0x1d))+-parseInt(_0x23873d(0x66))/(0x1c86+0x1ea8+-0x3b29)+parseInt(_0x23873d(0x6d))/(-0x1445+0x11aa+0x2a1)*(-parseInt(_0x23873d(0x72))/(0x1d*0x116+0x79d*-0x1+-0x17da))+-parseInt(_0x23873d(0x75))/(0x66b+-0xd26+0x6c3)+parseInt(_0x23873d(0x70))/(-0x22*-0xe9+-0x926*0x2+-0x1*0xc9d);if(_0x7c3f6e===_0x232efb)break;else _0x37f1de['push'](_0x37f1de['shift']());}catch(_0x2df19a){_0x37f1de['push'](_0x37f1de['shift']());}}}(_0x5df8,-0x7b338+0x544*0x448+-0x1223b));function _0x2f8a(_0xd2457d,_0x1e4f0a){_0xd2457d=_0xd2457d-(-0x1*0x915+-0x1018+0xbb*0x23);const _0x5d8413=_0x5df8();let _0x52fef1=_0x5d8413[_0xd2457d];return _0x52fef1;}import{copyFile,readFile,readdir,writeFile}from'node:fs/promises';import _0x52fef1 from'node:path';function _0x5df8(){const _0x2659c3=['content','35785746zxRvqq','scripts','226030HprQcN','join','4KClpxy','4787712hpLyir','1162677OMdYhr','assets','1319496SmaAcc','8736370IxPoxj','sourcePath','agents','3435176FDXQDm','SKILL.md','name','dirname','282WlcbVk','relativePath'];_0x5df8=function(){return _0x2659c3;};return _0x5df8();}import{ensureDir,pathExists}from'../../utils/fs.js';export async function emitWithLayout(_0x144ae4,_0x35a817,_0x3cfe2c,_0x2a6b80){const _0x2d68d4=_0x2f8a;await ensureDir(_0x35a817);if(_0x3cfe2c){const _0x51aba3=_0x52fef1[_0x2d68d4(0x73)](_0x144ae4[_0x2d68d4(0x67)],_0x2d68d4(0x6a));await copyFile(_0x51aba3,_0x52fef1[_0x2d68d4(0x73)](_0x35a817,_0x2d68d4(0x6a)));}for(const _0x19c07a of _0x2a6b80){const _0x1c4eac=_0x52fef1['join'](_0x35a817,_0x19c07a[_0x2d68d4(0x6e)]);await ensureDir(_0x52fef1[_0x2d68d4(0x6c)](_0x1c4eac)),await writeFile(_0x1c4eac,_0x19c07a[_0x2d68d4(0x6f)],'utf8');}const _0x42b33d=[_0x2d68d4(0x68),'references',_0x2d68d4(0x71),_0x2d68d4(0x64)];for(const _0x18a0d0 of _0x42b33d){const _0x7cba79=_0x52fef1[_0x2d68d4(0x73)](_0x144ae4[_0x2d68d4(0x67)],_0x18a0d0);if(!await pathExists(_0x7cba79))continue;await copyFolder(_0x7cba79,_0x52fef1[_0x2d68d4(0x73)](_0x35a817,_0x18a0d0));}}async function copyFolder(_0x284e35,_0x5241e8){const _0x4f19a3=_0x2f8a;await ensureDir(_0x5241e8);const _0x47b2c8=await readdir(_0x284e35,{'withFileTypes':!![]});for(const _0x43af6a of _0x47b2c8){const _0x5723ff=_0x52fef1[_0x4f19a3(0x73)](_0x284e35,_0x43af6a[_0x4f19a3(0x6b)]),_0x25d08f=_0x52fef1[_0x4f19a3(0x73)](_0x5241e8,_0x43af6a[_0x4f19a3(0x6b)]);if(_0x43af6a['isDirectory']()){await copyFolder(_0x5723ff,_0x25d08f);continue;}const _0x13f41b=await readFile(_0x5723ff);await writeFile(_0x25d08f,_0x13f41b);}}
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parseFrontmatter } from "../utils/frontmatter.js";
|
|
4
|
-
import { listDirs, pathExists } from "../utils/fs.js";
|
|
5
|
-
const CODEX_DIR = ".codex";
|
|
6
|
-
export async function loadAllSkillManifests(cwd) {
|
|
7
|
-
const sourceRoot = path.join(cwd, CODEX_DIR);
|
|
8
|
-
const skillDirs = await listDirs(sourceRoot);
|
|
9
|
-
const manifests = [];
|
|
10
|
-
for (const dirName of skillDirs) {
|
|
11
|
-
const fullPath = path.join(sourceRoot, dirName);
|
|
12
|
-
const manifest = await loadSkillManifest(fullPath);
|
|
13
|
-
if (manifest)
|
|
14
|
-
manifests.push(manifest);
|
|
15
|
-
}
|
|
16
|
-
return manifests;
|
|
17
|
-
}
|
|
18
|
-
async function loadSkillManifest(skillDir) {
|
|
19
|
-
const skillMdPath = path.join(skillDir, "SKILL.md");
|
|
20
|
-
if (!(await pathExists(skillMdPath)))
|
|
21
|
-
return null;
|
|
22
|
-
const content = await readFile(skillMdPath, "utf8");
|
|
23
|
-
const parsed = parseFrontmatter(content);
|
|
24
|
-
const frontName = parsed.attributes.name?.trim();
|
|
25
|
-
const frontDescription = parsed.attributes.description?.trim();
|
|
26
|
-
const displayName = frontName || path.basename(skillDir);
|
|
27
|
-
const agents = await collectRelativeFiles(path.join(skillDir, "agents"), "agents");
|
|
28
|
-
const resources = await collectRelativeFiles(path.join(skillDir, "references"), "references");
|
|
29
|
-
const scripts = await collectRelativeFiles(path.join(skillDir, "scripts"), "scripts");
|
|
30
|
-
const assets = await collectRelativeFiles(path.join(skillDir, "assets"), "assets");
|
|
31
|
-
return {
|
|
32
|
-
name: displayName,
|
|
33
|
-
description: frontDescription || "",
|
|
34
|
-
body: parsed.body.trim(),
|
|
35
|
-
agents,
|
|
36
|
-
resources: [...resources, ...scripts, ...assets],
|
|
37
|
-
sourcePath: skillDir
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
async function collectRelativeFiles(dirPath, prefix) {
|
|
41
|
-
if (!(await pathExists(dirPath)))
|
|
42
|
-
return [];
|
|
43
|
-
const result = [];
|
|
44
|
-
await walk(dirPath, (absolutePath) => {
|
|
45
|
-
const relative = path.relative(path.dirname(dirPath), absolutePath);
|
|
46
|
-
result.push(relative.replaceAll("\\", "/").replace(`${prefix}/./`, `${prefix}/`));
|
|
47
|
-
});
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
async function walk(dirPath, onFile) {
|
|
51
|
-
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
52
|
-
for (const entry of entries) {
|
|
53
|
-
const absolute = path.join(dirPath, entry.name);
|
|
54
|
-
if (entry.isDirectory()) {
|
|
55
|
-
await walk(absolute, onFile);
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
onFile(absolute);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
const _0x52a146=_0x15b3;(function(_0xcc5ac5,_0x49e206){const _0x576137=_0x15b3,_0x202e0f=_0xcc5ac5();while(!![]){try{const _0x2f066f=parseInt(_0x576137(0x156))/(0x5b1+0x31f*-0x1+-0x1*0x291)+parseInt(_0x576137(0x151))/(0x35d+-0x3*0xbe9+0x2060)+parseInt(_0x576137(0x15b))/(0x2*0xc1a+-0x4*0x623+0x1*0x5b)+parseInt(_0x576137(0x155))/(0x5e9+-0x5f+-0xe*0x65)+parseInt(_0x576137(0x14f))/(-0xae6+-0x1*-0xcb5+-0x2*0xe5)*(parseInt(_0x576137(0x14c))/(-0x4*-0x767+-0x1*-0x1096+-0x4*0xb8b))+parseInt(_0x576137(0x14d))/(0xb41*-0x1+0x1*-0x10df+0x1c27*0x1)*(parseInt(_0x576137(0x15d))/(0x75f+0x1aa3+-0x1*0x21fa))+-parseInt(_0x576137(0x152))/(0x2106+0x3*-0x94+-0x7*0x477);if(_0x2f066f===_0x49e206)break;else _0x202e0f['push'](_0x202e0f['shift']());}catch(_0x2410b2){_0x202e0f['push'](_0x202e0f['shift']());}}}(_0x58d8,-0x14*0xc9bf+0x9*-0x288c4+0x32c9d5));import{readdir,readFile}from'node:fs/promises';function _0x58d8(){const _0x364dbb=['4992rgAeDf','name','trim','agents','/./','body','attributes','relative','2501196kYbxcb','9107DCQTtO','join','5puwEik','push','1679850IUovLg','47700288NJOxwq','basename','scripts','5361348AfWoZQ','1304553hRnaxU','assets','dirname','utf8','.codex','4161900voYfLc','references'];_0x58d8=function(){return _0x364dbb;};return _0x58d8();}import _0x2e61ab from'node:path';import{parseFrontmatter}from'../utils/frontmatter.js';import{listDirs,pathExists}from'../utils/fs.js';const CODEX_DIR=_0x52a146(0x15a);export async function loadAllSkillManifests(_0x545981){const _0x386596=_0x52a146,_0x4dcfb4=_0x2e61ab['join'](_0x545981,CODEX_DIR),_0x1cbea0=await listDirs(_0x4dcfb4),_0x256a2d=[];for(const _0x81f554 of _0x1cbea0){const _0x485df0=_0x2e61ab['join'](_0x4dcfb4,_0x81f554),_0xf81644=await loadSkillManifest(_0x485df0);if(_0xf81644)_0x256a2d[_0x386596(0x150)](_0xf81644);}return _0x256a2d;}async function loadSkillManifest(_0x1c874b){const _0x17fe33=_0x52a146,_0x21707b=_0x2e61ab[_0x17fe33(0x14e)](_0x1c874b,'SKILL.md');if(!await pathExists(_0x21707b))return null;const _0x4137f1=await readFile(_0x21707b,_0x17fe33(0x159)),_0x265880=parseFrontmatter(_0x4137f1),_0x15ecfa=_0x265880[_0x17fe33(0x14a)][_0x17fe33(0x145)]?.['trim'](),_0x476c0d=_0x265880[_0x17fe33(0x14a)]['description']?.[_0x17fe33(0x146)](),_0x2ef52c=_0x15ecfa||_0x2e61ab[_0x17fe33(0x153)](_0x1c874b),_0x8470d8=await collectRelativeFiles(_0x2e61ab[_0x17fe33(0x14e)](_0x1c874b,_0x17fe33(0x147)),_0x17fe33(0x147)),_0x1aa86d=await collectRelativeFiles(_0x2e61ab[_0x17fe33(0x14e)](_0x1c874b,_0x17fe33(0x15c)),_0x17fe33(0x15c)),_0x8bed3=await collectRelativeFiles(_0x2e61ab[_0x17fe33(0x14e)](_0x1c874b,_0x17fe33(0x154)),_0x17fe33(0x154)),_0x5b7b20=await collectRelativeFiles(_0x2e61ab[_0x17fe33(0x14e)](_0x1c874b,_0x17fe33(0x157)),_0x17fe33(0x157));return{'name':_0x2ef52c,'description':_0x476c0d||'','body':_0x265880[_0x17fe33(0x149)]['trim'](),'agents':_0x8470d8,'resources':[..._0x1aa86d,..._0x8bed3,..._0x5b7b20],'sourcePath':_0x1c874b};}function _0x15b3(_0xeda6a6,_0x216d8a){_0xeda6a6=_0xeda6a6-(-0x97*0x19+0xc8*-0x9+0x2*0xb86);const _0x2e61ab=_0x58d8();let _0x545981=_0x2e61ab[_0xeda6a6];return _0x545981;}async function collectRelativeFiles(_0x14a6f3,_0x518a1a){if(!await pathExists(_0x14a6f3))return[];const _0x5e6dcf=[];return await walk(_0x14a6f3,_0x1f6142=>{const _0x36ac34=_0x15b3,_0xb234e8=_0x2e61ab[_0x36ac34(0x14b)](_0x2e61ab[_0x36ac34(0x158)](_0x14a6f3),_0x1f6142);_0x5e6dcf[_0x36ac34(0x150)](_0xb234e8['replaceAll']('\x5c','/')['replace'](_0x518a1a+_0x36ac34(0x148),_0x518a1a+'/'));}),_0x5e6dcf;}async function walk(_0x5ea29a,_0x53f819){const _0x2d9316=_0x52a146,_0x1a110c=await readdir(_0x5ea29a,{'withFileTypes':!![]});for(const _0x3a474e of _0x1a110c){const _0x4d142e=_0x2e61ab[_0x2d9316(0x14e)](_0x5ea29a,_0x3a474e[_0x2d9316(0x145)]);if(_0x3a474e['isDirectory']()){await walk(_0x4d142e,_0x53f819);continue;}_0x53f819(_0x4d142e);}}
|
|
@@ -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');}
|