@a1st/aix-core 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +13 -14
- package/dist/backup.js.map +1 -1
- package/dist/cache/cleanup.d.ts.map +1 -1
- package/dist/cache/cleanup.js +7 -8
- package/dist/cache/cleanup.js.map +1 -1
- package/dist/cache/clear.js +4 -4
- package/dist/cache/clear.js.map +1 -1
- package/dist/cache/status.d.ts.map +1 -1
- package/dist/cache/status.js +4 -5
- package/dist/cache/status.js.map +1 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +18 -17
- package/dist/discovery.js.map +1 -1
- package/dist/editors/adapters/base.d.ts +6 -3
- package/dist/editors/adapters/base.d.ts.map +1 -1
- package/dist/editors/adapters/base.js +121 -40
- package/dist/editors/adapters/base.js.map +1 -1
- package/dist/editors/adapters/claude-code.d.ts +3 -3
- package/dist/editors/adapters/claude-code.d.ts.map +1 -1
- package/dist/editors/adapters/claude-code.js +4 -3
- package/dist/editors/adapters/claude-code.js.map +1 -1
- package/dist/editors/adapters/codex.d.ts +20 -10
- package/dist/editors/adapters/codex.d.ts.map +1 -1
- package/dist/editors/adapters/codex.js +75 -30
- package/dist/editors/adapters/codex.js.map +1 -1
- package/dist/editors/adapters/copilot.d.ts +5 -3
- package/dist/editors/adapters/copilot.d.ts.map +1 -1
- package/dist/editors/adapters/copilot.js +36 -8
- package/dist/editors/adapters/copilot.js.map +1 -1
- package/dist/editors/adapters/cursor.d.ts +2 -2
- package/dist/editors/adapters/cursor.d.ts.map +1 -1
- package/dist/editors/adapters/cursor.js +3 -2
- package/dist/editors/adapters/cursor.js.map +1 -1
- package/dist/editors/adapters/gemini.d.ts +34 -0
- package/dist/editors/adapters/gemini.d.ts.map +1 -0
- package/dist/editors/adapters/gemini.js +99 -0
- package/dist/editors/adapters/gemini.js.map +1 -0
- package/dist/editors/adapters/index.d.ts +2 -0
- package/dist/editors/adapters/index.d.ts.map +1 -1
- package/dist/editors/adapters/index.js +2 -0
- package/dist/editors/adapters/index.js.map +1 -1
- package/dist/editors/adapters/opencode.d.ts +25 -0
- package/dist/editors/adapters/opencode.d.ts.map +1 -0
- package/dist/editors/adapters/opencode.js +74 -0
- package/dist/editors/adapters/opencode.js.map +1 -0
- package/dist/editors/adapters/windsurf.d.ts +1 -1
- package/dist/editors/adapters/windsurf.d.ts.map +1 -1
- package/dist/editors/adapters/windsurf.js +2 -1
- package/dist/editors/adapters/windsurf.js.map +1 -1
- package/dist/editors/adapters/zed.d.ts.map +1 -1
- package/dist/editors/adapters/zed.js +8 -3
- package/dist/editors/adapters/zed.js.map +1 -1
- package/dist/editors/import.d.ts +61 -1
- package/dist/editors/import.d.ts.map +1 -1
- package/dist/editors/import.js +1014 -86
- package/dist/editors/import.js.map +1 -1
- package/dist/editors/index.d.ts +4 -4
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/editors/index.js.map +1 -1
- package/dist/editors/install.d.ts.map +1 -1
- package/dist/editors/install.js +56 -8
- package/dist/editors/install.js.map +1 -1
- package/dist/editors/section-managed-markdown.d.ts +33 -0
- package/dist/editors/section-managed-markdown.d.ts.map +1 -0
- package/dist/editors/section-managed-markdown.js +97 -0
- package/dist/editors/section-managed-markdown.js.map +1 -0
- package/dist/editors/strategies/claude-code/hooks.d.ts +1 -0
- package/dist/editors/strategies/claude-code/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/hooks.js +17 -0
- package/dist/editors/strategies/claude-code/hooks.js.map +1 -1
- package/dist/editors/strategies/claude-code/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/mcp.js +2 -2
- package/dist/editors/strategies/claude-code/mcp.js.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.d.ts +1 -1
- package/dist/editors/strategies/claude-code/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.js +37 -6
- package/dist/editors/strategies/claude-code/prompts.js.map +1 -1
- package/dist/editors/strategies/claude-code/rules.js +3 -3
- package/dist/editors/strategies/claude-code/rules.js.map +1 -1
- package/dist/editors/strategies/codex/prompts.d.ts +6 -5
- package/dist/editors/strategies/codex/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/codex/prompts.js +49 -18
- package/dist/editors/strategies/codex/prompts.js.map +1 -1
- package/dist/editors/strategies/copilot/hooks.d.ts +2 -1
- package/dist/editors/strategies/copilot/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/hooks.js +27 -18
- package/dist/editors/strategies/copilot/hooks.js.map +1 -1
- package/dist/editors/strategies/copilot/mcp.d.ts +3 -2
- package/dist/editors/strategies/copilot/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/mcp.js +76 -41
- package/dist/editors/strategies/copilot/mcp.js.map +1 -1
- package/dist/editors/strategies/copilot/prompts.d.ts +2 -1
- package/dist/editors/strategies/copilot/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/prompts.js +7 -5
- package/dist/editors/strategies/copilot/prompts.js.map +1 -1
- package/dist/editors/strategies/cursor/hooks.d.ts +1 -0
- package/dist/editors/strategies/cursor/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/cursor/hooks.js +3 -0
- package/dist/editors/strategies/cursor/hooks.js.map +1 -1
- package/dist/editors/strategies/cursor/rules.js +3 -3
- package/dist/editors/strategies/cursor/rules.js.map +1 -1
- package/dist/editors/strategies/gemini/index.d.ts +4 -0
- package/dist/editors/strategies/gemini/index.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/index.js +4 -0
- package/dist/editors/strategies/gemini/index.js.map +1 -0
- package/dist/editors/strategies/gemini/mcp.d.ts +19 -0
- package/dist/editors/strategies/gemini/mcp.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/mcp.js +73 -0
- package/dist/editors/strategies/gemini/mcp.js.map +1 -0
- package/dist/editors/strategies/gemini/prompts.d.ts +34 -0
- package/dist/editors/strategies/gemini/prompts.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/prompts.js +118 -0
- package/dist/editors/strategies/gemini/prompts.js.map +1 -0
- package/dist/editors/strategies/gemini/rules.d.ts +18 -0
- package/dist/editors/strategies/gemini/rules.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/rules.js +36 -0
- package/dist/editors/strategies/gemini/rules.js.map +1 -0
- package/dist/editors/strategies/index.d.ts +1 -0
- package/dist/editors/strategies/index.d.ts.map +1 -1
- package/dist/editors/strategies/index.js +1 -0
- package/dist/editors/strategies/index.js.map +1 -1
- package/dist/editors/strategies/opencode/index.d.ts +4 -0
- package/dist/editors/strategies/opencode/index.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/index.js +4 -0
- package/dist/editors/strategies/opencode/index.js.map +1 -0
- package/dist/editors/strategies/opencode/mcp.d.ts +17 -0
- package/dist/editors/strategies/opencode/mcp.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/mcp.js +137 -0
- package/dist/editors/strategies/opencode/mcp.js.map +1 -0
- package/dist/editors/strategies/opencode/prompts.d.ts +20 -0
- package/dist/editors/strategies/opencode/prompts.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/prompts.js +94 -0
- package/dist/editors/strategies/opencode/prompts.js.map +1 -0
- package/dist/editors/strategies/opencode/rules.d.ts +17 -0
- package/dist/editors/strategies/opencode/rules.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/rules.js +31 -0
- package/dist/editors/strategies/opencode/rules.js.map +1 -0
- package/dist/editors/strategies/shared/global-mcp.d.ts.map +1 -1
- package/dist/editors/strategies/shared/global-mcp.js +4 -6
- package/dist/editors/strategies/shared/global-mcp.js.map +1 -1
- package/dist/editors/strategies/shared/native-skills.d.ts +8 -4
- package/dist/editors/strategies/shared/native-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/native-skills.js +23 -23
- package/dist/editors/strategies/shared/native-skills.js.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.d.ts +2 -1
- package/dist/editors/strategies/shared/no-hooks.d.ts.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.js +4 -1
- package/dist/editors/strategies/shared/no-hooks.js.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.d.ts +5 -2
- package/dist/editors/strategies/shared/pointer-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.js +15 -10
- package/dist/editors/strategies/shared/pointer-skills.js.map +1 -1
- package/dist/editors/strategies/types.d.ts +9 -2
- package/dist/editors/strategies/types.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.d.ts +1 -0
- package/dist/editors/strategies/windsurf/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.js +5 -0
- package/dist/editors/strategies/windsurf/hooks.js.map +1 -1
- package/dist/editors/strategies/windsurf/prompts.js +2 -2
- package/dist/editors/strategies/windsurf/prompts.js.map +1 -1
- package/dist/editors/strategies/windsurf/rules.js +3 -3
- package/dist/editors/strategies/windsurf/rules.js.map +1 -1
- package/dist/editors/strategies/windsurf/skills.d.ts +1 -1
- package/dist/editors/strategies/windsurf/skills.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/skills.js +4 -2
- package/dist/editors/strategies/windsurf/skills.js.map +1 -1
- package/dist/editors/types.d.ts +39 -1
- package/dist/editors/types.d.ts.map +1 -1
- package/dist/entity-hash.d.ts +26 -0
- package/dist/entity-hash.d.ts.map +1 -0
- package/dist/entity-hash.js +106 -0
- package/dist/entity-hash.js.map +1 -0
- package/dist/env/ci.d.ts +0 -4
- package/dist/env/ci.d.ts.map +1 -1
- package/dist/env/ci.js +10 -8
- package/dist/env/ci.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -1
- package/dist/errors.js.map +1 -1
- package/dist/frontmatter-utils.d.ts +7 -2
- package/dist/frontmatter-utils.d.ts.map +1 -1
- package/dist/frontmatter-utils.js +9 -2
- package/dist/frontmatter-utils.js.map +1 -1
- package/dist/fs/safe-rm.d.ts.map +1 -1
- package/dist/fs/safe-rm.js +15 -10
- package/dist/fs/safe-rm.js.map +1 -1
- package/dist/git-download.js +4 -4
- package/dist/git-download.js.map +1 -1
- package/dist/git-loader.d.ts.map +1 -1
- package/dist/git-loader.js +5 -6
- package/dist/git-loader.js.map +1 -1
- package/dist/global/index.d.ts +3 -4
- package/dist/global/index.d.ts.map +1 -1
- package/dist/global/index.js +2 -3
- package/dist/global/index.js.map +1 -1
- package/dist/global/processor.d.ts.map +1 -1
- package/dist/global/processor.js +18 -57
- package/dist/global/processor.js.map +1 -1
- package/dist/global/types.d.ts +2 -0
- package/dist/global/types.d.ts.map +1 -1
- package/dist/import-writer.d.ts +2 -0
- package/dist/import-writer.d.ts.map +1 -1
- package/dist/import-writer.js +22 -24
- package/dist/import-writer.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/inheritance.d.ts.map +1 -1
- package/dist/inheritance.js +18 -17
- package/dist/inheritance.js.map +1 -1
- package/dist/loader.d.ts +8 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +22 -9
- package/dist/loader.js.map +1 -1
- package/dist/lockfile.d.ts +31 -0
- package/dist/lockfile.d.ts.map +1 -0
- package/dist/lockfile.js +270 -0
- package/dist/lockfile.js.map +1 -0
- package/dist/mcp/env.d.ts.map +1 -1
- package/dist/mcp/env.js +3 -2
- package/dist/mcp/env.js.map +1 -1
- package/dist/merge.d.ts +9 -5
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +8 -6
- package/dist/merge.js.map +1 -1
- package/dist/npm/resolve.d.ts.map +1 -1
- package/dist/npm/resolve.js +15 -17
- package/dist/npm/resolve.js.map +1 -1
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/loader.d.ts.map +1 -1
- package/dist/prompts/loader.js +4 -5
- package/dist/prompts/loader.js.map +1 -1
- package/dist/prompts/to-skills.d.ts +26 -0
- package/dist/prompts/to-skills.d.ts.map +1 -0
- package/dist/prompts/to-skills.js +87 -0
- package/dist/prompts/to-skills.js.map +1 -0
- package/dist/reference-resolver.d.ts +86 -0
- package/dist/reference-resolver.d.ts.map +1 -0
- package/dist/reference-resolver.js +250 -0
- package/dist/reference-resolver.js.map +1 -0
- package/dist/remote-loader.d.ts.map +1 -1
- package/dist/remote-loader.js +35 -19
- package/dist/remote-loader.js.map +1 -1
- package/dist/rules/loader.d.ts.map +1 -1
- package/dist/rules/loader.js +4 -5
- package/dist/rules/loader.js.map +1 -1
- package/dist/rules/skill-rules.d.ts.map +1 -1
- package/dist/rules/skill-rules.js +2 -2
- package/dist/rules/skill-rules.js.map +1 -1
- package/dist/runtime/browser-dummy.d.ts +3 -0
- package/dist/runtime/browser-dummy.d.ts.map +1 -0
- package/dist/runtime/browser-dummy.js +46 -0
- package/dist/runtime/browser-dummy.js.map +1 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +23 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/node.d.ts +3 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +212 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/types.d.ts +130 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/skills/cache.js +2 -2
- package/dist/skills/cache.js.map +1 -1
- package/dist/skills/parser.d.ts.map +1 -1
- package/dist/skills/parser.js +6 -2
- package/dist/skills/parser.js.map +1 -1
- package/dist/skills/reference-parser.d.ts.map +1 -1
- package/dist/skills/reference-parser.js +6 -6
- package/dist/skills/reference-parser.js.map +1 -1
- package/dist/skills/resolvers/git.d.ts.map +1 -1
- package/dist/skills/resolvers/git.js +4 -5
- package/dist/skills/resolvers/git.js.map +1 -1
- package/dist/skills/resolvers/local.d.ts.map +1 -1
- package/dist/skills/resolvers/local.js +2 -2
- package/dist/skills/resolvers/local.js.map +1 -1
- package/dist/skills/resolvers/npm.d.ts.map +1 -1
- package/dist/skills/resolvers/npm.js +2 -2
- package/dist/skills/resolvers/npm.js.map +1 -1
- package/dist/skills/validate.d.ts.map +1 -1
- package/dist/skills/validate.js +4 -4
- package/dist/skills/validate.js.map +1 -1
- package/dist/state/index.d.ts +3 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +3 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/tracker.d.ts +68 -0
- package/dist/state/tracker.d.ts.map +1 -0
- package/dist/state/tracker.js +143 -0
- package/dist/state/tracker.js.map +1 -0
- package/dist/state/types.d.ts +37 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +2 -0
- package/dist/state/types.js.map +1 -0
- package/dist/updater.d.ts.map +1 -1
- package/dist/updater.js +18 -19
- package/dist/updater.js.map +1 -1
- package/dist/url-parsing.d.ts +12 -1
- package/dist/url-parsing.d.ts.map +1 -1
- package/dist/url-parsing.js +26 -3
- package/dist/url-parsing.js.map +1 -1
- package/package.json +5 -1
- package/dist/global/tracking.d.ts +0 -109
- package/dist/global/tracking.d.ts.map +0 -1
- package/dist/global/tracking.js +0 -193
- package/dist/global/tracking.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { join } from 'pathe';
|
|
2
|
+
import { getRuntimeAdapter } from '../runtime/index.js';
|
|
3
|
+
const MAX_SKILL_DESCRIPTION_LENGTH = 1024;
|
|
4
|
+
/**
|
|
5
|
+
* Convert loaded prompts into instruction-only Agent Skills. Editors with no prompt support can
|
|
6
|
+
* install these through their normal skills strategy without special prompt handling.
|
|
7
|
+
*/
|
|
8
|
+
export async function convertPromptsToSkills(prompts, options = {}) {
|
|
9
|
+
const tempRoot = options.tempRoot ?? (await getRuntimeAdapter().fs.mkdtemp(join(getRuntimeAdapter().os.tmpdir(), 'aix-prompt-skills-'))), usedNames = new Set(), skills = new Map(), conflicts = [], writes = [];
|
|
10
|
+
for (const name of options.existingSkillNames ?? []) {
|
|
11
|
+
if (name) {
|
|
12
|
+
usedNames.add(sanitizeSkillName(name));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
for (const prompt of prompts) {
|
|
16
|
+
const baseName = sanitizeSkillName(prompt.name), skillName = nextAvailableSkillName(baseName, usedNames);
|
|
17
|
+
usedNames.add(skillName);
|
|
18
|
+
if (skillName !== baseName) {
|
|
19
|
+
conflicts.push({ promptName: prompt.name, skillName });
|
|
20
|
+
}
|
|
21
|
+
const skillDir = join(tempRoot, skillName), skillBody = formatPromptSkill(prompt, skillName);
|
|
22
|
+
writes.push({ skillDir, skillBody });
|
|
23
|
+
skills.set(skillName, {
|
|
24
|
+
frontmatter: {
|
|
25
|
+
name: skillName,
|
|
26
|
+
description: getPromptSkillDescription(prompt),
|
|
27
|
+
},
|
|
28
|
+
body: skillBody,
|
|
29
|
+
basePath: skillDir,
|
|
30
|
+
source: 'local',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
await Promise.all(writes.map(async ({ skillDir, skillBody }) => {
|
|
34
|
+
await getRuntimeAdapter().fs.mkdir(skillDir, { recursive: true });
|
|
35
|
+
await getRuntimeAdapter().fs.writeFile(join(skillDir, 'SKILL.md'), skillBody, 'utf-8');
|
|
36
|
+
}));
|
|
37
|
+
return { skills, conflicts };
|
|
38
|
+
}
|
|
39
|
+
export function sanitizeSkillName(name) {
|
|
40
|
+
const sanitized = name
|
|
41
|
+
.trim()
|
|
42
|
+
.toLowerCase()
|
|
43
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
44
|
+
.replace(/^-+|-+$/g, '')
|
|
45
|
+
.replace(/-{2,}/g, '-')
|
|
46
|
+
.slice(0, 64)
|
|
47
|
+
.replace(/-+$/g, '');
|
|
48
|
+
return sanitized || 'prompt';
|
|
49
|
+
}
|
|
50
|
+
function nextAvailableSkillName(baseName, usedNames) {
|
|
51
|
+
if (!usedNames.has(baseName)) {
|
|
52
|
+
return baseName;
|
|
53
|
+
}
|
|
54
|
+
const prefixed = truncateSkillName(`prompt-${baseName}`);
|
|
55
|
+
if (!usedNames.has(prefixed)) {
|
|
56
|
+
return prefixed;
|
|
57
|
+
}
|
|
58
|
+
let suffix = 2;
|
|
59
|
+
while (true) {
|
|
60
|
+
const candidate = numberedPromptSkillName(baseName, suffix);
|
|
61
|
+
if (!usedNames.has(candidate)) {
|
|
62
|
+
return candidate;
|
|
63
|
+
}
|
|
64
|
+
suffix++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function truncateSkillName(name) {
|
|
68
|
+
return name.slice(0, 64).replace(/-+$/g, '') || 'prompt';
|
|
69
|
+
}
|
|
70
|
+
function numberedPromptSkillName(baseName, suffix) {
|
|
71
|
+
const suffixText = `-${suffix}`, maxStemLength = 64 - suffixText.length, stem = truncateSkillName(`prompt-${baseName}`).slice(0, maxStemLength).replace(/-+$/g, '');
|
|
72
|
+
return `${stem || 'prompt'}${suffixText}`;
|
|
73
|
+
}
|
|
74
|
+
function formatPromptSkill(prompt, skillName) {
|
|
75
|
+
const description = getPromptSkillDescription(prompt), argumentHint = prompt.argumentHint
|
|
76
|
+
? `\nArgument hint from the original prompt: \`${prompt.argumentHint}\`\n`
|
|
77
|
+
: '', originalName = prompt.name === skillName ? '' : ` Original prompt name: \`${prompt.name}\`.`;
|
|
78
|
+
return `---\nname: ${skillName}\ndescription: ${quoteYamlString(description)}\n---\n\n${description}\n\nThis skill was generated from an aix prompt for an editor that supports Agent Skills but not prompts.${originalName}${argumentHint}\n## Instructions\n\n${prompt.content.trim()}\n`;
|
|
79
|
+
}
|
|
80
|
+
function getPromptSkillDescription(prompt) {
|
|
81
|
+
const description = prompt.description?.trim() || `Run the ${prompt.name} prompt workflow.`;
|
|
82
|
+
return description.slice(0, MAX_SKILL_DESCRIPTION_LENGTH);
|
|
83
|
+
}
|
|
84
|
+
function quoteYamlString(value) {
|
|
85
|
+
return JSON.stringify(value);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=to-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-skills.js","sourceRoot":"","sources":["../../src/prompts/to-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAwBxD,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACzC,OAA2B,EAC3B,UAAwC,EAAE;IAE1C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,MAAM,iBAAiB,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAClI,SAAS,GAAG,IAAI,GAAG,EAAU,EAC7B,MAAM,GAAG,IAAI,GAAG,EAAuB,EACvC,SAAS,GAA0B,EAAE,EACrC,MAAM,GAAmD,EAAE,CAAC;IAElE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;QACnD,IAAI,IAAI,EAAE,CAAC;YACR,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EACzC,SAAS,GAAG,sBAAsB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE9D,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEzB,IAA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jG,OAAO,GAAG,IAAI,IAAI,QAAQ,GAAG,UAAU,EAAE,CAAC;AAC7C,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,SAAiB;IACnE,MAAM,WAAW,GAAG,yBAAyB,CAAC,MAAM,CAAC,EAC/C,YAAY,GAAG,MAAM,CAAC,YAAY;QAC/B,CAAC,CAAC,+CAA+C,MAAM,CAAC,YAAY,MAAM;QAC1E,CAAC,CAAC,EAAE,EACP,YAAY,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B,MAAM,CAAC,IAAI,KAAK,CAAC;IAEnG,OAAO,cAAc,SAAS,kBAAkB,eAAe,CAAC,WAAW,CAAC,YAAY,WAAW,4GAA4G,YAAY,GAAG,YAAY,wBAAwB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;AAC/R,CAAC;AAED,SAAS,yBAAyB,CAAC,MAAwB;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,WAAW,MAAM,CAAC,IAAI,mBAAmB,CAAC;IAE5F,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACnC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified reference resolution for all asset types (rules, prompts, skills, configs).
|
|
3
|
+
* This is the single entry point for parsing source strings into structured references.
|
|
4
|
+
* CLI commands should use this instead of inline parseSource() functions.
|
|
5
|
+
*/
|
|
6
|
+
import { type SourceType } from '@a1st/aix-schema';
|
|
7
|
+
/**
|
|
8
|
+
* Asset types that affect how references are resolved.
|
|
9
|
+
* - 'rule': prefers tree URLs (directories), infers name from subdirectory
|
|
10
|
+
* - 'prompt': prefers blob URLs (files), infers name from file path
|
|
11
|
+
* - 'skill': similar to rule, directories with SKILL.md
|
|
12
|
+
* - 'config': references to ai.json files, normalizes to shorthand
|
|
13
|
+
*/
|
|
14
|
+
export type AssetType = 'rule' | 'prompt' | 'skill' | 'config';
|
|
15
|
+
/** Git reference object used in rule/prompt/skill values */
|
|
16
|
+
export interface GitReference {
|
|
17
|
+
url: string;
|
|
18
|
+
ref?: string;
|
|
19
|
+
path?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A parsed source reference with the resolved value and inferred name.
|
|
23
|
+
* The `type` field indicates what kind of source was detected.
|
|
24
|
+
*/
|
|
25
|
+
export interface ParsedReference {
|
|
26
|
+
/** The type of source detected */
|
|
27
|
+
sourceType: SourceType;
|
|
28
|
+
/** How the reference was resolved */
|
|
29
|
+
resolvedAs: 'local' | 'git' | 'content' | 'shorthand';
|
|
30
|
+
/** The value suitable for use in ai.json (string shorthand, git object, or content object) */
|
|
31
|
+
value: string | {
|
|
32
|
+
git: GitReference;
|
|
33
|
+
} | {
|
|
34
|
+
content: string;
|
|
35
|
+
} | {
|
|
36
|
+
path: string;
|
|
37
|
+
};
|
|
38
|
+
/** Inferred name from the source (e.g., directory name, file stem) */
|
|
39
|
+
inferredName?: string;
|
|
40
|
+
/** For config references: normalized shorthand (e.g., "github:org/repo") */
|
|
41
|
+
normalizedRef?: string;
|
|
42
|
+
/** Parsed git details for consumers that need them */
|
|
43
|
+
gitDetails?: {
|
|
44
|
+
owner?: string;
|
|
45
|
+
repo?: string;
|
|
46
|
+
ref?: string;
|
|
47
|
+
path?: string;
|
|
48
|
+
provider?: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface ParseSourceOptions {
|
|
52
|
+
/** The asset type being resolved (affects URL handling and name inference) */
|
|
53
|
+
type: AssetType;
|
|
54
|
+
/** Override git ref (branch/tag/commit) from URL */
|
|
55
|
+
refOverride?: string;
|
|
56
|
+
/** Custom extensions to strip for name inference (overrides defaults for asset type) */
|
|
57
|
+
extensions?: string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parse a source string into a structured reference suitable for ai.json.
|
|
61
|
+
* This is the unified entry point that consolidates duplicated parseSource() logic.
|
|
62
|
+
*
|
|
63
|
+
* Resolution order:
|
|
64
|
+
* 1. Local paths → string shorthand or { path: ... }
|
|
65
|
+
* 2. GitHub tree URLs → { git: { url, ref, path } } (for rules/skills)
|
|
66
|
+
* 3. GitHub blob URLs → { git: { url, ref, path } } (for prompts)
|
|
67
|
+
* 4. GitHub repo URLs → { git: { url } } or shorthand
|
|
68
|
+
* 5. Git shorthand → { git: { url, ref?, path? } }
|
|
69
|
+
* 6. Generic git URLs → string shorthand or { git: { url, ref } }
|
|
70
|
+
* 7. Fallback → { content: source } (inline content)
|
|
71
|
+
*/
|
|
72
|
+
export declare function parseSourceReference(source: string, options: ParseSourceOptions): ParsedReference;
|
|
73
|
+
/**
|
|
74
|
+
* Validate and optionally normalize a reference string (for --extends, etc.).
|
|
75
|
+
* Returns the normalized form if valid, throws if unrecognizable.
|
|
76
|
+
*/
|
|
77
|
+
export declare function validateReference(source: string, context?: string): {
|
|
78
|
+
sourceType: SourceType;
|
|
79
|
+
normalized: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Detect if a source string represents a git-based reference (shorthand, tree, blob, repo URL).
|
|
83
|
+
* Useful for pre-processing before passing to external tools that may not handle all URL formats.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isGitReference(source: string): boolean;
|
|
86
|
+
//# sourceMappingURL=reference-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-resolver.d.ts","sourceRoot":"","sources":["../src/reference-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAiC,MAAM,kBAAkB,CAAC;AAiBlF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAA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GAAE,MAAoB,GAC7B;IACA,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACrB,CAuCA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAuBtD"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified reference resolution for all asset types (rules, prompts, skills, configs).
|
|
3
|
+
* This is the single entry point for parsing source strings into structured references.
|
|
4
|
+
* CLI commands should use this instead of inline parseSource() functions.
|
|
5
|
+
*/
|
|
6
|
+
import { detectSourceType, isLocalPath } from '@a1st/aix-schema';
|
|
7
|
+
import { parseGitHubTreeUrl, parseGitHubBlobUrl, parseGitHubRepoUrl, parseGitShorthand, isGenericGitUrl, inferNameFromPath, buildGitHubUrl, buildProviderUrl, } from './url-parsing.js';
|
|
8
|
+
/** Default file extensions to strip when inferring names, by asset type */
|
|
9
|
+
const EXTENSIONS_BY_TYPE = {
|
|
10
|
+
rule: ['.md', '.txt'],
|
|
11
|
+
prompt: ['.md', '.prompt.md', '.txt'],
|
|
12
|
+
skill: ['.md'],
|
|
13
|
+
config: ['.json'],
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Parse a source string into a structured reference suitable for ai.json.
|
|
17
|
+
* This is the unified entry point that consolidates duplicated parseSource() logic.
|
|
18
|
+
*
|
|
19
|
+
* Resolution order:
|
|
20
|
+
* 1. Local paths → string shorthand or { path: ... }
|
|
21
|
+
* 2. GitHub tree URLs → { git: { url, ref, path } } (for rules/skills)
|
|
22
|
+
* 3. GitHub blob URLs → { git: { url, ref, path } } (for prompts)
|
|
23
|
+
* 4. GitHub repo URLs → { git: { url } } or shorthand
|
|
24
|
+
* 5. Git shorthand → { git: { url, ref?, path? } }
|
|
25
|
+
* 6. Generic git URLs → string shorthand or { git: { url, ref } }
|
|
26
|
+
* 7. Fallback → { content: source } (inline content)
|
|
27
|
+
*/
|
|
28
|
+
export function parseSourceReference(source, options) {
|
|
29
|
+
const { type, refOverride } = options;
|
|
30
|
+
const extensions = options.extensions ?? EXTENSIONS_BY_TYPE[type];
|
|
31
|
+
// 1. Local file paths
|
|
32
|
+
if (isLocalPath(source)) {
|
|
33
|
+
return {
|
|
34
|
+
sourceType: 'local',
|
|
35
|
+
resolvedAs: 'local',
|
|
36
|
+
value: source,
|
|
37
|
+
inferredName: inferNameFromPath(source, extensions),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// 2. GitHub tree URL (directories — primarily for rules/skills)
|
|
41
|
+
const ghTree = parseGitHubTreeUrl(source);
|
|
42
|
+
if (ghTree) {
|
|
43
|
+
return resolveGitHubTree(ghTree, refOverride, extensions, type);
|
|
44
|
+
}
|
|
45
|
+
// 3. GitHub blob URL (files — primarily for prompts)
|
|
46
|
+
const ghBlob = parseGitHubBlobUrl(source);
|
|
47
|
+
if (ghBlob) {
|
|
48
|
+
return resolveGitHubBlob(ghBlob, refOverride, extensions);
|
|
49
|
+
}
|
|
50
|
+
// 4. GitHub repo URL (no tree/blob path)
|
|
51
|
+
const ghRepo = parseGitHubRepoUrl(source);
|
|
52
|
+
if (ghRepo) {
|
|
53
|
+
return resolveGitHubRepo(ghRepo, refOverride, type);
|
|
54
|
+
}
|
|
55
|
+
// 5. Git shorthand: github:user/repo/path#ref
|
|
56
|
+
const shorthand = parseGitShorthand(source);
|
|
57
|
+
if (shorthand) {
|
|
58
|
+
return resolveGitShorthand(shorthand, refOverride, extensions, type);
|
|
59
|
+
}
|
|
60
|
+
// 6. Generic git URL (https://*.git, git@, git://)
|
|
61
|
+
if (isGenericGitUrl(source)) {
|
|
62
|
+
return resolveGenericGitUrl(source, refOverride, extensions);
|
|
63
|
+
}
|
|
64
|
+
// 7. Fallback: treat as inline content
|
|
65
|
+
return {
|
|
66
|
+
sourceType: detectSourceType(source),
|
|
67
|
+
resolvedAs: 'content',
|
|
68
|
+
value: { content: source },
|
|
69
|
+
inferredName: undefined,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate and optionally normalize a reference string (for --extends, etc.).
|
|
74
|
+
* Returns the normalized form if valid, throws if unrecognizable.
|
|
75
|
+
*/
|
|
76
|
+
export function validateReference(source, context = 'reference') {
|
|
77
|
+
const sourceType = detectSourceType(source);
|
|
78
|
+
switch (sourceType) {
|
|
79
|
+
case 'http-unsupported':
|
|
80
|
+
throw new Error(`${context}: HTTP URLs are not supported (use HTTPS): ${source}`);
|
|
81
|
+
case 'local':
|
|
82
|
+
return { sourceType, normalized: source };
|
|
83
|
+
case 'git-shorthand':
|
|
84
|
+
return { sourceType, normalized: source };
|
|
85
|
+
case 'https-repo': {
|
|
86
|
+
// Try to normalize GitHub repo URLs to shorthand
|
|
87
|
+
const ghRepo = parseGitHubRepoUrl(source);
|
|
88
|
+
if (ghRepo) {
|
|
89
|
+
return { sourceType, normalized: `github:${ghRepo.owner}/${ghRepo.repo}` };
|
|
90
|
+
}
|
|
91
|
+
// Check for tree URL (also an https-repo type)
|
|
92
|
+
const ghTree = parseGitHubTreeUrl(source);
|
|
93
|
+
if (ghTree) {
|
|
94
|
+
const subpath = ghTree.subdir ? `/${ghTree.subdir}` : '';
|
|
95
|
+
const ref = ghTree.ref !== 'main' && ghTree.ref !== 'master' ? `#${ghTree.ref}` : '';
|
|
96
|
+
return {
|
|
97
|
+
sourceType,
|
|
98
|
+
normalized: `github:${ghTree.owner}/${ghTree.repo}${subpath}${ref}`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Non-GitHub repo URL — keep as-is
|
|
102
|
+
return { sourceType, normalized: source };
|
|
103
|
+
}
|
|
104
|
+
case 'https-file': {
|
|
105
|
+
// Blob URLs could be normalized too, but keep as-is for clarity
|
|
106
|
+
return { sourceType, normalized: source };
|
|
107
|
+
}
|
|
108
|
+
case 'npm':
|
|
109
|
+
return { sourceType, normalized: source };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Detect if a source string represents a git-based reference (shorthand, tree, blob, repo URL).
|
|
114
|
+
* Useful for pre-processing before passing to external tools that may not handle all URL formats.
|
|
115
|
+
*/
|
|
116
|
+
export function isGitReference(source) {
|
|
117
|
+
const sourceType = detectSourceType(source);
|
|
118
|
+
if (sourceType === 'git-shorthand') {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
if (sourceType === 'https-repo') {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
// Check if it's a specific git host URL
|
|
125
|
+
if (parseGitHubTreeUrl(source)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
if (parseGitHubBlobUrl(source)) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if (parseGitHubRepoUrl(source)) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
if (isGenericGitUrl(source)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
// --- Internal resolution helpers ---
|
|
140
|
+
function resolveGitHubTree(ghTree, refOverride, extensions, _type) {
|
|
141
|
+
return {
|
|
142
|
+
sourceType: 'https-repo',
|
|
143
|
+
resolvedAs: 'git',
|
|
144
|
+
value: {
|
|
145
|
+
git: {
|
|
146
|
+
url: buildGitHubUrl(ghTree.owner, ghTree.repo),
|
|
147
|
+
ref: refOverride ?? ghTree.ref,
|
|
148
|
+
path: ghTree.subdir,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
inferredName: inferNameFromPath(ghTree.subdir, extensions),
|
|
152
|
+
gitDetails: {
|
|
153
|
+
owner: ghTree.owner,
|
|
154
|
+
repo: ghTree.repo,
|
|
155
|
+
ref: refOverride ?? ghTree.ref,
|
|
156
|
+
path: ghTree.subdir,
|
|
157
|
+
provider: 'github',
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function resolveGitHubBlob(ghBlob, refOverride, extensions) {
|
|
162
|
+
return {
|
|
163
|
+
sourceType: 'https-file',
|
|
164
|
+
resolvedAs: 'git',
|
|
165
|
+
value: {
|
|
166
|
+
git: {
|
|
167
|
+
url: buildGitHubUrl(ghBlob.owner, ghBlob.repo),
|
|
168
|
+
ref: refOverride ?? ghBlob.ref,
|
|
169
|
+
path: ghBlob.path,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
inferredName: inferNameFromPath(ghBlob.path, extensions),
|
|
173
|
+
gitDetails: {
|
|
174
|
+
owner: ghBlob.owner,
|
|
175
|
+
repo: ghBlob.repo,
|
|
176
|
+
ref: refOverride ?? ghBlob.ref,
|
|
177
|
+
path: ghBlob.path,
|
|
178
|
+
provider: 'github',
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function resolveGitHubRepo(ghRepo, refOverride, type) {
|
|
183
|
+
const gitRef = {
|
|
184
|
+
url: buildGitHubUrl(ghRepo.owner, ghRepo.repo),
|
|
185
|
+
};
|
|
186
|
+
if (refOverride) {
|
|
187
|
+
gitRef.ref = refOverride;
|
|
188
|
+
}
|
|
189
|
+
const result = {
|
|
190
|
+
sourceType: 'https-repo',
|
|
191
|
+
resolvedAs: 'git',
|
|
192
|
+
value: { git: gitRef },
|
|
193
|
+
inferredName: ghRepo.repo,
|
|
194
|
+
normalizedRef: `github:${ghRepo.owner}/${ghRepo.repo}`,
|
|
195
|
+
gitDetails: {
|
|
196
|
+
owner: ghRepo.owner,
|
|
197
|
+
repo: ghRepo.repo,
|
|
198
|
+
ref: refOverride,
|
|
199
|
+
provider: 'github',
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
// For config type, also provide the shorthand
|
|
203
|
+
if (type === 'config') {
|
|
204
|
+
result.normalizedRef = `github:${ghRepo.owner}/${ghRepo.repo}`;
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
function resolveGitShorthand(shorthand, refOverride, extensions, _type) {
|
|
209
|
+
const gitUrl = buildProviderUrl(shorthand.provider, shorthand.user, shorthand.repo);
|
|
210
|
+
const effectiveRef = refOverride ?? shorthand.ref;
|
|
211
|
+
const gitRefObj = { url: gitUrl };
|
|
212
|
+
if (effectiveRef) {
|
|
213
|
+
gitRefObj.ref = effectiveRef;
|
|
214
|
+
}
|
|
215
|
+
if (shorthand.subpath) {
|
|
216
|
+
gitRefObj.path = shorthand.subpath;
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
sourceType: 'git-shorthand',
|
|
220
|
+
resolvedAs: 'git',
|
|
221
|
+
value: { git: gitRefObj },
|
|
222
|
+
inferredName: shorthand.subpath
|
|
223
|
+
? inferNameFromPath(shorthand.subpath, extensions)
|
|
224
|
+
: shorthand.repo,
|
|
225
|
+
gitDetails: {
|
|
226
|
+
owner: shorthand.user,
|
|
227
|
+
repo: shorthand.repo,
|
|
228
|
+
ref: effectiveRef,
|
|
229
|
+
path: shorthand.subpath,
|
|
230
|
+
provider: shorthand.provider,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function resolveGenericGitUrl(source, refOverride, extensions) {
|
|
235
|
+
if (refOverride) {
|
|
236
|
+
return {
|
|
237
|
+
sourceType: detectSourceType(source),
|
|
238
|
+
resolvedAs: 'git',
|
|
239
|
+
value: { git: { url: source, ref: refOverride } },
|
|
240
|
+
inferredName: inferNameFromPath(source.replace(/\.git$/, ''), extensions),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
sourceType: detectSourceType(source),
|
|
245
|
+
resolvedAs: 'git',
|
|
246
|
+
value: source,
|
|
247
|
+
inferredName: inferNameFromPath(source.replace(/\.git$/, ''), extensions),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=reference-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-resolver.js","sourceRoot":"","sources":["../src/reference-resolver.ts"],"names":[],"mappings":"AAAA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gB,CAAC,MAAM,CAAC;YACpC,UAAU,EAAE,KAAK;YACjB,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;YACjD,YAAY,EAAE,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC;SAC3E,CAAC;IACL,CAAC;IAED,OAAO;QACJ,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC;QACpC,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC;KAC3E,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-loader.d.ts","sourceRoot":"","sources":["../src/remote-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-loader.d.ts","sourceRoot":"","sources":["../src/remote-loader.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC3B,mBAAmB;IACnB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC9B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,MAAM,EAAE,gBAAgB,CAAC;IACzB,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,aAAa,CAAC;CAC5B;AA4FD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoCxE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyEnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAA0C,GAAG,gBAAgB,CAoBjH;AAwDD;;GAEG;AACH,wBAAsB,cAAc,CACjC,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,MAA0C,GAC/C,OAAO,CAAC,gBAAgB,CAAC,CAuB3B"}
|
package/dist/remote-loader.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remote config loading utilities for fetching ai.json from URLs, git repos, and local paths.
|
|
3
3
|
*/
|
|
4
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
-
import { tmpdir } from 'node:os';
|
|
6
4
|
import { resolve, dirname } from 'pathe';
|
|
7
|
-
import { downloadTemplate } from 'giget';
|
|
8
5
|
import { parseJsonc, detectSourceType } from '@a1st/aix-schema';
|
|
9
6
|
import { convertBlobToRawUrl, parseGitShorthand, parseGitHubRepoUrl, parseGitHubBlobUrl, } from './url-parsing.js';
|
|
10
|
-
import { ConfigNotFoundError, ConfigParseError, RemoteFetchError, UnsupportedUrlError, } from './errors.js';
|
|
7
|
+
import { ConfigNotFoundError, ConfigParseError, RemoteFetchError, UnsupportedRuntimeCapabilityError, UnsupportedUrlError, } from './errors.js';
|
|
8
|
+
import { getRuntimeAdapter } from './runtime/index.js';
|
|
11
9
|
const FETCH_TIMEOUT_MS = 30000;
|
|
12
10
|
/**
|
|
13
11
|
* Fetch content from a URL with timeout.
|
|
14
12
|
*/
|
|
15
13
|
async function fetchWithTimeout(url, timeoutMs = FETCH_TIMEOUT_MS) {
|
|
16
|
-
const controller =
|
|
14
|
+
const controller = getRuntimeAdapter().network.createAbortController(), timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
17
15
|
try {
|
|
18
|
-
const response = await fetch(url, { signal: controller.signal });
|
|
16
|
+
const response = await getRuntimeAdapter().network.fetch(url, { signal: controller.signal });
|
|
19
17
|
if (!response.ok) {
|
|
20
18
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
21
19
|
}
|
|
@@ -40,19 +38,25 @@ async function loadFromGitHubBlobUrl(parsed) {
|
|
|
40
38
|
const template = `github:${parsed.owner}/${parsed.repo}#${parsed.ref}`;
|
|
41
39
|
let dir;
|
|
42
40
|
try {
|
|
43
|
-
const result = await downloadTemplate(template, {
|
|
41
|
+
const result = await getRuntimeAdapter().git.downloadTemplate(template, {
|
|
42
|
+
cwd: getRuntimeAdapter().os.tmpdir(),
|
|
43
|
+
forceClean: true,
|
|
44
|
+
});
|
|
44
45
|
dir = result.dir;
|
|
45
46
|
}
|
|
46
47
|
catch (error) {
|
|
48
|
+
if (error instanceof UnsupportedRuntimeCapabilityError) {
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
47
51
|
const message = error instanceof Error ? error.message : String(error);
|
|
48
52
|
throw new RemoteFetchError(`https://github.com/${parsed.owner}/${parsed.repo}/blob/${parsed.ref}/${parsed.path}`, message);
|
|
49
53
|
}
|
|
50
54
|
// Read the config file from the downloaded repo
|
|
51
55
|
const configPath = resolve(dir, parsed.path);
|
|
52
|
-
if (!existsSync(configPath)) {
|
|
56
|
+
if (!getRuntimeAdapter().fs.existsSync(configPath)) {
|
|
53
57
|
throw new ConfigNotFoundError(configPath);
|
|
54
58
|
}
|
|
55
|
-
const content = readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
59
|
+
const content = getRuntimeAdapter().fs.readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
56
60
|
if (result.errors.length > 0) {
|
|
57
61
|
throw new ConfigParseError(`Parse error: ${result.errors[0]?.message}`, configPath);
|
|
58
62
|
}
|
|
@@ -122,10 +126,16 @@ export async function loadFromGitShorthand(input) {
|
|
|
122
126
|
}
|
|
123
127
|
let dir;
|
|
124
128
|
try {
|
|
125
|
-
const result = await downloadTemplate(template, {
|
|
129
|
+
const result = await getRuntimeAdapter().git.downloadTemplate(template, {
|
|
130
|
+
cwd: getRuntimeAdapter().os.tmpdir(),
|
|
131
|
+
forceClean: true,
|
|
132
|
+
});
|
|
126
133
|
dir = result.dir;
|
|
127
134
|
}
|
|
128
135
|
catch (error) {
|
|
136
|
+
if (error instanceof UnsupportedRuntimeCapabilityError) {
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
129
139
|
const message = error instanceof Error ? error.message : String(error);
|
|
130
140
|
throw new RemoteFetchError(input, message);
|
|
131
141
|
}
|
|
@@ -141,10 +151,10 @@ export async function loadFromGitShorthand(input) {
|
|
|
141
151
|
configPath = resolve(dir, 'ai.json');
|
|
142
152
|
configPathInRepo = parsed.subpath ? `${parsed.subpath}/ai.json` : 'ai.json';
|
|
143
153
|
}
|
|
144
|
-
if (!existsSync(configPath)) {
|
|
154
|
+
if (!getRuntimeAdapter().fs.existsSync(configPath)) {
|
|
145
155
|
throw new ConfigNotFoundError(configPath);
|
|
146
156
|
}
|
|
147
|
-
const content = readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
157
|
+
const content = getRuntimeAdapter().fs.readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
148
158
|
if (result.errors.length > 0) {
|
|
149
159
|
throw new ConfigParseError(`Parse error: ${result.errors[0]?.message}`, configPath);
|
|
150
160
|
}
|
|
@@ -165,12 +175,12 @@ export async function loadFromGitShorthand(input) {
|
|
|
165
175
|
/**
|
|
166
176
|
* Load config from a local file path.
|
|
167
177
|
*/
|
|
168
|
-
export function loadFromLocalPath(path, cwd = process.cwd()) {
|
|
178
|
+
export function loadFromLocalPath(path, cwd = getRuntimeAdapter().process.cwd()) {
|
|
169
179
|
const absolutePath = resolve(cwd, path);
|
|
170
|
-
if (!existsSync(absolutePath)) {
|
|
180
|
+
if (!getRuntimeAdapter().fs.existsSync(absolutePath)) {
|
|
171
181
|
throw new ConfigNotFoundError(absolutePath);
|
|
172
182
|
}
|
|
173
|
-
const content = readFileSync(absolutePath, 'utf-8'), result = parseJsonc(content);
|
|
183
|
+
const content = getRuntimeAdapter().fs.readFileSync(absolutePath, 'utf-8'), result = parseJsonc(content);
|
|
174
184
|
if (result.errors.length > 0) {
|
|
175
185
|
throw new ConfigParseError(`Parse error: ${result.errors[0]?.message}`, absolutePath);
|
|
176
186
|
}
|
|
@@ -194,18 +204,24 @@ async function loadFromRepoUrl(url) {
|
|
|
194
204
|
// For other repo URLs, try using giget directly
|
|
195
205
|
let dir;
|
|
196
206
|
try {
|
|
197
|
-
const result = await downloadTemplate(url, {
|
|
207
|
+
const result = await getRuntimeAdapter().git.downloadTemplate(url, {
|
|
208
|
+
cwd: getRuntimeAdapter().os.tmpdir(),
|
|
209
|
+
forceClean: true,
|
|
210
|
+
});
|
|
198
211
|
dir = result.dir;
|
|
199
212
|
}
|
|
200
213
|
catch (error) {
|
|
214
|
+
if (error instanceof UnsupportedRuntimeCapabilityError) {
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
201
217
|
const message = error instanceof Error ? error.message : String(error);
|
|
202
218
|
throw new RemoteFetchError(url, message);
|
|
203
219
|
}
|
|
204
220
|
const configPath = resolve(dir, 'ai.json');
|
|
205
|
-
if (!existsSync(configPath)) {
|
|
221
|
+
if (!getRuntimeAdapter().fs.existsSync(configPath)) {
|
|
206
222
|
throw new ConfigNotFoundError(configPath);
|
|
207
223
|
}
|
|
208
|
-
const content = readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
224
|
+
const content = getRuntimeAdapter().fs.readFileSync(configPath, 'utf-8'), result = parseJsonc(content);
|
|
209
225
|
if (result.errors.length > 0) {
|
|
210
226
|
throw new ConfigParseError(`Parse error: ${result.errors[0]?.message}`, configPath);
|
|
211
227
|
}
|
|
@@ -219,7 +235,7 @@ async function loadFromRepoUrl(url) {
|
|
|
219
235
|
/**
|
|
220
236
|
* Classify and load config from any source type.
|
|
221
237
|
*/
|
|
222
|
-
export async function loadFromSource(source, cwd = process.cwd()) {
|
|
238
|
+
export async function loadFromSource(source, cwd = getRuntimeAdapter().process.cwd()) {
|
|
223
239
|
const sourceType = detectSourceType(source);
|
|
224
240
|
switch (sourceType) {
|
|
225
241
|
case 'git-shorthand':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-loader.js","sourceRoot":"","sources":["../src/remote-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"remote-loader.js","sourceRoot":"","sources":["../src/remote-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACJ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACJ,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iCAAiC,EACjC,mBAAmB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AA+BvD,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAAC,GAAW,EAAE,SAAS,GAAG,gBAAgB;IACtE,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAChE,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE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EAAE,OAAO,CAAC,UAAU,CAAC;QAC5B,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,KAAK;KACjB,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACjC,MAAc,EACd,MAAc,iBAAiB,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;IAE/C,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE5C,QAAQ,UAAU,EAAE,CAAC;QACrB,KAAK,eAAe;YACjB,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAEvC,KAAK,YAAY;YACd,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;QAE9B,KAAK,YAAY;YACd,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;QAElC,KAAK,kBAAkB;YACpB,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAEzC,KAAK,OAAO;YACT,OAAO,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAEzC,KAAK,KAAK;YACP,2EAA2E;YAC3E,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/rules/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/rules/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ3F,MAAM,WAAW,UAAU;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,cAAc,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACJ;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAsFpG;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC5B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAarC"}
|