@nuucognition/flint-cli 0.3.0-alpha.0 → 0.3.0-alpha.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 (2) hide show
  1. package/dist/index.js +130 -46
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -68,7 +68,6 @@ import {
68
68
  removeWorkspaceRepository,
69
69
  removeWorkspaceSourceRepository,
70
70
  resolveShardMode,
71
- stampSynced,
72
71
  stampVersion,
73
72
  stringify,
74
73
  toKebabCase,
@@ -101,12 +100,12 @@ import {
101
100
  } from "./chunk-ODSWKVNZ.js";
102
101
 
103
102
  // src/index.ts
104
- import { Command as Command29 } from "commander";
105
- import { readFileSync as readFileSync2, existsSync as existsSync7, cpSync, mkdirSync, readdirSync as readdirSync2 } from "fs";
106
- import { fileURLToPath as fileURLToPath5 } from "url";
107
- import { dirname as dirname6, join as join24 } from "path";
103
+ import { Command as Command30 } from "commander";
104
+ import { readFileSync as readFileSync3, existsSync as existsSync8, cpSync, mkdirSync, readdirSync as readdirSync2 } from "fs";
105
+ import { fileURLToPath as fileURLToPath6 } from "url";
106
+ import { dirname as dirname7, join as join25 } from "path";
108
107
  import { homedir as homedir8 } from "os";
109
- import pc34 from "picocolors";
108
+ import pc35 from "picocolors";
110
109
 
111
110
  // ../../node_modules/.pnpm/@nuucognition+cli-core@0.0.1-beta.5/node_modules/@nuucognition/cli-core/dist/index.js
112
111
  import { homedir } from "os";
@@ -1435,10 +1434,11 @@ var FEATURES = createFeatureRegistry([
1435
1434
  { id: "connection", tier: "prod", type: "command", description: "Inter-flint connections", requiresAuth: false },
1436
1435
  { id: "resolve", tier: "prod", type: "command", description: "Resolve external resources to local paths", requiresAuth: false },
1437
1436
  { id: "fulfill", tier: "prod", type: "command", description: "Fulfill external resources with local paths", requiresAuth: false },
1437
+ { id: "update", tier: "prod", type: "command", description: "Update flint-cli to the latest version", requiresAuth: false },
1438
1438
  // === Dev Commands ===
1439
1439
  { id: "lattice", tier: "prod", type: "command", description: "Lattice data gateway integration", requiresAuth: false },
1440
1440
  { id: "agent", tier: "dev", type: "command", description: "AI agent integration", requiresAuth: false },
1441
- { id: "code", tier: "exp", type: "command", description: "Launch AI coding agents", requiresAuth: false },
1441
+ { id: "code", tier: "prod", type: "command", description: "Launch AI coding agents", requiresAuth: false },
1442
1442
  { id: "server", tier: "dev", type: "command", description: "Flint runtime server", requiresAuth: false },
1443
1443
  { id: "runtime", tier: "dev", type: "command", description: "Flint runtime management", requiresAuth: false },
1444
1444
  { id: "obsidian.push", tier: "dev", type: "function", description: "Push obsidian config changes to remote", requiresAuth: false },
@@ -4999,10 +4999,6 @@ async function syncFlint(flintPath, progress) {
4999
4999
  error: `Failed to update .gitignore: ${err instanceof Error ? err.message : String(err)}`
5000
5000
  });
5001
5001
  }
5002
- try {
5003
- await stampSynced(currentFlintPath);
5004
- } catch {
5005
- }
5006
5002
  return result;
5007
5003
  }
5008
5004
  var __dirname3 = dirname32(fileURLToPath3(import.meta.url));
@@ -5790,7 +5786,7 @@ Uninstalled ${pc8.bold(result.name)}`));
5790
5786
  modeMap.set(k, resolveShardMode(d) || "normal");
5791
5787
  }
5792
5788
  console.log(pc8.bold("\nInstalled shards:\n"));
5793
- const { execSync: execSync4 } = await import("child_process");
5789
+ const { execSync: execSync5 } = await import("child_process");
5794
5790
  const gitRemotes = /* @__PURE__ */ new Map();
5795
5791
  for (const shard of installed) {
5796
5792
  if (modeMap.get(shard.name) !== "dev") continue;
@@ -5798,7 +5794,7 @@ Uninstalled ${pc8.bold(result.name)}`));
5798
5794
  const gitDir = join13(shardPath, ".git");
