@guiho/runx 0.2.7 → 0.4.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 (86) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/DOCS.md +127 -128
  3. package/README.md +56 -75
  4. package/devops/build-binaries.ts +44 -62
  5. package/devops/devops.xdocs.md +8 -5
  6. package/devops/install.ps1 +182 -152
  7. package/devops/install.sh +197 -262
  8. package/devops/installers.spec.ts +31 -0
  9. package/devops/verify-release-assets.ts +17 -0
  10. package/docs/docs.xdocs.md +3 -1
  11. package/docs/plans/plans.xdocs.md +7 -0
  12. package/docs/plans/rfc-0034-cli-compliance-migration.md +586 -0
  13. package/docs/plans/upgrade-reliability-implementation.md +95 -0
  14. package/docs/reviews/implementation/implementation.xdocs.md +2 -0
  15. package/docs/reviews/implementation/rfc-0034-cli-compliance-migration-review.md +69 -0
  16. package/docs/reviews/plans/plans.xdocs.md +6 -0
  17. package/docs/reviews/plans/rfc-0034-cli-compliance-migration-review.md +80 -0
  18. package/docs/reviews/plans/upgrade-reliability-implementation-review.md +65 -0
  19. package/docs/superpowers/specs/2026-07-15-upgrade-reliability-design.md +662 -0
  20. package/docs/superpowers/specs/specs.xdocs.md +24 -0
  21. package/docs/superpowers/superpowers.xdocs.md +21 -0
  22. package/docs/todo/rfc-0034-cli-compliance-migration-implementation.md +77 -0
  23. package/docs/todo/rfc-0034-cli-compliance-migration.md +152 -0
  24. package/docs/todo/todo.xdocs.md +6 -2
  25. package/docs/validation/rfc-0034-cli-compliance-migration.md +83 -0
  26. package/docs/validation/upgrade-reliability.md +124 -0
  27. package/docs/validation/validation.xdocs.md +5 -0
  28. package/library/agents.d.ts +29 -4
  29. package/library/agents.d.ts.map +1 -1
  30. package/library/agents.js +143 -41
  31. package/library/cli.d.ts.map +1 -1
  32. package/library/cli.js +311 -331
  33. package/library/configuration.d.ts +57 -0
  34. package/library/configuration.d.ts.map +1 -0
  35. package/library/configuration.js +111 -0
  36. package/library/embedded-resources.d.ts +6 -1
  37. package/library/embedded-resources.d.ts.map +1 -1
  38. package/library/embedded-resources.js +10 -4
  39. package/library/executor.d.ts +5 -1
  40. package/library/executor.d.ts.map +1 -1
  41. package/library/executor.js +10 -10
  42. package/library/help.d.ts +8 -4
  43. package/library/help.d.ts.map +1 -1
  44. package/library/help.js +70 -46
  45. package/library/init.d.ts +8 -27
  46. package/library/init.d.ts.map +1 -1
  47. package/library/init.js +37 -159
  48. package/library/manifest.d.ts +4 -43
  49. package/library/manifest.d.ts.map +1 -1
  50. package/library/manifest.js +4 -125
  51. package/library/path-utils.d.ts +13 -0
  52. package/library/path-utils.d.ts.map +1 -0
  53. package/library/path-utils.js +82 -0
  54. package/library/recovery.d.ts +7 -0
  55. package/library/recovery.d.ts.map +1 -0
  56. package/library/recovery.js +23 -0
  57. package/library/release-catalog.d.ts +32 -0
  58. package/library/release-catalog.d.ts.map +1 -0
  59. package/library/release-catalog.js +124 -0
  60. package/library/self-management.d.ts +24 -4
  61. package/library/self-management.d.ts.map +1 -1
  62. package/library/self-management.js +279 -99
  63. package/library/storage.d.ts +13 -0
  64. package/library/storage.d.ts.map +1 -0
  65. package/library/storage.js +38 -0
  66. package/library/types.d.ts +11 -16
  67. package/library/types.d.ts.map +1 -1
  68. package/library/types.js +3 -0
  69. package/library/update-cache.d.ts +21 -0
  70. package/library/update-cache.d.ts.map +1 -0
  71. package/library/update-cache.js +68 -0
  72. package/library/upgrade-reporting.d.ts +11 -0
  73. package/library/upgrade-reporting.d.ts.map +1 -0
  74. package/library/upgrade-reporting.js +67 -0
  75. package/library/upgrade-types.d.ts +72 -0
  76. package/library/upgrade-types.d.ts.map +1 -0
  77. package/library/upgrade-types.js +3 -0
  78. package/package.json +6 -3
  79. package/scripts/runx-bin.mjs +49 -0
  80. package/scripts/runx-bin.spec.ts +62 -0
  81. package/scripts/scripts.xdocs.md +3 -3
  82. package/skills/guiho-s-runx/SKILL.md +64 -59
  83. package/skills/guiho-s-runx/guiho-s-runx.xdocs.md +7 -4
  84. package/skills/skills.xdocs.md +1 -1
  85. package/docs/todo/implement-runx-alpha.md +0 -36
  86. package/scripts/runx-bin.ts +0 -24
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ import type { Static } from '@sinclair/typebox';
5
+ export { commandSchema, findConfiguration, manifestSchema, readManifest, resolveCommand, };
6
+ export type { RunXCommand, RunXManifest, };
7
+ declare const commandSchema: import("@sinclair/typebox").TObject<{
8
+ uid: import("@sinclair/typebox").TString;
9
+ id: import("@sinclair/typebox").TString;
10
+ group: import("@sinclair/typebox").TString;
11
+ summary: import("@sinclair/typebox").TString;
12
+ description: import("@sinclair/typebox").TString;
13
+ command: import("@sinclair/typebox").TString;
14
+ cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
15
+ shell: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"bash">, import("@sinclair/typebox").TLiteral<"sh">, import("@sinclair/typebox").TLiteral<"powershell">, import("@sinclair/typebox").TLiteral<"cmd">]>>;
16
+ tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
17
+ confirm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"never">, import("@sinclair/typebox").TLiteral<"always">]>>;
18
+ }>;
19
+ declare const manifestSchema: import("@sinclair/typebox").TObject<{
20
+ version: import("@sinclair/typebox").TString;
21
+ project: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
22
+ name: import("@sinclair/typebox").TString;
23
+ }>>;
24
+ scripts: import("@sinclair/typebox").TObject<{
25
+ directory: import("@sinclair/typebox").TString;
26
+ }>;
27
+ groups: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
28
+ summary: import("@sinclair/typebox").TString;
29
+ }>>;
30
+ commands: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
31
+ uid: import("@sinclair/typebox").TString;
32
+ id: import("@sinclair/typebox").TString;
33
+ group: import("@sinclair/typebox").TString;
34
+ summary: import("@sinclair/typebox").TString;
35
+ description: import("@sinclair/typebox").TString;
36
+ command: import("@sinclair/typebox").TString;
37
+ cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
38
+ shell: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"bash">, import("@sinclair/typebox").TLiteral<"sh">, import("@sinclair/typebox").TLiteral<"powershell">, import("@sinclair/typebox").TLiteral<"cmd">]>>;
39
+ tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
40
+ confirm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"never">, import("@sinclair/typebox").TLiteral<"always">]>>;
41
+ }>>;
42
+ }>;
43
+ type RunXCommand = Static<typeof commandSchema>;
44
+ type RunXManifest = Static<typeof manifestSchema>;
45
+ type ResolvedCommand = RunXCommand & {
46
+ index: number;
47
+ selector: string;
48
+ manifestPath: string;
49
+ cwd: string;
50
+ };
51
+ declare function findConfiguration(cwd: string, explicitConfig?: string): Promise<string>;
52
+ declare function readManifest(cwd: string, explicitConfig?: string): Promise<{
53
+ manifest: RunXManifest;
54
+ path: string;
55
+ }>;
56
+ declare function resolveCommand(manifest: RunXManifest, manifestPath: string, selector: string): ResolvedCommand;
57
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../source/configuration.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,CAAA;AACD,YAAY,EACV,WAAW,EACX,YAAY,GACb,CAAA;AAKD,QAAA,MAAM,aAAa;;;;;;;;;;;EAiBgB,CAAA;AAEnC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;EAMe,CAAA;AAEnC,KAAK,WAAW,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAA;AAC/C,KAAK,YAAY,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAEjD,KAAK,eAAe,GAAG,WAAW,GAAG;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,iBAAe,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWtF;AAED,iBAAe,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBnH;AAED,iBAAS,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAevG"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ import { Type } from '@sinclair/typebox';
5
+ import { Value } from '@sinclair/typebox/value';
6
+ import { RunXError } from './errors.js';
7
+ import { directoryName, homeDirectory, isAbsolutePath, joinPath, relativePath, resolvePath } from './path-utils.js';
8
+ export { commandSchema, findConfiguration, manifestSchema, readManifest, resolveCommand, };
9
+ const identifier = '^[a-z][a-z0-9-]*$';
10
+ const semver = '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$';
11
+ const commandSchema = Type.Object({
12
+ uid: Type.String({ pattern: identifier }),
13
+ id: Type.String({ pattern: identifier }),
14
+ group: Type.String({ pattern: identifier }),
15
+ summary: Type.String({ minLength: 1 }),
16
+ description: Type.String({ minLength: 1 }),
17
+ command: Type.String({ minLength: 1 }),
18
+ cwd: Type.Optional(Type.String({ minLength: 1 })),
19
+ shell: Type.Optional(Type.Union([
20
+ Type.Literal('auto'),
21
+ Type.Literal('bash'),
22
+ Type.Literal('sh'),
23
+ Type.Literal('powershell'),
24
+ Type.Literal('cmd'),
25
+ ])),
26
+ tags: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
27
+ confirm: Type.Optional(Type.Union([Type.Literal('never'), Type.Literal('always')])),
28
+ }, { additionalProperties: false });
29
+ const manifestSchema = Type.Object({
30
+ version: Type.String({ pattern: semver }),
31
+ project: Type.Optional(Type.Object({ name: Type.String({ minLength: 1 }) }, { additionalProperties: false })),
32
+ scripts: Type.Object({ directory: Type.String({ minLength: 1 }) }, { additionalProperties: false }),
33
+ groups: Type.Record(Type.String({ pattern: identifier }), Type.Object({ summary: Type.String({ minLength: 1 }) }, { additionalProperties: false })),
34
+ commands: Type.Array(commandSchema),
35
+ }, { additionalProperties: false });
36
+ async function findConfiguration(cwd, explicitConfig) {
37
+ const candidates = explicitConfig
38
+ ? [resolvePath(cwd, explicitConfig)]
39
+ : [joinPath(resolvePath(cwd), 'runx.yaml'), joinPath(homeDirectory(), '.guiho', 'runx', 'runx.yaml')];
40
+ for (const candidate of candidates)
41
+ if (await Bun.file(candidate).exists())
42
+ return candidate;
43
+ throw new RunXError(explicitConfig
44
+ ? `Configuration file not found: ${candidates[0]}`
45
+ : `No runx.yaml found in ${resolvePath(cwd)} or ${joinPath(homeDirectory(), '.guiho', 'runx', 'runx.yaml')}.`, 3);
46
+ }
47
+ async function readManifest(cwd, explicitConfig) {
48
+ const path = await findConfiguration(cwd, explicitConfig);
49
+ let input;
50
+ try {
51
+ input = Bun.YAML.parse(await Bun.file(path).text());
52
+ }
53
+ catch (error) {
54
+ throw new RunXError(`Invalid YAML in ${path}: ${error instanceof Error ? error.message : 'Unknown YAML parsing error.'}`, 3);
55
+ }
56
+ let parsed;
57
+ try {
58
+ parsed = Value.Decode(manifestSchema, input);
59
+ }
60
+ catch (error) {
61
+ throw new RunXError(`Invalid RunX configuration ${path}: ${error instanceof Error ? error.message : 'schema validation failed'}`, 3);
62
+ }
63
+ validateManifestSemantics(parsed, path);
64
+ return { manifest: parsed, path };
65
+ }
66
+ function resolveCommand(manifest, manifestPath, selector) {
67
+ let command = manifest.commands.find((entry) => entry.uid === selector);
68
+ if (!command && selector.includes('/'))
69
+ command = manifest.commands.find((entry) => `${entry.group}/${entry.id}` === selector);
70
+ if (!command && /^\d+$/.test(selector))
71
+ command = manifest.commands[Number.parseInt(selector, 10) - 1];
72
+ if (!command) {
73
+ const matches = manifest.commands.filter((entry) => entry.id === selector);
74
+ if (matches.length > 1)
75
+ throw new RunXError(`Ambiguous command ID "${selector}". Use a UID or group/id selector.`, 2);
76
+ command = matches[0];
77
+ }
78
+ if (!command)
79
+ throw new RunXError(`Unknown command selector: ${selector}`, 2);
80
+ const root = directoryName(manifestPath);
81
+ const commandCwd = resolvePath(root, command.cwd ?? '.');
82
+ const relative = relativePath(root, commandCwd);
83
+ if (isAbsolutePath(relative) || relative.startsWith('..'))
84
+ throw new RunXError(`Command ${command.uid} has a cwd outside the configuration directory.`, 3);
85
+ return { ...command, index: manifest.commands.indexOf(command) + 1, selector: `${command.group}/${command.id}`, manifestPath, cwd: commandCwd };
86
+ }
87
+ function validateManifestSemantics(manifest, path) {
88
+ if (manifest.version.split('.', 1)[0] !== '1')
89
+ throw new RunXError(`Unsupported RunX manifest version "${manifest.version}" in ${path}.`, 3);
90
+ if (!manifest.groups.public)
91
+ throw new RunXError(`RunX configuration ${path} must define the "public" group.`, 3);
92
+ const root = directoryName(path);
93
+ const scripts = resolvePath(root, manifest.scripts.directory);
94
+ const relative = relativePath(root, scripts);
95
+ if (relative === '.' || isAbsolutePath(relative) || relative.startsWith('..')) {
96
+ throw new RunXError(`Scripts directory must be a relative subdirectory in ${path}.`, 3);
97
+ }
98
+ const uids = new Set();
99
+ const selectors = new Set();
100
+ for (const command of manifest.commands) {
101
+ if (!manifest.groups[command.group])
102
+ throw new RunXError(`Command ${command.uid} references unknown group "${command.group}".`, 3);
103
+ if (uids.has(command.uid))
104
+ throw new RunXError(`Duplicate command UID "${command.uid}".`, 3);
105
+ const selector = `${command.group}/${command.id}`;
106
+ if (selectors.has(selector))
107
+ throw new RunXError(`Duplicate command selector "${selector}".`, 3);
108
+ uids.add(command.uid);
109
+ selectors.add(selector);
110
+ }
111
+ }
@@ -1,7 +1,12 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ export { registerEmbeddedResources, };
1
5
  declare global {
2
6
  var __RUNX_EMBEDDED_RESOURCES__: {
3
7
  skill: string;
8
+ prompt: string;
4
9
  } | undefined;
5
10
  }
