gaslighting-engine 0.2.0 → 0.2.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.
@@ -30,3 +30,5 @@ Rules:
30
30
  - If something is incomplete, declare it explicitly.
31
31
 
32
32
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
33
+
34
+ To refresh this Gaslighting Codex install later, run `npx gaslighting-engine@latest upgrade`.
@@ -99,3 +99,11 @@ Do not produce a plan without files.
99
99
  Do not say what should be done.
100
100
 
101
101
  Generate the actual project discipline documents.
102
+
103
+ ## Update Rule
104
+
105
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
106
+
107
+ ```bash
108
+ npx gaslighting-engine@latest upgrade
109
+ ```
@@ -30,3 +30,5 @@ Rules:
30
30
  - If something is incomplete, declare it explicitly.
31
31
 
32
32
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
33
+
34
+ To refresh this Gaslighting Codex install later, run `npx gaslighting-engine@latest upgrade`.
@@ -99,3 +99,11 @@ Do not produce a plan without files.
99
99
  Do not say what should be done.
100
100
 
101
101
  Generate the actual project discipline documents.
102
+
103
+ ## Update Rule
104
+
105
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
106
+
107
+ ```bash
108
+ npx gaslighting-engine@latest upgrade
109
+ ```
package/README.md CHANGED
@@ -84,11 +84,13 @@ gaslighting init "I want to build a hospital website."
84
84
  gaslighting-engine generate "Build an ecommerce MVP."
85
85
  gaslighting-engine update "The hospital is actually an OB-GYN clinic, not dermatology."
86
86
  gaslighting-engine doctor
87
+ gaslighting-engine upgrade
87
88
  gaslighting-engine codex-install
88
89
  gaslighting-engine codex-doctor
89
90
  gaslighting-engine skill
90
91
  gaslighting-engine agents
91
92
  gaslighting-engine care
93
+ gaslighting-engine care --github-url https://github.com/user/repo.git
92
94
  ```
93
95
 
94
96
  ## Output Layout
@@ -113,18 +115,33 @@ This file tracks non-blocking but important care risks:
113
115
 
114
116
  These are warnings, not fake blockers. The agent should keep implementing, but it must keep warning and recording gaps until they are resolved.
115
117
 
118
+ If GitHub is not connected yet, run:
119
+
120
+ ```bash
121
+ gaslighting-engine care --github-url https://github.com/user/repo.git
122
+ ```
123
+
124
+ This initializes Git when needed and connects `origin`. If `origin` already exists and must be replaced, use `--force-remote`.
125
+
116
126
  ## Update Notice
117
127
 
118
128
  Gaslighting-engine checks npm for a newer version when you run normal commands.
119
129
 
130
+ The simple update command is:
131
+
132
+ ```bash
133
+ npx gaslighting-engine@latest upgrade
134
+ ```
135
+
136
+ This updates the Codex skill and prompt files in the current project. No `--force` is needed.
137
+
120
138
  If an update exists, it prints a short notice like:
121
139
 
122
140
  ```txt
123
141
  Gaslighting-engine update available:
124
142
  - current: 0.1.0
125
143
  - latest: 0.1.1
