@12ui/design 0.2.6 → 0.2.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.
Files changed (83) hide show
  1. package/README.md +7 -0
  2. package/dist/cli-corpus-command.d.ts.map +1 -1
  3. package/dist/cli-corpus-command.js +7 -0
  4. package/dist/cli-corpus-command.js.map +1 -1
  5. package/dist/cli-corpus-evidence.d.ts.map +1 -1
  6. package/dist/cli-corpus-evidence.js +20 -2
  7. package/dist/cli-corpus-evidence.js.map +1 -1
  8. package/dist/cli-corpus-reference-image.d.ts +13 -0
  9. package/dist/cli-corpus-reference-image.d.ts.map +1 -0
  10. package/dist/cli-corpus-reference-image.js +54 -0
  11. package/dist/cli-corpus-reference-image.js.map +1 -0
  12. package/dist/cli-corpus-run.d.ts +6 -0
  13. package/dist/cli-corpus-run.d.ts.map +1 -1
  14. package/dist/cli-corpus-run.js +15 -2
  15. package/dist/cli-corpus-run.js.map +1 -1
  16. package/dist/cli-corpus-types.d.ts +4 -0
  17. package/dist/cli-corpus-types.d.ts.map +1 -1
  18. package/dist/cli-corpus-types.js.map +1 -1
  19. package/dist/cli-image-batch-command.d.ts.map +1 -1
  20. package/dist/cli-image-batch-command.js +2 -1
  21. package/dist/cli-image-batch-command.js.map +1 -1
  22. package/dist/cli-image-command.d.ts.map +1 -1
  23. package/dist/cli-image-command.js +7 -1
  24. package/dist/cli-image-command.js.map +1 -1
  25. package/dist/cli-persistence.d.ts +3 -0
  26. package/dist/cli-persistence.d.ts.map +1 -1
  27. package/dist/cli-persistence.js +74 -4
  28. package/dist/cli-persistence.js.map +1 -1
  29. package/dist/cli-skill-command.d.ts.map +1 -1
  30. package/dist/cli-skill-command.js +5 -0
  31. package/dist/cli-skill-command.js.map +1 -1
  32. package/dist/cli.js +2 -2
  33. package/dist/corpus-client.d.ts +15 -1
  34. package/dist/corpus-client.d.ts.map +1 -1
  35. package/dist/corpus-client.js +48 -2
  36. package/dist/corpus-client.js.map +1 -1
  37. package/dist/corpus-experiment.d.ts +170 -0
  38. package/dist/corpus-experiment.d.ts.map +1 -0
  39. package/dist/corpus-experiment.js +2 -0
  40. package/dist/corpus-experiment.js.map +1 -0
  41. package/dist/image-generation-batch-manifest.d.ts +2 -1
  42. package/dist/image-generation-batch-manifest.d.ts.map +1 -1
  43. package/dist/image-generation-batch-manifest.js +7 -1
  44. package/dist/image-generation-batch-manifest.js.map +1 -1
  45. package/dist/image-generation-error.d.ts +3 -0
  46. package/dist/image-generation-error.d.ts.map +1 -0
  47. package/dist/image-generation-error.js +30 -0
  48. package/dist/image-generation-error.js.map +1 -0
  49. package/dist/image-generation-evidence.d.ts +3 -1
  50. package/dist/image-generation-evidence.d.ts.map +1 -1
  51. package/dist/image-generation-evidence.js.map +1 -1
  52. package/dist/image-generation-request.d.ts +4 -0
  53. package/dist/image-generation-request.d.ts.map +1 -1
  54. package/dist/image-generation-request.js +3 -0
  55. package/dist/image-generation-request.js.map +1 -1
  56. package/dist/image-generation-run.d.ts.map +1 -1
  57. package/dist/image-generation-run.js +14 -4
  58. package/dist/image-generation-run.js.map +1 -1
  59. package/dist/image-generation-usage.d.ts +4 -0
  60. package/dist/image-generation-usage.d.ts.map +1 -1
  61. package/dist/image-generation-usage.js +37 -10
  62. package/dist/image-generation-usage.js.map +1 -1
  63. package/dist/index.d.ts +2 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/legacy-cli-cleanup.d.ts +1 -0
  68. package/dist/legacy-cli-cleanup.d.ts.map +1 -1
  69. package/dist/legacy-cli-cleanup.js +12 -0
  70. package/dist/legacy-cli-cleanup.js.map +1 -1
  71. package/dist/legacy-npm-global-cli-cleanup.d.ts +16 -0
  72. package/dist/legacy-npm-global-cli-cleanup.d.ts.map +1 -0
  73. package/dist/legacy-npm-global-cli-cleanup.js +102 -0
  74. package/dist/legacy-npm-global-cli-cleanup.js.map +1 -0
  75. package/dist/legacy-npm-global-cli-recognition.d.ts +12 -0
  76. package/dist/legacy-npm-global-cli-recognition.d.ts.map +1 -0
  77. package/dist/legacy-npm-global-cli-recognition.js +105 -0
  78. package/dist/legacy-npm-global-cli-recognition.js.map +1 -0
  79. package/package.json +2 -2
  80. package/skills/design/SKILL.md +99 -14
  81. package/skills/design/references/continuation-contract.md +60 -0
  82. package/skills/design/references/selection-contract.md +34 -4
  83. package/skills/design-search/SKILL.md +21 -2
