pi-rolecast 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-rolecast",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Multi-agent role framework for Pi. Groups of specialist agents (coding, video, etc.) bound to per-role models, dispatched via pi-subagents. Profile-driven, gate-verified, language-agnostic.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,17 +58,38 @@ fi
58
58
  # Global role symlinks for every role-packs/<group>/<role>.md.
59
59
  agents_dir="$PREFIX/agents"
60
60
  mkdir -p "$agents_dir"
61
+ # Clean up ANY pre-existing symlinks pointing at the legacy framework root.
62
+ # Old symlinks would dangle after `pi-agent-workflow` is removed; clean first.
63
+ if [[ -d "$agents_dir" ]]; then
64
+ while IFS= read -r stale; do
65
+ target="$(readlink "$stale" 2>/dev/null || true)"
66
+ if [[ -n "$target" && "$target" == *pi-agent-workflow* ]]; then
67
+ rm -f "$stale"
68
+ fi
69
+ done < <(find "$agents_dir" -maxdepth 1 -type l -name '*.md')
70
+ fi
61
71
  linked=0
62
72
  while IFS= read -r md; do
63
- role=$(basename "$md" .md)
73
+ role=$(basename "$md" .md) # e.g. "coding-architect"
74
+ bare="${role#coding-}" # legacy compat name e.g. "architect" (for coding group)
64
75
  link_path="$agents_dir/$role.md"
65
76
  if [[ -L "$link_path" ]]; then
66
77
  rm -f "$link_path"
67
78
  fi
68
79
  ln -s "$md" "$link_path"
69
80
  linked=$((linked + 1))
81
+ # Legacy shim: create <bare-role>.md symlink for extensions that key
82
+ # off filename (e.g. bundled pi-cc-extensions). Removed in v0.3.0.
83
+ if [[ "$role" == "$bare" ]]; then
84
+ continue # safety: if role had no group prefix, skip
85
+ fi
86
+ legacy_link="$agents_dir/$bare.md"
87
+ if [[ ! -L "$legacy_link" && ! -e "$legacy_link" ]]; then
88
+ ln -s "$md" "$legacy_link"
89
+ linked=$((linked + 1))
90
+ fi
70
91
  done < <(find "$FRAMEWORK_ROOT/role-packs" -type f -name '*.md' 2>/dev/null | sort)
71
- echo "linked $linked role agents from role-packs/"
92
+ echo "linked $linked role agents from role-packs/ (incl. legacy compat shims)"
72
93
 
73
94
  # Warn if pi-subagents is missing — required for actual role dispatch.
74
95
  SETTINGS_JSON="$PREFIX/settings.json"
@@ -252,7 +252,13 @@ def _write_agents(agents_dir: Path, framework_root: Path,
252
252
  dry_run: bool, registry) -> int:
253
253
  """Write project-local copies of role-packs/<group>/<role>.md for every
254
254
  bound role. Uses full role name (`<group>-<role>`) as the filename so
255
- pi-subagents can find it via @<full-name> mention syntax."""
255
+ pi-subagents can find it via @<full-name> mention syntax.
256
+
257
+ Also writes a legacy `<bare-role>.md` shim for extensions that key off
258
+ filename (e.g. the bundled pi-cc-extensions subagent reference provider).
259
+ Both files contain the same body, just different filenames. The legacy
260
+ shim is removed in v0.3.0.
261
+ """
256
262
  roles = available_roles(framework_root, groups=enabled_groups or None)
257
263
  if dry_run:
258
264
  for role_full_name, rd in sorted(roles.items()):
@@ -263,6 +269,10 @@ def _write_agents(agents_dir: Path, framework_root: Path,
263
269
  full = (provider + "/" + model_id) if provider else model_id
264
270
  print("would write " + str(agents_dir / (role_full_name + ".md")) +
265
271
  " model=" + full)
272
+ legacy = rd.role
273
+ if legacy and legacy != role_full_name:
274
+ print("would write " + str(agents_dir / (legacy + ".md")) +
275
+ " model=" + full + " (legacy shim)")
266
276
  return 0
267
277
  agents_dir.mkdir(parents=True, exist_ok=True)
268
278
  written = 0
@@ -274,15 +284,26 @@ def _write_agents(agents_dir: Path, framework_root: Path,
274
284
  print("warning: role-packs file not found: " + str(rd.file_path),
275
285
  file=sys.stderr)
276
286
  continue
277
- dst = agents_dir / (role_full_name + ".md")
278
287
  body = src.read_text()
279
288
  model_id = new_overrides[role_full_name]["model"]
280
289
  provider = _provider_for_model(model_id, registry)
281
290
  full = (provider + "/" + model_id) if provider else model_id
282
291
  updated = _set_frontmatter_field(body, "model", full)
292
+ # v0.2.0+ canonical filename
293
+ dst = agents_dir / (role_full_name + ".md")
283
294
  dst.write_text(updated)
284
295
  written += 1
285
- print("wrote " + str(written) + " project-local agent files to " + str(agents_dir))
296
+ # Legacy shim: bare role name for filename-keyed extensions.
297
+ # Only created for the coding group; other groups have no legacy.
298
+ legacy = rd.role
299
+ if legacy and legacy != role_full_name and rd.group == "coding":
300
+ legacy_dst = agents_dir / (legacy + ".md")
301
+ if legacy_dst.exists() or legacy_dst.is_symlink():
302
+ legacy_dst.unlink()
303
+ legacy_dst.write_text(updated)
304
+ written += 1
305
+ print("wrote " + str(written) + " project-local agent files to " + str(agents_dir) +
306
+ " (incl. legacy compat shims)")
286
307
  return 0
287
308
 
288
309