@valentia-ai-skills/framework 2.0.5 → 2.0.6

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 (3) hide show
  1. package/README.md +18 -16
  2. package/bin/cli.js +105 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -65,14 +65,14 @@ npx ai-skills help # Show help
65
65
  #### Legacy Codebase Intelligence Scanner
66
66
 
67
67
  ```bash
68
- # Add / refresh a project by uploading a scan intelligence package
69
- npx ai-skills legacy-projects add --path ./my-project-intelligence/
68
+ # Upload a scan package to the Skills Console (creates or refreshes the project)
69
+ npx ai-skills upload-legacy-scan --path ./my-project-intelligence/
70
+ npx ai-skills upload-legacy-scan --path ./my-project-intelligence/ --dry-run # validate only
71
+ npx ai-skills upload-legacy-scan --path ./my-project-intelligence/ --token <token>
70
72
 
71
- # Validate the payload without uploading (dry run)
72
- npx ai-skills legacy-projects add --path ./my-project-intelligence/ --dry-run
73
-
74
- # Supply an explicit auth token instead of going through OTP
75
- npx ai-skills legacy-projects add --path ./my-project-intelligence/ --token <your-token>
73
+ # Download a project's skills from the console install into your local AI tools
74
+ npx ai-skills legacy-projects add "My Project"
75
+ npx ai-skills legacy-projects add "My Project" --path ./output-dir/ # also save raw files locally
76
76
 
77
77
  # List all legacy projects for your team
78
78
  npx ai-skills legacy-projects list
@@ -84,10 +84,7 @@ npx ai-skills legacy-projects status "My Project"
84
84
  npx ai-skills legacy-projects remove "My Project"
85
85
  ```
86
86
 
