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.
Files changed (143) hide show
  1. package/LICENSE +52 -0
  2. package/README.md +417 -0
  3. package/bin/peaks.js +2 -0
  4. package/dist/src/cli/cli-helpers.d.ts +25 -0
  5. package/dist/src/cli/cli-helpers.js +78 -0
  6. package/dist/src/cli/commands/capability-commands.d.ts +5 -0
  7. package/dist/src/cli/commands/capability-commands.js +46 -0
  8. package/dist/src/cli/commands/capability-worker-config-sc-commands.d.ts +3 -0
  9. package/dist/src/cli/commands/capability-worker-config-sc-commands.js +10 -0
  10. package/dist/src/cli/commands/config-commands.d.ts +3 -0
  11. package/dist/src/cli/commands/config-commands.js +212 -0
  12. package/dist/src/cli/commands/core-artifact-commands.d.ts +3 -0
  13. package/dist/src/cli/commands/core-artifact-commands.js +200 -0
  14. package/dist/src/cli/commands/sc-commands.d.ts +3 -0
  15. package/dist/src/cli/commands/sc-commands.js +37 -0
  16. package/dist/src/cli/commands/worker-commands.d.ts +3 -0
  17. package/dist/src/cli/commands/worker-commands.js +52 -0
  18. package/dist/src/cli/commands/workflow-commands.d.ts +3 -0
  19. package/dist/src/cli/commands/workflow-commands.js +257 -0
  20. package/dist/src/cli/index.d.ts +1 -0
  21. package/dist/src/cli/index.js +14 -0
  22. package/dist/src/cli/program.d.ts +4 -0
  23. package/dist/src/cli/program.js +13 -0
  24. package/dist/src/services/artifacts/artifact-service.d.ts +43 -0
  25. package/dist/src/services/artifacts/artifact-service.js +97 -0
  26. package/dist/src/services/artifacts/workspace-service.d.ts +33 -0
  27. package/dist/src/services/artifacts/workspace-service.js +254 -0
  28. package/dist/src/services/config/config-service.d.ts +29 -0
  29. package/dist/src/services/config/config-service.js +501 -0
  30. package/dist/src/services/config/config-types.d.ts +63 -0
  31. package/dist/src/services/config/config-types.js +16 -0
  32. package/dist/src/services/config/model-routing.d.ts +4 -0
  33. package/dist/src/services/config/model-routing.js +15 -0
  34. package/dist/src/services/doctor/doctor-service.d.ts +18 -0
  35. package/dist/src/services/doctor/doctor-service.js +68 -0
  36. package/dist/src/services/memory/project-memory-service.d.ts +79 -0
  37. package/dist/src/services/memory/project-memory-service.js +306 -0
  38. package/dist/src/services/profiles/profile-service.d.ts +6 -0
  39. package/dist/src/services/profiles/profile-service.js +19 -0
  40. package/dist/src/services/providers/minimax-provider-service.d.ts +24 -0
  41. package/dist/src/services/providers/minimax-provider-service.js +143 -0
  42. package/dist/src/services/providers/minimax-worker-service.d.ts +21 -0
  43. package/dist/src/services/providers/minimax-worker-service.js +80 -0
  44. package/dist/src/services/proxy/proxy-service.d.ts +7 -0
  45. package/dist/src/services/proxy/proxy-service.js +31 -0
  46. package/dist/src/services/rd/rd-service.d.ts +88 -0
  47. package/dist/src/services/rd/rd-service.js +370 -0
  48. package/dist/src/services/recommendations/capability-availability.d.ts +5 -0
  49. package/dist/src/services/recommendations/capability-availability.js +40 -0
  50. package/dist/src/services/recommendations/capability-map-service.d.ts +7 -0
  51. package/dist/src/services/recommendations/capability-map-service.js +131 -0
  52. package/dist/src/services/recommendations/capability-seed-items.d.ts +2 -0
  53. package/dist/src/services/recommendations/capability-seed-items.js +131 -0
  54. package/dist/src/services/recommendations/capability-seed-mappings.d.ts +2 -0
  55. package/dist/src/services/recommendations/capability-seed-mappings.js +42 -0
  56. package/dist/src/services/recommendations/capability-seed-sources.d.ts +2 -0
  57. package/dist/src/services/recommendations/capability-seed-sources.js +35 -0
  58. package/dist/src/services/recommendations/recommendation-service.d.ts +8 -0
  59. package/dist/src/services/recommendations/recommendation-service.js +106 -0
  60. package/dist/src/services/recommendations/recommendation-types.d.ts +129 -0
  61. package/dist/src/services/recommendations/recommendation-types.js +1 -0
  62. package/dist/src/services/recommendations/seed-capability-catalog.d.ts +3 -0
  63. package/dist/src/services/recommendations/seed-capability-catalog.js +3 -0
  64. package/dist/src/services/refactor/refactor-service.d.ts +9 -0
  65. package/dist/src/services/refactor/refactor-service.js +33 -0
  66. package/dist/src/services/sc/index.d.ts +1 -0
  67. package/dist/src/services/sc/index.js +1 -0
  68. package/dist/src/services/sc/sc-service.d.ts +79 -0
  69. package/dist/src/services/sc/sc-service.js +223 -0
  70. package/dist/src/services/skills/skill-registry.d.ts +17 -0
  71. package/dist/src/services/skills/skill-registry.js +40 -0
  72. package/dist/src/services/standards/project-standards-service.d.ts +82 -0
  73. package/dist/src/services/standards/project-standards-service.js +383 -0
  74. package/dist/src/services/tech/tech-service.d.ts +69 -0
  75. package/dist/src/services/tech/tech-service.js +236 -0
  76. package/dist/src/services/workflow/workflow-autonomous-service.d.ts +99 -0
  77. package/dist/src/services/workflow/workflow-autonomous-service.js +526 -0
  78. package/dist/src/services/workflow/workflow-router-service.d.ts +85 -0
  79. package/dist/src/services/workflow/workflow-router-service.js +213 -0
  80. package/dist/src/shared/change-id.d.ts +15 -0
  81. package/dist/src/shared/change-id.js +76 -0
  82. package/dist/src/shared/frontmatter.d.ts +6 -0
  83. package/dist/src/shared/frontmatter.js +47 -0
  84. package/dist/src/shared/fs-utils.d.ts +4 -0
  85. package/dist/src/shared/fs-utils.js +16 -0
  86. package/dist/src/shared/fs.d.ts +4 -0
  87. package/dist/src/shared/fs.js +26 -0
  88. package/dist/src/shared/path-utils.d.ts +13 -0
  89. package/dist/src/shared/path-utils.js +56 -0
  90. package/dist/src/shared/paths.d.ts +6 -0
  91. package/dist/src/shared/paths.js +40 -0
  92. package/dist/src/shared/planner-response.d.ts +21 -0
  93. package/dist/src/shared/planner-response.js +26 -0
  94. package/dist/src/shared/platform.d.ts +6 -0
  95. package/dist/src/shared/platform.js +11 -0
  96. package/dist/src/shared/process.d.ts +5 -0
  97. package/dist/src/shared/process.js +12 -0
  98. package/dist/src/shared/result.d.ts +13 -0
  99. package/dist/src/shared/result.js +32 -0
  100. package/package.json +49 -0
  101. package/schemas/approval-record.schema.json +14 -0
  102. package/schemas/artifact-manifest.schema.json +16 -0
  103. package/schemas/artifact-retention-report.schema.json +17 -0
  104. package/schemas/artifact-workspace.schema.json +22 -0
  105. package/schemas/capability-availability.schema.json +36 -0
  106. package/schemas/capability-item.schema.json +37 -0
  107. package/schemas/capability-source.schema.json +30 -0
  108. package/schemas/change-impact.schema.json +15 -0
  109. package/schemas/context-capsule.schema.json +16 -0
  110. package/schemas/recommendation-plan.schema.json +37 -0
  111. package/schemas/refactor-slice-spec.schema.json +19 -0
  112. package/scripts/clean-dist.mjs +8 -0
  113. package/scripts/install-skills.mjs +76 -0
  114. package/scripts/watch.mjs +389 -0
  115. package/skills/peaks-prd/SKILL.md +42 -0
  116. package/skills/peaks-prd/references/artifact-contracts.md +3 -0
  117. package/skills/peaks-prd/references/command-migration.md +3 -0
  118. package/skills/peaks-prd/references/workflow.md +11 -0
  119. package/skills/peaks-qa/SKILL.md +45 -0
  120. package/skills/peaks-qa/references/artifact-contracts.md +3 -0
  121. package/skills/peaks-qa/references/command-migration.md +3 -0
  122. package/skills/peaks-qa/references/regression-gates.md +16 -0
  123. package/skills/peaks-rd/SKILL.md +56 -0
  124. package/skills/peaks-rd/references/artifact-contracts.md +3 -0
  125. package/skills/peaks-rd/references/command-migration.md +3 -0
  126. package/skills/peaks-rd/references/refactor-workflow.md +31 -0
  127. package/skills/peaks-sc/SKILL.md +30 -0
  128. package/skills/peaks-sc/references/artifact-contracts.md +3 -0
  129. package/skills/peaks-sc/references/artifact-retention.md +14 -0
  130. package/skills/peaks-sc/references/command-migration.md +3 -0
  131. package/skills/peaks-solo/SKILL.md +63 -0
  132. package/skills/peaks-solo/references/artifact-contracts.md +3 -0
  133. package/skills/peaks-solo/references/command-migration.md +3 -0
  134. package/skills/peaks-solo/references/refactor-mode.md +22 -0
  135. package/skills/peaks-solo/references/workflow.md +14 -0
  136. package/skills/peaks-txt/SKILL.md +48 -0
  137. package/skills/peaks-txt/references/artifact-contracts.md +3 -0
  138. package/skills/peaks-txt/references/command-migration.md +3 -0
  139. package/skills/peaks-txt/references/context-capsule.md +20 -0
  140. package/skills/peaks-ui/SKILL.md +35 -0
  141. package/skills/peaks-ui/references/artifact-contracts.md +3 -0
  142. package/skills/peaks-ui/references/command-migration.md +3 -0
  143. package/skills/peaks-ui/references/workflow.md +11 -0
