@zhuan-ai/zhuanspec 2.11.6 → 2.11.10
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/dist/cli/hooks.js +3 -2
- package/dist/commands/progress.js +4 -3
- package/dist/core/business-assets-sync.d.ts +94 -0
- package/dist/core/business-assets-sync.js +562 -0
- package/dist/core/hooks/collect-knowledge.js +4 -1
- package/dist/core/hooks/deviation-check.js +7 -3
- package/dist/core/hooks/init.js +4 -1
- package/dist/core/hooks/record-progress.js +50 -4
- package/dist/core/task-graph/execution-planner.d.ts +17 -2
- package/dist/core/task-graph/execution-planner.js +33 -2
- package/dist/core/task-graph/integration-report-template.d.ts +30 -0
- package/dist/core/task-graph/integration-report-template.js +210 -0
- package/dist/core/task-graph/types.d.ts +73 -0
- package/dist/core/task-graph/xml-renderer.js +51 -6
- package/dist/core/templates/agents-root-stub.d.ts +1 -1
- package/dist/core/templates/agents-root-stub.js +2 -0
- package/dist/core/templates/agents-template.d.ts +1 -1
- package/dist/core/templates/agents-template.js +59 -18
- package/dist/core/templates/slash-command-templates.js +233 -69
- package/dist/core/templates/tdd-tasks-template.js +0 -4
- package/dist/core/templates/test-cases-template.d.ts +7 -0
- package/dist/core/templates/test-cases-template.js +42 -35
- package/dist/core/update.d.ts +2 -3
- package/dist/core/update.js +146 -66
- package/dist/core/validation/strict-rules.d.ts +1 -1
- package/dist/core/validation/strict-rules.js +54 -2
- package/dist/utils/item-discovery.js +4 -3
- package/dist/utils/resolve-root.d.ts +26 -0
- package/dist/utils/resolve-root.js +80 -0
- package/package.json +1 -1
package/dist/cli/hooks.js
CHANGED
|
@@ -23,6 +23,7 @@ import { postApplyHook, executePostApply } from '../core/hooks/post-apply.js';
|
|
|
23
23
|
import { codeReviewResultCheck, unitTestResultCheck, specConsistencyResultCheck, generateReviewReport, } from '../core/hooks/review-hooks.js';
|
|
24
24
|
import path from 'path';
|
|
25
25
|
import { FileSystemUtils } from '../utils/file-system.js';
|
|
26
|
+
import { resolveZhuanSpecRoot } from '../utils/resolve-root.js';
|
|
26
27
|
const program = new Command();
|
|
27
28
|
program
|
|
28
29
|
.name('zhuanspec-hook')
|
|
@@ -295,7 +296,7 @@ program
|
|
|
295
296
|
* Phase Transition Check - Unified function for phase transition validation
|
|
296
297
|
*/
|
|
297
298
|
async function runPhaseTransitionCheck(options) {
|
|
298
|
-
const cwd =
|
|
299
|
+
const cwd = resolveZhuanSpecRoot();
|
|
299
300
|
const changeId = options.change || process.env.ZHUANSPEC_CHANGE_ID || '';
|
|
300
301
|
const fromPhase = options.from || process.env.ZHUANSPEC_PHASE || 'idle';
|
|
301
302
|
const toPhase = options.to || '';
|
|
@@ -394,7 +395,7 @@ async function runPhaseTransitionCheck(options) {
|
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
async function collectHookStatus() {
|
|
397
|
-
const cwd =
|
|
398
|
+
const cwd = resolveZhuanSpecRoot();
|
|
398
399
|
const settingsPath = path.join(cwd, '.claude', 'settings.json');
|
|
399
400
|
const settingsExists = await FileSystemUtils.fileExists(settingsPath);
|
|
400
401
|
const registeredLifecycleHooks = [];
|
|
@@ -11,6 +11,7 @@ import { promises as fs } from 'fs';
|
|
|
11
11
|
import { FileSystemUtils } from '../utils/file-system.js';
|
|
12
12
|
import { PHASE_ORDER } from '../utils/phase-utils.js';
|
|
13
13
|
import { initializeProgress } from '../core/hooks/record-progress.js';
|
|
14
|
+
import { resolveZhuanSpecRoot } from '../utils/resolve-root.js';
|
|
14
15
|
export class ProgressCommand {
|
|
15
16
|
/**
|
|
16
17
|
* Recover damaged progress.json using three-tier fallback strategy
|
|
@@ -80,7 +81,7 @@ export class ProgressCommand {
|
|
|
80
81
|
* Usage: zhuanspec progress show <change-id>
|
|
81
82
|
*/
|
|
82
83
|
async show(changeId, options) {
|
|
83
|
-
const cwd =
|
|
84
|
+
const cwd = resolveZhuanSpecRoot();
|
|
84
85
|
const zhuanspecDir = path.join(cwd, 'zhuanspec');
|
|
85
86
|
const changeDir = path.join(zhuanspecDir, 'changes', changeId);
|
|
86
87
|
const metricsDir = path.join(changeDir, 'metrics');
|
|
@@ -110,7 +111,7 @@ export class ProgressCommand {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
async execute(options) {
|
|
113
|
-
const cwd =
|
|
114
|
+
const cwd = resolveZhuanSpecRoot();
|
|
114
115
|
const zhuanspecDir = path.join(cwd, 'zhuanspec');
|
|
115
116
|
// Check if zhuanspec directory exists
|
|
116
117
|
if (!await FileSystemUtils.fileExists(zhuanspecDir)) {
|
|
@@ -351,7 +352,7 @@ export class ProgressCommand {
|
|
|
351
352
|
* Usage: zhuanspec progress set-phase <change-id> <phase>
|
|
352
353
|
*/
|
|
353
354
|
async setPhase(changeId, phase) {
|
|
354
|
-
const cwd =
|
|
355
|
+
const cwd = resolveZhuanSpecRoot();
|
|
355
356
|
const changeDir = path.join(cwd, 'zhuanspec', 'changes', changeId);
|
|
356
357
|
if (!await FileSystemUtils.directoryExists(changeDir)) {
|
|
357
358
|
throw new Error(`Change '${changeId}' not found`);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export declare const ARCH_REPO_URL = "http://gitlab.zhuanspirit.com/zz-kf/spec_repo.git";
|
|
2
|
+
export declare const ARCH_REPO_BRANCH = "spec_repo-feature-6612-2";
|
|
3
|
+
export type ClaudeAssetSource = 'business' | 'common' | 'none';
|
|
4
|
+
export type FileSyncStatus = 'copied' | 'overwritten' | 'skipped-unchanged';
|
|
5
|
+
export type ClaudeAssetFileSyncResult = {
|
|
6
|
+
source: ClaudeAssetSource;
|
|
7
|
+
files: {
|
|
8
|
+
added: string[];
|
|
9
|
+
overwritten: string[];
|
|
10
|
+
skipped: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type ClaudeAssetSyncResult = {
|
|
14
|
+
claudeMd: {
|
|
15
|
+
source: ClaudeAssetSource;
|
|
16
|
+
status: FileSyncStatus | 'missing';
|
|
17
|
+
};
|
|
18
|
+
dotClaude: ClaudeAssetFileSyncResult;
|
|
19
|
+
};
|
|
20
|
+
export type SpecTemplateSyncDetail = {
|
|
21
|
+
synced: boolean;
|
|
22
|
+
added: number;
|
|
23
|
+
skipped: number;
|
|
24
|
+
};
|
|
25
|
+
export type SpecTemplateSyncResult = {
|
|
26
|
+
syncedSpecs: boolean;
|
|
27
|
+
syncedChanges: boolean;
|
|
28
|
+
syncedKnowledge: boolean;
|
|
29
|
+
specs: SpecTemplateSyncDetail;
|
|
30
|
+
changes: SpecTemplateSyncDetail;
|
|
31
|
+
knowledge: SpecTemplateSyncDetail;
|
|
32
|
+
};
|
|
33
|
+
export declare function cloneArchRepoToTemp(prefix?: string): string | null;
|
|
34
|
+
export declare function readBusinessDirection(zhuanspecPath: string): string | null;
|
|
35
|
+
export declare function resolveBusinessDirectionRoot(specsRoot: string, businessDirection: string | null): string | null;
|
|
36
|
+
export declare function findFirstDirectoryByName(searchRoot: string, targetName: string): string | null;
|
|
37
|
+
export declare function findFirstTemplateSourceRoot(searchRoot: string): string | null;
|
|
38
|
+
export declare function copyDirectoryContentsIfExists(sourceDir: string, targetDir: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Recursively copy src to dst.
|
|
41
|
+
* If the target file already exists, it is left untouched (skipped).
|
|
42
|
+
* This protects user's local modifications, used by `zhuanspec update`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function mergeDirectoryAdditive(sourceDir: string, targetDir: string): {
|
|
45
|
+
exists: boolean;
|
|
46
|
+
added: number;
|
|
47
|
+
skipped: number;
|
|
48
|
+
};
|
|
49
|
+
export declare function resolveClaudeAssetSource(businessPath: string | null, commonPath: string): {
|
|
50
|
+
source: Exclude<ClaudeAssetSource, 'none'>;
|
|
51
|
+
path: string;
|
|
52
|
+
} | null;
|
|
53
|
+
export declare function copyClaudeFileIfNeeded(sourceAsset: {
|
|
54
|
+
source: Exclude<ClaudeAssetSource, 'none'>;
|
|
55
|
+
path: string;
|
|
56
|
+
} | null, targetPath: string): {
|
|
57
|
+
source: ClaudeAssetSource;
|
|
58
|
+
status: FileSyncStatus | 'missing';
|
|
59
|
+
};
|
|
60
|
+
export declare function copyClaudeDirectoryIfNeeded(sourceAsset: {
|
|
61
|
+
source: Exclude<ClaudeAssetSource, 'none'>;
|
|
62
|
+
path: string;
|
|
63
|
+
} | null, targetPath: string): ClaudeAssetFileSyncResult;
|
|
64
|
+
export declare function copyClaudeDirectoryFromCommon(commonSourcePath: string, targetPath: string): ClaudeAssetFileSyncResult;
|
|
65
|
+
export declare function fetchRemoteArchitectureFiles(existingTempDir?: string | null): string[];
|
|
66
|
+
export declare function fetchRemoteArchitectureContent(fileName: string, existingTempDir?: string | null): string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Fetch the business architecture file content.
|
|
69
|
+
*
|
|
70
|
+
* Priority:
|
|
71
|
+
* 1. remote clone (via `existingTempDir` if provided, otherwise fresh clone)
|
|
72
|
+
* 2. `git show` from local repo at `repoCwd` (skipped when repoCwd is null)
|
|
73
|
+
* 3. direct file read from `repoCwd` (skipped when repoCwd is null)
|
|
74
|
+
*/
|
|
75
|
+
export declare function fetchArchitectureFile(businessDirection: string | null, repoCwd: string | null, existingTempDir?: string | null): Promise<string | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Sync business-scoped template directories (specs / changes / knowledge).
|
|
78
|
+
* `mode='overwrite'` preserves legacy init behavior (cpSync force:true).
|
|
79
|
+
* `mode='additive'` only creates missing files (used by `zhuanspec update`).
|
|
80
|
+
*/
|
|
81
|
+
export declare function syncBusinessSpecTemplate(zhuanspecPath: string, businessDirection: string | null, mode?: 'overwrite' | 'additive', existingTempDir?: string | null): SpecTemplateSyncResult;
|
|
82
|
+
export declare function syncBusinessClaudeAssets(projectPath: string, businessDirection: string | null, existingTempDir?: string | null): ClaudeAssetSyncResult;
|
|
83
|
+
/**
|
|
84
|
+
* Sync `.claude/` from the common directory only.
|
|
85
|
+
* Used by `zhuanspec update` when no `.business-direction` is configured.
|
|
86
|
+
*/
|
|
87
|
+
export declare function syncCommonDotClaude(projectPath: string, existingTempDir?: string | null): {
|
|
88
|
+
attempted: boolean;
|
|
89
|
+
synced: boolean;
|
|
90
|
+
added: number;
|
|
91
|
+
overwritten: number;
|
|
92
|
+
skipped: number;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=business-assets-sync.d.ts.map
|