87
- > `upload-legacy-scan` is also available as a direct alias:
88
- > `npx ai-skills upload-legacy-scan --path ./my-project-intelligence/`
89
-
90
- The `--path` directory must contain a `manifest.json` file. See the [Legacy Scanner](#legacy-codebase-intelligence-scanner) section below for the required format.
87
+ The `--path` directory for `upload-legacy-scan` must contain a `manifest.json` file. See the [Legacy Scanner](#legacy-codebase-intelligence-scanner) section below for the required format.
91
88
 
92
89
  ### Environment Variables
93
90
 
@@ -289,10 +286,11 @@ The framework supports ingesting intelligence packages generated by legacy codeb
289
286
  ### How It Works
290
287
 
291
288
  1. **Scan** — A compatible scanner tool analyses an existing codebase and produces an intelligence folder
292
- 2. **Add** — `npx ai-skills legacy-projects add --path <folder>` uploads the package, creating the project if it doesn't exist or replacing its documents if it does
289
+ 2. **Upload** — `npx ai-skills upload-legacy-scan --path <folder>` ships the intelligence package to your team's Skills Console, creating or refreshing the project
293
290
  3. **Review** — Tech leads review auto-generated skills, reports, and diagrams in the Skills Console, approving or flagging each document
294
- 4. **Promote** — Approved skills are promoted into the team's active toolkit and distributed on the next `npx ai-skills update`
295
- 5. **Rescan** — Re-running `add` on the same project name replaces all documents with the latest scan output
291
+ 4. **Install** — Developers run `npx ai-skills legacy-projects add <project-name>` to download approved skills from the console and have them installed into their local AI tools automatically
292
+ 5. **Code** — AI tools (Claude Code, Cursor, Copilot, Windsurf) now have full context about the legacy project's patterns
293
+ 6. **Rescan** — Re-running `upload-legacy-scan` on the same project name replaces all documents with the latest scan output
296
294
 
297
295
  ### Intelligence Package Format
298
296
 
@@ -347,8 +345,12 @@ Approved skills are promoted into the team's standard toolkit and distributed on
347
345
  ### Managing Projects from the CLI
348
346
 
349
347
  ```bash
350
- # Add a new project (or refresh an existing one)
351
- npx ai-skills legacy-projects add --path ./my-project-intelligence/
348
+ # Upload a scan package (add new project or replace existing)
349
+ npx ai-skills upload-legacy-scan --path ./my-project-intelligence/
350
+
351
+ # Download a project's skills and install them into your local AI tools
352
+ npx ai-skills legacy-projects add "My Project"
353
+ npx ai-skills legacy-projects add "My Project" --path ./output/ # also write raw files locally
352
354
 
353
355
  # List all projects with status, module count, and completeness score
354
356
  npx ai-skills legacy-projects list
package/bin/cli.js CHANGED
@@ -1665,8 +1665,108 @@ async function cmdLegacyProjects() {
1665
1665
  console.log(`\n Console: ${c("dim", p.console_url)}\n`);
1666
1666
 
1667
1667
  } else if (subcommand === "add") {
1668
- // Delegate to upload-legacy-scan argv flags (--path, --dry-run, --token) are preserved
1669
- await cmdUploadLegacyScan();
1668
+ // Download a legacy project's skills from the console and install them
1669
+ // into the developer's local AI tools (Claude Code, Cursor, Copilot, Windsurf).
1670
+ const projectName = args[0];
1671
+ if (!projectName) {
1672
+ console.log(c("red", "Usage: npx ai-skills legacy-projects add <project-name> [--path <dir>]"));
1673
+ console.log(c("dim", " Downloads the project's skills from the console and installs them into your AI tools.\n"));
1674
+ process.exit(1);
1675
+ }
1676
+
1677
+ // Optional --path flag to also save raw files to a local directory
1678
+ let outputPath = null;
1679
+ for (let i = 1; i < args.length; i++) {
1680
+ if (args[i] === "--path" && args[i + 1]) outputPath = args[++i];
1681
+ }
1682
+
1683
+ console.log(c("blue", `\n━━━ Install Legacy Project: ${projectName} ━━━\n`));
1684
+ let result;
1685
+ try {
1686
+ result = await fetchJSONWithAuth(MANAGE_LEGACY_PROJECTS_URL, { action: "download", email, project_name: projectName }, null);
1687
+ } catch (err) {
1688
+ console.log(c("red", `✗ ${err.message}`));
1689
+ process.exit(1);
1690
+ }
1691
+
1692
+ const project = result.project;
1693
+ const documents = result.documents || [];
1694
+
1695
+ if (documents.length === 0) {
1696
+ console.log(c("yellow", "No documents found for this project.\n Check the project name or upload a scan first with:\n npx ai-skills upload-legacy-scan --path <dir>\n"));
1697
+ return;
1698
+ }
1699
+
1700
+ const skillDocs = documents.filter((d) => d.category === "skill");
1701
+ const reportDocs = documents.filter((d) => d.category === "report" || d.category === "guide");
1702
+ const diagramDocs = documents.filter((d) => d.category === "diagram");
1703
+
1704
+ console.log(` Project: ${c("bold", project.name)}`);
1705
+ console.log(` Status: ${project.status} | ${project.completeness_score}% complete`);
1706
+ console.log(` Skills: ${skillDocs.length} Reports: ${reportDocs.length} Diagrams: ${diagramDocs.length}\n`);
1707
+
1708
+ // ── Install skill documents into local AI tools ──
1709
+ if (skillDocs.length > 0) {
1710
+ const tools = detectTools();
1711
+ if (tools.length === 0) {
1712
+ console.log(c("yellow", " ⚠ No AI tools detected — install Claude Code, Cursor, Copilot, or Windsurf first.\n"));
1713
+ } else {
1714
+ // Build skill objects in the format installSkillsForTool expects
1715
+ const skills = skillDocs.map((doc) => ({
1716
+ name: `legacy-${doc.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")}`,
1717
+ scope: "global", // global so filterSkillsForProject passes them through
1718
+ content: doc.content,
1719
+ }));
1720
+
1721
+ console.log(` Installing into detected AI tools:\n`);
1722
+ for (const toolKey of tools) {
1723
+ const tool = TOOL_CONFIGS[toolKey];
1724
+ const count = installSkillsForTool(toolKey, skills);
1725
+ console.log(` ${c("green", "✓")} ${tool.name}: ${count} skill(s)`);
1726
+ }
1727
+ console.log("");
1728
+ }
1729
+ } else {
1730
+ console.log(c("dim", " No skills in this project (reports/diagrams only).\n"));
1731
+ }
1732
+
1733
+ // ── Optionally save the full raw package to --path ──
1734
+ if (outputPath) {
1735
+ const resolved = path.resolve(outputPath);
1736
+ mkdirp(resolved);
1737
+
1738
+ if (skillDocs.length > 0) {
1739
+ const modulesDir = path.join(resolved, "modules");
1740
+ mkdirp(modulesDir);
1741
+ for (const doc of skillDocs) {
1742
+ const safeName = doc.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
1743
+ const docDir = path.join(modulesDir, safeName);
1744
+ mkdirp(docDir);
1745
+ fs.writeFileSync(path.join(docDir, "SKILL.md"), doc.content);
1746
+ }
1747
+ }
1748
+
1749
+ for (const doc of reportDocs) {
1750
+ const fileName = doc.document_type.toUpperCase() + ".md";
1751
+ fs.writeFileSync(path.join(resolved, fileName), doc.content);
1752
+ }
1753
+
1754
+ if (diagramDocs.length > 0) {
1755
+ const diagramsDir = path.join(resolved, "diagrams");
1756
+ mkdirp(diagramsDir);
1757
+ for (const doc of diagramDocs) {
1758
+ const safeName = doc.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
1759
+ fs.writeFileSync(path.join(diagramsDir, `${safeName}.mmd`), doc.content);
1760
+ }
1761
+ }
1762
+
1763
+ console.log(` ${c("green", "✓")} Raw files saved to: ${c("bold", resolved)}\n`);
1764
+ }
1765
+
1766
+ console.log(c("green", `✓ "${project.name}" is ready. Restart your AI tool to activate the skills.\n`));
1767
+ if (result.project?.console_url) {
1768
+ console.log(` Console: ${c("dim", result.project.console_url)}\n`);
1769
+ }
1670
1770
  return;
