openspec-stat 1.4.2 → 1.4.4

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/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/openspec-stat.svg?style=flat)](https://npmjs.com/package/openspec-stat)
4
4
  [![NPM downloads](http://img.shields.io/npm/dm/openspec-stat.svg?style=flat)](https://npmjs.com/package/openspec-stat)
5
+ [![Last commit](https://img.shields.io/github/last-commit/Orchardxyz/openspec-stat.svg?style=flat)](https://github.com/Orchardxyz/openspec-stat/commits/main)
5
6
  [![CI](https://github.com/Orchardxyz/openspec-stat/actions/workflows/ci.yml/badge.svg)](https://github.com/Orchardxyz/openspec-stat/actions/workflows/ci.yml)
7
+ [![License](https://img.shields.io/npm/l/openspec-stat.svg?style=flat)](https://github.com/Orchardxyz/openspec-stat/blob/main/LICENSE)
6
8
 
7
9
  English | [简体中文](./README.zh-CN.md)
8
10
 
package/dist/esm/cli.js CHANGED
@@ -4,7 +4,7 @@ import { runSingleRepoCommand } from "./commands/single.js";
4
4
  import { runMultiRepoCommand } from "./commands/multi.js";
5
5
  import { runInitCommand } from "./commands/init.js";
6
6
  const program = new Command();
7
- program.name('openspec-stat').description("Track team members' OpenSpec proposals and code changes in Git repositories").version("1.4.2").enablePositionalOptions().passThroughOptions();
7
+ program.name('openspec-stat').description("Track team members' OpenSpec proposals and code changes in Git repositories").version("1.4.4").enablePositionalOptions().passThroughOptions();
8
8
 
9
9
  // Default command for single-repository mode (for backward compatibility)
10
10
  program.argument('[repo]', 'Repository path', '.').option('-r, --repo <path>', 'Repository path (alternative)', '.').option('-b, --branches <branches>', 'Branch list, comma-separated').option('--no-interactive', 'Disable interactive branch selection').option('-s, --since <datetime>', 'Start time (default: yesterday 20:00)').option('-u, --until <datetime>', 'End time (default: today 20:00)').option('-a, --author <name>', 'Filter by specific author').option('--json', 'Output in JSON format').option('--csv', 'Output in CSV format').option('--markdown', 'Output in Markdown format').option('-c, --config <path>', 'Configuration file path').option('-v, --verbose', 'Verbose output mode').option('-l, --lang <language>', 'Language for output (en, zh-CN)', 'en').option('--no-fetch', 'Skip fetching remote branches').action(async (repo, options) => {
@@ -24,8 +24,12 @@ export class MultiRepoAnalyzer {
24
24
  this.nextCloneIndex = 1;
25
25
  this.totalCloneTargets = enabledRepos.filter(repo => repo.type === 'remote').length;
26
26
  try {
27
- const results = await this.processInBatches(enabledRepos, (repo, context) => this.analyzeRepository(repo, since, until, context), this.config.parallelism?.maxConcurrent || 3);
28
- return results;
27
+ const localRepos = enabledRepos.filter(repo => repo.type === 'local');
28
+ const remoteRepos = enabledRepos.filter(repo => repo.type === 'remote');
29
+ const maxConcurrent = this.config.parallelism?.maxConcurrent || 3;
30
+ const localResults = await this.processInBatches(localRepos, (repo, context) => this.analyzeRepository(repo, since, until, context), maxConcurrent);
31
+ const remoteResults = await this.processInBatches(remoteRepos, (repo, context) => this.analyzeRepository(repo, since, until, context), maxConcurrent);
32
+ return [...localResults, ...remoteResults];
29
33
  } finally {
30
34
  if (this.config.remoteCache?.cleanupOnComplete) {
31
35
  await this.cleanupTempDirs();
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "openspec-stat",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Track team members' OpenSpec proposals and code changes in Git repositories",
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
7
- "types": "dist/esm/index.d.ts",
8
7
  "bin": {
9
8
  "openspec-stat": "dist/esm/cli.js"
10
9
  },
@@ -38,6 +37,8 @@
38
37
  },
39
38
  "devDependencies": {
40
39
  "@changesets/cli": "^2.27.1",
40
+ "@commitlint/cli": "^19.8.1",
41
+ "@commitlint/config-conventional": "^19.8.1",
41
42
  "@types/mock-fs": "^4.13.4",
42
43
  "@types/node": "^25.0.3",
43
44
  "@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -1,7 +0,0 @@
1
- export interface BranchInfo {
2
- name: string;
3
- lastCommitDate: Date;
4
- commitCount: number;
5
- }
6
- export declare function getActiveBranches(repoPath: string, limit?: number): Promise<BranchInfo[]>;
7
- export declare function selectBranches(repoPath: string, defaultBranches?: string[]): Promise<string[]>;
package/dist/esm/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,7 +0,0 @@
1
- interface InitOptions {
2
- multi?: boolean;
3
- template?: 'single' | 'multi';
4
- output?: string;
5
- }
6
- export declare function runInitCommand(options: InitOptions): Promise<void>;
7
- export {};
@@ -1,16 +0,0 @@
1
- interface MultiCommandOptions {
2
- config: string;
3
- since?: string;
4
- until?: string;
5
- author?: string;
6
- json?: boolean;
7
- csv?: boolean;
8
- markdown?: boolean;
9
- verbose?: boolean;
10
- lang?: string;
11
- cleanup?: boolean;
12
- showContributors?: boolean;
13
- noFetch?: boolean;
14
- }
15
- export declare function runMultiRepoCommand(options: MultiCommandOptions): Promise<void>;
16
- export {};
@@ -1,2 +0,0 @@
1
- import { CliOptions } from '../types.js';
2
- export declare function runSingleRepoCommand(options: CliOptions): Promise<void>;
@@ -1,3 +0,0 @@
1
- import { Config } from './types.js';
2
- export declare function loadConfig(configPath?: string, repoPath?: string): Promise<Config>;
3
- export declare function normalizeAuthor(author: string, mapping?: Record<string, string>): string;
@@ -1,7 +0,0 @@
1
- import { StatsResult } from './types.js';
2
- export declare class OutputFormatter {
3
- formatTable(result: StatsResult, verbose?: boolean, showContributors?: boolean): string;
4
- formatJSON(result: StatsResult, showContributors?: boolean): string;
5
- formatCSV(result: StatsResult, showContributors?: boolean): string;
6
- formatMarkdown(result: StatsResult, showContributors?: boolean): string;
7
- }
@@ -1,11 +0,0 @@
1
- import { CommitInfo, CommitAnalysis, Config } from './types.js';
2
- export declare class GitAnalyzer {
3
- private git;
4
- private config;
5
- constructor(repoPath: string, config: Config);
6
- fetchRemote(): Promise<void>;
7
- getCommits(since: Date, until: Date, branches: string[]): Promise<CommitInfo[]>;
8
- getCommitBranches(commitHash: string, targetBranches: string[]): Promise<string[]>;
9
- analyzeCommit(commit: CommitInfo): Promise<CommitAnalysis | null>;
10
- getActiveAuthors(weeks?: number): Promise<Set<string>>;
11
- }
@@ -1,7 +0,0 @@
1
- type Language = 'en' | 'zh-CN';
2
- type TranslationKey = string;
3
- export declare function setLanguage(lang: Language): void;
4
- export declare function getLanguage(): Language;
5
- export declare function t(key: TranslationKey, params?: Record<string, string | number>): string;
6
- export declare function initI18n(lang?: string): void;
7
- export {};
@@ -1,6 +0,0 @@
1
- export { GitAnalyzer } from './git-analyzer.js';
2
- export { StatsAggregator } from './stats-aggregator.js';
3
- export { OutputFormatter } from './formatters.js';
4
- export { loadConfig, normalizeAuthor } from './config.js';
5
- export { getDefaultTimeRange, parseDateTime, parseBranches } from './time-utils.js';
6
- export * from './types.js';
@@ -1,3 +0,0 @@
1
- import { MultiRepoConfig } from '../types.js';
2
- export declare function validateAndFillDefaults(config: unknown): MultiRepoConfig;
3
- export declare function printConfigSummary(config: MultiRepoConfig): void;
@@ -1,50 +0,0 @@
1
- export declare function runConfigWizard(isMultiRepo?: boolean): Promise<void>;
2
- export declare const SINGLE_REPO_TEMPLATE: {
3
- defaultBranches: string[];
4
- defaultSinceHours: number;
5
- defaultUntilHours: number;
6
- authorMapping: {
7
- 'user@email1.com': string;
8
- 'user@email2.com': string;
9
- };
10
- openspecDir: string;
11
- excludeExtensions: string[];
12
- activeUserWeeks: number;
13
- };
14
- export declare const MULTI_REPO_TEMPLATE: {
15
- mode: string;
16
- repositories: ({
17
- name: string;
18
- type: string;
19
- path: string;
20
- branches: string[];
21
- url?: undefined;
22
- cloneOptions?: undefined;
23
- } | {
24
- name: string;
25
- type: string;
26
- url: string;
27
- branches: string[];
28
- cloneOptions: {
29
- depth: null;
30
- singleBranch: boolean;
31
- };
32
- path?: undefined;
33
- })[];
34
- defaultSinceHours: number;
35
- defaultUntilHours: number;
36
- authorMapping: {};
37
- openspecDir: string;
38
- excludeExtensions: string[];
39
- activeUserWeeks: number;
40
- parallelism: {
41
- maxConcurrent: number;
42
- timeout: number;
43
- };
44
- remoteCache: {
45
- dir: string;
46
- autoCleanup: boolean;
47
- cleanupOnComplete: boolean;
48
- cleanupOnError: boolean;
49
- };
50
- };
@@ -1,24 +0,0 @@
1
- import { MultiRepoConfig, RepositoryResult } from '../types.js';
2
- interface AnalyzerOptions {
3
- quiet?: boolean;
4
- }
5
- export declare class MultiRepoAnalyzer {
6
- private config;
7
- private tempDirs;
8
- private isQuiet;
9
- private cloneOrder;
10
- private totalCloneTargets;
11
- private nextCloneIndex;
12
- constructor(config: MultiRepoConfig, options?: AnalyzerOptions);
13
- analyzeAll(since: Date, until: Date): Promise<RepositoryResult[]>;
14
- private analyzeRepository;
15
- private cloneRemoteRepository;
16
- private resolveLocalPath;
17
- private processInBatches;
18
- private withTimeout;
19
- cleanupTempDirs(): Promise<void>;
20
- registerCleanupHandlers(): void;
21
- private getProgressSuffix;
22
- private reportCloneStatus;
23
- }
24
- export {};
@@ -1,7 +0,0 @@
1
- import { CommitAnalysis, StatsResult, Config } from './types.js';
2
- export declare class StatsAggregator {
3
- private config;
4
- private activeAuthors?;
5
- constructor(config: Config, activeAuthors?: Set<string>);
6
- aggregate(analyses: CommitAnalysis[], since: Date, until: Date, branches: string[], filterAuthor?: string): StatsResult;
7
- }
@@ -1,6 +0,0 @@
1
- export declare function getDefaultTimeRange(sinceHours?: number, untilHours?: number): {
2
- since: Date;
3
- until: Date;
4
- };
5
- export declare function parseDateTime(dateStr: string): Date;
6
- export declare function parseBranches(branchesStr?: string): string[];
@@ -1,136 +0,0 @@
1
- export interface Config {
2
- defaultBranches?: string[];
3
- defaultSinceHours?: number;
4
- defaultUntilHours?: number;
5
- authorMapping?: Record<string, string>;
6
- openspecDir?: string;
7
- codeFileExtensions?: string[];
8
- excludeExtensions?: string[];
9
- activeUserWeeks?: number;
10
- autoFetch?: boolean;
11
- }
12
- export interface CliOptions {
13
- repo: string;
14
- branches?: string;
15
- since?: string;
16
- until?: string;
17
- author?: string;
18
- json?: boolean;
19
- csv?: boolean;
20
- markdown?: boolean;
21
- config?: string;
22
- verbose?: boolean;
23
- interactive?: boolean;
24
- lang?: string;
25
- noFetch?: boolean;
26
- }
27
- export interface CommitInfo {
28
- hash: string;
29
- author: string;
30
- email: string;
31
- date: Date;
32
- message: string;
33
- branches?: string[];
34
- }
35
- export interface FileChange {
36
- path: string;
37
- additions: number;
38
- deletions: number;
39
- status: string;
40
- }
41
- export interface CommitAnalysis {
42
- commit: CommitInfo;
43
- openspecProposals: Set<string>;
44
- codeFiles: FileChange[];
45
- totalAdditions: number;
46
- totalDeletions: number;
47
- netChanges: number;
48
- }
49
- export interface AuthorStats {
50
- author: string;
51
- commits: number;
52
- openspecProposals: Set<string>;
53
- codeFilesChanged: number;
54
- additions: number;
55
- deletions: number;
56
- netChanges: number;
57
- lastCommitDate?: Date;
58
- firstCommitDate?: Date;
59
- statisticsPeriod?: string;
60
- branchStats?: Map<string, BranchStats>;
61
- }
62
- export interface BranchStats {
63
- branch: string;
64
- commits: number;
65
- openspecProposals: Set<string>;
66
- codeFilesChanged: number;
67
- additions: number;
68
- deletions: number;
69
- netChanges: number;
70
- }
71
- export interface ProposalStats {
72
- proposal: string;
73
- commits: number;
74
- contributors: Set<string>;
75
- codeFilesChanged: number;
76
- additions: number;
77
- deletions: number;
78
- netChanges: number;
79
- commitHashes: Set<string>;
80
- multiProposalCommits: number;
81
- sharedCommitHashes: Set<string>;
82
- }
83
- export interface StatsResult {
84
- timeRange: {
85
- since: Date;
86
- until: Date;
87
- };
88
- branches: string[];
89
- authors: Map<string, AuthorStats>;
90
- proposals: Map<string, ProposalStats>;
91
- totalCommits: number;
92
- }
93
- export interface RepositoryConfig {
94
- name: string;
95
- type: 'local' | 'remote';
96
- path?: string;
97
- url?: string;
98
- cloneOptions?: {
99
- depth?: number | null;
100
- singleBranch?: boolean;
101
- };
102
- branches: string[];
103
- enabled?: boolean;
104
- }
105
- export interface RemoteCacheConfig {
106
- dir: string;
107
- autoCleanup: boolean;
108
- cleanupOnComplete: boolean;
109
- cleanupOnError: boolean;
110
- }
111
- export interface ParallelismConfig {
112
- maxConcurrent: number;
113
- timeout: number;
114
- }
115
- export interface MultiRepoConfig extends Config {
116
- mode: 'single-repo' | 'multi-repo';
117
- repositories?: RepositoryConfig[];
118
- remoteCache?: RemoteCacheConfig;
119
- parallelism?: ParallelismConfig;
120
- }
121
- export interface RepositoryResult {
122
- repository: string;
123
- type: 'local' | 'remote';
124
- path: string;
125
- analyses: CommitAnalysis[];
126
- success: boolean;
127
- error?: string;
128
- }
129
- export interface MultiRepoStatsResult extends StatsResult {
130
- repositories: string[];
131
- repositoryDetails: Map<string, {
132
- type: 'local' | 'remote';
133
- commits: number;
134
- error?: string;
135
- }>;
136
- }
@@ -1,12 +0,0 @@
1
- export declare class SpinnerManager {
2
- private spinner;
3
- private isQuiet;
4
- constructor(isQuiet?: boolean);
5
- start(text: string): void;
6
- succeed(text?: string): void;
7
- fail(text?: string): void;
8
- warn(text: string): void;
9
- info(text: string): void;
10
- update(text: string): void;
11
- stop(): void;
12
- }