projectops 4.104.6 → 4.104.8
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 +1 -1
- package/bin/projectops.js +4 -4
- package/package.json +1 -1
- package/src/cli/args.js +43 -43
- package/src/cli/errors.js +8 -8
- package/src/cli/help.js +4 -4
- package/src/commands/doctor.js +39 -39
- package/src/commands/full.js +29 -29
- package/src/commands/interactive.js +86 -86
- package/src/commands/issues.js +5 -5
- package/src/commands/skills.js +13 -13
- package/src/commands/version.js +8 -8
- package/src/commands/workflows.js +23 -22
- package/src/context.js +24 -24
- package/src/core/agent-guide.js +5 -5
- package/src/core/assets.js +11 -11
- package/src/core/baseline.js +24 -24
- package/src/core/branch-sub.js +23 -23
- package/src/core/breaking-check.js +21 -21
- package/src/core/breaking.js +6 -6
- package/src/core/ci-minutes-sub.js +13 -13
- package/src/core/constants.js +17 -17
- package/src/core/copy/coderabbit.js +10 -10
- package/src/core/copy/gitignore.js +9 -9
- package/src/core/copy/readme.js +7 -7
- package/src/core/copy/simple.js +35 -35
- package/src/core/copy/util.js +9 -9
- package/src/core/copy/workflows.js +99 -99
- package/src/core/detect-fs.js +21 -21
- package/src/core/detect.js +12 -12
- package/src/core/development-branch.js +11 -11
- package/src/core/exclusions.js +12 -12
- package/src/core/fsutil.js +9 -9
- package/src/core/git-branch.js +11 -11
- package/src/core/ide/adapter.js +23 -23
- package/src/core/ide/adapters/claude.js +12 -12
- package/src/core/ide/adapters/codex.js +4 -4
- package/src/core/ide/adapters/copilot.js +12 -12
- package/src/core/ide/adapters/cursor.js +7 -7
- package/src/core/ide/adapters/gemini.js +5 -5
- package/src/core/ide/adapters/pi-common.js +12 -12
- package/src/core/ide/adapters/pi-harness.js +7 -7
- package/src/core/ide/adapters/pi.js +3 -3
- package/src/core/ide/home-skills.js +6 -6
- package/src/core/ide/legacy.js +8 -8
- package/src/core/ide/registry.js +6 -6
- package/src/core/ide/runner.js +15 -15
- package/src/core/ide/skills-copy.js +34 -34
- package/src/core/ide/stable-entry.js +11 -11
- package/src/core/ide/util.js +4 -4
- package/src/core/incoming.js +13 -13
- package/src/core/label-style.js +12 -12
- package/src/core/migration-guide.js +19 -19
- package/src/core/migrations/index.js +16 -16
- package/src/core/migrations/registry.js +39 -39
- package/src/core/migrations/rules/legacy-dirs.js +6 -6
- package/src/core/migrations/rules/obsolete-workflows.js +4 -4
- package/src/core/migrations/rules/root-files.js +3 -3
- package/src/core/migrations/rules/settings-extractors.js +8 -8
- package/src/core/options-ask.js +104 -104
- package/src/core/options-schema.js +23 -23
- package/src/core/orphan-workflows.js +14 -14
- package/src/core/paths-resolve.js +54 -54
- package/src/core/paths.js +2 -2
- package/src/core/placeholder-triggers.js +10 -10
- package/src/core/repo-language.js +10 -10
- package/src/core/resolve-options.js +30 -30
- package/src/core/run-trace.js +54 -54
- package/src/core/store-locales-hint.js +13 -13
- package/src/core/verify.js +27 -27
- package/src/core/version-yml.js +117 -116
- package/src/core/wizard-env.js +42 -42
- package/src/core/wizard-labels.js +31 -31
- package/src/core/workflow-groups.js +14 -14
- package/src/i18n/core.en.js +1 -1
- package/src/i18n/doctor.en.js +1 -1
- package/src/i18n/ide.en.js +1 -1
- package/src/i18n/migrate.en.js +1 -1
- package/src/i18n/options.en.js +1 -1
- package/src/index.js +60 -60
- package/src/ui/ansi.js +5 -5
- package/src/ui/env-plan.js +44 -44
- package/src/ui/prompts.js +21 -21
- package/src/ui/readline-engine.js +38 -38
- package/src/ui/skills-prompts.js +4 -4
package/src/core/detect.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Classify package.json content — substring matching on the raw file text.
|
|
2
|
+
// Checks raw text rather than parsing dependencies (works even on broken JSON).
|
|
3
|
+
// Input is the raw package.json string. Order matters.
|
|
4
4
|
export function classifyPackageText(raw) {
|
|
5
5
|
const s = String(raw || "");
|
|
6
6
|
if (s.includes("@react-native") || s.includes("react-native")) {
|
|
7
7
|
return s.includes("expo") ? "react-native-expo" : "react-native";
|
|
8
8
|
}
|
|
9
|
-
// next
|
|
9
|
+
// The next type was merged into react in v4.1.0 — a "next" dependency still classifies as react
|
|
10
10
|
if (s.includes('"react"') || s.includes('"next"')) return "react";
|
|
11
11
|
return "node";
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// Convenience: for a parsed object, re-serialize to text and apply the rules above
|
|
15
15
|
export function classifyPackageJson(pkgOrRaw) {
|
|
16
16
|
const raw = typeof pkgOrRaw === "string" ? pkgOrRaw : JSON.stringify(pkgOrRaw || {});
|
|
17
17
|
return classifyPackageText(raw);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
// read(relpath)=>string|null
|
|
20
|
+
// Marker scan (behavior spec §3.1). Injects has(relpath)=>bool. node is not added when another type exists.
|
|
21
|
+
// Receives raw package.json via read(relpath)=>string|null and passes it to classifyPackageText.
|
|
22
22
|
export function detectTypesFromMarkers({ has, read }) {
|
|
23
23
|
const types = [];
|
|
24
24
|
if (has("pubspec.yaml")) types.push("flutter");
|
|
@@ -34,7 +34,7 @@ export function detectTypesFromMarkers({ has, read }) {
|
|
|
34
34
|
|
|
35
35
|
const VERSION_RE = /^\d+\.\d+\.\d+$/;
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// Version detection (behavior spec §3.3) — first success in order. Injects read(relpath)=>string|null.
|
|
38
38
|
export function detectVersionFromFiles({ read, readJson, hasJq, gitTag }) {
|
|
39
39
|
const pkg = readJson?.("package.json");
|
|
40
40
|
if (hasJq && pkg?.version && VERSION_RE.test(pkg.version)) return pkg.version;
|
|
@@ -61,10 +61,10 @@ export function extraMarkers(type) {
|
|
|
61
61
|
return { python: ["setup.py", "requirements.txt"], spring: ["build.gradle.kts", "pom.xml"] }[type] || [];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
64
|
+
// Extension frequency scan recommendation (step 2 when there are no markers, #458).
|
|
65
|
+
// Secondary recommendation used only when there are no markers at all (= basic fallback). files = pruned relative paths.
|
|
66
|
+
// Thresholds: dart≥1→flutter, java+kt+gradle≥3→spring, tsx+jsx≥3→react, py≥3→python,
|
|
67
|
+
// none of those and ts+js≥3→node. Returned in menu definition order.
|
|
68
68
|
export function suggestTypesByExtScan(files) {
|
|
69
69
|
const count = (re) => files.filter((f) => re.test(f)).length;
|
|
70
70
|
const found = new Set();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Non-interactive development (release source) branch creation (#715) — only when --create-development-branch is given.
|
|
2
|
+
// Reuses the interactive ensureDeployBranch as "yes to every question": one code path for existence check, creation and push.
|
|
3
|
+
// Never throws on failure — leaves a manual command instead of failing the whole integration.
|
|
4
4
|
import { ensureDeployBranch } from "./options-ask.js";
|
|
5
5
|
|
|
6
|
-
// ensureDeployBranch state >
|
|
6
|
+
// ensureDeployBranch state > 3 results (created · skipped · failed)
|
|
7
7
|
const STATUS_BY_STATE = {
|
|
8
8
|
"exists-local": "skipped",
|
|
9
9
|
"exists-remote": "skipped",
|
|
@@ -14,7 +14,7 @@ const STATUS_BY_STATE = {
|
|
|
14
14
|
"not-checked": "failed",
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// Manual command per failure reason (push failure: the local branch already exists, so push only)
|
|
18
18
|
function manualCommandFor(state, branch, base) {
|
|
19
19
|
if (state === "push-failed") return `git push -u origin ${branch}`;
|
|
20
20
|
if (state === "create-failed" && base) return `git branch ${branch} ${base} && git push -u origin ${branch}`;
|
|
@@ -22,12 +22,12 @@ function manualCommandFor(state, branch, base) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Check the development branch > create it from the default branch if missing > push to origin
|
|
26
|
+
* Returns { status, reason, branch, base, pushed, manualCommand (on failure only) }
|
|
27
27
|
*/
|
|
28
28
|
export async function createDevelopmentBranchUnattended({ targetRoot = ".", branch = "develop", defaultBranch = "", say = () => {} }) {
|
|
29
29
|
const answerYes = { confirm: async () => true };
|
|
30
|
-
//
|
|
30
|
+
// Unattended run: fail instead of asking for credentials, sending it to the failed path (manual command) (#988)
|
|
31
31
|
const outcome = await ensureDeployBranch({ targetRoot, deployBranch: branch, defaultBranch, io: answerYes, say, isNonInteractive: true });
|
|
32
32
|
const status = STATUS_BY_STATE[outcome.state] ?? "failed";
|
|
33
33
|
return {
|
|
@@ -41,8 +41,8 @@ export async function createDevelopmentBranchUnattended({ targetRoot = ".", bran
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Step wrapper: check the flag > try to create > write the run trace
|
|
45
|
+
* Without the flag, creates nothing and records only why. Returns result | null (no flag)
|
|
46
46
|
*/
|
|
47
47
|
export async function runDevelopmentBranchStep({ isRequested = false, targetRoot, branch, defaultBranch, trace = null, say = () => {} }) {
|
|
48
48
|
const name = branch || "develop";
|
|
@@ -51,7 +51,7 @@ export async function runDevelopmentBranchStep({ isRequested = false, targetRoot
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
const result = await createDevelopmentBranchUnattended({ targetRoot, branch: name, defaultBranch, say });
|
|
54
|
-
// action
|
|
54
|
+
// action is the result — failed shows as ERROR in the log (run-trace levelOf)
|
|
55
55
|
trace?.event("dev-branch", result.status, name, {
|
|
56
56
|
base: defaultBranch || null, reason: result.reason, pushed: result.pushed, manualCommand: result.manualCommand,
|
|
57
57
|
});
|
package/src/core/exclusions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// ⚠️
|
|
3
|
-
// template_initializer.py(
|
|
4
|
-
// (
|
|
1
|
+
// Items removed after downloading the template (copy exclusion list).
|
|
2
|
+
// ⚠️ Sync point of the "adding template-only files" rule (docs/architecture/agent/scripts.md):
|
|
3
|
+
// template_initializer.py (delete) / this file (copy exclusion)
|
|
4
|
+
// (this is the only copy-exclusion point)
|
|
5
5
|
export const DOCS_TO_REMOVE = [
|
|
6
6
|
"CONTRIBUTING.md",
|
|
7
7
|
"SECURITY.md",
|
|
@@ -12,15 +12,15 @@ export const DOCS_TO_REMOVE = [
|
|
|
12
12
|
"GEMINI.md",
|
|
13
13
|
"llms.txt",
|
|
14
14
|
"gemini-extension.json",
|
|
15
|
-
//
|
|
16
|
-
//
|
|
15
|
+
// This repo's own work output, regenerated by the changelog-deploy pipeline on every release.
|
|
16
|
+
// Meaningless for user projects, so it is not copied.
|
|
17
17
|
"pr_body.md",
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
-
// ⚠️ `.github/i18n`(
|
|
21
|
-
//
|
|
22
|
-
// copyIssueTemplates
|
|
23
|
-
// ("Use this template"
|
|
20
|
+
// ⚠️ Do not add `.github/i18n` (Korean template overlay, #769) here. This list deletes entries from the downloaded
|
|
21
|
+
// template folder, but the overlay must be read from that folder for language: ko installs. It does not leak into user repos
|
|
22
|
+
// because copyIssueTemplates copies only ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.
|
|
23
|
+
// (The "Use this template" path is cleaned up by template_initializer.py.)
|
|
24
24
|
export const PLUGIN_ITEMS_TO_REMOVE = [
|
|
25
25
|
".claude-plugin",
|
|
26
26
|
".codex-plugin",
|
|
@@ -30,7 +30,7 @@ export const PLUGIN_ITEMS_TO_REMOVE = [
|
|
|
30
30
|
"package.json",
|
|
31
31
|
"harness",
|
|
32
32
|
"plugins",
|
|
33
|
-
// Claude Code
|
|
33
|
+
// Claude Code plugin hooks (#953) — kept apart from the user repo's hooks/
|
|
34
34
|
"hooks",
|
|
35
35
|
"bin",
|
|
36
36
|
"src",
|
|
@@ -43,4 +43,4 @@ export const PLUGIN_ITEMS_TO_REMOVE = [
|
|
|
43
43
|
".github/workflows/PROJECT-TEMPLATE-ISSUE-ASSIGNMENT.yaml",
|
|
44
44
|
".github/config/community-labels.yml",
|
|
45
45
|
];
|
|
46
|
-
// ⚠️ skills/
|
|
46
|
+
// ⚠️ skills/ is not excluded (kept as the Cursor install source)
|
package/src/core/fsutil.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Shared filesystem utilities (byte copy that keeps LF). Text is copied as is to keep the original line endings.
|
|
2
2
|
import {
|
|
3
3
|
copyFileSync as copyFileBytes, existsSync, lstatSync, readFileSync, readlinkSync, symlinkSync,
|
|
4
4
|
writeFileSync, mkdirSync, readdirSync, rmSync,
|
|
@@ -13,14 +13,14 @@ export function writeText(p, s) {
|
|
|
13
13
|
writeFileSync(p, s);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// Copy a single file (creates parent directories, byte for byte)
|
|
17
17
|
export function copyFileSync(src, dst) {
|
|
18
18
|
mkdirSync(dirname(dst), { recursive: true });
|
|
19
19
|
copyFileBytes(src, dst);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
// Windows
|
|
22
|
+
// Recursive copy of files, folders and symlinks. Avoids the built-in fs recursive copy (cp-sync):
|
|
23
|
+
// on Windows with Node 22+, a non-ASCII (e.g. Korean) path kills the process with no message.
|
|
24
24
|
export function copyPathSync(src, dst, filter) {
|
|
25
25
|
if (filter && !filter(src)) return;
|
|
26
26
|
const stat = lstatSync(src);
|
|
@@ -35,20 +35,20 @@ export function copyPathSync(src, dst, filter) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// Recursive directory copy (contents go under dst)
|
|
39
39
|
export function copyDirSync(src, dst, { filter } = {}) {
|
|
40
40
|
mkdirSync(dst, { recursive: true });
|
|
41
41
|
copyPathSync(src, dst, filter);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//
|
|
44
|
+
// Delete a file/folder (harmless if missing)
|
|
45
45
|
export function remove(p) {
|
|
46
46
|
rmSync(p, { recursive: true, force: true });
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
// (
|
|
49
|
+
// Names of .yaml/.yml files directly under a directory. Subfolders excluded.
|
|
50
|
+
// Sort: group by extension first (.yaml before .yml), alphabetical within each group.
|
|
51
|
+
// (Iteration order sets the key order of the version.yml deploy block — keeps output byte-identical to existing installs)
|
|
52
52
|
export function listYamlFiles(dir) {
|
|
53
53
|
if (!existsSync(dir)) return [];
|
|
54
54
|
const names = readdirSync(dir, { withFileTypes: true })
|
package/src/core/git-branch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Branch existence check and creation helpers (#477) — used by the wizard's offer to create the development branch.
|
|
2
|
+
// Every function quietly returns false/null on failure (so the wizard survives no git, no repo, or no remote).
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
|
|
5
5
|
function git(root, args, env = undefined) {
|
|
@@ -9,9 +9,9 @@ function git(root, args, env = undefined) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ssh
|
|
12
|
+
* Environment for non-interactive remote access (#988): block credential prompts > fail at once > show manual command
|
|
13
|
+
* 4 blocks: terminal prompt, askpass (GIT_/SSH_), Git Credential Manager window, ssh password prompt
|
|
14
|
+
* ssh is forced to BatchMode only when there is no user-set command (GIT_SSH_COMMAND, GIT_SSH, core.sshCommand)
|
|
15
15
|
*/
|
|
16
16
|
export function nonInteractiveGitEnv(baseEnv = process.env, { hasCustomSshCommand = false } = {}) {
|
|
17
17
|
const env = { ...baseEnv, GIT_TERMINAL_PROMPT: "0", GIT_ASKPASS: "", SSH_ASKPASS: "", GCM_INTERACTIVE: "never" };
|
|
@@ -19,14 +19,14 @@ export function nonInteractiveGitEnv(baseEnv = process.env, { hasCustomSshComman
|
|
|
19
19
|
return env;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// Remote command env: interactive inherits (undefined), non-interactive blocks prompts
|
|
23
23
|
function remoteEnv(root, isNonInteractive) {
|
|
24
24
|
if (!isNonInteractive) return undefined;
|
|
25
25
|
const hasCustomSshCommand = Boolean(git(root, ["config", "--get", "core.sshCommand"]));
|
|
26
26
|
return nonInteractiveGitEnv(process.env, { hasCustomSshCommand });
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// Branch existence state. remote is null (unknown) when the origin lookup fails (no remote, network).
|
|
30
30
|
export function branchStatus(root, name, { isNonInteractive = false } = {}) {
|
|
31
31
|
const isRepo = git(root, ["rev-parse", "--git-dir"]) !== null;
|
|
32
32
|
if (!isRepo || !name) return { isRepo, local: false, remote: null };
|
|
@@ -36,8 +36,8 @@ export function branchStatus(root, name, { isNonInteractive = false } = {}) {
|
|
|
36
36
|
return { isRepo, local, remote };
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// fromBranch(
|
|
40
|
-
//
|
|
39
|
+
// Create a local branch from fromBranch (the default branch) — no checkout.
|
|
40
|
+
// If fromBranch is not local, fall back to origin/fromBranch → HEAD in that order.
|
|
41
41
|
export function createBranch(root, name, fromBranch = "") {
|
|
42
42
|
if (fromBranch) {
|
|
43
43
|
if (git(root, ["branch", name, fromBranch]) !== null) return true;
|
|
@@ -46,8 +46,8 @@ export function createBranch(root, name, fromBranch = "") {
|
|
|
46
46
|
return git(root, ["branch", name]) !== null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//
|
|
50
|
-
//
|
|
49
|
+
// Push a branch to the remote (origin) with -u. false on credential/network failure.
|
|
50
|
+
// Non-interactive fails right away without asking for credentials (#988 — asking stalls an unattended run)
|
|
51
51
|
export function pushBranch(root, name, { isNonInteractive = false } = {}) {
|
|
52
52
|
return git(root, ["push", "-u", "origin", name], remoteEnv(root, isNonInteractive)) !== null;
|
|
53
53
|
}
|
package/src/core/ide/adapter.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// IDE
|
|
1
|
+
// Shared IDE adapter contract (the core of the extension point).
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// src/core/ide/adapters/<name>.js
|
|
5
|
-
//
|
|
3
|
+
// To support a new IDE (editor/agent CLI), create one object satisfying this shape
|
|
4
|
+
// in src/core/ide/adapters/<name>.js and add it to the registry.js array — that is all.
|
|
5
|
+
// The orchestrator (commands/skills.js) knows only adapter fields, nothing about individual IDE logic.
|
|
6
6
|
//
|
|
7
7
|
// @typedef {Object} IdeStatus
|
|
8
|
-
// installed: boolean
|
|
9
|
-
// version: string|null
|
|
10
|
-
// cliMissing: boolean
|
|
11
|
-
// note: string
|
|
8
|
+
// installed: boolean whether it is installed
|
|
9
|
+
// version: string|null installed version (if known)
|
|
10
|
+
// cliMissing: boolean whether install is impossible because the dedicated CLI is missing (notice only)
|
|
11
|
+
// note: string short note appended to the status line (optional)
|
|
12
12
|
//
|
|
13
13
|
// @typedef {Object} IdeAdapter
|
|
14
|
-
// id: string
|
|
15
|
-
// label: string
|
|
16
|
-
// order: number
|
|
17
|
-
// detect(io): IdeStatus
|
|
18
|
-
// apply(io, ctx): boolean
|
|
19
|
-
// remove(io, ctx): boolean
|
|
20
|
-
// manualHint(io): string
|
|
14
|
+
// id: string internal unique key (e.g. "claude"). Used for routing and preselect
|
|
15
|
+
// label: string name shown to people (e.g. "Claude Code")
|
|
16
|
+
// order: number status/menu display order (smaller first)
|
|
17
|
+
// detect(io): IdeStatus current install status
|
|
18
|
+
// apply(io, ctx): boolean install or update (idempotent). true on success
|
|
19
|
+
// remove(io, ctx): boolean remove (no-op if not installed, true)
|
|
20
|
+
// manualHint(io): string manual install command shown when the CLI is missing (optional)
|
|
21
21
|
//
|
|
22
|
-
// io = runner.defaultIo()
|
|
23
|
-
// ctx = { templateVersion, sourceSkillsDir } —
|
|
22
|
+
// io = runner.defaultIo() or a test stub: { which, run, home, log, projectopsHome? (default home/.projectops) }
|
|
23
|
+
// ctx = { templateVersion, sourceSkillsDir } — shared context such as version display and the Cursor copy source
|
|
24
24
|
//
|
|
25
|
-
//
|
|
26
|
-
// - apply/remove/detect
|
|
27
|
-
// - CLI
|
|
28
|
-
// -
|
|
25
|
+
// Rules:
|
|
26
|
+
// - apply/remove/detect never throw (absorbed internally). Failure is expressed as log + false.
|
|
27
|
+
// - A missing CLI is not an error but a cliMissing state + manualHint notice.
|
|
28
|
+
// - Adapters interact with the outside only through io (no direct spawnSync/console) — for testability.
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// Helper that checks during development that adapters keep the minimum contract (runtime guard).
|
|
31
31
|
export function assertAdapter(a) {
|
|
32
32
|
for (const k of ["id", "label", "detect", "apply", "remove"]) {
|
|
33
|
-
if (a[k] == null) throw new Error(`IDE
|
|
33
|
+
if (a[k] == null) throw new Error(`IDE adapter '${a?.id || "?"}' is missing required field '${k}'`);
|
|
34
34
|
}
|
|
35
35
|
return a;
|
|
36
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Claude Code
|
|
2
|
-
//
|
|
1
|
+
// Claude Code adapter (plugin install/remove, plugin data cleanup).
|
|
2
|
+
// Marketplace Cassiiopeia/projectops, plugin projectops@projectops-marketplace.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, readdirSync, mkdirSync, copyFileSync, rmSync } from "node:fs";
|
|
5
5
|
import { compareCacheName } from "../util.js";
|
|
@@ -23,25 +23,25 @@ function detect(io) {
|
|
|
23
23
|
const name = String(p.name || p.id || "");
|
|
24
24
|
if (name.includes("projectops@") || name === "projectops") { scope = p.scope || ""; version = p.version || null; break; }
|
|
25
25
|
}
|
|
26
|
-
} catch { /*
|
|
26
|
+
} catch { /* Parse failure → treat as not installed */ }
|
|
27
27
|
return { installed: !!scope, version, cliMissing: false, scope };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function apply(io, ctx = {}) {
|
|
31
31
|
const st = detect(io);
|
|
32
32
|
if (st.cliMissing) { io.log(manualHint(io)); return false; }
|
|
33
|
-
migrateLegacy(io); //
|
|
34
|
-
migrateConfigRoot(io); //
|
|
35
|
-
const st2 = detect(io); //
|
|
33
|
+
migrateLegacy(io); // Clean up the old cassiiopeia plugin/marketplace
|
|
34
|
+
migrateConfigRoot(io); // Migrate the shared config root
|
|
35
|
+
const st2 = detect(io); // Re-detect after cleanup
|
|
36
36
|
if (st2.installed) return update(io, st2.scope);
|
|
37
37
|
return install(io, "user");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//
|
|
40
|
+
// Clean up the old-name (cassiiopeia) plugin and marketplace. Quietly, log only. Failure is harmless (no-op if missing).
|
|
41
41
|
function migrateLegacy(io) {
|
|
42
42
|
const r = io.run("claude", ["plugin", "list", "--json"]);
|
|
43
43
|
let list = [];
|
|
44
|
-
try { const arr = JSON.parse(r.stdout || "[]"); list = Array.isArray(arr) ? arr : (arr.plugins || []); } catch { /*
|
|
44
|
+
try { const arr = JSON.parse(r.stdout || "[]"); list = Array.isArray(arr) ? arr : (arr.plugins || []); } catch { /* ignore */ }
|
|
45
45
|
for (const legacy of LEGACY_PLUGINS) {
|
|
46
46
|
const hit = list.find((p) => {
|
|
47
47
|
const name = String(p.name || p.id || "");
|
|
@@ -54,7 +54,7 @@ function migrateLegacy(io) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
for (const mp of LEGACY_MARKETPLACES) {
|
|
57
|
-
io.run("claude", ["plugin", "marketplace", "remove", mp]); //
|
|
57
|
+
io.run("claude", ["plugin", "marketplace", "remove", mp]); // No-op if missing
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -94,7 +94,7 @@ function manualHint() {
|
|
|
94
94
|
return t("ide.claude.manual", { market: MARKETPLACE, plugin: PLUGIN });
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// ──
|
|
97
|
+
// ── Internal helpers ──
|
|
98
98
|
function latestCacheDir(root) {
|
|
99
99
|
if (!existsSync(root)) return "";
|
|
100
100
|
const dirs = readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort(compareCacheName);
|
|
@@ -109,11 +109,11 @@ function migrateConfig(io, oldCache, newCache) {
|
|
|
109
109
|
let copied = 0;
|
|
110
110
|
for (const f of readdirSync(oldCfg)) if (f.endsWith(".json")) { copyFileSync(join(oldCfg, f), join(newCfg, f)); copied++; }
|
|
111
111
|
if (copied) io.log(t("ide.claude.configMigrated"));
|
|
112
|
-
} catch { /*
|
|
112
|
+
} catch { /* harmless */ }
|
|
113
113
|
}
|
|
114
114
|
function removePluginData(io) {
|
|
115
115
|
const dataDir = join(io.home(), ".claude/plugins/data", PLUGIN);
|
|
116
|
-
if (existsSync(dataDir)) { try { rmSync(dataDir, { recursive: true, force: true }); io.log(t("ide.claude.dataRemoved")); } catch { /*
|
|
116
|
+
if (existsSync(dataDir)) { try { rmSync(dataDir, { recursive: true, force: true }); io.log(t("ide.claude.dataRemoved")); } catch { /* harmless */ } }
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export const claudeAdapter = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Codex CLI
|
|
2
|
-
//
|
|
1
|
+
// Codex CLI adapter (skills management, marketplace registration/removal).
|
|
2
|
+
// Marketplace add/upgrade is the main path. The native ~/.agents/skills/projectops symlink is used for detection and removal.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, lstatSync, rmSync } from "node:fs";
|
|
5
5
|
import { migrateConfigRoot } from "../legacy.js";
|
|
@@ -47,12 +47,12 @@ function remove(io) {
|
|
|
47
47
|
|
|
48
48
|
function manualHint() { return ` 💡 Codex CLI: codex plugin marketplace add ${MARKETPLACE}`; }
|
|
49
49
|
|
|
50
|
-
//
|
|
50
|
+
// Clean up the old native skills folder/symlink + old marketplace. Failure is harmless.
|
|
51
51
|
function migrateLegacy(io) {
|
|
52
52
|
for (const name of LEGACY_NATIVES) {
|
|
53
53
|
const old = join(io.home(), ".agents/skills", name);
|
|
54
54
|
if (existsSync(old) || isSymlink(old)) {
|
|
55
|
-
try { rmSync(old, { recursive: true, force: true }); io.log(t("ide.codex.legacy", { name })); } catch { /*
|
|
55
|
+
try { rmSync(old, { recursive: true, force: true }); io.log(t("ide.codex.legacy", { name })); } catch { /* ignore */ }
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (io.which("codex")) for (const mp of LEGACY_MARKETPLACES) io.run("codex", ["plugin", "marketplace", "remove", mp]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// GitHub Copilot
|
|
2
|
-
//
|
|
3
|
-
// (JetBrains 1.18
|
|
4
|
-
// ~/.copilot/intellij-skills
|
|
5
|
-
//
|
|
1
|
+
// GitHub Copilot adapter (copy agent skills, record meta, remove).
|
|
2
|
+
// The personal skill folder ~/.copilot/skills/<name>/SKILL.md is read by default by VS Code, Copilot CLI and the JetBrains plugin
|
|
3
|
+
// (JetBrains 1.18 default locations: .agents/.github/.claude skills + ~/.agents, ~/.copilot, ~/.claude skills)
|
|
4
|
+
// ~/.copilot/intellij-skills is not used — it is a managed folder where the JetBrains plugin overwrites built-in skills.
|
|
5
|
+
// A skill loads only when its name (frontmatter name) matches the folder name — pro-* folders already follow that rule.
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { existsSync, readdirSync } from "node:fs";
|
|
8
8
|
import { migrateConfigRoot } from "../legacy.js";
|
|
@@ -12,14 +12,14 @@ import { applyHomeSkills, removeHomeSkills } from "../home-skills.js";
|
|
|
12
12
|
|
|
13
13
|
const META_FILE_NAME = "copilot-skills-meta.json";
|
|
14
14
|
const MESSAGE_PREFIX = "ide.copilot";
|
|
15
|
-
//
|
|
15
|
+
// 4 signs of Copilot use: copilot CLI, ~/.copilot folder (made by the CLI and JetBrains), VS Code extension, JetBrains plugin
|
|
16
16
|
const COPILOT_CLI_NAME = "copilot";
|
|
17
17
|
const COPILOT_HOME_DIR = ".copilot";
|
|
18
18
|
const VSCODE_EXTENSION_DIRS = [".vscode/extensions", ".vscode-insiders/extensions"];
|
|
19
|
-
// VS Code
|
|
19
|
+
// VS Code extension folder names: github.copilot-1.2.3 · github.copilot-chat-0.30.0
|
|
20
20
|
const VSCODE_EXTENSION_PREFIX = "github.copilot";
|
|
21
|
-
// IDE
|
|
22
|
-
// Linux
|
|
21
|
+
// IDE settings roots (macOS · Windows · Linux) > <product><version>/plugins/github-copilot-intellij
|
|
22
|
+
// On Linux the plugin sits directly under <product><version>/. Android Studio uses the same plugin.
|
|
23
23
|
const JETBRAINS_CONFIG_ROOTS = [
|
|
24
24
|
"Library/Application Support/JetBrains", "AppData/Roaming/JetBrains", ".local/share/JetBrains",
|
|
25
25
|
"Library/Application Support/Google", "AppData/Roaming/Google", ".local/share/Google",
|
|
@@ -30,7 +30,7 @@ function skillsDir(io) { return join(io.home(), COPILOT_HOME_DIR, "skills"); }
|
|
|
30
30
|
function metaPath(io) { return join(skillsDir(io), META_FILE_NAME); }
|
|
31
31
|
function homeSkillsOptions(io) { return { skillsDest: skillsDir(io), metaFileName: META_FILE_NAME, messagePrefix: MESSAGE_PREFIX }; }
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// Only an install candidate when there are signs of use, so ~/.copilot is not created in the home of non-users
|
|
34
34
|
function isCopilotDetected(io) {
|
|
35
35
|
if (io.which(COPILOT_CLI_NAME)) return true;
|
|
36
36
|
if (existsSync(join(io.home(), COPILOT_HOME_DIR))) return true;
|
|
@@ -65,11 +65,11 @@ function detect(io) {
|
|
|
65
65
|
|
|
66
66
|
function apply(io, ctx = {}) {
|
|
67
67
|
if (detect(io).cliMissing) { io.log(manualHint()); return false; }
|
|
68
|
-
migrateConfigRoot(io); //
|
|
68
|
+
migrateConfigRoot(io); // Migrate the shared config root
|
|
69
69
|
return applyHomeSkills(io, ctx, homeSkillsOptions(io));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// Keep the folder if skills the user added remain
|
|
73
73
|
function remove(io, ctx = {}) {
|
|
74
74
|
return removeHomeSkills(io, ctx, homeSkillsOptions(io));
|
|
75
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Cursor
|
|
2
|
-
//
|
|
1
|
+
// Cursor adapter (copy skills, record meta, remove).
|
|
2
|
+
// No marketplace → copy the skills/ folder to ~/.cursor/skills/ and the shared Python to ~/.cursor/scripts/, tracking the version in meta.json.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
5
5
|
import { migrateConfigRoot, isLegacyVersion } from "../legacy.js";
|
|
@@ -22,17 +22,17 @@ function detect(io) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function apply(io, ctx = {}) {
|
|
25
|
-
migrateLegacy(io, ctx); //
|
|
26
|
-
migrateConfigRoot(io); //
|
|
25
|
+
migrateLegacy(io, ctx); // On an old name/version, selectively delete projectops-owned entries
|
|
26
|
+
migrateConfigRoot(io); // Migrate the shared config root
|
|
27
27
|
return applyHomeSkills(io, ctx, homeSkillsOptions(io));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// Keep the folder if other skills (somansa-tools, etc.) remain
|
|
31
31
|
function remove(io, ctx = {}) {
|
|
32
32
|
return removeHomeSkills(io, ctx, homeSkillsOptions(io));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// If meta has an old name/version, selectively delete only projectops-owned entries → apply reinstalls fresh.
|
|
36
36
|
function migrateLegacy(io, ctx) {
|
|
37
37
|
const mp = metaPath(io);
|
|
38
38
|
if (!existsSync(mp)) return;
|
|
@@ -42,7 +42,7 @@ function migrateLegacy(io, ctx) {
|
|
|
42
42
|
const oldVer = isLegacyVersion(meta.version, LEGACY_MAX_VERSION);
|
|
43
43
|
if (!(oldName || oldVer)) return;
|
|
44
44
|
for (const name of ownedEntries(skillsDir(io), ctx, META_FILE_NAME)) {
|
|
45
|
-
try { rmSync(join(skillsDir(io), name), { recursive: true, force: true }); } catch { /*
|
|
45
|
+
try { rmSync(join(skillsDir(io), name), { recursive: true, force: true }); } catch { /* ignore */ }
|
|
46
46
|
}
|
|
47
47
|
io.log(t("ide.cursor.legacy", { name: meta.name, version: meta.version }));
|
|
48
48
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Gemini CLI
|
|
2
|
-
// extension install/update/uninstall.
|
|
1
|
+
// Gemini CLI adapter (extension install/remove).
|
|
2
|
+
// extension install/update/uninstall. A git URL extension instead of a marketplace.
|
|
3
3
|
import { migrateConfigRoot } from "../legacy.js";
|
|
4
4
|
import { t } from "../../../i18n/index.js";
|
|
5
5
|
import { TEMPLATE_REPO_WEB_URL } from "../../paths.js";
|
|
@@ -10,7 +10,7 @@ const LEGACY_EXTS = ["SUH-DEVOPS-TEMPLATE"];
|
|
|
10
10
|
|
|
11
11
|
function detect(io) {
|
|
12
12
|
if (!io.which("gemini")) return { installed: false, version: null, cliMissing: true, note: t("ide.cliMissing") };
|
|
13
|
-
// gemini
|
|
13
|
+
// gemini install status is not queried precisely, only shown as "installable" → installed unknown.
|
|
14
14
|
return { installed: false, version: null, cliMissing: false, note: t("ide.installable") };
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -30,12 +30,12 @@ function remove(io) {
|
|
|
30
30
|
if (!io.which("gemini")) { io.log(t("ide.gemini.notFound")); return true; }
|
|
31
31
|
if (io.run("gemini", ["extensions", "uninstall", EXT]).code === 0) { io.log(t("ide.gemini.removed")); return true; }
|
|
32
32
|
io.log(t("ide.gemini.removeFailed", { ext: EXT }));
|
|
33
|
-
return true; //
|
|
33
|
+
return true; // Removing something not installed is not a failure
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function manualHint() { return ` 💡 Gemini CLI: gemini extensions install ${URL}`; }
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// Clean up the old-name extension. Ignore failure if missing.
|
|
39
39
|
function migrateLegacy(io) {
|
|
40
40
|
for (const e of LEGACY_EXTS) io.run("gemini", ["extensions", "uninstall", e]);
|
|
41
41
|
}
|