fix: add barrel files for remote-questions, ttsr, and shared extensions (#1048)
* fix: add barrel files for remote-questions, ttsr, and shared extensions Centralizes public API surface for three extension directories behind index.ts barrel files. External consumers now import from the barrel instead of reaching into internal module files, reducing coupling and making future refactors safer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: rename barrel files to mod.ts to avoid extension loader auto-discovery The extension loader auto-discovers extensions by looking for index.ts files inside extensions/*/ directories. remote-questions/ and shared/ are utility directories, not extensions — their index.ts barrel files caused load failures. Renamed to mod.ts which the loader ignores, and updated all import paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
27e79f76b3
commit
94be09482f
31 changed files with 81 additions and 34 deletions
|
|
@ -18,7 +18,7 @@ import {
|
|||
type Question,
|
||||
type QuestionOption,
|
||||
type RoundResult,
|
||||
} from "./shared/interview-ui.js";
|
||||
} from "./shared/mod.js";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export function restoreWindowsVTInput(): void {
|
|||
|
||||
// ── Time Formatting ────────────────────────────────────────────────────────
|
||||
|
||||
import { formatDuration } from "../shared/format-utils.js";
|
||||
import { formatDuration } from "../shared/mod.js";
|
||||
|
||||
export const formatUptime = formatDuration;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { resolve } from "node:path";
|
|||
import type { ExtensionAPI, Theme } from "@gsd/pi-coding-agent";
|
||||
import { CURSOR_MARKER, Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth, wrapTextWithAnsi } from "@gsd/pi-tui";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { makeUI, type ProgressStatus } from "./shared/ui.js";
|
||||
import { makeUI, type ProgressStatus } from "./shared/mod.js";
|
||||
import { parseSecretsManifest, formatSecretsManifest } from "./gsd/files.js";
|
||||
import { resolveMilestoneFile } from "./gsd/paths.js";
|
||||
import type { SecretsManifestEntry } from "./gsd/types.js";
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { parseRoadmap, parsePlan } from "./files.js";
|
||||
import { readFileSync, existsSync } from "node:fs";
|
||||
import { truncateToWidth, visibleWidth } from "@gsd/pi-tui";
|
||||
import { makeUI, GLYPH, INDENT } from "../shared/ui.js";
|
||||
import { makeUI, GLYPH, INDENT } from "../shared/mod.js";
|
||||
|
||||
// ─── Dashboard Data ───────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ import {
|
|||
} from "./auto-worktree.js";
|
||||
import { pruneQueueOrder } from "./queue-order.js";
|
||||
import { consumeSignal } from "./session-status-io.js";
|
||||
import { showNextAction } from "../shared/next-action-ui.js";
|
||||
import { showNextAction } from "../shared/mod.js";
|
||||
import { debugLog, debugTime, debugCount, debugPeak, enableDebug, isDebugEnabled, writeDebugSummary, getDebugLogPath } from "./debug-logger.js";
|
||||
import {
|
||||
resolveExpectedArtifactPath,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import {
|
|||
} from "./doctor.js";
|
||||
import { loadPrompt } from "./prompt-loader.js";
|
||||
|
||||
import { handleRemote } from "../remote-questions/remote-command.js";
|
||||
import { handleRemote } from "../remote-questions/mod.js";
|
||||
import { handleQuick } from "./quick.js";
|
||||
import { handleHistory } from "./history.js";
|
||||
import { handleUndo } from "./undo.js";
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ import {
|
|||
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
||||
import { getActiveWorktreeName } from "./worktree-command.js";
|
||||
import { getWorkerBatches, hasActiveWorkers, type WorkerEntry } from "../subagent/worker-registry.js";
|
||||
import { formatDuration, padRight, joinColumns, centerLine, fitColumns } from "../shared/format-utils.js";
|
||||
import { STATUS_GLYPH, STATUS_COLOR } from "../shared/ui.js";
|
||||
import { formatDuration, padRight, joinColumns, centerLine, fitColumns, STATUS_GLYPH, STATUS_COLOR } from "../shared/mod.js";
|
||||
import { estimateTimeRemaining } from "./auto-dashboard.js";
|
||||
|
||||
function unitLabel(type: string): string {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from "./metrics.js";
|
||||
import type { UnitMetrics } from "./metrics.js";
|
||||
import { gsdRoot } from "./paths.js";
|
||||
import { formatDuration } from "../shared/format-utils.js";
|
||||
import { formatDuration } from "../shared/mod.js";
|
||||
|
||||
/**
|
||||
* Write an export file directly, without requiring an ExtensionCommandContext.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import { deriveState } from "./state.js";
|
|||
import { isAutoActive } from "./auto.js";
|
||||
import { loadPrompt } from "./prompt-loader.js";
|
||||
import { gsdRoot } from "./paths.js";
|
||||
import { formatDuration } from "../shared/format-utils.js";
|
||||
import { formatDuration } from "../shared/mod.js";
|
||||
import { getAutoWorktreePath } from "./auto-worktree.js";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
||||
import { showNextAction } from "../shared/next-action-ui.js";
|
||||
import { showNextAction } from "../shared/mod.js";
|
||||
import { loadFile, parseRoadmap } from "./files.js";
|
||||
import { loadPrompt, inlineTemplate } from "./prompt-loader.js";
|
||||
import { deriveState } from "./state.js";
|
||||
|
|
@ -29,7 +29,7 @@ import { ensureGitignore, ensurePreferences, untrackRuntimeFiles } from "./gitig
|
|||
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
||||
import { detectProjectState } from "./detection.js";
|
||||
import { showProjectInit, offerMigration } from "./init-wizard.js";
|
||||
import { showConfirm } from "../shared/confirm-ui.js";
|
||||
import { showConfirm } from "../shared/mod.js";
|
||||
import { loadQueueOrder, sortByQueueOrder, saveQueueOrder } from "./queue-order.js";
|
||||
import { debugLog } from "./debug-logger.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ import { Key } from "@gsd/pi-tui";
|
|||
import { join } from "node:path";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import { shortcutDesc } from "../shared/terminal.js";
|
||||
import { shortcutDesc } from "../shared/mod.js";
|
||||
import { Text } from "@gsd/pi-tui";
|
||||
import { pauseAutoForProviderError, classifyProviderError } from "./provider-error-pause.js";
|
||||
import { toPosixPath } from "../shared/path-display.js";
|
||||
import { toPosixPath } from "../shared/mod.js";
|
||||
import { isParallelActive, shutdownParallel } from "./parallel-orchestrator.js";
|
||||
import { DEFAULT_BASH_TIMEOUT_SECS } from "./constants.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
||||
import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { showNextAction } from "../shared/next-action-ui.js";
|
||||
import { showNextAction } from "../shared/mod.js";
|
||||
import { nativeIsRepo, nativeInit, nativeAddPaths, nativeCommit } from "./native-git-bridge.js";
|
||||
import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
||||
import { gsdRoot } from "./paths.js";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { gsdRoot } from "./paths.js";
|
|||
import { getAndClearSkills } from "./skill-telemetry.js";
|
||||
|
||||
// Re-export from shared — canonical implementation lives in format-utils.
|
||||
export { formatTokenCount } from "../shared/format-utils.js";
|
||||
export { formatTokenCount } from "../shared/mod.js";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent
|
|||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { resolve, join, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { showNextAction } from "../../shared/next-action-ui.js";
|
||||
import { showNextAction } from "../../shared/mod.js";
|
||||
import {
|
||||
validatePlanningDirectory,
|
||||
parsePlanningDirectory,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// Zero Pi dependencies — uses only exported helpers from files.ts.
|
||||
|
||||
import { splitFrontmatter, parseFrontmatterMap, extractBoldField } from '../files.js';
|
||||
import { normalizeStringArray } from '../../shared/format-utils.js';
|
||||
import { normalizeStringArray } from '../../shared/mod.js';
|
||||
|
||||
import type {
|
||||
PlanningRoadmap,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import type { PostUnitHookConfig, PreDispatchHookConfig, BudgetEnforcementMode,
|
|||
import type { DynamicRoutingConfig } from "./model-router.js";
|
||||
import { defaultRoutingConfig } from "./model-router.js";
|
||||
import { VALID_BRANCH_NAME } from "./git-service.js";
|
||||
import { normalizeStringArray } from "../shared/format-utils.js";
|
||||
import { normalizeStringArray } from "../shared/mod.js";
|
||||
|
||||
const GLOBAL_PREFERENCES_PATH = join(homedir(), ".gsd", "preferences.md");
|
||||
const LEGACY_GLOBAL_PREFERENCES_PATH = join(homedir(), ".pi", "agent", "gsd-preferences.md");
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
import type { ExtensionContext } from "@gsd/pi-coding-agent";
|
||||
import { type Theme } from "@gsd/pi-coding-agent";
|
||||
import { Key, matchesKey, truncateToWidth, type TUI } from "@gsd/pi-tui";
|
||||
import { makeUI, GLYPH } from "../shared/ui.js";
|
||||
import { makeUI, GLYPH } from "../shared/mod.js";
|
||||
import { validateQueueOrder, type DependencyValidation } from "./queue-order.js";
|
||||
|
||||
export interface ReorderItem {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import assert from "node:assert/strict";
|
|||
import { mkdirSync, rmSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { createPromptRecord, writePromptRecord } from "../../remote-questions/store.ts";
|
||||
import { getLatestPromptSummary } from "../../remote-questions/status.ts";
|
||||
import { createPromptRecord, writePromptRecord } from "../../remote-questions/mod.js";
|
||||
import { getLatestPromptSummary } from "../../remote-questions/mod.js";
|
||||
|
||||
function withTempHome(fn: (tempHome: string) => void | Promise<void>) {
|
||||
return async () => {
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ assertTrue(
|
|||
console.log("\n=== Overlay: Shared Imports ===");
|
||||
|
||||
assertTrue(
|
||||
overlaySrc.includes('from "../shared/format-utils.js"'),
|
||||
"imports from shared format-utils",
|
||||
overlaySrc.includes('from "../shared/mod.js"'),
|
||||
"imports from shared barrel",
|
||||
);
|
||||
|
||||
report();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
import type { ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
||||
import { showNextAction } from "../shared/next-action-ui.js";
|
||||
import { showNextAction } from "../shared/mod.js";
|
||||
import type { CaptureEntry, Classification, TriageResult } from "./captures.js";
|
||||
import { markCaptureResolved } from "./captures.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
type ProgressFilter,
|
||||
} from "./visualizer-views.js";
|
||||
import { writeExportFile } from "./export.js";
|
||||
import { stripAnsi } from "../shared/format-utils.js";
|
||||
import { stripAnsi } from "../shared/mod.js";
|
||||
|
||||
const TAB_COUNT = 10;
|
||||
const TAB_LABELS = [
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ import type { Theme } from "@gsd/pi-coding-agent";
|
|||
import { truncateToWidth, visibleWidth } from "@gsd/pi-tui";
|
||||
import type { VisualizerData, VisualizerMilestone, SliceVerification, VisualizerSliceActivity, VisualizerStats, VisualizerSliceRef } from "./visualizer-data.js";
|
||||
import { formatCost, formatTokenCount, classifyUnitPhase } from "./metrics.js";
|
||||
import { formatDuration, padRight, joinColumns, sparkline } from "../shared/format-utils.js";
|
||||
import { STATUS_GLYPH, STATUS_COLOR } from "../shared/ui.js";
|
||||
import { formatDuration, padRight, joinColumns, sparkline, STATUS_GLYPH, STATUS_COLOR } from "../shared/mod.js";
|
||||
|
||||
function formatCompletionDate(input: string): string {
|
||||
if (!input) return "unknown";
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent
|
|||
import { loadPrompt } from "./prompt-loader.js";
|
||||
import { autoCommitCurrentBranch, getMainBranch, resolveGitHeadPath, nudgeGitBranchCache } from "./worktree.js";
|
||||
import { runWorktreePostCreateHook } from "./auto-worktree.js";
|
||||
import { showConfirm } from "../shared/confirm-ui.js";
|
||||
import { showConfirm } from "../shared/mod.js";
|
||||
import { gsdRoot, milestonesDir } from "./paths.js";
|
||||
import {
|
||||
createWorktree,
|
||||
|
|
|
|||
15
src/resources/extensions/remote-questions/mod.ts
Normal file
15
src/resources/extensions/remote-questions/mod.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Barrel file — re-exports consumed by external modules
|
||||
|
||||
export { handleRemote } from "./remote-command.js";
|
||||
export { createPromptRecord, writePromptRecord } from "./store.js";
|
||||
export { getLatestPromptSummary } from "./status.js";
|
||||
export {
|
||||
parseSlackReply,
|
||||
parseDiscordResponse,
|
||||
formatForDiscord,
|
||||
formatForSlack,
|
||||
parseSlackReactionResponse,
|
||||
formatForTelegram,
|
||||
parseTelegramResponse,
|
||||
} from "./format.js";
|
||||
export { resolveRemoteConfig, isValidChannelId } from "./config.js";
|
||||
29
src/resources/extensions/shared/mod.ts
Normal file
29
src/resources/extensions/shared/mod.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Barrel file — re-exports consumed by external modules
|
||||
|
||||
export {
|
||||
makeUI,
|
||||
GLYPH,
|
||||
INDENT,
|
||||
STATUS_GLYPH,
|
||||
STATUS_COLOR,
|
||||
} from "./ui.js";
|
||||
export type { ProgressStatus } from "./ui.js";
|
||||
|
||||
export {
|
||||
stripAnsi,
|
||||
formatTokenCount,
|
||||
formatDuration,
|
||||
padRight,
|
||||
joinColumns,
|
||||
centerLine,
|
||||
fitColumns,
|
||||
sparkline,
|
||||
normalizeStringArray,
|
||||
} from "./format-utils.js";
|
||||
|
||||
export { shortcutDesc } from "./terminal.js";
|
||||
export { toPosixPath } from "./path-display.js";
|
||||
export { showInterviewRound } from "./interview-ui.js";
|
||||
export type { Question, QuestionOption, RoundResult } from "./interview-ui.js";
|
||||
export { showNextAction } from "./next-action-ui.js";
|
||||
export { showConfirm } from "./confirm-ui.js";
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
||||
import { showInterviewRound, type Question, type RoundResult } from "../shared/interview-ui.js";
|
||||
import { showInterviewRound, type Question, type RoundResult } from "../shared/mod.js";
|
||||
|
||||
export default function createExtension(pi: ExtensionAPI) {
|
||||
pi.registerCommand("create-extension", {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
||||
import { showInterviewRound, type Question, type RoundResult } from "../shared/interview-ui.js";
|
||||
import { showInterviewRound, type Question, type RoundResult } from "../shared/mod.js";
|
||||
|
||||
export default function createSlashCommand(pi: ExtensionAPI) {
|
||||
pi.registerCommand("create-slash-command", {
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ function extractDeltaContext(
|
|||
return null;
|
||||
}
|
||||
|
||||
// Re-exports for external consumers
|
||||
export { TtsrManager } from "./ttsr-manager.js";
|
||||
export type { Rule, TtsrMatchContext } from "./ttsr-manager.js";
|
||||
export { loadRules } from "./rule-loader.js";
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
let manager: TtsrManager | null = null;
|
||||
let pendingViolation: PendingViolation | null = null;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ExtensionAPI, ExtensionContext } from "@gsd/pi-coding-agent";
|
||||
import { shortcutDesc } from "../shared/terminal.js";
|
||||
import { shortcutDesc } from "../shared/mod.js";
|
||||
import type { AssistantMessage } from "@gsd/pi-ai";
|
||||
import { isKeyRelease, Key, matchesKey, truncateToWidth, visibleWidth } from "@gsd/pi-tui";
|
||||
import { spawn, execSync, type ChildProcess } from "node:child_process";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { TtsrManager, type Rule, type TtsrMatchContext } from '../../src/resources/extensions/ttsr/ttsr-manager.ts'
|
||||
import { TtsrManager, type Rule, type TtsrMatchContext } from '../../src/resources/extensions/ttsr/index.js'
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs'
|
|||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
|
||||
import { loadRules } from '../../src/resources/extensions/ttsr/rule-loader.ts'
|
||||
import { loadRules } from '../../src/resources/extensions/ttsr/index.js'
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue