@goodtek/vibeops 0.2.0
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/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +444 -0
- package/dist/agent/loader.js +71 -0
- package/dist/agent/prompt.js +66 -0
- package/dist/bootstrap/installer.js +149 -0
- package/dist/bootstrap/manifest.js +15 -0
- package/dist/bootstrap/substitute.js +35 -0
- package/dist/cli.js +241 -0
- package/dist/commands/agent-list.js +32 -0
- package/dist/commands/agent-prompt.js +59 -0
- package/dist/commands/agent-show.js +26 -0
- package/dist/commands/github-init.js +554 -0
- package/dist/commands/github-status.js +164 -0
- package/dist/commands/init.js +179 -0
- package/dist/commands/notion-init.js +764 -0
- package/dist/commands/notion-sync.js +405 -0
- package/dist/commands/notion-test.js +595 -0
- package/dist/commands/plan.js +114 -0
- package/dist/commands/status.js +17 -0
- package/dist/commands/task-check.js +155 -0
- package/dist/commands/task-done.js +98 -0
- package/dist/commands/task-generate.js +206 -0
- package/dist/commands/task-pull.js +277 -0
- package/dist/commands/task-rollback.js +174 -0
- package/dist/commands/task-start.js +90 -0
- package/dist/lib/brief.js +349 -0
- package/dist/lib/config.js +158 -0
- package/dist/lib/filesystem.js +67 -0
- package/dist/lib/git.js +237 -0
- package/dist/lib/github-cli.js +247 -0
- package/dist/lib/inquirer-helpers.js +111 -0
- package/dist/lib/logger.js +42 -0
- package/dist/lib/notion-client.js +459 -0
- package/dist/lib/notion-discovery.js +671 -0
- package/dist/lib/notion-env.js +140 -0
- package/dist/lib/notion-mappers.js +148 -0
- package/dist/lib/notion-schema.js +272 -0
- package/dist/lib/notion-sync.js +337 -0
- package/dist/lib/notion-target.js +247 -0
- package/dist/lib/package-json.js +133 -0
- package/dist/lib/paths.js +26 -0
- package/dist/lib/project-docs.js +95 -0
- package/dist/lib/prompt-builder.js +125 -0
- package/dist/lib/task-generator.js +183 -0
- package/dist/lib/task-prompt.js +23 -0
- package/dist/lib/task-pull.js +354 -0
- package/dist/lib/task-scaffold.js +128 -0
- package/dist/lib/task-summary.js +276 -0
- package/dist/lib/task.js +364 -0
- package/dist/status/collector.js +103 -0
- package/dist/status/format.js +177 -0
- package/dist/types/brief.js +126 -0
- package/dist/types/config.js +17 -0
- package/dist/types/task.js +1 -0
- package/dist/version.js +8 -0
- package/package.json +61 -0
- package/templates/.cursor/rules/00-project-governance.mdc +28 -0
- package/templates/.cursor/rules/01-agent-orchestration.mdc +48 -0
- package/templates/.cursor/rules/02-task-workflow.mdc +38 -0
- package/templates/.cursor/rules/03-git-safety.mdc +30 -0
- package/templates/.cursor/rules/04-docs-update.mdc +22 -0
- package/templates/.vibeops/agents/architect.md +47 -0
- package/templates/.vibeops/agents/builder.md +38 -0
- package/templates/.vibeops/agents/docs.md +54 -0
- package/templates/.vibeops/agents/orchestrator.md +40 -0
- package/templates/.vibeops/agents/planner.md +60 -0
- package/templates/.vibeops/agents/recovery.md +49 -0
- package/templates/.vibeops/agents/reviewer.md +47 -0
- package/templates/.vibeops/agents/tester.md +43 -0
- package/templates/.vibeops/prompts/create-plan.md +33 -0
- package/templates/.vibeops/prompts/generate-tasks.md +41 -0
- package/templates/.vibeops/prompts/implement-task.md +39 -0
- package/templates/.vibeops/prompts/review-task.md +34 -0
- package/templates/.vibeops/prompts/rollback.md +32 -0
- package/templates/.vibeops/prompts/start-project.md +39 -0
- package/templates/.vibeops/workflows/notion-sync.md +53 -0
- package/templates/.vibeops/workflows/project-start.md +73 -0
- package/templates/.vibeops/workflows/rollback.md +45 -0
- package/templates/.vibeops/workflows/task-lifecycle.md +71 -0
- package/templates/AGENTS.md +98 -0
- package/templates/docs/logs/README.md +38 -0
- package/templates/docs/project/00-overview.md +27 -0
- package/templates/docs/project/01-requirements.md +30 -0
- package/templates/docs/project/02-mvp-scope.md +36 -0
- package/templates/docs/project/03-architecture.md +34 -0
- package/templates/docs/project/04-tech-stack.md +29 -0
- package/templates/docs/project/05-current-state.md +35 -0
- package/templates/docs/project/06-decisions.md +20 -0
- package/templates/docs/project/07-backlog.md +23 -0
- package/templates/docs/project/08-env.md +29 -0
- package/templates/docs/project/09-deployment.md +28 -0
- package/templates/docs/tasks/TASK-000-template.md +72 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { readConfig } from "../lib/config.js";
|
|
3
|
+
import { ghAuthStatus, gitRemoteList, isGhInstalled, parseGitHubRemote, } from "../lib/github-cli.js";
|
|
4
|
+
import { readBugsUrl, readHomepage, readPackageJson, readRepositoryUrl, } from "../lib/package-json.js";
|
|
5
|
+
import { bold, cyan, dim, green, log, yellow } from "../lib/logger.js";
|
|
6
|
+
async function collect(cwd) {
|
|
7
|
+
const [installed, auth, remotes, vibeopsConfig, pkg] = await Promise.all([
|
|
8
|
+
isGhInstalled(),
|
|
9
|
+
ghAuthStatus(),
|
|
10
|
+
gitRemoteList(cwd),
|
|
11
|
+
readConfig(cwd),
|
|
12
|
+
readPackageJson(cwd),
|
|
13
|
+
]);
|
|
14
|
+
const origin = remotes.find((r) => r.name === "origin") ?? null;
|
|
15
|
+
const otherGithub = remotes.find((r) => r.name !== "origin" && parseGitHubRemote(r.url).isGithub);
|
|
16
|
+
const chosen = origin ?? otherGithub ?? null;
|
|
17
|
+
const remote = chosen
|
|
18
|
+
? {
|
|
19
|
+
name: chosen.name,
|
|
20
|
+
url: chosen.url,
|
|
21
|
+
info: parseGitHubRemote(chosen.url),
|
|
22
|
+
}
|
|
23
|
+
: null;
|
|
24
|
+
return {
|
|
25
|
+
cwd,
|
|
26
|
+
gh: {
|
|
27
|
+
installed,
|
|
28
|
+
authenticated: auth.authenticated,
|
|
29
|
+
username: auth.username,
|
|
30
|
+
hosts: auth.hosts,
|
|
31
|
+
},
|
|
32
|
+
remote,
|
|
33
|
+
config: vibeopsConfig?.github
|
|
34
|
+
? {
|
|
35
|
+
enabled: vibeopsConfig.github.enabled,
|
|
36
|
+
mode: vibeopsConfig.github.mode,
|
|
37
|
+
owner: vibeopsConfig.github.owner,
|
|
38
|
+
repo: vibeopsConfig.github.repo,
|
|
39
|
+
remote: vibeopsConfig.github.remote,
|
|
40
|
+
visibility: vibeopsConfig.github.visibility,
|
|
41
|
+
url: vibeopsConfig.github.url,
|
|
42
|
+
}
|
|
43
|
+
: null,
|
|
44
|
+
package: pkg
|
|
45
|
+
? {
|
|
46
|
+
present: true,
|
|
47
|
+
repositoryUrl: readRepositoryUrl(pkg.data),
|
|
48
|
+
homepage: readHomepage(pkg.data),
|
|
49
|
+
bugsUrl: readBugsUrl(pkg.data),
|
|
50
|
+
}
|
|
51
|
+
: { present: false, repositoryUrl: "", homepage: "", bugsUrl: "" },
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function fmtRow(label, value, accent = "info") {
|
|
55
|
+
const padded = label.padEnd(20, " ");
|
|
56
|
+
const decorated = accent === "ok"
|
|
57
|
+
? green(value)
|
|
58
|
+
: accent === "warn"
|
|
59
|
+
? yellow(value)
|
|
60
|
+
: accent === "off"
|
|
61
|
+
? dim(value)
|
|
62
|
+
: value;
|
|
63
|
+
log.info(` ${padded} ${decorated}`);
|
|
64
|
+
}
|
|
65
|
+
function describeRemote(report) {
|
|
66
|
+
if (report.remote === null)
|
|
67
|
+
return { text: "none", accent: "off" };
|
|
68
|
+
const { info } = report.remote;
|
|
69
|
+
if (info.isGithub && info.owner !== null && info.repo !== null) {
|
|
70
|
+
return {
|
|
71
|
+
text: `${report.remote.name} ${info.owner}/${info.repo} ${dim(info.url)}`,
|
|
72
|
+
accent: "ok",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
text: `${report.remote.name} ${report.remote.url} ${yellow("(not a GitHub URL)")}`,
|
|
77
|
+
accent: "warn",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function describePackage(report) {
|
|
81
|
+
if (!report.package.present)
|
|
82
|
+
return { text: "none", accent: "off" };
|
|
83
|
+
const url = report.package.repositoryUrl;
|
|
84
|
+
if (url.length === 0)
|
|
85
|
+
return { text: "none", accent: "off" };
|
|
86
|
+
const info = parseGitHubRemote(url);
|
|
87
|
+
if (info.isGithub && info.owner !== null && info.repo !== null) {
|
|
88
|
+
return {
|
|
89
|
+
text: `${info.owner}/${info.repo} ${dim(url)}`,
|
|
90
|
+
accent: "ok",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return { text: `${url} ${yellow("(not a GitHub URL)")}`, accent: "warn" };
|
|
94
|
+
}
|
|
95
|
+
function describeConfig(report) {
|
|
96
|
+
if (report.config === null)
|
|
97
|
+
return { text: "no (no github section)", accent: "off" };
|
|
98
|
+
if (!report.config.enabled)
|
|
99
|
+
return {
|
|
100
|
+
text: `no (config present, enabled=false)`,
|
|
101
|
+
accent: "off",
|
|
102
|
+
};
|
|
103
|
+
const slug = report.config.owner.length > 0 && report.config.repo.length > 0
|
|
104
|
+
? `${report.config.owner}/${report.config.repo}`
|
|
105
|
+
: "(owner/repo missing)";
|
|
106
|
+
const visibility = report.config.visibility.length > 0 ? report.config.visibility : "?";
|
|
107
|
+
return {
|
|
108
|
+
text: `yes ${slug} visibility=${visibility} remote=${report.config.remote}`,
|
|
109
|
+
accent: report.config.owner.length > 0 && report.config.repo.length > 0 ? "ok" : "warn",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function printHuman(report) {
|
|
113
|
+
log.info(bold("GitHub"));
|
|
114
|
+
fmtRow("gh installed", report.gh.installed ? "yes" : "no", report.gh.installed ? "ok" : "off");
|
|
115
|
+
if (report.gh.installed) {
|
|
116
|
+
fmtRow("gh authenticated", report.gh.authenticated
|
|
117
|
+
? `yes${report.gh.username !== null ? ` ${dim(`as ${report.gh.username}`)}` : ""}`
|
|
118
|
+
: "no", report.gh.authenticated ? "ok" : "off");
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
fmtRow("gh authenticated", "n/a", "off");
|
|
122
|
+
}
|
|
123
|
+
const remote = describeRemote(report);
|
|
124
|
+
fmtRow("git remote origin", remote.text, remote.accent);
|
|
125
|
+
const cfg = describeConfig(report);
|
|
126
|
+
fmtRow("config enabled", cfg.text, cfg.accent);
|
|
127
|
+
const pkg = describePackage(report);
|
|
128
|
+
fmtRow("package repo", pkg.text, pkg.accent);
|
|
129
|
+
log.blank();
|
|
130
|
+
if (!report.gh.installed) {
|
|
131
|
+
log.info(`${yellow("!")} gh CLI not found. Install via ${cyan("brew install gh")} (macOS) and re-run.`);
|
|
132
|
+
}
|
|
133
|
+
else if (!report.gh.authenticated) {
|
|
134
|
+
log.info(`${yellow("!")} gh installed but not authenticated. Run ${cyan("gh auth login")} first.`);
|
|
135
|
+
}
|
|
136
|
+
else if (report.remote === null) {
|
|
137
|
+
log.info(`${dim("·")} No git remote yet. Run ${cyan("vibeops github init")} to create or connect one.`);
|
|
138
|
+
}
|
|
139
|
+
else if (!report.remote.info.isGithub) {
|
|
140
|
+
log.info(`${yellow("!")} ${report.remote.name} is not a GitHub URL. Reconnect with ${cyan("vibeops github init --connect <owner/repo>")}.`);
|
|
141
|
+
}
|
|
142
|
+
else if (report.config === null || !report.config.enabled) {
|
|
143
|
+
log.info(`${dim("·")} Remote OK, but .vibeops.json has no github section. Run ${cyan("vibeops github init")} to record it.`);
|
|
144
|
+
}
|
|
145
|
+
else if (report.package.present &&
|
|
146
|
+
parseGitHubRemote(report.package.repositoryUrl).isGithub === false) {
|
|
147
|
+
log.info(`${dim("·")} package.json repository fields are not GitHub URLs. Re-run ${cyan("vibeops github init")} to update them.`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
log.ok("GitHub setup looks consistent.");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export async function githubStatusCommand(options = {}) {
|
|
154
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
155
|
+
const report = await collect(cwd);
|
|
156
|
+
if (options.json === true) {
|
|
157
|
+
log.raw(`${JSON.stringify(report, null, 2)}\n`);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
printHuman(report);
|
|
161
|
+
// Non-blocking: github status never sets a non-zero exit code by itself.
|
|
162
|
+
// The user is informed; nothing about gh missing / unauthenticated should
|
|
163
|
+
// break CI scripts that only call `vibeops github status` to probe state.
|
|
164
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { basename, resolve } from "node:path";
|
|
2
|
+
import { install, printReport } from "../bootstrap/installer.js";
|
|
3
|
+
import { buildConfig } from "../lib/config.js";
|
|
4
|
+
import { currentBranchOrUnborn, gitAddAll, gitCommit, gitInit, gitSetDefaultBranch, gitStatusPorcelain, hasAnyCommit, isGitRepository, } from "../lib/git.js";
|
|
5
|
+
import { askInput, askYesNo } from "../lib/inquirer-helpers.js";
|
|
6
|
+
import { cyan, dim, green, log, yellow } from "../lib/logger.js";
|
|
7
|
+
const DEFAULT_BRANCH = "main";
|
|
8
|
+
const DEFAULT_COMMIT_MESSAGE = "chore: initialize vibeops project";
|
|
9
|
+
function deriveProjectName(root, explicit) {
|
|
10
|
+
if (explicit && explicit.trim().length > 0)
|
|
11
|
+
return explicit.trim();
|
|
12
|
+
const base = basename(root);
|
|
13
|
+
if (base.length > 0 && base !== "/")
|
|
14
|
+
return base;
|
|
15
|
+
return "untitled-project";
|
|
16
|
+
}
|
|
17
|
+
export async function initCommand(options = {}) {
|
|
18
|
+
const dryRun = options.dryRun === true;
|
|
19
|
+
const force = options.force === true;
|
|
20
|
+
const projectRoot = resolve(options.cwd ?? process.cwd());
|
|
21
|
+
const interactive = !dryRun && process.stdin.isTTY === true && options.git === undefined;
|
|
22
|
+
const name = deriveProjectName(projectRoot, options.name);
|
|
23
|
+
const config = buildConfig(name);
|
|
24
|
+
log.step(`vibeops init ${dryRun ? "(dry-run) " : ""}→ ${projectRoot}`);
|
|
25
|
+
log.info(` project: ${name}`);
|
|
26
|
+
log.info(` vibeops: ${config.vibeopsVersion}`);
|
|
27
|
+
if (force)
|
|
28
|
+
log.warn("--force is on — existing files will be overwritten.");
|
|
29
|
+
log.blank();
|
|
30
|
+
const report = await install({ projectRoot, config, dryRun, force });
|
|
31
|
+
printReport(report, dryRun);
|
|
32
|
+
const gitPlan = await resolveGitPlan(options, interactive);
|
|
33
|
+
await runGitSetup(projectRoot, gitPlan, dryRun);
|
|
34
|
+
if (!dryRun) {
|
|
35
|
+
log.blank();
|
|
36
|
+
log.info("Next steps:");
|
|
37
|
+
log.info(" 1. Open AGENTS.md and confirm the project name.");
|
|
38
|
+
log.info(" 2. Run `vibeops status` to verify installation.");
|
|
39
|
+
log.info(" 3. Run `vibeops plan` to populate docs/project/* (or fill them by hand).");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function resolveGitPlan(options, interactive) {
|
|
43
|
+
const defaultBranch = typeof options.defaultBranch === "string" && options.defaultBranch.trim().length > 0
|
|
44
|
+
? options.defaultBranch.trim()
|
|
45
|
+
: DEFAULT_BRANCH;
|
|
46
|
+
const commitMessage = typeof options.commitMessage === "string" && options.commitMessage.trim().length > 0
|
|
47
|
+
? options.commitMessage.trim()
|
|
48
|
+
: DEFAULT_COMMIT_MESSAGE;
|
|
49
|
+
if (interactive) {
|
|
50
|
+
log.blank();
|
|
51
|
+
log.info("Git setup");
|
|
52
|
+
const shouldInitGit = await askYesNo({
|
|
53
|
+
message: "Initialize Git repository?",
|
|
54
|
+
nonInteractive: false,
|
|
55
|
+
defaultValue: true,
|
|
56
|
+
});
|
|
57
|
+
if (!shouldInitGit) {
|
|
58
|
+
return {
|
|
59
|
+
shouldInitGit: false,
|
|
60
|
+
shouldSetDefaultBranch: false,
|
|
61
|
+
defaultBranch,
|
|
62
|
+
shouldInitialCommit: false,
|
|
63
|
+
commitMessage,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const useMain = await askYesNo({
|
|
67
|
+
message: "Use `main` as default branch?",
|
|
68
|
+
nonInteractive: false,
|
|
69
|
+
defaultValue: true,
|
|
70
|
+
});
|
|
71
|
+
const shouldInitialCommit = await askYesNo({
|
|
72
|
+
message: "Create initial commit?",
|
|
73
|
+
nonInteractive: false,
|
|
74
|
+
defaultValue: true,
|
|
75
|
+
});
|
|
76
|
+
const finalMessage = shouldInitialCommit
|
|
77
|
+
? await askInput({
|
|
78
|
+
message: "Initial commit message",
|
|
79
|
+
nonInteractive: false,
|
|
80
|
+
default: commitMessage,
|
|
81
|
+
required: true,
|
|
82
|
+
})
|
|
83
|
+
: commitMessage;
|
|
84
|
+
return {
|
|
85
|
+
shouldInitGit: true,
|
|
86
|
+
shouldSetDefaultBranch: useMain,
|
|
87
|
+
defaultBranch,
|
|
88
|
+
shouldInitialCommit,
|
|
89
|
+
commitMessage: finalMessage.length > 0 ? finalMessage : commitMessage,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const shouldInitGit = options.git !== false && (options.git === true || options.initialCommit === true);
|
|
93
|
+
if (!shouldInitGit) {
|
|
94
|
+
return {
|
|
95
|
+
shouldInitGit: false,
|
|
96
|
+
shouldSetDefaultBranch: false,
|
|
97
|
+
defaultBranch,
|
|
98
|
+
shouldInitialCommit: false,
|
|
99
|
+
commitMessage,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
shouldInitGit: true,
|
|
104
|
+
shouldSetDefaultBranch: true,
|
|
105
|
+
defaultBranch,
|
|
106
|
+
shouldInitialCommit: options.initialCommit !== false,
|
|
107
|
+
commitMessage,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async function runGitSetup(projectRoot, plan, dryRun) {
|
|
111
|
+
log.blank();
|
|
112
|
+
log.info("Git setup:");
|
|
113
|
+
if (!plan.shouldInitGit) {
|
|
114
|
+
log.info(` ${dim("skipped")} Git initialization`);
|
|
115
|
+
if (dryRun) {
|
|
116
|
+
log.info(` ${dim("hint")} use ${cyan("vibeops init --git --initial-commit")} to include Git setup in non-interactive mode`);
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const alreadyRepo = await isGitRepository(projectRoot);
|
|
121
|
+
const hasCommitsBefore = alreadyRepo ? await hasAnyCommit(projectRoot) : false;
|
|
122
|
+
if (dryRun) {
|
|
123
|
+
log.info(` ${alreadyRepo ? dim("would skip") : green("would run")} git init`);
|
|
124
|
+
if (plan.shouldSetDefaultBranch) {
|
|
125
|
+
log.info(` ${green("would set")} default branch ${cyan(plan.defaultBranch)}`);
|
|
126
|
+
}
|
|
127
|
+
if (plan.shouldInitialCommit) {
|
|
128
|
+
log.info(` ${green("would run")} git add .`);
|
|
129
|
+
log.info(` ${green("would run")} git commit -m ${JSON.stringify(plan.commitMessage)}`);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
log.info(` ${dim("would skip")} initial commit`);
|
|
133
|
+
}
|
|
134
|
+
log.info(` ${dim("dry-run")} no git commands executed`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (alreadyRepo) {
|
|
138
|
+
log.info(` ${dim("skipped")} git init (already a git repository)`);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
await gitInit(projectRoot);
|
|
142
|
+
log.ok("git init");
|
|
143
|
+
}
|
|
144
|
+
if (plan.shouldSetDefaultBranch) {
|
|
145
|
+
const hasCommitsNow = await hasAnyCommit(projectRoot);
|
|
146
|
+
if (alreadyRepo && hasCommitsNow) {
|
|
147
|
+
log.info(` ${yellow("skipped")} default branch change (repository already has commits)`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
await gitSetDefaultBranch(projectRoot, plan.defaultBranch);
|
|
151
|
+
log.ok(`default branch ${plan.defaultBranch}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!plan.shouldInitialCommit) {
|
|
155
|
+
log.info(` ${dim("skipped")} initial commit`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (hasCommitsBefore || (await hasAnyCommit(projectRoot))) {
|
|
159
|
+
log.info(` ${yellow("skipped")} initial commit (repository already has commits)`);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const changedFiles = await gitStatusPorcelain(projectRoot);
|
|
163
|
+
log.info(` ${dim("initial commit files")} ${changedFiles.length} file${changedFiles.length === 1 ? "" : "s"} will be included`);
|
|
164
|
+
if (changedFiles.length === 0) {
|
|
165
|
+
log.info(` ${dim("skipped")} initial commit (nothing to commit)`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
await gitAddAll(projectRoot);
|
|
170
|
+
await gitCommit(projectRoot, plan.commitMessage);
|
|
171
|
+
const branch = await currentBranchOrUnborn(projectRoot);
|
|
172
|
+
log.ok(`initial commit created${branch.branch !== null ? ` on ${branch.branch}` : ""}`);
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
log.error(`initial commit failed: ${err.message}`);
|
|
176
|
+
log.info(` ${dim("hint")} check Git user.name/user.email, then run ${cyan(`git commit -m ${JSON.stringify(plan.commitMessage)}`)} manually.`);
|
|
177
|
+
process.exitCode = 1;
|
|
178
|
+
}
|
|
179
|
+
}
|