@iaforged/context-code 1.0.79 → 1.0.81
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/src/commands/init.js +17 -16
- package/dist/src/components/LogoV2/FeedColumn.js +3 -4
- package/dist/src/components/LogoV2/LogoV2.js +10 -10
- package/dist/src/components/LogoV2/WelcomeV2.js +1 -1
- package/dist/src/components/agents/AgentsList.js +9 -9
- package/dist/src/components/agents/AgentsMenu.js +3 -3
- package/dist/src/components/agents/ModelSelector.js +204 -52
- package/dist/src/components/agents/new-agent-creation/types.js +1 -0
- package/dist/src/components/agents/utils.js +13 -9
- package/dist/src/projectOnboardingState.js +3 -3
- package/dist/src/tools/AgentTool/agentDisplay.js +18 -10
- package/dist/src/utils/claudemd.js +19 -7
- package/dist/src/utils/model/agent.js +12 -3
- package/dist/src/utils/model/providerOverrideContext.js +11 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { feature } from '../recovery/bunBundleShim.js';
|
|
2
2
|
import { maybeMarkProjectOnboardingComplete } from '../projectOnboardingState.js';
|
|
3
3
|
import { isEnvTruthy } from '../utils/envUtils.js';
|
|
4
|
-
const OLD_INIT_PROMPT = `Please analyze this codebase and create a
|
|
4
|
+
const OLD_INIT_PROMPT = `Please analyze this codebase and create a .context/CONTEXT.md file, which will be given to future instances of Context Code to operate in this repository.
|
|
5
5
|
|
|
6
6
|
What to add:
|
|
7
7
|
1. Commands that will be commonly used, such as how to build, lint, and run tests. Include the necessary commands to develop in this codebase, such as how to run a single test.
|
|
8
8
|
2. High-level code architecture and structure so that future instances can be productive more quickly. Focus on the "big picture" architecture that requires reading multiple files to understand.
|
|
9
9
|
|
|
10
10
|
Usage notes:
|
|
11
|
-
- If there's already a
|
|
12
|
-
- When you make the initial
|
|
11
|
+
- If there's already a .context/CONTEXT.md, suggest improvements to it.
|
|
12
|
+
- When you make the initial .context/CONTEXT.md, do not repeat yourself and do not include obvious instructions like "Provide helpful error messages to users", "Write unit tests for all new utilities", "Never include sensitive information (API keys, tokens) in code or commits".
|
|
13
13
|
- Avoid listing every component or file structure that can be easily discovered.
|
|
14
14
|
- Don't include generic development practices.
|
|
15
15
|
- If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.
|
|
@@ -18,7 +18,7 @@ Usage notes:
|
|
|
18
18
|
- Be sure to prefix the file with the following text:
|
|
19
19
|
|
|
20
20
|
\`\`\`
|
|
21
|
-
#
|
|
21
|
+
# CONTEXT.md
|
|
22
22
|
|
|
23
23
|
This file provides guidance to Context Code when working with code in this repository.
|
|
24
24
|
\`\`\``;
|
|
@@ -28,7 +28,7 @@ const NEW_INIT_PROMPT = `Set up a minimal CLAUDE.md (and optionally skills and h
|
|
|
28
28
|
|
|
29
29
|
Use AskUserQuestion to find out what the user wants:
|
|
30
30
|
|
|
31
|
-
- "Which CLAUDE.md files should /
|
|
31
|
+
- "Which CLAUDE.md files should /iniciar set up?"
|
|
32
32
|
Options: "Project CLAUDE.md" | "Personal CLAUDE.local.md" | "Both project + personal"
|
|
33
33
|
Description for project: "Team-shared instructions checked into source control — architecture, coding standards, common workflows."
|
|
34
34
|
Description for personal: "Your private preferences for this project (gitignored, not shared) — your role, sandbox URLs, preferred test data, workflow quirks."
|
|
@@ -201,7 +201,7 @@ Check the environment and ask about each gap you find (use AskUserQuestion):
|
|
|
201
201
|
- "before committing" (literal git-commit gate) → **not a hooks.json hook.** Matchers can't filter Bash by command content, so there's no way to target only \`git commit\`. Route this to a git pre-commit hook (\`.git/hooks/pre-commit\`, husky, pre-commit framework) instead — offer to write one. If the user actually means "before I review and commit Context's output", that's \`Stop\` — probe to disambiguate.
|
|
202
202
|
Probe if the preference is ambiguous.
|
|
203
203
|
|
|
204
|
-
3. **Load the hook reference** (once per \`/
|
|
204
|
+
3. **Load the hook reference** (once per \`/iniciar\` run, before the first hook): invoke the Skill tool with \`skill: 'update-config'\` and args starting with \`[hooks-only]\` followed by a one-line summary of what you're building — e.g., \`[hooks-only] Constructing a PostToolUse/Write|Edit format hook for .context/settings.json using ruff\`. This loads the hooks schema and verification flow into context. Subsequent hooks reuse it — don't re-invoke.
|
|
205
205
|
|
|
206
206
|
4. Follow the skill's **"Constructing a Hook"** flow: dedup check → construct for THIS project → pipe-test raw → wrap → write JSON → \`jq -e\` validate → live-proof (for \`Pre|PostToolUse\` on triggerable matchers) → cleanup → handoff. Target file and event/matcher come from steps 1–2 above.
|
|
207
207
|
|
|
@@ -209,7 +209,7 @@ Act on each "yes" before moving on.
|
|
|
209
209
|
|
|
210
210
|
## Phase 8: Summary and next steps
|
|
211
211
|
|
|
212
|
-
Recap what was set up — which files were written and the key points included in each. Remind the user these files are a starting point: they should review and tweak them, and can run \`/
|
|
212
|
+
Recap what was set up — which files were written and the key points included in each. Remind the user these files are a starting point: they should review and tweak them, and can run \`/iniciar\` again anytime to re-scan.
|
|
213
213
|
|
|
214
214
|
Then tell the user that you'll be introducing a few more suggestions for optimizing their codebase and Context Code setup based on what you found. Present these as a single, well-formatted to-do list where every item is relevant to this repo. Put the most impactful items first.
|
|
215
215
|
|
|
@@ -221,27 +221,28 @@ When building the list, work through these checks and include only what applies:
|
|
|
221
221
|
- Browse official plugins with \`/plugin\` — these bundle skills, agents, hooks, and MCP servers that you may find helpful. You can also create your own custom plugins to share them with others. (Always include this one.)`;
|
|
222
222
|
const command = {
|
|
223
223
|
type: 'prompt',
|
|
224
|
-
name: '
|
|
224
|
+
name: 'iniciar',
|
|
225
225
|
get description() {
|
|
226
226
|
return feature('NEW_INIT') &&
|
|
227
227
|
(process.env.USER_TYPE === 'ant' ||
|
|
228
228
|
isEnvTruthy(process.env.CLAUDE_CODE_NEW_INIT))
|
|
229
|
-
? 'Inicializar
|
|
230
|
-
: 'Inicializar
|
|
229
|
+
? 'Inicializar .context/CONTEXT.md y habilidades/ganchos opcionales con documentacion de la base de codigo'
|
|
230
|
+
: 'Inicializar .context/CONTEXT.md con documentacion de la base de codigo';
|
|
231
231
|
},
|
|
232
232
|
contentLength: 0, // Dynamic content
|
|
233
|
-
progressMessage: 'analizando tu base de
|
|
233
|
+
progressMessage: 'analizando tu base de codigo',
|
|
234
234
|
source: 'builtin',
|
|
235
235
|
async getPromptForCommand() {
|
|
236
236
|
maybeMarkProjectOnboardingComplete();
|
|
237
|
+
const prompt = feature('NEW_INIT') &&
|
|
238
|
+
(process.env.USER_TYPE === 'ant' ||
|
|
239
|
+
isEnvTruthy(process.env.CLAUDE_CODE_NEW_INIT))
|
|
240
|
+
? NEW_INIT_PROMPT
|
|
241
|
+
: OLD_INIT_PROMPT;
|
|
237
242
|
return [
|
|
238
243
|
{
|
|
239
244
|
type: 'text',
|
|
240
|
-
text:
|
|
241
|
-
(process.env.USER_TYPE === 'ant' ||
|
|
242
|
-
isEnvTruthy(process.env.CLAUDE_CODE_NEW_INIT))
|
|
243
|
-
? NEW_INIT_PROMPT
|
|
244
|
-
: OLD_INIT_PROMPT,
|
|
245
|
+
text: prompt.replaceAll('CLAUDE.md', '.context/CONTEXT.md'),
|
|
245
246
|
},
|
|
246
247
|
];
|
|
247
248
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Box } from '../../ink.js';
|
|
5
|
-
import { Divider } from '../design-system/Divider.js';
|
|
6
5
|
import { calculateFeedWidth, Feed } from './Feed.js';
|
|
7
6
|
export function FeedColumn(t0) {
|
|
8
7
|
const $ = _c(10);
|
|
@@ -23,7 +22,7 @@ export function FeedColumn(t0) {
|
|
|
23
22
|
if ($[2] !== actualWidth || $[3] !== feeds) {
|
|
24
23
|
let t3;
|
|
25
24
|
if ($[5] !== actualWidth || $[6] !== feeds.length) {
|
|
26
|
-
t3 = (feed_0, index) =>
|
|
25
|
+
t3 = (feed_0, index) => _jsx(React.Fragment, { children: _jsx(Feed, { config: feed_0, actualWidth: actualWidth }) }, index);
|
|
27
26
|
$[5] = actualWidth;
|
|
28
27
|
$[6] = feeds.length;
|
|
29
28
|
$[7] = t3;
|
|
@@ -41,7 +40,7 @@ export function FeedColumn(t0) {
|
|
|
41
40
|
}
|
|
42
41
|
let t3;
|
|
43
42
|
if ($[8] !== t2) {
|
|
44
|
-
t3 = _jsx(Box, { flexDirection: "column", children: t2 });
|
|
43
|
+
t3 = _jsx(Box, { flexDirection: "column", gap: 1, children: t2 });
|
|
45
44
|
$[8] = t2;
|
|
46
45
|
$[9] = t3;
|
|
47
46
|
}
|
|
@@ -251,8 +251,8 @@ export function LogoV2() {
|
|
|
251
251
|
}
|
|
252
252
|
const layoutMode = getLayoutMode(columns);
|
|
253
253
|
const userTheme = resolveThemeSetting(getGlobalConfig().theme);
|
|
254
|
-
const borderTitle = ` ${color("claude", userTheme)("
|
|
255
|
-
const compactBorderTitle = color("claude", userTheme)("
|
|
254
|
+
const borderTitle = ` ${color("claude", userTheme)("CTX")} ${color("inactive", userTheme)(`v${version}`)} `;
|
|
255
|
+
const compactBorderTitle = color("claude", userTheme)(" CTX ");
|
|
256
256
|
if (layoutMode === "compact") {
|
|
257
257
|
let welcomeMessage = formatWelcomeMessage(username);
|
|
258
258
|
if (stringWidth(welcomeMessage) > columns - 4) {
|
|
@@ -335,7 +335,7 @@ export function LogoV2() {
|
|
|
335
335
|
t18 = $[42];
|
|
336
336
|
t19 = $[43];
|
|
337
337
|
}
|
|
338
|
-
return _jsxs(_Fragment, { children: [_jsx(OffscreenFreeze, { children: _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "claude", borderText: t11, paddingX:
|
|
338
|
+
return _jsxs(_Fragment, { children: [_jsx(OffscreenFreeze, { children: _jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "claude", borderText: t11, paddingX: 2, paddingY: 1, alignItems: "center", width: columns, children: [_jsx(Text, { color: "claude", children: "CTX" }), _jsx(Text, { bold: true, children: welcomeMessage }), t12, _jsx(Text, { dimColor: true, children: modelDisplayName }), _jsx(Text, { dimColor: true, children: billingType }), agentName ? _jsxs(Text, { dimColor: true, children: ["@", agentName] }) : null, _jsx(Text, { dimColor: true, children: truncatedCwd })] }) }), t14, t15, t16, t17, t18, t19] });
|
|
339
339
|
}
|
|
340
340
|
const welcomeMessage_0 = formatWelcomeMessage(username);
|
|
341
341
|
const modelLine = !process.env.IS_DEMO && config.oauthAccount?.organizationName ? `${modelDisplayName} · ${billingType} · ${config.oauthAccount.organizationName}` : `${modelDisplayName} · ${billingType}`;
|
|
@@ -364,9 +364,9 @@ export function LogoV2() {
|
|
|
364
364
|
t14 = $[45];
|
|
365
365
|
}
|
|
366
366
|
const T2 = Box;
|
|
367
|
-
const t15 =
|
|
368
|
-
const t16 =
|
|
369
|
-
const t17 =
|
|
367
|
+
const t15 = "column";
|
|
368
|
+
const t16 = 2;
|
|
369
|
+
const t17 = 2;
|
|
370
370
|
let t18;
|
|
371
371
|
if ($[46] !== welcomeMessage_0) {
|
|
372
372
|
t18 = _jsx(Box, { marginTop: 1, children: _jsx(Text, { bold: true, children: welcomeMessage_0 }) });
|
|
@@ -404,7 +404,7 @@ export function LogoV2() {
|
|
|
404
404
|
}
|
|
405
405
|
let t22;
|
|
406
406
|
if ($[53] !== t20 || $[54] !== t21) {
|
|
407
|
-
t22 = _jsxs(Box, { flexDirection: "column", alignItems: "center", children: [t20, t21] });
|
|
407
|
+
t22 = _jsxs(Box, { flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: "claude", children: "CTX" }), t20, t21] });
|
|
408
408
|
$[53] = t20;
|
|
409
409
|
$[54] = t21;
|
|
410
410
|
$[55] = t22;
|
|
@@ -414,7 +414,7 @@ export function LogoV2() {
|
|
|
414
414
|
}
|
|
415
415
|
let t23;
|
|
416
416
|
if ($[56] !== leftWidth || $[57] !== t18 || $[58] !== t22) {
|
|
417
|
-
t23 = _jsxs(Box, { flexDirection: "column", width: leftWidth, justifyContent: "space-between", alignItems: "center", minHeight:
|
|
417
|
+
t23 = _jsxs(Box, { flexDirection: "column", width: leftWidth, justifyContent: "space-between", alignItems: "center", minHeight: 11, children: [t18, t19, t22] });
|
|
418
418
|
$[56] = leftWidth;
|
|
419
419
|
$[57] = t18;
|
|
420
420
|
$[58] = t22;
|
|
@@ -425,14 +425,14 @@ export function LogoV2() {
|
|
|
425
425
|
}
|
|
426
426
|
let t24;
|
|
427
427
|
if ($[60] !== layoutMode) {
|
|
428
|
-
t24 =
|
|
428
|
+
t24 = null;
|
|
429
429
|
$[60] = layoutMode;
|
|
430
430
|
$[61] = t24;
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
433
433
|
t24 = $[61];
|
|
434
434
|
}
|
|
435
|
-
const t25 =
|
|
435
|
+
const t25 = _jsx(FeedColumn, { feeds: showOnboarding ? [createProjectOnboardingFeed(getSteps()), createRecentActivityFeed(activities)] : showGuestPassesUpsell ? [createRecentActivityFeed(activities), createGuestPassesFeed()] : showOverageCreditUpsell ? [createRecentActivityFeed(activities), createOverageCreditFeed()] : [createRecentActivityFeed(activities), createWhatsNewFeed(changelog)], maxWidth: Math.max(leftWidth, rightWidth) });
|
|
436
436
|
let t26;
|
|
437
437
|
if ($[62] !== T2 || $[63] !== t15 || $[64] !== t23 || $[65] !== t24 || $[66] !== t25) {
|
|
438
438
|
t26 = _jsxs(T2, { flexDirection: t15, paddingX: t16, gap: t17, children: [t23, t24, t25] });
|
|
@@ -4,5 +4,5 @@ import { Box, Text } from '../../ink.js';
|
|
|
4
4
|
import { Clawd } from './Clawd.js';
|
|
5
5
|
const WELCOME_WIDTH = 54;
|
|
6
6
|
export function WelcomeV2() {
|
|
7
|
-
return (_jsx(Box, { flexDirection: "column", width: WELCOME_WIDTH, children: _jsxs(Box, { borderStyle: "round", borderColor: "claude", paddingX:
|
|
7
|
+
return (_jsx(Box, { flexDirection: "column", width: WELCOME_WIDTH, children: _jsxs(Box, { borderStyle: "round", borderColor: "claude", paddingX: 3, paddingY: 1, flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: "claude", children: "CTX" }), _jsx(Text, { bold: true, children: "Context Code" }), _jsxs(Text, { dimColor: true, children: ["v", MACRO.VERSION] }), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(Clawd, {}) }), _jsx(Text, { children: "Lee, edita y ejecuta sin perder contexto." }), _jsx(Text, { dimColor: true, children: "Configuracion inicial" })] }) }));
|
|
8
8
|
}
|
|
@@ -26,7 +26,7 @@ export function AgentsList(t0) {
|
|
|
26
26
|
const getOverrideInfo = _temp;
|
|
27
27
|
let t2;
|
|
28
28
|
if ($[2] !== isCreateNewSelected) {
|
|
29
|
-
t2 = () => _jsxs(Box, { children: [_jsx(Text, { color: isCreateNewSelected ? "suggestion" : undefined, children: isCreateNewSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { color: isCreateNewSelected ? "suggestion" : undefined, children: "
|
|
29
|
+
t2 = () => _jsxs(Box, { children: [_jsx(Text, { color: isCreateNewSelected ? "suggestion" : undefined, children: isCreateNewSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { color: isCreateNewSelected ? "suggestion" : undefined, children: "Crear nuevo agente" })] });
|
|
30
30
|
$[2] = isCreateNewSelected;
|
|
31
31
|
$[3] = t2;
|
|
32
32
|
}
|
|
@@ -43,7 +43,7 @@ export function AgentsList(t0) {
|
|
|
43
43
|
const dimmed = isBuiltIn || isOverridden;
|
|
44
44
|
const textColor = !isBuiltIn && isSelected ? "suggestion" : undefined;
|
|
45
45
|
const resolvedModel = resolveAgentModelDisplay(agent_0);
|
|
46
|
-
return _jsxs(Box, { children: [_jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: isBuiltIn ? "" : isSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: agent_0.agentType }), resolvedModel && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", resolvedModel] }), agent_0.memory && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", agent_0.memory, "
|
|
46
|
+
return _jsxs(Box, { children: [_jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: isBuiltIn ? "" : isSelected ? `${figures.pointer} ` : " " }), _jsx(Text, { dimColor: dimmed && !isSelected, color: textColor, children: agent_0.agentType }), resolvedModel && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", resolvedModel] }), agent_0.memory && _jsxs(Text, { dimColor: true, color: textColor, children: [" \xB7 ", agent_0.memory, " memoria"] }), overriddenBy && _jsxs(Text, { dimColor: !isSelected, color: isSelected ? "warning" : undefined, children: [" ", figures.warning, " reemplazado por ", getOverrideSourceLabel(overriddenBy)] })] }, `${agent_0.agentType}-${agent_0.source}`);
|
|
47
47
|
};
|
|
48
48
|
$[4] = isCreateNewSelected;
|
|
49
49
|
$[5] = selectedAgent?.agentType;
|
|
@@ -160,7 +160,7 @@ export function AgentsList(t0) {
|
|
|
160
160
|
let t8;
|
|
161
161
|
if ($[23] !== renderAgent || $[24] !== sortedAgents) {
|
|
162
162
|
t8 = t9 => {
|
|
163
|
-
const title = t9 === undefined ? "
|
|
163
|
+
const title = t9 === undefined ? "Integrados (siempre disponibles):" : t9;
|
|
164
164
|
const builtInAgents = sortedAgents.filter(_temp4);
|
|
165
165
|
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsx(Text, { bold: true, dimColor: true, children: title }), builtInAgents.map(renderAgent)] });
|
|
166
166
|
};
|
|
@@ -232,9 +232,9 @@ export function AgentsList(t0) {
|
|
|
232
232
|
let t25;
|
|
233
233
|
let t26;
|
|
234
234
|
if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
|
|
235
|
-
t24 = _jsx(Text, { dimColor: true, children: "No
|
|
236
|
-
t25 = _jsx(Text, { dimColor: true, children: "
|
|
237
|
-
t26 = _jsx(Text, { dimColor: true, children: "
|
|
235
|
+
t24 = _jsx(Text, { dimColor: true, children: "No hay agentes. Crea subagentes especializados a los que Context Code pueda delegar tareas." });
|
|
236
|
+
t25 = _jsx(Text, { dimColor: true, children: "Cada subagente tiene su propia ventana de contexto, prompt de sistema personalizado y herramientas especificas." });
|
|
237
|
+
t26 = _jsx(Text, { dimColor: true, children: "Prueba crear: Revisor de codigo, Simplificador de codigo, Revisor de seguridad, Lider tecnico o Revisor UX." });
|
|
238
238
|
$[58] = t24;
|
|
239
239
|
$[59] = t25;
|
|
240
240
|
$[60] = t26;
|
|
@@ -268,7 +268,7 @@ export function AgentsList(t0) {
|
|
|
268
268
|
}
|
|
269
269
|
let t29;
|
|
270
270
|
if ($[69] !== onBack || $[70] !== sourceTitle || $[71] !== t28) {
|
|
271
|
-
t29 = _jsx(Dialog, { title: sourceTitle, subtitle: "No
|
|
271
|
+
t29 = _jsx(Dialog, { title: sourceTitle, subtitle: "No hay agentes", onCancel: onBack, hideInputGuide: true, children: t28 });
|
|
272
272
|
$[69] = onBack;
|
|
273
273
|
$[70] = sourceTitle;
|
|
274
274
|
$[71] = t28;
|
|
@@ -291,7 +291,7 @@ export function AgentsList(t0) {
|
|
|
291
291
|
else {
|
|
292
292
|
t23 = $[74];
|
|
293
293
|
}
|
|
294
|
-
t18 = `${t23}
|
|
294
|
+
t18 = `${t23} agentes`;
|
|
295
295
|
t19 = onBack;
|
|
296
296
|
t20 = true;
|
|
297
297
|
if ($[75] !== changes) {
|
|
@@ -319,7 +319,7 @@ export function AgentsList(t0) {
|
|
|
319
319
|
t16 = source === "all" ? _jsxs(_Fragment, { children: [AGENT_SOURCE_GROUPS.filter(_temp9).map(t24 => {
|
|
320
320
|
const { label, source: groupSource_0 } = t24;
|
|
321
321
|
return _jsx(React.Fragment, { children: renderAgentGroup(label, sortedAgents.filter(a_7 => a_7.source === groupSource_0)) }, groupSource_0);
|
|
322
|
-
}), builtInAgents_0.length > 0 && _jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsxs(Text, { dimColor: true, children: [_jsx(Text, { bold: true, children: "
|
|
322
|
+
}), builtInAgents_0.length > 0 && _jsxs(Box, { flexDirection: "column", marginBottom: 1, paddingLeft: 2, children: [_jsxs(Text, { dimColor: true, children: [_jsx(Text, { bold: true, children: "Agentes integrados" }), " (siempre disponibles)"] }), builtInAgents_0.map(renderAgent)] })] }) : source === "built-in" ? _jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, italic: true, children: "Los agentes integrados vienen por defecto y no se pueden modificar." }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: sortedAgents.map(agent_2 => renderAgent(agent_2)) })] }) : _jsxs(_Fragment, { children: [sortedAgents.filter(_temp0).map(agent_3 => renderAgent(agent_3)), sortedAgents.some(_temp1) && _jsxs(_Fragment, { children: [_jsx(Divider, {}), renderBuiltInAgentsSection()] })] });
|
|
323
323
|
}
|
|
324
324
|
$[30] = changes;
|
|
325
325
|
$[31] = handleKeyDown;
|
|
@@ -170,7 +170,7 @@ export function AgentsMenu(t0) {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
});
|
|
173
|
-
setChanges(prev_0 => [...prev_0, `
|
|
173
|
+
setChanges(prev_0 => [...prev_0, `Agente eliminado: ${chalk.bold(agent.agentType)}`]);
|
|
174
174
|
setModeState({
|
|
175
175
|
mode: "list-agents",
|
|
176
176
|
source: "all"
|
|
@@ -217,8 +217,8 @@ export function AgentsMenu(t0) {
|
|
|
217
217
|
let t15;
|
|
218
218
|
if ($[34] !== changes || $[35] !== onExit) {
|
|
219
219
|
t15 = () => {
|
|
220
|
-
const exitMessage = changes.length > 0 ? `
|
|
221
|
-
onExit(exitMessage ?? "
|
|
220
|
+
const exitMessage = changes.length > 0 ? `Cambios de agentes:\n${changes.join("\n")}` : undefined;
|
|
221
|
+
onExit(exitMessage ?? "Panel de agentes cerrado", {
|
|
222
222
|
display: changes.length === 0 ? "system" : undefined
|
|
223
223
|
});
|
|
224
224
|
};
|
|
@@ -1,62 +1,214 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { Box, Text } from '../../ink.js';
|
|
4
|
-
import { getAgentModelOptions } from '../../utils/model/agent.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, ...base];
|
|
19
|
-
break bb0;
|
|
20
|
-
}
|
|
21
|
-
t1 = base;
|
|
22
|
-
}
|
|
23
|
-
$[0] = initialModel;
|
|
24
|
-
$[1] = t1;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
t1 = $[1];
|
|
4
|
+
import { getAgentModelDisplay, getAgentModelOptions, } from '../../utils/model/agent.js';
|
|
5
|
+
import { fetchProviderModels, } from '../../utils/model/providerModels.js';
|
|
6
|
+
import { getVisibleProvider, VISIBLE_PROVIDERS, } from '../../utils/model/providerCatalog.js';
|
|
7
|
+
import { toProviderPreference } from '../../utils/model/providerSwitch.js';
|
|
8
|
+
import { getAPIProvider } from '../../utils/model/providers.js';
|
|
9
|
+
import { Select, } from '../CustomSelect/select.js';
|
|
10
|
+
const INHERIT_OPTION = '__inherit_parent__';
|
|
11
|
+
const MANUAL_MODEL_OPTION = '__manual_model__';
|
|
12
|
+
function isClaudeProvider(provider) {
|
|
13
|
+
return provider === 'claude';
|
|
14
|
+
}
|
|
15
|
+
function inferInitialProvider(initialModel, initialProvider) {
|
|
16
|
+
if (initialProvider) {
|
|
17
|
+
return initialProvider;
|
|
28
18
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let t2;
|
|
32
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
-
t2 = _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Model determines the agent's reasoning capabilities and speed." }) });
|
|
34
|
-
$[2] = t2;
|
|
19
|
+
if (!initialModel || initialModel === 'inherit') {
|
|
20
|
+
return undefined;
|
|
35
21
|
}
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
const claudeValues = new Set(getAgentModelOptions().map(option => option.value));
|
|
23
|
+
if (claudeValues.has(initialModel)) {
|
|
24
|
+
return 'claude';
|
|
38
25
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
return toProviderPreference(getAPIProvider());
|
|
27
|
+
}
|
|
28
|
+
function getProviderOptions() {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
value: INHERIT_OPTION,
|
|
32
|
+
label: 'Heredar del padre',
|
|
33
|
+
description: 'Usa el mismo proveedor y modelo de la conversacion principal.',
|
|
34
|
+
},
|
|
35
|
+
...VISIBLE_PROVIDERS.map(provider => ({
|
|
36
|
+
value: provider.id,
|
|
37
|
+
label: provider.label,
|
|
38
|
+
description: provider.description,
|
|
39
|
+
})),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
function mapClaudeModelOptions() {
|
|
43
|
+
return getAgentModelOptions()
|
|
44
|
+
.filter(option => option.value !== 'inherit')
|
|
45
|
+
.map(option => ({
|
|
46
|
+
value: option.value,
|
|
47
|
+
label: option.label,
|
|
48
|
+
description: option.description,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
function mapDynamicModelOptions(models) {
|
|
52
|
+
return models.map(model => ({
|
|
53
|
+
value: model.value,
|
|
54
|
+
label: model.label,
|
|
55
|
+
description: model.description,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
function ensureCurrentModelOption(options, provider, initialModel) {
|
|
59
|
+
if (!initialModel || initialModel === 'inherit') {
|
|
60
|
+
return options;
|
|
45
61
|
}
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
if (options.some(option => option.value === initialModel)) {
|
|
63
|
+
return options;
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
value: initialModel,
|
|
68
|
+
label: getAgentModelDisplay(initialModel, provider),
|
|
69
|
+
description: 'Modelo actual guardado manualmente.',
|
|
70
|
+
},
|
|
71
|
+
...options,
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
function toApiProvider(provider) {
|
|
75
|
+
switch (provider) {
|
|
76
|
+
case 'claude':
|
|
77
|
+
return 'firstParty';
|
|
78
|
+
case 'openai':
|
|
79
|
+
return 'openai';
|
|
80
|
+
case 'openrouter':
|
|
81
|
+
return 'openrouter';
|
|
82
|
+
case 'ollama':
|
|
83
|
+
return 'ollama';
|
|
84
|
+
case 'ollama-cloud':
|
|
85
|
+
return 'ollama-cloud';
|
|
86
|
+
case 'gemini-api':
|
|
87
|
+
return 'gemini-api';
|
|
88
|
+
case 'gemini-google':
|
|
89
|
+
return 'gemini-google';
|
|
90
|
+
case 'zai':
|
|
91
|
+
return 'zai';
|
|
92
|
+
case 'minimax':
|
|
93
|
+
return 'minimax';
|
|
57
94
|
}
|
|
58
|
-
|
|
59
|
-
|
|
95
|
+
}
|
|
96
|
+
export function ModelSelector({ initialModel, initialProvider, onComplete, onCancel, }) {
|
|
97
|
+
const inferredProvider = React.useMemo(() => inferInitialProvider(initialModel, initialProvider), [initialModel, initialProvider]);
|
|
98
|
+
const [step, setStep] = React.useState(inferredProvider ? 'model' : 'provider');
|
|
99
|
+
const [selectedProvider, setSelectedProvider] = React.useState(inferredProvider);
|
|
100
|
+
const [manualModel, setManualModel] = React.useState(initialModel && initialModel !== 'inherit' ? initialModel : '');
|
|
101
|
+
const [providerModels, setProviderModels] = React.useState([]);
|
|
102
|
+
const [isLoadingModels, setIsLoadingModels] = React.useState(false);
|
|
103
|
+
const [loadError, setLoadError] = React.useState(null);
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
if (!selectedProvider || isClaudeProvider(selectedProvider)) {
|
|
106
|
+
setProviderModels([]);
|
|
107
|
+
setIsLoadingModels(false);
|
|
108
|
+
setLoadError(null);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
let cancelled = false;
|
|
112
|
+
const loadModels = async () => {
|
|
113
|
+
setIsLoadingModels(true);
|
|
114
|
+
setLoadError(null);
|
|
115
|
+
try {
|
|
116
|
+
const models = await fetchProviderModels(toApiProvider(selectedProvider));
|
|
117
|
+
if (cancelled) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
setProviderModels(models);
|
|
121
|
+
if (models.length === 0) {
|
|
122
|
+
const providerLabel = getVisibleProvider(selectedProvider).label;
|
|
123
|
+
setLoadError(`No se pudieron cargar modelos de ${providerLabel}. Puedes escribir el ID manualmente.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
if (cancelled) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
setProviderModels([]);
|
|
131
|
+
setLoadError(error instanceof Error
|
|
132
|
+
? error.message
|
|
133
|
+
: 'No se pudieron cargar los modelos del proveedor.');
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
if (!cancelled) {
|
|
137
|
+
setIsLoadingModels(false);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
void loadModels();
|
|
142
|
+
return () => {
|
|
143
|
+
cancelled = true;
|
|
144
|
+
};
|
|
145
|
+
}, [selectedProvider]);
|
|
146
|
+
const providerOptions = React.useMemo(() => getProviderOptions(), []);
|
|
147
|
+
const modelOptions = React.useMemo(() => {
|
|
148
|
+
if (!selectedProvider) {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
const baseOptions = isClaudeProvider(selectedProvider)
|
|
152
|
+
? mapClaudeModelOptions()
|
|
153
|
+
: mapDynamicModelOptions(providerModels);
|
|
154
|
+
const optionsWithCurrent = ensureCurrentModelOption(baseOptions, selectedProvider, initialModel);
|
|
155
|
+
const withManualOption = [
|
|
156
|
+
...optionsWithCurrent,
|
|
157
|
+
{
|
|
158
|
+
type: 'input',
|
|
159
|
+
value: MANUAL_MODEL_OPTION,
|
|
160
|
+
label: 'Modelo manual',
|
|
161
|
+
description: 'Escribe el ID exacto si no aparece en la lista.',
|
|
162
|
+
placeholder: 'ID del modelo',
|
|
163
|
+
initialValue: manualModel,
|
|
164
|
+
onChange: value => setManualModel(value),
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
return withManualOption;
|
|
168
|
+
}, [initialModel, manualModel, providerModels, selectedProvider]);
|
|
169
|
+
const providerDescription = selectedProvider
|
|
170
|
+
? getVisibleProvider(selectedProvider).label
|
|
171
|
+
: undefined;
|
|
172
|
+
const defaultModelValue = React.useMemo(() => {
|
|
173
|
+
if (!selectedProvider) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
if (!initialModel || initialModel === 'inherit') {
|
|
177
|
+
return modelOptions[0]?.value;
|
|
178
|
+
}
|
|
179
|
+
return modelOptions.some(option => option.value === initialModel)
|
|
180
|
+
? initialModel
|
|
181
|
+
: MANUAL_MODEL_OPTION;
|
|
182
|
+
}, [initialModel, modelOptions, selectedProvider]);
|
|
183
|
+
if (step === 'provider') {
|
|
184
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Elige si este agente debe heredar el proveedor del hilo o quedar fijo a un proveedor concreto." }) }), _jsx(Select, { options: providerOptions, defaultValue: selectedProvider ? selectedProvider : INHERIT_OPTION, layout: "compact-vertical", onChange: value => {
|
|
185
|
+
if (value === INHERIT_OPTION) {
|
|
186
|
+
onComplete({ model: 'inherit' });
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
setSelectedProvider(value);
|
|
190
|
+
setStep('model');
|
|
191
|
+
}, onCancel: onCancel })] }));
|
|
60
192
|
}
|
|
61
|
-
return
|
|
193
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { marginBottom: 1, flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: providerDescription
|
|
194
|
+
? `Proveedor seleccionado: ${providerDescription}`
|
|
195
|
+
: 'Proveedor seleccionado' }), _jsx(Text, { dimColor: true, children: "Para volver a elegir proveedor, presiona `Esc`." })] }), isLoadingModels ? (_jsx(Text, { dimColor: true, children: "Cargando modelos..." })) : (_jsx(Select, { options: modelOptions, defaultValue: defaultModelValue, layout: "compact-vertical", onChange: value => {
|
|
196
|
+
if (value === MANUAL_MODEL_OPTION) {
|
|
197
|
+
const trimmed = manualModel.trim();
|
|
198
|
+
if (!trimmed) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
onComplete({
|
|
202
|
+
provider: selectedProvider,
|
|
203
|
+
model: trimmed,
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
onComplete({
|
|
208
|
+
provider: selectedProvider,
|
|
209
|
+
model: value,
|
|
210
|
+
});
|
|
211
|
+
}, onCancel: () => {
|
|
212
|
+
setStep('provider');
|
|
213
|
+
} })), loadError ? (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "warning", children: loadError }) })) : null] }));
|
|
62
214
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import capitalize from 'lodash-es/capitalize.js';
|
|
2
2
|
import { getSettingSourceName } from '../../utils/settings/constants.js';
|
|
3
|
+
const SOURCE_DISPLAY_NAMES = {
|
|
4
|
+
all: 'Agentes',
|
|
5
|
+
'built-in': 'Agentes integrados',
|
|
6
|
+
plugin: 'Agentes de plugins',
|
|
7
|
+
userSettings: 'Agentes de usuario',
|
|
8
|
+
projectSettings: 'Agentes del proyecto',
|
|
9
|
+
localSettings: 'Agentes locales',
|
|
10
|
+
policySettings: 'Agentes administrados',
|
|
11
|
+
flagSettings: 'Agentes por argumento CLI',
|
|
12
|
+
};
|
|
3
13
|
export function getAgentSourceDisplayName(source) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (source === 'built-in') {
|
|
8
|
-
return 'Built-in agents';
|
|
9
|
-
}
|
|
10
|
-
if (source === 'plugin') {
|
|
11
|
-
return 'Plugin agents';
|
|
12
|
-
}
|
|
14
|
+
const translatedName = SOURCE_DISPLAY_NAMES[source];
|
|
15
|
+
if (translatedName)
|
|
16
|
+
return translatedName;
|
|
13
17
|
return capitalize(getSettingSourceName(source));
|
|
14
18
|
}
|
|
@@ -5,7 +5,7 @@ import { getCwd } from './utils/cwd.js';
|
|
|
5
5
|
import { isDirEmpty } from './utils/file.js';
|
|
6
6
|
import { getFsImplementation } from './utils/fsOperations.js';
|
|
7
7
|
export function getSteps() {
|
|
8
|
-
const
|
|
8
|
+
const hasContextMd = getFsImplementation().existsSync(join(getCwd(), '.context', 'CONTEXT.md'));
|
|
9
9
|
const isWorkspaceDirEmpty = isDirEmpty(getCwd());
|
|
10
10
|
return [
|
|
11
11
|
{
|
|
@@ -17,8 +17,8 @@ export function getSteps() {
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
key: 'claudemd',
|
|
20
|
-
text: 'Ejecuta /
|
|
21
|
-
isComplete:
|
|
20
|
+
text: 'Ejecuta /iniciar para crear .context/CONTEXT.md con instrucciones para Context Code',
|
|
21
|
+
isComplete: hasContextMd,
|
|
22
22
|
isCompletable: true,
|
|
23
23
|
isEnabled: !isWorkspaceDirEmpty,
|
|
24
24
|
},
|
|
@@ -3,19 +3,27 @@
|
|
|
3
3
|
* Used by both the CLI `claude agents` handler and the interactive `/agents` command.
|
|
4
4
|
*/
|
|
5
5
|
import { getDefaultSubagentModel } from '../../utils/model/agent.js';
|
|
6
|
-
|
|
6
|
+
const OVERRIDE_SOURCE_LABELS = {
|
|
7
|
+
userSettings: 'usuario',
|
|
8
|
+
projectSettings: 'proyecto',
|
|
9
|
+
localSettings: 'local',
|
|
10
|
+
policySettings: 'administrado',
|
|
11
|
+
flagSettings: 'argumento CLI',
|
|
12
|
+
'built-in': 'integrado',
|
|
13
|
+
plugin: 'plugin',
|
|
14
|
+
};
|
|
7
15
|
/**
|
|
8
16
|
* Ordered list of agent source groups for display.
|
|
9
17
|
* Both the CLI and interactive UI should use this to ensure consistent ordering.
|
|
10
18
|
*/
|
|
11
19
|
export const AGENT_SOURCE_GROUPS = [
|
|
12
|
-
{ label: '
|
|
13
|
-
{ label: '
|
|
14
|
-
{ label: '
|
|
15
|
-
{ label: '
|
|
16
|
-
{ label: '
|
|
17
|
-
{ label: '
|
|
18
|
-
{ label: '
|
|
20
|
+
{ label: 'Agentes de usuario', source: 'userSettings' },
|
|
21
|
+
{ label: 'Agentes del proyecto', source: 'projectSettings' },
|
|
22
|
+
{ label: 'Agentes locales', source: 'localSettings' },
|
|
23
|
+
{ label: 'Agentes administrados', source: 'policySettings' },
|
|
24
|
+
{ label: 'Agentes de plugins', source: 'plugin' },
|
|
25
|
+
{ label: 'Agentes por argumento CLI', source: 'flagSettings' },
|
|
26
|
+
{ label: 'Agentes integrados', source: 'built-in' },
|
|
19
27
|
];
|
|
20
28
|
/**
|
|
21
29
|
* Annotate agents with override information by comparing against the active
|
|
@@ -53,14 +61,14 @@ export function resolveAgentModelDisplay(agent) {
|
|
|
53
61
|
const model = agent.model || getDefaultSubagentModel();
|
|
54
62
|
if (!model)
|
|
55
63
|
return undefined;
|
|
56
|
-
return model === 'inherit' ? '
|
|
64
|
+
return model === 'inherit' ? 'heredar' : model;
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
67
|
* Get a human-readable label for the source that overrides an agent.
|
|
60
68
|
* Returns lowercase, e.g. "user", "project", "managed".
|
|
61
69
|
*/
|
|
62
70
|
export function getOverrideSourceLabel(source) {
|
|
63
|
-
return
|
|
71
|
+
return OVERRIDE_SOURCE_LABELS[source];
|
|
64
72
|
}
|
|
65
73
|
/**
|
|
66
74
|
* Compare agents alphabetically by name (case-insensitive).
|
|
@@ -6,7 +6,7 @@ const require = createRequire(import.meta.url);
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Managed memory (eg. /etc/claude-code/CLAUDE.md) - Global instructions for all users
|
|
8
8
|
* 2. User memory (~/.context/CLAUDE.md) - Private global instructions for all projects
|
|
9
|
-
* 3. Project memory (CLAUDE.md, .context/CLAUDE.md, and .context/rules/*.md in project roots) - Instructions checked into the codebase
|
|
9
|
+
* 3. Project memory (CLAUDE.md, .context/CONTEXT.md, .context/CLAUDE.md, and .context/rules/*.md in project roots) - Instructions checked into the codebase
|
|
10
10
|
* 4. Local memory (CLAUDE.local.md in project roots) - Private project-specific instructions
|
|
11
11
|
*
|
|
12
12
|
* Files are loaded in reverse order of priority, i.e. the latest files are highest priority
|
|
@@ -16,7 +16,7 @@ const require = createRequire(import.meta.url);
|
|
|
16
16
|
* - User memory is loaded from the user's home directory
|
|
17
17
|
* - Project and Local files are discovered by traversing from the current directory up to root
|
|
18
18
|
* - Files closer to the current directory have higher priority (loaded later)
|
|
19
|
-
* - CLAUDE.md, .context/CLAUDE.md, and all .md files in .context/rules/ are checked in each directory for Project memory
|
|
19
|
+
* - CLAUDE.md, .context/CONTEXT.md, .context/CLAUDE.md, and all .md files in .context/rules/ are checked in each directory for Project memory
|
|
20
20
|
*
|
|
21
21
|
* Memory @include directive:
|
|
22
22
|
* - Memory files can include other files using @ notation
|
|
@@ -668,7 +668,10 @@ export const getMemoryFiles = memoize(async (forceIncludeExternal = false) => {
|
|
|
668
668
|
if (isSettingSourceEnabled('projectSettings') && !skipProject) {
|
|
669
669
|
const projectPath = join(dir, 'CLAUDE.md');
|
|
670
670
|
result.push(...(await processMemoryFile(projectPath, 'Project', processedPaths, includeExternal)));
|
|
671
|
-
// Try reading .context/
|
|
671
|
+
// Try reading .context/CONTEXT.md (Project)
|
|
672
|
+
const dotContextContextPath = join(dir, '.context', 'CONTEXT.md');
|
|
673
|
+
result.push(...(await processMemoryFile(dotContextContextPath, 'Project', processedPaths, includeExternal)));
|
|
674
|
+
// Try reading .context/CLAUDE.md (Project, legacy)
|
|
672
675
|
const dotContextPath = join(dir, '.context', 'CLAUDE.md');
|
|
673
676
|
result.push(...(await processMemoryFile(dotContextPath, 'Project', processedPaths, includeExternal)));
|
|
674
677
|
// Try reading .context/rules/*.md files (Project)
|
|
@@ -697,7 +700,10 @@ export const getMemoryFiles = memoize(async (forceIncludeExternal = false) => {
|
|
|
697
700
|
// Try reading CLAUDE.md from the additional directory
|
|
698
701
|
const projectPath = join(dir, 'CLAUDE.md');
|
|
699
702
|
result.push(...(await processMemoryFile(projectPath, 'Project', processedPaths, includeExternal)));
|
|
700
|
-
// Try reading .context/
|
|
703
|
+
// Try reading .context/CONTEXT.md from the additional directory
|
|
704
|
+
const dotContextContextPath = join(dir, '.context', 'CONTEXT.md');
|
|
705
|
+
result.push(...(await processMemoryFile(dotContextContextPath, 'Project', processedPaths, includeExternal)));
|
|
706
|
+
// Try reading .context/CLAUDE.md from the additional directory (legacy)
|
|
701
707
|
const dotContextPath = join(dir, '.context', 'CLAUDE.md');
|
|
702
708
|
result.push(...(await processMemoryFile(dotContextPath, 'Project', processedPaths, includeExternal)));
|
|
703
709
|
// Try reading .context/rules/*.md files from the additional directory
|
|
@@ -900,7 +906,7 @@ export async function getManagedAndUserConditionalRules(targetPath, processedPat
|
|
|
900
906
|
}
|
|
901
907
|
/**
|
|
902
908
|
* Gets memory files for a single nested directory (between CWD and target).
|
|
903
|
-
* Loads CLAUDE.md, unconditional rules, and conditional rules for that directory.
|
|
909
|
+
* Loads CLAUDE.md/.context/CONTEXT.md, unconditional rules, and conditional rules for that directory.
|
|
904
910
|
*
|
|
905
911
|
* @param dir The directory to process
|
|
906
912
|
* @param targetPath The target file path (for conditional rule matching)
|
|
@@ -909,10 +915,12 @@ export async function getManagedAndUserConditionalRules(targetPath, processedPat
|
|
|
909
915
|
*/
|
|
910
916
|
export async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths) {
|
|
911
917
|
const result = [];
|
|
912
|
-
// Process project memory files (CLAUDE.md and .context/CLAUDE.md)
|
|
918
|
+
// Process project memory files (CLAUDE.md, .context/CONTEXT.md, and .context/CLAUDE.md)
|
|
913
919
|
if (isSettingSourceEnabled('projectSettings')) {
|
|
914
920
|
const projectPath = join(dir, 'CLAUDE.md');
|
|
915
921
|
result.push(...(await processMemoryFile(projectPath, 'Project', processedPaths, false)));
|
|
922
|
+
const dotContextContextPath = join(dir, '.context', 'CONTEXT.md');
|
|
923
|
+
result.push(...(await processMemoryFile(dotContextContextPath, 'Project', processedPaths, false)));
|
|
916
924
|
const dotContextPath = join(dir, '.context', 'CLAUDE.md');
|
|
917
925
|
result.push(...(await processMemoryFile(dotContextPath, 'Project', processedPaths, false)));
|
|
918
926
|
}
|
|
@@ -1016,7 +1024,7 @@ export async function shouldShowClaudeMdExternalIncludesWarning() {
|
|
|
1016
1024
|
return hasExternalClaudeMdIncludes(await getMemoryFiles(true));
|
|
1017
1025
|
}
|
|
1018
1026
|
/**
|
|
1019
|
-
* Check if a file path is a memory file (CLAUDE.md, CLAUDE.local.md, or .context/rules/*.md)
|
|
1027
|
+
* Check if a file path is a memory file (CLAUDE.md, .context/CONTEXT.md, CLAUDE.local.md, or .context/rules/*.md)
|
|
1020
1028
|
*/
|
|
1021
1029
|
export function isMemoryFilePath(filePath) {
|
|
1022
1030
|
const name = basename(filePath);
|
|
@@ -1024,6 +1032,10 @@ export function isMemoryFilePath(filePath) {
|
|
|
1024
1032
|
if (name === 'CLAUDE.md' || name === 'CLAUDE.local.md') {
|
|
1025
1033
|
return true;
|
|
1026
1034
|
}
|
|
1035
|
+
if (name === 'CONTEXT.md' &&
|
|
1036
|
+
filePath.includes(`${sep}.context${sep}`)) {
|
|
1037
|
+
return true;
|
|
1038
|
+
}
|
|
1027
1039
|
// .md files in .context/rules/ directories
|
|
1028
1040
|
if (name.endsWith('.md') &&
|
|
1029
1041
|
filePath.includes(`${sep}.context${sep}rules${sep}`)) {
|
|
@@ -2,6 +2,7 @@ import { capitalize } from '../stringUtils.js';
|
|
|
2
2
|
import { MODEL_ALIASES } from './aliases.js';
|
|
3
3
|
import { applyBedrockRegionPrefix, getBedrockRegionPrefix } from './bedrock.js';
|
|
4
4
|
import { getCanonicalName, getRuntimeMainLoopModel, parseUserSpecifiedModel, } from './model.js';
|
|
5
|
+
import { getVisibleProvider } from './providerCatalog.js';
|
|
5
6
|
import { getAPIProvider } from './providers.js';
|
|
6
7
|
export const AGENT_MODEL_OPTIONS = [...MODEL_ALIASES, 'inherit'];
|
|
7
8
|
/**
|
|
@@ -91,14 +92,22 @@ function aliasMatchesParentTier(alias, parentModel) {
|
|
|
91
92
|
return false;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
export function getAgentModelDisplay(model) {
|
|
95
|
+
export function getAgentModelDisplay(model, provider) {
|
|
95
96
|
// When model is omitted, getDefaultSubagentModel() returns 'inherit' at runtime
|
|
96
97
|
if (!model)
|
|
97
|
-
return '
|
|
98
|
+
return 'Heredar del padre (predeterminado)';
|
|
98
99
|
if (model === 'inherit')
|
|
99
|
-
return '
|
|
100
|
+
return 'Heredar del padre';
|
|
101
|
+
if (provider && provider !== 'claude')
|
|
102
|
+
return model;
|
|
100
103
|
return capitalize(model);
|
|
101
104
|
}
|
|
105
|
+
export function getAgentProviderDisplay(provider) {
|
|
106
|
+
if (!provider) {
|
|
107
|
+
return 'Heredar del padre';
|
|
108
|
+
}
|
|
109
|
+
return getVisibleProvider(provider).label;
|
|
110
|
+
}
|
|
102
111
|
/**
|
|
103
112
|
* Get available model options for agents
|
|
104
113
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
|
+
const providerOverrideStorage = new AsyncLocalStorage();
|
|
3
|
+
export function getProviderOverride() {
|
|
4
|
+
return providerOverrideStorage.getStore();
|
|
5
|
+
}
|
|
6
|
+
export function runWithProviderOverride(provider, fn) {
|
|
7
|
+
if (!provider) {
|
|
8
|
+
return fn();
|
|
9
|
+
}
|
|
10
|
+
return providerOverrideStorage.run(provider, fn);
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iaforged/context-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.81",
|
|
4
4
|
"description": "Context Code es un asistente de desarrollo para la terminal. Puede revisar tu proyecto, editar archivos, ejecutar comandos y apoyarte en tareas reales de programacion.",
|
|
5
5
|
"author": "Context AI",
|
|
6
6
|
"license": "MIT",
|