@forgehive/forge-cli 0.3.13 → 0.3.14
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 +3 -2
- package/dist/tasks/docs/download.d.ts +8 -3
- package/dist/tasks/docs/download.js +57 -20
- package/package.json +3 -3
- package/src/runner.ts +3 -2
- package/src/tasks/docs/download.ts +67 -20
package/dist/runner.js
CHANGED
|
@@ -163,9 +163,10 @@ runner.setHandler(async (data) => {
|
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
else if (taskName === 'docs:download') {
|
|
166
|
-
const { path } = args;
|
|
166
|
+
const { path, logs } = args;
|
|
167
167
|
result = await task.run({
|
|
168
|
-
path
|
|
168
|
+
path,
|
|
169
|
+
logs
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
else if (taskName === 'project:create') {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const download: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
2
2
|
path?: string | undefined;
|
|
3
|
+
logs?: boolean | undefined;
|
|
3
4
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
4
5
|
fetchFile: (url: string) => Promise<string>;
|
|
5
6
|
getCurrentWorkingDirectory: () => Promise<string>;
|
|
@@ -8,9 +9,13 @@ export declare const download: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
8
9
|
checkFileExists: (filePath: string) => Promise<boolean>;
|
|
9
10
|
}>) => Promise<{
|
|
10
11
|
success: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
downloads: {
|
|
13
|
+
type: string;
|
|
14
|
+
filePath: string;
|
|
15
|
+
targetPath: string;
|
|
16
|
+
size: number;
|
|
17
|
+
}[];
|
|
18
|
+
totalFiles: number;
|
|
14
19
|
}>, {
|
|
15
20
|
fetchFile: (url: string) => Promise<string>;
|
|
16
21
|
getCurrentWorkingDirectory: () => Promise<string>;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// Run this task with:
|
|
4
4
|
// forge task:run docs:download
|
|
5
5
|
// forge task:run docs:download --path="custom/path/forge.md"
|
|
6
|
+
// forge task:run docs:download --logs
|
|
7
|
+
// forge task:run docs:download --logs --path="custom/path/forge.md"
|
|
6
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
9
|
if (k2 === undefined) k2 = k;
|
|
8
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -45,10 +47,12 @@ const task_1 = require("@forgehive/task");
|
|
|
45
47
|
const schema_1 = require("@forgehive/schema");
|
|
46
48
|
const path_1 = __importDefault(require("path"));
|
|
47
49
|
const name = 'docs:download';
|
|
48
|
-
const description = 'Download
|
|
50
|
+
const description = 'Download ForgeHive LLM guides from GitHub to local project';
|
|
49
51
|
const LLM_GUIDE_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm.md';
|
|
52
|
+
const LLM_HIVE_LOGGING_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm-hive-logging.md';
|
|
50
53
|
const schema = new schema_1.Schema({
|
|
51
|
-
path: schema_1.Schema.string().optional()
|
|
54
|
+
path: schema_1.Schema.string().optional(),
|
|
55
|
+
logs: schema_1.Schema.boolean().optional()
|
|
52
56
|
});
|
|
53
57
|
const boundaries = {
|
|
54
58
|
fetchFile: async (url) => {
|
|
@@ -85,30 +89,63 @@ exports.download = (0, task_1.createTask)({
|
|
|
85
89
|
description,
|
|
86
90
|
schema,
|
|
87
91
|
boundaries,
|
|
88
|
-
fn: async function ({ path: customPath }, { fetchFile, getCurrentWorkingDirectory, createDirectory, writeFile, checkFileExists }) {
|
|
89
|
-
// Determine the target path
|
|
90
|
-
const targetPath = customPath || 'docs/forge.md';
|
|
92
|
+
fn: async function ({ path: customPath, logs }, { fetchFile, getCurrentWorkingDirectory, createDirectory, writeFile, checkFileExists }) {
|
|
91
93
|
const cwd = await getCurrentWorkingDirectory();
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const results = [];
|
|
95
|
+
// Download main LLM guide
|
|
96
|
+
const mainTargetPath = customPath || 'docs/forge.md';
|
|
97
|
+
const mainFullPath = path_1.default.resolve(cwd, mainTargetPath);
|
|
98
|
+
const mainDirPath = path_1.default.dirname(mainFullPath);
|
|
99
|
+
console.log(`Downloading ForgeHive LLM guide to: ${mainTargetPath}`);
|
|
95
100
|
// Check if file already exists
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
console.log(`Warning: File already exists at ${
|
|
101
|
+
const mainFileExists = await checkFileExists(mainFullPath);
|
|
102
|
+
if (mainFileExists) {
|
|
103
|
+
console.log(`Warning: File already exists at ${mainTargetPath}. It will be overwritten.`);
|
|
99
104
|
}
|
|
100
|
-
// Download the
|
|
101
|
-
const
|
|
105
|
+
// Download the main guide content
|
|
106
|
+
const mainContent = await fetchFile(LLM_GUIDE_URL);
|
|
102
107
|
// Create directory if it doesn't exist
|
|
103
|
-
await createDirectory(
|
|
104
|
-
// Write the file
|
|
105
|
-
await writeFile(
|
|
106
|
-
console.log(`✅ Successfully downloaded ForgeHive LLM guide to ${
|
|
108
|
+
await createDirectory(mainDirPath);
|
|
109
|
+
// Write the main guide file
|
|
110
|
+
await writeFile(mainFullPath, mainContent);
|
|
111
|
+
console.log(`✅ Successfully downloaded ForgeHive LLM guide to ${mainTargetPath}`);
|
|
112
|
+
results.push({
|
|
113
|
+
type: 'main',
|
|
114
|
+
filePath: mainFullPath,
|
|
115
|
+
targetPath: mainTargetPath,
|
|
116
|
+
size: mainContent.length
|
|
117
|
+
});
|
|
118
|
+
// Download Hive logging guide if --logs flag is provided
|
|
119
|
+
if (logs) {
|
|
120
|
+
const logsTargetPath = customPath
|
|
121
|
+
? path_1.default.join(path_1.default.dirname(customPath), 'hive-logging.md')
|
|
122
|
+
: 'docs/hive-logging.md';
|
|
123
|
+
const logsFullPath = path_1.default.resolve(cwd, logsTargetPath);
|
|
124
|
+
const logsDirPath = path_1.default.dirname(logsFullPath);
|
|
125
|
+
console.log(`Downloading Hive Logging guide to: ${logsTargetPath}`);
|
|
126
|
+
// Check if logs file already exists
|
|
127
|
+
const logsFileExists = await checkFileExists(logsFullPath);
|
|
128
|
+
if (logsFileExists) {
|
|
129
|
+
console.log(`Warning: File already exists at ${logsTargetPath}. It will be overwritten.`);
|
|
130
|
+
}
|
|
131
|
+
// Download the logs guide content
|
|
132
|
+
const logsContent = await fetchFile(LLM_HIVE_LOGGING_URL);
|
|
133
|
+
// Create directory if it doesn't exist
|
|
134
|
+
await createDirectory(logsDirPath);
|
|
135
|
+
// Write the logs guide file
|
|
136
|
+
await writeFile(logsFullPath, logsContent);
|
|
137
|
+
console.log(`✅ Successfully downloaded Hive Logging guide to ${logsTargetPath}`);
|
|
138
|
+
results.push({
|
|
139
|
+
type: 'logs',
|
|
140
|
+
filePath: logsFullPath,
|
|
141
|
+
targetPath: logsTargetPath,
|
|
142
|
+
size: logsContent.length
|
|
143
|
+
});
|
|
144
|
+
}
|
|
107
145
|
return {
|
|
108
146
|
success: true,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
size: content.length
|
|
147
|
+
downloads: results,
|
|
148
|
+
totalFiles: results.length
|
|
112
149
|
};
|
|
113
150
|
}
|
|
114
151
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgehive/forge-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "TypeScript CLI application",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"@forgehive/record-tape": "0.2.6",
|
|
34
34
|
"@forgehive/hive-sdk": "0.1.4",
|
|
35
|
-
"@forgehive/
|
|
35
|
+
"@forgehive/schema": "0.1.4",
|
|
36
36
|
"@forgehive/runner": "0.2.6",
|
|
37
|
-
"@forgehive/
|
|
37
|
+
"@forgehive/task": "0.2.6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/archiver": "^6.0.3",
|
package/src/runner.ts
CHANGED
|
@@ -184,10 +184,11 @@ runner.setHandler(async (data: ParsedArgs): Promise<unknown> => {
|
|
|
184
184
|
profileName: String(action)
|
|
185
185
|
})
|
|
186
186
|
} else if (taskName === 'docs:download') {
|
|
187
|
-
const { path } = args as { path?: string }
|
|
187
|
+
const { path, logs } = args as { path?: string, logs?: boolean }
|
|
188
188
|
|
|
189
189
|
result = await task.run({
|
|
190
|
-
path
|
|
190
|
+
path,
|
|
191
|
+
logs
|
|
191
192
|
})
|
|
192
193
|
} else if (taskName === 'project:create') {
|
|
193
194
|
const { projectName, description } = args as { projectName?: string, description?: string }
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
// Run this task with:
|
|
3
3
|
// forge task:run docs:download
|
|
4
4
|
// forge task:run docs:download --path="custom/path/forge.md"
|
|
5
|
+
// forge task:run docs:download --logs
|
|
6
|
+
// forge task:run docs:download --logs --path="custom/path/forge.md"
|
|
5
7
|
|
|
6
8
|
import { createTask } from '@forgehive/task'
|
|
7
9
|
import { Schema } from '@forgehive/schema'
|
|
8
10
|
import path from 'path'
|
|
9
11
|
|
|
10
12
|
const name = 'docs:download'
|
|
11
|
-
const description = 'Download
|
|
13
|
+
const description = 'Download ForgeHive LLM guides from GitHub to local project'
|
|
12
14
|
|
|
13
15
|
const LLM_GUIDE_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm.md'
|
|
16
|
+
const LLM_HIVE_LOGGING_URL = 'https://raw.githubusercontent.com/forge-and-hive/forge-mono-repo/refs/heads/main/docs/llm-hive-logging.md'
|
|
14
17
|
|
|
15
18
|
const schema = new Schema({
|
|
16
|
-
path: Schema.string().optional()
|
|
19
|
+
path: Schema.string().optional(),
|
|
20
|
+
logs: Schema.boolean().optional()
|
|
17
21
|
})
|
|
18
22
|
|
|
19
23
|
const boundaries = {
|
|
@@ -51,37 +55,80 @@ export const download = createTask({
|
|
|
51
55
|
description,
|
|
52
56
|
schema,
|
|
53
57
|
boundaries,
|
|
54
|
-
fn: async function ({ path: customPath }, { fetchFile, getCurrentWorkingDirectory, createDirectory, writeFile, checkFileExists }) {
|
|
55
|
-
// Determine the target path
|
|
56
|
-
const targetPath = customPath || 'docs/forge.md'
|
|
58
|
+
fn: async function ({ path: customPath, logs }, { fetchFile, getCurrentWorkingDirectory, createDirectory, writeFile, checkFileExists }) {
|
|
57
59
|
const cwd = await getCurrentWorkingDirectory()
|
|
58
|
-
const
|
|
59
|
-
const dirPath = path.dirname(fullPath)
|
|
60
|
+
const results = []
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
// Download main LLM guide
|
|
63
|
+
const mainTargetPath = customPath || 'docs/forge.md'
|
|
64
|
+
const mainFullPath = path.resolve(cwd, mainTargetPath)
|
|
65
|
+
const mainDirPath = path.dirname(mainFullPath)
|
|
66
|
+
|
|
67
|
+
console.log(`Downloading ForgeHive LLM guide to: ${mainTargetPath}`)
|
|
62
68
|
|
|
63
69
|
// Check if file already exists
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
console.log(`Warning: File already exists at ${
|
|
70
|
+
const mainFileExists = await checkFileExists(mainFullPath)
|
|
71
|
+
if (mainFileExists) {
|
|
72
|
+
console.log(`Warning: File already exists at ${mainTargetPath}. It will be overwritten.`)
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
// Download the
|
|
70
|
-
const
|
|
75
|
+
// Download the main guide content
|
|
76
|
+
const mainContent = await fetchFile(LLM_GUIDE_URL)
|
|
71
77
|
|
|
72
78
|
// Create directory if it doesn't exist
|
|
73
|
-
await createDirectory(
|
|
79
|
+
await createDirectory(mainDirPath)
|
|
80
|
+
|
|
81
|
+
// Write the main guide file
|
|
82
|
+
await writeFile(mainFullPath, mainContent)
|
|
83
|
+
|
|
84
|
+
console.log(`✅ Successfully downloaded ForgeHive LLM guide to ${mainTargetPath}`)
|
|
85
|
+
|
|
86
|
+
results.push({
|
|
87
|
+
type: 'main',
|
|
88
|
+
filePath: mainFullPath,
|
|
89
|
+
targetPath: mainTargetPath,
|
|
90
|
+
size: mainContent.length
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// Download Hive logging guide if --logs flag is provided
|
|
94
|
+
if (logs) {
|
|
95
|
+
const logsTargetPath = customPath
|
|
96
|
+
? path.join(path.dirname(customPath), 'hive-logging.md')
|
|
97
|
+
: 'docs/hive-logging.md'
|
|
98
|
+
const logsFullPath = path.resolve(cwd, logsTargetPath)
|
|
99
|
+
const logsDirPath = path.dirname(logsFullPath)
|
|
100
|
+
|
|
101
|
+
console.log(`Downloading Hive Logging guide to: ${logsTargetPath}`)
|
|
74
102
|
|
|
75
|
-
|
|
76
|
-
|
|
103
|
+
// Check if logs file already exists
|
|
104
|
+
const logsFileExists = await checkFileExists(logsFullPath)
|
|
105
|
+
if (logsFileExists) {
|
|
106
|
+
console.log(`Warning: File already exists at ${logsTargetPath}. It will be overwritten.`)
|
|
107
|
+
}
|
|
77
108
|
|
|
78
|
-
|
|
109
|
+
// Download the logs guide content
|
|
110
|
+
const logsContent = await fetchFile(LLM_HIVE_LOGGING_URL)
|
|
111
|
+
|
|
112
|
+
// Create directory if it doesn't exist
|
|
113
|
+
await createDirectory(logsDirPath)
|
|
114
|
+
|
|
115
|
+
// Write the logs guide file
|
|
116
|
+
await writeFile(logsFullPath, logsContent)
|
|
117
|
+
|
|
118
|
+
console.log(`✅ Successfully downloaded Hive Logging guide to ${logsTargetPath}`)
|
|
119
|
+
|
|
120
|
+
results.push({
|
|
121
|
+
type: 'logs',
|
|
122
|
+
filePath: logsFullPath,
|
|
123
|
+
targetPath: logsTargetPath,
|
|
124
|
+
size: logsContent.length
|
|
125
|
+
})
|
|
126
|
+
}
|
|
79
127
|
|
|
80
128
|
return {
|
|
81
129
|
success: true,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
size: content.length
|
|
130
|
+
downloads: results,
|
|
131
|
+
totalFiles: results.length
|
|
85
132
|
}
|
|
86
133
|
}
|
|
87
134
|
})
|