@cratis/pi 7.148.0 → 7.150.0

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.
Files changed (36) hide show
  1. package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +30 -16
  2. package/package/corpus/product-sync.json +2 -0
  3. package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +28 -0
  4. package/package/corpus/skills/cratis-arc-configuration/SKILL.md +89 -0
  5. package/package/corpus/skills/cratis-arc-configuration/references/arc-options.md +93 -0
  6. package/package/corpus/skills/cratis-arc-configuration/references/data-and-protection-keys.md +52 -0
  7. package/package/corpus/skills/cratis-arc-configuration/references/frontend-and-routes.md +53 -0
  8. package/package/corpus/skills/cratis-arc-configuration/references/symptoms.md +23 -0
  9. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/connection-options.md +29 -4
  10. package/package/corpus/skills/cratis-chronicle-configuration/SKILL.md +87 -0
  11. package/package/corpus/skills/cratis-chronicle-configuration/references/client-options.md +80 -0
  12. package/package/corpus/skills/cratis-chronicle-configuration/references/development-inner-loop.md +77 -0
  13. package/package/corpus/skills/cratis-chronicle-configuration/references/environment-variables.md +66 -0
  14. package/package/corpus/skills/cratis-chronicle-configuration/references/kernel-options.md +87 -0
  15. package/package/corpus/skills/cratis-chronicle-configuration/references/symptoms.md +53 -0
  16. package/package/corpus/skills/cratis-screenplay-reverse-engineering/SKILL.md +22 -4
  17. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/behavior-catalog.md +5 -0
  18. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/evidence-format.md +23 -0
  19. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/executable-intake.md +13 -0
  20. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/fidelity-check.md +13 -2
  21. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/probing-and-naming.md +29 -4
  22. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/process-drift.md +56 -0
  23. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/provenance.md +1 -1
  24. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/scoping.md +6 -0
  25. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/synthesis-rules.md +38 -3
  26. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/target-and-first-validation.md +3 -0
  27. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/drift-scope-self-test.mjs +87 -0
  28. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/drift-scope.mjs +155 -0
  29. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/README.md +23 -0
  30. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/change.diff +131 -0
  31. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/evidence-map.json +39 -0
  32. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/expected.json +52 -0
  33. package/package/corpus/skills/cratis-screenplay-reverse-engineering/verification.json +3 -1
  34. package/package/profile-catalog.json +2 -0
  35. package/package.json +1 -1
  36. package/src/index.ts +47 -35