5799
5795
  if (!existsSync4(gitDir)) continue;
5800
5796
  try {
5801
- const url = execSync4("git remote get-url origin", { cwd: shardPath, encoding: "utf-8" }).trim();
5797
+ const url = execSync5("git remote get-url origin", { cwd: shardPath, encoding: "utf-8" }).trim();
5802
5798
  const match = url.match(/(?:github\.com[/:])([\w.-]+\/[\w.-]+?)(?:\.git)?$/);
5803
5799
  if (match) {
5804
5800
  gitRemotes.set(shard.name, match[1]);
@@ -6297,7 +6293,7 @@ Reinstalling ${shorthand}...
6297
6293
  ).addCommand(
6298
6294
  new Command5("gitinit").description("Initialize git repo for a dev shard and push to a remote").argument("<name>", "Shard name (e.g. reports, living-documents)").argument("<url>", "Git remote URL (e.g., https://github.com/org/repo.git)").option("-p, --path <dir>", "Path to flint").action(async (name, url, options) => {
6299
6295
  try {
6300
- const { execSync: execSync4 } = await import("child_process");
6296
+ const { execSync: execSync5 } = await import("child_process");
6301
6297
  const flintPath = await resolveFlint(options.path);
6302
6298
  const installed = await getInstalledShardsWithVersions(flintPath);
6303
6299
  const match = resolveInstalledShard(installed, name);
@@ -6328,7 +6324,7 @@ Shard "${name}" not found.`));
6328
6324
  const hasGit = existsSync4(gitDir);
6329
6325
  if (hasGit) {
6330
6326
  try {
6331
- const existing = execSync4("git remote get-url origin", { cwd: shardPath, stdio: "pipe" }).toString().trim();
6327
+ const existing = execSync5("git remote get-url origin", { cwd: shardPath, stdio: "pipe" }).toString().trim();
6332
6328
  console.error(pc8.red(`
6333
6329
  "${match.folderName}" already has a remote: ${existing}`));
6334
6330
  console.log(pc8.dim(` Use ${pc8.cyan("flint shard push")} instead.`));
@@ -6341,13 +6337,13 @@ Shard "${name}" not found.`));
6341
6337
  Initializing ${match.folderName}...
6342
6338
  `));
6343
6339
  if (!hasGit) {
6344
- execSync4("git init", { cwd: shardPath, stdio: "pipe" });
6340
+ execSync5("git init", { cwd: shardPath, stdio: "pipe" });
6345
6341
  }
6346
- execSync4(`git remote add origin "${url}"`, { cwd: shardPath, stdio: "pipe" });
6347
- execSync4("git branch -M main", { cwd: shardPath, stdio: "pipe" });
6348
- execSync4("git add -A", { cwd: shardPath, stdio: "pipe" });
6349
- execSync4('git commit -m "initial commit"', { cwd: shardPath, stdio: "pipe" });
6350
- execSync4("git push -u origin main", { cwd: shardPath, stdio: "inherit" });
6342
+ execSync5(`git remote add origin "${url}"`, { cwd: shardPath, stdio: "pipe" });
6343
+ execSync5("git branch -M main", { cwd: shardPath, stdio: "pipe" });
6344
+ execSync5("git add -A", { cwd: shardPath, stdio: "pipe" });
6345
+ execSync5('git commit -m "initial commit"', { cwd: shardPath, stdio: "pipe" });
6346
+ execSync5("git push -u origin main", { cwd: shardPath, stdio: "inherit" });
6351
6347
  console.log(pc8.green(`
6352
6348
  ${pc8.bold(match.folderName)} pushed to ${pc8.dim(url)}`));
6353
6349
  console.log();
@@ -6358,7 +6354,7 @@ Initializing ${match.folderName}...
6358
6354
  ).addCommand(
6359
6355
  new Command5("push").description("Commit and push a dev shard to its remote").argument("<name>", "Shard name (e.g. reports, living-documents)").option("-m, --message <msg>", "Commit message").option("-b, --bump <level>", "Bump version in shard.yaml (patch, minor, major)").option("-p, --path <dir>", "Path to flint").action(async (name, options) => {
6360
6356
  try {
6361
- const { execSync: execSync4 } = await import("child_process");
6357
+ const { execSync: execSync5 } = await import("child_process");
6362
6358
  const flintPath = await resolveFlint(options.path);
6363
6359
  const installed = await getInstalledShardsWithVersions(flintPath);
6364
6360
  const match = resolveInstalledShard(installed, name);
@@ -6393,15 +6389,15 @@ Shard "${name}" not found.`));
6393
6389
  console.log();
6394
6390
  return;
6395
6391
  }
