@guiho/mirror 3.1.2 → 3.2.1

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 (42) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/DOCS.md +129 -6
  3. package/README.md +8 -5
  4. package/jsr.json +1 -1
  5. package/library/adapters.d.ts +4 -0
  6. package/library/adapters.d.ts.map +1 -1
  7. package/library/adapters.js +8 -1
  8. package/library/agents.d.ts +3 -1
  9. package/library/agents.d.ts.map +1 -1
  10. package/library/agents.js +14 -2
  11. package/library/cli.d.ts.map +1 -1
  12. package/library/cli.js +87 -20
  13. package/library/config.d.ts +5 -1
  14. package/library/config.d.ts.map +1 -1
  15. package/library/config.js +138 -89
  16. package/library/executor.d.ts +2 -2
  17. package/library/executor.d.ts.map +1 -1
  18. package/library/executor.js +27 -13
  19. package/library/flags.d.ts.map +1 -1
  20. package/library/flags.js +11 -1
  21. package/library/guiho-mirror.d.ts +7 -4
  22. package/library/guiho-mirror.d.ts.map +1 -1
  23. package/library/guiho-mirror.js +6 -3
  24. package/library/hooks.d.ts +14 -0
  25. package/library/hooks.d.ts.map +1 -0
  26. package/library/hooks.js +122 -0
  27. package/library/init.d.ts +12 -0
  28. package/library/init.d.ts.map +1 -0
  29. package/library/init.js +100 -0
  30. package/library/plan.d.ts.map +1 -1
  31. package/library/plan.js +9 -5
  32. package/library/reporter.d.ts +2 -1
  33. package/library/reporter.d.ts.map +1 -1
  34. package/library/reporter.js +31 -2
  35. package/library/schema.d.ts +164 -0
  36. package/library/schema.d.ts.map +1 -0
  37. package/library/schema.js +152 -0
  38. package/library/types.d.ts +50 -0
  39. package/library/types.d.ts.map +1 -1
  40. package/package.json +2 -1
  41. package/schema/mirror.config.schema.json +379 -0
  42. package/skills/guiho-as-mirror/SKILL.md +13 -7
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ import { createInterface } from 'node:readline/promises';
5
+ import { basename } from 'node:path';
6
+ const adapterValues = new Set(['package.json', 'jsr.json', 'git']);
7
+ export const parseAdapterList = (value) => {
8
+ const values = value
9
+ .split(',')
10
+ .map((item) => item.trim())
11
+ .filter(Boolean)
12
+ .filter((item) => adapterValues.has(item));
13
+ return [...new Set(values)];
14
+ };
15
+ const parsePathList = (value) => value
16
+ .split(',')
17
+ .map((item) => item.trim())
18
+ .filter(Boolean);
19
+ export const resolveInitAnswers = async (flags, cwd, prompter) => {
20
+ const source = flags.source ?? (await askAdapter(prompter, 'Version source (package.json, jsr.json, git)', 'package.json'));
21
+ const output = flags.output ?? (await askAdapterList(prompter, 'Version outputs (comma separated)', ['package.json', 'git']));
22
+ const usesPackage = source === 'package.json' || output.includes('package.json');
23
+ const usesJsr = source === 'jsr.json' || output.includes('jsr.json');
24
+ const usesGit = source === 'git' || output.includes('git');
25
+ const hasFileOutput = output.includes('package.json') || output.includes('jsr.json');
26
+ const packagePath = usesPackage
27
+ ? flags.packagePath ?? (prompter ? await prompter.text('package.json path', 'package.json') : 'package.json')
28
+ : 'package.json';
29
+ const auxiliaryPaths = usesPackage
30
+ ? flags.auxiliaryPaths ??
31
+ (prompter ? parsePathList(await prompter.text('Auxiliary package.json paths (comma separated, blank for none)', '')) : [])
32
+ : [];
33
+ const jsrPath = usesJsr
34
+ ? flags.jsrPath ?? (prompter ? await prompter.text('jsr.json path', 'jsr.json') : 'jsr.json')
35
+ : 'jsr.json';
36
+ const name = flags.name ?? (source === 'git' ? basename(cwd) : undefined);
37
+ const nameAvailable = source === 'package.json' || source === 'jsr.json' || Boolean(name);
38
+ const defaultTagTemplate = nameAvailable ? '{name}@{version}' : 'v{version}';
39
+ const tagTemplate = usesGit
40
+ ? flags.tagTemplate ?? (prompter ? await prompter.text('Git tag template', defaultTagTemplate) : defaultTagTemplate)
41
+ : defaultTagTemplate;
42
+ const defaultCommit = usesGit && hasFileOutput;
43
+ const commit = flags.commit ?? (usesGit && prompter ? await prompter.confirm('Create release commits?', defaultCommit) : defaultCommit);
44
+ const push = flags.push ?? (usesGit && prompter ? await prompter.confirm('Push release refs?', false) : false);
45
+ const prereleaseId = flags.prereleaseId ?? '';
46
+ return {
47
+ source,
48
+ output,
49
+ packagePath,
50
+ auxiliaryPaths,
51
+ jsrPath,
52
+ name,
53
+ prereleaseId,
54
+ tagTemplate,
55
+ commit,
56
+ push,
57
+ };
58
+ };
59
+ export const isInteractiveInit = (options) => Boolean(process.stdin.isTTY) && options.yes !== true && options.nonInteractive !== true;
60
+ export const createReadlineInitPrompter = () => {
61
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
62
+ return {
63
+ async text(question, defaultValue) {
64
+ const suffix = defaultValue.length > 0 ? ` [${defaultValue}]` : ' [none]';
65
+ const answer = (await rl.question(`${question}${suffix}: `)).trim();
66
+ return answer.length > 0 ? answer : defaultValue;
67
+ },
68
+ async confirm(question, defaultValue) {
69
+ const suffix = defaultValue ? ' [Y/n]' : ' [y/N]';
70
+ const answer = (await rl.question(`${question}${suffix}: `)).trim().toLowerCase();
71
+ if (answer.length === 0)
72
+ return defaultValue;
73
+ return answer === 'y' || answer === 'yes';
74
+ },
75
+ close() {
76
+ rl.close();
77
+ },
78
+ };
79
+ };
80
+ const askAdapter = async (prompter, question, defaultValue) => {
81
+ if (!prompter)
82
+ return defaultValue;
83
+ for (let attempt = 0; attempt < 3; attempt += 1) {
84
+ const answer = (await prompter.text(question, defaultValue)).trim();
85
+ if (adapterValues.has(answer))
86
+ return answer;
87
+ }
88
+ return defaultValue;
89
+ };
90
+ const askAdapterList = async (prompter, question, defaultValue) => {
91
+ if (!prompter)
92
+ return defaultValue;
93
+ for (let attempt = 0; attempt < 3; attempt += 1) {
94
+ const answer = await prompter.text(question, defaultValue.join(', '));
95
+ const parsed = parseAdapterList(answer);
96
+ if (parsed.length > 0)
97
+ return parsed;
98
+ }
99
+ return defaultValue;
100
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../source/plan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAA2B,MAAM,YAAY,CAAA;AAM5G,eAAO,MAAM,oBAAoB,GAAU,UAAS,gBAAqB,KAAG,OAAO,CAAC,YAAY,CAW/F,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,QAAQ,MAAM,EAAE,UAAS,gBAAqB,KAAG,OAAO,CAAC,iBAAiB,CA4DhH,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY,aAO1D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,cAAc,MAAM,WAAgE,CAAA;AAElI,eAAO,MAAM,kBAAkB,GAAI,MAAM,iBAAiB,EAAE,MAAM,MAAM,WAAoC,CAAA"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../source/plan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAA2B,MAAM,YAAY,CAAA;AAM5G,eAAO,MAAM,oBAAoB,GAAU,UAAS,gBAAqB,KAAG,OAAO,CAAC,YAAY,CAW/F,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,QAAQ,MAAM,EAAE,UAAS,gBAAqB,KAAG,OAAO,CAAC,iBAAiB,CA8DhH,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY,aAU1D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,cAAc,MAAM,WAAgE,CAAA;AAElI,eAAO,MAAM,kBAAkB,GAAI,MAAM,iBAAiB,EAAE,MAAM,MAAM,WAAoC,CAAA"}
package/library/plan.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { relative } from 'node:path';
5
5
  import { MirrorError } from './errors.js';