@@ -94,4 +94,16 @@ export const retireRecognizedLegacyCli = async (args) => {
94
94
  await rename(removed, recovery);
95
95
  return { removed, recovery };
96
96
  };
97
+ export const restoreRetiredLegacyCli = async (retired) => {
98
+ try {
99
+ await lstat(retired.removed);
100
+ throw new Error(`Refusing to overwrite ${retired.removed} while restoring legacy 12ui CLI`);
101
+ }
102
+ catch (error) {
103
+ if (error.code !== 'ENOENT')
104
+ throw error;
105
+ }
106
+ await mkdir(path.dirname(retired.removed), { recursive: true });
107
+ await rename(retired.recovery, retired.removed);
108
+ };
97
109
  //# sourceMappingURL=legacy-cli-cleanup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-cli-cleanup.js","sourceRoot":"","sources":["../src/legacy-cli-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AACxC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,MAAM,wBAAwB,GAC5B,iGAAiG,CAAC;AACpG,MAAM,yBAAyB,GAC7B,+DAA+D,CAAC;AAClE,MAAM,qBAAqB,GAAG,CAAC,cAAc,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;AASpF,MAAM,QAA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} from './legacy-npm-global-cli-recognition.js';
2
+ export { digestLegacyNpmGlobalPackageTree, isRecognizedNpmGlobalLegacyCli, legacyNpmGlobalCliPaths, } from './legacy-npm-global-cli-recognition.js';
3
+ export type { LegacyNpmGlobalCliPaths } from './legacy-npm-global-cli-recognition.js';
4
+ export type RetiredLegacyNpmGlobalCli = {
5
+ removed: LegacyNpmGlobalCliPaths;
6
+ recovery: LegacyNpmGlobalCliPaths & {
7
+ root: string;
8
+ };
9
+ };
10
+ export declare const retireRecognizedNpmGlobalLegacyCli: (args: {
11
+ dataRoot: string;
12
+ homeDirectory: string;
13
+ recognizedPackageTreeDigests?: ReadonlySet<string>;
14
+ }) => Promise<RetiredLegacyNpmGlobalCli | null>;
15
+ export declare const restoreRetiredNpmGlobalLegacyCli: (retired: RetiredLegacyNpmGlobalCli) => Promise<void>;
16
+ //# sourceMappingURL=legacy-npm-global-cli-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-npm-global-cli-cleanup.d.ts","sourceRoot":"","sources":["../src/legacy-npm-global-cli-cleanup.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEtF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,uBAAuB,CAAC;IACjC,QAAQ,EAAE,uBAAuB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD,CAAC;AAiCF,eAAO,MAAM,kCAAkC,GAAU,MAAM;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpD,KAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CA0C3C,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAC3C,SAAS,yBAAyB,KACjC,OAAO,CAAC,IAAI,CA2Cd,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { lstat, mkdir, rename, rm, } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { isRecognizedNpmGlobalLegacyCli, LEGACY_NPM_GLOBAL_PACKAGE_VERSION, legacyNpmGlobalCliPaths, } from './legacy-npm-global-cli-recognition.js';
5
+ export { digestLegacyNpmGlobalPackageTree, isRecognizedNpmGlobalLegacyCli, legacyNpmGlobalCliPaths, } from './legacy-npm-global-cli-recognition.js';
6
+ const pathExists = async (target) => {
7
+ try {
8
+ await lstat(target);
9
+ return true;
10
+ }
11
+ catch (error) {
12
+ if (error.code === 'ENOENT')
13
+ return false;
14
+ throw error;
15
+ }
16
+ };
17
+ const restoreMovedPair = async (args) => {
18
+ const restorations = await Promise.allSettled([
19
+ ...(args.movedLauncher
20
+ ? [rename(args.recovery.launcher, args.original.launcher)]
21
+ : []),
22
+ ...(args.movedPackage
23
+ ? [rename(args.recovery.packageRoot, args.original.packageRoot)]
24
+ : []),
25
+ ]);
26
+ return restorations.flatMap((result) => (result.status === 'rejected'
27
+ ? [result.reason instanceof Error ? result.reason : new Error(String(result.reason))]
28
+ : []));
29
+ };
30
+ export const retireRecognizedNpmGlobalLegacyCli = async (args) => {
31
+ if (!(await isRecognizedNpmGlobalLegacyCli(args)))
32
+ return null;
33
+ const removed = legacyNpmGlobalCliPaths(args.homeDirectory);
34
+ const retirementRoot = path.join(args.dataRoot, 'retired');
35
+ const recoveryRoot = path.join(retirementRoot, `npm-global-just-every-12ui-${LEGACY_NPM_GLOBAL_PACKAGE_VERSION}-${randomUUID()}`);
36
+ const recovery = {
37
+ root: recoveryRoot,
38
+ launcher: path.join(recoveryRoot, '12ui'),
39
+ packageRoot: path.join(recoveryRoot, 'package'),
40
+ };
41
+ await mkdir(retirementRoot, { recursive: true });
42
+ await mkdir(recoveryRoot);
43
+ const moves = await Promise.allSettled([
44
+ rename(removed.launcher, recovery.launcher),
45
+ rename(removed.packageRoot, recovery.packageRoot),
46
+ ]);
47
+ const moveErrors = moves.flatMap((result) => (result.status === 'rejected'
48
+ ? [result.reason instanceof Error ? result.reason : new Error(String(result.reason))]
49
+ : []));
50
+ if (moveErrors.length > 0) {
51
+ const restoreErrors = await restoreMovedPair({
52
+ movedLauncher: moves[0]?.status === 'fulfilled',
53
+ movedPackage: moves[1]?.status === 'fulfilled',
54
+ original: removed,
55
+ recovery,
56
+ });
57
+ if (restoreErrors.length === 0) {
58
+ await rm(recoveryRoot, { recursive: true, force: true });
59
+ throw moveErrors[0];
60
+ }
61
+ throw new AggregateError([...moveErrors, ...restoreErrors], 'Legacy npm-global 12ui retirement failed and could not be restored');
62
+ }
63
+ return { removed, recovery };
64
+ };
65
+ export const restoreRetiredNpmGlobalLegacyCli = async (retired) => {
66
+ const destinationsExist = await Promise.all([
67
+ pathExists(retired.removed.launcher),
68
+ pathExists(retired.removed.packageRoot),
69
+ ]);
70
+ if (destinationsExist.some(Boolean)) {
71
+ throw new Error('Refusing to overwrite a path while restoring the legacy npm-global 12ui CLI');
72
+ }
73
+ await Promise.all([
74
+ mkdir(path.dirname(retired.removed.launcher), { recursive: true }),
75
+ mkdir(path.dirname(retired.removed.packageRoot), { recursive: true }),
76
+ ]);
77
+ const restorations = await Promise.allSettled([
78
+ rename(retired.recovery.launcher, retired.removed.launcher),
79
+ rename(retired.recovery.packageRoot, retired.removed.packageRoot),
80
+ ]);
81
+ const restoreErrors = restorations.flatMap((result) => (result.status === 'rejected'
82
+ ? [result.reason instanceof Error ? result.reason : new Error(String(result.reason))]
83
+ : []));
84
+ if (restoreErrors.length > 0) {
85
+ const rollbackResults = await Promise.allSettled([
86
+ ...(restorations[0]?.status === 'fulfilled'
87
+ ? [rename(retired.removed.launcher, retired.recovery.launcher)]
88
+ : []),
89
+ ...(restorations[1]?.status === 'fulfilled'
90
+ ? [rename(retired.removed.packageRoot, retired.recovery.packageRoot)]
91
+ : []),
92
+ ]);
93
+ const rollbackErrors = rollbackResults.flatMap((result) => (result.status === 'rejected'
94
+ ? [result.reason instanceof Error ? result.reason : new Error(String(result.reason))]
95
+ : []));
96
+ throw new AggregateError([...restoreErrors, ...rollbackErrors], rollbackErrors.length > 0
97
+ ? 'Retired npm-global 12ui CLI restore failed and could not be rolled back'
98
+ : 'Retired npm-global 12ui CLI could not be restored');
99
+ }
100
+ await rm(retired.recovery.root, { recursive: true, force: true });
101
+ };
102
+ //# sourceMappingURL=legacy-npm-global-cli-cleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-npm-global-cli-cleanup.js","sourceRoot":"","sources":["../src/legacy-npm-global-cli-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,EAAE,GACH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,uBAAuB,GAExB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAQhD,MAAM,UAAU,GAAG,KAAK,EAAE,MAAc,EAAoB,EAAE;IAC5D,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAK/B,EAAoB,EAAE;IACrB,MAAM,YAAY,GAAG,MA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,CAAC,EACrC,cAAc,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,yEAAyE;YAC3E,CAAC,CAAC,mDAAmD,CACxD,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const LEGACY_NPM_GLOBAL_PACKAGE_VERSION = "0.1.97";
2
+ export type LegacyNpmGlobalCliPaths = {
3
+ launcher: string;
4
+ packageRoot: string;
5
+ };
6
+ export declare const digestLegacyNpmGlobalPackageTree: (packageRoot: string) => Promise<string | null>;
7
+ export declare const legacyNpmGlobalCliPaths: (homeDirectory: string) => LegacyNpmGlobalCliPaths;
8
+ export declare const isRecognizedNpmGlobalLegacyCli: (args: {
9
+ homeDirectory: string;
10
+ recognizedPackageTreeDigests?: ReadonlySet<string>;
11
+ }) => Promise<boolean>;
12
+ //# sourceMappingURL=legacy-npm-global-cli-recognition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-npm-global-cli-recognition.d.ts","sourceRoot":"","sources":["../src/legacy-npm-global-cli-recognition.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iCAAiC,WAAW,CAAC;AAc1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAUF,eAAO,MAAM,gCAAgC,GAC3C,aAAa,MAAM,KAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CA2CvB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,eAAe,MAAM,KAAG,uBAM/D,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAU,MAAM;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpD,KAAG,OAAO,CAAC,OAAO,CAqClB,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { lstat, readFile, readdir, readlink, } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ const LEGACY_PACKAGE_NAME = '@just-every/12ui';
5
+ export const LEGACY_NPM_GLOBAL_PACKAGE_VERSION = '0.1.97';
6
+ const LEGACY_LAUNCHER_TARGET = '../lib/node_modules/@just-every/12ui/dist/cli.js';
7
+ // Canonical digest of the complete npm-global package tree observed for the
8
+ // published @just-every/12ui@0.1.97 darwin-arm64 installation. The digest
9
+ // includes paths, entry kinds, permission bits, file bytes, and symlink targets.
10
+ const RECOGNIZED_PACKAGE_TREE_DIGESTS = new Set([
11
+ 'd7cdcb6a5ebc3f729824fd429b6939c49c5215f407b652305c6bac1ddcaaed0f',
12
+ ]);
13
+ class UnsupportedLegacyPackageEntryError extends Error {
14
+ }
15
+ const isRecord = (value) => (typeof value === 'object' && value !== null && !Array.isArray(value));
16
+ const entryOrder = (left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
17
+ export const digestLegacyNpmGlobalPackageTree = async (packageRoot) => {
18
+ const visit = async (directory, relativeDirectory = '') => {
19
+ const entries = (await readdir(directory, { withFileTypes: true })).sort(entryOrder);
20
+ const records = await Promise.all(entries.map(async (entry) => {
21
+ const absolute = path.join(directory, entry.name);
22
+ const relative = relativeDirectory
23
+ ? `${relativeDirectory}/${entry.name}`
24
+ : entry.name;
25
+ const metadata = await lstat(absolute);
26
+ const mode = (metadata.mode & 0o777).toString(8);
27
+ if (metadata.isSymbolicLink()) {
28
+ return [`symlink\0${relative}\0${mode}\0${await readlink(absolute)}\0`];
29
+ }
30
+ if (metadata.isDirectory()) {
31
+ return [
32
+ `directory\0${relative}\0${mode}\0`,
33
+ ...await visit(absolute, relative),
34
+ ];
35
+ }
36
+ if (metadata.isFile()) {
37
+ const fileDigest = createHash('sha256')
38
+ .update(await readFile(absolute))
39
+ .digest('hex');
40
+ return [`file\0${relative}\0${mode}\0${fileDigest}\0`];
41
+ }
42
+ throw new UnsupportedLegacyPackageEntryError(`Unsupported entry in legacy npm-global CLI: ${absolute}`);
43
+ }));
44
+ return records.flat();
45
+ };
46
+ try {
47
+ const rootMetadata = await lstat(packageRoot);
48
+ if (!rootMetadata.isDirectory() || rootMetadata.isSymbolicLink())
49
+ return null;
50
+ const treeDigest = createHash('sha256');
51
+ for (const record of await visit(packageRoot))
52
+ treeDigest.update(record);
53
+ return treeDigest.digest('hex');
54
+ }
55
+ catch (error) {
56
+ if (error.code === 'ENOENT')
57
+ return null;
58
+ if (error instanceof UnsupportedLegacyPackageEntryError)
59
+ return null;
60
+ throw error;
61
+ }
62
+ };
63
+ export const legacyNpmGlobalCliPaths = (homeDirectory) => {
64
+ const prefix = path.join(homeDirectory, '.npm-global');
65
+ return {
66
+ launcher: path.join(prefix, 'bin', '12ui'),
67
+ packageRoot: path.join(prefix, 'lib', 'node_modules', '@just-every', '12ui'),
68
+ };
69
+ };
70
+ export const isRecognizedNpmGlobalLegacyCli = async (args) => {
71
+ const targets = legacyNpmGlobalCliPaths(args.homeDirectory);
72
+ let launcherMetadata;
73
+ try {
74
+ launcherMetadata = await lstat(targets.launcher);
75
+ }
76
+ catch (error) {
77
+ if (error.code === 'ENOENT')
78
+ return false;
79
+ throw error;
80
+ }
81
+ if (!launcherMetadata.isSymbolicLink())
82
+ return false;
83
+ if (await readlink(targets.launcher) !== LEGACY_LAUNCHER_TARGET)
84
+ return false;
85
+ let manifest;
86
+ try {
87
+ manifest = JSON.parse(await readFile(path.join(targets.packageRoot, 'package.json'), 'utf8'));
88
+ }
89
+ catch (error) {
90
+ if (error instanceof SyntaxError
91
+ || error.code === 'ENOENT') {
92
+ return false;
93
+ }
94
+ throw error;
95
+ }
96
+ if (!isRecord(manifest)
97
+ || manifest.name !== LEGACY_PACKAGE_NAME
98
+ || manifest.version !== LEGACY_NPM_GLOBAL_PACKAGE_VERSION
99
+ || manifest.bin !== './dist/cli.js') {
100
+ return false;
101
+ }
102
+ const digest = await digestLegacyNpmGlobalPackageTree(targets.packageRoot);
103
+ return digest !== null && (args.recognizedPackageTreeDigests ?? RECOGNIZED_PACKAGE_TREE_DIGESTS).has(digest);
104
+ };
105
+ //# sourceMappingURL=legacy-npm-global-cli-recognition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-npm-global-cli-recognition.js","sourceRoot":"","sources":["../src/legacy-npm-global-cli-recognition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C,MAAM,CAAC,MAAM,iCAAiC,GAAG,QAAQ,CAAC;AAC1D,MAAM,sBAAsB,GAAG,kDAAkD,CAAC;AAElF,4EAA4E;AAC5E,0EAA0E;AAC1E,iFAAiF;AACjF,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,kEAAkE;CACnE,CAAC,CAAC;AAIH,MAAM,kCAAmC,SAAQ,KAAK;CAAG;AAOzD,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAuB,EAAE,CAAC,CACxD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACrE,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAsB,EAAE,KAAuB,EAAU,EAAE,CAAC,CAC9E,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC7D,CA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AAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3E,OAAO,MAAM,KAAK,IAAI,IAAI,CACxB,IAAI,CAAC,4BAA4B,IAAI,+BAA+B,CACrE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12ui/design",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "description": "The canonical 12UI CLI, SDK, MCP server, and visual interface design skills",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "prepublishOnly": "npm run build"
25
25
  },
