@alessandroraffa/tangyr 3.0.2 → 3.0.4

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 +80 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17329,6 +17329,18 @@ function collectAssessFindings(scope, projectRoot, toolFilter, assessOptions) {
17329
17329
  scope,
17330
17330
  scope === "project" ? projectRoot ?? process.cwd() : void 0
17331
17331
  );
17332
+ const recorded = recordedArtifactPaths(scopePath);
17333
+ for (const finding of findings) {
17334
+ if (finding.classification !== "conflicting") {
17335
+ continue;
17336
+ }
17337
+ const resolved = path12.resolve(finding.path);
17338
+ const ours = recorded.has(resolved) || finding.type === "directory" && holdsOnlyRecorded(resolved, recorded);
17339
+ if (ours) {
17340
+ finding.classification = "compatible";
17341
+ finding.description = `${finding.description} (recorded by this installation)`;
17342
+ }
17343
+ }
17332
17344
  if (fs11.existsSync(path12.join(scopePath, "manifest.json"))) {
17333
17345
  findings.push({
17334
17346
  path: path12.join(scopePath, "manifest.json"),
@@ -17524,6 +17536,49 @@ function resolveKitPath(config, configDir) {
17524
17536
  });
17525
17537
  return resolution?.kit.path ?? null;
17526
17538
  }
17539
+ function recordedArtifactPaths(scopePath) {
17540
+ const paths = /* @__PURE__ */ new Set();
17541
+ try {
17542
+ const manifest = readManifest(scopePath);
17543
+ if (!manifest) {
17544
+ return paths;
17545
+ }
17546
+ for (const artifact of manifest.artifacts) {
17547
+ if (artifact.path) {
17548
+ paths.add(path12.resolve(artifact.path));
17549
+ }
17550
+ }
17551
+ for (const link of manifest.managedLinks) {
17552
+ paths.add(path12.resolve(link.path));
17553
+ }
17554
+ } catch {
17555
+ }
17556
+ return paths;
17557
+ }
17558
+ function holdsOnlyRecorded(dir, recorded) {
17559
+ let entries;
17560
+ try {
17561
+ entries = fs11.readdirSync(dir, { withFileTypes: true });
17562
+ } catch {
17563
+ return false;
17564
+ }
17565
+ if (entries.length === 0) {
17566
+ return [...recorded].some((p) => p.startsWith(`${dir}${path12.sep}`));
17567
+ }
17568
+ for (const entry of entries) {
17569
+ const full = path12.join(dir, entry.name);
17570
+ if (entry.isDirectory() && !entry.isSymbolicLink()) {
17571
+ if (!holdsOnlyRecorded(full, recorded)) {
17572
+ return false;
17573
+ }
17574
+ continue;
17575
+ }
17576
+ if (!recorded.has(full)) {
17577
+ return false;
17578
+ }
17579
+ }
17580
+ return true;
17581
+ }
17527
17582
 
17528
17583
  // src/commands/auth.ts
17529
17584
  import fs14 from "fs";
@@ -28712,6 +28767,9 @@ function syncMcp2(config, sourceRoot, paths, options, lossReport, logger, provid
28712
28767
  };
28713
28768
  }
