fix: rename all packages from @mosaic/* to @mosaicstack/*
- Updated all package.json name fields and dependency references - Updated all TypeScript/JavaScript imports - Updated .woodpecker/publish.yml filters and registry paths - Updated tools/install.sh scope default - Updated .npmrc registry paths (worktree + host) - Enhanced update-checker.ts with checkForAllUpdates() multi-package support - Updated CLI update command to show table of all packages - Added KNOWN_PACKAGES, formatAllPackagesTable, getInstallAllCommand - Marked checkForUpdate() with @deprecated JSDoc Closes #391
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/agent",
|
||||
"name": "@mosaicstack/agent",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,7 +21,7 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/types": "workspace:*"
|
||||
"@mosaicstack/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/auth",
|
||||
"name": "@mosaicstack/auth",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -28,7 +28,7 @@
|
||||
"vitest": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/db": "workspace:^",
|
||||
"@mosaicstack/db": "workspace:^",
|
||||
"better-auth": "^1.5.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('buildOAuthProviders', () => {
|
||||
process.env['WORKOS_CLIENT_ID'] = 'client_test123';
|
||||
|
||||
expect(() => buildOAuthProviders()).toThrow(
|
||||
'@mosaic/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.',
|
||||
'@mosaicstack/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ describe('buildOAuthProviders', () => {
|
||||
process.env['KEYCLOAK_CLIENT_SECRET'] = 'secret123';
|
||||
|
||||
expect(() => buildOAuthProviders()).toThrow(
|
||||
'@mosaic/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.',
|
||||
'@mosaicstack/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -129,7 +129,7 @@ describe('buildOAuthProviders', () => {
|
||||
process.env['AUTHENTIK_CLIENT_ID'] = 'authentik-client';
|
||||
|
||||
expect(() => buildOAuthProviders()).toThrow(
|
||||
'@mosaic/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.',
|
||||
'@mosaicstack/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { betterAuth } from 'better-auth';
|
||||
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
|
||||
import { admin } from 'better-auth/plugins';
|
||||
import { genericOAuth, type GenericOAuthConfig } from 'better-auth/plugins/generic-oauth';
|
||||
import type { Db } from '@mosaic/db';
|
||||
import type { Db } from '@mosaicstack/db';
|
||||
import { buildGenericOidcProviderConfigs } from './sso.js';
|
||||
|
||||
export interface AuthConfig {
|
||||
|
||||
@@ -66,7 +66,7 @@ function buildAuthentikConfig(env: EnvMap): GenericOidcProviderConfig | null {
|
||||
const presentCount = fields.filter(Boolean).length;
|
||||
if (presentCount > 0 && presentCount < fields.length) {
|
||||
throw new Error(
|
||||
'@mosaic/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.',
|
||||
'@mosaicstack/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.',
|
||||
);
|
||||
}
|
||||
if (!issuer || !clientId || !clientSecret) {
|
||||
@@ -97,7 +97,7 @@ function buildWorkosConfig(env: EnvMap): GenericOidcProviderConfig | null {
|
||||
const presentCount = fields.filter(Boolean).length;
|
||||
if (presentCount > 0 && presentCount < fields.length) {
|
||||
throw new Error(
|
||||
'@mosaic/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.',
|
||||
'@mosaicstack/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.',
|
||||
);
|
||||
}
|
||||
if (!issuer || !clientId || !clientSecret) {
|
||||
@@ -135,7 +135,7 @@ function buildKeycloakConfig(env: EnvMap): GenericOidcProviderConfig | null {
|
||||
const anySet = !!(issuer || clientId || clientSecret);
|
||||
if (anySet && (!issuer || !clientId || !clientSecret)) {
|
||||
throw new Error(
|
||||
'@mosaic/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.',
|
||||
'@mosaicstack/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.',
|
||||
);
|
||||
}
|
||||
if (!issuer || !clientId || !clientSecret) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/brain",
|
||||
"name": "@mosaicstack/brain",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,8 +21,8 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/db": "workspace:^",
|
||||
"@mosaic/types": "workspace:*"
|
||||
"@mosaicstack/db": "workspace:^",
|
||||
"@mosaicstack/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, or, type Db, agents } from '@mosaic/db';
|
||||
import { eq, and, or, type Db, agents } from '@mosaicstack/db';
|
||||
|
||||
export type Agent = typeof agents.$inferSelect;
|
||||
export type NewAgent = typeof agents.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Db } from '@mosaic/db';
|
||||
import type { Db } from '@mosaicstack/db';
|
||||
import { createProjectsRepo, type ProjectsRepo } from './projects.js';
|
||||
import { createMissionsRepo, type MissionsRepo } from './missions.js';
|
||||
import { createMissionTasksRepo, type MissionTasksRepo } from './mission-tasks.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, asc, desc, ilike, type Db, conversations, messages } from '@mosaic/db';
|
||||
import { eq, and, asc, desc, ilike, type Db, conversations, messages } from '@mosaicstack/db';
|
||||
|
||||
/** Maximum number of conversations returned per list query. */
|
||||
const MAX_CONVERSATIONS = 200;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, type Db, missionTasks } from '@mosaic/db';
|
||||
import { eq, and, type Db, missionTasks } from '@mosaicstack/db';
|
||||
|
||||
export type MissionTask = typeof missionTasks.$inferSelect;
|
||||
export type NewMissionTask = typeof missionTasks.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, type Db, missions } from '@mosaic/db';
|
||||
import { eq, and, type Db, missions } from '@mosaicstack/db';
|
||||
|
||||
export type Mission = typeof missions.$inferSelect;
|
||||
export type NewMission = typeof missions.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, or, inArray, type Db, projects, teamMembers } from '@mosaic/db';
|
||||
import { eq, or, inArray, type Db, projects, teamMembers } from '@mosaicstack/db';
|
||||
|
||||
export type Project = typeof projects.$inferSelect;
|
||||
export type NewProject = typeof projects.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, type Db, tasks } from '@mosaic/db';
|
||||
import { eq, type Db, tasks } from '@mosaicstack/db';
|
||||
|
||||
export type Task = typeof tasks.$inferSelect;
|
||||
export type NewTask = typeof tasks.$inferInsert;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/cli",
|
||||
"name": "@mosaicstack/cli",
|
||||
"version": "0.0.17",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -27,11 +27,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.9.0",
|
||||
"@mosaic/config": "workspace:^",
|
||||
"@mosaic/mosaic": "workspace:^",
|
||||
"@mosaic/prdy": "workspace:^",
|
||||
"@mosaic/quality-rails": "workspace:^",
|
||||
"@mosaic/types": "workspace:^",
|
||||
"@mosaicstack/config": "workspace:^",
|
||||
"@mosaicstack/mosaic": "workspace:^",
|
||||
"@mosaicstack/prdy": "workspace:^",
|
||||
"@mosaicstack/quality-rails": "workspace:^",
|
||||
"@mosaicstack/types": "workspace:^",
|
||||
"commander": "^13.0.0",
|
||||
"ink": "^5.0.0",
|
||||
"ink-spinner": "^5.0.0",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { createRequire } from 'module';
|
||||
import { Command } from 'commander';
|
||||
import { registerQualityRails } from '@mosaic/quality-rails';
|
||||
import { registerQualityRails } from '@mosaicstack/quality-rails';
|
||||
import { registerAgentCommand } from './commands/agent.js';
|
||||
import { registerMissionCommand } from './commands/mission.js';
|
||||
// prdy is registered via launch.ts
|
||||
@@ -14,7 +14,7 @@ const CLI_VERSION: string = (_require('../package.json') as { version: string })
|
||||
|
||||
// Fire-and-forget update check at startup (non-blocking, cached 1h)
|
||||
try {
|
||||
const { backgroundUpdateCheck } = await import('@mosaic/mosaic');
|
||||
const { backgroundUpdateCheck } = await import('@mosaicstack/mosaic');
|
||||
backgroundUpdateCheck();
|
||||
} catch {
|
||||
// Silently ignore — update check is best-effort
|
||||
@@ -314,38 +314,36 @@ program
|
||||
.description('Check for and install Mosaic CLI updates')
|
||||
.option('--check', 'Check only, do not install')
|
||||
.action(async (opts: { check?: boolean }) => {
|
||||
const { checkForUpdate, formatUpdateNotice, getInstallCommand } =
|
||||
await import('@mosaic/mosaic');
|
||||
const { checkForAllUpdates, formatAllPackagesTable, getInstallAllCommand } =
|
||||
await import('@mosaicstack/mosaic');
|
||||
const { execSync } = await import('node:child_process');
|
||||
|
||||
console.log('Checking for updates…');
|
||||
const result = checkForUpdate({ skipCache: true });
|
||||
const results = checkForAllUpdates({ skipCache: true });
|
||||
|
||||
if (!result.latest) {
|
||||
console.error('Could not reach the Mosaic registry.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('');
|
||||
console.log(formatAllPackagesTable(results));
|
||||
|
||||
console.log(` Installed: ${result.current || '(none)'}`);
|
||||
console.log(` Latest: ${result.latest}`);
|
||||
|
||||
if (!result.updateAvailable) {
|
||||
console.log('\n✔ Up to date.');
|
||||
const outdated = results.filter((r: { updateAvailable: boolean }) => r.updateAvailable);
|
||||
if (outdated.length === 0) {
|
||||
const anyInstalled = results.some((r: { current: string }) => r.current);
|
||||
if (!anyInstalled) {
|
||||
console.error('No @mosaicstack/* packages are installed.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('\n✔ All packages up to date.');
|
||||
return;
|
||||
}
|
||||
|
||||
const notice = formatUpdateNotice(result);
|
||||
if (notice) console.log(notice);
|
||||
|
||||
if (opts.check) {
|
||||
process.exit(2); // Signal to callers that an update exists
|
||||
}
|
||||
|
||||
console.log('Installing update…');
|
||||
console.log(`\nInstalling ${outdated.length} update(s)…`);
|
||||
try {
|
||||
// Relies on @mosaic:registry in ~/.npmrc — do NOT pass --registry
|
||||
// globally or non-@mosaic deps will 404 against the Gitea registry.
|
||||
execSync(getInstallCommand(result), {
|
||||
// Relies on @mosaicstack:registry in ~/.npmrc
|
||||
const cmd = getInstallAllCommand(outdated);
|
||||
execSync(cmd, {
|
||||
stdio: 'inherit',
|
||||
timeout: 60_000,
|
||||
});
|
||||
@@ -380,7 +378,7 @@ program
|
||||
createConfigService,
|
||||
WizardCancelledError,
|
||||
DEFAULT_MOSAIC_HOME,
|
||||
} = await import('@mosaic/mosaic');
|
||||
} = await import('@mosaicstack/mosaic');
|
||||
|
||||
try {
|
||||
const mosaicHome = (opts['mosaicHome'] as string | undefined) ?? DEFAULT_MOSAIC_HOME;
|
||||
|
||||
@@ -91,10 +91,10 @@ export function resolveGatewayEntry(): string {
|
||||
return meta.entryPoint;
|
||||
}
|
||||
|
||||
// Try to resolve from globally installed @mosaic/gateway
|
||||
// Try to resolve from globally installed @mosaicstack/gateway
|
||||
try {
|
||||
const req = createRequire(import.meta.url);
|
||||
const pkgPath = req.resolve('@mosaic/gateway/package.json');
|
||||
const pkgPath = req.resolve('@mosaicstack/gateway/package.json');
|
||||
const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js');
|
||||
if (existsSync(mainEntry)) return mainEntry;
|
||||
} catch {
|
||||
@@ -210,8 +210,8 @@ function sleep(ms: number): Promise<void> {
|
||||
const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/';
|
||||
|
||||
export function installGatewayPackage(): void {
|
||||
console.log('Installing @mosaic/gateway from Gitea registry...');
|
||||
execSync(`npm install -g @mosaic/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, {
|
||||
console.log('Installing @mosaicstack/gateway from Gitea registry...');
|
||||
execSync(`npm install -g @mosaicstack/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, {
|
||||
stdio: 'inherit',
|
||||
timeout: 120_000,
|
||||
});
|
||||
@@ -219,7 +219,7 @@ export function installGatewayPackage(): void {
|
||||
|
||||
export function uninstallGatewayPackage(): void {
|
||||
try {
|
||||
execSync('npm uninstall -g @mosaic/gateway', {
|
||||
execSync('npm uninstall -g @mosaicstack/gateway', {
|
||||
stdio: 'inherit',
|
||||
timeout: 60_000,
|
||||
});
|
||||
@@ -230,15 +230,15 @@ export function uninstallGatewayPackage(): void {
|
||||
|
||||
export function getInstalledGatewayVersion(): string | null {
|
||||
try {
|
||||
const output = execSync('npm ls -g @mosaic/gateway --json --depth=0', {
|
||||
const output = execSync('npm ls -g @mosaicstack/gateway --json --depth=0', {
|
||||
encoding: 'utf-8',
|
||||
timeout: 15_000,
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
});
|
||||
const data = JSON.parse(output) as {
|
||||
dependencies?: { '@mosaic/gateway'?: { version?: string } };
|
||||
dependencies?: { '@mosaicstack/gateway'?: { version?: string } };
|
||||
};
|
||||
return data.dependencies?.['@mosaic/gateway']?.version ?? null;
|
||||
return data.dependencies?.['@mosaicstack/gateway']?.version ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType<typeof createInterface>, opts: InstallOp
|
||||
entryPoint = resolveGatewayEntry();
|
||||
} catch {
|
||||
console.error('Error: Gateway package not found after install.');
|
||||
console.error('Check that @mosaic/gateway installed correctly.');
|
||||
console.error('Check that @mosaicstack/gateway installed correctly.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -494,13 +494,13 @@ function delegateToScript(scriptPath: string, args: string[], env?: Record<strin
|
||||
|
||||
/**
|
||||
* Resolve a path under the framework tools directory. Prefers the version
|
||||
* bundled in the @mosaic/mosaic npm package (always matches the installed
|
||||
* bundled in the @mosaicstack/mosaic npm package (always matches the installed
|
||||
* CLI version) over the deployed copy in ~/.config/mosaic/ (may be stale).
|
||||
*/
|
||||
function resolveTool(...segments: string[]): string {
|
||||
try {
|
||||
const req = createRequire(import.meta.url);
|
||||
const mosaicPkg = dirname(req.resolve('@mosaic/mosaic/package.json'));
|
||||
const mosaicPkg = dirname(req.resolve('@mosaicstack/mosaic/package.json'));
|
||||
const bundled = join(mosaicPkg, 'framework', 'tools', ...segments);
|
||||
if (existsSync(bundled)) return bundled;
|
||||
} catch {
|
||||
|
||||
@@ -255,7 +255,7 @@ async function planMission(
|
||||
console.log(`Planning mission: ${mission.name}\n`);
|
||||
|
||||
try {
|
||||
const { runPrdWizard } = await import('@mosaic/prdy');
|
||||
const { runPrdWizard } = await import('@mosaicstack/prdy');
|
||||
await runPrdWizard({
|
||||
name: mission.name,
|
||||
projectPath: process.cwd(),
|
||||
|
||||
@@ -32,7 +32,7 @@ export function registerPrdyCommand(program: Command) {
|
||||
}
|
||||
|
||||
try {
|
||||
const { runPrdWizard } = await import('@mosaic/prdy');
|
||||
const { runPrdWizard } = await import('@mosaicstack/prdy');
|
||||
const name =
|
||||
typeof opts.init === 'string'
|
||||
? opts.init
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { Box, useApp, useInput } from 'ink';
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
import { TopBar } from './components/top-bar.js';
|
||||
import { BottomBar } from './components/bottom-bar.js';
|
||||
import { MessageList } from './components/message-list.js';
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { parseSlashCommand } from './parse.js';
|
||||
import { CommandRegistry } from './registry.js';
|
||||
import type { CommandDef } from '@mosaic/types';
|
||||
import type { CommandDef } from '@mosaicstack/types';
|
||||
|
||||
// ─── Parse + Registry Round-trip ─────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
import { commandRegistry } from '../registry.js';
|
||||
|
||||
export function executeHelp(_parsed: ParsedCommand): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
|
||||
export interface StatusContext {
|
||||
connected: boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
|
||||
export function parseSlashCommand(input: string): ParsedCommand | null {
|
||||
const match = input.match(/^\/([a-z][a-z0-9:_-]*)\s*(.*)?$/i);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommandDef, CommandManifest } from '@mosaic/types';
|
||||
import type { CommandDef, CommandManifest } from '@mosaicstack/types';
|
||||
|
||||
// Local-only commands (work even when gateway is disconnected)
|
||||
const LOCAL_COMMANDS: CommandDef[] = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import type { RoutingDecisionInfo } from '@mosaic/types';
|
||||
import type { RoutingDecisionInfo } from '@mosaicstack/types';
|
||||
import type { TokenUsage } from '../hooks/use-socket.js';
|
||||
import type { GitInfo } from '../hooks/use-git-info.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import type { CommandDef, CommandArgDef } from '@mosaic/types';
|
||||
import type { CommandDef, CommandArgDef } from '@mosaicstack/types';
|
||||
|
||||
interface CommandAutocompleteProps {
|
||||
commands: CommandDef[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Box, Text, useInput } from 'ink';
|
||||
import TextInput from 'ink-text-input';
|
||||
import type { ParsedCommand, CommandDef } from '@mosaic/types';
|
||||
import type { ParsedCommand, CommandDef } from '@mosaicstack/types';
|
||||
import { parseSlashCommand, commandRegistry } from '../commands/index.js';
|
||||
import { CommandAutocomplete } from './command-autocomplete.js';
|
||||
import { useInputHistory } from '../hooks/use-input-history.js';
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
SlashCommandResultPayload,
|
||||
SystemReloadPayload,
|
||||
RoutingDecisionInfo,
|
||||
} from '@mosaic/types';
|
||||
} from '@mosaicstack/types';
|
||||
import { commandRegistry } from '../commands/index.js';
|
||||
|
||||
export interface ToolCall {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/config",
|
||||
"name": "@mosaicstack/config",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -22,9 +22,9 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/memory": "workspace:^",
|
||||
"@mosaic/queue": "workspace:^",
|
||||
"@mosaic/storage": "workspace:^"
|
||||
"@mosaicstack/memory": "workspace:^",
|
||||
"@mosaicstack/queue": "workspace:^",
|
||||
"@mosaicstack/storage": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^9.0.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import type { StorageConfig } from '@mosaic/storage';
|
||||
import type { QueueAdapterConfig as QueueConfig } from '@mosaic/queue';
|
||||
import type { StorageConfig } from '@mosaicstack/storage';
|
||||
import type { QueueAdapterConfig as QueueConfig } from '@mosaicstack/queue';
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Types */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/coord",
|
||||
"name": "@mosaicstack/coord",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,7 +21,7 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/types": "workspace:*"
|
||||
"@mosaicstack/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
|
||||
@@ -9,9 +9,9 @@ const SAMPLE_TASKS_MD = `# Tasks — MVP
|
||||
| id | status | milestone | description | pr | notes |
|
||||
| ------ | ----------- | --------- | ------------------------------------------ | --- | ----- |
|
||||
| P0-001 | done | Phase 0 | Scaffold monorepo | #60 | #1 |
|
||||
| P0-002 | done | Phase 0 | @mosaic/types — migrate and extend | #65 | #2 |
|
||||
| P0-002 | done | Phase 0 | @mosaicstack/types — migrate and extend | #65 | #2 |
|
||||
| P1-001 | in-progress | Phase 1 | apps/gateway scaffold | #61 | #10 |
|
||||
| P2-001 | not-started | Phase 2 | @mosaic/agent — Pi SDK integration | — | #19 |
|
||||
| P2-001 | not-started | Phase 2 | @mosaicstack/agent — Pi SDK integration | — | #19 |
|
||||
| P2-002 | blocked | Phase 2 | Multi-provider support | — | #20 |
|
||||
`;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/db",
|
||||
"name": "@mosaicstack/db",
|
||||
"version": "0.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/design-tokens",
|
||||
"name": "@mosaicstack/design-tokens",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getPipelineStatus,
|
||||
} from '../src/pipeline-runner.js';
|
||||
import type { ForgeTask, RunManifest, TaskExecutor } from '../src/types.js';
|
||||
import type { TaskResult } from '@mosaic/macp';
|
||||
import type { TaskResult } from '@mosaicstack/macp';
|
||||
|
||||
/** Mock TaskExecutor that records submitted tasks and returns success. */
|
||||
function createMockExecutor(options?: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/forge",
|
||||
"name": "@mosaicstack/forge",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -26,7 +26,7 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/macp": "workspace:*"
|
||||
"@mosaicstack/macp": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { GateEntry, TaskResult } from '@mosaic/macp';
|
||||
import type { GateEntry, TaskResult } from '@mosaicstack/macp';
|
||||
|
||||
/** Stage dispatch mode. */
|
||||
export type StageDispatch = 'exec' | 'yolo' | 'pi';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/log",
|
||||
"name": "@mosaicstack/log",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -22,7 +22,7 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/db": "workspace:*",
|
||||
"@mosaicstack/db": "workspace:*",
|
||||
"drizzle-orm": "^0.45.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, desc, lt, sql, type Db, agentLogs } from '@mosaic/db';
|
||||
import { eq, and, desc, lt, sql, type Db, agentLogs } from '@mosaicstack/db';
|
||||
|
||||
export type AgentLog = typeof agentLogs.$inferSelect;
|
||||
export type NewAgentLog = typeof agentLogs.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Db } from '@mosaic/db';
|
||||
import type { Db } from '@mosaicstack/db';
|
||||
import { createAgentLogsRepo, type AgentLogsRepo } from './agent-logs.js';
|
||||
|
||||
export interface LogService {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/macp",
|
||||
"name": "@mosaicstack/macp",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/memory",
|
||||
"name": "@mosaicstack/memory",
|
||||
"version": "0.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -22,9 +22,9 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/db": "workspace:*",
|
||||
"@mosaic/storage": "workspace:*",
|
||||
"@mosaic/types": "workspace:*",
|
||||
"@mosaicstack/db": "workspace:*",
|
||||
"@mosaicstack/storage": "workspace:*",
|
||||
"@mosaicstack/types": "workspace:*",
|
||||
"drizzle-orm": "^0.45.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import type { StorageAdapter } from '@mosaic/storage';
|
||||
import type { StorageAdapter } from '@mosaicstack/storage';
|
||||
import { KeywordAdapter } from './keyword.js';
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { StorageAdapter } from '@mosaic/storage';
|
||||
import type { StorageAdapter } from '@mosaicstack/storage';
|
||||
import type {
|
||||
MemoryAdapter,
|
||||
MemoryConfig,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createDb, type DbHandle } from '@mosaic/db';
|
||||
import { createDb, type DbHandle } from '@mosaicstack/db';
|
||||
import type {
|
||||
MemoryAdapter,
|
||||
MemoryConfig,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, desc, sql, lt, type Db, insights } from '@mosaic/db';
|
||||
import { eq, and, desc, sql, lt, type Db, insights } from '@mosaicstack/db';
|
||||
|
||||
export type Insight = typeof insights.$inferSelect;
|
||||
export type NewInsight = typeof insights.$inferInsert;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Db } from '@mosaic/db';
|
||||
import type { Db } from '@mosaicstack/db';
|
||||
import { createPreferencesRepo, type PreferencesRepo } from './preferences.js';
|
||||
import { createInsightsRepo, type InsightsRepo } from './insights.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { eq, and, type Db, preferences } from '@mosaic/db';
|
||||
import { eq, and, type Db, preferences } from '@mosaicstack/db';
|
||||
|
||||
export type Preference = typeof preferences.$inferSelect;
|
||||
export type NewPreference = typeof preferences.$inferInsert;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export type { EmbeddingProvider, VectorSearchResult } from './vector-store.js';
|
||||
import type { EmbeddingProvider } from './vector-store.js';
|
||||
import type { StorageAdapter } from '@mosaic/storage';
|
||||
import type { StorageAdapter } from '@mosaicstack/storage';
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Insight types (adapter-level, decoupled from Drizzle schema) */
|
||||
|
||||
@@ -88,17 +88,17 @@ describe('formatUpdateNotice', () => {
|
||||
expect(notice).toContain('Update available');
|
||||
});
|
||||
|
||||
it('uses @mosaic/mosaic for installs', async () => {
|
||||
it('uses @mosaicstack/mosaic for installs', async () => {
|
||||
execSyncMock.mockImplementation((command: string) => {
|
||||
if (command.includes('ls -g --depth=0 --json')) {
|
||||
return JSON.stringify({
|
||||
dependencies: {
|
||||
'@mosaic/mosaic': { version: '0.0.19' },
|
||||
'@mosaicstack/mosaic': { version: '0.0.19' },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (command.includes('view @mosaic/mosaic version')) {
|
||||
if (command.includes('view @mosaicstack/mosaic version')) {
|
||||
return '0.0.20';
|
||||
}
|
||||
|
||||
@@ -111,26 +111,26 @@ describe('formatUpdateNotice', () => {
|
||||
|
||||
expect(result.current).toBe('0.0.19');
|
||||
expect(result.latest).toBe('0.0.20');
|
||||
expect(result.currentPackage).toBe('@mosaic/mosaic');
|
||||
expect(result.targetPackage).toBe('@mosaic/mosaic');
|
||||
expect(notice).toContain('@mosaic/mosaic@latest');
|
||||
expect(result.currentPackage).toBe('@mosaicstack/mosaic');
|
||||
expect(result.targetPackage).toBe('@mosaicstack/mosaic');
|
||||
expect(notice).toContain('@mosaicstack/mosaic@latest');
|
||||
});
|
||||
|
||||
it('does not query legacy @mosaic/cli package', async () => {
|
||||
it('does not query legacy @mosaicstack/cli package', async () => {
|
||||
execSyncMock.mockImplementation((command: string) => {
|
||||
if (command.includes('view @mosaic/cli')) {
|
||||
throw new Error('Should not query @mosaic/cli');
|
||||
if (command.includes('view @mosaicstack/cli')) {
|
||||
throw new Error('Should not query @mosaicstack/cli');
|
||||
}
|
||||
|
||||
if (command.includes('ls -g --depth=0 --json')) {
|
||||
return JSON.stringify({
|
||||
dependencies: {
|
||||
'@mosaic/mosaic': { version: '0.0.19' },
|
||||
'@mosaicstack/mosaic': { version: '0.0.19' },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (command.includes('view @mosaic/mosaic version')) {
|
||||
if (command.includes('view @mosaicstack/mosaic version')) {
|
||||
return '0.0.20';
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ describe('formatUpdateNotice', () => {
|
||||
const { checkForUpdate } = await importUpdateChecker();
|
||||
const result = checkForUpdate({ skipCache: true });
|
||||
|
||||
expect(result.targetPackage).toBe('@mosaic/mosaic');
|
||||
expect(result.targetPackage).toBe('@mosaicstack/mosaic');
|
||||
expect(result.latest).toBe('0.0.20');
|
||||
// Verify no @mosaic/cli queries were made
|
||||
// Verify no @mosaicstack/cli queries were made
|
||||
const calls = execSyncMock.mock.calls.map((c: any[]) => c[0] as string);
|
||||
expect(calls.some((c) => c.includes('@mosaic/cli'))).toBe(false);
|
||||
expect(calls.some((c) => c.includes('@mosaicstack/cli'))).toBe(false);
|
||||
});
|
||||
|
||||
it('returns empty result when package is not installed', async () => {
|
||||
@@ -153,7 +153,7 @@ describe('formatUpdateNotice', () => {
|
||||
return JSON.stringify({ dependencies: {} });
|
||||
}
|
||||
|
||||
if (command.includes('view @mosaic/mosaic version')) {
|
||||
if (command.includes('view @mosaicstack/mosaic version')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ The installer:
|
||||
|
||||
- Downloads the framework from the monorepo archive
|
||||
- Installs it to `~/.config/mosaic/`
|
||||
- Installs `@mosaic/cli` globally via npm (TUI, gateway client, wizard)
|
||||
- Installs `@mosaicstack/cli` globally via npm (TUI, gateway client, wizard)
|
||||
- Adds `~/.config/mosaic/bin` to your PATH
|
||||
- Syncs runtime adapters and skills
|
||||
- Runs a health audit
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/mosaic",
|
||||
"name": "@mosaicstack/mosaic",
|
||||
"version": "0.0.19",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -27,12 +27,12 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/config": "workspace:*",
|
||||
"@mosaic/forge": "workspace:*",
|
||||
"@mosaic/macp": "workspace:*",
|
||||
"@mosaic/prdy": "workspace:*",
|
||||
"@mosaic/quality-rails": "workspace:*",
|
||||
"@mosaic/types": "workspace:*",
|
||||
"@mosaicstack/config": "workspace:*",
|
||||
"@mosaicstack/forge": "workspace:*",
|
||||
"@mosaicstack/macp": "workspace:*",
|
||||
"@mosaicstack/prdy": "workspace:*",
|
||||
"@mosaicstack/quality-rails": "workspace:*",
|
||||
"@mosaicstack/types": "workspace:*",
|
||||
"@clack/prompts": "^0.9.1",
|
||||
"commander": "^13.0.0",
|
||||
"ink": "^5.0.0",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { createRequire } from 'module';
|
||||
import { Command } from 'commander';
|
||||
import { registerQualityRails } from '@mosaic/quality-rails';
|
||||
import { registerQualityRails } from '@mosaicstack/quality-rails';
|
||||
import { registerAgentCommand } from './commands/agent.js';
|
||||
import { registerMissionCommand } from './commands/mission.js';
|
||||
// prdy is registered via launch.ts
|
||||
@@ -10,9 +10,9 @@ import { registerLaunchCommands } from './commands/launch.js';
|
||||
import { registerGatewayCommand } from './commands/gateway.js';
|
||||
import {
|
||||
backgroundUpdateCheck,
|
||||
checkForUpdate,
|
||||
formatUpdateNotice,
|
||||
getInstallCommand,
|
||||
checkForAllUpdates,
|
||||
formatAllPackagesTable,
|
||||
getInstallAllCommand,
|
||||
} from './runtime/update-checker.js';
|
||||
import { runWizard } from './wizard.js';
|
||||
import { ClackPrompter } from './prompter/clack-prompter.js';
|
||||
@@ -325,37 +325,35 @@ program
|
||||
.description('Check for and install Mosaic CLI updates')
|
||||
.option('--check', 'Check only, do not install')
|
||||
.action(async (opts: { check?: boolean }) => {
|
||||
// checkForUpdate and formatUpdateNotice imported statically above
|
||||
// checkForAllUpdates imported statically above
|
||||
const { execSync } = await import('node:child_process');
|
||||
|
||||
console.log('Checking for updates…');
|
||||
const result = checkForUpdate({ skipCache: true });
|
||||
const results = checkForAllUpdates({ skipCache: true });
|
||||
|
||||
if (!result.latest) {
|
||||
console.error('Could not reach the Mosaic registry.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('');
|
||||
console.log(formatAllPackagesTable(results));
|
||||
|
||||
console.log(` Installed: ${result.current || '(none)'}`);
|
||||
console.log(` Latest: ${result.latest}`);
|
||||
|
||||
if (!result.updateAvailable) {
|
||||
console.log('\n✔ Up to date.');
|
||||
const outdated = results.filter((r: { updateAvailable: boolean }) => r.updateAvailable);
|
||||
if (outdated.length === 0) {
|
||||
const anyInstalled = results.some((r: { current: string }) => r.current);
|
||||
if (!anyInstalled) {
|
||||
console.error('No @mosaicstack/* packages are installed.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('\n✔ All packages up to date.');
|
||||
return;
|
||||
}
|
||||
|
||||
const notice = formatUpdateNotice(result);
|
||||
if (notice) console.log(notice);
|
||||
|
||||
if (opts.check) {
|
||||
process.exit(2); // Signal to callers that an update exists
|
||||
}
|
||||
|
||||
console.log('Installing update…');
|
||||
console.log(`\nInstalling ${outdated.length} update(s)…`);
|
||||
try {
|
||||
// Relies on @mosaic:registry in ~/.npmrc — do NOT pass --registry
|
||||
// globally or non-@mosaic deps will 404 against the Gitea registry.
|
||||
execSync(getInstallCommand(result), {
|
||||
// Relies on @mosaicstack:registry in ~/.npmrc
|
||||
const cmd = getInstallAllCommand(outdated);
|
||||
execSync(cmd, {
|
||||
stdio: 'inherit',
|
||||
timeout: 60_000,
|
||||
});
|
||||
|
||||
@@ -91,10 +91,10 @@ export function resolveGatewayEntry(): string {
|
||||
return meta.entryPoint;
|
||||
}
|
||||
|
||||
// Try to resolve from globally installed @mosaic/gateway
|
||||
// Try to resolve from globally installed @mosaicstack/gateway
|
||||
try {
|
||||
const req = createRequire(import.meta.url);
|
||||
const pkgPath = req.resolve('@mosaic/gateway/package.json');
|
||||
const pkgPath = req.resolve('@mosaicstack/gateway/package.json');
|
||||
const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js');
|
||||
if (existsSync(mainEntry)) return mainEntry;
|
||||
} catch {
|
||||
@@ -210,8 +210,8 @@ function sleep(ms: number): Promise<void> {
|
||||
const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/';
|
||||
|
||||
export function installGatewayPackage(): void {
|
||||
console.log('Installing @mosaic/gateway from Gitea registry...');
|
||||
execSync(`npm install -g @mosaic/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, {
|
||||
console.log('Installing @mosaicstack/gateway from Gitea registry...');
|
||||
execSync(`npm install -g @mosaicstack/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, {
|
||||
stdio: 'inherit',
|
||||
timeout: 120_000,
|
||||
});
|
||||
@@ -219,7 +219,7 @@ export function installGatewayPackage(): void {
|
||||
|
||||
export function uninstallGatewayPackage(): void {
|
||||
try {
|
||||
execSync('npm uninstall -g @mosaic/gateway', {
|
||||
execSync('npm uninstall -g @mosaicstack/gateway', {
|
||||
stdio: 'inherit',
|
||||
timeout: 60_000,
|
||||
});
|
||||
@@ -230,15 +230,15 @@ export function uninstallGatewayPackage(): void {
|
||||
|
||||
export function getInstalledGatewayVersion(): string | null {
|
||||
try {
|
||||
const output = execSync('npm ls -g @mosaic/gateway --json --depth=0', {
|
||||
const output = execSync('npm ls -g @mosaicstack/gateway --json --depth=0', {
|
||||
encoding: 'utf-8',
|
||||
timeout: 15_000,
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
});
|
||||
const data = JSON.parse(output) as {
|
||||
dependencies?: { '@mosaic/gateway'?: { version?: string } };
|
||||
dependencies?: { '@mosaicstack/gateway'?: { version?: string } };
|
||||
};
|
||||
return data.dependencies?.['@mosaic/gateway']?.version ?? null;
|
||||
return data.dependencies?.['@mosaicstack/gateway']?.version ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType<typeof createInterface>, opts: InstallOp
|
||||
entryPoint = resolveGatewayEntry();
|
||||
} catch {
|
||||
console.error('Error: Gateway package not found after install.');
|
||||
console.error('Check that @mosaic/gateway installed correctly.');
|
||||
console.error('Check that @mosaicstack/gateway installed correctly.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -494,13 +494,13 @@ function delegateToScript(scriptPath: string, args: string[], env?: Record<strin
|
||||
|
||||
/**
|
||||
* Resolve a path under the framework tools directory. Prefers the version
|
||||
* bundled in the @mosaic/mosaic npm package (always matches the installed
|
||||
* bundled in the @mosaicstack/mosaic npm package (always matches the installed
|
||||
* CLI version) over the deployed copy in ~/.config/mosaic/ (may be stale).
|
||||
*/
|
||||
function resolveTool(...segments: string[]): string {
|
||||
try {
|
||||
const req = createRequire(import.meta.url);
|
||||
const mosaicPkg = dirname(req.resolve('@mosaic/mosaic/package.json'));
|
||||
const mosaicPkg = dirname(req.resolve('@mosaicstack/mosaic/package.json'));
|
||||
const bundled = join(mosaicPkg, 'framework', 'tools', ...segments);
|
||||
if (existsSync(bundled)) return bundled;
|
||||
} catch {
|
||||
|
||||
@@ -255,7 +255,7 @@ async function planMission(
|
||||
console.log(`Planning mission: ${mission.name}\n`);
|
||||
|
||||
try {
|
||||
const { runPrdWizard } = await import('@mosaic/prdy');
|
||||
const { runPrdWizard } = await import('@mosaicstack/prdy');
|
||||
await runPrdWizard({
|
||||
name: mission.name,
|
||||
projectPath: process.cwd(),
|
||||
|
||||
@@ -32,7 +32,7 @@ export function registerPrdyCommand(program: Command) {
|
||||
}
|
||||
|
||||
try {
|
||||
const { runPrdWizard } = await import('@mosaic/prdy');
|
||||
const { runPrdWizard } = await import('@mosaicstack/prdy');
|
||||
const name =
|
||||
typeof opts.init === 'string'
|
||||
? opts.init
|
||||
|
||||
@@ -3,9 +3,14 @@ export const VERSION = '0.0.0';
|
||||
export {
|
||||
backgroundUpdateCheck,
|
||||
checkForUpdate,
|
||||
checkForAllUpdates,
|
||||
formatUpdateNotice,
|
||||
formatAllPackagesTable,
|
||||
getInstallCommand,
|
||||
getInstallAllCommand,
|
||||
getInstalledVersion,
|
||||
getLatestVersion,
|
||||
semverLt,
|
||||
type UpdateCheckResult,
|
||||
type PackageUpdateResult,
|
||||
} from './runtime/update-checker.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Mosaic update checker — compares the installed @mosaic/mosaic package
|
||||
* Mosaic update checker — compares the installed @mosaicstack/mosaic package
|
||||
* against the Gitea npm registry and reports when an upgrade is available.
|
||||
*
|
||||
* Used by:
|
||||
@@ -39,8 +39,8 @@ export interface UpdateCheckResult {
|
||||
|
||||
// ─── Constants ──────────────────────────────────────────────────────────────
|
||||
|
||||
const REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/';
|
||||
const PKG = '@mosaic/mosaic';
|
||||
const REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaicstack/npm/';
|
||||
const PKG = '@mosaicstack/mosaic';
|
||||
const CACHE_DIR = join(homedir(), '.cache', 'mosaic');
|
||||
const CACHE_FILE = join(CACHE_DIR, 'update-check.json');
|
||||
const CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour
|
||||
@@ -124,20 +124,42 @@ export function semverLt(a: string, b: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ─── Known packages for checkForAllUpdates() ──────────────────────────────
|
||||
|
||||
const KNOWN_PACKAGES = [
|
||||
'@mosaicstack/mosaic',
|
||||
'@mosaicstack/cli',
|
||||
'@mosaicstack/gateway',
|
||||
'@mosaicstack/quality-rails',
|
||||
];
|
||||
|
||||
// ─── Multi-package types ──────────────────────────────────────────────────
|
||||
|
||||
export interface PackageUpdateResult {
|
||||
/** Package name */
|
||||
package: string;
|
||||
/** Currently installed version (empty if not installed) */
|
||||
current: string;
|
||||
/** Latest published version (empty if check failed) */
|
||||
latest: string;
|
||||
/** True when a newer version is available */
|
||||
updateAvailable: boolean;
|
||||
}
|
||||
|
||||
// ─── Cache ──────────────────────────────────────────────────────────────────
|
||||
|
||||
/** Cache stores only the latest registry version (the expensive network call).
|
||||
/** Cache stores the latest registry versions for all checked packages.
|
||||
* The installed version is always checked fresh — it's a local `npm ls`. */
|
||||
interface RegistryCache {
|
||||
latest: string;
|
||||
interface AllPackagesCache {
|
||||
packages: Record<string, { latest: string }>;
|
||||
checkedAt: string;
|
||||
registry: string;
|
||||
}
|
||||
|
||||
function readCache(): RegistryCache | null {
|
||||
function readAllCache(): AllPackagesCache | null {
|
||||
try {
|
||||
if (!existsSync(CACHE_FILE)) return null;
|
||||
const raw = JSON.parse(readFileSync(CACHE_FILE, 'utf-8')) as RegistryCache;
|
||||
const raw = JSON.parse(readFileSync(CACHE_FILE, 'utf-8')) as AllPackagesCache;
|
||||
const age = Date.now() - new Date(raw.checkedAt).getTime();
|
||||
if (age > CACHE_TTL_MS) return null;
|
||||
return raw;
|
||||
@@ -146,7 +168,7 @@ function readCache(): RegistryCache | null {
|
||||
}
|
||||
}
|
||||
|
||||
function writeCache(entry: RegistryCache): void {
|
||||
function writeAllCache(entry: AllPackagesCache): void {
|
||||
try {
|
||||
mkdirSync(CACHE_DIR, { recursive: true });
|
||||
writeFileSync(CACHE_FILE, JSON.stringify(entry, null, 2) + '\n', 'utf-8');
|
||||
@@ -155,10 +177,28 @@ function writeCache(entry: RegistryCache): void {
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy single-package cache (backward compat)
|
||||
type RegistryCache = { latest: string; checkedAt: string; registry: string };
|
||||
|
||||
function readCache(): RegistryCache | null {
|
||||
const c = readAllCache();
|
||||
if (!c) return null;
|
||||
const mosaicLatest = c.packages[PKG]?.latest;
|
||||
if (!mosaicLatest) return null;
|
||||
return { latest: mosaicLatest, checkedAt: c.checkedAt, registry: c.registry };
|
||||
}
|
||||
|
||||
function writeCache(entry: RegistryCache): void {
|
||||
const existing = readAllCache();
|
||||
const packages = { ...(existing?.packages ?? {}) };
|
||||
packages[PKG] = { latest: entry.latest };
|
||||
writeAllCache({ packages, checkedAt: entry.checkedAt, registry: entry.registry });
|
||||
}
|
||||
|
||||
// ─── Public API ─────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Get the currently installed @mosaic/mosaic version.
|
||||
* Get the currently installed @mosaicstack/mosaic version.
|
||||
*/
|
||||
export function getInstalledVersion(): { name: string; version: string } {
|
||||
try {
|
||||
@@ -179,7 +219,7 @@ export function getInstalledVersion(): { name: string; version: string } {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the latest published @mosaic/mosaic version from the Gitea npm registry.
|
||||
* Fetch the latest published @mosaicstack/mosaic version from the Gitea npm registry.
|
||||
* Returns empty string on failure.
|
||||
*/
|
||||
export function getLatestVersion(): { name: string; version: string } {
|
||||
@@ -199,6 +239,9 @@ export function getInstallCommand(result: Pick<UpdateCheckResult, 'targetPackage
|
||||
* installed version fresh (local npm ls is cheap, caching it causes stale
|
||||
* "update available" banners after an upgrade).
|
||||
* Never throws.
|
||||
*
|
||||
* @deprecated Use checkForAllUpdates() for multi-package checking.
|
||||
* This function is kept for backward compatibility.
|
||||
*/
|
||||
export function checkForUpdate(options?: { skipCache?: boolean }): UpdateCheckResult {
|
||||
const currentInfo = getInstalledVersion();
|
||||
@@ -284,3 +327,146 @@ export function backgroundUpdateCheck(): void {
|
||||
// Silently ignore — never block the user
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Multi-package update check ────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Get the currently installed versions of all globally-installed @mosaicstack/* packages.
|
||||
*/
|
||||
function getInstalledVersions(): Record<string, string> {
|
||||
const result: Record<string, string> = {};
|
||||
try {
|
||||
const raw = npmExec('ls -g --depth=0 --json 2>/dev/null', 3000);
|
||||
if (raw) {
|
||||
const data = JSON.parse(raw) as {
|
||||
dependencies?: Record<string, { version?: string }>;
|
||||
};
|
||||
for (const [name, info] of Object.entries(data?.dependencies ?? {})) {
|
||||
if (name.startsWith('@mosaicstack/') && info.version) {
|
||||
result[name] = info.version;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// fall through
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the latest published version of a single package from the registry.
|
||||
*/
|
||||
function getLatestVersionFor(pkgName: string): string {
|
||||
return npmExec(`view ${pkgName} version --registry=${REGISTRY}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all known @mosaicstack/* packages for updates.
|
||||
* Returns an array of per-package results, sorted by package name.
|
||||
* Never throws.
|
||||
*/
|
||||
export function checkForAllUpdates(options?: { skipCache?: boolean }): PackageUpdateResult[] {
|
||||
const installed = getInstalledVersions();
|
||||
const checkedAt = new Date().toISOString();
|
||||
|
||||
// Resolve latest versions (from cache or network)
|
||||
let latestVersions: Record<string, string>;
|
||||
|
||||
if (!options?.skipCache) {
|
||||
const cached = readAllCache();
|
||||
if (cached) {
|
||||
latestVersions = {};
|
||||
for (const pkg of KNOWN_PACKAGES) {
|
||||
const cachedLatest = cached.packages[pkg]?.latest;
|
||||
if (cachedLatest) {
|
||||
latestVersions[pkg] = cachedLatest;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
latestVersions = {};
|
||||
for (const pkg of KNOWN_PACKAGES) {
|
||||
const v = getLatestVersionFor(pkg);
|
||||
if (v) latestVersions[pkg] = v;
|
||||
}
|
||||
writeAllCache({
|
||||
packages: Object.fromEntries(
|
||||
Object.entries(latestVersions).map(([k, v]) => [k, { latest: v }]),
|
||||
),
|
||||
checkedAt,
|
||||
registry: REGISTRY,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
latestVersions = {};
|
||||
for (const pkg of KNOWN_PACKAGES) {
|
||||
const v = getLatestVersionFor(pkg);
|
||||
if (v) latestVersions[pkg] = v;
|
||||
}
|
||||
writeAllCache({
|
||||
packages: Object.fromEntries(
|
||||
Object.entries(latestVersions).map(([k, v]) => [k, { latest: v }]),
|
||||
),
|
||||
checkedAt,
|
||||
registry: REGISTRY,
|
||||
});
|
||||
}
|
||||
|
||||
const results: PackageUpdateResult[] = [];
|
||||
for (const pkg of KNOWN_PACKAGES) {
|
||||
const current = installed[pkg] ?? '';
|
||||
const latest = latestVersions[pkg] ?? '';
|
||||
results.push({
|
||||
package: pkg,
|
||||
current,
|
||||
latest,
|
||||
updateAvailable: !!(current && latest && semverLt(current, latest)),
|
||||
});
|
||||
}
|
||||
|
||||
return results.sort((a, b) => a.package.localeCompare(b.package));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the install command for all outdated packages.
|
||||
*/
|
||||
export function getInstallAllCommand(outdated: PackageUpdateResult[]): string {
|
||||
const pkgs = outdated.filter((r) => r.updateAvailable).map((r) => `${r.package}@latest`);
|
||||
if (pkgs.length === 0) return '';
|
||||
return `npm i -g ${pkgs.join(' ')}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a table showing all packages with their current/latest versions.
|
||||
*/
|
||||
export function formatAllPackagesTable(results: PackageUpdateResult[]): string {
|
||||
if (results.length === 0) return 'No @mosaicstack/* packages found.';
|
||||
|
||||
const hasUpdate = results.some((r) => r.updateAvailable);
|
||||
const nameWidth = Math.max(...results.map((r) => r.package.length), 10);
|
||||
const verWidth = 10;
|
||||
|
||||
const header =
|
||||
' ' +
|
||||
'Package'.padEnd(nameWidth + 2) +
|
||||
'Current'.padEnd(verWidth + 2) +
|
||||
'Latest'.padEnd(verWidth + 2) +
|
||||
'Status';
|
||||
const sep = ' ' + '-'.repeat(header.length - 2);
|
||||
|
||||
const rows = results.map((r) => {
|
||||
const status = !r.current
|
||||
? 'not installed'
|
||||
: r.updateAvailable
|
||||
? '⬆ update available'
|
||||
: '✔ up to date';
|
||||
return (
|
||||
' ' +
|
||||
r.package.padEnd(nameWidth + 2) +
|
||||
(r.current || '-').padEnd(verWidth + 2) +
|
||||
(r.latest || '-').padEnd(verWidth + 2) +
|
||||
status
|
||||
);
|
||||
});
|
||||
|
||||
return [header, sep, ...rows].join('\n');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { Box, useApp, useInput } from 'ink';
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
import { TopBar } from './components/top-bar.js';
|
||||
import { BottomBar } from './components/bottom-bar.js';
|
||||
import { MessageList } from './components/message-list.js';
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { parseSlashCommand } from './parse.js';
|
||||
import { CommandRegistry } from './registry.js';
|
||||
import type { CommandDef } from '@mosaic/types';
|
||||
import type { CommandDef } from '@mosaicstack/types';
|
||||
|
||||
// ─── Parse + Registry Round-trip ─────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
import { commandRegistry } from '../registry.js';
|
||||
|
||||
export function executeHelp(_parsed: ParsedCommand): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
|
||||
export interface StatusContext {
|
||||
connected: boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ParsedCommand } from '@mosaic/types';
|
||||
import type { ParsedCommand } from '@mosaicstack/types';
|
||||
|
||||
export function parseSlashCommand(input: string): ParsedCommand | null {
|
||||
const match = input.match(/^\/([a-z][a-z0-9:_-]*)\s*(.*)?$/i);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommandDef, CommandManifest } from '@mosaic/types';
|
||||
import type { CommandDef, CommandManifest } from '@mosaicstack/types';
|
||||
|
||||
// Local-only commands (work even when gateway is disconnected)
|
||||
const LOCAL_COMMANDS: CommandDef[] = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import type { RoutingDecisionInfo } from '@mosaic/types';
|
||||
import type { RoutingDecisionInfo } from '@mosaicstack/types';
|
||||
import type { TokenUsage } from '../hooks/use-socket.js';
|
||||
import type { GitInfo } from '../hooks/use-git-info.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import type { CommandDef, CommandArgDef } from '@mosaic/types';
|
||||
import type { CommandDef, CommandArgDef } from '@mosaicstack/types';
|
||||
|
||||
interface CommandAutocompleteProps {
|
||||
commands: CommandDef[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Box, Text, useInput } from 'ink';
|
||||
import TextInput from 'ink-text-input';
|
||||
import type { ParsedCommand, CommandDef } from '@mosaic/types';
|
||||
import type { ParsedCommand, CommandDef } from '@mosaicstack/types';
|
||||
import { parseSlashCommand, commandRegistry } from '../commands/index.js';
|
||||
import { CommandAutocomplete } from './command-autocomplete.js';
|
||||
import { useInputHistory } from '../hooks/use-input-history.js';
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
SlashCommandResultPayload,
|
||||
SystemReloadPayload,
|
||||
RoutingDecisionInfo,
|
||||
} from '@mosaic/types';
|
||||
} from '@mosaicstack/types';
|
||||
import { commandRegistry } from '../commands/index.js';
|
||||
|
||||
export interface ToolCall {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/prdy",
|
||||
"name": "@mosaicstack/prdy",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/quality-rails",
|
||||
"name": "@mosaicstack/quality-rails",
|
||||
"version": "0.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/queue",
|
||||
"name": "@mosaicstack/queue",
|
||||
"version": "0.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,7 +21,7 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mosaic/types": "workspace:*",
|
||||
"@mosaicstack/types": "workspace:*",
|
||||
"ioredis": "^5.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/storage",
|
||||
"name": "@mosaicstack/storage",
|
||||
"version": "0.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -22,8 +22,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@electric-sql/pglite": "^0.2.17",
|
||||
"@mosaic/db": "workspace:^",
|
||||
"@mosaic/types": "workspace:*"
|
||||
"@mosaicstack/db": "workspace:^",
|
||||
"@mosaicstack/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.0",
|
||||
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
sql,
|
||||
type Db,
|
||||
type DbHandle,
|
||||
} from '@mosaic/db';
|
||||
import * as schema from '@mosaic/db';
|
||||
} from '@mosaicstack/db';
|
||||
import * as schema from '@mosaicstack/db';
|
||||
import type { StorageAdapter, StorageConfig } from '../types.js';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@mosaic/types",
|
||||
"name": "@mosaicstack/types",
|
||||
"version": "0.0.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in New Issue
Block a user