26
26
  "dependencies": {
27
- "@just-every/ensemble": "0.2.272",
27
+ "@just-every/ensemble": "0.2.274",
28
28
  "@modelcontextprotocol/sdk": "^1.29.0",
29
29
  "sharp": "^0.34.5"
30
30
  },
@@ -13,7 +13,11 @@ than recreating it manually.
13
13
 
14
14
  ## Choose the route
15
15
 
16
- - Finished screenshot or mockup: use `design-convert` directly.
16
+ - Finished screenshot or mockup to reproduce faithfully: use `design-convert`
17
+ directly.
18
+ - Existing screenshot supplied as a redesign source: choose an exploratory
19
+ redesign or a structure-preserving reskin below. It is not a corpus
20
+ inspiration image.
17
21
  - Small visual edit: change the existing project code. Do not search, generate,
18
22
  or convert.
19
23
  - Rough brief, new interface, or major redesign: use the workflow below.
@@ -26,6 +30,19 @@ Inspect the project before designing: its instructions, framework, routes,
26
30
  components, assets, conventions, validation commands, and existing user
27
31
  changes. Create the run directory under the system temporary directory.
28
32
 
33
+ If there is a redesign source, state a short preserve/change contract before
34
+ searching. Choose one mode:
35
+
36
+ - `exploratory-redesign`: preserve only named product/UX constraints and allow
37
+ layout and visual language to change.
38
+ - `structure-preserving-reskin`: preserve the named information architecture,
39
+ content hierarchy, and interactions; change only the named visual qualities.
40
+
41
+ If the source is a long page or contains more than the target screen, crop the
42
+ relevant first viewport into the system temporary run directory before search
43
+ or generation. Keep and hash both the original and prepared crop; do not make
44
+ the image model solve a whole-page composition inside one viewport.
45
+
29
46
  Search with the CLI; do not make a separate brief file:
30
47
 
31
48
  ```bash
@@ -36,6 +53,20 @@ Search with the CLI; do not make a separate brief file:
36
53
  --out-dir <run-dir>/references
37
54
  ```
38
55
 
56
+ For either redesign mode, add the existing screenshot to retrieval:
57
+
58
+ ```bash
59
+ 12ui corpus inspire \
60
+ --query "<preserve/change contract and desired direction>" \
61
+ --reference-image <redesign-source.png> \
62
+ --count 4 \
63
+ --aspect <landscape|portrait|square> \
64
+ --out-dir <run-dir>/references
65
+ ```
66
+
67
+ This performs one image-and-text-conditioned search. The redesign source stays
68
+ distinct from the four returned corpus inspirations.
69
+
39
70
  Use the four real downloaded images in endpoint order. `manifest.json`
40
71
  contains their IDs, paths, hashes, roles, arms, cells, relevance, relevance
41
72
  percentiles, and quality percentiles. Preserve those values; do not rerank or
@@ -50,7 +81,8 @@ imagery where useful, strong hierarchy, breathing room, and sound UX. Make the
50
81
  result striking at first glance, but keep the prompt to a few sentences and
51
82
  let the image model choose layout, style, palette, typography, and detail.
52
83
 
53
- Use this shape as guidance, not a form to fill mechanically:
84
+ For new interfaces and exploratory redesigns, use this shape as guidance, not
85
+ a form to fill mechanically:
54
86
 