@@ -0,0 +1,52 @@
1
+ {
2
+ "watermarks": {
3
+ "from": { "revision": "0cd6557", "input": "Screenplay/Crm.play", "inputDigest": "sha256:3b93313c21d1c51ea35dac93377cc852e0a3ee3fee38d998927ba4b90c562c44" },
4
+ "to": { "revision": "df908a2", "input": "Screenplay/Crm.play", "inputDigest": "sha256:166ff866090d299fc955f69826ff70aeef920ad4b53e58168814e1d3fe562ef7" }
5
+ },
6
+ "hunks": [
7
+ {
8
+ "path": "Source/Crm/Opportunities/Pipeline/Pipeline.cs", "before": "Source/Crm/Opportunities/Pipeline/Pipeline.cs",
9
+ "hunk": "@@ -30,4 +30,7 @@ public record Opportunity(global::SoloCrm.Common.OpportunityTitle Title, global:",
10
+ "classification": "process", "reason": "behavior source or unrecognized change; re-derive before deciding drift", "flows": ["Crm/Opportunities/Pipeline"]
11
+ },
12
+ {
13
+ "path": "Source/Crm/Tasks/Tasks/Tasks.cs", "before": "Source/Crm/Tasks/Tasks/Tasks.cs",
14
+ "hunk": "@@ -25,4 +25,10 @@ public record TaskItem(string RegardingId, global::SoloCrm.Common.TaskTitle Titl",
15
+ "classification": "process", "reason": "behavior source or unrecognized change; re-derive before deciding drift", "flows": ["Crm/Tasks/Tasks"]
16
+ },
17
+ {
18
+ "path": "Source/Crm/Today/TodayRules.cs", "before": "Source/Crm/Today/TodayRules.cs", "hunk": "@@ -0,0 +1,74 @@",
19
+ "classification": "process", "reason": "behavior source or unrecognized change; re-derive before deciding drift", "flows": []
20
+ },
21
+ {
22
+ "path": "Source/Crm/Tasks/Tasks/Tasks.ts", "before": "Source/Crm/Tasks/Tasks/Tasks.ts", "hunk": "@@ -0,0 +1,439 @@",
23
+ "classification": "structure-only", "reason": "generated TypeScript proxy", "flows": []
24
+ },
25
+ {
26
+ "path": "Source/yarn.lock", "before": "Source/yarn.lock", "hunk": "@@ -0,0 +1,1670 @@",
27
+ "classification": "structure-only", "reason": "lockfile", "flows": []
28
+ },
29
+ {
30
+ "path": "Source/scene.json", "before": "Source/scene.json", "hunk": "@@ -1 +1 @@",
31
+ "classification": "structure-only", "reason": "scene/build artifact", "flows": []
32
+ },
33
+ {
34
+ "path": "Source/src/stage-scene.json", "before": "Source/src/stage-scene.json", "hunk": "@@ -1 +1 @@",
35
+ "classification": "structure-only", "reason": "scene/build artifact", "flows": []
36
+ }
37
+ ],
38
+ "touchedFlows": ["Crm/Opportunities/Pipeline", "Crm/Tasks/Tasks"],
39
+ "untouchedFlows": [
40
+ "Crm/Contacts/ArchiveContact", "Crm/Contacts/Contacts", "Crm/Contacts/RegisterContact", "Crm/Contacts/RestoreContact", "Crm/Contacts/TagContact",
41
+ "Crm/Opportunities/ArchiveOpportunity", "Crm/Opportunities/ChangeOpportunityPricing", "Crm/Opportunities/MoveOpportunityToStage", "Crm/Opportunities/RegisterOpportunity", "Crm/Opportunities/RestoreOpportunity", "Crm/Opportunities/TagOpportunity",
42
+ "Crm/Organizations/ArchiveOrganization", "Crm/Organizations/Organizations", "Crm/Organizations/RegisterOrganization", "Crm/Organizations/RestoreOrganization",
43
+ "Crm/Stages/DefineStage", "Crm/Stages/RenameStage", "Crm/Stages/ReorderStage", "Crm/Stages/Stages",
44
+ "Crm/Tags/DefineTag", "Crm/Tags/Tags",
45
+ "Crm/Tasks/AddTask", "Crm/Tasks/CompleteTask", "Crm/Tasks/ReopenTask", "Crm/Tasks/RescheduleTask",
46
+ "Crm/Timeline/LogContactActivity", "Crm/Timeline/LogOpportunityActivity", "Crm/Timeline/LogOrganizationActivity", "Crm/Timeline/Timeline"
47
+ ],
48
+ "newFlowCandidates": [
49
+ { "path": "Source/Crm/Today/TodayRules.cs", "symbols": ["IsDormant", "IsDueToday", "IsOverdue"], "reason": "unmapped source; intake a candidate flow (including deletions or unsupported changes)" }
50
+ ],
51
+ "structureOnlyCount": 4
52
+ }
@@ -29,6 +29,8 @@
29
29
  { "kind": "skill-contains", "value": "Managed assembly intake", "file": "references/executable-intake.md" },
30
30
  { "kind": "skill-contains", "value": "Naming (non-leaked)", "file": "references/ground-truth-benchmark.md" },
31
31
  { "kind": "skill-contains", "value": "behavior catalog" },
32
- { "kind": "skill-contains", "value": "score-fidelity.mjs" }
32
+ { "kind": "skill-contains", "value": "score-fidelity.mjs" },
33
+ { "kind": "skill-contains", "value": "drift-scope.mjs --self-test" },
34
+ { "kind": "skill-contains", "value": "structure-only", "file": "references/process-drift.md" }
33
35
  ]
34
36
  }
@@ -277,6 +277,7 @@
277
277
  "cratis-arc-command-execution",
