@polymorphism-tech/morph-spec 10.12.1 → 11.0.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/CLAUDE.md +27 -57
- package/README.md +51 -340
- package/bin/morph-spec.js +22 -373
- package/docs/CHEATSHEET.md +37 -166
- package/docs/QUICKSTART.md +14 -74
- package/framework/CLAUDE.md +15 -26
- package/framework/MORPH.md +34 -101
- package/framework/agents.json +8 -8
- package/framework/commands/morph-apply.md +5 -5
- package/framework/commands/morph-infra.md +1 -1
- package/framework/docs/CLI.md +74 -886
- package/framework/evals/review-checklist.md +14 -14
- package/framework/hooks/README.md +21 -189
- package/framework/hooks/claude-code/core/README.md +2 -5
- package/framework/hooks/claude-code/core/conventional-commit.js +2 -2
- package/framework/hooks/claude-code/core/denylist.json +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +2 -2
- package/framework/hooks/claude-code/core/masked-exit.js +6 -6
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +17 -61
- package/framework/hooks/claude-code/core/stack-changed.js +35 -0
- package/framework/hooks/claude-code/core/validate-completion.js +32 -87
- package/framework/hooks/shared/{heavy-command.js → command-kind.js} +6 -79
- package/framework/hooks/shared/command-tokens.js +0 -139
- package/framework/hooks/shared/contract.js +14 -0
- package/framework/hooks/shared/feature-slug.js +21 -0
- package/framework/hooks/shared/frontend-locations.js +0 -1
- package/framework/hooks/shared/git-paths.js +0 -15
- package/framework/hooks/shared/graph-freshness.js +0 -19
- package/framework/hooks/shared/hook-response.js +0 -7
- package/framework/hooks/shared/morph-cli.js +2 -81
- package/framework/hooks/shared/owner-words.js +2 -120
- package/framework/hooks/shared/payload-utils.js +0 -39
- package/framework/hooks/shared/report-progress.js +7 -101
- package/framework/hooks/statusline.js +16 -60
- package/framework/mcp/registry.json +2 -2
- package/framework/rules/ai-agents-standards.md +1 -1
- package/framework/rules/asaas-standards.md +1 -1
- package/framework/rules/ef-standards.md +1 -1
- package/framework/rules/gsap-standards.md +1 -1
- package/framework/rules/hangfire-standards.md +1 -1
- package/framework/rules/implement-report.md +3 -3
- package/framework/rules/neon-auth-standards.md +1 -1
- package/framework/rules/nextjs-standards.md +1 -1
- package/framework/rules/plan-grammar.md +13 -11
- package/framework/rules/resend-standards.md +1 -1
- package/framework/rules/ui-design.md +4 -0
- package/framework/schemas/config.schema.json +95 -310
- package/framework/skills/README.md +12 -32
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +21 -46
- package/framework/skills/core/morph-plan/SKILL.md +28 -63
- package/framework/skills/core/morph-uiux/SKILL.md +23 -25
- package/framework/{templates/docs/ui-mockups.md → skills/core/morph-uiux/references/mockups.md} +4 -4
- package/framework/standards/STANDARDS.json +10 -11
- package/framework/standards/STANDARDS.meta.json +1 -1
- package/framework/standards/ai-agents/evals-with-cache.md +18 -32
- package/framework/standards/ai-agents/observability-patterns.md +2 -2
- package/framework/standards/architecture/code-comments.md +2 -5
- package/framework/standards/architecture/engineering-lens.md +1 -1
- package/framework/standards/backend/dotnet/testing.md +4 -4
- package/framework/standards/frontend/nextjs/lint.md +24 -10
- package/framework/standards/frontend/nextjs/testing.md +2 -2
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +14 -30
- package/framework/templates/CLAUDE.md.core.guide.md +2 -2
- package/framework/templates/README.md +1 -1
- package/framework/templates/REGISTRY.json +3 -33
- package/framework/templates/docs/plan.md +3 -2
- package/framework/templates/dotnet/ai-kit/README.md +2 -4
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +1 -1
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +1 -1
- package/package.json +1 -2
- package/src/commands/graph/explain.js +2 -1
- package/src/commands/graph/status.js +2 -1
- package/src/commands/mcp/mcp-setup.js +1 -2
- package/src/commands/project/doctor.js +5 -341
- package/src/commands/project/env.js +21 -52
- package/src/commands/project/init-contract.js +47 -0
- package/src/commands/project/init.js +36 -66
- package/src/commands/project/stack-scan.js +1 -1
- package/src/commands/project/update.js +15 -50
- package/src/commands/validation/check.js +128 -0
- package/src/commands/validation/plan-check.js +41 -64
- package/src/commands/validation/prove-red.js +1 -1
- package/src/core/paths/output-schema.js +0 -22
- package/src/core/templates/template-renderer.js +0 -14
- package/src/lib/ai/ai-project-scan.js +1 -6
- package/src/lib/check/attempts.js +38 -0
- package/src/lib/check/signals.js +145 -0
- package/src/lib/config/project-config.js +13 -0
- package/src/lib/contract/apply.js +62 -0
- package/src/lib/contract/defaults.js +96 -0
- package/src/lib/contract/merge.js +79 -0
- package/src/lib/contract/ports.js +43 -0
- package/src/lib/contract/scan.js +102 -0
- package/src/lib/detectors/claude-config-detector.js +7 -0
- package/src/lib/{procs → detectors}/mcp-config.js +1 -37
- package/src/lib/diff/diff-lines.js +64 -0
- package/src/lib/generators/architecture-scanner.js +1 -1
- package/src/lib/generators/scaffold-generator.js +0 -7
- package/src/lib/git/default-branch.js +0 -122
- package/src/lib/graph/diff-tree.js +2 -1
- package/src/lib/graph/god-nodes.js +2 -1
- package/src/lib/graph/graphify-runtime.js +0 -1
- package/src/lib/graph/graphifyignore.js +1 -1
- package/src/lib/graph/sanitize.js +2 -8
- package/src/lib/installers/memory-installer.js +15 -30
- package/src/lib/installers/stack-sync.js +16 -9
- package/src/lib/plan/checks.js +20 -64
- package/src/lib/plan/media.js +1 -1
- package/src/lib/plan/plan-parser.js +5 -5
- package/src/lib/review-reports.js +3 -77
- package/src/lib/scan/worktree-dirs.js +3 -0
- package/src/lib/specs/adr-index.js +2 -2
- package/src/lib/stack/dotnet-build-ignores.js +10 -2
- package/src/lib/stack/stack-scan.js +2 -2
- package/src/lib/stack-filter.js +3 -2
- package/src/lib/tests-audit/audit.js +1 -1
- package/src/scripts/setup-infra.js +6 -59
- package/src/utils/agents-installer.js +1 -34
- package/src/utils/atomic-json.js +27 -0
- package/src/utils/file-copier.js +4 -12
- package/src/utils/hooks-installer.js +9 -107
- package/claude-plugin.json +0 -14
- package/framework/commands/morph-archive.md +0 -46
- package/framework/commands/morph-hotfix.md +0 -17
- package/framework/commands/morph-preflight.md +0 -180
- package/framework/commands/morph-review.md +0 -15
- package/framework/commands/morph-status.md +0 -37
- package/framework/hooks/claude-code/core/block-destructive-worktree-removal.js +0 -80
- package/framework/hooks/claude-code/core/block-raw-worktree-add.js +0 -72
- package/framework/hooks/claude-code/core/enforce-phase-writes.js +0 -100
- package/framework/hooks/claude-code/core/gate-guard.js +0 -148
- package/framework/hooks/claude-code/core/heavy-gate.js +0 -78
- package/framework/hooks/claude-code/core/heavy-release.js +0 -23
- package/framework/hooks/claude-code/core/loop-detect.js +0 -79
- package/framework/hooks/claude-code/core/state-sync.js +0 -214
- package/framework/hooks/claude-code/core/telemetry-log.js +0 -259
- package/framework/hooks/claude-code/core/test-budget.js +0 -29
- package/framework/hooks/claude-code/core/worktree-context.js +0 -249
- package/framework/hooks/claude-code/core/worktree-create.js +0 -119
- package/framework/hooks/claude-code/core/worktree-env-inject.js +0 -68
- package/framework/hooks/claude-code/core/worktree-remove.js +0 -55
- package/framework/hooks/shared/build-check.js +0 -120
- package/framework/hooks/shared/claim-registry.js +0 -125
- package/framework/hooks/shared/e2e-check.js +0 -1022
- package/framework/hooks/shared/feature-locator.js +0 -82
- package/framework/hooks/shared/gate-event.js +0 -18
- package/framework/hooks/shared/gate-question.js +0 -20
- package/framework/hooks/shared/heavy-config.js +0 -113
- package/framework/hooks/shared/heavy-holders.js +0 -85
- package/framework/hooks/shared/heavy-slots.js +0 -280
- package/framework/hooks/shared/host-services.js +0 -440
- package/framework/hooks/shared/next-step.js +0 -181
- package/framework/hooks/shared/redact-secrets.js +0 -44
- package/framework/hooks/shared/reparse-scan.js +0 -40
- package/framework/hooks/shared/state-reader.js +0 -220
- package/framework/hooks/shared/state-writer.js +0 -112
- package/framework/hooks/shared/telemetry-logger.js +0 -101
- package/framework/hooks/shared/transcript-usage.js +0 -58
- package/framework/hooks/shared/worktree-root.js +0 -71
- package/framework/phases.json +0 -92
- package/framework/schemas/feature.schema.json +0 -242
- package/framework/skills/core/morph-apply/references/hotfix.md +0 -46
- package/framework/skills/core/morph-apply/references/machine.md +0 -30
- package/framework/skills/core/morph-apply/references/review.md +0 -77
- package/framework/skills/core/morph-plan/references/critique.md +0 -51
- package/framework/skills/core/morph-plan/references/interview.md +0 -37
- package/framework/templates/state.template.json +0 -17
- package/src/commands/dashboard/dashboard.js +0 -74
- package/src/commands/e2e/e2e.js +0 -400
- package/src/commands/observability/cost.js +0 -283
- package/src/commands/project/branch.js +0 -129
- package/src/commands/project/claim.js +0 -132
- package/src/commands/project/doctor-procs.js +0 -162
- package/src/commands/project/fleet.js +0 -66
- package/src/commands/project/heavy.js +0 -81
- package/src/commands/project/install-plugin-cmd.js +0 -27
- package/src/commands/project/status.js +0 -61
- package/src/commands/project/worktree.js +0 -1234
- package/src/commands/state/advance.js +0 -248
- package/src/commands/state/approve.js +0 -303
- package/src/commands/state/archive.js +0 -231
- package/src/commands/state/auto-approval.js +0 -67
- package/src/commands/state/create.js +0 -274
- package/src/commands/state/delete.js +0 -192
- package/src/commands/state/finish.js +0 -1247
- package/src/commands/state/gate-check.js +0 -244
- package/src/commands/state/gate-decision.js +0 -122
- package/src/commands/state/list.js +0 -244
- package/src/commands/state/next.js +0 -24
- package/src/commands/state/recap.js +0 -80
- package/src/commands/state/report-check.js +0 -244
- package/src/commands/state/retype.js +0 -110
- package/src/commands/validation/verify.js +0 -421
- package/src/core/state/feature-identity.js +0 -10
- package/src/core/state/gate-order.js +0 -23
- package/src/core/state/lifecycle-audit.js +0 -171
- package/src/core/state/state-manager.js +0 -523
- package/src/core/templates/template-seed.js +0 -21
- package/src/core/work-types.js +0 -44
- package/src/dashboard/app/App.jsx +0 -84
- package/src/dashboard/app/components/ActivityFeed.jsx +0 -166
- package/src/dashboard/app/components/CommandPalette.jsx +0 -144
- package/src/dashboard/app/components/DetailPanel.jsx +0 -43
- package/src/dashboard/app/components/EntityLink.jsx +0 -42
- package/src/dashboard/app/components/ErrorBoundary.jsx +0 -47
- package/src/dashboard/app/components/FlowGraph.jsx +0 -19
- package/src/dashboard/app/components/GatePauses.jsx +0 -116
- package/src/dashboard/app/components/KnowledgeMarkdown.jsx +0 -42
- package/src/dashboard/app/components/Markdown.jsx +0 -38
- package/src/dashboard/app/components/PhaseRail.jsx +0 -100
- package/src/dashboard/app/components/SearchFilter.jsx +0 -36
- package/src/dashboard/app/components/SessionMap.jsx +0 -77
- package/src/dashboard/app/components/Sidebar.jsx +0 -147
- package/src/dashboard/app/hooks/useMorphQuery.js +0 -44
- package/src/dashboard/app/hooks/usePref.js +0 -34
- package/src/dashboard/app/lib/format.js +0 -69
- package/src/dashboard/app/lib/phases.js +0 -75
- package/src/dashboard/app/lib/project.js +0 -38
- package/src/dashboard/app/main.jsx +0 -13
- package/src/dashboard/app/pages/Activity.jsx +0 -28
- package/src/dashboard/app/pages/AgentMap.jsx +0 -363
- package/src/dashboard/app/pages/FeatureDetail.jsx +0 -579
- package/src/dashboard/app/pages/Features.jsx +0 -393
- package/src/dashboard/app/pages/Guide.jsx +0 -145
- package/src/dashboard/app/pages/HookInspector.jsx +0 -444
- package/src/dashboard/app/pages/PhasePipeline.jsx +0 -273
- package/src/dashboard/app/pages/Portfolio.jsx +0 -190
- package/src/dashboard/app/pages/RulesMap.jsx +0 -285
- package/src/dashboard/app/pages/SkillsLibrary.jsx +0 -468
- package/src/dashboard/app/pages/Standards.jsx +0 -392
- package/src/dashboard/app/styles/index.css +0 -187
- package/src/dashboard/index.html +0 -14
- package/src/dashboard/package.json +0 -32
- package/src/dashboard/scanner/activity-scanner.js +0 -321
- package/src/dashboard/scanner/agents-scanner.js +0 -67
- package/src/dashboard/scanner/docs-scanner.js +0 -34
- package/src/dashboard/scanner/feature-status.js +0 -7
- package/src/dashboard/scanner/features-scanner.js +0 -397
- package/src/dashboard/scanner/hooks-scanner.js +0 -96
- package/src/dashboard/scanner/index.js +0 -21
- package/src/dashboard/scanner/phases-scanner.js +0 -14
- package/src/dashboard/scanner/portfolio.js +0 -129
- package/src/dashboard/scanner/project-api.js +0 -160
- package/src/dashboard/scanner/rules-scanner.js +0 -46
- package/src/dashboard/scanner/skills-scanner.js +0 -104
- package/src/dashboard/scanner/standards-scanner.js +0 -38
- package/src/dashboard/vite-plugin-morph-data.js +0 -120
- package/src/dashboard/vite.config.js +0 -26
- package/src/lib/ci/ci-verify.js +0 -30
- package/src/lib/ci/github-ci.js +0 -52
- package/src/lib/ci/pr-checks.js +0 -76
- package/src/lib/e2e/applicability.js +0 -39
- package/src/lib/e2e/compose-env.js +0 -80
- package/src/lib/e2e/stack-teardown.js +0 -96
- package/src/lib/git/branch-classifier.js +0 -104
- package/src/lib/git/evidence-staleness.js +0 -40
- package/src/lib/git/gh.js +0 -15
- package/src/lib/git/pending-prs.js +0 -58
- package/src/lib/git/pr-files.js +0 -31
- package/src/lib/git/pr-index.js +0 -39
- package/src/lib/git/tree-fingerprint.js +0 -58
- package/src/lib/git/tree-state.js +0 -125
- package/src/lib/heavy/cleanup.js +0 -72
- package/src/lib/heavy/gate.js +0 -168
- package/src/lib/heavy/live-stacks.js +0 -64
- package/src/lib/heavy/reclaim.js +0 -107
- package/src/lib/heavy/watchdog.js +0 -46
- package/src/lib/next-step.js +0 -12
- package/src/lib/plan/critique.js +0 -67
- package/src/lib/plan/plan-template.js +0 -18
- package/src/lib/procs/classify.js +0 -91
- package/src/lib/procs/list.js +0 -124
- package/src/lib/procs/prune.js +0 -47
- package/src/lib/procs/wslconfig.js +0 -70
- package/src/lib/projects/registry.js +0 -121
- package/src/lib/recap/piper.js +0 -36
- package/src/lib/recap/recap.js +0 -259
- package/src/lib/review-confirmation.js +0 -66
- package/src/lib/risk/diff-risk.js +0 -137
- package/src/lib/risk-detector.js +0 -638
- package/src/lib/specs/design-seed.js +0 -18
- package/src/lib/specs/screen-checklist.js +0 -315
- package/src/lib/stack/stack-profile.js +0 -69
- package/src/lib/tasks/eval-node.js +0 -293
- package/src/lib/tasks/linux-runner.js +0 -200
- package/src/lib/tasks/test-nodes.js +0 -414
- package/src/lib/tasks/test-runner.js +0 -569
- package/src/lib/telemetry/metrics.js +0 -384
- package/src/lib/telemetry/telemetry-reader.js +0 -276
- package/src/lib/telemetry/verify-event.js +0 -57
- package/src/lib/validators/code-budget/code-budget-validator.js +0 -170
- package/src/lib/validators/contracts/contract-compliance-validator.js +0 -219
- package/src/lib/validators/nextjs/next-component-validator.js +0 -142
- package/src/lib/validators/packages/package-validator.js +0 -310
- package/src/lib/validators/reuse/reuse-validator.js +0 -202
- package/src/lib/validators/reuse/symbol-scanner.js +0 -64
- package/src/lib/validators/validation-runner.js +0 -188
- package/src/lib/validators/verify-cache.js +0 -63
- package/src/lib/validators/verify-runner.js +0 -971
- package/src/lib/verify/affected.js +0 -143
- package/src/lib/verify/detached.js +0 -159
- package/src/lib/view/feature-html.js +0 -480
- package/src/lib/view/feature-page.client.js +0 -109
- package/src/lib/view/feature-page.css +0 -278
- package/src/lib/view/feature-view.js +0 -113
- package/src/lib/view/flow-layers.js +0 -79
- package/src/lib/view/flow-svg.js +0 -63
- package/src/lib/view/tokens.css +0 -18
- package/src/lib/work-type-detector.js +0 -81
- package/src/lib/worktree/dirs.js +0 -3
- package/src/lib/worktree/docker-audit.js +0 -175
- package/src/lib/worktree/env-allocator.js +0 -177
- package/src/lib/worktree/feature-truth.js +0 -145
- package/src/lib/worktree/finish-backup.js +0 -529
- package/src/lib/worktree/fleet-scanner.js +0 -223
- package/src/lib/worktree/ignored-triage.js +0 -136
- package/src/lib/worktree/vscode-settings.js +0 -112
- package/src/lib/worktree/worktree-audit.js +0 -323
- package/src/lib/worktree/worktree-include.js +0 -44
- package/src/scripts/install-plugin.js +0 -114
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { existsSync, readdirSync, readFileSync, rmdirSync, statSync } from 'fs';
|
|
3
|
-
import { join, resolve } from 'path';
|
|
4
|
-
import {
|
|
5
|
-
isGitRepo,
|
|
6
|
-
resolvePrimaryRoot,
|
|
7
|
-
parseWorktreeList,
|
|
8
|
-
clearDanglingWorktreeRegistration,
|
|
9
|
-
} from '../../commands/project/worktree.js';
|
|
10
|
-
import { containerDirs, isUnder } from '../../../framework/hooks/shared/worktree-root.js';
|
|
11
|
-
import { detectDefaultBranch } from '../git/default-branch.js';
|
|
12
|
-
import { buildPrIndex } from '../git/pr-index.js';
|
|
13
|
-
import { classifyBranch, commitsAhead, resolveBaseRef } from '../git/branch-classifier.js';
|
|
14
|
-
import { auditDockerStacks } from './docker-audit.js';
|
|
15
|
-
import { auditFinishBackups } from './finish-backup.js';
|
|
16
|
-
|
|
17
|
-
const norm = (p) => resolve(p).replace(/\\/g, '/');
|
|
18
|
-
|
|
19
|
-
function knownFeatures(root) {
|
|
20
|
-
const names = new Set();
|
|
21
|
-
try {
|
|
22
|
-
const dir = join(root, '.morph', 'features');
|
|
23
|
-
if (!existsSync(dir)) return names;
|
|
24
|
-
for (const name of readdirSync(dir)) {
|
|
25
|
-
if (existsSync(join(dir, name, 'feature.json'))) names.add(name);
|
|
26
|
-
}
|
|
27
|
-
} catch { /* fail-open */ }
|
|
28
|
-
return names;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Branch existence proves nothing (`worktree add -b` creates it); the committed blob does.
|
|
32
|
-
function featureCommittedOnBranch(root, feature) {
|
|
33
|
-
try {
|
|
34
|
-
execFileSync('git', ['cat-file', '-e', `morph/${feature}:.morph/features/${feature}/feature.json`], {
|
|
35
|
-
cwd: root, stdio: 'pipe',
|
|
36
|
-
});
|
|
37
|
-
return true;
|
|
38
|
-
} catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Fail-CLOSED: when integration cannot be established the worktree counts as
|
|
44
|
-
// unintegrated — a quiet diagnostic beats suggesting to delete the only copy.
|
|
45
|
-
function unintegratedWork(root, branchRef, prIndex) {
|
|
46
|
-
const branch = (branchRef || '').replace(/^refs\/heads\//, '');
|
|
47
|
-
if (!branch) return { unintegrated: true, evidence: 'não foi possível resolver a branch do worktree', pr: null };
|
|
48
|
-
|
|
49
|
-
const pr = prIndex?.get(branch) ?? null;
|
|
50
|
-
if (pr?.state === 'OPEN') return { unintegrated: true, evidence: `PR #${pr.number} OPEN`, pr: pr.number };
|
|
51
|
-
|
|
52
|
-
const defaultBranch = detectDefaultBranch(root);
|
|
53
|
-
const baseRef = resolveBaseRef(defaultBranch, root);
|
|
54
|
-
if (!baseRef) return { unintegrated: true, evidence: 'sem branch default resolvível para comparar', pr: null };
|
|
55
|
-
|
|
56
|
-
const ahead = commitsAhead(baseRef, branch, root);
|
|
57
|
-
if (ahead === null) return { unintegrated: true, evidence: `não foi possível comparar com ${baseRef}`, pr: null };
|
|
58
|
-
if (ahead === 0) return { unintegrated: false, evidence: `nenhum commit fora de ${baseRef}`, pr: pr?.number ?? null };
|
|
59
|
-
|
|
60
|
-
// A squash-merge also leaves commits ahead; the classifier keeps `doctor` and `branch prune` agreeing.
|
|
61
|
-
const verdict = classifyBranch({ name: branch, sha: '', current: false, worktreePath: null }, { baseRef, cwd: root, pr });
|
|
62
|
-
if (verdict.kind === 'merged-ancestral' || verdict.kind === 'merged-squash') {
|
|
63
|
-
return { unintegrated: false, evidence: verdict.reason, pr: pr?.number ?? null };
|
|
64
|
-
}
|
|
65
|
-
return { unintegrated: true, evidence: `${ahead} commit(s) fora de ${baseRef}`, pr: pr?.number ?? null };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function featureRegistrations(root) {
|
|
69
|
-
const out = [];
|
|
70
|
-
try {
|
|
71
|
-
const dir = join(root, '.morph', 'features');
|
|
72
|
-
if (!existsSync(dir)) return out;
|
|
73
|
-
for (const feature of readdirSync(dir)) {
|
|
74
|
-
const fjPath = join(dir, feature, 'feature.json');
|
|
75
|
-
if (!existsSync(fjPath)) continue;
|
|
76
|
-
try {
|
|
77
|
-
const fj = JSON.parse(readFileSync(fjPath, 'utf8'));
|
|
78
|
-
if (fj?.worktree?.path) out.push({ feature, path: fj.worktree.path, branch: fj.worktree.branch || null });
|
|
79
|
-
} catch { /* corrupt feature.json — nothing to register */ }
|
|
80
|
-
}
|
|
81
|
-
} catch { /* fail-open */ }
|
|
82
|
-
return out;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Unreadable counts as occupied: emptiness is what licenses automatic removal.
|
|
86
|
-
function isEmptyDir(path) {
|
|
87
|
-
try {
|
|
88
|
-
return readdirSync(path).length === 0;
|
|
89
|
-
} catch {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function dirsOnDisk(root) {
|
|
95
|
-
const found = [];
|
|
96
|
-
const rootNorm = norm(root);
|
|
97
|
-
for (const base of containerDirs(root)) {
|
|
98
|
-
if (!existsSync(base)) continue;
|
|
99
|
-
const label = base.startsWith(`${rootNorm}/`) ? base.slice(rootNorm.length + 1) : base;
|
|
100
|
-
try {
|
|
101
|
-
for (const name of readdirSync(base)) {
|
|
102
|
-
const full = join(base, name);
|
|
103
|
-
try {
|
|
104
|
-
if (statSync(full).isDirectory()) {
|
|
105
|
-
found.push({ name, path: norm(full), container: label, empty: isEmptyDir(full) });
|
|
106
|
-
}
|
|
107
|
-
} catch { /* unreadable entry — skip */ }
|
|
108
|
-
}
|
|
109
|
-
} catch { /* fail-open */ }
|
|
110
|
-
}
|
|
111
|
-
return found;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Reconciles git's worktree registry, the disk, morph's features and docker.
|
|
116
|
-
* Read-only and fail-open; `exec` is the docker executor seam.
|
|
117
|
-
*/
|
|
118
|
-
export function auditWorktrees(cwd = process.cwd(), { exec } = {}) {
|
|
119
|
-
if (!isGitRepo(cwd)) return [];
|
|
120
|
-
const root = resolvePrimaryRoot(cwd);
|
|
121
|
-
const rootNorm = norm(root);
|
|
122
|
-
const issues = [];
|
|
123
|
-
|
|
124
|
-
// null = UNKNOWN (no gh / not GitHub / unauthenticated), never "no PRs".
|
|
125
|
-
const prIndex = buildPrIndex(root);
|
|
126
|
-
|
|
127
|
-
const containers = containerDirs(root);
|
|
128
|
-
const registered = parseWorktreeList(root);
|
|
129
|
-
const registeredPaths = new Set();
|
|
130
|
-
const features = knownFeatures(root);
|
|
131
|
-
|
|
132
|
-
for (const entry of registered) {
|
|
133
|
-
const path = norm(entry.path);
|
|
134
|
-
registeredPaths.add(path);
|
|
135
|
-
if (path === rootNorm) continue;
|
|
136
|
-
|
|
137
|
-
if (!existsSync(path)) {
|
|
138
|
-
issues.push({
|
|
139
|
-
type: 'registered-missing',
|
|
140
|
-
path,
|
|
141
|
-
detail: `git registra um worktree em ${path}, mas o diretório não existe`,
|
|
142
|
-
fix: `git worktree prune (ou \`morph-spec doctor --worktrees --prune\`)`,
|
|
143
|
-
});
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const feature = entry.branch?.match(/^refs\/heads\/morph\/(.+)$/)?.[1] || null;
|
|
148
|
-
if (!feature) {
|
|
149
|
-
const inContainer = isUnder(containers, path);
|
|
150
|
-
const task = entry.branch?.match(/^refs\/heads\/morph-task\/(.+)$/)?.[1] || null;
|
|
151
|
-
|
|
152
|
-
if (!inContainer) {
|
|
153
|
-
// Never pruned: the work inside a tree created outside morph may be the only copy.
|
|
154
|
-
const work = unintegratedWork(root, entry.branch, prIndex);
|
|
155
|
-
issues.push({
|
|
156
|
-
type: 'out-of-container',
|
|
157
|
-
severity: 'warn',
|
|
158
|
-
path,
|
|
159
|
-
detail: `${path} é um worktree fora de worktrees/ (${entry.branch || 'HEAD destacado'}) — criado sem o morph: sem junctions, sem portas, invisível ao \`fleet\`${work.unintegrated ? `; carrega trabalho NÃO integrado (${work.evidence})` : ''}`,
|
|
160
|
-
fix: work.unintegrated
|
|
161
|
-
? `integre a branch primeiro; depois \`morph-spec worktree remove --target "${path}"\`. Novos worktrees: \`morph-spec worktree setup <f>\` ou \`worktree provision <n>\``
|
|
162
|
-
: `morph-spec worktree remove --target "${path}" — e crie os próximos por \`morph-spec worktree setup <f>\` / \`worktree provision <n>\``,
|
|
163
|
-
});
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (task) {
|
|
168
|
-
const work = unintegratedWork(root, entry.branch, prIndex);
|
|
169
|
-
if (work.unintegrated) {
|
|
170
|
-
issues.push({
|
|
171
|
-
type: 'unintegrated-work',
|
|
172
|
-
severity: 'info',
|
|
173
|
-
path,
|
|
174
|
-
detail: `${path} é um worktree de isolamento de task (${entry.branch}) com trabalho NÃO integrado (${work.evidence})`,
|
|
175
|
-
fix: `integre a branch (\`git merge --no-ff morph-task/${task}\` no orquestrador) e depois \`morph-spec worktree remove --target "${path}"\``,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (inContainer) {
|
|
182
|
-
const work = unintegratedWork(root, entry.branch, prIndex);
|
|
183
|
-
issues.push(work.unintegrated
|
|
184
|
-
? {
|
|
185
|
-
type: 'unintegrated-work',
|
|
186
|
-
severity: 'info',
|
|
187
|
-
path,
|
|
188
|
-
detail: `${path} está em ${entry.branch || 'HEAD destacado'} (o \`fleet\` não o enxerga) e carrega trabalho NÃO integrado (${work.evidence})`,
|
|
189
|
-
fix: work.pr
|
|
190
|
-
? `nada a fazer enquanto o PR #${work.pr} estiver aberto`
|
|
191
|
-
: `integre a branch antes de remover o worktree — ele é o único exemplar`,
|
|
192
|
-
}
|
|
193
|
-
: {
|
|
194
|
-
type: 'non-morph-branch',
|
|
195
|
-
path,
|
|
196
|
-
detail: `${path} está em ${entry.branch || 'HEAD destacado'}, não numa branch morph/* — o \`fleet\` não o enxerga (e não há trabalho pendente: ${work.evidence})`,
|
|
197
|
-
// Never raw `git worktree remove`: it follows the infra junctions and
|
|
198
|
-
// empties the root's .claude/ and .morph/framework/.
|
|
199
|
-
fix: `morph-spec worktree remove --target "${path}" (se já não serve)`,
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (!features.has(feature) && !featureCommittedOnBranch(root, feature)) {
|
|
206
|
-
// An archived feature or an open PR leaves this same shape: suggest removal
|
|
207
|
-
// only when the work is provably integrated.
|
|
208
|
-
const work = unintegratedWork(root, entry.branch, prIndex);
|
|
209
|
-
if (work.unintegrated) {
|
|
210
|
-
issues.push({
|
|
211
|
-
type: 'unintegrated-work',
|
|
212
|
-
severity: 'info',
|
|
213
|
-
path,
|
|
214
|
-
feature,
|
|
215
|
-
detail: `worktree com trabalho NÃO integrado (${work.evidence}) — a feature foi arquivada, o trabalho não`,
|
|
216
|
-
fix: work.pr
|
|
217
|
-
? `nada a fazer enquanto o PR #${work.pr} estiver aberto; depois de mergeado, \`morph-spec worktree remove --target "${path}"\``
|
|
218
|
-
: `integre a branch (\`morph-spec finish\` ou um PR) antes de remover o worktree — ele é o único exemplar`,
|
|
219
|
-
});
|
|
220
|
-
} else {
|
|
221
|
-
issues.push({
|
|
222
|
-
type: 'no-feature',
|
|
223
|
-
path,
|
|
224
|
-
feature,
|
|
225
|
-
detail: `worktree de "${feature}" sem feature conhecida (nem em .morph/features/, nem na branch) e sem trabalho pendente (${work.evidence})`,
|
|
226
|
-
fix: `morph-spec worktree remove --target "${path}"`,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
for (const d of dirsOnDisk(root)) {
|
|
233
|
-
if (registeredPaths.has(d.path)) continue;
|
|
234
|
-
issues.push({
|
|
235
|
-
type: 'unregistered-dir',
|
|
236
|
-
path: d.path,
|
|
237
|
-
empty: d.empty,
|
|
238
|
-
detail: d.empty
|
|
239
|
-
? `${d.container}/${d.name} existe no disco, está VAZIO e o git não o registra — resíduo de um finish anterior`
|
|
240
|
-
: `${d.container}/${d.name} existe no disco mas o git não o registra — resíduo de um finish anterior`,
|
|
241
|
-
fix: d.empty
|
|
242
|
-
? `morph-spec doctor --worktrees --prune`
|
|
243
|
-
: `apague o diretório à mão depois de conferir que nada importante ficou nele`,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
for (const reg of featureRegistrations(root)) {
|
|
248
|
-
const path = norm(reg.path);
|
|
249
|
-
if (!existsSync(reg.path)) {
|
|
250
|
-
issues.push({
|
|
251
|
-
type: 'dangling-registration',
|
|
252
|
-
feature: reg.feature,
|
|
253
|
-
path,
|
|
254
|
-
detail: `"${reg.feature}" registra worktree.path=${path} na raiz, mas o diretório não existe`,
|
|
255
|
-
fix: `morph-spec doctor --worktrees --prune`,
|
|
256
|
-
});
|
|
257
|
-
} else if (!registeredPaths.has(path)) {
|
|
258
|
-
issues.push({
|
|
259
|
-
type: 'unregistered-registration',
|
|
260
|
-
feature: reg.feature,
|
|
261
|
-
path,
|
|
262
|
-
detail: `"${reg.feature}" registra worktree.path=${path}, mas o git não o conhece como worktree — a próxima \`worktree setup\` recusará com exit 3`,
|
|
263
|
-
fix: `inspecione o diretório; se não serve mais, apague-o e rode morph-spec doctor --worktrees --prune`,
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Feature names are passed in so docker-audit never rescans and disagrees.
|
|
269
|
-
const treeFeatures = new Set(features);
|
|
270
|
-
for (const entry of registered) {
|
|
271
|
-
const f = entry.branch?.match(/^refs\/heads\/morph\/(.+)$/)?.[1];
|
|
272
|
-
if (f) treeFeatures.add(f);
|
|
273
|
-
}
|
|
274
|
-
issues.push(...auditDockerStacks(root, { exec, features: treeFeatures }));
|
|
275
|
-
|
|
276
|
-
issues.push(...auditFinishBackups(root));
|
|
277
|
-
|
|
278
|
-
return issues;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// `rmdirSync`, never `rm -rf`: a file that appears after the emptiness check
|
|
282
|
-
// makes it fail instead of being lost.
|
|
283
|
-
function removeEmptyUnregisteredDirs(root) {
|
|
284
|
-
const registeredPaths = new Set(parseWorktreeList(root).map((e) => norm(e.path)));
|
|
285
|
-
const removed = [];
|
|
286
|
-
for (const d of dirsOnDisk(root)) {
|
|
287
|
-
if (!d.empty || registeredPaths.has(d.path)) continue;
|
|
288
|
-
try {
|
|
289
|
-
rmdirSync(d.path);
|
|
290
|
-
removed.push(d.path);
|
|
291
|
-
} catch { /* raced, locked or no longer empty — leave it to the next audit */ }
|
|
292
|
-
}
|
|
293
|
-
return removed;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Touches only what is already gone from disk or provably empty. Order matters:
|
|
298
|
-
* empty dirs go first so a root pointer to one becomes dangling and is cleared
|
|
299
|
-
* in the same run.
|
|
300
|
-
*/
|
|
301
|
-
export async function pruneWorktrees(cwd = process.cwd()) {
|
|
302
|
-
if (!isGitRepo(cwd)) return { pruned: false, error: 'not-a-git-repo', removedEmptyDirs: [], clearedRegistrations: [] };
|
|
303
|
-
const root = resolvePrimaryRoot(cwd);
|
|
304
|
-
|
|
305
|
-
let pruned = false;
|
|
306
|
-
let error;
|
|
307
|
-
try {
|
|
308
|
-
execFileSync('git', ['worktree', 'prune'], { cwd: root, stdio: 'pipe' });
|
|
309
|
-
pruned = true;
|
|
310
|
-
} catch (err) {
|
|
311
|
-
error = (err.message || 'unknown').slice(0, 200);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const removedEmptyDirs = removeEmptyUnregisteredDirs(root);
|
|
315
|
-
|
|
316
|
-
const clearedRegistrations = [];
|
|
317
|
-
for (const reg of featureRegistrations(root)) {
|
|
318
|
-
const { cleared } = await clearDanglingWorktreeRegistration(root, reg.feature);
|
|
319
|
-
if (cleared) clearedRegistrations.push({ feature: reg.feature, cleared: true });
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return { pruned, ...(error ? { error } : {}), removedEmptyDirs, clearedRegistrations };
|
|
323
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
|
-
import { copyFileSync, existsSync, lstatSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
4
|
-
import { isDisposableBuildArtifact } from './ignored-triage.js';
|
|
5
|
-
|
|
6
|
-
const INCLUDE_FILE = '.worktreeinclude';
|
|
7
|
-
const NESTED_GIT = /(^|\/)\.git(\/|$)/;
|
|
8
|
-
|
|
9
|
-
const gitOut = (cwd, args, input) => execFileSync('git', args, { cwd, stdio: ['pipe', 'pipe', 'ignore'], encoding: 'utf8', input });
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `.worktreeinclude` parity: a WorktreeCreate hook replaces the native creation, so the native copy
|
|
13
|
-
* never runs. Copies files matching a pattern AND gitignored in the tree, when the tree lacks them;
|
|
14
|
-
* never build artifacts or `node_modules`. Returns the relative paths copied.
|
|
15
|
-
*/
|
|
16
|
-
export function copyWorktreeIncludes(worktreePath, root) {
|
|
17
|
-
const file = join(root, INCLUDE_FILE);
|
|
18
|
-
if (!existsSync(file)) return [];
|
|
19
|
-
try {
|
|
20
|
-
// No --exclude-standard: with --ignored it would list every gitignored file, not just the pattern matches.
|
|
21
|
-
const matched = gitOut(root, ['ls-files', '--others', '--ignored', '--exclude-from', file, '-z'])
|
|
22
|
-
.split('\0').filter(Boolean).map((p) => p.replace(/\\/g, '/'))
|
|
23
|
-
.filter((p) => !NESTED_GIT.test(p) && !isDisposableBuildArtifact(p));
|
|
24
|
-
if (!matched.length) return [];
|
|
25
|
-
|
|
26
|
-
const ignoredThere = new Set(gitOut(worktreePath, ['check-ignore', '--stdin', '-z'], `${matched.join('\0')}\0`).split('\0').filter(Boolean));
|
|
27
|
-
const copied = [];
|
|
28
|
-
for (const rel of matched) {
|
|
29
|
-
if (!ignoredThere.has(rel)) continue;
|
|
30
|
-
const src = join(root, rel);
|
|
31
|
-
const dst = join(worktreePath, rel);
|
|
32
|
-
try {
|
|
33
|
-
if (!lstatSync(src).isFile()) continue;
|
|
34
|
-
try { lstatSync(dst); continue; } catch { /* absent, and not a dangling link either */ }
|
|
35
|
-
mkdirSync(dirname(dst), { recursive: true });
|
|
36
|
-
copyFileSync(src, dst);
|
|
37
|
-
copied.push(rel);
|
|
38
|
-
} catch { /* unreadable or unwritable — leave it out */ }
|
|
39
|
-
}
|
|
40
|
-
return copied;
|
|
41
|
-
} catch {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { homedir } from 'os';
|
|
3
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
4
|
-
import { mkdir, writeFile } from 'fs/promises';
|
|
5
|
-
import https from 'node:https';
|
|
6
|
-
|
|
7
|
-
const PLUGINS_DIR = join(homedir(), '.claude', 'plugins');
|
|
8
|
-
const CACHE_DIR = join(PLUGINS_DIR, 'cache', 'claude-plugins-official');
|
|
9
|
-
const INSTALLED_FILE = join(PLUGINS_DIR, 'installed_plugins.json');
|
|
10
|
-
const GH_REPO = 'anthropics/claude-plugins-official';
|
|
11
|
-
|
|
12
|
-
async function fetchGitHub(path) {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
const opts = {
|
|
15
|
-
hostname: 'api.github.com',
|
|
16
|
-
path,
|
|
17
|
-
headers: { 'User-Agent': 'morph-spec', 'Accept': 'application/vnd.github.v3+json' }
|
|
18
|
-
};
|
|
19
|
-
https.get(opts, (res) => {
|
|
20
|
-
let data = '';
|
|
21
|
-
res.on('data', c => data += c);
|
|
22
|
-
res.on('end', () => {
|
|
23
|
-
try { resolve(JSON.parse(data)); }
|
|
24
|
-
catch (e) { reject(new Error(`GitHub API parse error: ${data.slice(0, 200)}`)); }
|
|
25
|
-
});
|
|
26
|
-
}).on('error', reject);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async function downloadFile(rawUrl) {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const doGet = (url) => {
|
|
33
|
-
const parsed = new URL(url);
|
|
34
|
-
https.get({
|
|
35
|
-
hostname: parsed.hostname,
|
|
36
|
-
path: parsed.pathname + parsed.search,
|
|
37
|
-
headers: { 'User-Agent': 'morph-spec' }
|
|
38
|
-
}, (res) => {
|
|
39
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
40
|
-
return doGet(res.headers.location);
|
|
41
|
-
}
|
|
42
|
-
const chunks = [];
|
|
43
|
-
res.on('data', c => chunks.push(c));
|
|
44
|
-
res.on('end', () => resolve(Buffer.concat(chunks)));
|
|
45
|
-
}).on('error', reject);
|
|
46
|
-
};
|
|
47
|
-
doGet(rawUrl);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function readInstalledPlugins() {
|
|
52
|
-
if (!existsSync(INSTALLED_FILE)) return { version: 2, plugins: {} };
|
|
53
|
-
try { return JSON.parse(readFileSync(INSTALLED_FILE, 'utf8')); }
|
|
54
|
-
catch { return { version: 2, plugins: {} }; }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function isPluginInstalled(plugins, name) {
|
|
58
|
-
return `${name}@claude-plugins-official` in plugins;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function buildInstallEntry(pluginName, installPath, gitCommitSha, version) {
|
|
62
|
-
const now = new Date().toISOString();
|
|
63
|
-
return { scope: 'user', installPath, version, installedAt: now, lastUpdated: now, gitCommitSha };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function resolvePluginVersion(pluginName) {
|
|
67
|
-
const commits = await fetchGitHub(`/repos/${GH_REPO}/commits?path=${pluginName}&per_page=1`);
|
|
68
|
-
if (!Array.isArray(commits) || commits.length === 0) {
|
|
69
|
-
throw new Error(`Could not resolve version for plugin: ${pluginName}`);
|
|
70
|
-
}
|
|
71
|
-
const sha = commits[0].sha;
|
|
72
|
-
return { sha, shortSha: sha.slice(0, 12) };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function downloadPluginFiles(pluginName, sha, destDir) {
|
|
76
|
-
const tree = await fetchGitHub(`/repos/${GH_REPO}/git/trees/${sha}?recursive=1`);
|
|
77
|
-
if (!tree.tree) throw new Error('GitHub tree API returned unexpected shape');
|
|
78
|
-
|
|
79
|
-
const pluginFiles = tree.tree.filter(f => f.path.startsWith(`${pluginName}/`) && f.type === 'blob');
|
|
80
|
-
if (pluginFiles.length === 0) throw new Error(`Plugin "${pluginName}" not found in repository`);
|
|
81
|
-
|
|
82
|
-
for (const file of pluginFiles) {
|
|
83
|
-
const relativePath = file.path.slice(pluginName.length + 1);
|
|
84
|
-
const destPath = join(destDir, relativePath);
|
|
85
|
-
await mkdir(join(destPath, '..'), { recursive: true });
|
|
86
|
-
const content = await downloadFile(
|
|
87
|
-
`https://raw.githubusercontent.com/${GH_REPO}/${sha}/${file.path}`
|
|
88
|
-
);
|
|
89
|
-
await writeFile(destPath, content);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** @returns {{ installed: boolean, version: string, alreadyInstalled: boolean }} */
|
|
94
|
-
export async function installPlugin(pluginName) {
|
|
95
|
-
const data = readInstalledPlugins();
|
|
96
|
-
if (isPluginInstalled(data.plugins, pluginName)) {
|
|
97
|
-
const existing = data.plugins[`${pluginName}@claude-plugins-official`];
|
|
98
|
-
const version = Array.isArray(existing) ? existing[0]?.version : 'unknown';
|
|
99
|
-
return { installed: true, alreadyInstalled: true, version };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const { sha, shortSha } = await resolvePluginVersion(pluginName);
|
|
103
|
-
const installPath = join(CACHE_DIR, pluginName, shortSha);
|
|
104
|
-
|
|
105
|
-
await mkdir(installPath, { recursive: true });
|
|
106
|
-
await downloadPluginFiles(pluginName, sha, installPath);
|
|
107
|
-
|
|
108
|
-
const entry = buildInstallEntry(pluginName, installPath, sha, shortSha);
|
|
109
|
-
data.plugins[`${pluginName}@claude-plugins-official`] = [entry];
|
|
110
|
-
mkdirSync(PLUGINS_DIR, { recursive: true });
|
|
111
|
-
writeFileSync(INSTALLED_FILE, JSON.stringify(data, null, 2));
|
|
112
|
-
|
|
113
|
-
return { installed: true, alreadyInstalled: false, version: shortSha };
|
|
114
|
-
}
|