55
87
  ```text
56
88
  Create one distinctive [desktop/mobile] [interface] for [product and purpose].
@@ -61,14 +93,33 @@ the visual language yourself. Fill the canvas without a device or presentation
61
93
  frame.
62
94
  ```
63
95
 
64
- Map reference 1 to candidate A, 2 to B, 3 to C, and 4 to D. Each candidate gets
65
- exactly one reference. Never combine references in a single generation.
66
- Before writing the prompts, derive one short, visibly grounded direction from
67
- each paired reference—such as airy editorial, tactile retail, cinematic, or
96
+ For a structure-preserving reskin, be explicit about what is fixed but leave
97
+ visual choices open:
98
+
99
+ ```text
100
+ Reskin this [desktop/mobile] interface for [product and purpose]. Preserve the
101
+ attached source's information architecture, content hierarchy, primary actions,
102
+ and interactions. Change only [named visual qualities]. Show the first viewport
103
+ or primary screen and choose the palette, typography, spacing, and detail.
104
+ Fill the canvas without a device or presentation frame.
105
+ ```
106
+
107
+ Map corpus reference 1 to candidate A, 2 to B, 3 to C, and 4 to D. Before
108
+ writing the prompts, derive one short, visibly grounded direction from each
109
+ paired corpus reference—such as airy editorial, tactile retail, cinematic, or
68
110
  playful illustration. Use that as the candidate's one desired quality, and
