aspectcode 0.4.1 → 1.0.1
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 +2 -2
- package/dist/agentsMdRenderer.d.ts +16 -0
- package/dist/agentsMdRenderer.d.ts.map +1 -0
- package/dist/agentsMdRenderer.js +137 -0
- package/dist/agentsMdRenderer.js.map +1 -0
- package/dist/auth.d.ts +31 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +386 -0
- package/dist/auth.js.map +1 -0
- package/dist/autoResolve.d.ts +41 -0
- package/dist/autoResolve.d.ts.map +1 -0
- package/dist/autoResolve.js +196 -0
- package/dist/autoResolve.js.map +1 -0
- package/dist/changeEvaluator.d.ts +56 -0
- package/dist/changeEvaluator.d.ts.map +1 -0
- package/dist/changeEvaluator.js +674 -0
- package/dist/changeEvaluator.js.map +1 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +37 -17
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +50 -2
- package/dist/config.js.map +1 -1
- package/dist/dreamCycle.d.ts +57 -0
- package/dist/dreamCycle.d.ts.map +1 -0
- package/dist/dreamCycle.js +334 -0
- package/dist/dreamCycle.js.map +1 -0
- package/dist/kbBuilder.d.ts +1 -2
- package/dist/kbBuilder.d.ts.map +1 -1
- package/dist/kbBuilder.js +1 -2
- package/dist/kbBuilder.js.map +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +148 -7
- package/dist/main.js.map +1 -1
- package/dist/optimize.d.ts +13 -6
- package/dist/optimize.d.ts.map +1 -1
- package/dist/optimize.js +433 -142
- package/dist/optimize.js.map +1 -1
- package/dist/pipeline.d.ts +19 -21
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +1093 -160
- package/dist/pipeline.js.map +1 -1
- package/dist/preferences.d.ts +80 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +238 -0
- package/dist/preferences.js.map +1 -0
- package/dist/runtimeState.d.ts +30 -0
- package/dist/runtimeState.d.ts.map +1 -0
- package/dist/runtimeState.js +39 -0
- package/dist/runtimeState.js.map +1 -0
- package/dist/scopedRules.d.ts +84 -0
- package/dist/scopedRules.d.ts.map +1 -0
- package/dist/scopedRules.js +449 -0
- package/dist/scopedRules.js.map +1 -0
- package/dist/ui/Dashboard.d.ts +4 -16
- package/dist/ui/Dashboard.d.ts.map +1 -1
- package/dist/ui/Dashboard.js +339 -140
- package/dist/ui/Dashboard.js.map +1 -1
- package/dist/ui/MemoryMap.d.ts +16 -0
- package/dist/ui/MemoryMap.d.ts.map +1 -0
- package/dist/ui/MemoryMap.js +266 -0
- package/dist/ui/MemoryMap.js.map +1 -0
- package/dist/ui/SettingsPanel.d.ts +18 -0
- package/dist/ui/SettingsPanel.d.ts.map +1 -0
- package/dist/ui/SettingsPanel.js +241 -0
- package/dist/ui/SettingsPanel.js.map +1 -0
- package/dist/ui/prompts.d.ts +7 -0
- package/dist/ui/prompts.d.ts.map +1 -1
- package/dist/ui/prompts.js +63 -0
- package/dist/ui/prompts.js.map +1 -1
- package/dist/ui/store.d.ts +154 -18
- package/dist/ui/store.d.ts.map +1 -1
- package/dist/ui/store.js +154 -24
- package/dist/ui/store.js.map +1 -1
- package/dist/ui/theme.d.ts +1 -8
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +2 -21
- package/dist/ui/theme.js.map +1 -1
- package/dist/updateChecker.d.ts +13 -0
- package/dist/updateChecker.d.ts.map +1 -0
- package/dist/updateChecker.js +66 -0
- package/dist/updateChecker.js.map +1 -0
- package/dist/usageTracker.d.ts +12 -0
- package/dist/usageTracker.d.ts.map +1 -0
- package/dist/usageTracker.js +89 -0
- package/dist/usageTracker.js.map +1 -0
- package/dist/writer.d.ts +1 -7
- package/dist/writer.d.ts.map +1 -1
- package/dist/writer.js +1 -11
- package/dist/writer.js.map +1 -1
- package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts.map +1 -1
- package/node_modules/@aspectcode/core/dist/analysis/repo.js +13 -2
- package/node_modules/@aspectcode/core/dist/analysis/repo.js.map +1 -1
- package/node_modules/@aspectcode/core/dist/index.d.ts +1 -3
- package/node_modules/@aspectcode/core/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/core/dist/index.js +1 -3
- package/node_modules/@aspectcode/core/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.d.ts +14 -0
- package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.d.ts.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.js +191 -0
- package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.js.map +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.d.ts +1 -0
- package/node_modules/@aspectcode/core/dist/parsers/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/index.js +6 -1
- package/node_modules/@aspectcode/core/dist/parsers/index.js.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts +20 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/languages.js +25 -0
- package/node_modules/@aspectcode/core/dist/parsers/languages.js.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts.map +1 -1
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js +4 -1
- package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js.map +1 -1
- package/node_modules/@aspectcode/core/package.json +2 -2
- package/node_modules/@aspectcode/core/parsers/cpp.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/go.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/php.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/ruby.wasm +0 -0
- package/node_modules/@aspectcode/core/parsers/rust.wasm +0 -0
- package/node_modules/@aspectcode/emitters/dist/index.d.ts +1 -17
- package/node_modules/@aspectcode/emitters/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/index.js +2 -90
- package/node_modules/@aspectcode/emitters/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts +0 -2
- package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/index.js +1 -7
- package/node_modules/@aspectcode/emitters/dist/instructions/index.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts +0 -18
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js +0 -57
- package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts +0 -18
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.js +0 -130
- package/node_modules/@aspectcode/emitters/dist/kb/conventions.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts +2 -4
- package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/kb/index.js +1 -11
- package/node_modules/@aspectcode/emitters/dist/kb/index.js.map +1 -1
- package/node_modules/@aspectcode/emitters/package.json +3 -3
- package/node_modules/@aspectcode/evaluator/dist/apply.d.ts +55 -0
- package/node_modules/@aspectcode/evaluator/dist/apply.d.ts.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/apply.js +368 -0
- package/node_modules/@aspectcode/evaluator/dist/apply.js.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts +16 -25
- package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/diagnosis.js +115 -138
- package/node_modules/@aspectcode/evaluator/dist/diagnosis.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/index.d.ts +8 -43
- package/node_modules/@aspectcode/evaluator/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/index.js +15 -61
- package/node_modules/@aspectcode/evaluator/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/judge.d.ts +32 -0
- package/node_modules/@aspectcode/evaluator/dist/judge.d.ts.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/judge.js +165 -0
- package/node_modules/@aspectcode/evaluator/dist/judge.js.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/llmUtil.d.ts +15 -0
- package/node_modules/@aspectcode/evaluator/dist/llmUtil.d.ts.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/llmUtil.js +41 -0
- package/node_modules/@aspectcode/evaluator/dist/llmUtil.js.map +1 -0
- package/node_modules/@aspectcode/evaluator/dist/probes.d.ts +20 -47
- package/node_modules/@aspectcode/evaluator/dist/probes.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/probes.js +188 -278
- package/node_modules/@aspectcode/evaluator/dist/probes.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/runner.d.ts +7 -32
- package/node_modules/@aspectcode/evaluator/dist/runner.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/runner.js +21 -146
- package/node_modules/@aspectcode/evaluator/dist/runner.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/types.d.ts +141 -99
- package/node_modules/@aspectcode/evaluator/dist/types.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/types.js +10 -2
- package/node_modules/@aspectcode/evaluator/dist/types.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/package.json +4 -4
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts +3 -10
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/index.js +1 -19
- package/node_modules/@aspectcode/optimizer/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js +40 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.d.ts +9 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.d.ts.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.js +83 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.js.map +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts +4 -3
- package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/index.js +24 -10
- package/node_modules/@aspectcode/optimizer/dist/providers/index.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js +22 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts +14 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.js +1 -0
- package/node_modules/@aspectcode/optimizer/dist/providers/retry.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts +14 -0
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/types.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/package.json +2 -2
- package/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/web-tree-sitter/README.md +198 -0
- package/node_modules/web-tree-sitter/package.json +36 -0
- package/node_modules/web-tree-sitter/tree-sitter-web.d.ts +204 -0
- package/node_modules/web-tree-sitter/tree-sitter.js +1 -0
- package/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
- package/package.json +8 -8
- package/dist/complaintProcessor.d.ts +0 -16
- package/dist/complaintProcessor.d.ts.map +0 -1
- package/dist/complaintProcessor.js +0 -134
- package/dist/complaintProcessor.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/emitter.d.ts +0 -72
- package/node_modules/@aspectcode/emitters/dist/emitter.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/emitter.js +0 -10
- package/node_modules/@aspectcode/emitters/dist/emitter.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts +0 -26
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js +0 -501
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts +0 -13
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.js +0 -55
- package/node_modules/@aspectcode/emitters/dist/instructions/detection.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts +0 -9
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js +0 -30
- package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts +0 -21
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js +0 -125
- package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/manifest.d.ts +0 -37
- package/node_modules/@aspectcode/emitters/dist/manifest.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/manifest.js +0 -50
- package/node_modules/@aspectcode/emitters/dist/manifest.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/report.d.ts +0 -22
- package/node_modules/@aspectcode/emitters/dist/report.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/report.js +0 -3
- package/node_modules/@aspectcode/emitters/dist/report.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts +0 -14
- package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/stableJson.js +0 -40
- package/node_modules/@aspectcode/emitters/dist/stableJson.js.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/transaction.d.ts +0 -29
- package/node_modules/@aspectcode/emitters/dist/transaction.d.ts.map +0 -1
- package/node_modules/@aspectcode/emitters/dist/transaction.js +0 -104
- package/node_modules/@aspectcode/emitters/dist/transaction.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped rule generation — deterministic, analysis-driven rules for
|
|
3
|
+
* Claude Code, Cursor, and Copilot.
|
|
4
|
+
*
|
|
5
|
+
* Extracts path-specific guidance from the AnalysisModel and writes
|
|
6
|
+
* platform-specific rule files. AGENTS.md stays broad; scoped rules
|
|
7
|
+
* activate only when relevant files are touched.
|
|
8
|
+
*/
|
|
9
|
+
import type { AnalysisModel } from '@aspectcode/core';
|
|
10
|
+
import type { EmitterHost } from '@aspectcode/emitters';
|
|
11
|
+
import type { AiToolId } from '@aspectcode/emitters';
|
|
12
|
+
export interface ScopedRule {
|
|
13
|
+
/** Unique slug for file naming, e.g. "src-core" */
|
|
14
|
+
slug: string;
|
|
15
|
+
/** Human-readable description for frontmatter */
|
|
16
|
+
description: string;
|
|
17
|
+
/** Glob patterns this rule applies to */
|
|
18
|
+
globs: string[];
|
|
19
|
+
/** Markdown body (no frontmatter) */
|
|
20
|
+
content: string;
|
|
21
|
+
/** Which extractor generated this */
|
|
22
|
+
source: 'hub' | 'convention' | 'circular-dep' | 'dream' | 'probe';
|
|
23
|
+
}
|
|
24
|
+
export interface ManifestEntry {
|
|
25
|
+
slug: string;
|
|
26
|
+
platform: string;
|
|
27
|
+
path: string;
|
|
28
|
+
hash: string;
|
|
29
|
+
source: ScopedRule['source'] | 'probe';
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract all scoped rules from the analysis model.
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractScopedRules(model: AnalysisModel): ScopedRule[];
|
|
37
|
+
/**
|
|
38
|
+
* Hub directory rules — for directories containing high-connectivity files.
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractHubRules(model: AnalysisModel): ScopedRule[];
|
|
41
|
+
/**
|
|
42
|
+
* Convention cluster rules — for directories with naming patterns
|
|
43
|
+
* that differ from the repo-wide dominant.
|
|
44
|
+
*/
|
|
45
|
+
export declare function extractConventionRules(model: AnalysisModel): ScopedRule[];
|
|
46
|
+
/**
|
|
47
|
+
* Circular dependency zone rules — for directories involved in cycles.
|
|
48
|
+
*/
|
|
49
|
+
export declare function extractCircularDepRules(model: AnalysisModel): ScopedRule[];
|
|
50
|
+
export declare function serializeForClaudeCode(rule: ScopedRule): {
|
|
51
|
+
path: string;
|
|
52
|
+
content: string;
|
|
53
|
+
};
|
|
54
|
+
export declare function serializeForCursor(rule: ScopedRule): {
|
|
55
|
+
path: string;
|
|
56
|
+
content: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the active platform. Returns null if ambiguous (needs survey).
|
|
60
|
+
* Priority: flag → config → auto-detect (single match) → null.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolvePlatform(host: EmitterHost, root: string, flagPlatform?: string, configPlatform?: string): Promise<AiToolId | null>;
|
|
63
|
+
/** Map AiToolId back to user-facing name. */
|
|
64
|
+
export declare function platformLabel(id: AiToolId | null): string;
|
|
65
|
+
/**
|
|
66
|
+
* Write scoped rules for a single platform. Manages manifest
|
|
67
|
+
* to track owned files and clean up stale ones.
|
|
68
|
+
*/
|
|
69
|
+
export declare function writeScopedRules(host: EmitterHost, root: string, rules: ScopedRule[], platform: AiToolId): Promise<string[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Delete scoped rules by slug. Removes files and updates manifest.
|
|
72
|
+
*/
|
|
73
|
+
export declare function deleteScopedRules(host: EmitterHost, root: string, slugs: string[]): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Write a single instruction file for platforms that don't support scoped rules.
|
|
76
|
+
* Concatenates all rules into one markdown file.
|
|
77
|
+
*/
|
|
78
|
+
export declare function writeSingleInstructionFile(host: EmitterHost, root: string, rules: ScopedRule[], platformId: string): Promise<string | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Write rules for all selected platforms. Handles both scoped (Claude/Cursor)
|
|
81
|
+
* and single-file (Copilot/Windsurf/Cline/Gemini/Aider) platforms.
|
|
82
|
+
*/
|
|
83
|
+
export declare function writeRulesForPlatforms(host: EmitterHost, root: string, rules: ScopedRule[], platforms: string[]): Promise<string[]>;
|
|
84
|
+
//# sourceMappingURL=scopedRules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopedRules.d.ts","sourceRoot":"","sources":["../src/scopedRules.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIrD,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qCAAqC;IACrC,OAAO,EAAE,M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AG,MAAM,CAIzD;AAID;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CA6CnB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,IAAI,CAAC,CAcf;AAYD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EAAE,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EAAE,EACnB,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB"}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Scoped rule generation — deterministic, analysis-driven rules for
|
|
4
|
+
* Claude Code, Cursor, and Copilot.
|
|
5
|
+
*
|
|
6
|
+
* Extracts path-specific guidance from the AnalysisModel and writes
|
|
7
|
+
* platform-specific rule files. AGENTS.md stays broad; scoped rules
|
|
8
|
+
* activate only when relevant files are touched.
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.extractScopedRules = extractScopedRules;
|
|
45
|
+
exports.extractHubRules = extractHubRules;
|
|
46
|
+
exports.extractConventionRules = extractConventionRules;
|
|
47
|
+
exports.extractCircularDepRules = extractCircularDepRules;
|
|
48
|
+
exports.serializeForClaudeCode = serializeForClaudeCode;
|
|
49
|
+
exports.serializeForCursor = serializeForCursor;
|
|
50
|
+
exports.resolvePlatform = resolvePlatform;
|
|
51
|
+
exports.platformLabel = platformLabel;
|
|
52
|
+
exports.writeScopedRules = writeScopedRules;
|
|
53
|
+
exports.deleteScopedRules = deleteScopedRules;
|
|
54
|
+
exports.writeSingleInstructionFile = writeSingleInstructionFile;
|
|
55
|
+
exports.writeRulesForPlatforms = writeRulesForPlatforms;
|
|
56
|
+
const crypto = __importStar(require("crypto"));
|
|
57
|
+
const path = __importStar(require("path"));
|
|
58
|
+
const emitters_1 = require("@aspectcode/emitters");
|
|
59
|
+
// ── Supported platforms ──────────────────────────────────────
|
|
60
|
+
const SUPPORTED_PLATFORMS = ['claudeCode', 'cursor', 'copilot'];
|
|
61
|
+
// ── Extractors ───────────────────────────────────────────────
|
|
62
|
+
/**
|
|
63
|
+
* Extract all scoped rules from the analysis model.
|
|
64
|
+
*/
|
|
65
|
+
function extractScopedRules(model) {
|
|
66
|
+
return [
|
|
67
|
+
...extractHubRules(model),
|
|
68
|
+
...extractConventionRules(model),
|
|
69
|
+
...extractCircularDepRules(model),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Hub directory rules — for directories containing high-connectivity files.
|
|
74
|
+
*/
|
|
75
|
+
function extractHubRules(model) {
|
|
76
|
+
const hubs = model.metrics.hubs.filter((h) => h.inDegree >= 3);
|
|
77
|
+
if (hubs.length === 0)
|
|
78
|
+
return [];
|
|
79
|
+
// Group hubs by directory
|
|
80
|
+
const dirHubs = new Map();
|
|
81
|
+
for (const hub of hubs) {
|
|
82
|
+
const dir = path.posix.dirname(hub.file);
|
|
83
|
+
const existing = dirHubs.get(dir) ?? [];
|
|
84
|
+
existing.push(hub);
|
|
85
|
+
dirHubs.set(dir, existing);
|
|
86
|
+
}
|
|
87
|
+
const rules = [];
|
|
88
|
+
for (const [dir, hubsInDir] of dirHubs) {
|
|
89
|
+
// Find top dependents across all hubs in this directory
|
|
90
|
+
const dependents = new Set();
|
|
91
|
+
for (const hub of hubsInDir) {
|
|
92
|
+
for (const edge of model.graph.edges) {
|
|
93
|
+
if (edge.target === hub.file && edge.source !== hub.file) {
|
|
94
|
+
dependents.add(edge.source);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const hubList = hubsInDir
|
|
99
|
+
.sort((a, b) => b.inDegree - a.inDegree)
|
|
100
|
+
.map((h) => `\`${path.posix.basename(h.file)}\` (${h.inDegree} dependents)`)
|
|
101
|
+
.join(', ');
|
|
102
|
+
const topDeps = [...dependents].slice(0, 5).map((d) => `\`${d}\``).join(', ');
|
|
103
|
+
const slug = dirToSlug(dir);
|
|
104
|
+
rules.push({
|
|
105
|
+
slug: `hub-${slug}`,
|
|
106
|
+
description: `High-impact hub files in ${dir}/`,
|
|
107
|
+
globs: [`${dir}/**`],
|
|
108
|
+
content: [
|
|
109
|
+
`## High-Impact Hubs`,
|
|
110
|
+
``,
|
|
111
|
+
`This directory contains hub files with many dependents: ${hubList}.`,
|
|
112
|
+
``,
|
|
113
|
+
`- Read the hub file and trace callers before editing.`,
|
|
114
|
+
`- Changes here ripple widely. Verify dependent files after modifications.`,
|
|
115
|
+
...(topDeps ? [`- Key dependents: ${topDeps}`] : []),
|
|
116
|
+
].join('\n') + '\n',
|
|
117
|
+
source: 'hub',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return rules;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Convention cluster rules — for directories with naming patterns
|
|
124
|
+
* that differ from the repo-wide dominant.
|
|
125
|
+
*/
|
|
126
|
+
function extractConventionRules(model) {
|
|
127
|
+
// Determine repo-wide dominant naming pattern
|
|
128
|
+
const allFiles = model.files.map((f) => f.relativePath);
|
|
129
|
+
const repoDominant = detectDominantNaming(allFiles);
|
|
130
|
+
// Group files by directory
|
|
131
|
+
const dirFiles = new Map();
|
|
132
|
+
for (const file of model.files) {
|
|
133
|
+
const dir = path.posix.dirname(file.relativePath);
|
|
134
|
+
const existing = dirFiles.get(dir) ?? [];
|
|
135
|
+
existing.push(file.relativePath);
|
|
136
|
+
dirFiles.set(dir, existing);
|
|
137
|
+
}
|
|
138
|
+
const rules = [];
|
|
139
|
+
const ruledDirs = new Set();
|
|
140
|
+
// Sort directories by depth (shallowest first) to skip children with same convention
|
|
141
|
+
const sortedDirs = [...dirFiles.entries()].sort((a, b) => {
|
|
142
|
+
const depthA = a[0].split('/').length;
|
|
143
|
+
const depthB = b[0].split('/').length;
|
|
144
|
+
return depthA - depthB;
|
|
145
|
+
});
|
|
146
|
+
for (const [dir, files] of sortedDirs) {
|
|
147
|
+
if (files.length < 2)
|
|
148
|
+
continue; // need at least 2 files to detect a pattern
|
|
149
|
+
const dirDominant = detectDominantNaming(files);
|
|
150
|
+
if (!dirDominant || dirDominant === repoDominant)
|
|
151
|
+
continue;
|
|
152
|
+
// Skip if parent directory already has a rule with the same convention
|
|
153
|
+
const parentHasRule = [...ruledDirs].some((ruled) => dir.startsWith(ruled + '/'));
|
|
154
|
+
if (parentHasRule)
|
|
155
|
+
continue;
|
|
156
|
+
// Check for test co-location
|
|
157
|
+
const hasTests = files.some((f) => {
|
|
158
|
+
const base = path.posix.basename(f).toLowerCase();
|
|
159
|
+
return /\.(test|spec)\.[^.]+$/.test(base);
|
|
160
|
+
});
|
|
161
|
+
const lines = [`## Directory Conventions`, ``];
|
|
162
|
+
lines.push(`- Files in this directory use **${dirDominant}** naming.`);
|
|
163
|
+
if (hasTests) {
|
|
164
|
+
lines.push(`- Tests are co-located alongside source files.`);
|
|
165
|
+
}
|
|
166
|
+
const slug = dirToSlug(dir);
|
|
167
|
+
rules.push({
|
|
168
|
+
slug: `conv-${slug}`,
|
|
169
|
+
description: `Naming conventions for ${dir}/`,
|
|
170
|
+
globs: [`${dir}/**`],
|
|
171
|
+
content: lines.join('\n') + '\n',
|
|
172
|
+
source: 'convention',
|
|
173
|
+
});
|
|
174
|
+
ruledDirs.add(dir);
|
|
175
|
+
}
|
|
176
|
+
return rules;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Circular dependency zone rules — for directories involved in cycles.
|
|
180
|
+
*/
|
|
181
|
+
function extractCircularDepRules(model) {
|
|
182
|
+
const circularEdges = model.graph.edges.filter((e) => e.type === 'circular');
|
|
183
|
+
if (circularEdges.length === 0)
|
|
184
|
+
return [];
|
|
185
|
+
// Group by directory of source file
|
|
186
|
+
const dirCycles = new Map();
|
|
187
|
+
for (const edge of circularEdges) {
|
|
188
|
+
const dir = path.posix.dirname(edge.source);
|
|
189
|
+
const existing = dirCycles.get(dir) ?? new Set();
|
|
190
|
+
existing.add(edge.source);
|
|
191
|
+
existing.add(edge.target);
|
|
192
|
+
dirCycles.set(dir, existing);
|
|
193
|
+
}
|
|
194
|
+
const rules = [];
|
|
195
|
+
for (const [dir, involvedFiles] of dirCycles) {
|
|
196
|
+
const fileList = [...involvedFiles]
|
|
197
|
+
.map((f) => `\`${f}\``)
|
|
198
|
+
.join(', ');
|
|
199
|
+
const slug = dirToSlug(dir);
|
|
200
|
+
rules.push({
|
|
201
|
+
slug: `circular-${slug}`,
|
|
202
|
+
description: `Circular dependency warning for ${dir}/`,
|
|
203
|
+
globs: [`${dir}/**`],
|
|
204
|
+
content: [
|
|
205
|
+
`## Circular Dependencies`,
|
|
206
|
+
``,
|
|
207
|
+
`This directory has circular import chains involving: ${fileList}.`,
|
|
208
|
+
``,
|
|
209
|
+
`- Avoid adding new imports between these files.`,
|
|
210
|
+
`- When modifying, check if the change deepens the cycle.`,
|
|
211
|
+
`- Consider extracting shared types to break the cycle.`,
|
|
212
|
+
].join('\n') + '\n',
|
|
213
|
+
source: 'circular-dep',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return rules;
|
|
217
|
+
}
|
|
218
|
+
// ── Platform serializers ─────────────────────────────────────
|
|
219
|
+
function serializeForClaudeCode(rule) {
|
|
220
|
+
const globs = rule.globs.map((g) => ` - "${g}"`).join('\n');
|
|
221
|
+
const content = `---\ndescription: "${escapeYaml(rule.description)}"\nglobs:\n${globs}\n---\n\n${rule.content}`;
|
|
222
|
+
return { path: `.claude/rules/ac-${rule.slug}.md`, content };
|
|
223
|
+
}
|
|
224
|
+
function serializeForCursor(rule) {
|
|
225
|
+
const globs = rule.globs.map((g) => ` - "${g}"`).join('\n');
|
|
226
|
+
const content = `---\ndescription: "${escapeYaml(rule.description)}"\nglobs:\n${globs}\nalwaysApply: false\n---\n\n${rule.content}`;
|
|
227
|
+
return { path: `.cursor/rules/ac-${rule.slug}.mdc`, content };
|
|
228
|
+
}
|
|
229
|
+
// ── Platform resolution ──────────────────────────────────────
|
|
230
|
+
/** User-facing platform names mapped to internal AiToolId. */
|
|
231
|
+
const PLATFORM_MAP = {
|
|
232
|
+
claude: 'claudeCode',
|
|
233
|
+
cursor: 'cursor',
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Resolve the active platform. Returns null if ambiguous (needs survey).
|
|
237
|
+
* Priority: flag → config → auto-detect (single match) → null.
|
|
238
|
+
*/
|
|
239
|
+
async function resolvePlatform(host, root, flagPlatform, configPlatform) {
|
|
240
|
+
// 1. CLI flag
|
|
241
|
+
if (flagPlatform) {
|
|
242
|
+
const mapped = PLATFORM_MAP[flagPlatform];
|
|
243
|
+
if (mapped)
|
|
244
|
+
return mapped;
|
|
245
|
+
}
|
|
246
|
+
// 2. Config
|
|
247
|
+
if (configPlatform) {
|
|
248
|
+
const mapped = PLATFORM_MAP[configPlatform];
|
|
249
|
+
if (mapped)
|
|
250
|
+
return mapped;
|
|
251
|
+
}
|
|
252
|
+
// 3. Auto-detect from filesystem
|
|
253
|
+
const detected = [];
|
|
254
|
+
for (const entry of emitters_1.AI_TOOL_DETECTION_PATHS) {
|
|
255
|
+
if (!SUPPORTED_PLATFORMS.includes(entry.id))
|
|
256
|
+
continue;
|
|
257
|
+
for (const p of entry.paths) {
|
|
258
|
+
if (await host.exists(host.join(root, p))) {
|
|
259
|
+
detected.push(entry.id);
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (detected.length === 1)
|
|
265
|
+
return detected[0];
|
|
266
|
+
return null; // ambiguous or none — caller should survey
|
|
267
|
+
}
|
|
268
|
+
/** Map AiToolId back to user-facing name. */
|
|
269
|
+
function platformLabel(id) {
|
|
270
|
+
if (id === 'claudeCode')
|
|
271
|
+
return 'claude';
|
|
272
|
+
if (id === 'cursor')
|
|
273
|
+
return 'cursor';
|
|
274
|
+
return '';
|
|
275
|
+
}
|
|
276
|
+
// ── Writer ───────────────────────────────────────────────────
|
|
277
|
+
/**
|
|
278
|
+
* Write scoped rules for a single platform. Manages manifest
|
|
279
|
+
* to track owned files and clean up stale ones.
|
|
280
|
+
*/
|
|
281
|
+
async function writeScopedRules(host, root, rules, platform) {
|
|
282
|
+
const manifest = await loadManifest(host, root);
|
|
283
|
+
const oldBySlug = new Map(manifest.rules.map((e) => [e.slug, e]));
|
|
284
|
+
const newEntries = [];
|
|
285
|
+
const written = [];
|
|
286
|
+
const now = new Date().toISOString();
|
|
287
|
+
for (const rule of rules) {
|
|
288
|
+
const serialized = platform === 'claudeCode'
|
|
289
|
+
? serializeForClaudeCode(rule)
|
|
290
|
+
: serializeForCursor(rule);
|
|
291
|
+
const absPath = host.join(root, serialized.path);
|
|
292
|
+
const dir = host.join(root, path.posix.dirname(serialized.path));
|
|
293
|
+
await host.mkdirp(dir);
|
|
294
|
+
await host.writeFile(absPath, serialized.content);
|
|
295
|
+
const hash = crypto.createHash('md5').update(serialized.content).digest('hex').slice(0, 8);
|
|
296
|
+
const old = oldBySlug.get(rule.slug);
|
|
297
|
+
const contentChanged = !old || old.hash !== hash;
|
|
298
|
+
newEntries.push({
|
|
299
|
+
slug: rule.slug,
|
|
300
|
+
platform,
|
|
301
|
+
path: serialized.path,
|
|
302
|
+
hash,
|
|
303
|
+
source: rule.source,
|
|
304
|
+
createdAt: old?.createdAt ?? now,
|
|
305
|
+
updatedAt: contentChanged ? now : (old?.updatedAt ?? now),
|
|
306
|
+
});
|
|
307
|
+
written.push(serialized.path);
|
|
308
|
+
}
|
|
309
|
+
// Clean up stale files (in old manifest but not in new)
|
|
310
|
+
const newPaths = new Set(newEntries.map((e) => e.path));
|
|
311
|
+
for (const old of manifest.rules) {
|
|
312
|
+
if (!newPaths.has(old.path)) {
|
|
313
|
+
try {
|
|
314
|
+
await host.rmrf(host.join(root, old.path));
|
|
315
|
+
}
|
|
316
|
+
catch { /* file may already be gone */ }
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
await saveManifest(host, root, { version: 1, rules: newEntries });
|
|
320
|
+
return written;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Delete scoped rules by slug. Removes files and updates manifest.
|
|
324
|
+
*/
|
|
325
|
+
async function deleteScopedRules(host, root, slugs) {
|
|
326
|
+
const manifest = await loadManifest(host, root);
|
|
327
|
+
const slugSet = new Set(slugs);
|
|
328
|
+
for (const entry of manifest.rules) {
|
|
329
|
+
if (slugSet.has(entry.slug)) {
|
|
330
|
+
try {
|
|
331
|
+
await host.rmrf(host.join(root, entry.path));
|
|
332
|
+
}
|
|
333
|
+
catch { /* file may already be gone */ }
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const remaining = manifest.rules.filter((e) => !slugSet.has(e.slug));
|
|
337
|
+
await saveManifest(host, root, { version: 1, rules: remaining });
|
|
338
|
+
}
|
|
339
|
+
// ── Single instruction file for non-scoped platforms ────────
|
|
340
|
+
const SINGLE_FILE_PATHS = {
|
|
341
|
+
copilot: '.github/copilot-instructions.md',
|
|
342
|
+
windsurf: '.windsurfrules',
|
|
343
|
+
cline: '.clinerules',
|
|
344
|
+
gemini: 'GEMINI.md',
|
|
345
|
+
aider: 'CONVENTIONS.md',
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Write a single instruction file for platforms that don't support scoped rules.
|
|
349
|
+
* Concatenates all rules into one markdown file.
|
|
350
|
+
*/
|
|
351
|
+
async function writeSingleInstructionFile(host, root, rules, platformId) {
|
|
352
|
+
const filePath = SINGLE_FILE_PATHS[platformId];
|
|
353
|
+
if (!filePath)
|
|
354
|
+
return null;
|
|
355
|
+
const header = `<!-- Generated by Aspect Code. Do not edit manually. -->\n\n`;
|
|
356
|
+
const sections = rules.map((r) => {
|
|
357
|
+
const globLine = r.globs.length > 0 ? `*Applies to: ${r.globs.join(', ')}*\n\n` : '';
|
|
358
|
+
return `## ${r.description}\n\n${globLine}${r.content}`;
|
|
359
|
+
}).join('\n---\n\n');
|
|
360
|
+
const content = header + sections;
|
|
361
|
+
const absPath = host.join(root, filePath);
|
|
362
|
+
const dir = host.join(root, path.posix.dirname(filePath));
|
|
363
|
+
await host.mkdirp(dir);
|
|
364
|
+
await host.writeFile(absPath, content);
|
|
365
|
+
return filePath;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Write rules for all selected platforms. Handles both scoped (Claude/Cursor)
|
|
369
|
+
* and single-file (Copilot/Windsurf/Cline/Gemini/Aider) platforms.
|
|
370
|
+
*/
|
|
371
|
+
async function writeRulesForPlatforms(host, root, rules, platforms) {
|
|
372
|
+
const written = [];
|
|
373
|
+
for (const p of platforms) {
|
|
374
|
+
if (p === 'claude') {
|
|
375
|
+
const paths = await writeScopedRules(host, root, rules, 'claudeCode');
|
|
376
|
+
written.push(...paths);
|
|
377
|
+
}
|
|
378
|
+
else if (p === 'cursor') {
|
|
379
|
+
const paths = await writeScopedRules(host, root, rules, 'cursor');
|
|
380
|
+
written.push(...paths);
|
|
381
|
+
}
|
|
382
|
+
else if (SINGLE_FILE_PATHS[p]) {
|
|
383
|
+
const path = await writeSingleInstructionFile(host, root, rules, p);
|
|
384
|
+
if (path)
|
|
385
|
+
written.push(path);
|
|
386
|
+
}
|
|
387
|
+
// codex: reads AGENTS.md directly, no extra files needed
|
|
388
|
+
}
|
|
389
|
+
return written;
|
|
390
|
+
}
|
|
391
|
+
// ── Manifest ─────────────────────────────────────────────────
|
|
392
|
+
const MANIFEST_PATH = '.aspectcode/scoped-rules.json';
|
|
393
|
+
async function loadManifest(host, root) {
|
|
394
|
+
try {
|
|
395
|
+
const raw = await host.readFile(host.join(root, MANIFEST_PATH));
|
|
396
|
+
const parsed = JSON.parse(raw);
|
|
397
|
+
if (parsed.version === 1 && Array.isArray(parsed.rules))
|
|
398
|
+
return parsed;
|
|
399
|
+
}
|
|
400
|
+
catch { /* missing or malformed */ }
|
|
401
|
+
return { version: 1, rules: [] };
|
|
402
|
+
}
|
|
403
|
+
async function saveManifest(host, root, manifest) {
|
|
404
|
+
const dir = host.join(root, '.aspectcode');
|
|
405
|
+
await host.mkdirp(dir);
|
|
406
|
+
await host.writeFile(host.join(root, MANIFEST_PATH), JSON.stringify(manifest, null, 2) + '\n');
|
|
407
|
+
}
|
|
408
|
+
// ── Helpers ──────────────────────────────────────────────────
|
|
409
|
+
/** Convert a directory path to a slug for file naming. */
|
|
410
|
+
function dirToSlug(dir) {
|
|
411
|
+
return dir
|
|
412
|
+
.replace(/^\.?\/?/, '')
|
|
413
|
+
.replace(/\//g, '-')
|
|
414
|
+
.replace(/[^a-z0-9-]/gi, '')
|
|
415
|
+
.toLowerCase()
|
|
416
|
+
|| 'root';
|
|
417
|
+
}
|
|
418
|
+
/** Escape a string for YAML double-quoted value. */
|
|
419
|
+
function escapeYaml(s) {
|
|
420
|
+
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
421
|
+
}
|
|
422
|
+
/** Detect the dominant naming pattern in a list of file paths. */
|
|
423
|
+
function detectDominantNaming(files) {
|
|
424
|
+
const counts = {};
|
|
425
|
+
for (const file of files) {
|
|
426
|
+
const basename = path.posix.basename(file).replace(/\.[^.]+$/, '');
|
|
427
|
+
// Skip index files and test files
|
|
428
|
+
if (basename === 'index' || /test|spec/i.test(basename))
|
|
429
|
+
continue;
|
|
430
|
+
let pattern = null;
|
|
431
|
+
if (basename.includes('-'))
|
|
432
|
+
pattern = 'kebab-case';
|
|
433
|
+
else if (basename.includes('_'))
|
|
434
|
+
pattern = 'snake_case';
|
|
435
|
+
else if (/^[A-Z]/.test(basename))
|
|
436
|
+
pattern = 'PascalCase';
|
|
437
|
+
else if (/[a-z][A-Z]/.test(basename))
|
|
438
|
+
pattern = 'camelCase';
|
|
439
|
+
if (pattern)
|
|
440
|
+
counts[pattern] = (counts[pattern] ?? 0) + 1;
|
|
441
|
+
}
|
|
442
|
+
const entries = Object.entries(counts);
|
|
443
|
+
if (entries.length === 0)
|
|
444
|
+
return null;
|
|
445
|
+
entries.sort((a, b) => b[1] - a[1]);
|
|
446
|
+
const total = entries.reduce((sum, [, c]) => sum + c, 0);
|
|
447
|
+
return entries[0][1] / total > 0.5 ? entries[0][0] : null;
|
|
448
|
+
}
|
|
449
|
+
//# sourceMappingURL=scopedRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopedRules.js","sourceRoot":"","sources":["../src/scopedRules.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDH,gDAMC;AAKD,0CAmDC;AAMD,wDA4DC;AAKD,0DAuCC;AAID,wDAIC;AAED,gDAIC;AAcD,0CAgCC;AAGD,sCAIC;AAQD,4CAkDC;AAKD,8CAkBC;AAgBD,gEAqBC;AAMD,wDAqBC;AA9aD,+CAAiC;AACjC,2CAA6B;AAG7B,mDAA+D;AAiC/D,gEAAgE;AAEhE,MAAM,mBAAmB,GAAe,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAE5E,gEAAgE;AAEhE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAoB;IACrD,OAAO;QACL,GAAG,eAAe,CAAC,KAAK,CAAC;QACzB,GAAG,sBAAsB,CAAC,KAAK,CAAC;QAChC,GAAG,uBAAuB,CAAC,KAAK,CAAC;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,KAAoB;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,C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AAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAkB,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7E,CAAC"}
|
package/dist/ui/Dashboard.d.ts
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dashboard —
|
|
2
|
+
* Dashboard — ink-based CLI dashboard with memory map and real-time assessments.
|
|
3
3
|
*
|
|
4
|
-
* Layout
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Input bar (watching/done only)
|
|
8
|
-
* Setup notes (compact single line)
|
|
9
|
-
* Status line (spinner/icon + phase + stats)
|
|
10
|
-
* Eval progress (harvest → probes → diagnosis)
|
|
11
|
-
* Token usage (after LLM generation)
|
|
12
|
-
* Summary card (after writing — sections, rules, paths)
|
|
13
|
-
* Diff summary (watch-mode: +N lines, -M lines)
|
|
14
|
-
* [Detail] (change trigger, warning, reasoning)
|
|
15
|
-
* Applied changes (after refinement)
|
|
16
|
-
*
|
|
17
|
-
* Layout (compact mode):
|
|
18
|
-
* Same but no banner, no reasoning, setup only if warning.
|
|
4
|
+
* Layout:
|
|
5
|
+
* Header → Memory Map → (Working status | Eval progress) →
|
|
6
|
+
* Assessment area → Status bar
|
|
19
7
|
*/
|
|
20
8
|
import React from 'react';
|
|
21
9
|
declare const Dashboard: React.FC;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/ui/Dashboard.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/ui/Dashboard.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AA+KnD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAmZtB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|