snipara-companion 1.3.3 → 1.3.4
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/dist/index.d.ts +20 -1
- package/dist/index.js +58 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1213,6 +1213,13 @@ interface CodeSyncCommandOptions extends CodeStatusCommandOptions {
|
|
|
1213
1213
|
commit?: string;
|
|
1214
1214
|
workingTree?: boolean;
|
|
1215
1215
|
}
|
|
1216
|
+
interface CodeUploadCommandOptions extends CodeStatusCommandOptions {
|
|
1217
|
+
cached?: boolean;
|
|
1218
|
+
ttlHours?: number;
|
|
1219
|
+
sourceClient?: string;
|
|
1220
|
+
sessionId?: string;
|
|
1221
|
+
retirePrevious?: boolean;
|
|
1222
|
+
}
|
|
1216
1223
|
interface LocalCodeQueryCommandOptions extends CodeStatusCommandOptions {
|
|
1217
1224
|
cached?: boolean;
|
|
1218
1225
|
qualifiedName?: string;
|
|
@@ -1280,6 +1287,17 @@ interface LocalCodeOverlaySummary {
|
|
|
1280
1287
|
fileSamples: string[];
|
|
1281
1288
|
warnings: LocalCodeOverlayManifest["warnings"];
|
|
1282
1289
|
}
|
|
1290
|
+
interface HostedCodeOverlayUploadPayload {
|
|
1291
|
+
manifest: LocalCodeOverlayManifest;
|
|
1292
|
+
cachePath: string;
|
|
1293
|
+
request: {
|
|
1294
|
+
overlay: LocalCodeOverlayManifest;
|
|
1295
|
+
source_client: string;
|
|
1296
|
+
ttl_hours: number;
|
|
1297
|
+
retire_previous: boolean;
|
|
1298
|
+
session_id?: string;
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1283
1301
|
declare function getLocalCodeOverlayCachePath(cwd?: string): string;
|
|
1284
1302
|
declare function getLocalCodePromotionStatePath(cwd?: string): string;
|
|
1285
1303
|
declare function buildLocalCodeOverlay(options?: LocalCodeOverlayOptions): LocalCodeOverlayManifest;
|
|
@@ -1290,6 +1308,7 @@ declare function writeLocalCodePromotionState(state: LocalCodePromotionState): s
|
|
|
1290
1308
|
declare function readLocalCodePromotionState(cwd?: string): LocalCodePromotionState | null;
|
|
1291
1309
|
declare function buildCodeStatusResult(options: CodeStatusCommandOptions): Record<string, unknown>;
|
|
1292
1310
|
declare function buildCodeSyncResult(options: CodeSyncCommandOptions): Record<string, unknown>;
|
|
1311
|
+
declare function buildHostedCodeOverlayUploadPayload(options?: CodeUploadCommandOptions): HostedCodeOverlayUploadPayload;
|
|
1293
1312
|
declare function buildLocalImportsResult(options: LocalCodeQueryCommandOptions): Record<string, unknown>;
|
|
1294
1313
|
declare function buildLocalCallersResult(options: LocalCodeQueryCommandOptions): Record<string, unknown>;
|
|
1295
1314
|
declare function buildLocalNeighborsResult(options: LocalCodeQueryCommandOptions): Record<string, unknown>;
|
|
@@ -1975,4 +1994,4 @@ interface WrittenOrchestratorHandoff {
|
|
|
1975
1994
|
declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions): OrchestratorHandoffArtifact;
|
|
1976
1995
|
declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
|
|
1977
1996
|
|
|
1978
|
-
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, archiveInactiveTeamSyncWork, autoArchiveTeamSyncState, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, normalizeGuardTag, normalizeWorkflowPlanInput, projectIntelligenceBriefCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, resolveQueryFromToolInput, runMemoryGuardCheck, saveConfig, saveTeamSyncState, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };
|
|
1997
|
+
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, archiveInactiveTeamSyncWork, autoArchiveTeamSyncState, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildHostedCodeOverlayUploadPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, normalizeGuardTag, normalizeWorkflowPlanInput, projectIntelligenceBriefCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, resolveQueryFromToolInput, runMemoryGuardCheck, saveConfig, saveTeamSyncState, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
buildCodePromotionResult: () => buildCodePromotionResult,
|
|
50
50
|
buildCodeStatusResult: () => buildCodeStatusResult,
|
|
51
51
|
buildCodeSyncResult: () => buildCodeSyncResult,
|
|
52
|
+
buildHostedCodeOverlayUploadPayload: () => buildHostedCodeOverlayUploadPayload,
|
|
52
53
|
buildJournalCheckpointEntry: () => buildJournalCheckpointEntry,
|
|
53
54
|
buildLocalCallersResult: () => buildLocalCallersResult,
|
|
54
55
|
buildLocalCodeOverlay: () => buildLocalCodeOverlay,
|
|
@@ -6164,6 +6165,7 @@ var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
|
6164
6165
|
]);
|
|
6165
6166
|
var DEFAULT_MAX_FILES = 2e3;
|
|
6166
6167
|
var DEFAULT_MAX_FILE_BYTES = 1024 * 1024;
|
|
6168
|
+
var DEFAULT_HOSTED_OVERLAY_TTL_HOURS = 48;
|
|
6167
6169
|
var CACHE_RELATIVE_PATH = import_path.default.join(".snipara", "code-overlay", "latest.json");
|
|
6168
6170
|
var PROMOTION_RELATIVE_PATH = import_path.default.join(".snipara", "code-overlay", "promotion.json");
|
|
6169
6171
|
var HOOK_BLOCK_PREFIX = "snipara:code-overlay";
|
|
@@ -6768,6 +6770,31 @@ function buildCodeSyncResult(options) {
|
|
|
6768
6770
|
const cachePath = writeLocalCodeOverlayCache(manifest);
|
|
6769
6771
|
return options.includeGraph ? { ...manifest, cachePath } : { ...summarizeLocalCodeOverlay(manifest), cachePath };
|
|
6770
6772
|
}
|
|
6773
|
+
function buildHostedCodeOverlayUploadPayload(options = {}) {
|
|
6774
|
+
const repoRoot = resolveRepoRoot(options.dir ?? process.cwd());
|
|
6775
|
+
const cached = options.cached ? readLocalCodeOverlayCache(repoRoot) : null;
|
|
6776
|
+
if (options.cached && !cached) {
|
|
6777
|
+
throw new Error("No cached local code overlay found. Run `snipara-companion code sync` first.");
|
|
6778
|
+
}
|
|
6779
|
+
const manifest = cached ?? buildLocalCodeOverlay({
|
|
6780
|
+
cwd: repoRoot,
|
|
6781
|
+
mode: "working_tree",
|
|
6782
|
+
maxFiles: options.maxFiles
|
|
6783
|
+
});
|
|
6784
|
+
const cachePath = writeLocalCodeOverlayCache(manifest);
|
|
6785
|
+
const ttlHours = positiveInteger(options.ttlHours, DEFAULT_HOSTED_OVERLAY_TTL_HOURS);
|
|
6786
|
+
return {
|
|
6787
|
+
manifest,
|
|
6788
|
+
cachePath,
|
|
6789
|
+
request: {
|
|
6790
|
+
overlay: manifest,
|
|
6791
|
+
source_client: options.sourceClient ?? "snipara-companion",
|
|
6792
|
+
ttl_hours: ttlHours,
|
|
6793
|
+
retire_previous: options.retirePrevious !== false,
|
|
6794
|
+
...options.sessionId ? { session_id: options.sessionId } : {}
|
|
6795
|
+
}
|
|
6796
|
+
};
|
|
6797
|
+
}
|
|
6771
6798
|
function buildLocalImportsResult(options) {
|
|
6772
6799
|
const manifest = loadQueryManifest(options);
|
|
6773
6800
|
const symbol = findSymbol(manifest, options);
|
|
@@ -6936,6 +6963,23 @@ async function codeSyncCommand(options) {
|
|
|
6936
6963
|
const cachePath = writeLocalCodeOverlayCache(manifest);
|
|
6937
6964
|
printManifestSummary(manifest, cachePath);
|
|
6938
6965
|
}
|
|
6966
|
+
async function codeUploadCommand(options) {
|
|
6967
|
+
const payload = buildHostedCodeOverlayUploadPayload(options);
|
|
6968
|
+
const result = await createClient(3e4, { cwd: payload.manifest.repoRoot }).callTool("snipara_local_code_overlay_upload", payload.request);
|
|
6969
|
+
const output = { ...result, cachePath: payload.cachePath };
|
|
6970
|
+
if (options.json) {
|
|
6971
|
+
console.log(JSON.stringify(output, null, 2));
|
|
6972
|
+
return;
|
|
6973
|
+
}
|
|
6974
|
+
console.log(import_chalk3.default.bold("Hosted Local Code Overlay"));
|
|
6975
|
+
const overlay = result.overlay ?? {};
|
|
6976
|
+
console.log(`Overlay: ${String(overlay.id ?? "uploaded")}`);
|
|
6977
|
+
console.log(`Repo: ${payload.manifest.repositoryId}`);
|
|
6978
|
+
console.log(`Branch: ${payload.manifest.branch ?? "unknown"}`);
|
|
6979
|
+
console.log(`Expires: ${String(result.expires_at ?? "unknown")}`);
|
|
6980
|
+
console.log(`Cache: ${payload.cachePath}`);
|
|
6981
|
+
console.log("Canonical graph: unchanged until hosted code reindex completes.");
|
|
6982
|
+
}
|
|
6939
6983
|
function hookBlockMarker(hookName, type) {
|
|
6940
6984
|
return `# ${HOOK_BLOCK_PREFIX} ${hookName}:${type}`;
|
|
6941
6985
|
}
|
|
@@ -15023,6 +15067,19 @@ code.addCommand(
|
|
|
15023
15067
|
json: options.json
|
|
15024
15068
|
});
|
|
15025
15069
|
})
|
|
15070
|
+
).addCommand(
|
|
15071
|
+
new import_commander.Command("upload").description("Upload the non-canonical local code overlay through Hosted MCP").option("-d, --dir <directory>", "Repository directory (default: current)").option("--cached", "Upload the cached overlay instead of rebuilding from the working tree").option("--ttl-hours <number>", "Hosted overlay TTL in hours", "48").option("--source-client <name>", "Source client label", "snipara-companion").option("--session-id <id>", "Optional agent/session identifier").option("--no-retire-previous", "Keep older active overlays for the same repository/branch").option("--max-files <number>", "Maximum supported code files to inspect", "2000").option("--json", "Print raw JSON").action(async (options) => {
|
|
15072
|
+
await codeUploadCommand({
|
|
15073
|
+
dir: options.dir,
|
|
15074
|
+
cached: Boolean(options.cached),
|
|
15075
|
+
ttlHours: parseInt(options.ttlHours, 10),
|
|
15076
|
+
sourceClient: options.sourceClient,
|
|
15077
|
+
sessionId: options.sessionId,
|
|
15078
|
+
retirePrevious: options.retirePrevious !== false,
|
|
15079
|
+
maxFiles: parseInt(options.maxFiles, 10),
|
|
15080
|
+
json: options.json
|
|
15081
|
+
});
|
|
15082
|
+
})
|
|
15026
15083
|
).addCommand(
|
|
15027
15084
|
new import_commander.Command("hooks").description(
|
|
15028
15085
|
"Install Git hooks that keep local code overlays fresh before hosted push/index catches up"
|
|
@@ -15342,6 +15399,7 @@ if (require.main === module) {
|
|
|
15342
15399
|
buildCodePromotionResult,
|
|
15343
15400
|
buildCodeStatusResult,
|
|
15344
15401
|
buildCodeSyncResult,
|
|
15402
|
+
buildHostedCodeOverlayUploadPayload,
|
|
15345
15403
|
buildJournalCheckpointEntry,
|
|
15346
15404
|
buildLocalCallersResult,
|
|
15347
15405
|
buildLocalCodeOverlay,
|