69
111
  make the four directions meaningfully different. Do not describe the whole
70
112
  reference or prescribe its layout, palette, or techniques.
71
113
 
114
+ Use exactly one image reference per generation; never combine images:
115
+
116
+ - New interface or `exploratory-redesign`: each candidate uses its paired
117
+ corpus image. The redesign source conditions search but is not also attached
118
+ to generation.
119
+ - `structure-preserving-reskin`: every candidate uses the redesign source as
120
+ its sole image reference. Its paired corpus image contributes only the short
121
+ textual direction above; do not attach that corpus image to generation.
122
+
72
123
  Write one batch manifest in the run directory with four candidates:
73
124
 
74
125
  ```json
@@ -77,11 +128,12 @@ Write one batch manifest in the run directory with four candidates:
77
128
  "projectRoot": "<absolute-project-root>",
78
129
  "provider": "auto",
79
130
  "aspect": "landscape",
131
+ "referenceMode": "inspiration",
80
132
  "candidates": [
81
133
  {
82
134
  "id": "A",
83
135
  "prompt": "<short candidate prompt>",
84
- "reference": "<reference-1-path>",
136
+ "reference": "<single-generation-reference-path>",
85
137
  "out": "<run-dir>/candidates/A.png",
86
138
  "idempotencyKey": "<stable-A-key>"
87
139
  }
@@ -89,7 +141,11 @@ Write one batch manifest in the run directory with four candidates:
89
141
  }
90
142
  ```
91
143
 
92
- Include A-D, each with its mapped reference, unique PNG output, and stable key.
144
+ Include A-D, each with its one allowed image reference, unique PNG output, and
145
+ stable key. Set the top-level `referenceMode` to `inspiration` for new and
146
+ exploratory candidates, or `preserve-structure` when the redesign source is
147
+ the sole reference. This is persisted semantic evidence; GPT Image 2 already
148
+ processes image inputs at fixed high fidelity, so do not add `input_fidelity`.
93
149
  Then run one foreground command:
94
150
 
