code-ai-installer 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/contentTransformer.d.ts +0 -7
- package/dist/contentTransformer.js +28 -14
- package/dist/installer.js +1 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,14 +81,14 @@ code-ai uninstall --target claude --apply
|
|
|
81
81
|
- Agent files copied to target-specific agents directory.
|
|
82
82
|
- Skill files copied to target-specific skills directory.
|
|
83
83
|
- Markdown content is normalized per target (model-specific hint comments like `codex:` are transformed).
|
|
84
|
-
- `codex reasoning` is mapped to target-native hints (`claude thinking`, `qwen reasoning_effort`, `gemini reasoning`).
|
|
84
|
+
- `codex reasoning` is mapped to target-native hints (`copilot reasoning`, `claude thinking`, `qwen reasoning_effort`, `gemini reasoning`).
|
|
85
85
|
|
|
86
86
|
## Safety model
|
|
87
87
|
- Default mode is `dry-run`.
|
|
88
88
|
- Backup is created before writes under `.code-ai-installer/backups/<target>/<timestamp>/`.
|
|
89
89
|
- State is tracked in `.code-ai-installer/state/<target>.json` for uninstall.
|
|
90
90
|
- Rollback restores previous files on install failure.
|
|
91
|
-
- Optional strict
|
|
91
|
+
- Optional strict adaptation mode: `--strict-hints` enforces target-hint emission and auto-fills missing hints with target defaults.
|
|
92
92
|
|
|
93
93
|
## Notes
|
|
94
94
|
- Target aliases are accepted: `copilot`, `codex`, `claude`, `qwen`, `google`, `antigravity`.
|
|
@@ -7,10 +7,3 @@ import type { TargetId } from "./types.js";
|
|
|
7
7
|
* @returns Target-normalized markdown content.
|
|
8
8
|
*/
|
|
9
9
|
export declare function transformContentForTarget(input: string, target: TargetId, assetType: "orchestrator" | "agent" | "skill"): string;
|
|
10
|
-
/**
|
|
11
|
-
* Returns whether markdown contains explicit hint for the selected target model.
|
|
12
|
-
* @param input Original markdown content.
|
|
13
|
-
* @param target Target AI identifier.
|
|
14
|
-
* @returns True when a native target hint is present.
|
|
15
|
-
*/
|
|
16
|
-
export declare function hasExplicitTargetHint(input: string, target: TargetId): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const hintRegex = /<!--\s*(codex|claude|qwen|gemini)\s*:\s*([\s\S]*?)-->\s*\n?/gi;
|
|
1
|
+
const hintRegex = /<!--\s*(codex|copilot|claude|qwen|gemini)\s*:\s*([\s\S]*?)-->\s*\n?/gi;
|
|
2
2
|
/**
|
|
3
3
|
* Transforms markdown content for selected AI target.
|
|
4
4
|
* @param input Original file content.
|
|
@@ -21,18 +21,6 @@ export function transformContentForTarget(input, target, assetType) {
|
|
|
21
21
|
const output = cleaned.trimStart();
|
|
22
22
|
return `${marker}${mappedHint}${output.endsWith("\n") ? output : `${output}\n`}`;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns whether markdown contains explicit hint for the selected target model.
|
|
26
|
-
* @param input Original markdown content.
|
|
27
|
-
* @param target Target AI identifier.
|
|
28
|
-
* @returns True when a native target hint is present.
|
|
29
|
-
*/
|
|
30
|
-
export function hasExplicitTargetHint(input, target) {
|
|
31
|
-
const content = stripBom(input).replace(/\r\n/g, "\n");
|
|
32
|
-
const targetModel = targetToModel(target);
|
|
33
|
-
const hints = [...content.matchAll(/<!--\s*(codex|claude|qwen|gemini)\s*:\s*[\s\S]*?-->/gi)];
|
|
34
|
-
return hints.some((match) => String(match[1]).toLowerCase() === targetModel);
|
|
35
|
-
}
|
|
36
24
|
/**
|
|
37
25
|
* Returns content without UTF-8 BOM prefix.
|
|
38
26
|
* @param value Raw content.
|
|
@@ -66,17 +54,40 @@ function buildMappedHint(target, hints) {
|
|
|
66
54
|
}
|
|
67
55
|
const codex = hints.find((hint) => hint.model === "codex");
|
|
68
56
|
if (!codex) {
|
|
69
|
-
return
|
|
57
|
+
return `<!-- ${targetModel}: ${defaultPayloadForTarget(targetModel)} -->\n`;
|
|
70
58
|
}
|
|
71
59
|
const mappedPayload = mapCodexPayload(codex.payload, targetModel);
|
|
72
60
|
return `<!-- ${targetModel}: ${mappedPayload} -->\n`;
|
|
73
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns fallback payload when source markdown has no model hints.
|
|
64
|
+
* @param targetModel Destination model label.
|
|
65
|
+
* @returns Default target-model payload.
|
|
66
|
+
*/
|
|
67
|
+
function defaultPayloadForTarget(targetModel) {
|
|
68
|
+
if (targetModel === "copilot") {
|
|
69
|
+
return "reasoning=medium; note=\"auto-adapted default\"";
|
|
70
|
+
}
|
|
71
|
+
if (targetModel === "claude") {
|
|
72
|
+
return "thinking=medium; note=\"auto-adapted default\"";
|
|
73
|
+
}
|
|
74
|
+
if (targetModel === "qwen") {
|
|
75
|
+
return "reasoning_effort=medium; note=\"auto-adapted default\"";
|
|
76
|
+
}
|
|
77
|
+
if (targetModel === "gemini") {
|
|
78
|
+
return "reasoning=medium; note=\"auto-adapted default\"";
|
|
79
|
+
}
|
|
80
|
+
return "reasoning=medium; note=\"auto-adapted default\"";
|
|
81
|
+
}
|
|
74
82
|
/**
|
|
75
83
|
* Maps target id to hint model label.
|
|
76
84
|
* @param target Target AI identifier.
|
|
77
85
|
* @returns Target model name used in markdown hints.
|
|
78
86
|
*/
|
|
79
87
|
function targetToModel(target) {
|
|
88
|
+
if (target === "vscode-copilot") {
|
|
89
|
+
return "copilot";
|
|
90
|
+
}
|
|
80
91
|
if (target === "claude") {
|
|
81
92
|
return "claude";
|
|
82
93
|
}
|
|
@@ -110,6 +121,9 @@ function mapCodexPayload(payload, targetModel) {
|
|
|
110
121
|
const effort = mapReasoningToGemini(normalizedReasoning);
|
|
111
122
|
return withNote(`reasoning=${effort}`, note);
|
|
112
123
|
}
|
|
124
|
+
if (targetModel === "copilot") {
|
|
125
|
+
return withNote(`reasoning=${normalizedReasoning}`, note);
|
|
126
|
+
}
|
|
113
127
|
return withNote(`reasoning=${normalizedReasoning}`, note);
|
|
114
128
|
}
|
|
115
129
|
/**
|
package/dist/installer.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import { getPlatformAdapter } from "./platforms/adapters.js";
|
|
4
4
|
import { loadSourceCatalog } from "./catalog.js";
|
|
5
|
-
import {
|
|
5
|
+
import { transformContentForTarget } from "./contentTransformer.js";
|
|
6
6
|
/**
|
|
7
7
|
* Runs installation for selected target with optional dry-run and backup.
|
|
8
8
|
* @param options Install options.
|
|
@@ -105,14 +105,6 @@ async function applyOperations(args) {
|
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
let sourceContentForTransform;
|
|
108
|
-
if (operation.transform &&
|
|
109
|
-
args.strictHints &&
|
|
110
|
-
(operation.transform.assetType === "agent" || operation.transform.assetType === "skill")) {
|
|
111
|
-
sourceContentForTransform = await fs.readFile(operation.sourcePath, "utf8");
|
|
112
|
-
if (!hasExplicitTargetHint(sourceContentForTransform, operation.transform.target)) {
|
|
113
|
-
throw new Error(`Strict hints check failed: missing explicit '${operation.transform.target}' hint in ${operation.sourcePath}`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
108
|
if (!args.dryRun && exists && backupDir) {
|
|
117
109
|
const rel = path.relative(args.destinationDir, destination);
|
|
118
110
|
const backupPath = path.join(backupDir, rel);
|