@guiho/runx 0.2.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/DOCS.md +128 -109
- package/README.md +58 -58
- package/devops/build-binaries.ts +44 -62
- package/devops/devops.xdocs.md +8 -5
- package/devops/install.ps1 +182 -152
- package/devops/install.sh +197 -262
- package/devops/installers.spec.ts +31 -0
- package/devops/verify-release-assets.ts +17 -0
- package/docs/decisions/decisions.xdocs.md +4 -0
- package/docs/decisions/interactive-init-manifest.md +187 -0
- package/docs/docs.xdocs.md +3 -1
- package/docs/plans/interactive-init-manifest.md +177 -0
- package/docs/plans/plans.xdocs.md +11 -0
- package/docs/plans/rfc-0034-cli-compliance-migration.md +586 -0
- package/docs/plans/upgrade-reliability-implementation.md +95 -0
- package/docs/reviews/implementation/implementation.xdocs.md +6 -0
- package/docs/reviews/implementation/interactive-init-manifest-review.md +69 -0
- package/docs/reviews/implementation/rfc-0034-cli-compliance-migration-review.md +59 -0
- package/docs/reviews/plans/interactive-init-manifest-review.md +82 -0
- package/docs/reviews/plans/plans.xdocs.md +10 -0
- package/docs/reviews/plans/rfc-0034-cli-compliance-migration-review.md +80 -0
- package/docs/reviews/plans/upgrade-reliability-implementation-review.md +65 -0
- package/docs/superpowers/specs/2026-07-15-upgrade-reliability-design.md +662 -0
- package/docs/superpowers/specs/specs.xdocs.md +24 -0
- package/docs/superpowers/superpowers.xdocs.md +21 -0
- package/docs/todo/rfc-0034-cli-compliance-migration-implementation.md +58 -0
- package/docs/todo/rfc-0034-cli-compliance-migration.md +151 -0
- package/docs/todo/todo.xdocs.md +6 -2
- package/docs/validation/interactive-init-manifest.md +79 -0
- package/docs/validation/rfc-0034-cli-compliance-migration.md +67 -0
- package/docs/validation/upgrade-reliability.md +124 -0
- package/docs/validation/validation.xdocs.md +9 -0
- package/library/agents.d.ts +28 -4
- package/library/agents.d.ts.map +1 -1
- package/library/agents.js +143 -41
- package/library/cli.d.ts.map +1 -1
- package/library/cli.js +297 -317
- package/library/configuration.d.ts +57 -0
- package/library/configuration.d.ts.map +1 -0
- package/library/configuration.js +111 -0
- package/library/embedded-resources.d.ts +6 -1
- package/library/embedded-resources.d.ts.map +1 -1
- package/library/embedded-resources.js +10 -4
- package/library/executor.d.ts +5 -1
- package/library/executor.d.ts.map +1 -1
- package/library/executor.js +10 -10
- package/library/help.d.ts +8 -4
- package/library/help.d.ts.map +1 -1
- package/library/help.js +70 -42
- package/library/init.d.ts +18 -0
- package/library/init.d.ts.map +1 -0
- package/library/init.js +43 -0
- package/library/manifest.d.ts +4 -40
- package/library/manifest.d.ts.map +1 -1
- package/library/manifest.js +4 -112
- package/library/path-utils.d.ts +13 -0
- package/library/path-utils.d.ts.map +1 -0
- package/library/path-utils.js +82 -0
- package/library/recovery.d.ts +7 -0
- package/library/recovery.d.ts.map +1 -0
- package/library/recovery.js +23 -0
- package/library/release-catalog.d.ts +32 -0
- package/library/release-catalog.d.ts.map +1 -0
- package/library/release-catalog.js +124 -0
- package/library/self-management.d.ts +24 -4
- package/library/self-management.d.ts.map +1 -1
- package/library/self-management.js +279 -99
- package/library/storage.d.ts +13 -0
- package/library/storage.d.ts.map +1 -0
- package/library/storage.js +38 -0
- package/library/types.d.ts +11 -16
- package/library/types.d.ts.map +1 -1
- package/library/types.js +3 -0
- package/library/update-cache.d.ts +21 -0
- package/library/update-cache.d.ts.map +1 -0
- package/library/update-cache.js +68 -0
- package/library/upgrade-reporting.d.ts +11 -0
- package/library/upgrade-reporting.d.ts.map +1 -0
- package/library/upgrade-reporting.js +67 -0
- package/library/upgrade-types.d.ts +72 -0
- package/library/upgrade-types.d.ts.map +1 -0
- package/library/upgrade-types.js +3 -0
- package/package.json +6 -3
- package/scripts/runx-bin.mjs +49 -0
- package/scripts/runx-bin.spec.ts +62 -0
- package/scripts/scripts.xdocs.md +3 -3
- package/skills/guiho-s-runx/SKILL.md +64 -59
- package/skills/guiho-s-runx/guiho-s-runx.xdocs.md +7 -4
- package/skills/skills.xdocs.md +1 -1
- package/docs/todo/implement-runx-alpha.md +0 -36
- 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
|
-
|
|
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":"
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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
|
+
}
|
package/library/executor.d.ts
CHANGED
|
@@ -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
|
|
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":"
|
|
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"}
|
package/library/executor.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
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
|
|
13
|
-
}
|
|
14
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/library/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../source/help.ts"],"names":[],"mappings":"
|
|
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,43 +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
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { RunXManifest } from './types.js';
|
|
5
|
+
export { createInitialManifest, initializeRunXManifest, renderInitialManifest, };
|
|
6
|
+
export type { RunXInitResult, };
|
|
7
|
+
type RunXInitResult = {
|
|
8
|
+
status: 'created';
|
|
9
|
+
path: string;
|
|
10
|
+
manifest: RunXManifest;
|
|
11
|
+
};
|
|
12
|
+
declare function initializeRunXManifest(options: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
config?: string;
|
|
15
|
+
}): Promise<RunXInitResult>;
|
|
16
|
+
declare function createInitialManifest(projectName: string, scriptsDirectory: string): RunXManifest;
|
|
17
|
+
declare function renderInitialManifest(manifest: RunXManifest): string;
|
|
18
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/library/init.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { RunXError } from './errors.js';
|
|
5
|
+
import { baseName, resolvePath } from './path-utils.js';
|
|
6
|
+
import { writeTextFile } from './storage.js';
|
|
7
|
+
export { createInitialManifest, initializeRunXManifest, renderInitialManifest, };
|
|
8
|
+
async function initializeRunXManifest(options) {
|
|
9
|
+
const cwd = resolvePath(options.cwd);
|
|
10
|
+
const path = resolvePath(cwd, options.config ?? 'runx.yaml');
|
|
11
|
+
if (await Bun.file(path).exists())
|
|
12
|
+
throw new RunXError(`Configuration already exists: ${path}`, 5);
|
|
13
|
+
const manifest = createInitialManifest(baseName(cwd) || 'my-project', 'scripts');
|
|
14
|
+
await writeTextFile(path, renderInitialManifest(manifest));
|
|
15
|
+
return { status: 'created', path, manifest };
|
|
16
|
+
}
|
|
17
|
+
function createInitialManifest(projectName, scriptsDirectory) {
|
|
18
|
+
return {
|
|
19
|
+
version: '1.0.0',
|
|
20
|
+
project: { name: projectName },
|
|
21
|
+
scripts: { directory: scriptsDirectory },
|
|
22
|
+
groups: { public: { summary: 'Default public project commands.' } },
|
|
23
|
+
commands: [],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function renderInitialManifest(manifest) {
|
|
27
|
+
return [
|
|
28
|
+
`version: ${JSON.stringify(manifest.version)}`,
|
|
29
|
+
'',
|
|
30
|
+
'project:',
|
|
31
|
+
` name: ${JSON.stringify(manifest.project?.name ?? '')}`,
|
|
32
|
+
'',
|
|
33
|
+
'scripts:',
|
|
34
|
+
` directory: ${JSON.stringify(manifest.scripts.directory)}`,
|
|
35
|
+
'',
|
|
36
|
+
'groups:',
|
|
37
|
+
' public:',
|
|
38
|
+
` summary: ${JSON.stringify(manifest.groups.public.summary)}`,
|
|
39
|
+
'',
|
|
40
|
+
'commands: []',
|
|
41
|
+
'',
|
|
42
|
+
].join('\n');
|
|
43
|
+
}
|
package/library/manifest.d.ts
CHANGED
|
@@ -1,41 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
group: import("@sinclair/typebox").TString;
|
|
6
|
-
summary: import("@sinclair/typebox").TString;
|
|
7
|
-
description: import("@sinclair/typebox").TString;
|
|
8
|
-
command: import("@sinclair/typebox").TString;
|
|
9
|
-
cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
-
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">]>>;
|
|
11
|
-
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
12
|
-
confirm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"never">, import("@sinclair/typebox").TLiteral<"always">]>>;
|
|
13
|
-
}>;
|
|
14
|
-
export declare const ManifestSchema: import("@sinclair/typebox").TObject<{
|
|
15
|
-
version: import("@sinclair/typebox").TLiteral<1>;
|
|
16
|
-
project: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
17
|
-
name: import("@sinclair/typebox").TString;
|
|
18
|
-
}>>;
|
|
19
|
-
groups: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
20
|
-
summary: import("@sinclair/typebox").TString;
|
|
21
|
-
}>>;
|
|
22
|
-
commands: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
23
|
-
uid: import("@sinclair/typebox").TString;
|
|
24
|
-
id: import("@sinclair/typebox").TString;
|
|
25
|
-
group: import("@sinclair/typebox").TString;
|
|
26
|
-
summary: import("@sinclair/typebox").TString;
|
|
27
|
-
description: import("@sinclair/typebox").TString;
|
|
28
|
-
command: import("@sinclair/typebox").TString;
|
|
29
|
-
cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
-
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">]>>;
|
|
31
|
-
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
32
|
-
confirm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"never">, import("@sinclair/typebox").TLiteral<"always">]>>;
|
|
33
|
-
}>>;
|
|
34
|
-
}>;
|
|
35
|
-
export declare const findManifest: (cwd: string, explicitFile?: string) => Promise<string>;
|
|
36
|
-
export declare const readManifest: (cwd: string, explicitFile?: string) => Promise<{
|
|
37
|
-
manifest: RunXManifest;
|
|
38
|
-
path: string;
|
|
39
|
-
}>;
|
|
40
|
-
export declare const resolveCommand: (manifest: RunXManifest, manifestPath: string, selector: string) => ResolvedCommand;
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright © 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
|
+
*/
|
|
4
|
+
export { commandSchema as CommandSchema, findConfiguration as findManifest, manifestSchema as ManifestSchema, readManifest, resolveCommand, } from './configuration.js';
|
|
41
5
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../source/manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../source/manifest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,iBAAiB,IAAI,YAAY,EACjC,cAAc,IAAI,cAAc,EAChC,YAAY,EACZ,cAAc,GACf,MAAM,oBAAoB,CAAA"}
|