95
151
  ```bash
@@ -103,7 +159,7 @@ from one host task: that tool path may queue them serially. Never retry a failed
103
159
  or ambiguous candidate, switch providers after dispatch, use cached samples, or
104
160
  leave generation in detached background work.
105
161
 
106
- ### 3. Select and convert
162
+ ### 3. Select
107
163
 
108
164
  Inspect all candidates at original detail. Choose the best eligible direction
109
165
  for the brief, hierarchy, usability, personality, accessibility, feasibility,
@@ -117,18 +173,47 @@ provenance or a tie-breaker between visibly strong candidates.
117
173
 
118
174
  Write `<run-dir>/selection.json` using
119
175
  [the selection contract](references/selection-contract.md). Record exact
120
- prompts, references, candidate paths and hashes, winner, specific rejection
121
- reasons, and visible rationale. Convert only that winner with `design-convert`.
176
+ prompts, original/prepared redesign-source paths and hashes, preserve/change contract, design mode,
177
+ reference policy, corpus directions, candidate paths and hashes, winner,
178
+ specific rejection reasons, and visible rationale.
179
+
180
+ ### 4. Extend and convert
181
+
182
+ If the winner represents the complete simple surface, convert only that winner
183
+ with `design-convert` and continue to integration.
184
+
185
+ When the first image intentionally omitted later page viewports, routes, or app
186
+ states, freeze the winner as the sole visual reference for every continuation.
187
+ Plan 2-16 useful continuations. Prompt only the state, content, actions, and
188
+ route purpose that must change; do not redescribe palette, typography, layout,
189
+ style, or visual techniques. Set the continuation batch `referenceMode` to
190
+ `inspiration`: the winner supplies the visual system, not a first-viewport
191
+ composition to clone. Never attach a corpus image, composite, prior
192
+ continuation, or predecessor. If a particular app-state edit must preserve the
193
+ winner's exact structure, put only those edits in a separate
194
+ `preserve-structure` batch rather than changing the continuation default.
195
+
196
+ Submit the winner's base LayerDoc conversion in detached mode, then immediately
197
+ run one foreground `12ui image generate-batch` for all continuations so image
198
+ generation overlaps the base conversion. Inspect every result before accepting
199
+ it. Convert accepted continuation images concurrently with distinct stable
200
+ idempotency keys; never retry or replace an ambiguous generation.
201
+
202
+ For ordered viewports of one continuous page, use the conversion package API
203
+ to preserve page order. Integrate independent web routes, app states, or mobile
204
+ screens as separate surfaces. Record the run in `<run-dir>/continuations.json`
205
+ using [the continuation contract](references/continuation-contract.md).
206
+
122
207
  If conversion is interrupted, resume its ID or repeat the exact create request
123
208
  with the same idempotency key; do not convert another candidate as a shortcut.
124
209
 
125
- ### 4. Integrate and verify
210
+ ### 5. Integrate and verify
126
211
 
127
212
  Inspect generated files before merging the smallest coherent set into the
128
213
  project. Preserve routing, components, tokens, accessibility, dependencies,
129
214
  and unrelated changes. Add the exact copy, interactions, responsive behavior,
130
- later sections, and routes intentionally omitted from the image prompt while
131
- extending the winning visual system.
215
+ later sections, and routes intentionally omitted from the first-viewport prompt
216
+ while extending the visual system from the winner and accepted continuations.
132
217
 
133
218
  Run focused checks, launch the real interface, exercise interactions, and
134
219
  compare it with the winner at the source viewport plus representative narrower
@@ -0,0 +1,60 @@
1
+ # Continuation evidence contract
2
+
3
+ Write `continuations.json` when the selected first viewport does not cover the
4
+ complete interface. The winner remains the sole reference for every generation.
5
+
6
+ ```json
7
+ {
8
+ "version": 1,
9
+ "createdAt": "<ISO-8601>",
10
+ "selectionPath": "<absolute selection.json path>",
11
+ "winner": {
12
+ "id": "A",
13
+ "path": "<absolute winner PNG path>",
14
+ "sha256": "<winner sha256>"
15
+ },
16
+ "baseConversion": {
17
+ "idempotencyKey": "<stable key>",
18
+ "conversionId": "<base LayerDoc conversion id>",
19
+ "resultEvidencePath": "<absolute result evidence path>"
20
+ },
21
+ "generation": {
22
+ "referenceMode": "inspiration",
23
+ "manifestPath": "<absolute batch manifest path>",
24
+ "manifestSha256": "<sha256>",
25
+ "batchAttemptPath": "<absolute batch attempt path>"
26
+ },
27
+ "continuations": [
28
+ {
29
+ "id": "viewport-2",
30
+ "kind": "<continuous-page|web-route|app-state|mobile-screen>",
31
+ "order": 2,
32
+ "prompt": "<semantic content, actions, state, and route purpose only>",
33
+ "promptSha256": "<sha256>",
34
+ "referencePath": "<same winner path>",
35
+ "referenceSha256": "<same winner sha256>",
36
+ "outputPath": "<absolute generated PNG path>",
37
+ "outputSha256": "<sha256>",
38
+ "attemptEvidencePath": "<absolute attempt path>",
39
+ "accepted": true,
40
+ "rejectionReason": null,
41
+ "conversionId": "<accepted image conversion id or null>",
42
+ "conversionEvidencePath": "<absolute evidence path or null>"
43
+ }
44
+ ],
45
+ "integration": {
46
+ "mode": "<ordered-package|independent-surfaces>",
47
+ "packageEvidencePath": "<absolute package evidence path or null>"
48
+ }
49
+ }
50
+ ```
51
+
52
+ Include 2-16 continuation entries. Every entry must repeat the winner path and
53
+ hash; never substitute a corpus image, composite, prior continuation, or
54
+ predecessor. The default continuation batch uses `inspiration`, because the
55
+ winner supplies a visual system rather than a first-viewport composition to
56
+ clone. If an intentional app-state edit must preserve exact structure, record
57
+ it in a separate `preserve-structure` batch. Preserve rejected generations
58
+ with a visible reason and null conversion fields. For `ordered-package`,
59
+ record the package evidence and keep continuous-page order exact. Never store
60
+ credentials or invent IDs or hashes.
@@ -5,10 +5,27 @@ prompt text so a resumed run cannot silently select different evidence.
5
5
 
6
6
  ```json
