ai-ops-compiler 0.1.5 → 0.1.8
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 +14 -2
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,8 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
185
185
|
installed_rules: z.ZodArray<z.ZodString, "many">;
|
|
186
186
|
/** 실제 디스크에 쓰여진 파일 상대 경로 목록 (uninstall용). 기존 manifest 호환성 위해 optional */
|
|
187
187
|
installed_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
188
|
+
/** non-managed 파일에 섹션을 append한 경우 추적 (uninstall 시 섹션만 제거) */
|
|
189
|
+
appended_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
188
190
|
/** SSOT 데이터 파일들의 deterministic SHA-256 해시 (6자리 hex). diff/update 판단 기준 */
|
|
189
191
|
sourceHash: z.ZodString;
|
|
190
192
|
generatedAt: z.ZodString;
|
|
@@ -200,6 +202,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
200
202
|
preset: string;
|
|
201
203
|
}> | undefined;
|
|
202
204
|
installed_files?: string[] | undefined;
|
|
205
|
+
appended_files?: string[] | undefined;
|
|
203
206
|
}, {
|
|
204
207
|
tools: string[];
|
|
205
208
|
scope: "project" | "global";
|
|
@@ -212,6 +215,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
212
215
|
preset: string;
|
|
213
216
|
}> | undefined;
|
|
214
217
|
installed_files?: string[] | undefined;
|
|
218
|
+
appended_files?: string[] | undefined;
|
|
215
219
|
}>;
|
|
216
220
|
type Manifest = z.infer<typeof ManifestSchema>;
|
|
217
221
|
|
|
@@ -237,7 +241,7 @@ declare const TOOL_OUTPUT_MAP: {
|
|
|
237
241
|
};
|
|
238
242
|
readonly codex: {
|
|
239
243
|
readonly mode: "multi-file";
|
|
240
|
-
readonly dir: "
|
|
244
|
+
readonly dir: "";
|
|
241
245
|
readonly rootFileName: "AGENTS.md";
|
|
242
246
|
readonly domainFileName: "AGENTS.override.md";
|
|
243
247
|
readonly contextStrategy: "hierarchical";
|
|
@@ -299,6 +303,7 @@ declare const buildManifest: (params: {
|
|
|
299
303
|
}>;
|
|
300
304
|
installedRules: readonly string[];
|
|
301
305
|
installedFiles?: readonly string[];
|
|
306
|
+
appendedFiles?: readonly string[];
|
|
302
307
|
sourceHash: string;
|
|
303
308
|
}) => Manifest;
|
|
304
309
|
|
|
@@ -312,6 +317,13 @@ declare const parseManagedHeader: (content: string) => {
|
|
|
312
317
|
generatedAt: string;
|
|
313
318
|
} | null;
|
|
314
319
|
declare const stripManagedHeader: (content: string) => string;
|
|
320
|
+
declare const wrapWithSection: (content: string, meta: {
|
|
321
|
+
sourceHash: string;
|
|
322
|
+
generatedAt: string;
|
|
323
|
+
}) => string;
|
|
324
|
+
declare const hasAiOpsSection: (content: string) => boolean;
|
|
325
|
+
declare const stripAiOpsSection: (content: string) => string;
|
|
326
|
+
declare const replaceAiOpsSection: (existing: string, newSection: string) => string;
|
|
315
327
|
|
|
316
328
|
declare const MANIFEST_FILENAME = ".ai-ops-manifest.json";
|
|
317
329
|
declare const parseManifest: (json: string) => Manifest;
|
|
@@ -354,4 +366,4 @@ declare const inferInstalledFiles: (manifest: Manifest) => string[];
|
|
|
354
366
|
|
|
355
367
|
declare const COMPILER_DATA_DIR: string;
|
|
356
368
|
|
|
357
|
-
export { CLAUDE_CODE_PATH_GLOBS, COMPILER_DATA_DIR, type ClaudeCodeRenderResult, type CodexRenderResult, type DecisionTableEntry, DecisionTableEntrySchema, type DiffResult, type FileAction, GLOBAL_CATEGORIES, type GeminiRenderResult, MANIFEST_FILENAME, type Manifest, ManifestSchema, type Preset, PresetSchema, type Rule, type RuleContent, RuleContentSchema, RuleSchema, SCOPES, TOOL_OUTPUT_MAP, type ToolId, type ToolRenderResult, type WorkspaceEntry, type WorkspaceMapping, buildInstallPlan, buildManifest, computeDiff, computeHash, computeSourceHash, excludeRules, inferInstalledFiles, isGlobalRule, isManagedFile, loadAllRules, loadPresets, loadRuleFile, parseManagedHeader, parseManifest, parseRawPresets, partitionRules, readManifest, renderClaudeCodeRule, renderDecisionTable, renderForTool, renderFrontmatter, renderRuleToMarkdown, renderRulesToMarkdown, resolveManifestPath, resolvePresetRules, ruleIdToTitle, serializeManifest, sortRulesByPriority, stripManagedHeader, wrapWithHeader, writeManifest };
|
|
369
|
+
export { CLAUDE_CODE_PATH_GLOBS, COMPILER_DATA_DIR, type ClaudeCodeRenderResult, type CodexRenderResult, type DecisionTableEntry, DecisionTableEntrySchema, type DiffResult, type FileAction, GLOBAL_CATEGORIES, type GeminiRenderResult, MANIFEST_FILENAME, type Manifest, ManifestSchema, type Preset, PresetSchema, type Rule, type RuleContent, RuleContentSchema, RuleSchema, SCOPES, TOOL_OUTPUT_MAP, type ToolId, type ToolRenderResult, type WorkspaceEntry, type WorkspaceMapping, buildInstallPlan, buildManifest, computeDiff, computeHash, computeSourceHash, excludeRules, hasAiOpsSection, inferInstalledFiles, isGlobalRule, isManagedFile, loadAllRules, loadPresets, loadRuleFile, parseManagedHeader, parseManifest, parseRawPresets, partitionRules, readManifest, renderClaudeCodeRule, renderDecisionTable, renderForTool, renderFrontmatter, renderRuleToMarkdown, renderRulesToMarkdown, replaceAiOpsSection, resolveManifestPath, resolvePresetRules, ruleIdToTitle, serializeManifest, sortRulesByPriority, stripAiOpsSection, stripManagedHeader, wrapWithHeader, wrapWithSection, writeManifest };
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,8 @@ var ManifestSchema = z3.object({
|
|
|
51
51
|
installed_rules: z3.array(z3.string().min(1)),
|
|
52
52
|
/** 실제 디스크에 쓰여진 파일 상대 경로 목록 (uninstall용). 기존 manifest 호환성 위해 optional */
|
|
53
53
|
installed_files: z3.array(z3.string().min(1)).optional(),
|
|
54
|
+
/** non-managed 파일에 섹션을 append한 경우 추적 (uninstall 시 섹션만 제거) */
|
|
55
|
+
appended_files: z3.array(z3.string().min(1)).optional(),
|
|
54
56
|
/** SSOT 데이터 파일들의 deterministic SHA-256 해시 (6자리 hex). diff/update 판단 기준 */
|
|
55
57
|
sourceHash: z3.string().regex(/^[a-f0-9]{6}$/, "sourceHash must be 6 lowercase hex chars"),
|
|
56
58
|
generatedAt: z3.string().datetime({ offset: true })
|
|
@@ -123,7 +125,7 @@ var TOOL_OUTPUT_MAP = {
|
|
|
123
125
|
},
|
|
124
126
|
codex: {
|
|
125
127
|
mode: "multi-file",
|
|
126
|
-
dir: "
|
|
128
|
+
dir: "",
|
|
127
129
|
rootFileName: "AGENTS.md",
|
|
128
130
|
// global 룰
|
|
129
131
|
domainFileName: "AGENTS.override.md",
|
|
@@ -260,6 +262,7 @@ var buildManifest = (params) => ManifestSchema.parse({
|
|
|
260
262
|
workspaces: params.workspaces,
|
|
261
263
|
installed_rules: [...params.installedRules],
|
|
262
264
|
installed_files: params.installedFiles ? [...params.installedFiles] : void 0,
|
|
265
|
+
appended_files: params.appendedFiles && params.appendedFiles.length > 0 ? [...params.appendedFiles] : void 0,
|
|
263
266
|
sourceHash: params.sourceHash,
|
|
264
267
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
265
268
|
});
|
|
@@ -267,6 +270,8 @@ var buildManifest = (params) => ManifestSchema.parse({
|
|
|
267
270
|
// src/managed-header.ts
|
|
268
271
|
var MANAGED_MARKER = "<!-- managed by ai-ops -->";
|
|
269
272
|
var META_PATTERN = /^<!-- sourceHash: ([a-f0-9]{6}) \| generatedAt: (.+) -->$/;
|
|
273
|
+
var SECTION_START = "<!-- ai-ops:start -->";
|
|
274
|
+
var SECTION_END = "<!-- ai-ops:end -->";
|
|
270
275
|
var wrapWithHeader = (content, meta) => {
|
|
271
276
|
const metaLine = `<!-- sourceHash: ${meta.sourceHash} | generatedAt: ${meta.generatedAt} -->`;
|
|
272
277
|
return `${MANAGED_MARKER}
|
|
@@ -289,6 +294,31 @@ var stripManagedHeader = (content) => {
|
|
|
289
294
|
const stripped = lines.slice(3).join("\n");
|
|
290
295
|
return stripped;
|
|
291
296
|
};
|
|
297
|
+
var wrapWithSection = (content, meta) => {
|
|
298
|
+
const metaLine = `<!-- sourceHash: ${meta.sourceHash} | generatedAt: ${meta.generatedAt} -->`;
|
|
299
|
+
return `${SECTION_START}
|
|
300
|
+
${metaLine}
|
|
301
|
+
|
|
302
|
+
${content}
|
|
303
|
+
${SECTION_END}`;
|
|
304
|
+
};
|
|
305
|
+
var hasAiOpsSection = (content) => content.includes(SECTION_START) && content.includes(SECTION_END);
|
|
306
|
+
var stripAiOpsSection = (content) => {
|
|
307
|
+
const startIdx = content.indexOf(SECTION_START);
|
|
308
|
+
const endIdx = content.indexOf(SECTION_END);
|
|
309
|
+
if (startIdx === -1 || endIdx === -1) return content;
|
|
310
|
+
const before = content.slice(0, startIdx).trimEnd();
|
|
311
|
+
const after = content.slice(endIdx + SECTION_END.length).trimStart();
|
|
312
|
+
return before + (after ? "\n\n" + after : "") + "\n";
|
|
313
|
+
};
|
|
314
|
+
var replaceAiOpsSection = (existing, newSection) => {
|
|
315
|
+
const startIdx = existing.indexOf(SECTION_START);
|
|
316
|
+
const endIdx = existing.indexOf(SECTION_END);
|
|
317
|
+
if (startIdx === -1 || endIdx === -1) return existing;
|
|
318
|
+
const before = existing.slice(0, startIdx).trimEnd();
|
|
319
|
+
const after = existing.slice(endIdx + SECTION_END.length).trimStart();
|
|
320
|
+
return before + "\n\n" + newSection + (after ? "\n\n" + after : "") + "\n";
|
|
321
|
+
};
|
|
292
322
|
|
|
293
323
|
// src/manifest-io.ts
|
|
294
324
|
import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
@@ -415,6 +445,7 @@ export {
|
|
|
415
445
|
computeHash,
|
|
416
446
|
computeSourceHash,
|
|
417
447
|
excludeRules,
|
|
448
|
+
hasAiOpsSection,
|
|
418
449
|
inferInstalledFiles,
|
|
419
450
|
isGlobalRule,
|
|
420
451
|
isManagedFile,
|
|
@@ -432,13 +463,16 @@ export {
|
|
|
432
463
|
renderFrontmatter,
|
|
433
464
|
renderRuleToMarkdown,
|
|
434
465
|
renderRulesToMarkdown,
|
|
466
|
+
replaceAiOpsSection,
|
|
435
467
|
resolveManifestPath,
|
|
436
468
|
resolvePresetRules,
|
|
437
469
|
ruleIdToTitle,
|
|
438
470
|
serializeManifest,
|
|
439
471
|
sortRulesByPriority,
|
|
472
|
+
stripAiOpsSection,
|
|
440
473
|
stripManagedHeader,
|
|
441
474
|
wrapWithHeader,
|
|
475
|
+
wrapWithSection,
|
|
442
476
|
writeManifest
|
|
443
477
|
};
|
|
444
478
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/rule.schema.ts","../src/schemas/preset.schema.ts","../src/schemas/manifest.schema.ts","../src/loader.ts","../src/renderer.ts","../src/tool-output.ts","../src/source-hash.ts","../src/managed-header.ts","../src/manifest-io.ts","../src/diff.ts","../src/install-plan.ts","../src/uninstall-plan.ts","../src/paths.ts"],"sourcesContent":["/**\n * Rule = SSOT의 최소 지식 단위. 하나의 코딩 컨벤션/아키텍처 규칙을 YAML로 구조화한 것.\n */\nimport { z } from 'zod';\n\nexport const DecisionTableEntrySchema = z\n .object({\n when: z.string().min(1),\n then: z.string().min(1),\n /** 조건부 규칙에서 회피해야 할 패턴 */\n avoid: z.string().min(1).optional(),\n })\n .strict();\n\nexport const RuleContentSchema = z\n .object({\n /** Anti-pattern 규칙 ('하지 마라'). guidelines보다 항상 상단 렌더링 */\n constraints: z.array(z.string().min(1)),\n /** Positive 규칙 ('해라') */\n guidelines: z.array(z.string().min(1)),\n /** 조건부 규칙. when→then→avoid 구조 */\n decision_table: z.array(DecisionTableEntrySchema).optional(),\n })\n .strict();\n\nexport const RuleSchema = z\n .object({\n id: z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'id must be kebab-case'),\n category: z.string().min(1),\n tags: z.array(z.string().min(1)),\n /** 0-100. 높을수록 생성 파일 상단 배치 (U-shaped attention 최적화) */\n priority: z.number().int().min(0).max(100),\n content: RuleContentSchema,\n })\n .strict();\n\nexport type DecisionTableEntry = z.infer<typeof DecisionTableEntrySchema>;\nexport type RuleContent = z.infer<typeof RuleContentSchema>;\nexport type Rule = z.infer<typeof RuleSchema>;\n","import { z } from 'zod';\n\nexport const PresetSchema = z\n .object({\n id: z\n .string()\n .regex(/^[a-z][a-z0-9-]*$/)\n .min(1),\n description: z.string().min(1),\n rules: z.array(z.string().min(1)).min(1),\n })\n .strict();\n\nexport type Preset = z.infer<typeof PresetSchema>;\n","/**\n * Manifest = 설치 추적 메타데이터. CLI가 이전 설치 상태를 기억하기 위한 JSON.\n */\nimport { z } from 'zod';\n\nexport const SCOPES = {\n PROJECT: 'project',\n GLOBAL: 'global',\n} as const;\n\n/** 모노레포 워크스페이스별 preset + rules 추적 */\nconst WorkspaceEntrySchema = z\n .object({\n preset: z.string().min(1),\n rules: z.array(z.string().min(1)),\n })\n .strict();\n\nexport type WorkspaceEntry = z.infer<typeof WorkspaceEntrySchema>;\n\nexport const ManifestSchema = z\n .object({\n tools: z.array(z.string().min(1)).min(1),\n scope: z.enum(['project', 'global']),\n /** 비모노레포 단일 preset */\n preset: z.string().min(1).optional(),\n /** 모노레포: workspace path → { preset, rules } */\n workspaces: z.record(z.string(), WorkspaceEntrySchema).optional(),\n installed_rules: z.array(z.string().min(1)),\n /** 실제 디스크에 쓰여진 파일 상대 경로 목록 (uninstall용). 기존 manifest 호환성 위해 optional */\n installed_files: z.array(z.string().min(1)).optional(),\n /** SSOT 데이터 파일들의 deterministic SHA-256 해시 (6자리 hex). diff/update 판단 기준 */\n sourceHash: z.string().regex(/^[a-f0-9]{6}$/, 'sourceHash must be 6 lowercase hex chars'),\n generatedAt: z.string().datetime({ offset: true }),\n })\n .strict();\n\nexport type Manifest = z.infer<typeof ManifestSchema>;\n","import { readFileSync, readdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { parse } from 'yaml';\nimport { RuleSchema, PresetSchema } from './schemas/index.js';\nimport type { Rule, Preset } from './schemas/index.js';\n\n// priority 내림차순 정렬 (높을수록 상단 → U-shaped attention)\nexport const sortRulesByPriority = (rules: readonly Rule[]): Rule[] =>\n [...rules].sort((a, b) => b.priority - a.priority);\n\n// presets.yaml의 Record<id, {description, rules}> → Preset[] 변환\nexport const parseRawPresets = (raw: Record<string, { description: string; rules: string[] }>): Preset[] =>\n Object.entries(raw).map(([id, value]) => PresetSchema.parse({ id, ...value }));\n\n// TUI 세부조정: 사용자가 해제한 rule ID 목록을 제외 (순서 유지)\nexport const excludeRules = (rules: readonly Rule[], excludeIds: readonly string[]): Rule[] => {\n const excludeSet = new Set(excludeIds);\n return rules.filter((r) => !excludeSet.has(r.id));\n};\n\n// preset.rules ID 목록으로 allRules에서 필터링 + priority 정렬, 누락 시 throw\nexport const resolvePresetRules = (preset: Preset, allRules: readonly Rule[]): Rule[] => {\n const resolved = preset.rules.map((ruleId) => {\n const found = allRules.find((r) => r.id === ruleId);\n if (!found) throw new Error(`Rule not found: ${ruleId}`);\n return found;\n });\n return sortRulesByPriority(resolved);\n};\n\nexport const loadRuleFile = (filePath: string): Rule => {\n const raw = readFileSync(filePath, 'utf-8');\n return RuleSchema.parse(parse(raw));\n};\n\n// readdirSync + .yaml 필터 + sort\nexport const loadAllRules = (rulesDir: string): Rule[] => {\n const files = readdirSync(rulesDir)\n .filter((f) => f.endsWith('.yaml'))\n .sort();\n return files.map((f) => loadRuleFile(resolve(rulesDir, f)));\n};\n\nexport const loadPresets = (presetsPath: string): Preset[] => {\n const raw = readFileSync(presetsPath, 'utf-8');\n const data = parse(raw) as Record<string, { description: string; rules: string[] }>;\n return parseRawPresets(data);\n};\n","import { join } from 'node:path';\nimport type { Rule, DecisionTableEntry } from './schemas/index.js';\nimport { GLOBAL_CATEGORIES, CLAUDE_CODE_PATH_GLOBS, TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { ToolId } from './tool-output.js';\n\n// \"react-typescript\" → \"React Typescript\"\nexport const ruleIdToTitle = (id: string): string =>\n id\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n\n// DecisionTableEntry[] → Markdown 테이블 (pipe 문자 | escape)\nexport const renderDecisionTable = (entries: readonly DecisionTableEntry[]): string => {\n const escape = (s: string) => s.replace(/\\|/g, '|');\n const hasAvoid = entries.some((e) => e.avoid !== undefined);\n\n const header = hasAvoid ? '| When | Then | Avoid |\\n|------|------|-------|' : '| When | Then |\\n|------|------|';\n\n const rows = entries.map((e) => {\n const when = escape(e.when);\n const then = escape(e.then);\n if (hasAvoid) {\n const avoid = e.avoid ? escape(e.avoid) : '';\n return `| ${when} | ${then} | ${avoid} |`;\n }\n return `| ${when} | ${then} |`;\n });\n\n return [header, ...rows].join('\\n');\n};\n\n// 단일 Rule → Markdown (빈 섹션 생략)\nexport const renderRuleToMarkdown = (rule: Rule): string => {\n const sections: string[] = [`# ${ruleIdToTitle(rule.id)}`];\n\n if (rule.content.constraints.length > 0) {\n sections.push('## Constraints');\n sections.push(rule.content.constraints.map((c) => `- ${c}`).join('\\n'));\n }\n\n if (rule.content.guidelines.length > 0) {\n sections.push('## Guidelines');\n sections.push(rule.content.guidelines.map((g) => `- ${g}`).join('\\n'));\n }\n\n if (rule.content.decision_table && rule.content.decision_table.length > 0) {\n sections.push('## Decision Table');\n sections.push(renderDecisionTable(rule.content.decision_table));\n }\n\n return sections.join('\\n\\n');\n};\n\n// Rule[] → 단일 Markdown (--- separator, single-file 모드용)\nexport const renderRulesToMarkdown = (rules: readonly Rule[]): string =>\n rules.map(renderRuleToMarkdown).join('\\n\\n---\\n\\n');\n\n// Rule이 global 카테고리에 속하는지 판별\nexport const isGlobalRule = (rule: Rule): boolean => (GLOBAL_CATEGORIES as readonly string[]).includes(rule.category);\n\n// Rule[] → { global, domain } 분리\nexport const partitionRules = (rules: readonly Rule[]): { global: Rule[]; domain: Rule[] } => {\n const global: Rule[] = [];\n const domain: Rule[] = [];\n for (const rule of rules) {\n if (isGlobalRule(rule)) {\n global.push(rule);\n } else {\n domain.push(rule);\n }\n }\n return { global, domain };\n};\n\n// glob 배열 → YAML frontmatter 블록\nexport const renderFrontmatter = (paths: readonly string[]): string => {\n const lines = paths.map((p) => ` - \"${p}\"`).join('\\n');\n return `---\\npaths:\\n${lines}\\n---`;\n};\n\nexport type WorkspaceMapping = {\n path: string;\n ruleIds: readonly string[];\n};\n\n// 단일 Rule → Claude Code용 Markdown\n// domain 룰이면서 glob 매핑이 있으면 paths: frontmatter 추가 (단일 프로젝트 전용)\n// global 룰 또는 매핑 없는 domain 룰 → frontmatter 없음\nexport const renderClaudeCodeRule = (rule: Rule): string => {\n const globs = CLAUDE_CODE_PATH_GLOBS[rule.id];\n if (!isGlobalRule(rule) && globs !== undefined) {\n return `${renderFrontmatter(globs)}\\n\\n${renderRuleToMarkdown(rule)}`;\n }\n return renderRuleToMarkdown(rule);\n};\n\n// 도구별 렌더링 결과 타입 (tagged union)\nexport type ClaudeCodeRenderResult = {\n tool: 'claude-code';\n files: { relativePath: string; content: string }[];\n};\n\nexport type CodexRenderResult = {\n tool: 'codex';\n rootContent: string;\n domainContent: string;\n};\n\nexport type GeminiRenderResult = {\n tool: 'gemini';\n rootContent: string;\n domainContent: string;\n};\n\nexport type ToolRenderResult = ClaudeCodeRenderResult | CodexRenderResult | GeminiRenderResult;\n\n// CLI 진입점: toolId + rules → 도구별 렌더링 결과\nexport const renderForTool = (\n toolId: ToolId,\n rules: readonly Rule[],\n workspaceMappings?: readonly WorkspaceMapping[],\n): ToolRenderResult => {\n const config = TOOL_OUTPUT_MAP[toolId];\n\n if (toolId === 'claude-code') {\n const { rulesDir, fileExtension } = config as (typeof TOOL_OUTPUT_MAP)['claude-code'];\n\n if (!workspaceMappings || workspaceMappings.length === 0) {\n // 단일 프로젝트: domain 룰에 paths: frontmatter (path-scoped)\n const files = rules.map((rule) => ({\n relativePath: join(rulesDir, `${rule.id}${fileExtension}`),\n content: renderClaudeCodeRule(rule),\n }));\n return { tool: 'claude-code', files };\n }\n\n // 모노레포: global → .claude/rules/, domain → {workspace}/CLAUDE.md (진짜 지연 로딩)\n const { global, domain } = partitionRules(rules);\n\n const globalFiles = global.map((rule) => ({\n relativePath: join(rulesDir, `${rule.id}${fileExtension}`),\n content: renderRuleToMarkdown(rule), // global은 frontmatter 불필요\n }));\n\n const workspaceFiles: { relativePath: string; content: string }[] = [];\n for (const ws of workspaceMappings) {\n const wsRules = domain.filter((r) => ws.ruleIds.includes(r.id));\n if (wsRules.length === 0) continue;\n workspaceFiles.push({\n relativePath: join(ws.path, 'CLAUDE.md'),\n content: renderRulesToMarkdown(wsRules),\n });\n }\n\n return { tool: 'claude-code', files: [...globalFiles, ...workspaceFiles] };\n }\n\n const { global, domain } = partitionRules(rules);\n const rootContent = renderRulesToMarkdown(global);\n const domainContent = renderRulesToMarkdown(domain);\n\n if (toolId === 'codex') {\n return { tool: 'codex', rootContent, domainContent };\n }\n\n // gemini\n return { tool: 'gemini', rootContent, domainContent };\n};\n","// Global 성격의 category (항상 로딩, frontmatter 없음)\nexport const GLOBAL_CATEGORIES = ['persona', 'communication', 'philosophy', 'convention', 'standard'] as const;\n\n// Claude Code paths: frontmatter용 Rule ID → glob 매핑\n// src/ 없이 루트를 src처럼 쓰는 React/Next.js 프로젝트 고려\n// 매핑에 없는 domain 룰 → frontmatter 없이 항상 로딩 (안전 fallback)\nexport const CLAUDE_CODE_PATH_GLOBS: Readonly<Record<string, readonly string[]>> = {\n typescript: ['**/*.ts', '**/*.tsx'],\n 'react-typescript': ['**/*.tsx', '**/*.jsx'],\n nextjs: ['**/app/**', 'next.config.*', '**/middleware.ts'],\n nestjs: ['**/*.module.ts', '**/*.controller.ts', '**/*.service.ts'],\n 'nestjs-graphql': ['**/*.resolver.ts'],\n graphql: ['**/*.graphql', '**/*.gql'],\n 'prisma-postgresql': ['prisma/**', '**/*.prisma'],\n 'shadcn-ui': ['**/components/ui/**'],\n flutter: ['lib/**/*.dart'],\n python: ['**/*.py'],\n fastapi: ['**/routers/**', '**/main.py'],\n sqlalchemy: ['**/models/**/*.py', 'alembic/**'],\n 'data-pipeline-python': ['**/pipelines/**', '**/etl/**'],\n 'ai-llm-python': ['**/agents/**', '**/chains/**'],\n 'libs-frontend-web': ['**/*.tsx', '**/*.ts'],\n 'libs-frontend-app': ['lib/**/*.dart'],\n 'libs-backend-ts': ['**/*.ts'],\n 'libs-backend-python': ['**/*.py'],\n};\n\nexport const TOOL_OUTPUT_MAP = {\n 'claude-code': {\n mode: 'multi-file' as const,\n rulesDir: '.claude/rules',\n fileExtension: '.md',\n // single: path-scoped (paths: frontmatter) / monorepo: hierarchical ({workspace}/CLAUDE.md)\n contextStrategy: 'hybrid' as const,\n },\n codex: {\n mode: 'multi-file' as const,\n dir: '.codex',\n rootFileName: 'AGENTS.md', // global 룰\n domainFileName: 'AGENTS.override.md', // domain 룰 (하위 폴더)\n contextStrategy: 'hierarchical' as const, // 루트 + 하위 폴더 JIT\n },\n gemini: {\n mode: 'multi-file' as const,\n dir: '.gemini',\n rootFileName: 'GEMINI.md', // global 룰\n domainFileName: 'GEMINI.md', // domain 룰 (하위 폴더)\n contextStrategy: 'hierarchical' as const, // 루트 + 하위 폴더 JIT\n },\n} as const;\n\nexport type ToolId = keyof typeof TOOL_OUTPUT_MAP;\n","import { createHash } from 'node:crypto';\nimport { readFileSync, readdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { ManifestSchema } from './schemas/index.js';\nimport type { Manifest } from './schemas/index.js';\n\n// 문자열 배열 → SHA-256 → 6-hex (caller가 정렬 책임)\nexport const computeHash = (contents: readonly string[]): string =>\n createHash('sha256').update(contents.join('')).digest('hex').slice(0, 6);\n\n// rulesDir 내 YAML 파일들을 alphabetical 정렬 후 해싱\nexport const computeSourceHash = (rulesDir: string): string => {\n const files = readdirSync(rulesDir)\n .filter((f) => f.endsWith('.yaml'))\n .sort();\n const contents = files.map((f) => readFileSync(resolve(rulesDir, f), 'utf-8'));\n return computeHash(contents);\n};\n\n// Manifest Builder (Pure, 단 generatedAt에 현재 시각 사용)\nexport const buildManifest = (params: {\n tools: readonly string[];\n scope: 'project' | 'global';\n preset?: string;\n workspaces?: Record<string, { preset: string; rules: string[] }>;\n installedRules: readonly string[];\n installedFiles?: readonly string[];\n sourceHash: string;\n}): Manifest =>\n ManifestSchema.parse({\n tools: [...params.tools],\n scope: params.scope,\n preset: params.preset,\n workspaces: params.workspaces,\n installed_rules: [...params.installedRules],\n installed_files: params.installedFiles ? [...params.installedFiles] : undefined,\n sourceHash: params.sourceHash,\n generatedAt: new Date().toISOString(),\n });\n","const MANAGED_MARKER = '<!-- managed by ai-ops -->';\nconst META_PATTERN = /^<!-- sourceHash: ([a-f0-9]{6}) \\| generatedAt: (.+) -->$/;\n\nexport const wrapWithHeader = (content: string, meta: { sourceHash: string; generatedAt: string }): string => {\n const metaLine = `<!-- sourceHash: ${meta.sourceHash} | generatedAt: ${meta.generatedAt} -->`;\n return `${MANAGED_MARKER}\\n${metaLine}\\n\\n${content}`;\n};\n\nexport const isManagedFile = (content: string): boolean => content.startsWith(MANAGED_MARKER);\n\nexport const parseManagedHeader = (content: string): { sourceHash: string; generatedAt: string } | null => {\n if (!isManagedFile(content)) return null;\n\n const lines = content.split('\\n');\n const metaLine = lines[1] ?? '';\n const match = META_PATTERN.exec(metaLine);\n if (!match) return null;\n\n return { sourceHash: match[1], generatedAt: match[2] };\n};\n\nexport const stripManagedHeader = (content: string): string => {\n if (!isManagedFile(content)) return content;\n\n const lines = content.split('\\n');\n // marker line + meta line + blank line = 3 lines\n const stripped = lines.slice(3).join('\\n');\n return stripped;\n};\n","import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { ManifestSchema } from './schemas/index.js';\nimport type { Manifest } from './schemas/index.js';\n\nexport const MANIFEST_FILENAME = '.ai-ops-manifest.json';\n\n// Pure\nexport const parseManifest = (json: string): Manifest => ManifestSchema.parse(JSON.parse(json));\n\nexport const serializeManifest = (manifest: Manifest): string => JSON.stringify(manifest, null, 2) + '\\n';\n\n// I/O\nexport const resolveManifestPath = (basePath: string): string => join(basePath, MANIFEST_FILENAME);\n\nexport const readManifest = (manifestPath: string): Manifest | null => {\n let raw: string;\n try {\n raw = readFileSync(manifestPath, 'utf-8');\n } catch {\n return null;\n }\n return parseManifest(raw);\n};\n\nexport const writeManifest = (manifestPath: string, manifest: Manifest): void => {\n mkdirSync(dirname(manifestPath), { recursive: true });\n writeFileSync(manifestPath, serializeManifest(manifest), 'utf-8');\n};\n","import type { Manifest } from './schemas/index.js';\n\nexport type DiffResult = {\n status: 'up-to-date' | 'changed';\n added: readonly string[];\n removed: readonly string[];\n sourceChanged: boolean;\n};\n\nexport const computeDiff = (params: {\n previous: Manifest;\n currentRules: readonly string[];\n currentSourceHash: string;\n}): DiffResult => {\n const { previous, currentRules, currentSourceHash } = params;\n\n const previousSet = new Set(previous.installed_rules);\n const currentSet = new Set(currentRules);\n\n const added = currentRules.filter((id) => !previousSet.has(id));\n const removed = previous.installed_rules.filter((id) => !currentSet.has(id));\n const sourceChanged = previous.sourceHash !== currentSourceHash;\n\n const status = added.length > 0 || removed.length > 0 || sourceChanged ? 'changed' : 'up-to-date';\n\n return { status, added, removed, sourceChanged };\n};\n","import { join } from 'node:path';\nimport { wrapWithHeader } from './managed-header.js';\nimport { TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { ToolId } from './tool-output.js';\nimport type { ToolRenderResult } from './renderer.js';\n\n// Codex has no settings.json — plan directory convention must live in AGENTS.md\nconst CODEX_PLAN_SECTION =\n '\\n\\n---\\n\\n## Plan\\n\\nSave plans to `.codex/plans/<timestamp>-<topic>.md` when creating or updating plans in plan mode.';\n\nexport type FileAction = {\n relativePath: string;\n content: string;\n};\n\nexport const buildInstallPlan = (params: {\n toolId: ToolId;\n renderResult: ToolRenderResult;\n meta: { sourceHash: string; generatedAt: string };\n}): readonly FileAction[] => {\n const { toolId, renderResult, meta } = params;\n\n if (toolId === 'claude-code' && renderResult.tool === 'claude-code') {\n return renderResult.files.map(({ relativePath, content }) => ({\n relativePath,\n content: wrapWithHeader(content, meta),\n }));\n }\n\n if (\n (toolId === 'codex' && renderResult.tool === 'codex') ||\n (toolId === 'gemini' && renderResult.tool === 'gemini')\n ) {\n const config = TOOL_OUTPUT_MAP[toolId];\n const actions: FileAction[] = [];\n\n if (renderResult.rootContent) {\n const rootContent = toolId === 'codex' ? renderResult.rootContent + CODEX_PLAN_SECTION : renderResult.rootContent;\n actions.push({\n relativePath: join(config.dir, config.rootFileName),\n content: wrapWithHeader(rootContent, meta),\n });\n }\n\n if (renderResult.domainContent) {\n actions.push({\n relativePath: join(config.dir, config.domainFileName),\n content: wrapWithHeader(renderResult.domainContent, meta),\n });\n }\n\n return actions;\n }\n\n return [];\n};\n","import { join } from 'node:path';\nimport { TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { Manifest } from './schemas/index.js';\n\n/**\n * manifest에 installed_files가 없는 구버전 manifest를 위한 fallback.\n * manifest의 tools/workspaces/installed_rules 정보를 기반으로\n * 실제 설치됐을 파일 경로를 역산한다.\n */\nexport const inferInstalledFiles = (manifest: Manifest): string[] => {\n const files: string[] = [];\n const isMonorepo = manifest.workspaces !== undefined;\n\n for (const toolId of manifest.tools) {\n if (toolId === 'claude-code') {\n // claude-code: .claude/rules/{ruleId}.md\n const config = TOOL_OUTPUT_MAP['claude-code'];\n for (const ruleId of manifest.installed_rules) {\n files.push(join(config.rulesDir, `${ruleId}${config.fileExtension}`));\n }\n } else if (toolId === 'codex') {\n const config = TOOL_OUTPUT_MAP['codex'];\n if (!isMonorepo) {\n // 비모노: .codex/AGENTS.md + .codex/AGENTS.override.md (domain 있으면)\n files.push(join(config.dir, config.rootFileName));\n files.push(join(config.dir, config.domainFileName));\n } else {\n // 모노: .codex/AGENTS.md (global) + {workspace}/AGENTS.override.md (domain)\n files.push(join(config.dir, config.rootFileName));\n for (const ws of Object.keys(manifest.workspaces ?? {})) {\n files.push(join(ws, config.domainFileName));\n }\n }\n } else if (toolId === 'gemini') {\n const config = TOOL_OUTPUT_MAP['gemini'];\n if (!isMonorepo) {\n // 비모노: .gemini/GEMINI.md\n files.push(join(config.dir, config.rootFileName));\n } else {\n // 모노: .gemini/GEMINI.md (global) + {workspace}/GEMINI.md (domain)\n files.push(join(config.dir, config.rootFileName));\n for (const ws of Object.keys(manifest.workspaces ?? {})) {\n files.push(join(ws, config.domainFileName));\n }\n }\n }\n }\n\n // 중복 제거 (codex 비모노에서 rootFileName === domainFileName인 경우 대비)\n return [...new Set(files)];\n};\n","import { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n// dist/index.js 위치 기준 → 상위(패키지 루트) → data/\n// src/에서 실행 시: src/../data = data/ ✅\n// dist/에서 실행 시: dist/../data = data/ ✅\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport const COMPILER_DATA_DIR = resolve(__dirname, '..', 'data');\n"],"mappings":";AAGA,SAAS,SAAS;AAEX,IAAM,2BAA2B,EACrC,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA;AAAA,EAEtB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AACpC,CAAC,EACA,OAAO;AAEH,IAAM,oBAAoB,EAC9B,OAAO;AAAA;AAAA,EAEN,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAAA;AAAA,EAEtC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAAA;AAAA,EAErC,gBAAgB,EAAE,MAAM,wBAAwB,EAAE,SAAS;AAC7D,CAAC,EACA,OAAO;AAEH,IAAM,aAAa,EACvB,OAAO;AAAA,EACN,IA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,MAAM,GAAG,OAAO,aAAa,EAAE,CAAC;AAAA,MACtE;AAAA,IACF,WAAW,WAAW,SAAS;AAC7B,YAAM,SAAS,gBAAgB,OAAO;AACtC,UAAI,CAAC,YAAY;AAEf,cAAM,KAAKA,MAAK,OAAO,KAAK,OAAO,YAAY,CAAC;AAChD,cAAM,KAAKA,MAAK,OAAO,KAAK,OAAO,cAAc,CAAC;AAAA,MACpD,OAAO;AAEL,cAAM,KAAKA,MAAK,OAAO,KAAK,OAAO,YAAY,CAAC;AAChD,mBAAW,MAAM,OAAO,KAAK,SAAS,cAAc,CAAC,CAAC,GAAG;AACvD,gBAAM,KAAKA,MAAK,IAAI,OAAO,cAAc,CAAC;AAAA,QAC5C;AAAA,MACF;AAAA,IACF,WAAW,WAAW,UAAU;AAC9B,YAAM,SAAS,gBAAgB,QAAQ;AACvC,UAAI,CAAC,YAAY;AAEf,cAAM,KAAKA,MAAK,OAAO,KAAK,OAAO,YAAY,CAAC;AAAA,MAClD,OAAO;AAEL,cAAM,KAAKA,MAAK,OAAO,KAAK,OAAO,YAAY,CAAC;AAChD,mBAAW,MAAM,OAAO,KAAK,SAAS,cAAc,CAAC,CAAC,GAAG;AACvD,gBAAM,KAAKA,MAAK,IAAI,OAAO,cAAc,CAAC;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,SAAO,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;AAC3B;;;AClDA,SAAS,WAAAC,UAAS,WAAAC,gBAAe;AACjC,SAAS,qBAAqB;AAK9B,IAAM,YAAYD,SAAQ,cAAc,YAAY,GAAG,CAAC;AAEjD,IAAM,oBAAoBC,SAAQ,WAAW,MAAM,MAAM;","names":["z","z","global","domain","readFileSync","readdirSync","resolve","readdirSync","readFileSync","resolve","readFileSync","join","join","readFileSync","join","join","join","join","dirname","resolve"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/rule.schema.ts","../src/schemas/preset.schema.ts","../src/schemas/manifest.schema.ts","../src/loader.ts","../src/renderer.ts","../src/tool-output.ts","../src/source-hash.ts","../src/managed-header.ts","../src/manifest-io.ts","../src/diff.ts","../src/install-plan.ts","../src/uninstall-plan.ts","../src/paths.ts"],"sourcesContent":["/**\n * Rule = SSOT의 최소 지식 단위. 하나의 코딩 컨벤션/아키텍처 규칙을 YAML로 구조화한 것.\n */\nimport { z } from 'zod';\n\nexport const DecisionTableEntrySchema = z\n .object({\n when: z.string().min(1),\n then: z.string().min(1),\n /** 조건부 규칙에서 회피해야 할 패턴 */\n avoid: z.string().min(1).optional(),\n })\n .strict();\n\nexport const RuleContentSchema = z\n .object({\n /** Anti-pattern 규칙 ('하지 마라'). guidelines보다 항상 상단 렌더링 */\n constraints: z.array(z.string().min(1)),\n /** Positive 규칙 ('해라') */\n guidelines: z.array(z.string().min(1)),\n /** 조건부 규칙. when→then→avoid 구조 */\n decision_table: z.array(DecisionTableEntrySchema).optional(),\n })\n .strict();\n\nexport const RuleSchema = z\n .object({\n id: z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'id must be kebab-case'),\n category: z.string().min(1),\n tags: z.array(z.string().min(1)),\n /** 0-100. 높을수록 생성 파일 상단 배치 (U-shaped attention 최적화) */\n priority: z.number().int().min(0).max(100),\n content: RuleContentSchema,\n })\n .strict();\n\nexport type DecisionTableEntry = z.infer<typeof DecisionTableEntrySchema>;\nexport type RuleContent = z.infer<typeof RuleContentSchema>;\nexport type Rule = z.infer<typeof RuleSchema>;\n","import { z } from 'zod';\n\nexport const PresetSchema = z\n .object({\n id: z\n .string()\n .regex(/^[a-z][a-z0-9-]*$/)\n .min(1),\n description: z.string().min(1),\n rules: z.array(z.string().min(1)).min(1),\n })\n .strict();\n\nexport type Preset = z.infer<typeof PresetSchema>;\n","/**\n * Manifest = 설치 추적 메타데이터. CLI가 이전 설치 상태를 기억하기 위한 JSON.\n */\nimport { z } from 'zod';\n\nexport const SCOPES = {\n PROJECT: 'project',\n GLOBAL: 'global',\n} as const;\n\n/** 모노레포 워크스페이스별 preset + rules 추적 */\nconst WorkspaceEntrySchema = z\n .object({\n preset: z.string().min(1),\n rules: z.array(z.string().min(1)),\n })\n .strict();\n\nexport type WorkspaceEntry = z.infer<typeof WorkspaceEntrySchema>;\n\nexport const ManifestSchema = z\n .object({\n tools: z.array(z.string().min(1)).min(1),\n scope: z.enum(['project', 'global']),\n /** 비모노레포 단일 preset */\n preset: z.string().min(1).optional(),\n /** 모노레포: workspace path → { preset, rules } */\n workspaces: z.record(z.string(), WorkspaceEntrySchema).optional(),\n installed_rules: z.array(z.string().min(1)),\n /** 실제 디스크에 쓰여진 파일 상대 경로 목록 (uninstall용). 기존 manifest 호환성 위해 optional */\n installed_files: z.array(z.string().min(1)).optional(),\n /** non-managed 파일에 섹션을 append한 경우 추적 (uninstall 시 섹션만 제거) */\n appended_files: z.array(z.string().min(1)).optional(),\n /** SSOT 데이터 파일들의 deterministic SHA-256 해시 (6자리 hex). diff/update 판단 기준 */\n sourceHash: z.string().regex(/^[a-f0-9]{6}$/, 'sourceHash must be 6 lowercase hex chars'),\n generatedAt: z.string().datetime({ offset: true }),\n })\n .strict();\n\nexport type Manifest = z.infer<typeof ManifestSchema>;\n","import { readFileSync, readdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { parse } from 'yaml';\nimport { RuleSchema, PresetSchema } from './schemas/index.js';\nimport type { Rule, Preset } from './schemas/index.js';\n\n// priority 내림차순 정렬 (높을수록 상단 → U-shaped attention)\nexport const sortRulesByPriority = (rules: readonly Rule[]): Rule[] =>\n [...rules].sort((a, b) => b.priority - a.priority);\n\n// presets.yaml의 Record<id, {description, rules}> → Preset[] 변환\nexport const parseRawPresets = (raw: Record<string, { description: string; rules: string[] }>): Preset[] =>\n Object.entries(raw).map(([id, value]) => PresetSchema.parse({ id, ...value }));\n\n// TUI 세부조정: 사용자가 해제한 rule ID 목록을 제외 (순서 유지)\nexport const excludeRules = (rules: readonly Rule[], excludeIds: readonly string[]): Rule[] => {\n const excludeSet = new Set(excludeIds);\n return rules.filter((r) => !excludeSet.has(r.id));\n};\n\n// preset.rules ID 목록으로 allRules에서 필터링 + priority 정렬, 누락 시 throw\nexport const resolvePresetRules = (preset: Preset, allRules: readonly Rule[]): Rule[] => {\n const resolved = preset.rules.map((ruleId) => {\n const found = allRules.find((r) => r.id === ruleId);\n if (!found) throw new Error(`Rule not found: ${ruleId}`);\n return found;\n });\n return sortRulesByPriority(resolved);\n};\n\nexport const loadRuleFile = (filePath: string): Rule => {\n const raw = readFileSync(filePath, 'utf-8');\n return RuleSchema.parse(parse(raw));\n};\n\n// readdirSync + .yaml 필터 + sort\nexport const loadAllRules = (rulesDir: string): Rule[] => {\n const files = readdirSync(rulesDir)\n .filter((f) => f.endsWith('.yaml'))\n .sort();\n return files.map((f) => loadRuleFile(resolve(rulesDir, f)));\n};\n\nexport const loadPresets = (presetsPath: string): Preset[] => {\n const raw = readFileSync(presetsPath, 'utf-8');\n const data = parse(raw) as Record<string, { description: string; rules: string[] }>;\n return parseRawPresets(data);\n};\n","import { join } from 'node:path';\nimport type { Rule, DecisionTableEntry } from './schemas/index.js';\nimport { GLOBAL_CATEGORIES, CLAUDE_CODE_PATH_GLOBS, TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { ToolId } from './tool-output.js';\n\n// \"react-typescript\" → \"React Typescript\"\nexport const ruleIdToTitle = (id: string): string =>\n id\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n\n// DecisionTableEntry[] → Markdown 테이블 (pipe 문자 | escape)\nexport const renderDecisionTable = (entries: readonly DecisionTableEntry[]): string => {\n const escape = (s: string) => s.replace(/\\|/g, '|');\n const hasAvoid = entries.some((e) => e.avoid !== undefined);\n\n const header = hasAvoid ? '| When | Then | Avoid |\\n|------|------|-------|' : '| When | Then |\\n|------|------|';\n\n const rows = entries.map((e) => {\n const when = escape(e.when);\n const then = escape(e.then);\n if (hasAvoid) {\n const avoid = e.avoid ? escape(e.avoid) : '';\n return `| ${when} | ${then} | ${avoid} |`;\n }\n return `| ${when} | ${then} |`;\n });\n\n return [header, ...rows].join('\\n');\n};\n\n// 단일 Rule → Markdown (빈 섹션 생략)\nexport const renderRuleToMarkdown = (rule: Rule): string => {\n const sections: string[] = [`# ${ruleIdToTitle(rule.id)}`];\n\n if (rule.content.constraints.length > 0) {\n sections.push('## Constraints');\n sections.push(rule.content.constraints.map((c) => `- ${c}`).join('\\n'));\n }\n\n if (rule.content.guidelines.length > 0) {\n sections.push('## Guidelines');\n sections.push(rule.content.guidelines.map((g) => `- ${g}`).join('\\n'));\n }\n\n if (rule.content.decision_table && rule.content.decision_table.length > 0) {\n sections.push('## Decision Table');\n sections.push(renderDecisionTable(rule.content.decision_table));\n }\n\n return sections.join('\\n\\n');\n};\n\n// Rule[] → 단일 Markdown (--- separator, single-file 모드용)\nexport const renderRulesToMarkdown = (rules: readonly Rule[]): string =>\n rules.map(renderRuleToMarkdown).join('\\n\\n---\\n\\n');\n\n// Rule이 global 카테고리에 속하는지 판별\nexport const isGlobalRule = (rule: Rule): boolean => (GLOBAL_CATEGORIES as readonly string[]).includes(rule.category);\n\n// Rule[] → { global, domain } 분리\nexport const partitionRules = (rules: readonly Rule[]): { global: Rule[]; domain: Rule[] } => {\n const global: Rule[] = [];\n const domain: Rule[] = [];\n for (const rule of rules) {\n if (isGlobalRule(rule)) {\n global.push(rule);\n } else {\n domain.push(rule);\n }\n }\n return { global, domain };\n};\n\n// glob 배열 → YAML frontmatter 블록\nexport const renderFrontmatter = (paths: readonly string[]): string => {\n const lines = paths.map((p) => ` - \"${p}\"`).join('\\n');\n return `---\\npaths:\\n${lines}\\n---`;\n};\n\nexport type WorkspaceMapping = {\n path: string;\n ruleIds: readonly string[];\n};\n\n// 단일 Rule → Claude Code용 Markdown\n// domain 룰이면서 glob 매핑이 있으면 paths: frontmatter 추가 (단일 프로젝트 전용)\n// global 룰 또는 매핑 없는 domain 룰 → frontmatter 없음\nexport const renderClaudeCodeRule = (rule: Rule): string => {\n const globs = CLAUDE_CODE_PATH_GLOBS[rule.id];\n if (!isGlobalRule(rule) && globs !== undefined) {\n return `${renderFrontmatter(globs)}\\n\\n${renderRuleToMarkdown(rule)}`;\n }\n return renderRuleToMarkdown(rule);\n};\n\n// 도구별 렌더링 결과 타입 (tagged union)\nexport type ClaudeCodeRenderResult = {\n tool: 'claude-code';\n files: { relativePath: string; content: string }[];\n};\n\nexport type CodexRenderResult = {\n tool: 'codex';\n rootContent: string;\n domainContent: string;\n};\n\nexport type GeminiRenderResult = {\n tool: 'gemini';\n rootContent: string;\n domainContent: string;\n};\n\nexport type ToolRenderResult = ClaudeCodeRenderResult | CodexRenderResult | GeminiRenderResult;\n\n// CLI 진입점: toolId + rules → 도구별 렌더링 결과\nexport const renderForTool = (\n toolId: ToolId,\n rules: readonly Rule[],\n workspaceMappings?: readonly WorkspaceMapping[],\n): ToolRenderResult => {\n const config = TOOL_OUTPUT_MAP[toolId];\n\n if (toolId === 'claude-code') {\n const { rulesDir, fileExtension } = config as (typeof TOOL_OUTPUT_MAP)['claude-code'];\n\n if (!workspaceMappings || workspaceMappings.length === 0) {\n // 단일 프로젝트: domain 룰에 paths: frontmatter (path-scoped)\n const files = rules.map((rule) => ({\n relativePath: join(rulesDir, `${rule.id}${fileExtension}`),\n content: renderClaudeCodeRule(rule),\n }));\n return { tool: 'claude-code', files };\n }\n\n // 모노레포: global → .claude/rules/, domain → {workspace}/CLAUDE.md (진짜 지연 로딩)\n const { global, domain } = partitionRules(rules);\n\n const globalFiles = global.map((rule) => ({\n relativePath: join(rulesDir, `${rule.id}${fileExtension}`),\n content: renderRuleToMarkdown(rule), // global은 frontmatter 불필요\n }));\n\n const workspaceFiles: { relativePath: string; content: string }[] = [];\n for (const ws of workspaceMappings) {\n const wsRules = domain.filter((r) => ws.ruleIds.includes(r.id));\n if (wsRules.length === 0) continue;\n workspaceFiles.push({\n relativePath: join(ws.path, 'CLAUDE.md'),\n content: renderRulesToMarkdown(wsRules),\n });\n }\n\n return { tool: 'claude-code', files: [...globalFiles, ...workspaceFiles] };\n }\n\n const { global, domain } = partitionRules(rules);\n const rootContent = renderRulesToMarkdown(global);\n const domainContent = renderRulesToMarkdown(domain);\n\n if (toolId === 'codex') {\n return { tool: 'codex', rootContent, domainContent };\n }\n\n // gemini\n return { tool: 'gemini', rootContent, domainContent };\n};\n","// Global 성격의 category (항상 로딩, frontmatter 없음)\nexport const GLOBAL_CATEGORIES = ['persona', 'communication', 'philosophy', 'convention', 'standard'] as const;\n\n// Claude Code paths: frontmatter용 Rule ID → glob 매핑\n// src/ 없이 루트를 src처럼 쓰는 React/Next.js 프로젝트 고려\n// 매핑에 없는 domain 룰 → frontmatter 없이 항상 로딩 (안전 fallback)\nexport const CLAUDE_CODE_PATH_GLOBS: Readonly<Record<string, readonly string[]>> = {\n typescript: ['**/*.ts', '**/*.tsx'],\n 'react-typescript': ['**/*.tsx', '**/*.jsx'],\n nextjs: ['**/app/**', 'next.config.*', '**/middleware.ts'],\n nestjs: ['**/*.module.ts', '**/*.controller.ts', '**/*.service.ts'],\n 'nestjs-graphql': ['**/*.resolver.ts'],\n graphql: ['**/*.graphql', '**/*.gql'],\n 'prisma-postgresql': ['prisma/**', '**/*.prisma'],\n 'shadcn-ui': ['**/components/ui/**'],\n flutter: ['lib/**/*.dart'],\n python: ['**/*.py'],\n fastapi: ['**/routers/**', '**/main.py'],\n sqlalchemy: ['**/models/**/*.py', 'alembic/**'],\n 'data-pipeline-python': ['**/pipelines/**', '**/etl/**'],\n 'ai-llm-python': ['**/agents/**', '**/chains/**'],\n 'libs-frontend-web': ['**/*.tsx', '**/*.ts'],\n 'libs-frontend-app': ['lib/**/*.dart'],\n 'libs-backend-ts': ['**/*.ts'],\n 'libs-backend-python': ['**/*.py'],\n};\n\nexport const TOOL_OUTPUT_MAP = {\n 'claude-code': {\n mode: 'multi-file' as const,\n rulesDir: '.claude/rules',\n fileExtension: '.md',\n // single: path-scoped (paths: frontmatter) / monorepo: hierarchical ({workspace}/CLAUDE.md)\n contextStrategy: 'hybrid' as const,\n },\n codex: {\n mode: 'multi-file' as const,\n dir: '',\n rootFileName: 'AGENTS.md', // global 룰\n domainFileName: 'AGENTS.override.md', // domain 룰 (하위 폴더)\n contextStrategy: 'hierarchical' as const, // 루트 + 하위 폴더 JIT\n },\n gemini: {\n mode: 'multi-file' as const,\n dir: '.gemini',\n rootFileName: 'GEMINI.md', // global 룰\n domainFileName: 'GEMINI.md', // domain 룰 (하위 폴더)\n contextStrategy: 'hierarchical' as const, // 루트 + 하위 폴더 JIT\n },\n} as const;\n\nexport type ToolId = keyof typeof TOOL_OUTPUT_MAP;\n","import { createHash } from 'node:crypto';\nimport { readFileSync, readdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { ManifestSchema } from './schemas/index.js';\nimport type { Manifest } from './schemas/index.js';\n\n// 문자열 배열 → SHA-256 → 6-hex (caller가 정렬 책임)\nexport const computeHash = (contents: readonly string[]): string =>\n createHash('sha256').update(contents.join('')).digest('hex').slice(0, 6);\n\n// rulesDir 내 YAML 파일들을 alphabetical 정렬 후 해싱\nexport const computeSourceHash = (rulesDir: string): string => {\n const files = readdirSync(rulesDir)\n .filter((f) => f.endsWith('.yaml'))\n .sort();\n const contents = files.map((f) => readFileSync(resolve(rulesDir, f), 'utf-8'));\n return computeHash(contents);\n};\n\n// Manifest Builder (Pure, 단 generatedAt에 현재 시각 사용)\nexport const buildManifest = (params: {\n tools: readonly string[];\n scope: 'project' | 'global';\n preset?: string;\n workspaces?: Record<string, { preset: string; rules: string[] }>;\n installedRules: readonly string[];\n installedFiles?: readonly string[];\n appendedFiles?: readonly string[];\n sourceHash: string;\n}): Manifest =>\n ManifestSchema.parse({\n tools: [...params.tools],\n scope: params.scope,\n preset: params.preset,\n workspaces: params.workspaces,\n installed_rules: [...params.installedRules],\n installed_files: params.installedFiles ? [...params.installedFiles] : undefined,\n appended_files: params.appendedFiles && params.appendedFiles.length > 0 ? [...params.appendedFiles] : undefined,\n sourceHash: params.sourceHash,\n generatedAt: new Date().toISOString(),\n });\n","const MANAGED_MARKER = '<!-- managed by ai-ops -->';\nconst META_PATTERN = /^<!-- sourceHash: ([a-f0-9]{6}) \\| generatedAt: (.+) -->$/;\n\nconst SECTION_START = '<!-- ai-ops:start -->';\nconst SECTION_END = '<!-- ai-ops:end -->';\n\nexport const wrapWithHeader = (content: string, meta: { sourceHash: string; generatedAt: string }): string => {\n const metaLine = `<!-- sourceHash: ${meta.sourceHash} | generatedAt: ${meta.generatedAt} -->`;\n return `${MANAGED_MARKER}\\n${metaLine}\\n\\n${content}`;\n};\n\nexport const isManagedFile = (content: string): boolean => content.startsWith(MANAGED_MARKER);\n\nexport const parseManagedHeader = (content: string): { sourceHash: string; generatedAt: string } | null => {\n if (!isManagedFile(content)) return null;\n\n const lines = content.split('\\n');\n const metaLine = lines[1] ?? '';\n const match = META_PATTERN.exec(metaLine);\n if (!match) return null;\n\n return { sourceHash: match[1], generatedAt: match[2] };\n};\n\nexport const stripManagedHeader = (content: string): string => {\n if (!isManagedFile(content)) return content;\n\n const lines = content.split('\\n');\n // marker line + meta line + blank line = 3 lines\n const stripped = lines.slice(3).join('\\n');\n return stripped;\n};\n\nexport const wrapWithSection = (content: string, meta: { sourceHash: string; generatedAt: string }): string => {\n const metaLine = `<!-- sourceHash: ${meta.sourceHash} | generatedAt: ${meta.generatedAt} -->`;\n return `${SECTION_START}\\n${metaLine}\\n\\n${content}\\n${SECTION_END}`;\n};\n\nexport const hasAiOpsSection = (content: string): boolean =>\n content.includes(SECTION_START) && content.includes(SECTION_END);\n\nexport const stripAiOpsSection = (content: string): string => {\n const startIdx = content.indexOf(SECTION_START);\n const endIdx = content.indexOf(SECTION_END);\n if (startIdx === -1 || endIdx === -1) return content;\n\n const before = content.slice(0, startIdx).trimEnd();\n const after = content.slice(endIdx + SECTION_END.length).trimStart();\n return before + (after ? '\\n\\n' + after : '') + '\\n';\n};\n\nexport const replaceAiOpsSection = (existing: string, newSection: string): string => {\n const startIdx = existing.indexOf(SECTION_START);\n const endIdx = existing.indexOf(SECTION_END);\n if (startIdx === -1 || endIdx === -1) return existing;\n\n const before = existing.slice(0, startIdx).trimEnd();\n const after = existing.slice(endIdx + SECTION_END.length).trimStart();\n return before + '\\n\\n' + newSection + (after ? '\\n\\n' + after : '') + '\\n';\n};\n","import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { ManifestSchema } from './schemas/index.js';\nimport type { Manifest } from './schemas/index.js';\n\nexport const MANIFEST_FILENAME = '.ai-ops-manifest.json';\n\n// Pure\nexport const parseManifest = (json: string): Manifest => ManifestSchema.parse(JSON.parse(json));\n\nexport const serializeManifest = (manifest: Manifest): string => JSON.stringify(manifest, null, 2) + '\\n';\n\n// I/O\nexport const resolveManifestPath = (basePath: string): string => join(basePath, MANIFEST_FILENAME);\n\nexport const readManifest = (manifestPath: string): Manifest | null => {\n let raw: string;\n try {\n raw = readFileSync(manifestPath, 'utf-8');\n } catch {\n return null;\n }\n return parseManifest(raw);\n};\n\nexport const writeManifest = (manifestPath: string, manifest: Manifest): void => {\n mkdirSync(dirname(manifestPath), { recursive: true });\n writeFileSync(manifestPath, serializeManifest(manifest), 'utf-8');\n};\n","import type { Manifest } from './schemas/index.js';\n\nexport type DiffResult = {\n status: 'up-to-date' | 'changed';\n added: readonly string[];\n removed: readonly string[];\n sourceChanged: boolean;\n};\n\nexport const computeDiff = (params: {\n previous: Manifest;\n currentRules: readonly string[];\n currentSourceHash: string;\n}): DiffResult => {\n const { previous, currentRules, currentSourceHash } = params;\n\n const previousSet = new Set(previous.installed_rules);\n const currentSet = new Set(currentRules);\n\n const added = currentRules.filter((id) => !previousSet.has(id));\n const removed = previous.installed_rules.filter((id) => !currentSet.has(id));\n const sourceChanged = previous.sourceHash !== currentSourceHash;\n\n const status = added.length > 0 || removed.length > 0 || sourceChanged ? 'changed' : 'up-to-date';\n\n return { status, added, removed, sourceChanged };\n};\n","import { join } from 'node:path';\nimport { wrapWithHeader } from './managed-header.js';\nimport { TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { ToolId } from './tool-output.js';\nimport type { ToolRenderResult } from './renderer.js';\n\n// Codex has no settings.json — plan directory convention must live in AGENTS.md\nconst CODEX_PLAN_SECTION =\n '\\n\\n---\\n\\n## Plan\\n\\nSave plans to `.codex/plans/<timestamp>-<topic>.md` when creating or updating plans in plan mode.';\n\nexport type FileAction = {\n relativePath: string;\n content: string;\n};\n\nexport const buildInstallPlan = (params: {\n toolId: ToolId;\n renderResult: ToolRenderResult;\n meta: { sourceHash: string; generatedAt: string };\n}): readonly FileAction[] => {\n const { toolId, renderResult, meta } = params;\n\n if (toolId === 'claude-code' && renderResult.tool === 'claude-code') {\n return renderResult.files.map(({ relativePath, content }) => ({\n relativePath,\n content: wrapWithHeader(content, meta),\n }));\n }\n\n if (\n (toolId === 'codex' && renderResult.tool === 'codex') ||\n (toolId === 'gemini' && renderResult.tool === 'gemini')\n ) {\n const config = TOOL_OUTPUT_MAP[toolId];\n const actions: FileAction[] = [];\n\n if (renderResult.rootContent) {\n const rootContent = toolId === 'codex' ? renderResult.rootContent + CODEX_PLAN_SECTION : renderResult.rootContent;\n actions.push({\n relativePath: join(config.dir, config.rootFileName),\n content: wrapWithHeader(rootContent, meta),\n });\n }\n\n if (renderResult.domainContent) {\n actions.push({\n relativePath: join(config.dir, config.domainFileName),\n content: wrapWithHeader(renderResult.domainContent, meta),\n });\n }\n\n return actions;\n }\n\n return [];\n};\n","import { join } from 'node:path';\nimport { TOOL_OUTPUT_MAP } from './tool-output.js';\nimport type { Manifest } from './schemas/index.js';\n\n/**\n * manifest에 installed_files가 없는 구버전 manifest를 위한 fallback.\n * manifest의 tools/workspaces/installed_rules 정보를 기반으로\n * 실제 설치됐을 파일 경로를 역산한다.\n */\nexport const inferInstalledFiles = (manifest: Manifest): string[] => {\n const files: string[] = [];\n const isMonorepo = manifest.workspaces !== undefined;\n\n for (const toolId of manifest.tools) {\n if (toolId === 'claude-code') {\n // claude-code: .claude/rules/{ruleId}.md\n const config = TOOL_OUTPUT_MAP['claude-code'];\n for (const ruleId of manifest.installed_rules) {\n files.push(join(config.rulesDir, `${ruleId}${config.fileExtension}`));\n }\n } else if (toolId === 'codex') {\n const config = TOOL_OUTPUT_MAP['codex'];\n if (!isMonorepo) {\n // 비모노: .codex/AGENTS.md + .codex/AGENTS.override.md (domain 있으면)\n files.push(join(config.dir, config.rootFileName));\n files.push(join(config.dir, config.domainFileName));\n } else {\n // 모노: .codex/AGENTS.md (global) + {workspace}/AGENTS.override.md (domain)\n files.push(join(config.dir, config.rootFileName));\n for (const ws of Object.keys(manifest.workspaces ?? {})) {\n files.push(join(ws, config.domainFileName));\n }\n }\n } else if (toolId === 'gemini') {\n const config = TOOL_OUTPUT_MAP['gemini'];\n if (!isMonorepo) {\n // 비모노: .gemini/GEMINI.md\n files.push(join(config.dir, config.rootFileName));\n } else {\n // 모노: .gemini/GEMINI.md (global) + {workspace}/GEMINI.md (domain)\n files.push(join(config.dir, config.rootFileName));\n for (const ws of Object.keys(manifest.workspaces ?? {})) {\n files.push(join(ws, config.domainFileName));\n }\n }\n }\n }\n\n // 중복 제거 (codex 비모노에서 rootFileName === domainFileName인 경우 대비)\n return [...new Set(files)];\n};\n","import { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n// dist/index.js 위치 기준 → 상위(패키지 루트) → data/\n// src/에서 실행 시: src/../data = data/ ✅\n// dist/에서 실행 시: dist/../data = data/ ✅\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport const COMPILER_DATA_DIR = resolve(__dirname, '..', 'data');\n"],"mappings":";AAGA,SAAS,SAAS;AAEX,IAAM,2BAA2B,EACrC,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA;AAAA,EAEtB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AACpC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,YAAY,GAAG,CAAC;AAEjD,IAAM,oBAAoBC,SAAQ,WAAW,MAAM,MAAM;","names":["z","z","global","domain","readFileSync","readdirSync","resolve","readdirSync","readFileSync","resolve","readFileSync","join","join","readFileSync","join","join","join","join","dirname","resolve"]}
|