@ancleto/spec 0.6.35 → 0.6.37

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli/index.js +23 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancleto/spec",
3
- "version": "0.6.35",
3
+ "version": "0.6.37",
4
4
  "description": "Orquestador SDD liviano con subagentes optimizados para costo/tokens",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/index.js CHANGED
@@ -1049,6 +1049,12 @@ async function initProject(args) {
1049
1049
  } else {
1050
1050
  agent = await resolveAgent(args, existing?.agent, false)
1051
1051
  tier = tierFlag
1052
+ if (!tier) {
1053
+ // Paridad con install: sin flag se respeta el tier guardado. Sin esto un
1054
+ // re-init pelado re-copiaba los agents de origen y perdia los modelos aplicados.
1055
+ const stored = (await exists(tierFile)) ? (await readFile(tierFile, 'utf8')).trim() : null
1056
+ if (stored && TIERS[stored]) tier = stored
1057
+ }
1052
1058
  if (!language) language = 'auto'
1053
1059
  if (withAzure) azure.enabled = true
1054
1060
  }
@@ -1059,8 +1065,24 @@ async function initProject(args) {
1059
1065
  await writeFile(tierFile, tier + '\n')
1060
1066
  }
1061
1067
 
1062
- const manifest = await writeManifest(projectDir, { azure, discovery, agent, language })
1068
+ // Paridad con install: el tier elegido tambien reescribe los modelos de los
1069
+ // agentes locales. Antes quedaba huerfano (tier declarado, modelos de otro tier).
1070
+ let gratisModelChoice = null
1071
+ if (tier === 'gratis') {
1072
+ const persisted = isKnownGratisModel(existing?.gratisModel) ? existing.gratisModel : null
1073
+ gratisModelChoice = persisted || gratisModel()
1074
+ }
1075
+ const manifest = await writeManifest(projectDir, {
1076
+ azure,
1077
+ discovery,
1078
+ agent,
1079
+ language,
1080
+ ...(gratisModelChoice ? { gratisModel: gratisModelChoice } : {})
1081
+ })
1063
1082
  await copyTemplates(projectDir)
1083
+ if (tier) {
1084
+ await applyTier(join(projectDir, '.opencode', 'agents'), tier, tierModels(tier, TIERS, gratisModelChoice))
1085
+ }
1064
1086
  await scaffoldAspec(projectDir)
1065
1087
  await refreshWorkingContext(projectDir)
1066
1088
  await registerProject(projectDir, { agent, tier: tier || null })