6
- export declare const registerEmbeddedResources: () => void;
11
+ declare function registerEmbeddedResources(): void;
7
12
  //# sourceMappingURL=embedded-resources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"embedded-resources.d.ts","sourceRoot":"","sources":["../source/embedded-resources.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,2BAA2B,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CAC/D;AAED,eAAO,MAAM,yBAAyB,QAAO,IAE5C,CAAA"}
1
+ {"version":3,"file":"embedded-resources.d.ts","sourceRoot":"","sources":["../source/embedded-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EACL,yBAAyB,GAC1B,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,2BAA2B,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CAC/E;AAED,iBAAS,yBAAyB,IAAI,IAAI,CAEzC"}
@@ -1,5 +1,11 @@
1
- // @ts-expect-error Bun text imports embed the bundled agent skill in native binaries.
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ // @ts-expect-error Bun text imports embed the bundled skill in native binaries.
2
5
  import skill from '../skills/guiho-s-runx/SKILL.md' with { type: 'text' };
3
- export const registerEmbeddedResources = () => {
4
- globalThis.__RUNX_EMBEDDED_RESOURCES__ = { skill };
5
- };
6
+ // @ts-expect-error Bun text imports embed the bundled instruction prompt in native binaries.
7
+ import prompt from '../prompts/guiho-i-runx.md' with { type: 'text' };
8
+ export { registerEmbeddedResources, };
9
+ function registerEmbeddedResources() {
10
+ globalThis.__RUNX_EMBEDDED_RESOURCES__ = { skill, prompt };
11
+ }
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
1
4
  import type { ResolvedCommand } from './types.js';
2
- export declare const runCommand: (command: ResolvedCommand) => Promise<number>;
5
+ export { runCommand, };
6
+ declare function runCommand(command: ResolvedCommand): Promise<number>;
3
7
  //# sourceMappingURL=executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../source/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,eAAO,MAAM,UAAU,YAAmB,eAAe,KAAG,OAAO,CAAC,MAAM,CAWzE,CAAA"}
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../source/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EACL,UAAU,GACX,CAAA;AAED,iBAAe,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAQnE"}
@@ -1,17 +1,17 @@
1
- import { existsSync } from 'node:fs';
2
- import { RunXError } from './errors.js';
3
- export const runCommand = async (command) => {
4
- if (!existsSync(command.cwd))
5
- throw new RunXError(`Command working directory does not exist: ${command.cwd}`);
6
- const process = Bun.spawn(shellArguments(command), {
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ export { runCommand, };
5
+ async function runCommand(command) {
6
+ const child = Bun.spawn(shellArguments(command), {
7
7
  cwd: command.cwd,
8
8
  stdin: 'inherit',
9
9
  stdout: 'inherit',
10
10
  stderr: 'inherit',
11
11
  });
12
- return process.exited;
13
- };
14
- const shellArguments = (command) => {
12
+ return child.exited;
13
+ }
14
+ function shellArguments(command) {
15
15
  switch (command.shell ?? 'auto') {
16
16
  case 'bash': return ['bash', '-lc', command.command];
17
17
  case 'sh': return ['sh', '-lc', command.command];
@@ -21,4 +21,4 @@ const shellArguments = (command) => {
21
21
  ? ['cmd.exe', '/d', '/s', '/c', command.command]
22
22
  : ['sh', '-lc', command.command];
23
23
  }
24
- };
24
+ }
package/library/help.d.ts CHANGED
@@ -1,5 +1,9 @@
1
- export declare const readVersion: () => string;
2
- export declare const showHome: () => string;
3
- export declare const showHelpTree: () => string;
4
- export declare const showHelpDocs: () => string;
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
4
+ import type { CommandDef } from 'citty';
5
+ export { readVersion, renderHelpDocs, renderHelpTree, };
6
+ declare function readVersion(): string;
7
+ declare function renderHelpTree(command: CommandDef<any>, depth?: number): string;
8
+ declare function renderHelpDocs(command: CommandDef<any>): string;
5
9
  //# sourceMappingURL=help.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../source/help.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAO,MAAiF,CAAA;AAEhH,eAAO,MAAM,QAAQ,QAAO,MAiB3B,CAAA;AAED,eAAO,MAAM,YAAY,QAAO,MAcpB,CAAA;AAEZ,eAAO,MAAM,YAAY,QAAO,MAW/B,CAAA"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../source/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GACf,CAAA;AAED,iBAAS,WAAW,IAAI,MAAM,CAE7B;AAED,iBAAS,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,SAA2B,GAAG,MAAM,CAI1F;AAuBD,iBAAS,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CA6BxD"}
package/library/help.js CHANGED
@@ -1,47 +1,71 @@
1
+ /**
2
+ * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
+ */
1
4
  import packageJson from '../package.json' with { type: 'json' };
2
- export const readVersion = () => typeof packageJson.version === 'string' ? packageJson.version : '0.0.0';
3
- export const showHome = () => `RunX ${readVersion()}
4
-
5
- A documented, local command catalog for runx.yaml manifests.
6
-
7
- Usage:
8
- runx init [--cwd <path>]
9
- runx list [--file <path>] [--format <text|json>]
10
- runx describe <selector>
11
- runx run <selector> [--dry-run] [--yes]
12
- runx r <selector> [--dry-run] [--yes]
13
- runx <selector>
14
-
15
- Start here:
16
- runx init Interactively create an empty runx.yaml catalog.
17
- runx list List every command in the nearest manifest.
18
- runx --help-tree Show the complete command tree.
19
- runx --help-docs Show manifest and agent documentation guidance.
20
- `;
21
- export const showHelpTree = () => [
22
- 'runx',
23
- '|- list',
24
- '|- describe <selector>',
25
- '|- run <selector>',
26
- '| `- alias: r',
27
- '|- check',
28
- '|- init',
29
- '|- agents',
30
- '| |- install <local|global>',
31
- '| `- instructions',
32
- '|- upgrade [check|list]',
33
- '`- uninstall',
34
- '',
35
- ].join('\n');
36
- export const showHelpDocs = () => `RunX documentation
37
-
38
- Manifest: runx.yaml, discovered from the current directory upward or selected with --file.
39
- Create an empty catalog with runx init. Its manifest uses SemVer 1.x, configures a scripts directory, and always includes the public group.
40
- Required command fields: uid, id, group, summary, description, command.
41
- Optional command fields: cwd, shell, tags, confirm.
42
-
43
- Selectors resolve in this order: UID, group/id, one-based index, then an unambiguous ID.
44
- Use UID values for automation. Use runx describe <selector> and runx run <selector> --dry-run before unfamiliar execution.
45
-
46
- Agent skill: runx agents install local installs guiho-s-runx under .agents/skills.
47
- `;
5
+ export { readVersion, renderHelpDocs, renderHelpTree, };
6
+ function readVersion() {
7
+ return typeof packageJson.version === 'string' ? packageJson.version : '0.0.0';
8
+ }
9
+ function renderHelpTree(command, depth = Number.POSITIVE_INFINITY) {
10
+ const lines = ['COMMAND TREE', '', commandMeta(command).name ?? 'runx'];
11
+ appendChildren(lines, command, '', depth);
12
+ return `${lines.join('\n')}\n`;
13
+ }
14
+ function appendChildren(lines, command, prefix, depth) {
15
+ if (depth <= 0)
16
+ return;
17
+ const subCommands = Object.entries(command.subCommands ?? {}).filter(([name, child]) => !name.startsWith('_') && !commandMeta(child).hidden);
18
+ const flags = Object.entries(command.args ?? {});
19
+ const visibleFlags = flags.filter(([, value]) => value.type !== 'positional');
20
+ const nodes = [
21
+ ...subCommands.map(([name, child]) => ({ label: name, description: commandMeta(child).description ?? '', child })),
22
+ ...visibleFlags.map(([name, value]) => ({
23
+ label: `--${name}${value.type === 'string' ? ` <${value.valueHint ?? 'value'}>` : ''}`,
24
+ description: value.description ?? '',
25
+ child: null,
26
+ })),
27
+ ];
28
+ const width = Math.max(0, ...nodes.map((node) => node.label.length));
29
+ nodes.forEach((node, index) => {
30
+ const last = index === nodes.length - 1;
31
+ lines.push(`${prefix}${last ? '└── ' : '├── '}${node.label.padEnd(width)}${node.description ? ` ${node.description}` : ''}`);
32
+ if (node.child)
33
+ appendChildren(lines, node.child, `${prefix}${last ? ' ' : '│ '}`, depth - 1);
34
+ });
35
+ }
36
+ function renderHelpDocs(command) {
37
+ const meta = commandMeta(command);
38
+ const name = meta.name ?? 'runx';
39
+ const description = meta.description ?? '';
40
+ const args = Object.entries(command.args ?? {});
41
+ const positionals = args.filter(([, value]) => value.type === 'positional');
42
+ const flags = args.filter(([, value]) => value.type !== 'positional');
43
+ const children = Object.entries(command.subCommands ?? {}).filter(([key, value]) => !key.startsWith('_') && !commandMeta(value).hidden);
44
+ const syntax = [
45
+ name,
46
+ ...positionals.map(([key]) => `<${key}>`),
47
+ children.length ? '<command>' : '',
48
+ flags.length ? '[options]' : '',
49
+ ].filter(Boolean).join(' ');
50
+ const lines = [`# ${name}`, '', description, '', '## Syntax', '', '```text', syntax, '```'];
51
+ if (positionals.length) {
52
+ lines.push('', '## Positionals', '');
53
+ for (const [key, value] of positionals)
54
+ lines.push(`- \`${key}\` — ${value.description ?? ''}`);
55
+ }
56
+ if (flags.length) {
57
+ lines.push('', '## Flags', '');
58
+ for (const [key, value] of flags)
59
+ lines.push(`- \`--${key}${value.type === 'string' ? ` <${value.valueHint ?? 'value'}>` : ''}\` — ${value.description ?? ''}`);
60
+ }
61
+ if (children.length) {
62
+ lines.push('', '## Subcommands', '');
63
+ for (const [key, value] of children)
64
+ lines.push(`- \`${key}\` — ${commandMeta(value).description ?? ''}`);
65
+ }
66
+ lines.push('', '## Examples', '', '```text', `${name} --help`, `${name} --help-tree`, `${name} --help-docs`, '```', '');
67
+ return lines.join('\n');
68
+ }
69
+ function commandMeta(command) {
70
+ return (command.meta ?? {});
71
+ }
package/library/init.d.ts CHANGED
@@ -2,36 +2,17 @@
2
2
  * @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
4
  import type { RunXManifest } from './types.js';
5
- export type RunXInitPrompter = {
6
- intro(title: string): void;
7
- text(options: {
8
- message: string;
9
- initialValue: string;
10
- validate: (value: string | undefined) => string | undefined;
11
- }): Promise<string | undefined>;
12
- confirm(options: {
13
- message: string;
14
- initialValue: boolean;
15
- }): Promise<boolean | undefined>;
16
- preview(manifest: string): void;
17
- cancel(message: string): void;
18
- outro(message: string): void;
19
- close?(): void;
20
- };
21
- export type RunXInitResult = {
22
- status: 'cancelled';
23
- } | {
5
+ export { createInitialManifest, initializeRunXManifest, renderInitialManifest, };
6
+ export type { RunXInitResult, };
7
+ type RunXInitResult = {
24
8
  status: 'created';
25
9
  path: string;
26
10
  manifest: RunXManifest;
27
11
  };
28
- type RunXInitOptions = {
12
+ declare function initializeRunXManifest(options: {
29
13
  cwd: string;
30
- isInteractive?: boolean;
31
- prompter?: RunXInitPrompter;
32
- };
33
- export declare const initializeRunXManifest: ({ cwd, isInteractive, prompter }: RunXInitOptions) => Promise<RunXInitResult>;
34
- export declare const createInitialManifest: (projectName: string, scriptsDirectory: string) => RunXManifest;
35
- export declare const renderInitialManifest: (manifest: RunXManifest) => string;
36
- export {};
14
+ config?: string;
15
+ }): Promise<RunXInitResult>;
16
+ declare function createInitialManifest(projectName: string, scriptsDirectory: string): RunXManifest;
17
+ declare function renderInitialManifest(manifest: RunXManifest): string;
37
18
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../source/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,IAAI,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAClJ,OAAO,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC1F,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,KAAK,CAAC,IAAI,IAAI,CAAA;CACf,CAAA;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAA;AAE/D,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B,CAAA;AAID,eAAO,MAAM,sBAAsB,qCAA4G,eAAe,KAAG,OAAO,CAAC,cAAc,CAmDtL,CAAA;AAED,eAAO,MAAM,qBAAqB,gBAAiB,MAAM,oBAAoB,MAAM,KAAG,YAQpF,CAAA;AAEF,eAAO,MAAM,qBAAqB,aAAc,YAAY,KAAG,MAenD,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../source/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,cAAc,GACf,CAAA;AAED,KAAK,cAAc,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAA;AAEjF,iBAAe,sBAAsB,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAOxG;AAED,iBAAS,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,YAAY,CAQ1F;AAED,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAiB7D"}