@prism-d1/cli 1.1.2 → 1.3.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.
- package/dist/assets/github-workflows/prism-agent-eval.yml +2 -1
- package/dist/assets/github-workflows/prism-eval-gate-kiro.yml +12 -2
- package/dist/assets/gitlab-workflows/prism-eval-gate.yml +8 -0
- package/dist/assets/infra/bin/app.ts +61 -37
- package/dist/assets/infra/lib/constructs/otel-collector-construct.ts +96 -0
- package/dist/assets/infra/lib/constructs/security-agent-construct.ts +35 -30
- package/dist/assets/infra/lib/dashboard-stack.ts +27 -0
- package/dist/assets/infra/lib/lambda/otel-receiver.ts +278 -8
- package/dist/assets/infra/lib/lambda/pricing/litellm-snapshot.json +3769 -0
- package/dist/assets/infra/lib/lambda/pricing/price-source.ts +56 -0
- package/dist/assets/infra/lib/lambda/pricing/price-table.ts +240 -0
- package/dist/assets/infra/lib/lambda/pricing/prices-key.ts +6 -0
- package/dist/assets/infra/lib/lambda/pricing/reprice.ts +108 -0
- package/dist/assets/infra/lib/lambda/pricing-refresh.ts +352 -0
- package/dist/assets/infra/lib/lambda/velocity-widget.ts +124 -1
- package/dist/assets/infra/lib/metrics-pipeline-stack.ts +2 -110
- package/dist/assets/infra/lib/security-agent-resources.ts +136 -0
- package/dist/assets/infra/lib/security-agent-stack.ts +69 -0
- package/dist/assets/infra/package.json +4 -1
- package/dist/assets/metric-hooks/prepare-commit-msg +3 -1
- package/dist/assets/pentest-cdk/bin/app.ts +12 -0
- package/dist/assets/pentest-cdk/cdk.json +7 -0
- package/dist/assets/pentest-cdk/lib/pentest-target-stack.ts +206 -0
- package/dist/assets/pentest-cdk/package.json +18 -0
- package/dist/assets/pentest-cdk/tsconfig.json +12 -0
- package/dist/src/codewatch/config.d.ts +17 -0
- package/dist/src/codewatch/config.d.ts.map +1 -0
- package/dist/src/codewatch/config.js +40 -0
- package/dist/src/codewatch/config.js.map +1 -0
- package/dist/src/codewatch/gitleaks.d.ts +49 -0
- package/dist/src/codewatch/gitleaks.d.ts.map +1 -0
- package/dist/src/codewatch/gitleaks.js +160 -0
- package/dist/src/codewatch/gitleaks.js.map +1 -0
- package/dist/src/codewatch/globalHooks.d.ts +52 -0
- package/dist/src/codewatch/globalHooks.d.ts.map +1 -0
- package/dist/src/codewatch/globalHooks.js +235 -0
- package/dist/src/codewatch/globalHooks.js.map +1 -0
- package/dist/src/codewatch/hooks.d.ts +38 -0
- package/dist/src/codewatch/hooks.d.ts.map +1 -0
- package/dist/src/codewatch/hooks.js +176 -0
- package/dist/src/codewatch/hooks.js.map +1 -0
- package/dist/src/codewatch/prepush.d.ts +37 -0
- package/dist/src/codewatch/prepush.d.ts.map +1 -0
- package/dist/src/codewatch/prepush.js +231 -0
- package/dist/src/codewatch/prepush.js.map +1 -0
- package/dist/src/codewatch/results.d.ts +210 -0
- package/dist/src/codewatch/results.d.ts.map +1 -0
- package/dist/src/codewatch/results.js +127 -0
- package/dist/src/codewatch/results.js.map +1 -0
- package/dist/src/codewatch/reviewers/claude.d.ts +9 -0
- package/dist/src/codewatch/reviewers/claude.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/claude.js +48 -0
- package/dist/src/codewatch/reviewers/claude.js.map +1 -0
- package/dist/src/codewatch/reviewers/index.d.ts +39 -0
- package/dist/src/codewatch/reviewers/index.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/index.js +97 -0
- package/dist/src/codewatch/reviewers/index.js.map +1 -0
- package/dist/src/codewatch/reviewers/kiro.d.ts +14 -0
- package/dist/src/codewatch/reviewers/kiro.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/kiro.js +32 -0
- package/dist/src/codewatch/reviewers/kiro.js.map +1 -0
- package/dist/src/codewatch/reviewers/types.d.ts +56 -0
- package/dist/src/codewatch/reviewers/types.d.ts.map +1 -0
- package/dist/src/codewatch/reviewers/types.js +91 -0
- package/dist/src/codewatch/reviewers/types.js.map +1 -0
- package/dist/src/codewatch/rules.d.ts +12 -0
- package/dist/src/codewatch/rules.d.ts.map +1 -0
- package/dist/src/codewatch/rules.js +27 -0
- package/dist/src/codewatch/rules.js.map +1 -0
- package/dist/src/commands/_top/dashboard.d.ts +17 -0
- package/dist/src/commands/_top/dashboard.d.ts.map +1 -0
- package/dist/src/commands/_top/dashboard.js +76 -0
- package/dist/src/commands/_top/dashboard.js.map +1 -0
- package/dist/src/commands/_top/version.d.ts +62 -0
- package/dist/src/commands/_top/version.d.ts.map +1 -0
- package/dist/src/commands/_top/version.js +175 -0
- package/dist/src/commands/_top/version.js.map +1 -0
- package/dist/src/commands/bedrock-protection/scan-account.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-account.js +2 -1
- package/dist/src/commands/bedrock-protection/scan-account.js.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.d.ts.map +1 -1
- package/dist/src/commands/bedrock-protection/scan-org.js +16 -4
- package/dist/src/commands/bedrock-protection/scan-org.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-eval-harness.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-eval-harness.js +15 -48
- package/dist/src/commands/bootstrapper/install-eval-harness.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-git-hooks.d.ts +13 -0
- package/dist/src/commands/bootstrapper/install-git-hooks.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-git-hooks.js +28 -147
- package/dist/src/commands/bootstrapper/install-git-hooks.js.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts +12 -6
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.js +18 -443
- package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
- package/dist/src/commands/codewatch/pre-commit.d.ts +7 -0
- package/dist/src/commands/codewatch/pre-commit.d.ts.map +1 -0
- package/dist/src/commands/codewatch/pre-commit.js +30 -0
- package/dist/src/commands/codewatch/pre-commit.js.map +1 -0
- package/dist/src/commands/codewatch/pre-push.d.ts +16 -0
- package/dist/src/commands/codewatch/pre-push.d.ts.map +1 -0
- package/dist/src/commands/codewatch/pre-push.js +32 -0
- package/dist/src/commands/codewatch/pre-push.js.map +1 -0
- package/dist/src/commands/codewatch/report.d.ts +22 -0
- package/dist/src/commands/codewatch/report.d.ts.map +1 -0
- package/dist/src/commands/codewatch/report.js +64 -0
- package/dist/src/commands/codewatch/report.js.map +1 -0
- package/dist/src/commands/enable/codeburn.d.ts +59 -0
- package/dist/src/commands/enable/codeburn.d.ts.map +1 -0
- package/dist/src/commands/enable/codeburn.js +531 -0
- package/dist/src/commands/enable/codeburn.js.map +1 -0
- package/dist/src/commands/enable/codewatch.d.ts +15 -0
- package/dist/src/commands/enable/codewatch.d.ts.map +1 -0
- package/dist/src/commands/enable/codewatch.js +186 -0
- package/dist/src/commands/enable/codewatch.js.map +1 -0
- package/dist/src/commands/enable/security.d.ts +41 -0
- package/dist/src/commands/enable/security.d.ts.map +1 -0
- package/dist/src/commands/enable/security.js +130 -0
- package/dist/src/commands/enable/security.js.map +1 -0
- package/dist/src/commands/export/otel.d.ts +31 -0
- package/dist/src/commands/export/otel.d.ts.map +1 -0
- package/dist/src/commands/export/otel.js +52 -0
- package/dist/src/commands/export/otel.js.map +1 -0
- package/dist/src/commands/git/claude-session-context.d.ts.map +1 -1
- package/dist/src/commands/git/claude-session-context.js +2 -1
- package/dist/src/commands/git/claude-session-context.js.map +1 -1
- package/dist/src/commands/git/commit-trailers.js +1 -1
- package/dist/src/commands/git/commit-trailers.js.map +1 -1
- package/dist/src/commands/security/code-review.d.ts +22 -0
- package/dist/src/commands/security/code-review.d.ts.map +1 -0
- package/dist/src/commands/security/code-review.js +43 -0
- package/dist/src/commands/security/code-review.js.map +1 -0
- package/dist/src/commands/security/findings.d.ts +15 -0
- package/dist/src/commands/security/findings.d.ts.map +1 -0
- package/dist/src/commands/security/findings.js +31 -0
- package/dist/src/commands/security/findings.js.map +1 -0
- package/dist/src/commands/security/pentest.d.ts +18 -0
- package/dist/src/commands/security/pentest.d.ts.map +1 -0
- package/dist/src/commands/security/pentest.js +32 -0
- package/dist/src/commands/security/pentest.js.map +1 -0
- package/dist/src/commands/security/threat-model.d.ts +16 -0
- package/dist/src/commands/security/threat-model.d.ts.map +1 -0
- package/dist/src/commands/security/threat-model.js +24 -0
- package/dist/src/commands/security/threat-model.js.map +1 -0
- package/dist/src/commands/security/threats.d.ts +12 -0
- package/dist/src/commands/security/threats.d.ts.map +1 -0
- package/dist/src/commands/security/threats.js +23 -0
- package/dist/src/commands/security/threats.js.map +1 -0
- package/dist/src/commands/securityagent/setup.d.ts +19 -5
- package/dist/src/commands/securityagent/setup.d.ts.map +1 -1
- package/dist/src/commands/securityagent/setup.js +25 -189
- package/dist/src/commands/securityagent/setup.js.map +1 -1
- package/dist/src/commands/workshop/verify-setup.d.ts.map +1 -1
- package/dist/src/commands/workshop/verify-setup.js +5 -3
- package/dist/src/commands/workshop/verify-setup.js.map +1 -1
- package/dist/src/dashboard/codewatch.d.ts +106 -0
- package/dist/src/dashboard/codewatch.d.ts.map +1 -0
- package/dist/src/dashboard/codewatch.js +120 -0
- package/dist/src/dashboard/codewatch.js.map +1 -0
- package/dist/src/dashboard/commits.d.ts +96 -0
- package/dist/src/dashboard/commits.d.ts.map +1 -0
- package/dist/src/dashboard/commits.js +207 -0
- package/dist/src/dashboard/commits.js.map +1 -0
- package/dist/src/dashboard/page.d.ts +10 -0
- package/dist/src/dashboard/page.d.ts.map +1 -0
- package/dist/src/dashboard/page.js +470 -0
- package/dist/src/dashboard/page.js.map +1 -0
- package/dist/src/dashboard/payload.d.ts +114 -0
- package/dist/src/dashboard/payload.d.ts.map +1 -0
- package/dist/src/dashboard/payload.js +96 -0
- package/dist/src/dashboard/payload.js.map +1 -0
- package/dist/src/dashboard/report.d.ts +99 -0
- package/dist/src/dashboard/report.d.ts.map +1 -0
- package/dist/src/dashboard/report.js +300 -0
- package/dist/src/dashboard/report.js.map +1 -0
- package/dist/src/dashboard/repos.d.ts +58 -0
- package/dist/src/dashboard/repos.d.ts.map +1 -0
- package/dist/src/dashboard/repos.js +111 -0
- package/dist/src/dashboard/repos.js.map +1 -0
- package/dist/src/dashboard/security.d.ts +130 -0
- package/dist/src/dashboard/security.d.ts.map +1 -0
- package/dist/src/dashboard/security.js +144 -0
- package/dist/src/dashboard/security.js.map +1 -0
- package/dist/src/dashboard/server.d.ts +52 -0
- package/dist/src/dashboard/server.d.ts.map +1 -0
- package/dist/src/dashboard/server.js +163 -0
- package/dist/src/dashboard/server.js.map +1 -0
- package/dist/src/dashboard/setup.d.ts +67 -0
- package/dist/src/dashboard/setup.d.ts.map +1 -0
- package/dist/src/dashboard/setup.js +146 -0
- package/dist/src/dashboard/setup.js.map +1 -0
- package/dist/src/dashboard/usage.d.ts +43 -0
- package/dist/src/dashboard/usage.d.ts.map +1 -0
- package/dist/src/dashboard/usage.js +88 -0
- package/dist/src/dashboard/usage.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/security/cfn-diff.d.ts +57 -0
- package/dist/src/security/cfn-diff.d.ts.map +1 -0
- package/dist/src/security/cfn-diff.js +112 -0
- package/dist/src/security/cfn-diff.js.map +1 -0
- package/dist/src/security/errors.d.ts +45 -0
- package/dist/src/security/errors.d.ts.map +1 -0
- package/dist/src/security/errors.js +116 -0
- package/dist/src/security/errors.js.map +1 -0
- package/dist/src/security/marker.d.ts +46 -0
- package/dist/src/security/marker.d.ts.map +1 -0
- package/dist/src/security/marker.js +120 -0
- package/dist/src/security/marker.js.map +1 -0
- package/dist/src/security/pentest-dockerfile.d.ts +8 -0
- package/dist/src/security/pentest-dockerfile.d.ts.map +1 -0
- package/dist/src/security/pentest-dockerfile.js +163 -0
- package/dist/src/security/pentest-dockerfile.js.map +1 -0
- package/dist/src/security/pentest.d.ts +233 -0
- package/dist/src/security/pentest.d.ts.map +1 -0
- package/dist/src/security/pentest.js +1057 -0
- package/dist/src/security/pentest.js.map +1 -0
- package/dist/src/security/repo.d.ts +25 -0
- package/dist/src/security/repo.d.ts.map +1 -0
- package/dist/src/security/repo.js +38 -0
- package/dist/src/security/repo.js.map +1 -0
- package/dist/src/security/review.d.ts +202 -0
- package/dist/src/security/review.d.ts.map +1 -0
- package/dist/src/security/review.js +706 -0
- package/dist/src/security/review.js.map +1 -0
- package/dist/src/security/setup.d.ts +193 -0
- package/dist/src/security/setup.d.ts.map +1 -0
- package/dist/src/security/setup.js +728 -0
- package/dist/src/security/setup.js.map +1 -0
- package/dist/src/security/threat-model.d.ts +133 -0
- package/dist/src/security/threat-model.d.ts.map +1 -0
- package/dist/src/security/threat-model.js +653 -0
- package/dist/src/security/threat-model.js.map +1 -0
- package/dist/src/utils/audit-bedrock.d.ts +1 -0
- package/dist/src/utils/audit-bedrock.d.ts.map +1 -1
- package/dist/src/utils/audit-bedrock.js +133 -0
- package/dist/src/utils/audit-bedrock.js.map +1 -1
- package/dist/src/utils/audit-org.d.ts +1 -0
- package/dist/src/utils/audit-org.d.ts.map +1 -1
- package/dist/src/utils/audit-org.js +155 -0
- package/dist/src/utils/audit-org.js.map +1 -1
- package/dist/src/utils/exec.d.ts +6 -0
- package/dist/src/utils/exec.d.ts.map +1 -1
- package/dist/src/utils/exec.js +12 -1
- package/dist/src/utils/exec.js.map +1 -1
- package/dist/src/utils/otel-sync-schedule.d.ts +41 -0
- package/dist/src/utils/otel-sync-schedule.d.ts.map +1 -0
- package/dist/src/utils/otel-sync-schedule.js +90 -0
- package/dist/src/utils/otel-sync-schedule.js.map +1 -0
- package/dist/src/utils/tool-check.d.ts +14 -0
- package/dist/src/utils/tool-check.d.ts.map +1 -0
- package/dist/src/utils/tool-check.js +42 -0
- package/dist/src/utils/tool-check.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** The command that installs codeburn and its scheduled sync. Fix hints point here. */
|
|
2
|
+
export declare const ENABLE_CODEBURN_CMD = "prism-cli enable codeburn";
|
|
3
|
+
/** npm package and global install argv for codeburn (github.com/getagentseal/codeburn). */
|
|
4
|
+
export declare const CODEBURN_NPM_PACKAGE = "codeburn";
|
|
5
|
+
export declare const CODEBURN_INSTALL_ARGS: string[];
|
|
6
|
+
/** Window the recurring sync pushes on every run, and the `export otel` default. */
|
|
7
|
+
export declare const SYNC_SINCE = "7d";
|
|
8
|
+
/**
|
|
9
|
+
* The argv of a sync push, shared by every schedule platform and `export otel`.
|
|
10
|
+
*
|
|
11
|
+
* This is the single source of truth on purpose. It previously existed only as
|
|
12
|
+
* a Linux helper, and the Windows branch open-coded its own command string
|
|
13
|
+
* that omitted --attribution. That silently reduced Windows machines to usage
|
|
14
|
+
* telemetry with no commit attribution, so those developers counted toward the
|
|
15
|
+
* Attribution Coverage denominator (CI sees their commits) while contributing
|
|
16
|
+
* nothing to the numerator -- indistinguishable on the dashboard from someone
|
|
17
|
+
* who never onboarded. Any new caller must use this.
|
|
18
|
+
*/
|
|
19
|
+
export declare function syncArgs(since: string): string[];
|
|
20
|
+
export declare const CRON_MARKER = "# prism-otel-sync";
|
|
21
|
+
export declare const PLIST_LABEL = "com.prism.otel-sync";
|
|
22
|
+
export declare const SCHTASK_NAME = "PrismOtelSync";
|
|
23
|
+
export declare function otelLogDir(home?: string): string;
|
|
24
|
+
export declare function otelLogFile(home?: string): string;
|
|
25
|
+
export declare function codeburnSyncConfigPath(home?: string): string;
|
|
26
|
+
export declare function linuxCrontabAvailable(): boolean;
|
|
27
|
+
export declare function linuxScheduleExists(): boolean;
|
|
28
|
+
export declare function darwinPlistPath(home?: string): string;
|
|
29
|
+
export declare function darwinScheduleExists(): boolean;
|
|
30
|
+
export declare function windowsScheduleExists(): boolean;
|
|
31
|
+
export declare function scheduleExists(): boolean;
|
|
32
|
+
export declare function schedulerName(): string;
|
|
33
|
+
export interface LastSync {
|
|
34
|
+
/** mtime of the sync log: when the scheduled job last wrote output. */
|
|
35
|
+
at: string;
|
|
36
|
+
/** Last non-empty log line, trimmed. */
|
|
37
|
+
lastLine: string | null;
|
|
38
|
+
}
|
|
39
|
+
/** When the scheduled sync last ran, from ~/.prism/logs/otel-sync.log. null if it never wrote. */
|
|
40
|
+
export declare function lastSync(home?: string): LastSync | null;
|
|
41
|
+
//# sourceMappingURL=otel-sync-schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel-sync-schedule.d.ts","sourceRoot":"","sources":["../../../src/utils/otel-sync-schedule.ts"],"names":[],"mappings":"AAaA,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,qBAAqB,UAA0C,CAAC;AAE7E,oFAAoF;AACpF,eAAO,MAAM,UAAU,OAAO,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhD;AAED,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,wBAAgB,UAAU,CAAC,IAAI,SAAY,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,IAAI,SAAY,GAAG,MAAM,CAEpD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,SAAY,GAAG,MAAM,CAE/D;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAI7C;AAED,wBAAgB,eAAe,CAAC,IAAI,SAAY,GAAG,MAAM,CAExD;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,MAAM,WAAW,QAAQ;IACvB,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,IAAI,SAAY,GAAG,QAAQ,GAAG,IAAI,CAS1D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detection of the scheduled `codeburn sync push` installed by
|
|
3
|
+
* `enable codeburn` (formerly `bootstrapper setup-otel-sync`). Shared so the
|
|
4
|
+
* dashboard's setup checklist, `enable codeburn --status` and `export otel`
|
|
5
|
+
* agree on what "installed" means and on what a sync push runs.
|
|
6
|
+
*
|
|
7
|
+
* Read-only: nothing here installs or removes a schedule.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
10
|
+
import { homedir, platform } from 'node:os';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { run } from './exec.js';
|
|
13
|
+
/** The command that installs codeburn and its scheduled sync. Fix hints point here. */
|
|
14
|
+
export const ENABLE_CODEBURN_CMD = 'prism-cli enable codeburn';
|
|
15
|
+
/** npm package and global install argv for codeburn (github.com/getagentseal/codeburn). */
|
|
16
|
+
export const CODEBURN_NPM_PACKAGE = 'codeburn';
|
|
17
|
+
export const CODEBURN_INSTALL_ARGS = ['install', '-g', CODEBURN_NPM_PACKAGE];
|
|
18
|
+
/** Window the recurring sync pushes on every run, and the `export otel` default. */
|
|
19
|
+
export const SYNC_SINCE = '7d';
|
|
20
|
+
/**
|
|
21
|
+
* The argv of a sync push, shared by every schedule platform and `export otel`.
|
|
22
|
+
*
|
|
23
|
+
* This is the single source of truth on purpose. It previously existed only as
|
|
24
|
+
* a Linux helper, and the Windows branch open-coded its own command string
|
|
25
|
+
* that omitted --attribution. That silently reduced Windows machines to usage
|
|
26
|
+
* telemetry with no commit attribution, so those developers counted toward the
|
|
27
|
+
* Attribution Coverage denominator (CI sees their commits) while contributing
|
|
28
|
+
* nothing to the numerator -- indistinguishable on the dashboard from someone
|
|
29
|
+
* who never onboarded. Any new caller must use this.
|
|
30
|
+
*/
|
|
31
|
+
export function syncArgs(since) {
|
|
32
|
+
return ['sync', 'push', '--since', since, '--attribution'];
|
|
33
|
+
}
|
|
34
|
+
export const CRON_MARKER = '# prism-otel-sync';
|
|
35
|
+
export const PLIST_LABEL = 'com.prism.otel-sync';
|
|
36
|
+
export const SCHTASK_NAME = 'PrismOtelSync';
|
|
37
|
+
export function otelLogDir(home = homedir()) {
|
|
38
|
+
return join(home, '.prism', 'logs');
|
|
39
|
+
}
|
|
40
|
+
export function otelLogFile(home = homedir()) {
|
|
41
|
+
return join(otelLogDir(home), 'otel-sync.log');
|
|
42
|
+
}
|
|
43
|
+
export function codeburnSyncConfigPath(home = homedir()) {
|
|
44
|
+
return join(home, '.config', 'codeburn', 'sync.json');
|
|
45
|
+
}
|
|
46
|
+
export function linuxCrontabAvailable() {
|
|
47
|
+
return run('which', ['crontab']).ok;
|
|
48
|
+
}
|
|
49
|
+
export function linuxScheduleExists() {
|
|
50
|
+
if (!linuxCrontabAvailable())
|
|
51
|
+
return false;
|
|
52
|
+
const result = run('crontab', ['-l']);
|
|
53
|
+
return result.ok && result.stdout.includes(CRON_MARKER);
|
|
54
|
+
}
|
|
55
|
+
export function darwinPlistPath(home = homedir()) {
|
|
56
|
+
return join(home, 'Library', 'LaunchAgents', `${PLIST_LABEL}.plist`);
|
|
57
|
+
}
|
|
58
|
+
export function darwinScheduleExists() {
|
|
59
|
+
return existsSync(darwinPlistPath());
|
|
60
|
+
}
|
|
61
|
+
export function windowsScheduleExists() {
|
|
62
|
+
return run('schtasks', ['/query', '/tn', SCHTASK_NAME, '/fo', 'CSV']).ok;
|
|
63
|
+
}
|
|
64
|
+
export function scheduleExists() {
|
|
65
|
+
switch (platform()) {
|
|
66
|
+
case 'darwin': return darwinScheduleExists();
|
|
67
|
+
case 'win32': return windowsScheduleExists();
|
|
68
|
+
default: return linuxScheduleExists();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function schedulerName() {
|
|
72
|
+
switch (platform()) {
|
|
73
|
+
case 'darwin': return 'LaunchAgent';
|
|
74
|
+
case 'win32': return 'Scheduled Task';
|
|
75
|
+
default: return 'crontab';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** When the scheduled sync last ran, from ~/.prism/logs/otel-sync.log. null if it never wrote. */
|
|
79
|
+
export function lastSync(home = homedir()) {
|
|
80
|
+
const f = otelLogFile(home);
|
|
81
|
+
try {
|
|
82
|
+
const st = statSync(f);
|
|
83
|
+
const lines = readFileSync(f, 'utf8').split('\n').map((l) => l.trim()).filter(Boolean);
|
|
84
|
+
return { at: st.mtime.toISOString(), lastLine: lines.length ? lines[lines.length - 1].slice(0, 200) : null };
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=otel-sync-schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel-sync-schedule.js","sourceRoot":"","sources":["../../../src/utils/otel-sync-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAE/D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,IAA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M,CAAC,OAAO,CAAC,CAAC;QACvF,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Resolves an executable on PATH without spawning `which`. */
|
|
2
|
+
export declare function findOnPath(binary: string, pathEnv?: string | undefined): string | null;
|
|
3
|
+
/** First line of `<binary> <args>` (default `--version`), or null. */
|
|
4
|
+
export declare function toolVersion(binary: string, args?: string[]): string | null;
|
|
5
|
+
export interface ToolInfo {
|
|
6
|
+
installed: boolean;
|
|
7
|
+
path: string | null;
|
|
8
|
+
version: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function checkTool(binary: string, opts?: {
|
|
11
|
+
pathEnv?: string;
|
|
12
|
+
versionArgs?: string[];
|
|
13
|
+
}): ToolInfo;
|
|
14
|
+
//# sourceMappingURL=tool-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-check.d.ts","sourceRoot":"","sources":["../../../src/utils/tool-check.ts"],"names":[],"mappings":"AAUA,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,GAAG,SAA4B,GAAG,MAAM,GAAG,IAAI,CAexG;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAkB,GAAG,MAAM,GAAG,IAAI,CAIzF;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GAAG,QAAQ,CAI3G"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Is this tool installed, and which version?" -- shared by workshop
|
|
3
|
+
* verify-setup, codewatch's reviewer detection and the dashboard checklist.
|
|
4
|
+
*
|
|
5
|
+
* No shell: PATH is scanned directly and the version probe is argv-only.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from 'node:child_process';
|
|
8
|
+
import { accessSync, constants, statSync } from 'node:fs';
|
|
9
|
+
import { delimiter, join } from 'node:path';
|
|
10
|
+
/** Resolves an executable on PATH without spawning `which`. */
|
|
11
|
+
export function findOnPath(binary, pathEnv = process.env.PATH) {
|
|
12
|
+
const exts = process.platform === 'win32' ? (process.env.PATHEXT || '.EXE;.CMD;.BAT').split(';') : [''];
|
|
13
|
+
for (const dir of (pathEnv || '').split(delimiter)) {
|
|
14
|
+
if (!dir)
|
|
15
|
+
continue;
|
|
16
|
+
for (const ext of exts) {
|
|
17
|
+
const p = join(dir, binary + ext);
|
|
18
|
+
try {
|
|
19
|
+
if (statSync(p).isFile()) {
|
|
20
|
+
accessSync(p, constants.X_OK);
|
|
21
|
+
return p;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch { /* not here */ }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
/** First line of `<binary> <args>` (default `--version`), or null. */
|
|
30
|
+
export function toolVersion(binary, args = ['--version']) {
|
|
31
|
+
const r = spawnSync(binary, args, { encoding: 'utf8', timeout: 10_000, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
32
|
+
if (r.error || r.status !== 0)
|
|
33
|
+
return null;
|
|
34
|
+
return ((r.stdout || r.stderr || '').trim().split('\n')[0] || '').trim() || null;
|
|
35
|
+
}
|
|
36
|
+
export function checkTool(binary, opts = {}) {
|
|
37
|
+
const path = findOnPath(binary, opts.pathEnv);
|
|
38
|
+
if (!path)
|
|
39
|
+
return { installed: false, path: null, version: null };
|
|
40
|
+
return { installed: true, path, version: toolVersion(path, opts.versionArgs) };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=tool-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-check.js","sourceRoot":"","sources":["../../../src/utils/tool-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5C,+DAA+D;AAC/D,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,UAA8B,OAAO,CAAC,GAAG,CAAC,IAAI;IACvF,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACxG,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC;gBACH,IAAI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F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prism-d1/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "PRISM D1 Velocity CLI — AI development lifecycle assessment tool",
|
|
5
5
|
"author": "andklee",
|
|
6
6
|
"engines": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "npx tsc && rm -rf dist/assets && mkdir -p dist/assets/infra dist/assets/coding-agent && cp -r ../bootstrapper/metric-hooks ../bootstrapper/eval-harness ../bootstrapper/github-workflows ../bootstrapper/gitlab-workflows dist/assets/ && cp -r ../infra/bin ../infra/lib ../infra/package.json ../infra/tsconfig.json ../infra/cdk.json dist/assets/infra/ && cp -r ../coding-agent/agent.py ../coding-agent/config.py ../coding-agent/system_prompt.py ../coding-agent/requirements.txt ../coding-agent/pyproject.toml ../coding-agent/README.md ../coding-agent/tools ../coding-agent/eval ../coding-agent/deploy dist/assets/coding-agent/ && mkdir -p dist/assets/coding-agent/fixtures && cp ../sample-app/.coding-agent/fixtures/*.json dist/assets/coding-agent/fixtures/ && find dist/assets/coding-agent -name __pycache__ -type d -prune -exec rm -rf {} +",
|
|
25
|
+
"build": "npx tsc && rm -rf dist/assets && mkdir -p dist/assets/infra dist/assets/coding-agent && cp -r ../bootstrapper/metric-hooks ../bootstrapper/eval-harness ../bootstrapper/github-workflows ../bootstrapper/gitlab-workflows dist/assets/ && cp -r ../infra/bin ../infra/lib ../infra/package.json ../infra/tsconfig.json ../infra/cdk.json dist/assets/infra/ && cp -r ../coding-agent/agent.py ../coding-agent/config.py ../coding-agent/system_prompt.py ../coding-agent/requirements.txt ../coding-agent/pyproject.toml ../coding-agent/README.md ../coding-agent/tools ../coding-agent/eval ../coding-agent/deploy dist/assets/coding-agent/ && mkdir -p dist/assets/coding-agent/fixtures && cp ../sample-app/.coding-agent/fixtures/*.json dist/assets/coding-agent/fixtures/ && find dist/assets/coding-agent -name __pycache__ -type d -prune -exec rm -rf {} + && cp -r src/commands/security/pentest-cdk dist/assets/pentest-cdk",
|
|
26
|
+
"test": "tsc -p tsconfig.test.json && node --import tsx --test test/*.test.ts",
|
|
26
27
|
"prepublishOnly": "npm run build",
|
|
27
28
|
"start": "tsx bin/prism-cli.ts",
|
|
28
29
|
"dev": "tsx bin/prism-cli.ts"
|