6396
- const status = execSync4("git status --porcelain", { cwd: shardPath, encoding: "utf-8" }).trim();
6392
+ const status = execSync5("git status --porcelain", { cwd: shardPath, encoding: "utf-8" }).trim();
6397
6393
  if (!status) {
6398
6394
  try {
6399
- const unpushed = execSync4("git log @{u}..HEAD --oneline", { cwd: shardPath, encoding: "utf-8" }).trim();
6395
+ const unpushed = execSync5("git log @{u}..HEAD --oneline", { cwd: shardPath, encoding: "utf-8" }).trim();
6400
6396
  if (unpushed) {
6401
6397
  console.log(pc8.bold(`
6402
6398
  Pushing ${match.folderName}...
6403
6399
  `));
6404
- execSync4("git push", { cwd: shardPath, stdio: "inherit" });
6400
+ execSync5("git push", { cwd: shardPath, stdio: "inherit" });
6405
6401
  console.log(pc8.green(`
6406
6402
  Pushed unpushed commits.`));
6407
6403
  console.log();
@@ -6445,13 +6441,13 @@ Could not parse version from shard.yaml.`));
6445
6441
  console.log(pc8.bold(`
6446
6442
  Pushing ${match.folderName}...
6447
6443
  `));
6448
- execSync4("git add -A", { cwd: shardPath, stdio: "pipe" });
6449
- execSync4(`git commit -m "${message.replace(/"/g, '\\"')}"`, { cwd: shardPath, stdio: "pipe" });
6444
+ execSync5("git add -A", { cwd: shardPath, stdio: "pipe" });
6445
+ execSync5(`git commit -m "${message.replace(/"/g, '\\"')}"`, { cwd: shardPath, stdio: "pipe" });
6450
6446
  try {
6451
- execSync4("git push", { cwd: shardPath, stdio: "inherit" });
6447
+ execSync5("git push", { cwd: shardPath, stdio: "inherit" });
6452
6448
  } catch {
6453
- const branch = execSync4("git branch --show-current", { cwd: shardPath, encoding: "utf-8" }).trim();
6454
- execSync4(`git push -u origin ${branch}`, { cwd: shardPath, stdio: "inherit" });
6449
+ const branch = execSync5("git branch --show-current", { cwd: shardPath, encoding: "utf-8" }).trim();
6450
+ execSync5(`git push -u origin ${branch}`, { cwd: shardPath, stdio: "inherit" });
6455
6451
  }
6456
6452
  console.log(pc8.green(`
6457
6453
  ${pc8.bold(match.folderName)} pushed.`));
@@ -6501,10 +6497,10 @@ Cannot read shard info for "${name}".`));
6501
6497
  }
6502
6498
  if (!repo) {
6503
6499
  try {
6504
- const { execSync: execSync4 } = await import("child_process");
6500
+ const { execSync: execSync5 } = await import("child_process");
6505
6501
  const gitDir = join13(shardPath, ".git");
6506
6502
  if (existsSync4(gitDir)) {
6507
- const remoteUrl = execSync4("git remote get-url origin", { cwd: shardPath, encoding: "utf-8" }).trim();
6503
+ const remoteUrl = execSync5("git remote get-url origin", { cwd: shardPath, encoding: "utf-8" }).trim();
6508
6504
  const ghMatch = remoteUrl.match(/github\.com[/:]([\w.-]+\/[\w.-]+?)(?:\.git)?$/);
6509
6505
  if (ghMatch) {
6510
6506
  repo = ghMatch[1];
@@ -9755,7 +9751,7 @@ var latticeCommand = new Command20("lattice").description("Manage lattice connec
9755
9751
  import { Command as Command21 } from "commander";
9756
9752
  import pc24 from "picocolors";
9757
9753
  var serverCommand = new Command21("server").description("Manage the local Flint server");
9758
- serverCommand.command("start").description("Start the Flint server").option("-p, --port <port>", "Port to bind").option("--path <dir>", "Path to flint (default: auto-detect)").action(async (options) => {
9754
+ serverCommand.command("start").description("Start the Flint server").option("-p, --port <port>", "Port to bind").option("--path <dir>", "Path to flint (default: auto-detect)").option("--chrome", "Enable Chrome browser tools for sessions").action(async (options) => {
9759
9755
  const flintPath = options.path || await findFlintRoot(process.cwd());
9760
9756
  let configPort = 7433;
9761
9757
  if (flintPath) {
@@ -9774,7 +9770,8 @@ serverCommand.command("start").description("Start the Flint server").option("-p,
9774
9770
  console.log(pc24.dim("The server module is in development. Install it locally to use this command."));
9775
9771
  process.exit(1);
9776
9772
  }
9777
- const server = await startFlintServer({ port, flintPath });
9773
+ const chrome = Boolean(options.chrome);
9774
+ const server = await startFlintServer({ port, flintPath, chrome });
9778
9775
  console.log(`
9779
9776
  ${pc24.bold(pc24.blue("Flint Server"))}`);
9780
9777
  console.log(` URL: ${pc24.cyan(server.address)}`);
@@ -9782,6 +9779,7 @@ ${pc24.bold(pc24.blue("Flint Server"))}`);
9782
9779
  if (flintPath) {
9783
9780
  console.log(` Flint: ${pc24.dim(flintPath)}`);
9784
9781
  }
