gaslighting-engine 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -89,6 +89,7 @@ gaslighting-engine codex-doctor
89
89
  gaslighting-engine skill
90
90
  gaslighting-engine agents
91
91
  gaslighting-engine care
92
+ gaslighting-engine care --github-url https://github.com/user/repo.git
92
93
  ```
93
94
 
94
95
  ## Output Layout
@@ -113,6 +114,14 @@ This file tracks non-blocking but important care risks:
113
114
 
114
115
  These are warnings, not fake blockers. The agent should keep implementing, but it must keep warning and recording gaps until they are resolved.
115
116
 
117
+ If GitHub is not connected yet, run:
118
+
119
+ ```bash
120
+ gaslighting-engine care --github-url https://github.com/user/repo.git
121
+ ```
122
+
123
+ This initializes Git when needed and connects `origin`. If `origin` already exists and must be replaced, use `--force-remote`.
124
+
116
125
  ## Update Notice
117
126
 
118
127
  Gaslighting-engine checks npm for a newer version when you run normal commands.
package/dist/cli.js CHANGED
@@ -58,6 +58,7 @@ Examples:
58
58
  $ gaslighting "Build an ecommerce MVP." --type ecommerce
59
59
  $ gaslighting-engine init "Build a landing page" --dry-run
60
60
  $ gaslighting-engine doctor
61
+ $ gaslighting-engine care --github-url https://github.com/user/repo.git
61
62
  $ gaslighting-engine codex-install --force
62
63
 
63
64
  Defaults:
@@ -98,6 +99,8 @@ Defaults:
98
99
  .option("--path <path>", "target directory")
99
100
  .option("--lang <lang>", "language: en or ko", "en")
100
101
  .option("--type <type>", "project type override", parseProjectType)
102
+ .option("--github-url <url>", "initialize git if needed and connect origin to this GitHub URL")
103
+ .option("--force-remote", "replace an existing origin remote when used with --github-url")
101
104
  .action(runCare);
102
105
  program
103
106
  .command("codex-install")
@@ -1,5 +1,5 @@
1
1
  import { generateProjectCareDoc } from "../core/generateDocs.js";
2
- import { inspectProjectCare } from "../core/projectCare.js";
2
+ import { connectGitHubRemote, inspectProjectCare } from "../core/projectCare.js";
3
3
  import { printBanner } from "../utils/banner.js";
4
4
  import { writeDocs } from "../utils/file.js";
5
5
  export function runCare(rawUserRequest = "Project care audit", options) {
@@ -13,6 +13,19 @@ export function runCare(rawUserRequest = "Project care audit", options) {
13
13
  noTodo: true,
14
14
  noShortcut: true,
15
15
  };
16
+ if (options.githubUrl && !options.dryRun) {
17
+ printBanner("GITHUB CARE");
18
+ console.log("Git/GitHub repair:");
19
+ for (const result of connectGitHubRemote(root, options.githubUrl, options.forceRemote)) {
20
+ console.log(`${result.ok ? "PASS" : "WARN"} ${result.step}: ${result.message}`);
21
+ }
22
+ console.log("");
23
+ }
24
+ if (options.githubUrl && options.dryRun) {
25
+ printBanner("GITHUB CARE");
26
+ console.log(`Dry run: would connect GitHub remote to ${options.githubUrl}`);
27
+ console.log("");
28
+ }
16
29
  const results = writeDocs(root, generateProjectCareDoc(input, root), options.force, options.dryRun);
17
30
  const care = inspectProjectCare(root);
18
31
  printBanner("PROJECT CARE");
@@ -2,6 +2,57 @@ import { execFileSync } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { decisionDate, projectPurpose } from "./content.js";
5
+ export function connectGitHubRemote(root, githubUrl, forceRemote = false) {
6
+ const results = [];
7
+ const normalizedUrl = githubUrl.trim();
8
+ if (!normalizedUrl) {
9
+ return [{ step: "GitHub URL", ok: false, message: "No GitHub URL was provided." }];
10
+ }
11
+ if (!/github\.com[:/]/i.test(normalizedUrl)) {
12
+ return [{ step: "GitHub URL", ok: false, message: "The provided URL does not look like a GitHub remote URL." }];
13
+ }
14
+ if (runGit(root, ["rev-parse", "--is-inside-work-tree"]) !== "true") {
15
+ if (runGitCommand(root, ["init"])) {
16
+ results.push({ step: "git init", ok: true, message: "Initialized a Git repository." });
17
+ }
18
+ else {
19
+ results.push({ step: "git init", ok: false, message: "Could not initialize a Git repository. Confirm Git is installed and the directory is writable." });
20
+ return results;
21
+ }
22
+ }
23
+ else {
24
+ results.push({ step: "git init", ok: true, message: "Git repository already exists." });
25
+ }
26
+ const existingOrigin = runGit(root, ["remote", "get-url", "origin"]);
27
+ if (!existingOrigin) {
28
+ const added = runGitCommand(root, ["remote", "add", "origin", normalizedUrl]);
29
+ results.push({
30
+ step: "git remote add origin",
31
+ ok: added,
32
+ message: added ? `Connected origin to ${normalizedUrl}.` : "Could not add origin remote.",
33
+ });
34
+ return results;
35
+ }
36
+ if (existingOrigin === normalizedUrl) {
37
+ results.push({ step: "git remote", ok: true, message: `Origin already points to ${normalizedUrl}.` });
38
+ return results;
39
+ }
40
+ if (!forceRemote) {
41
+ results.push({
42
+ step: "git remote",
43
+ ok: false,
44
+ message: `Origin already points to ${existingOrigin}. Re-run with --force-remote to replace it.`,
45
+ });
46
+ return results;
47
+ }
48
+ const replaced = runGitCommand(root, ["remote", "set-url", "origin", normalizedUrl]);
49
+ results.push({
50
+ step: "git remote set-url origin",
51
+ ok: replaced,
52
+ message: replaced ? `Replaced origin with ${normalizedUrl}.` : "Could not replace origin remote.",
53
+ });
54
+ return results;
55
+ }
5
56
  export function inspectProjectCare(root) {
6
57
  const isGitRepository = runGit(root, ["rev-parse", "--is-inside-work-tree"]) === "true";
7
58
  const gitBranch = isGitRepository ? runGit(root, ["branch", "--show-current"]) : undefined;
@@ -115,6 +166,7 @@ ${care.checks.map((check) => `- [${check.ok ? "x" : " "}] ${check.label}: ${chec
115
166
  - Do make a practical assumption, record it, and keep moving.
116
167
  - If Git is not initialized, ask for a GitHub URL and offer the exact commands.
117
168
  - If Git is initialized but no GitHub remote exists, ask for the remote URL and offer \`git remote add origin <url>\`.
169
+ - If the user provides a GitHub URL, run \`gaslighting-engine care --github-url <url>\` or connect it directly with Git CLI.
118
170
  - If GitHub is connected, record the remote URL here and in \`DECISION_LOG.md\` when it changes.
119
171
  - If domain or deployment details are missing, keep warning until they are confirmed.
120
172
  - Treat missing domain, deployment, analytics, email, and privacy ownership as mission-critical launch risks, not as reasons to abandon the task.
@@ -133,3 +185,12 @@ function runGit(root, args) {
133
185
  return undefined;
134
186
  }
135
187
  }
188
+ function runGitCommand(root, args) {
189
+ try {
190
+ execFileSync("git", args, { cwd: root, stdio: ["ignore", "ignore", "ignore"] });
191
+ return true;
192
+ }
193
+ catch {
194
+ return false;
195
+ }
196
+ }
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const packageName = "gaslighting-engine";
2
- export const packageVersion = "0.2.0";
2
+ export const packageVersion = "0.2.1";
package/docs/examples.md CHANGED
@@ -27,6 +27,7 @@ Project-care refresh:
27
27
 
28
28
  ```bash
29
29
  npx gaslighting-engine care "I want to build a hospital website." --force
30
+ npx gaslighting-engine care --github-url https://github.com/user/repo.git --force
30
31
  ```
31
32
 
32
33
  Update check test:
@@ -63,6 +63,7 @@ The agent must treat this project as mission-critical. If something can put deli
63
63
  - Do make a practical assumption, record it, and keep moving.
64
64
  - If Git is not initialized, ask for a GitHub URL and offer the exact commands.
65
65
  - If Git is initialized but no GitHub remote exists, ask for the remote URL and offer `git remote add origin <url>`.
66
+ - If the user provides a GitHub URL, run `gaslighting-engine care --github-url <url>` or connect it directly with Git CLI.
66
67
  - If GitHub is connected, record the remote URL here and in `DECISION_LOG.md` when it changes.
67
68
  - If domain or deployment details are missing, keep warning until they are confirmed.
68
69
  - Treat missing domain, deployment, analytics, email, and privacy ownership as mission-critical launch risks, not as reasons to abandon the task.
@@ -63,6 +63,7 @@ The agent must treat this project as mission-critical. If something can put deli
63
63
  - Do make a practical assumption, record it, and keep moving.
64
64
  - If Git is not initialized, ask for a GitHub URL and offer the exact commands.
65
65
  - If Git is initialized but no GitHub remote exists, ask for the remote URL and offer `git remote add origin <url>`.
66
+ - If the user provides a GitHub URL, run `gaslighting-engine care --github-url <url>` or connect it directly with Git CLI.
66
67
  - If GitHub is connected, record the remote URL here and in `DECISION_LOG.md` when it changes.
67
68
  - If domain or deployment details are missing, keep warning until they are confirmed.
68
69
  - Treat missing domain, deployment, analytics, email, and privacy ownership as mission-critical launch risks, not as reasons to abandon the task.
@@ -62,6 +62,7 @@ The agent must treat this project as mission-critical. If something can put deli
62
62
  - Do make a practical assumption, record it, and keep moving.
63
63
  - If Git is not initialized, ask for a GitHub URL and offer the exact commands.
64
64
  - If Git is initialized but no GitHub remote exists, ask for the remote URL and offer `git remote add origin <url>`.
65
+ - If the user provides a GitHub URL, run `gaslighting-engine care --github-url <url>` or connect it directly with Git CLI.
65
66
  - If GitHub is connected, record the remote URL here and in `DECISION_LOG.md` when it changes.
66
67
  - If domain or deployment details are missing, keep warning until they are confirmed.
67
68
  - Treat missing domain, deployment, analytics, email, and privacy ownership as mission-critical launch risks, not as reasons to abandon the task.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaslighting-engine",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "LUDGI Gaslighting-engine: a hardcore project-discipline generator for AI coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",