7
7
  {
8
- "version": 3,
8
+ "version": 5,
9
9
  "createdAt": "<ISO-8601>",
10
10
  "requestSummary": "<concise implementation contract>",
11
11
  "viewportMode": "<first-viewport|primary-state|single-screen|complete-simple-surface>",
12
+ "designMode": "<new-interface|exploratory-redesign|structure-preserving-reskin>",
13
+ "redesignSource": {
14
+ "originalPath": "<absolute source path, or null when absent>",
15
+ "originalSha256": "<source sha256, or null when absent>",
16
+ "preparedPath": "<absolute crop or original path, or null when absent>",
17
+ "preparedSha256": "<prepared sha256, or null when absent>",
18
+ "preparation": "<none|first-viewport-crop>"
19
+ },
20
+ "contract": {
21
+ "preserve": ["<specific constraint>"],
22
+ "change": ["<specific intended change>"]
23
+ },
24
+ "referencePolicy": {
25
+ "retrieval": "<text-only|text-and-redesign-source>",
26
+ "generation": "<one-corpus-image-per-candidate|redesign-source-only>",
27
+ "imagesPerGeneration": 1
28
+ },
12
29
  "corpus": {
13
30
  "query": "<exact query>",
14
31
  "idempotencyKey": "<manifest value>",
@@ -28,6 +45,7 @@ prompt text so a resumed run cannot silently select different evidence.
28
45
  ]
29
46
  },
30
47
  "generation": {
48
+ "referenceMode": "<inspiration|preserve-structure>",
31
49
  "manifestPath": "<absolute generation manifest path>",
32
50
  "manifestSha256": "<sha256>",
33
51
  "batchAttemptPath": "<absolute batch attempt path>"
@@ -39,9 +57,11 @@ prompt text so a resumed run cannot silently select different evidence.
39
57
  "sha256": "<sha256>",
40
58
  "prompt": "<exact prompt>",
41
59
  "promptSha256": "<sha256>",
42
- "referenceId": "<id-1>",
43
- "referencePath": "<absolute path>",
44
- "referenceSha256": "<sha256>",
60
+ "directionReferenceId": "<paired corpus id-1>",
61
+ "direction": "<short visibly grounded text direction>",
62
+ "generationReferencePath": "<paired corpus path or redesign-source path>",
63
+ "generationReferenceSha256": "<sha256>",
64
+ "referenceMode": "<inspiration|preserve-structure>",
45
65
  "provider": "<codex|openai>",
46
66
  "idempotencyKey": "<stable key>",
47
67
  "providerIdempotencyEnforced": false,
@@ -60,3 +80,13 @@ from the batch and candidate attempt files. Never store credentials or invent
60
80
  IDs, metrics, or provider guarantees. The winner has no rejection reasons;
61
81
  every other candidate has at least one specific visible reason. Set
62
82
  `providerIdempotencyEnforced` only to the recorded CLI value.
83
+
84
+ For `new-interface`, use null redesign-source paths/hashes, `text-only` retrieval, and one
85
+ paired corpus image per generation. For `exploratory-redesign`, record the
86
+ original and prepared source for retrieval but still use one paired corpus
87
+ image per generation. For `structure-preserving-reskin`, use the prepared
88
+ redesign source as the sole generation
89
+ image for all four candidates; each paired corpus image is represented only by
90
+ its short textual `direction`. Never attach the redesign source and a corpus
91
+ image to the same generation. Use `inspiration` reference mode for the first two
92
+ cases and `preserve-structure` for the last.