@aspects-ai/workspace-cli 0.1.0 → 0.1.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/README.md +14 -16
- package/dist/index.js +46 -13
- package/dist/registry/libraries.json +4 -20
- package/package.json +1 -1
- package/src/registry/libraries.json +4 -20
package/README.md
CHANGED
|
@@ -176,28 +176,27 @@ Libraries are defined in `src/registry/libraries.json`:
|
|
|
176
176
|
"animate-core": {
|
|
177
177
|
"name": "@aspects-ai/noodle-animate-core",
|
|
178
178
|
"description": "Core animation components for Noodle videos",
|
|
179
|
-
"version": "0.1.3",
|
|
180
179
|
"repository": {
|
|
181
180
|
"url": "https://github.com/aspects-ai/noodle-templates.git",
|
|
182
181
|
"directory": "noodle-animate-core/src",
|
|
183
|
-
"branch": "main"
|
|
182
|
+
"branch": "main",
|
|
183
|
+
"packageJsonPath": "noodle-animate-core/package.json"
|
|
184
184
|
},
|
|
185
|
-
"installPath": "animate-core"
|
|
186
|
-
"dependencies": {
|
|
187
|
-
"react": "19.1.0",
|
|
188
|
-
"remotion": "4.0.356"
|
|
189
|
-
}
|
|
185
|
+
"installPath": "animate-core"
|
|
190
186
|
}
|
|
191
187
|
}
|
|
192
188
|
}
|
|
193
189
|
```
|
|
194
190
|
|
|
191
|
+
**Automatic Detection**: The CLI automatically reads both the `version` and `dependencies` from the library's `package.json` in the git repository. You don't need to hardcode these values in the registry - they're always fetched from the source of truth.
|
|
192
|
+
|
|
195
193
|
## How It Works
|
|
196
194
|
|
|
197
195
|
1. **Git Sparse Checkout**: The CLI uses git sparse checkout to efficiently fetch only the required directory from the repository
|
|
198
|
-
2. **
|
|
199
|
-
3. **
|
|
200
|
-
4. **
|
|
196
|
+
2. **Automatic Metadata Detection**: Both version and dependencies are read from the library's `package.json` in the repository, so they're always up-to-date
|
|
197
|
+
3. **Local Installation**: Files are copied to `./core/<library-name>/` in your workspace
|
|
198
|
+
4. **Dependency Management**: Required dependencies are automatically added to your `package.json`
|
|
199
|
+
5. **Version Tracking**: The exact git commit hash and detected version are stored for reproducibility
|
|
201
200
|
|
|
202
201
|
## Error Handling
|
|
203
202
|
|
|
@@ -249,20 +248,19 @@ Example:
|
|
|
249
248
|
"my-library": {
|
|
250
249
|
"name": "@aspects-ai/my-library",
|
|
251
250
|
"description": "Description of the library",
|
|
252
|
-
"version": "1.0.0",
|
|
253
251
|
"repository": {
|
|
254
252
|
"url": "https://github.com/org/repo.git",
|
|
255
253
|
"directory": "path/to/library/src",
|
|
256
|
-
"branch": "main"
|
|
254
|
+
"branch": "main",
|
|
255
|
+
"packageJsonPath": "path/to/library/package.json"
|
|
257
256
|
},
|
|
258
|
-
"installPath": "my-library"
|
|
259
|
-
"dependencies": {
|
|
260
|
-
"react": "^18.0.0"
|
|
261
|
-
}
|
|
257
|
+
"installPath": "my-library"
|
|
262
258
|
}
|
|
263
259
|
}
|
|
264
260
|
```
|
|
265
261
|
|
|
262
|
+
**Note**: Both `version` and `dependencies` fields are optional. If you provide `packageJsonPath`, the CLI will automatically read these from the library's `package.json` in the repository. This keeps the registry minimal and ensures values are always current.
|
|
263
|
+
|
|
266
264
|
## License
|
|
267
265
|
|
|
268
266
|
ISC
|
package/dist/index.js
CHANGED
|
@@ -165,15 +165,19 @@ import { z as z2 } from "zod";
|
|
|
165
165
|
var RepositorySchema = z2.object({
|
|
166
166
|
url: z2.string(),
|
|
167
167
|
directory: z2.string(),
|
|
168
|
-
branch: z2.string()
|
|
168
|
+
branch: z2.string(),
|
|
169
|
+
packageJsonPath: z2.string().optional()
|
|
170
|
+
// Path to package.json in repo (e.g., "noodle-animate-core/package.json")
|
|
169
171
|
});
|
|
170
172
|
var LibrarySchema = z2.object({
|
|
171
173
|
name: z2.string(),
|
|
172
174
|
description: z2.string(),
|
|
173
|
-
version: z2.string(),
|
|
175
|
+
version: z2.string().optional(),
|
|
176
|
+
// Optional - if not provided, will be read from package.json in repo
|
|
174
177
|
repository: RepositorySchema,
|
|
175
178
|
installPath: z2.string(),
|
|
176
|
-
dependencies: z2.record(z2.string())
|
|
179
|
+
dependencies: z2.record(z2.string()).optional()
|
|
180
|
+
// Optional - if not provided, will be read from package.json in repo
|
|
177
181
|
});
|
|
178
182
|
var RegistrySchema = z2.object({
|
|
179
183
|
libraries: z2.record(LibrarySchema)
|
|
@@ -215,7 +219,8 @@ function createListCommand() {
|
|
|
215
219
|
const libraries = await listLibraries();
|
|
216
220
|
logger.log(chalk2.bold("\nAvailable libraries:\n"));
|
|
217
221
|
for (const { name, library } of libraries) {
|
|
218
|
-
|
|
222
|
+
const versionStr = library.version ? ` @${library.version}` : " @latest";
|
|
223
|
+
logger.log(chalk2.cyan(` ${name}`) + chalk2.gray(versionStr));
|
|
219
224
|
logger.log(` ${library.description}`);
|
|
220
225
|
logger.log("");
|
|
221
226
|
}
|
|
@@ -251,8 +256,13 @@ async function fetchDirectory(options) {
|
|
|
251
256
|
await execa("git", ["remote", "add", "origin", repoUrl], { cwd: tempDir });
|
|
252
257
|
await execa("git", ["config", "core.sparseCheckout", "true"], { cwd: tempDir });
|
|
253
258
|
const sparseFile = path3.join(tempDir, ".git", "info", "sparse-checkout");
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
let sparsePaths = `${options.directory}/*
|
|
260
|
+
`;
|
|
261
|
+
if (options.packageJsonPath) {
|
|
262
|
+
sparsePaths += `${options.packageJsonPath}
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
await fs3.writeFile(sparseFile, sparsePaths);
|
|
256
266
|
await execa("git", ["pull", "origin", options.branch, "--depth=1"], {
|
|
257
267
|
cwd: tempDir,
|
|
258
268
|
stderr: "pipe"
|
|
@@ -267,7 +277,26 @@ async function fetchDirectory(options) {
|
|
|
267
277
|
overwrite: true,
|
|
268
278
|
errorOnExist: false
|
|
269
279
|
});
|
|
270
|
-
|
|
280
|
+
let version = null;
|
|
281
|
+
let dependencies = {};
|
|
282
|
+
if (options.packageJsonPath) {
|
|
283
|
+
const packageJsonFullPath = path3.join(tempDir, options.packageJsonPath);
|
|
284
|
+
if (await fs3.pathExists(packageJsonFullPath)) {
|
|
285
|
+
try {
|
|
286
|
+
const packageJson = await fs3.readJson(packageJsonFullPath);
|
|
287
|
+
version = packageJson.version || null;
|
|
288
|
+
dependencies = packageJson.dependencies || {};
|
|
289
|
+
} catch (error) {
|
|
290
|
+
version = null;
|
|
291
|
+
dependencies = {};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
commit: commit.trim(),
|
|
297
|
+
version,
|
|
298
|
+
dependencies
|
|
299
|
+
};
|
|
271
300
|
} catch (error) {
|
|
272
301
|
if (error.stderr && error.stderr.includes("Authentication failed")) {
|
|
273
302
|
throw new Error(
|
|
@@ -305,20 +334,24 @@ Use --force to reinstall.`
|
|
|
305
334
|
const config = await loadWorkspaceConfig(workspaceRoot);
|
|
306
335
|
const coreDir = config?.coreDir || "./core";
|
|
307
336
|
const targetPath = path4.join(workspaceRoot, coreDir, library.installPath);
|
|
308
|
-
|
|
309
|
-
|
|
337
|
+
const versionDisplay = library.version || "latest";
|
|
338
|
+
logger.info(`Fetching ${libraryName}@${versionDisplay} from git...`);
|
|
339
|
+
const result = await fetchDirectory({
|
|
310
340
|
repository: library.repository.url,
|
|
311
341
|
directory: library.repository.directory,
|
|
312
342
|
branch: library.repository.branch,
|
|
313
343
|
token,
|
|
314
|
-
targetPath
|
|
344
|
+
targetPath,
|
|
345
|
+
packageJsonPath: library.repository.packageJsonPath
|
|
315
346
|
});
|
|
347
|
+
const actualVersion = result.version || library.version || "unknown";
|
|
348
|
+
const actualDependencies = Object.keys(result.dependencies).length > 0 ? result.dependencies : library.dependencies || {};
|
|
316
349
|
logger.info(`Installed to ${path4.relative(workspaceRoot, targetPath)}`);
|
|
317
350
|
logger.info(`Updating workspace.config.json...`);
|
|
318
|
-
await addLibraryToConfig(workspaceRoot, libraryName,
|
|
319
|
-
await updatePackageDependencies(workspaceRoot,
|
|
351
|
+
await addLibraryToConfig(workspaceRoot, libraryName, actualVersion, result.commit);
|
|
352
|
+
await updatePackageDependencies(workspaceRoot, actualDependencies);
|
|
320
353
|
logger.success(
|
|
321
|
-
`Installed ${libraryName}@${
|
|
354
|
+
`Installed ${libraryName}@${actualVersion} (commit: ${result.commit.substring(0, 7)})`
|
|
322
355
|
);
|
|
323
356
|
}
|
|
324
357
|
async function updatePackageDependencies(workspaceRoot, dependencies) {
|
|
@@ -3,29 +3,13 @@
|
|
|
3
3
|
"animate-core": {
|
|
4
4
|
"name": "@aspects-ai/noodle-animate-core",
|
|
5
5
|
"description": "Core animation components for Noodle videos",
|
|
6
|
-
"version": "0.1.3",
|
|
7
6
|
"repository": {
|
|
8
7
|
"url": "https://github.com/aspects-ai/noodle-templates.git",
|
|
9
8
|
"directory": "noodle-animate-core/src",
|
|
10
|
-
"branch": "main"
|
|
9
|
+
"branch": "main",
|
|
10
|
+
"packageJsonPath": "noodle-animate-core/package.json"
|
|
11
11
|
},
|
|
12
|
-
"installPath": "animate-core"
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"react": "19.1.0",
|
|
15
|
-
"react-dom": "19.1.0",
|
|
16
|
-
"remotion": "4.0.356",
|
|
17
|
-
"react-rnd": "^10.5.2",
|
|
18
|
-
"class-variance-authority": "^0.7.1",
|
|
19
|
-
"clsx": "^2.1.1",
|
|
20
|
-
"cmdk": "^1.1.1",
|
|
21
|
-
"date-fns": "^4.1.0",
|
|
22
|
-
"embla-carousel-react": "^8.6.0",
|
|
23
|
-
"input-otp": "^1.4.2",
|
|
24
|
-
"lucide-react": "^0.542.0",
|
|
25
|
-
"tailwind-merge": "^3.3.1",
|
|
26
|
-
"tailwindcss-animate": "^1.0.7",
|
|
27
|
-
"vaul": "^1.1.2"
|
|
28
|
-
}
|
|
12
|
+
"installPath": "animate-core"
|
|
29
13
|
}
|
|
30
14
|
}
|
|
31
|
-
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -3,29 +3,13 @@
|
|
|
3
3
|
"animate-core": {
|
|
4
4
|
"name": "@aspects-ai/noodle-animate-core",
|
|
5
5
|
"description": "Core animation components for Noodle videos",
|
|
6
|
-
"version": "0.1.3",
|
|
7
6
|
"repository": {
|
|
8
7
|
"url": "https://github.com/aspects-ai/noodle-templates.git",
|
|
9
8
|
"directory": "noodle-animate-core/src",
|
|
10
|
-
"branch": "main"
|
|
9
|
+
"branch": "main",
|
|
10
|
+
"packageJsonPath": "noodle-animate-core/package.json"
|
|
11
11
|
},
|
|
12
|
-
"installPath": "animate-core"
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"react": "19.1.0",
|
|
15
|
-
"react-dom": "19.1.0",
|
|
16
|
-
"remotion": "4.0.356",
|
|
17
|
-
"react-rnd": "^10.5.2",
|
|
18
|
-
"class-variance-authority": "^0.7.1",
|
|
19
|
-
"clsx": "^2.1.1",
|
|
20
|
-
"cmdk": "^1.1.1",
|
|
21
|
-
"date-fns": "^4.1.0",
|
|
22
|
-
"embla-carousel-react": "^8.6.0",
|
|
23
|
-
"input-otp": "^1.4.2",
|
|
24
|
-
"lucide-react": "^0.542.0",
|
|
25
|
-
"tailwind-merge": "^3.3.1",
|
|
26
|
-
"tailwindcss-animate": "^1.0.7",
|
|
27
|
-
"vaul": "^1.1.2"
|
|
28
|
-
}
|
|
12
|
+
"installPath": "animate-core"
|
|
29
13
|
}
|
|
30
14
|
}
|
|
31
|
-
}
|
|
15
|
+
}
|