fix: installer copies default framework files (AGENTS.md, STANDARDS.md) to mosaicHome
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

sourceDir now defaults to the bundled framework/ directory instead of
mosaicHome, so syncFramework() actually copies files. Additionally,
syncFramework() now copies root-level defaults (AGENTS.md, STANDARDS.md,
etc.) from framework/defaults/ into mosaicHome when they don't already
exist. Bump to 0.0.9.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jarvis
2026-04-02 21:33:51 -05:00
parent 70a51ba711
commit 297ec526ff
4 changed files with 30 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@mosaic/cli",
"version": "0.0.8",
"version": "0.0.9",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,6 +1,6 @@
{
"name": "@mosaic/mosaic",
"version": "0.0.8",
"version": "0.0.9",
"description": "Mosaic agent framework — installation wizard and meta package",
"type": "module",
"main": "dist/index.js",

View File

@@ -1,4 +1,4 @@
import { readFileSync, existsSync } from 'node:fs';
import { readFileSync, existsSync, readdirSync, statSync, copyFileSync } from 'node:fs';
import { join } from 'node:path';
import type { ConfigService } from './config-service.js';
import type { SoulConfig, UserConfig, ToolsConfig, InstallAction } from '../types.js';
@@ -140,6 +140,23 @@ export class FileConfigAdapter implements ConfigService {
preserve: preservePaths,
excludeGit: true,
});
// Copy default root-level .md files (AGENTS.md, STANDARDS.md, etc.)
// from framework/defaults/ into mosaicHome root if they don't exist yet.
// These are framework contracts — only written on first install, never
// overwritten (user may have customized them).
const defaultsDir = join(this.sourceDir, 'defaults');
if (existsSync(defaultsDir)) {
for (const entry of readdirSync(defaultsDir)) {
const dest = join(this.mosaicHome, entry);
if (!existsSync(dest)) {
const src = join(defaultsDir, entry);
if (statSync(src).isFile()) {
copyFileSync(src, dest);
}
}
}
}
}
/**

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env node
import { resolve } from 'node:path';
import { existsSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Command } from 'commander';
@@ -49,7 +50,14 @@ program
.action(async (opts: Record<string, string | boolean | undefined>) => {
try {
const mosaicHome = (opts['mosaicHome'] as string) ?? DEFAULT_MOSAIC_HOME;
const sourceDir = (opts['sourceDir'] as string | undefined) ?? mosaicHome;
// Default source to the framework/ dir bundled in this npm package.
// This ensures syncFramework copies AGENTS.md, STANDARDS.md, guides/, etc.
// Falls back to mosaicHome if the bundled dir doesn't exist (shouldn't happen).
const pkgRoot = dirname(fileURLToPath(import.meta.url));
const bundledFramework = resolve(pkgRoot, '..', 'framework');
const sourceDir =
(opts['sourceDir'] as string | undefined) ??
(existsSync(bundledFramework) ? bundledFramework : mosaicHome);
const prompter = opts['nonInteractive'] ? new HeadlessPrompter() : new ClackPrompter();