@ryuenn3123/agentic-senior-core 4.3.15 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/.agents/plugins/marketplace.json +21 -0
  2. package/.agents/rules/agentic-senior-core.md +126 -0
  3. package/.claude-plugin/marketplace.json +17 -0
  4. package/.claude-plugin/plugin.json +17 -0
  5. package/.clinerules/agentic-senior-core.md +94 -0
  6. package/.codex-plugin/plugin.json +24 -0
  7. package/.cursor/rules/agentic-senior-core.mdc +99 -0
  8. package/.devin-plugin/plugin.json +13 -0
  9. package/.github/copilot-instructions.md +94 -0
  10. package/.github/plugin/marketplace.json +20 -0
  11. package/.github/plugin/plugin.json +16 -0
  12. package/.kiro/steering/agentic-senior-core.md +94 -0
  13. package/.openclaw/skills/asc/SKILL.md +23 -0
  14. package/.openclaw/skills/asc-audit/SKILL.md +28 -0
  15. package/.openclaw/skills/asc-review/SKILL.md +54 -0
  16. package/.opencode/plugins/agentic-senior-core.mjs +31 -0
  17. package/.windsurf/rules/agentic-senior-core.md +94 -0
  18. package/AGENTS.md +126 -179
  19. package/CONTRIBUTING.md +93 -63
  20. package/README.md +160 -111
  21. package/__init__.py +61 -0
  22. package/bin/agentic-senior-core.js +41 -43
  23. package/commands/asc-audit.md +1 -0
  24. package/commands/asc-audit.toml +2 -0
  25. package/commands/asc-help.md +9 -0
  26. package/commands/asc-help.toml +2 -0
  27. package/commands/asc-refactor.md +1 -0
  28. package/commands/asc-refactor.toml +2 -0
  29. package/commands/asc-review.md +1 -0
  30. package/commands/asc-review.toml +2 -0
  31. package/gemini-extension.json +10 -0
  32. package/hooks/copilot-hooks.json +21 -0
  33. package/hooks/hooks.json +31 -0
  34. package/hooks/session-start.js +36 -0
  35. package/hooks/subagent-start.js +38 -0
  36. package/lib/cli/commands/adapter.mjs +109 -0
  37. package/lib/cli/commands/clean.mjs +63 -0
  38. package/lib/cli/commands/status.mjs +94 -0
  39. package/package.json +43 -67
  40. package/plugin.yaml +16 -0
  41. package/scripts/uninstall.js +38 -0
  42. package/skills/asc/SKILL.md +16 -0
  43. package/skills/asc-audit/SKILL.md +28 -0
  44. package/skills/asc-refactor/SKILL.md +35 -0
  45. package/skills/asc-review/SKILL.md +54 -0
  46. package/.agent-context/policies/llm-judge-threshold.json +0 -29
  47. package/.agent-context/prompts/bootstrap-design.md +0 -63
  48. package/.agent-context/prompts/compact-natural-mode.md +0 -100
  49. package/.agent-context/prompts/init-project.md +0 -60
  50. package/.agent-context/prompts/refactor.md +0 -38
  51. package/.agent-context/prompts/review-code.md +0 -31
  52. package/.agent-context/review-checklists/architecture-review.md +0 -57
  53. package/.agent-context/review-checklists/pr-checklist.md +0 -136
  54. package/.agent-context/rules/api-docs.md +0 -24
  55. package/.agent-context/rules/api-versioning.md +0 -16
  56. package/.agent-context/rules/architecture.md +0 -33
  57. package/.agent-context/rules/background-jobs.md +0 -17
  58. package/.agent-context/rules/config-and-flags.md +0 -16
  59. package/.agent-context/rules/database-design.md +0 -18
  60. package/.agent-context/rules/docker-runtime.md +0 -17
  61. package/.agent-context/rules/error-handling.md +0 -16
  62. package/.agent-context/rules/event-driven.md +0 -16
  63. package/.agent-context/rules/frontend-architecture.md +0 -54
  64. package/.agent-context/rules/microservices.md +0 -16
  65. package/.agent-context/rules/migrations.md +0 -16
  66. package/.agent-context/rules/observability.md +0 -16
  67. package/.agent-context/rules/performance.md +0 -16
  68. package/.agent-context/rules/realtime.md +0 -16
  69. package/.agent-context/rules/resilience.md +0 -18
  70. package/.agent-context/rules/security.md +0 -18
  71. package/.agent-context/rules/testing.md +0 -16
  72. package/.agent-context/state/README.md +0 -25
  73. package/.agent-context/state/architecture-map.md +0 -40
  74. package/.agent-context/state/benchmark-comparison-schema.json +0 -181
  75. package/.agent-context/state/benchmark-reproducibility.json +0 -87
  76. package/.agent-context/state/benchmark-thresholds.json +0 -10
  77. package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
  78. package/.agent-context/state/dependency-map.md +0 -41
  79. package/.agent-context/state/memory-adapter-contract.json +0 -52
  80. package/.agent-context/state/memory-schema-v1.json +0 -88
  81. package/GEMINI.md +0 -1
  82. package/benchmarks/README.md +0 -60
  83. package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
  84. package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
  85. package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
  86. package/lib/cli/adaptive-context/catalog.mjs +0 -390
  87. package/lib/cli/adaptive-context/file-signals.mjs +0 -100
  88. package/lib/cli/adaptive-context/implications.mjs +0 -44
  89. package/lib/cli/adaptive-context.mjs +0 -365
  90. package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
  91. package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
  92. package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
  93. package/lib/cli/audits/typography-palette-anti-repeat-audit.mjs +0 -239
  94. package/lib/cli/backup.mjs +0 -210
  95. package/lib/cli/commands/audit-design-anti-repeat.mjs +0 -39
  96. package/lib/cli/commands/context.mjs +0 -140
  97. package/lib/cli/commands/init/project-context.mjs +0 -60
  98. package/lib/cli/commands/init/runtime-environment.mjs +0 -59
  99. package/lib/cli/commands/init/setup-decisions.mjs +0 -83
  100. package/lib/cli/commands/init.mjs +0 -654
  101. package/lib/cli/commands/launch.mjs +0 -76
  102. package/lib/cli/commands/optimize.mjs +0 -284
  103. package/lib/cli/commands/rollback.mjs +0 -64
  104. package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
  105. package/lib/cli/commands/upgrade.mjs +0 -451
  106. package/lib/cli/compiler.mjs +0 -570
  107. package/lib/cli/constants.mjs +0 -136
  108. package/lib/cli/detector/constants.mjs +0 -135
  109. package/lib/cli/detector/design-evidence/collector.mjs +0 -256
  110. package/lib/cli/detector/design-evidence/constants.mjs +0 -39
  111. package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
  112. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
  113. package/lib/cli/detector/design-evidence/summary.mjs +0 -109
  114. package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
  115. package/lib/cli/detector/design-evidence.mjs +0 -25
  116. package/lib/cli/detector/stack-detection.mjs +0 -243
  117. package/lib/cli/detector/ui-signals.mjs +0 -150
  118. package/lib/cli/detector/workspace-scan.mjs +0 -177
  119. package/lib/cli/detector.mjs +0 -23
  120. package/lib/cli/init-detection-flow.mjs +0 -48
  121. package/lib/cli/init-options.mjs +0 -237
  122. package/lib/cli/init-selection.mjs +0 -29
  123. package/lib/cli/memory-continuity.mjs +0 -537
  124. package/lib/cli/preflight.mjs +0 -76
  125. package/lib/cli/project-scaffolder/constants.mjs +0 -69
  126. package/lib/cli/project-scaffolder/discovery.mjs +0 -272
  127. package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
  128. package/lib/cli/project-scaffolder/storage.mjs +0 -144
  129. package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
  130. package/lib/cli/project-scaffolder.mjs +0 -29
  131. package/lib/cli/rollback.mjs +0 -66
  132. package/lib/cli/token-optimization.mjs +0 -486
  133. package/lib/cli/utils/filesystem.mjs +0 -81
  134. package/lib/cli/utils/managed-surface.mjs +0 -280
  135. package/lib/cli/utils/prompting.mjs +0 -44
  136. package/lib/cli/utils.mjs +0 -479
  137. package/mcp.json +0 -134
  138. package/scripts/adaptive-context/fixtures.mjs +0 -183
  139. package/scripts/adaptive-context-benchmark.mjs +0 -9
  140. package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
  141. package/scripts/audit-cache-layer-contract.mjs +0 -263
  142. package/scripts/audit-caching-scope-hygiene.mjs +0 -268
  143. package/scripts/audit-file-size.mjs +0 -219
  144. package/scripts/audit-reflection-citations.mjs +0 -163
  145. package/scripts/audit-release-bundle.mjs +0 -170
  146. package/scripts/audit-rule-id-uniqueness.mjs +0 -313
  147. package/scripts/audit-typography-palette-anti-repeat.mjs +0 -120
  148. package/scripts/benchmark-evidence-bundle.mjs +0 -645
  149. package/scripts/benchmark-gate.mjs +0 -121
  150. package/scripts/benchmark-intelligence.mjs +0 -33
  151. package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
  152. package/scripts/build-release-benchmark-bundle.mjs +0 -202
  153. package/scripts/bump-version.mjs +0 -103
  154. package/scripts/clean-local-artifacts.mjs +0 -78
  155. package/scripts/compact-natural-mode-benchmark.mjs +0 -9
  156. package/scripts/context-triggered-audit.mjs +0 -391
  157. package/scripts/detection-benchmark.mjs +0 -127
  158. package/scripts/docs-quality-drift-report.mjs +0 -358
  159. package/scripts/documentation-boundary-audit.mjs +0 -305
  160. package/scripts/explain-on-demand-audit.mjs +0 -427
  161. package/scripts/forbidden-content-check.mjs +0 -123
  162. package/scripts/frontend-usability-audit.mjs +0 -243
  163. package/scripts/generate-sbom.mjs +0 -61
  164. package/scripts/governance-weekly-report.mjs +0 -466
  165. package/scripts/llm-judge/checklist-loader.mjs +0 -45
  166. package/scripts/llm-judge/constants.mjs +0 -66
  167. package/scripts/llm-judge/diff-collection.mjs +0 -74
  168. package/scripts/llm-judge/prompting.mjs +0 -78
  169. package/scripts/llm-judge/providers.mjs +0 -111
  170. package/scripts/llm-judge/verdict.mjs +0 -134
  171. package/scripts/llm-judge.mjs +0 -200
  172. package/scripts/memory-continuity-benchmark.mjs +0 -322
  173. package/scripts/quality-trend-report.mjs +0 -289
  174. package/scripts/release-gate/audit-checks.mjs +0 -441
  175. package/scripts/release-gate/constants.mjs +0 -53
  176. package/scripts/release-gate/runtime.mjs +0 -63
  177. package/scripts/release-gate/static-checks.mjs +0 -182
  178. package/scripts/release-gate.mjs +0 -42
  179. package/scripts/rules-guardian-audit.mjs +0 -580
  180. package/scripts/single-source-lazy-loading-audit.mjs +0 -449
  181. package/scripts/sync-thin-adapters.mjs +0 -72
  182. package/scripts/token-optimization-benchmark.mjs +0 -252
  183. package/scripts/ui-design-judge/constants.mjs +0 -13
  184. package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
  185. package/scripts/ui-design-judge/git-input.mjs +0 -134
  186. package/scripts/ui-design-judge/prompting.mjs +0 -52
  187. package/scripts/ui-design-judge/providers.mjs +0 -102
  188. package/scripts/ui-design-judge/reporting.mjs +0 -183
  189. package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
  190. package/scripts/ui-design-judge/rubric-goldset.json +0 -188
  191. package/scripts/ui-design-judge.mjs +0 -319
  192. package/scripts/ui-rubric-calibration.mjs +0 -35
  193. package/scripts/validate/config.mjs +0 -519
  194. package/scripts/validate/coverage-checks.mjs +0 -446
  195. package/scripts/validate/file-structure.mjs +0 -162
  196. package/scripts/validate/markdown-content.mjs +0 -109
  197. package/scripts/validate/project-metadata.mjs +0 -166
  198. package/scripts/validate.mjs +0 -338
