@insforge/cli 0.1.7 → 0.1.8

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync5 } from "fs";
5
- import { join as join5, dirname } from "path";
4
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync6 } from "fs";
5
+ import { join as join6, dirname } from "path";
6
6
  import { fileURLToPath } from "url";
7
7
  import { Command } from "commander";
8
8
 
@@ -102,7 +102,7 @@ var AuthError = class extends CLIError {
102
102
  };
103
103
  var ProjectNotLinkedError = class extends CLIError {
104
104
  constructor() {
105
- super("No project linked. Run `insforge projects link` first.", 3, "PROJECT_NOT_LINKED");
105
+ super("No project linked. Run `insforge link` first.", 3, "PROJECT_NOT_LINKED");
106
106
  }
107
107
  };
108
108
  function handleError(err, json) {
@@ -649,9 +649,38 @@ import * as clack6 from "@clack/prompts";
649
649
 
650
650
  // src/lib/skills.ts
651
651
  import { exec } from "child_process";
652
+ import { existsSync as existsSync2, readFileSync as readFileSync2, appendFileSync } from "fs";
653
+ import { join as join2 } from "path";
652
654
  import { promisify } from "util";
653
655
  import * as clack5 from "@clack/prompts";
654
656
  var execAsync = promisify(exec);
657
+ var GITIGNORE_ENTRIES = [
658
+ ".insforge",
659
+ ".agent",
660
+ ".agents",
661
+ ".augment",
662
+ ".claude",
663
+ ".cline",
664
+ ".github/copilot*",
665
+ ".kilocode",
666
+ ".qoder",
667
+ ".qwen",
668
+ ".roo",
669
+ ".trae",
670
+ ".windsurf"
671
+ ];
672
+ function updateGitignore() {
673
+ const gitignorePath = join2(process.cwd(), ".gitignore");
674
+ const existing = existsSync2(gitignorePath) ? readFileSync2(gitignorePath, "utf-8") : "";
675
+ const lines = new Set(existing.split("\n").map((l) => l.trim()));
676
+ const missing = GITIGNORE_ENTRIES.filter((entry) => !lines.has(entry));
677
+ if (!missing.length) return;
678
+ const block = `
679
+ # InsForge & AI agent skills
680
+ ${missing.join("\n")}
681
+ `;
682
+ appendFileSync(gitignorePath, block);
683
+ }
655
684
  async function installSkills(json) {
656
685
  try {
657
686
  if (!json) clack5.log.info("Installing InsForge agent skills...");
@@ -663,6 +692,10 @@ async function installSkills(json) {
663
692
  } catch {
664
693
  if (!json) clack5.log.warn("Failed to install agent skills. You can run manually: npx skills add insforge/agent-skills");
665
694
  }
695
+ try {
696
+ updateGitignore();
697
+ } catch {
698
+ }
666
699
  }
667
700
 
668
701
  // src/commands/projects/link.ts
@@ -1089,7 +1122,7 @@ function registerDbExportCommand(dbCmd2) {
1089
1122
  }
1090
1123
 
1091
1124
  // src/commands/db/import.ts
1092
- import { readFileSync as readFileSync2 } from "fs";
1125
+ import { readFileSync as readFileSync3 } from "fs";
1093
1126
  import { basename } from "path";
1094
1127
  function registerDbImportCommand(dbCmd2) {
1095
1128
  dbCmd2.command("import <file>").description("Import database from a local SQL file").option("--truncate", "Truncate existing tables before import").action(async (file, opts, cmd) => {
@@ -1098,7 +1131,7 @@ function registerDbImportCommand(dbCmd2) {
1098
1131
  await requireAuth();
1099
1132
  const config = getProjectConfig();
1100
1133
  if (!config) throw new ProjectNotLinkedError();
1101
- const fileContent = readFileSync2(file);
1134
+ const fileContent = readFileSync3(file);
1102
1135
  const fileName = basename(file);
1103
1136
  const formData = new FormData();
1104
1137
  formData.append("file", new Blob([fileContent]), fileName);
@@ -1309,21 +1342,21 @@ function registerFunctionsCommands(functionsCmd2) {
1309
1342
  }
1310
1343
 
1311
1344
  // src/commands/functions/deploy.ts
1312
- import { readFileSync as readFileSync3, existsSync as existsSync2 } from "fs";
1313
- import { join as join2 } from "path";
1345
+ import { readFileSync as readFileSync4, existsSync as existsSync3 } from "fs";
1346
+ import { join as join3 } from "path";
1314
1347
  function registerFunctionsDeployCommand(functionsCmd2) {
1315
1348
  functionsCmd2.command("deploy <slug>").description("Deploy an edge function (create or update)").option("--file <path>", "Path to the function source file").option("--name <name>", "Function display name").option("--description <desc>", "Function description").action(async (slug, opts, cmd) => {
1316
1349
  const { json } = getRootOpts(cmd);
1317
1350
  try {
1318
1351
  await requireAuth();
1319
- const filePath = opts.file ?? join2(process.cwd(), "insforge", "functions", slug, "index.ts");
1320
- if (!existsSync2(filePath)) {
1352
+ const filePath = opts.file ?? join3(process.cwd(), "insforge", "functions", slug, "index.ts");
1353
+ if (!existsSync3(filePath)) {
1321
1354
  throw new CLIError(
1322
1355
  `Source file not found: ${filePath}
1323
- Specify --file <path> or create ${join2("insforge", "functions", slug, "index.ts")}`
1356
+ Specify --file <path> or create ${join3("insforge", "functions", slug, "index.ts")}`
1324
1357
  );
1325
1358
  }
1326
- const code = readFileSync3(filePath, "utf-8");
1359
+ const code = readFileSync4(filePath, "utf-8");
1327
1360
  const name = opts.name ?? slug;
1328
1361
  const description = opts.description ?? "";
1329
1362
  let exists = false;
@@ -1464,7 +1497,7 @@ function registerStorageBucketsCommand(storageCmd2) {
1464
1497
  }
1465
1498
 
1466
1499
  // src/commands/storage/upload.ts
1467
- import { readFileSync as readFileSync4, existsSync as existsSync3 } from "fs";
1500
+ import { readFileSync as readFileSync5, existsSync as existsSync4 } from "fs";
1468
1501
  import { basename as basename2 } from "path";
1469
1502
  function registerStorageUploadCommand(storageCmd2) {
1470
1503
  storageCmd2.command("upload <file>").description("Upload a file to a storage bucket").requiredOption("--bucket <name>", "Target bucket name").option("--key <objectKey>", "Object key (defaults to filename)").action(async (file, opts, cmd) => {
@@ -1473,10 +1506,10 @@ function registerStorageUploadCommand(storageCmd2) {
1473
1506
  await requireAuth();
1474
1507
  const config = getProjectConfig();
1475
1508
  if (!config) throw new ProjectNotLinkedError();
1476
- if (!existsSync3(file)) {
1509
+ if (!existsSync4(file)) {
1477
1510
  throw new CLIError(`File not found: ${file}`);
1478
1511
  }
1479
- const fileContent = readFileSync4(file);
1512
+ const fileContent = readFileSync5(file);
1480
1513
  const objectKey = opts.key ?? basename2(file);
1481
1514
  const bucketName = opts.bucket;
1482
1515
  const formData = new FormData();
@@ -1508,7 +1541,7 @@ function registerStorageUploadCommand(storageCmd2) {
1508
1541
 
1509
1542
  // src/commands/storage/download.ts
1510
1543
  import { writeFileSync as writeFileSync3 } from "fs";
1511
- import { join as join3, basename as basename3 } from "path";
1544
+ import { join as join4, basename as basename3 } from "path";
1512
1545
  function registerStorageDownloadCommand(storageCmd2) {
1513
1546
  storageCmd2.command("download <objectKey>").description("Download a file from a storage bucket").requiredOption("--bucket <name>", "Source bucket name").option("--output <path>", "Output file path (defaults to current directory)").action(async (objectKey, opts, cmd) => {
1514
1547
  const { json } = getRootOpts(cmd);
@@ -1528,7 +1561,7 @@ function registerStorageDownloadCommand(storageCmd2) {
1528
1561
  throw new CLIError(err.error ?? `Download failed: ${res.status}`);
1529
1562
  }
1530
1563
  const buffer = Buffer.from(await res.arrayBuffer());
1531
- const outputPath = opts.output ?? join3(process.cwd(), basename3(objectKey));
1564
+ const outputPath = opts.output ?? join4(process.cwd(), basename3(objectKey));
1532
1565
  writeFileSync3(outputPath, buffer);
1533
1566
  if (json) {
1534
1567
  outputJson({ success: true, path: outputPath, size: buffer.length });
@@ -2701,7 +2734,7 @@ function registerLogsCommand(program2) {
2701
2734
 
2702
2735
  // src/index.ts
2703
2736
  var __dirname = dirname(fileURLToPath(import.meta.url));
2704
- var pkg = JSON.parse(readFileSync5(join5(__dirname, "../package.json"), "utf-8"));
2737
+ var pkg = JSON.parse(readFileSync6(join6(__dirname, "../package.json"), "utf-8"));
2705
2738
  var INSFORGE_LOGO = `
2706
2739
  \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
2707
2740
  \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
@@ -2712,8 +2745,8 @@ var INSFORGE_LOGO = `
2712
2745
  `;
2713
2746
  function showLogoOnFirstRun() {
2714
2747
  if (process.argv.includes("--json")) return;
2715
- const localDir = join5(process.cwd(), ".insforge");
2716
- if (existsSync4(localDir)) return;
2748
+ const localDir = join6(process.cwd(), ".insforge");
2749
+ if (existsSync5(localDir)) return;
2717
2750
  console.log(INSFORGE_LOGO);
2718
2751
  console.log(" Welcome to InsForge CLI! Run `insforge login` to get started.\n");
2719
2752
  mkdirSync2(localDir, { recursive: true });