9782
+ console.log(` Chrome: ${chrome ? pc24.green("enabled") : pc24.dim("disabled")}`);
9785
9783
  console.log(`
9786
9784
  ${pc24.dim('Session endpoint: POST /sessions { "prompt": "..." }')}
9787
9785
  `);
@@ -9809,6 +9807,7 @@ ${pc24.bold("Flint Server")}`);
9809
9807
  if (health.flintPath) {
9810
9808
  console.log(` Flint: ${pc24.dim(health.flintPath)}`);
9811
9809
  }
9810
+ console.log(` Chrome: ${health.chrome ? pc24.green("enabled") : pc24.dim("disabled")}`);
9812
9811
  const runtimesResponse = await fetch(`${serverUrl}/runtimes`);
9813
9812
  if (runtimesResponse.ok) {
9814
9813
  const payload = await runtimesResponse.json();
@@ -10908,16 +10907,100 @@ function prompt4(message) {
10908
10907
  });
10909
10908
  }
10910
10909
 
10911
- // src/index.ts
10910
+ // src/commands/update.ts
10911
+ import { Command as Command29 } from "commander";
10912
+ import pc34 from "picocolors";
10913
+ import { readFileSync as readFileSync2, existsSync as existsSync7 } from "fs";
10914
+ import { dirname as dirname6, join as join24 } from "path";
10915
+ import { fileURLToPath as fileURLToPath5 } from "url";
10916
+ import { execSync as execSync4 } from "child_process";
10917
+ import https from "https";
10912
10918
  var __dirname5 = dirname6(fileURLToPath5(import.meta.url));
10913
- var pkg = JSON.parse(readFileSync2(join24(__dirname5, "..", "package.json"), "utf-8"));
10919
+ function readPkgVersion() {
10920
+ for (const rel of ["../..", ".."]) {
10921
+ const p = join24(__dirname5, rel, "package.json");
10922
+ if (existsSync7(p)) {
10923
+ return JSON.parse(readFileSync2(p, "utf-8")).version;
10924
+ }
10925
+ }
10926
+ throw new Error("Could not determine current version");
10927
+ }
10928
+ var PACKAGE_NAME = "@nuucognition/flint-cli";
10929
+ function fetchLatestVersion() {
10930
+ return new Promise((resolve12, reject) => {
10931
+ https.get(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`, (res) => {
10932
+ let data = "";
10933
+ res.on("data", (chunk) => data += chunk);
10934
+ res.on("end", () => {
10935
+ try {
10936
+ const json = JSON.parse(data);
10937
+ resolve12(json.version);
10938
+ } catch {
10939
+ reject(new Error("Failed to parse registry response"));
10940
+ }
10941
+ });
10942
+ res.on("error", reject);
10943
+ }).on("error", reject);
10944
+ });
10945
+ }
10946
+ var updateCommand = new Command29("update").description("Update flint-cli to the latest version").option("-c, --check", "Check for updates without installing").action(async (options) => {
10947
+ try {
10948
+ const currentVersion = readPkgVersion();
10949
+ console.log();
10950
+ console.log(pc34.bold("Flint Update"));
10951
+ console.log();
10952
+ console.log(` Current version: ${pc34.cyan(currentVersion)}`);
10953
+ console.log(` Checking npm registry...`);
10954
+ let latestVersion;
10955
+ try {
10956
+ latestVersion = await fetchLatestVersion();
10957
+ } catch {
10958
+ console.error(pc34.red(" Failed to reach npm registry."));
10959
+ process.exit(1);
10960
+ }
10961
+ console.log(` Latest version: ${pc34.cyan(latestVersion)}`);
10962
+ console.log();
10963
+ if (currentVersion === latestVersion) {
10964
+ console.log(pc34.green(" \u2713 Already up to date."));
10965
+ console.log();
10966
+ return;
10967
+ }
10968
+ console.log(pc34.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
10969
+ console.log();
10970
+ if (options.check) {
10971
+ console.log(pc34.dim(" Run `flint update` to install."));
10972
+ console.log();
10973
+ return;
10974
+ }
10975
+ console.log(` Installing ${PACKAGE_NAME}@latest...`);
10976
+ console.log();
10977
+ try {
10978
+ execSync4(`npm install -g ${PACKAGE_NAME}@latest`, { stdio: "inherit" });
10979
+ console.log();
10980
+ console.log(pc34.green(` \u2713 Updated to ${latestVersion}`));
10981
+ } catch {
10982
+ console.error(pc34.red(" Update failed. Try manually:"));
10983
+ console.log(pc34.dim(` npm install -g ${PACKAGE_NAME}@latest`));
10984
+ process.exit(1);
10985
+ }
10986
+ console.log();
10987
+ } catch (err) {
10988
+ const message = err instanceof Error ? err.message : String(err);
10989
+ console.error(pc34.red(`Error: ${message}`));
10990
+ process.exit(1);
10991
+ }
10992
+ });
10993
+
10994
+ // src/index.ts
10995
+ var __dirname6 = dirname7(fileURLToPath6(import.meta.url));
10996
+ var pkg = JSON.parse(readFileSync3(join25(__dirname6, "..", "package.json"), "utf-8"));
10914
10997
  var runtime2 = resolveRuntimeSync({ cliname: "flint" });
10915
10998
  var devAvailable2 = runtime2.mode === "dev";
10916
10999
  var newDir = getConfigDir("flint");
10917
- var oldDir = join24(homedir8(), ".flint");
10918
- var intermediateDir = join24(homedir8(), ".nuucognition", ".flint");
11000
+ var oldDir = join25(homedir8(), ".flint");
11001
+ var intermediateDir = join25(homedir8(), ".nuucognition", ".flint");
10919
11002
  function migrateDir(sourceDir, label) {
10920
- if (!existsSync7(sourceDir)) return false;
11003
+ if (!existsSync8(sourceDir)) return false;
10921
11004
  try {
10922
11005
  const entries = readdirSync2(sourceDir);
10923
11006
  const filesToMigrate = entries.filter((e) => !e.startsWith(".DS_Store"));
@@ -10925,15 +11008,15 @@ function migrateDir(sourceDir, label) {
10925
11008
  mkdirSync(newDir, { recursive: true });
10926
11009
  let migrated = 0;
10927
11010
  for (const entry of filesToMigrate) {
10928
- const src = join24(sourceDir, entry);
10929
- const dest = join24(newDir, entry);
10930
- if (!existsSync7(dest)) {
11011
+ const src = join25(sourceDir, entry);
11012
+ const dest = join25(newDir, entry);
11013
+ if (!existsSync8(dest)) {
10931
11014
  cpSync(src, dest, { recursive: true });
10932
11015
  migrated++;
10933
11016
  }
10934
11017
  }
10935
11018
  if (migrated > 0) {
10936
- console.log(pc34.yellow(`Migrated ${migrated} item(s) from ${label} to ~/.nuucognition/flint/`));
11019
+ console.log(pc35.yellow(`Migrated ${migrated} item(s) from ${label} to ~/.nuucognition/flint/`));
10937
11020
  }
10938
11021
  return migrated > 0;
10939
11022
  } catch {
@@ -10969,7 +11052,7 @@ var authConfig = {
10969
11052
  defaultEnv: devAvailable2 ? "dev" : "prod",
10970
11053
  devAvailable: devAvailable2
10971
11054
  };
10972
- var program = new Command29();
11055
+ var program = new Command30();
10973
11056
  program.name("flint").description("Flint cognitive workspace CLI").version(pkg.version).enablePositionalOptions().option("--verbose", "Show stack traces for errors");
10974
11057
  program.addCommand(createLoginCommand(authConfig));
10975
11058
  program.addCommand(createLogoutCommand(authConfig));
@@ -10998,6 +11081,7 @@ var COMMAND_MAP = [
10998
11081
  { featureId: "org", command: orgCommand },
10999
11082
  { featureId: "resolve", command: resolveCommand },
11000
11083
  { featureId: "fulfill", command: fulfillCommand },
11084
+ { featureId: "update", command: updateCommand },
11001
11085
  // Dev commands
11002
11086
  { featureId: "agent", command: agentCommand },
11003
11087
  { featureId: "lattice", command: latticeCommand },
@@ -11016,11 +11100,11 @@ program.on("command:*", (operands) => {
11016
11100
  if (feature && !isFeatureEnabled(FEATURES, cmdName, runtime2)) {
11017
11101
  error(`Feature '${cmdName}' requires dev mode.`);
11018
11102
  console.log("");
11019
- console.log(pc34.dim("Dev features are only available when running the dev binary."));
11103
+ console.log(pc35.dim("Dev features are only available when running the dev binary."));
11020
11104
  process.exit(1);
11021
11105
  }
11022
11106
  error(`Unknown command: ${cmdName}`);
11023
- console.log(pc34.dim(`Run 'flint --help' for available commands`));
11107
+ console.log(pc35.dim(`Run 'flint --help' for available commands`));
11024
11108
  process.exit(1);
11025
11109
  });
11026
11110
  await program.parseAsync(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuucognition/flint-cli",
3
- "version": "0.3.0-alpha.0",
3
+ "version": "0.3.0-alpha.1",
4
4
  "type": "module",
5
5
  "description": "Flint cognitive workspace CLI",
6
6
  "license": "PROPRIETARY",
@@ -26,12 +26,12 @@
26
26
  "tsup": "^8.3.5",
27
27
  "tsx": "^4.19.2",
28
28
  "typescript": "^5.9.2",
29
+ "@nuucognition/eslint-config": "0.0.0",
30
+ "@nuucognition/flint-migrations": "0.1.0",
29
31
  "@nuucognition/flint": "0.1.0",
30
- "@nuucognition/flint-server": "0.0.1",
31
32
  "@nuucognition/flint-runtime": "0.0.1",
32
- "@nuucognition/typescript-config": "0.0.0",
33
- "@nuucognition/eslint-config": "0.0.0",
34
- "@nuucognition/flint-migrations": "0.1.0"
33
+ "@nuucognition/flint-server": "0.0.1",
34
+ "@nuucognition/typescript-config": "0.0.0"
35
35
  },
36
36
  "scripts": {
37
37
  "dev": "FLINT_MODE=dev tsx src/index.ts",