@@ -1,33 +1,45 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Agentic-Senior-Core CLI — Thin entry point.
3
+ * Agentic-Senior-Core CLI v5 -- Universal plugin system.
4
4
  *
5
- * All logic lives in lib/cli/ modules. This file only handles
6
- * argument dispatch and the top-level error boundary.
5
+ * Commands:
6
+ * adapter Generate instruction-tier adapter files for IDEs without plugin support
7
+ * clean Remove v4 per-project artifacts (.agent-context/, bridge files)
8
+ * status Show detected IDEs and install hints
9
+ * mcp Start MCP stdio server
7
10
  */
8
11
  import { exit } from 'node:process';
12
+ import { readFileSync } from 'node:fs';
13
+ import { resolve, dirname } from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
9
15
 
10
- import { CLI_VERSION } from '../lib/cli/constants.mjs';
11
- import { printUsage } from '../lib/cli/utils.mjs';
12
- import { runLaunchCommand } from '../lib/cli/commands/launch.mjs';
13
- import { runRollbackCommand } from '../lib/cli/commands/rollback.mjs';
14
- import { runMcpServerCommand } from '../lib/cli/commands/mcp.mjs';
15
- import { runOptimizeCommand, parseOptimizeArguments } from '../lib/cli/commands/optimize.mjs';
16
- import { runInitCommand, parseInitArguments } from '../lib/cli/commands/init.mjs';
17
- import { runUpgradeCommand, parseUpgradeArguments } from '../lib/cli/commands/upgrade.mjs';
18
- import { runContextCommand } from '../lib/cli/commands/context.mjs';
19
- import { runDesignAntiRepeatAuditCommand } from '../lib/cli/commands/audit-design-anti-repeat.mjs';
16
+ const currentFilePath = fileURLToPath(import.meta.url);
17
+ const repositoryRoot = resolve(dirname(currentFilePath), '..');
18
+ const packageJson = JSON.parse(readFileSync(resolve(repositoryRoot, 'package.json'), 'utf8'));
19
+ const CLI_VERSION = packageJson.version;
20
+
21
+ function printUsage() {
22
+ console.log(`Agentic-Senior-Core CLI v${CLI_VERSION}`);
23
+ console.log('Universal AI coding rules. Write code like a staff engineer.\n');
24
+ console.log('Plugin install (always-on, no per-project files):');
25
+ console.log(' Claude Code: /plugin marketplace add fatidaprilian/Agentic-Senior-Core');
26
+ console.log(' Codex CLI: codex plugins install agentic-senior-core\n');
27
+ console.log('Adapter install (one file per project):');
28
+ console.log(' asc adapter --cursor --windsurf --cline --copilot --kiro --all\n');
29
+ console.log('Commands:');
30
+ console.log(' adapter Generate instruction-tier adapter files');
31
+ console.log(' clean Remove v4 per-project artifacts');
32
+ console.log(' status Show detected IDEs and install hints');
33
+ console.log(' mcp Start MCP stdio server');
34
+ console.log(' --version Show version');
35
+ console.log(' --help Show this help');
36
+ }
20
37
 
