reffy-cli 1.4.1 → 1.4.2
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 +7 -0
- package/dist/gitignore.d.ts +4 -0
- package/dist/gitignore.js +31 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
import { renderDiagram } from "./diagram.js";
|
|
6
6
|
import { runDoctor } from "./doctor.js";
|
|
7
7
|
import { loadDotEnvIfPresent } from "./env.js";
|
|
8
|
+
import { ensureGitignoreEntries } from "./gitignore.js";
|
|
8
9
|
import { archivePlanningChange } from "./plan-archive.js";
|
|
9
10
|
import { createPlanScaffold } from "./plan.js";
|
|
10
11
|
import { DEFAULT_PLANNING_RELATIVE_DIR, looksLikePlanningDir, resolveCanonicalPlanningPath } from "./planning-paths.js";
|
|
@@ -905,6 +906,7 @@ async function main() {
|
|
|
905
906
|
provision: parsed.provision,
|
|
906
907
|
identity,
|
|
907
908
|
});
|
|
909
|
+
const gitignore = await ensureGitignoreEntries(parsed.repoRoot, [".reffy/state/"]);
|
|
908
910
|
const payload = {
|
|
909
911
|
status: "ok",
|
|
910
912
|
command: "remote",
|
|
@@ -919,6 +921,8 @@ async function main() {
|
|
|
919
921
|
project_id: identity.project_id,
|
|
920
922
|
workspace_name: identity.workspace_name,
|
|
921
923
|
linkage_mode: result.created_pod || result.created_actor ? "provisioned" : "existing",
|
|
924
|
+
gitignore_path: gitignore.path,
|
|
925
|
+
gitignore_added: gitignore.added,
|
|
922
926
|
};
|
|
923
927
|
if (output === "json") {
|
|
924
928
|
printResult(output, payload);
|
|
@@ -934,6 +938,9 @@ async function main() {
|
|
|
934
938
|
console.log(`Created pod: ${payload.created_pod ? "yes" : "no"}`);
|
|
935
939
|
console.log(`Created actor: ${payload.created_actor ? "yes" : "no"}`);
|
|
936
940
|
console.log(`Linkage mode: ${payload.linkage_mode}`);
|
|
941
|
+
if (payload.gitignore_added.length > 0) {
|
|
942
|
+
console.log(`Updated .gitignore: ${payload.gitignore_added.join(", ")}`);
|
|
943
|
+
}
|
|
937
944
|
}
|
|
938
945
|
return 0;
|
|
939
946
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function normalizeLines(content) {
|
|
4
|
+
return content
|
|
5
|
+
.split(/\r?\n/)
|
|
6
|
+
.map((line) => line.trim())
|
|
7
|
+
.filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
export async function ensureGitignoreEntries(repoRoot, entries) {
|
|
10
|
+
const gitignorePath = path.join(repoRoot, ".gitignore");
|
|
11
|
+
const current = await fs.readFile(gitignorePath, "utf8").catch(() => "");
|
|
12
|
+
const existing = new Set(normalizeLines(current));
|
|
13
|
+
const added = [];
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
const normalized = entry.trim();
|
|
16
|
+
if (!normalized || existing.has(normalized))
|
|
17
|
+
continue;
|
|
18
|
+
existing.add(normalized);
|
|
19
|
+
added.push(normalized);
|
|
20
|
+
}
|
|
21
|
+
if (added.length === 0) {
|
|
22
|
+
return { path: gitignorePath, added };
|
|
23
|
+
}
|
|
24
|
+
const nextLines = current.length > 0 ? current.replace(/\s*$/, "").split(/\r?\n/) : [];
|
|
25
|
+
if (nextLines.length > 0 && nextLines[nextLines.length - 1] !== "") {
|
|
26
|
+
nextLines.push("");
|
|
27
|
+
}
|
|
28
|
+
nextLines.push(...added);
|
|
29
|
+
await fs.writeFile(gitignorePath, `${nextLines.join("\n")}\n`, "utf8");
|
|
30
|
+
return { path: gitignorePath, added };
|
|
31
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { MANIFEST_VERSION, allowedKindExtensions, validateManifest } from "./man
|
|
|
3
3
|
export { runDoctor } from "./doctor.js";
|
|
4
4
|
export { createPlanScaffold } from "./plan.js";
|
|
5
5
|
export { loadDotEnvIfPresent, parseDotEnv } from "./env.js";
|
|
6
|
+
export { ensureGitignoreEntries } from "./gitignore.js";
|
|
6
7
|
export { collectWorkspaceDocuments, ensureRemoteInit, extractWorkspaceIdentity, mergeRemoteConfig, PaseoRemoteClient, readRemoteConfig, resolveRemoteConfigPath, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
|
|
7
8
|
export { listSpecs, showSpec } from "./spec-runtime.js";
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,6 @@ export { MANIFEST_VERSION, allowedKindExtensions, validateManifest } from "./man
|
|
|
3
3
|
export { runDoctor } from "./doctor.js";
|
|
4
4
|
export { createPlanScaffold } from "./plan.js";
|
|
5
5
|
export { loadDotEnvIfPresent, parseDotEnv } from "./env.js";
|
|
6
|
+
export { ensureGitignoreEntries } from "./gitignore.js";
|
|
6
7
|
export { collectWorkspaceDocuments, ensureRemoteInit, extractWorkspaceIdentity, mergeRemoteConfig, PaseoRemoteClient, readRemoteConfig, resolveRemoteConfigPath, toCanonicalRemotePath, writeRemoteConfig, } from "./remote.js";
|
|
7
8
|
export { listSpecs, showSpec } from "./spec-runtime.js";
|