@conscience-technology/ovenn 0.7.5 → 0.7.6
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/README.md +43 -4
- package/assets/components/AttachmentThumb/AttachmentThumb.tsx +1 -0
- package/assets/components/ChatComposer/ChatComposer.tsx +1 -1
- package/assets/components/FileIcon/FileIcon.tsx +1 -0
- package/assets/components/FileIcon/fileExtMap.ts +1 -0
- package/assets/components/Onboarding/OnboardingAxisPanel.tsx +1 -1
- package/assets/components/Onboarding/OnboardingPage.tsx +13 -11
- package/assets/components/Onboarding/actions.ts +9 -9
- package/assets/components/TableRowEdit/TableRowEdit.tsx +2 -2
- package/assets/components/ThemeController.tsx +2 -2
- package/assets/components/TimelineView/TimelineView.tsx +4 -2
- package/assets/components/Tooltip/Tooltip.module.css +1 -0
- package/assets/components/_utils.css +1 -0
- package/assets/components/side-effect-css.d.ts +5 -0
- package/assets/components/themeBootScript.ts +7 -1
- package/assets/components/tokens.css +1 -0
- package/assets/prompts/ASSEMBLY.md +2 -0
- package/assets/prompts/CASCADE.md +2 -2
- package/assets/prompts/CATALOG.md +1 -1
- package/assets/prompts/PRINCIPLES.md +4 -8
- package/assets/prompts/RULES.md +19 -1
- package/assets/prompts/SLOTS.md +2 -4
- package/assets/prompts/WORKFLOW_DESIGN.md +0 -4
- package/assets/prompts/axes/icon.md +1 -1
- package/assets/prompts/axes/motion.md +1 -1
- package/assets/prompts/axes/voice.md +1 -1
- package/assets/prompts/components/_variants.md +3 -3
- package/assets/prompts/components/accordion.md +4 -4
- package/assets/prompts/components/attachment-item.md +2 -2
- package/assets/prompts/components/button.md +2 -2
- package/assets/prompts/components/card.md +1 -2
- package/assets/prompts/components/chart-bar.md +1 -1
- package/assets/prompts/components/chat-input.md +1 -1
- package/assets/prompts/components/checkbox.md +5 -5
- package/assets/prompts/components/color-field.md +2 -2
- package/assets/prompts/components/command-palette.md +3 -3
- package/assets/prompts/components/context-menu.md +5 -5
- package/assets/prompts/components/date-picker.md +2 -2
- package/assets/prompts/components/drawer.md +2 -2
- package/assets/prompts/components/dropdown-menu.md +3 -3
- package/assets/prompts/components/event-list-item.md +4 -4
- package/assets/prompts/components/file-icon.md +2 -2
- package/assets/prompts/components/gallery-item.md +1 -1
- package/assets/prompts/components/hint.md +3 -3
- package/assets/prompts/components/kanban.md +2 -3
- package/assets/prompts/components/list-item.md +11 -11
- package/assets/prompts/components/menu-item.md +2 -2
- package/assets/prompts/components/message-table.md +4 -4
- package/assets/prompts/components/onboarding.md +3 -3
- package/assets/prompts/components/page-header.md +6 -7
- package/assets/prompts/components/quotation-bar.md +1 -1
- package/assets/prompts/components/select.md +1 -1
- package/assets/prompts/components/shortcut.md +3 -3
- package/assets/prompts/components/sidebar.md +5 -4
- package/assets/prompts/components/stepper.md +1 -1
- package/assets/prompts/components/tab-strip.md +2 -2
- package/assets/prompts/components/table-row-edit.md +6 -6
- package/assets/prompts/components/table-row-select.md +1 -1
- package/assets/prompts/components/tabs.md +5 -2
- package/assets/prompts/components/textarea.md +1 -1
- package/assets/prompts/components/toast.md +3 -3
- package/assets/prompts/components/tooltip.md +3 -3
- package/assets/prompts/components/topbar.md +1 -1
- package/assets/prompts/primitives/scroll.md +1 -1
- package/assets/prompts/recipes/README.md +5 -6
- package/assets/prompts/recipes/meta-line.md +2 -2
- package/assets/prompts/recipes/page-header.md +2 -2
- package/assets/prompts/recipes/section-header.md +1 -1
- package/assets/prompts/themes/_SCHEMA.md +2 -2
- package/assets/skills/ovenn-validate/SKILL.md +1 -1
- package/assets/skills/ovenn-validate/scripts/lib/component-usage.js +7 -1
- package/assets/skills/ovenn-validate/scripts/lib/engine.mjs +105 -0
- package/assets/skills/ovenn-validate/scripts/lib/engine.test.mjs +46 -0
- package/assets/skills/ovenn-validate/scripts/lib/source-utils.mjs +5 -3
- package/assets/skills/ovenn-validate/scripts/rules/doc-sync.mjs +28 -5
- package/assets/skills/ovenn-validate/scripts/rules/doc-sync.test.mjs +15 -0
- package/assets/skills/ovenn-validate/scripts/rules/ghost-tokens.mjs +7 -0
- package/assets/skills/ovenn-validate/scripts/rules/hardcoded.mjs +61 -30
- package/assets/skills/ovenn-validate/scripts/rules/memory-rules.mjs +7 -4
- package/assets/skills/ovenn-validate/scripts/rules/memory-rules.test.mjs +3 -0
- package/assets/skills/ovenn-validate/scripts/validate.mjs +8 -136
- package/assets/skills/ovenn-wireframe/SKILL.md +1 -1
- package/bin/ovenn.js +8 -0
- package/package.json +2 -2
- package/src/commands/check.js +70 -0
- package/src/commands/info.js +32 -7
- package/src/commands/init.js +26 -30
- package/src/commands/setup-checks.js +80 -0
- package/src/commands/update.js +90 -18
- package/src/data/ctds-releases.json +1 -0
- package/src/utils/assets.js +5 -0
- package/src/utils/component-usage.js +7 -1
- package/src/utils/design-workflow.js +6 -2
- package/src/utils/doctor.js +7 -1
- package/src/utils/legacy-ctds.js +169 -0
- package/src/utils/managed-assets.js +16 -3
- package/src/utils/route.js +17 -0
- package/src/utils/rules-context.js +91 -0
- package/src/utils/update-transaction.js +16 -3
- package/assets/prompts/FEEDBACK_PROCESS.md +0 -19
- package/assets/prompts/GUIDE.md +0 -307
- package/assets/prompts/MEMORY.md +0 -202
- package/assets/prompts/TEMPLATE_PREVIEWS.md +0 -21
- package/assets/prompts/components/README.md +0 -84
|
@@ -10,8 +10,14 @@ const digest=value=>createHash('sha256').update(value).digest('hex');
|
|
|
10
10
|
export function componentExports(source){return [...new Set([...source.matchAll(/export\s*\{([^}]+)\}/g)].flatMap(match=>match[1].split(',').map(value=>value.trim()).filter(value=>value&&!value.startsWith('type ')).map(value=>value.split(/\s+as\s+/).at(-1))))];}
|
|
11
11
|
function exportFolder(registry,name,files={},base='components/') {return registry.find(entry=>entry.status!=='wip'&&(entry.folder===name||(entry.exports||componentExports(files[base+entry.folder+'/index.ts']||'')).includes(name)))?.folder;}
|
|
12
12
|
export function componentContract(text){const match=text.match(/<!-- component-contract -->\s*```json\s*([\s\S]*?)```/);return match?JSON.parse(match[1]):null;}
|
|
13
|
+
// The checks parse with TypeScript's JS compiler API. TypeScript 7's `typescript` package no longer exposes it,
|
|
14
|
+
// so a TS 7 project resolves it from @typescript/typescript6, the compatibility package Microsoft publishes for tools.
|
|
13
15
|
export function loadTypeScript(root=process.cwd()){
|
|
14
|
-
|
|
16
|
+
let native=null;
|
|
17
|
+
for(const base of [root,path.join(root,'web')])for(const name of ['typescript','@typescript/typescript6']){
|
|
18
|
+
try{const ts=createRequire(path.join(base,'package.json'))(name);if(typeof ts.createSourceFile==='function'&&typeof ts.preProcessFile==='function')return ts;native??=ts.version;}catch{}
|
|
19
|
+
}
|
|
20
|
+
if(native)throw new Error(`TypeScript ${native} has no JS compiler API, which this check needs. Install the compatibility package next to it: npm install -D @typescript/typescript6. No packages were installed automatically.`);
|
|
15
21
|
throw new Error('TypeScript parser is unavailable. Use a project with TypeScript installed; no packages were installed automatically.');
|
|
16
22
|
}
|
|
17
23
|
export function planSchema(){return {type:'object',additionalProperties:false,required:['version','scope','direction','roles'],properties:{version:{type:'string',enum:['2']},scope:{type:'string',enum:['page','partial','component']},direction:{type:'string',minLength:1},roles:{type:'array',minItems:1,items:{type:'object',additionalProperties:false,required:['id','purpose','component','components','strategy','source','originalHash','reason','requires','sourceFiles','evidence'],properties:{id:{type:'string'},purpose:{type:'string'},component:{type:'string'},components:{type:'array',items:{type:'string'}},strategy:{type:'string',enum:['reuse','compose','derived','custom','preserved']},source:{type:'string'},originalHash:{type:'string'},reason:{type:'string'},requires:{type:'array',items:{type:'string'}},sourceFiles:{type:'array',items:{type:'string'}},evidence:{type:'array',items:{type:'string'}}}}}}};}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {phaseSources} from "./rules-context.js";
|
|
1
2
|
import {planSchema} from './component-usage.js';
|
|
2
3
|
const nonempty = value => typeof value === 'string' && Boolean(value.trim());
|
|
3
4
|
const array = value => Array.isArray(value) ? value : [];
|
|
@@ -148,8 +149,11 @@ export function assessWorkflow(record, policy) {
|
|
|
148
149
|
if(collaborative(policy) && assessment.status==='reviewed' && latest.status!=='reviewed')return {status:'review_pending',missing:['specialist-status-mismatch']};
|
|
149
150
|
return assessment;
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
// phase (plan|build|review) returns only the sections and schemas that phase uses; omitted keeps the full contract.
|
|
153
|
+
/** @param {string} assembly @param {string} review @param {{scope?: string, role?: string, phase?: 'plan'|'build'|'review'}} [options] */
|
|
154
|
+
export function workflowContext(assembly,review,{scope='page',role='generator',phase}={}) {
|
|
152
155
|
const policy=workflowPolicy(assembly);
|
|
153
156
|
if(!policy.scopes.includes(scope)||!['generator','reviewer'].includes(role))throw new Error('Invalid workflow scope or role');
|
|
154
|
-
|
|
157
|
+
const planning=!phase||phase!=='review',reviewing=!phase||phase==='review';
|
|
158
|
+
return {scope,role,...(phase?{phase,sections:'Only this phase. Call again with phase=plan|build|review for the next one, or without phase for the full documents.'}:{}),policy,...(planning?{componentPlanSchema:planSchema()}:{}),sources:phaseSources(assembly,review,phase),...(reviewing?{reviewSchema:reviewSchema(policy),reviewContentSchema:reviewContentSchema(policy),...(policy.orchestrationVersion===2?{uxReviewContentSchema:uxReviewContentSchema(policy)}:{})}:{}),responsibility:role==='reviewer'?'생성 대화와 분리된 문맥에서 실제 캡처와 상태 증거를 검토한다. 소스를 수정하지 않는다. 관측 못한 항목은 not_observed로 기록한다. 실행기가 실제 제공한 소스·캡처 hash와 세션을 검수 내용에 연결하며 모델의 hash 복사를 관측 증거로 삼지 않는다.':'원본 절차를 실행하고 실제 도구/파일 증거를 기록한다. 독립 검수자를 실행할 수 없으면 review_pending. 자체 평가를 독립 검수로 표시하지 않는다.'};
|
|
155
159
|
}
|
package/src/utils/doctor.js
CHANGED
|
@@ -6,6 +6,8 @@ import { detectProject } from "./detect.js";
|
|
|
6
6
|
import { loadMeta } from "./meta.js";
|
|
7
7
|
import { pendingUpdates } from "./update-transaction.js";
|
|
8
8
|
import { safePath, hashAt, baselineFromMeta } from "./managed-assets.js";
|
|
9
|
+
import { detectLegacy } from "./legacy-ctds.js";
|
|
10
|
+
import { loadTypeScript } from "./component-usage.js";
|
|
9
11
|
|
|
10
12
|
export function diagnose(root) {
|
|
11
13
|
const diagnostics = [];
|
|
@@ -23,7 +25,9 @@ export function diagnose(root) {
|
|
|
23
25
|
}
|
|
24
26
|
const componentPath=project.useSrcDir ? "src/components/ovenn" : "components/ovenn";
|
|
25
27
|
const meta=loadMeta(join(root,componentPath));
|
|
26
|
-
|
|
28
|
+
const legacy=project.ok ? detectLegacy(root,project) : null;
|
|
29
|
+
if(legacy) add("legacy-ctds","error",`A CTDS ${legacy.version} install is still present (${legacy.componentPath}).`,"ovenn update --dry, then ovenn update (migrates CTDS files, imports and config to Ovenn)",`${legacy.componentPath}/.ctds-meta.json`);
|
|
30
|
+
if (!meta?.files || typeof meta.files !== "object") { if (!legacy) add("metadata-missing","error","Installation metadata is missing or invalid.","Back up local files; run ovenn init --no-open, then review conflicts with ovenn update --dry.",`${componentPath}/.ovenn-meta.json`); }
|
|
27
31
|
else {
|
|
28
32
|
if(meta.version !== cli.version) add("version-mismatch","warning",`Installed ${meta.version}, CLI ${cli.version}.`,"ovenn update --dry",`${componentPath}/.ovenn-meta.json`);
|
|
29
33
|
for(const [path,hash] of Object.entries(baselineFromMeta(meta,componentPath))) {
|
|
@@ -31,6 +35,8 @@ export function diagnose(root) {
|
|
|
31
35
|
catch(error) { add("unsafe-metadata","error",error.message,"Repair the metadata path before updating.",path); }
|
|
32
36
|
}
|
|
33
37
|
}
|
|
38
|
+
// The local usage check parses with TypeScript's JS API, which TypeScript 7's own package no longer ships.
|
|
39
|
+
if(declared.typescript){ try { loadTypeScript(root); } catch(error) { add("typescript-api","warning",error.message,"npm install -D @typescript/typescript6","package.json"); } }
|
|
34
40
|
const configPath=join(root,"ovenn.config.json");
|
|
35
41
|
if(!existsSync(configPath)) add("config-missing","warning","No ovenn.config.json. Core defaults will be used.","Complete /ovenn onboarding or add a reviewed config.","ovenn.config.json");
|
|
36
42
|
else try {
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration of projects installed by the legacy `@conscience-technology/ctds` CLI (0.1.0–0.6.3).
|
|
3
|
+
*
|
|
4
|
+
* CTDS installed components/ctds, prompts/, public/onboarding/, .claude/skills/ctds*, app/ctds and a
|
|
5
|
+
* ctds marker block in AGENTS.md, and patched layout/globals to import from components/ctds. Its metadata
|
|
6
|
+
* only hashed components, so prompts and skills would otherwise look like local edits forever.
|
|
7
|
+
* src/data/ctds-releases.json lists every file each published release installed: a file whose hash
|
|
8
|
+
* matches it is untouched upstream content that may be replaced or removed. Anything else is a local edit.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
12
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { safePath, hashAt } from "./managed-assets.js";
|
|
15
|
+
import { renderOvennRoute } from "./route.js";
|
|
16
|
+
|
|
17
|
+
export const LEGACY_ROOTS = ["components/ctds", "prompts", "public/onboarding", ".claude/skills", "app/ctds"];
|
|
18
|
+
export const shortDigest = (content) => createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
19
|
+
|
|
20
|
+
const LEGACY_AGENTS = /<!-- ctds:start -->[\s\S]*?<!-- ctds:end -->\n*/;
|
|
21
|
+
// Quoted module specifiers ("@/components/ctds/Button", '../components/ctds/tokens.css').
|
|
22
|
+
const SPECIFIER = /(["'`])([^"'`\s]*?components\/)ctds((?:\/[^"'`\s]*)?)\1/g;
|
|
23
|
+
const SOURCE_EXT = /\.(?:[cm]?[jt]sx?|css|scss|sass|less|mdx)$/;
|
|
24
|
+
const SKIP_DIRS = new Set(["node_modules", ".git", ".next", ".ovenn", ".claude", ".cursor", ".turbo", ".vercel", "out", "dist", "build", "coverage", "prompts", "public"]);
|
|
25
|
+
|
|
26
|
+
let releases;
|
|
27
|
+
function knownHashes(key) {
|
|
28
|
+
releases ??= JSON.parse(readFileSync(new URL("../data/ctds-releases.json", import.meta.url), "utf8")).files;
|
|
29
|
+
return releases[key];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The CTDS install in this project, or null. */
|
|
33
|
+
export function detectLegacy(root, project) {
|
|
34
|
+
const componentPath = project.useSrcDir ? "src/components/ctds" : "components/ctds";
|
|
35
|
+
const metaPath = join(root, componentPath, ".ctds-meta.json");
|
|
36
|
+
if (!existsSync(metaPath)) return null;
|
|
37
|
+
let meta = {};
|
|
38
|
+
try { meta = JSON.parse(readFileSync(metaPath, "utf8")); } catch { /* A broken meta still marks a CTDS install; files then count as local edits. */ }
|
|
39
|
+
return { componentPath, appRoute: `${project.appDir}/ctds`, meta, version: typeof meta.version === "string" ? meta.version : "unknown" };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Removes the CTDS block that `ctds init` wrote into AGENTS.md. */
|
|
43
|
+
export const stripLegacyAgentsBlock = (text) => text.replace(LEGACY_AGENTS, "");
|
|
44
|
+
|
|
45
|
+
/** True when `path` holds exactly what a CTDS release installed there. */
|
|
46
|
+
function isPristine(root, legacy, path) {
|
|
47
|
+
const file = safePath(root, path);
|
|
48
|
+
if (!existsSync(file)) return false;
|
|
49
|
+
const content = readFileSync(file);
|
|
50
|
+
if (path.startsWith(`${legacy.componentPath}/`)) {
|
|
51
|
+
const recorded = legacy.meta.files?.[path.slice(legacy.componentPath.length + 1)];
|
|
52
|
+
if (recorded && recorded.replace(/^sha256:/, "") === createHash("sha256").update(content).digest("hex")) return true;
|
|
53
|
+
}
|
|
54
|
+
// The manifest is recorded from a root app/ layout; src/ layouts install the same files one level down.
|
|
55
|
+
const key = path.replace(/^src\/(components|app)\//, "$1/");
|
|
56
|
+
return knownHashes(key)?.includes(shortDigest(content)) ?? false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function walkFiles(root, relative, out = []) {
|
|
60
|
+
const absolute = join(root, relative);
|
|
61
|
+
if (!existsSync(absolute)) return out;
|
|
62
|
+
for (const entry of readdirSync(absolute, { withFileTypes: true })) {
|
|
63
|
+
const path = `${relative}/${entry.name}`;
|
|
64
|
+
if (entry.isSymbolicLink()) continue;
|
|
65
|
+
if (entry.isDirectory()) walkFiles(root, path, out); else out.push(path);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The project's own source files: everything outside vendor folders, docs, build output and dependencies. */
|
|
71
|
+
export function projectSources(root, relative = "", out = []) {
|
|
72
|
+
for (const entry of readdirSync(join(root, relative), { withFileTypes: true })) {
|
|
73
|
+
const path = relative ? `${relative}/${entry.name}` : entry.name;
|
|
74
|
+
if (entry.isSymbolicLink()) continue;
|
|
75
|
+
if (entry.isDirectory()) {
|
|
76
|
+
if (SKIP_DIRS.has(entry.name) || /(^|\/)components\/(ctds|ovenn)$/.test(path)) continue;
|
|
77
|
+
projectSources(root, path, out);
|
|
78
|
+
} else if (SOURCE_EXT.test(entry.name)) out.push(path);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** True when the new component tree provides `components/ovenn<tail>` (a file, a file without extension, or a folder). */
|
|
84
|
+
function resolvesInOvenn(sources, componentPath, tail) {
|
|
85
|
+
const target = `${componentPath}${tail}`;
|
|
86
|
+
for (const path of sources.keys()) {
|
|
87
|
+
if (path === target || path.startsWith(`${target}/`) || path.startsWith(`${target}.`)) return true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Plans the CTDS → Ovenn migration on top of the regular update.
|
|
94
|
+
* @returns {{legacy, baseline: Record<string,string>, removals: string[], moved: string[], rewrites: Map<string,string>, unresolved: {file:string, specifier:string}[]}}
|
|
95
|
+
*/
|
|
96
|
+
export function planLegacyMigration(root, project, sources, componentPath) {
|
|
97
|
+
const legacy = detectLegacy(root, project);
|
|
98
|
+
const empty = { legacy: null, baseline: {}, removals: [], moved: [], rewrites: new Map(), unresolved: [] };
|
|
99
|
+
if (!legacy) return empty;
|
|
100
|
+
const baseline = {}, removals = [], moved = [], rewrites = new Map(), unresolved = [];
|
|
101
|
+
|
|
102
|
+
// Files that Ovenn also ships at the same path (prompts, onboarding images): untouched CTDS copies are safe to overwrite.
|
|
103
|
+
for (const path of sources.keys()) {
|
|
104
|
+
if (path.startsWith("prompts/") || path.startsWith("public/onboarding/")) {
|
|
105
|
+
if (isPristine(root, legacy, path)) baseline[path] = hashAt(safePath(root, path));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Imports of the old component folder, in the project's own code.
|
|
110
|
+
const renameConfig = existsSync(join(root, "ctds.config.json")) && !existsSync(join(root, "ovenn.config.json"));
|
|
111
|
+
for (const file of projectSources(root)) {
|
|
112
|
+
const text = readFileSync(join(root, file), "utf8");
|
|
113
|
+
let next = text.replace(SPECIFIER, (match, quote, prefix, tail) => {
|
|
114
|
+
if (!resolvesInOvenn(sources, componentPath, tail)) { unresolved.push({ file, specifier: `${prefix}ctds${tail}` }); return match; }
|
|
115
|
+
return `${quote}${prefix}ovenn${tail}${quote}`;
|
|
116
|
+
});
|
|
117
|
+
if (renameConfig) next = next.replace(/ctds\.config\.json/g, "ovenn.config.json");
|
|
118
|
+
// globals.css may already carry the Ovenn import when `ovenn init` ran on a CTDS project.
|
|
119
|
+
if (/\.(?:css|scss|sass|less)$/.test(file)) next = dedupeImports(next);
|
|
120
|
+
if (next !== text) rewrites.set(file, next);
|
|
121
|
+
}
|
|
122
|
+
// Vendor code stays out of the project's lint, as on a fresh install (CTDS before 0.6.1 never wrote this file).
|
|
123
|
+
const eslint = join(root, ".eslintignore");
|
|
124
|
+
const eslintText = existsSync(eslint) ? readFileSync(eslint, "utf8") : "";
|
|
125
|
+
const lines = eslintText.split("\n").map((line) => line.replace(/^((?:src\/)?components\/)ctds(\/\*\*)$/, "$1ovenn$2"));
|
|
126
|
+
let eslintNext = lines.filter((line, index) => !line.trim() || lines.indexOf(line) === index).join("\n");
|
|
127
|
+
if (!/^components\/ovenn\/\*\*\s*$/m.test(eslintNext)) eslintNext = `${eslintNext}${eslintNext && !eslintNext.endsWith("\n") ? "\n" : ""}components/ovenn/**\n`;
|
|
128
|
+
if (eslintNext !== eslintText) rewrites.set(".eslintignore", eslintNext);
|
|
129
|
+
if (renameConfig) {
|
|
130
|
+
rewrites.set("ovenn.config.json", readFileSync(join(root, "ctds.config.json"), "utf8"));
|
|
131
|
+
removals.push("ctds.config.json");
|
|
132
|
+
const design = join(root, "DESIGN.md");
|
|
133
|
+
if (existsSync(design)) {
|
|
134
|
+
const text = readFileSync(design, "utf8"), next = text.replace(/ctds\.config\.json/g, "ovenn.config.json");
|
|
135
|
+
if (next !== text) rewrites.set("DESIGN.md", next);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// CTDS-only trees. Components stay while any import still needs them.
|
|
140
|
+
const owned = [
|
|
141
|
+
...(unresolved.length ? [] : walkFiles(root, legacy.componentPath).filter((path) => !path.endsWith("/.ctds-meta.json"))),
|
|
142
|
+
...walkFiles(root, legacy.appRoute),
|
|
143
|
+
...(existsSync(join(root, ".claude/skills")) ? readdirSync(join(root, ".claude/skills")).filter((name) => /^ctds(-|$)/.test(name)).flatMap((name) => walkFiles(root, `.claude/skills/${name}`)) : []),
|
|
144
|
+
];
|
|
145
|
+
// Edited CTDS files leave the source tree too: left in place they still compile against removed siblings
|
|
146
|
+
// and agents still load them. update moves them under .ovenn/kept/ so the edits remain available.
|
|
147
|
+
for (const path of owned) (isPristine(root, legacy, path) ? removals : moved).push(path);
|
|
148
|
+
// Old CTDS docs and images that Ovenn no longer ships.
|
|
149
|
+
for (const path of [...walkFiles(root, "prompts"), ...walkFiles(root, "public/onboarding")]) {
|
|
150
|
+
if (!sources.has(path) && isPristine(root, legacy, path)) removals.push(path);
|
|
151
|
+
}
|
|
152
|
+
const route = `${project.appDir}/ovenn/page.tsx`;
|
|
153
|
+
if (existsSync(join(root, legacy.appRoute)) && !existsSync(join(root, route))) rewrites.set(route, renderOvennRoute());
|
|
154
|
+
for (const path of [...removals, ...moved]) rewrites.delete(path);
|
|
155
|
+
const componentsLeft = walkFiles(root, legacy.componentPath).filter((path) => !path.endsWith("/.ctds-meta.json") && !removals.includes(path) && !moved.includes(path));
|
|
156
|
+
if (!componentsLeft.length) removals.push(`${legacy.componentPath}/.ctds-meta.json`);
|
|
157
|
+
return { legacy, baseline, removals, moved, rewrites, unresolved };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function dedupeImports(css) {
|
|
161
|
+
const seen = new Set();
|
|
162
|
+
return css.split("\n").filter((line) => {
|
|
163
|
+
const match = line.trim().match(/^@import\s+["']([^"']+)["']\s*;?$/);
|
|
164
|
+
if (!match) return true;
|
|
165
|
+
if (seen.has(match[1])) return false;
|
|
166
|
+
seen.add(match[1]); return true;
|
|
167
|
+
}).join("\n");
|
|
168
|
+
}
|
|
169
|
+
|
|
@@ -30,20 +30,33 @@ export function sourceFiles(roots) {
|
|
|
30
30
|
for (const [source, destination] of roots) walk(source, destination);
|
|
31
31
|
return files;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
// `merged` files are rebuilt from their current text, replacing only the Ovenn marker block and
|
|
34
|
+
// keeping everything outside it, so local notes there are never a conflict.
|
|
35
|
+
export function planManagedUpdate(root, sources, baseline = {}, {merged = new Set()} = {}) {
|
|
34
36
|
const plan = [];
|
|
35
37
|
for (const [path, content] of sources) {
|
|
36
38
|
const current = hashAt(safePath(root, path)); const upstream = digest(content);
|
|
37
|
-
const kind = current === upstream ? "unchanged" : current === null ? "add" : current === baseline[path] ? "safe" : "conflict";
|
|
39
|
+
const kind = current === upstream ? "unchanged" : current === null ? "add" : current === baseline[path] || merged.has(path) ? "safe" : "conflict";
|
|
38
40
|
plan.push({path, content, current, upstream, kind});
|
|
39
41
|
}
|
|
40
42
|
return plan;
|
|
41
43
|
}
|
|
44
|
+
/** Baseline files the new release no longer ships: "remove" when untouched, "orphan" when edited, "gone" when already deleted. */
|
|
45
|
+
export function planRemovals(root, sources, baseline = {}) {
|
|
46
|
+
const removals = [];
|
|
47
|
+
for (const [path, hash] of Object.entries(baseline)) {
|
|
48
|
+
if (sources.has(path)) continue;
|
|
49
|
+
const current = hashAt(safePath(root, path));
|
|
50
|
+
removals.push({path, current, kind: current === null ? "gone" : current === hash ? "remove" : "orphan"});
|
|
51
|
+
}
|
|
52
|
+
return removals;
|
|
53
|
+
}
|
|
42
54
|
export function baselineFromMeta(meta, componentPath) {
|
|
43
55
|
return {...(meta.assets ?? {}), ...Object.fromEntries(Object.entries(meta.files ?? {}).map(([path, hash]) => [`${componentPath}/${path}`, hash]))};
|
|
44
56
|
}
|
|
45
|
-
export function nextBaseline(plan, old, kept) {
|
|
57
|
+
export function nextBaseline(plan, old, kept, dropped = []) {
|
|
46
58
|
const result = {...old};
|
|
59
|
+
for (const path of dropped) delete result[path];
|
|
47
60
|
for (const item of plan) { if (!kept.has(item.path)) result[item.path] = item.upstream; }
|
|
48
61
|
return result;
|
|
49
62
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The /ovenn onboarding route that init creates and a CTDS migration recreates in place of /ctds. */
|
|
2
|
+
export function renderOvennRoute() {
|
|
3
|
+
// 사용자 플젝 alias 호환성 — 상대경로로 안전하게.
|
|
4
|
+
// app/ovenn/page.tsx → ../../components/ovenn/Onboarding (useSrcDir도 동일 레벨)
|
|
5
|
+
const importPath = "../../components/ovenn/Onboarding";
|
|
6
|
+
return `/**
|
|
7
|
+
* Ovenn onboarding route.
|
|
8
|
+
* Generated by \`npx ovenn init\`. Edit freely — subsequent \`ovenn init\`
|
|
9
|
+
* runs will not overwrite this file unless you pass --force.
|
|
10
|
+
*/
|
|
11
|
+
import { OnboardingPage } from "${importPath}";
|
|
12
|
+
|
|
13
|
+
export default function Page() {
|
|
14
|
+
return <OnboardingPage />;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules and workflow text sized to the task: the components in a componentPlan, and the current phase.
|
|
3
|
+
* Shared by MCP get_rules/get_design_workflow and the CLI's --local equivalents, so both return the same text.
|
|
4
|
+
* Without arguments the callers keep returning the full documents.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Markdown split at ## and ### headings; text before the first heading is `intro`. */
|
|
8
|
+
export function sections(markdown) {
|
|
9
|
+
const lines = markdown.split("\n"), out = [], intro = [];
|
|
10
|
+
let current = null;
|
|
11
|
+
for (const line of lines) {
|
|
12
|
+
const heading = line.match(/^(#{2,3})\s+(.+?)\s*$/);
|
|
13
|
+
if (heading) { current = { level: heading[1].length, heading: heading[2], lines: [line] }; out.push(current); }
|
|
14
|
+
else (current ? current.lines : intro).push(line);
|
|
15
|
+
}
|
|
16
|
+
return { intro: intro.join("\n").trim(), sections: out.map((s) => ({ level: s.level, heading: s.heading, text: s.lines.join("\n").trim() })) };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Sections whose heading contains one of `wanted`, plus the subsections under a picked parent. */
|
|
20
|
+
export function pickSections(markdown, wanted) {
|
|
21
|
+
const { intro, sections: all } = sections(markdown);
|
|
22
|
+
const picked = [];
|
|
23
|
+
let parentLevel = null;
|
|
24
|
+
for (const s of all) {
|
|
25
|
+
if (parentLevel !== null && s.level > parentLevel) { picked.push(s.text); continue; }
|
|
26
|
+
parentLevel = null;
|
|
27
|
+
if (wanted.some((w) => s.heading.includes(w))) { picked.push(s.text); parentLevel = s.level; }
|
|
28
|
+
}
|
|
29
|
+
return [intro, ...picked].filter(Boolean).join("\n\n");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const WORKFLOW_PHASES = {
|
|
33
|
+
plan: {
|
|
34
|
+
assembly: ["1. 역할", "2. 레퍼런스", "3. 부품", "조립 전 확인", "기존 UI 전환", "실행 주체"],
|
|
35
|
+
review: ["원칙", "미적 완성도", "명시적 디자인 금지", "Do", "Don't"],
|
|
36
|
+
},
|
|
37
|
+
build: {
|
|
38
|
+
assembly: ["조립 전 확인", "기존 UI 전환", "4. 조립", "5. 규칙 검사"],
|
|
39
|
+
review: ["원칙", "명시적 디자인 금지", "Do", "Don't", "Fallback"],
|
|
40
|
+
},
|
|
41
|
+
review: {
|
|
42
|
+
assembly: ["6. 눈으로", "실행 기록", "실행 주체"],
|
|
43
|
+
review: null, // the reviewer needs every criterion
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** ASSEMBLY / WORKFLOW_DESIGN cut to a phase. `phase` undefined keeps both documents whole. */
|
|
48
|
+
export function phaseSources(assembly, review, phase) {
|
|
49
|
+
if (!phase) return { assembly, review };
|
|
50
|
+
const map = WORKFLOW_PHASES[phase];
|
|
51
|
+
if (!map) throw new Error(`Unknown phase: ${phase} (plan, build or review)`);
|
|
52
|
+
return { assembly: pickSections(assembly, map.assembly), review: map.review ? pickSections(review, map.review) : review };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** "ButtonGroup" · "Button Group" · "button-group" → "button-group" (same mapping as get_component). */
|
|
56
|
+
export function componentSlug(name) {
|
|
57
|
+
const slug = String(name).trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\s+/g, "-").toLowerCase();
|
|
58
|
+
return slug === "button-group" || slug === "buttongroup" ? "control-group" : slug;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Sections that carry a component's contract: principle, behaviour and input handling, accessibility, and the Don'ts.
|
|
62
|
+
const RULE_SECTIONS = /^(?:원칙|행동|인터랙션|접근성|키보드|Don'?t)(?=$|[\s:(])/i;
|
|
63
|
+
|
|
64
|
+
/** A component document reduced to its rules: contract sections plus every [HARD] line outside them. */
|
|
65
|
+
export function componentRules(markdown) {
|
|
66
|
+
const { sections: all } = sections(markdown);
|
|
67
|
+
const dont = all.filter((s) => RULE_SECTIONS.test(s.heading)).map((s) => s.text);
|
|
68
|
+
const inDont = new Set(dont.join("\n").split("\n").map((l) => l.trim()));
|
|
69
|
+
const hard = markdown.split("\n").map((l) => l.trim()).filter((l) => /\[HARD\]/.test(l) && !inDont.has(l));
|
|
70
|
+
return [...dont, ...(hard.length ? [`### [HARD] (그 밖의 절)\n${hard.join("\n")}`] : [])].join("\n\n").trim();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* RULES plus the rules of the listed components; PRINCIPLES only when asked (or when no component is listed).
|
|
75
|
+
* @param {{rules: string, principles: string, components?: string[], withPrinciples?: boolean, readComponent: (slug: string) => string|null}} input
|
|
76
|
+
*/
|
|
77
|
+
export function rulesContext({ rules, principles, components = [], withPrinciples, readComponent }) {
|
|
78
|
+
if (!components.length) return `${rules}\n\n---\n\n${principles}`;
|
|
79
|
+
const parts = [rules, "---", "## 부품 규칙 (componentPlan의 부품만)"];
|
|
80
|
+
const missing = [];
|
|
81
|
+
for (const name of [...new Set(components)]) {
|
|
82
|
+
const doc = readComponent(componentSlug(name));
|
|
83
|
+
if (!doc) { missing.push(name); continue; }
|
|
84
|
+
const body = componentRules(doc);
|
|
85
|
+
parts.push(`### ${name}\n${body ? body.replace(/^###/gm, "####") : "(이 부품 문서에는 Don't·[HARD]가 없다. RULES만 적용한다.)"}`);
|
|
86
|
+
}
|
|
87
|
+
if (missing.length) parts.push(`문서가 없는 이름: ${missing.join(", ")}. 카탈로그(find_components 또는 prompts/CATALOG.md)에서 실제 부품 이름을 확인한다.`);
|
|
88
|
+
parts.push("API·Props·예시는 get_component(또는 prompts/components/<slug>.md)로, 변형·안전 정책 전문은 principles를 켜서 받는다.");
|
|
89
|
+
if (withPrinciples) parts.push("---", principles);
|
|
90
|
+
return parts.join("\n\n");
|
|
91
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, rmSync, readdirSync, openSync, closeSync, lstatSync, chmodSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, rmSync, rmdirSync, readdirSync, openSync, closeSync, lstatSync, chmodSync } from "node:fs";
|
|
2
2
|
import { join, dirname } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { safePath, hashAt, digest } from "./managed-assets.js";
|
|
@@ -59,14 +59,16 @@ export function applyUpdate(root, changes, {beforeWrite} = {}) {
|
|
|
59
59
|
if (before !== item.current) throw new Error(`File changed since planning: ${item.path}`);
|
|
60
60
|
const backup = `backups/${index}`;
|
|
61
61
|
if (before !== null) atomic(safePath(root, `.ovenn/updates/${id}/${backup}`), readFileSync(target));
|
|
62
|
-
|
|
62
|
+
// content === null removes the file; its backup restores it on rollback.
|
|
63
|
+
journal.files.push({path: item.path, before, after: item.content === null ? null : digest(item.content), backup, mode: before === null ? 0o644 : lstatSync(target).mode & 0o777});
|
|
63
64
|
}
|
|
64
65
|
atomic(path, JSON.stringify(journal, null, 2));
|
|
65
66
|
for (const [index, item] of changes.entries()) {
|
|
66
67
|
beforeWrite?.(index, id);
|
|
67
68
|
// Catch edits that occur while conflict choices or staging were in progress.
|
|
68
69
|
if (hashAt(safePath(root, item.path)) !== item.current) throw new Error(`Concurrent edit: ${item.path}`);
|
|
69
|
-
|
|
70
|
+
if (item.content === null) rmSync(safePath(root, item.path), {force: true});
|
|
71
|
+
else atomic(safePath(root, item.path), item.content, journal.files[index].mode);
|
|
70
72
|
}
|
|
71
73
|
atomic(path, JSON.stringify({...journal, status: "applied"}, null, 2));
|
|
72
74
|
return id;
|
|
@@ -77,3 +79,14 @@ export function applyUpdate(root, changes, {beforeWrite} = {}) {
|
|
|
77
79
|
throw error;
|
|
78
80
|
} finally { release(); }
|
|
79
81
|
}
|
|
82
|
+
/** Removes folders left empty by removed files, walking up from each file but never past the project root. */
|
|
83
|
+
export function pruneEmptyDirs(root, paths) {
|
|
84
|
+
for (const path of paths) {
|
|
85
|
+
const parts = path.split("/").slice(0, -1);
|
|
86
|
+
while (parts.length) {
|
|
87
|
+
const folder = safePath(root, parts.join("/"));
|
|
88
|
+
if (!existsSync(folder) || readdirSync(folder).length) break;
|
|
89
|
+
rmdirSync(folder); parts.pop();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# 사용자 피드백에서 WORKFLOW_DESIGN 규칙 개선까지
|
|
2
|
-
|
|
3
|
-
사용자 피드백으로 Ovenn 디자인 규칙을 개선하는 메타 프로세스. agent가 매 요청마다 실행할 지침이 아니라, `continue` 모드에서 피드백 원인 분석 계약과 사용자가 WORKFLOW_DESIGN을 유지관리할 때의 작업 순서를 담는다. 정책 원본은 [[WORKFLOW_DESIGN]]이다.
|
|
4
|
-
|
|
5
|
-
## 시각 교정 사례와 소비자 전달
|
|
6
|
-
|
|
7
|
-
규칙 준수와 미적 완성도는 별도로 판단한다. 규칙 위반 없음은 미감 합격이 아니며, 미감 채택도 위반을 면제하지 않는다. 사람 평가는 AI 독립 검수와 구분하고 해당 회차의 실제 소스·캡처, 평가 당시의 규칙 정의·원본 해시에 연결한다. 기준이 바뀌면 과거 판정과 현재 평가를 구분한다. 기준 사례에는 같은 업무의 전후 전체 화면과 필요한 부분 확대, 적용 문맥, 수정 전 관측, 바꾼 점, 좋아진 이유, 원본 부품과 변형 내용을 보존한다. 사례를 저장한 뒤의 사람 평가는 동일 소스·캡처일 때만 별도 이력으로 연결하며 저장 당시 근거를 덮어쓰지 않는다. 미확인은 합격으로 취급하지 않는다.
|
|
8
|
-
|
|
9
|
-
평가 기록 저장은 모델 학습이나 소비자 배포가 아니다. 수정 후 규칙 검사와 미감 판단을 완료한 사례에서 사람이 적용 판단과 범위를 작성하고 이 원본의 실험 초안으로 만든다. 한 화면의 값을 모든 화면의 정답으로 만들지 않는다. 초안으로 원래 과제를 재실험하고 독립 검수를 마친 뒤 문서 전후와 실제 화면을 검토해 채택한다. 기준을 만드는 데 쓰지 않은 새 요청과 모델별 결과도 별도로 평가한다. 평가 수는 회차·서로 다른 과제·모델을 구분하며 적은 사례의 개선을 전체 품질 보증으로 표현하지 않는다.
|
|
10
|
-
|
|
11
|
-
채택된 판단은 이 원본에서 관리하고 기존 get_design_workflow/get_guide 및 CLI의 설치된 prompts/WORKFLOW_DESIGN.md로 전달한다. 실제 서비스 배포 또는 CLI 패키지 배포와 설치 업데이트가 있어야 소비자에게 적용된다. 소비자가 텍스트로 요청해도 에이전트가 이 지침을 읽는 기존 절차를 따른다. 로컬 사례 이미지·소스를 자동 배포하거나 사용자가 매번 레퍼런스를 제공해야 하는 계약을 만들지 않는다. 시각 입력을 받지 못하는 환경에서 이미지까지 전달됐다고 주장하지 않는다.
|
|
12
|
-
|
|
13
|
-
후속 수정은 화면을 고치는 것과 원인을 찾는 것을 함께 수행한다. 이전 입력에 제공된 문서, 실제 도구 호출에 등장한 문서, 생성자의 선택 설명을 구분해 확인한다. 관련 컴포넌트 문서·실제 코드와 spacing/typography/PRINCIPLES를 다시 검토하고, 실제로 문제에 관계없는 문서까지 억지로 고치지 않는다.
|
|
14
|
-
|
|
15
|
-
원인은 implementation_error(기존 규칙 미준수), missing_rule(규칙 부족), incorrect_rule(규칙 오류), uncertain(근거 부족)으로 구분한다. 구현 미준수는 구현을 바로잡고 문서를 더 엄격하게 만드는 것으로 대신하지 않는다. 규칙의 부족·오류는 해당 조항·화면 관측·영향을 연결해 설명한다. 한 화면의 취향을 모든 화면의 금지 규칙으로 일반화하지 않는다. 사용자 피드백과 현재 원칙이 충돌하면 적용 범위를 밝히고 원본의 미감 정책을 조용히 뒤집지 않는다.
|
|
16
|
-
|
|
17
|
-
실험용 사본에서 화면을 수정하고, 근거 있는 문서 수정안만 함께 작성한다. 소비자 프로젝트의 원본은 바로 바꾸지 않는다. .ovenn/feedback.json에는 summary, issues 배열을 남기며 각 항목은 feedback, classification, observation, cause, documents([{path,reason}]), verification을 가진다. summary·feedback·observation·cause·verification·문서 reason은 짧은 문자열로 작성하고 문서 경로는 prompts/ 기준으로 명시한다. 구조화된 보조 검증 기록은 문자열 요약과 구분해 보존한다. 원인·적용 판단은 모델의 설명이며 관측 사실과 구분한다. 불확실하면 uncertain으로 남기고 문서 수정을 강제하지 않는다.
|
|
18
|
-
|
|
19
|
-
수정 전후 문서와 입력 hash를 보존하고, 문서 초안으로 원래 과제를 다시 실험해 화면·기능·기존 계약에 미치는 영향을 검토한다. 재실험의 실행·독립 검수 완료는 미적 우수성의 보증이 아니다. 근거·전후·재실험 결과를 사람이 검토해 채택한 변경만 원본에 반영한다.
|