@a5gard/asgard 0.0.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 (207) hide show
  1. package/.env +2 -0
  2. package/.gitignore copy +6 -0
  3. package/.vscode/ntrsync/.vscode/ocrmnavigator/id.txt +1 -0
  4. package/.vscode/ntrsync/.vscode/ocrmnavigator.code-snippets +3664 -0
  5. package/.vscode/ntrsync/00002_CRM URGENT_todo.md +79 -0
  6. package/.vscode/ntrsync/10005_notes repo url.md +3 -0
  7. package/.vscode/ntrsync/10012_vscode_color_settings.md +133 -0
  8. package/.vscode/ntrsync/10013_Googles Snapchat Upload Hack note.md +11 -0
  9. package/.vscode/ntrsync/10014_APP IDEA - Lawyer CRM.md +229 -0
  10. package/.vscode/ntrsync/10015_APP IDEA - Onlyfans.md +293 -0
  11. package/.vscode/ntrsync/10016_notes repo url.md +3 -0
  12. package/.vscode/ntrsync/10504_adhd symptom.md +3 -0
  13. package/.vscode/ntrsync/10505_APP IDEA - GMAIL.md +39 -0
  14. package/.vscode/ntrsync/10506_container home - build mats.md +18 -0
  15. package/.vscode/ntrsync/10507_cleint facing site meta and loader function.md +25 -0
  16. package/.vscode/ntrsync/10508_Sabaak VSCode 1-8 players - private teams, solo q, duos q.md +11 -0
  17. package/.vscode/ntrsync/10509_schema dump.md +80 -0
  18. package/.vscode/ntrsync/10510_APPT BEACONHILL_reminder.md +7 -0
  19. package/.vscode/ntrsync/10512_clipboard very usefull should use asap within all apps.md +101 -0
  20. package/.vscode/ntrsync/10516_DevStack_todo.md +130 -0
  21. package/.vscode/ntrsync/10517_CRM_todo.md +95 -0
  22. package/.vscode/ntrsync/10518_Catalyst POS_todo.md +73 -0
  23. package/.vscode/ntrsync/10519_Catalyst Software_todo.md +497 -0
  24. package/.vscode/ntrsync/10523_new note.md +6 -0
  25. package/.vscode/ntrsync/10524_New Reminder_reminder.md +5 -0
  26. package/.vscode/ntrsync/10525_Mobile - Notes, To-Dos And Things_todo.md +4 -0
  27. package/.vscode/ntrsync/90002_COMPLETED_todo.md +97 -0
  28. package/.vscode/ntrsync/README.md +1 -0
  29. package/.vscode/ocrmnavigator/id.txt +1 -0
  30. package/.vscode/ocrmnavigator.code-snippets +349 -0
  31. package/.vscode/settings.json +1 -0
  32. package/CHANGELOG.md +6 -0
  33. package/LICENSE.md +21 -0
  34. package/README.md +1612 -0
  35. package/bin/dev.cmd +3 -0
  36. package/bin/dev.js +17 -0
  37. package/bin/run.cmd +3 -0
  38. package/bin/run.js +5 -0
  39. package/config.asgard +8 -0
  40. package/dist/commands/add-source.d.ts +9 -0
  41. package/dist/commands/add-source.d.ts.map +1 -0
  42. package/dist/commands/add-source.js +68 -0
  43. package/dist/commands/add-source.js.map +1 -0
  44. package/dist/commands/baldr.d.ts +5 -0
  45. package/dist/commands/baldr.d.ts.map +1 -0
  46. package/dist/commands/baldr.js +35 -0
  47. package/dist/commands/baldr.js.map +1 -0
  48. package/dist/commands/combine-timelines.d.ts +5 -0
  49. package/dist/commands/combine-timelines.d.ts.map +1 -0
  50. package/dist/commands/combine-timelines.js +53 -0
  51. package/dist/commands/combine-timelines.js.map +1 -0
  52. package/dist/commands/create-project.d.ts +10 -0
  53. package/dist/commands/create-project.d.ts.map +1 -0
  54. package/dist/commands/create-project.js +195 -0
  55. package/dist/commands/create-project.js.map +1 -0
  56. package/dist/commands/create-timeline.d.ts +8 -0
  57. package/dist/commands/create-timeline.d.ts.map +1 -0
  58. package/dist/commands/create-timeline.js +54 -0
  59. package/dist/commands/create-timeline.js.map +1 -0
  60. package/dist/commands/delete-project.d.ts +5 -0
  61. package/dist/commands/delete-project.d.ts.map +1 -0
  62. package/dist/commands/delete-project.js +47 -0
  63. package/dist/commands/delete-project.js.map +1 -0
  64. package/dist/commands/delete-source.d.ts +8 -0
  65. package/dist/commands/delete-source.d.ts.map +1 -0
  66. package/dist/commands/delete-source.js +57 -0
  67. package/dist/commands/delete-source.js.map +1 -0
  68. package/dist/commands/delete-timeline.d.ts +8 -0
  69. package/dist/commands/delete-timeline.d.ts.map +1 -0
  70. package/dist/commands/delete-timeline.js +54 -0
  71. package/dist/commands/delete-timeline.js.map +1 -0
  72. package/dist/commands/delete-version.d.ts +8 -0
  73. package/dist/commands/delete-version.d.ts.map +1 -0
  74. package/dist/commands/delete-version.js +65 -0
  75. package/dist/commands/delete-version.js.map +1 -0
  76. package/dist/commands/download-file.d.ts +17 -0
  77. package/dist/commands/download-file.d.ts.map +1 -0
  78. package/dist/commands/download-file.js +87 -0
  79. package/dist/commands/download-file.js.map +1 -0
  80. package/dist/commands/download-folder.d.ts +18 -0
  81. package/dist/commands/download-folder.d.ts.map +1 -0
  82. package/dist/commands/download-folder.js +111 -0
  83. package/dist/commands/download-folder.js.map +1 -0
  84. package/dist/commands/download-source.d.ts +12 -0
  85. package/dist/commands/download-source.d.ts.map +1 -0
  86. package/dist/commands/download-source.js +46 -0
  87. package/dist/commands/download-source.js.map +1 -0
  88. package/dist/commands/gh-setup.d.ts +7 -0
  89. package/dist/commands/gh-setup.d.ts.map +1 -0
  90. package/dist/commands/gh-setup.js +106 -0
  91. package/dist/commands/gh-setup.js.map +1 -0
  92. package/dist/commands/load-project.d.ts +5 -0
  93. package/dist/commands/load-project.d.ts.map +1 -0
  94. package/dist/commands/load-project.js +56 -0
  95. package/dist/commands/load-project.js.map +1 -0
  96. package/dist/commands/menu.d.ts +5 -0
  97. package/dist/commands/menu.d.ts.map +1 -0
  98. package/dist/commands/menu.js +41 -0
  99. package/dist/commands/menu.js.map +1 -0
  100. package/dist/commands/midgardr.d.ts +5 -0
  101. package/dist/commands/midgardr.d.ts.map +1 -0
  102. package/dist/commands/midgardr.js +24 -0
  103. package/dist/commands/midgardr.js.map +1 -0
  104. package/dist/commands/publish-project.d.ts +5 -0
  105. package/dist/commands/publish-project.d.ts.map +1 -0
  106. package/dist/commands/publish-project.js +102 -0
  107. package/dist/commands/publish-project.js.map +1 -0
  108. package/dist/commands/replace-timeline.d.ts +8 -0
  109. package/dist/commands/replace-timeline.d.ts.map +1 -0
  110. package/dist/commands/replace-timeline.js +63 -0
  111. package/dist/commands/replace-timeline.js.map +1 -0
  112. package/dist/commands/restore-version.d.ts +8 -0
  113. package/dist/commands/restore-version.d.ts.map +1 -0
  114. package/dist/commands/restore-version.js +67 -0
  115. package/dist/commands/restore-version.js.map +1 -0
  116. package/dist/commands/save-project.d.ts +8 -0
  117. package/dist/commands/save-project.d.ts.map +1 -0
  118. package/dist/commands/save-project.js +43 -0
  119. package/dist/commands/save-project.js.map +1 -0
  120. package/dist/commands/set-source.d.ts +9 -0
  121. package/dist/commands/set-source.d.ts.map +1 -0
  122. package/dist/commands/set-source.js +59 -0
  123. package/dist/commands/set-source.js.map +1 -0
  124. package/dist/commands/switch-timeline.d.ts +8 -0
  125. package/dist/commands/switch-timeline.d.ts.map +1 -0
  126. package/dist/commands/switch-timeline.js +61 -0
  127. package/dist/commands/switch-timeline.js.map +1 -0
  128. package/dist/commands/sync-source.d.ts +5 -0
  129. package/dist/commands/sync-source.d.ts.map +1 -0
  130. package/dist/commands/sync-source.js +29 -0
  131. package/dist/commands/sync-source.js.map +1 -0
  132. package/dist/commands/upload-project+++.d.ts +5 -0
  133. package/dist/commands/upload-project+++.d.ts.map +1 -0
  134. package/dist/commands/upload-project+++.js +32 -0
  135. package/dist/commands/upload-project+++.js.map +1 -0
  136. package/dist/commands/upload-project++.d.ts +5 -0
  137. package/dist/commands/upload-project++.d.ts.map +1 -0
  138. package/dist/commands/upload-project++.js +33 -0
  139. package/dist/commands/upload-project++.js.map +1 -0
  140. package/dist/commands/upload-project+.d.ts +5 -0
  141. package/dist/commands/upload-project+.d.ts.map +1 -0
  142. package/dist/commands/upload-project+.js +40 -0
  143. package/dist/commands/upload-project+.js.map +1 -0
  144. package/dist/commands/upload-project.d.ts +5 -0
  145. package/dist/commands/upload-project.d.ts.map +1 -0
  146. package/dist/commands/upload-project.js +29 -0
  147. package/dist/commands/upload-project.js.map +1 -0
  148. package/dist/commands/view-timeline.d.ts +5 -0
  149. package/dist/commands/view-timeline.d.ts.map +1 -0
  150. package/dist/commands/view-timeline.js +39 -0
  151. package/dist/commands/view-timeline.js.map +1 -0
  152. package/dist/commands/view-versions.d.ts +5 -0
  153. package/dist/commands/view-versions.d.ts.map +1 -0
  154. package/dist/commands/view-versions.js +45 -0
  155. package/dist/commands/view-versions.js.map +1 -0
  156. package/dist/git/helpers.d.ts +10 -0
  157. package/dist/git/helpers.d.ts.map +1 -0
  158. package/dist/git/helpers.js +300 -0
  159. package/dist/git/helpers.js.map +1 -0
  160. package/dist/git/sync-repo.d.ts +2 -0
  161. package/dist/git/sync-repo.d.ts.map +1 -0
  162. package/dist/git/sync-repo.js +17 -0
  163. package/dist/git/sync-repo.js.map +1 -0
  164. package/dist/index.d.ts +2 -0
  165. package/dist/index.d.ts.map +1 -0
  166. package/dist/index.js +3 -0
  167. package/dist/index.js.map +1 -0
  168. package/dist/utils/box.d.ts +11 -0
  169. package/dist/utils/box.d.ts.map +1 -0
  170. package/dist/utils/box.js +158 -0
  171. package/dist/utils/box.js.map +1 -0
  172. package/ideas.md +46 -0
  173. package/package.json +53 -0
  174. package/src/commands/add-source.js +72 -0
  175. package/src/commands/baldr.js +38 -0
  176. package/src/commands/combine-timelines.js +65 -0
  177. package/src/commands/create-project.js +216 -0
  178. package/src/commands/create-timeline.js +60 -0
  179. package/src/commands/delete-project.js +54 -0
  180. package/src/commands/delete-source.js +63 -0
  181. package/src/commands/delete-timeline.js +63 -0
  182. package/src/commands/delete-version.js +74 -0
  183. package/src/commands/download-file.js +101 -0
  184. package/src/commands/download-folder.js +123 -0
  185. package/src/commands/download-source.js +51 -0
  186. package/src/commands/gh-setup.js +77 -0
  187. package/src/commands/load-project.js +63 -0
  188. package/src/commands/menu.js +46 -0
  189. package/src/commands/midgardr.js +25 -0
  190. package/src/commands/publish-project.js +167 -0
  191. package/src/commands/replace-timeline.js +76 -0
  192. package/src/commands/restore-version.js +80 -0
  193. package/src/commands/save-project.js +48 -0
  194. package/src/commands/set-source.js +65 -0
  195. package/src/commands/switch-timeline.js +69 -0
  196. package/src/commands/sync-source.js +32 -0
  197. package/src/commands/upload-project+++.js +34 -0
  198. package/src/commands/upload-project++.js +35 -0
  199. package/src/commands/upload-project+.js +47 -0
  200. package/src/commands/upload-project.js +31 -0
  201. package/src/commands/view-timeline.js +43 -0
  202. package/src/commands/view-versions.js +50 -0
  203. package/src/git/helpers.js +333 -0
  204. package/src/git/sync-repo.js +16 -0
  205. package/src/index.js +2 -0
  206. package/src/utils/box.js +282 -0
  207. package/tsconfig.json +23 -0