1671
1771
 
1672
1772
  } else if (subcommand === "remove") {
@@ -1695,7 +1795,7 @@ async function cmdLegacyProjects() {
1695
1795
 
1696
1796
  } else {
1697
1797
  console.log(c("red", `Unknown subcommand: ${subcommand}`));
1698
- console.log(c("dim", "Usage: npx ai-skills legacy-projects add --path <dir> | list | status <name> | remove <name>\n"));
1798
+ console.log(c("dim", "Usage: npx ai-skills legacy-projects add <name> | list | status <name> | remove <name>\n"));
1699
1799
  process.exit(1);
1700
1800
  }
1701
1801
  }
@@ -1724,7 +1824,8 @@ Usage:
1724
1824
  npx ai-skills list List locally bundled skills
1725
1825
  npx ai-skills analyze Analyze last commit against active skills
1726
1826
  npx ai-skills upload-legacy-scan Upload a legacy codebase intelligence package
1727
- npx ai-skills legacy-projects add --path <dir> Upload a scan package and add / refresh the project
1827
+ npx ai-skills legacy-projects add <name> Download project skills install into AI tools
1828
+ npx ai-skills legacy-projects add <name> --path <dir> Also save raw files to a local directory
1728
1829
  npx ai-skills legacy-projects list List all legacy projects
1729
1830
  npx ai-skills legacy-projects status <name> Show project status and document counts
1730
1831
  npx ai-skills legacy-projects remove <name> Delete a project and all its documents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentia-ai-skills/framework",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "AI development skills framework centralized coding standards, security patterns, and SOPs for AI-assisted development. Works with Claude Code, Cursor, Copilot, Windsurf, and any AI coding tool.",
5
5
  "keywords": [
6
6
  "ai-skills",