mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Add the git-commit skill and dashboard card, and the No changes button, as v2.6.0
AI Assisted
This commit is contained in:
1 parent
1877ca1fa7
commit
50a78a6917
37 files changed
+1001
-141
No files matched your search
@@ -344,6 +344,20 @@ function gitDirAt(dir) {
|
||||
return fs.existsSync(path.join(git, "HEAD")) ? git : null;
|
||||
}
|
||||
|
||||
// Whether `dir` is inside a git repository, found without a git process: the
|
||||
// same walk findRoots() does. A set GIT_DIR / GIT_WORK_TREE / GIT_COMMON_DIR
|
||||
// means git decides, so it counts as a repository. A `gitdir:` file (a linked
|
||||
// worktree or a submodule) counts like a `.git` folder.
|
||||
export function insideGitRepo(dir) {
|
||||
if (process.env.GIT_DIR || process.env.GIT_WORK_TREE || process.env.GIT_COMMON_DIR) return true;
|
||||
for (let d = path.resolve(dir); ; ) {
|
||||
if (gitDirAt(d)) return true;
|
||||
const up = path.dirname(d);
|
||||
if (up === d) return false;
|
||||
d = up;
|
||||
}
|
||||
}
|
||||
|
||||
export function projectRoot(cwd = process.cwd()) {
|
||||
return repoRoots(cwd).project;
|
||||
}
|
||||
@@ -857,6 +871,7 @@ function isDir(p) {
|
||||
* Scan <root>/specs into picker entries, most recently touched first.
|
||||
* `touched` is the newest file mtime inside the folder — last write wins,
|
||||
* which is the honest reading of "the one you were working on".
|
||||
* `isGit` says whether `root` sits inside a git repository (no git process).
|
||||
*/
|
||||
export function scanProject(root) {
|
||||
const specsDir = path.join(root, "specs");
|
||||
@@ -888,6 +903,7 @@ export function scanProject(root) {
|
||||
return {
|
||||
at: nowIso(),
|
||||
hasAgents: fs.existsSync(path.join(root, "AGENTS.md")),
|
||||
isGit: insideGitRepo(root),
|
||||
specs,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user