@@ -0,0 +1,79 @@
1
+ export type ChangeImpact = {
2
+ changeId: string;
3
+ sourceArtifacts: string[];
4
+ affectedModules: string[];
5
+ affectedFiles: string[];
6
+ qaImpact: {
7
+ coverageDelta: number | null;
8
+ testCount: number;
9
+ status: 'passed' | 'failed' | 'unknown';
10
+ };
11
+ riskImpact: {
12
+ level: 'low' | 'medium' | 'high';
13
+ factors: string[];
14
+ };
15
+ syncPointers: {
16
+ artifactRepo: string | null;
17
+ lastSync: string | null;
18
+ localPath: string;
19
+ };
20
+ };
21
+ export type ArtifactRetentionReport = {
22
+ sliceId: string;
23
+ prdArtifacts: string[];
24
+ rdArtifacts: string[];
25
+ qaArtifacts: string[];
26
+ coverageArtifacts: string[];
27
+ reviewArtifacts: string[];
28
+ codeChanges: string[];
29
+ commitStatus: 'committed' | 'pending' | 'rolled-back';
30
+ rollbackPoint: string | null;
31
+ };
32
+ export type ChangeTraceabilityStatus = {
33
+ changeId: string | null;
34
+ hasArtifactRepo: boolean;
35
+ artifactSyncStatus: 'synced' | 'pending' | 'out-of-sync' | 'unknown';
36
+ localArtifactPath: string;
37
+ requiredArtifacts: {
38
+ name: string;
39
+ path: string;
40
+ exists: boolean;
41
+ }[];
42
+ nextActions: string[];
43
+ };
44
+ export type CommitBoundary = {
45
+ sliceId: string;
46
+ commitHash: string | null;
47
+ timestamp: string;
48
+ artifacts: string[];
49
+ codeFiles: string[];
50
+ syncState: 'synced' | 'pending' | 'failed';
51
+ rollbackPoint: string | null;
52
+ };
53
+ export declare function getChangeTraceabilityStatus(): ChangeTraceabilityStatus;
54
+ export declare function createChangeImpact(options: {
55
+ changeId: string;
56
+ sourceArtifacts?: string[];
57
+ affectedModules?: string[];
58
+ affectedFiles?: string[];
59
+ }): ChangeImpact;
60
+ export declare function createArtifactRetentionReport(options: {
61
+ sliceId: string;
62
+ prdArtifacts?: string[];
63
+ rdArtifacts?: string[];
64
+ qaArtifacts?: string[];
65
+ coverageArtifacts?: string[];
66
+ reviewArtifacts?: string[];
67
+ codeChanges?: string[];
68
+ }): ArtifactRetentionReport;
69
+ export declare function recordCommitBoundary(options: {
70
+ sliceId: string;
71
+ artifacts?: string[];
72
+ codeFiles?: string[];
73
+ }): CommitBoundary;
74
+ export declare function validateArtifactRetention(sliceId: string): {
75
+ valid: boolean;
76
+ missingArtifacts: string[];
77
+ warnings: string[];
78
+ };
79
+ export declare function getScHelpText(): string[];
@@ -0,0 +1,223 @@
1
+ import { existsSync, lstatSync, readFileSync, realpathSync } from 'node:fs';
2
+ import { execFileSync } from 'node:child_process';
3
+ import { basename, relative, resolve } from 'node:path';
4
+ import { getCurrentWorkspaceConfig } from '../config/config-service.js';
5
+ import { getArtifactWorkspaceStatus, getLocalArtifactPath } from '../artifacts/workspace-service.js';
6
+ const REQUIRED_ARTIFACTS = [
7
+ { name: 'artifact-retention-report.md', path: ['qa', 'artifact-retention-report.md'] },
8
+ { name: 'change-impact.json', path: ['sc', 'change-impact.json'] },
9
+ { name: 'commit-boundary.md', path: ['checkpoints', 'commit-boundary.md'] },
10
+ { name: 'coverage-report.md', path: ['qa', 'coverage-report.md'] }
11
+ ];
12
+ const RETENTION_REQUIREMENTS = [
13
+ ['product', 'prd.md'],
14
+ ['architecture', 'slice-spec.md'],
15
+ ['qa', 'validation-report.md'],
16
+ ['qa', 'coverage-report.md'],
17
+ ['review', 'code-review.md']
18
+ ];
19
+ const SLICE_ID_PATTERN = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
20
+ function getPeaksPath(workspaceRoot) {
21
+ return resolve(workspaceRoot, '.peaks');
22
+ }
23
+ function resolveCurrentChangeId(peaksPath) {
24
+ const currentChangePath = resolve(peaksPath, 'current-change');
25
+ if (!existsSync(currentChangePath))
26
+ return null;
27
+ try {
28
+ const stat = lstatSync(currentChangePath);
29
+ if (stat.isSymbolicLink()) {
30
+ return basename(realpathSync(currentChangePath));
31
+ }
32
+ const raw = readFileSync(currentChangePath, 'utf-8').trim();
33
+ if (!raw)
34
+ return null;
35
+ return basename(raw);
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ function getArtifactRepoUrl(artifactRepo) {
42
+ if (!artifactRepo)
43
+ return null;
44
+ if (artifactRepo.provider === 'github') {
45
+ return `https://github.com/${artifactRepo.owner}/${artifactRepo.name}.git`;
46
+ }
47
+ return `https://gitlab.com/${artifactRepo.owner}/${artifactRepo.name}.git`;
48
+ }
49
+ function getCurrentCommitHash(workspaceRoot) {
50
+ if (!workspaceRoot)
51
+ return null;
52
+ try {
53
+ return execFileSync('git', ['rev-parse', 'HEAD'], { cwd: workspaceRoot, encoding: 'utf-8' }).trim();
54
+ }
55
+ catch {
56
+ return null;
57
+ }
58
+ }
59
+ function mapSyncState(syncStatus) {
60
+ if (syncStatus === 'synced')
61
+ return 'synced';
62
+ if (syncStatus === 'pending')
63
+ return 'pending';
64
+ return 'failed';
65
+ }
66
+ function getCurrentArtifactDir(workspaceRoot) {
67
+ const peaksPath = getPeaksPath(workspaceRoot);
68
+ const changeId = resolveCurrentChangeId(peaksPath);
69
+ const effectiveChangeId = changeId ?? 'unknown-change';
70
+ return {
71
+ peaksPath,
72
+ changeId,
73
+ changeDir: resolve(peaksPath, 'changes', effectiveChangeId)
74
+ };
75
+ }
76
+ function getRetentionChangeDir(workspaceRoot, sliceId) {
77
+ const peaksPath = getPeaksPath(workspaceRoot);
78
+ return {
79
+ peaksPath,
80
+ changeId: sliceId,
81
+ changeDir: resolve(peaksPath, 'changes', sliceId)
82
+ };
83
+ }
84
+ export function getChangeTraceabilityStatus() {
85
+ const workspace = getCurrentWorkspaceConfig();
86
+ const artifactStatus = getArtifactWorkspaceStatus(workspace?.workspaceId);
87
+ if (!workspace) {
88
+ return {
89
+ changeId: null,
90
+ hasArtifactRepo: false,
91
+ artifactSyncStatus: 'unknown',
92
+ localArtifactPath: '.peaks-artifacts',
93
+ requiredArtifacts: REQUIRED_ARTIFACTS.map((artifact) => ({
94
+ name: artifact.name,
95
+ path: resolve('.peaks', 'changes', '<change-id>', ...artifact.path),
96
+ exists: false
97
+ })),
98
+ nextActions: ['Add a workspace: peaks config workspace add --id <id> --name <name> --path <path>']
99
+ };
100
+ }
101
+ const { peaksPath, changeId, changeDir } = getCurrentArtifactDir(workspace.rootPath);
102
+ const hasArtifactRepo = Boolean(workspace.artifactRepo);
103
+ const requiredArtifacts = REQUIRED_ARTIFACTS.map((artifact) => {
104
+ const artifactPath = resolve(changeDir, ...artifact.path);
105
+ return {
106
+ name: artifact.name,
107
+ path: resolve(peaksPath, 'changes', changeId ?? '<change-id>', ...artifact.path),
108
+ exists: existsSync(artifactPath)
109
+ };
110
+ });
111
+ const nextActions = [];
112
+ if (!changeId) {
113
+ nextActions.push('Set the current change in .peaks/current-change');
114
+ }
115
+ if (!hasArtifactRepo) {
116
+ nextActions.push('Configure artifact repo: peaks config workspace add --id <id> --provider github --repo-owner <owner> --repo-name <name>');
117
+ nextActions.push('Then run: peaks artifacts init --provider github --name <repo> --dry-run');
118
+ }
119
+ else if (artifactStatus.syncStatus === 'pending') {
120
+ nextActions.push(`Run peaks artifacts sync --workspace ${workspace.workspaceId} --dry-run`);
121
+ }
122
+ return {
123
+ changeId,
124
+ hasArtifactRepo,
125
+ artifactSyncStatus: artifactStatus.syncStatus,
126
+ localArtifactPath: getLocalArtifactPath(workspace),
127
+ requiredArtifacts,
128
+ nextActions
129
+ };
130
+ }
131
+ export function createChangeImpact(options) {
132
+ const workspace = getCurrentWorkspaceConfig();
133
+ const artifactRepo = workspace?.artifactRepo ?? null;
134
+ return {
135
+ changeId: options.changeId,
136
+ sourceArtifacts: options.sourceArtifacts ?? [],
137
+ affectedModules: options.affectedModules ?? [],
138
+ affectedFiles: options.affectedFiles ?? [],
139
+ qaImpact: {
140
+ coverageDelta: null,
141
+ testCount: 0,
142
+ status: 'unknown'
143
+ },
144
+ riskImpact: {
145
+ level: 'medium',
146
+ factors: ['Manual review required', 'No automated gates detected']
147
+ },
148
+ syncPointers: {
149
+ artifactRepo: getArtifactRepoUrl(artifactRepo ?? undefined),
150
+ lastSync: null,
151
+ localPath: workspace ? getLocalArtifactPath(workspace) : '.peaks-artifacts'
152
+ }
153
+ };
154
+ }
155
+ export function createArtifactRetentionReport(options) {
156
+ return {
157
+ sliceId: options.sliceId,
158
+ prdArtifacts: options.prdArtifacts ?? [],
159
+ rdArtifacts: options.rdArtifacts ?? [],
160
+ qaArtifacts: options.qaArtifacts ?? [],
161
+ coverageArtifacts: options.coverageArtifacts ?? [],
162
+ reviewArtifacts: options.reviewArtifacts ?? [],
163
+ codeChanges: options.codeChanges ?? [],
164
+ commitStatus: 'pending',
165
+ rollbackPoint: null
166
+ };
167
+ }
168
+ export function recordCommitBoundary(options) {
169
+ const workspace = getCurrentWorkspaceConfig();
170
+ const artifactStatus = getArtifactWorkspaceStatus(workspace?.workspaceId);
171
+ const commitHash = getCurrentCommitHash(workspace?.rootPath);
172
+ return {
173
+ sliceId: options.sliceId,
174
+ commitHash,
175
+ timestamp: new Date().toISOString(),
176
+ artifacts: options.artifacts ?? [],
177
+ codeFiles: options.codeFiles ?? [],
178
+ syncState: mapSyncState(artifactStatus.syncStatus),
179
+ rollbackPoint: commitHash
180
+ };
181
+ }
182
+ export function validateArtifactRetention(sliceId) {
183
+ const workspace = getCurrentWorkspaceConfig();
184
+ if (!workspace) {
185
+ return {
186
+ valid: false,
187
+ missingArtifacts: ['No workspace configured'],
188
+ warnings: ['Cannot validate without a configured workspace']
189
+ };
190
+ }
191
+ if (!SLICE_ID_PATTERN.test(sliceId)) {
192
+ return {
193
+ valid: false,
194
+ missingArtifacts: ['Invalid slice id'],
195
+ warnings: ['Slice id must stay inside .peaks/changes and only contain letters, numbers, dots, underscores, or hyphens']
196
+ };
197
+ }
198
+ const { changeDir } = getRetentionChangeDir(workspace.rootPath, sliceId);
199
+ const missingArtifacts = RETENTION_REQUIREMENTS
200
+ .map(([folder, file]) => resolve(changeDir, folder, file))
201
+ .filter((filePath) => !existsSync(filePath))
202
+ .map((filePath) => relative(changeDir, filePath).replace(/\\/g, '/'));
203
+ return {
204
+ valid: missingArtifacts.length === 0,
205
+ missingArtifacts,
206
+ warnings: missingArtifacts.length === 0 ? [] : ['Some required artifact files are missing']
207
+ };
208
+ }
209
+ export function getScHelpText() {
210
+ return [
211
+ 'peaks sc status Show change traceability status',
212
+ 'peaks sc impact --change-id <id> Generate change impact artifact',
213
+ 'peaks sc retention --slice-id <id> Create artifact retention report',
214
+ 'peaks sc validate --slice-id <id> Validate artifact retention',
215
+ 'peaks sc boundary --slice-id <id> Record commit boundary for slice',
216
+ '',
217
+ 'Change traceability workflow integration:',
218
+ ' 1. Run peaks sc status to check current state',
219
+ ' 2. After slice completion, run peaks sc retention --slice-id <id>',
220
+ ' 3. Artifact sync is automatic when artifact repo is configured',
221
+ ' 4. Commit boundary is recorded when code is committed'
222
+ ];
223
+ }
@@ -0,0 +1,17 @@
1
+ export type SkillMetadata = {
2
+ name: string;
3
+ description: string;
4
+ directory: string;
5
+ skillPath: string;
6
+ };
7
+ export type SkillLoadFailure = {
8
+ directory: string;
9
+ skillPath: string;
10
+ message: string;
11
+ };
12
+ export type SkillRegistryResult = {
13
+ skills: SkillMetadata[];
14
+ failures: SkillLoadFailure[];
15
+ };
16
+ export declare function loadSkillRegistry(baseDir?: string): Promise<SkillRegistryResult>;
17
+ export declare function listSkills(baseDir?: string): Promise<SkillMetadata[]>;
@@ -0,0 +1,40 @@
1
+ import { join } from 'node:path';
2
+ import { listDirectories, pathExists, readText } from '../../shared/fs.js';
3
+ import { parseFrontmatter } from '../../shared/frontmatter.js';
4
+ import { skillsDir } from '../../shared/paths.js';
5
+ function getLoadFailureMessage(error) {
6
+ return error instanceof Error ? error.message : 'Unable to parse skill metadata';
7
+ }
8
+ export async function loadSkillRegistry(baseDir = skillsDir) {
9
+ if (!(await pathExists(baseDir))) {
10
+ return { skills: [], failures: [] };
11
+ }
12
+ const directories = await listDirectories(baseDir);
13
+ const skills = [];
14
+ const failures = [];
15
+ for (const directory of directories) {
16
+ const skillPath = join(baseDir, directory, 'SKILL.md');
17
+ if (!(await pathExists(skillPath))) {
18
+ continue;
19
+ }
20
+ try {
21
+ const frontmatter = parseFrontmatter(await readText(skillPath));
22
+ skills.push({
23
+ name: frontmatter.name,
24
+ description: frontmatter.description,
25
+ directory,
26
+ skillPath
27
+ });
28
+ }
29
+ catch (error) {
30
+ failures.push({ directory, skillPath, message: getLoadFailureMessage(error) });
31
+ }
32
+ }
33
+ return {
34
+ skills: skills.sort((left, right) => left.name.localeCompare(right.name)),
35
+ failures: failures.sort((left, right) => left.directory.localeCompare(right.directory))
36
+ };
37
+ }
38
+ export async function listSkills(baseDir = skillsDir) {
39
+ return (await loadSkillRegistry(baseDir)).skills;
40
+ }
@@ -0,0 +1,82 @@
1
+ export type StandardsLanguage = 'generic' | 'typescript' | 'javascript' | 'python' | 'go' | 'rust';
2
+ export type StandardsWriteStatus = 'planned' | 'existing' | 'written' | 'appended' | 'review';
3
+ export type StandardsWrite = {
4
+ readonly relativePath: string;
5
+ readonly filePath: string;
6
+ readonly content: string;
7
+ readonly status: StandardsWriteStatus;
8
+ };
9
+ export type ProjectStandardsSource = {
10
+ readonly sourceId: 'everything-claude-code';
11
+ readonly url: 'https://github.com/affaan-m/everything-claude-code';
12
+ readonly usage: 'curated-baseline-reference';
13
+ };
14
+ export type StandardsSkillPreflight = {
15
+ readonly appliesTo: readonly ['peaks-rd', 'peaks-qa', 'peaks-solo'];
16
+ readonly summary: string;
17
+ };
18
+ export type ProjectStandardsInitPlan = {
19
+ readonly apply: boolean;
20
+ readonly projectRoot: string;
21
+ readonly language: StandardsLanguage;
22
+ readonly source: ProjectStandardsSource;
23
+ readonly skillPreflight: StandardsSkillPreflight;
24
+ readonly plannedWrites: StandardsWrite[];
25
+ };
26
+ export type ProjectStandardsInitResult = ProjectStandardsInitPlan & {
27
+ readonly writtenFiles: string[];
28
+ };
29
+ export type ProjectStandardsInitSummary = {
30
+ readonly apply: boolean;
31
+ readonly projectRoot: string;
32
+ readonly language: StandardsLanguage;
33
+ readonly source: ProjectStandardsSource;
34
+ readonly skillPreflight: StandardsSkillPreflight;
35
+ readonly plannedWrites: Array<Pick<StandardsWrite, 'relativePath' | 'status'>>;
36
+ readonly writtenFiles: string[];
37
+ readonly skippedFiles: string[];
38
+ };
39
+ export type ProjectStandardsUpdatePlan = ProjectStandardsInitPlan & {
40
+ readonly claudeMd: {
41
+ readonly relativePath: 'CLAUDE.md';
42
+ readonly filePath: string;
43
+ readonly status: StandardsWriteStatus;
44
+ readonly content: string;
45
+ readonly appendBlock: string;
46
+ readonly reviewSuggestions: string[];
47
+ };
48
+ };
49
+ export type ProjectStandardsUpdateResult = ProjectStandardsUpdatePlan & {
50
+ readonly writtenFiles: string[];
51
+ readonly appendedFiles: string[];
52
+ readonly reviewSuggestions: string[];
53
+ };
54
+ export type ProjectStandardsUpdateSummary = {
55
+ readonly apply: boolean;
56
+ readonly projectRoot: string;
57
+ readonly language: StandardsLanguage;
58
+ readonly source: ProjectStandardsSource;
59
+ readonly skillPreflight: StandardsSkillPreflight;
60
+ readonly plannedWrites: Array<Pick<StandardsWrite, 'relativePath' | 'status'>>;
61
+ readonly writtenFiles: string[];
62
+ readonly appendedFiles: string[];
63
+ readonly skippedFiles: string[];
64
+ readonly reviewSuggestions: string[];
65
+ readonly claudeMd: {
66
+ readonly relativePath: 'CLAUDE.md';
67
+ readonly status: StandardsWriteStatus;
68
+ readonly reviewSuggestions: string[];
69
+ };
70
+ };
71
+ type ProjectStandardsInitOptions = {
72
+ readonly projectRoot: string;
73
+ readonly language?: string;
74
+ readonly apply?: boolean;
75
+ };
76
+ export declare function createProjectStandardsInitPlan(options: ProjectStandardsInitOptions): ProjectStandardsInitPlan;
77
+ export declare function createProjectStandardsUpdatePlan(options: ProjectStandardsInitOptions): ProjectStandardsUpdatePlan;
78
+ export declare function executeProjectStandardsInit(options: ProjectStandardsInitOptions): ProjectStandardsInitResult;
79
+ export declare function executeProjectStandardsUpdate(options: ProjectStandardsInitOptions): ProjectStandardsUpdateResult;
80
+ export declare function summarizeProjectStandardsInitResult(result: ProjectStandardsInitResult): ProjectStandardsInitSummary;
81
+ export declare function summarizeProjectStandardsUpdateResult(result: ProjectStandardsUpdateResult): ProjectStandardsUpdateSummary;
82
+ export {};