crewbee 0.1.12 → 0.1.13
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 +175 -269
- package/README.zh-CN.md +157 -271
- package/dist/opencode-plugin.mjs +134 -53
- package/dist/src/adapters/opencode/prompt-builder.js +7 -7
- package/dist/src/adapters/opencode/prompt-builder.js.map +1 -1
- package/dist/src/agent-teams/constants.d.ts +5 -0
- package/dist/src/agent-teams/constants.d.ts.map +1 -1
- package/dist/src/agent-teams/constants.js +6 -1
- package/dist/src/agent-teams/constants.js.map +1 -1
- package/dist/src/agent-teams/filesystem.d.ts +2 -1
- package/dist/src/agent-teams/filesystem.d.ts.map +1 -1
- package/dist/src/agent-teams/filesystem.js +94 -5
- package/dist/src/agent-teams/filesystem.js.map +1 -1
- package/dist/src/cli/doctor.js +1 -1
- package/dist/src/cli/doctor.js.map +1 -1
- package/dist/src/cli/package-version.d.ts.map +1 -0
- package/dist/src/cli/package-version.js.map +1 -0
- package/dist/src/cli/version.js +1 -1
- package/dist/src/cli/version.js.map +1 -1
- package/dist/src/install/types.d.ts +1 -1
- package/dist/src/install/types.d.ts.map +1 -1
- package/dist/src/normalize/build-agent-prompt-document.d.ts +6 -0
- package/dist/src/normalize/build-agent-prompt-document.d.ts.map +1 -0
- package/dist/src/normalize/{build-agent-prompt-source.js → build-agent-prompt-document.js} +6 -6
- package/dist/src/normalize/build-agent-prompt-document.js.map +1 -0
- package/dist/src/normalize/{build-team-prompt-source.d.ts → build-team-prompt-document.d.ts} +2 -2
- package/dist/src/normalize/build-team-prompt-document.d.ts.map +1 -0
- package/dist/src/normalize/{build-team-prompt-source.js → build-team-prompt-document.js} +3 -3
- package/dist/src/normalize/build-team-prompt-document.js.map +1 -0
- package/dist/src/render/apply-prompt-projection.d.ts.map +1 -0
- package/dist/src/render/apply-prompt-projection.js.map +1 -0
- package/dist/src/render/build-prompt-catalog.d.ts.map +1 -0
- package/dist/src/render/build-prompt-catalog.js.map +1 -0
- package/dist/src/render/build-prompt-plan.d.ts.map +1 -0
- package/dist/src/render/build-prompt-plan.js.map +1 -0
- package/dist/src/render/prompt-document-renderer.js +3 -3
- package/dist/src/render/prompt-document-renderer.js.map +1 -1
- package/dist/src/render/structural-renderer.js +1 -1
- package/dist/src/render/structural-renderer.js.map +1 -1
- package/package.json +2 -2
- package/templates/crewbee.json +1 -0
- package/dist/src/catalog/build-prompt-catalog.d.ts.map +0 -1
- package/dist/src/catalog/build-prompt-catalog.js.map +0 -1
- package/dist/src/manager/index.d.ts +0 -24
- package/dist/src/manager/index.d.ts.map +0 -1
- package/dist/src/manager/index.js +0 -68
- package/dist/src/manager/index.js.map +0 -1
- package/dist/src/normalize/build-agent-prompt-source.d.ts +0 -6
- package/dist/src/normalize/build-agent-prompt-source.d.ts.map +0 -1
- package/dist/src/normalize/build-agent-prompt-source.js.map +0 -1
- package/dist/src/normalize/build-team-prompt-source.d.ts.map +0 -1
- package/dist/src/normalize/build-team-prompt-source.js.map +0 -1
- package/dist/src/plan/build-prompt-plan.d.ts.map +0 -1
- package/dist/src/plan/build-prompt-plan.js.map +0 -1
- package/dist/src/projection/apply-prompt-projection.d.ts.map +0 -1
- package/dist/src/projection/apply-prompt-projection.js.map +0 -1
- package/dist/src/version/package-version.d.ts.map +0 -1
- package/dist/src/version/package-version.js.map +0 -1
- /package/dist/src/{version → cli}/package-version.d.ts +0 -0
- /package/dist/src/{version → cli}/package-version.js +0 -0
- /package/dist/src/{projection → render}/apply-prompt-projection.d.ts +0 -0
- /package/dist/src/{projection → render}/apply-prompt-projection.js +0 -0
- /package/dist/src/{catalog → render}/build-prompt-catalog.d.ts +0 -0
- /package/dist/src/{catalog → render}/build-prompt-catalog.js +0 -0
- /package/dist/src/{plan → render}/build-prompt-plan.d.ts +0 -0
- /package/dist/src/{plan → render}/build-prompt-plan.js +0 -0
package/dist/opencode-plugin.mjs
CHANGED
|
@@ -1435,6 +1435,7 @@ var require_stringify = __commonJS({
|
|
|
1435
1435
|
nullStr: "null",
|
|
1436
1436
|
simpleKeys: false,
|
|
1437
1437
|
singleQuote: null,
|
|
1438
|
+
trailingComma: false,
|
|
1438
1439
|
trueStr: "true",
|
|
1439
1440
|
verifyAliasOrder: true
|
|
1440
1441
|
}, doc.schema.toStringOptions, options);
|
|
@@ -1952,12 +1953,19 @@ ${indent}${line}` : "\n";
|
|
|
1952
1953
|
if (comment)
|
|
1953
1954
|
reqNewline = true;
|
|
1954
1955
|
let str = stringify.stringify(item, itemCtx, () => comment = null);
|
|
1955
|
-
|
|
1956
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
|
|
1957
|
+
if (i < items.length - 1) {
|
|
1956
1958
|
str += ",";
|
|
1959
|
+
} else if (ctx.options.trailingComma) {
|
|
1960
|
+
if (ctx.options.lineWidth > 0) {
|
|
1961
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
|
|
1962
|
+
}
|
|
1963
|
+
if (reqNewline) {
|
|
1964
|
+
str += ",";
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1957
1967
|
if (comment)
|
|
1958
1968
|
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
1959
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
|
|
1960
|
-
reqNewline = true;
|
|
1961
1969
|
lines.push(str);
|
|
1962
1970
|
linesAtValue = lines.length;
|
|
1963
1971
|
}
|
|
@@ -4971,17 +4979,22 @@ var require_compose_node = __commonJS({
|
|
|
4971
4979
|
case "block-map":
|
|
4972
4980
|
case "block-seq":
|
|
4973
4981
|
case "flow-collection":
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4982
|
+
try {
|
|
4983
|
+
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
|
4984
|
+
if (anchor)
|
|
4985
|
+
node.anchor = anchor.source.substring(1);
|
|
4986
|
+
} catch (error45) {
|
|
4987
|
+
const message = error45 instanceof Error ? error45.message : String(error45);
|
|
4988
|
+
onError(token, "RESOURCE_EXHAUSTION", message);
|
|
4989
|
+
}
|
|
4977
4990
|
break;
|
|
4978
4991
|
default: {
|
|
4979
4992
|
const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
4980
4993
|
onError(token, "UNEXPECTED_TOKEN", message);
|
|
4981
|
-
node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
|
|
4982
4994
|
isSrcToken = false;
|
|
4983
4995
|
}
|
|
4984
4996
|
}
|
|
4997
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
4985
4998
|
if (anchor && node.anchor === "")
|
|
4986
4999
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
4987
5000
|
if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
@@ -7334,6 +7347,7 @@ var EMBEDDED_TEAM_IDS = [BUILTIN_CODING_TEAM_ID];
|
|
|
7334
7347
|
var BUILTIN_CODING_TEAM_MODEL_PRESET = "sota-2026-05";
|
|
7335
7348
|
var BUILTIN_CODING_TEAM_MODEL_FALLBACK = "builtin-role-chain";
|
|
7336
7349
|
var BUILTIN_CODING_TEAM_FALLBACK_TO_HOST_DEFAULT = true;
|
|
7350
|
+
var CREWBEE_CONFIG_VERSION = 2;
|
|
7337
7351
|
var BUILTIN_CODING_TEAM_AGENT_MODELS = {
|
|
7338
7352
|
"coding-leader": "openai/gpt-5.5",
|
|
7339
7353
|
"coordination-leader": "openai/gpt-5.5",
|
|
@@ -10613,6 +10627,7 @@ function createDefaultCrewBeeConfig() {
|
|
|
10613
10627
|
}
|
|
10614
10628
|
}
|
|
10615
10629
|
return {
|
|
10630
|
+
config_version: CREWBEE_CONFIG_VERSION,
|
|
10616
10631
|
teams: [createDefaultCodingTeamConfigEntry()]
|
|
10617
10632
|
};
|
|
10618
10633
|
}
|
|
@@ -10671,6 +10686,65 @@ function createUpdatedCrewBeeConfigWithDefaultTeam(config2) {
|
|
|
10671
10686
|
}
|
|
10672
10687
|
};
|
|
10673
10688
|
}
|
|
10689
|
+
function migrateCrewBeeConfig(existing) {
|
|
10690
|
+
const currentVersion = typeof existing.config_version === "number" ? existing.config_version : 1;
|
|
10691
|
+
if (currentVersion >= CREWBEE_CONFIG_VERSION) {
|
|
10692
|
+
return { changed: false, config: existing };
|
|
10693
|
+
}
|
|
10694
|
+
const defaults = createDefaultCrewBeeConfig();
|
|
10695
|
+
const migrated = { ...existing };
|
|
10696
|
+
migrated.config_version = CREWBEE_CONFIG_VERSION;
|
|
10697
|
+
for (const key of Object.keys(defaults)) {
|
|
10698
|
+
if (!(key in migrated)) {
|
|
10699
|
+
migrated[key] = defaults[key];
|
|
10700
|
+
}
|
|
10701
|
+
}
|
|
10702
|
+
const existingTeams = Array.isArray(migrated.teams) ? migrated.teams : [];
|
|
10703
|
+
const defaultTeams = defaults.teams ?? [];
|
|
10704
|
+
const mergedTeams = existingTeams.map((entry) => {
|
|
10705
|
+
if (!isRecord3(entry)) return entry;
|
|
10706
|
+
const teamId = getOptionalString(entry.id);
|
|
10707
|
+
if (!teamId) return entry;
|
|
10708
|
+
const defaultEntry = defaultTeams.find(
|
|
10709
|
+
(d) => isRecord3(d) && d.id === teamId
|
|
10710
|
+
);
|
|
10711
|
+
if (!defaultEntry || !isRecord3(defaultEntry)) return entry;
|
|
10712
|
+
const merged = { ...entry };
|
|
10713
|
+
for (const key of Object.keys(defaultEntry)) {
|
|
10714
|
+
if (!(key in merged)) {
|
|
10715
|
+
merged[key] = defaultEntry[key];
|
|
10716
|
+
}
|
|
10717
|
+
}
|
|
10718
|
+
if (isRecord3(defaultEntry.agents)) {
|
|
10719
|
+
const existingAgents = isRecord3(merged.agents) ? { ...merged.agents } : {};
|
|
10720
|
+
for (const [agentId, agentConfig] of Object.entries(defaultEntry.agents)) {
|
|
10721
|
+
if (!(agentId in existingAgents)) {
|
|
10722
|
+
existingAgents[agentId] = agentConfig;
|
|
10723
|
+
}
|
|
10724
|
+
}
|
|
10725
|
+
merged.agents = existingAgents;
|
|
10726
|
+
}
|
|
10727
|
+
return merged;
|
|
10728
|
+
});
|
|
10729
|
+
for (const defaultEntry of defaultTeams) {
|
|
10730
|
+
if (!isRecord3(defaultEntry)) continue;
|
|
10731
|
+
const defaultId = getOptionalString(defaultEntry.id);
|
|
10732
|
+
const defaultPath = getOptionalString(defaultEntry.path);
|
|
10733
|
+
const key = defaultId ?? defaultPath;
|
|
10734
|
+
if (!key) continue;
|
|
10735
|
+
const alreadyExists = mergedTeams.some((entry) => {
|
|
10736
|
+
if (!isRecord3(entry)) return false;
|
|
10737
|
+
if (defaultId) return entry.id === defaultId;
|
|
10738
|
+
if (defaultPath) return entry.path === defaultPath;
|
|
10739
|
+
return false;
|
|
10740
|
+
});
|
|
10741
|
+
if (!alreadyExists) {
|
|
10742
|
+
mergedTeams.push(defaultEntry);
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10745
|
+
migrated.teams = mergedTeams;
|
|
10746
|
+
return { changed: true, config: migrated };
|
|
10747
|
+
}
|
|
10674
10748
|
function ensureCrewBeeConfigFile(input) {
|
|
10675
10749
|
const configRoot = input.configRoot ?? resolveOpenCodeConfigRoot();
|
|
10676
10750
|
const configPath = resolveCrewBeeConfigPath(configRoot);
|
|
@@ -10700,14 +10774,21 @@ function ensureCrewBeeConfigFile(input) {
|
|
|
10700
10774
|
};
|
|
10701
10775
|
}
|
|
10702
10776
|
if (input.mode === "startup") {
|
|
10777
|
+
const migration2 = migrateCrewBeeConfig(parsed.config);
|
|
10778
|
+
if (migration2.changed && !input.dryRun) {
|
|
10779
|
+
writeCrewBeeConfig(configPath, migration2.config);
|
|
10780
|
+
}
|
|
10703
10781
|
return {
|
|
10704
|
-
changed:
|
|
10782
|
+
changed: migration2.changed,
|
|
10705
10783
|
configPath,
|
|
10706
|
-
reason: "unchanged"
|
|
10784
|
+
reason: migration2.changed ? "migrated-config-version" : "unchanged"
|
|
10707
10785
|
};
|
|
10708
10786
|
}
|
|
10709
10787
|
const updated = createUpdatedCrewBeeConfigWithDefaultTeam(parsed.config);
|
|
10710
|
-
|
|
10788
|
+
const migration = migrateCrewBeeConfig(updated.next);
|
|
10789
|
+
const finalConfig = migration.config;
|
|
10790
|
+
const changed = updated.changed || migration.changed;
|
|
10791
|
+
if (!changed) {
|
|
10711
10792
|
return {
|
|
10712
10793
|
changed: false,
|
|
10713
10794
|
configPath,
|
|
@@ -10715,12 +10796,12 @@ function ensureCrewBeeConfigFile(input) {
|
|
|
10715
10796
|
};
|
|
10716
10797
|
}
|
|
10717
10798
|
if (!input.dryRun) {
|
|
10718
|
-
writeCrewBeeConfig(configPath,
|
|
10799
|
+
writeCrewBeeConfig(configPath, finalConfig);
|
|
10719
10800
|
}
|
|
10720
10801
|
return {
|
|
10721
10802
|
changed: true,
|
|
10722
10803
|
configPath,
|
|
10723
|
-
reason: "added-default-coding-team"
|
|
10804
|
+
reason: updated.changed ? "added-default-coding-team" : "migrated-config-version"
|
|
10724
10805
|
};
|
|
10725
10806
|
}
|
|
10726
10807
|
function resolveConfiguredTeamPath(teamPath, configRoot) {
|
|
@@ -11956,7 +12037,7 @@ function createOpenCodePermissionConfig(permissionRules) {
|
|
|
11956
12037
|
return permission;
|
|
11957
12038
|
}
|
|
11958
12039
|
|
|
11959
|
-
// src/normalize/build-agent-prompt-
|
|
12040
|
+
// src/normalize/build-agent-prompt-document.ts
|
|
11960
12041
|
function isRecord5(value) {
|
|
11961
12042
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11962
12043
|
}
|
|
@@ -11994,7 +12075,7 @@ function pushBlock(blocks, key, value, order) {
|
|
|
11994
12075
|
});
|
|
11995
12076
|
return order + 1;
|
|
11996
12077
|
}
|
|
11997
|
-
function
|
|
12078
|
+
function buildAgentPromptDocumentWithOverrides(agent, overrides) {
|
|
11998
12079
|
const blocks = [];
|
|
11999
12080
|
let order = 0;
|
|
12000
12081
|
order = pushBlock(blocks, "persona_core", agent.personaCore, order);
|
|
@@ -12029,7 +12110,7 @@ function buildAgentPromptSourceWithOverrides(agent, overrides) {
|
|
|
12029
12110
|
};
|
|
12030
12111
|
}
|
|
12031
12112
|
|
|
12032
|
-
// src/normalize/build-team-prompt-
|
|
12113
|
+
// src/normalize/build-team-prompt-document.ts
|
|
12033
12114
|
function asRecord2(value) {
|
|
12034
12115
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
12035
12116
|
}
|
|
@@ -12039,7 +12120,7 @@ function asMetadataRecord2(value) {
|
|
|
12039
12120
|
}
|
|
12040
12121
|
return value;
|
|
12041
12122
|
}
|
|
12042
|
-
function
|
|
12123
|
+
function buildTeamPromptDocument(manifest, policy, bodySections = []) {
|
|
12043
12124
|
const qualityFloor = asRecord2(policy.qualityFloor);
|
|
12044
12125
|
const approvalPolicy = asRecord2(policy.approvalPolicy);
|
|
12045
12126
|
const workingRulesValue = normalizeValue({
|
|
@@ -12105,7 +12186,39 @@ function buildTeamPromptSource(manifest, policy, bodySections = []) {
|
|
|
12105
12186
|
};
|
|
12106
12187
|
}
|
|
12107
12188
|
|
|
12108
|
-
// src/
|
|
12189
|
+
// src/render/apply-prompt-projection.ts
|
|
12190
|
+
function matchesPath(selected, path10) {
|
|
12191
|
+
return selected === path10 || path10.startsWith(`${selected}.`);
|
|
12192
|
+
}
|
|
12193
|
+
function isAncestorPath(ancestor, descendant) {
|
|
12194
|
+
return descendant === ancestor || descendant.startsWith(`${ancestor}.`);
|
|
12195
|
+
}
|
|
12196
|
+
function projectNode(node, projection) {
|
|
12197
|
+
const include = projection?.include ?? [];
|
|
12198
|
+
const exclude = projection?.exclude ?? [];
|
|
12199
|
+
const labels = projection?.labels ?? {};
|
|
12200
|
+
const projectedChildren = node.children?.map((child) => projectNode(child, projection)).filter((child) => Boolean(child));
|
|
12201
|
+
const explicitlyIncluded = include.length === 0 || include.some((selected) => matchesPath(selected, node.path));
|
|
12202
|
+
const descendantIncluded = include.length > 0 && include.some((selected) => isAncestorPath(node.path, selected));
|
|
12203
|
+
const explicitlyExcluded = exclude.some((selected) => matchesPath(selected, node.path));
|
|
12204
|
+
const shouldKeep = include.length === 0 ? !explicitlyExcluded && (node.visibleByDefault || (projectedChildren?.length ?? 0) > 0) : (explicitlyIncluded || descendantIncluded || (projectedChildren?.length ?? 0) > 0) && !explicitlyExcluded;
|
|
12205
|
+
if (!shouldKeep) {
|
|
12206
|
+
return void 0;
|
|
12207
|
+
}
|
|
12208
|
+
return {
|
|
12209
|
+
...node,
|
|
12210
|
+
label: labels[node.path] ?? node.label,
|
|
12211
|
+
...projectedChildren ? { children: projectedChildren } : {}
|
|
12212
|
+
};
|
|
12213
|
+
}
|
|
12214
|
+
function applyPromptProjection(catalog, projection) {
|
|
12215
|
+
return {
|
|
12216
|
+
kind: catalog.kind,
|
|
12217
|
+
nodes: catalog.nodes.map((node) => projectNode(node, projection)).filter((node) => Boolean(node))
|
|
12218
|
+
};
|
|
12219
|
+
}
|
|
12220
|
+
|
|
12221
|
+
// src/render/build-prompt-catalog.ts
|
|
12109
12222
|
function formatDisplayLabel(key) {
|
|
12110
12223
|
return key.replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
12111
12224
|
}
|
|
@@ -12178,7 +12291,7 @@ function buildPromptCatalog(doc) {
|
|
|
12178
12291
|
};
|
|
12179
12292
|
}
|
|
12180
12293
|
|
|
12181
|
-
// src/
|
|
12294
|
+
// src/render/build-prompt-plan.ts
|
|
12182
12295
|
var CANONICAL_SECTION_TITLES = {
|
|
12183
12296
|
working_rules: "Working Rules",
|
|
12184
12297
|
approval_safety: "Approval & Safety",
|
|
@@ -12249,38 +12362,6 @@ function buildPromptPlan(catalog) {
|
|
|
12249
12362
|
};
|
|
12250
12363
|
}
|
|
12251
12364
|
|
|
12252
|
-
// src/projection/apply-prompt-projection.ts
|
|
12253
|
-
function matchesPath(selected, path10) {
|
|
12254
|
-
return selected === path10 || path10.startsWith(`${selected}.`);
|
|
12255
|
-
}
|
|
12256
|
-
function isAncestorPath(ancestor, descendant) {
|
|
12257
|
-
return descendant === ancestor || descendant.startsWith(`${ancestor}.`);
|
|
12258
|
-
}
|
|
12259
|
-
function projectNode(node, projection) {
|
|
12260
|
-
const include = projection?.include ?? [];
|
|
12261
|
-
const exclude = projection?.exclude ?? [];
|
|
12262
|
-
const labels = projection?.labels ?? {};
|
|
12263
|
-
const projectedChildren = node.children?.map((child) => projectNode(child, projection)).filter((child) => Boolean(child));
|
|
12264
|
-
const explicitlyIncluded = include.length === 0 || include.some((selected) => matchesPath(selected, node.path));
|
|
12265
|
-
const descendantIncluded = include.length > 0 && include.some((selected) => isAncestorPath(node.path, selected));
|
|
12266
|
-
const explicitlyExcluded = exclude.some((selected) => matchesPath(selected, node.path));
|
|
12267
|
-
const shouldKeep = include.length === 0 ? !explicitlyExcluded && (node.visibleByDefault || (projectedChildren?.length ?? 0) > 0) : (explicitlyIncluded || descendantIncluded || (projectedChildren?.length ?? 0) > 0) && !explicitlyExcluded;
|
|
12268
|
-
if (!shouldKeep) {
|
|
12269
|
-
return void 0;
|
|
12270
|
-
}
|
|
12271
|
-
return {
|
|
12272
|
-
...node,
|
|
12273
|
-
label: labels[node.path] ?? node.label,
|
|
12274
|
-
...projectedChildren ? { children: projectedChildren } : {}
|
|
12275
|
-
};
|
|
12276
|
-
}
|
|
12277
|
-
function applyPromptProjection(catalog, projection) {
|
|
12278
|
-
return {
|
|
12279
|
-
kind: catalog.kind,
|
|
12280
|
-
nodes: catalog.nodes.map((node) => projectNode(node, projection)).filter((node) => Boolean(node))
|
|
12281
|
-
};
|
|
12282
|
-
}
|
|
12283
|
-
|
|
12284
12365
|
// src/render/structural-renderer.ts
|
|
12285
12366
|
var defaultRenderContext = {
|
|
12286
12367
|
indentUnit: " "
|
|
@@ -12417,7 +12498,7 @@ function renderPart(title, body) {
|
|
|
12417
12498
|
${body}` : void 0;
|
|
12418
12499
|
}
|
|
12419
12500
|
function createOpenCodeAgentPrompt(agent, _requestedTools) {
|
|
12420
|
-
const
|
|
12501
|
+
const teamDocument = buildTeamPromptDocument(
|
|
12421
12502
|
{
|
|
12422
12503
|
id: agent.sourceTeam.manifest.id,
|
|
12423
12504
|
name: agent.sourceTeam.manifest.name,
|
|
@@ -12425,8 +12506,8 @@ function createOpenCodeAgentPrompt(agent, _requestedTools) {
|
|
|
12425
12506
|
},
|
|
12426
12507
|
agent.sourceTeam.policy
|
|
12427
12508
|
);
|
|
12428
|
-
const teamPart = renderNormalizedPromptDocument(
|
|
12429
|
-
const normalizedAgent =
|
|
12509
|
+
const teamPart = renderNormalizedPromptDocument(teamDocument);
|
|
12510
|
+
const normalizedAgent = buildAgentPromptDocumentWithOverrides(agent.sourceAgent, {
|
|
12430
12511
|
collaborationValue: createCollaborationPromptValue(agent)
|
|
12431
12512
|
});
|
|
12432
12513
|
const agentPart = renderNormalizedPromptDocument(normalizedAgent);
|
|
@@ -5,8 +5,8 @@ exports.createOpenCodePromptFromRawDocuments = createOpenCodePromptFromRawDocume
|
|
|
5
5
|
exports.createOpenCodeAgentPrompt = createOpenCodeAgentPrompt;
|
|
6
6
|
const markdown_body_loader_1 = require("../../loader/markdown-body-loader");
|
|
7
7
|
const profile_loader_1 = require("../../loader/profile-loader");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const build_agent_prompt_document_1 = require("../../normalize/build-agent-prompt-document");
|
|
9
|
+
const build_team_prompt_document_1 = require("../../normalize/build-team-prompt-document");
|
|
10
10
|
const normalize_document_1 = require("../../normalize/normalize-document");
|
|
11
11
|
const prompt_document_renderer_1 = require("../../render/prompt-document-renderer");
|
|
12
12
|
function resolveTargetAgent(team, agentRef) {
|
|
@@ -52,24 +52,24 @@ function createOpenCodePromptFromRawDocuments(input) {
|
|
|
52
52
|
const normalizedAgent = (0, normalize_document_1.normalizeProfileDocument)(loadedAgent);
|
|
53
53
|
const agentPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(normalizedAgent);
|
|
54
54
|
const loadedPolicy = (0, profile_loader_1.loadTeamPolicy)(input.teamPolicyRaw);
|
|
55
|
-
const
|
|
55
|
+
const teamDocument = (0, build_team_prompt_document_1.buildTeamPromptDocument)({
|
|
56
56
|
id: String(loadedTeamManifest.metadata.id),
|
|
57
57
|
name: typeof loadedTeamManifest.metadata.name === "string" ? loadedTeamManifest.metadata.name : undefined,
|
|
58
58
|
promptProjection: loadedTeamManifest.promptProjection,
|
|
59
59
|
}, loadedPolicy, loadedTeamManifest.bodySections);
|
|
60
|
-
const teamPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(
|
|
60
|
+
const teamPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(teamDocument);
|
|
61
61
|
return [renderPart("Team Contract", teamPart), renderPart("Agent Contract", agentPart)]
|
|
62
62
|
.filter((block) => Boolean(block))
|
|
63
63
|
.join("\n\n");
|
|
64
64
|
}
|
|
65
65
|
function createOpenCodeAgentPrompt(agent, _requestedTools) {
|
|
66
|
-
const
|
|
66
|
+
const teamDocument = (0, build_team_prompt_document_1.buildTeamPromptDocument)({
|
|
67
67
|
id: agent.sourceTeam.manifest.id,
|
|
68
68
|
name: agent.sourceTeam.manifest.name,
|
|
69
69
|
promptProjection: agent.sourceTeam.policy.promptProjection,
|
|
70
70
|
}, agent.sourceTeam.policy);
|
|
71
|
-
const teamPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(
|
|
72
|
-
const normalizedAgent = (0,
|
|
71
|
+
const teamPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(teamDocument);
|
|
72
|
+
const normalizedAgent = (0, build_agent_prompt_document_1.buildAgentPromptDocumentWithOverrides)(agent.sourceAgent, {
|
|
73
73
|
collaborationValue: createCollaborationPromptValue(agent),
|
|
74
74
|
});
|
|
75
75
|
const agentPart = (0, prompt_document_renderer_1.renderNormalizedPromptDocument)(normalizedAgent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../../../src/adapters/opencode/prompt-builder.ts"],"names":[],"mappings":";;AA2CA,8EAUC;AAED,oFA+BC;AAED,8DAkBC;AAzGD,4EAA+E;AAC/E,gEAAiG;AACjG,
|
|
1
|
+
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../../../src/adapters/opencode/prompt-builder.ts"],"names":[],"mappings":";;AA2CA,8EAUC;AAED,oFA+BC;AAED,8DAkBC;AAzGD,4EAA+E;AAC/E,gEAAiG;AACjG,6FAAoG;AACpG,2FAAqF;AACrF,2EAA8E;AAC9E,oFAAmH;AAKnH,SAAS,kBAAkB,CAAC,IAAkC,EAAE,QAAgB;IAC9E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,8BAA8B,CAAC,KAAqB;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;IAE9B,MAAM,UAAU,GAAG,CAAC,OAAkF,EAAE,EAAE;QACxG,MAAM,QAAQ,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC1E,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,mBAAmB,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAE1F,OAAO;YACL,EAAE,EAAE,WAAW;gBACb,CAAC,CAAC,WAAW,CAAC,gBAAgB,IAAI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MAAM,CAAC,CAAC;AAClB,CAAC;AAED,SAAgB,yBAAyB,CAAC,KAAqB,EAAE,eAAmC;IAClG,MAAM,YAAY,GAAG,IAAA,oDAAuB,EAC1C;QACE,EAAE,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAChC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI;QACpC,gBAAgB,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,gBAAgB;KAC3D,EACD,KAAK,CAAC,UAAU,CAAC,MAAM,CACxB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,yDAA8B,EAAC,YAAY,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAG,IAAA,mEAAqC,EAAC,KAAK,CAAC,WAAW,EAAE;QAC/E,kBAAkB,EAAE,8BAA8B,CAAC,KAAK,CAAC;KAC1D,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAA,yDAA8B,EAAC,eAAe,CAAC,CAAC;IAElE,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;SACpF,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAClD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -7,5 +7,10 @@ export declare const EMBEDDED_TEAM_IDS: readonly ["coding-team"];
|
|
|
7
7
|
export declare const BUILTIN_CODING_TEAM_MODEL_PRESET = "sota-2026-05";
|
|
8
8
|
export declare const BUILTIN_CODING_TEAM_MODEL_FALLBACK = "builtin-role-chain";
|
|
9
9
|
export declare const BUILTIN_CODING_TEAM_FALLBACK_TO_HOST_DEFAULT = true;
|
|
10
|
+
/**
|
|
11
|
+
* Current config version for crewbee.json. Bump this when adding new fields
|
|
12
|
+
* so that existing user configs get auto-migrated with new defaults.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CREWBEE_CONFIG_VERSION = 2;
|
|
10
15
|
export declare const BUILTIN_CODING_TEAM_AGENT_MODELS: Record<string, string>;
|
|
11
16
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/agent-teams/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,eAAO,MAAM,iBAAiB,0BAAoC,CAAC;AAEnE,eAAO,MAAM,gCAAgC,iBAAiB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,4CAA4C,OAAO,CAAC;AAEjE,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASnE,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/agent-teams/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,eAAO,MAAM,iBAAiB,0BAAoC,CAAC;AAEnE,eAAO,MAAM,gCAAgC,iBAAiB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,4CAA4C,OAAO,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASnE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BUILTIN_CODING_TEAM_AGENT_MODELS = exports.BUILTIN_CODING_TEAM_FALLBACK_TO_HOST_DEFAULT = exports.BUILTIN_CODING_TEAM_MODEL_FALLBACK = exports.BUILTIN_CODING_TEAM_MODEL_PRESET = exports.EMBEDDED_TEAM_IDS = exports.DEFAULT_FILE_TEAM_PRIORITY = exports.DEFAULT_EMBEDDED_TEAM_PRIORITY = exports.BUILTIN_CODING_TEAM_ID = exports.CREWBEE_CONFIG_FILE = exports.TEAM_CONFIG_ROOT = void 0;
|
|
3
|
+
exports.BUILTIN_CODING_TEAM_AGENT_MODELS = exports.CREWBEE_CONFIG_VERSION = exports.BUILTIN_CODING_TEAM_FALLBACK_TO_HOST_DEFAULT = exports.BUILTIN_CODING_TEAM_MODEL_FALLBACK = exports.BUILTIN_CODING_TEAM_MODEL_PRESET = exports.EMBEDDED_TEAM_IDS = exports.DEFAULT_FILE_TEAM_PRIORITY = exports.DEFAULT_EMBEDDED_TEAM_PRIORITY = exports.BUILTIN_CODING_TEAM_ID = exports.CREWBEE_CONFIG_FILE = exports.TEAM_CONFIG_ROOT = void 0;
|
|
4
4
|
exports.TEAM_CONFIG_ROOT = "teams";
|
|
5
5
|
exports.CREWBEE_CONFIG_FILE = "crewbee.json";
|
|
6
6
|
exports.BUILTIN_CODING_TEAM_ID = "coding-team";
|
|
@@ -10,6 +10,11 @@ exports.EMBEDDED_TEAM_IDS = [exports.BUILTIN_CODING_TEAM_ID];
|
|
|
10
10
|
exports.BUILTIN_CODING_TEAM_MODEL_PRESET = "sota-2026-05";
|
|
11
11
|
exports.BUILTIN_CODING_TEAM_MODEL_FALLBACK = "builtin-role-chain";
|
|
12
12
|
exports.BUILTIN_CODING_TEAM_FALLBACK_TO_HOST_DEFAULT = true;
|
|
13
|
+
/**
|
|
14
|
+
* Current config version for crewbee.json. Bump this when adding new fields
|
|
15
|
+
* so that existing user configs get auto-migrated with new defaults.
|
|
16
|
+
*/
|
|
17
|
+
exports.CREWBEE_CONFIG_VERSION = 2;
|
|
13
18
|
exports.BUILTIN_CODING_TEAM_AGENT_MODELS = {
|
|
14
19
|
"coding-leader": "openai/gpt-5.5",
|
|
15
20
|
"coordination-leader": "openai/gpt-5.5",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/agent-teams/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,mBAAmB,GAAG,cAAc,CAAC;AACrC,QAAA,sBAAsB,GAAG,aAAa,CAAC;AACvC,QAAA,8BAA8B,GAAG,CAAC,CAAC;AACnC,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE/B,QAAA,iBAAiB,GAAG,CAAC,8BAAsB,CAAU,CAAC;AAEtD,QAAA,gCAAgC,GAAG,cAAc,CAAC;AAClD,QAAA,kCAAkC,GAAG,oBAAoB,CAAC;AAC1D,QAAA,4CAA4C,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/agent-teams/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,mBAAmB,GAAG,cAAc,CAAC;AACrC,QAAA,sBAAsB,GAAG,aAAa,CAAC;AACvC,QAAA,8BAA8B,GAAG,CAAC,CAAC;AACnC,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE/B,QAAA,iBAAiB,GAAG,CAAC,8BAAsB,CAAU,CAAC;AAEtD,QAAA,gCAAgC,GAAG,cAAc,CAAC;AAClD,QAAA,kCAAkC,GAAG,oBAAoB,CAAC;AAC1D,QAAA,4CAA4C,GAAG,IAAI,CAAC;AAEjE;;;GAGG;AACU,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAE3B,QAAA,gCAAgC,GAA2B;IACtE,eAAe,EAAE,gBAAgB;IACjC,qBAAqB,EAAE,gBAAgB;IACvC,iBAAiB,EAAE,gBAAgB;IACnC,mBAAmB,EAAE,qBAAqB;IAC1C,gBAAgB,EAAE,+BAA+B;IACjD,QAAQ,EAAE,2BAA2B;IACrC,mBAAmB,EAAE,2BAA2B;IAChD,mBAAmB,EAAE,+BAA+B;CACrD,CAAC"}
|
|
@@ -33,9 +33,10 @@ export interface ConfiguredFilesystemTeamSource {
|
|
|
33
33
|
export type ConfiguredTeamSource = ConfiguredEmbeddedTeamSource | ConfiguredFilesystemTeamSource;
|
|
34
34
|
export type TeamConfigSourceScope = "project" | "global";
|
|
35
35
|
export interface CrewBeeConfigFile {
|
|
36
|
+
config_version?: number;
|
|
36
37
|
teams: Array<Record<string, unknown>>;
|
|
37
38
|
}
|
|
38
|
-
export type CrewBeeConfigEnsureReason = "created-default" | "repaired-invalid" | "added-default-coding-team" | "unchanged";
|
|
39
|
+
export type CrewBeeConfigEnsureReason = "created-default" | "repaired-invalid" | "added-default-coding-team" | "migrated-config-version" | "unchanged";
|
|
39
40
|
export interface CrewBeeConfigEnsureResult {
|
|
40
41
|
changed: boolean;
|
|
41
42
|
backupPath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../src/agent-teams/filesystem.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../src/agent-teams/filesystem.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAoCnD,MAAM,WAAW,2BA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VERSION,
|
|
143
144
|
teams: [createDefaultCodingTeamConfigEntry()],
|
|
144
145
|
};
|
|
145
146
|
}
|
|
@@ -200,6 +201,85 @@ function createUpdatedCrewBeeConfigWithDefaultTeam(config) {
|
|
|
200
201
|
},
|
|
201
202
|
};
|
|
202
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Migrate an existing config to the latest version by merging in new default
|
|
206
|
+
* fields while preserving all user-configured values. Returns whether any
|
|
207
|
+
* changes were made and the resulting config.
|
|
208
|
+
*/
|
|
209
|
+
function migrateCrewBeeConfig(existing) {
|
|
210
|
+
const currentVersion = typeof existing.config_version === "number" ? existing.config_version : 1;
|
|
211
|
+
if (currentVersion >= constants_1.CREWBEE_CONFIG_VERSION) {
|
|
212
|
+
// Already up-to-date; cast and return as-is.
|
|
213
|
+
return { changed: false, config: existing };
|
|
214
|
+
}
|
|
215
|
+
const defaults = createDefaultCrewBeeConfig();
|
|
216
|
+
// Start with a shallow copy of the existing config so we preserve all user keys.
|
|
217
|
+
const migrated = { ...existing };
|
|
218
|
+
// Stamp the new version.
|
|
219
|
+
migrated.config_version = constants_1.CREWBEE_CONFIG_VERSION;
|
|
220
|
+
// Merge top-level keys from defaults that are missing in the existing config.
|
|
221
|
+
for (const key of Object.keys(defaults)) {
|
|
222
|
+
if (!(key in migrated)) {
|
|
223
|
+
migrated[key] = defaults[key];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Deep-merge each team entry: for teams that match by id, merge missing fields
|
|
227
|
+
// from the corresponding default team entry.
|
|
228
|
+
const existingTeams = Array.isArray(migrated.teams) ? migrated.teams : [];
|
|
229
|
+
const defaultTeams = defaults.teams ?? [];
|
|
230
|
+
const mergedTeams = existingTeams.map((entry) => {
|
|
231
|
+
if (!isRecord(entry))
|
|
232
|
+
return entry;
|
|
233
|
+
const teamId = getOptionalString(entry.id);
|
|
234
|
+
if (!teamId)
|
|
235
|
+
return entry;
|
|
236
|
+
const defaultEntry = defaultTeams.find((d) => isRecord(d) && d.id === teamId);
|
|
237
|
+
if (!defaultEntry || !isRecord(defaultEntry))
|
|
238
|
+
return entry;
|
|
239
|
+
// Shallow-merge missing top-level team fields from default.
|
|
240
|
+
const merged = { ...entry };
|
|
241
|
+
for (const key of Object.keys(defaultEntry)) {
|
|
242
|
+
if (!(key in merged)) {
|
|
243
|
+
merged[key] = defaultEntry[key];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Deep-merge agents: preserve user agent models, add new agents from default.
|
|
247
|
+
if (isRecord(defaultEntry.agents)) {
|
|
248
|
+
const existingAgents = isRecord(merged.agents) ? { ...merged.agents } : {};
|
|
249
|
+
for (const [agentId, agentConfig] of Object.entries(defaultEntry.agents)) {
|
|
250
|
+
if (!(agentId in existingAgents)) {
|
|
251
|
+
existingAgents[agentId] = agentConfig;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
merged.agents = existingAgents;
|
|
255
|
+
}
|
|
256
|
+
return merged;
|
|
257
|
+
});
|
|
258
|
+
// Append any default teams that don't exist in the user config at all.
|
|
259
|
+
for (const defaultEntry of defaultTeams) {
|
|
260
|
+
if (!isRecord(defaultEntry))
|
|
261
|
+
continue;
|
|
262
|
+
const defaultId = getOptionalString(defaultEntry.id);
|
|
263
|
+
const defaultPath = getOptionalString(defaultEntry.path);
|
|
264
|
+
const key = defaultId ?? defaultPath;
|
|
265
|
+
if (!key)
|
|
266
|
+
continue;
|
|
267
|
+
const alreadyExists = mergedTeams.some((entry) => {
|
|
268
|
+
if (!isRecord(entry))
|
|
269
|
+
return false;
|
|
270
|
+
if (defaultId)
|
|
271
|
+
return entry.id === defaultId;
|
|
272
|
+
if (defaultPath)
|
|
273
|
+
return entry.path === defaultPath;
|
|
274
|
+
return false;
|
|
275
|
+
});
|
|
276
|
+
if (!alreadyExists) {
|
|
277
|
+
mergedTeams.push(defaultEntry);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
migrated.teams = mergedTeams;
|
|
281
|
+
return { changed: true, config: migrated };
|
|
282
|
+
}
|
|
203
283
|
function ensureCrewBeeConfigFile(input) {
|
|
204
284
|
const configRoot = input.configRoot ?? (0, install_root_1.resolveOpenCodeConfigRoot)();
|
|
205
285
|
const configPath = resolveCrewBeeConfigPath(configRoot);
|
|
@@ -231,14 +311,23 @@ function ensureCrewBeeConfigFile(input) {
|
|
|
231
311
|
};
|
|
232
312
|
}
|
|
233
313
|
if (input.mode === "startup") {
|
|
314
|
+
// Even in startup mode, migrate outdated configs to add new default fields.
|
|
315
|
+
const migration = migrateCrewBeeConfig(parsed.config);
|
|
316
|
+
if (migration.changed && !input.dryRun) {
|
|
317
|
+
writeCrewBeeConfig(configPath, migration.config);
|
|
318
|
+
}
|
|
234
319
|
return {
|
|
235
|
-
changed:
|
|
320
|
+
changed: migration.changed,
|
|
236
321
|
configPath,
|
|
237
|
-
reason: "unchanged",
|
|
322
|
+
reason: migration.changed ? "migrated-config-version" : "unchanged",
|
|
238
323
|
};
|
|
239
324
|
}
|
|
240
325
|
const updated = createUpdatedCrewBeeConfigWithDefaultTeam(parsed.config);
|
|
241
|
-
|
|
326
|
+
// After ensuring the coding team exists, also migrate to latest config version.
|
|
327
|
+
const migration = migrateCrewBeeConfig(updated.next);
|
|
328
|
+
const finalConfig = migration.config;
|
|
329
|
+
const changed = updated.changed || migration.changed;
|
|
330
|
+
if (!changed) {
|
|
242
331
|
return {
|
|
243
332
|
changed: false,
|
|
244
333
|
configPath,
|
|
@@ -246,12 +335,12 @@ function ensureCrewBeeConfigFile(input) {
|
|
|
246
335
|
};
|
|
247
336
|
}
|
|
248
337
|
if (!input.dryRun) {
|
|
249
|
-
writeCrewBeeConfig(configPath,
|
|
338
|
+
writeCrewBeeConfig(configPath, finalConfig);
|
|
250
339
|
}
|
|
251
340
|
return {
|
|
252
341
|
changed: true,
|
|
253
342
|
configPath,
|
|
254
|
-
reason: "added-default-coding-team",
|
|
343
|
+
reason: updated.changed ? "added-default-coding-team" : "migrated-config-version",
|
|
255
344
|
};
|
|
256
345
|
}
|
|
257
346
|
function resolveConfiguredTeamPath(teamPath, configRoot) {
|