@devbie/fewbie-cli 1.6.3 → 1.7.0

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.
Files changed (40) hide show
  1. package/README.md +8 -13
  2. package/dist/commands/apits-templates.d.ts +1 -1
  3. package/dist/commands/apits-templates.js +1 -1
  4. package/dist/commands/apits-templates.js.map +1 -1
  5. package/dist/commands/apits.js +2 -1
  6. package/dist/commands/apits.js.map +1 -1
  7. package/dist/commands/doctor.js +56 -1
  8. package/dist/commands/doctor.js.map +1 -1
  9. package/dist/commands/modules/add.js +2 -1
  10. package/dist/commands/modules/add.js.map +1 -1
  11. package/dist/commands/modules/apply.js +4 -3
  12. package/dist/commands/modules/apply.js.map +1 -1
  13. package/dist/commands/modules/default.js +2 -1
  14. package/dist/commands/modules/default.js.map +1 -1
  15. package/dist/commands/modules/remove.js +2 -1
  16. package/dist/commands/modules/remove.js.map +1 -1
  17. package/dist/commands/modules/update.js +3 -2
  18. package/dist/commands/modules/update.js.map +1 -1
  19. package/dist/commands/status.js +2 -1
  20. package/dist/commands/status.js.map +1 -1
  21. package/dist/commands/template/update.js +100 -11
  22. package/dist/commands/template/update.js.map +1 -1
  23. package/dist/lib/modules-file.d.ts +5 -0
  24. package/dist/lib/modules-file.js +31 -3
  25. package/dist/lib/modules-file.js.map +1 -1
  26. package/dist/lib/template-ownership.d.ts +23 -2
  27. package/dist/lib/template-ownership.js +156 -12
  28. package/dist/lib/template-ownership.js.map +1 -1
  29. package/dist/registry/auth/item.json +2 -5
  30. package/dist/registry/source.d.ts +2 -0
  31. package/dist/registry/source.js +94 -0
  32. package/dist/registry/source.js.map +1 -0
  33. package/dist/registry/store.d.ts +0 -1
  34. package/dist/registry/store.js +0 -33
  35. package/dist/registry/store.js.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/registry/api-client/item.json +0 -18
  38. package/dist/registry/app-shell/item.json +0 -20
  39. package/dist/registry/chart/item.json +0 -43
  40. package/dist/registry/page-header/item.json +0 -14
@@ -9,6 +9,7 @@ const promises_1 = __importDefault(require("node:fs/promises"));
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
10
  const colorette_1 = require("colorette");
11
11
  const store_1 = require("../../registry/store");
12
+ const source_1 = require("../../registry/source");
12
13
  const cli_kit_1 = require("@devbie/cli-kit");
13
14
  const template_ownership_1 = require("../../lib/template-ownership");
14
15
  const npm_spec_1 = require("../../lib/npm-spec");
@@ -29,8 +30,8 @@ function filterAssets(paths) {
29
30
  }
30
31
  return selected;
31
32
  }
