@shrkcrft/inspector 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +1 -1
- package/dist/adoption-state.js +1 -1
- package/dist/area-map.d.ts +14 -0
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +17 -0
- package/dist/ci-permissions-fix.d.ts +1 -1
- package/dist/ci-permissions-fix.d.ts.map +1 -1
- package/dist/ci-permissions-fix.js +182 -1
- package/dist/construct-adoption-diff.d.ts.map +1 -1
- package/dist/construct-adoption-diff.js +1 -2
- package/dist/construct-adoption.d.ts.map +1 -1
- package/dist/construct-adoption.js +10 -2
- package/dist/construct-inference.d.ts.map +1 -1
- package/dist/construct-inference.js +1 -2
- package/dist/construct-registry.d.ts.map +1 -1
- package/dist/construct-registry.js +10 -2
- package/dist/contract-template-registry.d.ts.map +1 -1
- package/dist/contract-template-registry.js +10 -2
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +10 -2
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +9 -2
- package/dist/feedback-ingestion.js +10 -2
- package/dist/git-helpers.d.ts +12 -0
- package/dist/git-helpers.d.ts.map +1 -1
- package/dist/git-helpers.js +63 -0
- package/dist/impact-render.d.ts.map +1 -1
- package/dist/impact-render.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/ingest-drafts.js +4 -8
- package/dist/migration-profile-registry.d.ts.map +1 -1
- package/dist/migration-profile-registry.js +10 -2
- package/dist/onboarding-drafts-merge.d.ts +71 -0
- package/dist/onboarding-drafts-merge.d.ts.map +1 -0
- package/dist/onboarding-drafts-merge.js +174 -0
- package/dist/onboarding-drafts.d.ts +14 -0
- package/dist/onboarding-drafts.d.ts.map +1 -1
- package/dist/onboarding-drafts.js +39 -5
- package/dist/ownership.js +10 -2
- package/dist/pack-helper-registry.d.ts.map +1 -1
- package/dist/pack-helper-registry.js +10 -2
- package/dist/pack-release-check.d.ts.map +1 -1
- package/dist/pack-release-check.js +10 -3
- package/dist/pack-symbol-compat.d.ts +17 -4
- package/dist/pack-symbol-compat.d.ts.map +1 -1
- package/dist/pack-symbol-compat.js +155 -7
- package/dist/pack-test-runner.js +10 -2
- package/dist/playbook-registry.d.ts.map +1 -1
- package/dist/playbook-registry.js +10 -2
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +1 -1
- package/dist/plugin-lifecycle-profile-registry.js +10 -2
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +11 -3
- package/dist/policy-test.js +11 -3
- package/dist/product-coherence.js +5 -5
- package/dist/registration-hint-registry.d.ts.map +1 -1
- package/dist/registration-hint-registry.js +10 -2
- package/dist/release-readiness.js +2 -2
- package/dist/review-packet-v2.d.ts.map +1 -1
- package/dist/review-packet-v2.js +13 -3
- package/dist/rule-scaffold.d.ts.map +1 -1
- package/dist/rule-scaffold.js +4 -12
- package/dist/scaffold-patterns.js +10 -2
- package/dist/search-tuning-registry.d.ts.map +1 -1
- package/dist/search-tuning-registry.js +10 -2
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +0 -1
- package/dist/task-routing-hint-registry.d.ts.map +1 -1
- package/dist/task-routing-hint-registry.js +10 -2
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +11 -3
- package/dist/upgrade-advisor.js +1 -1
- package/package.json +21 -22
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SharkCraft inspector: project overview, doctor checks, AI-agent instructions.
|
|
4
4
|
|
|
5
|
-
Part of [SharkCraft](https://github.com/
|
|
5
|
+
Part of [SharkCraft](https://github.com/sharkcraft/sharkcraft) — a deterministic, local-first toolkit that gives AI coding agents durable project context. See the main repo for documentation, examples, and the `shrk` CLI.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
package/dist/adoption-state.js
CHANGED
|
@@ -133,7 +133,7 @@ export function buildAdoptionState(input) {
|
|
|
133
133
|
projectRoot: input.projectRoot,
|
|
134
134
|
createdAt: input.previousCreatedAt ?? now,
|
|
135
135
|
updatedAt: now,
|
|
136
|
-
sharkcraftVersion: input.sharkcraftVersion ?? '0.1.0-alpha.
|
|
136
|
+
sharkcraftVersion: input.sharkcraftVersion ?? '0.1.0-alpha.9',
|
|
137
137
|
command: input.command,
|
|
138
138
|
sourceDraftFiles: collectDraftFileHashes(input.projectRoot),
|
|
139
139
|
targetFiles: collectTargetHashes(input.projectRoot, input.targets),
|
package/dist/area-map.d.ts
CHANGED
|
@@ -36,7 +36,21 @@ export interface IAreaMap {
|
|
|
36
36
|
projectRoot: string;
|
|
37
37
|
areas: readonly IAreaMapEntry[];
|
|
38
38
|
unclassifiedFiles: number;
|
|
39
|
+
/**
|
|
40
|
+
* When set, `areas` was filtered to a subset of the repo's areas
|
|
41
|
+
* (e.g. only areas touched by the current diff). `areasTotal` reports
|
|
42
|
+
* the original area count so the consumer knows the map was slimmed.
|
|
43
|
+
*/
|
|
44
|
+
areasTotal?: number;
|
|
45
|
+
/** True iff areas[] is a filtered subset of the full repo area map. */
|
|
46
|
+
filtered?: boolean;
|
|
39
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Return a copy of `map` with `areas[]` filtered to only those whose `id`
|
|
50
|
+
* is in `keepIds`. Sets `filtered: true` and preserves `areasTotal` so
|
|
51
|
+
* consumers know the map was slimmed.
|
|
52
|
+
*/
|
|
53
|
+
export declare function filterAreaMap(map: IAreaMap, keepIds: ReadonlyArray<string>): IAreaMap;
|
|
40
54
|
export declare function buildAreaMap(inspection: ISharkcraftInspection): IAreaMap;
|
|
41
55
|
export declare function renderAreaMapText(map: IAreaMap): string;
|
|
42
56
|
export declare function renderAreaMapMarkdown(map: IAreaMap): string;
|
package/dist/area-map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-map.d.ts","sourceRoot":"","sources":["../src/area-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,OAAO,eAAe,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"area-map.d.ts","sourceRoot":"","sources":["../src/area-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,oBAAY,QAAQ;IAClB,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C,GAAG,EAAE,QAAQ,GAAG,MAAM,CAc3D"}
|
package/dist/area-map.js
CHANGED
|
@@ -18,6 +18,23 @@ export var AreaKind;
|
|
|
18
18
|
AreaKind["Generated"] = "generated";
|
|
19
19
|
AreaKind["Unknown"] = "unknown";
|
|
20
20
|
})(AreaKind || (AreaKind = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Return a copy of `map` with `areas[]` filtered to only those whose `id`
|
|
23
|
+
* is in `keepIds`. Sets `filtered: true` and preserves `areasTotal` so
|
|
24
|
+
* consumers know the map was slimmed.
|
|
25
|
+
*/
|
|
26
|
+
export function filterAreaMap(map, keepIds) {
|
|
27
|
+
if (keepIds.length === 0)
|
|
28
|
+
return map;
|
|
29
|
+
const keep = new Set(keepIds);
|
|
30
|
+
const filtered = map.areas.filter((a) => keep.has(a.id));
|
|
31
|
+
return {
|
|
32
|
+
...map,
|
|
33
|
+
areas: filtered,
|
|
34
|
+
areasTotal: map.areasTotal ?? map.areas.length,
|
|
35
|
+
filtered: true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
21
38
|
const AREA_PATTERNS = [
|
|
22
39
|
{ kind: AreaKind.Core, match: [/^packages\/core(\/|$)/, /^src\/core(\/|$)/], idHint: 'core' },
|
|
23
40
|
{ kind: AreaKind.Common, match: [/^packages\/(common|shared)(\/|$)/, /^src\/(common|shared)(\/|$)/], idHint: 'common' },
|
|
@@ -16,7 +16,7 @@ import type { ICiPermissionsAudit, CiProviderForAudit } from './ci-permissions.j
|
|
|
16
16
|
export declare const CI_PERMISSIONS_FIX_SCHEMA = "sharkcraft.ci-permissions-fix/v1";
|
|
17
17
|
export type CiPermissionsFixFormat = 'patch' | 'markdown' | 'json';
|
|
18
18
|
export interface ICiPermissionsFixHint {
|
|
19
|
-
code: 'add-permissions-block' | 'add-pull-requests-write' | 'narrow-permissions-block' | 'remove-pull-requests-write' | 'pin-action-sha' | 'pin-image-digest' | 'no-action-required';
|
|
19
|
+
code: 'add-permissions-block' | 'add-pull-requests-write' | 'narrow-permissions-block' | 'remove-pull-requests-write' | 'pin-action-sha' | 'pin-image-digest' | 'requires-manual' | 'add-oidc-block' | 'add-id-tokens-block' | 'add-azure-permissions-block' | 'no-action-required';
|
|
20
20
|
severity: 'info' | 'warning' | 'error';
|
|
21
21
|
message: string;
|
|
22
22
|
explanation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-permissions-fix.d.ts","sourceRoot":"","sources":["../src/ci-permissions-fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,uBAAuB,GACvB,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,GAC5B,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,OAAO,yBAAyB,CAAC;IACzC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"ci-permissions-fix.d.ts","sourceRoot":"","sources":["../src/ci-permissions-fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EACA,uBAAuB,GACvB,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,GAC5B,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,qBAAqB,GACrB,6BAA6B,GAC7B,oBAAoB,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,OAAO,yBAAyB,CAAC;IACzC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;CACvB;AAoPD,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,mBAAmB,GAAG,wBAAwB,CAkFjG;AA+CD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,wBAAwB,EACjC,MAAM,EAAE,sBAAsB,GAC7B,MAAM,CAoCR"}
|
|
@@ -20,6 +20,24 @@ function leastPrivilegeBlock(provider, withPullRequestsWrite) {
|
|
|
20
20
|
? 'permissions:\n contents: read\n pull-requests: write\n'
|
|
21
21
|
: 'permissions:\n contents: read\n';
|
|
22
22
|
}
|
|
23
|
+
if (provider === 'gitlab') {
|
|
24
|
+
return withPullRequestsWrite
|
|
25
|
+
? '# GitLab CI uses CI/CD variables, not file-level permissions.\n# Store a Project Access Token with `api` scope as a masked variable\n# named REVIEW_TOKEN, then reference it in the comment-posting job:\n# variables:\n# GIT_STRATEGY: clone\n# id_tokens:\n# GITLAB_OIDC_TOKEN:\n# aud: https://gitlab.example.com\n'
|
|
26
|
+
: '# GitLab CI uses CI/CD variables, not file-level permissions.\n# $CI_JOB_TOKEN is read-only for repo metadata — no extra scopes required.\n';
|
|
27
|
+
}
|
|
28
|
+
if (provider === 'bitbucket') {
|
|
29
|
+
return withPullRequestsWrite
|
|
30
|
+
? 'oidc: true # add to each step that needs write scopes — pair with a repo access token in Bitbucket settings\n'
|
|
31
|
+
: '# Bitbucket Pipelines has no top-level permissions block.\n# Use repository access tokens (Bitbucket settings → Access tokens) and store them as secured variables.\n';
|
|
32
|
+
}
|
|
33
|
+
if (provider === 'azure') {
|
|
34
|
+
return withPullRequestsWrite
|
|
35
|
+
? 'permissions:\n contents: read\n pull-requests: write # Azure Pipelines job-level permissions (recent feature)\n'
|
|
36
|
+
: 'permissions:\n contents: read\n';
|
|
37
|
+
}
|
|
38
|
+
if (provider === 'jenkins') {
|
|
39
|
+
return '// Jenkins permissions are configured in Manage Jenkins → Security → Authorization.\n// Use Matrix-based or Role-based security; the Jenkinsfile itself cannot grant or restrict scopes.\n';
|
|
40
|
+
}
|
|
23
41
|
return '# (least-privilege block — provider-specific)\n';
|
|
24
42
|
}
|
|
25
43
|
function makeAddPermissionsBlockPatch(file, body, withPullRequestsWrite) {
|
|
@@ -45,6 +63,145 @@ function makeAddPermissionsBlockPatch(file, body, withPullRequestsWrite) {
|
|
|
45
63
|
];
|
|
46
64
|
return patch.join('\n') + '\n';
|
|
47
65
|
}
|
|
66
|
+
function makeInsertAfterTopLineMatchingPatch(file, body, matcher, block) {
|
|
67
|
+
const lines = body.split(/\r?\n/);
|
|
68
|
+
let anchor = -1;
|
|
69
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
70
|
+
if (matcher.test(lines[i])) {
|
|
71
|
+
anchor = i;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (anchor < 0)
|
|
76
|
+
anchor = 0;
|
|
77
|
+
const blockLines = block.split(/\r?\n/).filter((l) => l.length > 0);
|
|
78
|
+
return [
|
|
79
|
+
`--- a/${file}`,
|
|
80
|
+
`+++ b/${file}`,
|
|
81
|
+
`@@ -${anchor + 1},1 +${anchor + 1},${1 + blockLines.length} @@`,
|
|
82
|
+
` ${lines[anchor] ?? ''}`,
|
|
83
|
+
...blockLines.map((l) => `+${l}`),
|
|
84
|
+
].join('\n') + '\n';
|
|
85
|
+
}
|
|
86
|
+
function emitGitlabHints(audit, body) {
|
|
87
|
+
const hints = [];
|
|
88
|
+
if (audit.postsComments) {
|
|
89
|
+
const block = 'id_tokens:\n GITLAB_OIDC_TOKEN:\n aud: https://gitlab.example.com # replace with your GitLab host\n';
|
|
90
|
+
// Anchor after the first `stages:` line if present, otherwise top.
|
|
91
|
+
const hasIdTokens = /\bid_tokens:\s*$/m.test(body);
|
|
92
|
+
if (hasIdTokens) {
|
|
93
|
+
hints.push({
|
|
94
|
+
code: 'requires-manual',
|
|
95
|
+
severity: 'info',
|
|
96
|
+
message: 'Pipeline already declares `id_tokens:` — confirm the `aud:` matches your GitLab instance and the consuming script trades the OIDC token for a scoped access token.',
|
|
97
|
+
explanation: 'GitLab CI has no native permissions block. Least-privilege comes from OIDC + a Project Access Token with `api` scope on the consuming job.',
|
|
98
|
+
insertion: leastPrivilegeBlock('gitlab', true),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
hints.push({
|
|
103
|
+
code: 'add-id-tokens-block',
|
|
104
|
+
severity: 'warning',
|
|
105
|
+
message: 'Pipeline posts MR comments without declaring an `id_tokens:` block — comment-posting will require a long-lived PRIVATE-TOKEN, which is harder to rotate.',
|
|
106
|
+
explanation: 'Use GitLab OIDC: declare `id_tokens.GITLAB_OIDC_TOKEN.aud` on the job, then exchange the token for a Project Access Token at runtime. Avoids storing long-lived secrets in CI/CD variables.',
|
|
107
|
+
patch: body ? makeInsertAfterTopLineMatchingPatch(audit.workflowFile, body, /^\s*stages:\s*$/, block) : undefined,
|
|
108
|
+
insertion: block,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
hints.push({
|
|
114
|
+
code: 'no-action-required',
|
|
115
|
+
severity: 'info',
|
|
116
|
+
message: 'No MR-comment-posting step detected — $CI_JOB_TOKEN is sufficient and no scoped token is required.',
|
|
117
|
+
explanation: 'GitLab CI runs each job with a read-only $CI_JOB_TOKEN by default; only enable write scopes (Project Access Tokens) on jobs that actually mutate the project.',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return hints;
|
|
121
|
+
}
|
|
122
|
+
function emitBitbucketHints(audit, body) {
|
|
123
|
+
const hints = [];
|
|
124
|
+
const hasOidc = /\boidc:\s*true\b/.test(body);
|
|
125
|
+
if (audit.postsComments && !hasOidc) {
|
|
126
|
+
const block = ' oidc: true # exchange for a scoped repo access token at runtime\n';
|
|
127
|
+
hints.push({
|
|
128
|
+
code: 'add-oidc-block',
|
|
129
|
+
severity: 'warning',
|
|
130
|
+
message: 'Pipeline posts PR comments without declaring `oidc: true` — pair the comment-posting step with OIDC + a repository access token instead of a long-lived secret.',
|
|
131
|
+
explanation: 'Bitbucket Pipelines has no top-level permissions block; least-privilege comes from `oidc: true` + a repo-scoped access token configured in Bitbucket settings.',
|
|
132
|
+
patch: body
|
|
133
|
+
? makeInsertAfterTopLineMatchingPatch(audit.workflowFile, body, /^\s*-\s*step:\s*$/, block)
|
|
134
|
+
: undefined,
|
|
135
|
+
insertion: block,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
else if (!audit.postsComments) {
|
|
139
|
+
hints.push({
|
|
140
|
+
code: 'no-action-required',
|
|
141
|
+
severity: 'info',
|
|
142
|
+
message: 'No PR-comment-posting step detected — the default repository access token is read-only.',
|
|
143
|
+
explanation: 'Bitbucket Pipelines does not require explicit permissions for read-only operations. Avoid checking long-lived tokens into the file regardless.',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
hints.push({
|
|
148
|
+
code: 'requires-manual',
|
|
149
|
+
severity: 'info',
|
|
150
|
+
message: 'Pipeline already declares `oidc: true`. Confirm the consuming step exchanges the token for the minimum repo scope it needs.',
|
|
151
|
+
explanation: 'OIDC exchange happens at runtime — the workflow file cannot enforce the resulting token\'s scope. Audit the API calls in the step.',
|
|
152
|
+
insertion: leastPrivilegeBlock('bitbucket', true),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return hints;
|
|
156
|
+
}
|
|
157
|
+
function emitAzureHints(audit, body) {
|
|
158
|
+
const hints = [];
|
|
159
|
+
const hasPermissions = /^\s*permissions:\s*$/m.test(body);
|
|
160
|
+
if (audit.postsComments && !hasPermissions) {
|
|
161
|
+
const block = leastPrivilegeBlock('azure', true);
|
|
162
|
+
hints.push({
|
|
163
|
+
code: 'add-azure-permissions-block',
|
|
164
|
+
severity: 'warning',
|
|
165
|
+
message: 'Pipeline posts PR comments without declaring a job-level `permissions:` block. Azure Pipelines now supports job-level permissions — use them to scope the System.AccessToken.',
|
|
166
|
+
explanation: 'When the job-level `permissions:` feature is enabled on the project, Azure Pipelines restricts System.AccessToken to the scopes you list. Without the block, the token defaults to the project-level setting.',
|
|
167
|
+
patch: body
|
|
168
|
+
? makeInsertAfterTopLineMatchingPatch(audit.workflowFile, body, /^\s*(jobs|stages):\s*$/, block)
|
|
169
|
+
: undefined,
|
|
170
|
+
insertion: block,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else if (!audit.postsComments) {
|
|
174
|
+
hints.push({
|
|
175
|
+
code: 'no-action-required',
|
|
176
|
+
severity: 'info',
|
|
177
|
+
message: 'No PR-comment-posting step detected — the default Build Service token is read-only for repo metadata.',
|
|
178
|
+
explanation: 'Azure Pipelines defaults the System.AccessToken to project-scoped read; only enable write scopes when the pipeline mutates repo state.',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
hints.push({
|
|
183
|
+
code: 'requires-manual',
|
|
184
|
+
severity: 'info',
|
|
185
|
+
message: 'Pipeline already declares a `permissions:` block. Confirm it lists only the scopes the comment-posting job needs (typically `contents: read` + `pull-requests: write`).',
|
|
186
|
+
explanation: 'Azure Pipelines permissions blocks are additive per job — make sure broader scopes are not granted to unrelated jobs.',
|
|
187
|
+
insertion: leastPrivilegeBlock('azure', true),
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return hints;
|
|
191
|
+
}
|
|
192
|
+
function emitJenkinsHints(audit) {
|
|
193
|
+
return [
|
|
194
|
+
{
|
|
195
|
+
code: 'requires-manual',
|
|
196
|
+
severity: audit.postsComments ? 'warning' : 'info',
|
|
197
|
+
message: audit.postsComments
|
|
198
|
+
? 'Jenkinsfile posts PR comments — declarative pipelines cannot grant permissions; this is configured in Jenkins itself.'
|
|
199
|
+
: 'Jenkinsfile detected — declarative pipelines cannot grant permissions; this is configured in Jenkins itself.',
|
|
200
|
+
explanation: 'Jenkins permissions are administered via Manage Jenkins → Security → Authorization (Matrix-based or Role-based plugin). Edit there, not in the Jenkinsfile. The pipeline\'s `withCredentials(...)` block scopes secrets to a step but does not grant repository write access on its own.',
|
|
201
|
+
insertion: leastPrivilegeBlock('jenkins', audit.postsComments),
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
}
|
|
48
205
|
function makeNarrowPermissionsPatch(file, body) {
|
|
49
206
|
// Find the broad permission lines and propose replacing each with
|
|
50
207
|
// `contents: read`.
|
|
@@ -88,6 +245,27 @@ export function buildCiPermissionsFixPreview(audit) {
|
|
|
88
245
|
catch {
|
|
89
246
|
body = '';
|
|
90
247
|
}
|
|
248
|
+
// Non-GHA providers: emit provider-specific hints and return early.
|
|
249
|
+
if (audit.provider === 'gitlab') {
|
|
250
|
+
for (const h of emitGitlabHints(audit, body))
|
|
251
|
+
hints.push(h);
|
|
252
|
+
return finalize(audit, hints);
|
|
253
|
+
}
|
|
254
|
+
if (audit.provider === 'bitbucket') {
|
|
255
|
+
for (const h of emitBitbucketHints(audit, body))
|
|
256
|
+
hints.push(h);
|
|
257
|
+
return finalize(audit, hints);
|
|
258
|
+
}
|
|
259
|
+
if (audit.provider === 'azure') {
|
|
260
|
+
for (const h of emitAzureHints(audit, body))
|
|
261
|
+
hints.push(h);
|
|
262
|
+
return finalize(audit, hints);
|
|
263
|
+
}
|
|
264
|
+
if (audit.provider === 'jenkins') {
|
|
265
|
+
for (const h of emitJenkinsHints(audit))
|
|
266
|
+
hints.push(h);
|
|
267
|
+
return finalize(audit, hints);
|
|
268
|
+
}
|
|
91
269
|
const isGha = audit.provider === 'github-actions';
|
|
92
270
|
const missingPermsBlock = audit.findings.some((f) => f.code === 'permissions-block-missing');
|
|
93
271
|
// Case 1: comment-posting requested but no permissions block (or no pull-requests: write).
|
|
@@ -123,7 +301,10 @@ export function buildCiPermissionsFixPreview(audit) {
|
|
|
123
301
|
insertion: leastPrivilegeBlock(audit.provider, false),
|
|
124
302
|
});
|
|
125
303
|
}
|
|
126
|
-
|
|
304
|
+
return finalize(audit, hints);
|
|
305
|
+
}
|
|
306
|
+
function finalize(audit, hints) {
|
|
307
|
+
// Supply-chain hints — provider-agnostic.
|
|
127
308
|
if (audit.externalActions.length > 0) {
|
|
128
309
|
hints.push({
|
|
129
310
|
code: 'pin-action-sha',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct-adoption-diff.d.ts","sourceRoot":"","sources":["../src/construct-adoption-diff.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,8BAA8B,0CAA0C,CAAC;AAEtF,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAA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E,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AA8KD,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,sBAAsB,CAAC,CA2CjC;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAmBpF;AAED,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAuCxF;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAwCpF;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,2BAA2B,GAClC,MAAM,CAKR"}
|
|
@@ -159,8 +159,7 @@ function renderProposedFilePreview(existingSource, plan) {
|
|
|
159
159
|
.join('\n');
|
|
160
160
|
if (!existingSource) {
|
|
161
161
|
return [
|
|
162
|
-
|
|
163
|
-
'function defineConstruct<T>(construct: T): T { return construct; }',
|
|
162
|
+
"import { defineConstruct } from '@shrkcrft/plugin-api';",
|
|
164
163
|
'',
|
|
165
164
|
'export default [',
|
|
166
165
|
additionBlock,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct-adoption.d.ts","sourceRoot":"","sources":["../src/construct-adoption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"construct-adoption.d.ts","sourceRoot":"","sources":["../src/construct-adoption.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,2BAA2B,EAC3B,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF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QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,GAChC,uBAAuB,GAAG,IAAI,CAShC;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAwDjC;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAiDpF;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAwBjF;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,EACjC,IAAI,EAAE,sBAAsB,GAC3B,6BAA6B,CAc/B;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,yCAAyC,CAAC;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CACnD;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,qBAAqB,GAChC,wBAAwB,CAkC1B"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
3
12
|
import { listConstructs } from "./construct-registry.js";
|
|
4
13
|
import { InferredConstructConfidence, } from "./construct-inference.js";
|
|
5
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
6
14
|
export const CONSTRUCT_ADOPTION_SCHEMA = 'sharkcraft.construct-adoption-plan/v1';
|
|
7
15
|
export var ConstructAdoptionCategory;
|
|
8
16
|
(function (ConstructAdoptionCategory) {
|
|
@@ -25,7 +33,7 @@ async function loadDrafts(file) {
|
|
|
25
33
|
if (!existsSync(file))
|
|
26
34
|
return [];
|
|
27
35
|
try {
|
|
28
|
-
const mod = (await
|
|
36
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
29
37
|
if (Array.isArray(mod.default))
|
|
30
38
|
return mod.default;
|
|
31
39
|
if (Array.isArray(mod.constructs))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct-inference.d.ts","sourceRoot":"","sources":["../src/construct-inference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,oBAAY,2BAA2B;IACrC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,M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AE,SAAS,MAAM,EAAE,CAAC;CAC7B;AA0OD,wBAAsB,eAAe,CACnC,UAAU,EAAE,qBAAqB,EACjC,KAAK,GAAE,wBAA6B,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAuJpC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,yBAAyB,GAChC,MAAM,CAkBR"}
|
|
@@ -379,8 +379,7 @@ export function renderConstructDraftsModule(result) {
|
|
|
379
379
|
lines.push(" * SharkCraft does NOT load this file automatically.");
|
|
380
380
|
lines.push(` * Generated: ${result.generatedAt}`);
|
|
381
381
|
lines.push(" */");
|
|
382
|
-
lines.push(
|
|
383
|
-
lines.push('function defineConstruct<T>(construct: T): T { return construct; }');
|
|
382
|
+
lines.push("import { defineConstruct } from '@shrkcrft/plugin-api';");
|
|
384
383
|
lines.push('');
|
|
385
384
|
lines.push('export default [');
|
|
386
385
|
for (const c of result.candidates) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct-registry.d.ts","sourceRoot":"","sources":["../src/construct-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"construct-registry.d.ts","sourceRoot":"","sources":["../src/construct-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;CAAG;AA+DhE,wBAAsB,cAAc,CAClC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAwFhC;AAED;wEACwE;AACxE,wBAAgB,cAAc,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,UAAU,EAAE,CAGvF;AAED,wEAAwE;AACxE,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,UAAU,CAAC;IACtB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,UAAU,GAAG,eAAe,CAmBrE"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
3
|
-
import {
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
4
12
|
export const CONSTRUCT_REGISTRY_SCHEMA = 'sharkcraft.construct-registry/v1';
|
|
5
13
|
const CACHE = new Map();
|
|
6
14
|
function readJsonOrEmpty(file) {
|
|
@@ -14,7 +22,7 @@ function readJsonOrEmpty(file) {
|
|
|
14
22
|
}
|
|
15
23
|
}
|
|
16
24
|
async function importDefault(file) {
|
|
17
|
-
const mod = (await
|
|
25
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
18
26
|
const def = mod.default;
|
|
19
27
|
if (Array.isArray(def))
|
|
20
28
|
return def;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-template-registry.d.ts","sourceRoot":"","sources":["../src/contract-template-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract-template-registry.d.ts","sourceRoot":"","sources":["../src/contract-template-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAE5F,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+CD,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC;IACT,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,MAAM,EAAE,SAAS,8BAA8B,EAAE,CAAC;CACnD,CAAC,CAkGD;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAG5C;AAED,wBAAgB,kCAAkC,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAG7E"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Contract template registry. Merges engine built-ins with
|
|
3
11
|
* pack-contributed contract templates via `contractTemplateFiles`.
|
|
4
12
|
*/
|
|
5
13
|
import { existsSync } from 'node:fs';
|
|
6
14
|
import * as nodePath from 'node:path';
|
|
15
|
+
import { pathToFileURL } from 'node:url';
|
|
7
16
|
import { ALL_CONTRACT_TEMPLATES, AGENT_CONTRACT_TEMPLATE_SCHEMA, } from "./agent-contract-templates.js";
|
|
8
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
9
17
|
export const CONTRACT_TEMPLATE_REGISTRY_SCHEMA = 'sharkcraft.contract-template-registry/v1';
|
|
10
18
|
export var ContractTemplateSource;
|
|
11
19
|
(function (ContractTemplateSource) {
|
|
@@ -15,7 +23,7 @@ export var ContractTemplateSource;
|
|
|
15
23
|
})(ContractTemplateSource || (ContractTemplateSource = {}));
|
|
16
24
|
const CACHE = new Map();
|
|
17
25
|
async function importDefault(file) {
|
|
18
|
-
const mod = (await
|
|
26
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
19
27
|
if (Array.isArray(mod.default))
|
|
20
28
|
return mod.default;
|
|
21
29
|
if (mod.default && typeof mod.default === 'object')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convention-registry.d.ts","sourceRoot":"","sources":["../src/convention-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convention-registry.d.ts","sourceRoot":"","sources":["../src/convention-registry.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ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CAC9C;AAiBD,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAAC,sBAAsB,CAAC,CAqCjC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Convention registry. Loads pack + local conventions and validates
|
|
3
11
|
* them. Engine has no built-in conventions; everything comes from
|
|
@@ -5,8 +13,8 @@
|
|
|
5
13
|
*/
|
|
6
14
|
import { existsSync } from 'node:fs';
|
|
7
15
|
import * as nodePath from 'node:path';
|
|
16
|
+
import { pathToFileURL } from 'node:url';
|
|
8
17
|
import { validateConvention, } from '@shrkcrft/plugin-api';
|
|
9
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
10
18
|
export const CONVENTION_REGISTRY_SCHEMA = 'sharkcraft.convention-registry/v1';
|
|
11
19
|
export var ConventionSource;
|
|
12
20
|
(function (ConventionSource) {
|
|
@@ -15,7 +23,7 @@ export var ConventionSource;
|
|
|
15
23
|
ConventionSource["Fixture"] = "fixture";
|
|
16
24
|
})(ConventionSource || (ConventionSource = {}));
|
|
17
25
|
async function importDefault(file) {
|
|
18
|
-
const mod = (await
|
|
26
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
19
27
|
if (Array.isArray(mod.default))
|
|
20
28
|
return mod.default;
|
|
21
29
|
if (mod.default && typeof mod.default === 'object')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-records.d.ts","sourceRoot":"","sources":["../src/decision-records.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"decision-records.d.ts","sourceRoot":"","sources":["../src/decision-records.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,UAAU,eAAe;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,sBAAsB,CAAC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA8CD,wBAAgB,aAAa,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,eAAe,EAAE,CAyD3F;AA0BD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAuCrC;AAaD,wBAAgB,WAAW,CAAC,UAAU,EAAE,qBAAqB,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEtG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CA0CvE;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/E"}
|
package/dist/decision-records.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Decision / ADR support.
|
|
3
11
|
*
|
|
@@ -10,7 +18,6 @@
|
|
|
10
18
|
*/
|
|
11
19
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
12
20
|
import * as nodePath from 'node:path';
|
|
13
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
14
21
|
export const DECISION_RECORD_SCHEMA = 'sharkcraft.decision/v1';
|
|
15
22
|
export var DecisionStatus;
|
|
16
23
|
(function (DecisionStatus) {
|
|
@@ -186,7 +193,7 @@ async function importDefaultArray(absPath) {
|
|
|
186
193
|
if (!existsSync(absPath))
|
|
187
194
|
return [];
|
|
188
195
|
const { pathToFileURL } = await import('node:url');
|
|
189
|
-
const mod = (await
|
|
196
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(absPath).href)));
|
|
190
197
|
return Array.isArray(mod.default) ? mod.default : [];
|
|
191
198
|
}
|
|
192
199
|
catch {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Feedback ingestion.
|
|
3
11
|
*
|
|
@@ -13,8 +21,8 @@
|
|
|
13
21
|
* Schema: sharkcraft.feedback-ingestion/v1
|
|
14
22
|
*/
|
|
15
23
|
import { existsSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { pathToFileURL } from 'node:url';
|
|
16
25
|
import * as nodePath from 'node:path';
|
|
17
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
18
26
|
export const FEEDBACK_INGESTION_SCHEMA = 'sharkcraft.feedback-ingestion/v1';
|
|
19
27
|
export var FeedbackBucket;
|
|
20
28
|
(function (FeedbackBucket) {
|
|
@@ -341,7 +349,7 @@ async function importDefaultArray(absPath) {
|
|
|
341
349
|
try {
|
|
342
350
|
if (!existsSync(absPath))
|
|
343
351
|
return [];
|
|
344
|
-
const mod = (await
|
|
352
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(absPath).href)));
|
|
345
353
|
return Array.isArray(mod.default) ? mod.default : [];
|
|
346
354
|
}
|
|
347
355
|
catch {
|
package/dist/git-helpers.d.ts
CHANGED
|
@@ -20,6 +20,18 @@ export interface IGitStatusSummary {
|
|
|
20
20
|
export declare function isGitRepo(cwd: string): boolean;
|
|
21
21
|
export declare function getGitRoot(cwd: string): string | null;
|
|
22
22
|
export declare function getGitBranch(cwd: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Verify that `ref` resolves to a commit. Returns `{ valid: true }` on
|
|
25
|
+
* success, otherwise `{ valid: false, suggestions }` listing nearby
|
|
26
|
+
* branch / tag names so the caller can offer a did-you-mean.
|
|
27
|
+
*
|
|
28
|
+
* Cheap (`git rev-parse --verify` + `git for-each-ref`) — only run when
|
|
29
|
+
* the user passes an explicit ref.
|
|
30
|
+
*/
|
|
31
|
+
export declare function verifyGitRef(cwd: string, ref: string): {
|
|
32
|
+
valid: boolean;
|
|
33
|
+
suggestions?: string[];
|
|
34
|
+
};
|
|
23
35
|
export declare function getChangedFiles(cwd: string, opts?: IGitChangedOptions): string[];
|
|
24
36
|
export declare function getStatusSummary(cwd: string): IGitStatusSummary;
|
|
25
37
|
export declare function parseLines(text: string): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-helpers.d.ts","sourceRoot":"","sources":["../src/git-helpers.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW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