code-ai-installer 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/catalog.d.ts +27 -0
- package/dist/catalog.js +134 -0
- package/dist/contentTransformer.d.ts +16 -0
- package/dist/contentTransformer.js +195 -0
- package/dist/doctor.d.ts +13 -0
- package/dist/doctor.js +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +333 -0
- package/dist/installer.d.ts +35 -0
- package/dist/installer.js +205 -0
- package/dist/logger.d.ts +20 -0
- package/dist/logger.js +29 -0
- package/dist/platforms/adapters.d.ts +12 -0
- package/dist/platforms/adapters.js +180 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.js +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
const targetLayouts = {
|
|
3
|
+
"vscode-copilot": {
|
|
4
|
+
instructionFile: ".github/copilot-instructions.md",
|
|
5
|
+
orchestratorMirrorFile: "AGENTS.md",
|
|
6
|
+
agentsDir: ".github/agents",
|
|
7
|
+
skillsDir: ".github/skills",
|
|
8
|
+
notes: "Uses copilot-instructions.md and stores role/skill docs in .github.",
|
|
9
|
+
},
|
|
10
|
+
claude: {
|
|
11
|
+
instructionFile: "CLAUDE.md",
|
|
12
|
+
orchestratorMirrorFile: "AGENTS.md",
|
|
13
|
+
agentsDir: ".claude/agents",
|
|
14
|
+
skillsDir: ".claude/skills",
|
|
15
|
+
notes: "Uses CLAUDE.md and local .claude folder for role/skill docs.",
|
|
16
|
+
},
|
|
17
|
+
"qwen-3.5": {
|
|
18
|
+
instructionFile: "QWEN.md",
|
|
19
|
+
orchestratorMirrorFile: "AGENTS.md",
|
|
20
|
+
agentsDir: ".qwen/agents",
|
|
21
|
+
skillsDir: ".qwen/skills",
|
|
22
|
+
notes: "Uses QWEN.md convention and .qwen folder for role/skill docs.",
|
|
23
|
+
},
|
|
24
|
+
"google-antugravity": {
|
|
25
|
+
instructionFile: "GEMINI.md",
|
|
26
|
+
orchestratorMirrorFile: "AGENTS.md",
|
|
27
|
+
agentsDir: ".gemini/agents",
|
|
28
|
+
skillsDir: ".gemini/skills",
|
|
29
|
+
notes: "Uses GEMINI.md convention and .gemini folder for role/skill docs.",
|
|
30
|
+
},
|
|
31
|
+
"gpt-codex": {
|
|
32
|
+
instructionFile: "CODEX.md",
|
|
33
|
+
orchestratorMirrorFile: "AGENTS.md",
|
|
34
|
+
agentsDir: ".codex/agents",
|
|
35
|
+
skillsDir: ".codex/skills",
|
|
36
|
+
notes: "Uses CODEX.md and .codex folder for role/skill docs.",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Returns all supported platform adapters.
|
|
41
|
+
* @returns Array of platform adapters.
|
|
42
|
+
*/
|
|
43
|
+
export function getPlatformAdapters() {
|
|
44
|
+
return [
|
|
45
|
+
buildAdapter("vscode-copilot", "VS Code Copilot"),
|
|
46
|
+
buildAdapter("claude", "Claude AI"),
|
|
47
|
+
buildAdapter("qwen-3.5", "Qwen 3.5"),
|
|
48
|
+
buildAdapter("google-antugravity", "Google Antugravity"),
|
|
49
|
+
buildAdapter("gpt-codex", "GPT Codex"),
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns a single platform adapter by identifier.
|
|
54
|
+
* @param target Target id.
|
|
55
|
+
* @returns Platform adapter.
|
|
56
|
+
*/
|
|
57
|
+
export function getPlatformAdapter(target) {
|
|
58
|
+
const found = getPlatformAdapters().find((adapter) => adapter.id === target);
|
|
59
|
+
if (!found) {
|
|
60
|
+
throw new Error(`Unsupported target: ${target}`);
|
|
61
|
+
}
|
|
62
|
+
return found;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Builds one adapter from target layout metadata.
|
|
66
|
+
* @param id Target id.
|
|
67
|
+
* @param label Human-readable label.
|
|
68
|
+
* @returns Configured platform adapter.
|
|
69
|
+
*/
|
|
70
|
+
function buildAdapter(id, label) {
|
|
71
|
+
const layout = targetLayouts[id];
|
|
72
|
+
return {
|
|
73
|
+
id,
|
|
74
|
+
label,
|
|
75
|
+
description: layout.notes,
|
|
76
|
+
defaultDestination(projectDir) {
|
|
77
|
+
return projectDir;
|
|
78
|
+
},
|
|
79
|
+
validateDestination(destinationDir) {
|
|
80
|
+
const warnings = [];
|
|
81
|
+
const normalized = path.resolve(destinationDir);
|
|
82
|
+
if (normalized.length < 3) {
|
|
83
|
+
warnings.push("Destination path looks suspiciously short.");
|
|
84
|
+
}
|
|
85
|
+
return warnings;
|
|
86
|
+
},
|
|
87
|
+
planOperations(args) {
|
|
88
|
+
return planForLayout(layout, args.catalog, args.destinationDir, args.selectedAgents, args.selectedSkills, id);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Plans copy and generated instruction operations for one platform layout.
|
|
94
|
+
* @param layout Platform layout.
|
|
95
|
+
* @param catalog Source catalog.
|
|
96
|
+
* @param destinationDir Destination root.
|
|
97
|
+
* @param selectedAgents Selected agent names.
|
|
98
|
+
* @param selectedSkills Selected skill names.
|
|
99
|
+
* @param target Target id.
|
|
100
|
+
* @returns Planned operations list.
|
|
101
|
+
*/
|
|
102
|
+
function planForLayout(layout, catalog, destinationDir, selectedAgents, selectedSkills, target) {
|
|
103
|
+
const operations = [];
|
|
104
|
+
operations.push({
|
|
105
|
+
sourcePath: catalog.orchestratorPath,
|
|
106
|
+
destinationPath: path.join(destinationDir, layout.orchestratorMirrorFile),
|
|
107
|
+
generated: false,
|
|
108
|
+
transform: {
|
|
109
|
+
target,
|
|
110
|
+
assetType: "orchestrator",
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
const instructionContent = renderInstructionFile(target, selectedAgents, selectedSkills);
|
|
114
|
+
operations.push({
|
|
115
|
+
sourcePath: "<generated>",
|
|
116
|
+
destinationPath: path.join(destinationDir, layout.instructionFile),
|
|
117
|
+
generated: true,
|
|
118
|
+
content: instructionContent,
|
|
119
|
+
});
|
|
120
|
+
for (const agentName of selectedAgents) {
|
|
121
|
+
const sourcePath = catalog.agentFiles[agentName];
|
|
122
|
+
if (!sourcePath) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
operations.push({
|
|
126
|
+
sourcePath,
|
|
127
|
+
destinationPath: path.join(destinationDir, layout.agentsDir, `${agentName}.md`),
|
|
128
|
+
generated: false,
|
|
129
|
+
transform: {
|
|
130
|
+
target,
|
|
131
|
+
assetType: "agent",
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
for (const skillName of selectedSkills) {
|
|
136
|
+
const sourcePath = catalog.skillFiles[skillName];
|
|
137
|
+
if (!sourcePath) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
operations.push({
|
|
141
|
+
sourcePath,
|
|
142
|
+
destinationPath: path.join(destinationDir, layout.skillsDir, skillName, "SKILL.md"),
|
|
143
|
+
generated: false,
|
|
144
|
+
transform: {
|
|
145
|
+
target,
|
|
146
|
+
assetType: "skill",
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return operations;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Renders a platform-level instruction file with selected assets.
|
|
154
|
+
* @param target Target id.
|
|
155
|
+
* @param selectedAgents Selected agent list.
|
|
156
|
+
* @param selectedSkills Selected skill list.
|
|
157
|
+
* @returns Instruction markdown.
|
|
158
|
+
*/
|
|
159
|
+
function renderInstructionFile(target, selectedAgents, selectedSkills) {
|
|
160
|
+
const lines = [];
|
|
161
|
+
lines.push(`# ${target} Instructions`);
|
|
162
|
+
lines.push("");
|
|
163
|
+
lines.push("This file was generated by code-ai installer.");
|
|
164
|
+
lines.push("Use AGENTS.md as orchestration baseline.");
|
|
165
|
+
lines.push("");
|
|
166
|
+
lines.push("## Enabled Agents");
|
|
167
|
+
for (const agentName of selectedAgents) {
|
|
168
|
+
lines.push(`- ${agentName}`);
|
|
169
|
+
}
|
|
170
|
+
lines.push("");
|
|
171
|
+
lines.push("## Enabled Skills");
|
|
172
|
+
for (const skillName of selectedSkills) {
|
|
173
|
+
lines.push(`- ${skillName}`);
|
|
174
|
+
}
|
|
175
|
+
lines.push("");
|
|
176
|
+
lines.push("## Local Paths");
|
|
177
|
+
lines.push("- Agents: see platform-specific agents directory.");
|
|
178
|
+
lines.push("- Skills: see platform-specific skills directory.");
|
|
179
|
+
return `${lines.join("\n")}\n`;
|
|
180
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported AI target identifiers.
|
|
3
|
+
*/
|
|
4
|
+
export type TargetId = "vscode-copilot" | "claude" | "qwen-3.5" | "google-antugravity" | "gpt-codex";
|
|
5
|
+
/**
|
|
6
|
+
* Defines one source file and destination path copy action.
|
|
7
|
+
*/
|
|
8
|
+
export interface InstallOperation {
|
|
9
|
+
sourcePath: string;
|
|
10
|
+
destinationPath: string;
|
|
11
|
+
generated: boolean;
|
|
12
|
+
content?: string;
|
|
13
|
+
transform?: {
|
|
14
|
+
target: TargetId;
|
|
15
|
+
assetType: "orchestrator" | "agent" | "skill";
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents discovered local assets that can be installed.
|
|
20
|
+
*/
|
|
21
|
+
export interface SourceCatalog {
|
|
22
|
+
rootDir: string;
|
|
23
|
+
orchestratorPath: string;
|
|
24
|
+
agentFiles: Record<string, string>;
|
|
25
|
+
skillFiles: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Contains runtime options for install command.
|
|
29
|
+
*/
|
|
30
|
+
export interface InstallOptions {
|
|
31
|
+
target: TargetId;
|
|
32
|
+
projectDir: string;
|
|
33
|
+
destinationDir: string;
|
|
34
|
+
selectedAgents: string[];
|
|
35
|
+
selectedSkills: string[];
|
|
36
|
+
dryRun: boolean;
|
|
37
|
+
overwriteMode: "skip" | "overwrite";
|
|
38
|
+
strictHints: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Stores install output metadata for uninstall and audit.
|
|
42
|
+
*/
|
|
43
|
+
export interface InstallState {
|
|
44
|
+
target: TargetId;
|
|
45
|
+
installedAt: string;
|
|
46
|
+
destinationDir: string;
|
|
47
|
+
projectDir: string;
|
|
48
|
+
files: string[];
|
|
49
|
+
selectedAgents: string[];
|
|
50
|
+
selectedSkills: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Represents platform-specific destination layout and generated instruction files.
|
|
54
|
+
*/
|
|
55
|
+
export interface PlatformAdapter {
|
|
56
|
+
id: TargetId;
|
|
57
|
+
label: string;
|
|
58
|
+
description: string;
|
|
59
|
+
defaultDestination(projectDir: string): string;
|
|
60
|
+
validateDestination(destinationDir: string): string[];
|
|
61
|
+
planOperations(args: {
|
|
62
|
+
catalog: SourceCatalog;
|
|
63
|
+
destinationDir: string;
|
|
64
|
+
selectedAgents: string[];
|
|
65
|
+
selectedSkills: string[];
|
|
66
|
+
}): InstallOperation[];
|
|
67
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "code-ai-installer",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Production-ready CLI to install code-ai agents and skills for multiple AI coding assistants.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"code-ai": "dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "node -e \"const fs=require('fs'); if (fs.existsSync('dist')) fs.rmSync('dist',{recursive:true,force:true});\"",
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"dev": "tsx src/index.ts",
|
|
17
|
+
"lint": "tsc --noEmit -p tsconfig.json",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"prepack": "npm run clean && npm run build"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cli",
|
|
26
|
+
"agents",
|
|
27
|
+
"ai",
|
|
28
|
+
"codex",
|
|
29
|
+
"claude",
|
|
30
|
+
"qwen",
|
|
31
|
+
"copilot",
|
|
32
|
+
"gemini"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"chalk": "^5.3.0",
|
|
36
|
+
"commander": "^12.1.0",
|
|
37
|
+
"fs-extra": "^11.2.0",
|
|
38
|
+
"prompts": "^2.4.2",
|
|
39
|
+
"zod": "^3.23.8"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/fs-extra": "^11.0.4",
|
|
43
|
+
"@types/node": "^22.10.2",
|
|
44
|
+
"@types/prompts": "^2.4.9",
|
|
45
|
+
"tsx": "^4.19.2",
|
|
46
|
+
"typescript": "^5.7.2",
|
|
47
|
+
"vitest": "^2.1.8"
|
|
48
|
+
}
|
|
49
|
+
}
|