32
- async function collectRegistryTargets() {
33
- const registryRoot = await (0, store_1.resolveRegistryRoot)();
33
+ async function collectRegistryTargets(projectRoot) {
34
+ const registryRoot = await (0, source_1.resolveRegistryRoot)(projectRoot);
34
35
  const names = await (0, store_1.listRegistryItemNames)(registryRoot);
35
36
  const targets = new Set();
36
37
  for (const name of names) {
@@ -77,6 +78,66 @@ async function assertTemplateRegistryComplete(templateRoot) {
77
78
  throw new cli_kit_1.CliError(`Template file(s) missing from the ownership registry (ADR-025):\n - ${unclassified.join("\n - ")}\n` +
78
79
  "Classify each one in TEMPLATE_ASSETS (packages/fewbie-cli/src/lib/template-ownership.ts).");
79
80
  }
81
+ function expandGlobAssets(assets, templateFiles) {
82
+ const expanded = [];
83
+ for (const asset of assets) {
84
+ if (!asset.path.endsWith("/**")) {
85
+ expanded.push(asset);
86
+ continue;
87
+ }
88
+ for (const filePath of templateFiles) {
89
+ if ((0, template_ownership_1.assetCoversPath)(asset, filePath))
90
+ expanded.push({ ...asset, path: filePath });
91
+ }
92
+ }
93
+ return expanded;
94
+ }
95
+ function assertTemplateOwnershipUnambiguous() {
96
+ const ambiguous = (0, template_ownership_1.findAmbiguousTemplatePaths)();
97
+ if (ambiguous.length === 0)
98
+ return;
99
+ throw new cli_kit_1.CliError(`Template ownership registry is ambiguous (ADR-056):\n - ${ambiguous
100
+ .map((entry) => `${entry.path} (${entry.ownerships.join(", ")})`)
101
+ .join("\n - ")}\n` +
102
+ "Longest-prefix resolution cannot decide between them. " +
103
+ "Fix TEMPLATE_ASSETS in packages/fewbie-cli/src/lib/template-ownership.ts.");
104
+ }
105
+ async function readProjectBaseline(projectRoot) {
106
+ const raw = await (0, cli_kit_1.readTextIfExists)(node_path_1.default.join(projectRoot, template_ownership_1.FRAMEWORK_MANIFEST_PATH));
107
+ if (raw === null)
108
+ return undefined;
109
+ const manifest = (0, template_ownership_1.parseFrameworkManifest)(raw);
110
+ if (manifest === null) {
111
+ throw new cli_kit_1.CliError(`${template_ownership_1.FRAMEWORK_MANIFEST_PATH} is malformed or was edited outside the CLI (its digest does not match). ` +
112
+ "Restore the template copy, or delete it to re-adopt the framework files and lose the ability to " +
113
+ "detect host edits.");
114
+ }
115
+ return manifest.files;
116
+ }
117
+ async function syncTemplateBaseline(templateRoot, check) {
118
+ const files = new Map();
119
+ for (const filePath of await listTemplateFiles(templateRoot)) {
120
+ if ((0, template_ownership_1.resolveTemplateAsset)(filePath)?.ownership !== "framework")
121
+ continue;
122
+ files.set(filePath, await (0, cli_kit_1.readTextIfExists)(node_path_1.default.join(templateRoot, filePath)));
123
+ }
124
+ const manifest = (0, template_ownership_1.buildFrameworkManifest)(files);
125
+ const count = Object.keys(manifest.files).length;
126
+ const desired = (0, template_ownership_1.serializeFrameworkManifest)(manifest);
127
+ const target = node_path_1.default.join(templateRoot, template_ownership_1.FRAMEWORK_MANIFEST_PATH);
128
+ const current = await (0, cli_kit_1.readTextIfExists)(target);
129
+ if (current === desired) {
130
+ console.info((0, colorette_1.green)(`✓ Framework baseline covers ${count} file(s)`));
131
+ return;
132
+ }
133
+ if (check) {
134
+ throw new cli_kit_1.CliError(`${template_ownership_1.FRAMEWORK_MANIFEST_PATH} is stale (${count} framework file(s) in the template). ` +
135
+ "Regenerate it with `fewbie template update --template-path .` and commit the result.");
136
+ }
137
+ await promises_1.default.mkdir(node_path_1.default.dirname(target), { recursive: true });
138
+ await promises_1.default.writeFile(target, desired);
139
+ console.info((0, colorette_1.green)(`✓ Regenerated ${template_ownership_1.FRAMEWORK_MANIFEST_PATH} for ${count} framework file(s).`));
140
+ }
80
141
  function printChange(change) {
81
142
  if (change.kind === "missing-markers") {
82
143
  const markers = (0, template_ownership_1.assetMarkers)(change.asset);
@@ -92,6 +153,18 @@ function printChange(change) {
92
153
  process.stdout.write(change.templateComparable);
93
154
  return;
94
155
  }
156
+ if (change.kind === "modified-framework") {
157
+ const baseline = change.baselineHash ? change.baselineHash.slice(0, 12) : "none recorded";
158
+ const label = change.asset.path;
159
+ console.warn((0, colorette_1.yellow)(`! ${label}: modified-framework conflict — the host copy diverged from the framework baseline ` +
160
+ `(${baseline}). Template update never overwrites it, and there is no --force.`));
161
+ console.warn((0, colorette_1.yellow)(" Resolve it by porting the host change into fewbie-starter (then regenerate the baseline with " +
162
+ "`fewbie template update --template-path .`) or by restoring the framework copy by hand, then re-run."));
163
+ if (change.templateComparable !== null) {
164
+ process.stdout.write((0, diff_1.unifiedDiff)(change.currentComparable ?? "", change.templateComparable, `a/${label}`, `b/${label}`));
165
+ }
166
+ return;
167
+ }
95
168
  const label = change.asset.path;
96
169
  const kindLabel = change.kind === "create" ? "missing in project" : "differs from template";
97
170
  console.info((0, colorette_1.bold)(`\n# ${label} (${kindLabel})`));
@@ -100,6 +173,7 @@ function printChange(change) {
100
173
  }
101
174
  async function runTemplateUpdate(options) {
102
175
  const projectRoot = node_path_1.default.resolve(options.cwd);
176
+ assertTemplateOwnershipUnambiguous();
103
177
  const assets = filterAssets(options.paths);
104
178
  const scope = options.paths && options.paths.length > 0 ? options.paths.join(", ") : null;
105
179
  const template = await (0, create_1.resolveTemplate)({
@@ -113,8 +187,8 @@ async function runTemplateUpdate(options) {
113
187
  console.info((0, colorette_1.cyan)(`Scope: ${scope} (${assets.length} template files)`));
114
188
  if (options.registryComplete)
115
189
  await assertTemplateRegistryComplete(template.root);
116
- const registryTargets = await collectRegistryTargets();
117
- const overlap = assets.filter((asset) => registryTargets.has(asset.path));
190
+ const registryTargets = await collectRegistryTargets(projectRoot);
191
+ const overlap = assets.filter((asset) => [...registryTargets].some((target) => (0, template_ownership_1.assetCoversPath)(asset, (0, template_ownership_1.normalizeAssetPath)(target))));
118
192
  if (overlap.length > 0) {
119
193
  throw new cli_kit_1.CliError(`Template update and the registry both own: ${overlap.map((asset) => asset.path).join(", ")}. ` +
120
194
  "Reclassify them in ADR-025 before updating.");
@@ -123,9 +197,12 @@ async function runTemplateUpdate(options) {
123
197
  if (options.registryComplete) {
124
198
  console.info((0, colorette_1.green)((0, colorette_1.bold)("✓ Ownership registry covers every template file")));
125
199
  }
200
+ await syncTemplateBaseline(template.root, Boolean(options.check));
126
201
  console.warn((0, colorette_1.yellow)("Template source is the project root itself, so content drift cannot be detected by comparing a tree " +
127
202
  "with itself. This run only enforced " +
128
- (options.registryComplete ? "the ownership registry and overlap guards" : "the ownership-overlap guard") +
203
+ (options.registryComplete
204
+ ? "the ownership registry, baseline and overlap guards"
205
+ : "the ownership-overlap and baseline guards") +
129
206
  "; drift gates belong in consuming projects (`fewbie template update --check`)."));
130
207
  return;
131
208
  }
@@ -138,19 +215,27 @@ async function runTemplateUpdate(options) {
138
215
  }
139
216
  console.warn((0, colorette_1.yellow)(`! Framework dependencies missing from package.json:\n - ${detail.join("\n - ")}\n Run \`${install}\`.`));
140
217
  }
218
+ const templateFileList = await listTemplateFiles(template.root);
219
+ const syncAssets = expandGlobAssets(assets, templateFileList);
141
220
  const projectFiles = new Map();
142
221
  const templateFiles = new Map();
143
- for (const asset of assets) {
222
+ for (const asset of syncAssets) {
144
223
  projectFiles.set(asset.path, await (0, cli_kit_1.readTextIfExists)(node_path_1.default.join(projectRoot, asset.path)));
145
224
  templateFiles.set(asset.path, await (0, cli_kit_1.readTextIfExists)(node_path_1.default.join(template.root, asset.path)));
146
225
  }
226
+ const baseline = await readProjectBaseline(projectRoot);
147
227
  let changes;
148
228
  try {
149
- changes = (0, template_ownership_1.planTemplateUpdate)(projectFiles, templateFiles, assets);
229
+ changes = (0, template_ownership_1.planTemplateUpdate)(projectFiles, templateFiles, syncAssets, baseline);
150
230
  }
151
231
  catch (error) {
152
232
  throw new cli_kit_1.CliError(error.message);
153
233
  }
234
+ if (baseline === undefined &&
235
+ changes.some((change) => change.asset.ownership === "framework" && change.kind !== "modified-framework")) {
236
+ console.warn((0, colorette_1.yellow)(`! No ${template_ownership_1.FRAMEWORK_MANIFEST_PATH} in this project: host edits of framework files cannot be detected on ` +
237
+ "this run. Review the diff before committing; the manifest shipped by this update protects later runs."));
238
+ }
154
239
  if (changes.length === 0) {
155
240
  const suffix = scope ? ` (scope: ${scope})` : "";
156
241
  console.info((0, colorette_1.green)((0, colorette_1.bold)(`✓ Project template files are up to date with the template${suffix}.`)));
@@ -163,8 +248,11 @@ async function runTemplateUpdate(options) {
163
248
  actionable.map((change) => `${change.asset.path} (${change.kind})`).join(", "));
164
249
  if (options.check) {
165
250
  const command = scope ? `fewbie template update ${scope}` : "fewbie template update";
166
- throw new cli_kit_1.CliError(`${changes.length} template file(s) drift from the template (${actionable.length} auto-fixable). ` +
167
- `Run \`${command}\` to apply the template version.`);
251
+ const conflicts = changes.filter((change) => change.kind === "modified-framework").length;
252
+ const resolution = conflicts > 0
253
+ ? `${conflicts} modified-framework conflict(s) must be resolved by hand (no --force).`
254
+ : `Run \`${command}\` to apply the template version.`;
255
+ throw new cli_kit_1.CliError(`${changes.length} template file(s) drift from the template (${actionable.length} auto-fixable). ` + resolution);
168
256
  }
169
257
  if (options.dryRun) {
170
258
  console.info("[dry-run] no files were modified");
@@ -178,8 +266,9 @@ async function runTemplateUpdate(options) {
178
266
  await promises_1.default.writeFile(target, change.nextContent);
179
267
  }
180
268
  const skipped = changes.length - actionable.length;
181
- if (skipped > 0)
182
- console.warn((0, colorette_1.yellow)(`\n${skipped} file(s) left untouched (missing markers or host adoption).`));
269
+ if (skipped > 0) {
270
+ console.warn((0, colorette_1.yellow)(`\n${skipped} file(s) left untouched (conflicts, missing markers or host adoption).`));
271
+ }
183
272
  console.info((0, colorette_1.green)((0, colorette_1.bold)("\n✓ Template files updated.")));
184
273
  console.info("Review with `git diff`, then commit on a branch and open a PR.");
185
274
  }
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/template/update.ts"],"names":[],"mappings":";;;;;AAgFA,8CAqBC;AAkDD,8CAoHC;AA3QD,gEAAkC;AAClC,0DAA6B;AAC7B,yCAAsD;AAEtD,gDAA4F;AAC5F,6CAA6D;AAC7D,qEASsC;AACtC,iDAAqD;AACrD,yCAA6C;AAC7C,sCAA4C;AAqB5C,SAAS,iBAAiB,CAAC,QAAgB,EAAE,MAAc;IACzD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,UAAU,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,YAAY,CAAC,KAA2B;IAC/C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,oCAAe,CAAC;IACzD,MAAM,QAAQ,GAAG,oCAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,kBAAQ,CAAC,8DAA8D,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAMD,KAAK,UAAU,sBAAsB;IACnC,MAA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AC,MAAM,8CAA8C,UAAU,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAChH,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;YAChC,IAAI,MAAM,CAAC,WAAW,KAAK,IAAI;gBAAE,SAAS;YAC1C,MAAM,MAAM,GAAG,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzD,MAAM,kBAAE,CAAC,KAAK,CAAC,mBAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,MAAM,kBAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QACnD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,IAAA,kBAAM,EAAC,KAAK,OAAO,wEAAwE,CAAC,CAAC,CAAC;QAC7G,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,IAAA,gBAAI,EAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IACjF,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -1,5 +1,10 @@
1
1
  export declare const MODULES_FILE = "fewbie.json";
2
+ export interface RegistryDeclaration {
3
+ url: string;
4
+ ref?: string;
5
+ }
2
6
  export declare function readModulesFile(projectRoot: string): Promise<string[] | null>;
7
+ export declare function readRegistryDeclaration(projectRoot: string): Promise<RegistryDeclaration | null>;
3
8
  export declare function requireModulesFile(projectRoot: string): Promise<string[]>;
4
9
  export declare function modulesFileContent(names: string[]): string;
5
10
  export declare function writeModulesFile(projectRoot: string, names: string[]): Promise<void>;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.MODULES_FILE = void 0;
7
7
  exports.readModulesFile = readModulesFile;
8
+ exports.readRegistryDeclaration = readRegistryDeclaration;
8
9
  exports.requireModulesFile = requireModulesFile;
9
10
  exports.modulesFileContent = modulesFileContent;
10
11
  exports.writeModulesFile = writeModulesFile;
@@ -12,7 +13,7 @@ const promises_1 = __importDefault(require("node:fs/promises"));
12
13
  const node_path_1 = __importDefault(require("node:path"));
13
14
  const cli_kit_1 = require("@devbie/cli-kit");
14
15
  exports.MODULES_FILE = "fewbie.json";
15
- async function readModulesFile(projectRoot) {
16
+ async function readDeclarationDocument(projectRoot) {
16
17
  const target = node_path_1.default.join(projectRoot, exports.MODULES_FILE);
17
18
  let raw;
18
19
  try {
@@ -30,12 +31,38 @@ async function readModulesFile(projectRoot) {
30
31
  catch (error) {
31
32
  throw new cli_kit_1.CliError(`Invalid JSON in ${exports.MODULES_FILE}: ${error.message}`);
32
33
  }
33
- const names = parsed.modules;
34
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
35
+ throw new cli_kit_1.CliError(`${exports.MODULES_FILE} must be a JSON object.`);
36
+ }
37
+ return parsed;
38
+ }
39
+ async function readModulesFile(projectRoot) {
40
+ const document = await readDeclarationDocument(projectRoot);
41
+ if (document === null)
42
+ return null;
43
+ const names = document.modules;
34
44
  if (!Array.isArray(names) || names.some((name) => typeof name !== "string")) {
35
45
  throw new cli_kit_1.CliError(`${exports.MODULES_FILE} must be an object of the form { "modules": ["name", ...] }.`);
36
46
  }
37
47
  return normalizeNames(names);
38
48
  }
49
+ async function readRegistryDeclaration(projectRoot) {
50
+ const document = await readDeclarationDocument(projectRoot);
51
+ const registry = document?.registry;
52
+ if (registry === undefined)
53
+ return null;
54
+ if (registry === null || typeof registry !== "object" || Array.isArray(registry)) {
55
+ throw new cli_kit_1.CliError(`${exports.MODULES_FILE}: "registry" must be an object with a "url" string.`);
56
+ }
57
+ const { url, ref } = registry;
58
+ if (typeof url !== "string" || url.trim() === "") {
59
+ throw new cli_kit_1.CliError(`${exports.MODULES_FILE}: "registry.url" must be a non-empty string.`);
60
+ }
61
+ if (ref !== undefined && (typeof ref !== "string" || ref.trim() === "")) {
62
+ throw new cli_kit_1.CliError(`${exports.MODULES_FILE}: "registry.ref" must be a non-empty string when set.`);
63
+ }
64
+ return ref === undefined ? { url } : { url, ref };
65
+ }
39
66
  async function requireModulesFile(projectRoot) {
40
67
  const declared = await readModulesFile(projectRoot);
41
68
  if (declared === null) {
@@ -47,7 +74,8 @@ function modulesFileContent(names) {
47
74
  return `${JSON.stringify({ modules: normalizeNames(names) }, null, 2)}\n`;
48
75
  }
49
76
  async function writeModulesFile(projectRoot, names) {
50
- await promises_1.default.writeFile(node_path_1.default.join(projectRoot, exports.MODULES_FILE), modulesFileContent(names));
77
+ const document = { ...((await readDeclarationDocument(projectRoot)) ?? {}), modules: normalizeNames(names) };
78
+ await promises_1.default.writeFile(node_path_1.default.join(projectRoot, exports.MODULES_FILE), `${JSON.stringify(document, null, 2)}\n`);
51
79
  }
52
80
  function normalizeNames(names) {
53
81
  return [...new Set(names)].sort();
@@ -1 +1 @@
1
- {"version":3,"file":"modules-file.js","sourceRoot":"","sources":["../../src/lib/modules-file.ts"],"names":[],"mappings":";;;;;;AAaA,0CAsBC;AAGD,gDAQC;AAGD,gDAEC;AAED,4CAEC;AAvDD,gEAAkC;AAClC,0DAA6B;AAE7B,6CAA2C;AAG9B,QAAA,YAAY,GAAG,aAAa,CAAC;AAOnC,KAAK,UAAU,eAAe,CAAC,WAAmB;IACvD,MAAM,MAAM,GAAG,mBAAI,C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BAAE,CAAC,SAAS,CAAC,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAY,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACrG,CAAC;AAED,SAAS,cAAc,CAAC,KAAe;IACrC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export declare const FRAMEWORK_MARKER_START = "/* fewbie:framework:start */";
2
2
  export declare const FRAMEWORK_MARKER_END = "/* fewbie:framework:end */";
3
+ export declare const FRAMEWORK_MANIFEST_PATH = ".fewbie/framework.json";
4
+ export declare const FRAMEWORK_MANIFEST_VERSION = 1;
3
5
  export interface TemplateMarkers {
4
6
  start: string;
5
7
  end: string;
@@ -22,16 +24,35 @@ export interface FrameworkDependency {
22
24
  }
23
25
  export declare const FRAMEWORK_DEPENDENCIES: readonly FrameworkDependency[];
24
26
  export declare function assetCoversPath(asset: TemplateAsset, filePath: string): boolean;
27
+ export declare function normalizeAssetPath(assetPath: string): string;
28
+ export declare function resolveTemplateAsset(filePath: string, assets?: readonly TemplateAsset[]): TemplateAsset | null;
29
+ export interface AmbiguousOwnership {
30
+ path: string;
31
+ ownerships: TemplateOwnership[];
32
+ }
33
+ export declare function findAmbiguousTemplatePaths(assets?: readonly TemplateAsset[]): AmbiguousOwnership[];
34
+ export declare function hashContent(content: string): string;
35
+ export interface FrameworkManifest {
36
+ version: number;
37
+ algorithm: "sha256";
38
+ digest?: string;
39
+ files: Record<string, string>;
40
+ }
41
+ export declare function manifestDigest(files: Readonly<Record<string, string>>): string;
42
+ export declare function buildFrameworkManifest(templateFiles: ReadonlyMap<string, string | null>, assets?: readonly TemplateAsset[]): FrameworkManifest;
43
+ export declare function serializeFrameworkManifest(manifest: FrameworkManifest): string;
44
+ export declare function parseFrameworkManifest(raw: string): FrameworkManifest | null;
25
45
  export declare function isTemplateScanIgnored(filePath: string): boolean;
26
46
  export declare function findUnclassifiedTemplateFiles(filePaths: Iterable<string>): string[];
27
47
  export declare function extractMarkerBlock(content: string, markers?: TemplateMarkers): string | null;
28
48
  export declare function replaceMarkerBlock(content: string, block: string, markers?: TemplateMarkers): string | null;
29
- export type TemplateChangeKind = "create" | "update" | "missing-markers" | "scaffold-outdated";
49
+ export type TemplateChangeKind = "create" | "update" | "missing-markers" | "scaffold-outdated" | "modified-framework";
30
50
  export interface TemplateChange {
31
51
  asset: TemplateAsset;
32
52
  kind: TemplateChangeKind;
33
53
  nextContent: string | null;
34
54
  currentComparable: string | null;
35
55
  templateComparable: string | null;
56
+ baselineHash?: string | null;
36
57
  }
37
- export declare function planTemplateUpdate(projectFiles: ReadonlyMap<string, string | null>, templateFiles: ReadonlyMap<string, string | null>, assets?: readonly TemplateAsset[]): TemplateChange[];
58
+ export declare function planTemplateUpdate(projectFiles: ReadonlyMap<string, string | null>, templateFiles: ReadonlyMap<string, string | null>, assets?: readonly TemplateAsset[], baseline?: Readonly<Record<string, string>>): TemplateChange[];
@@ -1,16 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FRAMEWORK_DEPENDENCIES = exports.SYNCABLE_ASSETS = exports.TEMPLATE_ASSETS = exports.FRAMEWORK_MARKER_END = exports.FRAMEWORK_MARKER_START = void 0;
3
+ exports.FRAMEWORK_DEPENDENCIES = exports.SYNCABLE_ASSETS = exports.TEMPLATE_ASSETS = exports.FRAMEWORK_MANIFEST_VERSION = exports.FRAMEWORK_MANIFEST_PATH = exports.FRAMEWORK_MARKER_END = exports.FRAMEWORK_MARKER_START = void 0;
4
4
  exports.assetMarkers = assetMarkers;
5
5
  exports.isSyncableAsset = isSyncableAsset;
6
6
  exports.assetCoversPath = assetCoversPath;
7
+ exports.normalizeAssetPath = normalizeAssetPath;
8
+ exports.resolveTemplateAsset = resolveTemplateAsset;
9
+ exports.findAmbiguousTemplatePaths = findAmbiguousTemplatePaths;
10
+ exports.hashContent = hashContent;
11
+ exports.manifestDigest = manifestDigest;
12
+ exports.buildFrameworkManifest = buildFrameworkManifest;
13
+ exports.serializeFrameworkManifest = serializeFrameworkManifest;
14
+ exports.parseFrameworkManifest = parseFrameworkManifest;
7
15
  exports.isTemplateScanIgnored = isTemplateScanIgnored;
8
16
  exports.findUnclassifiedTemplateFiles = findUnclassifiedTemplateFiles;
9
17
  exports.extractMarkerBlock = extractMarkerBlock;
10
18
  exports.replaceMarkerBlock = replaceMarkerBlock;
11
19
  exports.planTemplateUpdate = planTemplateUpdate;
20
+ const node_crypto_1 = require("node:crypto");
12
21
  exports.FRAMEWORK_MARKER_START = "/* fewbie:framework:start */";
13
22
  exports.FRAMEWORK_MARKER_END = "/* fewbie:framework:end */";
23
+ exports.FRAMEWORK_MANIFEST_PATH = ".fewbie/framework.json";
24
+ exports.FRAMEWORK_MANIFEST_VERSION = 1;
14
25
  const DEFAULT_MARKERS = { start: exports.FRAMEWORK_MARKER_START, end: exports.FRAMEWORK_MARKER_END };
15
26
  function assetMarkers(asset) {
16
27
  return asset.markers ?? DEFAULT_MARKERS;
@@ -22,6 +33,12 @@ exports.TEMPLATE_ASSETS = [
22
33
  requiredSnippet: 'from "./next.config.framework"',
23
34
  note: "host config calls withFewbie(); defaults and invariants live in next.config.framework.ts",
24
35
  },
36
+ {
37
+ path: "src/app/host-providers.tsx",
38
+ ownership: "scaffold",
39
+ requiredSnippet: "HostProviders",
40
+ note: "providers the framework layout wraps the tree in; created when missing, never rewritten once adopted",
41
+ },
25
42
  { path: "next.config.framework.ts", ownership: "framework" },
26
43
  { path: "tsconfig.json", ownership: "framework" },
27
44
  { path: "postcss.config.mjs", ownership: "framework" },
@@ -52,8 +69,38 @@ exports.TEMPLATE_ASSETS = [
52
69
  note: "the framework block lists variables framework-owned files read; host and registry-module variables stay outside it",
53
70
  markers: { start: "# fewbie:framework:start", end: "# fewbie:framework:end" },
54
71
  },
72
+ { path: "src/components/ui/**", ownership: "framework" },
73
+ { path: "src/framework/**", ownership: "framework" },
74
+ { path: "src/lib/api-client/**", ownership: "framework" },
75
+ {
76
+ path: "scripts/**",
77
+ ownership: "framework",
78
+ note: "gate scripts (page contract, shell, primitives, routes, framework ADR) and their fixtures ship with the template",
79
+ },
80
+ {
81
+ path: "src/app/fonts/**",
82
+ ownership: "framework",
83
+ note: "self-hosted font faces keep the first paint and metrics identical across hosts",
84
+ },
85
+ {
86
+ path: "src/i18n/config.ts",
87
+ ownership: "framework",
88
+ note: "locale list and message loading are framework policy",
89
+ },
90
+ { path: "src/i18n/request.ts", ownership: "framework" },
91
+ {
92
+ path: "src/i18n/messages/framework.en.json",
93
+ ownership: "framework",
94
+ note: "framework namespace; host messages live in src/i18n/messages/<host>.*.json",
95
+ },
96
+ { path: "src/i18n/messages/framework.zh.json", ownership: "framework" },
97
+ {
98
+ path: "src/app/layout.tsx",
99
+ ownership: "framework",
100
+ note: "root layout is framework-owned; hosts inject widgets through slots (ADR-056 D5)",
101
+ },
102
+ { path: exports.FRAMEWORK_MANIFEST_PATH, ownership: "framework" },
55
103
  { path: ".trae/**", ownership: "host", note: "workspace ledger and skill mount; symlinks are never copied" },
56
- { path: "src/app/layout.tsx", ownership: "host" },
57
104
  { path: "src/app/page.tsx", ownership: "host" },
58
105
  { path: "src/app/favicon.ico", ownership: "host" },
59
106
  { path: "src/components/**", ownership: "host" },
@@ -82,6 +129,11 @@ exports.FRAMEWORK_DEPENDENCIES = [
82
129
  { name: "tailwindcss", importedBy: "src/app/globals.css" },
83
130
  { name: "tw-animate-css", importedBy: "src/app/globals.css" },
84
131
  { name: "shadcn", importedBy: "src/app/globals.css (shadcn/tailwind.css)" },
132
+ { name: "axios", importedBy: "src/lib/api-client/client.ts" },
133
+ { name: "dayjs", importedBy: "src/components/ui/date-picker.tsx" },
134
+ { name: "cmdk", importedBy: "src/components/ui/command.tsx" },
135
+ { name: "echarts", importedBy: "src/framework/chart/echarts.ts" },
136
+ { name: "react-day-picker", importedBy: "src/components/ui/calendar.tsx, src/components/ui/date-picker.tsx" },
85
137
  ];
86
138
  function assetCoversPath(asset, filePath) {
87
139
  if (asset.path.endsWith("/**")) {
@@ -90,6 +142,83 @@ function assetCoversPath(asset, filePath) {
90
142
  }
91
143
  return filePath === asset.path;
92
144
  }
145
+ function normalizeAssetPath(assetPath) {
146
+ return assetPath.replace(/^\.\//, "").replace(/\/+$/, "");
147
+ }
148
+ function assetDepth(asset) {
149
+ const normalized = normalizeAssetPath(asset.path);
150
+ return (normalized.endsWith("/**") ? normalized.slice(0, -3) : normalized).length;
151
+ }
152
+ function resolveTemplateAsset(filePath, assets = exports.TEMPLATE_ASSETS) {
153
+ const matches = assets.filter((asset) => assetCoversPath(asset, filePath));
154
+ if (matches.length === 0)
155
+ return null;
156
+ return matches.reduce((best, candidate) => (assetDepth(candidate) > assetDepth(best) ? candidate : best));
157
+ }
158
+ function findAmbiguousTemplatePaths(assets = exports.TEMPLATE_ASSETS) {
159
+ const byRoot = new Map();
160
+ for (const asset of assets) {
161
+ const root = normalizeAssetPath(asset.path).replace(/\/\*\*$/, "");
162
+ byRoot.set(root, [...(byRoot.get(root) ?? []), asset]);
163
+ }
164
+ return [...byRoot.entries()]
165
+ .filter(([, entries]) => entries.length > 1)
166
+ .map(([path, entries]) => ({ path, ownerships: entries.map((entry) => entry.ownership) }))
167
+ .sort((a, b) => a.path.localeCompare(b.path));
168
+ }
169
+ function hashContent(content) {
170
+ return (0, node_crypto_1.createHash)("sha256").update(content, "utf8").digest("hex");
171
+ }
172
+ function manifestDigest(files) {
173
+ const canonical = Object.keys(files)
174
+ .sort((a, b) => a.localeCompare(b))
175
+ .map((filePath) => `${filePath}:${files[filePath]}`)
176
+ .join("\n");
177
+ return hashContent(canonical);
178
+ }
179
+ function buildFrameworkManifest(templateFiles, assets = exports.TEMPLATE_ASSETS) {
180
+ const files = {};
181
+ for (const [filePath, content] of templateFiles) {
182
+ if (content == null || filePath === exports.FRAMEWORK_MANIFEST_PATH)
183
+ continue;
184
+ if (resolveTemplateAsset(filePath, assets)?.ownership !== "framework")
185
+ continue;
186
+ files[filePath] = hashContent(content);
187
+ }
188
+ return { version: exports.FRAMEWORK_MANIFEST_VERSION, algorithm: "sha256", digest: manifestDigest(files), files };
189
+ }
190
+ function serializeFrameworkManifest(manifest) {
191
+ const files = Object.fromEntries(Object.entries(manifest.files).sort(([a], [b]) => a.localeCompare(b)));
192
+ return `${JSON.stringify({ ...manifest, digest: manifestDigest(files), files }, null, 2)}\n`;
193
+ }
194
+ function parseFrameworkManifest(raw) {
195
+ let parsed;
196
+ try {
197
+ parsed = JSON.parse(raw);
198
+ }
199
+ catch {
200
+ return null;
201
+ }
202
+ if (typeof parsed !== "object" || parsed === null)
203
+ return null;
204
+ const candidate = parsed;
205
+ if (candidate.version !== exports.FRAMEWORK_MANIFEST_VERSION || candidate.algorithm !== "sha256")
206
+ return null;
207
+ if (typeof candidate.files !== "object" || candidate.files === null || Array.isArray(candidate.files))
208
+ return null;
209
+ const files = {};
210
+ for (const [filePath, hash] of Object.entries(candidate.files)) {
211
+ if (typeof hash !== "string" || hash.length === 0)
212
+ return null;
213
+ files[filePath] = hash;
214
+ }
215
+ if (candidate.digest !== undefined && candidate.digest !== manifestDigest(files))
216
+ return null;
217
+ const manifest = { version: exports.FRAMEWORK_MANIFEST_VERSION, algorithm: "sha256", files };
218
+ if (candidate.digest !== undefined)
219
+ manifest.digest = candidate.digest;
220
+ return manifest;
221
+ }
93
222
  const SCAN_IGNORED_DIRECTORIES = new Set([
94
223
  ".git",
95
224
  ".idea",
@@ -116,7 +245,7 @@ function withoutComments(source) {
116
245
  return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
117
246
  }
118
247
  function findUnclassifiedTemplateFiles(filePaths) {
119
- return [...filePaths].filter((filePath) => !exports.TEMPLATE_ASSETS.some((asset) => assetCoversPath(asset, filePath))).sort();
248
+ return [...filePaths].filter((filePath) => resolveTemplateAsset(filePath) === null).sort();
120
249
  }
121
250
  function extractMarkerBlock(content, markers = DEFAULT_MARKERS) {
122
251
  const start = content.indexOf(markers.start);
@@ -140,7 +269,7 @@ function comparable(asset, content) {
140
269
  }
141
270
  return block;
142
271
  }
143
- function planTemplateUpdate(projectFiles, templateFiles, assets = exports.SYNCABLE_ASSETS) {
272
+ function planTemplateUpdate(projectFiles, templateFiles, assets = exports.SYNCABLE_ASSETS, baseline) {
144
273
  const changes = [];
145
274
  for (const asset of assets) {
146
275
  const templateContent = templateFiles.get(asset.path);
@@ -198,15 +327,30 @@ function planTemplateUpdate(projectFiles, templateFiles, assets = exports.SYNCAB
198
327
  }
199
328
  continue;
200
329
  }
201
- if (projectContent !== templateContent) {
202
- changes.push({
203
- asset,
204
- kind: "update",
205
- nextContent: templateContent,
206
- currentComparable: projectContent,
207
- templateComparable: templateContent,
208
- });
330
+ if (projectContent === templateContent)
331
+ continue;
332
+ if (baseline !== undefined && asset.path !== exports.FRAMEWORK_MANIFEST_PATH) {
333
+ const projectHash = hashContent(projectContent);
334
+ const recorded = baseline[asset.path];
335
+ if (recorded !== projectHash) {
336
+ changes.push({
337
+ asset,
338
+ kind: "modified-framework",
339
+ nextContent: null,
340
+ currentComparable: projectContent,
341
+ templateComparable: templateContent,
342
+ baselineHash: recorded ?? null,
343
+ });
344
+ continue;
345
+ }
209
346
  }
347
+ changes.push({
348
+ asset,
349
+ kind: "update",
350
+ nextContent: templateContent,
351
+ currentComparable: projectContent,
352
+ templateComparable: templateContent,
353
+ });
210
354
  }
211
355
  return changes;
212
356
  }