openplanr 2.2641.1 → 2.2641.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 +21 -0
- package/README.md +1 -1
- package/dist/cli/commands/artifact.js +1 -1
- package/dist/cli/commands/artifact.js.map +1 -1
- package/dist/cli/commands/github.d.ts.map +1 -1
- package/dist/cli/commands/github.js +7 -10
- package/dist/cli/commands/github.js.map +1 -1
- package/dist/cli/commands/linear.js +1 -1
- package/dist/cli/commands/linear.js.map +1 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +28 -32
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/dashboard/.vite/manifest.json +1 -1
- package/dist/dashboard/assets/{index-DGyC7RDz.js → index-DI_TKz9J.js} +2 -2
- package/dist/dashboard/assets/{index-DGyC7RDz.js.map → index-DI_TKz9J.js.map} +1 -1
- package/dist/dashboard/dashboard-manifest.json +8 -8
- package/dist/dashboard/index.html +1 -1
- package/dist/models/schema.d.ts +0 -4
- package/dist/models/schema.d.ts.map +1 -1
- package/dist/models/schema.js +0 -2
- package/dist/models/schema.js.map +1 -1
- package/dist/models/types.d.ts +1 -4
- package/dist/models/types.d.ts.map +1 -1
- package/dist/services/credentials-service.js +1 -1
- package/dist/services/credentials-service.js.map +1 -1
- package/dist/services/distribution-service.d.ts +1 -4
- package/dist/services/distribution-service.d.ts.map +1 -1
- package/dist/services/distribution-service.js +1 -60
- package/dist/services/distribution-service.js.map +1 -1
- package/dist/services/github-service.d.ts +7 -4
- package/dist/services/github-service.d.ts.map +1 -1
- package/dist/services/github-service.js +16 -15
- package/dist/services/github-service.js.map +1 -1
- package/dist/services/linear-push-service.d.ts +3 -4
- package/dist/services/linear-push-service.d.ts.map +1 -1
- package/dist/services/linear-push-service.js +5 -6
- package/dist/services/linear-push-service.js.map +1 -1
- package/dist/services/spec-service.d.ts.map +1 -1
- package/dist/services/spec-service.js +34 -69
- package/dist/services/spec-service.js.map +1 -1
- package/dist/templates/rules/shared/capability-map.md.hbs +1 -1
- package/docs/CLI.md +10 -14
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +8 -8
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +80 -64
- package/lib/host-packages/claude/openplanr/README.md +8 -12
- package/lib/host-packages/claude/openplanr/agents/planr-backend.md +49 -55
- package/lib/host-packages/claude/openplanr/agents/planr-database.md +56 -92
- package/lib/host-packages/claude/openplanr/agents/planr-designer.md +35 -51
- package/lib/host-packages/claude/openplanr/agents/planr-devops.md +37 -51
- package/lib/host-packages/claude/openplanr/agents/planr-documentation.md +29 -52
- package/lib/host-packages/claude/openplanr/agents/planr-entity-scaffold.md +24 -23
- package/lib/host-packages/claude/openplanr/agents/planr-frontend.md +46 -58
- package/lib/host-packages/claude/openplanr/agents/planr-qa.md +4 -2
- package/lib/host-packages/claude/openplanr/agents/planr-specification.md +54 -51
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/backend.md +21 -65
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/designer.md +5 -6
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/devops.md +2 -3
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/doc-gen.md +3 -4
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/frontend.md +19 -64
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/default/specification.md +10 -12
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/backend.md +19 -62
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/designer.md +3 -4
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/devops.md +2 -3
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/doc-gen.md +2 -3
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/frontend.md +16 -59
- package/lib/host-packages/claude/openplanr/references/agents/shared/modes/spec-driven/specification.md +9 -11
- package/lib/host-packages/claude/openplanr/references/pipeline/stacks/database/mongodb.md +4 -4
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +24 -9
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +3 -3
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +1 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +1 -1
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/skills/artifact/SKILL.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/artifact/references/diagram-sharing.md +1 -1
- package/lib/host-packages/claude/openplanr/skills/ceo-review/SKILL.md +0 -1
- package/lib/host-packages/claude/openplanr/skills/ceo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/claude/openplanr/skills/chair-review/SKILL.md +6 -2
- package/lib/host-packages/claude/openplanr/skills/challenger-review/SKILL.md +6 -2
- package/lib/host-packages/claude/openplanr/skills/cmo-review/SKILL.md +0 -1
- package/lib/host-packages/claude/openplanr/skills/cmo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/claude/openplanr/skills/coo-review/SKILL.md +0 -1
- package/lib/host-packages/claude/openplanr/skills/coo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/claude/openplanr/skills/cpo-review/SKILL.md +0 -1
- package/lib/host-packages/claude/openplanr/skills/cpo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/claude/openplanr/skills/cto-review/SKILL.md +0 -1
- package/lib/host-packages/claude/openplanr/skills/cto-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/claude/openplanr/skills/delegate/SKILL.md +7 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/references/capsule-contract.md +16 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/references/operator-guide.md +7 -5
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/claude.mjs +11 -4
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/adapters/native.mjs +1 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +14 -48
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/context.mjs +84 -22
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/credentials.mjs +167 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/presentation.mjs +3 -2
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-contract.mjs +5 -7
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-preparation.mjs +2 -0
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/run-record.mjs +2 -3
- package/lib/host-packages/claude/openplanr/skills/diagram/references/diagram-sharing.md +1 -1
- package/lib/host-packages/claude/openplanr/skills/operate/SKILL.md +5 -3
- package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +8 -2
- package/lib/host-packages/claude/openplanr/skills/sprint/SKILL.md +5 -4
- package/lib/host-packages/claude/openplanr/skills/sprint/references/tracker-connections.md +70 -0
- package/lib/host-packages/claude/openplanr/skills/status/SKILL.md +4 -3
- package/lib/host-packages/claude/openplanr/skills/status/references/tracker-connections.md +70 -0
- package/lib/host-packages/claude/openplanr/skills/sync/SKILL.md +11 -20
- package/lib/host-packages/claude/openplanr/skills/sync/references/tracker-connections.md +70 -0
- package/lib/host-packages/claude/openplanr/skills/sync/scripts/sync.mjs +2 -2
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +52 -36
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/diagram-sharing.md +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-artifact.mdc +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-ceo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-chair-review.mdc +6 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-challenger-review.mdc +6 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-cmo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-coo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-cpo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-cto-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/capsule-contract.md +16 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/references/operator-guide.md +7 -5
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/claude.mjs +11 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/adapters/native.mjs +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/backend-diagnostics.mjs +14 -48
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/context.mjs +84 -22
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/credentials.mjs +167 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/presentation.mjs +3 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-contract.mjs +5 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-preparation.mjs +2 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/run-record.mjs +2 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate.mdc +7 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-diagram/references/diagram-sharing.md +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-operate.mdc +5 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +8 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-sprint/references/tracker-connections.md +70 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-sprint.mdc +5 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-status/references/tracker-connections.md +70 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-status.mdc +4 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-sync/references/tracker-connections.md +70 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-sync/scripts/sync.mjs +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-sync.mdc +11 -20
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +24 -9
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +3 -3
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +61 -45
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +24 -9
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +3 -3
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +1 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +1 -1
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/artifact/SKILL.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/artifact/references/diagram-sharing.md +1 -1
- package/lib/host-packages/openai/openplanr/skills/ceo-review/SKILL.md +0 -1
- package/lib/host-packages/openai/openplanr/skills/ceo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/openai/openplanr/skills/chair-review/SKILL.md +6 -2
- package/lib/host-packages/openai/openplanr/skills/challenger-review/SKILL.md +6 -2
- package/lib/host-packages/openai/openplanr/skills/cmo-review/SKILL.md +0 -1
- package/lib/host-packages/openai/openplanr/skills/cmo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/openai/openplanr/skills/coo-review/SKILL.md +0 -1
- package/lib/host-packages/openai/openplanr/skills/coo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/openai/openplanr/skills/cpo-review/SKILL.md +0 -1
- package/lib/host-packages/openai/openplanr/skills/cpo-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/openai/openplanr/skills/cto-review/SKILL.md +0 -1
- package/lib/host-packages/openai/openplanr/skills/cto-review/references/operate-advisor-contract.md +25 -4
- package/lib/host-packages/openai/openplanr/skills/delegate/SKILL.md +7 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/openplanr.skill.json +11 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/references/capsule-contract.md +16 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/references/operator-guide.md +7 -5
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/claude.mjs +11 -4
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/adapters/native.mjs +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +14 -48
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/context.mjs +84 -22
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/credentials.mjs +167 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/presentation.mjs +3 -2
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-contract.mjs +5 -7
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-preparation.mjs +2 -0
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/run-record.mjs +2 -3
- package/lib/host-packages/openai/openplanr/skills/diagram/references/diagram-sharing.md +1 -1
- package/lib/host-packages/openai/openplanr/skills/operate/SKILL.md +5 -3
- package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +8 -2
- package/lib/host-packages/openai/openplanr/skills/sprint/SKILL.md +5 -4
- package/lib/host-packages/openai/openplanr/skills/sprint/openplanr.skill.json +11 -0
- package/lib/host-packages/openai/openplanr/skills/sprint/references/tracker-connections.md +70 -0
- package/lib/host-packages/openai/openplanr/skills/status/SKILL.md +4 -3
- package/lib/host-packages/openai/openplanr/skills/status/openplanr.skill.json +11 -0
- package/lib/host-packages/openai/openplanr/skills/status/references/tracker-connections.md +70 -0
- package/lib/host-packages/openai/openplanr/skills/sync/SKILL.md +11 -20
- package/lib/host-packages/openai/openplanr/skills/sync/openplanr.skill.json +11 -0
- package/lib/host-packages/openai/openplanr/skills/sync/references/tracker-connections.md +70 -0
- package/lib/host-packages/openai/openplanr/skills/sync/scripts/sync.mjs +2 -2
- package/lib/integrations.mjs +2 -2
- package/package.json +2 -2
- package/dist/services/connectors/adapters/business-metrics.d.ts +0 -5
- package/dist/services/connectors/adapters/business-metrics.d.ts.map +0 -1
- package/dist/services/connectors/adapters/business-metrics.js +0 -41
- package/dist/services/connectors/adapters/business-metrics.js.map +0 -1
- package/dist/services/connectors/adapters/deployment-health.d.ts +0 -18
- package/dist/services/connectors/adapters/deployment-health.d.ts.map +0 -1
- package/dist/services/connectors/adapters/deployment-health.js +0 -67
- package/dist/services/connectors/adapters/deployment-health.js.map +0 -1
- package/dist/services/connectors/adapters/github.d.ts +0 -5
- package/dist/services/connectors/adapters/github.d.ts.map +0 -1
- package/dist/services/connectors/adapters/github.js +0 -31
- package/dist/services/connectors/adapters/github.js.map +0 -1
- package/dist/services/connectors/adapters/linear-jira.d.ts +0 -5
- package/dist/services/connectors/adapters/linear-jira.d.ts.map +0 -1
- package/dist/services/connectors/adapters/linear-jira.js +0 -26
- package/dist/services/connectors/adapters/linear-jira.js.map +0 -1
- package/dist/services/connectors/adapters/posthog.d.ts +0 -5
- package/dist/services/connectors/adapters/posthog.d.ts.map +0 -1
- package/dist/services/connectors/adapters/posthog.js +0 -31
- package/dist/services/connectors/adapters/posthog.js.map +0 -1
- package/dist/services/connectors/adapters/sentry.d.ts +0 -5
- package/dist/services/connectors/adapters/sentry.d.ts.map +0 -1
- package/dist/services/connectors/adapters/sentry.js +0 -31
- package/dist/services/connectors/adapters/sentry.js.map +0 -1
- package/dist/services/connectors/checkpoint-custody.d.ts +0 -45
- package/dist/services/connectors/checkpoint-custody.d.ts.map +0 -1
- package/dist/services/connectors/checkpoint-custody.js +0 -499
- package/dist/services/connectors/checkpoint-custody.js.map +0 -1
- package/dist/services/connectors/connector-registry.d.ts +0 -144
- package/dist/services/connectors/connector-registry.d.ts.map +0 -1
- package/dist/services/connectors/connector-registry.js +0 -423
- package/dist/services/connectors/connector-registry.js.map +0 -1
- package/dist/services/connectors/connector-runtime.d.ts +0 -208
- package/dist/services/connectors/connector-runtime.d.ts.map +0 -1
- package/dist/services/connectors/connector-runtime.js +0 -1305
- package/dist/services/connectors/connector-runtime.js.map +0 -1
- package/dist/services/connectors/credential-custody.d.ts +0 -96
- package/dist/services/connectors/credential-custody.d.ts.map +0 -1
- package/dist/services/connectors/credential-custody.js +0 -390
- package/dist/services/connectors/credential-custody.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { lstat, mkdir, readdir, readFile, realpath, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
+
import { classifyCredentials, credentialSyntax, resolveFindings } from './credentials.mjs';
|
|
4
5
|
|
|
5
6
|
export const CAPSULE_SCHEMA_VERSION = '1.0.0';
|
|
6
7
|
|
|
@@ -12,19 +13,14 @@ const DEFAULT_LIMITS = Object.freeze({
|
|
|
12
13
|
const SECRET_NAME =
|
|
13
14
|
/^(?:\.env(?:\..*)?|\.envrc|\.netrc|\.git-credentials|\.npmrc|\.pypirc|id_(?:rsa|dsa|ecdsa|ed25519)(?:\.pub)?|credentials(?:\.[^.]+)?|service[-_]?account(?:\.[^.]+)?|.*\.(?:pem|p12|pfx|key|tfvars)(?:\.json)?)$/iu;
|
|
14
15
|
const SECRET_SEGMENT = /^(?:\.ssh|\.aws|\.gnupg|\.kube)$/iu;
|
|
15
|
-
const SECRET_VALUE =
|
|
16
|
-
/-----BEGIN (?:[A-Z ]* )?PRIVATE KEY-----|\bAKIA[0-9A-Z]{16}\b|\bgh[pousr]_[A-Za-z0-9_]{20,}\b|\bgithub_pat_[A-Za-z0-9_]{20,}\b|\bsk-(?:proj-)?[A-Za-z0-9_-]{24,}\b|\bxox[baprs]-[A-Za-z0-9-]{20,}\b|"private_key"\s*:\s*"-----BEGIN/iu;
|
|
17
|
-
const SECRET_ASSIGNMENT =
|
|
18
|
-
/(?:^|[^A-Za-z0-9_])(?:[A-Za-z_][A-Za-z0-9_-]*?)?(?:API[_-]?KEY|ACCESS[_-]?TOKEN|AUTH[_-]?TOKEN|CLIENT[_-]?SECRET|PRIVATE[_-]?KEY|PASSWORD|TOKEN|SECRET(?:[_-]?KEY)?)["']?\s*[:=]\s*(["'`])((?:(?!\1|\$\{)[^\r\n\\]|\\.){16,})\1/giu;
|
|
19
|
-
const SECRET_CONFIG_ASSIGNMENT =
|
|
20
|
-
/^[ \t]*(?:export[ \t]+)?(?:[A-Za-z_][A-Za-z0-9_-]*?)?(?:API[_-]?KEY|ACCESS[_-]?TOKEN|AUTH[_-]?TOKEN|CLIENT[_-]?SECRET|PRIVATE[_-]?KEY|PASSWORD|TOKEN|SECRET(?:[_-]?KEY)?)[ \t]*[:=][ \t]*(?!process\.env(?:\.|\[)|import\.meta\.env(?:\.|\[)|Deno\.env\.|os\.environ|env\.)([^\s"'`#()\[\]{}$]{16,})[ \t]*(?:#[^\r\n]*)?\r?$/gimu;
|
|
21
|
-
const CREDENTIAL_PLACEHOLDER =
|
|
22
|
-
/^(?:example(?:[-_].*)?|placeholder(?:[-_].*)?|your[-_].*|(?:change|replace)[-_]me(?:[-_].*)?|(?:dummy|fake|mock|test|never[-_]return)[-_](?:api[-_]?key|access[-_]?token|auth[-_]?token|client[-_]?secret|password|token|secret(?:[-_]?key)?))$/iu;
|
|
23
16
|
const TASK_ID = /^(?:T|TASK|QT)-\d{3,}$/u;
|
|
24
17
|
const STORY_ID = /^US-\d{3,}$/u;
|
|
25
18
|
const SPEC_ID = /^SPEC-\d{3,}$/u;
|
|
26
19
|
const FEATURE_ID = /^FEAT-\d{3,}$/u;
|
|
27
20
|
const EPIC_ID = /^EPIC-\d{3,}$/u;
|
|
21
|
+
// Credential findings of an optional omission, keyed by the omission entry. The delegate reads
|
|
22
|
+
// the written capsule, so they reach only the parent's preview.
|
|
23
|
+
const OMISSION_FINDINGS = new WeakMap();
|
|
28
24
|
|
|
29
25
|
export class CapsuleError extends Error {
|
|
30
26
|
constructor(code, message, details = {}) {
|
|
@@ -68,14 +64,9 @@ function isSecretPath(path) {
|
|
|
68
64
|
return parts.some((part) => SECRET_SEGMENT.test(part)) || SECRET_NAME.test(parts.at(-1));
|
|
69
65
|
}
|
|
70
66
|
|
|
67
|
+
/** True when free text holds credential material; source files are classified by their syntax. */
|
|
71
68
|
export function containsSecret(bytes) {
|
|
72
|
-
|
|
73
|
-
if (SECRET_VALUE.test(content)) return true;
|
|
74
|
-
for (const match of content.matchAll(SECRET_ASSIGNMENT))
|
|
75
|
-
if (!CREDENTIAL_PLACEHOLDER.test(match[2])) return true;
|
|
76
|
-
for (const match of content.matchAll(SECRET_CONFIG_ASSIGNMENT))
|
|
77
|
-
if (!CREDENTIAL_PLACEHOLDER.test(match[1])) return true;
|
|
78
|
-
return false;
|
|
69
|
+
return classifyCredentials(bytes).findings.length > 0;
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
export function assertCredentialFreeText(
|
|
@@ -84,10 +75,34 @@ export function assertCredentialFreeText(
|
|
|
84
75
|
) {
|
|
85
76
|
if (typeof value !== 'string')
|
|
86
77
|
throw new CapsuleError('E_CAPSULE_INPUT', `${label} must be text.`);
|
|
87
|
-
|
|
78
|
+
const { contentDigest, findings } = classifyCredentials(Buffer.from(value, 'utf8'), {
|
|
79
|
+
label,
|
|
80
|
+
resolvable: false,
|
|
81
|
+
});
|
|
82
|
+
if (findings.length)
|
|
88
83
|
throw new CapsuleError(
|
|
89
84
|
code,
|
|
90
85
|
`${label} contains credential material; use native configuration or credential environment references instead.`,
|
|
86
|
+
{ findings, contentDigest },
|
|
87
|
+
);
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function credentialResolutionList(value) {
|
|
92
|
+
if (
|
|
93
|
+
!Array.isArray(value) ||
|
|
94
|
+
value.length > 64 ||
|
|
95
|
+
value.some(
|
|
96
|
+
(resolution) =>
|
|
97
|
+
!resolution ||
|
|
98
|
+
typeof resolution !== 'object' ||
|
|
99
|
+
!/^cred_[a-f0-9]{16}$/u.test(resolution.id ?? '') ||
|
|
100
|
+
!/^sha256:[a-f0-9]{64}$/u.test(resolution.contentDigest ?? ''),
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
throw new CapsuleError(
|
|
104
|
+
'E_CAPSULE_INPUT',
|
|
105
|
+
'Credential resolutions must list at most 64 { id, contentDigest } entries from reported findings.',
|
|
91
106
|
);
|
|
92
107
|
return value;
|
|
93
108
|
}
|
|
@@ -312,8 +327,22 @@ export async function buildContextCapsule({
|
|
|
312
327
|
optionalFiles = [],
|
|
313
328
|
readOnlyRepositories = [],
|
|
314
329
|
limits,
|
|
330
|
+
credentialResolutions = [],
|
|
315
331
|
} = {}) {
|
|
316
332
|
if (!repositoryRoot) throw new CapsuleError('E_CAPSULE_SOURCE', 'repositoryRoot is required.');
|
|
333
|
+
const resolutions = credentialResolutionList(credentialResolutions);
|
|
334
|
+
const appliedResolutions = [];
|
|
335
|
+
const credentialCheck = (bytes, origin) => {
|
|
336
|
+
const classification = classifyCredentials(bytes, origin);
|
|
337
|
+
return {
|
|
338
|
+
...resolveFindings(classification, resolutions),
|
|
339
|
+
contentDigest: classification.contentDigest,
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
const recordResolutions = ({ applied, contentDigest }, source) => {
|
|
343
|
+
for (const { id, rule, location } of applied)
|
|
344
|
+
appliedResolutions.push({ id, contentDigest, ...source, rule, location });
|
|
345
|
+
};
|
|
317
346
|
if (request !== undefined && typeof request !== 'string')
|
|
318
347
|
throw new CapsuleError('E_CAPSULE_INPUT', 'A direct request must be text.');
|
|
319
348
|
if (Boolean(taskSelector) === Boolean(request?.trim())) {
|
|
@@ -354,8 +383,18 @@ export async function buildContextCapsule({
|
|
|
354
383
|
if (request && Buffer.byteLength(request, 'utf8') > bounds.maxFileBytes) {
|
|
355
384
|
throw new CapsuleError('E_CAPSULE_LIMIT', 'The direct request exceeds the capsule text limit.');
|
|
356
385
|
}
|
|
357
|
-
if (request
|
|
358
|
-
|
|
386
|
+
if (request) {
|
|
387
|
+
const credentials = credentialCheck(Buffer.from(request, 'utf8'), { label: 'request' });
|
|
388
|
+
if (credentials.remaining.length)
|
|
389
|
+
throw new CapsuleError(
|
|
390
|
+
'E_CAPSULE_SECRET',
|
|
391
|
+
'The direct request contains credential material.',
|
|
392
|
+
{
|
|
393
|
+
findings: credentials.remaining,
|
|
394
|
+
contentDigest: credentials.contentDigest,
|
|
395
|
+
},
|
|
396
|
+
);
|
|
397
|
+
recordResolutions(credentials, { source: 'request' });
|
|
359
398
|
}
|
|
360
399
|
const roots = await sourceRoots(repositoryRoot, readOnlyRepositories);
|
|
361
400
|
const project = roots.get('project').physical;
|
|
@@ -381,9 +420,16 @@ export async function buildContextCapsule({
|
|
|
381
420
|
return prior;
|
|
382
421
|
}
|
|
383
422
|
const optionalOmission = (reason) => {
|
|
384
|
-
if (required)
|
|
423
|
+
if (required)
|
|
424
|
+
throw new CapsuleError(reason.code, reason.message, {
|
|
425
|
+
repositoryKey,
|
|
426
|
+
path,
|
|
427
|
+
...reason.details,
|
|
428
|
+
});
|
|
385
429
|
if (!omitted.has(key)) {
|
|
386
|
-
|
|
430
|
+
const omission = { repositoryKey, path, role, reason: reason.code };
|
|
431
|
+
if (reason.details) OMISSION_FINDINGS.set(omission, reason.details);
|
|
432
|
+
omissions.push(omission);
|
|
387
433
|
omitted.add(key);
|
|
388
434
|
}
|
|
389
435
|
return null;
|
|
@@ -467,11 +513,20 @@ export async function buildContextCapsule({
|
|
|
467
513
|
message: `Required source exceeds capsule limits: ${path}`,
|
|
468
514
|
});
|
|
469
515
|
}
|
|
470
|
-
|
|
516
|
+
// A link reads as its target's syntax, or as configuration when either path is configuration.
|
|
517
|
+
const syntaxes = [path, relative(allowed, physical).split(sep).join('/')].map(credentialSyntax);
|
|
518
|
+
const credentials = credentialCheck(bytes, {
|
|
519
|
+
path,
|
|
520
|
+
label: `${repositoryKey}/${path}`,
|
|
521
|
+
syntax: syntaxes.includes('config') ? 'config' : syntaxes[1],
|
|
522
|
+
});
|
|
523
|
+
if (credentials.remaining.length)
|
|
471
524
|
return optionalOmission({
|
|
472
525
|
code: 'E_CAPSULE_SECRET',
|
|
473
526
|
message: `Credential material detected in source: ${path}`,
|
|
527
|
+
details: { findings: credentials.remaining, contentDigest: credentials.contentDigest },
|
|
474
528
|
});
|
|
529
|
+
recordResolutions(credentials, { repositoryKey, path });
|
|
475
530
|
const copy = {
|
|
476
531
|
repositoryKey,
|
|
477
532
|
path,
|
|
@@ -686,6 +741,7 @@ export async function buildContextCapsule({
|
|
|
686
741
|
inventory,
|
|
687
742
|
files,
|
|
688
743
|
omissions,
|
|
744
|
+
...(appliedResolutions.length ? { credentialResolutions: appliedResolutions } : {}),
|
|
689
745
|
planning: {
|
|
690
746
|
logicalPath: join(project, '.planr'),
|
|
691
747
|
physicalPath: roots.get('project').planning,
|
|
@@ -731,7 +787,13 @@ export function previewContextCapsule(capsule) {
|
|
|
731
787
|
mode: capsule.mode,
|
|
732
788
|
selector: capsule.selector,
|
|
733
789
|
inventory: capsule.inventory,
|
|
734
|
-
omissions: capsule.omissions
|
|
790
|
+
omissions: capsule.omissions.map((omission) => ({
|
|
791
|
+
...omission,
|
|
792
|
+
...OMISSION_FINDINGS.get(omission),
|
|
793
|
+
})),
|
|
794
|
+
...(capsule.credentialResolutions
|
|
795
|
+
? { credentialResolutions: capsule.credentialResolutions }
|
|
796
|
+
: {}),
|
|
735
797
|
blockers: [],
|
|
736
798
|
planning: capsule.planning ?? null,
|
|
737
799
|
sourceKeys: capsule.sourceKeys,
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Credential classification for delegated context. Findings never carry the matched value.
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Recognizable credential formats; rejected everywhere, including tests and placeholders.
|
|
6
|
+
* Case-sensitive: each prefix has a fixed case, and `github_pat_` and `sk-` bodies need an
|
|
7
|
+
* uppercase letter or digit.
|
|
8
|
+
*/
|
|
9
|
+
export const CREDENTIAL_FORMAT =
|
|
10
|
+
/-----BEGIN (?:[A-Z ]* )?PRIVATE KEY(?: BLOCK)?-----|"private_key"\s*:\s*"-----BEGIN|(?<![A-Za-z0-9])AKIA[0-9A-Z]{16}\b|(?<![A-Za-z0-9])gh[pousr]_[A-Za-z0-9]{20,}(?![A-Za-z0-9])|(?<![A-Za-z0-9])github_pat_(?=[A-Za-z0-9_]*[A-Z0-9])[A-Za-z0-9_]{20,}\b|(?<![A-Za-z0-9])sk-(?:proj-)?(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{24,}\b|(?<![A-Za-z0-9])xox[baprs]-[A-Za-z0-9-]{20,}/u;
|
|
11
|
+
|
|
12
|
+
// `word` is the credential word findings report as `key`; the rest of a name may hold a value.
|
|
13
|
+
const CREDENTIAL_NAME =
|
|
14
|
+
'(?<name>(?:[A-Za-z_][A-Za-z0-9_-]*?)?(?<word>API[_-]?KEY|ACCESS[_-]?TOKEN|AUTH[_-]?TOKEN|CLIENT[_-]?SECRET|PRIVATE[_-]?KEY|PASSWORD|TOKEN|SECRET(?:[_-]?KEY)?))';
|
|
15
|
+
const QUOTED_ASSIGNMENT = new RegExp(
|
|
16
|
+
`(?:^|[^A-Za-z0-9_])${CREDENTIAL_NAME}["']?\\s*[:=]\\s*(?<quote>["'\`])(?<value>(?:(?!\\k<quote>|\\$\\{)[^\\r\\n\\\\]|\\\\.){16,})\\k<quote>`,
|
|
17
|
+
'giu',
|
|
18
|
+
);
|
|
19
|
+
const UNQUOTED_ASSIGNMENT = new RegExp(
|
|
20
|
+
`^[ \\t]*(?<exported>export[ \\t]+)?${CREDENTIAL_NAME}(?<before>[ \\t]*)(?<operator>[:=])(?<after>[ \\t]*)(?!process\\.env(?:\\.|\\[)|import\\.meta\\.env(?:\\.|\\[)|Deno\\.env\\.|os\\.environ|env\\.)(?<value>[^\\s"'\`#()\\[\\]{}$]{16,})[ \\t]*(?:#[^\\r\\n]*)?\\r?$`,
|
|
21
|
+
'gimu',
|
|
22
|
+
);
|
|
23
|
+
const PLACEHOLDER =
|
|
24
|
+
/^(?:example(?:[-_].*)?|placeholder(?:[-_].*)?|your[-_].*|(?:change|replace)[-_]me(?:[-_].*)?|(?:dummy|fake|mock|test|never[-_]return)[-_](?:api[-_]?key|access[-_]?token|auth[-_]?token|client[-_]?secret|password|token|secret(?:[-_]?key)?))$/iu;
|
|
25
|
+
// A lowercase marker followed only by words and short numbers, one of them a credential noun.
|
|
26
|
+
const DESCRIBED_PLACEHOLDER =
|
|
27
|
+
/^(?:dummy|fake|mock|test|fixture|synthetic|never[-_]return)(?:[-_. ](?:[a-z]+|\d{1,4}))+[-_.]?$/u;
|
|
28
|
+
const CREDENTIAL_NOUN = /[-_. ](?:secret|key|token|password|credential)s?(?=[-_. ]|$)/u;
|
|
29
|
+
const SHELL_NAME = /^[A-Z][A-Z0-9_]*$/u;
|
|
30
|
+
const IDENTIFIER_WORD = /[A-Z]{2,}(?![a-z])\d{0,2}|[A-Z]?[a-z]+\d{0,2}|[A-Z]\d{0,2}|\d{1,2}/gu;
|
|
31
|
+
|
|
32
|
+
const CODE_EXTENSIONS = new Set(
|
|
33
|
+
'c cc cjs cpp cs cts dart go groovy h hpp java js jsx kt kts lua m mjs mm mts php py rb rs scala svelte swift ts tsx vue'.split(
|
|
34
|
+
' ',
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
const CONFIG_EXTENSIONS = new Set(
|
|
38
|
+
'bash cfg conf env fish hcl ini json json5 jsonc properties ps1 sh tf toml xml yaml yml zsh'.split(
|
|
39
|
+
' ',
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
const CONFIG_NAMES = new Set(['dockerfile', 'makefile', 'procfile']);
|
|
43
|
+
|
|
44
|
+
/** The syntax that decides whether an unquoted value is a literal: code, config, or free text. */
|
|
45
|
+
export function credentialSyntax(path) {
|
|
46
|
+
if (typeof path !== 'string' || !path) return 'text';
|
|
47
|
+
const name = path.split('/').at(-1).toLowerCase();
|
|
48
|
+
if (CONFIG_NAMES.has(name) || name.startsWith('.env')) return 'config';
|
|
49
|
+
const extension = name.includes('.') ? name.split('.').at(-1) : '';
|
|
50
|
+
if (CODE_EXTENSIONS.has(extension)) return 'code';
|
|
51
|
+
if (CONFIG_EXTENSIONS.has(extension)) return 'config';
|
|
52
|
+
return 'text';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function sha256(value) {
|
|
56
|
+
return createHash('sha256').update(value).digest('hex');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function position(content, index) {
|
|
60
|
+
const before = content.slice(0, index);
|
|
61
|
+
return { line: before.split('\n').length, column: index - before.lastIndexOf('\n') };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Reads like a code identifier: whole words, digits only at word ends, at most one one-letter word.
|
|
65
|
+
function codeIdentifier(value) {
|
|
66
|
+
if (!/^[A-Za-z_$][\w$]*$/u.test(value) || value.length > 64) return false;
|
|
67
|
+
let singleLetters = 0;
|
|
68
|
+
for (const part of value.split(/[_$]+/u).filter(Boolean)) {
|
|
69
|
+
const words = part.match(IDENTIFIER_WORD) ?? [];
|
|
70
|
+
if (words.join('') !== part) return false;
|
|
71
|
+
singleLetters += words.filter((word) => word.replace(/\d+$/u, '').length <= 1).length;
|
|
72
|
+
}
|
|
73
|
+
return singleLetters <= 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function memberPath(value) {
|
|
77
|
+
const segments = value.replace(/!$/u, '').split(/[!?]?\./u);
|
|
78
|
+
return segments.length > 1 && segments.every(codeIdentifier);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// An unquoted value is a literal unless its syntax makes it a reference, type or expression.
|
|
82
|
+
// Multi-line strings in code read like text, so an unterminated identifier stays a literal.
|
|
83
|
+
function unquotedLiteral(raw, operator, syntax) {
|
|
84
|
+
if (syntax === 'config' || (syntax === 'text' && operator === '=')) return true;
|
|
85
|
+
const terminated = /[;,]$/u.test(raw);
|
|
86
|
+
const value = terminated ? raw.slice(0, -1) : raw;
|
|
87
|
+
if (memberPath(value)) return !(terminated || syntax === 'code');
|
|
88
|
+
return !(terminated && codeIdentifier(value));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// `export NAME=` is a shell line in any file, and so is an uppercase `NAME=value` without spaces
|
|
92
|
+
// unless it ends in `,` like a keyword argument.
|
|
93
|
+
function shellAssignment({ exported, name, before, operator, after, value }) {
|
|
94
|
+
if (exported) return true;
|
|
95
|
+
return operator === '=' && !before && !after && SHELL_NAME.test(name) && !value.endsWith(',');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function placeholder(value) {
|
|
99
|
+
return (
|
|
100
|
+
PLACEHOLDER.test(value) || (DESCRIBED_PLACEHOLDER.test(value) && CREDENTIAL_NOUN.test(value))
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Classifies credential material in `bytes` from `origin` ({ path?, label?, syntax?, resolvable? }).
|
|
106
|
+
* Findings report location, rule, classification, confidence and explanation, never values.
|
|
107
|
+
* `resolvable: false` marks text that no resolution can admit, such as a correction.
|
|
108
|
+
*/
|
|
109
|
+
export function classifyCredentials(bytes, origin = {}) {
|
|
110
|
+
const buffer = Buffer.isBuffer(bytes) ? bytes : Buffer.from(String(bytes), 'utf8');
|
|
111
|
+
const content = buffer.toString('utf8');
|
|
112
|
+
const label = origin.label ?? origin.path ?? 'text';
|
|
113
|
+
const syntax = origin.syntax ?? credentialSyntax(origin.path);
|
|
114
|
+
const resolvable = origin.resolvable !== false;
|
|
115
|
+
const findings = [];
|
|
116
|
+
const add = (rule, index, key, details) => {
|
|
117
|
+
const { line, column } = position(content, index);
|
|
118
|
+
findings.push({
|
|
119
|
+
id: `cred_${sha256(`${label}\n${rule}\n${line}:${column}\n${key ?? ''}`).slice(0, 16)}`,
|
|
120
|
+
rule,
|
|
121
|
+
...details,
|
|
122
|
+
location: { ...(origin.path ? { path: origin.path } : {}), line, column },
|
|
123
|
+
...(key ? { key } : {}),
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
for (const match of content.matchAll(new RegExp(CREDENTIAL_FORMAT.source, 'gu')))
|
|
127
|
+
add('credential-format', match.index, null, {
|
|
128
|
+
classification: 'credential',
|
|
129
|
+
confidence: 'high',
|
|
130
|
+
resolvable: false,
|
|
131
|
+
explanation:
|
|
132
|
+
'A recognizable credential or private key format cannot be delegated; remove it from the source.',
|
|
133
|
+
});
|
|
134
|
+
const literal = ({ index, 0: text, groups: { name, word } }) =>
|
|
135
|
+
add('credential-assignment', index + text.indexOf(name), word, {
|
|
136
|
+
classification: 'possible-credential',
|
|
137
|
+
confidence: 'medium',
|
|
138
|
+
resolvable,
|
|
139
|
+
explanation: `${word} is assigned a literal that is neither a reference nor a recognized placeholder; ${resolvable ? 'resolve this finding only if the value is not a credential' : 'remove the value or replace it with a reference'}.`,
|
|
140
|
+
});
|
|
141
|
+
for (const match of content.matchAll(QUOTED_ASSIGNMENT))
|
|
142
|
+
if (!placeholder(match.groups.value)) literal(match);
|
|
143
|
+
for (const match of content.matchAll(UNQUOTED_ASSIGNMENT)) {
|
|
144
|
+
const { operator, value } = match.groups;
|
|
145
|
+
const lineSyntax = shellAssignment(match.groups) ? 'config' : syntax;
|
|
146
|
+
if (unquotedLiteral(value, operator, lineSyntax) && !placeholder(value.replace(/[;,]$/u, '')))
|
|
147
|
+
literal(match);
|
|
148
|
+
}
|
|
149
|
+
return { contentDigest: `sha256:${sha256(buffer)}`, syntax, findings };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Splits findings into those an explicit resolution covers and the rest. A resolution names one
|
|
154
|
+
* resolvable finding and the exact content digest it was recorded for; changed bytes invalidate it.
|
|
155
|
+
*/
|
|
156
|
+
export function resolveFindings(classification, resolutions = []) {
|
|
157
|
+
const accepted = new Set(
|
|
158
|
+
resolutions
|
|
159
|
+
.filter((resolution) => resolution?.contentDigest === classification.contentDigest)
|
|
160
|
+
.map((resolution) => resolution.id),
|
|
161
|
+
);
|
|
162
|
+
const applied = [];
|
|
163
|
+
const remaining = [];
|
|
164
|
+
for (const finding of classification.findings)
|
|
165
|
+
(finding.resolvable && accepted.has(finding.id) ? applied : remaining).push(finding);
|
|
166
|
+
return { applied, remaining };
|
|
167
|
+
}
|
|
@@ -39,7 +39,7 @@ export function preparationPresentation(preview) {
|
|
|
39
39
|
return {
|
|
40
40
|
phase: 'preview',
|
|
41
41
|
headline: `${taskLabel(preview.selector)} is ready for review before dispatch.`,
|
|
42
|
-
context: `${preview.inventory.length} copied file(s); ${preview.omissions.length} omission(s).`,
|
|
42
|
+
context: `${preview.inventory.length} copied file(s); ${preview.omissions.length} omission(s); ${preview.credentialResolutions?.length ?? 0} accepted credential resolution(s).`,
|
|
43
43
|
writableRepository: preview.writableRepository,
|
|
44
44
|
worktreePath: preview.worktreePath,
|
|
45
45
|
selectedPaths: preview.selectedPaths,
|
|
@@ -49,6 +49,7 @@ export function preparationPresentation(preview) {
|
|
|
49
49
|
: 'Legacy run has no recorded integration scope; supply explicit paths at review. The worktree is not a filesystem sandbox.',
|
|
50
50
|
inventory: preview.inventory,
|
|
51
51
|
omissions: preview.omissions,
|
|
52
|
+
credentialResolutions: preview.credentialResolutions ?? [],
|
|
52
53
|
blockers: preview.blockers ?? [],
|
|
53
54
|
planning: preview.planning ?? null,
|
|
54
55
|
helper: preview.helper ?? null,
|
|
@@ -61,7 +62,7 @@ export function preparationPresentation(preview) {
|
|
|
61
62
|
destination: preview.destination,
|
|
62
63
|
...(preview.executionPolicy ? { executionPolicy: preview.executionPolicy } : {}),
|
|
63
64
|
nextAction:
|
|
64
|
-
'Review required sources, optional omissions, planning location, integration scope, and destination before dispatch.',
|
|
65
|
+
'Review required sources, optional omissions, accepted credential resolutions, planning location, integration scope, and destination before dispatch.',
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { isAbsolute, sep } from 'node:path';
|
|
4
4
|
import { assertCredentialFreeText } from './context.mjs';
|
|
5
|
+
import { CREDENTIAL_FORMAT } from './credentials.mjs';
|
|
5
6
|
import { updateRunRecord } from './run-record.mjs';
|
|
6
7
|
|
|
7
8
|
const MAX_HANDOFF_TEXT = 4096;
|
|
@@ -16,9 +17,6 @@ export const SHA256 = /^[a-f0-9]{64}$/u;
|
|
|
16
17
|
|
|
17
18
|
const RESULT_STATES = new Set(['completed', 'blocked', 'question']);
|
|
18
19
|
|
|
19
|
-
const CREDENTIAL =
|
|
20
|
-
/-----BEGIN (?:[A-Z ]* )?PRIVATE KEY-----|\bAKIA[0-9A-Z]{16}\b|\bgh[pousr]_[A-Za-z0-9_]{20,}\b|\bgithub_pat_[A-Za-z0-9_]{20,}\b|\bsk-(?:proj-)?[A-Za-z0-9_-]{24,}\b|\bxox[baprs]-[A-Za-z0-9-]{20,}/iu;
|
|
21
|
-
|
|
22
20
|
export class DelegateRunError extends Error {
|
|
23
21
|
constructor(code, message, runId = null, details = null) {
|
|
24
22
|
super(message);
|
|
@@ -68,7 +66,7 @@ export function boundedText(value, label) {
|
|
|
68
66
|
typeof value !== 'string' ||
|
|
69
67
|
!value.trim() ||
|
|
70
68
|
Buffer.byteLength(value, 'utf8') > MAX_HANDOFF_TEXT ||
|
|
71
|
-
|
|
69
|
+
CREDENTIAL_FORMAT.test(value)
|
|
72
70
|
) {
|
|
73
71
|
throw new DelegateRunError(
|
|
74
72
|
'E_DELEGATE_INPUT',
|
|
@@ -152,7 +150,7 @@ function validQuestion(question) {
|
|
|
152
150
|
typeof question.text !== 'string' ||
|
|
153
151
|
!question.text.trim() ||
|
|
154
152
|
Buffer.byteLength(question.text, 'utf8') > MAX_HANDOFF_TEXT ||
|
|
155
|
-
|
|
153
|
+
CREDENTIAL_FORMAT.test(question.text) ||
|
|
156
154
|
(question.options !== undefined &&
|
|
157
155
|
(!Array.isArray(question.options) ||
|
|
158
156
|
question.options.length > 12 ||
|
|
@@ -160,7 +158,7 @@ function validQuestion(question) {
|
|
|
160
158
|
(option) =>
|
|
161
159
|
typeof option !== 'string' ||
|
|
162
160
|
Buffer.byteLength(option, 'utf8') > 256 ||
|
|
163
|
-
|
|
161
|
+
CREDENTIAL_FORMAT.test(option),
|
|
164
162
|
)))
|
|
165
163
|
)
|
|
166
164
|
return false;
|
|
@@ -181,7 +179,7 @@ export function resultShape(result, expectedSessionId = null) {
|
|
|
181
179
|
) {
|
|
182
180
|
return null;
|
|
183
181
|
}
|
|
184
|
-
if (
|
|
182
|
+
if (CREDENTIAL_FORMAT.test(result.summary)) return null;
|
|
185
183
|
if (result.status === 'blocked' && !result.summary.trim()) return null;
|
|
186
184
|
if (result.status === 'question' && !validQuestion(result.question)) return null;
|
|
187
185
|
if (
|
|
@@ -143,6 +143,7 @@ export async function prepareDelegateRun({
|
|
|
143
143
|
selectedFiles = [],
|
|
144
144
|
optionalFiles = [],
|
|
145
145
|
readOnlyRepositories = [],
|
|
146
|
+
credentialResolutions = [],
|
|
146
147
|
selectedPaths,
|
|
147
148
|
scopePaths,
|
|
148
149
|
preservePaths = [],
|
|
@@ -199,6 +200,7 @@ export async function prepareDelegateRun({
|
|
|
199
200
|
selectedFiles,
|
|
200
201
|
optionalFiles,
|
|
201
202
|
readOnlyRepositories,
|
|
203
|
+
credentialResolutions,
|
|
202
204
|
});
|
|
203
205
|
const integrationScopePaths = scopePaths === undefined ? null : integrationPaths(scopePaths);
|
|
204
206
|
let identity = profileIdentity(prepared);
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { join, resolve, sep } from 'node:path';
|
|
16
16
|
import { promisify } from 'node:util';
|
|
17
|
+
import { CREDENTIAL_FORMAT } from './credentials.mjs';
|
|
17
18
|
import { captureFileState } from './custody.mjs';
|
|
18
19
|
|
|
19
20
|
export const RUN_RECORD_SCHEMA_VERSION = '2.0.0';
|
|
@@ -21,8 +22,6 @@ export const MAX_RUN_RECORD_BYTES = 64 * 1024;
|
|
|
21
22
|
export const CLOSED_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
22
23
|
|
|
23
24
|
const RUN_ID = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,99}$/u;
|
|
24
|
-
const CREDENTIAL =
|
|
25
|
-
/-----BEGIN (?:[A-Z ]* )?PRIVATE KEY-----|\bAKIA[0-9A-Z]{16}\b|\bgh[pousr]_[A-Za-z0-9_]{20,}\b|\bgithub_pat_[A-Za-z0-9_]{20,}\b|\bsk-(?:proj-)?[A-Za-z0-9_-]{24,}\b|\bxox[baprs]-[A-Za-z0-9-]{20,}/iu;
|
|
26
25
|
|
|
27
26
|
const execute = promisify(execFile);
|
|
28
27
|
|
|
@@ -74,7 +73,7 @@ function encoded(record) {
|
|
|
74
73
|
if (bytes.length > MAX_RUN_RECORD_BYTES) {
|
|
75
74
|
throw new RunRecordError('E_RUN_LIMIT', 'Delegated run record exceeds its private size limit.');
|
|
76
75
|
}
|
|
77
|
-
if (
|
|
76
|
+
if (CREDENTIAL_FORMAT.test(bytes.toString('utf8'))) {
|
|
78
77
|
throw new RunRecordError('E_RUN_CREDENTIAL', 'Credential material cannot enter a run record.');
|
|
79
78
|
}
|
|
80
79
|
return bytes;
|
|
@@ -13,7 +13,7 @@ review. Preview the exact diagram title, source revision, elements, connections,
|
|
|
13
13
|
destination and retention before creating it. Use `--yes` only when the user has
|
|
14
14
|
already authorized that publication. The stable URL and generated access token
|
|
15
15
|
are separate; copy the token through the local studio's **Share diagram** dialog,
|
|
16
|
-
never into a URL, prompt, ordinary output or repository file. Owner
|
|
16
|
+
never into a URL, prompt, ordinary output or repository file. Owner keys
|
|
17
17
|
are saved privately outside the project. The review remains available until the
|
|
18
18
|
owner revokes or deletes it and works while the local studio is stopped.
|
|
19
19
|
|
|
@@ -47,9 +47,11 @@ matches. Never overwrite a prior cycle implicitly.
|
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
`cycle.md` records the effective scope, roster, repository revision when relevant, and the outcome
|
|
50
|
-
of each lens.
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
of each lens. An advisor lens run on its own creates the same layout with a one-lens roster and an
|
|
51
|
+
unsynthesized `board-report.md`, so every review the dashboard lists has one shape.
|
|
52
|
+
If the directory is ignored by Git, continue locally and mention that in the report; do not ask the
|
|
53
|
+
user to change ignore rules. Report an exact filesystem error only when the cycle workspace cannot be
|
|
54
|
+
created or written.
|
|
53
55
|
|
|
54
56
|
## Build shared context once
|
|
55
57
|
|
|
@@ -79,8 +79,14 @@ Write stories and tasks directly in the repository's active planning mode.
|
|
|
79
79
|
deleted ID. The packaged [planning ID helper](scripts/planning-ids.mjs) may
|
|
80
80
|
inspect or reserve IDs; it never generates content.
|
|
81
81
|
- Give each story stable acceptance IDs starting at `AC-001`.
|
|
82
|
-
-
|
|
83
|
-
|
|
82
|
+
- Split each story into tasks that are coherent and independently verifiable.
|
|
83
|
+
Separate by ownership first: UI work is a `UI` task for the frontend role and
|
|
84
|
+
server, data, or integration work is a `Tech` task for the backend role.
|
|
85
|
+
Within one owner, split further only for a real output dependency, a distinct
|
|
86
|
+
verification surface, or reviewable size. Most stories need one Tech task,
|
|
87
|
+
plus one UI task when a design surface applies; never fragment one coherent
|
|
88
|
+
change into tasks that cannot be verified alone, and never fold unrelated work
|
|
89
|
+
into one task.
|
|
84
90
|
- Map every acceptance ID through `acceptanceRefs` and name it with a concrete
|
|
85
91
|
verification statement under `## Test Requirements`.
|
|
86
92
|
- Set `reviewRisks` and `browserSurfaces` from repository evidence; use empty
|
|
@@ -36,7 +36,7 @@ capability; it never blocks the run. Name every degraded input in `Issues`.
|
|
|
36
36
|
| Capacity (engineers × working days) | Fit the list and name the overflow | Ask once; default 1 engineer × 10 days, stated in the return |
|
|
37
37
|
| Previous sprint or refinement note (`.planr/sprints/SPRINT-NNN/refinement.json`) | Carry `leftovers`; `openplanr sprint diff` is possible | First run, no diff |
|
|
38
38
|
| Last Operate cycle | Rank its unfinished actions alongside | Skipped silently |
|
|
39
|
-
| Linear or GitHub
|
|
39
|
+
| Linear or GitHub connection ([tracker connections](references/tracker-connections.md)) | Update linked issues on approval, read PR state | Local files only; report the external step as not run and name the connection to add |
|
|
40
40
|
|
|
41
41
|
## Step 0: Frame the run
|
|
42
42
|
|
|
@@ -135,9 +135,10 @@ openplanr sprint apply SPRINT-NNN --dry-run # show the status and prior
|
|
|
135
135
|
openplanr sprint apply SPRINT-NNN --yes --commit # one commit: chore(planr): refine backlog for SPRINT-NNN
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
Then update the issue linked to each changed item through the host's Linear or
|
|
139
|
+
GitHub connection, with the status mapping in
|
|
140
|
+
[tracker connections](references/tracker-connections.md), and report the items that
|
|
141
|
+
were not updated. When the CLI is unavailable, apply the same status changes with
|
|
141
142
|
the repository's own vocabulary and commit them with the same message.
|
|
142
143
|
|
|
143
144
|
Close a finished sprint with `openplanr sprint close SPRINT-NNN`; it records the
|
|
@@ -44,6 +44,17 @@
|
|
|
44
44
|
],
|
|
45
45
|
"executable": false
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
"path": "references/tracker-connections.md",
|
|
49
|
+
"kind": "reference",
|
|
50
|
+
"hosts": [
|
|
51
|
+
"claude-code",
|
|
52
|
+
"codex",
|
|
53
|
+
"chatgpt",
|
|
54
|
+
"cursor"
|
|
55
|
+
],
|
|
56
|
+
"executable": false
|
|
57
|
+
},
|
|
47
58
|
{
|
|
48
59
|
"path": "schemas/refinement.schema.json",
|
|
49
60
|
"kind": "schema",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# GitHub and Linear connections
|
|
2
|
+
|
|
3
|
+
These skills store and read no GitHub or Linear credentials. Remote steps run through a
|
|
4
|
+
connection the host already has; the planning files stay the source of truth.
|
|
5
|
+
|
|
6
|
+
## Use the host's connection
|
|
7
|
+
|
|
8
|
+
- **Linear:** the host's Linear connection, whose tools read, create and update issues.
|
|
9
|
+
- **GitHub:** the host's GitHub connection, or the GitHub CLI when
|
|
10
|
+
`gh auth status --hostname github.com` succeeds.
|
|
11
|
+
|
|
12
|
+
Never ask the user for a token, read one from the environment or a file, or put one in a
|
|
13
|
+
command, URL or file.
|
|
14
|
+
|
|
15
|
+
## When a connection is missing
|
|
16
|
+
|
|
17
|
+
Finish the local work first. Then report the remote step as not run and give the one
|
|
18
|
+
line for the current host:
|
|
19
|
+
|
|
20
|
+
| Host | Linear | GitHub |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| Claude Code | Run `/plugin install linear@claude-plugins-official`, then sign in to Linear from `/mcp`. | Install the GitHub CLI (cli.github.com) and run `gh auth login`. |
|
|
23
|
+
| Codex | Run `codex mcp add linear --url https://mcp.linear.app/mcp`, then `codex mcp login linear`. | Install the GitHub plugin from `/plugins`, or run `gh auth login`. |
|
|
24
|
+
| Cursor | Add Linear from the Cursor Marketplace and sign in to Linear. | Install the GitHub CLI (cli.github.com) and run `gh auth login`. |
|
|
25
|
+
|
|
26
|
+
Ask the user to try again once connected; never retry the remote step on your own.
|
|
27
|
+
|
|
28
|
+
## Status mapping
|
|
29
|
+
|
|
30
|
+
| Local status | Linear workflow state | GitHub issue |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `planning`, `pending` | Unstarted (for example Todo) | open |
|
|
33
|
+
| `in-progress` | Started (for example In Progress) | open |
|
|
34
|
+
| `done` | Completed (for example Done) | closed |
|
|
35
|
+
| Backlog `open` | Backlog, else Unstarted | open |
|
|
36
|
+
| Backlog `closed` | Completed | closed |
|
|
37
|
+
| Backlog `promoted` | Leave as it is | Leave as it is |
|
|
38
|
+
|
|
39
|
+
When reading state back, write only a status the item's type allows. A backlog item takes
|
|
40
|
+
`open` or `closed` and keeps `promoted`.
|
|
41
|
+
|
|
42
|
+
- Linear Completed or Canceled sets `done`, or `closed` for a backlog item. Started sets
|
|
43
|
+
`in-progress`, and Triage, Backlog or Unstarted sets `planning` for features and stories
|
|
44
|
+
and `pending` for quick tasks; a backlog item takes `open` from any of these. Epics and
|
|
45
|
+
task files keep their status.
|
|
46
|
+
- A closed GitHub issue sets `done`, or `closed` for a backlog item. An open issue sets
|
|
47
|
+
`in-progress` for a `done` item and `open` for a `closed` backlog item; other statuses
|
|
48
|
+
stay as they are.
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
A linked item records its tracker identity in frontmatter. Update a linked item through
|
|
53
|
+
that identity instead of creating another, and record the identity of everything you
|
|
54
|
+
create.
|
|
55
|
+
|
|
56
|
+
- **GitHub:** each item is one issue, recorded as `githubIssue`.
|
|
57
|
+
- **Linear:** use the shapes the OpenPlanr CLI uses, so its later pushes reuse what you
|
|
58
|
+
create:
|
|
59
|
+
- An epic is a Linear project (`linearProjectId`, `linearProjectIdentifier`,
|
|
60
|
+
`linearProjectUrl`). When its `linearMappingStrategy` is `milestone-of` or `label-on`,
|
|
61
|
+
it is a milestone in an existing project (`linearMilestoneId`) or a team label
|
|
62
|
+
(`linearLabelId`) instead, and every issue under it carries that milestone
|
|
63
|
+
(`linearProjectMilestoneId`) or label (`linearLabelIds`).
|
|
64
|
+
- A feature, quick task or backlog item is one issue (`linearIssueId`,
|
|
65
|
+
`linearIssueIdentifier`, `linearIssueUrl`). A story is a sub-issue of its feature's
|
|
66
|
+
issue (`linearParentIssueId`).
|
|
67
|
+
- All task files of one feature share one task-list issue: a sub-issue of the feature's
|
|
68
|
+
issue whose checklist merges every task file, recorded in each task file. Its state is
|
|
69
|
+
Completed when every task file is `done`, Unstarted when every one is `pending`, and
|
|
70
|
+
Started otherwise.
|
|
@@ -11,9 +11,10 @@ planning artifacts, task statuses, dependency graph, current branch, and relevan
|
|
|
11
11
|
runtime markers directly. Use the optional deterministic `openplanr status --json`
|
|
12
12
|
utility when available, but do not require it or a semantic subprocess.
|
|
13
13
|
|
|
14
|
-
Add GitHub or Linear lookups only when the user requests live remote state
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Add GitHub or Linear lookups only when the user requests live remote state, through
|
|
15
|
+
the host's connections as described in [tracker connections](references/tracker-connections.md).
|
|
16
|
+
Keep local results useful when a connection is unavailable, and name the one to add.
|
|
17
|
+
Report counts, ready and blocked work, dependency problems, and the most useful next
|
|
17
18
|
action. Do not repair artifacts, start Plan or Ship, or change lifecycle state.
|
|
18
19
|
|
|
19
20
|
When the OpenPlanr dashboard is running (`planr-dashboard`), the same delivery
|