126
- - update: npm install -g gaslighting-engine@latest
127
- - npx: npx gaslighting-engine@latest
144
+ - update: npx gaslighting-engine@latest upgrade
128
145
  ```
129
146
 
130
147
  The update check is best-effort and never blocks the command. Disable it with:
package/dist/cli.js CHANGED
@@ -7,6 +7,7 @@ import { runGenerate } from "./commands/generate.js";
7
7
  import { runInit } from "./commands/init.js";
8
8
  import { runSkill } from "./commands/skill.js";
9
9
  import { runUpdate } from "./commands/update.js";
10
+ import { runUpgrade } from "./commands/upgrade.js";
10
11
  import { packageVersion } from "./version.js";
11
12
  const projectTypes = [
12
13
  "hospital_homepage",
@@ -58,6 +59,8 @@ Examples:
58
59
  $ gaslighting "Build an ecommerce MVP." --type ecommerce
59
60
  $ gaslighting-engine init "Build a landing page" --dry-run
60
61
  $ gaslighting-engine doctor
62
+ $ gaslighting-engine care --github-url https://github.com/user/repo.git
63
+ $ gaslighting-engine upgrade
61
64
  $ gaslighting-engine codex-install --force
62
65
 
63
66
  Defaults:
@@ -98,7 +101,17 @@ Defaults:
98
101
  .option("--path <path>", "target directory")
99
102
  .option("--lang <lang>", "language: en or ko", "en")
100
103
  .option("--type <type>", "project type override", parseProjectType)
104
+ .option("--github-url <url>", "initialize git if needed and connect origin to this GitHub URL")
105
+ .option("--force-remote", "replace an existing origin remote when used with --github-url")
101
106
  .action(runCare);
107
+ program
108
+ .command("upgrade")
109
+ .description("Update the local Codex Gaslighting install with one simple command")
110
+ .option("--no-force", "preserve existing files and create .new variants instead")
111
+ .option("--dry-run", "print files without writing")
112
+ .option("--path <path>", "target directory")
113
+ .option("--scope <scope>", "project or user", "project")
114
+ .action(runUpgrade);
102
115
  program
103
116
  .command("codex-install")
104
117
  .description("Install Gaslighting as a Codex-optimized project or user skill")
@@ -121,7 +134,7 @@ export function normalizeDefaultInitArgv(argv) {
121
134
  return argv;
122
135
  if (args.some((arg) => ["--help", "-h", "--version", "-V"].includes(arg)))
123
136
  return argv;
124
- const commands = new Set(["init", "generate", "update", "doctor", "skill", "agents", "care", "codex-install", "codex-doctor"]);
137
+ const commands = new Set(["init", "generate", "update", "doctor", "skill", "agents", "care", "upgrade", "codex-install", "codex-doctor"]);
125
138
  const firstMeaningful = args.find((arg) => !arg.startsWith("-"));
126
139
  if (firstMeaningful && commands.has(firstMeaningful))
127
140
  return argv;
@@ -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");
@@ -26,6 +26,7 @@ export function runCodexInstall(options) {
26
26
  console.log('- If Codex exposes enabled skills in slash commands, use: /gaslighting');
27
27
  console.log("- If neither appears immediately, restart Codex and reopen this project.");
28
28
  console.log("- Fallback prompt file: .gaslighting/CODEX_GASLIGHTING.md");
29
+ console.log("- Update later with: npx gaslighting-engine@latest upgrade");
29
30
  }
30
31
  export function runCodexDoctor(options) {
31
32
  const target = resolveTargetPath(options);
@@ -46,12 +47,12 @@ export function runCodexDoctor(options) {
46
47
  const hasSkill = checks.some((check) => check.ok && check.file.endsWith("skills/gaslighting/SKILL.md"));
47
48
  if (!hasSkill) {
48
49
  process.exitCode = 1;
49
- console.log("\nNo gaslighting skill was found. Run: gaslighting codex-install --force");
50
+ console.log("\nNo gaslighting skill was found. Run: npx gaslighting-engine@latest upgrade");
50
51
  return;
51
52
  }
52
53
  console.log("\nCodex install looks usable. Restart Codex if the skill does not appear yet.");
53
54
  }
54
- function resolveTargetPath(options) {
55
+ export function resolveTargetPath(options) {
55
56
  if (options.path)
56
57
  return resolve(options.path);
57
58
  if (options.scope === "user")
@@ -0,0 +1,27 @@
1
+ import { generateCodexInstallDocs } from "../core/generateDocs.js";
2
+ import { printBanner } from "../utils/banner.js";
3
+ import { writeDocs } from "../utils/file.js";
4
+ import { packageVersion } from "../version.js";
5
+ import { resolveTargetPath } from "./codexInstall.js";
6
+ export function runUpgrade(options) {
7
+ const target = resolveTargetPath(options);
8
+ const force = options.force ?? true;
9
+ const results = writeDocs(target, generateCodexInstallDocs(), force, options.dryRun);
10
+ printBanner("UPGRADE");
11
+ console.log(`Version: ${packageVersion}`);
12
+ console.log(`Target: ${target}\n`);
13
+ console.log("Updated Codex files:");
14
+ for (const result of results) {
15
+ const suffix = result.status === "created_variant"
16
+ ? " (existing file preserved)"
17
+ : result.status === "overwritten"
18
+ ? " (overwritten)"
19
+ : result.status === "dry_run"
20
+ ? " (dry run)"
21
+ : "";
22
+ console.log(`- ${result.filename}${suffix}`);
23
+ }
24
+ console.log("\nDone.");
25
+ console.log("Restart Codex or reopen this project if the old skill is still visible.");
26
+ console.log('Use: /gaslighting, "$gaslighting", or say "Use the gaslighting skill."');
27
+ }
@@ -424,6 +424,14 @@ Do not produce a plan without files.
424
424
  Do not say what should be done.
425
425
 
426
426
  Generate the actual project discipline documents.
427
+
428
+ ## Update Rule
429
+
430
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
431
+
432
+ \`\`\`bash
433
+ npx gaslighting-engine@latest upgrade
434
+ \`\`\`
427
435
  `;
428
436
  }
429
437
  export function generateSkillOpenAiYaml() {
@@ -472,6 +480,12 @@ Rules:
472
480
 
473
481
  Before claiming completion, perform the self-audit in \`.gaslighting/GASLIGHTING.md\`.
474
482
 
483
+ To refresh the Codex skill files later, run:
484
+
485
+ \`\`\`bash
486
+ npx gaslighting-engine@latest upgrade
487
+ \`\`\`
488
+
475
489
  Proceed.
476
490
  `;
477
491
  }
@@ -508,6 +522,8 @@ Rules:
508
522
  - If something is incomplete, declare it explicitly.
509
523
 