21
38
  async function main() {
22
39
  const commandArgument = process.argv[2];
23
40
  const commandArguments = process.argv.slice(3);
24
41
 
25
- if (!commandArgument || commandArgument === 'launch') {
26
- await runLaunchCommand();
27
- return;
28
- }
29
-
30
- if (commandArgument === '--help' || commandArgument === '-h') {
42
+ if (!commandArgument || commandArgument === '--help' || commandArgument === '-h') {
31
43
  printUsage();
32
44
  return;
33
45
  }
@@ -37,44 +49,30 @@ async function main() {
37
49
  return;
38
50
  }
39
51
 
40
- if (commandArgument === 'upgrade') {
41
- const upgradeOptions = parseUpgradeArguments(commandArguments);
42
- await runUpgradeCommand(upgradeOptions.targetDirectory, upgradeOptions);
52
+ if (commandArgument === 'adapter') {
53
+ const { runAdapterCommand } = await import('../lib/cli/commands/adapter.mjs');
54
+ await runAdapterCommand(commandArguments);
43
55
  return;
44
56
  }
45
57
 
46
- if (commandArgument === 'optimize') {
47
- const optimizeOptions = parseOptimizeArguments(commandArguments);
48
- await runOptimizeCommand(optimizeOptions.targetDirectory, optimizeOptions);
58
+ if (commandArgument === 'clean') {
59
+ const { runCleanCommand } = await import('../lib/cli/commands/clean.mjs');
60
+ await runCleanCommand(commandArguments);
49
61
  return;
50
62
  }
51
63
 
52
- if (commandArgument === 'context') {
53
- await runContextCommand(commandArguments);
54
- return;
55
- }
56
-
57
- if (commandArgument === 'init') {
58
- const initOptions = parseInitArguments(commandArguments);
59
- await runInitCommand(initOptions.targetDirectory, initOptions);
60
- return;
61
- }
62
-
63
- if (commandArgument === 'rollback') {
64
- await runRollbackCommand(commandArguments);
64
+ if (commandArgument === 'status') {
65
+ const { runStatusCommand } = await import('../lib/cli/commands/status.mjs');
66
+ await runStatusCommand();
65
67
  return;
66
68
  }
67
69
 
68
70
  if (commandArgument === 'mcp') {
71
+ const { runMcpServerCommand } = await import('../lib/cli/commands/mcp.mjs');
69
72
  await runMcpServerCommand();
70
73
  return;
71
74
  }
72
75
 
73
- if (commandArgument === 'audit:design-anti-repeat') {
74
- const auditExitCode = await runDesignAntiRepeatAuditCommand(commandArguments);
75
- exit(auditExitCode);
76
- }
77
-
78
76
  console.error(`Unknown command: ${commandArgument}`);
79
77
  printUsage();
80
78
  exit(1);
@@ -0,0 +1 @@
1
+ Run the security and architecture audit from skills/asc-audit/SKILL.md. Examine trust boundaries, auth, data handling, architecture boundaries, dependency health, and error exposure. Report findings with severity, evidence, and remediation.
@@ -0,0 +1,2 @@
1
+ description = "Security and architecture audit"
2
+ prompt = "Load and follow the asc-audit skill. Audit trust boundaries, auth/authz, data handling, architecture boundaries, dependency health, and error exposure. For every finding report severity (critical/high/medium/low), vulnerability class, location, impact, evidence, remediation, and validation steps. Findings ordered by severity."
@@ -0,0 +1,9 @@
1
+ Show available Agentic Senior Core commands and skills.
2
+
3
+ Available commands:
4
+ - /asc-refactor -- Structured refactoring workflow
5
+ - /asc-review -- Production-risk code review
6
+ - /asc-audit -- Security and architecture audit
7
+ - /asc-help -- This help
8
+
9
+ The universal coding rules from AGENTS.md are always active. Skills provide deeper, on-demand workflows.
@@ -0,0 +1,2 @@
1
+ description = "Show available Agentic Senior Core commands"
2
+ prompt = "Show the Agentic Senior Core command reference: /asc-refactor (structured refactoring workflow), /asc-review (production-risk code review with severity-ordered findings), /asc-audit (security and architecture audit), /asc-help (this help). ASC loads universal engineering rules covering code quality, architecture, security, error handling, testing, API design, database, frontend, infrastructure, resilience, and async patterns."
@@ -0,0 +1 @@
1
+ Run the refactoring workflow from skills/asc-refactor/SKILL.md on the current code changes or specified files. Preserve existing behavior while improving structure, naming, boundaries, and maintainability.
@@ -0,0 +1,2 @@
1
+ description = "Structured refactoring workflow with pre-checks and validation"
2
+ prompt = "Load and follow the asc-refactor skill. Read the target code, identify the smallest scope, apply refactor rules: improve clarity, boundaries, naming, validation, error handling, tests. Prioritize maintainability over compressed one-liners. No premature abstractions. Run a final simplification pass. For every change explain what risk existed, what changed, and why the new shape is safer."
@@ -0,0 +1 @@
1
+ Run the code review workflow from skills/asc-review/SKILL.md on the current diff or specified files. Prioritize findings by severity: correctness and security first, then contracts, tests, architecture, and performance.
@@ -0,0 +1,2 @@
1
+ description = "Production-risk code review with severity-ordered findings"
2
+ prompt = "Load and follow the asc-review skill. Review changed files for production risks. Priority order: correctness/data-loss/security, public contract drift, missing tests, architecture boundary drift, performance/accessibility with concrete impact. For every finding include file/line reference, real risk, and smallest safe fix. Report findings ordered by severity."
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "agentic-senior-core",
3
+ "version": "5.1.0",
4
+ "description": "Universal AI coding rules. Write code like a staff engineer.",
5
+ "author": "fatidaprilian",
6
+ "license": "MIT",
7
+ "contextFileName": "AGENTS.md",
8
+ "commands": ["commands/"],
9
+ "skills": ["skills/"]
10
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "sessionStart": [
5
+ {
6
+ "type": "command",
7
+ "bash": "node \"${PLUGIN_ROOT}/hooks/session-start.js\"",
8
+ "powershell": "node \"${PLUGIN_ROOT}\\hooks\\session-start.js\"",
9
+ "timeoutSec": 5
10
+ }
11
+ ],
12
+ "subagentStart": [
13
+ {
14
+ "type": "command",
15
+ "bash": "node \"${PLUGIN_ROOT}/hooks/subagent-start.js\"",
16
+ "powershell": "node \"${PLUGIN_ROOT}\\hooks\\subagent-start.js\"",
17
+ "timeoutSec": 5
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|resume|clear|compact",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.js\"; exit 0",
10
+ "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\session-start.js\" }",
11
+ "timeout": 5,
12
+ "statusMessage": "Loading ASC rules..."
13
+ }
14
+ ]
15
+ }
16
+ ],
17
+ "SubagentStart": [
18
+ {
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/subagent-start.js\"; exit 0",
23
+ "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\subagent-start.js\" }",
24
+ "timeout": 5,
25
+ "statusMessage": "Loading ASC rules..."
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ // Agentic Senior Core — SessionStart hook
3
+ // Injects universal coding rules on every session start.
4
+ // Supports Claude Code, Codex CLI, and GitHub Copilot CLI.
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || path.resolve(__dirname, '..');
10
+ const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
11
+ const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
12
+
13
+ let content;
14
+ try {
15
+ content = fs.readFileSync(path.join(pluginRoot, 'AGENTS.md'), 'utf8');
16
+ } catch (e) {
17
+ process.exit(0);
18
+ }
19
+
20
+ try {
21
+ if (isCopilot) {
22
+ process.stdout.write(JSON.stringify({ additionalContext: content }));
23
+ } else if (isCodex) {
24
+ process.stdout.write(JSON.stringify({
25
+ systemMessage: 'ASC:ACTIVE',
26
+ hookSpecificOutput: {
27
+ hookEventName: 'SessionStart',
28
+ additionalContext: content,
29
+ },
30
+ }));
31
+ } else {
32
+ process.stdout.write(content);
33
+ }
34
+ } catch (e) {
35
+ // Silent fail — stdout closed/EPIPE at hook exit must not surface as a hook failure
36
+ }
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ // Agentic Senior Core — SubagentStart hook
3
+ // SessionStart context is parent-thread only and never reaches subagents.
4
+ // This injects the same ruleset into each subagent.
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || path.resolve(__dirname, '..');
10
+ const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
11
+ const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
12
+
13
+ let content;
14
+ try {
15
+ content = fs.readFileSync(path.join(pluginRoot, 'AGENTS.md'), 'utf8');
16
+ } catch (e) {
17
+ process.exit(0);
18
+ }
19
+
20
+ try {
21
+ if (isCodex) {
22
+ process.stdout.write(JSON.stringify({
23
+ hookSpecificOutput: {
24
+ hookEventName: 'SubagentStart',
25
+ additionalContext: content,
26
+ },
27
+ }));
28
+ } else {
29
+ process.stdout.write(JSON.stringify({
30
+ hookSpecificOutput: {
31
+ hookEventName: 'SubagentStart',
32
+ additionalContext: content,
33
+ },
34
+ }));
35
+ }
36
+ } catch (e) {
37
+ // Silent fail
38
+ }
@@ -0,0 +1,109 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const currentFilePath = fileURLToPath(import.meta.url);
6
+ const currentDirectoryPath = path.dirname(currentFilePath);
7
+ const REPOSITORY_ROOT = path.resolve(currentDirectoryPath, '..', '..', '..');
8
+
9
+ const ADAPTER_TARGETS = {
10
+ cursor: {
11
+ label: 'Cursor',
12
+ targetPath: '.cursor/rules/agentic-senior-core.mdc',
13
+ sourcePath: '.cursor/rules/agentic-senior-core.mdc',
14
+ },
15
+ windsurf: {
16
+ label: 'Windsurf',
17
+ targetPath: '.windsurf/rules/agentic-senior-core.md',
18
+ sourcePath: '.windsurf/rules/agentic-senior-core.md',
19
+ },
20
+ cline: {
21
+ label: 'Cline',
22
+ targetPath: '.clinerules/agentic-senior-core.md',
23
+ sourcePath: '.clinerules/agentic-senior-core.md',
24
+ },
25
+ copilot: {
26
+ label: 'GitHub Copilot',
27
+ targetPath: '.github/copilot-instructions.md',
28
+ sourcePath: '.github/copilot-instructions.md',
29
+ },
30
+ kiro: {
31
+ label: 'Kiro',
32
+ targetPath: '.kiro/steering/agentic-senior-core.md',
33
+ sourcePath: '.kiro/steering/agentic-senior-core.md',
34
+ },
35
+ };
36
+
37
+ async function pathExists(filePath) {
38
+ try {
39
+ await fs.access(filePath);
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ async function generateAdapter(targetDirectory, adapterKey) {
47
+ const adapter = ADAPTER_TARGETS[adapterKey];
48
+ if (!adapter) {
49
+ console.error(`Unknown adapter: ${adapterKey}. Available: ${Object.keys(ADAPTER_TARGETS).join(', ')}`);
50
+ return false;
51
+ }
52
+
53
+ const sourcePath = path.join(REPOSITORY_ROOT, adapter.sourcePath);
54
+ const targetPath = path.join(targetDirectory, adapter.targetPath);
55
+ const targetDir = path.dirname(targetPath);
56
+
57
+ if (!(await pathExists(sourcePath))) {
58
+ console.error(`Adapter source not found: ${sourcePath}`);
59
+ return false;
60
+ }
61
+
62
+ await fs.mkdir(targetDir, { recursive: true });
63
+ await fs.copyFile(sourcePath, targetPath);
64
+ console.log(` ${adapter.label}: ${adapter.targetPath} ... OK`);
65
+ return true;
66
+ }
67
+
68
+ export async function runAdapterCommand(commandArguments) {
69
+ const targetDirectory = process.cwd();
70
+ const requestedAdapters = [];
71
+
72
+ for (const argument of commandArguments) {
73
+ if (argument === '--all') {
74
+ requestedAdapters.push(...Object.keys(ADAPTER_TARGETS));
75
+ break;
76
+ }
77
+
78
+ const adapterKey = argument.replace(/^--/, '');
79
+ if (ADAPTER_TARGETS[adapterKey]) {
80
+ requestedAdapters.push(adapterKey);
81
+ } else if (argument.startsWith('--')) {
82
+ console.error(`Unknown option: ${argument}`);
83
+ console.log(`Available adapters: ${Object.keys(ADAPTER_TARGETS).map(k => `--${k}`).join(', ')}, --all`);
84
+ process.exit(1);
85
+ }
86
+ }
87
+
88
+ if (requestedAdapters.length === 0) {
89
+ console.log('Agentic Senior Core -- Adapter Generator\n');
90
+ console.log('Usage: asc adapter [--cursor] [--windsurf] [--cline] [--copilot] [--kiro] [--all]\n');
91
+ console.log('Generates instruction-tier adapter files for IDEs without plugin support.');
92
+ console.log('Each adapter is a single file containing the universal coding rules.\n');
93
+ console.log('Available adapters:');
94
+ for (const [key, adapter] of Object.entries(ADAPTER_TARGETS)) {
95
+ console.log(` --${key.padEnd(10)} ${adapter.label.padEnd(20)} -> ${adapter.targetPath}`);
96
+ }
97
+ return;
98
+ }
99
+
100
+ console.log('Agentic Senior Core -- Generating adapters\n');
101
+
102
+ let successCount = 0;
103
+ for (const adapterKey of requestedAdapters) {
104
+ const success = await generateAdapter(targetDirectory, adapterKey);
105
+ if (success) successCount++;
106
+ }
107
+
108
+ console.log(`\n${successCount}/${requestedAdapters.length} adapter(s) generated.`);
109
+ }
@@ -0,0 +1,63 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+
4
+ const V4_ARTIFACTS = [
5
+ '.agent-context',
6
+ 'AGENTS.md',
7
+ 'CLAUDE.md',
8
+ 'GEMINI.md',
9
+ 'STAGE-CHECKPOINT.md',
10
+ 'mcp.json',
11
+ 'validate_output.txt',
12
+ 'release-gate-report.json',
13
+ ];
14
+
15
+ async function pathExists(filePath) {
16
+ try {
17
+ await fs.access(filePath);
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ export async function runCleanCommand(commandArguments) {
25
+ const targetDirectory = process.cwd();
26
+ const dryRun = commandArguments.includes('--dry-run');
27
+
28
+ console.log('Agentic Senior Core -- Clean v4 artifacts\n');
29
+ console.log(`Target: ${targetDirectory}`);
30
+ if (dryRun) console.log('Mode: dry-run (no files will be deleted)\n');
31
+ else console.log('');
32
+
33
+ let found = 0;
34
+ let removed = 0;
35
+
36
+ for (const artifact of V4_ARTIFACTS) {
37
+ const fullPath = path.join(targetDirectory, artifact);
38
+ if (!(await pathExists(fullPath))) continue;
39
+
40
+ found++;
41
+ const stat = await fs.stat(fullPath);
42
+ const label = stat.isDirectory() ? `${artifact}/` : artifact;
43
+
44
+ if (dryRun) {
45
+ console.log(` would remove: ${label}`);
46
+ } else {
47
+ await fs.rm(fullPath, { recursive: true, force: true });
48
+ console.log(` removed: ${label}`);
49
+ removed++;
50
+ }
51
+ }
52
+
53
+ if (found === 0) {
54
+ console.log('No v4 artifacts found. This project is clean.');
55
+ return;
56
+ }
57
+
58
+ if (dryRun) {
59
+ console.log(`\n${found} artifact(s) found. Run without --dry-run to remove.`);
60
+ } else {
61
+ console.log(`\n${removed} artifact(s) removed.`);
62
+ }
63
+ }
@@ -0,0 +1,94 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import os from 'node:os';
4
+
5
+ const HOME = os.homedir();
6
+
7
+ const IDE_CHECKS = [
8
+ {
9
+ name: 'Claude Code',
10
+ type: 'plugin',
11
+ checkPaths: [
12
+ path.join(HOME, '.claude'),
13
+ ],
14
+ installHint: '/plugin marketplace add fatidaprilian/Agentic-Senior-Core',
15
+ },
16
+ {
17
+ name: 'Codex CLI',
18
+ type: 'plugin',
19
+ checkPaths: [
20
+ path.join(HOME, '.codex'),
21
+ ],
22
+ installHint: 'codex plugins install agentic-senior-core',
23
+ },
24
+ {
25
+ name: 'Gemini CLI',
26
+ type: 'plugin',
27
+ checkPaths: [
28
+ path.join(HOME, '.gemini'),
29
+ ],
30
+ installHint: 'Auto-detected via gemini-extension.json',
31
+ },
32
+ {
33
+ name: 'Cursor',
34
+ type: 'adapter',
35
+ checkPaths: [
36
+ path.join(HOME, '.cursor'),
37
+ path.join(HOME, 'AppData', 'Roaming', 'Cursor'),
38
+ path.join(HOME, '.config', 'Cursor'),
39
+ ],
40
+ installHint: 'asc adapter --cursor',
41
+ },
42
+ {
43
+ name: 'Windsurf',
44
+ type: 'adapter',
45
+ checkPaths: [
46
+ path.join(HOME, '.codeium'),
47
+ path.join(HOME, '.windsurf'),
48
+ ],
49
+ installHint: 'asc adapter --windsurf',
50
+ },
51
+ {
52
+ name: 'Cline',
53
+ type: 'adapter',
54
+ checkPaths: [
55
+ path.join(HOME, 'Documents', 'Cline'),
56
+ path.join(HOME, '.cline'),
57
+ ],
58
+ installHint: 'asc adapter --cline',
59
+ },
60
+ ];
61
+
62
+ async function pathExists(filePath) {
63
+ try {
64
+ await fs.access(filePath);
65
+ return true;
66
+ } catch {
67
+ return false;
68
+ }
69
+ }
70
+
71
+ export async function runStatusCommand() {
72
+ console.log('Agentic Senior Core -- IDE Status\n');
73
+
74
+ for (const ide of IDE_CHECKS) {
75
+ let detected = false;
76
+ for (const checkPath of ide.checkPaths) {
77
+ if (await pathExists(checkPath)) {
78
+ detected = true;
79
+ break;
80
+ }
81
+ }
82
+
83
+ const icon = detected ? '[x]' : '[ ]';
84
+ const support = ide.type === 'plugin' ? '(plugin)' : '(adapter)';
85
+ console.log(` ${icon} ${ide.name.padEnd(15)} ${support.padEnd(10)} ${detected ? 'detected' : 'not found'}`);
86
+
87
+ if (detected) {
88
+ console.log(` Install: ${ide.installHint}`);
89
+ }
90
+ }
91
+
92
+ console.log('\nPlugin hosts get always-on rules via SessionStart hook.');
93
+ console.log('Adapter hosts need one file per project via "asc adapter".');
94
+ }