@@ -0,0 +1,43 @@
1
+ import { Command } from '@oclif/core';
2
+ import { execSync } from 'child_process';
3
+ import ora from 'ora';
4
+ import { boxStart, boxDivider, boxEnd, boxLine } from '../utils/box.js';
5
+
6
+ export default class ViewTimeline extends Command {
7
+ static description = 'Show all workspaces in your project';
8
+
9
+ async run() {
10
+ const cwd = process.cwd();
11
+ boxStart('View Timeline');
12
+
13
+ const spinner = ora('Loading workspaces...').start();
14
+
15
+ try {
16
+ const current = execSync('git branch --show-current', { cwd, encoding: 'utf8' }).trim();
17
+ const branchesRaw = execSync('git branch --format="%(refname:short)"', { cwd, encoding: 'utf8' }).trim();
18
+ const branches = branchesRaw ? branchesRaw.split('\n') : [];
19
+
20
+ spinner.stop();
21
+
22
+ boxLine('Available Workspaces:');
23
+ boxDivider();
24
+
25
+ branches.forEach(branch => {
26
+ if (branch === current) {
27
+ boxLine(`* ${branch} (current)`, 'success');
28
+ } else {
29
+ boxLine(` ${branch}`, 'info');
30
+ }
31
+ });
32
+
33
+ boxDivider();
34
+ boxEnd(true, 'Complete');
35
+ } catch (error) {
36
+ spinner.stop();
37
+ const msg = error.stderr ? error.stderr.toString() : error.message;
38
+ boxLine(msg, 'error');
39
+ boxDivider();
40
+ boxEnd(false, 'Failed to load workspaces');
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,50 @@
1
+ import { Command } from '@oclif/core';
2
+ import { execSync } from 'child_process';
3
+ import ora from 'ora';
4
+ import { boxStart, boxDivider, boxEnd, boxLine } from '../utils/box.js';
5
+
6
+ export default class ViewVersions extends Command {
7
+ static description = 'Show all labeled versions of your project';
8
+
9
+ async run() {
10
+ const cwd = process.cwd();
11
+ boxStart('View Versions');
12
+
13
+ const spinner = ora('Loading versions...').start();
14
+
15
+ try {
16
+ let tags = [];
17
+ try {
18
+ const tagsRaw = execSync('git tag', { cwd, encoding: 'utf8' }).trim();
19
+ tags = tagsRaw ? tagsRaw.split('\n') : [];
20
+ } catch (e) {
21
+ tags = [];
22
+ }
23
+
24
+ spinner.stop();
25
+
26
+ if (tags.length === 0) {
27
+ boxLine('No versions found', 'warning');
28
+ boxDivider();
29
+ boxEnd(false, 'No versions available');
30
+ return;
31
+ }
32
+
33
+ boxLine('Labeled Versions:');
34
+ boxDivider();
35
+
36
+ tags.forEach(tag => {
37
+ boxLine(` ${tag}`, 'info');
38
+ });
39
+
40
+ boxDivider();
41
+ boxEnd(true, 'Complete');
42
+ } catch (error) {
43
+ spinner.stop();
44
+ const msg = error.stderr ? error.stderr.toString() : error.message;
45
+ boxLine(msg, 'error');
46
+ boxDivider();
47
+ boxEnd(false, 'Failed to load versions');
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,333 @@
1
+ import simpleGit from 'simple-git';
2
+ import ora from 'ora';
3
+ import { success, error } from '../utils/box.js';
4
+ import inquirer from 'inquirer';
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import os from 'os';
8
+ import { execSync } from 'child_process';
9
+ import chalk from 'chalk';
10
+
11
+
12
+ export async function bumpVersion(releaseType = 'patch') {
13
+ const packagePath = path.resolve(process.cwd(), 'package.json');
14
+
15
+ const cwd = process.cwd();
16
+ const configPath = path.join(cwd, 'config.asgard');
17
+ let packageManager = 'pnpm';
18
+
19
+ if (fs.existsSync(configPath)) {
20
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
21
+ packageManager = config.packageManager || 'pnpm';
22
+ }
23
+
24
+
25
+
26
+ execSync(`${packageManager} version ${releaseType}`, { cwd, stdio: 'inherit' });
27
+ execSync(`git push`, { cwd, stdio: 'inherit' });
28
+ execSync(`git push --tags`, { cwd, stdio: 'inherit' });
29
+ }
30
+
31
+
32
+ export async function addCommitPush(message) {
33
+ const spinner = ora('Saving changes...').start();
34
+ const cwd = process.cwd();
35
+
36
+ try {
37
+ spinner.text = 'Staging changes...';
38
+ execSync('git add .', { cwd });
39
+
40
+ spinner.text = 'Committing...';
41
+ // We use a check to see if there are actually changes to avoid "nothing to commit" errors
42
+ execSync(`git commit -m "${message}"`, { cwd, stdio: 'pipe' });
43
+
44
+ spinner.text = 'Pushing to remote...';
45
+ execSync('git push', { cwd, stdio: 'pipe' });
46
+
47
+ spinner.stop();
48
+ return true;
49
+ } catch (err) {
50
+ spinner.stop();
51
+ // If the error is just "nothing to commit", we can handle it gracefully
52
+ if (err.stdout && err.stdout.toString().includes('nothing to commit')) {
53
+ return true;
54
+ }
55
+ throw new Error(err.stderr ? err.stderr.toString() : err.message);
56
+ }
57
+ }
58
+ export async function downloadFolder(repoUrl, folder, branch = 'main') {
59
+ const spinner = ora('Downloading folder').start();
60
+ const git = simpleGit();
61
+ const tempDir = `.temp-${Date.now()}`;
62
+
63
+ try {
64
+ await git.init(tempDir);
65
+ await git.cwd(tempDir);
66
+ await git.addRemote('origin', repoUrl);
67
+ await git.addConfig('core.sparseCheckout', 'true');
68
+
69
+ const sparseCheckoutPath = `${tempDir}/.git/info/sparse-checkout`;
70
+ await Bun.write(sparseCheckoutPath, folder);
71
+
72
+ spinner.text = 'Pulling folder';
73
+ await git.pull('origin', branch);
74
+
75
+ spinner.stop();
76
+ success(`Folder downloaded to: ${tempDir}`);
77
+ return tempDir;
78
+ } catch (err) {
79
+ spinner.stop();
80
+ error(`Failed to download folder: ${err.message}`);
81
+ return null;
82
+ }
83
+ }
84
+
85
+ export async function downloadFolderRaw(owner, repo, folder, branch = 'main') {
86
+ const spinner = ora('Downloading folder (raw)').start();
87
+
88
+ try {
89
+ const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${folder}?ref=${branch}`;
90
+ const response = await fetch(apiUrl);
91
+ const files = await response.json();
92
+
93
+ if (!Array.isArray(files)) {
94
+ throw new Error('Not a folder');
95
+ }
96
+
97
+ const targetDir = `./${folder.split('/').pop()}`;
98
+ await Bun.write(`${targetDir}/.gitkeep`, '');
99
+
100
+ for (const file of files) {
101
+ if (file.type === 'file') {
102
+ const fileResponse = await fetch(file.download_url);
103
+ const content = await fileResponse.text();
104
+ await Bun.write(`${targetDir}/${file.name}`, content);
105
+ }
106
+ }
107
+
108
+ spinner.stop();
109
+ success(`Folder downloaded to: ${targetDir}`);
110
+ return targetDir;
111
+ } catch (err) {
112
+ spinner.stop();
113
+ error(`Failed to download folder: ${err.message}`);
114
+ return null;
115
+ }
116
+ }
117
+
118
+ export async function downloadFile(owner, repo, filePath, branch = 'main') {
119
+ const spinner = ora('Downloading file').start();
120
+
121
+ try {
122
+ const url = `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${filePath}`;
123
+ const response = await fetch(url);
124
+
125
+ if (!response.ok) {
126
+ throw new Error('File not found');
127
+ }
128
+
129
+ const content = await response.text();
130
+ const fileName = filePath.split('/').pop();
131
+ await Bun.write(`./${fileName}`, content);
132
+
133
+ spinner.stop();
134
+ success(`File downloaded: ${fileName}`);
135
+ return fileName;
136
+ } catch (err) {
137
+ spinner.stop();
138
+ error(`Failed to download file: ${err.message}`);
139
+ return null;
140
+ }
141
+ }
142
+
143
+
144
+ export async function cloneRepo(repoUrl, targetDir = '') {
145
+ const spinner = ora(`Cloning ${repoUrl}...`).start();
146
+ try {
147
+ // Git handles the URL parsing and directory creation itself
148
+ execSync(`git clone ${repoUrl} ${targetDir}`, { stdio: 'pipe' });
149
+ spinner.stop();
150
+ return true;
151
+ } catch (err) {
152
+ spinner.stop();
153
+ throw new Error(err.stderr ? err.stderr.toString() : err.message);
154
+ }
155
+ }
156
+
157
+ export async function ensureGitConfig() {
158
+ const cwd = process.cwd();
159
+
160
+ try {
161
+ execSync('git config user.name', { stdio: 'ignore' });
162
+ execSync('git config user.email', { stdio: 'ignore' });
163
+ } catch (e) {
164
+ const gitAnswers = await inquirer.prompt([
165
+ { type: 'input', name: 'name', message: 'Git username:', validate: i => i.length > 0 },
166
+ { type: 'input', name: 'email', message: 'Git email:', validate: i => i.includes('@') }
167
+ ]);
168
+
169
+ execSync(`git config --global user.name "${gitAnswers.name}"`, { cwd });
170
+ execSync(`git config --global user.email "${gitAnswers.email}"`, { cwd });
171
+ }
172
+
173
+ }
174
+ export function getGitHubToken() {
175
+ try {
176
+ return execSync('gh auth token', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
177
+ } catch {
178
+ const envToken = process.env.GITHUB_TOKEN;
179
+ if (!envToken) {
180
+ console.error(chalk.red('GitHub token not found. Run: gh auth login'));
181
+ process.exit(1);
182
+ }
183
+ return envToken;
184
+ }
185
+ }
186
+
187
+ export function getLicenseContent(type, owner) {
188
+ const year = new Date().getFullYear();
189
+
190
+ const licenses = {
191
+ 'MIT': `MIT License
192
+
193
+ Copyright (c) ${year} ${owner}
194
+
195
+ Permission is hereby granted, free of charge, to any person obtaining a copy
196
+ of this software and associated documentation files (the "Software"), to deal
197
+ in the Software without restriction, including without limitation the rights
198
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
199
+ copies of the Software, and to permit persons to whom the Software is
200
+ furnished to do so, subject to the following conditions:
201
+
202
+ The above copyright notice and this permission notice shall be included in all
203
+ copies or substantial portions of the Software.
204
+
205
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
206
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
207
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
208
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
209
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
210
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
211
+ SOFTWARE.`,
212
+
213
+ 'Apache-2.0': `Apache License
214
+ Version 2.0, January 2004
215
+ http://www.apache.org/licenses/
216
+
217
+ Copyright ${year} ${owner}
218
+
219
+ Licensed under the Apache License, Version 2.0 (the "License");
220
+ you may not use this file except in compliance with the License.
221
+ You may obtain a copy of the License at
222
+
223
+ http://www.apache.org/licenses/LICENSE-2.0
224
+
225
+ Unless required by applicable law or agreed to in writing, software
226
+ distributed under the License is distributed on an "AS IS" BASIS,
227
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228
+ See the License for the specific language governing permissions and
229
+ limitations under the License.`,
230
+
231
+ 'GPL-3.0': `GNU GENERAL PUBLIC LICENSE
232
+ Version 3, 29 June 2007
233
+
234
+ Copyright (C) ${year} ${owner}
235
+
236
+ This program is free software: you can redistribute it and/or modify
237
+ it under the terms of the GNU General Public License as published by
238
+ the Free Software Foundation, either version 3 of the License, or
239
+ (at your option) any later version.
240
+
241
+ This program is distributed in the hope that it will be useful,
242
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
243
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244
+ GNU General Public License for more details.
245
+
246
+ You should have received a copy of the GNU General Public License
247
+ along with this program. If not, see <https://www.gnu.org/licenses/>.`,
248
+
249
+ 'BSD-3-Clause': `BSD 3-Clause License
250
+
251
+ Copyright (c) ${year}, ${owner}
252
+
253
+ Redistribution and use in source and binary forms, with or without
254
+ modification, are permitted provided that the following conditions are met:
255
+
256
+ 1. Redistributions of source code must retain the above copyright notice, this
257
+ list of conditions and the following disclaimer.
258
+
259
+ 2. Redistributions in binary form must reproduce the above copyright notice,
260
+ this list of conditions and the following disclaimer in the documentation
261
+ and/or other materials provided with the distribution.
262
+
263
+ 3. Neither the name of the copyright holder nor the names of its
264
+ contributors may be used to endorse or promote products derived from
265
+ this software without specific prior written permission.
266
+
267
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
268
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
269
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
270
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
271
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
272
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
273
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
274
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
275
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.`,
277
+
278
+ 'ISC': `ISC License
279
+
280
+ Copyright (c) ${year}, ${owner}
281
+
282
+ Permission to use, copy, modify, and/or distribute this software for any
283
+ purpose with or without fee is hereby granted, provided that the above
284
+ copyright notice and this permission notice appear in all copies.
285
+
286
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
287
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
288
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
289
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
290
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
291
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
292
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.`
293
+ };
294
+
295
+ return licenses[type] || licenses['MIT'];
296
+ }
297
+ /**The short answer is: **Not with a standard `git clone`.** When you clone, Git is designed to grab the entire history of the repository. However, if you are looking to save space or time, there is a modern workflow called **Sparse Checkout** that allows you to tell Git, "I only want to see these specific folders."
298
+
299
+ Here is how you can achieve this without downloading the entire project’s history and files.
300
+
301
+ ---
302
+
303
+ ## The "Sparse Checkout" Method
304
+
305
+ This is the most efficient way to handle this in modern Git (version 2.25 or later). It downloads the repository data but only "checks out" (shows) the folders you care about.
306
+
307
+ 1. **Initialize the repo locally:**
308
+ `git clone --filter=blob:none --sparse <url>`
309
+ *The `--filter=blob:none` flag tells Git not to download the actual file contents until you ask for them.*
310
+ 2. **Navigate into the folder:**
311
+ `cd <repo-name>`
312
+ 3. **Set the specific folder you want:**
313
+ `git sparse-checkout set <path/to/folder>`
314
+
315
+ ---
316
+
317
+ ## Comparison of Approaches
318
+
319
+ | Method | Best For... | Pros | Cons |
320
+ | --- | --- | --- | --- |
321
+ | **Standard Clone** | Small projects | Simple, one command | Downloads everything |
322
+ | **Sparse Checkout** | Monorepos | Saves disk space, very fast | Requires a few extra commands |
323
+ | **Shallow Clone** | Quick CI/CD builds | Fastest download | No commit history (`--depth 1`) |
324
+
325
+ ---
326
+
327
+ ## A Simpler Alternative: GitHub Web
328
+
329
+ If you don't actually need to *code* and just need the files once, tools like **DownGit** or simply using the **GitHub CLI** can sometimes be faster than messing with Git commands.
330
+
331
+ > **Tip:** If you're on GitHub, you can also press the `.` key while viewing the repo in your browser to open the web editor. From there, you can right-click and download specific files without cloning anything.
332
+
333
+ Would you like me to walk you through the exact commands for a specific folder path you have in mind? */
@@ -0,0 +1,16 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import simpleGit from 'simple-git';
4
+ import { execSync } from 'child_process';
5
+
6
+ export async function syncRepo() {
7
+ try {
8
+ const cwd = process.cwd();
9
+ execSync('git add .', { cwd, stdio: 'inherit' });
10
+ execSync('git commit -m "Syncing local repo with remote" || true', { cwd, stdio: 'inherit' });
11
+ execSync('git pull --rebase', { cwd, stdio: 'inherit' });
12
+ execSync('git push', { cwd, stdio: 'inherit' });
13
+ } catch (error) {
14
+ throw new Error(`Sync failed on branch detection/sync: ${error.message}`);
15
+ }
16
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // src/index.js
2
+ export { default as run } from '@oclif/core';