278
278
  "cratis-arc-command-operation",
279
279
  "cratis-arc-command-validation",
280
+ "cratis-arc-configuration",
280
281
  "cratis-arc-hosting",
281
282
  "cratis-arc-neo4j",
282
283
  "cratis-arc-observable-query-http",
@@ -531,6 +532,7 @@
531
532
  "availableTargets": [
532
533
  "cratis-commits-and-pull-requests",
533
534
  "cratis-rtk",
535
+ "cratis-chronicle-configuration",
534
536
  "cratis-chronicle-decision-reads",
535
537
  "cratis-chronicle-event-constraints",
536
538
  "cratis-chronicle-event-modeling",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.148.0",
3
+ "version": "7.150.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [
package/src/index.ts CHANGED
@@ -23,22 +23,23 @@ function skillPath(skill: string): string {
23
23
  return join(corpusRoot, 'skills', skill);
24
24
  }
25
25
 
26
- function allSkillPaths(): string[] {
27
- return [...new Set(profiles.flatMap(profile => profile.availableTargets ?? []))]
26
+ function skillPathsOf(selected: Profile[]): string[] {
27
+ return [...new Set(selected.flatMap(profile => profile.availableTargets ?? []))]
28
28
  .sort()
29
29
  .map(skillPath);
30
30
  }
31
31
 
32
+ function allSkillPaths(): string[] {
33
+ return skillPathsOf(profiles);
34
+ }
35
+
32
36
  function supportsLanguage(profile: Profile, languages: Set<string>): boolean {
33
37
  if (!profile.languages?.length) return true;
34
38
  return profile.languages.some(language => language === 'language-agnostic' || languages.has(language));
35
39
  }
36
40
 
37
- export function selectedSkillPaths(cwd: string): string[] {
38
- const configurationPath = join(cwd, '.cratis', 'ai.json');
39
- if (!existsSync(configurationPath)) return allSkillPaths();
40
-
41
- const configuration = JSON.parse(readFileSync(configurationPath, 'utf8')) as AiConfiguration;
41
+ /** The ids of the configured profiles and, transitively, the composed profiles that support the configured languages. */
42
+ function selectedProfileIds(configuration: AiConfiguration): Set<string> {
42
43
  const languages = new Set(configuration.languages ?? []);
43
44
  const selected = new Set<string>();
44
45
  const select = (id: string, explicitSelection: boolean): void => {
@@ -50,9 +51,16 @@ export function selectedSkillPaths(cwd: string): string[] {
50
51
  profile.composes?.forEach(child => select(child, false));
51
52
  };
52
53
  configuration.profiles?.forEach(profile => select(profile, true));
53
- return [...new Set(profiles.filter(profile => selected.has(profile.id)).flatMap(profile => profile.availableTargets ?? []))]
54
- .sort()
55
- .map(skillPath);
54
+ return selected;
55
+ }
56
+
57
+ export function selectedSkillPaths(cwd: string): string[] {
58
+ const configurationPath = join(cwd, '.cratis', 'ai.json');
59
+ if (!existsSync(configurationPath)) return allSkillPaths();
60
+
61
+ const configuration = JSON.parse(readFileSync(configurationPath, 'utf8')) as AiConfiguration;
62
+ const selected = selectedProfileIds(configuration);
63
+ return skillPathsOf(profiles.filter(profile => selected.has(profile.id)));
56
64
  }
57
65
 
58
66
  function isManagedInstallation(cwd: string): boolean {
@@ -68,35 +76,39 @@ function frontmatterValue(content: string, name: string): string | undefined {
68
76
  return line?.slice(prefix.length).trim().replace(/^"|"$/g, '');
69
77
  }
70
78
 
79
+ function profileMatchesSelection(profile: string | undefined, selectedProfiles: string[]): boolean {
80
+ if (profile === 'application') return selectedProfiles.some(candidate => candidate.startsWith('cratis/application'));
81
+ if (profile === 'framework') return selectedProfiles.some(candidate => candidate.startsWith('cratis/engineering'));
82
+ if (profile?.startsWith('cratis/')) return selectedProfiles.some(candidate => candidate === profile || candidate.startsWith(`${profile}/`));
83
+ return true;
84
+ }
85
+
86
+ /** A scope kind a rule can name through `applyTo`, and the configuration that satisfies it. */
87
+ interface ScopeKind {
88
+ named: (applyTo: string, path: string) => boolean;
89
+ satisfied: (configuration: AiConfiguration) => boolean;
90
+ }
91
+
92
+ const hasLanguage = (language: string) => (configuration: AiConfiguration) => (configuration.languages ?? []).includes(language);
93
+
94
+ const scopeKinds: ScopeKind[] = [
95
+ { named: applyTo => applyTo.includes('.cs'), satisfied: hasLanguage('csharp') },
96
+ { named: (applyTo, path) => applyTo.includes('.ts') || path.endsWith('/rtk.md'), satisfied: hasLanguage('typescript') },
97
+ { named: applyTo => applyTo.includes('.go') || applyTo.includes('go.mod') || applyTo.includes('go.sum'), satisfied: hasLanguage('go') },
98
+ { named: applyTo => applyTo.includes('.kt'), satisfied: hasLanguage('kotlin') },
99
+ { named: applyTo => applyTo.includes('.java'), satisfied: hasLanguage('java') },
100
+ { named: applyTo => applyTo.includes('.ex'), satisfied: hasLanguage('elixir') },
101
+ { named: applyTo => applyTo.includes('md'), satisfied: configuration => (configuration.profiles ?? []).includes('cratis/documentation') },
102
+ ];
103
+
71
104
  function ruleMatchesConfiguration(path: string, content: string, configuration: AiConfiguration): boolean {
72
- const selectedProfiles = configuration.profiles ?? [];
73
- const profile = frontmatterValue(content, 'profile');
74
- const hasApplicationProfile = selectedProfiles.some(candidate => candidate.startsWith('cratis/application'));
75
- const hasEngineeringProfile = selectedProfiles.some(candidate => candidate.startsWith('cratis/engineering'));
76
- if (profile === 'application' && !hasApplicationProfile) return false;
77
- if (profile === 'framework' && !hasEngineeringProfile) return false;
78
- if (profile?.startsWith('cratis/') && !selectedProfiles.some(candidate => candidate === profile || candidate.startsWith(`${profile}/`))) return false;
79
-
80
- const languages = configuration.languages ?? [];
81
- if (languages.length === 0) return true;
105
+ if (!profileMatchesSelection(frontmatterValue(content, 'profile'), configuration.profiles ?? [])) return false;
106
+ if ((configuration.languages ?? []).length === 0) return true;
82
107
  const applyTo = frontmatterValue(content, 'applyTo') ?? '';
83
- const needsCSharp = applyTo.includes('.cs');
84
- const needsTypeScript = applyTo.includes('.ts') || path.endsWith('/rtk.md');
85
- const needsGo = applyTo.includes('.go') || applyTo.includes('go.mod') || applyTo.includes('go.sum');
86
- const needsKotlin = applyTo.includes('.kt');
87
- const needsJava = applyTo.includes('.java');
88
- const needsElixir = applyTo.includes('.ex');
89
- const needsDocumentation = applyTo.includes('md');
90
108
  // A scope that also names model files (`.play`) is not tied to one language, so it is always kept.
91
109
  if (applyTo.includes('.play')) return true;
92
- if (!needsCSharp && !needsTypeScript && !needsGo && !needsKotlin && !needsJava && !needsElixir && !needsDocumentation) return true;
93
- return (needsCSharp && languages.includes('csharp')) ||
94
- (needsTypeScript && languages.includes('typescript')) ||
95
- (needsGo && languages.includes('go')) ||
96
- (needsKotlin && languages.includes('kotlin')) ||
97
- (needsJava && languages.includes('java')) ||
98
- (needsElixir && languages.includes('elixir')) ||
99
- (needsDocumentation && selectedProfiles.includes('cratis/documentation'));
110
+ const named = scopeKinds.filter(kind => kind.named(applyTo, path));
111
+ return named.length === 0 || named.some(kind => kind.satisfied(configuration));
100
112
  }
101
113
 
102
114
  /**