fix: グローバル設定のpieceが解決チェーンで無視されるバグを修正 (#458)
This commit is contained in:
parent
d2b48fdd92
commit
ed16c05160
@ -51,15 +51,15 @@ describe('RESOLUTION_REGISTRY defaultValue removal', () => {
|
||||
});
|
||||
|
||||
describe('piece', () => {
|
||||
it('should resolve piece from project config DEFAULT_PROJECT_CONFIG when not explicitly set', () => {
|
||||
it('should resolve piece as undefined when not set in project or global config', () => {
|
||||
const value = resolveConfigValue(projectDir, 'piece');
|
||||
expect(value).toBe('default');
|
||||
expect(value).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should report source as project when piece comes from DEFAULT_PROJECT_CONFIG', () => {
|
||||
it('should report source as default when piece is not set anywhere', () => {
|
||||
const result = resolveConfigValueWithSource(projectDir, 'piece');
|
||||
expect(result.value).toBe('default');
|
||||
expect(result.source).toBe('project');
|
||||
expect(result.value).toBeUndefined();
|
||||
expect(result.source).toBe('default');
|
||||
});
|
||||
|
||||
it('should resolve explicit project piece over default', () => {
|
||||
@ -76,8 +76,8 @@ describe('RESOLUTION_REGISTRY defaultValue removal', () => {
|
||||
invalidateGlobalConfigCache();
|
||||
|
||||
const result = resolveConfigValueWithSource(projectDir, 'piece');
|
||||
expect(result.value).toBe('default');
|
||||
expect(result.source).toBe('project');
|
||||
expect(result.value).toBe('global-piece');
|
||||
expect(result.source).toBe('global');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -87,6 +87,8 @@ export interface PersistedGlobalConfig {
|
||||
logLevel: 'debug' | 'info' | 'warn' | 'error';
|
||||
provider?: 'claude' | 'codex' | 'opencode' | 'cursor' | 'copilot' | 'mock';
|
||||
model?: string;
|
||||
/** Default piece name for new tasks (resolved via config layers: project > global > 'default') */
|
||||
piece?: string;
|
||||
observability?: ObservabilityConfig;
|
||||
analytics?: AnalyticsConfig;
|
||||
/** Directory for shared clones (worktree_dir in config). If empty, uses ../{clone-name} relative to project */
|
||||
|
||||
@ -444,6 +444,8 @@ export const GlobalConfigSchema = z.object({
|
||||
log_level: z.enum(['debug', 'info', 'warn', 'error']).optional().default('info'),
|
||||
provider: z.enum(['claude', 'codex', 'opencode', 'cursor', 'copilot', 'mock']).optional().default('claude'),
|
||||
model: z.string().optional(),
|
||||
/** Default piece name for new tasks */
|
||||
piece: z.string().optional(),
|
||||
observability: ObservabilityConfigSchema.optional(),
|
||||
analytics: AnalyticsConfigSchema.optional(),
|
||||
/** Directory for shared clones (worktree_dir in config). If empty, uses ../{clone-name} relative to project */
|
||||
|
||||
@ -221,6 +221,7 @@ export class GlobalConfigManager {
|
||||
logLevel: parsed.log_level,
|
||||
provider: parsed.provider,
|
||||
model: parsed.model,
|
||||
piece: parsed.piece,
|
||||
observability: parsed.observability ? {
|
||||
providerEvents: parsed.observability.provider_events,
|
||||
} : undefined,
|
||||
@ -289,6 +290,9 @@ export class GlobalConfigManager {
|
||||
if (config.model) {
|
||||
raw.model = config.model;
|
||||
}
|
||||
if (config.piece) {
|
||||
raw.piece = config.piece;
|
||||
}
|
||||
if (config.observability && config.observability.providerEvents !== undefined) {
|
||||
raw.observability = {
|
||||
provider_events: config.observability.providerEvents,
|
||||
|
||||
@ -18,9 +18,7 @@ import { invalidateResolvedConfigCache } from '../resolutionCache.js';
|
||||
export type { ProjectLocalConfig } from '../types.js';
|
||||
|
||||
/** Default project configuration */
|
||||
const DEFAULT_PROJECT_CONFIG: ProjectLocalConfig = {
|
||||
piece: 'default',
|
||||
};
|
||||
const DEFAULT_PROJECT_CONFIG: ProjectLocalConfig = {};
|
||||
|
||||
const SUBMODULES_ALL = 'all';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user