singularity-forge/scripts
Jeremy McSpadden b580f64144 fix: apply pi manifest opt-out to extension-discovery.ts (#1545)
* fix: apply pi manifest opt-out to extension-discovery.ts (#1537 follow-up)

The cmux fix in #1537 patched resolveExtensionEntries() in
packages/pi-coding-agent/src/core/extensions/loader.ts to honor
"pi": {} as an opt-out from auto-discovery. However, there is a
second copy of resolveExtensionEntries() in src/extension-discovery.ts
that was not updated. This is the version actually used at startup
by loader.js via discoverExtensionEntryPaths().

As a result, cmux/index.js is still discovered and loaded as an
extension on startup, producing:
  Extension does not export a valid factory function: .../cmux/index.js

Fix: Apply the same authoritative-manifest logic to the
extension-discovery.ts copy. When a package.json has a "pi" field,
treat it as authoritative and return early — either with declared
extension paths or an empty array for library opt-out.

Tests: 7 new tests covering resolveExtensionEntries and
discoverExtensionEntryPaths behavior for opt-out, declared
extensions, and fallback discovery.

* fix: apply pi manifest opt-out to package-manager.ts (third copy)

There are THREE copies of resolveExtensionEntries():
1. packages/pi-coding-agent/src/core/extensions/loader.ts (fixed in #1537)
2. src/extension-discovery.ts (fixed in previous commit)
3. packages/pi-coding-agent/src/core/package-manager.ts (THIS commit)

Copy #3 is used by collectAutoExtensionEntries() which is called from
addAutoDiscoveredResources() during DefaultPackageManager.resolve().
This is the actual code path that discovers ~/.gsd/agent/extensions/cmux
and passes it to loadExtensions(), producing the factory function error.

* fix: rewrite pi.extensions .ts paths to .js during resource copy

copy-resources.cjs compiles .ts → .js via tsc but copies package.json
files verbatim. Extensions with pi.extensions: ["./index.ts"] end up
in dist/ pointing to a .ts file that doesn't exist (only .js does).

This causes resolveExtensionEntries() to find no valid entry points,
silently skipping the extension. Affected: gsd, browser-tools, context7,
google-search, universal-config — all extensions with pi manifests.

Fix: When copying package.json files, rewrite .ts/.tsx extensions in
pi.extensions arrays to .js so they match the compiled output.

* fix: add missing commands to /gsd description and rate sub-completions

- Add 9 missing commands to the description string: widget, rate, park,
  unpark, init, setup, logs, inspect, extensions
- Add sub-completions for /gsd rate (over/ok/under)

* feat: grid layout for parallel cmux splits and completion trailing-space fix

CmuxClient.createGridLayout(count) pre-creates a tiled grid of surfaces
before launching parallel agents, instead of the previous approach of
creating splits per-agent with alternating right/down directions.

Grid layout strategy:
  1 agent:  [gsd | A]
  2 agents: [gsd | A]    (A split down)
            [    | B]
  3 agents: [gsd | A]    (2x2 grid)
            [ C  | B]
  4 agents: [gsd | A]    (additional splits from bottom-right)
            [ C  | B]
            [    | D]

Changes:
- Add CmuxClient.createSplitFrom(sourceSurfaceId, direction) to split
  from a specific surface rather than always the gsd surface
- Add CmuxClient.createGridLayout(count) that builds the grid and
  returns surface IDs in order
- Update runSingleAgentInCmuxSplit to accept a pre-created surface ID
  (string) or a direction for backward compatibility
- Parallel dispatch pre-creates grid, assigns each agent a surface
- Fix getArgumentCompletions trailing-space handling so sub-completions
  work (e.g., /gsd cmux <tab> now shows status/on/off/etc.)
- 5 new tests for grid layout logic
2026-03-20 08:11:51 -06:00
..
bump-version.mjs feat(ci): automate prod-release with version bump, changelog, and tag push (#1194) 2026-03-18 11:17:43 -06:00
check-skill-references.mjs fix: remove broken SwiftUI skill and add CI reference check (#1476) (#1520) 2026-03-19 18:04:37 -06:00
ci_monitor.cjs feat: add GitHub Workflows skill with CI workflow and ci_monitor tool (#294) 2026-03-13 22:31:17 -06:00
ci_monitor.md feat: add GitHub Workflows skill with CI workflow and ci_monitor tool (#294) 2026-03-13 22:31:17 -06:00
copy-export-html.cjs refactor: extract inline build scripts from package.json to files 2026-03-16 13:34:05 -05:00
copy-resources.cjs fix: apply pi manifest opt-out to extension-discovery.ts (#1545) 2026-03-20 08:11:51 -06:00
copy-themes.cjs refactor: extract inline build scripts from package.json to files 2026-03-16 13:34:05 -05:00
dev.js refactor: deduplicate help text, cross-platform validate-pack, fix dev.js 2026-03-16 13:29:31 -05:00
generate-changelog.mjs feat(ci): automate prod-release with version bump, changelog, and tag push (#1194) 2026-03-18 11:17:43 -06:00
install-hooks.sh feat: add pre-commit secret scanner and CI secret detection (#1148) 2026-03-18 08:33:17 -06:00
install-pi-global.js Add pi global install scripts (#57) 2026-03-11 14:34:03 -06:00
link-workspace-packages.cjs fix: detect broken install and add Windows symlink fallback (#890) 2026-03-17 09:35:57 -06:00
postinstall.js fix: strip clack UI from postinstall, keep silent Playwright download (#783) 2026-03-16 21:35:04 -06:00
preview-dashboard.ts feat(dashboard): two-column layout with redesigned widget (#1530) 2026-03-19 20:07:18 -06:00
secret-scan.sh feat: add pre-commit secret scanner and CI secret detection (#1148) 2026-03-18 08:33:17 -06:00
sync-pkg-version.cjs feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
uninstall-pi-global.js Add pi global install scripts (#57) 2026-03-11 14:34:03 -06:00
update-changelog.mjs feat(ci): automate prod-release with version bump, changelog, and tag push (#1194) 2026-03-18 11:17:43 -06:00
validate-pack.js fix: detect broken install and add Windows symlink fallback (#890) 2026-03-17 09:35:57 -06:00
validate-pack.sh fix: broken npm install — remove bundleDependencies, use postinstall symlinks (#369) 2026-03-14 10:04:12 -06:00
verify-s03.sh feat(wizard): add BRAVE_ANSWERS_KEY support 2026-03-10 22:44:28 -06:00
verify-s04.sh Replace remaining 'get stuff done' instances in verify script 2026-03-11 08:11:11 -06:00
version-stamp.mjs feat(ci): implement three-stage promotion pipeline (Dev → Test → Prod) (#1098) 2026-03-18 00:40:06 -06:00
watch-resources.js fix: read resources from dist/ to prevent branch-drift in npm-link setups (#314) 2026-03-14 11:47:03 -06:00