6
6
  import { loadMirrorConfig, relativeFromCwd, resolveMirrorPath } from './config.js';
7
- import { ensureAdapterFiles, readCurrentVersion, renderGitTag, resolveProjectName } from './adapters.js';
7
+ import { ensureAdapterFiles, readCurrentVersion, readJsrVersionFile, readPackageVersionFile, renderGitTag, resolveProjectName } from './adapters.js';
8
8
  import { resolveNextVersion } from './version.js';
9
9
  export const validateMirrorConfig = async (options = {}) => {
10
10
  const config = await loadMirrorConfig(options);
@@ -25,11 +25,12 @@ export const buildVersionPlan = async (target, options = {}) => {
25
25
  const pushEnabled = config.git.push;
26
26
  const actions = [];
27
27
  for (const path of fileOutputPaths) {
28
+ const adapter = path === resolveMirrorPath(config.cwd, config.jsr.path) ? 'jsr.json' : 'package.json';
28
29
  actions.push({
29
30
  type: 'write-file',
30
- adapter: path.endsWith(config.package.path) ? 'package.json' : 'jsr.json',
31
+ adapter,
31
32
  path,
32
- currentVersion,
33
+ currentVersion: adapter === 'package.json' ? await readPackageVersionFile(path) : await readJsrVersionFile(path),
33
34
  nextVersion,
34
35
  });
35
36
  }
@@ -71,11 +72,14 @@ export const buildVersionPlan = async (target, options = {}) => {
71
72
  };
72
73
  export const resolveFileOutputPaths = (config) => {
73
74
  const paths = [];
74
- if (config.version.output.includes('package.json'))
75
+ if (config.version.output.includes('package.json')) {
75
76
  paths.push(resolveMirrorPath(config.cwd, config.package.path));
77
+ for (const path of config.package.auxiliaryPaths)
78
+ paths.push(resolveMirrorPath(config.cwd, path));
79
+ }
76
80
  if (config.version.output.includes('jsr.json'))
77
81
  paths.push(resolveMirrorPath(config.cwd, config.jsr.path));
78
- return paths;
82
+ return [...new Set(paths)];
79
83
  };
80
84
  export const releaseLabel = (version, projectName) => (projectName ? `${projectName}@${version}` : `v${version}`);
81
85
  export const planPathForDisplay = (plan, path) => relativeFromCwd(plan.cwd, path);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
- import type { MirrorAgentsInstructionsResult, MirrorConfig, MirrorExecutionResult, MirrorFormat, MirrorSkillInstallResult, MirrorVersionPlan } from './types.js';
4
+ import type { MirrorAgentsInstructionsResult, MirrorConfig, MirrorExecutionResult, MirrorFormat, MirrorHookResult, MirrorSkillInstallResult, MirrorVersionPlan } from './types.js';
5
5
  export declare const mirrorBanner: (configPath?: string) => string;
6
6
  export declare const reportValue: (value: unknown, format?: MirrorFormat) => string;
7
7
  export declare const reportConfig: (config: MirrorConfig, format?: MirrorFormat) => string;
@@ -11,4 +11,5 @@ export declare const reportAgentsInstructions: (result: MirrorAgentsInstructions
11
11
  export declare const reportPlan: (plan: MirrorVersionPlan, format?: MirrorFormat) => string;
12
12
  export declare const reportExecution: (result: MirrorExecutionResult, format?: MirrorFormat) => string;
13
13
  export declare const reportExecutionSummary: (result: MirrorExecutionResult, format?: MirrorFormat) => string;
14
+ export declare const reportHookResults: (results: MirrorHookResult[]) => string;
14
15
  //# sourceMappingURL=reporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../source/reporter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAGnB,eAAO,MAAM,YAAY,GAAI,aAAa,MAAM,WAW/C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,EAAE,SAAQ,YAAqB,WAGxE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,SAAQ,YAAqB,WAmB/E,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAQ,YAAqB,WAwC/D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,QAAQ,wBAAwB,EAAE,SAAQ,YAAqB,WAWjG,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,QAAQ,8BAA8B,EAAE,SAAQ,YAAqB,WAS7G,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,MAAM,iBAAiB,EAAE,SAAQ,YAAqB,WAyBhF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,qBAAqB,EAAE,SAAQ,YAAqB,WAG3F,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,QAAQ,qBAAqB,EAAE,SAAQ,YAAqB,WAgBlG,CAAA"}
1
+ {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../source/reporter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAInB,eAAO,MAAM,YAAY,GAAI,aAAa,MAAM,WAW/C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,EAAE,SAAQ,YAAqB,WAGxE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,SAAQ,YAAqB,WAoB/E,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAQ,YAAqB,WAyD/D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,QAAQ,wBAAwB,EAAE,SAAQ,YAAqB,WAWjG,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,QAAQ,8BAA8B,EAAE,SAAQ,YAAqB,WAS7G,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,MAAM,iBAAiB,EAAE,SAAQ,YAAqB,WAyBhF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,qBAAqB,EAAE,SAAQ,YAAqB,WAK3F,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,QAAQ,qBAAqB,EAAE,SAAQ,YAAqB,WAkBlG,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,SAAS,gBAAgB,EAAE,WAG5D,CAAA"}
@@ -2,6 +2,7 @@
2
2
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
4
  import { configPathForDisplay, relativeFromCwd } from './config.js';
5
+ import { renderMirrorConfigJsonSchema } from './schema.js';
5
6
  export const mirrorBanner = (configPath) => {
6
7
  const noColor = process.env['NO_COLOR'] === '1';
7
8
  const title = noColor ? '🪞 GUIHO Mirror' : '\x1b[1;36m🪞 GUIHO Mirror\x1b[0m';
@@ -25,6 +26,7 @@ export const reportConfig = (config, format = 'text') => {
25
26
  `source: ${config.version.source}`,
26
27
  `output: ${config.version.output.join(', ')}`,
27
28
  `package: ${config.package.path}`,
29
+ `package_auxiliary: ${config.package.auxiliaryPaths.join(', ') || '(none)'}`,
28
30
  `jsr: ${config.jsr.path}`,
29
31
  `tag_template: ${config.git.tagTemplate}`,
30
32
  `commit: ${String(config.git.commit)}`,
@@ -39,7 +41,7 @@ export const reportConfig = (config, format = 'text') => {
39
41
  };
40
42
  export const reportConfigSchema = (format = 'text') => {
41
43
  if (format === 'json') {
42
- return `${JSON.stringify({ schema: 'See text output for full reference.' }, null, 2)}\n`;
44
+ return renderMirrorConfigJsonSchema();
43
45
  }
44
46
  return [
45
47
  'MIRROR CONFIGURATION SCHEMA (mirror.config.toml)',
@@ -58,6 +60,7 @@ export const reportConfigSchema = (format = 'text') => {
58
60
  '',
59
61
  ' [package]',
60
62
  ' path = "<path>" Optional. Path to package.json. Default: "package.json".',
63
+ ' auxiliary_paths = ["<path>"] Optional. Extra package.json files that mirror the main package version.',
61
64
  '',
62
65
  ' [jsr]',
63
66
  ' path = "<path>" Optional. Path to jsr.json. Default: "jsr.json".',
@@ -75,6 +78,22 @@ export const reportConfigSchema = (format = 'text') => {
75
78
  ' auto_agents_md = true | false Optional. Insert Mirror guidance into AGENTS.md when present. Default: true.',
76
79
  ' auto_skill_install = true | false Optional. Install guiho-as-mirror globally when missing. Default: true.',
77
80
  '',
81
+ ' [hooks]',
82
+ ' before_everything = "<command>" Optional. Shell command(s) before any release work.',
83
+ ' after_everything = "<command>" Optional. Shell command(s) after all release work (always runs).',
84
+ ' before_plan = "<command>" Optional. Shell command(s) before building the release plan.',
85
+ ' after_plan = "<command>" Optional. Shell command(s) after the plan is built.',
86
+ ' before_apply = "<command>" Optional. Shell command(s) before executing the plan.',
87
+ ' after_apply = "<command>" Optional. Shell command(s) after plan execution (always runs).',
88
+ ' before_write = "<command>" Optional. Shell command(s) before writing version files.',
89
+ ' after_write = "<command>" Optional. Shell command(s) after writing version files.',
90
+ ' before_commit = "<command>" Optional. Shell command(s) before creating a release commit.',
91
+ ' after_commit = "<command>" Optional. Shell command(s) after creating a release commit.',
92
+ ' before_tag = "<command>" Optional. Shell command(s) before creating a release tag.',
93
+ ' after_tag = "<command>" Optional. Shell command(s) after creating a release tag.',
94
+ ' before_push = "<command>" Optional. Shell command(s) before pushing release refs.',
95
+ ' after_push = "<command>" Optional. Shell command(s) after pushing release refs.',
96
+ '',
78
97
  ].join('\n');
79
98
  };
80
99
  export const reportSkillInstall = (result, format = 'text') => {
@@ -132,7 +151,10 @@ export const reportPlan = (plan, format = 'text') => {
132
151
  export const reportExecution = (result, format = 'text') => {
133
152
  if (format === 'json')
134
153
  return `${JSON.stringify(result, null, 2)}\n`;
135
- return `${reportPlan(result.plan, 'text')}applied: ${String(result.applied)}\ndry_run: ${String(result.dryRun)}\n`;
154
+ let out = `${reportPlan(result.plan, 'text')}applied: ${String(result.applied)}\ndry_run: ${String(result.dryRun)}\n`;
155
+ if (result.hookResults && result.hookResults.length > 0)
156
+ out += reportHookResults(result.hookResults);
157
+ return out;
136
158
  };
137
159
  export const reportExecutionSummary = (result, format = 'text') => {
138
160
  if (format === 'json')
@@ -149,5 +171,12 @@ export const reportExecutionSummary = (result, format = 'text') => {
149
171
  lines.push(`files: ${files}`);
150
172
  if (result.plan.gitTag)
151
173
  lines.push(`tag: ${result.plan.gitTag}`);
174
+ let out = `${lines.join('\n')}\n`;
175
+ if (result.hookResults && result.hookResults.length > 0)
176
+ out += reportHookResults(result.hookResults);
177
+ return out;
178
+ };
179
+ export const reportHookResults = (results) => {
180
+ const lines = results.map((r) => `hooks: ${r.name} ${r.status}${r.exitCode ? ` (exit ${r.exitCode})` : ''}`);
152
181
  return `${lines.join('\n')}\n`;
153
182
  };
@@ -0,0 +1,164 @@
1
+ /**
2
+ * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ export declare const mirrorConfigSchemaReference = "./node_modules/@guiho/mirror/schema/mirror.config.schema.json";
5
+ export declare const mirrorConfigJsonSchema: {
6
+ readonly $schema: "http://json-schema.org/draft-07/schema#";
7
+ readonly $id: "https://guiho.co/schema/mirror.config.schema.json";
8
+ readonly title: "GUIHO Mirror Configuration";
9
+ readonly description: "Configuration schema for mirror.config.toml.";
10
+ readonly type: "object";
11
+ readonly required: readonly ["schema", "version"];
12
+ readonly additionalProperties: false;
13
+ readonly properties: {
14
+ readonly schema: {
15
+ readonly const: 1;
16
+ readonly description: "Configuration schema version. Must be 1.";
17
+ };
18
+ readonly project: {
19
+ readonly type: "object";
20
+ readonly additionalProperties: false;
21
+ readonly properties: {
22
+ readonly name: {
23
+ readonly type: "string";
24
+ readonly description: "Explicit project name.";
25
+ };
26
+ readonly name_source: {
27
+ readonly enum: readonly ["package.json", "jsr.json"];
28
+ readonly description: "Adapter used to read the project name.";
29
+ };
30
+ };
31
+ };
32
+ readonly version: {
33
+ readonly type: "object";
34
+ readonly additionalProperties: false;
35
+ readonly required: readonly ["source", "output"];
36
+ readonly properties: {
37
+ readonly scheme: {
38
+ readonly const: "semver";
39
+ readonly description: "Versioning scheme. Only \"semver\" is supported.";
40
+ };
41
+ readonly source: {
42
+ readonly enum: readonly ["package.json", "jsr.json", "git"];
43
+ readonly description: "Adapter Mirror reads the current version from.";
44
+ };
45
+ readonly output: {
46
+ readonly type: "array";
47
+ readonly minItems: 1;
48
+ readonly items: {
49
+ readonly enum: readonly ["package.json", "jsr.json", "git"];
50
+ };
51
+ readonly description: "Adapters Mirror writes the next version to.";
52
+ };
53
+ readonly prerelease_id: {
54
+ readonly type: "string";
55
+ readonly description: "Default prerelease identifier, for example \"alpha\".";
56
+ };
57
+ };
58
+ };
59
+ readonly package: {
60
+ readonly type: "object";
61
+ readonly additionalProperties: false;
62
+ readonly properties: {
63
+ readonly path: {
64
+ readonly type: "string";
65
+ readonly description: "Path to the main package.json.";
66
+ };
67
+ readonly auxiliary_paths: {
68
+ readonly type: "array";
69
+ readonly items: {
70
+ readonly type: "string";
71
+ };
72
+ readonly description: "Extra package.json files that mirror the main package version.";
73
+ };
74
+ };
75
+ };
76
+ readonly jsr: {
77
+ readonly type: "object";
78
+ readonly additionalProperties: false;
79
+ readonly properties: {
80
+ readonly path: {
81
+ readonly type: "string";
82
+ readonly description: "Path to jsr.json.";
83
+ };
84
+ };
85
+ };
86
+ readonly git: {
87
+ readonly type: "object";
88
+ readonly additionalProperties: false;
89
+ readonly properties: {
90
+ readonly tag_template: {
91
+ readonly enum: readonly ["v{version}", "{name}@{version}", "{name}/v{version}"];
92
+ readonly description: "Git tag format.";
93
+ };
94
+ readonly commit: {
95
+ readonly type: "boolean";
96
+ readonly description: "Create release commits.";
97
+ };
98
+ readonly push: {
99
+ readonly type: "boolean";
100
+ readonly description: "Push release refs.";
101
+ };
102
+ readonly allow_dirty: {
103
+ readonly type: "boolean";
104
+ readonly description: "Allow release in a dirty Git worktree.";
105
+ };
106
+ };
107
+ };
108
+ readonly agents: {
109
+ readonly type: "object";
110
+ readonly additionalProperties: false;
111
+ readonly properties: {
112
+ readonly write_changelog: {
113
+ readonly type: "boolean";
114
+ readonly description: "Tell agents whether changelog edits are allowed.";
115
+ };
116
+ readonly changelog_path: {
117
+ readonly type: "string";
118
+ readonly description: "Changelog file path for agents.";
119
+ };
120
+ readonly auto_agents_md: {
121
+ readonly type: "boolean";
122
+ readonly description: "Insert Mirror guidance into AGENTS.md when present.";
123
+ };
124
+ readonly auto_skill_install: {
125
+ readonly type: "boolean";
126
+ readonly description: "Install guiho-as-mirror globally when missing.";
127
+ };
128
+ };
129
+ };
130
+ readonly hooks: {
131
+ readonly type: "object";
132
+ readonly description: "Lifecycle hook commands that run at defined points during version apply.";
133
+ readonly additionalProperties: {
134
+ readonly oneOf: readonly [{
135
+ readonly type: "string";
136
+ readonly description: "A single shell command.";
137
+ }, {
138
+ readonly type: "array";
139
+ readonly items: {
140
+ readonly type: "string";
141
+ };
142
+ readonly description: "Multiple shell commands run sequentially.";
143
+ }];
144
+ };
145
+ readonly properties: {
146
+ [k: string]: {
147
+ oneOf: ({
148
+ type: string;
149
+ description: string;
150
+ items?: undefined;
151
+ } | {
152
+ type: string;
153
+ items: {
154
+ type: string;
155
+ };
156
+ description: string;
157
+ })[];
158
+ };
159
+ };
160
+ };
161
+ };
162
+ };
163
+ export declare const renderMirrorConfigJsonSchema: () => string;
164
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../source/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,2BAA2B,kEAAkE,CAAA;AAE1G,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJzB,CAAA;AAEV,eAAO,MAAM,4BAA4B,cAA+D,CAAA"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ export const mirrorConfigSchemaReference = './node_modules/@guiho/mirror/schema/mirror.config.schema.json';
5
+ export const mirrorConfigJsonSchema = {
6
+ $schema: 'http://json-schema.org/draft-07/schema#',
7
+ $id: 'https://guiho.co/schema/mirror.config.schema.json',
8
+ title: 'GUIHO Mirror Configuration',
9
+ description: 'Configuration schema for mirror.config.toml.',
10
+ type: 'object',
11
+ required: ['schema', 'version'],
12
+ additionalProperties: false,
13
+ properties: {
14
+ schema: {
15
+ const: 1,
16
+ description: 'Configuration schema version. Must be 1.',
17
+ },
18
+ project: {
19
+ type: 'object',
20
+ additionalProperties: false,
21
+ properties: {
22
+ name: {
23
+ type: 'string',
24
+ description: 'Explicit project name.',
25
+ },
26
+ name_source: {
27
+ enum: ['package.json', 'jsr.json'],
28
+ description: 'Adapter used to read the project name.',
29
+ },
30
+ },
31
+ },
32
+ version: {
33
+ type: 'object',
34
+ additionalProperties: false,
35
+ required: ['source', 'output'],
36
+ properties: {
37
+ scheme: {
38
+ const: 'semver',
39
+ description: 'Versioning scheme. Only "semver" is supported.',
40
+ },
41
+ source: {
42
+ enum: ['package.json', 'jsr.json', 'git'],
43
+ description: 'Adapter Mirror reads the current version from.',
44
+ },
45
+ output: {
46
+ type: 'array',
47
+ minItems: 1,
48
+ items: { enum: ['package.json', 'jsr.json', 'git'] },
49
+ description: 'Adapters Mirror writes the next version to.',
50
+ },
51
+ prerelease_id: {
52
+ type: 'string',
53
+ description: 'Default prerelease identifier, for example "alpha".',
54
+ },
55
+ },
56
+ },
57
+ package: {
58
+ type: 'object',
59
+ additionalProperties: false,
60
+ properties: {
61
+ path: {
62
+ type: 'string',
63
+ description: 'Path to the main package.json.',
64
+ },
65
+ auxiliary_paths: {
66
+ type: 'array',
67
+ items: { type: 'string' },
68
+ description: 'Extra package.json files that mirror the main package version.',
69
+ },
70
+ },
71
+ },
72
+ jsr: {
73
+ type: 'object',
74
+ additionalProperties: false,
75
+ properties: {
76
+ path: {
77
+ type: 'string',
78
+ description: 'Path to jsr.json.',
79
+ },
80
+ },
81
+ },
82
+ git: {
83
+ type: 'object',
84
+ additionalProperties: false,
85
+ properties: {
86
+ tag_template: {
87
+ enum: ['v{version}', '{name}@{version}', '{name}/v{version}'],
88
+ description: 'Git tag format.',
89
+ },
90
+ commit: {
91
+ type: 'boolean',
92
+ description: 'Create release commits.',
93
+ },
94
+ push: {
95
+ type: 'boolean',
96
+ description: 'Push release refs.',
97
+ },
98
+ allow_dirty: {
99
+ type: 'boolean',
100
+ description: 'Allow release in a dirty Git worktree.',
101
+ },
102
+ },
103
+ },
104
+ agents: {
105
+ type: 'object',
106
+ additionalProperties: false,
107
+ properties: {
108
+ write_changelog: {
109
+ type: 'boolean',
110
+ description: 'Tell agents whether changelog edits are allowed.',
111
+ },
112
+ changelog_path: {
113
+ type: 'string',
114
+ description: 'Changelog file path for agents.',
115
+ },
116
+ auto_agents_md: {
117
+ type: 'boolean',
118
+ description: 'Insert Mirror guidance into AGENTS.md when present.',
119
+ },
120
+ auto_skill_install: {
121
+ type: 'boolean',
122
+ description: 'Install guiho-as-mirror globally when missing.',
123
+ },
124
+ },
125
+ },
126
+ hooks: {
127
+ type: 'object',
128
+ description: 'Lifecycle hook commands that run at defined points during version apply.',
129
+ additionalProperties: {
130
+ oneOf: [
131
+ { type: 'string', description: 'A single shell command.' },
132
+ { type: 'array', items: { type: 'string' }, description: 'Multiple shell commands run sequentially.' },
133
+ ],
134
+ },
135
+ properties: Object.fromEntries([
136
+ 'before_everything', 'after_everything',
137
+ 'before_plan', 'after_plan',
138
+ 'before_apply', 'after_apply',
139
+ 'before_write', 'after_write',
140
+ 'before_commit', 'after_commit',
141
+ 'before_tag', 'after_tag',
142
+ 'before_push', 'after_push',
143
+ ].map((key) => [key, {
144
+ oneOf: [
145
+ { type: 'string', description: `A single shell command to run at the ${key.replaceAll('_', ':')} lifecycle point.` },
146
+ { type: 'array', items: { type: 'string' }, description: `Multiple shell commands to run sequentially at the ${key.replaceAll('_', ':')} lifecycle point.` },
147
+ ],
148
+ }])),
149
+ },
150
+ },
151
+ };
152
+ export const renderMirrorConfigJsonSchema = () => `${JSON.stringify(mirrorConfigJsonSchema, null, 2)}\n`;