peaks-cli 1.0.26 → 1.0.27
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/bin/peaks.js +0 -0
- package/dist/src/cli/commands/core-artifact-commands.js +5 -4
- package/dist/src/cli/commands/workflow-commands.js +5 -2
- package/dist/src/services/config/config-safety.js +14 -4
- package/dist/src/services/skills/skill-presence-service.js +6 -2
- package/dist/src/shared/change-id.js +4 -2
- package/dist/src/shared/version.d.ts +1 -1
- package/dist/src/shared/version.js +1 -1
- package/package.json +2 -2
package/bin/peaks.js
CHANGED
|
File without changes
|
|
@@ -9,6 +9,7 @@ import { listSkills } from '../../services/skills/skill-registry.js';
|
|
|
9
9
|
import { inspectSkillRunbook } from '../../services/skills/skill-runbook-service.js';
|
|
10
10
|
import { setSkillPresence, clearSkillPresence, getSkillPresence, isSkillPresenceMode, touchSkillHeartbeat } from '../../services/skills/skill-presence-service.js';
|
|
11
11
|
import { ensureSession, getSessionMeta, setSessionMeta, setSessionTitle, listSessionMetas } from '../../services/session/session-manager.js';
|
|
12
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
12
13
|
import { fail, ok } from '../../shared/result.js';
|
|
13
14
|
import { addJsonOption, failUnsupportedNonDryRun, getErrorMessage, isArtifactProvider, isArtifactSetupStep, printResult } from '../cli-helpers.js';
|
|
14
15
|
export function registerCoreAndArtifactCommands(program, io) {
|
|
@@ -80,7 +81,7 @@ export function registerCoreAndArtifactCommands(program, io) {
|
|
|
80
81
|
}
|
|
81
82
|
const presence = setSkillPresence(name, options.mode, options.gate);
|
|
82
83
|
// Also update session metadata so session dirs self-document
|
|
83
|
-
const projectRoot = process.cwd();
|
|
84
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
84
85
|
const sessionId = await ensureSession(projectRoot);
|
|
85
86
|
setSessionMeta(projectRoot, sessionId, {
|
|
86
87
|
skill: name,
|
|
@@ -129,14 +130,14 @@ export function registerCoreAndArtifactCommands(program, io) {
|
|
|
129
130
|
addJsonOption(session
|
|
130
131
|
.command('list')
|
|
131
132
|
.description('List all session directories with titles and metadata')).action((options) => {
|
|
132
|
-
const projectRoot = process.cwd();
|
|
133
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
133
134
|
const metas = listSessionMetas(projectRoot);
|
|
134
135
|
printResult(io, ok('session.list', { sessions: metas, total: metas.length }), options.json);
|
|
135
136
|
});
|
|
136
137
|
addJsonOption(session
|
|
137
138
|
.command('info <sessionId>')
|
|
138
139
|
.description('Show full metadata for a session directory')).action((sessionId, options) => {
|
|
139
|
-
const projectRoot = process.cwd();
|
|
140
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
140
141
|
const meta = getSessionMeta(projectRoot, sessionId);
|
|
141
142
|
if (meta === null) {
|
|
142
143
|
printResult(io, fail('session.info', 'SESSION_NOT_FOUND', `Session "${sessionId}" not found or has no metadata`, { sessionId }, ['Use `peaks session list` to see available sessions']), options.json);
|
|
@@ -148,7 +149,7 @@ export function registerCoreAndArtifactCommands(program, io) {
|
|
|
148
149
|
addJsonOption(session
|
|
149
150
|
.command('title <sessionId> <title>')
|
|
150
151
|
.description('Set a human-readable title for a session directory')).action((sessionId, title, options) => {
|
|
151
|
-
const projectRoot = process.cwd();
|
|
152
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
152
153
|
try {
|
|
153
154
|
const meta = setSessionTitle(projectRoot, sessionId, title);
|
|
154
155
|
printResult(io, ok('session.title', meta), options.json);
|
|
@@ -10,12 +10,14 @@ import { validateChangeIdOrThrow } from '../../shared/change-id.js';
|
|
|
10
10
|
import { getEconomyAwareExecutionModelId } from '../../services/config/model-routing.js';
|
|
11
11
|
import { getLocalArtifactPath } from '../../services/artifacts/workspace-service.js';
|
|
12
12
|
import { getSessionId } from '../../services/session/session-manager.js';
|
|
13
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
13
14
|
import { verifyPipeline } from '../../services/workflow/pipeline-verify-service.js';
|
|
14
15
|
import { fail, ok } from '../../shared/result.js';
|
|
15
16
|
import { addJsonOption, failUnsupportedNonDryRun, getErrorMessage, isRecommendationWorkflow, printResult } from '../cli-helpers.js';
|
|
16
17
|
function getCurrentWorkspaceContext() {
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
20
|
+
const sessionId = getSessionId(projectRoot);
|
|
19
21
|
return sessionId ? { sessionId, sessionDir: `.peaks/${sessionId}` } : {};
|
|
20
22
|
}
|
|
21
23
|
catch {
|
|
@@ -24,7 +26,8 @@ function getCurrentWorkspaceContext() {
|
|
|
24
26
|
}
|
|
25
27
|
function getWorkflowWorkspaceContext() {
|
|
26
28
|
try {
|
|
27
|
-
const
|
|
29
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
30
|
+
const workspace = getWorkspaceConfigForPath(projectRoot);
|
|
28
31
|
if (!workspace)
|
|
29
32
|
return {};
|
|
30
33
|
return { workspace, artifactWorkspacePath: getLocalArtifactPath(workspace) };
|
|
@@ -50,34 +50,44 @@ export function findProjectRoot(startPath) {
|
|
|
50
50
|
const homeBoundaryPaths = getHomeBoundaryPaths();
|
|
51
51
|
let current = resolve(startPath);
|
|
52
52
|
let parent = dirname(current);
|
|
53
|
+
let pkgRoot = null;
|
|
53
54
|
while (current !== parent && !homeBoundaryPaths.has(normalizeBoundaryPath(current))) {
|
|
54
55
|
if (existsSync(resolve(current, '.peaks', 'config.json')) && isSafeProjectConfigMarker(current)) {
|
|
55
56
|
return current;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
// .git is the definitive project root — return immediately
|
|
59
|
+
if (existsSync(resolve(current, '.git'))) {
|
|
58
60
|
return current;
|
|
59
61
|
}
|
|
62
|
+
// package.json alone is ambiguous in monorepos — keep walking up for .git
|
|
63
|
+
if (pkgRoot === null && existsSync(resolve(current, 'package.json'))) {
|
|
64
|
+
pkgRoot = current;
|
|
65
|
+
}
|
|
60
66
|
parent = current;
|
|
61
67
|
current = dirname(parent);
|
|
62
68
|
}
|
|
63
|
-
return
|
|
69
|
+
return pkgRoot;
|
|
64
70
|
}
|
|
65
71
|
export function resolveProjectRootForConfig(startPath) {
|
|
66
72
|
const start = resolve(startPath);
|
|
67
73
|
const homeBoundaryPaths = getHomeBoundaryPaths();
|
|
68
74
|
let current = start;
|
|
69
75
|
let parent = dirname(current);
|
|
76
|
+
let pkgRoot = null;
|
|
70
77
|
while (current !== parent && !homeBoundaryPaths.has(normalizeBoundaryPath(current))) {
|
|
71
78
|
if (existsSync(resolve(current, '.peaks', 'config.json')) && isSafeProjectConfigMarker(current)) {
|
|
72
79
|
return current;
|
|
73
80
|
}
|
|
74
|
-
if (existsSync(resolve(current, '
|
|
81
|
+
if (existsSync(resolve(current, '.git'))) {
|
|
75
82
|
return current;
|
|
76
83
|
}
|
|
84
|
+
if (pkgRoot === null && existsSync(resolve(current, 'package.json'))) {
|
|
85
|
+
pkgRoot = current;
|
|
86
|
+
}
|
|
77
87
|
parent = current;
|
|
78
88
|
current = dirname(parent);
|
|
79
89
|
}
|
|
80
|
-
return start;
|
|
90
|
+
return pkgRoot ?? start;
|
|
81
91
|
}
|
|
82
92
|
export function getProjectConfigPath(projectRoot) {
|
|
83
93
|
if (!projectRoot)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { findProjectRoot } from '../config/config-safety.js';
|
|
3
4
|
export const VALID_SKILL_PRESENCE_MODES = [
|
|
4
5
|
'full-auto',
|
|
5
6
|
'assisted',
|
|
@@ -11,11 +12,14 @@ export function isSkillPresenceMode(value) {
|
|
|
11
12
|
}
|
|
12
13
|
const PRESENCE_FILE = '.peaks/.active-skill.json';
|
|
13
14
|
const SESSION_FILE = '.peaks/.session.json';
|
|
15
|
+
function resolveProjectRoot() {
|
|
16
|
+
return findProjectRoot(process.cwd()) ?? process.cwd();
|
|
17
|
+
}
|
|
14
18
|
function resolvePresencePath() {
|
|
15
|
-
return resolve(
|
|
19
|
+
return resolve(resolveProjectRoot(), PRESENCE_FILE);
|
|
16
20
|
}
|
|
17
21
|
function getCurrentSessionId() {
|
|
18
|
-
const sessionPath = resolve(
|
|
22
|
+
const sessionPath = resolve(resolveProjectRoot(), SESSION_FILE);
|
|
19
23
|
if (!existsSync(sessionPath))
|
|
20
24
|
return null;
|
|
21
25
|
try {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { posix, join } from 'node:path';
|
|
7
7
|
import { getNextNumber, buildNumberedFilename } from './incrementing-number.js';
|
|
8
8
|
import { getSessionId } from '../services/session/session-manager.js';
|
|
9
|
+
import { findProjectRoot } from '../services/config/config-safety.js';
|
|
9
10
|
const CHANGE_ID_PATTERN = /^[A-Za-z0-9._-]+$/;
|
|
10
11
|
function normalizeForwardSlashes(input) {
|
|
11
12
|
return input.replace(/\\/g, '/');
|
|
@@ -75,10 +76,11 @@ export function isUnsafeArtifactPath(path) {
|
|
|
75
76
|
*/
|
|
76
77
|
export function buildArtifactRelativePath(changeId, ...segments) {
|
|
77
78
|
validateChangeIdOrThrow(changeId);
|
|
78
|
-
const
|
|
79
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
80
|
+
const sessionId = getSessionId(projectRoot);
|
|
79
81
|
if (sessionId && segments.length > 0 && segments[0]) {
|
|
80
82
|
const role = normalizeForwardSlashes(segments[0]);
|
|
81
|
-
const dirPath = join(
|
|
83
|
+
const dirPath = join(projectRoot, '.peaks', sessionId, role);
|
|
82
84
|
if (isUnsafeArtifactPath(role) || isUnsafeArtifactPath(sessionId)) {
|
|
83
85
|
throw new ChangeIdValidationError(changeId);
|
|
84
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "1.0.
|
|
1
|
+
export declare const CLI_VERSION = "1.0.27";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "1.0.
|
|
1
|
+
export const CLI_VERSION = "1.0.27";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Peaks CLI and short skill family for Claude Code automation.",
|
|
5
5
|
"author": "SquabbyZ",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dev:watch": "node ./scripts/watch.mjs",
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"test:coverage": "vitest run --coverage",
|
|
38
|
-
"pretest:coverage": "
|
|
38
|
+
"pretest:coverage": "node ./scripts/pretest-coverage.mjs",
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|