peaks-cli 1.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/LICENSE +52 -0
- package/README.md +417 -0
- package/bin/peaks.js +2 -0
- package/dist/src/cli/cli-helpers.d.ts +25 -0
- package/dist/src/cli/cli-helpers.js +78 -0
- package/dist/src/cli/commands/capability-commands.d.ts +5 -0
- package/dist/src/cli/commands/capability-commands.js +46 -0
- package/dist/src/cli/commands/capability-worker-config-sc-commands.d.ts +3 -0
- package/dist/src/cli/commands/capability-worker-config-sc-commands.js +10 -0
- package/dist/src/cli/commands/config-commands.d.ts +3 -0
- package/dist/src/cli/commands/config-commands.js +212 -0
- package/dist/src/cli/commands/core-artifact-commands.d.ts +3 -0
- package/dist/src/cli/commands/core-artifact-commands.js +200 -0
- package/dist/src/cli/commands/sc-commands.d.ts +3 -0
- package/dist/src/cli/commands/sc-commands.js +37 -0
- package/dist/src/cli/commands/worker-commands.d.ts +3 -0
- package/dist/src/cli/commands/worker-commands.js +52 -0
- package/dist/src/cli/commands/workflow-commands.d.ts +3 -0
- package/dist/src/cli/commands/workflow-commands.js +257 -0
- package/dist/src/cli/index.d.ts +1 -0
- package/dist/src/cli/index.js +14 -0
- package/dist/src/cli/program.d.ts +4 -0
- package/dist/src/cli/program.js +13 -0
- package/dist/src/services/artifacts/artifact-service.d.ts +43 -0
- package/dist/src/services/artifacts/artifact-service.js +97 -0
- package/dist/src/services/artifacts/workspace-service.d.ts +33 -0
- package/dist/src/services/artifacts/workspace-service.js +254 -0
- package/dist/src/services/config/config-service.d.ts +29 -0
- package/dist/src/services/config/config-service.js +501 -0
- package/dist/src/services/config/config-types.d.ts +63 -0
- package/dist/src/services/config/config-types.js +16 -0
- package/dist/src/services/config/model-routing.d.ts +4 -0
- package/dist/src/services/config/model-routing.js +15 -0
- package/dist/src/services/doctor/doctor-service.d.ts +18 -0
- package/dist/src/services/doctor/doctor-service.js +68 -0
- package/dist/src/services/memory/project-memory-service.d.ts +79 -0
- package/dist/src/services/memory/project-memory-service.js +306 -0
- package/dist/src/services/profiles/profile-service.d.ts +6 -0
- package/dist/src/services/profiles/profile-service.js +19 -0
- package/dist/src/services/providers/minimax-provider-service.d.ts +24 -0
- package/dist/src/services/providers/minimax-provider-service.js +143 -0
- package/dist/src/services/providers/minimax-worker-service.d.ts +21 -0
- package/dist/src/services/providers/minimax-worker-service.js +80 -0
- package/dist/src/services/proxy/proxy-service.d.ts +7 -0
- package/dist/src/services/proxy/proxy-service.js +31 -0
- package/dist/src/services/rd/rd-service.d.ts +88 -0
- package/dist/src/services/rd/rd-service.js +370 -0
- package/dist/src/services/recommendations/capability-availability.d.ts +5 -0
- package/dist/src/services/recommendations/capability-availability.js +40 -0
- package/dist/src/services/recommendations/capability-map-service.d.ts +7 -0
- package/dist/src/services/recommendations/capability-map-service.js +131 -0
- package/dist/src/services/recommendations/capability-seed-items.d.ts +2 -0
- package/dist/src/services/recommendations/capability-seed-items.js +131 -0
- package/dist/src/services/recommendations/capability-seed-mappings.d.ts +2 -0
- package/dist/src/services/recommendations/capability-seed-mappings.js +42 -0
- package/dist/src/services/recommendations/capability-seed-sources.d.ts +2 -0
- package/dist/src/services/recommendations/capability-seed-sources.js +35 -0
- package/dist/src/services/recommendations/recommendation-service.d.ts +8 -0
- package/dist/src/services/recommendations/recommendation-service.js +106 -0
- package/dist/src/services/recommendations/recommendation-types.d.ts +129 -0
- package/dist/src/services/recommendations/recommendation-types.js +1 -0
- package/dist/src/services/recommendations/seed-capability-catalog.d.ts +3 -0
- package/dist/src/services/recommendations/seed-capability-catalog.js +3 -0
- package/dist/src/services/refactor/refactor-service.d.ts +9 -0
- package/dist/src/services/refactor/refactor-service.js +33 -0
- package/dist/src/services/sc/index.d.ts +1 -0
- package/dist/src/services/sc/index.js +1 -0
- package/dist/src/services/sc/sc-service.d.ts +79 -0
- package/dist/src/services/sc/sc-service.js +223 -0
- package/dist/src/services/skills/skill-registry.d.ts +17 -0
- package/dist/src/services/skills/skill-registry.js +40 -0
- package/dist/src/services/standards/project-standards-service.d.ts +82 -0
- package/dist/src/services/standards/project-standards-service.js +383 -0
- package/dist/src/services/tech/tech-service.d.ts +69 -0
- package/dist/src/services/tech/tech-service.js +236 -0
- package/dist/src/services/workflow/workflow-autonomous-service.d.ts +99 -0
- package/dist/src/services/workflow/workflow-autonomous-service.js +526 -0
- package/dist/src/services/workflow/workflow-router-service.d.ts +85 -0
- package/dist/src/services/workflow/workflow-router-service.js +213 -0
- package/dist/src/shared/change-id.d.ts +15 -0
- package/dist/src/shared/change-id.js +76 -0
- package/dist/src/shared/frontmatter.d.ts +6 -0
- package/dist/src/shared/frontmatter.js +47 -0
- package/dist/src/shared/fs-utils.d.ts +4 -0
- package/dist/src/shared/fs-utils.js +16 -0
- package/dist/src/shared/fs.d.ts +4 -0
- package/dist/src/shared/fs.js +26 -0
- package/dist/src/shared/path-utils.d.ts +13 -0
- package/dist/src/shared/path-utils.js +56 -0
- package/dist/src/shared/paths.d.ts +6 -0
- package/dist/src/shared/paths.js +40 -0
- package/dist/src/shared/planner-response.d.ts +21 -0
- package/dist/src/shared/planner-response.js +26 -0
- package/dist/src/shared/platform.d.ts +6 -0
- package/dist/src/shared/platform.js +11 -0
- package/dist/src/shared/process.d.ts +5 -0
- package/dist/src/shared/process.js +12 -0
- package/dist/src/shared/result.d.ts +13 -0
- package/dist/src/shared/result.js +32 -0
- package/package.json +49 -0
- package/schemas/approval-record.schema.json +14 -0
- package/schemas/artifact-manifest.schema.json +16 -0
- package/schemas/artifact-retention-report.schema.json +17 -0
- package/schemas/artifact-workspace.schema.json +22 -0
- package/schemas/capability-availability.schema.json +36 -0
- package/schemas/capability-item.schema.json +37 -0
- package/schemas/capability-source.schema.json +30 -0
- package/schemas/change-impact.schema.json +15 -0
- package/schemas/context-capsule.schema.json +16 -0
- package/schemas/recommendation-plan.schema.json +37 -0
- package/schemas/refactor-slice-spec.schema.json +19 -0
- package/scripts/clean-dist.mjs +8 -0
- package/scripts/install-skills.mjs +76 -0
- package/scripts/watch.mjs +389 -0
- package/skills/peaks-prd/SKILL.md +42 -0
- package/skills/peaks-prd/references/artifact-contracts.md +3 -0
- package/skills/peaks-prd/references/command-migration.md +3 -0
- package/skills/peaks-prd/references/workflow.md +11 -0
- package/skills/peaks-qa/SKILL.md +45 -0
- package/skills/peaks-qa/references/artifact-contracts.md +3 -0
- package/skills/peaks-qa/references/command-migration.md +3 -0
- package/skills/peaks-qa/references/regression-gates.md +16 -0
- package/skills/peaks-rd/SKILL.md +56 -0
- package/skills/peaks-rd/references/artifact-contracts.md +3 -0
- package/skills/peaks-rd/references/command-migration.md +3 -0
- package/skills/peaks-rd/references/refactor-workflow.md +31 -0
- package/skills/peaks-sc/SKILL.md +30 -0
- package/skills/peaks-sc/references/artifact-contracts.md +3 -0
- package/skills/peaks-sc/references/artifact-retention.md +14 -0
- package/skills/peaks-sc/references/command-migration.md +3 -0
- package/skills/peaks-solo/SKILL.md +63 -0
- package/skills/peaks-solo/references/artifact-contracts.md +3 -0
- package/skills/peaks-solo/references/command-migration.md +3 -0
- package/skills/peaks-solo/references/refactor-mode.md +22 -0
- package/skills/peaks-solo/references/workflow.md +14 -0
- package/skills/peaks-txt/SKILL.md +48 -0
- package/skills/peaks-txt/references/artifact-contracts.md +3 -0
- package/skills/peaks-txt/references/command-migration.md +3 -0
- package/skills/peaks-txt/references/context-capsule.md +20 -0
- package/skills/peaks-ui/SKILL.md +35 -0
- package/skills/peaks-ui/references/artifact-contracts.md +3 -0
- package/skills/peaks-ui/references/command-migration.md +3 -0
- package/skills/peaks-ui/references/workflow.md +11 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared response types for planner commands.
|
|
3
|
+
* These types ensure consistent error/status reporting across
|
|
4
|
+
* tech and RD swarm dry-run planner commands.
|
|
5
|
+
*/
|
|
6
|
+
export const WORKSPACE_UNAVAILABLE_NEXT_ACTIONS = Object.freeze([
|
|
7
|
+
'Configure a Peaks artifact workspace in your workspace config.',
|
|
8
|
+
'See peaks artifacts workspace --help for setup instructions.',
|
|
9
|
+
]);
|
|
10
|
+
export function makeUnavailableResponse(behavior, reason) {
|
|
11
|
+
return {
|
|
12
|
+
available: false,
|
|
13
|
+
behavior,
|
|
14
|
+
reason,
|
|
15
|
+
nextActions: [...WORKSPACE_UNAVAILABLE_NEXT_ACTIONS],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function makeAvailableResponse(data) {
|
|
19
|
+
return {
|
|
20
|
+
available: true,
|
|
21
|
+
data,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function isUnavailableResponse(resp) {
|
|
25
|
+
return resp.available === false;
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Platform = 'win32' | 'darwin' | 'linux';
|
|
2
|
+
export declare function detectPlatform(currentPlatform?: NodeJS.Platform): Platform;
|
|
3
|
+
export declare const platform: Platform;
|
|
4
|
+
export declare const isWindows: boolean;
|
|
5
|
+
export declare const isMac: boolean;
|
|
6
|
+
export declare const isLinux: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function detectPlatform(currentPlatform = process.platform) {
|
|
2
|
+
if (currentPlatform === 'win32')
|
|
3
|
+
return 'win32';
|
|
4
|
+
if (currentPlatform === 'darwin')
|
|
5
|
+
return 'darwin';
|
|
6
|
+
return 'linux';
|
|
7
|
+
}
|
|
8
|
+
export const platform = detectPlatform();
|
|
9
|
+
export const isWindows = platform === 'win32';
|
|
10
|
+
export const isMac = platform === 'darwin';
|
|
11
|
+
export const isLinux = platform === 'linux';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
export async function execCommand(command, args, options) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
execFile(command, args, { cwd: options?.cwd, env: options?.env }, (error, stdout) => {
|
|
5
|
+
if (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
resolve(stdout.trim());
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ResultEnvelope<T> = {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
command: string;
|
|
4
|
+
data: T;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
nextActions: string[];
|
|
7
|
+
code?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function ok<T>(command: string, data: T, warnings?: string[], nextActions?: string[]): ResultEnvelope<T>;
|
|
11
|
+
export declare function fail<T>(command: string, code: string, message: string, data: T, nextActions?: string[]): ResultEnvelope<T>;
|
|
12
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
13
|
+
export declare function redactSensitiveErrorMessage(message: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function ok(command, data, warnings = [], nextActions = []) {
|
|
2
|
+
return { ok: true, command, data, warnings, nextActions };
|
|
3
|
+
}
|
|
4
|
+
export function fail(command, code, message, data, nextActions = []) {
|
|
5
|
+
return { ok: false, command, code, message, data, warnings: [], nextActions };
|
|
6
|
+
}
|
|
7
|
+
const SENSITIVE_ERROR_PATTERNS = [
|
|
8
|
+
/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/gi,
|
|
9
|
+
/-----BEGIN [A-Z ]*PRIVATE KEY-----/g,
|
|
10
|
+
/\b(?:api[\s_-]?key|token|password|secret)\s*[:=]\s*['\"]?[^\s'\"]{8,}/gi,
|
|
11
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
12
|
+
/\bAIza[0-9A-Za-z_-]{20,}\b/g,
|
|
13
|
+
/\bghp_[0-9A-Za-z_]{20,}\b/g,
|
|
14
|
+
/\bgithub_pat_[0-9A-Za-z_]{20,}\b/g,
|
|
15
|
+
/\bglpat-[0-9A-Za-z_-]{20,}\b/g,
|
|
16
|
+
/\bxox[abprse]-[0-9A-Za-z-]{20,}\b/g,
|
|
17
|
+
/\bsk-[A-Za-z0-9_-]{16,}\b/g,
|
|
18
|
+
/\beyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,
|
|
19
|
+
/(secret|token|password|api[-_ ]?key)/gi
|
|
20
|
+
];
|
|
21
|
+
export function getErrorMessage(error) {
|
|
22
|
+
if (error instanceof Error) {
|
|
23
|
+
return error.message;
|
|
24
|
+
}
|
|
25
|
+
if (typeof error === 'string') {
|
|
26
|
+
return error;
|
|
27
|
+
}
|
|
28
|
+
return 'Unexpected error';
|
|
29
|
+
}
|
|
30
|
+
export function redactSensitiveErrorMessage(message) {
|
|
31
|
+
return SENSITIVE_ERROR_PATTERNS.reduce((redacted, pattern) => redacted.replace(pattern, '[redacted]'), message);
|
|
32
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "peaks-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Peaks CLI and short skill family for Claude Code automation.",
|
|
5
|
+
"author": "SquabbyZ",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"packageManager": "pnpm@10.11.0",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"peaks": "./bin/peaks.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin/peaks.js",
|
|
17
|
+
"dist/src/cli/index.js",
|
|
18
|
+
"dist/src/**/*.js",
|
|
19
|
+
"dist/src/**/*.d.ts",
|
|
20
|
+
"scripts/clean-dist.mjs",
|
|
21
|
+
"scripts/install-skills.mjs",
|
|
22
|
+
"scripts/watch.mjs",
|
|
23
|
+
"skills/**",
|
|
24
|
+
"schemas/*.json"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "node ./scripts/clean-dist.mjs && tsc -p tsconfig.json",
|
|
28
|
+
"prepack": "npm run build",
|
|
29
|
+
"postinstall": "node ./scripts/install-skills.mjs",
|
|
30
|
+
"dev": "tsx src/cli/index.ts",
|
|
31
|
+
"dev:watch": "node ./scripts/watch.mjs",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:coverage": "vitest run --coverage",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"commander": "^12.1.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.10.2",
|
|
44
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
45
|
+
"tsx": "^4.19.2",
|
|
46
|
+
"typescript": "^5.7.2",
|
|
47
|
+
"vitest": "^2.1.8"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Approval Record",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["approvedArtifact", "decision"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"approvedBy": { "type": "string" },
|
|
8
|
+
"approvedAt": { "type": "string" },
|
|
9
|
+
"approvedArtifact": { "type": "string" },
|
|
10
|
+
"decision": { "type": "string" },
|
|
11
|
+
"acceptedRisks": { "type": "array" },
|
|
12
|
+
"conditions": { "type": "array" }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Artifact Manifest",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["artifactId", "artifactType", "ownerSkill", "status"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"artifactId": { "type": "string" },
|
|
8
|
+
"artifactType": { "type": "string" },
|
|
9
|
+
"ownerSkill": { "type": "string" },
|
|
10
|
+
"scenario": { "type": "string" },
|
|
11
|
+
"status": { "type": "string" },
|
|
12
|
+
"inputs": { "type": "array", "items": { "type": "string" } },
|
|
13
|
+
"outputs": { "type": "array", "items": { "type": "string" } },
|
|
14
|
+
"evidence": { "type": "array", "items": { "type": "string" } }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Artifact Retention Report",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["sliceId", "prdArtifacts", "rdArtifacts", "qaArtifacts", "commitStatus"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"sliceId": { "type": "string" },
|
|
8
|
+
"prdArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
9
|
+
"rdArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
10
|
+
"qaArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
11
|
+
"coverageArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
12
|
+
"reviewArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
13
|
+
"codeChanges": { "type": "array", "items": { "type": "string" } },
|
|
14
|
+
"commitStatus": { "type": "string" },
|
|
15
|
+
"rollbackPoint": { "type": "string" }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Artifact Workspace",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["workspaceId", "localPath"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"workspaceId": { "type": "string" },
|
|
8
|
+
"artifactRepo": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["provider", "owner", "name"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"provider": { "type": "string", "enum": ["github", "gitlab"] },
|
|
13
|
+
"owner": { "type": "string" },
|
|
14
|
+
"name": { "type": "string" },
|
|
15
|
+
"url": { "type": "string", "format": "uri" }
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"localPath": { "type": "string" },
|
|
19
|
+
"lastSync": { "type": "string", "format": "date-time" },
|
|
20
|
+
"syncStatus": { "type": "string", "enum": ["synced", "pending", "out-of-sync", "unknown"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Capability Availability",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["capabilityId", "type", "status", "requiredFor", "fallback"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"capabilityId": { "type": "string" },
|
|
8
|
+
"type": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["skill", "mcp", "cli", "agent", "profile"]
|
|
11
|
+
},
|
|
12
|
+
"status": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["available", "missing", "installable", "disabled", "unknown"]
|
|
15
|
+
},
|
|
16
|
+
"requiredFor": { "type": "array", "items": { "type": "string" } },
|
|
17
|
+
"installPlan": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"available": { "type": "boolean" },
|
|
21
|
+
"commandPreview": { "type": "string" },
|
|
22
|
+
"requiresApproval": { "type": "boolean" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"fallback": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["mode", "qualityImpact"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"mode": { "type": "string" },
|
|
30
|
+
"qualityImpact": { "type": "string" },
|
|
31
|
+
"nextAction": { "type": "string" }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"risk": { "type": "string", "enum": ["low", "medium", "high"] }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Capability Item",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["capabilityId", "sourceId", "itemType", "category", "workflows", "riskLevel", "fallback"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"capabilityId": { "type": "string" },
|
|
8
|
+
"sourceId": { "type": "string" },
|
|
9
|
+
"name": { "type": "string" },
|
|
10
|
+
"itemType": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"enum": ["skill", "agent", "mcp", "rule", "hook", "template", "workflow", "doc", "cli"]
|
|
13
|
+
},
|
|
14
|
+
"category": { "type": "string" },
|
|
15
|
+
"workflows": { "type": "array", "items": { "type": "string" } },
|
|
16
|
+
"audience": { "type": "array", "items": { "type": "string" } },
|
|
17
|
+
"riskLevel": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
18
|
+
"inputContract": { "type": "string" },
|
|
19
|
+
"outputContract": { "type": "string" },
|
|
20
|
+
"fallback": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": ["mode", "qualityImpact"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"mode": { "type": "string" },
|
|
25
|
+
"qualityImpact": { "type": "string" },
|
|
26
|
+
"nextAction": { "type": "string" }
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"presentation": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"displayName": { "type": "object" },
|
|
33
|
+
"description": { "type": "object" }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Capability Source",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["sourceId", "sourceType", "title", "url", "discoveryStatus", "items"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"sourceId": { "type": "string" },
|
|
8
|
+
"sourceType": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["repo", "skills-package", "mcp-collection", "website", "local-install"]
|
|
11
|
+
},
|
|
12
|
+
"title": { "type": "string" },
|
|
13
|
+
"url": { "type": "string" },
|
|
14
|
+
"trustSignals": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"sourceReputation": { "type": "string" },
|
|
18
|
+
"stars": { "type": "number" },
|
|
19
|
+
"installs": { "type": "number" },
|
|
20
|
+
"maintainer": { "type": "string" },
|
|
21
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"discoveryStatus": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["unscanned", "indexed", "verified", "deprecated"]
|
|
27
|
+
},
|
|
28
|
+
"items": { "type": "array", "items": { "type": "string" } }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Change Impact",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["changeId", "sourceArtifacts", "affectedModules"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"changeId": { "type": "string" },
|
|
8
|
+
"sourceArtifacts": { "type": "array", "items": { "type": "string" } },
|
|
9
|
+
"affectedModules": { "type": "array", "items": { "type": "string" } },
|
|
10
|
+
"affectedFiles": { "type": "array", "items": { "type": "string" } },
|
|
11
|
+
"qaImpact": { "type": "object" },
|
|
12
|
+
"riskImpact": { "type": "object" },
|
|
13
|
+
"syncPointers": { "type": "object" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Context Capsule",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["sourceSkill", "audience", "purpose"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"sourceSkill": { "type": "string" },
|
|
8
|
+
"audience": { "type": "array", "items": { "type": "string" } },
|
|
9
|
+
"purpose": { "type": "string" },
|
|
10
|
+
"confirmedDecisions": { "type": "array" },
|
|
11
|
+
"assumptions": { "type": "array" },
|
|
12
|
+
"discardedOptions": { "type": "array" },
|
|
13
|
+
"risks": { "type": "array" },
|
|
14
|
+
"staleness": { "type": "object" }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Recommendation Plan",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["intent", "workflow", "profile", "audience", "options", "requiredCapabilities", "availability", "decisionRequired", "machine", "presentation"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"intent": { "type": "string" },
|
|
8
|
+
"workflow": { "type": "string" },
|
|
9
|
+
"profile": { "type": "string" },
|
|
10
|
+
"audience": { "type": "string" },
|
|
11
|
+
"options": { "type": "array" },
|
|
12
|
+
"requiredCapabilities": { "type": "array", "items": { "type": "string" } },
|
|
13
|
+
"availability": { "type": "array" },
|
|
14
|
+
"fallbacks": { "type": "array" },
|
|
15
|
+
"decisionRequired": { "type": "boolean" },
|
|
16
|
+
"machine": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"required": ["nextActions"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"nextActions": { "type": "array" },
|
|
21
|
+
"constraints": { "type": "array" },
|
|
22
|
+
"stopConditions": { "type": "array" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"presentation": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["language", "summary", "options"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"language": { "type": "string" },
|
|
30
|
+
"summary": { "type": "string" },
|
|
31
|
+
"options": { "type": "array" },
|
|
32
|
+
"warnings": { "type": "array" },
|
|
33
|
+
"explanations": { "type": "array" }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Peaks Refactor Slice Spec",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["sliceId", "functionalBoundary", "coverageRequirement", "acceptanceChecks", "commitRequired"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"sliceId": { "type": "string" },
|
|
8
|
+
"functionalBoundary": { "type": "string" },
|
|
9
|
+
"preRefactorBehavior": { "type": "string" },
|
|
10
|
+
"targetStructure": { "type": "string" },
|
|
11
|
+
"nonGoals": { "type": "array" },
|
|
12
|
+
"unitTestRequirements": { "type": "array" },
|
|
13
|
+
"coverageRequirement": { "type": "number", "minimum": 95 },
|
|
14
|
+
"acceptanceChecks": { "type": "array" },
|
|
15
|
+
"rollbackPlan": { "type": "string" },
|
|
16
|
+
"requiredArtifacts": { "type": "array" },
|
|
17
|
+
"commitRequired": { "type": "boolean", "const": true }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { rmSync } from 'node:fs';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { dirname } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
rmSync(join(packageRoot, 'dist'), { recursive: true, force: true });
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, symlinkSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
|
|
7
|
+
function getPathStats(path) {
|
|
8
|
+
try {
|
|
9
|
+
return lstatSync(path);
|
|
10
|
+
} catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function linksToSamePath(targetPath, sourcePath) {
|
|
16
|
+
try {
|
|
17
|
+
return realpathSync(targetPath) === realpathSync(sourcePath);
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function installBundledSkills(options = {}) {
|
|
24
|
+
const packageRoot = resolve(options.packageRoot ?? join(dirname(fileURLToPath(import.meta.url)), '..'));
|
|
25
|
+
const skillsRoot = join(packageRoot, 'skills');
|
|
26
|
+
const targetRoot = resolve(options.targetRoot ?? process.env.PEAKS_CLAUDE_SKILLS_DIR ?? join(homedir(), '.claude', 'skills'));
|
|
27
|
+
|
|
28
|
+
if (process.env.PEAKS_SKIP_SKILL_INSTALL === '1' || !existsSync(skillsRoot)) {
|
|
29
|
+
return { installed: [], skipped: [] };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const installed = [];
|
|
33
|
+
const skipped = [];
|
|
34
|
+
mkdirSync(targetRoot, { recursive: true });
|
|
35
|
+
|
|
36
|
+
for (const skillName of readdirSync(skillsRoot)) {
|
|
37
|
+
const sourcePath = join(skillsRoot, skillName);
|
|
38
|
+
const skillFile = join(sourcePath, 'SKILL.md');
|
|
39
|
+
const targetPath = join(targetRoot, skillName);
|
|
40
|
+
|
|
41
|
+
if (!lstatSync(sourcePath).isDirectory() || !existsSync(skillFile)) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const current = getPathStats(targetPath);
|
|
46
|
+
if (current) {
|
|
47
|
+
if (!current.isSymbolicLink() || !linksToSamePath(targetPath, sourcePath)) {
|
|
48
|
+
skipped.push(skillName);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
installed.push(skillName);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
symlinkSync(sourcePath, targetPath, process.platform === 'win32' ? 'junction' : 'dir');
|
|
56
|
+
installed.push(skillName);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { installed, skipped };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
63
|
+
try {
|
|
64
|
+
const result = installBundledSkills();
|
|
65
|
+
if (result.installed.length > 0) {
|
|
66
|
+
process.stdout.write(`Peaks skills linked: ${result.installed.join(', ')}\n`);
|
|
67
|
+
}
|
|
68
|
+
if (result.skipped.length > 0) {
|
|
69
|
+
process.stderr.write(`Peaks skills skipped because local files already exist: ${result.skipped.join(', ')}\n`);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
73
|
+
process.stderr.write(`Peaks skills were not linked: ${message}\n`);
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
}
|
|
76
|
+
}
|