28714
28769
  function writeCompiledArtifact(component, destination, content, expectedHash, config, sourceRoot, options, logger, manifest, scopePath) {
28770
+ if (!options.force && isCompiledCurrent(destination, content, expectedHash)) {
28771
+ return { component, status: "skipped-current", path: destination };
28772
+ }
28715
28773
  const artifactClass = classifyArtifact(destination, config, sourceRoot);
28716
28774
  if (artifactClass === "managed-compiled" && !options.force && isCompiledCurrent(destination, content, expectedHash)) {
28717
28775
  return { component, status: "skipped-current", path: destination };
@@ -28791,11 +28849,9 @@ function handleConflict2(destination, config, options, logger, manifest, scopePa
28791
28849
  fs39.rmSync(destination, { recursive: true, force: true });
28792
28850
  return true;
28793
28851
  }
28794
- function isCompiledCurrent(destination, expectedContent, expectedHash) {
28852
+ function isCompiledCurrent(destination, expectedContent, _expectedHash) {
28795
28853
  try {
28796
- const current = fs39.readFileSync(destination, "utf8");
28797
- const marker = extractProvenanceMarker(current);
28798
- return expectedHash ? marker?.hash === expectedHash && marker.target === "codex" && current === expectedContent : current === expectedContent;
28854
+ return fs39.readFileSync(destination, "utf8") === expectedContent;
28799
28855
  } catch {
28800
28856
  return false;
28801
28857
  }
@@ -29334,6 +29390,9 @@ function syncMcp3(config, sourceRoot, paths, options, lossReport, logger) {
29334
29390
  );
29335
29391
  }
29336
29392
  function writeCompiledArtifact2(component, destination, content, expectedHash, config, sourceRoot, options, logger, manifest, scopePath) {
29393
+ if (!options.force && isCompiledCurrent2(destination, content, expectedHash)) {
29394
+ return { component, status: "skipped-current", path: destination };
29395
+ }
29337
29396
  const artifactClass = classifyArtifact(destination, config, sourceRoot);
29338
29397
  if (artifactClass === "managed-compiled" && !options.force && isCompiledCurrent2(destination, content, expectedHash)) {
29339
29398
  return { component, status: "skipped-current", path: destination };
@@ -29351,11 +29410,9 @@ function writeCompiledArtifact2(component, destination, content, expectedHash, c
29351
29410
  fs40.writeFileSync(destination, content);
29352
29411
  return { component, status: "success", path: destination };
29353
29412
  }
29354
- function isCompiledCurrent2(destination, expectedContent, expectedHash) {
29413
+ function isCompiledCurrent2(destination, expectedContent, _expectedHash) {
29355
29414
  try {
29356
- const current = fs40.readFileSync(destination, "utf8");
29357
- const marker = extractProvenanceMarker(current);
29358
- return expectedHash ? marker?.hash === expectedHash && marker.target === "copilot" && current === expectedContent : current === expectedContent;
29415
+ return fs40.readFileSync(destination, "utf8") === expectedContent;
29359
29416
  } catch {
29360
29417
  return false;
29361
29418
  }
@@ -29984,6 +30041,9 @@ function syncProviderPin(config, sourceRoot, lossReport) {
29984
30041
  }
29985
30042
  }
29986
30043
  function writeCompiledArtifact3(component, destination, content, expectedHash, config, sourceRoot, options, logger, manifest, scopePath) {
30044
+ if (!options.force && isCompiledCurrent3(destination, content, expectedHash)) {
30045
+ return { component, status: "skipped-current", path: destination };
30046
+ }
29987
30047
  const artifactClass = classifyArtifact(destination, config, sourceRoot);
29988
30048
  if (artifactClass === "managed-compiled" && !options.force && isCompiledCurrent3(destination, content, expectedHash)) {
29989
30049
  return { component, status: "skipped-current", path: destination };
@@ -30034,11 +30094,9 @@ function handleConflict4(destination, config, options, logger, manifest, scopePa
30034
30094
  fs41.rmSync(destination, { recursive: true, force: true });
30035
30095
  return true;
30036
30096
  }
30037
- function isCompiledCurrent3(destination, expectedContent, expectedHash) {
30097
+ function isCompiledCurrent3(destination, expectedContent, _expectedHash) {
30038
30098
  try {
30039
- const current = fs41.readFileSync(destination, "utf8");
30040
- const marker = extractProvenanceMarker(current);
30041
- return expectedHash ? marker?.hash === expectedHash && marker.target === "cursor" && current === expectedContent : current === expectedContent;
30099
+ return fs41.readFileSync(destination, "utf8") === expectedContent;
30042
30100
  } catch {
30043
30101
  return false;
30044
30102
  }
@@ -30474,6 +30532,9 @@ function syncProviderAndModel(config, sourceRoot, lossReport) {
30474
30532
  }
30475
30533
  }
30476
30534
  function writeCompiledArtifact4(component, destination, content, expectedHash, config, sourceRoot, options, logger, manifest, scopePath) {
30535
+ if (!options.force && isCompiledCurrent4(destination, content, expectedHash)) {
30536
+ return { component, status: "skipped-current", path: destination };
30537
+ }
30477
30538
  const artifactClass = classifyArtifact(destination, config, sourceRoot);
30478
30539
  if (artifactClass === "managed-compiled" && !options.force && isCompiledCurrent4(destination, content, expectedHash)) {
30479
30540
  return { component, status: "skipped-current", path: destination };
@@ -30524,11 +30585,9 @@ function handleConflict5(destination, config, options, logger, manifest, scopePa
30524
30585
  fs42.rmSync(destination, { recursive: true, force: true });
30525
30586
  return true;
30526
30587
  }
30527
- function isCompiledCurrent4(destination, expectedContent, expectedHash) {
30588
+ function isCompiledCurrent4(destination, expectedContent, _expectedHash) {
30528
30589
  try {
30529
- const current = fs42.readFileSync(destination, "utf8");
30530
- const marker = extractProvenanceMarker(current);
30531
- return expectedHash ? marker?.hash === expectedHash && marker.target === "cline" && current === expectedContent : current === expectedContent;
30590
+ return fs42.readFileSync(destination, "utf8") === expectedContent;
30532
30591
  } catch {
30533
30592
  return false;
30534
30593
  }
@@ -30982,6 +31041,9 @@ function syncConfigDoc(paths, mcpEntries, _lossReport, permissionMap, mappings)
30982
31041
  `);
30983
31042
  }
30984
31043
  function writeCompiledArtifact5(component, destination, content, expectedHash, config, sourceRoot, options, logger, manifest, scopePath) {
31044
+ if (!options.force && isCompiledCurrent5(destination, content, expectedHash)) {
31045
+ return { component, status: "skipped-current", path: destination };
31046
+ }
30985
31047
  const artifactClass = classifyArtifact(destination, config, sourceRoot);
30986
31048
  if (artifactClass === "managed-compiled" && !options.force && isCompiledCurrent5(destination, content, expectedHash)) {
30987
31049
  return { component, status: "skipped-current", path: destination };
@@ -31032,11 +31094,9 @@ function handleConflict6(destination, config, options, logger, manifest, scopePa
31032
31094
  fs43.rmSync(destination, { recursive: true, force: true });
31033
31095
  return true;
31034
31096
  }
31035
- function isCompiledCurrent5(destination, expectedContent, expectedHash) {
31097
+ function isCompiledCurrent5(destination, expectedContent, _expectedHash) {
31036
31098
  try {
31037
- const current = fs43.readFileSync(destination, "utf8");
31038
- const marker = extractProvenanceMarker(current);
31039
- return expectedHash ? marker?.hash === expectedHash && marker.target === "opencode" && current === expectedContent : current === expectedContent;
31099
+ return fs43.readFileSync(destination, "utf8") === expectedContent;
31040
31100
  } catch {
31041
31101
  return false;
31042
31102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alessandroraffa/tangyr",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "CLI for the Tangyr discipline — install and manage operating kits for AI coding tools",
5
5
  "license": "MIT",
6
6
  "engines": {