@soulguard/core 0.1.1 → 0.1.3

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/cli.js CHANGED
@@ -2150,6 +2150,7 @@ var {
2150
2150
 
2151
2151
  // src/cli.ts
2152
2152
  import { resolve as resolve2 } from "node:path";
2153
+ import { readFileSync } from "node:fs";
2153
2154
  import { readFile as readFile2 } from "node:fs/promises";
2154
2155
 
2155
2156
  // src/console-live.ts
@@ -2236,7 +2237,10 @@ async function resolvePatterns(ops, patterns) {
2236
2237
  return err(result.error);
2237
2238
  }
2238
2239
  for (const match of result.value) {
2239
- files.add(match);
2240
+ const statResult = await ops.stat(match);
2241
+ if (statResult.ok && !statResult.value.isDirectory) {
2242
+ files.add(match);
2243
+ }
2240
2244
  }
2241
2245
  } else {
2242
2246
  files.add(pattern);
@@ -8415,7 +8419,8 @@ class NodeSystemOps {
8415
8419
  const [user, group] = await Promise.all([uidToName(s.uid), gidToName(s.gid)]);
8416
8420
  return ok({
8417
8421
  path,
8418
- ownership: { user, group, mode: modeToString(s.mode) }
8422
+ ownership: { user, group, mode: modeToString(s.mode) },
8423
+ isDirectory: s.isDirectory()
8419
8424
  });
8420
8425
  } catch (e) {
8421
8426
  return err(mapError(e, path, "stat"));
@@ -8733,7 +8738,7 @@ async function makeOptions(workspace) {
8733
8738
  ops
8734
8739
  };
8735
8740
  }
8736
- var program2 = new Command().name("soulguard").description("Identity protection for AI agents").version("0.0.0");
8741
+ var program2 = new Command().name("soulguard").description("Identity protection for AI agents").version(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version);
8737
8742
  program2.command("status").description("Report the status of a soulguard workspace").argument("[workspace]", "workspace path", process.cwd()).action(async (workspace) => {
8738
8743
  const out = new LiveConsoleOutput;
8739
8744
  try {
package/dist/index.js CHANGED
@@ -4154,7 +4154,10 @@ async function resolvePatterns(ops, patterns) {
4154
4154
  return err(result.error);
4155
4155
  }
4156
4156
  for (const match of result.value) {
4157
- files.add(match);
4157
+ const statResult = await ops.stat(match);
4158
+ if (statResult.ok && !statResult.value.isDirectory) {
4159
+ files.add(match);
4160
+ }
4158
4161
  }
4159
4162
  } else {
4160
4163
  files.add(pattern);
@@ -4207,7 +4210,8 @@ class MockSystemOps {
4207
4210
  return err({ kind: "not_found", path });
4208
4211
  return ok({
4209
4212
  path,
4210
- ownership: { user: file.owner, group: file.group, mode: file.mode }
4213
+ ownership: { user: file.owner, group: file.group, mode: file.mode },
4214
+ isDirectory: false
4211
4215
  });
4212
4216
  }
4213
4217
  async chown(path, owner) {
@@ -4467,7 +4471,8 @@ class NodeSystemOps {
4467
4471
  const [user, group] = await Promise.all([uidToName(s.uid), gidToName(s.gid)]);
4468
4472
  return ok({
4469
4473
  path,
4470
- ownership: { user, group, mode: modeToString(s.mode) }
4474
+ ownership: { user, group, mode: modeToString(s.mode) },
4475
+ isDirectory: s.isDirectory()
4471
4476
  });
4472
4477
  } catch (e) {
4473
4478
  return err(mapError(e, path, "stat"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulguard/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "bin": {
5
5
  "soulguard": "dist/cli.js"
6
6
  },
package/src/cli.ts CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { Command } from "commander";
7
7
  import { resolve } from "node:path";
8
+ import { readFileSync } from "node:fs";
8
9
  import { readFile } from "node:fs/promises";
9
10
  import { LiveConsoleOutput } from "./console-live.js";
10
11
  import { StatusCommand } from "./cli/status-command.js";
@@ -62,7 +63,7 @@ async function makeOptions(workspace: string): Promise<StatusOptions> {
62
63
  const program = new Command()
63
64
  .name("soulguard")
64
65
  .description("Identity protection for AI agents")
65
- .version("0.0.0");
66
+ .version(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version);
66
67
 
67
68
  program
68
69
  .command("status")
package/src/glob.ts CHANGED
@@ -73,7 +73,10 @@ export async function resolvePatterns(
73
73
  return err(result.error);
74
74
  }
75
75
  for (const match of result.value) {
76
- files.add(match);
76
+ const statResult = await ops.stat(match);
77
+ if (statResult.ok && !statResult.value.isDirectory) {
78
+ files.add(match);
79
+ }
77
80
  }
78
81
  } else {
79
82
  files.add(pattern);
@@ -93,6 +93,7 @@ export class MockSystemOps implements SystemOperations {
93
93
  return ok({
94
94
  path,
95
95
  ownership: { user: file.owner, group: file.group, mode: file.mode },
96
+ isDirectory: false,
96
97
  });
97
98
  }
98
99
 
@@ -176,6 +176,7 @@ export class NodeSystemOps implements SystemOperations {
176
176
  return ok({
177
177
  path,
178
178
  ownership: { user, group, mode: modeToString(s.mode) },
179
+ isDirectory: s.isDirectory(),
179
180
  });
180
181
  } catch (e) {
181
182
  return err(mapError(e, path, "stat"));
package/src/system-ops.ts CHANGED
@@ -18,6 +18,7 @@ import { ok } from "./result.js";
18
18
  export type FileStat = {
19
19
  path: string;
20
20
  ownership: FileOwnership;
21
+ isDirectory: boolean;
21
22
  };
22
23
 
23
24
  export interface SystemOperations {