@yhong91/cpac 0.1.15 → 0.1.16
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/cpac.js +7 -0
- package/package.json +1 -1
package/dist/cpac.js
CHANGED
|
@@ -1729,6 +1729,13 @@ export function isKimiConfigInstalled() {
|
|
|
1729
1729
|
function writeKimiBlock(path, block) {
|
|
1730
1730
|
let content = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
1731
1731
|
content = content.replace(kimiBlockRegex, "");
|
|
1732
|
+
// A truncated managed block (start marker without the end marker) leaves its
|
|
1733
|
+
// tables behind; appending again would duplicate [providers.cpac], make the
|
|
1734
|
+
// file invalid TOML, and block `kimi login`. The block is always appended
|
|
1735
|
+
// last, so dropping from an orphaned start marker to EOF is safe.
|
|
1736
|
+
const orphan = content.indexOf(KIMI_BLOCK_START);
|
|
1737
|
+
if (orphan !== -1)
|
|
1738
|
+
content = content.slice(0, orphan);
|
|
1732
1739
|
if (block) {
|
|
1733
1740
|
content = `${content}${content && !content.endsWith("\n") ? "\n" : ""}${block}\n`;
|
|
1734
1741
|
}
|