workspace-architect 2.0.4 → 2.1.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/bin/cli.js CHANGED
@@ -16,6 +16,40 @@ const MANIFEST_PATH = path.join(ROOT_DIR, 'assets-manifest.json');
16
16
  // Check if running in local development mode (assets folder exists)
17
17
  const IS_LOCAL = await fs.pathExists(ASSETS_DIR);
18
18
 
19
+ /**
20
+ * Normalize collection items to flat array format for processing.
21
+ * Supports both old flat array format and new nested object format.
22
+ *
23
+ * Old format: ["instructions:reactjs", "prompts:code-review"]
24
+ * New format: { "instructions": ["reactjs"], "prompts": ["code-review"] }
25
+ *
26
+ * @param {Array|Object} items - Collection items in either format
27
+ * @returns {Array} Flat array of items in "type:name" format
28
+ */
29
+ function normalizeCollectionItems(items) {
30
+ if (!items) return [];
31
+
32
+ // If it's already an array (old format), return as-is
33
+ if (Array.isArray(items)) {
34
+ return items;
35
+ }
36
+
37
+ // If it's an object (new format), convert to flat array
38
+ if (typeof items === 'object') {
39
+ const flatItems = [];
40
+ for (const [type, names] of Object.entries(items)) {
41
+ if (Array.isArray(names)) {
42
+ for (const name of names) {
43
+ flatItems.push(`${type}:${name}`);
44
+ }
45
+ }
46
+ }
47
+ return flatItems;
48
+ }
49
+
50
+ return [];
51
+ }
52
+
19
53
  program
20
54
  .name('workspace-architect')
21
55
  .description('CLI to download GitHub Copilot instructions, prompts, and agents (alias: wsa)')
@@ -132,10 +166,10 @@ async function listAssets(type) {
132
166
  } else {
133
167
  // Production Mode (Manifest)
134
168
  const manifest = await getManifest();
135
- const assets = Object.entries(manifest.assets)
136
- .filter(([key, asset]) => asset.type === type)
137
- .map(([key, asset]) => ({
138
- id: key.split(':')[1],
169
+ const typeAssets = manifest.assets[type] || {};
170
+ const assets = Object.entries(typeAssets)
171
+ .map(([id, asset]) => ({
172
+ id,
139
173
  ...asset
140
174
  }));
141
175
 
@@ -178,17 +212,17 @@ async function downloadAsset(id, options) {
178
212
  }
179
213
 
180
214
  const collectionContent = await fs.readJson(sourcePath);
181
- items = collectionContent.items || (Array.isArray(collectionContent) ? collectionContent : []);
215
+ const rawItems = collectionContent.items || (Array.isArray(collectionContent) ? collectionContent : []);
216
+ items = normalizeCollectionItems(rawItems);
182
217
  } else {
183
218
  const manifest = await getManifest();
184
- const key = `${type}:${name}`;
185
- const asset = manifest.assets[key];
219
+ const asset = manifest.assets[type]?.[name];
186
220
 
187
221
  if (!asset) {
188
222
  throw new Error(`Collection not found: ${id}`);
189
223
  }
190
224
 
191
- items = asset.items || [];
225
+ items = normalizeCollectionItems(asset.items || []);
192
226
  }
193
227
 
194
228
  console.log(chalk.blue(`Downloading collection: ${name}`));
@@ -242,8 +276,7 @@ async function downloadAsset(id, options) {
242
276
  content = await fs.readFile(sourcePath, 'utf8');
243
277
  } else {
244
278
  const manifest = await getManifest();
245
- const key = `${type}:${name}`;
246
- const asset = manifest.assets[key];
279
+ const asset = manifest.assets[type]?.[name];
247
280
 
248
281
  if (!asset) {
249
282
  throw new Error(`Asset not found: ${id}`);
@@ -333,11 +366,10 @@ async function downloadSkill(name, options) {
333
366
  } else {
334
367
  // Production mode: fetch from manifest and download from GitHub
335
368
  const manifest = await getManifest();
336
- const key = `skills:${skillName}`;
337
- const asset = manifest.assets[key];
369
+ const asset = manifest.assets.skills?.[skillName];
338
370
 
339
371
  if (!asset) {
340
- throw new Error(`Skill not found: ${key}`);
372
+ throw new Error(`Skill not found: ${skillName}`);
341
373
  }
342
374
 
343
375
  skillPath = asset.path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-architect",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "A comprehensive library of specialized AI agents and personas for GitHub Copilot, ranging from architectural planning and specific tech stacks to advanced cognitive reasoning models.",
5
5
  "bin": {
6
6
  "workspace-architect": "./bin/cli.js",
@@ -11,6 +11,7 @@
11
11
  "test:local": "node bin/cli.js list && node bin/cli.js download instructions a11y --dry-run",
12
12
  "analyze": "node scripts/analyze-collections.js",
13
13
  "generate-manifest": "node scripts/generate-manifest.js",
14
+ "migrate-collections": "node scripts/migrate-collections-format.js",
14
15
  "prepublishOnly": "npm run generate-manifest",
15
16
  "fetch-upstream": "node scripts/fetch-upstream-assets.js",
16
17
  "sync-agents": "node scripts/sync-agents.js",