510
524
  Before claiming completion, perform the self-audit in \`.gaslighting/GASLIGHTING.md\`.
525
+
526
+ To refresh this Gaslighting Codex install later, run \`npx gaslighting-engine@latest upgrade\`.
511
527
  `;
512
528
  }
513
529
  export function generateSkillReferenceDocs() {
@@ -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
+ }
@@ -11,8 +11,7 @@ export async function notifyIfUpdateAvailable(argv) {
11
11
  console.error("Gaslighting-engine update available:");
12
12
  console.error(`- current: ${packageVersion}`);
13
13
  console.error(`- latest: ${latestVersion}`);
14
- console.error(`- update: npm install -g ${packageName}@latest`);
15
- console.error(`- npx: npx ${packageName}@latest`);
14
+ console.error(`- update: npx ${packageName}@latest upgrade`);
16
15
  console.error("");
17
16
  }
18
17
  catch {
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.2";
@@ -38,6 +38,14 @@ Check the install:
38
38
  npx gaslighting-engine codex-doctor
39
39
  ```
40
40
 
41
+ Update the Codex skill later:
42
+
43
+ ```bash
44
+ npx gaslighting-engine@latest upgrade
45
+ ```
46
+
47
+ This is the recommended update flow. It overwrites the local Codex skill and prompt files with the latest package version.
48
+
41
49
  ## Generate Discipline Docs
42
50
 
43
51
  Generate documents:
package/docs/examples.md CHANGED
@@ -19,6 +19,7 @@ Published usage:
19
19
 
20
20
  ```bash
21
21
  npx gaslighting-engine "I want to build a hospital website."
22
+ npx gaslighting-engine@latest upgrade
22
23
  ```
23
24
 
24
25
  This writes discipline documents under `.gaslighting/` and keeps only the Codex pointer `AGENTS.md` in the root.
@@ -27,6 +28,7 @@ Project-care refresh:
27
28
 
28
29
  ```bash
29
30
  npx gaslighting-engine care "I want to build a hospital website." --force
31
+ npx gaslighting-engine care --github-url https://github.com/user/repo.git --force
30
32
  ```
31
33
 
32
34
  Update check test:
@@ -30,3 +30,5 @@ Rules:
30
30
  - If something is incomplete, declare it explicitly.
31
31
 
32
32
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
33
+
34
+ To refresh this Gaslighting Codex install later, run `npx gaslighting-engine@latest upgrade`.
@@ -99,3 +99,11 @@ Do not produce a plan without files.
99
99
  Do not say what should be done.
100
100
 
101
101
  Generate the actual project discipline documents.
102
+
103
+ ## Update Rule
104
+
105
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
106
+
107
+ ```bash
108
+ npx gaslighting-engine@latest upgrade
109
+ ```
@@ -32,4 +32,10 @@ Rules:
32
32
 
33
33
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
34
34
 
35
+ To refresh the Codex skill files later, run:
36
+
37
+ ```bash
38
+ npx gaslighting-engine@latest upgrade
39
+ ```
40
+
35
41
  Proceed.
@@ -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.
@@ -30,3 +30,5 @@ Rules:
30
30
  - If something is incomplete, declare it explicitly.
31
31
 
32
32
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
33
+
34
+ To refresh this Gaslighting Codex install later, run `npx gaslighting-engine@latest upgrade`.
@@ -99,3 +99,11 @@ Do not produce a plan without files.
99
99
  Do not say what should be done.
100
100
 
101
101
  Generate the actual project discipline documents.
102
+
103
+ ## Update Rule
104
+
105
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
106
+
107
+ ```bash
108
+ npx gaslighting-engine@latest upgrade
109
+ ```
@@ -32,4 +32,10 @@ Rules:
32
32
 
33
33
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
34
34
 
35
+ To refresh the Codex skill files later, run:
36
+
37
+ ```bash
38
+ npx gaslighting-engine@latest upgrade
39
+ ```
40
+
35
41
  Proceed.
@@ -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.
@@ -30,3 +30,5 @@ Rules:
30
30
  - If something is incomplete, declare it explicitly.
31
31
 
32
32
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
33
+
34
+ To refresh this Gaslighting Codex install later, run `npx gaslighting-engine@latest upgrade`.
@@ -99,3 +99,11 @@ Do not produce a plan without files.
99
99
  Do not say what should be done.
100
100
 
101
101
  Generate the actual project discipline documents.
102
+
103
+ ## Update Rule
104
+
105
+ When the user asks how to update this Gaslighting Codex install, give the simple command:
106
+
107
+ ```bash
108
+ npx gaslighting-engine@latest upgrade
109
+ ```
@@ -32,4 +32,10 @@ Rules:
32
32
 
33
33
  Before claiming completion, perform the self-audit in `.gaslighting/GASLIGHTING.md`.
34
34
 
35
+ To refresh the Codex skill files later, run:
36
+
37
+ ```bash
38
+ npx gaslighting-engine@latest upgrade
39
+ ```
40
+
35
41
  Proceed.
@@ -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.2",
4
4
  "description": "LUDGI Gaslighting-engine: a hardcore project-discipline generator for AI coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",