circle-ir-ai 4.34.0 → 4.35.2
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/CHANGELOG.md +27 -0
- package/dist/agents/mastra/workflow.d.ts +9 -0
- package/dist/agents/mastra/workflow.d.ts.map +1 -1
- package/dist/agents/mastra/workflow.js +12 -3
- package/dist/agents/mastra/workflow.js.map +1 -1
- package/dist/grid/index.d.ts +9 -0
- package/dist/grid/index.d.ts.map +1 -1
- package/dist/grid/index.js +19 -5
- package/dist/grid/index.js.map +1 -1
- package/dist/selectors/detect.d.ts +2 -0
- package/dist/selectors/detect.d.ts.map +1 -1
- package/dist/selectors/detect.js +1 -1
- package/dist/selectors/detect.js.map +1 -1
- package/dist/spec-gap/analyzer.js +30 -4
- package/dist/spec-gap/analyzer.js.map +1 -1
- package/dist/specifica/environment/diff.d.ts.map +1 -1
- package/dist/specifica/environment/diff.js +10 -2
- package/dist/specifica/environment/diff.js.map +1 -1
- package/dist/specifica/environment/index.d.ts +20 -3
- package/dist/specifica/environment/index.d.ts.map +1 -1
- package/dist/specifica/environment/index.js +40 -10
- package/dist/specifica/environment/index.js.map +1 -1
- package/dist/specifica/environment/merge.d.ts +12 -0
- package/dist/specifica/environment/merge.d.ts.map +1 -1
- package/dist/specifica/environment/merge.js +29 -6
- package/dist/specifica/environment/merge.js.map +1 -1
- package/dist/specifica/environment/read-ci.d.ts.map +1 -1
- package/dist/specifica/environment/read-ci.js +3 -2
- package/dist/specifica/environment/read-ci.js.map +1 -1
- package/dist/specifica/environment/read-compose.d.ts +17 -0
- package/dist/specifica/environment/read-compose.d.ts.map +1 -0
- package/dist/specifica/environment/read-compose.js +96 -0
- package/dist/specifica/environment/read-compose.js.map +1 -0
- package/dist/specifica/environment/read-docker.js +2 -2
- package/dist/specifica/environment/read-docker.js.map +1 -1
- package/dist/specifica/environment/read-dotenv.js +3 -3
- package/dist/specifica/environment/read-dotenv.js.map +1 -1
- package/dist/specifica/environment/read-wrangler.js +2 -2
- package/dist/specifica/environment/read-wrangler.js.map +1 -1
- package/dist/specifica/environment/secrets.d.ts +17 -2
- package/dist/specifica/environment/secrets.d.ts.map +1 -1
- package/dist/specifica/environment/secrets.js +67 -12
- package/dist/specifica/environment/secrets.js.map +1 -1
- package/dist/specifica/environment/write.d.ts +24 -1
- package/dist/specifica/environment/write.d.ts.map +1 -1
- package/dist/specifica/environment/write.js +183 -73
- package/dist/specifica/environment/write.js.map +1 -1
- package/dist/specifica/file-routes.d.ts +89 -0
- package/dist/specifica/file-routes.d.ts.map +1 -0
- package/dist/specifica/file-routes.js +374 -0
- package/dist/specifica/file-routes.js.map +1 -0
- package/dist/specifica/generator.d.ts.map +1 -1
- package/dist/specifica/generator.js +124 -2
- package/dist/specifica/generator.js.map +1 -1
- package/dist/specifica/index.d.ts +4 -1
- package/dist/specifica/index.d.ts.map +1 -1
- package/dist/specifica/index.js +4 -1
- package/dist/specifica/index.js.map +1 -1
- package/dist/specifica/layering.d.ts +140 -0
- package/dist/specifica/layering.d.ts.map +1 -0
- package/dist/specifica/layering.js +365 -0
- package/dist/specifica/layering.js.map +1 -0
- package/dist/specifica/learned-diff.d.ts +15 -1
- package/dist/specifica/learned-diff.d.ts.map +1 -1
- package/dist/specifica/learned-diff.js +63 -21
- package/dist/specifica/learned-diff.js.map +1 -1
- package/dist/specifica/learned-tree.d.ts +4 -0
- package/dist/specifica/learned-tree.d.ts.map +1 -1
- package/dist/specifica/learned-tree.js.map +1 -1
- package/dist/specifica/level-design.d.ts +170 -0
- package/dist/specifica/level-design.d.ts.map +1 -0
- package/dist/specifica/level-design.js +1253 -0
- package/dist/specifica/level-design.js.map +1 -0
- package/dist/specifica/library-surface.d.ts +62 -0
- package/dist/specifica/library-surface.d.ts.map +1 -0
- package/dist/specifica/library-surface.js +348 -0
- package/dist/specifica/library-surface.js.map +1 -0
- package/dist/specifica/modules.d.ts +37 -0
- package/dist/specifica/modules.d.ts.map +1 -0
- package/dist/specifica/modules.js +536 -0
- package/dist/specifica/modules.js.map +1 -0
- package/dist/specifica/spec-tree.d.ts +150 -0
- package/dist/specifica/spec-tree.d.ts.map +1 -0
- package/dist/specifica/spec-tree.js +689 -0
- package/dist/specifica/spec-tree.js.map +1 -0
- package/dist/specifica/tree-types.d.ts +228 -0
- package/dist/specifica/tree-types.d.ts.map +1 -0
- package/dist/specifica/tree-types.js +35 -0
- package/dist/specifica/tree-types.js.map +1 -0
- package/dist/specifica/tree-writer.d.ts +133 -0
- package/dist/specifica/tree-writer.d.ts.map +1 -0
- package/dist/specifica/tree-writer.js +402 -0
- package/dist/specifica/tree-writer.js.map +1 -0
- package/dist/specifica/types.d.ts +40 -0
- package/dist/specifica/types.d.ts.map +1 -1
- package/dist/specifica/use-cases.d.ts +80 -0
- package/dist/specifica/use-cases.d.ts.map +1 -0
- package/dist/specifica/use-cases.js +888 -0
- package/dist/specifica/use-cases.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec recovery 0.2 integration: build the learned Specifica tree for a
|
|
3
|
+
* directory (techspec `spec-recovery/.specifica/0.2/design.md` §1–§2).
|
|
4
|
+
*
|
|
5
|
+
* detectModules (SR-E1) → per level (repository, each module):
|
|
6
|
+
* use cases (SR-E2) → layer classification (SR-E3: domain → spec, layers
|
|
7
|
+
* → one line per layer in principles, shared lines lifted to the parent)
|
|
8
|
+
* → spec.md (use cases grouped by area, domain rules only)
|
|
9
|
+
* → design.md (SR-E4) → principles.md (layer lines + learned conventions)
|
|
10
|
+
* → environment.md at the root (existing learner) → tasks.md empty
|
|
11
|
+
* → writeSpecTree (SR-E5).
|
|
12
|
+
*
|
|
13
|
+
* Size (spec §2 rule 3, default pending Eyal's confirmation): a spec.md that
|
|
14
|
+
* does not fit ~100 lines first drops the per-rule `from:` lines (rules.json
|
|
15
|
+
* keeps every code path), then lists one table row per area with its use
|
|
16
|
+
* cases; rules that still do not fit are counted and stay in rules.json. A
|
|
17
|
+
* package is never split into modules (Eyal's rule); too many areas merge into
|
|
18
|
+
* one "Other areas" row.
|
|
19
|
+
*
|
|
20
|
+
* Model arm (opt-in, `skipLLM` false): one call per level may phrase use-case
|
|
21
|
+
* sentences and principle lines from the deterministic facts only. Each
|
|
22
|
+
* phrase is keyed to a use case id or a layer that the static arm found;
|
|
23
|
+
* anything else in the answer is dropped, so the model never adds a module,
|
|
24
|
+
* a use case or a rule. Phrases are shown as `suggested · llm: <model>`. The
|
|
25
|
+
* static arm produces the complete tree alone.
|
|
26
|
+
*
|
|
27
|
+
* Deterministic on the static arm: inputs sorted, no timestamps; same source
|
|
28
|
+
* and engine version → same bytes and rule keys.
|
|
29
|
+
*/
|
|
30
|
+
import type { CircleIR } from 'circle-ir';
|
|
31
|
+
import { type LayerDecision, type LayerDependency } from './layering.js';
|
|
32
|
+
import { type SubjectCommit } from './learned-tree.js';
|
|
33
|
+
import { levelFilePaths, type WriteTreeResult } from './tree-writer.js';
|
|
34
|
+
import { type EnvironmentFolderFiles, type Module, type SpecLevel, type UseCase } from './tree-types.js';
|
|
35
|
+
import type { ExtendedFileEvidence, FileEvidence, Requirement, SpecMdContent } from './types.js';
|
|
36
|
+
/** One analysed source file. */
|
|
37
|
+
export interface TreeSourceFile {
|
|
38
|
+
/** Absolute path. */
|
|
39
|
+
abs: string;
|
|
40
|
+
/** Repository-relative POSIX path. */
|
|
41
|
+
rel: string;
|
|
42
|
+
code: string;
|
|
43
|
+
ir: CircleIR;
|
|
44
|
+
evidence: FileEvidence;
|
|
45
|
+
extended?: ExtendedFileEvidence;
|
|
46
|
+
}
|
|
47
|
+
/** The model arm: phrase use cases and principle lines from the facts. */
|
|
48
|
+
export interface TreePhraser {
|
|
49
|
+
/** Recorded as `llm: <model>`. */
|
|
50
|
+
model: string;
|
|
51
|
+
phrase(input: PhraseInput): Promise<PhraseOutput | null>;
|
|
52
|
+
}
|
|
53
|
+
export interface PhraseInput {
|
|
54
|
+
level: string;
|
|
55
|
+
useCases: Array<{
|
|
56
|
+
id: string;
|
|
57
|
+
area: string;
|
|
58
|
+
title: string;
|
|
59
|
+
trigger: string;
|
|
60
|
+
rules: string[];
|
|
61
|
+
}>;
|
|
62
|
+
layers: Array<{
|
|
63
|
+
layer: string;
|
|
64
|
+
name: string;
|
|
65
|
+
facts: string;
|
|
66
|
+
}>;
|
|
67
|
+
}
|
|
68
|
+
export interface PhraseOutput {
|
|
69
|
+
useCases?: Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
sentence: string;
|
|
72
|
+
}>;
|
|
73
|
+
layers?: Array<{
|
|
74
|
+
layer: string;
|
|
75
|
+
line: string;
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
78
|
+
export interface BuildTreeOptions {
|
|
79
|
+
/** Repository root (where `.cognium/` goes). */
|
|
80
|
+
projectRoot: string;
|
|
81
|
+
/** The directory scanned (default the project root). */
|
|
82
|
+
scanRoot?: string;
|
|
83
|
+
files: TreeSourceFile[];
|
|
84
|
+
/** circle-ir-ai version, for rules.json. */
|
|
85
|
+
engineVersion: string;
|
|
86
|
+
subject?: SubjectCommit;
|
|
87
|
+
/** Learned environment.md text; omitted → no environment.md. */
|
|
88
|
+
environment?: string;
|
|
89
|
+
/** The folder form (`environment/<part>.md`), when one file would pass ~100 lines; wins over `environment`. */
|
|
90
|
+
environmentFolder?: EnvironmentFolderFiles;
|
|
91
|
+
/** Attach ids@0.1 stable ids to a spec's code paths (generator's helper). */
|
|
92
|
+
attachStableIds?: (spec: SpecMdContent, root: string) => Promise<void>;
|
|
93
|
+
/** Model arm; absent → static arm only. */
|
|
94
|
+
phraser?: TreePhraser;
|
|
95
|
+
/** Line budget per file (default 100). */
|
|
96
|
+
budget?: number;
|
|
97
|
+
}
|
|
98
|
+
/** What one level produced, for callers and the smoke report. */
|
|
99
|
+
export interface LevelBuild {
|
|
100
|
+
level: SpecLevel;
|
|
101
|
+
useCases: UseCase[];
|
|
102
|
+
domainRules: Requirement[];
|
|
103
|
+
layerDecisions: LayerDecision[];
|
|
104
|
+
files: string[];
|
|
105
|
+
/** spec.md render mode used to fit the budget. */
|
|
106
|
+
specMode: 'full' | 'brief' | 'compact';
|
|
107
|
+
/** Use cases / layer lines the model phrased (model arm). */
|
|
108
|
+
phrased: {
|
|
109
|
+
useCases: number;
|
|
110
|
+
layers: number;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface BuiltTree {
|
|
114
|
+
tree: SpecLevel;
|
|
115
|
+
levels: LevelBuild[];
|
|
116
|
+
modules: Module[];
|
|
117
|
+
}
|
|
118
|
+
/** Direct dependencies a level's manifest declares (npm, Cargo, Go). */
|
|
119
|
+
export declare function manifestDependencies(projectRoot: string, root: string): LayerDependency[];
|
|
120
|
+
/**
|
|
121
|
+
* Build the learned tree in memory. Levels: the repository, and one per
|
|
122
|
+
* module (workspace package or service) inside the scanned directory.
|
|
123
|
+
*/
|
|
124
|
+
export declare function buildSpecTree(opts: BuildTreeOptions): Promise<BuiltTree>;
|
|
125
|
+
/** Per-level line counts of the four markdown files (smoke report). */
|
|
126
|
+
export declare function treeLineCounts(tree: SpecLevel): Array<{
|
|
127
|
+
level: string;
|
|
128
|
+
principles: number;
|
|
129
|
+
environment?: number;
|
|
130
|
+
environmentFolder?: Record<keyof EnvironmentFolderFiles, number>;
|
|
131
|
+
spec: number;
|
|
132
|
+
design: number;
|
|
133
|
+
tasks: number;
|
|
134
|
+
}>;
|
|
135
|
+
/** Build and write; returns what was written. */
|
|
136
|
+
export declare function generateSpecTree(opts: BuildTreeOptions & {
|
|
137
|
+
learnedDir?: string;
|
|
138
|
+
explicitOutputDir?: boolean;
|
|
139
|
+
}): Promise<BuiltTree & {
|
|
140
|
+
write: WriteTreeResult;
|
|
141
|
+
}>;
|
|
142
|
+
export { levelFilePaths };
|
|
143
|
+
/**
|
|
144
|
+
* The model phraser: one `chatJSON` call per level, given only the
|
|
145
|
+
* deterministic facts (use-case titles, triggers, rule texts, layer lines).
|
|
146
|
+
* The answer is keyed back to those ids; anything else is dropped by
|
|
147
|
+
* `phraseLevel`. Any failure → `null` (the level stays static).
|
|
148
|
+
*/
|
|
149
|
+
export declare function llmTreePhraser(model: string, specModel?: string): TreePhraser;
|
|
150
|
+
//# sourceMappingURL=spec-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-tree.d.ts","sourceRoot":"","sources":["../../src/specifica/spec-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,eAAe,EAGrB,MAAM,eAAe,CAAC;AAMvB,OAAO,EAA+D,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpH,OAAO,EAAiB,cAAc,EAAqD,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1I,OAAO,EAA+C,KAAK,sBAAsB,EAAqB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEzK,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIjG,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,QAAQ,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAC1D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