@forgehive/forge-cli 0.3.17 → 0.5.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.
- package/dist/runner.js +71 -3
- package/dist/tasks/auth/add.d.ts +2 -2
- package/dist/tasks/auth/add.js +4 -4
- package/dist/tasks/auth/clear.d.ts +3 -3
- package/dist/tasks/auth/list.d.ts +3 -3
- package/dist/tasks/auth/load.d.ts +1 -1
- package/dist/tasks/auth/loadCurrent.d.ts +3 -3
- package/dist/tasks/auth/remove.d.ts +2 -2
- package/dist/tasks/auth/remove.js +1 -1
- package/dist/tasks/auth/switch.d.ts +2 -2
- package/dist/tasks/auth/switch.js +1 -1
- package/dist/tasks/bundle/create.d.ts +2 -2
- package/dist/tasks/bundle/create.js +2 -2
- package/dist/tasks/bundle/fingerprint.d.ts +2 -2
- package/dist/tasks/bundle/fingerprint.js +2 -2
- package/dist/tasks/bundle/load.js +1 -1
- package/dist/tasks/bundle/zip.js +4 -4
- package/dist/tasks/conf/info.d.ts +5 -5
- package/dist/tasks/conf/load.d.ts +1 -1
- package/dist/tasks/docs/download.js +4 -2
- package/dist/tasks/fixture/download.d.ts +4 -4
- package/dist/tasks/fixture/download.js +1 -1
- package/dist/tasks/init.js +1 -1
- package/dist/tasks/project/create.d.ts +5 -5
- package/dist/tasks/project/create.js +21 -25
- package/dist/tasks/project/link.d.ts +4 -4
- package/dist/tasks/project/link.js +1 -1
- package/dist/tasks/project/sync.d.ts +7 -7
- package/dist/tasks/project/sync.js +7 -3
- package/dist/tasks/project/unlink.d.ts +3 -3
- package/dist/tasks/runner/bundle.d.ts +2 -2
- package/dist/tasks/runner/bundle.js +2 -2
- package/dist/tasks/runner/create.d.ts +2 -2
- package/dist/tasks/runner/create.js +1 -1
- package/dist/tasks/runner/remove.d.ts +2 -2
- package/dist/tasks/runner/remove.js +1 -1
- package/dist/tasks/task/createTask.d.ts +4 -4
- package/dist/tasks/task/createTask.js +3 -2
- package/dist/tasks/task/describe.d.ts +2 -2
- package/dist/tasks/task/describe.js +1 -1
- package/dist/tasks/task/download.d.ts +4 -4
- package/dist/tasks/task/download.js +2 -2
- package/dist/tasks/task/fingerprint.d.ts +2 -2
- package/dist/tasks/task/fingerprint.js +1 -1
- package/dist/tasks/task/invoke.d.ts +4 -4
- package/dist/tasks/task/invoke.js +2 -2
- package/dist/tasks/task/list.d.ts +3 -3
- package/dist/tasks/task/publish.d.ts +4 -4
- package/dist/tasks/task/publish.js +1 -1
- package/dist/tasks/task/remove.d.ts +2 -2
- package/dist/tasks/task/remove.js +1 -1
- package/dist/tasks/task/replay.d.ts +14 -7
- package/dist/tasks/task/replay.js +33 -23
- package/dist/tasks/task/run.d.ts +6 -6
- package/dist/tasks/task/run.js +18 -23
- package/dist/tasks/types.d.ts +1 -0
- package/dist/test/tasks/create.test.js +3 -2
- package/dist/utils/taskAnalysis.d.ts +6 -0
- package/dist/utils/taskAnalysis.js +82 -41
- package/package.json +11 -11
- package/pnpm-workspace.yaml +2 -0
- package/src/runner.ts +80 -3
- package/src/tasks/auth/add.ts +4 -4
- package/src/tasks/auth/remove.ts +1 -1
- package/src/tasks/auth/switch.ts +1 -1
- package/src/tasks/bundle/create.ts +2 -2
- package/src/tasks/bundle/fingerprint.ts +2 -2
- package/src/tasks/bundle/load.ts +1 -1
- package/src/tasks/bundle/zip.ts +4 -4
- package/src/tasks/docs/download.ts +5 -2
- package/src/tasks/fixture/download.ts +1 -1
- package/src/tasks/init.ts +1 -1
- package/src/tasks/project/create.ts +21 -27
- package/src/tasks/project/link.ts +1 -1
- package/src/tasks/project/sync.ts +9 -1
- package/src/tasks/runner/bundle.ts +2 -2
- package/src/tasks/runner/create.ts +1 -1
- package/src/tasks/runner/remove.ts +1 -1
- package/src/tasks/task/createTask.ts +3 -2
- package/src/tasks/task/describe.ts +1 -1
- package/src/tasks/task/download.ts +2 -2
- package/src/tasks/task/fingerprint.ts +1 -1
- package/src/tasks/task/invoke.ts +2 -2
- package/src/tasks/task/publish.ts +1 -1
- package/src/tasks/task/remove.ts +1 -1
- package/src/tasks/task/replay.ts +38 -24
- package/src/tasks/task/run.ts +19 -26
- package/src/tasks/types.ts +1 -0
- package/src/test/tasks/create.test.ts +3 -2
- package/src/utils/taskAnalysis.ts +90 -41
- package/logs/bundle:fingerprint.log +0 -1
- package/logs/task:fingerprint.log +0 -10
- package/logs/task:list.log +0 -1
- package/logs/test:guidance.log +0 -1
- package/logs/test:uuid.log +0 -1
- package/logs/test:uuidCheck.log +0 -1
package/dist/runner.js
CHANGED
|
@@ -75,10 +75,78 @@ runner.load('project:create', create_2.create);
|
|
|
75
75
|
runner.load('project:link', link_1.link);
|
|
76
76
|
runner.load('project:unlink', unlink_1.unlink);
|
|
77
77
|
runner.load('project:sync', sync_1.sync);
|
|
78
|
+
function printAllHelp() {
|
|
79
|
+
const tasks = runner.describe();
|
|
80
|
+
console.log('Usage: forge <command> [options]');
|
|
81
|
+
console.log('');
|
|
82
|
+
console.log('Commands:');
|
|
83
|
+
const groups = {};
|
|
84
|
+
for (const name of Object.keys(tasks).sort()) {
|
|
85
|
+
const group = name.includes(':') ? name.split(':')[0] : name;
|
|
86
|
+
if (!groups[group]) {
|
|
87
|
+
groups[group] = [];
|
|
88
|
+
}
|
|
89
|
+
groups[group].push(name);
|
|
90
|
+
}
|
|
91
|
+
for (const [group, commands] of Object.entries(groups)) {
|
|
92
|
+
console.log(`\n ${group}:`);
|
|
93
|
+
for (const cmd of commands) {
|
|
94
|
+
const desc = tasks[cmd].description || '';
|
|
95
|
+
console.log(` ${cmd.padEnd(26)} ${desc}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
console.log('');
|
|
99
|
+
console.log('Run "forge <command> --help" for more information on a specific command.');
|
|
100
|
+
}
|
|
101
|
+
function printTaskHelp(taskName) {
|
|
102
|
+
const task = runner.getTask(taskName);
|
|
103
|
+
if (!task) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// `describe()` returns JSON Schema: fields live under `properties`, optionality
|
|
107
|
+
// is the absence from `required`, and `description` carries the help text.
|
|
108
|
+
const schema = task.describe();
|
|
109
|
+
const properties = (schema.properties ?? {});
|
|
110
|
+
const required = new Set((schema.required ?? []));
|
|
111
|
+
const keys = Object.keys(properties);
|
|
112
|
+
console.log(`Usage: forge ${taskName}${keys.length > 0 ? ' [options]' : ''}`);
|
|
113
|
+
console.log('');
|
|
114
|
+
const desc = task.getDescription();
|
|
115
|
+
if (desc) {
|
|
116
|
+
console.log(desc);
|
|
117
|
+
console.log('');
|
|
118
|
+
}
|
|
119
|
+
if (keys.length > 0) {
|
|
120
|
+
console.log('Options:');
|
|
121
|
+
for (const key of keys) {
|
|
122
|
+
const field = properties[key];
|
|
123
|
+
const type = field.format ?? field.type ?? 'unknown';
|
|
124
|
+
const optional = required.has(key) ? '' : ' (optional)';
|
|
125
|
+
const description = field.description ? ` - ${field.description}` : '';
|
|
126
|
+
console.log(` --${key.padEnd(20)} ${`${type}${optional}`.padEnd(20)}${description}`);
|
|
127
|
+
}
|
|
128
|
+
console.log('');
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
console.log('This command takes no options.');
|
|
132
|
+
console.log('');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
78
135
|
// Set handler
|
|
79
136
|
runner.setHandler(async (data) => {
|
|
80
137
|
const parsedArgs = runner.parseArguments(data);
|
|
81
138
|
const { taskName, action, args } = parsedArgs;
|
|
139
|
+
const helpRequested = args?.help === true;
|
|
140
|
+
if (helpRequested || taskName === 'undefined' || !taskName) {
|
|
141
|
+
if (helpRequested && runner.getTask(taskName)) {
|
|
142
|
+
printTaskHelp(taskName);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
printAllHelp();
|
|
146
|
+
}
|
|
147
|
+
setTimeout(() => { process.exit(0); }, 100);
|
|
148
|
+
return { silent: true, outcome: 'Success', taskName, result: null };
|
|
149
|
+
}
|
|
82
150
|
console.log('===============================================');
|
|
83
151
|
console.log(`Running: ${taskName} ${action ? action : ''} ${JSON.stringify(args)}`);
|
|
84
152
|
console.log('===============================================');
|
|
@@ -92,7 +160,7 @@ runner.setHandler(async (data) => {
|
|
|
92
160
|
const commandsWithDescriptor = ['task:create', 'task:remove', 'task:publish', 'task:describe', 'task:fingerprint'];
|
|
93
161
|
const commandsWithRunner = ['runner:create', 'runner:remove'];
|
|
94
162
|
const commandsWithoutParams = ['project:unlink', 'project:sync', 'auth:clear'];
|
|
95
|
-
const silentCommands = ['task:describe', 'task:list', 'auth:list', 'info'];
|
|
163
|
+
const silentCommands = ['task:describe', 'task:list', 'auth:list', 'info', 'docs:download'];
|
|
96
164
|
if (commandsWithDescriptor.includes(taskName)) {
|
|
97
165
|
result = await task.run({ descriptorName: action });
|
|
98
166
|
}
|
|
@@ -170,9 +238,9 @@ runner.setHandler(async (data) => {
|
|
|
170
238
|
});
|
|
171
239
|
}
|
|
172
240
|
else if (taskName === 'project:create') {
|
|
173
|
-
const {
|
|
241
|
+
const { name, description } = args;
|
|
174
242
|
result = await task.run({
|
|
175
|
-
|
|
243
|
+
name,
|
|
176
244
|
description
|
|
177
245
|
});
|
|
178
246
|
}
|
package/dist/tasks/auth/add.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const add: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
5
5
|
apiSecret: string;
|
|
6
6
|
url: string;
|
|
7
7
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
8
|
-
loadProfiles: (args:
|
|
8
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
9
9
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
10
10
|
fetchMeInfo: (apiKey: string, apiSecret: string, url: string) => Promise<{
|
|
11
11
|
success: boolean;
|
|
@@ -20,7 +20,7 @@ export declare const add: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
20
20
|
teamName: string | undefined;
|
|
21
21
|
userName: string | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
loadProfiles: (args:
|
|
23
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
24
24
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
25
25
|
fetchMeInfo: (apiKey: string, apiSecret: string, url: string) => Promise<{
|
|
26
26
|
success: boolean;
|
package/dist/tasks/auth/add.js
CHANGED
|
@@ -14,10 +14,10 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
14
14
|
const os_1 = __importDefault(require("os"));
|
|
15
15
|
const load_1 = require("./load");
|
|
16
16
|
const schema = new schema_1.Schema({
|
|
17
|
-
name: schema_1.Schema.string(),
|
|
18
|
-
apiKey: schema_1.Schema.string(),
|
|
19
|
-
apiSecret: schema_1.Schema.string(),
|
|
20
|
-
url: schema_1.Schema.string()
|
|
17
|
+
name: schema_1.Schema.string().describe('The name of the profile'),
|
|
18
|
+
apiKey: schema_1.Schema.string().describe('The API key for the profile'),
|
|
19
|
+
apiSecret: schema_1.Schema.string().describe('The API secret for the profile'),
|
|
20
|
+
url: schema_1.Schema.string().describe('The URL for the profile')
|
|
21
21
|
});
|
|
22
22
|
const boundaries = {
|
|
23
23
|
loadProfiles: load_1.load.asBoundary(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Profiles } from '../types';
|
|
2
|
-
export declare const clear: import("@forgehive/task").TaskInstanceType<(argv:
|
|
3
|
-
loadProfiles: (args:
|
|
2
|
+
export declare const clear: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
4
4
|
clearProfiles: () => Promise<void>;
|
|
5
5
|
}>) => Promise<{
|
|
6
6
|
status: string;
|
|
@@ -11,6 +11,6 @@ export declare const clear: import("@forgehive/task").TaskInstanceType<(argv: {}
|
|
|
11
11
|
message: string;
|
|
12
12
|
clearedCount: number;
|
|
13
13
|
}>, {
|
|
14
|
-
loadProfiles: (args:
|
|
14
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
15
15
|
clearProfiles: () => Promise<void>;
|
|
16
16
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Profiles } from '../types';
|
|
2
|
-
export declare const list: import("@forgehive/task").TaskInstanceType<(argv:
|
|
3
|
-
loadProfiles: (args:
|
|
2
|
+
export declare const list: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
4
4
|
}>) => Promise<{
|
|
5
5
|
status: string;
|
|
6
6
|
profiles: never[];
|
|
@@ -16,5 +16,5 @@ export declare const list: import("@forgehive/task").TaskInstanceType<(argv: {},
|
|
|
16
16
|
}[];
|
|
17
17
|
status?: undefined;
|
|
18
18
|
}>, {
|
|
19
|
-
loadProfiles: (args:
|
|
19
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
20
20
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Profiles } from '../types';
|
|
2
|
-
export declare const load: import("@forgehive/task").TaskInstanceType<(argv:
|
|
2
|
+
export declare const load: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
3
|
ensureBuildsFolder: () => Promise<string>;
|
|
4
4
|
}>) => Promise<Profiles>, {
|
|
5
5
|
ensureBuildsFolder: () => Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Profile } from '../types';
|
|
2
|
-
export declare const loadCurrent: import("@forgehive/task").TaskInstanceType<(argv:
|
|
3
|
-
loadProfiles: (args:
|
|
2
|
+
export declare const loadCurrent: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profiles>>;
|
|
4
4
|
}>) => Promise<Profile>, {
|
|
5
|
-
loadProfiles: (args:
|
|
5
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profiles>>;
|
|
6
6
|
}>;
|
|
@@ -2,12 +2,12 @@ import { type Profiles } from '../types';
|
|
|
2
2
|
export declare const remove: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
3
3
|
profileName: string;
|
|
4
4
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
5
|
-
loadProfiles: (args:
|
|
5
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
6
6
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
7
7
|
}>) => Promise<{
|
|
8
8
|
status: string;
|
|
9
9
|
message: string;
|
|
10
10
|
}>, {
|
|
11
|
-
loadProfiles: (args:
|
|
11
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
12
12
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
13
13
|
}>;
|
|
@@ -14,7 +14,7 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
14
14
|
const os_1 = __importDefault(require("os"));
|
|
15
15
|
const load_1 = require("./load");
|
|
16
16
|
const schema = new schema_1.Schema({
|
|
17
|
-
profileName: schema_1.Schema.string()
|
|
17
|
+
profileName: schema_1.Schema.string().describe('The name of the auth profile to remove')
|
|
18
18
|
});
|
|
19
19
|
const boundaries = {
|
|
20
20
|
loadProfiles: load_1.load.asBoundary(),
|
|
@@ -2,11 +2,11 @@ import { type Profiles } from '../types';
|
|
|
2
2
|
export declare const switchProfile: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
3
3
|
profileName: string;
|
|
4
4
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
5
|
-
loadProfiles: (args:
|
|
5
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
6
6
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
7
7
|
}>) => Promise<{
|
|
8
8
|
default: string;
|
|
9
9
|
}>, {
|
|
10
|
-
loadProfiles: (args:
|
|
10
|
+
loadProfiles: (args: Record<string, unknown>) => Promise<Promise<Profiles>>;
|
|
11
11
|
persistProfiles: (profiles: Profiles) => Promise<void>;
|
|
12
12
|
}>;
|
|
@@ -14,7 +14,7 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
14
14
|
const os_1 = __importDefault(require("os"));
|
|
15
15
|
const load_1 = require("./load");
|
|
16
16
|
const schema = new schema_1.Schema({
|
|
17
|
-
profileName: schema_1.Schema.string()
|
|
17
|
+
profileName: schema_1.Schema.string().describe('The name of the auth profile to switch to')
|
|
18
18
|
});
|
|
19
19
|
const boundaries = {
|
|
20
20
|
loadProfiles: load_1.load.asBoundary(),
|
|
@@ -3,9 +3,9 @@ export declare const create: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
3
3
|
entryPoint: string;
|
|
4
4
|
outputFile: string;
|
|
5
5
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
6
|
-
loadConf: (args:
|
|
6
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
7
7
|
}>) => Promise<{
|
|
8
8
|
outputFile: string;
|
|
9
9
|
}>, {
|
|
10
|
-
loadConf: (args:
|
|
10
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
11
11
|
}>;
|
|
@@ -12,8 +12,8 @@ const schema_1 = require("@forgehive/schema");
|
|
|
12
12
|
const esbuild_1 = __importDefault(require("esbuild"));
|
|
13
13
|
const load_1 = require("../conf/load");
|
|
14
14
|
const schema = new schema_1.Schema({
|
|
15
|
-
entryPoint: schema_1.Schema.string(),
|
|
16
|
-
outputFile: schema_1.Schema.string()
|
|
15
|
+
entryPoint: schema_1.Schema.string().describe('Path to the task entry point file'),
|
|
16
|
+
outputFile: schema_1.Schema.string().describe('Path for the bundled output file')
|
|
17
17
|
});
|
|
18
18
|
const boundaries = {
|
|
19
19
|
loadConf: load_1.load.asBoundary()
|
|
@@ -4,7 +4,7 @@ export declare const fingerprint: import("@forgehive/task").TaskInstanceType<(ar
|
|
|
4
4
|
filePath?: string | undefined;
|
|
5
5
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
6
6
|
getCwd: () => Promise<string>;
|
|
7
|
-
loadConf: (args:
|
|
7
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
8
8
|
readFile: (filePath: string) => Promise<string>;
|
|
9
9
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
10
10
|
ensureFingerprintsFolder: (cwd: string, conf: {
|
|
@@ -35,7 +35,7 @@ export declare const fingerprint: import("@forgehive/task").TaskInstanceType<(ar
|
|
|
35
35
|
fingerprintFile?: undefined;
|
|
36
36
|
}>, {
|
|
37
37
|
getCwd: () => Promise<string>;
|
|
38
|
-
loadConf: (args:
|
|
38
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
39
39
|
readFile: (filePath: string) => Promise<string>;
|
|
40
40
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
41
41
|
ensureFingerprintsFolder: (cwd: string, conf: {
|
|
@@ -16,8 +16,8 @@ const load_1 = require("../conf/load");
|
|
|
16
16
|
const taskAnalysis_1 = require("../../utils/taskAnalysis");
|
|
17
17
|
const description = 'Generate task bundle with comprehensive fingerprinting and type extraction';
|
|
18
18
|
const schema = new schema_1.Schema({
|
|
19
|
-
descriptorName: schema_1.Schema.string(),
|
|
20
|
-
filePath: schema_1.Schema.string().optional()
|
|
19
|
+
descriptorName: schema_1.Schema.string().describe('The task descriptor name (e.g. domain:taskName)'),
|
|
20
|
+
filePath: schema_1.Schema.string().describe('Optional path to the task source file').optional()
|
|
21
21
|
});
|
|
22
22
|
const boundaries = {
|
|
23
23
|
getCwd: async () => {
|
|
@@ -40,7 +40,7 @@ exports.load = void 0;
|
|
|
40
40
|
const task_1 = require("@forgehive/task");
|
|
41
41
|
const schema_1 = require("@forgehive/schema");
|
|
42
42
|
const schema = new schema_1.Schema({
|
|
43
|
-
bundlePath: schema_1.Schema.string()
|
|
43
|
+
bundlePath: schema_1.Schema.string().describe('Path to the bundle file to load')
|
|
44
44
|
});
|
|
45
45
|
const boundaries = {};
|
|
46
46
|
exports.load = (0, task_1.createTask)({
|
package/dist/tasks/bundle/zip.js
CHANGED
|
@@ -14,10 +14,10 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const description = 'Zip a bundle file for distribution';
|
|
16
16
|
const schema = new schema_1.Schema({
|
|
17
|
-
dir: schema_1.Schema.string(),
|
|
18
|
-
input: schema_1.Schema.string(),
|
|
19
|
-
output: schema_1.Schema.string(),
|
|
20
|
-
forgeJsonPath: schema_1.Schema.string().optional() // Optional path to forge.json - if provided, it will be included
|
|
17
|
+
dir: schema_1.Schema.string().describe('Directory that will contain the generated zip'),
|
|
18
|
+
input: schema_1.Schema.string().describe('Path to the file or folder to add to the zip'),
|
|
19
|
+
output: schema_1.Schema.string().describe('Output path for the generated zip file'),
|
|
20
|
+
forgeJsonPath: schema_1.Schema.string().describe('Optional path to forge.json to include in the bundle').optional() // Optional path to forge.json - if provided, it will be included
|
|
21
21
|
});
|
|
22
22
|
const boundaries = {
|
|
23
23
|
createWriteStream: async (outputPath) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const info: import("@forgehive/task").TaskInstanceType<(argv:
|
|
1
|
+
export declare const info: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
2
2
|
readFile: (filePath: string) => Promise<string>;
|
|
3
|
-
loadConfig: (args:
|
|
4
|
-
loadCurrentProfile: (args:
|
|
3
|
+
loadConfig: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
4
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profile>>;
|
|
5
5
|
}>) => Promise<{
|
|
6
6
|
version: any;
|
|
7
7
|
profile: null;
|
|
@@ -22,6 +22,6 @@ export declare const info: import("@forgehive/task").TaskInstanceType<(argv: {},
|
|
|
22
22
|
error?: undefined;
|
|
23
23
|
}>, {
|
|
24
24
|
readFile: (filePath: string) => Promise<string>;
|
|
25
|
-
loadConfig: (args:
|
|
26
|
-
loadCurrentProfile: (args:
|
|
25
|
+
loadConfig: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
26
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profile>>;
|
|
27
27
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ForgeConf } from '../types';
|
|
2
|
-
export declare const load: import("@forgehive/task").TaskInstanceType<(argv:
|
|
2
|
+
export declare const load: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
3
|
readFile: (filePath: string) => Promise<string>;
|
|
4
4
|
}>) => Promise<ForgeConf>, {
|
|
5
5
|
readFile: (filePath: string) => Promise<string>;
|
|
@@ -51,8 +51,8 @@ const description = 'Download ForgeHive LLM guides from GitHub to local project'
|
|
|
51
51
|
const LLM_GUIDE_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm.md';
|
|
52
52
|
const LLM_HIVE_LOGGING_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm-hive-logging.md';
|
|
53
53
|
const schema = new schema_1.Schema({
|
|
54
|
-
path: schema_1.Schema.string().optional(),
|
|
55
|
-
logs: schema_1.Schema.boolean().optional()
|
|
54
|
+
path: schema_1.Schema.string().describe('Optional output path for the downloaded docs').optional(),
|
|
55
|
+
logs: schema_1.Schema.boolean().describe('Include execution logs in the downloaded docs').optional()
|
|
56
56
|
});
|
|
57
57
|
const boundaries = {
|
|
58
58
|
fetchFile: async (url) => {
|
|
@@ -117,6 +117,7 @@ exports.download = (0, task_1.createTask)({
|
|
|
117
117
|
});
|
|
118
118
|
// Download Hive logging guide if --logs flag is provided
|
|
119
119
|
if (logs) {
|
|
120
|
+
console.log('===============================================');
|
|
120
121
|
const logsTargetPath = customPath
|
|
121
122
|
? path_1.default.join(path_1.default.dirname(customPath), 'hive-logging.md')
|
|
122
123
|
: 'docs/hive-logging.md';
|
|
@@ -142,6 +143,7 @@ exports.download = (0, task_1.createTask)({
|
|
|
142
143
|
size: logsContent.length
|
|
143
144
|
});
|
|
144
145
|
}
|
|
146
|
+
console.log('===============================================');
|
|
145
147
|
return {
|
|
146
148
|
success: true,
|
|
147
149
|
downloads: results,
|
|
@@ -11,8 +11,8 @@ interface FixtureResponse {
|
|
|
11
11
|
export declare const download: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
12
12
|
uuid: string;
|
|
13
13
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
14
|
-
loadCurrentProfile: (args:
|
|
15
|
-
loadConf: (args:
|
|
14
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
15
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
16
16
|
downloadFixture: (uuid: string, profile: Profile) => Promise<FixtureResponse>;
|
|
17
17
|
getCwd: () => Promise<string>;
|
|
18
18
|
persistFixture: (filePath: string, data: FixtureData) => Promise<{
|
|
@@ -23,8 +23,8 @@ export declare const download: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
23
23
|
path: string;
|
|
24
24
|
shortPath: string;
|
|
25
25
|
}>, {
|
|
26
|
-
loadCurrentProfile: (args:
|
|
27
|
-
loadConf: (args:
|
|
26
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
27
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<import("../types").ForgeConf>>;
|
|
28
28
|
downloadFixture: (uuid: string, profile: Profile) => Promise<FixtureResponse>;
|
|
29
29
|
getCwd: () => Promise<string>;
|
|
30
30
|
persistFixture: (filePath: string, data: FixtureData) => Promise<{
|
|
@@ -16,7 +16,7 @@ const loadCurrent_1 = require("../auth/loadCurrent");
|
|
|
16
16
|
const load_1 = require("../conf/load");
|
|
17
17
|
const description = 'Download a fixture by UUID to a path based on task descriptor returned from API';
|
|
18
18
|
const schema = new schema_1.Schema({
|
|
19
|
-
uuid: schema_1.Schema.string()
|
|
19
|
+
uuid: schema_1.Schema.string().describe('The UUID of the fixture to download')
|
|
20
20
|
});
|
|
21
21
|
const boundaries = {
|
|
22
22
|
loadCurrentProfile: loadCurrent_1.loadCurrent.asBoundary(),
|
package/dist/tasks/init.js
CHANGED
|
@@ -9,7 +9,7 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
9
9
|
const task_1 = require("@forgehive/task");
|
|
10
10
|
const schema_1 = require("@forgehive/schema");
|
|
11
11
|
const schema = new schema_1.Schema({
|
|
12
|
-
dryRun: schema_1.Schema.boolean().optional()
|
|
12
|
+
dryRun: schema_1.Schema.boolean().describe('Preview the changes without writing any files').optional()
|
|
13
13
|
});
|
|
14
14
|
const boundaries = {
|
|
15
15
|
saveFile: async (path, content) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ForgeConf, type Profile } from '../types';
|
|
2
2
|
export declare const create: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
3
|
+
name: string;
|
|
3
4
|
description?: string | undefined;
|
|
4
|
-
projectName?: string | undefined;
|
|
5
5
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
6
|
-
loadConf: (args:
|
|
7
|
-
loadCurrentProfile: (args:
|
|
6
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
7
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
8
8
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
9
9
|
createProject: (profile: Profile, payload: {
|
|
10
10
|
projectName: string;
|
|
@@ -16,8 +16,8 @@ export declare const create: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
16
16
|
project: any;
|
|
17
17
|
localUuid: string;
|
|
18
18
|
}>, {
|
|
19
|
-
loadConf: (args:
|
|
20
|
-
loadCurrentProfile: (args:
|
|
19
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
20
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
21
21
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
22
22
|
createProject: (profile: Profile, payload: {
|
|
23
23
|
projectName: string;
|
|
@@ -14,11 +14,11 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const load_1 = require("../conf/load");
|
|
16
16
|
const loadCurrent_1 = require("../auth/loadCurrent");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const taskName = 'project:create';
|
|
18
|
+
const taskDescription = 'Create a new project in ForgeHive';
|
|
19
19
|
const schema = new schema_1.Schema({
|
|
20
|
-
|
|
21
|
-
description: schema_1.Schema.string().optional()
|
|
20
|
+
name: schema_1.Schema.string().describe('The name of the project'),
|
|
21
|
+
description: schema_1.Schema.string().describe('Optional description of the project').optional()
|
|
22
22
|
});
|
|
23
23
|
const boundaries = {
|
|
24
24
|
loadConf: load_1.load.asBoundary(),
|
|
@@ -39,33 +39,29 @@ const boundaries = {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
exports.create = (0, task_1.createTask)({
|
|
42
|
-
name,
|
|
43
|
-
description,
|
|
42
|
+
name: taskName,
|
|
43
|
+
description: taskDescription,
|
|
44
44
|
schema,
|
|
45
45
|
boundaries,
|
|
46
46
|
fn: async function (argv, { loadConf, loadCurrentProfile, writeFile, createProject }) {
|
|
47
|
-
const {
|
|
47
|
+
const { name: projectName, description } = argv;
|
|
48
48
|
// Load current configuration
|
|
49
49
|
const conf = await loadConf({});
|
|
50
|
-
// Use provided projectName or fall back to forge.json project name
|
|
51
|
-
const projectName = inputProjectName || conf.project.name;
|
|
52
|
-
if (!projectName) {
|
|
53
|
-
throw new Error('Project name is required. Provide --projectName or ensure forge.json has a project name.');
|
|
54
|
-
}
|
|
55
50
|
// Check if project already has a UUID, generate one if not
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...conf,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
const projectUuid = conf.project.uuid || (0, uuid_1.v4)();
|
|
52
|
+
// Update forge.json with the project name and UUID
|
|
53
|
+
const forgePath = path_1.default.join(process.cwd(), 'forge.json');
|
|
54
|
+
const updatedConf = {
|
|
55
|
+
...conf,
|
|
56
|
+
project: {
|
|
57
|
+
...conf.project,
|
|
58
|
+
name: projectName,
|
|
59
|
+
uuid: projectUuid
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
await writeFile(forgePath, JSON.stringify(updatedConf, null, 2));
|
|
63
|
+
console.log(`Updated forge.json with project name: ${projectName}`);
|
|
64
|
+
if (!conf.project.uuid) {
|
|
69
65
|
console.log(`Generated and saved project UUID: ${projectUuid}`);
|
|
70
66
|
}
|
|
71
67
|
// Load current profile for API authentication
|
|
@@ -2,8 +2,8 @@ import { type ForgeConf, type Profile } from '../types';
|
|
|
2
2
|
export declare const link: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
3
3
|
uuid: string;
|
|
4
4
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
5
|
-
loadConf: (args:
|
|
6
|
-
loadCurrentProfile: (args:
|
|
5
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
6
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
7
7
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
8
8
|
fetchProject: (profile: Profile, uuid: string) => Promise<Response>;
|
|
9
9
|
}>) => Promise<{
|
|
@@ -15,8 +15,8 @@ export declare const link: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
15
15
|
tasksCount: any;
|
|
16
16
|
};
|
|
17
17
|
}>, {
|
|
18
|
-
loadConf: (args:
|
|
19
|
-
loadCurrentProfile: (args:
|
|
18
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
19
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<Profile>>;
|
|
20
20
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
21
21
|
fetchProject: (profile: Profile, uuid: string) => Promise<Response>;
|
|
22
22
|
}>;
|
|
@@ -16,7 +16,7 @@ const loadCurrent_1 = require("../auth/loadCurrent");
|
|
|
16
16
|
const name = 'project:link';
|
|
17
17
|
const description = 'Link an existing remote project to the local project by UUID';
|
|
18
18
|
const schema = new schema_1.Schema({
|
|
19
|
-
uuid: schema_1.Schema.string()
|
|
19
|
+
uuid: schema_1.Schema.string().describe('The UUID of the project to link')
|
|
20
20
|
});
|
|
21
21
|
const boundaries = {
|
|
22
22
|
loadConf: load_1.load.asBoundary(),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ForgeConf } from '../types';
|
|
2
|
-
export declare const sync: import("@forgehive/task").TaskInstanceType<(argv:
|
|
3
|
-
loadConf: (args:
|
|
4
|
-
loadCurrentProfile: (args:
|
|
2
|
+
export declare const sync: import("@forgehive/task").TaskInstanceType<(argv: Record<string, unknown>, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
3
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
4
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profile>>;
|
|
5
5
|
getCwd: () => Promise<string>;
|
|
6
6
|
persistConf: (forge: ForgeConf, cwd: string) => Promise<void>;
|
|
7
|
-
syncTasksToHive: (projectUuid: string, tasks: Array<{
|
|
7
|
+
syncTasksToHive: (projectUuid: string, projectName: string, projectDescription: string | undefined, tasks: Array<{
|
|
8
8
|
uuid: string;
|
|
9
9
|
name: string;
|
|
10
10
|
}>, apiKey: string, apiSecret: string, baseUrl: string) => Promise<{
|
|
@@ -74,11 +74,11 @@ export declare const sync: import("@forgehive/task").TaskInstanceType<(argv: {},
|
|
|
74
74
|
projectUrl: string;
|
|
75
75
|
message?: undefined;
|
|
76
76
|
}>, {
|
|
77
|
-
loadConf: (args:
|
|
78
|
-
loadCurrentProfile: (args:
|
|
77
|
+
loadConf: (args: Record<string, unknown>) => Promise<Promise<ForgeConf>>;
|
|
78
|
+
loadCurrentProfile: (args: Record<string, unknown>) => Promise<Promise<import("../types").Profile>>;
|
|
79
79
|
getCwd: () => Promise<string>;
|
|
80
80
|
persistConf: (forge: ForgeConf, cwd: string) => Promise<void>;
|
|
81
|
-
syncTasksToHive: (projectUuid: string, tasks: Array<{
|
|
81
|
+
syncTasksToHive: (projectUuid: string, projectName: string, projectDescription: string | undefined, tasks: Array<{
|
|
82
82
|
uuid: string;
|
|
83
83
|
name: string;
|
|
84
84
|
}>, apiKey: string, apiSecret: string, baseUrl: string) => Promise<{
|
|
@@ -25,7 +25,7 @@ const boundaries = {
|
|
|
25
25
|
const forgePath = path_1.default.join(cwd, 'forge.json');
|
|
26
26
|
await promises_1.default.writeFile(forgePath, JSON.stringify(forge, null, 2));
|
|
27
27
|
},
|
|
28
|
-
syncTasksToHive: async (projectUuid, tasks, apiKey, apiSecret, baseUrl) => {
|
|
28
|
+
syncTasksToHive: async (projectUuid, projectName, projectDescription, tasks, apiKey, apiSecret, baseUrl) => {
|
|
29
29
|
try {
|
|
30
30
|
const url = `${baseUrl}/api/projects/${projectUuid}/sync`;
|
|
31
31
|
const response = await fetch(url, {
|
|
@@ -34,7 +34,7 @@ const boundaries = {
|
|
|
34
34
|
'Content-Type': 'application/json',
|
|
35
35
|
'Authorization': `Bearer ${apiKey}:${apiSecret}`
|
|
36
36
|
},
|
|
37
|
-
body: JSON.stringify({ tasks })
|
|
37
|
+
body: JSON.stringify({ projectName, description: projectDescription, tasks })
|
|
38
38
|
});
|
|
39
39
|
if (response.ok) {
|
|
40
40
|
const data = await response.json();
|
|
@@ -96,9 +96,13 @@ exports.sync = (0, task_1.createTask)({
|
|
|
96
96
|
return { status: 'no-tasks', message: 'No tasks found in project' };
|
|
97
97
|
}
|
|
98
98
|
console.log(` 📊 Found ${tasksToSync.length} tasks to sync`);
|
|
99
|
+
console.log(` 📝 Project name: ${forge.project.name}`);
|
|
100
|
+
if (forge.project.description) {
|
|
101
|
+
console.log(` 📝 Project description: ${forge.project.description}`);
|
|
102
|
+
}
|
|
99
103
|
try {
|
|
100
104
|
const profile = await loadCurrentProfile({});
|
|
101
|
-
const result = await syncTasksToHive(forge.project.uuid, tasksToSync, profile.apiKey, profile.apiSecret, profile.url);
|
|
105
|
+
const result = await syncTasksToHive(forge.project.uuid, forge.project.name, forge.project.description, tasksToSync, profile.apiKey, profile.apiSecret, profile.url);
|
|
102
106
|
if (result.success && result.data) {
|
|
103
107
|
const { summary, results } = result.data;
|
|
104
108
|
console.log('\\n ✅ Sync completed successfully!');
|